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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()
#define all2(a, b) (a).begin(), (a).begin() + (b)
#define debug(vari) cerr << #vari << " = " << (vari) << endl;
const int MOD = 1e9 + 7;

int main()
{
    int n, t, a;
    cin >> n >> t >> a;
    vector<int> h(n);
    rep(i, n) cin >> h[i];

    int ans;
    int res = 1001001001;

    rep(i, n)
    {
        if (abs(a*1000 - (t * 1000 - h[i] * 6)) < res)
        {
            res = abs(a*1000 - (t * 1000 - h[i] * 6));
            ans = i + 1;
        }
    }

    cout << ans << endl;
    return (0);
}


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

int main(){
  int N, x, sum;
  cin >> N;
  vector<int> a(N);
  for (int i=0; i<N; i++) {
    cin >> a.at(i);
  }
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  x = 1;
  sum = 0;
  for (int i=0; i<N; i++) {
    sum += a.at(i)*x;
    x *= -1;
  }
  cout << sum << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> P;
typedef pair<int,int> Pi;
#define rep(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define fi first
#define se second
#define endl "\n"

template<typename T> inline bool chmax(T &a, T b){if(a<b){a=b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream& operator<<(ostream& s,const complex<T>& d) {return s<<"("<<d.real()<<", "<<d.imag()<< ")";}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const pair<T1,T2>& d) {return s<<"("<<d.first<<", "<<d.second<<")";}
template<typename T> ostream& operator<<(ostream& s, const vector<T>& d){int len=d.size();rep(i,len){s<<d[i];if(i<len-1) s<<" ";}return s;}
template<typename T> ostream& operator<<(ostream& s,const vector<vector<T>>& d){int len=d.size();rep(i,len){s<<d[i]<<endl;}return s;}
template<typename T> ostream& operator<<(ostream& s,const set<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T> ostream& operator<<(ostream& s,const multiset<T>& v){s<<"{ ";for(auto itr=v.begin();itr!=v.end();++itr) {if (itr!=v.begin()) {s<< ", ";}s<<(*itr);}s<<" }";return s;}
template<typename T1, typename T2> ostream& operator<<(ostream& s,const map<T1,T2>& m){s<<"{"<<endl;for(auto itr=m.begin();itr!=m.end();++itr){s<<" "<<(*itr).first<<" : "<<(*itr).second<<endl;}s<<"}"<<endl;return s;}

const ll mod=1'000'000'007;
const ll inf=1'000'000'000'000'000'00;
const int INF=1'000'000'000;
const double EPS=1e-10;
const double PI=acos(-1);

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<vector<int>> a(n+100,vector<int>(2,-1));
    rep(i,n){
        rep(j,2) cin>>a[i][j];
    }
    rep(i,n-2){
        if(a[i][0]==a[i][1] && a[i+1][0]==a[i+1][1] && a[i+2][0]==a[i+2][1]){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 3660
#include<cstdio>
#include<iostream>
#include<cmath>

#define NMAX 50000+100
#define YES 0
#define NO 1

using namespace std;

int main(void){

	int hurui[NMAX]={YES};

	hurui[0]=NO,hurui[1]=NO;
	for(int i=2;i<sqrt((double)NMAX);i++){
		if(hurui[i]==YES){
			for(int j=i+i;j<NMAX;j+=i){
				hurui[j]=NO;
			}
		}
	}

	int inp;

	while(cin>>inp){
		for(int i=inp-1;;i--){
			if(hurui[i]==YES){
				cout<<i<<" ";
				break;
			}
		}
		for(int i=inp+1;;i++){
			if(hurui[i]==YES){
				cout<<i<<endl;
				break;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1360
n = int(input())

if n%10==2 or n%10==4 or n%10==5 or n%10==7 or n%10==9:
  print("hon")
elif n%10==0 or n%10==1 or n%10==6 or n%10==8:
  print("pon")
else:
  print("bon")


Measured memory_bytes: 9112
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	private static ArrayList<Long> fib = new ArrayList<Long>();

	public static void main(String[] args) {
		 Scanner sc = new Scanner(System.in);
         long N = sc.nextLong();

         long init = 1;

         for(int i = 0; i < N+1; i++){
        	 if(i==0){fib.add(init);continue;}
        	 if(i==1){fib.add(init);continue;}
        	 fib.add(fib.get(i-2) + fib.get(i-1));
//        	 for(long l:fib){System.out.print(l+",");}
//        	 System.out.println();
         }

         System.out.println(fib.get(fib.size()-1));
	}
}

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

string s[123];

void solve() {
	int n, l; cin >> n >> l;
	for (int i = 0; i < n; ++i) cin >> s[i];
	sort(s, s+n);
	for (int i = 0; i < n; ++i) cout << s[i];
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int t = 1; //scanf("%d", &t);
	while (t--) {
		solve();
	}
	return 0;
}


Measured memory_bytes: 256
n, m, q = map(int, input().split())
plist = []
for _ in range(q):
    plist.append(list(map(int, input().split())))

alist = []


def bfs(depth: int, l: list):
    global n, m, alist
    if depth == n:
        alist.append(l[1:])
        return
    c = l[depth]
    cl = l.copy()
    cl.append(c)
    bfs(depth+1, cl.copy())
    while c < m:
        c += 1
        cl = l.copy()
        cl.append(c)
        bfs(depth + 1, cl.copy())


bfs(0, [1])
pmax = 0
for a in alist:
    point = 0
    for p in plist:
        if (a[p[1]-1] - a[p[0]-1] == p[2]):
            point += p[3]
    pmax = max(pmax, point)

print(pmax)


Measured memory_bytes: 90644
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define loop(n) for(int i = 0; i < n; i++)
#define FOR(x,y,z) for(int x = y; x < z; x++)
#define INF 999999999;
#define VEC vector<int>
#define in push_back
#define answer(x) cout<<x<<endl

using namespace std;

int main()
{
	int a,b,c;
	cin >> a >> b >> c;
	if (c >= a && c <= b)answer("Yes");
	else answer("No");
	return 0;
}

Measured memory_bytes: 256
=begin
1, 受け取った数値を配列にし、多重ループして i * jを求める
2, 求めたi*jをans に足して出力
=end

gets
num_i = gets.split.map(&:to_i)
num_j = num_i.map(&:to_i)
ans = 0

num_i.each{|i|
  num_j.shift()
  num_j.each{|j|
    ans += i * j
  }
}

puts ans

Measured memory_bytes: 1916
s=input()
if s=='SAT':
  print(1)
if s=='MON':
  print(6)
if s=='TUE':
  print(5)
if s=='WED':
  print(4)
if s=='THU':
  print(3)
if s=='FRI':
  print(2)
if s=='SUN':
  print(7)


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
int mat[3][100001];
int main(){
	#ifdef EVAL
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
	#endif
	int N;
	cin>>N;
	int a[N];
	int b[N];
	int c[N];
	for(int i=0;i<N;i++){
		cin>>a[i]>>b[i]>>c[i];
	}
	mat[0][0]=a[0];
	mat[1][0]=b[0];
	mat[2][0]=c[0];
	for(int i=0;i<N-1;i++){
		for(int j=0;j<3;j++){
			if(j==0){
				mat[1][i+1]=max(mat[1][i+1],mat[j][i]+b[i+1]);
				mat[2][i+1]=max(mat[2][i+1],mat[j][i]+c[i+1]);
			}
			if(j==1){
				mat[0][i+1]=max(mat[0][i+1],mat[j][i]+a[i+1]);
				mat[2][i+1]=max(mat[2][i+1],mat[j][i]+c[i+1]);
			}
			if(j==2){
				mat[0][i+1]=max(mat[0][i+1],mat[j][i]+a[i+1]);
				mat[1][i+1]=max(mat[1][i+1],mat[j][i]+b[i+1]);
			}
		}
	}
	cout<<max(mat[2][N-1],max(mat[1][N-1],mat[0][N-1]));
}

Measured memory_bytes: 2560
n, m = map(int, input().split())
a = [0]*(n+1)
for j in range(m):
    pos = int(input())
    a[pos] = 1

MOD = 10**9+7

step = [0] * (n+1)
step[0] = 1
step[1] = 1

for i in range(n+1):
    if a[i] == 1:
        step[i] = 0
    else:
        if i != 0 and i != 1:
            step[i] = (step[i-1] + step[i-2]) % MOD

print(step[-1])


Measured memory_bytes: 13348
#include <bits/stdc++.h>
#define mem(a,b) memset(a,b,sizeof(a))
using namespace std;
typedef long long ll;
string s;
int main() {
//freopen("input.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    int n;
    cin >> n;
    cin >> s;
    stack<char> left;
    stack<char> right;
    int l, r;
    for(int i = 0; i < n; i++){
        if(s[i] == '(') left.push(s[i]);
        else if(s[i] == ')'){
            if(!left.empty()){
                left.pop();
            }
        }
    }
    l = left.size();
    for(int i = n-1; i >= 0; i--){
        if(s[i] == ')') right.push(s[i]);
        else if(s[i] == '('){
            if(!right.empty()){
                right.pop();
            }
        }
    }
    r = right.size();
    for(int i = 0; i < r; i++) cout << "(";
    cout << s;
    for(int i = 0; i < l; i++) cout << ")";
    return 0;
}

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

int main()
{
	long long n,c2,c5;
    cin>>n;
    
    if(n&1)
	{
        cout<<0<<endl;
        return 0;
    }
    
    for(long long i=2; i<=n; i*=2)
	{
        c2+=n/i;
    }
    
    for(long long i=10; i<=n; i*=5)
	{
        c5+=n/i;
    }
    
    cout<<min(c2,c5)<< endl;
    return 0;
}

Measured memory_bytes: 256
import Data.List

main :: IO ()
main = getLine >> getLine >>= print . solve 

-- |
-- >>> solve "WEEWW"
-- 1
-- >>> solve "WEWEWEEEWWWE"
-- 4
-- >>> solve "WWWWWEEE"
-- 3
solve :: String -> Int 
solve xs = minimum $ count 0 ec xs
    where
        ec = foldl' ff 0 xs
        ff acc 'E' = acc + 1
        ff acc _ = acc

        count a b ('W' : ys) = (a + b) : count (a + 1) b ys
        count a b (_ : ys) = (a + b - 1) : count a (b - 1) ys
        count _ _ _ = []

Measured memory_bytes: 22012
#include<iostream>
#include<vector>

using namespace std;

int main(){
    int H, N;
    int Amax = 0;
    vector<int> A, B;
    vector<vector<int>> dp;

    cin >> H >> N;
    A.resize(N + 1);
    B.resize(N + 1);
        for (int i = 1; i <= N; i++)
        {
            int a, b;
            cin >> a >> b;
            A[i] = a;
            B[i] = b;
            Amax = max(Amax, a);
        }
        dp.resize(N + 1, vector<int>(H + Amax, 100000000));
        for (int i = 0; i <= N; i++)
        {
            dp[i][0] = 0;
        }

        for (int n = 0; n < N; n++)
        {
            for (int h = 1; h < H + Amax; h++)
            {
                if (h >= A[n + 1])
                {
                    dp[n + 1][h] = min(dp[n + 1][h - A[n + 1]] + B[n + 1], dp[n][h]);
                }
                else
                {
                    dp[n + 1][h] = min(dp[n][h], B[n + 1]);
                }
            }
        }

    int result = dp[1][H];
    for (int i = 1; i <= N; i++){
        for (int j = H; j < H + Amax; j++){
            result = min(result, dp[i][j]);
        }
    }

    cout << result << endl;
}

Measured memory_bytes: 47004
s=list(str(input()))
ans=len(s)
cntx=0
cnty=0
for j in range(len(s)):
  if (int(s[j])==j%2):
    cntx+=1
  if (int(s[j])!=j%2):
    cnty+=1
  ans=min(cntx,cnty)
print(ans)

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

int main() {
  int N, A;
  cin >> N >> A;

  if (N % 500 == 0) {
    cout << "Yes" << endl;
  }
  // 500で割り切れたらYes
  
  else if (N % 500 <= A) {
    cout << "Yes" << endl;
  }
  // あまりがA以下であればYes
    
  
   else {
    cout <<"No" << endl;
  }
   
}

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

int main(void){
    int n,m;
    cin >> n >> m;
    if(n==m){
        cout << "Yes" <<endl;
    }
    else{
        cout << "No" <<endl;
    }
    
    return 0;
    
}





















































Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int x,y,z,max;
	int i,j,flg;
	int z3;
	
	while(1)	{
		scanf("%d",&z);
		if(z==0)	break;
		z3=z*z*z;
		max=-1;
		for(x=1;x<z;x++)	{
			flg=0;
			for(y=x;y<z;y++)	{
				if(z3<x*x*x+y*y*y)	{
					break;
				}
				else {
					flg=1;
					if(max<x*x*x+y*y*y)	{
						max=x*x*x+y*y*y;
					}
				}
			}
			if(flg==0)	break;
		}
		printf("%d\n",z3-max);
	}
	return 0;
}


Measured memory_bytes: 600
#include<stdio.h>
#include<string.h>

int main() {

	int i, count = 0;
	char w[10], str[100000];
	size_t len;
	scanf("%s", w);
	len = strlen(w);
	for (i = 0; i < len; i++) {
		if ((w[i] >= 'A') && (w[i] <= 'Z')) {
			w[i] += 'a' - 'A';
		}
	}
	while (1) {
		scanf("%s", str);
		if (strcmp(str, "END_OF_TEXT") == 0) {
			break;
		}
		len = strlen(str);
		for (i = 0; i < len; i++) {
			if ((str[i] >= 'A') && (str[i] <= 'Z')) {
				str[i] += 'a' - 'A';
			}
		}
		if (strcmp(str, w) == 0) {
			count++;
		}
	}
	printf("%d\n", count);


	return 0;
}

Measured memory_bytes: 556
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <queue>
#include <climits>
#include <set>
#include <map>
#include <stack>
#define ll long long
using namespace std;

int main()
{
    double n;
    cin >> n;
    double ave=0;
    vector<double> a(n);
    for (ll i =0; i < n;i++){
        cin >> a[i];
        ave += a[i];
    }
    ave /= n;
    //cout << ave << endl;
    ll ans = n - 1;
    for (ll i = n - 1; i >= 0; i--)
    {
        if(abs(a[ans]-ave)>=abs(a[i]-ave)){
            ans = i;
        }
    }
    cout << ans << endl;
}


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

int main() {
  int N,Y,i,j,x=-1,y=-1,z=-1;
  int t=0; 
  
  cin >> N >> Y;
  
  for(i=0;i<=N;i++) {
    for(j=0;j<=N-i;j++) {
      if(10000*i+5000*j+1000*(N-i-j) == Y) {
        x = i;
        y = j;
        z = N-i-j;
        break;
      }
    }
  }
  
  cout << x << " " << y << " " << z << endl;
  
  return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
inline int read(){char c = getchar();int x = 0,s = 1;
while(c < '0' || c > '9') {if(c == '-') s = -1;c = getchar();}
while(c >= '0' && c <= '9') {x = x*10 + c -'0';c = getchar();}
return x*s;}
using namespace std;
#define NewNode (TreeNode *)malloc(sizeof(TreeNode))
#define Mem(a,b) memset(a,b,sizeof(a))
const int N = 1e6 + 5;
const long long INFINF = 0x7f7f7f7f7f7f7f;
const int INF = 0x3f3f3f3f;
const double EPS = 1e-7;
const unsigned long long mod = 998244353;
const double II = acos(-1);
const double PP = (II*1.0)/(180.00);
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> piil;
int main()
{
    std::ios::sync_with_stdio(false);
    cin.tie(0),cout.tie(0);
    string s;
    cin >> s;
    for(int i = 0;i < s.size();i++)
        s[i] == '?' ? cout << 'D' : cout << s[i];
    cout << endl;
}


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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

int N, M;
ll a[55], b[55], c[55], d[55];

int main() {
   cin >> N >> M;
   rep (i, N) { cin >> a[i] >> b[i]; }
   rep (i, M) { cin >> c[i] >> d[i]; }

   rep (i, N) {
      ll dist = 1e15, p = 0;
      rep (j, M) {
         ll t = abs(a[i] - c[j]) + abs(b[i] - d[j]);
         if (t < dist) {
            dist = t, p = j + 1;
         }
      }
      cout << p << endl;
   }

   return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(ll i = n;i >= 0;--i)
#define FOR(i,m,n) for(ll i = m, i##_len=(n);i <i##_len; ++i)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
const int INF = 1e9;
const ll LLINF = 1e16;

ll modinv(ll a, ll m) {
    ll b = m, u = 1, v = 0;
    while (b) {
        ll t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(void)
{
    int n;
    cin >> n;
    vector<pair<ll,ll>> tasks(n);
    REP(i,n){
        cin >> tasks[i].second >> tasks[i].first;
    }
    sort(all(tasks));
    ll sum = 0;
    bool flag = false;

    REP(i,n){
        sum += tasks[i].second;
        if(sum > tasks[i].first){
            flag = true;
            break;
        }
    }

    if(flag){
        cout << "No" << endl;
    }
    else{
        cout << "Yes" << endl;
    }
    

    return 0;
}

Measured memory_bytes: 3328
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int n;cin>>n;
    int a=0,b=0;
    for(a=0;a<26;a++){
        for(b=0;b<20;b++){
            if(a*4+b*7==n){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
     cout<<"No"<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<time.h>
#include<tuple>
#include<set>
#include<map>
#include<cctype>
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define vint vector<int> 
#define vvint vector<vint>
#define ct(a) cout<<a<<endl
#define tget(a,b) get<a>(b)
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const ll INF = 1e18;
const int MOD = 1e9 + 7;

int a;
int main(void) {
	cin >> a;
	if (a < 1200)ct("ABC");
	else ct("ARC");
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int a[5], x = 0, y, z = 0;
	cin >> a[0] >> a[1] >> a[2] >> a[3] >> a[4];
	for (int i = 0; i < 5; i++) {
		if (a[i] % 10 == 0) {
			x = x + a[i];
			z++;
		}
	}
	for (int j = 9; j > 0; j--) {
		y = x;
		for (int k = 0; k < 5; k++) {
			if (z == 4 && a[k] % 10 == j) {
				x = x + a[k];
			}
			else if (a[k] % 10 == j) {
				x = x + a[k] + 10 - j;
				z++;
			}
		}
	}
	cout << x << endl;
	return 0;
}


Measured memory_bytes: 256
from heapq import heappush, heappop
import sys
input = sys.stdin.readline

h, w = map(int, input().split())
ch, cw = map(lambda x: int(x) - 1, input().split())
dh, dw = map(lambda x: int(x) - 1, input().split())
s = [input() for _ in range(h)]

INF = 10**10
cost = [[INF] * w for _ in range(h)]
dx = [+1, 0, -1, 0]
dy = [0, +1, 0, -1]
dxy2 = []
dxy2 += [(i, j) for i in [-2, 2] for j in range(-2, 3)]
dxy2 += [(i, j) for j in [-2, 2] for i in range(-1, 2)]
dxy2 += [(-1, -1), (-1, +1), (+1, -1), (+1, +1)]
q = [(0, ch, cw)]
cost[ch][cw] = 0
while q:
    c, x, y = heappop(q)
    if cost[x][y] < c:
        continue

    if x == dh and y == dw:
        break

    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
        if nx < 0 or nx >= h or ny < 0 or ny >= w:
            continue
        if s[nx][ny] == '#':
            continue
        if cost[nx][ny] <= c:
            continue
        cost[nx][ny] = c
        heappush(q, (c, nx, ny))

    for dx_, dy_ in dxy2:
        nx = x + dx_
        ny = y + dy_
        if nx < 0 or nx >= h or ny < 0 or ny >= w:
            continue
        if s[nx][ny] == '#':
            continue
        if cost[nx][ny] <= c + 1:
            continue
        cost[nx][ny] = c + 1
        heappush(q, (c + 1, nx, ny))

ans = -1 if cost[dh][dw] == INF else cost[dh][dw]
print(ans)
# print(*cost, sep='\n')


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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
#define MP make_pair
ll MOD = 1e9+7;
//ll MOD = 998244353;
ll INF = 1e18;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }
void ans1(bool x){
  if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){
  if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){
  if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
void ans(bool x, ll y, ll z){
  if(x) cout<<y<<endl;else cout<<z<<endl;}   


int main(){
  ll i,j;
  ll n; cin>>n;
  //ll a,b,c,d,e,f; cin>>a>>b;
  //ll a,b,c,d,e,f; cin>>a>>b>>c;
  //ll a,b,c,d,e,f; cin>>a>>b>>c>>d;
  //string s; cin >> s;
  ll result = 0;
  ll buf = 0;
  bool judge = true;

  vector<ll> a(n);
  for(i=0;i<n;i++){
    cin >> a[i];
  }
  sort(ALL(a));
  reverse(ALL(a));
  for(i=0;i<n;i++){
    if(i%2==0) result+=a[i];
    else result-=a[i];

  }
  cout<<result<<endl;

  return 0;
}

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

#define NMAX 100000

bitset<NMAX> visited;
vector<int>  edges[NMAX], indegree(NMAX), distances(NMAX);

void dfs (int v) {
	visited[v] = true;
	for (int w: edges[v]) {
		distances[w] = max(distances[w], distances[v] + 1);
		if(--indegree[w] == 0)
			dfs(w);
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	
	for (int i = 0; i < M; ++i) {
		int xi, yi;
		cin >> xi >> yi;
		edges[xi-1].push_back(yi-1);
		indegree[yi-1]++;
	}

	for (int v = 0; v < N; ++v) {
		if (visited[v] or indegree[v] > 0)
			continue;
		dfs(v);
	}

	/*
	for (int v = 0; v < N; ++v) {
		cout << "DIST " << v+1 << ": " << distances[v] << endl;
	}
	*/
	
	cout << *max_element(distances.begin(), distances.end()) << endl;
}


Measured memory_bytes: 9600
using System;

namespace abc160_a
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            if(str.Substring(2, 1)== str.Substring(3, 1))
            {
                if (str.Substring(4, 1) == str.Substring(5, 1))
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}


Measured memory_bytes: 11092
def answer():
    def cmb(n, r, mod):
        r = min(r, n - r)
        return g1[n] * g2[r] * g2[n - r] % mod

    x, y = map(int, input().split())
    a = (2 * y - x) / 3
    b = (2 * x - y) / 3

    if (2 * x - y) % 3 == 0 and a >= 0 and b >= 0:
        a = int(a)
        b = int(b)

        mod = 10 ** 9 + 7  # 出力の制限
        n = a + b
        g1 = [1, 1]  # 元テーブル
        g2 = [1, 1]  # 逆元テーブル
        inverse = [0, 1]  # 逆元テーブル計算用テーブル

        for i in range(2, n + 1):
            g1.append((g1[-1] * i) % mod)
            inverse.append((-inverse[mod % i] * (mod // i)) % mod)
            g2.append((g2[-1] * inverse[-1]) % mod)

        result = int(cmb(n, a, mod))
    else:
        result = 0

    print(result)


if __name__ == '__main__':
    answer()


Measured memory_bytes: 82280
#include <bits/stdc++.h>
using namespace std;
using ll=long long;

struct Z{
  ll y;
  ll x;
  ll depth;
};

ll H,W,K,y,x,depth,oo=1e12,xs,ys,xg,yg;
vector<ll> y_vec={1,0,-1,0};
vector<ll> x_vec={0,1,0,-1};
vector<vector<ll>> A;
queue<Z> q;

ll bfs(){
  ll ans=oo;
  while(!q.empty()){
    Z now=q.front(); q.pop();
    y=now.y, x=now.x, depth=now.depth;
    if(y==yg && x==xg){
      ans=min(ans,depth);
      return ans;
    }
    for(ll i=0; i<4; i++){
      for(ll k=1; k<=K; k++){
        Z next={y+y_vec[i]*k, x+x_vec[i]*k, depth+1};
//cout<<"ny:"<<next.y<<" nx:"<<next.x<<endl;        
        if(A[next.y][next.x]==-1) break;
        if(A[next.y][next.x]<next.depth) break;
        if(A[next.y][next.x]==next.depth) continue;
        A[next.y][next.x]=next.depth;
        q.push(next);
//cout<<" d:"<<next.depth<<endl;          
      }
    }
  }
  return oo;
}

//A[y][x], A(x,y)として管理
int main(){
  cin>>H>>W>>K;
  cin>>ys>>xs>>yg>>xg;
  A.assign(H+2, vector<ll>(W+2,-1));
  for(int i=1; i<=H; i++){
    for(int j=1; j<=W; j++){
      char a; cin>>a;
      if(a=='@') continue;
      A[i][j]=oo;
    }
  }
  A[ys][xs]=0;
  Z start={ys,xs,0};
  q.emplace(start);
  ll ans=bfs();
  if(ans==oo) ans=-1;
  cout<<ans<<endl;
}


Measured memory_bytes: 34332
# -*- coding:utf-8 -*-
def check(num):
    if num%2:
        return 1
    else:
        return 0

if __name__ == "__main__":
    factors = list(map(int, input().split()))
    maximum = max(factors)
    if check(maximum*3) != check(sum(factors)):
        maximum += 1
    else:
        pass
    print(int(((maximum*3)-sum(factors))/2))

Measured memory_bytes: 3060
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int d[10000005];
int main(){
    int n;cin>>n;
    vector<string>s(n);
    rep(i,n)cin>>s[i];
    rep(i,n)sort(ALL(s[i]));
    map<string,ll>mp;
    rep(i,n){
        mp[s[i]]++;
    }
    ll res = 0;
    for(auto m:mp){
        res += m.second*(m.second-1)/2;
    }
    cout<<res;
}



Measured memory_bytes: 18176
#include <stdio.h>
#include <iostream>
using namespace std;

#define MOD 1000000007

int main()
{
	int N, s[200001];
	int i;
	for (i = 0; i < 200001; i++)
	{
		s[i] = 0;
	}
	cin >> N;
	for (i = 1; i < N; i++)
	{
		int A;
		cin >> A;
		s[A - 1]++;
	}
	for (i = 0; i < N; i++)
	{
		cout << s[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 4420
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#define MOD 1000000007
typedef long long ll;
using namespace std;

ll dp[1010][20010];
const ll INF=1e18;

int main(){
  int N;
  cin>>N;
  int w[N+1]={},s[N+1]={};
  ll v[N+1]={};
  vector<pair<ll,int>> vec;
  for(int i=1;i<=N;i++){
    cin>>w[i]>>s[i]>>v[i];
    vec.push_back(make_pair(w[i]+s[i],i));
  }
  sort(vec.begin(),vec.end());

  for(int i=0;i<=N;i++){
    for(int j=0;j<=20001;j++){
      dp[i][j]=-INF;
    }
  }
  dp[0][0]=0;

  for(int i=0;i<=N-1;i++){
    int next=vec[i].second;
    for(int j=0;j<=20000;j++){
      if(dp[i][j]==-INF) continue;
      if(j+w[next]<=20000&&j<=s[next]){
        dp[i+1][j+w[next]]=max(dp[i+1][j+w[next]],dp[i][j]+v[next]);
      }
      dp[i+1][j]=max(dp[i+1][j],dp[i][j]);
    }
  }

  ll ans=0;
  for(int i=0;i<=20000;i++){
    ans=max(ans,dp[N][i]);
  }
  cout<<ans<<endl;

  return 0;
}


Measured memory_bytes: 157952
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<string>
#include<cstring>
#include<iomanip>
using namespace std;
typedef long long lng;
typedef unsigned long long ulng;

#define pb push_back
#define SZ(a) int((a).size())
#define ALL(a) (a).begin(), (a).end()
#define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
#define FORD(i,b,a) for(int i=(b); i>=(a); --i)
#define REP(i,n) FOR(i,0,n-1)
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end()) // <a> must be sorted in advance

lng power(lng b, lng e) {lng sol=1; while(e>0) {if(e&1) {sol=sol*b;} e>>=1; b*= b;} return sol;}



int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string n;
    cin >> n;
    if(n[0]==n[1]&&n[1]==n[2] || n[1]==n[2]&&n[2]==n[3]) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define per(i,a,b) for(int i=(b-1);i>=(a);i--)
#define all(V) V.begin(),V.end()
#define sz(a) (int)a.size()
#define de(a) cout<<#a<<" = "<<a<<endl
#define dd(a) cout<<#a<<" = "<<a
typedef long long ll;
typedef pair<int ,int > pii;
typedef vector<int> vi;
//----

const int N=2e5+5;
const int mod=1e9+7;
int data[N];
int main(){
	int n;
	scanf("%d",&n);
	rep(i,0,n)scanf("%d",&data[i]);
	rep(i,0,n)data[i]-=i;
	sort(data,data+n);
	ll ans=0;
	rep(i,0,n)ans+=abs(data[n/2]-data[i]);
	cout<<ans<<endl;
	return 0;	
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int n, k, q;
  cin >> n >> k >> q;

  vector<int> Ai(n, k-q);
  for(int i=0; i<q; i++){
    int idx;
    cin >> idx;
    idx -= 1;
    Ai[idx] += 1;
  }

  for(int i=0; i<n; i++){
    if( Ai[i] > 0 ) std::cout << "Yes" << '\n';
    else std::cout << "No" << '\n';
  }
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>

#include <cstdio>

using namespace std;


#define N_MAX 100001


int main(){
	int A[N_MAX],count[N_MAX];
	int N;

	scanf("%d",&N);

	for(int i=0;i<N_MAX;i++){
		count[i] = 0;
	}

	for(int i;i<N;i++){
		scanf("%d",&A[i]);
	}

	for (int i=0;i<N;i++){
		count[A[i]-1]++;
		count[A[i]]++;
		count[A[i]+1]++;
	}

	int max = 0;

	for(int i=0;i<N_MAX;i++){
		if(count[i]>max){
			max = count[i];
		}
	}

	printf("%d\n",max);

	return 0;

}

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

int main(){
    int n,i;
    vector<int> a(100001);
    vector<int> b(100000);
    cin >> n;
    for(i = 0;i < n+1;i++){
        cin >> a.at(i);
    }
    for(i = 0;i < n;i++){
        cin >> b.at(i);
    }
    long int count = 0;
    for(i = 0;i < n;i++){
        int k = a.at(i) - b.at(i);
        if(k < 0){
            count += a.at(i); 
            if(k + a.at(i+1) < 0){
                count += a.at(i+1);
                a.at(i+1) = 0;
            }else{
                count -= k;
                a.at(i+1) += k;
            }
            
        }else{
            count += b.at(i);
        }
    }
    cout << count << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define len(s) (int)s.size()
#define pb push_back

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;
}
constexpr int mod = 1e9+7;
constexpr int inf = 3e18;

int N,X;
int A[205],dp[205][100005];
signed main(){
	cin>>N>>X;
	rep(i,N)cin>>A[i];
	sort(A,A+N);
	rep(i,X+1)dp[1][i]=i%A[0];
	REP(i,N){
		rep(j,X+1){
			(dp[i+1][j]+=dp[i][j]*i)%=mod;
			(dp[i+1][j]+=dp[i][j%A[i]])%=mod;
		}
	}
	cout<<dp[N][X]<<endl;
}


Measured memory_bytes: 157184
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = n - 1; i >= 0; i--)
#define repone(i, n) for(ll i = 1; i <= (ll)(n); i++)
#define each(i, mp) for(auto i:mp)
#define FOR(i, m, n) for(ll i = m;i < n;i++)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll half_inf = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

int main() {
    ll n;
    cin >> n;
    repr(i, n + 1) {
        if (i * i <= n) {
            cout << i * i << endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import sys
from functools import lru_cache
def input(): return sys.stdin.readline().strip()


def main():

    """
    0から出発してNになるようにすると2^a 3^b 5^cをあらかじめ求めておかないといけなくて大変だったが
    Nから出発して0に向かうようにすれば数字がどんどん小さくなるから前計算不要なのか。。。

    そして\pm 1を掛け算のたびに挟むことになるから手詰まりになっていたけど、
    次の割り算をするのに、割り切れる数まで\pm 1してからさらに\pm 1をするのは確実に無駄とわかるから
    （\pm 1で移動→割り算）を１セットにして再帰してやれば確実に小さくなっていく！
    最後あたりに無限ループが起きる可能性があるから、そこは適切に処理すればよい。
    """

    T = int(input())
    for _ in range(T):
        N, a, b, c, d = map(int, input().split())

        @lru_cache(maxsize=None)
        def func(n):
            if n == 0: return 0
            if n == 1: return d
            val1 = func(n // 2) + a + d * (n % 2)
            val2 = func(n // 2 + 1) + a + d * (2 - (n % 2)) if n % 2 != 0 else float("inf")
            val3 = func(n // 3) + b + d * (n % 3)
            val4 = func(n // 3 + 1) + b + d * (3 - (n % 3)) if n % 3 != 0 else float("inf")
            val5 = func(n // 5) + c + d * (n % 5)
            val6 = func(n // 5 + 1) + c + d * (5 - (n % 5)) if n % 5 != 0 else float("inf")
            return min(val1, val2, val3, val4, val5, val6, d * n)
        
        print(func(N))


if __name__ == "__main__":
    main()


Measured memory_bytes: 11380
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <cassert>
#include <functional>

using namespace std;

#define LOG(...) printf(__VA_ARGS__)
//#define LOG(...)
#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define RSORT(c) sort((c).rbegin(),(c).rend())
#define CLR(a) memset((a), 0 ,sizeof(a))

typedef long long ll;
typedef unsigned long long ull;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vb> vvb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int dx[] = { -1, 0, 1, 0 }; const int dy[] = { 0, 1, 0, -1 };

struct UnionFind {
	vector<int> v;
	UnionFind(int n) : v(n)  { for (int i = 0; i < n; i++) v[i] = i; }
	int  find(int x)         { return v[x] == x ? x : v[x] = find(v[x]); }
	void unite(int x, int y) { v[find(x)] = find(y); }
};
int num[182];
int dfs(int n, int cnt, int now) {
	int res = 0;
	FOR(i,now,182) {
		if (n - num[i] == 0)
			 res++;
		if (n - num[i] >= num[i] && cnt <= 2)
			res += dfs(n - num[i], cnt + 1, i);

	}
	return res;
}
int main() {
	FOR(i, 1, 182)
		num[i] = i*i;
	int n;
	while (cin>>n,n) {
		cout << dfs(n, 0, 1) << endl;
	}
}

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

#define pb   push_back
#define endl "\n"
#define ll   long long

#define W(t)            while(t--)
#define clr(a)          memset(a,0,sizeof(a))
#define rep(i,a,b)      for(i = a; i < b; i++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;

vector<int> adj[300000];
int n, m;
bool vis[300000];

int dfs(int nd)
{
     int res=1;
     vis[nd] = true;

     for (auto ch : adj[nd])
          if (!vis[ch])
               res += dfs(ch);
     return res;
}
int main()
{
     IOS
#ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
#endif
     cin >> n >> m;
     int ans = 0;

     W(m)
     {
          int x, y; cin >> x >> y;
          adj[x].pb(y);
          adj[y].pb(x);
     }
     for (int i = 1; i <= n; i++)
          if (!vis[i])
               ans = max(dfs(i), ans);
     cout << ans << endl;
     return 0;
}

Measured memory_bytes: 26372
# R = int(input()) 
N= int(input())
A = list(map(int, input().split()))



# if N >= sum(A):
#     print(N-sum(A))
# else:
#     print(-1)
count= [0] * N

for x in A:
    count[x-1] +=1
for i in range(N):
    print(count[i])

# def count_defaultdict(it):
#     counter = collections.defaultdict(int)
#     for x in it:
#         counter[x] += 1
#     return dict(counter)



Measured memory_bytes: 92424
import java.util.Scanner;

class Main{
	public static void main(String args[]){
		Scanner scan = new Scanner(System.in);
		int num = scan.nextInt();
		int i,maxSide;
		int[] side = new int[3];
		
		for(i=0;i<num;i++){
			side[0] = scan.nextInt();
			side[1] = scan.nextInt();
			side[2] = scan.nextInt();
			
			maxSide = Math.max(side[0],side[1]);
			maxSide = Math.max(maxSide,side[2]);
			
			if(maxSide == side[0]){
				if(side[0]*side[0] == side[1]*side[1]+side[2]*side[2]){
					System.out.println("YES");
				}else{
					System.out.println("NO");
				}
			}else if(maxSide == side[1]){
				if(side[1]*side[1] == side[0]*side[0]+side[2]*side[2]){
					System.out.println("YES");
				}else{
					System.out.println("NO");
				}
			
			}else{
				if(side[2]*side[2] == side[0]*side[0]+side[1]*side[1]){
					System.out.println("YES");
				}else{
					System.out.println("NO");
				}
			}
		}
	}
}

Measured memory_bytes: 23352
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<functional>
#include<math.h>

#define rep(i,n) for(ll i=0;i<(n);i++)
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
	if (b == 0)return a;

	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}

int main() {
	int r;
	cin >> r;

	double ans = r * 2 * 3.14;
	printf("%.10f\n", ans);

	return 0;
}

Measured memory_bytes: 3748
import java.util.*;

public class Main {

    private static int gcd(int a, int b) {
        if (b == 0) return a;
        return gcd(b, a % b);
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        int res = sc.nextInt();
        Set<Integer> set = new HashSet<>();
        set.add(res);
        for (int i = 1; i < n; i++) {
            int num = sc.nextInt();
            if (!set.add(num)) continue;
            res = gcd(num, res);
            if (res == 1) break;
        }
        System.out.println(res);
    }
}

Measured memory_bytes: 59304
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner in = new Scanner(System.in);
        int N = in.nextInt();
        long res = 1L;

        for (int i = 0; i < N; i++) {
            long T = in.nextLong();
            res = lcm(T, res);
        }

        System.out.println(res);
    }

    static long lcm(long A, long B) {
        return A / gcm(A, B) * B;
    }

    static long gcm(long A, long B) {
        if (A > B) {
            long tmp = A;
            A = B;
            B = tmp;
        }

        if (B % A == 0) {
            return A;
        }

        return gcm(A, B % A);
    }
}



Measured memory_bytes: 21972
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;



int main() {

  int N;
  cin >> N;

  long long A[100000];
  for(int i = 0; i < N; ++i) cin >> A[i];
  sort(A, A+N);


  // start from minimum
  int min_idx = 1;
  int max_idx = N-1;
  bool pop_max = true;
  long long poped_num_small = A[0];
  long long poped_num_large = A[0];
  long long sum1 = 0;

  /*
  cout << A[0] << endl;
  //*/

  while(min_idx <= max_idx) {
    if(min_idx == max_idx) {
      if(pop_max) {
        /*
        cout << A[max_idx] << endl;
        //*/

        sum1 += A[max_idx] - poped_num_small;
        max_idx -= 2;
      }
      else {
        /*
        cout << A[min_idx] << endl;
        //*/

        sum1 += poped_num_large - A[min_idx];
        min_idx += 2;
      }
    }
    else {
      if(pop_max) {
        /*
        cout << A[max_idx-1] << endl;
        cout << A[max_idx] << endl;
        //*/

        sum1 += A[max_idx]   - poped_num_small;
        sum1 += A[max_idx-1] - poped_num_large;

        poped_num_small = A[max_idx-1];
        poped_num_large = A[max_idx];

        max_idx -= 2;
      }
      else {
        /*
        cout << A[min_idx] << endl;
        cout << A[min_idx+1] << endl;
        //*/

        sum1 += poped_num_small - A[min_idx];
        sum1 += poped_num_large - A[min_idx+1];

        poped_num_small = A[min_idx];
        poped_num_large = A[min_idx+1];

        min_idx += 2;
      }
    }

    /*
    cout << "min idx:" << min_idx << endl;
    cout << "max idx:" << max_idx << endl;
    //*/
    pop_max = !pop_max;
  }


  // start from maximum
  min_idx = 0;
  max_idx = N-2;
  pop_max = false;
  poped_num_small = A[N-1];
  poped_num_large = A[N-1];
  long long sum2 = 0;

  /*
  cout << A[N-1] << endl;
  //*/

  while(min_idx <= max_idx) {
    if(min_idx == max_idx) {
      if(pop_max) {
        /*
        cout << A[max_idx] << endl;
        //*/

        sum2 += A[max_idx] - poped_num_small;
        max_idx -= 2;
      }
      else {
        /*
        cout << A[min_idx] << endl;
        //*/

        sum2 += poped_num_large - A[min_idx];
        min_idx += 2;
      }
    }
    else {
      if(pop_max) {
        /*
        cout << A[max_idx-1] << endl;
        cout << A[max_idx] << endl;
        //*/

        sum2 += A[max_idx]   - poped_num_small;
        sum2 += A[max_idx-1] - poped_num_large;

        poped_num_small = A[max_idx-1];
        poped_num_large = A[max_idx];

        max_idx -= 2;
      }
      else {
        /*
        cout << A[min_idx] << endl;
        cout << A[min_idx+1] << endl;
        //*/

        sum2 += poped_num_small - A[min_idx];
        sum2 += poped_num_large - A[min_idx+1];

        poped_num_small = A[min_idx];
        poped_num_large = A[min_idx+1];

        min_idx += 2;
      }
    }

    /*
    cout << "min idx:" << min_idx << endl;
    cout << "max idx:" << max_idx << endl;
    //*/
    pop_max = !pop_max;
  }


  // result
  if(sum1 > sum2) {
    cout << sum1 << endl;
  }
  else {
    cout << sum2 << endl;
  }

}


Measured memory_bytes: 1024
# encoding: utf-8
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(M)]

# find maximum a for each b
max_as = [0] * N
for a, b in ab:
    if max_as[b - 1] < a: max_as[b - 1] = a

# count num. of valid bridges (bm = b - 1)
ans = 0
last_bridge = -1
for bm, max_a in enumerate(max_as):
    if max_a < 1: continue
    elif max_a <= last_bridge: continue
    ans += 1
    last_bridge = bm
        
# WA

# # check value exists in [a] and [b]
# a_exists = [False] * N
# b_exists = [False] * N
# for a, b in ab:
#     a_exists[a - 1] = True
#     b_exists[b - 1] = True

# # find minimum a -> find minimum b (> a) -> find minimum a (> =b) -> ...
# state = 1
# ans = 0
# for a_exist, b_exist in zip(a_exists, b_exists):
#     print("#", state, ans,  a_exist, b_exist)
#     # search minimum b
#     if state == 1 and b_exist:
#         ans += 1
#         state = 0
#     # search minimum a (can occur immediately after state = 0)
#     if state == 0 and a_exist:
#         state = 1

print(ans)


Measured memory_bytes: 28140
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

#define all(c) (c).begin(), (c).end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
    int n, l;
    cin >> n >> l;
    vector<string> vec;
    rep(i, n) {
        string s;
        cin >> s;
        vec.push_back(s);
    }
    sort(all(vec));
    for (auto &&s : vec) cout << s;
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;

namespace atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var nxy = Console.ReadLine().Split(' ').Select(num => int.Parse(num)).ToArray();
            var n = nxy[0];
            var x = nxy[1];
            var y = nxy[2];
            var mid = y - x - 1;
            var result = new int[n - 1];
            for (var from = 1; from < n; from++)
            {
                for (var to = from + 1; to <= n; to++)
                {
                    if (from <= x && y <= to)
                    {
                        result[to - from - mid - 1]++;
                        continue;
                    }
                    else if (from <= x)
                    {
                        result[Math.Min(to - from - 1, x - from + y - to)]++;
                        continue;
                    }
                    else if (y <= to)
                    {
                        result[Math.Min(to - from - 1, to - y + from - x)]++;
                        continue;
                    }
                    else
                    {
                        result[Math.Min(to - from - 1, from - x + y - to)]++;
                    }
                }
            }

            for (var i = 0; i < result.Length; i++)
            {
                Console.WriteLine(result[i]);
            }
        }
    }
}

Measured memory_bytes: 13268
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int main()
{
  int n, a, b;

  cin >> n;

  if(n == 1){
    cout << "Hello World" << endl;
  }
  else{
    cin >> a >> b;
    cout << a+b << endl;
}


  return 0;
}


Measured memory_bytes: 256