akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define Clear(a) a = decltype(a)()
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef pair<int,int> p;
//const ll big=998244353;
const ll big=1000000007;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
ll max(ll x,ll y){
if(x>y)return x;
else return y;
}
ll min(ll x,ll y){
if(x<y)return x;
else return y;
}
ll expm(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||x==0)return x;
    if(y%2==1)return (expm(x,y-1)*x)%big;
    ll t=expm(x,y/2);
    return (t*t)%big;
}
ll exp(ll x,ll y){
    if(y==0)return 1;//0^0=1
    if(x==1||y==0)return x;
    if(y%2==1)return exp(x,y-1)*x;
    ll t=exp(x,y/2);
    return t*t;
}
ll inv(ll x){
    return expm(x,big-2);
}


int main(){
    ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    /*--------------------------------*/

    int n;cin >> n;
    n-=400;
    cout << (8-n/200) << endl;
}

Measured memory_bytes: 3660
/* 
chirag11032000
Chirag Thakur
*/

#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;

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#ifndef ONLINE_JUDGE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
	cerr << name << " : " << arg1 << std::endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma = strchr(names + 1, ',');
	cerr.write(names, comma - names) << " : " << arg1 << " | ";
	__f(comma + 1, args...);
}
#else
#define trace(...)
#endif

#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

void test_case();

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	test_case();
	cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
	return 0;
}

void test_case() {
	string check = "ACGT";
	string s;
	cin >> s;
	int ans = 0;
	for (int i = 0; i < s.size(); ++i) {
		for (int j = i; j < s.size(); ++j) {
			if (check.find(s[j]) == string::npos) {
				break;
			} else {
				ans = max(ans, j - i + 1);
			}
		}
	}
	cout << ans << "\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main()
{
    int n,x,l[101],d,count = 0;

    scanf("%d %d",&n,&x);
    for (int i = 0; i < n; i++)
    {
        scanf("%d",&l[i]);
    }
    
    d = 0;
    while (d <= x)
    {
        d += l[count];
        count ++;
    }
    printf("%d",count);
}

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

int main() {
  int n,ans = 0;
  cin >> n;
  int d[n];
  rep(i,n) {
    cin >> d[i];
  }
  for(int i=0;i<n-1;++i) {
    for(int j=i+1;j<n;++j) {
      ans += d[i]*d[j];
    }
  }
  cout << ans << endl;
  return 0;
}

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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

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

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
ll n, k;
ll r, s, p;

PLL win(char x){
  switch (x)
  {
  case 'r':
    return PLL(2, p);
    break;
  case 's':
    return PLL(0, r);
    break;
  case 'p':
    return PLL(1, s);
    break;
  }
  return PLL(-1, -1);
}

int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  string t;
  cin >> n >> k >> r >> s >> p >> t;
  int cmds[n];
  ll ans = 0;

  rep(i, n) {
    PLL hand = win(t[i]);
    if(i < k){
      cmds[i] = hand.first;
      ans += hand.second;
    }else{
      if (cmds[i-k] == hand.first) {
        cmds[i] = -1;
      }else{
        cmds[i] = hand.first;
        ans += hand.second;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 848
import math
from math import cos


def time():
    A, B, H, M = map(int, input().split())
    minuteAngel = M * 360.0 / 60.0
    hourAngel = H * 30.0 + M * 30.0 / 60.0
    angel = abs(hourAngel - minuteAngel)
    a = cos(angel / 180 * math.pi)
    a = float('%.20f' % a)
    distance = math.sqrt(A * A + B * B - 2 * A * B * a)
    print("%.20f" % distance)


if __name__=="__main__":
    time()


Measured memory_bytes: 9476
use std::collections::HashSet;


fn main() {
    let n: usize = read();
    let mut queen_pos: Vec<Option<usize>> = vec![None; 8];
    for _ in 0..n {
        let (r, c) = read_tuple::<usize>();
        queen_pos[r] = Some(c);
    }

    let permutation = dfs(&mut vec![], &mut vec![false; 8]);

    for posc in permutation.iter() {
        let mut table = vec![vec!['.'; 8]; 8];
        let mut not_access: HashSet<(usize, usize)> = HashSet::new();
        let mut check = true;
        for (r, c) in posc.iter().enumerate() {
            if let Some(v) = queen_pos[r] {
                if *c != v {
                    check = false;
                    break;
                } 
            }

            if not_access.contains(&(r, *c)) {
                check = false;
                break;
            }

            table[r][*c] = 'Q';

            for i in 1..8 {
                let cond = (r >= i, *c >= i, r + i < 8, c + i < 8);
                if cond.0 && cond.1 {
                    not_access.insert((r - i, c - i));
                }
                if cond.0 && cond.3 {
                    not_access.insert((r - i, c + i));
                }
                if cond.1 && cond.2 {
                    not_access.insert((r + i, c - i));
                }
                if cond.2 && cond.3 {
                    not_access.insert((r + i, c + i));
                }
            }
        }

        if check {
            for line in table.iter() {
                println!("{}", line.iter().collect::<String>());
            }
            break;
        }
    }
}


fn dfs(cur: &mut Vec<usize>, flag: &mut Vec<bool>) -> Vec<Vec<usize>> {
    if flag.iter().all(|x| *x) {
        return vec![cur.clone()]
    }

    let mut res = Vec::new();
    for i in 0..flag.len() {
        if !flag[i] {
            flag[i] = true;

            cur.push(i);
            res.append(&mut dfs(cur, flag));
            cur.pop();

            flag[i] = false;
        }
    }

    res
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn read_tuple<T: std::str::FromStr + Copy>() -> (T, T) {
    let temp = read_vec();
    (temp[0], temp[1])
}



Measured memory_bytes: 9032
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#define ll long long
using namespace std;
ll n,l,t,x,w,ans[100005];
int main(){
    scanf("%lld%lld%lld",&n,&l,&t);
    ll p=1;
    for (int i=1; i<=n; i++){
        scanf("%lld%lld",&x,&w);
        if (w==1){
            ans[i]=(x+t)%l;
            p+=(x+t)/l;
        }else{
            ans[i]=(x-t)%l;
            p+=(x-t)/l;
            if (ans[i]<0) ans[i]+=l,p--;
        }
    }
    sort(ans+1,ans+n+1);
    p=(p%n+n)%n;
    if (p==0) p=n;
    for (int i=p; i<=n; i++)
        printf("%lld\n",ans[i]);
    for (int i=1; i<=p-1; i++)
        printf("%lld\n",ans[i]);
    return 0;
}

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

using namespace std;

//#define FILE_IO

int N, M;
char s[2005][2005];
int a[2005][2005];
int up[2005], lft[2005], rgt[2005];
stack<int> stv;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%d%d\n", &N, &M);
    for(int i = 1; i <= N; i++)
        scanf("%s", s[i] + 1);

    for(int i = 1; i < N; i++)
        for(int j = 1; j < M; j++)
            a[i][j] = (s[i][j] == '.') ^ (s[i + 1][j] == '.') ^ (s[i + 1][j + 1] == '.') ^ (s[i][j + 1] == '.');

    int ans = max(N, M);
    for(int i = 1; i < N; i++)
    {
        for(int j = 1; j < M; j++)
        {
            up[j]++;
            if(a[i][j] == 1)  up[j] = 0;
        }

        for(int j = 1; j < M; j++)
        {
            while(!stv.empty() && up[j] <= up[stv.top()])
            {
                rgt[ stv.top() ] = j - 1;
                stv.pop();
            }

            if(stv.empty()) lft[j] = 1;
            else    lft[j] = stv.top() + 1;

            stv.push(j);
        }

        while(!stv.empty())
        {
            rgt[ stv.top() ] = M - 1;
            stv.pop();
        }

        for(int j = 1; j < M; j++)
            ans = max(ans, (up[j] + 1) * (rgt[j] - lft[j] + 1 + 1));
    }

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


    return 0;
}


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

using namespace std;
#define ll long long
#define ld long double
#define f first
#define s second

bool isPal(string s)
{
    string s2 = s;
    reverse(s.begin() , s.end());
    return s == s2;
}
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    string s;
    cin >> s;

    if (isPal(s) && isPal(s.substr(0,s.size()/2)) && isPal(s.substr(s.size()/2+1 , s.size()/2))) cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
 


public class Main {
	static int a1[]= {0,-1,0,1};
	static int b1[]= {-1,0,1,0};
	private static         Scanner sc = new Scanner(System.in);
	//result = Math.pow(num1, num3)
	//StringBuffer str = new StringBuffer(hoge1);
	//String hoge2 = str.reverse().toString();
	//map.containsKey(A)

	//Map<String, Integer> map = new HashMap<String, Integer>(n);
	/*for ( キーのデータ型 key : マップの名前.keySet() ) {
		データのデータ型 data = マップの名前.get( key );
		
		// keyやdataを使った処理;
	}*/
	//int i = Integer.parseInt(s);
	//Queue<String> qq=new ArrayDeque<>(); //add,poll,peek
	//Deque<String> qq=new ArrayDeque<>();//push,pop,peek
	//ArrayList<String> cc = new ArrayList<>(n);
	//Collections.sort(list);
	//Array.sort(list);   cc.contains(tmp)
	//Arrays.asList(c).contains("a")
	//list.set(1,"walk");//1 1 2 3 5
	static int K,N;
	static long mod =1000000007;
	public static void main(String[] args) {
		int D=sc.nextInt();
		int N=sc.nextInt();
		
		int v=(int) Math.pow(100, D);
		
		int ctn=0;
		for(int i=1;true;i++) {
			int g=v*i;
			int t=0;
			while(g%100==0) {
				g/=100;
				t++;
			}
			if(t==D)ctn++;
			if(ctn==N) {
				p(v*i);
				break;
			}
		}
		
		
		
		
		
		
		
		
		
		
		//System.out.println(cc);
	}
	//N==S
	//E==W
//83 S 
	//69E
	//78N
	//87W
	
	//static ArrayList<Integer> cc = new ArrayList<>(10001);
	
	static void p(String ans) {System.out.println(ans);};
	static void p(int ans) {System.out.println(ans);};
	static void p() {System.out.println();};
	static void p(long ans) {System.out.println(ans);};
	static void p(double ans) {System.out.println(ans);};
	public static int gcd(int a, int b) {
        return b == 0 ? a: gcd(b, a % b);
	}
	static String nextPermutation(String s) {
		ArrayList<Character> list=new ArrayList<>();
		for(int i=0;i<s.length();i++) {
			list.add(s.charAt(i));
		}
		int pivotPos=-1;
		char pivot=0;
		for(int i=list.size()-2;i>=0;i--) {
			if(list.get(i)<list.get(i+1)) {
				pivotPos=i;
				pivot=list.get(i);
				break;
			}
		}
		if(pivotPos==-1&&pivot==0) {
			return "Final";
		}
		int L=pivotPos+1,R=list.size()-1;
		
		
		
		int minPos=-1;
		char min =Character.MAX_VALUE;
		
		for(int i=R;i>=L;i--) {
			if(pivot<list.get(i)) {
				if(list.get(i)<min) {
					min=list.get(i);
					minPos=i;
				}
			}
		}
		
		Collections.swap(list, pivotPos, minPos);
		Collections.sort(list.subList(L, R+1));
		
		
		StringBuilder sb=new StringBuilder();
		for(int i=0;i<list.size();i++) {
			sb.append(list.get(i));
		}
		return sb.toString();
	}
}
	


Measured memory_bytes: 21844
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

#define F first
#define S second
#define int long long
#define ll long long
//#define int  unsigned long long
#define pb push_back
//#define double long double

using namespace std;
using namespace __gnu_pbds;
typedef  tree< int , null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
const int mod = 1e9 + 7;
const int N = 1700000;
string s;
int f[N], invf[N], a[N];
int binpow(int x, int y){
    int res = 1;
    while(y){
        if (y % 2) res = res * x % mod;
        x = x * x % mod;
        y /= 2;
    }
    return res;
}
int c(int n, int k){
    if (k > n) return 0;
    return f[n] * invf[k] % mod * invf[n - k] % mod;
}
main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //freopen("input.txt", "r", stdin);
    int n, m, k;
    cin >> n >> m >> k;
    f[0] = 1;
    invf[0] = 1;
    for (int i = 1; i <= n + m + k; i++){
        f[i] = f[i - 1] * i % mod;
        invf[i] = binpow(f[i], mod -  2);
    }
    a[0] = 1;
    for (int i = 1; i <= n + m + k; i++){
        a[i] = (2 * a[i - 1] - c(i - 1, m) - c(i - 1, k) + mod + mod) % mod;
        if (a[i] == 0) break;
    }
    int ans = 0;
    for (int i = n; i <= n + m + k; i++){
        int x = c(i - 1, n - 1) * binpow(3, n + m + k - i) % mod;
        ans = (ans + x * a[i - n]) % mod;
    }
    cout << ans;
}


Measured memory_bytes: 24832
#include <bits/stdc++.h>
#define int long long
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define ff first
#define ss second
#define rep(i,l,r) for(int i = (int)l;i<(int)r;i++)
#define td(v) v.begin(),v.end()
//#define M   1000000007 // 1e9 + 7
#define MAXN 100100
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
inline int mod(int n, int m){ int ret = n%m; if(ret < 0) ret += m; return ret; }
int gcd(int a, int b){return (b == 0 ? a : gcd(b, a%b));}
int exp(int a,int b,int m){
	
    if(b==0) return 1;
    if(b==1) return mod(a,m);
    int k = mod(exp(a,b/2,m),m);
    if(b&1){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);

}

int dp[MAXN][3];
int a[MAXN][3];
int32_t main(){
	fastio;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			dp[i][j] = -1e10;
		}
	}
	for(int i=1;i<=n;i++){
		for(int j=0;j<3;j++){
			dp[i][j] = a[i][j] + max(dp[i-1][mod(j-1,3)],dp[i-1][(j+1)%3]);
		}
	}
	int r=0;
	for(int j=0;j<3;j++)r=max(r,dp[n][j]);
	cout<<r<<endl;
}

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

int main()
{
    string s,t;
    int a,b;
    string u;
    cin >> s >> t;
    cin >> a >> b;
    cin >> u;
    if(u == s) a--;
    else b--;


    cout << a << " " << b << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007 

int main() {
	ll a,b,c;
	cin>>a>>b>>c;
	swap(a,b);
	swap(a,c);
	cout << a <<" "<<b <<" "<<c;
	// your code goes here
	return 0;
}

Measured memory_bytes: 256
a, b = map(int, input().split())

def f(x):
    tmp = (x + 1) % 4
    if tmp == 0:
        return 0
    elif tmp == 1:
        return x
    elif tmp == 2:
        return 1
    else:
        return 1 ^ x

print(f(a-1) ^ f(b))


Measured memory_bytes: 2940
#include<iostream>
#include<cstring>
#include<cmath>
#include<queue>
#include<cstdio>
#include<algorithm>
#define LL long long
#define INF 1ll<<60
using namespace std;
const int N=2e5+100;
const int M=4e5+100;
const int mod=1e9+7;
int arr[N];
int tmp[N];
int main() {
	
	int n;
	while(cin>>n){
		for(int i=1;i<=n;i++)cin>>arr[i];
		sort(arr+1,arr+1+n);
		arr[n+1]=-1;
		int l=0,r=0;
		int num=0;
		for(int i=n;i>=1;i--){
			if(arr[i]==arr[i+1]){
				num++;
				if(num==2){
					num=0;
					if(l==0)l=arr[i];
					else {
						r=arr[i];
						break;
					}
				}
			}	
			else{	
				num=1;
			}
		}
		
		cout<<(LL)l*r<<endl;
	}
	return 0;
}


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

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

int rot[24][7] = {
	{ 0,1,2,3,4,5,6 },{ 0,1,3,5,2,4,6 },{ 0,1,4,2,5,3,6 },{ 0,1,5,4,3,2,6 },
	{ 0,2,6,3,4,1,5 },{ 0,2,3,1,6,4,5 },{ 0,2,1,4,3,6,5 },{ 0,2,4,6,1,3,5 },
	{ 0,3,1,2,5,6,4 },{ 0,3,2,6,1,5,4 },{ 0,3,5,1,6,2,4 },{ 0,3,6,5,2,1,4 },
	{ 0,4,1,5,2,6,3 },{ 0,4,2,1,6,5,3 },{ 0,4,5,6,1,2,3 },{ 0,4,6,2,5,1,3 },
	{ 0,5,1,3,4,6,2 },{ 0,5,3,6,1,4,2 },{ 0,5,4,1,6,3,2 },{ 0,5,6,4,3,1,2 },
	{ 0,6,2,4,3,5,1 },{ 0,6,3,2,5,4,1 },{ 0,6,5,3,4,2,1 },{ 0,6,4,5,2,3,1 } };

int  a[102][7];
char f[102];

int identical(int *a, int *b)
{
	int i, j;
	memset(f, 0, sizeof(f));
	for (i = 1; i <= 6; i++) f[a[i]]++;
	for (i = 1; i <= 6; i++) f[b[i]]--;
	for (i = 1; i <= 6; i++) if (f[b[i]]) return 0;

	for (j = 0; j < 24; j++) {
		if (b[1] == a[rot[j][1]]) {
			for (i = 2; ; i++) {
				if (i > 6) return 1;
				if (b[i] != a[rot[j][i]]) break;
			}
		}
	}
	return 0;
}

int main()
{
	int n, i, j, f;

	n = in();
	for (i = 0; i < n; i++) {
		for (j = 1; j <= 6; j++) a[i][j] = in();
	}
	f = 1;
	for (i = 0; i < n; i++) for (j = i+1; j < n; j++) {
		if (identical(a[i], a[j])) { f = 0; goto done; }
	}
done:
	puts(f? "Yes": "No");
	return 0;
}


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

int main(){
  int N, A, n = 30;
  cin >> N;
  for(int i = 0;i < N;i++){
    cin >> A;
    int j = 0;
    while ((A + 1) % 2){
      A /= 2;
      j++;
    }
    n = min(n, j);
    
  }
  cout << n << endl;
}

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 ALL(a)     (a).begin(),(a).end()
#define MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);

int main(){
  vector<int> a(3);
  REP(i,3)cin>>a[i];
  sort(ALL(a));
  cout << a[0] + a[1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define dd double
#define MOD 1000000007
#define nl cout<<endl
#define rt ll Q[100005]={0}
#define mp make_pair
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define ff first    
#define ss second
#define all(v) v.begin(),v.end()
#define s(ar,n) sort(ar,ar+n)
#define rs(ar,n) sort(ar, ar+n, greater<ll>()) 
#define oa(a,n) for(ll i=0;i<n;i++)cout<<a[i]<<" ";nl
#define cn(a,n) for(ll i=0;i<n;i++)cin>>a[i];
#define ov(a,n) for(ll i=n-1;i>=0;i--)cout<<a[i]<<" ";nl
#define ovp(a,n) for(ll i=0;i<n;i++)cout<<a[i].ff<<" "<<a[i].ss<<endl;
#define maxa(ar,N) *max_element(ar,ar+N)
#define mina(ar,N) *min_element(ar,ar+N)
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef pair<int,int> pii;
ll powe(ll n,ll m){if(m==0)return 1;ll t=powe(n,m/2);if(m%2==0)return (t*t);return (((t*t))*n);}
ll mpowe(ll n,ll m){if(m==0)return 1;ll t=mpowe(n,m/2);t%=MOD;if(m%2==0)return (t*t)%MOD;return (((t*t)%MOD)*n)%MOD;}
ll logtwo(ll n){if(n==1)return 0;return logtwo(n/2)+1;}

int main()
{
    fastio();
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif*/
    ll n,m,k;
    cin>>n>>m>>k;
    n = max(n,m);
    ll ans = k%n==0?k/n:k/n+1;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
#define LL long long

int h,w,a,b;
int mo = 1e9 + 7;

LL dp[1005][1005];
LL Line[100005];
LL F[200005];

LL expo( LL a , LL b ){
	if ( b == 0 ) return 1;
	if ( b == 1 ) return a;
	LL half = expo(a,b/2);
	half = (1LL * half * half ) % mo;
	if (b & 1 ) half = ( 1LL * half * a ) % mo;
	return half;
}

LL C( int n, int k ){
	LL ans = F[n];
	LL d1 = expo(F[n-k],mo-2), d2 = expo(F[k],mo-2);
	ans = ( 1LL * ans * d1 ) % mo;
	ans = ( 1LL * ans * d2 ) % mo;
	return ans; 
}

int main(){

	F[0] = 1;
	for ( int i = 1; i <= 200000; i++ ){
		F[i] = ( 1LL * F[i-1] * i ) % mo;
	}

	scanf("%d%d%d%d",&h,&w,&a,&b);
	// dp[1][0] = 1;
	// for ( int i = 1; i <= h; i++ ){
	// 	for ( int j = 1; j <= w; j++ ){
	// 		if ( j <= b && i >= h-a+1 ) continue;
	// 		dp[i][j] = dp[i-1][j] + dp[i][j-1];
	// 		cout << dp[i][j] << " ";
	// 	}
	// 	cout << endl;
	// }
	
	for ( int i = b+1; i <= w ; i++ ){
		Line[i] = C((h-a) + (i) - 2, i - 1);
	}
	LL sum = 0;
	for ( int i = b+1; i <= w; i++ ){
		// cout << i-b << " " << C(a-2 + i - b , i - b - 1) << endl;
		sum = ( sum + ( ( 1LL * C(a-2 + i - b, i - b - 1) * Line[w - ( i - b ) + 1] ) % mo ) ) % mo;
	}
	printf("%lld\n",sum);
	return 0;
}

Measured memory_bytes: 6400
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		String sample = "abcdefghijklmnopqrstuvwxyz";
		int[] sum = new int[26];
		for(int i=0;i<s.length();i++) {
			for(int j=0;j<26;j++) {
				if(sample.charAt(j)==s.charAt(i)) {
					sum[j]++;
					break;
				}
			}
		}
		int flg=0;

		for(int i:sum) {
			if(i%2!=0) {
				flg=1;
				break;
			}
		}

		if(flg!=1) {
			System.out.println("Yes");//Yes or YES注意！！
		}else {
			System.out.println("No");//No or NO注意！！
		}

	}
	public static int sample(int n) {
		return n;
	}

}


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

#define rep(i, x, n) for(int i=(x);i<(n);i++)
#define reps(i, x, n) for(int i=(x);i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDigit(a,b) (a+b-1)/b //小数点切り上げ
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;
//八方向を見るのに使うと便利(楽)
const int dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  lol a, foo;
  cin >> a;
  reps(i, 2, n){
    cin >> foo;
    a = lcm(foo, a);
  }
  cout << a << '\n';
  return 0;
}


Measured memory_bytes: 3620
S = input()
B = ["A","T","C","G"]
ans = 0
for k in range(len(S)):
    for l in range(k,len(S)):
        t = 0
        for s in S[k:l+1]:
            if s in B:
                t += 1
            else:
                t = 0
                break
        ans = max(ans,t)
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
struct Node
{
	int data;
	Node *next;
};
struct Queue
{
	Node *head;
	Node *la;
	Queue()
	{
		head=(Node *)malloc(sizeof (Node));
		la=(Node *)malloc(sizeof (Node));
		head =NULL;
	}
	bool empty()
	{
		if(head==NULL) return 1;
		else return 0;
	}
	void push(int x)
	{
		Node *p1;
		p1=(Node *)malloc(sizeof (Node));
		p1->data=x;
		if(head==NULL) 
		{
			head=p1;
			la=p1;
		}
		else
		{
			la->next=p1;
			la=p1;
		}
		la->next=NULL;
	}
	void pop()
	{
		Node *p1;
		p1=head->next;
		delete head;
		head=p1;
	}
	int front()
	{
		return head->data;
	}
	void clear()
	{
		while(head!=NULL) head=head->next;
	}
}; 
vector<pair<int,int> > nei[1000005];
vector<int> cit[1000005];
vector<int>comp;
int col[1000005];
bool vis[1000005];
vector<int>newnei[1000005];
int dp[1000005];
int poi[1000005];
int main()
{
	int n,m;
	cin>>n>>m;
	memset(col,-1,sizeof col);
	for(int i=0;i<m;i++)
	{
		int x,y,c;
		scanf("%d %d %d",&x,&y,&c);
		x--,y--,c--;
		nei[x].push_back(make_pair(c,y));
		nei[y].push_back(make_pair(c,x));
		cit[c].push_back(x);
		cit[c].push_back(y);
		comp.push_back(c);
	}
	sort(comp.begin(),comp.end());
	comp.erase(unique(comp.begin(),comp.end()),comp.end());
	for(int i=0;i<n;i++)
	{
		sort(nei[i].begin(),nei[i].end());
	}
	int newci=n;
	for(int i=0;i<comp.size();i++)
	{
		int cmp=comp[i];
		for(int j=0;j<cit[comp[i]].size();j++)
		{
			int v=cit[comp[i]][j];
			if(col[v]==cmp) continue;
			Queue q;
			q.push(v);
			col[v]=cmp;
			vector<int> ciin;
			while(!q.empty())
			{
				v=q.front();
				ciin.push_back(v);
				q.pop();
				int k=0;
				for(;poi[v]<nei[v].size();poi[v]++)
				{
					k=poi[v];
					if(nei[v][k].first!=cmp) break;
					int u=nei[v][k].second;
					if(col[u]==cmp) continue;
					col[u]=cmp;
					q.push(u);
				}
			}
			for(int k=0;k<ciin.size();k++)
			{
				int v=ciin[k];
				newnei[v].push_back(newci);
				newnei[newci].push_back(v);
			}
			newci++;
			q.clear();
		}
	}
	Queue q;
	for(int i=0;i<newci;i++) dp[i]=-2;
	dp[0]=1;
	q.push(0);
	while(!q.empty())
	{
		int v=q.front();
		q.pop();
		for(int k=0;k<newnei[v].size();k++)
		{
			int u=newnei[v][k];
			if(dp[u]==-2)
			{
				dp[u]=dp[v]+1;q.push(u);
			}
			
		}
	}
	q.clear();
	cout<<dp[n-1]/2;
}

Measured memory_bytes: 106472
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    ll n;
    cin>>n;
    
    ll a[n],b[n];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
        b[i] = a[i];
    }
   
    sort(a,a+n);
    
    ll mid = a[n/2];
    ll mid_num = n/2;
    ll count = 0;
    
    ll prev = a[n/2-1];
    ll prev_num = n/2-1;
    ll curr = mid;
    
    //cout<<prev<<" "<<curr<<endl;
    
    for(ll i=prev+1;i<=curr;i++)
    {
        ll counte = 0,countn=0;
        
        ll temp = prev_num;
        while(a[temp] >= i)
        {
            temp--;
        }
        //cout<<temp<<endl;
        
        counte = temp+1;
        //cout<<counte<<endl;
        
        ll temp1 = n-mid_num;
        //cout<<temp1<<endl;
        countn = temp1;
        
        if(counte == countn)
        count++;
    }
    
    cout<<count<<endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define mod 1000000007 //10^9+7
#define INF 1000000000000 //10^12
#define P pair<int,int>
#define rep(i,n) for(int i=0;i<n;i++)
int n;
int a[200000],b[200000];
int tak=0,aok=0;
vector<P>vec;
signed main(){
    cin>>n;
    rep(i,n){
        cin>>a[i]>>b[i];
        vec.push_back(make_pair(a[i]+b[i],a[i]));
    }
    sort(vec.begin(),vec.end());
    reverse(vec.begin(),vec.end());
    rep(i,n){
        if(i%2==0){
            tak+=vec[i].second;
        }
        else{
            aok+=vec[i].first-vec[i].second;
        }
    }
    cout<<tak-aok<<endl;
    return 0;
}


Measured memory_bytes: 3568
#include<iostream>
using namespace std;
int main(){
    int a,b;
    int ans;
    int NIL = -1;
    cin >> a >> b;

    ans = a * b;
    if (a >= 10 || b >= 10){
        cout << NIL;
    }
    else{
        cout << ans;
    }
    return 0;

}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    private const int INF = 1000000007;
    private const long INFINITY = 9223372036854775807;
    public static void Main()
    {
        int X = NextInt();
        int Y = NextInt();
        if (X % Y == 0) Console.WriteLine(-1);
        else { Console.WriteLine(X); }
    }
}

public class Input
{
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
}


Measured memory_bytes: 13268
#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<stdlib.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	if(a<=b)cout<<a*c<<endl;
	else cout<<b*c+(a-b)*d<<endl;
}


Measured memory_bytes: 256
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <functional>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
using namespace std;
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str();}
typedef vector<int> vi;
typedef vector<vi>  vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define EACH(t,i,c) for(t::iretator i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n) FOR(i,0,(n)-1)
const double EPS = 1e-12;
const double PI = acos(-1.0);

const int INF = INT_MAX/2-1;

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

typedef vector<char> vc;

struct state {
	int x, y, c;
	bool l;
	state(int x, int y, int c, bool l) : x(x), y(y), c(c), l(l) {};
	bool operator<(const state &o)const {
		return c>o.c;
	}
};

int get(char c) {
	switch(c) {
	case 'S':
	case 'T':
		return 0;
	default:
		return c - '0';
	}
}

int main() {
	int w, h;
	while(cin >> w >> h, w) {
		vector<vc> field(h, vc(w));
		REP(i, h) {
			REP(j, w) {
				cin >> field[i][j];
			}
		}

		priority_queue<state> Q;
		vector<vvi> cost(2, vvi(h, vi(w, INF)));		
		REP(i, h) {
			REP(j, w) {
				if(field[i][j] == 'S') {
					Q.push(state(j, i, 0, true));
					Q.push(state(j, i, 0, false));
					cost[0][i][j] = 0;
					cost[1][i][j] = 0;
				}
			}
		}

		while(!Q.empty()) {
			state st = Q.top();
			Q.pop();
			int k = (st.l ? 1 : -1);
			int l = (st.l ? 1 : 0);

			if(field[st.y][st.x] == 'T') {
				continue;
			}

			REP(i, 9) {
				int nx = st.x + dx[i]*k;
				int ny = st.y + dy[i];

				if(0 <= nx && nx < w && 0 <= ny && ny < h && field[ny][nx] != 'X') {
					int nc = st.c + get(field[ny][nx]);
					if(nc < cost[l][ny][nx]) {
						cost[l][ny][nx] = nc;
						Q.push(state(nx, ny, nc, !st.l));
					}
				}
			}
		}

		int ans = INF;
		REP(i, h) {
			REP(j, w) {
				if(field[i][j] == 'T') {
					ans = min(ans, cost[0][i][j]);
					ans = min(ans, cost[1][i][j]);
				}
			}
		}

		if(ans == INF) {
			cout << -1 << endl;
		} else {
			cout << ans << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 1260
#include <bits/stdc++.h>
using namespace std;
#define forstl(i,v) for(auto &i: v)
#define forn(i,e) for(int i = 0; i < e; i++)
#define forsn(i,s,e) for(int i = s; i < e; i++)
#define rforn(i,s) for(int i = s; i >= 0; i--)
#define rforsn(i,s,e) for(int i = s; i >= e; i--)
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits (binary me 1 kitne hai) (if longlong popcount ll)
#define ln "\n"
#define dbg(x) cerr<<#x<<" = "<<x<<endl
#define dbg2(x,y) cerr<<#x<<" = "<<x<<" & "<<#y<<" = "<<y<<endl;
#define dbgstl32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it<<ln;} cerr<<endl
#define dbgstlp32(v) cerr<<#v<<" = \n"; { int c=0; forstl(it,v) \
cerr<<"    Term "<< ++c <<" = "<<it.fi<<" , "<<it.se<<ln;} cerr<<endl
#define dbgarr(v,s,e) cerr<<#v<<" = "; forsn(i,s,e) cerr<<v[i]<<", "; cerr<<endl
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define all(n) n.begin() , n.end() 
#define tfi first.first
#define tse first.second
#define tth second
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32; 
typedef pair<ll,ll> p64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef map<int,int> m32;
typedef pair< pair<int,int> , int> tri;

#pragma GCC optimize ("-O2")
template <typename T> void chkmax(T &x, T y) {x = max(x, y); }
template <typename T> void chkmin(T &x, T y) {x = min(x, y); }
const int LIM = 2e5+5 ,MOD = 1e9+7;
//int n , m , t , x ,y ;
int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

	int n;
	cin >> n;
	ll h[n+1];

	forn(i,n) cin >> h[i+1];

	ll cost[n+1];

	cost[1]=0;
	cost[2]=abs(h[2]-h[1]);
	cost[3]=min(abs(h[2]-h[3])+cost[2], abs(h[1]-h[3]));

	forsn(i,3,n+1){
		cost[i]=min(cost[i-2]+abs(h[i]-h[i-2]), cost[i-1]+abs(h[i]-h[i-1]));
	}

	cout << cost[n];

}

Measured memory_bytes: 1792
from collections import defaultdict

N, A = map(int, input().split())
intA = lambda x: int(x) - A
X = tuple(map(intA, input().split()))

d = defaultdict(int)
for x in X:
    new_d = d.copy()
    for k, v in d.items():
        new_d[k + x] += v
    new_d[x + 2500] += 1
    d = new_d
print(d[2500])


Measured memory_bytes: 3444
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
//typedef pair<long long,long long> P;
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
using namespace std;
bool prime(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd(b,a%b);
  }
}
 
long long lcm(long long x, long long y){
  return (x/gcd(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  int n;
  cin>>n;
  typedef pair<int,int> P;
  vector<pair<int,int>> x,y;
  int a,b,c,d;
  REP(i,n){
    cin>>a>>b;
    x.push_back(P(a,b));
  }
  REP(i,n){
    cin>>c>>d;
    y.push_back(P(c,d));
  }
  sort(y.begin(),y.end());
  
  int mat=-1;//対応する赤い点のインデックスを入れたい。
  int may=-1;//対応する赤い点のy座標
  vector<bool> used(n,false);
  REP(i,n){
    mat = -1;
    may = -1;
    REP(j,n){
      if(x[j].first<y[i].first && x[j].second<y[i].second){
        if(used[j])continue;
        if(may<=x[j].second){
          mat = j;
          may = x[j].second;
        }
      }
    }
    if(mat==-1){
      continue;
    }else{
      used[mat]=true;
    }
  }
  
  int ans=0;
  REP(i,n){
    if(used[i]){
      ans++;
    }
  }
  cout<<ans<<endl; 
  return 0; 
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

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

const long double EPS = 1e-10;
const long long INF = 1e18;
const long double PI = acos(-1.0L);
//const ll mod = 1000000007;

int main() {
    //cout.precision(10);
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll h, n;
    cin >> h >> n;
    cout << (h + n - 1) / n;
    return 0;
}

Measured memory_bytes: 256
def gcd(a,b):
    x=max([a,b])
    y=min([a,b])
    if x%y==0:
        return y
    else:
        return gcd(y,x%y)
N,X=map(int,input().split())
x=[int(i) for i in input().split()]
y=[abs(x[i]-X) for i in range(N)]
if N==1:
    print(y[0])
    exit()
ans=gcd(y[0],y[1])
for i in range(2,N):
    ans=gcd(ans,y[i])
print(ans)


Measured memory_bytes: 14252
N=int(input())
p=[int(i) for i in input().split()]
ans=0
series=0
for i in range(N):
  if p[i]==i+1:
    if series==0:
      ans+=1
      series=1
    elif series==1:
      series=0
  else:
    series=0
print(ans)
    
    


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

int main(){
  int i=0,j,x;
  float f;
  vector<pair<float,int> >v,w;
  for(;i<3;i++){
    for(j=0;j<8;j++)
      scanf("%d%f",&x,&f),v.push_back(make_pair(f,x));
    sort(v.begin(),v.end());
    printf("%d %.2f\n%d %.2f\n",v[0].second,v[0].first,v[1].second,v[1].first);
    w.push_back(make_pair(v[2].first,v[2].second));
    w.push_back(make_pair(v[3].first,v[3].second));
    v.clear();
  }
  sort(w.begin(),w.end());
  printf("%d %.2f\n%d %.2f\n",w[0].second,w[0].first,w[1].second,w[1].first);
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstring>
#include <string>
#include <string.h>
#include <cmath>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>
#define pi acos(-1.0)
#define INF 0x3f3f3f3f
#define SIZE 200005
#define read(a,n) for(i=0;i<n;i++)cin>>a[i];
#define pii pair<int,int>
#define pb push_back
using namespace std;
typedef	long long ll;
ll n, m, i, j, k, h, t, maxn, ttt, t1, t2, sig = 0;
int main() 
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c, d, e;
	cin >> a >> b >> c >> d >> e;
	int s[] = { a,b,c,d,e };
	int minn = INF, mix = 0;
	for (i = 0; i < 5; i++) {
		if (minn > (s[i] % 10 == 0 ? 10 : s[i] % 10))
		{
			minn = (s[i] % 10 == 0 ? 10 : s[i] % 10);
			mix = i;
		}
	}
	swap(s[4], s[mix]);
	int sum = 0;
	for (i = 0; i < 5; i++) {
		if (i == 0) {
			while ((s[0] % 10))
				s[0]++;
			sum = s[0];
			continue;
		}
		if (i != 4) {
			sum += s[i];
			while ((sum % 10)) {
				sum++;
			}
			continue;
		}
		sum += s[i];
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int D, L; 
    //Dはカエルから巣穴までの距離、Lは大ジャンプでカエルが進む距離

    cin >> D >> L;
    int p, q; //カエルが大ジャンプしか回数と小ジャンプした回数

    p = D / L;
    q = D % L;

    cout << p + q << endl;
}


Measured memory_bytes: 3120
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<iostream>
using namespace std;
int main(){
	int A,B,C;
	cin>>A>>B>>C;
	int n;
	n=C%B;
	for(int i=1;i<=1000;i++){
		if((n+B*i)%A==0){
			printf("YES\n");
			return 0;
		}
	}
	printf("NO\n");
}


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

int main() {
  string str;
  cin >> str;
  size_t max_length = 0;
  size_t length = 0;
  const set<char> checker{'A', 'C', 'G', 'T'};
  for (size_t i = 0, size = str.size(); i < size; ++i) {
    if (checker.find(str[i]) != checker.end()) {
      ++length;
      if (length > max_length) {
        max_length = length;
      }
    } else {
      length = 0;
    }
  }
  cout << max_length;

  return 0;
}


Measured memory_bytes: 256
n=int(input())
a=[int(i) for i in input().split()]
b=[]
ans=0
ok=False
while True:
    for i in a:
        if i%2!=0:
            print(ans)
            ok=True
            break
        else:
            b.append(i//2)
    if ok:
        break
    ans+=1
    a=b
    b=[]

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0; i < (ll)(n); i++)
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; }
const ll INF = 1LL << 60;
bool d1[30010][10], d2[30010][100], d3[30010][1000];
int main(){
    int n;
    string s;
    cin >> n >> s;
    d1[0][s[0]-'0'] = true;
    for(int i=1; i<n; i++){
        rep(j,10){
            d1[i][j] = d1[i-1][j];
            rep(k,10){
                d2[i][10*j+k] = d2[i-1][10*j+k];
                rep(l,10){
                    d3[i][100*j+10*k+l] = d3[i-1][100*j+10*k+l];
                }
            }
        }
        d1[i][s[i]-'0'] = true;        
        rep(j,10){ 
            if(d1[i-1][j]) d2[i][10*j+(s[i]-'0')] = true;
            rep(k,10){ 
                if(d2[i-1][10*j+k]) d3[i][100*j+10*k+(s[i]-'0')] = true;
            }
        }
    }
    int ans = 0;
    rep(i,1000) if(d3[n-1][i]) ans++;
    cout << ans << endl;

    return 0;
}

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

void show_num(vector<int> num)
{
    for (int i = num.size() - 1; i >= 0; i--)
    {
        cout << num[i];
    }
    cout << endl;
}

int main()
{
    int K;
    cin >> K;
    vector<int> num;
    if (K <= 9)
    {
        cout << K << endl;
        return 0;
    }
    int counter = 9;
    num = vector<int>{0, 1};
    for (;;)
    {
        //show_num(num);
        counter++;
        if (K == counter)
            break;
        bool flag = false;
        for (int i = 0; i < num.size(); i++)
        {
            num[i]++;
            if (num[i] >= 10)
                continue;
            if (i < num.size() - 1 && num[i] - num[i + 1] > 1)
                continue;
            int prev = num[i];
            for (int j = i - 1; j >= 0; j--)
            {
                num[j] = max(0, prev - 1);
                prev--;
            }
            flag = true;
            break;
        }
        if (!flag)
        {
            // 次の位を足す
            for (int i = 0; i < num.size(); i++)
            {
                num[i] = 0;
            }
            num.push_back(1);
        }
    }
    show_num(num);
}

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

int main(){
  int n;
  int p[N];
  
  for(int i=0;i<N;i+=2)p[i] = 0;
  for(int i=1;i<N;i+=2)p[i] = 1;
  p[1] = 0;
  p[2] = 1;

  int c = 3;
  while(c*c<N){
    for(int i=3*c;i<N;i+=2*c)p[i] = 0;
    while(!p[++c]);
  }

  while(1){
    cin >> n;
    if(!n)break;

    if(p[n])cout << 0 << endl;
    else{
      int l,r;
      l = r = n;
      while(!p[--l]);
      while(!p[++r]);
      cout << r - l << endl;
    }
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
#define N 10000
#define WHITE 0
#define GRAY 1
#define BLACK 2
static const int INFTY = (1<<20);
int n;
vector<pair<int,int> >adj[N];
void dijkstra(void);
int main()
{
  int i,j,k;
  int u, v, c;

  cin >> n;

  for(i = 0;i < n;i++)
  {
    cin >> u >> k;

    for(j = 0;j < k;j++)
    {
      cin >> v >> c;

      adj[u].push_back(make_pair(v, c));
    }
  }

  dijkstra();

  return 0;
}




void dijkstra()
{
  priority_queue<pair<int,int> >PQ;
  int i,j;
  int u,v;
  int d[N],color[N];

  for(i = 0;i < n;i++)
  {
    color[i] = WHITE;
    d[i] = INFTY;
  }

  color[0] = GRAY;
  d[0] = 0;
  PQ.push(make_pair(0,0));

  while(!PQ.empty())
  {
    pair<int,int>a = PQ.top();
    PQ.pop();

    u = a.second;
    color[u] = BLACK;

        if(d[u] < a.first*(-1))
        {
          continue;
        }

        for(j = 0;j < adj[u].size();j++)
        {
          v = adj[u][j].first;

          if(color[v] == BLACK)
          {
    	       continue;
          }

          if(d[v] > d[u] + adj[u][j].second)
          {
    	       color[v] = GRAY;
    	       d[v] = d[u] + adj[u][j].second;
    	       PQ.push(make_pair(d[v]*(-1),v));
          }
        }

      }

      for(i = 0;i < n;i++)
      {
        cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
      }
    }



Measured memory_bytes: 8008
#include <algorithm>
#include <array>
#include <bitset>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <queue>

using namespace std;

struct BoolName : numpunct<char> {
  string t, f;
  BoolName (string t = "Yes", string f = "No") : t(t), f(f) {}
  string do_truename() const {return t;}
  string do_falsename() const {return f;}
};

struct Initializer {
  Initializer() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(15) << boolalpha;
    cout.imbue(locale(cout.getloc(), new BoolName));
  }
} initializer;

template<typename T> istream& operator>>(istream &s, vector<T> &v) {
  for (T &t : v) s >> t;
  return s;
}

template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
  for (const T &t : v) s << t << endl;
  return s;
}

void set_bool_name(string t, string f) {
  cout.imbue(locale(cout.getloc(), new BoolName(t, f)));
}

int main() {
  string n;
  cin >> n;
  cout << ((n[0] == n[1] || n[2] == n[3]) && n[1] == n[2] ? "Yes" : "No") << endl;
}



Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n,a=0;
    cin>>n;
	bool isprime[55555];
    for(auto &x:isprime)x=true;
	isprime[0]=isprime[1]=false;
	for(int i=2;i*i<=55555;i++)if(isprime[i])for(int j=i+i;j<=55555;j+=i)isprime[j]=false;

    for(int i=0;i<n;i++){
        while(1){
            if(isprime[a]&&a%5==1){
                cout<<a++<<"\n "[i!=n-1];
                break;
            }
            a++;
        }
    }
    return 0;
}

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

typedef long long ll;

const long double PI = (acos(-1));


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

  string s;
  cin >> s;

  if (s == "SUN"){
    cout << 7 << endl;
  }else if (s == "MON"){
    cout << 6 << endl;
  }else if (s == "TUE"){
    cout << 5 << endl;
  }else if (s == "WED"){
    cout << 4 << endl;
  }else if (s == "THU"){
    cout << 3 << endl;
  }else if (s == "FRI"){
    cout << 2 << endl;
  }else if (s == "SAT"){
    cout << 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256