akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
int ans = 0;

void solve(vector< vector<pair<int, int> > > &a, int pos, vector<int> &sol) {
    if (pos == a.size()) {
        int ncurr = 0;
        int ok = true;
        for (int i = 0; i < a.size(); ++i) {
            if (sol[i]) {
                ncurr++;
                for (int j = 0; j < a[i].size(); ++j) {
                    if (sol[a[i][j].first-1] != a[i][j].second) {
                        ok = false;
                        break;
                    }
                }
                if (!ok) break;
            }
        }
        if (ok) ans = max(ans, ncurr);
        return;
    }
    sol[pos] = 1;
    solve(a, pos + 1, sol);
    sol[pos] = 0;
    solve(a, pos + 1, sol);
}

int main() {
    int n; scanf("%d", &n);
    vector< vector<pair<int, int> > > a(n);
    for (int i = 0; i < n; ++i) {
        int A; scanf("%d", &A);
        for (int j = 0; j < A; ++j) {
            int x, y; scanf("%d%d", &x, &y);
            a[i].push_back(make_pair(x, y));
        }
    }
    //vector< map<int, int> > seen(n);
    vector<int> sol(n);
    solve(a, 0, sol);
    printf("%d", ans);
    return 0;
}


Measured memory_bytes: 256
#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;
}
typedef long long int ll;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define endl "\n"
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
const int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(ALL(a));
    a.erase(unique(ALL(a)), a.end());
    cout << (n == a.size() ? "YES" : "NO") << endl;
}

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

main() {
    int A,B,C; cin >> A >> B >> C;
    if(A+B>=C) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

Measured memory_bytes: 256
s = input()
q = int(input())

#qs = []
hanten = 0
mae = ''
ushiro = ''
for i in range(q):
    x = input()
    if x[0] == '1':
        #qs.append(x)
        hanten += 1
    else:
        xx = x.split(' ')
        #qs.append(x.split(' '))
        if xx[1] == '1':
            if hanten % 2 == 0:
                mae = xx[2] + mae
            else:
                ushiro = ushiro + xx[2]
        else:
            if hanten % 2 == 0:
                ushiro = ushiro + xx[2]
            else:
                mae = xx[2] + mae           

if hanten % 2 == 0:
    s = mae + s + ushiro
else:
    s = ushiro[::-1] + s[::-1] + mae[::-1]

print(s)

Measured memory_bytes: 4360
#include <bits/stdc++.h>
#define MOD 1000000007
#define INF 9999999999
using namespace std;
typedef long long ll;

int main()
{
 
    
       
        

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
      
 	ll h1,m1,h2,m2,k;
 	cin>>h1>>m1>>h2>>m2>>k;
 	ll mins1 = h1*60 + m1;
 	ll mins2 = h2*60 + m2;
 	ll res;
 	if(mins1 <= mins2)   
 	{
 		res = max((ll)0,mins2-mins1-k);
 	}
 	else
 	{
 		ll temp = 1440-mins1 + 60;
 		res = max((ll)0,temp-k);
 	}
 	cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<string>
#include<vector>
#include<bits/stdc++.h>
#define pb push_back
using namespace std;
int main()
{
    int k,x;
    cin>>k>>x;
    if(k*500>=x)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 256
//Code by Anshuman Das Gupta

#include<bits/stdc++.h>
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define MOD 1000000007
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define loop(I,N) for(int i=I;i<N;i++)
#define sortvec(V) sort(V.begin(),V.end())
#define vec vector<int>
#define endl "\n"
using namespace std;
#define PI 3.14159265359
int fast_power(int base, int power) {
    int result = 1;
    while (power > 0) {

        if (power & 1) {
            result = (result * base) % MOD;
        }
        base = (base * base) % MOD;
        power = power >> 1;
    }
    return result % MOD;
}

bool isPrime(int x) {
    for (int i = 2; i <= sqrt(x); i++) {
        if (x % i == 0)
            return false;
    }
    if (x == 1)
        return false;
    return true;
}

int binsearch(int a[], int f, int r, int x) {
    while (f <= r) {
        int mid = (f + r) / 2;
        if (a[mid] == x)
            return mid;
        else if (a[mid] > x) {
            r = mid - 1;
        }
        else {
            f = mid + 1;
        }
    }
    return -1;
}
void sieve(int a[], int n) {
    a[0] = 0;
    a[1] = 0;
    for (int i = 2; i <= n; i++) {
        if (a[i] == 1) {
            for (int j = i + i; j <= n; j += i) {
                a[j] = 0;
            }
        }
    }
}
int maxlim = 1e18;
int32_t main() {
/*#ifndef ONLINE_JUDGE
    //for getting input from input.txt
    freopen("input.txt", "r", stdin);
    //for writing output to output.txt
    freopen("out.txt", "w", stdout);
#endif  */
    int t = 1;
    //cin >> t;
    while (t--) {
        string s;
        cin >> s;
        if (s[2] == s[3] && s[4] == s[5]) {
            cout << "Yes\n";
            exit(0);
        }
        cout << "No\n";
    }
    return 0;
}


Measured memory_bytes: 256
#http://sucrose.hatenablog.com/entry/2016/11/06/234635
n = int(input())

def num_divisors_table(n):
    table = [0] * (n + 1)

    for i in range(1, n + 1):
        for j in range(i, n + 1, i):
            table[j] += 1

    return table

fk = num_divisors_table(n+1)  
  
ans = 0
for k in range(1, n+1):
  ans += k*fk[k]
  
print(ans)

Measured memory_bytes: 151656
n , m = map(int, input().split())
food = [0] * m
data = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    for j in range(1, data[i][0] + 1):
        food[data[i][j] - 1] += 1

ans = 0
for i in range(m):
    if food[i] == n:
        ans += 1

print(ans)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
    int K, A, B;

    cin >> K >> A >> B;

    for (int i = A; i <= B; i++) {
        if (i % K == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
    
    return 0;
}

Measured memory_bytes: 3620
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

int main ()
{
  vector<int> x(3);

  for (int i = 0; i < 3; i ++) {
    scanf("%d", &x[i]);
  }

  sort(x.begin(), x.end());

  printf("%d %d %d\n", x[0], x[1], x[2]);

  return 0;
}

Measured memory_bytes: 2744
#include <cstdio>
#include <unordered_map>
#include <queue>
#include <chrono>
using namespace std;
int n,k;

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
    size_t operator()(const pair<int,int> &i)const{
        return ((long long)i.first)|(((long long)i.second)<<32);
    }
};

unordered_map<int,queue<int>, custom_hash> m;
int main(){
    scanf("%d%d",&n,&k);
    
    m[0]=queue<int>();
    m[0].push(-1);
    
    long long ans=0;
    int t,p=0;
    for (int x=0;x<n;x++){
        scanf("%d",&t);
        t=(t+p-1)%k;
        if (m.count(t)==0){
            m[t]=queue<int>();
        }
        else{
            while (!m[t].empty() && m[t].front()+k<=x) m[t].pop();
            ans+=m[t].size();
        }
        m[t].push(x);
        p=t;
    }
    
    printf("%lld\n",ans);
}

Measured memory_bytes: 142920
gets
b = gets.chomp.split(' ').map(&:to_i)
c = Hash.new(0)
b.each do |i|
  c[i] += 1
end
d = c.count { |_, v| v % 2 == 0 }
puts c.count - (d % 2 == 1 ? 1 : 0)

Measured memory_bytes: 17796
#include<stdio.h>
#include<iostream>
using namespace std;
int main(){
	int a[1000];
	int d,x,n;
	cin>>n>>d>>x;
	for(int i=1;i<=n;i++){
		cin>>a[i];
	}
	int ans=0;

	for(int i=1;i<=n;i++){
		ans=ans+d/a[i];
		if(d%a[i]!=0)ans++;
	}
	ans+=x;
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,m;
main()
{
	cin>>n>>m;
	vector<pair<int,int> >A;
	for(int i=0;i<n;i++)
	{
		int a,b;cin>>a>>b;
		A.push_back(make_pair(a,b));
	}
	sort(A.begin(),A.end());
	long ans=0;
	int id=0;
	while(m>0)
	{
		if(A[id].second<=m)
		{
			m-=A[id].second;
			ans+=1L*A[id].first*A[id].second;
		}
		else
		{
			ans+=1L*A[id].first*m;
			m=0;
		}
		id++;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 1400
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
using namespace std;
const int maxn=222222;
int tmp[maxn*3],tot,A[maxn],Ans[maxn*3];
struct hhh
{
	int a,b,c;
}h[maxn];
set<int> sst;
map<int,int> mmp[maxn*3];
bool cmp(const hhh &x,const hhh &y)
{
	return x.c>y.c;
}
int main()
{
	int N,M;scanf("%d%d",&N,&M);
	for(int i=1;i<=N;++i) scanf("%d%d%d",&h[i].a,&h[i].b,&h[i].c),tmp[++tot]=max(0,h[i].a-h[i].c),tmp[++tot]=max(0,h[i].b-h[i].c);
	for(int i=1;i<=M;++i) scanf("%d",A+i),tmp[++tot]=A[i];
	sort(tmp+1,tmp+1+tot);
	tot=unique(tmp+1,tmp+1+tot)-tmp-1;
	sort(h+1,h+1+N,cmp);
	mmp[1][0]=1;
	h[0].c=-1;
	for(int i=1;i<=N;++i) mmp[lower_bound(tmp+1,tmp+1+tot,max(0,h[i].a-h[i].c))-tmp][i]=1,mmp[lower_bound(tmp+1,tmp+1+tot,max(0,h[i].b-h[i].c))-tmp][i]=0;
	for(int i=1;i<=tot;++i)
	{
		for(map<int,int> ::iterator j=mmp[i].begin();j!=mmp[i].end();++j)
		{
			if(j->second) sst.insert(j->first);
			else sst.erase(j->first);
		}
		Ans[i]=h[*sst.rbegin()].c;
	}
	for(int i=1;i<=M;++i) printf("%d\n",Ans[lower_bound(tmp+1,tmp+1+tot,A[i])-tmp]);
	return 0;
}

Measured memory_bytes: 68992
#!/usr/bin/env python3

from collections import defaultdict
from heapq import heappush, heappop
import sys
import numpy as np
import numba

sys.setrecursionlimit(10**6)
input = sys.stdin.buffer.readline
INF = 10 ** 9 + 1  # sys.maxsize # float("inf")


def debug(*x):
    print(*x)


@numba.njit
def get_longest(start, values, next, head, longest):
    ret = longest[start]
    if ret != -1:
        return ret

    ret = 0
    p = head[start]
    while p:
        v = values[p]
        x = get_longest(v, values, next, head, longest) + 1
        if x > ret:
            ret = x
        p = next[p]

    longest[start] = ret
    return ret


@numba.njit
def solve(N, M, data):
    longest = np.repeat(-1, N + 1)

    values = np.zeros(M + 1, np.int32)
    next = np.zeros(M + 1, np.int32)
    head = np.zeros(N + 1, np.int32)
    p = 1
    for i in range(0, 2 * M, 2):
        v1 = data[i]
        v2 = data[i + 1]
        values[p] = v2
        next[p] = head[v1]
        head[v1] = p
        p += 1

    for i in range(N + 1):
        if head[i] == 0:
            longest[i] = 0

    ret = 0
    for v in range(N + 1):
        x = get_longest(v, values, next, head, longest)
        if x > ret:
            ret = x
    return ret


def main():
    N, M = map(int, input().split())
    data = np.int32(read().split())
    print(solve(N, M, data))


T1 = """
4 5
1 2
1 3
3 2
2 4
3 4
"""

T2 = """
6 3
2 3
4 5
5 6
"""

T3 = """
5 8
5 3
2 3
2 4
5 2
5 1
1 4
4 3
1 3
"""


def _test():
    """
    # >>> as_input(T1)
    # >>> main()
    # 3

    # >>> as_input(T2)
    # >>> main()
    # 2

    >>> as_input(T3)
    >>> main()
    3
    """
    import doctest
    doctest.testmod()


def as_input(s):
    "use in test, use given string as input file"
    import io
    global read, input
    f = io.StringIO(s.strip())
    input = f.readline
    read = f.read


USE_NUMBA = False
if (USE_NUMBA and sys.argv[-1] == 'ONLINE_JUDGE') or sys.argv[-1] == '-c':
    print("compiling")
    from numba.pycc import CC
    import numba
    cc = CC('my_module')
    cc.export(
        'solve',
        numba.i8(
            numba.i8, numba.i8,
            numba.typeof({1: [1]})))(solve)
    cc.compile()
    exit()
else:
    input = sys.stdin.buffer.readline
    read = sys.stdin.buffer.read

    if (USE_NUMBA and sys.argv[-1] != '-p') or sys.argv[-1] == "--numba":
        # -p: pure python mode
        # if not -p, import compiled module
        from my_module import solve  # pylint: disable=all
    elif sys.argv[-1] == "-t":
        _test()
        sys.exit()
    elif sys.argv[-1] != '-p' and len(sys.argv) == 2:
        # input given as file
        input_as_file = open(sys.argv[1])
        input = input_as_file.buffer.readline
        read = input_as_file.buffer.read

    main()


Measured memory_bytes: 132680
<?php
fscanf(STDIN, '%d', $n);
fscanf(STDIN, '%s', $s);
$ans = 0;
$s[$n] = "";
for ($i = 0; $i < $n; $i++) {
    if ($s[$i] !== $s[$i+1]) $ans++;
}
echo $ans.PHP_EOL;

Measured memory_bytes: 4728
from collections import Counter

n=int(input())
s=input()

c=Counter(s)
ans1=c['B']*c['R']*c['G']

lim= n//2 if n%2==1 else n//2-1

for i in range(1,lim+1):
  for j in range(i,n-i):
    right=s[j-i]
    middle=s[j]
    left=s[j+i]
    if right!=middle and middle!=left and left!=right:
      ans1-=1
print(ans1)

Measured memory_bytes: 9464
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
#define repr(i, n) for (int i = (int)n - 1; i >= 0; --i)
#define ALL(a) (a).begin(), (a).end()
const ll mod = 1e9 + 7;

int main() {
  int x, y;
  cin >> x >> y;
  int sum = 0;
  if (x == 1) sum += 300000;
  if (x == 2) sum += 200000;
  if (x == 3) sum += 100000;
  if (y == 1) sum += 300000;
  if (y == 2) sum += 200000;
  if (y == 3) sum += 100000;
  if (x == 1 && y == 1) sum += 400000;
  cout << sum << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
A_sorted = sorted(A, reverse=True)

if N%2 == 0:
    print(sum(A_sorted[:N//2]) * 2 - A_sorted[0])
else:
    print(sum(A_sorted[:N//2]) * 2 - A_sorted[0] + A_sorted[N//2])


Measured memory_bytes: 31608
N = int(input())
BA = []
for i in range(N):
    A, B = map(int, input().split())
    BA.append([B, A])
BA = sorted(BA)
TIME = 0
for i in BA:
    TIME += i[1]
    if TIME > i[0]:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 37272
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<deque>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<string>
#define rep(i,n,m) for(int i=(n);i<(int)(m);i++)
#define reps(i,n,m) for(int i=(n);i<=(int)(m);i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define LB(a,x) lb(all(a), x) - a.begin()
#define UB(a,x) ub(all(a), x) - a.begin()
#define printfdouble(x) printf("%.12f\n",(x))
#define chartoint(c) (int)((c) - '0')
#define chartoll(c) (long long)((c) - '0')
#define MOD 1000000007
#define itn int
#define enld endl
#define ednl endl
#define icn cin
#define Endl endl
#define stirng string
using namespace std;
typedef long long ll;
const double pi = 3.141592653589793;
using Graph = vector<vector<int>>;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return 1;} return 0;}
template<class T> bool chmin(T &a, const T &b){if(b<a){a=b; return 1;} return 0;}
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}


int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    int N,X,T; cin >> N >> X >> T;
    cout << (N+X-1)/X * T << endl;
    return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,s=1,s2;
cin>>n;
while(1){
	s2=s;
	s2%=3;
	if(s2==0) cout<<" "<<s;
	else 
	for (s2=s; s2;s2/=10)
		{
		if (s2%10==3) 
			{cout<<" "<<s;
			break;};
		};
	if(s==n) break;
	s++;
	};
cout<<endl;
return 0;
}


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

#define NREP() for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 0; i < n; i++)
#define ALL(x) (x).begin(),(x).end()
#define MSG(x) cout << x << endl;
#define YN(x) x ? cout << "YES" << endl : cout << "NO" << endl;
#define Yn(x) x ? cout << "Yes" << endl : cout << "No" << endl;
#define yn(x) x ? cout << "yes" << endl : cout << "no" << endl;

using namespace std;
using ll = long long;
const static ll MOD = 1e9 + 7;

int main() {
    ll x1, y1, x2, y2;

    cin >> x1 >> y1 >> x2 >> y2;

    cout << x2 - (y2 - y1) << " "
         << y2 + (x2 - x1) << " "
         << x1 - (y2 - y1) << " "
         << y1 + (x2 - x1) << " ";
    return 0;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))

MOD = int(1e9) + 7

def fn(ls):
    l = len(ls)
    ret = 0
    for i in range(l):
        c = l - 1 - 2 * i
        ret += c * ls[l-i-1]
        ret %= MOD
    return ret

x = fn(xs)
y = fn(ys)
ans = x * y % MOD
print(ans)


Measured memory_bytes: 18624
#include <bits/stdc++.h>
using namespace std;
pair<long long, long long> a[101010];
main()
{
    int n;
    int x, y;
    long long o;
	cin >>n;
    for(int i = 0; i < n; i ++)
        cin >>a[i].first >>a[i].second;
    for(int k = o = 0; k < 100000; k ++)
    {
        random_shuffle(a, a + n);
        x = 0;
        y = 0;
        for(int i = 0; i < n; i ++)
        {
        	
            if((long long)(x + a[i].first) * (x + a[i].first) + (long long)(y + a[i].second) * (y + a[i].second) > (long long)x * x + (long long)y * y)
            {
                x += a[i].first ;
                y += a[i].second;
            }
        }
        o = max(o, (long long)x * x + (long long)y * y);
    }
    cout <<fixed <<setprecision(20) <<(sqrt(o));
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
#define N 200010
using namespace std;

ll n, k, ans, a[N];

inline ll read(){
	ll s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w *= -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}

inline void init(){
	n = read(), k = read();
	REP(i, 1, n) a[i] = read();
}

inline void work(){
	init();
	sort(a + 1, a + n + 1);
	reverse (a + 1, a + n + 1);
	REP(i, k + 1, n) ans += a[i];
	printf("%lld\n", ans);
}

int main(){
	work();
	return 0;
}

Measured memory_bytes: 1792
#include "bits/stdc++.h"
// Begin Header {{{
#define all(x)          (x).begin(), (x).end()
#define rep(i, n)       for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, s, t)   for (i64 i = (s), i##_limit = (t); i <= i##_limit; ++i)
#define repr(i, s, t)   for (i64 i = (s), i##_limit = (t); i >= i##_limit; --i)
#ifndef DBG
#define trace(...)
#endif
using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T, class U> inline bool chmax(T &a, const U &b) { return b > a && (a = b, true); }
template <class T, class U> inline bool chmin(T &a, const U &b) { return b < a && (a = b, true); }
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template <class T>
inline vector<T> make_v(const T &initValue, size_t sz) {
    return vector<T>(sz, initValue);
}

template <class T, class... Args>
inline auto make_v(const T &initValue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initValue, args...))>(sz, make_v<T>(initValue, args...));
}

inline void read() {}

template <class Head, class... Tail>
inline void read(Head &head, Tail&... tail) { cin >> head; read(tail...); }

inline void print() { cout << "\n"; }

template <class Head, class... Tail>
inline void print(Head &&head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail)) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
inline ostream& operator<< (ostream &out, const vector<T> &vec) {
    static constexpr const char *delim[] = { " ", "" };
    for (const auto &e : vec) out << e << delim[&e == &vec.back()];
    return out;
}
// }}} End Header

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

    int N; cin >> N;
    vector<int> a(N);

    rep(i, N) cin >> a[i];

    vector<int> foldL(N), foldR(N);
    foldL[0] = a[0];
    foldR[N-1] = a[N-1];

    reps(i, 1, N-1) foldL[i] = __gcd(a[i], foldL[i-1]);
    repr(i, N-2, 0) foldR[i] = __gcd(a[i], foldR[i+1]);

    trace(foldL);
    trace(foldR);

    int ans = 1;
    chmax(ans, foldL[N-2]);
    chmax(ans, foldR[1]);

    reps(i, 1, N-2) chmax(ans, __gcd(foldL[i-1], foldR[i+1]));

    print(ans);

    return 0;
}


Measured memory_bytes: 1408
int main(void){
    int S;
    int h,m,s;
    scanf("%d",&S);
    h = S / (60 * 60);
    s = S % 60;
    m = (S % (60 * 60) - s)/60;
    printf("%d:%d:%d\n",h,m,s);
    return 0;
}

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

int main(void){
    // Your code here!
    int N;
    long sum = 0;
    int T[200000] = {};
    int A[200000];
    scanf("%d", &N);
    
    for(int i = 0; i < N; i++)
    {
        scanf("%d", &A[i]);
        T[A[i]-1]++;
    }
    
    for(int i = 0; i < N; i++)
    {
        //printf("%d\n",T[i]);
        sum += (long)T[i] * (T[i]-1) / 2;
    }
    
    for(int i = 0; i < N; i++)
    {
        if(T[A[i]-1] <= 1)
            printf("%ld\n", sum);
        else
            printf("%ld\n", sum-(T[A[i]-1]-1));
    }
}


Measured memory_bytes: 4096
Q, H, S, D = map(int, input().split()) # yen
N = int(input()) # L want
min1 = min(2 * Q, H)
min2 = min(2 * min1, S)
min3 = min(2 * min2, D)
print(N // 2 * min3 + N % 2 * min2)

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

using namespace std;

int main() {
    int N;

    cin >> N;

    vector<int> A(N+1), B(N);
    for (int i=0; i < N+1; i++) {
        cin >> A[i];
    }
    for (int i=0; i < N; i++) {
        cin >> B[i];
    }

    long long ans = 0;
    for (int i = 0; i < N; i++) {
        int kill = min(A[i], B[i]);
        ans += kill;
        B[i] -= kill;

        kill = min(A[i+1], B[i]);
        ans += kill;
        A[i+1] -= kill;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <numeric>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <utility>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1e9 + 7
#define INF 1e9
#define SENTINEsL 2e9
#define PIE 3.1415a926535

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>
inline T GCD(T a, T b){if (b == 0) return a; else return GCD(b, a % b);}
template <class T>
inline T LCM(T a, T b) {return (a * b) / GCD(a, b);}

double culc(int xi, int xj, int yi, int yj){
    int bs = (xi - xj) * (xi - xj) + (yi - yj) * (yi - yj);
    double distance = sqrt(bs);
    return distance;
}

int factorial(int n){
    if(n == 1)
        return 1;
    else
        return n * factorial(n - 1);
}

int main(){
    int n;
    cin >> n;
    int x[n], y[n];
    vector<int> p(n);
    rep(i, n) {
        cin >> x[i] >> y[i];
        p[i] = i + 1;
    }
    double sum = 0;
    do{
        rep(i, n -1){
            sum += culc(x[p[i + 1] - 1], x[p[i] - 1], y[p[i + 1] - 1], y[p[i] - 1]);
        }
    } while (next_permutation(p.begin(), p.end()));
    cout << fixed << setprecision(10) << sum / factorial(n) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
using namespace std;
// using namespace __gnu_pbds;
#define lli long long int
#define llu unsigned long long int
#define pb push_back
#define rt return 0
#define endln "\n"
#define all(x) x.begin(), x.end()
#define sz(x) (lli)(x.size())
const lli MOD = 1e9 + 7;
const double PI = 3.14159265358979323846264338;
// cout << fixed << setprecision(0) << pi <<endl;
// typedef tree<int, null_type, less<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// for multiset
// typedef tree<int, null_type, less_equal<int>, rb_tree_tag,
//              tree_order_statistics_node_update>
//     new_data_set;
// order_of_key(val): returns the number of values less than val
// find_by_order(k): returns an iterator to the kth largest element (0-based)

void solve() {
    lli n;
    cin >> n;

    vector<lli> cnt(n + 2, 0);
    for (lli i = 1; i <= n; i++) {
        for (lli j = i; j <= n; j += i) {
            cnt[j]++;
        }
    }

    lli ans = 0;
    for (lli i = 1; i <= n; i++) {
        ans += i * cnt[i];
    }
    cout << ans << endl;
}

int main(void) {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    // lli t; cin >> t; while(t--)
    solve();
    rt;
}

Measured memory_bytes: 81340
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scanner = new Scanner(System.in);
		int a = scanner.nextInt();
		int b = scanner.nextInt();
		int c = scanner.nextInt();

		int sum1 = a + b;
		int sum2 = a + c;
		int sum3 = b + c;

		int[] sums = {sum1, sum2, sum3};
		int intMin = sums[0];

		for(int i = 0; i < sums.length; i++) {
			if (intMin > sums[i]) {
				intMin = sums[i];
			}
		}

		System.out.println(intMin);
	}

}

Measured memory_bytes: 21204
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define debugvec(v)   rep(i, v.size()) cerr << "L" << __LINE__ << ": " << #v << "[" << i << "] = " << v[i] << endl;
#define debugvec2(v)  cerr << "L" << __LINE__ << ": " << #v << " = { "; rep(i, v.size()) cerr << v[i] << (i + 1 == v.size() ? "" : ", "); cerr << " }" << endl;
typedef long long ll;  /* 10^18 くらいまでいける */

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

  int ans = 0;
  for (int i=0; i<n-2; i++){
    if (s[i] == 'A' && s[i+1] == 'B' && s[i+2] == 'C')
      ans++;
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define req(i,n) for(int i = 1;i <=n;i++)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;

const int MOD = 1000000007;
typedef pair<int,int> P;

//最大公約数
int gcd(int a,int b){
	if (a%b == 0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}

}

//最小公倍数
int lcm(int a,int b){
	return a /gcd(a,b) * b;
}

//素数判定
bool is_prime(long long N) {
    if (N == 1) return false;
    for (long long i = 2; i * i <= N; ++i) {
        if (N % i == 0) return false;
    }
    return true;
}



  








      

 
int main() {
    int n, a, res = 1;
    cin >> n;
    rep(i, n) {
        cin >> a;
        if (a % 2 == 0)res *= 2;
    }
    cout << pow(3, n) - res << endl;
    return 0;
}

Measured memory_bytes: 4132
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep='\n')

k = ni()
s = ns()
if len(s) > k:
    print(s[:k] + '...')
else:
    print(s)


Measured memory_bytes: 9184
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
	long long a,b,res;
	

	cin>>b>> a;
	if(a==b){
		cout << a;
		return 0;
	}
	
	if(b>1)
	{
	b=b-1;
	if(a%4==1)   a=1;
	else if(a%4==2)  a=a+1;
	else  if(a%4==3)  a=0;
	else a=a;           
	if(b%4==1)   b=1;
	else if(b%4==2)  b=b+1;
	else  if(b%4==3)  b=0;
	else b=b;   
	res=a^b;
    }    
	else if(b==1)
	{
		if(a%4==1)   a=1;
		else if(a%4==2)  a=a+1;
		else  if(a%4==3)  a=0;
		else a=a;           
		res= a; 
	}
	
	cout << res;
	
}


Measured memory_bytes: 3156
#include <bits/stdc++.h>
 
using namespace std;
 
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) ((int)(x).size())
#define whole(x) (x).begin(), (x).end()
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pii;
typedef pair < ll, ll > pll;
 
const int N = int(2e5) + 2;
const int LG = 20;
const ll mod = (int)1e9 + 7;
const int INF = (int)1e9 + 7;
const ll linf = 1e18; 
const ld pi = acos(-1);
const int base = 10;
const ld EPS = 1e-9;

int a, b, c;
int main (){
    scanf ("%d %d %d", &a, &b, &c);
    int rem = (a - b);
    printf ("%d\n", max(0, c - rem));
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int ans1 = 0, ans2 = 0;
        for(int i = 0; i < n; i++){
            String s = scan.next();
            String t = scan.next();
            int comp = s.compareTo(t);
            //System.out.println(comp);
            if(comp <= -1)ans1 += 3;
            else if(comp >= 1)ans2 += 3;
            else {
                ans1++;
                ans2++;
            }
        }
        System.out.println(ans2 + " " + ans1);
    }
}



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

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

const ll INF = 1LL << 60;
const int MOD = 1000000007;

int main() {
#ifdef MYLOCAL
    ifstream in("input.txt");
    cin.rdbuf(in.rdbuf());
#endif

    ll k, a, b; cin >> k >> a >> b;

    ll ans = 0;

    ll offset = 0;
    if( (k - a - 1) % 2 == 0) offset = 0;
    else offset = 1;

    for(ll i = a - 1; i <= k; i = i + 2){
        ll stock = 1 + i + offset;
        stock += (b - a) * ((k - i - offset) / 2);
        ans = max(ans, stock);
    }

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



Measured memory_bytes: 256
n = int(input())
hit = out = score = 0
while(n):
    d = input()
    if d == "HIT":
        hit += 1
        if hit == 4:
            hit = 3
            score += 1
    elif d == "OUT":
        out += 1
        if out == 3:
            n -= 1
            print(score)
            hit = score = out = 0
    else:
        score += hit + 1
        hit = 0


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

int main(){
  int N,K;
  cin >> N >> K;
  vector<int> A(N,0);
  for(int i=0;i<N;i++){
    cin >> A[i];
  }
  int ans = min(abs(A[0])+abs(A[0]-A[K-1]),abs(A[K-1])+abs(A[0]-A[K-1]));
  for(int i=0;i+K-1<N;i++){
    ans = min(ans,min(abs(A[i])+abs(A[i]-A[K+i-1]),abs(A[K+i-1])+abs(A[i]-A[i+K-1])));
  }
  cout << ans << endl;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define uint unsigned
#define pii pair<int,int>
#define pll pair<ll,ll>
#define PB push_back
#define fi first
#define se second
#define For(i,j,k) for (int i=(int)(j);i<=(int)(k);i++)
#define Rep(i,j,k) for (int i=(int)(j);i>=(int)(k);i--)
#define CLR(a,v) memset(a,v,sizeof(a));
#define CPY(a,b) memcpy(a,b,sizeof(a));
using namespace std;
int n,a[300005];
void GG(){
	puts("No");
	exit(0);
}
int main(){
	scanf("%d",&n);
	For(i,1,n) scanf("%d",&a[i]);
	for (int l=1,r;l<=n;l++){
		if (a[l]==l) continue;
		for (r=l;;r+=2){
			if (r+1>n||a[r+1]!=r+1) break;
			if (r+2>n||a[r+2]==r+2) break;
		}
		For(i,l,r)
			if (a[i]<l||a[i]>r)
				GG();
		int v0=0,v1=0;
		For(i,l,r)
			if (a[i]<i){
				if (a[i]<v0) GG();
				v0=a[i];
			}
			else if (a[i]>i){
				if (a[i]<v1) GG();
				v1=a[i];
			}
		l=r;
	}
	puts("Yes");
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
using namespace std;

#define REP(i, s, e) for (int i = (s); i < (e); i++)
#define REPI(i, s, e) for (int i = (s); i <= (e); i++)
#define rep(i, n) REP(i, 0, n)
#define repi(i, n) REPI(i, 0, n)
#define ALL(v) (v).begin(), (v).end()

#define dump(x) (cout << #x << " = " << x << endl)
#define dump2(x, y) (cout << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")" << endl)
#define dump3(x, y, z) (cout << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", "<< z << ")" << endl)

typedef long long ll;
typedef pair<int, int> pii;

#define INF (1<<29)
#define MAX 20000
int price;
int coins[4];

int ps[] = { 10, 50, 100, 500 };

int main(void)
{
	bool first = true;
	while (cin >> price, price) {
		rep(i, 4) cin >> coins[i];
		if (!first)
			puts("");
		first = false;

		int sum = 0;
		rep(i, 4) sum += ps[i]*coins[i];

		sum -= price;
		for (int i = 3; i >= 0; i--)
			while(sum >= ps[i])
				sum -= ps[i], coins[i]--;

		rep(i, 4)
			if (coins[i] > 0)
				printf("%d %d\n", ps[i], coins[i]);
	}
	return 0;
}

Measured memory_bytes: 1148
#include <stdio.h>

int main()
{
  int i, N, ret;
  char S[100001];
  
  ret = scanf("%d", &N);
  ret = scanf("%s", S);
  ret = N;
  for ( i=0; i<N-1; i++ ) {
    if ( S[i] == S[i+1] )
      ret--;
  }
  printf("%d\n", ret);
}

  

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

#define         eps         10e-9
#define         pi          2*acos(0)
#define         P1          1e9+7
#define         P2          1e9+9
#define         lli         long long int

using namespace std;

///ISNNJB

/**int fx[]={+1,-1,+0,+0};
int fy[]={+0,+0,+1,-1};
int fx[]={+0,+0,+1,-1,-1,+1,-1,+1};
int fy[]={-1,+1,+0,+0,+1,+1,-1,-1};*/

int main()
{
    /***freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);*/

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    int a,b,i,minn,maxx;
    cin>>a>>b;
    minn=min(a,b);
    maxx=max(a,b);

    for(i=1; i<=maxx; i++)
        cout<<minn;
    cout<<endl;

    return 0;
}



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

const char wall = '#';
vector<vector<char>> fields;
vector<vector<bool>> used;
vector<vector<ll>> dist;
const int dx[4] = {0, -1, 0, 1};
const int dy[4] = {1, 0, -1, 0};

vector<ll> A;
// vectorのリサイズ
// A.resize(N);

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

vector<string> split_naive(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}

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

  ll a;
  string b;
  cin >> a >> b;
  vector<string> bs = split_naive(b, '.');
  ll rb = atoi(bs[0].c_str());
  ll ib = atoi(bs[1].c_str());
  ll ans = a * rb;
  ans += a * ib / 100;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3668
#include<cstdio>
#include<iostream>
#include<vector>
#include<tuple>
#include<queue>
#include<set>
#include<algorithm>
#include<string>
#include<math.h>

using namespace std;

int main(int argc, char* argv[]){
  int x[27] = {};
  int y[27] = {};
  string s,t;
  cin >> s >> t;
  for(int i = 0; i < s.length(); i++){
    x[s[i]-'a']++;
    y[t[i]-'a']++;
  }
  sort(x,x+27);
  sort(y,y+27);

  for(int i = 0; i < 27; i++){
    if(x[i]!=y[i]){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h> 
using namespace std; 
typedef long long ll; 
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I) 
const ll INF=1e9+7; 
const ll N = 101; 


class dijkstra{ 
//0indexed 
public: 
	int v,startv; 
	vector<int> d; 
	vector<vector<pair<int,int> > >e; 

void initsize(int n0){ 
	d.resize(n0); 
	for(int i=0;i<n0;i++)d[i]=INT_MAX; 
	vector<pair<int,int> > ep; 
	for(int i=0;i<n0;i++)e.push_back(ep); 
	v=n0; 
} 

void initstart(int s){ 
	startv=s;
	d[s]=0;
}

void make_edge(int x,int y,int cost){ 
	e[x].push_back(make_pair(y,cost)); 
	e[y].push_back(make_pair(x,cost)); 
}

void make_edgedir(int x,int y,int cost){ 
	e[x].push_back(make_pair(y,cost)); 
}

void calcdistance(){ 
	// <-cost,x> 
	//cost startv->x 
	priority_queue<pair<int,int> > q; 
	pair<int,int> p; 
	vector<bool> did; 
	for(int i=0;i<v;i++)did.push_back(false); 
	did[startv]=true; 
	for(int i=0;i<e[startv].size();i++){ 
		p.first=-e[startv][i].second; 
		p.second=e[startv][i].first; 
		q.push(p); 
	}

	while(q.size()!=0){ 
		pair<int,int> p; 
		p=q.top(); 
		q.pop(); 
		int x,costsx; 
		x=p.second; 
		costsx=-p.first; 
		if(did[x]==true)continue; 
		did[x]=true; 
		d[x]=costsx; 

		for(int i=0;i<e[x].size();i++){ 
			p.first=-(d[x]+e[x][i].second); 
			p.second=e[x][i].first; 
			if(did[p.second]==false)q.push(p); 
		} 
	} 
} 

}; 



int main(){ 
	dijkstra di;
	int n;
	cin>>n;
	di.initsize(n);
	di.initstart(0);
	FOR(i,0,n){
		int u,k;
		cin>>u>>k;
		FOR(j,0,k){
			int x,co;
			cin>>x>>co;
			di.make_edgedir(u,x,co);
		}
	}
	di.calcdistance();
	FOR(i,0,n){
		cout<<i<<" "<<di.d[i]<<endl;
	}
	return 0; 
}


Measured memory_bytes: 3188
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main()
{
	int n, d;
	cin >> n >> d;
	vector<vector<int>> x(n, vector<int>(d));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> x[i][j];
		}
	}
	int ans = 0;
	int t = 0;
	int s;
	for (int i = 0; i < n - 1; i++) {
		for (int j = i + 1; j < n; j++) {
			t = 0;
			for (int k = 0; k < d; k++) {
				t += abs(x[i][k] - x[j][k]) * abs(x[i][k] - x[j][k]);
			}
			s = sqrt(t);
			if (s * s == t) {
				ans++;
			}
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
//#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define mp make_pair
#define pb push_back

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);

int n;
stack <char> s;
char c;

int main()
{
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("bst.in", "r", stdin);
	//freopen("bst.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		cin >> c;
		while (s.size() != 0 && s.top() == c)
			s.pop();
		s.push(c);
	}
	cout << s.size();
	return 0;
}

Measured memory_bytes: 384
N = int(input())
A = list(map(int,input().split()))
A.sort()
min_ptn = A[1]
for i in range(min_ptn,0,-1):
  count = 0
  for a in A:
    if a%i!=0:
      count+=1
    if count>1:
      break
  if count<2:
    print(i)
    break

Measured memory_bytes: 14080
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

string A,B;

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>A>>B;
	A+=B;
	int X=0;
	FORR(c,A) X=X*10+c-'0';
	
	if(abs(sqrt(X)-(int)sqrt(X))<1e-6) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}


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


void solve(std::string S){
    if(S.at(1) == 'R'){
        cout << "ABC" << endl;
    }else{
        cout << "ARC" << endl;
    }
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep0(i, n) for (long long i = 0; i < (long long)(n); i++)
#define rep1(i,n) for(long long i=1;i<=(long long)(n);i++)
#define all(v) v.begin(),v.end()
#define Sort(v) sort(all(v))
#define Reverse(v) reverse(all(v))
#define Rsort(v) sort(all(v),greater)
#define pub(v) push_back(v)
#define pob(v) pop_back(v)
typedef long long ll;
typedef vector<ll> vel;
typedef vector<vector<ll>> vel2d;
typedef string str;
typedef pair<ll,ll> pal;
typedef vector<str> ves;
typedef vector<char> vech;


int main() {
    ll X;cin>>X;
    vel A;
    ll d=(ll)(pow(X,0.25)+1);
    rep0(i,d+1){
        //if(pow(i,5)>X){break;}
        A.pub((ll)pow(i,5));
    }
    //rep0(i,A.size()){cout<<A[i]<<",";}
    //cout<<endl;
    ll n=A.size();
    rep0(i,n){
        rep0(j,n){
            if(A[i]+A[j]==X){cout<<i<<" "<<-j<<endl; return 0;}
            if(A[i]-A[j]==X){cout<<i<<" "<<j<<endl; return 0;}

        }
    }
}


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

int main() {
	int n;
  	cin >> n;
  
   int ans[n];
   int a[n];
    for(int i=0;i<=n;i++){
	 ans[i]=0;
   	 a[i]=0;
  }

  
  for(int i=0;i<n;i++){
    cin>>a[i];
    ans[a[i]]++;
  }

	for(int k=1;k<=n;k++){
    	cout<<ans[k]<<endl;
    }
  
  
  
}

Measured memory_bytes: 5144
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d,e;scanf("%d%d%d",&a,&b,&c),d=a^b^c;
	e=(a==d)+(b==d)+(c==d);
	if(e==1)puts("Yes");
	else puts("No");
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

template<class T>
class Union_Find {
private:
  T n;
  vector<T> parent;
public:
  Union_Find(T v){
    n=v;
    parent.resize(n,-1);
  }
  T root(T v){
    if(parent[v]<0)return v;
    return parent[v]=root(parent[v]);
  }
  T size(T v){
    return -parent[root(v)];
  }
  bool connect(T a,T b){
    a=root(a);
    b=root(b);
    if(a==b)return false;
    if(size(a)<size(b)) swap(a,b);
    parent[a]+=parent[b];
    parent[b]=a;
    return true;
  }
  bool same(T a,T b){
    return root(a)==root(b);
  }
  T operator[](T a){
    return root(a);
  }
  bool operator()(T a,T b){
    return connect(a,b);
  }
};

int main(){

  int n;
  cin>>n;
  auto a = vec<ll>(n,n);
  cin>>a;

  auto b = a;
  bool is_shortest = true;
  rep(k,n)rep(i,n)rep(j,n){
    if(chmin(a[i][j],a[i][k]+a[k][j]))is_shortest=false;
  }
  if(!is_shortest){
    cout<<(-1)<<endl;
    return 0;
  }

  struct edge{
    ll f,t,c;
    edge(){}
    edge(ll f,ll t,ll c):f(f),t(t),c(c){}
    bool operator< (edge const& rhs){
      return c < rhs.c;
    }
  };
  vector<edge> E;
  E.reserve(n*n);
  rep(i,n)rep(j,n){
    if(i<=j)continue;
    E.emplace_back(i,j,a[i][j]);
  }
  sort(E.begin(),E.end());

  ll ans = 0;
  auto d = _vec<ll>(n,n,INF);
  //rep(i,n)d[i][i]=0;
  for(auto e:E){
    if(chmin(d[e.f][e.t],e.c)){
      d[e.t][e.f] = e.c;
      ans += e.c;
      rep(i,n)rep(j,n){
        chmin(d[i][j],d[i][e.f]+d[e.f][j]);
        chmin(d[i][j],d[i][e.t]+d[e.t][j]);
      }
      rep(i,n)rep(j,n){
        chmin(d[i][j],d[i][e.f]+d[e.f][j]);
        chmin(d[i][j],d[i][e.t]+d[e.t][j]);
      }
      
    }
  }
  cout<<(ans)<<endl;

}

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

typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;

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

    ll a[n];
    rep(i,n)    cin >> a[i];

    for(int i=k;i<n;i++){
        if(a[i-k]<a[i]) puts("Yes");
        else    puts("No");
    }

    return 0;
}

Measured memory_bytes: 5132
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define ll long long
#define P pair<int, int>

using namespace std;
int mod = 1000000007;

int N;
int main() {
  cin >> N;
  vector<int> x(N);
  int y[20][100005];
  rep(i, N) {
    cin >> x.at(i);
  }
  int L;
  cin >> L;

  int pos = 1;
  rep(i, N) {
    while(pos < N && x.at(pos) <= x.at(i)+L) {
      pos++;
    }
    y[0][i+1] = pos;
  }

  for(int i=0; i<18; i++) {
    for(int j=1; j<=N; j++) {
      y[i+1][j] = y[i][y[i][j]];
    }
  }

  int Q;
  cin >> Q;

  while(Q > 0) {
    Q--;
    int ans = 0;
    int a, b;
    cin >> a >> b;
    if (a > b) {
      int tmp = b;
      b = a;
      a = tmp;
    }

    int now = a;
    while (now < b) {
      int i=0;
      while (y[i][now] < b) {
        i++;
      }
      if (i >= 1) {
        now = y[i-1][now];
        ans += 1<<(i-1);
      } else {
        now = b;
        ans += 1<<i;
      }
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 8704
#include <iostream>
#include <iomanip>
#include <math.h>
#include <float.h>
using namespace std;

#ifndef M_PI
#define M_PI (4.0*atan(1.0))
#endif

int main() {
	// your code goes here
	int H,W;
	while(1){
		std::cin>>H>>W;
//		std::cout<<H<<" "<<W<<std::endl;
		if(H==0 && W==0) break;
		for(int i=0; i<H; i++){
			for(int j=0; j<W; j++) {
				std::cout<<"#";
			}
			std::cout<<std::endl;
		}
		std::cout<<std::endl;
	}
	return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<string>
#include<queue>
#include<algorithm>
#include<map>
#include<set>
#include<vector>

using namespace std;

#define INF 1000000007
#define LINF 1000000000000000007

typedef long long i64;
typedef pair<i64,i64> P;


i64 n, a[101010];

int main(){
	cin >> n;
	int ans = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i];
		ans = (ans ^ a[i]);
	}
	
	if(ans == 0) cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return 0;
}


Measured memory_bytes: 1024