Skip to content
Programmingoneonone
Programmingoneonone
  • Engineering Subjects
    • Internet of Things (IoT)
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
    • 100+ C++ Programs
  • Solutions
    • HackerRank
      • Algorithms Solutions
      • C solutions
      • C++ solutions
      • Java solutions
      • Python solutions
    • Leetcode Solutions
    • HackerEarth Solutions
  • Work with US
Programmingoneonone
Programmingoneonone

HackerEarth Roy and Profile Picture problem solution

YASH PAL, 31 July 202413 February 2026
In this HackerEarth Roy and Profile Picture problem solution, Roy wants to change his profile picture on Facebook. Now Facebook has some restrictions over the dimension of pictures that we can upload.
The minimum dimension of the picture can be L x L, where L is the length of the side of the square.
 
Now Roy has N photos of various dimensions.
Dimension of a photo is denoted as W x H
where W – width of the photo and H – Height of the photo
 
When any photo is uploaded following events may occur:
 
[1] If any of the width or height is less than L, user is prompted to upload another one. Print “UPLOAD ANOTHER” in this case.
[2] If width and height, both are large enough and
(a) if the photo is already square then it is accepted. Print “ACCEPTED” in this case.
(b) else user is prompted to crop it. Print “CROP IT” in this case.
 
Given L, N, W and H as input, print appropriate text as output.
 
hackerEarth Roy and Profile Picture problem solution

 

 

HackerEarth Roy and Profile Picture problem solution.

def roy_and_profile_pic():
L = input()
N = input()
for t in xrange(N):
W,H = map(int,raw_input().split())
if W < L or H < L:
print 'UPLOAD ANOTHER'
else:
if W == H:
print 'ACCEPTED'
else:
print 'CROP IT'
roy_and_profile_pic()
 

second solution

l=input()
n=input()
for i in range(n):
x=raw_input()
y=x.split()
w=int(y[0])
h=int(y[1])
if w<l or h<l: print "UPLOAD ANOTHER"
elif w==h: print "ACCEPTED"
else: print "CROP IT"

 

 
 
coding problems solutions HackerEarth HackerEarth

Post navigation

Previous post
Next post

Leave a Reply

Your email address will not be published. Required fields are marked *

Programmingoneonone

We at Programmingoneonone, also known as Programming101 is a learning hub of programming and other related stuff. We provide free learning tutorials/articles related to programming and other technical stuff to people who are eager to learn about it.

Pages

  • About US
  • Contact US
  • Privacy Policy

Practice

  • Java
  • C++
  • C

Follow US

  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2026 Programmingoneonone | WordPress Theme by SuperbThemes