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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 998244353
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li dp1[3030][3030]; // 最初に取るやつが決まってるやつ
li n, s;
li a[3030];

int main() {
    cin >> n >> s;
    li res = 0;

    rin{
        cin >> a[i];
        dp1[i + 1][0] = dp1[i][0] + 1;
        if (a[i] <= s) {
            dp1[i + 1][a[i]] = dp1[i][0] + 1;
        }
        repp(j, 1, s + 1) {
            dp1[i + 1][j] = (dp1[i + 1][j] + dp1[i][j]) % MOD;
            if (j + a[i] <= s) {
                dp1[i + 1][j + a[i]] = (dp1[i + 1][j + a[i]] + dp1[i][j]) % MOD;
            }
        }
        res = (res + dp1[i + 1][s]) % MOD;
    }

    cout << res << endl;

    return 0;
}

Measured memory_bytes: 71936
def main():
    X, Y = map(int, input().split())
    #total X
    #feet Y
    for x in range(X+1):
        y = X - x
        feet = 4 * x + 2 * y
        if feet == Y:
            print("Yes")
            return

    print("No")

if __name__ == '__main__':
    main()


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

int main(){
  int n;
  cin >> n;
  int ans = 0;
  for(int i = 1;i <= n;++i){
    if(i <= 9) ++ans;
    else if(100 <= i && i <= 999) ++ans;
    else if(10000 <= i && i <= 99999) ++ans;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-

while True:
  try:
    ( a, b ) = map ( int, input ( ).split ( ) )
  except EOFError: break
  ( x, y ) = ( a, b )
  while x != 0:
    ( x, y ) = ( y % x, x )
  print ( "%s %s" % ( y, a * b // y ) )

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

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for (ll i = 1; i <= (ll)(n); i++)
#define INF 10000000000
#define MOD 1000000007
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
using Graph = vector<vector<int>>;

int main(){
    int N; cin>>N;
    vector<ll> S,B;//smaller,bigger

    vector<pll> x(N),y(N);//smaller,bigger
    rep(i,N){
        ll a,b; cin>>a>>b;
        if(a>b) swap(a,b);
        x[i] = {a,i};
        y[i] = {b,i};
        B.push_back(b);
        S.push_back(a);
    }
    sort(x.begin(),x.end());
    sort(y.begin(),y.end());
    bool flag = (x[0].second==y[N-1].second);
    ll res1 = 0, res2 = 0;
    res1 = (x[N-1].first - x[0].first) * (y[N-1].first - y[0].first);
    if(flag){
        cout<<res1<<endl;
        return 0;
    }
    res2 = y[N-1].first - x[0].first;
    
    ll Bmin = min(x[1].first,B[x[0].second]), Bmax = max(x[N-1].first,B[x[0].second]);
    rep1(i,N-1){
        // cout<<Bmin<<" "<<Bmax<<endl;
        if(Bmin!=x[i].first)break;
        if(Bmin==S[y[N-1].second])break;
        if(Bmin==x[i].first&&B[x[i].second]<=Bmax){
            Bmin = min({y[0].first,B[x[i].second],x[i+1].first});
        }else{
            break;
        }
    }
    res2 *= (Bmax - Bmin);
    cout<<min(res1,res2)<<endl;
}


Measured memory_bytes: 12888
#include <iostream>
#include <cstdlib>
#include <string>
#include <typeinfo>
#include <cstring>
#include <iostream>
using namespace std;
#define MAX 2000000
int H,A[MAX+1];

struct Node{int key;
Node *right, *left, *parent;};
Node *root, *NIL;

int parent(int i){return i/2;}
int left(int i){return 2*i;}
int right(int i){return 2*i+1;}

void maxHeapify(int i){
    int l,r,largest;
    l = 2*i;
    r = 2*i+1;
    
    if(l <= H && A[l] > A[i])largest = l;
    else largest = i;
    if(r <= H &&A[r] > A[largest])largest = r;
    
    if(largest != i){
        swap(A[i], A[largest]);
        maxHeapify(largest);
    }
}


int main(){
    cin >> H;
    
    for(int i = 1; i <= H; i++)cin >> A[i];
    for(int i = H/2;i >= 1 ; i--)maxHeapify(i);
    for(int i = 1; i <= H; i++)cout << " " << A[i];
        cout << endl;
    return 0;
}






Measured memory_bytes: 5080
S = input()
if len(S) == 4:
    if S.isupper():
        if S[0] == S[1]:
            if S[0] != S[2] and S[2] == S[3]:
                print("Yes")
            else:
                print("No")
        elif S[0] == S[2]:
            if S[0] != S[1] and S[1] == S[3]:
                print("Yes")
            else:
                print("No")
        elif S[0] == S[3]:
            if S[0] != S[2] and S[1] == S[2]:
                print("Yes")
            else:
                print("No")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ms(x,y) memset(x, y, sizeof(x))
#define lowbit(x) ((x)&(-x))
#define sqr(x) ((x)*(x))
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

const LL MOD = 1e9+7;

void run_case() {
    int n; cin >> n;
    vector<LL> a(n);
    for(auto &x: a) cin >> x;
    LL ans = 0;
    for(int bit = 0; bit < 60; ++bit) {
        LL cnt1 = 0, cnt0 = 0;
        for(int i = 0; i < n; ++i) {
            if(((a[i]>>bit)&1) == 0) {
                cnt0++;
            } else {
                cnt1++;
            }
        }
        (ans += cnt0*cnt1%MOD*((1LL<<bit)%MOD)%MOD)%=MOD;
    }
    cout << (ans + MOD) % MOD;
}


int main() {
    ios::sync_with_stdio(false), cin.tie(0);
    cout.flags(ios::fixed);cout.precision(9);
    //int t; cin >> t;
    //while(t--)
    run_case();
    cout.flush();
    return 0;
}

Measured memory_bytes: 5556
N = int(input())
S = input()
W = S.count('W')
E = S.count('E')
counter = len(S)
cost = E
for i in range(len(S)):
  if S[i] == 'E':
    cost -= 1
    if cost < counter:
      counter = cost
  else:
    if cost < counter:
      counter = cost
    cost +=1
print(counter)

Measured memory_bytes: 3704
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

typedef long long ll;
const ll maxn = 300010,mod = 1e9+7;
ll n,turn[10][2],f[maxn][10],ans;
char s[maxn];

int main()
{
    scanf("%s",s + 1);
    n = strlen(s + 1);
    turn[0][1] = 1;
    turn[0][0] = 5;
    turn[1][1] = 2;
    turn[1][0] = 3;
    turn[2][1] = turn[2][0] = 2;
    turn[3][0] = 4;
    turn[3][1] = 1;
    turn[4][0] = turn[4][1] = 3;
    turn[5][0] = 6;
    turn[5][1] = 7;
    turn[6][0] = turn[6][1] = 5;
    turn[7][0] = 5;
    turn[7][1] = 1;
    f[0][0] = 1;
    for (ll i = 1; i <= n; i++)
        for (ll j = 0; j <= 7; j++)
            if (f[i - 1][j])
            {
                if (s[i] == '1' || s[i] == '?')
                    f[i][turn[j][1]] += f[i - 1][j];
                if (s[i] == '0' || s[i] == '?')
                    f[i][turn[j][0]] += f[i - 1][j];
                f[i][turn[j][1]] %= mod;
                f[i][turn[j][0]] %= mod;
            }
    ans = (f[n][1] + f[n][2]) % mod;
    printf("%lld\n",ans);

    return 0;
}


Measured memory_bytes: 23936
#include <bits/stdc++.h>
using namespace std;
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; }

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ for(auto it : P) { s << "<" << it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ for(auto it : P) { s << "<" << it.first << "->" << it.second << "> "; } return s << endl; }


int main() {
    //ios::sync_with_stdio(false);
    //cin.tie(0);
    
    string S, T;
    while (cin >> S >> T) {
        int a, b;
        cin >> a >> b;
        string U;
        cin >> U;
        if (S == U) --a;
        if (T == U) --b;
        cout << a << " " << b << endl;
    }
}


















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	string S, T; cin >> S >> T; 
	int L = S.size(); 
	int ans = 0; 
	for(int i = 0; i < L; i++){
		if(S.at(i) != T.at(i)) ans ++; 
	}
	cout << ans << endl; 
}


Measured memory_bytes: 3852
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
void chmax(LL& a, LL b) {
	a = max(a, b);
}
void chmin(LL& a, LL b) {
	a = min(a, b);
}
//////////////

void solve() {
	int N, M;
	cin >> N >> M;
	vector<LL> A(N+1,0);
	for (int i = 1; i <= N; ++i) {
		cin >> A[i];
		A[i] += A[i - 1];
		A[i] %= M;
	}
	map<int, int> dat;
	for (int i = 0; i <= N; ++i) {
		if (dat.find(A[i]) != dat.end()) {
			dat[A[i]]++;
		}
		else {
			dat[A[i]]=1;
		}
	}
	map<int, int>::iterator itr;
	LL ans = 0;
	for (itr = dat.begin(); itr != dat.end(); itr++) {
		LL x = itr->second;
		ans += (x * (x - 1) / 2);
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}


Measured memory_bytes: 3968
import java.util.*;
public class Main {
	static boolean[] s = new boolean[100001];

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

		int n = sc.nextInt();
		int m = sc.nextInt();

		HashMap<Integer, ArrayList<Integer>> c = new HashMap<Integer, ArrayList<Integer>>();
		for ( int i=0; i<n; i++ ) {
			ArrayList<Integer> ll = new ArrayList<Integer>();
			c.put(i, ll);
		}

		for ( int i=0; i<m; i++ ) {
			int a = sc.nextInt()-1;
			int b = sc.nextInt()-1;

			c.get(a).add(b);
			c.get(b).add(a);
		}

		int k = 0;
		for ( int i=0; i<n; i++ ) {
			if ( !s[i] ) {
				dfs(c, i, n);
				k++;
			}
		}

		System.out.println(k-1);
	}

	private static void dfs(HashMap<Integer, ArrayList<Integer>> c, int vertex, int sz) {
		s[vertex] = true;
		ArrayList<Integer> lst = c.get(vertex);
		for ( Integer i : lst ) {
			if ( !s[i] ) dfs(c, i, sz);
		}
	}
}

Measured memory_bytes: 83460
n = int(input())
s = list(input())

r = [0 for _ in range(n)]
g = [0 for _ in range(n)]
b = [0 for _ in range(n)]

for i in range(len(s)):
    if s[i] == "R":
        r[i] += 1
    elif s[i] == "G":
        g[i] += 1
    else:
        b[i] += 1
        
for i in range(1,len(s)):
    r[i] += r[i - 1]
    g[i] += g[i - 1]
    b[i] += b[i - 1]

dic = {'GR': b, 'BG': r, 'BR': g}
col = {'GR': "B", 'BG': "R", 'BR': "G"}

ans = 0

for i in range(n - 2):
    for j in range(i + 1, n - 1):
        if s[i] != s[j]:
            used_color = "".join(sorted(list(s[i] + s[j])))
            arr = dic[used_color]
            ans += arr[-1] - arr[j]
            if j + j - i < n:
                if s[j + j - i] == col[used_color]:
                    ans -= 1
print(ans)
            

Measured memory_bytes: 74532
N = int(input())
A, B = list(map(int, input().split()))

vala = A//N
valb = B//N
if vala != valb or A%N == 0 or B%N == 0:
    print('OK')
elif A == B and N == 1:
    print('OK')
else:
    print('NG')

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define LCM(a, b) (a) / __gcd((a), (b)) * (b)
#define CEIL(a, b) (a)/(b)+(((a)%(b))?1:0)
#define log_2(a) (log((a)) / log(2))
#define ln '\n'

using namespace std;
using LL = long long;
using ldouble = long double;
using P = pair<int, int>;
using LP = pair<LL, LL>;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1e9 + 7;
static const int SIZE = 200005;

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

vector<LL> Div(LL n) {
    vector<LL> ret;
    for(LL i = 1; i * i <= n; ++i) {
        if(n % i == 0) {
            ret.pb(i);
            if(i * i != n) ret.pb(n / i);
        }
    }
    sort(all(ret));
    return ret;
}

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

    int N;
    string s, t;
    cin >> N;
    cin >> s;
    cin >> t;

    int res = N * 2;
    for(int i = 1; i <= N; ++i) {
        bool f = true;
        for(int j = N - i, k = 0; j < N; ++j, ++k) {
            if(s[j] != t[k]) {
                f = false;
                break;
            }
        }
        if(f) res = N * 2 - i;
    }
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 3624
#include <cstdio>

long long count[26];

int main()
{
  int n;
  char s[100001];
  scanf("%d %s", &n, s);
  for (char *p = s; *p; ++p)
  {
    count[*p - 'a']++;
  }
  long long ans = 1;
  for (int i = 0; i < 26; ++i)
  {
    ans = (ans * (count[i] + 1)) % 1000000007;
  }
  
  printf("%lld\n", ans - 1);
  return 0;
}

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

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> s(h);
	rep(i, h) cin >> s[i];
	rep(y, h) rep(x, w) {
		if (s[y][x] == '#') continue;
		int cnt = 0;
		for (int dy = -1; dy <= 1; dy++) {
			for (int dx = -1; dx <= 1; dx++) {
				int ny = y + dy;
				int nx = x + dx;
				if (ny < 0 || ny >= h || nx < 0 || nx >= w) continue;
				if (s[ny][nx] == '#') cnt++;
			}
		}
		s[y][x] = cnt + '0';
	}
	rep(i, h) cout << s[i] << endl;
	return 0;
}

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

using namespace std;

#define inf 1<<30
#define llong long long
#define usd unsigned
#define pqueue priority_queue
#define mp make_pair
#define pb push_back
#define fn fill_n
typedef pair<int, int> P;
typedef struct data{
	int now;
	int cost;
}data;
int nw[9] = {0, 1, 0, -1, -1, 1, 1, -1, 0};
int nh[9] = {1, 0, -1, 0, 1, 1, -1, -1, 0};




int main(){
	int q, queries[100000][2];
	int maxi = 0;
	cin >> q;
	for(int i = 0; i < q; i++){
		cin >> queries[i][0] >> queries[i][1];
		maxi = max(maxi, queries[i][1]);
	}

	vector<int> Sosu;
	map<int, bool> isSosu;
	isSosu[2] = true;
	Sosu.pb(2);
	for(int i = 3; i <= maxi; i++){
		bool check = true;
		for(int j = 0; j < Sosu.size(); j++){
			if(i%Sosu[j] == 0){
				check = false;
				break;
			}
			if(sqrt(i) <= Sosu[j]) break;
		}
		if(check){
			Sosu.pb(i);
			isSosu[i] = true;
		}
	}

	int ans[100001] = {};
	for(int i = 1; i <= maxi; i++){
		ans[i] = ans[i-1];
		if(isSosu[i] && isSosu[(i + 1)/2]) ans[i]++;
	}

	for(int i = 0; i < q; i++){
		cout << ans[queries[i][1]] - ans[queries[i][0] - 1] << endl;
	}


	return 0;
}

Measured memory_bytes: 6528
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;
#include <unordered_set>

int main(void){
    Cin(int, n);
    Cins(int, n, a);
    
    int sum = 0;
    For(i, n) sum += a[i];
    
    int ansv = 1e9, ansi = -1;
    For(i, n){
        int d = abs(n*a[i] - sum);
        if(d < ansv) ansv = d, ansi = i;
    }
    Cout(ansi);
}





Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author himkha_100
 */

#include <bits/stdc++.h>

#define MOD 1000000007
#define INFI 1e15
#define INFIM 1e18
#define ll long long int
#define s(t) scanf("%d",&t)
#define p(t) printf("%d\n",t)
#define pb push_back
#define f(t) for(int i=0;i<t;i++)
#define fi first
#define se second
#define all(t) t.begin(),t.end()
#define ci(t) cin>>t
#define co(t) cout<<t
#define mii map<int,int>
#define pii pair<int,int>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
struct node{
    int val;
    int pos;
};
bool ac(int x,int y)
{
    return x>y;
}
class CSumOfGcdOfTuplesEasy {
public:
	void solve(std::istream& cin, std::ostream& cout) {
        ll K;
        cin>>K;
        ll ans=0;
	    for(int i=1;i<=K;i++) {
	        for(int j=1;j<=K;j++) {
	            for(int k=1;k<=K;k++) {
	                ans+=__gcd(i,__gcd(j,k));
	            }
	        }
	    }
	    cout<<ans<<endl;
	}
};

int main() {
	CSumOfGcdOfTuplesEasy solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

Measured memory_bytes: 3644
import sys
input = sys.stdin.buffer.readline
import bisect

def main():
    N = int(input())
    is_prime = [True for _ in range(2*N)]
    is_prime[0] = is_prime[1] = False
    prime = []
    for i in range(2,2*N):
        if not is_prime[i]:
            continue
        else:
            prime.append(i)
            j = 2*i
            while j < 2*N:
                is_prime[j] = False
                j += i

    index = bisect.bisect_left(prime,N)
    print(prime[index])
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 5352
#include <bits/stdc++.h>
#define int long long
#define pb push_back
#define l first
#define r second

using namespace std;

const int maxn = 2e5 + 1;

char v[9][9];

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int x, y;
    cin >> x >> y;
    int ans = 0;
    if (x * y < 0 || x
         == 0 && y < 0 ||
        x > 0 && y == 0) {
        ans = abs(x + y) + 1;
    } else {
        if (x > y)
            ans = abs(x - y) + 2;
        else
            ans = abs(x - y);
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF ((long long)1e18)
#define EPS (1e-5)
#define MOD ((int)1e9+7)
#define endl "\n"

#define yn(f) ((f)?"Yes":"No")
#define YN(f) ((f)?"YES":"NO")

signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int a, b;
	int n, m;
	int x, t;
	// string s, t;
	
	cin>>t>>x;
	
	cout<<(double)t/x<<endl;
	
	return 0;
}

Measured memory_bytes: 256
package main
import (
	"fmt"
	"os"
	"bufio"
	"strconv"
)

var stdin = bufio.NewScanner(os.Stdin)

func Input_int() int {
	stdin.Scan()
	out,err := strconv.Atoi(stdin.Text())
	if err != nil{
		panic(err)
	}
	return out
}

func main(){
	stdin.Split(bufio.ScanWords)
	H,W := Input_int(),Input_int()
	h,w := Input_int(),Input_int()
	fmt.Println((H-h)*(W-w))
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> pii;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i))
#define mat(type, c, m, n) vector<vector<type>> c(m, vector<type>(n));for(auto& r:c)for(auto& i:r)cin>>i;
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define each(x,y) for(auto &(x):(y))
#define var(type, ...)type __VA_ARGS__;Scan(__VA_ARGS__);
template<typename T> void Scan(T& t) { cin >> t; }
template<typename First, typename...Rest>void Scan(First& first, Rest&...rest) { cin >> first; Scan(rest...); }
#define vec(type, c, n) vector<type> c(n);for(auto& i:c) cin>>i;
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
#define em emplace
#define pb pop_back
#define fi first
#define se second
#define get(a, i) get<i>(a)
#define bit_count __builtin_popcount
#define mt make_tuple
inline string zero(int a,string s,char c='0'){return string(a-len(s),c)+s;}
inline string zero(int a,int t,char c='0'){return zero(a, to_string(t), c);}
inline string zero(int a,ll t,char c='0'){return zero(a, to_string(t), c);}
#define mini min_element
#define maxi max_element
#define sum accumulate
#define chmax(a,b) if(a<b)a=b
#define chmin(a,b) if(a>b)a=b
template <class T> inline void print(T t){cout << t << '\n';}
template <class H, class... T> inline void print(H h, T... t){cout << h << " ";print(t...);}
#define MAX int(3010)
int dp[MAX][MAX];
void solve() {
	var(string, s, t);
	int n = len(s), m = len(t);
	rep(i, 0, n) {
		rep(j, 0, m) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
			} else {
				if (dp[i][j + 1] > dp[i + 1][j]) {
					dp[i + 1][j + 1] = dp[i][j + 1];
				} else {
					dp[i + 1][j + 1] = dp[i + 1][j];
				}
			}
		}
	}
	string ans = "";
	rrep(i, dp[n][m], 0) {
		while(true) {
			if (dp[n - 1][m - 1] == i) {
				--m; --n;
			} else if (dp[n - 1][m] == i) {
				--n;
			}  else if (dp[n][m - 1] == i) {
				--m;
			} else {
				break;
			}
		}
		ans += t[m - 1];
	}
	reverse(all(ans));
	print(ans);
}
int main() {
	solve();
	return 0;
}


Measured memory_bytes: 35584
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.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>;

int main() {
  string s;
  cin >> s;
  set<char> c; map<char,int> m;
  rep(i,s.size()) {
    c.insert(s[i]);
    m[s[i]]++;
  }
  if(c.size()==2){
    for(char ci:c){
      if(m[ci]!=2){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(void){
  int n,i;
  cin >> n;
  string s1,s2;
  int taro = 0, hanako = 0;
  for(i = 0; i < n; i++){
    cin >> s1 >> s2;
    if(s1.compare(s2)==0) {
      taro++;hanako++;
    }
    else if(s1.compare(s2)>0){
        taro+=3;
    }
    else{
    hanako+=3;
    }
  }
  cout << taro << " " << hanako << endl;
}


Measured memory_bytes: 3172
#include<bits/stdc++.h>
using namespace std;
long long c[100000200],n,a,b,t,s=0;
int main()
{
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)
		cin>>c[i];
	for(int i=1;i<=n-1;i++)
	{
		t=(c[i+1]-c[i])*a;
		if(t<=b)
			s+=t;
		else
			s+=b;
	}
	cout<<s;
	return 0;
} 

Measured memory_bytes: 1024
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())




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

	string s;
	cin>>s;

	if (s.size()>=4 && s.substr(0,4)=="YAKI"){
		cout << "Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
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;}
//自作関数
template<class T> ll llpow(T x,T n){ll ans=1;while(n--){ans*=x;}return ans;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)

long long INF = 1LL<<60;
int n;
int main(){
    ll h,w;
    cin>>h>>w;
    char a[h][w];
    rep(i,h){
        rep(j,w){
            cin>>a[i][j];
        }
    }

    bool column[w];
    bool row[h];
    rep(i,w)column[i]=true;
    rep(i,h)row[i]=true;
    rep(i,h)rep(j,w)if(a[i][j]=='#')row[i]=false;

    rep(i,w)rep(j,h)if(a[j][i]=='#')column[i]=false;

    rep(i,h){
        rep(j,w){
            if((!row[i])&&(!column[j])){
                cout<<a[i][j];
            }
            if((!row[i])&&(j==w-1)){
                cout<<endl;
            }
        }
    }
    return 0;
}




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

int main() {
    ll n;
    cin >> n;

    vector<pair<ll, ll>> a;

    for (ll i = 2; i*i <= n; i++) {
        if (n % i) {
            continue;
        }

        ll e = 0;
        while(n % i == 0) {
            n /= i;
            e++;
        }
        a.push_back({i, e});
    }

    if (n != 1) {
        a.push_back({n, 1});
    }

    int ans = 0;
    for (auto t : a) {
        ll c = t.second;
        ll d = 1;
        while(d <= c) {
            c -= d;
            d++;
            ans++;
        }
    }

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

Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m,ans=0;
int main(){
    cin>>n>>m;
    vector<ll> sumP(n+1),sumLayer(n+1);
    sumP.at(0)=1,sumLayer.at(0)=1;
    for(int i=1;i<n+1;i++){
        sumP.at(i)=2*sumP.at(i-1)+1;
        sumLayer.at(i)=2*sumLayer.at(i-1)+3;
    }
    while(n){
        if(m==1) {
            m=0;
            break;
        }
        else if(m==sumLayer.at(n)){
            ans+=sumP.at(n);
            m=0;
            break;
        }
        else if(m-2==sumLayer.at(n-1)){
            ans+=sumP.at(n-1)+1;
            m=0;
            break;
        }
        else if(m-2<sumLayer.at(n-1)){
            m--;
            n--;
        }
        else if(m-2>sumLayer.at(n-1)){
            ans+=sumP.at(n-1)+1;
            m-=(sumLayer.at(n-1)+2);
            n--;
        }
    }
    ans+=m;
    cout<<ans<<endl;
}


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

using namespace std;

int main() {
        int h, w;
        string c;
        cin >> h >> w;
        for (int i = 0; i < h; i++) {
                cin >> c;
                cout << c << endl;
                cout << c << endl;
        }
        return 0;
}

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

int main() {
    int N; cin >> N;
    vector<int> A(N, 0);
    vector<int> p(N, 0);
    rep(i, N) cin >> p.at(i);
    rep(i, N) A.at(i) = p.at(i);
    sort(A.begin(), A.end());

    int cnt = 0;
    rep(i, N){
        if(A.at(i) != p.at(i)) cnt++;
    }

    if(cnt <= 2) cout << "YES" << endl;
    else cout << "NO" << endl;

}


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

int main() {
  int a, b;
  cin >> a >> b;

  if (a < b) {
    for (int i = 0; i < b; ++i) {
      cout << a;
    }
    cout << endl;
  }
  else {
    for (int i = 0; i < a; ++i) {
      cout << b;
    }
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)

{

int a,b;

scanf("%d %d",&a,&b);

if(a<b){

printf("a < b\n");

}

else if(a>b){

printf("a > b\n");

}

else{


printf("a == b\n"); 

}

return 0;

}

Measured memory_bytes: 580
#include<bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target ("avx,avx2,fma")
#pragma GCC optimize ("03")
#define ll long long
#define pb push_back
#define nl '\n'
#define popb pop_back()
#define sz size()
#define inf 1000000000
#define ld long double
#define ull unsigned long long
#define F first
#define S second
#define fix fixed<<setprecision
#define pii pair<int,int>
#define E exit(0)
ll dp[2001];
int main() {
    //freopen("tshirts.in", "r", stdin);
	//freopen("tshirts.out", "w", stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int s;
	cin>>s;
	dp[0]=1;
    for (int i=1;i<=s;i++) {
        for (int j=3;i-j>=0;j++) {
            dp[i]+=dp[i-j];
        }
        dp[i]%=(inf+7);
    }
    cout<<dp[s]%(inf+7);
}

Measured memory_bytes: 3616
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<cstdint>
#include<unordered_map>
#include<sstream>
#include<boost/multiprecision/cpp_int.hpp>

#define rep(i, n) for(int i = 0; i < ( int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define vi vector<int>
#define vll vector<ll>
#define all(x) (x).begin(),(x).end()
#define F first
#define S second
#define pb push_back

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

ll M = 1000000007;

typedef pair<int, int> P;

bool ps1(const P& element1, const P& element2)
{//first昇順
	return element1.first < element2.first;
}
bool ps2(const P& element1, const P& element2)
{//first降順
	return element1.first > element2.first;
}
bool ps3(const P& element1, const P& element2)
{//second昇順
	return element1.second < element2.second;
}
bool ps4(const P& element1, const P& element2)
{//second降順
	return element1.second > element2.second;
}


int main()
{
	string s;
	cin >> s;
	int num = stoi(s);
	vector<int>n(10);
	int prev = -1;
	bool ans = true;
	rep(i, 4) {
		int k = num%10;
		if (k == prev) {
			ans = false;
		}
		num /= 10;
		prev = k;
	}
	if (ans) {
		cout << "Good" << endl;
	}
	else {
		cout << "Bad" << endl;
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>

using namespace std;
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define reppe(i,a,b) for(int i = (int)(a) ; i <= (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)
#define repme(i,a,b) for(int i = (int)(a) ; i >= (int)(b) ; --i)

typedef long long ll;

long long GCD(long long a, long long b){if(b==0)return a;return GCD(b,a%b);}

int main() {
    int A, B; cin >> A >> B;
    repp(i,0,1000000) {
        if (int(i * 1.08 - i) == A && int(i * 1.1 - i) == B) {
            cout << i << endl;
            return 0;
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));


int main(){	
	long long M;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&M);
	vector<string> S(M-1+1);
	vector<long long> p(M-1+1);
	for(int i = 0 ; i <= M-1 ; i++){
		scanf("%lld",&p[i]);
		cin >> S[i];
	}
	
	map<ll, ll> m;
	ll ac = 0, pe = 0;
	rep(i, M) {
		if (m[p[i]] != -1) {
			if (S[i] == "AC") {
				ac++;
				pe += m[p[i]];
				m[p[i]] = -1;
			} else {
				m[p[i]]++;
			}
		}
	}
	cout << ac << " " << pe << endl;

	return 0;
}



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

int main () {
  int N ; 
  cin >> N ;
  int line[9] = {1,2,3,5,6,9,10,13,17} ;
  bool ans = true ;
  if(N < 18) {
    for(int i = 0 ; i < 9 ; i++) {
      if(line[i]== N ) ans = false ;
    }
  }
  if(ans) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}

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

int main(){
  int n; cin>>n;
  int h[n];
  for(int i=0;i<n;i++)cin>>h[i];
  
  int dp[n]={INT_MAX};
  dp[0]=0; dp[1]=abs(h[1]-h[0]);
  
  for(int i=2;i<n;i++){
    dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
  }
  
  cout<<dp[n-1]<<endl;
}

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

int main() {
  int n;  cin >> n;
  int rank[n];
  rep (i, n) {
    int a;  cin >> a;
    a--;
    rank[a] = i+1;
  }

  rep (i, n) {
    cout << rank[i];
    if (i < n-1) cout << ' ';
    else cout << endl;
  }

  return 0;
}


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

typedef struct Node{
  int data;
  struct Node *right, *left;
}node;

node *start;

node *list_init(void);
int insert_list(node *p, int x);
void delete_node(node *p);
node *search_x(int x);

int main(void){
  int i, n, x;
  char op[12];
  node *p;

  start = list_init();
  if(start == NULL){
    printf("?????¢????¢??????¨??????\n");
    exit(1);
  }
  
  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", op);
    if(strcmp(op, "insert") == 0){
      scanf("%d", &x);
      if(insert_list(start->right, x) == 0){
	printf("?????¢????¢??????¨??????\n");
	exit(1);
      }
    }else if(strcmp(op, "delete") == 0){
      scanf("%d", &x);
      p = search_x(x);
      if(p != NULL){
	delete_node(p);
      }
    }else if(strcmp(op, "deleteFirst") == 0){
      delete_node(start->right);
    }else if(strcmp(op, "deleteLast") == 0){
      delete_node(start->left);
    } 
  }

  p = start->right;
  while(p != start){
    printf("%d", p->data);
    if(p->right != start){
      printf(" ");
    }
    p = p->right;
  }
  printf("\n");
  return 0;
}


/* ??£????????????????????? */
node *list_init(void){
  node *p = (node *)malloc(sizeof(node));
  if(p != NULL){
    p->right = p;
    p->left = p;
  }
  return p;
}


/* ??£????????????x???p??????????????\ */
int insert_list(node *p, int x){
  node *q = (node *)malloc(sizeof(node));
  if(q == NULL)  return 0;  /* ?????¢????¢??????±??? */
  q->left = p->left;
  q->data = x;
  q->right = p;
  p->left->right = q;
  p->left = q;
  return 1;  /* ?????? */
}


/* ??£??????????????????p?????? */
void delete_node(node *p){
  p->left->right = p->right;
  p->right->left = p->left;
  free(p);
}


/* ??£??????????????????x?????¢?´¢ */
node *search_x(int x){
  node *p = start->right;

  while(p != start){
    if(p->data == x)  break;
    p = p->right;
  }
  if(p == start){
    return NULL;
  }else{
    return p;
  }
}

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

int main()
{
	long int N;
	cin>>N;
	
	long int i,tot=0;
	for(i=1;i<=N;++i)
	{
		if(i%3!=0&&i%5!=0)
		{
			tot+=i;
		}
		
	}
			cout<<tot<<endl;

}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define f(i,x,n) for(ll i=x;i<n;i++)
#define fl(i,x,n) for(ll i=n;i>=x;i--)
#define mod (ll)1e9+7
#define print(x) cout<<x<<endl
#define vec vector<ll>
#define pai pair<ll, ll>
#define itr(it) :: iterator it
#define MAX (ll)1e16
#define MIN (ll)-1e16
#define X first
#define Y second
#define up upper_bound
#define lo lower_bound
using namespace std;
       ///////////   ///     ///   ///      ///   ////////////  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///           ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///////////   ///      ///   ////////////  ////////////
               ///   ///     ///   ///      ///   ///      ///  ///      ///
               ///   ///     ///   ///      ///   ///      ///  ///      ///
       ///////////   ///     ///   ////////////   ////////////  ///      ///
ll minn( ll a , ll b) 
{
    if(a>b)
        return b;
    return a;
}
ll maxx2( ll a , ll b)
{
    if(a>b)
        return a;
    return b;
}
ll maxx(ll a,ll b,ll c)
{
  return maxx2(a,maxx2(b,c));
}
ll gcdd(ll a, ll b)
{
    if(b==0)
        return a;
    else
        return gcdd(b,a%b);
}
ll dsum(ll n)
{
    ll sum=0;
    while(n>0)
    {
        sum+=n%10;
        n/=10;
    }
    return sum;
}
ll poww(ll a,ll b)
{
    if(b<=0)
        return 1;
    if(b==1)
        return a;
    if(b==2)
        return (a*a);
    else
        return poww(poww(a,b/2),2)*(poww(a,b%2));
}
ll sumsq(ll x,ll y,ll z)
{
    return (x-y)*(x-y)+(y-z)*(y-z)+(z-x)*(z-x);
} 
signed main() 
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    IOS;
    ll a[5],ans=0;
    f(i,0,5)
    {
        cin>>a[i];
        if(a[i]==0)
        {
            ans=i+1;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3640
n=int(input())
l=[list(input()) for i in range(n)]
s=set()
for i in l:
    for j in i:
        s.add(j)
s=sorted(s)
x=[[] for i in range(len(s))]

for i in range(len(s)):
    for j in range(n):
        x[i].append(l[j].count(s[i]))

ans=[]
for i in range(len(s)):
    ans.append(s[i]*min(x[i]))
print("".join(ans))


Measured memory_bytes: 38768
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
//typedef __int64 LL;
typedef pair<int,int> P;
const int INF=1000000000;
const int MOD_2=998244353;

int main()
{
	string s;
	cin>>s;
	if(s=="AAA" || s=="BBB")cout<<"No"<<"\n";
	else cout<<"Yes"<<"\n";	
	return 0;
}
	

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

#define _USE_MATH_DEFINES
#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>

#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef long long int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

//const i64 mod = 1'000'000'000ll + 7;
const i64 smod = 998244353ll;

//const i64 inf = mod;

const long double eps = 1e-8;

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed); cerr.precision(15); cerr.setf(ios::fixed);

    i64 n;
    cin >> n;

    pair<i64, i64> m[2];

    for (i64 i = 0; i < n; i++) {
        i64 x, y;
        cin >> x >> y;

        i64 t[2] = { x + y, x - y };

        for (i64 j = 0; j < 2; j++) {
            if (!i || m[j].first < t[j]) {
                m[j].first = t[j];
            }
            if (!i || m[j].second > t[j]) {
                m[j].second = t[j];
            }
        }
    }

    i64 R = max(abs(m[0].first - m[0].second), abs(m[1].first - m[1].second));
    cout << R << endl;


    return 0;
}

Measured memory_bytes: 3540
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;

int main(void){
    string s;
    cin >> s;
    int count = 0;
    int MAX = 0;
    char moji[] = {'A', 'T', 'G', 'C'};
    char check = 'a';

    for(int i = 0; i < s.length(); i++){
        for(int j = 0; j < 4; j++){
            if(s[i] == moji[j]){
                count++;
                s[i] = check;
            }
        }
        if(s[i] != check){
            MAX = max(MAX, count);
            count = 0;
            }
    }
    MAX = max(MAX, count);

    cout << MAX << endl;
    return 0;
}

Measured memory_bytes: 256
///17571@nith.ac.in @Ankit Verma
#include <bits/stdc++.h>
using namespace std;
#define ff          first
#define ss          second
#define pb          push_back
#define MP          make_pair
#define int         long long
#define ll          long long
#define inf         0x3f3f3f3f
#define MOD         1000000007
#define ld          long double
#define eb          emplace_back
#define pii         pair<int,int>
#define ull         unsigned long long
#define all(v)      v.begin(), v.end()
#define f(i,x,n)    for(int i=x;i<n;i++)
#define fr(i,x,n)   for(int i=x;i>=n;i--)
#define fastio      ios::sync_with_stdio(false)

#define n_l '\n'
template <typename T, size_t N> int SIZE(const T (&t)[N]){ return N; } template<typename T> int SIZE(const T &t){ return t.size(); } string to_string(const string s, int x1=0, int x2=1e9){ return '"' + ((x1 < s.size()) ? s.substr(x1, x2-x1+1) : "") + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(const bool b) { return (b ? "true" : "false"); } string to_string(const char c){ return string({c}); } template<size_t N> string to_string(const bitset<N> &b, int x1=0, int x2=1e9){ string t = ""; for(int __iii__ = min(x1,SIZE(b)),  __jjj__ = min(x2, SIZE(b)-1); __iii__ <= __jjj__; ++__iii__){ t += b[__iii__] + '0'; } return '"' + t + '"'; } template <typename A, typename... C> string to_string(const A (&v), int x1=0, int x2=1e9, C... coords); int l_v_l_v_l = 0, t_a_b_s = 0; template <typename A, typename B> string to_string(const pair<A, B> &p) { l_v_l_v_l++; string res = "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; l_v_l_v_l--; return res; } template <typename A, typename... C> string to_string(const A (&v), int x1, int x2, C... coords) { int rnk = rank<A>::value; string tab(t_a_b_s, ' '); string res = ""; bool first = true; if(l_v_l_v_l == 0) res += n_l; res += tab + "["; x1 = min(x1, SIZE(v)), x2 = min(x2, SIZE(v)); auto l = begin(v); advance(l, x1); auto r = l; advance(r, (x2-x1) + (x2 < SIZE(v))); for (auto e = l; e != r; e = next(e)) { if (!first) { res += ", "; } first = false; l_v_l_v_l++; if(e != l){ if(rnk > 1) { res += n_l; t_a_b_s = l_v_l_v_l; }; } else{ t_a_b_s = 0; } res += to_string(*e, coords...); l_v_l_v_l--; } res += "]"; if(l_v_l_v_l == 0) res += n_l; return res; } void dbgm(){;} template<typename Heads, typename... Tails> void dbgm(Heads H, Tails... T){ cout << to_string(H) << " | "; dbgm(T...); } 
#define debug(...) cout << "[" << #__VA_ARGS__ << "]: "; dbgm(__VA_ARGS__); cout << endl

void IO() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
}

int32_t main() {
    //IO();
    fastio;
    cin.tie(nullptr);
    cout.tie(nullptr);
    int a, b; cin >> a >> b;
    int c = a * b; 
    cout << c << endl;
    

    return 0;
}


Measured memory_bytes: 3640