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

using namespace std;

using int64 = long long;

template<typename T>
vector<vector<T>> Make2DVector(int d1, int d2, T default_value) {
  return vector<vector<T>>(d1, vector<T>(d2, default_value));
}

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

  int n;
  cin >> n;
  vector<vector<int64>> mat = Make2DVector<int64>(n, n, 0);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      cin >> mat[i][j];
    }
  }
  vector<int64> set_to_score(1 << n);
  for (int s = 0; s < 1 << n; s++) {
    for (int i = 0; i < n; i++) {
      for (int j = i + 1; j < n; j++) {
        if ((s & (1 << i)) > 0 && (s & (1 << j)) > 0) {
          set_to_score[s] += mat[i][j];
        }
      }
    }
  }

  vector<int64> dp(1 << n, INT64_MIN);
  function<int64(int)> solve = [&](int s) -> int64 {
    if (dp[s] != INT64_MIN) return dp[s];

    if (s == 0) return 0;
    int bit_count = 0;
    for (int i = 0; i < n; i++) {
      if ((s & (1 << i)) > 0) {
        bit_count++;
      }
    }
    if (bit_count == 1) return 0;

    int64 value = set_to_score[s];
    for(int t = (1 << n) - 1; t >= 0; t--) {
      t &= s;
      if (t == s || t == 0) continue;
      // cout << "s: " << s << " t: " << t << " s - t: " << s - t << endl;
      value = max(value, solve(t) + solve(s - t));
    }
    dp[s] = value;
    return value;
  };
  int64 ans = solve((1 << n) - 1);
  cout << ans << endl;
}


Measured memory_bytes: 1280
# -*- coding: utf-8 -*-
"""
B - KEYENCE String
https://atcoder.jp/contests/keyence2019/tasks/keyence2019_b

"""
import sys


def solve(S):
    l = len('keyence')
    diff = len(S) - l
    if diff < 0:
        return 'NO'
    for i in range(len(S)):
        t = S[:i] + S[i+diff:]
        if t == 'keyence':
            return 'YES'
    return 'NO'


def main(args):
    S = input()
    ans = solve(S)
    print(ans)


if __name__ == '__main__':
    main(sys.argv[1:])


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15); 
    int n, m, t1, t2; 
    cin >> n >> m;
    t1 = t2 = 0; 
    for (int i = 1; i <= n; ++i) {
        if (i % m == 0) {
            ++t1; 
        }   else if (2 * i % m == 0){
            ++t2; 
        }
    }
    long long ans = 1ll * t1 * t1 * t1 + 1ll * t2 * t2 * t2; 
    cout << ans << endl; 
    return 0; 
}

Measured memory_bytes: 256
#include <ios>
#include <iomanip>
#include <iostream>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF (1e9)
#define PI (acos(-1))
#define print(x) cout << x << endl
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
typedef pair <ll,ll> P;

int main()
{
    ll N, Y;
    cin >> N >> Y;
    for(ll x = 0; x <= 2 * 1000; x++) {
        for(ll y = 0; y <= 4 * 1000; y++) {
            ll z = N - x - y;
            if (z < 0) continue;
            if (10 * x + 5 * y + z == Y / 1000) {
                print(x << " " << y << " " << z);
                return 0;
            }
        }
    }
    print("-1 -1 -1");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>

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

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define no { cout << -1; return; }

void solve() {
    int n; string s;
    cin >> n >> s;
    int del = 0, R = 0, G = 0, B = 0;
    loop(i, n) {
        if (s[i] == 'R') ++R;
        else if (s[i] == 'G') ++G;
        else ++B;
        for (int j = i + 1; i + (j - i) * 2 < n; ++j)
            if (s[i] != s[j] && s[i] != s[i + (j - i) * 2] && s[j] != s[i + (j - i) * 2])
                ++del;
    }
    cout << R * G * B - del;
}
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3660
import sys
from functools import reduce
from fractions import gcd

sys.setrecursionlimit(10 ** 6)


def input(): return sys.stdin.readline().rstrip()

x1, y1, x2, y2 = map(int, input().split())
dx, dy = y1 - y2, x2 - x1
print(x2 + dx, y2 + dy, x1 + dx, y1 + dy)


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

using namespace std;
#define BUF (1000)
#define ll long long 

long long  x,y;

//最大公約数   ユークリッド互除法
long long gcd(long long a, long long b){
    if(b==0) return a;
    return gcd(b,a%b);
}

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

int main(void){
	cin >> x>>y;
	int anw=x;

	long long ans = lcm(x,y)-x;
	if(ans==0) ans = -1;	
	if(ans>1000000000000000000) ans = -1;
	cout << ans << endl;
	return 0;
}


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

typedef long long lli;
typedef pair<int,int> pii;
#define rep(i,n) for(lli i=0;i<(lli)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#define INF 999999999

#define F first
#define S second

#define EPS 1e-9

double f(pii a,pii b,pii c){
    pii p1,p2;
    p1=pii( a.F-b.F , a.S-b.S );
    p2=pii( a.F-c.F , a.S-c.S );
    
    return p1.F*p2.S-p1.S*p2.F;
}


int main(){
    int n;
    cin>>n;
    rep(hoge,n){
        pii p1,p2,p3,k,s;
        cin>>p1.F>>p1.S>>p2.F>>p2.S>>p3.F>>p3.S>>k.F>>k.S>>s.F>>s.S;
        
        
        double a=f(p1,p2,k);
        double b=f(p2,p3,k);
        double c=f(p3,p1,k);
        
        bool x;
        
        if( (a>=0&&b>=0&&c>=0) || (a<0+EPS&&b<0+EPS&&c<0+EPS) )x=true;
        else x=false;

    
        a=f(p1,p2,s);
        b=f(p2,p3,s);
        c=f(p3,p1,s);
        
        bool y;
        
        if( (a>=0&&b>=0&&c>=0) || (a<0+EPS&&b<0+EPS&&c<0+EPS) )y=true;
        else y=false;
        if(x==y)cout<<"NG"<<endl;
        else cout<<"OK"<<endl;
    }

}

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

int main(){
	string t, p;
	cin >> t >> p;

	int T = t.length();
	int P = p.length();
	for (int i = 0; i + P <= T; i++) 
		if (t.substr(i, P) == p) cout << i << "\n";

	return 0;
}

Measured memory_bytes: 3220
#include <iostream>
#include <algorithm>

using namespace std;
typedef long long ll;

ll gcd (ll n1, ll n2) {
    return (n2 == 0) ? n1 : gcd (n2, n1 % n2);
}

int main(int argc, const char *argv[])
{
    ll N, T, ans;
    cin >> N;
    cin >> ans;

    for (int i = 1; i < N; i++)
    {
        cin >> T;
        ans = ans / gcd(ans, T) * T;
    }

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


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main(){
  string str;
  getline(cin,str);
  for(int i=0;i<str.length();i++){
    if(str[i] >= 'a' && str[i] <= 'z'){
      str[i] -= 32;
    }
  }
    cout << str << endl;
   
}
  

Measured memory_bytes: 3168
import java.util.*;
import static java.lang.System.*;
import java.io.*;
public class Main  {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		StringBuilder a = new StringBuilder(sc.next());
		StringBuilder b = new StringBuilder(sc.next());
		StringBuilder c = new StringBuilder(sc.next());
		char turn = 'A';
		while(true) {
			StringBuilder sb = new StringBuilder();
			if( turn == 'A')  sb = a;
			if (turn == 'B') sb = b;
			if(turn == 'C') sb = c;
			if (sb.length() == 0) break;
			char ch = sb.charAt(0);
			ch -= 32;
			turn = ch;
			sb.deleteCharAt(0);
		}
		out.println(turn);
	}
}



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

int main(){
int N;
string s;
cin >> N;
cin >> s;
for(int i= 0; i<s.length();i++){
    int A = s[i] + N;
    if(A>90) A -=26;
    char B = A;
    cout << B;
}

}

Measured memory_bytes: 256
//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
 
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
 
ll pwr(ll base, ll p, ll mod = MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
 
 
int n, cc;
ll arr[100005], ans[100005], sparse[20][100005], BIT[2][100005];
map<int, int> pos, compress;
 
 
ll rmq(int l, int r){
	int k = log2(r-l+1);
	return max(sparse[k][l], sparse[k][r-(1<<k)+1]);
}
 
 
 
int main(){
 
    ios_base::sync_with_stdio(0);
    cin.tie(0);
 
    cin>>n;
    priority_queue<int> pq;
    for(int i=1;i<=n;i++){
    	cin>>arr[i];
    	compress[arr[i]];
    	pq.push(arr[i]);
    }

    cc = 0;
    for(auto &it : compress){
    	it.ss = ++cc;
    }
 
    for(int i=n;i>=1;i--)
    	pos[-arr[i]] = i;
 
    vector<int> seq;
    for(auto it : pos)
    	if(seq.empty() || it.ss < seq.back())
    		seq.pb(it.ss);
    seq.pb(0);
    reverse(seq.begin(), seq.end());
 
// cout<<"seq: ";for(auto it : seq)	cout<<it<<" ";cout<<endl;

	ll cnt = 0;
	for(int i=(int)seq.size()-1;i>=1;i--){
		int idx = seq[i];
		ll now = arr[seq[i]], next = arr[seq[i-1]];
		ans[idx] += cnt*(now - next);
		while(!pq.empty() && pq.top() >= next){
			ans[idx] += pq.top()-next;
			pq.pop();
			cnt++;
		}
	}
 
// cout<<cnt[9]<<endl;
 
    for(int i=1;i<=n;i++)
    	cout<<ans[i]<<endl;
    return 0;
}
 
 

Measured memory_bytes: 13688
#include <bits/stdc++.h>
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
*/#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
/*namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/#define lli long long int
#define uli unsigned long long int
#define INF 999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> A >> B;
  rep(i,0,A+1){
    if(i*2+(A-i)*4==B)flag=1;
  }
  if(flag)Out("Yes");
  else Out("No");
}

Measured memory_bytes: 3652
//ITP1_10_B
#include <stdio.h>
#include <math.h>

int main(){

	int a,b,C;
	double S,L,h;
	
	scanf("%d %d %d",&a,&b,&C);
	
	S=(a*b*sin(C*M_PI/180))/2;
	
	L=sqrt(pow(a,2)+pow(b,2)-2*a*b*cos(C*M_PI/180))+a+b;
	
	h=(S*2)/a;
	
	printf("%f\n%f\n%f",S,L,h);
	
	return 0;
}

Measured memory_bytes: 684
n = int(input())
t, a = map(int, input().split())
hLst = list(map(int, input().split()))
ans = int()
otmp = 10 ** 5

for i in range(n):
    tmp = t - hLst[i] * 0.006
    if abs(a - tmp) < abs(a - otmp):
        otmp = tmp
        ans = i + 1
print(ans)


Measured memory_bytes: 3060
from collections import *

N, M, X = map(int, input().split())
CA = [tuple(map(int, input().split())) for _ in range(N)]
ans = 10**18

for S in range(2**N):
    ans_cand = 0
    now = [0]*M
    
    for i in range(N):
        if (S>>i)&1:
            ans_cand += CA[i][0]
            
            for j in range(1, M+1):
                now[j-1] += CA[i][j]
    
    if min(now)>=X:
        ans = min(ans, ans_cand)

if ans==10**18:
    print(-1)
else:
    print(ans)

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
using P = pair<ll, ll>;
using V = vector<ll>;
#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 rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
#define ALL(obj) (obj).begin(), (obj).end()
#define MOD 1000000007
#define INF 1000000000

ll dp[100005][2];

void solve_abc_d() {
    ll n;
	cin >> n;

	V a(n);
	rep(i, n) {
		cin >> a[i];
	}

	dp[0][0] = a[0];
	dp[0][1] = -INF;
	rep(i, n - 1) {
		dp[i + 1][0] = max(dp[i][0] + a[i + 1], dp[i][1] + a[i + 1]);
		dp[i + 1][1] = max(dp[i][0] - 2 * a[i] - a[i + 1], dp[i][1] + 2 * a[i] - a[i + 1]);
	}

	ll ans = max(dp[n - 1][0], dp[n - 1][1]);

	cout << ans << "\n";
}

int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed;
	//cout << setprecision(7);

	solve_abc_d();

	return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<map>
using namespace std;

int digit_num = 0, ans = 0, N;

void dfs(string s, int length) {
    if (length == 0) {
        map<char, bool> MP;
        for (int i = 0; i < s.length(); i++) {
            MP[s[i]] = true;
        }
        if (MP['7'] && MP['5'] && MP['3'] && stoi(s) <= N) {
            ans++;
            return;
        }
        else return;
    }
    length--;
    dfs(s + '7', length);
    dfs(s + '5', length);
    dfs(s + '3', length);
    return;
}

int main() {
    int tmp;
    cin >> N;
    tmp = N;
    while (tmp > 0) {
        digit_num++;
        tmp /= 10;
    }
    string s;
    for (int num = digit_num; num >= 1; num--) dfs(s, num);
    cout << ans << endl;
    return 0;
}

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




int main()
{
	ll n,ans=1e12+7;
	cin>>n;

	for(ll i=1;i*i<=n;i++)
	{
		if(n%i==0)
		ans=min(ans,i+n/i -2);
		
	}
	cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long test,n,a,b;
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    test=1;
    while (test--)
    {
       cin>>a>>b;
       cout<<1ll*a*b<<endl;
    }
    
}    




Measured memory_bytes: 3620
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

from itertools import product

n, m, x = map(int, readline().split())
ca = [list(map(int, readline().split())) for _ in range(n)]
ans = float('inf')
for bit in product([0, 1], repeat=n):
    cnt = 0
    memo = [0] * m
    for i in range(n):
        if bit[i] == 1:
            cnt += ca[i][0]
            for j in range(m):
                memo[j] += ca[i][j + 1]
    for j in range(m):
        if memo[j] < x:
            break
    else:
        ans = min(ans, cnt)
if ans == float('inf'):
    ans = -1
print(ans)


Measured memory_bytes: 9288
#include <stdio.h>
#include <math.h>

#define N 252

int main(){
  int n, i, j;
  int ix;
  int a[N];

  scanf("%d", &n);
  for ( i = 1; i <= n; i++ ) scanf("%d", &a[i]);

  for( i = 1 ; i <= n; i++){
    printf("node %d: key = %d, " ,i ,a[i]);
    ix = parent(i);
    if( ix >= 1 && ix <= n ){     
      printf( "parent key = %d, " ,a[ix] );
    }
    ix = left(i);
    if( ix >= 1 && ix <= n ){
      printf( "left key = %d, " ,a[ix] );
    }
    ix = right(i);
    if(  ix >= 1 && ix <= n ){
      printf( "right key = %d, " ,a[ix] );
    }
    printf("\n");
  }

  return 0; // Don't forget return 0
}

int parent(int i){
  return floor(i/2);
}

int left(int i){
  return 2*i;
}

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

Measured memory_bytes: 600
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int (i) = 0, i_len = n; (i) < (i_len); ++(i))
#define repp(i,n) for(int (i) = 1, i_len = n; (i) <= (i_len); ++(i))
#define per(i,n) for(int (i) = n-1; (i) >= 0; --(i))
#define perr(i,n) for(int (i) = n; (i) > 0; --(i))
#define sz(x) ((int)(x).size())
#define popcnt __builtin_popcount
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).begin(),(v).end(),greater<>()
#define Pi 3.1415926535
#define MOD 1000000007;
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using itn = int;
using vint = vector<int>;
template<class T,class S> inline bool chmax(T& a, S b){if(a<b){a = b; return true;} return false;}
template<class T,class S> inline bool chmin(T& a, S b){if(a>b){a = b; return true;} return false;}
template<class T> T gcd(T a, T b){return b?gcd(b,a%b):a;}
template<class T> T lcm(T a, T b){return a*b/gcd(a,b);}
void yes(){cout << "Yes" << endl;}
void no(){cout << "No" << endl;}

int solve(){
    int a,b,c,d; cin >> a >> b >> c >> d;
    while(1){
        c -= b;
        if(c <= 0){
            yes();
            return 0;
        }
        a -= d;
        if(a <= 0){
            no();
            return 0;
        }
    }

    return 0;
}

int main(){
    cin.tie(0);
    cout << fixed << setprecision(10);
    ios::sync_with_stdio(false);
    solve();
    return 0;
}


Measured memory_bytes: 3616
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  int N;
  cin>>N; 
  vector<int>a(N);
  for(int j=0; j<N;j++){
    cin>>a.at(j);
  }
  int min=0;
  int max=0;
  bool ex=false;
  vector<int>b(8);
  for(int j=0; j<N;j++){
    if(a.at(j)<3200){
      ex=true;
      b.at(a.at(j)/400)=1;
    }
    else{
      max++;
    }
  }
  for(int j=0; j<8;j++){
    min+=b.at(j);
    max+=b.at(j);
  }
  if(ex){
    cout<<min<<" "<<max<<endl;
  }
  else{
    cout<<1<<" "<<max<<endl;
  }
  
}



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

int main() {
  ll x;
  cin >> x;
  ll a,b,count;
  a = x/100;
  b = x%100;
  count = 0;
  count += b/5;
  b = b%5;
  count += b/4;
  b = b%4;
  count += b/3;
  b = b%3;
  count += b/2;
  b = b%2;
  count += b;
  if(count <= a){
    cout << 1 << endl;
  }
  else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
 
using namespace std;
 
typedef long long ll;
 
#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;
 
#define MOD 1000000007

int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	cout << min(b/a,c) << endl;
	return 0;
}

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

int main() {
  int n, a[100];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  
  int count = 0;
  
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) {
      a[i] = 10000 + i;
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String x[] = sc.next().split("");
    String y[] = sc.next().split("");
    int ans = 0;
    if ((x[0].equals(y[2]) && x[1].equals(y[1])) && x[2].equals(y[0])){
      ans++;
    }
    System.out.println(ans == 0 ? "NO" : "YES");
  }
}


Measured memory_bytes: 35748
N = int(input())

first = 0
second = 0
flag =0
for i in range(9):
    first +=1
    second = 0
    for j in range(9):
        second +=1
        if(first * second == N):
            flag =1
if(flag == 1):
    print('Yes')
else:
    print('No')
        

Measured memory_bytes: 2940
n = gets.to_i
arr = gets.split.map(&:to_i)
h = arr.group_by(&:itself)
i = n - 1
while i > 1
  unless h[i]&.count == 2
    puts 0
    exit
  end
  i -= 2
end
unless h[i]&.count == i + 1
  puts 0
  exit
end
puts 2 ** (n / 2) % (10 ** 9 + 7)


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

int main(void){
    int i, n, count = 0;
    scanf("%d",&n);
    int a[n];
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        if((i+1)%2==1 && a[i]%2==1){
            count++;
        }
    }

    printf("%d",count);
    return 0;
}

Measured memory_bytes: 1724
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define rrep(i,n) for(int i=n; i>=1 ; i--)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define SP <<" "<<
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;



int main(){
    vi a(5);
    rep(i,5) cin >> a[i];

    int ans = 123 * 6;
    do{
        int tmp = 0;
        rep(i,4) tmp += ((a[i] + 9)/10) * 10;
        tmp += a[4];

        ans = min(ans,tmp);
    }while(next_permutation(ALL(a)));

    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
// Custom Header {{{
#define ALL(x) x.begin(), x.end()
using namespace std;
using i64 = long long;
using pii = pair<i64, i64>;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
// }}}

signed main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int q;
    cin >> q;

    while(q--) {
        int c, a, n;
        cin >> c >> a >> n;

        int ans = 0;
        for (int x = 0; x <= 1000; ++x) {
            for (int z = 0; z <= 1000; ++z) {
                if (
                        2*x + z <= c &&
                        x + z <= a &&
                        z <= n) {
                    int y = (c - 2 * x - z) / 3;
                    chmax(ans, x + y + z);
                }

            }
        }

        cout << ans << "\n";
    }

    return 0;
}

// vim: set foldmethod=marker :



Measured memory_bytes: 3200
#include <bits/stdc++.h>
using namespace std;
#define M 1046527

vector<string> H(M);

int getChar(char ch){
    if(ch == 'A') return 1;
    else if(ch == 'C') return 2;
    else if(ch == 'G') return 3;
    else if(ch == 'T') return 4;
    else return 0;
}

long long getKey(string str){
    long long sum = 0, p = 1;
    for(int i = 0;i < (int)(str.length()); i++){
        sum += p*(getChar(str.at(i)));
        p *= 5;
    }
    return sum;
}

int h1(int key){ return key % M;}
int h2(int key){ return 1 + (key % (M-1));}

int find(string e){
    long long key,h;
    key = getKey(e);
    for(int i = 0;;i++){
        h = (h1(key) + i * h2(key)) % M;
        if(H.at(h) == e) return 1;
        else if(H.at(h) == "") return 0;
    }
    return 0;
}

int insert(string e){
    long long key,h;
    key = getKey(e);
    for(int i = 0;;i++){
        h = (h1(key) + i * h2(key)) % M;
        if(H.at(h) == e) return 1;
        else if(H.at(h) == "") {
            H.at(h) = e;
            return 0;
        }
    }
    return 0;

}

int main(){
    int n, h;
    string com,e;
    scanf("%d",&n);
    for(int i = 0;i < n;i++){
        cin >> com >> e;
        if(com == "insert"){
            insert(e);
        }else{
            if(find(e)){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
}



Measured memory_bytes: 27588
#include<iostream>
#include<string>
#include<assert.h>

using namespace std;

int main(void) {
    char word[100];
    int i = 0;
    cin >> word;
    //assert(word[0] == '\0');
    while(true) {
        if(word[i] == '\0') {
            break;
        }
        i++;
    }
    cout << word[0]<< i-2 << word[i-1] << endl;
    return 0;
}


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

int main(){
	ll N,A,B,C,D,E,M;
	cin >> N >> A >> B >> C >> D >> E;
	M = min({A,B,C,D,E});
	cout << (N+M-1)/M+4 << endl;
}

Measured memory_bytes: 256
# include <iostream>
# include <stdint.h>
# include <stdio.h>
# include <math.h>
using namespace std;


int main(){
	long long r,c;
	cin >>r>>c;
	long long x[r+1][c+1] ={};
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			cin >>x[i][j];
		}
	}
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			x[i][c] += x[i][j];
		}
	}
	for(int j=0;j<c;j++){
		for(int i =0;i<r;i++){
			x[r][j] +=x[i][j];
		}
	}
	for(int i=0;i<r;i++){
		x[r][c] += x[i][c];
	}
	for(int j=0;j<c;j++){
		x[r][c] += x[r][j];
	}
	x[r][c] = x[r][c]/2;
	for(int i=0;i<r+1;i++){
		for(int j=0;j<c+1;j++){
			if(j ==0){
				cout <<x[i][j];
			}
			else{
				cout <<" "<<x[i][j];
			}
		}
		cout <<"\n";
	}
	return 0;
}



Measured memory_bytes: 3196
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    bool ans=false;
    vector<char> s(n);
    for(int i=0;i<n;i++)
    cin>>s[i];
    for(int i=0;i<n;i++){
        if(s[i]=='Y'){
            ans=true;
            break;
        }
    }
    if(ans)
    cout<<"Four"<<endl;
    else
    cout<<"Three"<<endl;
}

Measured memory_bytes: 3628
#include<stdio.h>

int main()
{
  char S[27];
  int i,j;
  int isUsed[27];
  char alphabet_map[27];//\0,a,b,...,z
  char before_a = 'a'-1;//alphabet -> 1-origin
  int end = 0;
  int isFound = 0;
  for(i = 0;i < 27;i++)
  {
    alphabet_map[i] = before_a+i;
    isUsed[i] = 0;
    S[i] = '\0';
  }
  alphabet_map[0] = '\0';
  isUsed[0] = 1;
  scanf("%s",S);
  for(i = 0;i < 27 && S[i] != '\0';i++)
  {
    isUsed[S[i]-before_a] = 1;
  }
  end = i;
  for(i = end;i >= 0;i--)
  {
    for(j = (S[i] == '\0'?1:S[i]-before_a+1);j<27;j++)
    {

      if(isUsed[j] == 0)
      {
        S[i] = j+'a'-1;
        goto SUCCESS;
      }
    }
    if(S[i] != '\0')
    {
      isUsed[S[i]-before_a] = 0;
      S[i] = '\0';
    }
  }
  printf("-1\n");
  return 0;
SUCCESS:
  printf("%s\n",S);
  return 0;
}

Measured memory_bytes: 128
using static System.Math;
using static System.Console;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AtCoder
{
	class Program
	{
		static void Main(string[] args)
		{
			//var line = ReadLine().Split(' ').Select(value => int.Parse(value)).ToArray();
			var t = ReadLine();
			WriteLine(t.Replace("?", "D"));
		}
	}
}


Measured memory_bytes: 20928
#ifndef BZ
#pragma GCC optimize "-O3"
#endif
#include <bits/stdc++.h>

#define FASTIO
#define ALL(v) (v).begin(), (v).end()
#define rep(i, l, r) for (int i = (l); i < (r); ++i)

#ifdef FASTIO
#define scanf abacaba
#define printf abacaba
#endif

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

using namespace std;


/*
ll pw(ll a, ll b) {
	ll ans = 1; while (b) {
		while (!(b & 1)) b >>= 1, a = (a * a) % MOD;
		ans = (ans * a) % MOD, --b;
	} return ans;
}
*/

const int MAXN = 1200 * 1200;

int n, m;
int a[MAXN];
int b[MAXN];

vector<int> gc[MAXN], gr[MAXN];
const ll MOD = 1e9 + 7;

int main() {
#ifdef FASTIO
	ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#endif
	cin >> n >> m;
	for (int i = 0; i < n; ++i)
		cin >> a[i], --a[i], gr[a[i]].push_back(i);
	for (int i = 0; i < m; ++i)
		cin >> b[i], --b[i], gc[b[i]].push_back(i);
	ll ans = 1;
	int r = 0;
	int c = 0;
	int cr = 0;
	for (int i = n * m - 1; i >= 0; --i) {
		if (gr[i].size() >= 2 || gc[i].size() >= 2) {
			cout << 0 << "\n";
			return 0;
		}
		if (gr[i].empty()) {
			if (gc[i].empty()) {
				ans = (ans * cr) % MOD;
				--cr;
			}
			else {
				ans = (ans * r) % MOD;
				cr += r - 1;
				++c;
			}
		}
		else {
			if (gc[i].empty()) {
				ans = (ans * c) % MOD;
				cr += c - 1;
				++r;
			}
			else {
				cr += r + c;
				++r, ++c;
			}
		}
	}
	cout << ans << "\n";
	return 0;
}




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

using namespace std;
using LL = long long;

int main(){
    LL a, b, c, d;

    cin >> a >> b >> c >> d;
    //if(a > c) swap(a, c);

    if(abs(c - a) <= d || ((abs(b - a) <= d) && (abs(c - b) <= d)))
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 256
#coding: utf-8

nextContest = int(input())

for i in range(nextContest, 1000):
    dig1 = int(i / 100)
    dig2 = int((i % 100) / 10)
    dig3 = int((i % 100) % 10)
    if dig1 == dig2 and dig2 == dig3:
        print (str(i))
        break


Measured memory_bytes: 2940
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstring>

using namespace std;

#define MAX 100000
#define INF 2140000000
#define MOD 1000000007

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<int> > s(m);

	for (int i = 0; i < m; ++i) {
		int k;
		cin >> k;
		int temp;

		for (int j = 0; j < k; ++j) {
			cin >> temp;
			s[i].push_back(temp);
		}
	}

	vector<int> p(m);

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

	int ans = 0;

	for (int i = 0; i < (1 << n); ++i) {
		int cnt = 0;
		for (int j = 0; j < m; ++j) {
			int temp = 0;
			for (int k = 0; k < (int) s[j].size(); ++k) {
				if (i & (1 << (s[j][k] - 1))) {
					temp++;
				}	
			}
			if (temp % 2 == p[j]) {
				cnt++;
			}
		}

		if (cnt == m) {
			ans++;
		}
	}

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

Measured memory_bytes: 256
from collections import deque
N = int(input())
L = []
for _ in range(N):
  x, l = map(int, input().split())
  L.append([x-l, x+l])
L.sort(key=lambda x: x[1])
L = deque(L)
s, ans = -10**8, 0
while L:
  l = deque.popleft(L)
  if s<=l[0]:
    ans += 1
    s = l[1]
print(ans)

Measured memory_bytes: 25952
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define INF INT_MAX
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
int main()
{
	chutiyaap;
	int n;cin>>n;
	int a[n+3];
	for(int i=0;i<n;i++)cin>>a[i];
	int sum1=0,sum2=0;
	int mini=INT_MAX;
	for(int i=0;i<n-1;i++)
	{
		sum1+=a[i];
		for(int j=i+1;j<n;j++)
		{
			sum2+=a[j];
		}
		mini=min(mini,abs(sum1-sum2));
		sum2=0;
	}
	cout<<mini;
}


Measured memory_bytes: 256
// finish date: 2018/02/05

#include <iostream>
#include <cmath>
#include <vector>
#include <bitset>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <climits>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
#define ll long long
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vvb vector<vector<bool>>
#define vs vector<string>
#define vc vector<char>
#define vvc vector<vector<char>>
#define bigmod 1000000007
#define INF 1050000000

//掛け算
int mul(int a, int b) {
    return (int) (((ll) (a % bigmod) * (b % bigmod)) % bigmod);
}

int main() {
    int N;
    cin >> N;
    vi A(N), B(N), C(N);
    rep(i, N) cin >> A[i];
    rep(i, N) cin >> B[i];
    rep(i, N) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());
    //B[i]<C[j]となるjの個数をBC[i]に格納(後に累積和)
    vl BC(N, 0);
    int idxB = 0, idxC = 0;
    while (idxB < N && idxC < N) {
        if (B[idxB] < C[idxC]) {
            BC[idxB] = N - idxC;
            idxB++;
        } else {
            idxC++;
        }
    }
    //後ろから累積和
    for (int i = N - 2; i >= 0; i--) {
        BC[i] += BC[i + 1];
    }
    ll ans = 0;
    int idxA = 0;
    idxB = 0;
    while (idxA < N && idxB < N) {
        if (A[idxA] < B[idxB]) {
            ans += BC[idxB];
            idxA++;
        } else {
            idxB++;
        }
    }

    cout << ans << endl;

    return 0;

}



Measured memory_bytes: 2304
a=int(input())
l=[]
for i in range(1,a+1):
    l.append(i)
k=[]
for i in range(1,a+1):
    if not i % 5 or not i % 3:
        k.append(i)
s=sum(k)
k=sum(l)
print(k-s)

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

int main() {
  int64_t x;
  cin >> x;
  int64_t a=100;
  for(int i=0; i<3761; i++){
    if(a>=x){
      cout << i << endl;
      break;
    }
    a=a+a/100;
  }
  
    
}

Measured memory_bytes: 3620
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <list>

using namespace std;

typedef pair<long long int, long long int> P;
long long int INF = 1e9;

int a[110000];
int cnt[110000] = {};

int main(){
	
	long long int n, K;
	cin >> n >> K;
	
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		if(a[i] > K){
			a[i] = 0;
		}
	}
	a[0] = 0;
	n++;
	
	int ans = INF;
	long long int sum = 0;
	int id = 0;
	
	for(int i = 0; i < n; i++){
		cnt[a[i]]--;
		if(cnt[a[i]] == 0){
			sum -= a[i];
		}
		while(sum != K * (K + 1) / 2){
			if(id >= n){
				break;
			}
			id++;
			cnt[a[id]]++;
			if(cnt[a[id]] == 1){
				sum += a[id];
			}
		}
		//cout << i << " " << id << endl;
		if(sum == K * (K + 1) / 2){
			ans = min(ans, id - i);
		}
	}
	
	if(ans == INF){
		cout << "0" << endl;
	}else{
		cout << ans << endl;
	}
	
	return 0;
}


Measured memory_bytes: 3864
/*author: hyperion_1724
  date: 
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	int A,B,K;
	cin>>A>>B>>K;
	int g=__gcd(A,B);
	K--;
	for (int i = g; i >=1 ; --i)
	{
		if(A%i==0 && B%i==0)
		{
			if(K==0)
			{
				cout<<i<<endl;
				break;
			}
			else
			{
				K--;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    public class Program
    {
        public static void Main()
        {
            string s1 = Console.ReadLine();
            //string s1 = "1000 8";
            string[] array1 = s1.Split(' ');
            int nowMoney = int.Parse(array1[0]);
            int arrIndex = int.Parse(array1[1]);

            string s2 = Console.ReadLine();
            //string s2 = "1 3 4 5 6 7 8 9";
            string[] array2 = s2.Split(' ');

            int result = Program.calc(nowMoney, array2);
            Console.WriteLine(result);
        }

        public static int calc(int money, string[] unfavoriteNum)
        {
            int result = 0;

            #region 使ってよい数値を求める
            List<string> templist = unfavoriteNum.ToList<string>();
            List<int> favoriteNumList = new List<int>();
            for (int i = 0; i < 10; i++)
            {
                if (!templist.Contains(i.ToString()))
                {
                    favoriteNumList.Add(i);
                }
            }
            favoriteNumList.Sort();
            #endregion

            // 結果を求める
            bool check = false;
            result = money;
            int keta = money.ToString().Length;
            do
            {
                // CHECK
                bool ketaCheck = true;
                for (int j = 0; j < keta; j++)
                {
                    string checkStr = result.ToString().Substring(j, 1);
                    if (!favoriteNumList.Contains(int.Parse(checkStr)))
                    {
                        ketaCheck = false;
                        break;
                    }
                }
                if (!ketaCheck)
                {
                    result++;
                    keta = result.ToString().Length;
                }
                else
                {
                    if (money <= result)
                    {
                        check = true;
                    }
                    else
                    {
                        result++;
                        keta = result.ToString().Length;
                    }
                }
            } while (!check);
            return result;
        }
    }

}

Measured memory_bytes: 7000
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl "\n"


class item {
public:
	int weight;
	ll value;
};

ll Knapsack1(vector<item>v, int n, int w) {
	ll dp[n + 1][w + 1];
	for (int wt = 0; wt <= w; wt++)
		dp[1][wt] = 0;
	dp[1][v[1].weight] = v[1].value;
	for (int i = 2; i <= n; i++) {
		for (int wt = 0; wt <= w; wt++) {
			dp[i][wt] = dp[i - 1][wt];
			if (v[i].weight > wt) continue;
			dp[i][wt] = max(dp[i][wt], v[i].value + dp[i - 1][wt - v[i].weight]);
		}
	}
	return *max_element(dp[n], dp[n] + w + 1);
}
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n, w;
	cin >> n >> w;
	vector<item>v(n + 1);//1 based indexing
	for (int i = 1; i <= n; i++)
		cin >> v[i].weight >> v[i].value;
	cout << Knapsack1(v, n, w) << endl;

	return 0;
}

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

using namespace std;
using ll = long long;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

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

  int sum = 0;
  rep(i, n) sum += a[i];

  if (sum >= h)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 640
function main(arg) {
  const a = arg.split(/\r\n|\r|\n/).map(item => item.split(' ').map(Number))

  if (a[0][0] === a[1][0]) {
    console.log(0)
  } else {
    console.log(1)
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 7372
#include<stdio.h>
int main(){
	int row;
	int col;
	int sheet[101][101];
	int i,j;
	
	for(i = 0;i < 101;i++){
		for(j = 0;j < 101;j++){
			sheet[i][j] = 0;
		}
	}
	
	scanf("%d %d", &row, &col);
	
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			scanf("%d", &sheet[i][j]);
		}
	}
	
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			sheet[i][col] += sheet[i][j];
		}
	}
	
	for(i =0;i < row;i++){
		for(j = 0;j < col;j++){
			sheet[row][j] += sheet[i][j];
		}
	}
	
	for(i = 0;i < row;i++){
		sheet[row][col] += sheet[i][col];
	}
	
	for(i =0;i <= row;i++){
		for(j = 0;j < col;j++){
			printf("%d ", sheet[i][j]);
		}
		printf("%d\n", sheet[i][col]);
	}
	return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    ll N;
    cin >> N;

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

    ll ans = A[0];
    for (int i = 0; i < N; i++) {
        ans = gcd(ans, A[i]);
    }

    cout << ans << endl;

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <queue>
#include <set>
#include <vector>
#include <cstring>
#include <algorithm>

int main(){
  long long int N, A, B;
  scanf("%lld%lld%lld", &N, &A, &B);
  
  std::cerr << "Answer:" << std::endl;
  if(A*N > B){
    std::cerr << "use taxi:" << std::endl;
    std::cout << B << std::endl;
  }
  else{
    std::cerr << "use train:" << std::endl;
    std::cout << A*N << std::endl;
  }
  
  return 0;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    if (n % 2 == 1) {
        for (int i = 0; i < m; i++) {
            cout << 1 + i << " " << n - i << endl;
        }
        return 0;
    }
    for (int i = 0; i < m; i++) {
        if (i >= n/4) {
            cout << 2 + i << " " << n - i << endl;
        } else {
            cout << 1 + i << " " << n - i << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define CL(a,x) memset(a, x, sizeof(a))
const int N = 205;

int cap[N][N];
bool vis[N];
int S,T,SZ,n,m;
int a[N>>1][N>>1];

int dfs(int x,int flow){
	if(vis[x]) return 0;
	vis[x]=true;
	if(x==T) return flow;
	rep(y,0,SZ)	if(cap[x][y] && !vis[y]){
		int tmp=dfs(y,min(flow,cap[x][y]));
		if(tmp>0){
			cap[x][y]-=tmp;
			cap[y][x]+=tmp;
			return tmp;
		}
	}
	return 0;
}

int main(){
	scanf("%d%d",&n,&m);
	S = 0, T = SZ = 2 * n + 1;
	rep(i,1,n)rep(j,1,m){
		scanf("%d",a[i]+j);
		++cap[i][(a[i][j]-1)/m+n+1];
	}
	rep(k,1,m-1){
		rep(i,1,n) cap[S][i] = cap[i+n][T] = 1;
		for(CL(vis,0);dfs(S,1e9);CL(vis,0));
		rep(i,1,n)rep(j,n+1,2*n)if(cap[j][i]){
			cap[j][i] = 0;
			rep(x,k+1,m) if( (a[i][x]-1)/m+n+1 == j){
				swap(a[i][k], a[i][x]);
				break;
			}
		}
	}
	rep(i,1,n)rep(j,1,m)printf("%d%c",a[i][j],j==m?'\n':' ');
	rep(j,1,m){
		int tmp[N];
		rep(i,1,n) tmp[i] = a[i][j];
		sort(tmp+1, tmp+n+1);
		rep(i,1,n) a[i][j] = tmp[i];
	}
	rep(i,1,n)rep(j,1,m)printf("%d%c",a[i][j],j==m?'\n':' ');
	return 0;
}

Measured memory_bytes: 512
import math
pi=3.1415926535897932
chk=0.0000001
a,b,x=map(int,input().split())
t=a*b/2
s=x/a
if t>s:
    h=[0,a]
    while 1:
        hs=(h[0]+h[1])/2
        w=b*hs/2
        if abs(w-s)<chk:
            break
        elif w>s:
            h[1]=hs
        elif w<s:
            h[0]=hs
    print(90-math.atan(hs/b)*180/pi)
else:
    h=[0,b]
    while 1:
        hs=(h[0]+h[1])/2
        w=(hs+b)*a/2
        if abs(w-s)<chk:
            break
        elif w>s:
            h[1]=hs
        elif w<s:
            h[0]=hs
    print(90-math.atan(a/(b-hs))*180/pi)

Measured memory_bytes: 38256
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

#define ub              upper_bound
#define lb              lower_bound
#define isrt            insert
#define clr             clear
#define rsz             resize
#define ff              first
#define ss              second
#define lli             long long int
#define pb              push_back
#define pf              push_front
#define mkp              make_pair
#define pii             pair<lli,lli>
#define vi              vector<int>
#define mii             map<lli,lli>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define INF             1e9
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define all(v)          v.begin(),v.end()
#define endl            "\n"
const double PI = acos(-1);

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

lli maxm(lli a, lli b)
{
  return (a >= b ? a : b);
}


lli minm(lli a, lli b)
{
  return (a <= b ? a : b);
}

lli power(lli x, lli y, lli p)
{
  lli res = 1;

  x = x % p;
  if (x == 0)
    return 0;

  while (y > 0)
  {

    if (y & 1)
      res = (res * x) % p;


    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}

lli nCrmodp(lli n, lli r, lli p)
{
  if (r == 0)
    return 1;
  if (r == 1)
    return n;


  lli pro = 1, k = n;
  while (k > r)
  {
    pro *= k;
    pro %= p;
    --k;
  }

  k = 2;
  while (k <= (n - r))
  {
    pro *= power(k, (p - 2), p);
    pro %= p;
    ++k;
  }

  return pro;
}


lli first_big(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = n;
  l = 0;
  r = n - 1;

  while (l <= r) {
    lli m = l + (r - l) / 2;

    if (arr[m] > k) {
      ans = m;
      r = m - 1;
    }

    else
      l = m + 1;
  }

  return ans;
}

lli last_small(lli n, lli k, vector<lli> arr)
{
  lli l, r, ans = -1;
  l = 0;
  r = n - 1;

  while (l <= r)
  {
    lli mid = (l + r) / 2;

    if (arr[mid] <= k)
    {
      ans = mid;
      l = mid + 1;
    }
    else
      r = mid - 1;
  }

  return ans;
}

void c_p_c()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
}

int main()
{
  c_p_c();
  int x;
  cin >> x;

  x = (1 - x);
  cout << x << endl;
  return 0;
}

Measured memory_bytes: 3632