akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

using ll = long long;
using ull = unsigned long long;
using vl = vector<ll>;
using vi = vector<int>;
using vchar = vector<char>;
using vstr = vector<string>;
using pll =  pair<ll,ll>;

const ll mod = 1000000007;
const ll inf = 1000000000000000;

#define pi acos(-1)
#define pb push_back
#define test int TEST;cin>>TEST;while(TEST--)
#define vsort(xx) sort(xx.begin(),xx.end())
#define vrevsort(xx) sort(xx.rbegin(),xx.rend())


int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);   
   int h,w,i;
   vector<string> a;
   cin>>h>>w;
   string s;
   for(i=0;i<h;i++){
       cin>>s;a.pb(s);
   }
   for(i=0;i<w+2;i++) cout<<"#";
   cout<<"\n";
   for(i=0;i<h;i++){
       cout<<"#";
       cout<<a[i];
       cout<<"#\n";
   }
   for(i=0;i<w+2;i++) cout<<"#";
    
   
    return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a[3]; for(int i = 0; i < 3; ++i) cin >> a[i];
    sort(a, a + 3);

    cout << abs(a[1] - a[2]) + abs(a[0] - a[1]);
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
# define ll long long
# define mo 1000000009
using namespace std;
int main()
{
    ll n,a,b;
    cin>>n>>a>>b;
    ll ans,y;
    if(a==0&&b==0)
    ans=0;
    else{
    ll x=n%(a+b);
    n=n-x;
    ll z=n/(a+b);
    if(x<=a)
    y=x;
    else
    y=a;
    ans=z*a+y;;}
    cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() { 
    int a,b,c;

    vector<int> arr(3,0);

    for(int i=0;i<3;i++){
    	cin >> arr[i];
    }

    for(int i=0;i<2;i++){
    	if(arr[i] >= arr[i+1]){
    		cout << "No" << endl;
    		return 0;
    	}
    }

    cout << "Yes" << endl;
    


    return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)
int n,m;
string s,t,ans="|";

bool bg(int i){
  if(m+i>n) return 0;
  fr(j,m) if(s[i+j]!='?'&&s[i+j]!=t[j]) return 0;
  return 1;
}

string nw(int i){
  string ns="";
  fr(j,n){
    if(i<=j&&j<i+m) ns+=t[j-i];
    else{
      if(s[j]=='?') ns+='a';
      else ns+=s[j];
    }
  }
  return ns;
}

int main(){
  cin>>s>>t;
  n=s.length();m=t.length();
  fr(i,n) if(bg(i)&&ans>nw(i)) ans=nw(i);
  if(ans=="|") cout<<"UNRESTORABLE"<<endl;
  else cout<<ans<<endl;
}

Measured memory_bytes: 256
import bisect
n,m = map(int,input().split())
x = [list() for i in range(n)]
p = []
y = []
for i in range(m):
  s,t = map(int,input().split())
  p.append(s)
  y.append(t)
  x[s-1].append(t)
for i in range(n):
  x[i].sort()
  
for i in range(m):
  index = bisect.bisect_left(x[p[i]-1],y[i])
  print("{:06}{:06}".format(p[i],index+1))


Measured memory_bytes: 94048
#include <iostream>
#include <cstdio>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <string>
#include <algorithm>

using namespace std;

int main (int argc, char *argv[]) {
    int m, n_min, n_max, p;
 
    while (cin>>m>>n_min>>n_max, m||n_min||n_max) {
        vector<int> v;
        for (int i = 0; i < m; ++i) {
            cin>>p;
            v.push_back(p);
        }
        sort(v.begin(), v.end(), greater<int>());
        int diff = 0;
        int ans = 0;
        for (int i = n_max - 1; i >= n_min - 1; --i) {
            if (v[i] - v[i+1] > diff) {
                diff = v[i] - v[i+1];
                ans = i;
            }
        }
        cout<<ans+1<<endl;
    }
    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

#define ll long long
#define pint pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define mp make_pair
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(VECTOR) (VECTOR).begin(),(VECTOR).end()

int main(){

	int A, B, Q;
	vector<ll> S, T, X;
	ll s, t, x;

	cin >> A >> B >> Q;
	for(int i = 0; i < A; i ++){
		cin >> s;
		S.pb(s);
	}
	sort(all(S));
	for(int i = 0; i < B; i ++){
		cin >> t;
		T.pb(t);
	}
	sort(all(T));
	ll ans, tmp;
	for(int i = 0; i < Q; i ++){
		cin >> x;
		ans = 30000000005;
		tmp = 0;
		auto itrs = lower_bound(all(S), x);
		if(itrs == S.end())--itrs;
		tmp += abs(x - *itrs);
		auto itrt = lower_bound(all(T), *itrs);
		if(itrt == T.end())--itrt;
		tmp += abs(*itrs - *itrt);
		//cout << "1 ans = " << ans << ", tmp = " << tmp << endl;
		ans = min(ans, tmp);
		tmp -= abs(*itrs - *itrt);
		if(itrt != T.begin()){
			--itrt;
			tmp += abs(*itrs - *itrt);
			//cout << "2 ans = " << ans << ", tmp = " << tmp << endl;
			ans = min(ans, tmp);
			tmp -= abs(*itrs - *itrt);
		}
		tmp -= abs(x - *itrs);
		if(itrs == S.begin()){
			//cout << ans << endl << "###################" << endl;
			goto qwerty;
		}
		--itrs;
		tmp += abs(x - *itrs);
		itrt = lower_bound(all(T), *itrs);
		if(itrt == T.end())--itrt;
		tmp += abs(*itrs - *itrt);
		//cout << "3 ans = " << ans << ", tmp = " << tmp << endl;
		ans = min(ans, tmp);
		tmp -= abs(*itrs - *itrt);
		//if(itrt == T.begin())cout << "itrt == T.begin()" << endl;
		if(itrt != T.begin()){
			--itrt;
			tmp += abs(*itrs - *itrt);
			//cout << "4 ans = " << ans << ", tmp = " << tmp << endl;
			ans = min(ans, tmp);
			tmp -= abs(*itrs - *itrt);
		}
		//cout << ans << endl << "###################" << endl;
	qwerty:
		tmp = 0;
		itrt = lower_bound(all(T), x);
		if(itrt == T.end())--itrt;
		tmp += abs(x - *itrt);
		itrs = lower_bound(all(S), *itrt);
		if(itrs == S.end())--itrs;
		tmp += abs(*itrt - *itrs);
		ans = min(ans, tmp);
		tmp -= abs(*itrt - *itrs);
		if(itrs != S.begin()){
			--itrs;
			tmp += abs(*itrt - *itrs);
			ans = min(ans, tmp);
			tmp -= abs(*itrt - *itrs);
		}
		tmp -= abs(x - *itrt);
		if(itrt == T.begin()){
			goto fin;
		}
		--itrt;
		tmp += abs(x - *itrt);
		itrs = lower_bound(all(S), *itrt);
		if(itrs == S.end())--itrs;
		tmp += abs(*itrt - *itrs);
		ans = min(ans, tmp);
		tmp -= abs(*itrt - *itrs);
		if(itrs != S.begin()){
			--itrs;
			tmp += abs(*itrt - *itrs);
			ans = min(ans, tmp);
			tmp -= abs(*itrt - *itrs);
		}
	fin:
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3060
import bisect


def abc170c_forbidden_list():
    x, n = map(int, input().split())
    p = list(map(int, input().split()))
    if n == 0:
        print(x)
        return
    p.sort()
    for i in range(100):
        idx = bisect.bisect_left(p, x - i)
        if idx >= n or p[idx] != x - i:
            print(x - i)
            return
        idx = bisect.bisect_left(p, x + i)
        if idx >= n or p[idx] != x + i:
            print(x + i)
            return


abc170c_forbidden_list()

Measured memory_bytes: 9088
#pragma GCC optimize("Ofast")
  
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstring>
#include <string>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <unordered_set>
#include <list>
#include <tuple>
#include <iomanip>
#include <climits>
#include <cstdlib>
#include <cassert>
#include <numeric>
#include <math.h>
#include <bitset>
#include <random>
#include <regex>

using namespace std;
  
#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,f,n) for(int i=f;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(14)
#define int long long
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;
constexpr int dy[] = {0,1,0,-1,1,-1,-1,1};
constexpr int dx[] = {1,0,-1,0,1,1,-1,-1};
 
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class A, class B> inline A updiv(const A a,const B b){ return (a + b - 1) / b; }
template <class A, class B> inline A gcd(const A a,const B b){ return b ? gcd(b,a % b) : a; }
template <class A, class B> inline A lcm(const A a,const B b){ return a / gcd(a,b) * b; }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A,class B> using umap = unordered_map<A,B>;

int k;
vector<int> lunlun;

void dfs(int n){
    if(n >= 1e10) return;
    lunlun.emplace_back(n);
    int low = max(n % 10 - 1, 0ll), high = min(n % 10 + 1, 9ll);
    for(int i = low; i <= high; ++i){
        dfs(n * 10 + i);
    }
}

signed main(void){
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);

    cin >> k;
    
    for(int i = 1; i <= 9; ++i){
        dfs(i);
    }

    sort(all(lunlun));

    cout << lunlun[k-1] << '\n';

    return 0;
}

Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch Christmas | diff Christmas.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address Christmas.cpp && ./a.out

/*
 
 2/3/2019
 
 10:40-11:12 WA
 11:17 AC
 
 */

int N;
LL X;

const int MAX_N=52;
pair<LL,LL> dp[MAX_N];
pair<LL,LL> f(int x) {
  if(x==0) return dp[x]={1,1};
  auto p=f(x-1);
  LL a=2LL*p.first+1,b=2LL*p.second+3;
//  dump(x,a,b);
  return dp[x]={a,b};
}
LL g(LL x, int lv) {
  SMAX(x,0LL);
  SMIN(x,dp[lv].second);
  if(x==0) return 0;
  if(x==dp[lv].second) return dp[lv].first;
  --x;
//  LL l=g(min(max(0LL,x),dp[lv-1].second),lv-1);
  LL l=g(x,lv-1);
  x-=dp[lv-1].second;
  LL c=0;
  if(x>0) ++c;
  x--;
//  LL r=g(min(max(0LL,x),dp[lv-1].second),lv-1);
  LL r=g(x,lv-1);
//  dump(x,lv,dp[lv].second,l,c,r);
  return l+c+r;
}
void solve() {
  f(50);
  cout<<g(X,N)<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>X;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
import numpy as np
S = input()
n = len(S)
rl_li = []
for i in range(n-1):
    if S[i]+S[i+1]=='RL':
        rl_li.append(i) 

ans = [0] * n
rl_idx = 0
for i in range(n):
    rl = rl_li[rl_idx]
    distance = abs(i - rl)
    
    if distance % 2 == 0:
        ans[rl] += 1
    else:
        ans[rl+1] += 1
    
    if i == n-1:
        break
        
    if S[i] == 'L' and S[i+1] == 'R':
        rl_idx += 1

print(*ans)

Measured memory_bytes: 18628
#include<cstdio>
#define max(a,b) (a>b?a:b)
char s[105];
int main()
{
	int n;
	scanf("%d\n%s",&n,s+1);
	int pos=0,ans=0;
	for(int i=1;i<=n;i++){
		if(s[i]=='I'){
			pos++;
			ans=max(ans,pos);
		}else if(s[i]=='D'){
			pos--;
		}
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
n = gets.to_i
answers = []
(1..n).each do |i|
  next if i % 2 == 0
  count = 1
  (3..i).each do |j|
    next if j % 2 == 0
    count += 1 if i % j == 0
  end
  answers << i if count == 8
end

puts answers.count


Measured memory_bytes: 1788
#include<iostream>
#include<cstdio>
using namespace std;

int main(){
    int n, m, a, sum=0;
    scanf("%d%d", &n, &m);
    for(int i=1; i<=m; i++){
        scanf("%d", &a);
        sum+=a;
    }
    if(sum>n)
        printf("-1\n");
    else
        printf("%d\n", n-sum);
     return 0;
}


Measured memory_bytes: 3836
b = gets.chomp.split("")#.map(&:to_i)

fst = b[0]
snd = b[-1]
state = 0
cnt = 0

if fst == snd
  if b.size % 2 == 0
puts "First"
  else
puts "Second"
  end
exit
end

for i in 1..b.size-1
  #p state
  if b[i] == snd && state == 0
    cnt += 1
    state = 1
  elsif b[i] == fst && state == 1
    cnt += 1
    state = 0
  end
end

#p state, cnt

if (b.size - cnt) %2 == 0
  puts "First"
else
  puts "Second"
end


Measured memory_bytes: 7036
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>
#include <stack>
#include <bitset>

using namespace std;
typedef long long ll;

#define MAX_N 100
#define INF 1000000

int A[3][3];
int b[MAX_N];

int B[3][3];


bool judge() {

  if (B[0][0] + B[0][1] + B[0][2] == 3) return true;
  if (B[1][0] + B[1][1] + B[1][2] == 3) return true;
  if (B[2][0] + B[2][1] + B[2][2] == 3) return true;

  if (B[0][0] + B[1][0] + B[2][0] == 3) return true;
  if (B[0][1] + B[1][1] + B[2][1] == 3) return true;
  if (B[0][2] + B[1][2] + B[2][2] == 3) return true;

  if (B[0][0] + B[1][1] + B[2][2] == 3) return true;
  if (B[0][2] + B[1][1] + B[2][0] == 3) return true;

  return false;
  
}


int main() {

  // ---------------------
  // Input
  
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;

  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      cin >> A[i][j];

      B[i][j] = 0;
      
    }
  }

  cin >> N;  
  
  for (int i = 0; i < N; i++) {
    cin >> b[i];
  }

  // ---------------------
  // 

  for (int k = 0; k < N; k++) {

    for (int i = 0; i < 3; i++) {
      for (int j = 0; j < 3; j++) {
	if(A[i][j] == b[k]) B[i][j] = 1;
      }
    }
    
  }

  if(judge()) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
  
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

bool f(int x) {
  int digit = 0;
  while(x) {
    digit++;
    x /= 10;
  }
  return digit%2 == 1;
}

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  for(int i = 1; i <= n; i++) {
    if(f(i)) cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}
#ifdef __LOCAL
#define debug(x) cerr << __LINE__ << ": " << #x << " = " << x << endl
#define debugArray(x, n)                           \
  cerr << __LINE__ << ": " << #x << " = {";        \
  for (long long hoge = 0; (hoge) < (n); ++(hoge)) \
    cerr << ((hoge) ? "," : "") << x[hoge];        \
  cerr << "}" << endl
#else
#define debug(x) (void(0))
#define debugArray(x, n) (void(0))
#endif

signed main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> graph(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    graph[a].push_back(b);
    graph[b].push_back(a);
  }
  bool isok = false;
  auto check = [&](int v) {
    for (int u : graph[v])
      if (u == N - 1) return true;
    return false;
  };
  for (int v : graph[0]) isok |= check(v);
  cout << (isok ? "POSSIBLE" : "IMPOSSIBLE") << '\n';
  return 0;
}


Measured memory_bytes: 14936
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s,t;
    cin >> s >> t;
    reverse(s.begin(),s.end());
    cout << (s==t?"YES":"NO")<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;

int main()
{
	int n, k;
	string s;
	cin >> n >> k;
	cin >> s;


	vector<int> nums;
	int now = 1;
	int count = 0;
	for (int i = 0; i < n; i++) {
		if (s[i] == (char)('0' + now)) {
			count++;
		}
		else {
			nums.push_back(count);
			now = 1 - now;
			count = 1;
		}
	}
	if (count != 0) {
		nums.push_back(count);
	}
	if (nums.size() % 2 == 0) {
		nums.push_back(0);
	}
	/*
	for (int i = 0; i < nums.size(); i++) {
		cout << nums.at(i) << " ";
	}
	cout << endl;
	*/

	vector<int> sums;
	sums.push_back(0);
	for (int i = 0; i < nums.size(); i++) {
		sums.push_back(sums.at(i) + nums.at(i));
	}

	/*
	for (int i = 0; i < sums.size(); i++) {
		cout << sums.at(i) << " ";
	}
	cout << endl;
	*/

	int answer = 0;
	for (int i = 0; i < sums.size(); i += 2) {
		int left = i;
		int right = min((int)sums.size() - 1, i + k * 2 + 1);
		answer = max(answer, sums.at(right) - sums.at(left));
	}
	cout << answer << endl;
	return 0;
}


Measured memory_bytes: 1528
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{

    long long a, b;
    int i, gs = 0;
    int p[100];
    scanf("%lld%lld", &a, &b);
    long long n;
    n = __gcd(a, b);

    for (i = 2; i * i <= n; i++)
        if (n % i == 0)
        {
            p[gs++] = i;
            while (n % i == 0)
                n /= i;
        }
    if (n > 1)
        p[gs++] = n;
    gs++;
    printf("%d", gs);

    return 0;
}

Measured memory_bytes: 256
s=int(input())  #数値入力
f = s//100
l = s%100

# YY:0 both:1
def detect_yymm(num):
    if (num >=1) & (num <= 12):
        return 1
    else:
        return 0
    
if (detect_yymm(f) == 0) & (detect_yymm(l) == 1):
    print('YYMM')
elif (detect_yymm(f) == 1) & (detect_yymm(l) == 0):
    print('MMYY')
elif (detect_yymm(f) == 1) & (detect_yymm(l) == 1):
    print('AMBIGUOUS')
else:
    print('NA')

Measured memory_bytes: 3064
//
//  main.cpp
//  Rated for me
//
//  Created by Kazumichi Yagi on 2018/08/22.
//  Copyright © 2018 Kazumichi Yagi. All rights reserved.
//

#include <iostream>

int main(){
    
    int R ;
    
    std::cin >> R;
    if(R >= 0 && R < 1200){
        std::cout << "ABC" << std::endl;
    }else if (R >= 1200 && R < 2800){
        std::cout << "ARC" << std::endl;
    }else if (R >= 2800 && R <= 4208){
        std::cout << "AGC" << std::endl;
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>

#define REP(i, x) REPI(i, 0, x)
#define REPI(i, a, b) for (int i = int(a); i < int(b); ++i)
#define ALL(x) (x).begin(), (x).end()

typedef long long ll;
using namespace std;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  long double A, B, N;
  cin >> A >> B >> N;
  // long double ans = 0;
  long double a_b = A / B;

  // long double prev_ans = -1;
  // for (long double x = 1.0; x <= N; x += 1.0) {
  //   ans = max(ans, floor(a_b * x) - A * floor(x / B));
  //   // if (prev_ans != -1) {
  //   //   if (prev_ans > ans) {
  //   //     cout << ans << endl;
  //   //     return 0;
  //   //   }
  //   // }
  //   prev_ans = ans;

  //   cout << setprecision(5) << floor(a_b * x) << ":" << A * floor(x / B)
  //        << endl;
  // }

  long double x = min(N, B - 1);
  cout << floor(a_b * x) - A * floor(x / B) << endl;

  return 0;
}


Measured memory_bytes: 3800
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AOJ
{
	class Program
	{
		static void Main(string[] args)
		{
			string s = "";
			var r = new List<double>();
			while ((s = Console.ReadLine()) != null)
			{
				r.Add(double.Parse(s));
			}
			Console.WriteLine(r.Max() - r.Min());
		}
	}
}

Measured memory_bytes: 5952
import Control.Applicative
import Control.Monad
import Data.List

main :: IO ()
main = do
    [a, b] <- fmap read . words <$> getLine :: IO [Int]
    let f c d
            | c >  0           = 1
            | c <= 0 && 0 <= d = 0
            | odd n            = -1
            | otherwise        = 1
          where
            n = d - c + 1
    case f a b of
        0 -> putStrLn "Zero"
        1 -> putStrLn "Positive"
        (-1) -> putStrLn "Negative"

Measured memory_bytes: 508
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
//cout << setprecision(20) << 

ll gcd(ll x, ll y) {
    return y ? __gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
    return x/__gcd(x, y)*y;
}

ll count(ll R, ll mul) {
    return R / mul;
}

int main() {
    ll A, B, C, D; cin >> A >> B >> C >> D;
    ll bcount = B - count(B, C) - count(B, D) + count(B, lcm(C, D));
    ll acount = A - 1 - count(A - 1, C) - count(A - 1, D) + count(A - 1, lcm(C, D));
    cout << bcount - acount << endl;
}

Measured memory_bytes: 3552
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int max(int a, int b)
{
  if (a>b) return a;
  else return b;
}

int main() {
  int D;
  scanf("%d", &D);
  int c[27];
  for(int i=1;i<=26;i++){
    scanf("%d", &c[i]);
  }
  int s[366][27];
  int smax[27]={0};
  int smax_idx[27]={0};

  for(int i=1;i<=365;i++){
    smax_idx[i]=1;
    for(int j=1;j<=26;j++){
      scanf("%d", &s[i][j]);
      if(smax[i]<s[i][j]){
        smax[i]=s[i][j];
        smax_idx[i]=j;
      }
    }
  }
  for(int i=1;i<=365;i++){
    printf("%d\n", smax_idx[i]);
  }
  return 0; 
}

Measured memory_bytes: 2192
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define INF 99999999
using namespace std;

int main() {
    long long n, ans = 0;
    cin >> n;
    vector <vector<long long>> v(n, vector<long long>(3));
    long long a, b, c;
    for (vector<long long>& tmp : v) {
        cin >> a >> b;
        c = a+b;
        tmp[0] = c; tmp[1] = a; tmp[2] = b;
        ans -= b;
    }
    /*
    for(vector<long long> tmp : v) {
        cout << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;
    }
     */
    sort(v.begin(), v.end(), greater<>());
    for(long long i = 0; i < n; i += 2) {
        ans += v[i][0];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 5760
#include<iostream>
using namespace std;
int
main(){
	int a,b,c;
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> a >> b >> c;
	if(a==b){
		cout << c << endl;
	}
	else if(b==c){
		cout << a << endl;
	}
	else{
		cout << b << endl;
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1e9 + 7;

template <class T>
inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

int main() {
  int A, B;
  cin >> A >> B;
  int C, D;
  cin >> C >> D;

  int l = A + B;
  int r = C + D;

  if (l > r)
    cout << "Left" << endl;
  else if (r > l)
    cout << "Right" << endl;
  else
    cout << "Balanced" << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
two = 0
one = 0
zero = 0
for i in range(N):
    if A[i]%4==0:
        two += 1
    elif A[i]%2==0:
        one += 1
    else:
        zero += 1


if zero-1<=two and one%2==0:
    print('Yes')
elif two*2>=N-1:
    print('Yes')
elif zero<=two:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14252
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int n, m , x;	
vector<int> c;
vector<vector<int>> a;

int dfs(){
  	int mn = pow(10,8);
//  	cout << mn << endl;
	rep(i,(1 << n)){
    	bitset<12> bt(i);
      	int tp = 0;
      	vector<int> ud(m,0);
      	bool fct = true;
      	rep(j,n){
        	if(bt.test(j)){
              	tp += c.at(j);
            	rep(k,m) ud.at(k) += a.at(j).at(k);	
            }
        }
        rep(k,m) if(ud.at(k) < x){fct = false; break;}
      	if(fct) mn = min(tp,mn);
    }
  	return mn;
}

int main() {
	cin >> n >> m >> x;
  	c = vector<int>(n);
  	a = vector<vector<int>>(n,vector<int>(m));
  	rep(i,n){
    	cin >> c.at(i);
      	rep(j,m) cin >> a.at(i).at(j);
    }
 	rep(j,m){
      	int sm = 0;
    	rep(i,n) sm += a.at(i).at(j);
      	if(x > sm){cout << -1 << endl;	return 0;}
    }
  	
  	cout << dfs() << endl;
}

Measured memory_bytes: 3636
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define in(x) cin >> x
#define out(str) cout << str << endl

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

string S;

int main(){
    cin>>S;
    S[0]='2';
    S[1]='0';
    S[2]='1';
    S[3]='8';
    out(S);

}


Measured memory_bytes: 256
N = int(input())
W = [input() for i in range(N)]

X  =[list(W[i]) for i in range(N)]
Y  = set(W)

ans = 0

if len(W) != len(Y):
    print('No')
else:
    for i in range(1,N):
        if X[i-1][-1] == X[i][0] :
            ans += 1
            #print(ans)
    if ans == N-1:  
        print('Yes')
    else:
        print('No')   

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;

const int maxN = 100 + 5;
const int maxM = 100 + 5;
int n, m, d[maxN][maxM];
char b[maxN][maxM];

int main() {
	cin >> n >> m;
	for(int i = 1; i <= n; ++i) cin >> (b[i] + 1);
	memset(d, 0x3f, sizeof(d));
	d[1][1] = (b[1][1] == '#');
	
	for(int i = 1; i <= n; ++i)
		for(int j = 1; j <= m; ++j) {
			if(i > 1) d[i][j] = min(d[i][j], d[i - 1][j] + (b[i - 1][j] != b[i][j]));
			if(j > 1) d[i][j] = min(d[i][j], d[i][j - 1] + (b[i][j - 1] != b[i][j]));
		}
	
	
	int leng = d[n][m];
	leng += (b[n][m] == '#');
	assert(leng % 2 == 0);
	cerr << "leng = " << leng << endl;
	cout << (leng / 2) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define INF      (int)1e9
#define MOD      (int)1e9+7
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;

int main(){
	int n;
	cin>>n;
	
	vector<double> v(n);
	REP(i,n) cin>>v[i];
	
	while(v.size()>1){
		sort(ALL(v));
		double tmp=v[0]+v[1];
		REP(i,2) v.erase(v.begin());
		v.push_back(tmp/2);
	}
	
	printf("%.10f\n",v[0]);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int a[N],b[N];
int main(){
	int n,si=0,l=N,r,w=0;scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",a+i);
	for(int i=n;i;i--){
		scanf("%d",b+i);
		if(b[i]==a[i])si++,l=i;
	}
	r=l+si-1;
	for(int i=1;i<=n;i++)if(b[i]!=a[r]&&a[i]!=a[r])w++;
	if(w<si)return puts("No"),0;
	puts("Yes");
	for(int i=1;i<=n;i++){
		if(l>r)break;
		if(b[i]!=a[r]&&a[i]!=a[r])swap(b[i],b[l++]);
	}
	for(int i=1;i<=n;i++)printf("%d ",b[i]);
	return 0;
}

Measured memory_bytes: 5420
#undef NDEBUG
#include <bits/stdc++.h>

using namespace std;

#define all(v) (v).begin(), (v).end()

using li = long long;
using ld = long double;

void solve(bool);

int main() {
#ifdef YA
    auto s = clock();
    assert(freopen("input.txt", "r", stdin));
#else
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
#endif

    cout << fixed << setprecision(20);

    solve(true);

#ifdef YA1
    while (true) solve(false);
#endif

#ifdef YA
    cout << endl << endl << "time = " << (clock() - s) / (double)CLOCKS_PER_SEC << endl;
#endif

    return 0;
}

const int maxn = (int)2e5 + 5;

int dist[maxn];
vector <int> g[maxn];
int n;

int dfs(int v, int pr) {
    dist[v] = 0;
    int best = v;
    for (int to : g[v]) {
        if (to == pr)
            continue;
        int tbest = dfs(to, v);
        if (dist[to] + 1 > dist[v]) {
            dist[v] = dist[to] + 1;
            best = tbest;
        }
    }
    return best;
}

void solve(bool __attribute__((unused)) read) {
    cin >> n;
    for (int i = 0; i < n - 1; ++i) {
        int x, y;
        cin >> x >> y;
        --x;
        --y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    int v = dfs(0, -1);
    dfs(v, -1);

    ++dist[v];
    if (dist[v] == 1)
        cout << "First\n";
    else if (dist[v] == 2)
        cout << "Second\n";
    else if ((dist[v] - 3) % 3 == 2)
        cout << "Second\n";
    else
        cout << "First\n";



}

Measured memory_bytes: 27648
#include "bits/stdc++.h"
using namespace std;

int main() {
	static long long N, A[100000], ANS[100000] = {};
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> A[i];
		if (i % 2 == 0) ANS[0] += A[i];
		else ANS[0] -= A[i];
	}
	for (int i = 0; i < N - 1; i++) {
		ANS[i + 1] = A[i] * 2 - ANS[i];
	}
	for (int i = 0; i < N; i++) {
		if (i != 0) cout << " ";
		cout << ANS[i];
	}
	cout << endl;
}

Measured memory_bytes: 2816
#include <iostream>
#include <vector>
#include <utility>
#include <queue>
#include <stack>
#include <cstring>
#include <set>
#include <map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#define ll long long
using namespace std;
ll mod=pow(10,9)+7;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n;
    cin>>n;
    ll* arr=new ll[10005]();
    for(ll x=1;x<=102;++x)
    {
        for(ll y=1;y<=102;++y)
        {
            for(ll z=1;z<=102;++z)
            {
                ll ans=pow(x,2)+pow(y,2)+pow(z,2)+x*y + y*z + z*x;
                if(ans<=10000)
                {
                    ++arr[ans];
                }
            }
        }
    }
    for(ll i=1;i<=n;++i)
    {
        cout<<arr[i]<<endl;
    }

}

Measured memory_bytes: 3684
using System;

namespace AOJ.Volume0
{
    public class DroppingInk
    {
        public static void Main()
        {
            // 紙を初期化
            int[,] paper = new int[10, 10];

            // 入力がなくなるまで処理
            while (true)
            {
                string input = Console.ReadLine();
                if (string.IsNullOrEmpty(input)) { break; }
                var data = input.Split(',');
                int x = int.Parse(data[0]);
                int y = int.Parse(data[1]);
                int vol = int.Parse(data[2]);

                // インクの滲み処理
                for (int i = 0; i < 10; i++)
                {
                    for (int j = 0; j < 10; j++)
                    {
                        switch (vol)
                        {
                            case 1:
                                // 小の場合(x, y)からの距離が1以下の位置に滲む
                                if (Math.Abs(x - i) + Math.Abs(y - j) <= 1) { paper[i, j]++; }
                                break;
                            case 2:
                                // 中の場合(x, y)のx方向の距離が1以下かつy方向の距離が1以下の位置に滲む
                                if (Math.Abs(x - i) <= 1 && Math.Abs(y - j) <= 1) { paper[i, j]++; }
                                break;
                            case 3:
                                // 大の場合(x, y)からの距離が2以下の位置に滲む
                                if (Math.Abs(x - i) + Math.Abs(y - j) <= 2) { paper[i, j]++; }
                                break;
                        }
                    }
                }
            }
            // 回答
            int white = 0;
            int max = 0;
            for (int i = 0; i < 10; i++)
            {
                for (int j = 0; j < 10; j++)
                {
                    if (paper[i, j] == 0) { white++; }
                    max = Math.Max(max, paper[i, j]);
                }
            }
            Console.WriteLine(white);
            Console.WriteLine(max);
        }
    }
}

Measured memory_bytes: 5628
N,A,B =map(int,input().split())
S = str(input())
a_pass = 0
i_pass = 0
for p in S:
  if p == 'c': 
    print('No')
  if p == 'a':
    if a_pass != A + B: 
      print('Yes')
      a_pass += 1
    else:
      print('No')
  if p == 'b':
    if a_pass != A + B and i_pass != B:
      print('Yes')
      a_pass += 1
      i_pass += 1
    else:
      print('No')
    

  

Measured memory_bytes: 9108
#pragma region
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define vi vector<int>
#define vd vector<double>
#define vs vector<string>
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define revi(i, m, n) for(int i=(int)(m-1);i>=(int)(n);i--)
#define rev(i, n) revi(i, n, 0)
#define each(i, n) for(auto&& i: n)
#define sz(v) ((int)(v).size()) 
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define uniq(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define dump(x) cerr << #x << " = " << x <<endl
#define gcd __gcd
int lcm(int a, int b){return a / gcd(a, b) * b;}
const int INF = 1e18;
const int MOD = 1e9 + 7;
const double EPS = 1e-15;
const double PI = acos(-1);
int dig(int n){return (int)(log10(n) + 1);}
int abc(char x){return (int)(x)-(int)('a');}
char abc(int x){return (char)(x+(int)('a'));}
int ABC(char x){return (int)(x)-(int)('A');}
char ABC(int x){return (char)(x+(int)('A'));}

void solve();
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);
	solve();
}
#pragma endregion

void solve() {
    string s, t;
	cin >> s >> t;
	vector<vi> ms(26), mt(26);
	rep(i, sz(s)) {
		ms[abc(s[i])].emplace_back(i);
		mt[abc(t[i])].emplace_back(i);
	}
	sort(all(ms));
	sort(all(mt));
	if (ms == mt) cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 5140
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL;
  typedef pair<ll,char> PLC;
  typedef pair<char,ll> PCL;

int main(void){
  int N;cin >> N;
  vector<string> S(N);
  int i,j;
  REP(i,N) cin >> S[i];
  int pre_B = 0, suf_A = 0;
  int count = 0;
  int neg = -1;
  REP(i,N){
    char pre = ' ';
    REP(j,S[i].length()){
      if(pre=='A' && S[i][j] =='B') count++;
      pre = S[i][j];
    }

    if(S[i][0] =='B'){
      pre_B++;
      if(S[i][S[i].length()-1] != 'A') neg=0;
    }
    if(S[i][S[i].length()-1] == 'A'){
      suf_A++;
      if(S[i][0] !='B') neg=0;
    }

  }
  if(min(pre_B,suf_A)==0) neg=0;
  cout << count + min(pre_B,suf_A) + neg << endl;
  return 0;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2e5+10;
int n,a[N],b[N],ans;
priority_queue<pair<int,int> >q;
signed main() {
	scanf("%lld",&n);
	for(int i=1;i<=n;i++)scanf("%lld",&a[i]);
	for(int i=1;i<=n;i++){
		scanf("%lld",&b[i]);q.push(make_pair(b[i],i));	
	}
	while(q.size()){
		pair<int,int> x=q.top();q.pop();
		if(a[x.second]==x.first)continue;
		if(a[x.second]>x.first){
			return puts("-1")*0;
		}
		int dis=x.first-a[x.second];
		int sum=b[x.second-1]+b[x.second+1];
		if(x.second==1)sum+=b[n];
		if(x.second==n)sum+=b[1];
		if(sum>dis){
			return puts("-1")*0;
		}
		int Dis=dis/sum;ans+=Dis;
		b[x.second]-=Dis*sum;
		q.push(make_pair(b[x.second],x.second));
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 9072
#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  cin >> n;
  int count = 0;
  string color;
  for (int i = 0; i < n; i++) {
    cin >> color;
    if (color == "Y") count++;
  }
  
  if (count > 0) cout << "Four" << endl;
  else cout << "Three" << endl;
}

Measured memory_bytes: 256
import math
H, W = map(int, input().split())
 
ans = 0

if H==1 or W==1:
  print(1)
  exit()

if H%2 == 0:
  len = int(H/2)
  ans += int(math.ceil(W/2))*len + int(math.floor(W/2))*len
else:
  len = int(math.floor(H/2))
  ans += int(math.ceil(W/2))*(len+1) + int(math.floor(W/2))*len
  
print(int(ans))

Measured memory_bytes: 38256
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")
al = "abcdefghijklmnopqrstuvwxyz"
AL = al.upper()

s = v()
a = len(s)
p = [0]*a
check = True
now_before = 0
now_after = 0
cnt_x = 1
cnt_y = 0

for i in range(1,a):
    if s[i] == "L" and check == True:
        now_before = i-1
        now_after = i
        check = False
        if i % 2 == 0:
            p[now_before] += cnt_y
            p[now_after] += cnt_x+1
        else:
            p[now_before] += cnt_x
            p[now_after] += cnt_y+1
        cnt_x = 0
        cnt_y = 0
    elif s[i] == "L" and check == False:
        if (i - now_after) % 2 == 0:
            p[now_after] += 1
        else:
            p[now_before] += 1   
    elif s[i] == "R" and check == False:
        check = True
        if i%2==0:
            cnt_x += 1
        else:
            cnt_y += 1
    elif s[i] == "R" and check == True:
        if i%2==0:
            cnt_x += 1
        else:
            cnt_y += 1

print(" ".join(map(str,p)))




Measured memory_bytes: 18532
#include <bits/stdc++.h>
#include <cassert>
#define rep(i, n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
struct Edge
{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w) {}
};
//using Graph = vector<vector<Edge>>;
using Graph = vector<vector<int>>;

const long long INF = 1LL << 60;
const int INT_INF = 1000000000;
const double PI = acos(-1.0);

int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
// int dx[8] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[8] = {-1, 0, 1, 1, -1, 1, 0, -1};

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  cout << max(A * B, C * D) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

int main() {
  int sx, sy, tx, ty;
  std::string moves = "";
  std::cin >> sx >> sy >> tx >> ty;
  int dx = tx - sx, dy = ty - sy;
  for (int i = 0; i < dx; i++) {
    moves += 'R';
  }
  for (int i = 0; i < dy; i++) {
    moves += 'U';
  }
  for (int i = 0; i < dx; i++) {
    moves += 'L';
  }
  for (int i = 0; i < dy; i++) {
    moves += 'D';
  }
  moves += 'D';
  for (int i = 0; i <= dx; i++) {
    moves += 'R';
  }
  for (int i = 0; i <= dy; i++) {
    moves += 'U';
  }
  moves += "LU";
  for (int i = 0; i <= dx; i++) {
    moves += 'L';
  }
  for (int i = 0; i <= dy; i++) {
    moves += 'D';
  }
  moves += 'R';

  std::cout << moves << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;

#define rep(i,x,y) for(ll i=(x);i<(y);i++)
#define rrep(i,x,y) for(ll i=(ll)(y)-1;i>=(x);i--)
#define all(x) (x).begin(),(x).end()
#define itrout(x) for(int i=0;i<x.size();i++) {cout << x[i] << (i==x.size()-1 ? "\n" : " ");}
#ifdef LOCAL
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl
#define itrdebug(x) cerr << #x << " "; for (auto & el : (x)) {cerr << (el) << " ";} cerr << endl
#define dassert(...) assert(__VA_ARGS__)
#else
#define debug(x)
#define itrdebug(x)
#define dassert(...)
#endif
//#define int long long

typedef long long ll;
const ll MOD = 1e9 + 7;
const long double EPS = 1e-8;

void solve(long long L, long long R, long long d){
    int answer =0;
    rep(i,L,R+1) {
        if (i%d==0) answer++;
    }
    cout << answer << endl;
}

signed main(){
    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    long long L;
    scanf("%lld",&L);
    long long R;
    scanf("%lld",&R);
    long long d;
    scanf("%lld",&d);
    solve(L, R, d);
    return 0;
}


Measured memory_bytes: 3684
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int n;
    cin>>n;
    string s;
    cin>>s;
    int r=0,g=0,b=0;
    for(int i=0;i<n;i++){
        if(s[i]=='R'){
            r++;
        }
        if(s[i]=='G'){
            g++;
        }
        if(s[i]=='B'){
            b++;
        }
    }
    long long ans=(1ll*r*g*b);
    long long ans1=0;
    for(int i=0;i<n;i++){
        for(int j=0;j<i;j++){
            if(2*i-j<n && s[i]!=s[j] && s[j]!=s[2*i-j] && s[i]!=s[2*i-j]){
                ans1++;
            }
        }
    }
    cout<<ans-ans1<<"\n";
}

int main(){
    std::ios::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);

    solve();
    return 0;
}

Measured memory_bytes: 3640
H,W=map(int,raw_input().split())

a = []
for i in range(H):
    a.append(map(int,raw_input().split()))

dictate_list = []
mini_dictate_list = []
Flag= False
for i in range(H):
    for j in range(W):
        if i%2==0:
            if a[i][j]%2==1:
                if Flag:
                    Flag=False
                    dictate_list.append(mini_dictate_list)
                    mini_dictate_list = []
                else:
                    Flag=True
            if Flag:
                if j!=W-1:
                    mini_dictate_list.append(str(i+1) + " " +str(j+1) + " " + str(i+1) + " " + str(j+2))
                elif i!=H-1:
                    mini_dictate_list.append(str(i+1) + " " +str(j+1) + " " + str(i+2) + " " + str(j+1))


                    
        else:
            if a[i][W-j-1]%2==1:
                if Flag:
                    Flag=False
                    dictate_list.append(mini_dictate_list)
                    mini_dictate_list = []
                else:
                    Flag=True
            if Flag:
                if j!=W-1:
                    mini_dictate_list.append(str(i+1) + " " +str(W-j) + " " + str(i+1) + " " + str(W-j-1))
                elif i!=H-1:
                    mini_dictate_list.append(str(i+1) + " " +str(W-j) + " " + str(i+2) + " " + str(W-j))


new_dictate_list = []

for mini in dictate_list:
    for dic in mini:
        new_dictate_list.append(dic)            


N=len(new_dictate_list)
print N
for d in new_dictate_list:
    print d

Measured memory_bytes: 30144
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

int main() {
   ll N, M;
   cin >> N >> M;
   ll a = min(N, M / 2); // Sとcの組み合わせで作る
   ll b = (M - 2 * a) / 4; // cのみで作る
   cout << a + b << endl;

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long int;
#define incID(i, l, r) for(int i = (l)    ; i <  (r); ++i)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); --i)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); ++i)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); --i)
#define inc(i, n)  incID(i, 0, n)
#define dec(i, n)  decID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define dec1(i, n) decII(i, 1, n)
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))
#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define FR front()
#define BA back()
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
auto setmin   = [](auto & a, auto b) { return (b <  a ? a = b, true : false); };
auto setmax   = [](auto & a, auto b) { return (b >  a ? a = b, true : false); };
auto setmineq = [](auto & a, auto b) { return (b <= a ? a = b, true : false); };
auto setmaxeq = [](auto & a, auto b) { return (b >= a ? a = b, true : false); };
#define SI(v) static_cast<int>(v.size())
#define RF(e, v) for(auto & e: v)
#define until(e) while(! (e))
#define if_not(e) if(! (e))
#define ef else if
#define UR assert(false)
#define IN(T, ...) T __VA_ARGS__; IN_(__VA_ARGS__);
void IN_() { };
template<typename T, typename ... U> void IN_(T & a, U & ... b) { cin >> a; IN_(b ...); };
template<typename T> void OUT(T && a) { cout << a << endl; }
template<typename T, typename ... U> void OUT(T && a, U && ... b) { cout << a << " "; OUT(b ...); }

// ---- ----

template<typename T> istream & operator>>(istream & s, vector<T> & v) { RF(e, v) { s >> e; } return s; }
template<typename T> ostream & operator<<(ostream & s, vector<T> const & v) {
	inc(i, SI(v)) { s << (i == 0 ? "" : " ") << v[i]; }
	return s;
}

int main() {
	IN(int, n);
	vector<string> s(n);
	cin >> s;
	
	map<string, int> mp;
	int ma = 0;
	inc(i, n) { mp[s[i]]++; setmax(ma, mp[s[i]]); }
	
	set<string> se;
	inc(i, n) { if(mp[s[i]] == ma) { se.insert(s[i]); } }
	RF(e, se) { OUT(e); }
}


Measured memory_bytes: 36096
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef unsigned long long ll;

int main()
{
    int n;
    int i,j,k;
    cin >> n;
    vector<ll> a(n);
    for(i = 0;i < n;++i){
        cin >> a.at(i);
    }
    sort(a.begin(),a.end());
    for(i = 0;i < n;++i){
        if(n%2 == 1){
            if(a.at(i) != ((i+1)/2)*2){
                cout << "0" << endl;
                return 0;
            }
        }else{
            if(a.at(i) != (i/2)*2+1){
                cout << "0" << endl;
                return 0;
            }
        }
    }
    ll ans = 1;
    ll tmp = 1e9+7;
    if(n%2 == 0){
        for(i = 0;i < n/2;++i){
            ans *= 2;
            ans %= tmp;
        }
    }else{
        for(i = 0;i < (n-1)/2;++i){
            ans *= 2;
            ans %= tmp;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024