akhauriyash/Code-Regression huggingface dataset:
int main(){
    int n;
    scanf("%d",&n);
    int a[100];
    int i=0;
    while(i<n){
        scanf("%d",&a[i]);
        i++;
    }
    for(i=n-1;i>=0;i--){
        printf("%d",a[i]);
        if(i!=0)
        printf(" ");
    }
    printf("\n");
    return 0;

}

Measured memory_bytes: 1860
import array;R=range;L=input;T=[0]*28;N=int(L());S=[[ord(C)-95 for C in L()]for _ in[0]*N];U=N*26**2*array.array('i',[0]);V=N*[0];Q=int(L())
for X in S:
	P=0
	for C in X:
		if T[P+C]==0:T[P+C]=len(T);T+=[0]*28
		T[P]+=1;P=T[P+C]
	T[P]+=1;T[P+1]=1
while N:
	N-=1;P=0
	for C in S[N]:
		for A in R(26):X=T[P+A+2];U[676*N+26*A+C-2]+=T[X]*(X and A!=C-2)
		V[N]+=T[P+1];P=T[P+C]
while Q:
	K,P=L().split();K=int(K)-1;P=[ord(C)-97 for C in P];X=1+V[K]
	for A in R(26):
		for B in R(A+1,26):X+=U[676*K+26*P[A]+P[B]]
	print(X);Q-=1

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N, M;
	cin >> N >> M;
	vector<ll> A(M, 0);
	REP(i, M) cin >> A[i];

	vector<ll> match = {2, 5, 5, 4, 5, 6, 3, 7, 6};

	ll INF = LLONG_MAX/3;

	string dp[N+1];
	REP(i, N+1) dp[i] = "";

	REP(i, N+1){
		if(i!=0 && dp[i]=="") continue;
		REP(j, M){
			ll tmp = i+match[A[j]-1];
			if(tmp>N) continue;
			string cand1 = dp[tmp];
			string cand2 = to_string(A[j])+dp[i];
			if(cand1.size()>cand2.size()){
				dp[tmp] = cand1;
			}else if(cand1.size()<cand2.size()){
				dp[tmp] = cand2;
			}else{
				if(cand1<cand2){
					dp[tmp] = cand2;
				}else{
					dp[tmp] = cand1;
				}
			}
		}
	}

	cout << dp[N] << endl;
	
    return 0;
}

Measured memory_bytes: 32384
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);++i)
#define Rep(i,n) for(int i=1;i<=(n);++i)
using LL = long long;
using ULL = unsigned long long;

const int INF = 0x3f3f3f3f;

int main()
{
    LL x;
    cin >> x;
    int ans = 0;
    for(LL i = 2; i * i <= x; ++i) if(x % i == 0) {
        int t = 0;
        while(x % i == 0) ++t, x /= i;
        int n = 1;
        t *= 2;
        while((n+1) * (n+2) <= t) ++n;
        ans += n;
    }
    if(x > 1) ++ans;
    cout << ans << endl;
	return 0;
}



Measured memory_bytes: 3636
import java.util.Scanner;

class Main {
    public static void main(String[] args) {

        Scanner s = new Scanner(System.in);
        int a =s.nextInt();
        int n =s.nextInt();

//        int a = 2;
//        int n = 1_000_000_006;
//        int n = 50;
        int p = 1_000_000_007;


        long ans = pow(a,n,p);

        System.out.println(ans);

    }

static
    long pow(int a,int n,int p){

        if(n==1){
            return a;
        }
        if(n%2==0){
            long temp = pow(a,n/2,p);
            return temp*temp %p;
        }else{
            long temp = pow(a,n-1,p);
            return temp*a %p;
        }
    }

}


Measured memory_bytes: 26180
package main

import "fmt"

func main() {
	var n int
	fmt.Scanln(&n)
	a := make([]int, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&a[i])
	}

	//BubbleSort
	swapNum := 0
	for i := 0; i < n; i++ {
		for j := n - 1; j >= i+1; j-- {
			if a[j] < a[j-1] {
				a[j], a[j-1] = a[j-1], a[j]
				swapNum++
			}
		}
	}
	for i := 0; i < n; i++ {
		if i < n-1 {
			fmt.Printf("%d ", a[i])
		} else {
			fmt.Println(a[i])
		}
	}
	fmt.Println(swapNum)
}


Measured memory_bytes: 1156
import sys,collections as cl,bisect as bs
sys.setrecursionlimit(100000)
input = sys.stdin.readline
mod = 10**9+7
Max = sys.maxsize
def l(): #intのlist
  return list(map(int,input().split()))
def m(): #複数文字
  return map(int,input().split())
def onem(): #Nとかの取得
  return int(input())
def s(x): #圧縮
  a = []
  if len(x) == 0:
    return []
  aa = x[0]
  su = 1
  for i in range(len(x)-1):
    if aa != x[i+1]:
      a.append([aa,su])
      aa = x[i+1]
      su = 1
    else:
      su += 1
  a.append([aa,su])
  return a
def jo(x): #listをスペースごとに分ける
  return " ".join(map(str,x))
def max2(x): #他のときもどうように作成可能
  return max(map(max,x))
def In(x,a): #aがリスト(sorted)
    k = bs.bisect_left(a,x)
    if k != len(a) and a[k] ==  x:
        return True
    else:
        return False

def pow_k(x, n):
    ans = 1
    while n:
        if n % 2:
            ans *= x
        x *= x
        n >>= 1
    return ans

"""
def nibu(x,n,r):
  ll = 0
  rr = r
  while True:
    mid = (ll+rr)//2

  if rr == mid:
    return ll
  if (ここに評価入れる):
    rr = mid
  else:
    ll = mid+1
"""

s = onem()

x = [0,10**9,0]
y = [0,1,0]

x[-1] = -s % 10**9
y[-1] = -(-s // 10**9)

print(x[0],y[0],x[1],y[1],x[2],y[2])



Measured memory_bytes: 3316
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <cmath>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <random>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include <fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;

using ll = long long;
using vll = vector<ll>;
using pll = pair<ll, ll>;
using qll = queue<ll>;
using vb = vector<bool>;
using mll = map<ll, ll>;
using sll = stack<ll>;
#define REP(i,n) for(ll i(0);(i)<(n);(i)++)
#define rep(i,n) for(ll i(0);(i)<(n);(i)++)
#define ALL(a) a.begin(), a.end()
#define enld endl //* missspell check
const ll INF = 1LL << 60;
const ll sqrtN = 512; //* 512*512=262144 > 10^5

struct RSQ{ 
    ll N, K; //* N length of data, K number of buckets
    string data;
    vector<vll> bucketSum;
    //* allocate memory with zeros
    void init(ll n){
        N = n;
        K = (n + sqrtN - 1) / sqrtN; //* number of buckets = ceil(n/sqrtN)
        //data.assign(K * sqrtN, '0');
        data = string(K * sqrtN, '0');
        bucketSum.assign(K, vll(26, 0));
    }
    //* constructor
    RSQ(ll n){ init(n);}
    //* constructor with init vector data
    RSQ(ll n, string &a){
        init(n);
        REP(i, n){
            data[i] = a[i];
        }
        REP(k, K){
            for(ll j = k * sqrtN; j < min(n, (k + 1)* sqrtN); j++){
                bucketSum[k][data[j]-'a']++;
            }
        }
    }
    //* update (add(i, x) -> a[i]+= x)
    void update(ll i, char x){
        ll k = i / sqrtN; //* corresponding bucket
        char old = data[i];
        data[i] = x;
        bucketSum[k][old-'a']--;
        bucketSum[k][data[i]-'a']++;
    }
    //* getSum(s, t)-> return a[s]+a[s+1]+...+a[t-1]
    //* [x, y)
    ll getSum(ll x, ll y){
        ll cnt = 0;
        vll tmpChar(26, 0);
        REP(k, K){
            ll l= k * sqrtN, r = (k+1) * sqrtN; //* bucket [l, r)
            if(r <= x || y <= l) //* no intersection
                continue;
            if(x <= l && r <= y) {//* [l, r) in [x, y)
                REP(ch, 26){
                    tmpChar[ch] += bucketSum[k][ch];
                }
            }
            else{ //* has intersection on boundary
                for(ll i = max(l, x); i < min(r, y); i++){
                    tmpChar[data[i]-'a']++;
                }
            }
        }
        REP(ch, 26) cnt+= ((tmpChar[ch]>0)?1:0);
        return cnt;
    }
};

int main(){
    ll N; cin >> N;
    string S; cin >> S;
    RSQ st(N, S);

    ll Q; cin >> Q;
    REP(q, Q){
        ll type; cin >> type;
        if(type == 1){
            ll i; cin >> i; i--;
            char c; cin >> c;
            st.update(i, c);
        }
        if(type == 2){
            ll l, r; cin >> l >> r; l--;
            cout << st.getSum(l, r)<<endl;
        }
    }

    return 0;
}


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

int main() {
    string s;
    cin >> s;
    for (int i = 2; i < s.size(); i++) {
        if (s[i - 2] == s[i]) {
            cout << (i - 1) << ' ' << (i + 1) << endl;
            return 0;
        }
    }
    for (int i = 1; i < s.size(); i++) {
        if (s[i - 1] == s[i]) {
            cout << i << ' ' << (i + 1) << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
    return 0;
}


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

ll solve() {
    ll N;
    cin >> N;
    unordered_map<int,int> AN;
    int a;
    for ( int i = 0; i < N; i++ ) {
        cin >> a;
        AN[a]++;
    }
    ll ans = 0;
    for ( auto k : AN ) {
        int i = k.first;
        int n = k.second;
        if ( n >= i ) ans += n - i;
        else ans += n;
    }
    return ans;
}

int main() {
    auto ans = solve();
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4260
#include <iostream>
#include <string>
#include <sstream>

using namespace std;

int main() {
    string line;
    stringstream ss;
    int n;
    getline(cin, line);
    ss << line;
    ss >> n;
    getline(cin, line);
    int total = 0;
    while (n--) {
        if (n > 1 && line[n] == 'C' && line[n - 1] == 'B' && line[n - 2] == 'A') {
            total++;
        }
    }
    cout << total;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
#define INF (1 << 30) - 1
#define LLINF (1LL << 61) - 1
// #define int ll
using namespace std;
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll n;
    cin>>n;
    if(n<10){
        cout<<n<<endl;
    }
    else if(n>=10 && n<100){
        cout<<9<<endl;
    }
    else if(n>=100 && n<1000){
        cout<<n-99+9<<endl;
    }
    else if(n>=1000 && n<10000){
        cout<<909<<endl;
    }
    else if(n>=10000 && n<100000){
        cout<<n-9999+900+9<<endl;
    }
    else{
        cout<<90909<<endl;
    }
    return 0;
}

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

int main()
{
	std::string S;
	std::cin >> S;
static int i=0;
	if (S[0] != 'A')
	{
		std::cout << "WA" << std::endl;
		return 0;
	}
	if (S[1] == 'C' || S[S.size()-1] =='C') {
		std::cout << "WA" << std::endl;
		return 0;
	}
	for (auto itr = S.begin(); itr != S.end(); ++itr)
	{
		if (*itr == 'C')
			i++;
		if (i >= 2) {
			std::cout << "WA" << std::endl;
			return 0;
}
                if(*itr == 'A' && itr !=S.begin()){
std::cout << "WA" << std::endl;
			return 0;
		}
		if (*itr == 'B') {
			std::cout << "WA" << std::endl;
			return 0;
		}
		if (*itr == 'D') {
			std::cout << "WA" << std::endl;
			return 0;
		}
		if (*itr == 'E') {
			std::cout << "WA" << std::endl;
			return 0;
		}
		if (*itr == 'F') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'G') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'H') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'I') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'J') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'K') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'L') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'M') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'N') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'O') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'P') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'Q') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'R') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'S') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'T') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'U') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'V') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'W') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'X') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'Y') {
			std::cout << "WA" << std::endl;
			return 0;
		}if (*itr == 'Z') {
			std::cout << "WA" << std::endl;
			return 0;
		}
	}
if(i==0){
std::cout<<"WA"<<std::endl;
return 0;
}
	std::cout << "AC" << std::endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main(){
  int L, R, d, count = 0;
  cin >> L >> R >> d;
  for (int i = L; i < R+1; i++){
    if (fmod(i,d) == 0){
      count += 1;
    }
  }
  cout << count << endl;
  return 0;
}

Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T, class U> using Pa = pair<T, U>;
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;

ll gcd(ll n,ll m){
    if(n%m==0) return m;
    else return gcd(m,n%m);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll A,B,C,D;
    cin >> A >> B >> C >> D;

    auto calc = [&](ll x){
        ll l = C/gcd(C,D)*D;
        return x-(x/C+x/D-x/l);
    };
    cout << calc(B)-calc(A-1) << "\n";
}

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


int dp[201][201] ;
int gcd1(int a, int b) 
{ 
    if(dp[a][b] == -1){
        if(a == 0){
            dp[0][b] = b;
            return b;
        }else{
            int ans = gcd1(b%a, a);
            dp[a][b] =  ans;
            dp[b][a] = ans;
            return ans;
        }
    }
    return dp[a][b];
} 
int gcd(int a, int b , vector <vector<int>> &dp) 
{   if(dp[a][b] == -1){
        if (a == 0) dp[a][b] = b; 
         
        dp[a][b] =  gcd(b % a, a , dp); 
        dp[b][a] = dp[a][b];
        return dp[a][b];
    }
    return dp[a][b];
    
} 
int main() {
    int n;
    cin >> n;
    long long sum = 0;
    memset(dp , -1 , sizeof(dp));

    for(int i = 1 ; i <= n ; i++){
        for(int j = 1; j <= n ; j++){
            for(int k = 1; k <= n ; k++){
                sum += gcd1(i , gcd1(j , k ) );
            }
        }
    }
    cout << sum << endl;
}


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

int main(){
    int n,W;
    cin >> n >> W;
    vector<int> v(n);
    vector<int> w(n);
    int dp[110][10010];
    rep(i,n) cin >> v[i] >> w[i];
    memset(dp[0], 0, sizeof(dp[0]));
    for(int i = 0; i < n; i++){
        for(int j = 0; j <=W; j++){
            if(j >= w[i]){
                dp[i + 1][j] = max(dp[i][j], dp[i][j - w[i]] + v[i]);
            }else {
                dp[i + 1][j] = dp[i][j];
            }
        }
    }
    cout << dp[n][W] << endl;
    return 0;
}


Measured memory_bytes: 7080
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int n;

void solve(){
  cin >> n;
  int a[n];
  for(int i=0;i<n;i++)cin >> a[i];
  int h=a[0];
  int ans=1;
  for(int i=1;i<n;i++){
    if(a[i]>=h){
      ans++;
      h=a[i];
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <tuple>
#include <algorithm>

using namespace std;

template<typename T>
using point = tuple<uint32_t, T, T>;

template<typename T>
class KdTree {
private:
    struct node {
        point<T> p;
        node *l, *r;
        node(const point<T> &p) : p(p), l(nullptr), r(nullptr) {}
    };

    node *root;

    template<typename Iter>
    node *construct(Iter points_begin, Iter points_end, bool x) {
        uint32_t n = points_end - points_begin;
        if (n == 0) return nullptr;

        sort(points_begin, points_end, [x](const point<T> &lhs, const point<T> &rhs){return x ? get<1>(lhs) < get<1>(rhs) : get<2>(lhs) < get<2>(rhs);});

        node *nd = new node(points_begin[n/2]);
        nd->l = construct(points_begin, points_begin+n/2, !x);
        nd->r = construct(points_begin+n/2+1, points_end, !x);

        return nd;
    }

    void search(node *nd, T sx, T tx, T sy, T ty, bool x, vector<uint32_t> &vec) {
        if (nd == nullptr) return;

        if (sx <= get<1>(nd->p) && get<1>(nd->p) <= tx &&
            sy <= get<2>(nd->p) && get<2>(nd->p) <= ty) {
            vec.push_back(get<0>(nd->p));
        }

        if (x ? sx <= get<1>(nd->p) : sy <= get<2>(nd->p)) search(nd->l, sx, tx, sy, ty, !x, vec);
        if (x ? get<1>(nd->p) <= tx : get<2>(nd->p) <= ty) search(nd->r, sx, tx, sy, ty, !x, vec);

        return;
    }

public:
    KdTree(vector<point<T>> &points) : root(construct(points.begin(), points.end(), true)) {}

    void search(T sx, T tx, T sy, T ty, vector<uint32_t> &vec) {
        search(root, sx, tx, sy, ty, true, vec);
        return;
    }
};

int main() {
    int32_t n;
    scanf("%d", &n);

    vector<point<int32_t>> points(n);

    for (int32_t i = 0; i < n; i++) {
        int32_t x, y;
        scanf("%d %d", &x, &y);

        points[i] = make_tuple(i, x, y);
    }

    KdTree<int32_t> kdt(points);

    int32_t q;
    scanf("%d", &q);

    for (int32_t i = 0; i < q; i++) {
        int32_t sx, tx, sy, ty;
        scanf("%d %d %d %d", &sx, &tx, &sy, &ty);

        vector<uint32_t> res;
        kdt.search(sx, tx, sy, ty, res);

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

        for (uint32_t id : res) printf("%u\n", id);
        printf("\n");
    }

    return 0;
}

Measured memory_bytes: 31340
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b;
  cin >> a >> b;
  int ans;
  if ( (a+b)%2 == 0 ) ans = (a+b)/2;
  else ans = (a+b)/2 +1;
  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3612
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
using namespace std;
typedef long long longlong;
typedef long long LL;
typedef pair<int, pair<int, int>> Trio;
typedef pair<int, int> Pair;

int main(void) {
	LL n, i, j, k, now, num;
	cin >> n;
	vector<LL> a(n+1);
	for (i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	now = 1;
	num = a[now];
	for (i = 0; i <= 2 * n; ++i) {
		now = num;
		num = a[now];
		if (now == 2) {
			cout << i + 1 << endl;
			return 0;
		}
	}
	cout << -1 << endl;
	return 0;
}


Measured memory_bytes: 1024
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.stream.Stream;

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

        while(true){
            int x = sc.nextInt();
            int y = sc.nextInt();

            if(x == 0 && y == 0) break;

            if(x > y){
                System.out.println(String.format("%d %d", y, x));
            } else {
                System.out.println(String.format("%d %d", x, y));
            }


        }
    }
}



Measured memory_bytes: 40904
#include <stdio.h>

int y_g(int ,int );

int main()
{
  int x,y;
  
  scanf("%d%d",&x,&y);
  printf("%d\n",y_g(x,y));

  return 0;
}

int y_g(int x,int y)
{
  if(x%y==0) return y;
  else return y_g(y,x%y);
}
  



Measured memory_bytes: 2104
#include<cstdio>
using namespace std;
int n;
long long m,a[100005],qzh[100005],ans;
struct sd{int num,c;}cnt[50000000];
int main()
{
	scanf("%d%lld",&n,&m);for(int i=0;i<=49999999;++i) cnt[i].num=cnt[i].c=0;
	for(int i=1;i<=n;++i) scanf("%lld",&a[i]);
	for(int i=1;i<=n;++i) qzh[i]=qzh[i-1]+a[i];
	for(int i=0;i<=n;++i) {
		int now=(int)(qzh[i]%m);
		int modal=now%50000000;
		while(cnt[modal].num&&cnt[modal].num!=now) {++modal;if(modal==50000000) modal=0;}
		if(cnt[modal].num) cnt[modal].c++;
		else {cnt[modal].num=now;cnt[modal].c++;}
	}
	for(int i=0;i<=49999999;++i) {
		long long nnn=cnt[i].c;
		ans+=nnn*(nnn-(long long)1)/(long long)2;
	}
	printf("%lld\n",ans);
	return 0;
}


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

#define rep(i,n) for(int i=0 ; i<(n) ; i++)
#define repr(i,n) for(int i=(n) ; i>=0 ; i--)
#define ALL(x) (x).begin(),(x).end()

using ll = long long;
using ull = unsigned long long;
 
const ll INF = 1LL<<60;
const int MINF = 1e9;
const int MOD = 1e9+7;

using vi = vector<int>;
using vii = vector<vi>;

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

template<typename T>
T GCD(T a,T b){ return b ? GCD(b,a%b) : a ;}
template<typename T>
T LCM(T a,T b){ return a*b / GCD(a,b) ;}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    ll ans = 0;

    if(k>0 && min(a,k) == a)k -= a,ans += a;
    else ans += k,k = 0;

    if(k>0 && min(b,k) == b)k -= b;
    else k = 0;

    if(k>0 && min(c,k) == c)k -= c,ans -= c;
    else ans -= k,k = 0;

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

Measured memory_bytes: 3680
<?php /*test.php*/

$t = new temp();

$t->stdin(fgets(STDIN));
$t->run();

unset($t);

class temp{
	private $stdin = array();
	
	public function __construct(){
	}

	public function stdin($data = null){
		$this->stdin = explode(" ", $data);
	}

	public function run(){
		$num = ($this->stdin[0] + $this->stdin[1]) / 2;
		$num = ceil($num);
		echo $num;
	}
	
}

?>


Measured memory_bytes: 3828
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;

int main() {
  bool yes = false;
  for (int i = 0; i < 3; ++i) {
    char c; cin >> c;
    if (c == '7') yes = true;
  }
  if (yes) cout << "Yes" << endl;
  else     cout << "No" << endl;
}


Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <list>
#include <cmath>
#include <stack>
#include <string>
#include <cstring>
#include <numeric>
#include <iomanip>
#include <fstream>
using namespace std;
long long mod=1e9+7;
int main(){
	int n;
	string s;
	cin>>n>>s;
	vector<int> c[26];
	for(int i=0;i<n;i++){
		c[s[i]-'a'].push_back(i);
	}
	long long ans=1;
	for(int i=0;i<26;i++){
		(ans*=(1+c[i].size()))%=mod;
	}
  	(ans+=mod-1)%=mod;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
#define siz(v) (ll)(v).size()
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define repr(i, a, n) for (ll i = n - 1; (ll)a <= i; i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 + 99);
vector<ll> dx = {-1, 1, 0, 0}, dy = {0, 0, -1, 1};
template <typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template <typename T>
T mpow(T a, T n)
{
    T res = 1;
    for (; n; n >>= 1)
    {
        if (n & 1)
            res = res * a;
        a = a * a;
    }
    return res;
}

//cin.tie(0);ios::sync_with_stdio(false);

signed main()
{
    cin.tie(0);ios::sync_with_stdio(false);
    ll n, ans = 0;
    cin >> n;

    multiset<ll> se;
    vector<ll> tpow(31, 1);
    rep(i, 1, 31)
    {
        tpow[i] = tpow[i - 1] * 2;
    }

    rep(i, 0, n)
    {
        ll x;
        cin >> x;
        se.insert(x);
    }

    while(!se.empty())
    {
        ll now=*(--se.end());
        ll need = *ub(all(tpow), now) - now;
        se.erase(se.lb(now));
        auto itr = se.lb(need);

        //if(itr==se.end())continue;

        if (need == *itr)
        {
            se.erase(itr);//
            ans++;
        }
    }

    cout << ans << endl;
}

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

using namespace std;

int main(){
    string s;
    cin >> s;
    int mina = -1;
    int maxz = -1;
    for(int i=0;i<s.length();i++){
        if(s[i]=='A'&&mina==-1){
            mina = i;
        }
        if(s[i]=='Z'&&i>maxz){
            maxz=i;
        }
    }
    cout << maxz-mina+1;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define all(x) x.begin(),x.end()
#define cmin(a,b) (a>b?a=b:a)
#define cmax(a,b) (a<b?a=b:a)
#define mem(a,k) memset(a,k,sizeof(a))
#define lop(i,s,t) for(int i=s;i<(t);++i)
#define rep(i,s,t) for(int i=s;i<=(t);++i)
#define dec(i,s,t) for(int i=s;i>=(t);--i)
#define fore(i,v) for(int i=g[v],d=es[i].d;i;i=es[i].nxt,d=es[i].d)
using namespace std;

#define Pr(f,...) fprintf(stderr,f,##__VA_ARGS__),fflush(stderr)

typedef long long ll;

template<typename T>
void read(T &x){
	x=0; 
	char c;
	for(c=getchar();!isdigit(c);c=getchar()); 
	for(;isdigit(c);c=getchar())x=x*10+c-'0'; 
}

const int N=305,O=300,P=998244353;

int mul(int a,int b){ return 1ll*a*b%P; }
int add(int a,int b){ a+=b; return a>=P?a-P:a; }
void upd(int&a,int b){ a=add(a,b); }
int sub(int a,int b){ a-=b; return a<0?a+P:a; }
int gcd(int a,int b){ return !b?a:gcd(b,a%b); }

string s;
int K,l,f[N][N+N][N],ans,n,a[N];
int main(int argc,char *argv[]){
#ifdef CURIOUSCAT
	freopen("d.in","r",stdin); 
#endif
	cin>>s>>K;
	s+="0"; 
	n=(int)s.size(); 
	int cur=0,sm=0;
	lop(i,0,n){
		if(s[i]=='0'){
			a[l++]=cur;
			sm+=cur;
			cur=0; 
		}else{
			++cur;
		}
	}
	reverse(a,a+l); 
	--l;
	if(l==0){
		cout<<1<<endl;
		return 0; 
	}
	K=min(sm,K); 

	rep(i,0,a[0])f[0][a[0]-i+O][a[0]-i]=1;
	//ith zero, j reamaining, k balance(counted when created), m at this round
	lop(i,0,l)rep(j,0,sm)rep(m,0,sm){
		int z=j+a[i+1]-m,nk=0;
		if(z<0)continue;
		if(z>j)nk=z-j;
		if(K-nk>=0)rep(k,0,K-nk){
			upd(f[i+1][z+O][k+nk],f[i][j+O][k]);
		}
	}
	rep(k,0,K)upd(ans,f[l][0+O][k]); 
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 31284
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
using namespace __gnu_pbds;

#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// find_by_order()  // order_of_key
typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;

int b[212345],a[212345];
int main(){
    std::ios::sync_with_stdio(false); cin.tie(NULL);
    int n,k;
    cin>>n>>k;
    int i,j;
    rep(i,n){
    	cin>>a[i];
    }
    rep(i,k){
    	int flag=0;
    	rep(j,n){
    		b[j]=0;
    		if(a[j]!=n){
    			flag=1;
    			//break;
    		}
    	}
    	if(flag==0)
    		break;
    	rep(j,n){
    		int lef=j-a[j];
    		int rig=j+a[j];
    		rig=min(rig,n-1);
    		rig++;
    		lef=max(lef,0);
    		b[lef]++;
    		b[rig]--;
    	}
    	a[0]=b[0];
    	f(j,1,n){
    		b[j]+=b[j-1];
    		a[j]=b[j];
    	}
    }
    rep(i,n){
    	cout<<a[i]<<" ";
    }
    cout<<endl;
    return 0;   
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  int n, q;
  ll s = 0;
  scanf("%d", &n);
  map<int, int> a;
  for(int i = 0; i < n; i++) {
    int t;
    cin >> t;
    a[t]++;
    s += t;
  }
  scanf("%d", &q);
  int b, c;
  for(int i = 0; i < q; i++) {
    scanf("%d %d", &b, &c);
    if(a.count(b)) {
      printf("%lld\n", (s = s + ((ll)c - b) * a[b]));
      a[c] += a[b];
      a[b] = 0;
    } else
      printf("%lld\n", s);
  }
}

Measured memory_bytes: 7456
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"unsafe"
)

func main() {
	N := sc.nextInt()
	An := sc.nextInts()
	mmap := make(map[int]int)
	// ansArr := make([]int, N)
	for i, v := range An {
		mmap[v] = i + 1
	}
	sort.Ints(An)
	for i := 0; i < N; i++ {
		fmt.Print(mmap[An[i]], " ")
	}
	fmt.Println()
}

var (
	sc scanner
)

func init() {
	sc = scanner{
		buf: make([]string, 0, 0),
		cur: 0,
		r:   bufio.NewReader(os.Stdin),
	}
}

type scanner struct {
	buf []string
	cur int
	r   *bufio.Reader
}

func (s *scanner) readln() {
	rbuf := make([]byte, 0, 0)
	for {
		line, prefix, err := s.r.ReadLine()
		if err != nil {
			panic(err)
		}
		rbuf = append(rbuf, line...)
		if prefix == false {
			break
		}
	}
	s.cur = 0
	s.buf = strings.Split(*(*string)(unsafe.Pointer(&rbuf)), " ")
}
func (s *scanner) isFull() bool {
	if s.cur == len(s.buf) {
		return true
	}
	return false
}
func (s *scanner) resetCur() {
	s.cur = 0
}
func (s *scanner) next() string {
	if s.cur == 0 {
		s.readln()
	}
	res := s.buf[s.cur]
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nexts() []string {
	s.readln()
	s.resetCur()
	return s.buf
}
func (s *scanner) nextInt() int {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.Atoi(s.buf[s.cur])
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextInts() []int {
	s.readln()
	res := make([]int, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.Atoi(s.buf[i])
	}
	s.resetCur()
	return res
}
func (s *scanner) nextFloat() float64 {
	if s.cur == 0 {
		s.readln()
	}
	res, _ := strconv.ParseFloat(s.buf[s.cur],
		64)
	s.cur++
	if s.isFull() {
		s.resetCur()
	}
	return res
}
func (s *scanner) nextFloats() []float64 {
	s.readln()
	res := make([]float64, len(s.buf))
	for i := range s.buf {
		res[i], _ = strconv.ParseFloat(s.buf[i],
			64)
	}
	s.resetCur()
	return res
}
func digits(x int) int {
	return len(strconv.Itoa(x))
}
func powInt(x, p int) (result int) {
	result = 1
	for i := 0; i < p; i++ {
		result *= x
	}
	return
}
func max(x, y int) int {
	return int(math.Max(float64(x), float64(y)))
}
func min(x, y int) int {
	return int(math.Min(float64(x), float64(y)))
}
func abs(x int) int {
	return int(math.Abs(float64(x)))
}
func varDump(value ...interface{}) {
	for _, v := range value {
		fmt.Fprintf(os.Stderr, "%#v\n", v)
	}
}
func yes() {
	fmt.Println("Yes")
}
func no() {
	fmt.Println("No")
}

// Pair a
type Pair struct {
	first  int
	second int
}

// Queue a
type Queue struct {
	v []Pair
}

// Push for queue
func (q *Queue) Push(v Pair) {
	q.v = append(q.v, v)
}

// Pop for queue
func (q *Queue) Pop() Pair {
	r := q.v[0]
	q.v = q.v[1:]
	return r
}

// Front for queue
func (q Queue) Front() Pair {
	return q.v[0]
}

// Empty return true if empty
func (q Queue) Empty() bool {
	return len(q.v) == 0
}


Measured memory_bytes: 11136
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
using namespace std;
#define rep(i,n) for(auto i=0; i<(n); i++)
#define mem(x,val) memset((x),(val),sizeof(x));
#define rite(x) freopen(x,"w",stdout);
#define read(x) freopen(x,"r",stdin);
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
#define sqr(x) ((x)*(x))
#define pb push_back
#define clr clear()
#define inf (1<<30)
#define ins insert
#define xx first
#define yy second
#define eps 1e-9
typedef long long ll;
typedef unsigned long long ull;
typedef string st;
typedef vector<int> vi;
typedef vector<st> vs;
typedef map<int, int> mii;
typedef map<st, int> msi;
typedef set<int> si;
typedef set<st> ss;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

int main() {
	//freopen("in.txt", "r", stdin);
	string s;
	cin >> s;
	int s0 = 0;
	for (int i = 0; i < s.size(); ++i)
		s0 += (s[i] - '0') == (i % 2);
	int s1 = 0;
	for (int i = 0; i < s.size(); ++i)
		s1 += (s[i] - '0') != (i % 2);
	cout << min(s1, s0) << endl;
	return 0;
}

Measured memory_bytes: 512
n, a, b = map(int, input().split())
p = 1000000007

def comb_mod(n, k, mod):
    numerator = 1
    denominator = 1
    for i in range(k):
        numerator = (numerator * (n - i)) % mod
        denominator = (denominator * (i + 1)) % mod

    return (numerator * pow(denominator, mod - 2, mod)) % mod

def factor(a,b):
    ans = 1
    for i in range(a, b+1):
        ans*=i
    return ans

total = (pow(2,n,p) - 1) % p
case_a = comb_mod(n, a, p)
case_b = comb_mod(n, b, p)

print((total - case_a - case_b) % p)

Measured memory_bytes: 3064
#include<iostream>
#include<string.h>
#include<vector>
#include<list>
#include<stdio.h>
#include<math.h>
#include<iomanip>
#include<map>
#include<stack>
#include<queue>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) range(i,0,b)
#define debug(x) cout << "debug " << x << endl;
using namespace std;

int main(){
    double a, b;
    int l, r;
    while(cin >> a >> b){
        if(a < 35.50){
            l = 1;
        }else if(a < 37.50){
            l = 2;
        }else if(a < 40.00){
            l = 3;
        }else if(a < 43.00){
            l = 4;
        }else if(a < 50.00){
            l = 5;
        }else if(a < 55.00){
            l = 6;
        }else if(a < 70.00){
            l = 7;
        }else{
            l = 8;
        }
        if(b < 71.00){
            r = 1;
        }else if(b < 77.00){
            r = 2;
        }else if(b < 83.00){
            r = 3;
        }else if(b < 89.00){
            r = 4;
        }else if(b < 105.00){
            r = 5;
        }else if(b < 116.00){
            r = 6;
        }else if(b < 148.00){
            r = 7;
        }else{
            r = 8;
        }
        int ans = max(l,r);
        if(ans == 1)
            cout << "AAA" << endl;
        if(ans == 2)
            cout << "AA" << endl;
        if(ans == 3)
            cout << "A" << endl;
        if(ans == 4)
            cout << "B" << endl;
        if(ans == 5)
            cout << "C" << endl;
        if(ans == 6)
            cout << "D" << endl;
        if(ans == 7)
            cout << "E" << endl;
        if(ans == 8)
            cout << "NA" << endl;
    }
}

Measured memory_bytes: 1216
from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))

# dp[(i, x, flg)] := i番目までみてx個選んでいる時の最大値。flgは最後の１つをとったかどうか。
dp = defaultdict(lambda: -float('inf'))
dp[(0, 0, 0)] = 0

for i, a in enumerate(A, start=1):
    j = i // 2
    for x in range(j - 1, j + 2):
        dp[(i, x, 0)] = max(dp[(i - 1, x, 0)], dp[(i - 1, x, 1)])
        dp[(i, x, 1)] = dp[(i - 1, x - 1, 0)] + a

print(max(dp[(N, N // 2, 0)], dp[(N, N // 2, 1)]))


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

using namespace std;
//FILE *fi=freopen("1.txt","r",stdin);
int n;
long long k;
long long a[200001];
long long Min = 1e18;
long long ans;
vector <long long> pos,neg;
long long cnt(long long x)
{
    long long ans = 0;
    int l=0;
    int r=pos.size()-1;
    while(l<r)
    {
        if(pos[l]*pos[r]<=x)
        {
            ans+=1LL*(r-l);
            l++;
        }
        else
            r--;
    }
    l=0;
    r=neg.size()-1;
    while(l<r)
    {
        if(neg[l]*neg[r]<=x)
        {
            ans+=1LL*(r-l);
            r--;
        }
        else
            l++;
    }
    l=0;
    r=0;
    while(l<neg.size()&&r<pos.size())
    {
        if(neg[l]*pos[r]<=x)
        {
            ans+=1LL*(pos.size()-r);
            l++;
        }
        else
            r++;
    }
    return ans;
}
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        if(a[i]<0)
            neg.push_back(a[i]);
        else
            pos.push_back(a[i]);
    }
    sort(neg.begin(),neg.end());
    sort(pos.begin(),pos.end());
    long long l=-2e18;
    long long r=2e18;
    while(l<=r)
    {
        long long mid = l+r>>1;
        long long x = cnt(mid);
        if(x>=k)
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 3700
#include <bits/stdc++.h>
using namespace std;
//using Graph = vector<vector<edge>>;
using dou =long double;
string yes="yes";
string Yes="Yes";
string YES="YES";
string no="no";
string No="No";
string NO="NO";

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

#define rep(i, n)         for(int i = 0; i < (int)(n); i++)
#define brep(n)           for(int bit=0;bit<(1<<n);bit++)
#define erep(i,container) for (auto i : container)
#define irep(i, n)        for(int i = n-1; i >= (int)0; i--)
#define rrep(i,m,n) for(ll i = m; i < (ll)(n); i++)
#define reprep(i,j,h,w) rep(i,h)rep(j,w)
#define all(x) (x).begin(),(x).end()
#define VEC(type,name,n) std::vector<type> name(n);rep(i,n)std::cin >> name[i];
#define pb push_back
#define pf push_front
#define query int qq;std::cin >> qq;rep(qqq,qq)
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define itn int
#define mp make_pair
#define sum(a) accumulate(all(a),0ll)
#define keta fixed<<setprecision
//#define vvector(name,typ,m,n,a)vector<vector<typ> > name(m,vector<typ> (n,a))
#define vvector(name,typ,m,n)vector<vector<typ> > name(m,vector<typ> (n))
#define vvvector(name,t,l,m,n,a) vector<vector<vector<t> > > name(l, vector<vector<t> >(m, vector<t>(n,a)));
#define vvvvector(name,t,k,l,m,n,a) vector<vector<vector<vector<t> > > > name(k,vector<vector<vector<t> > >(l, vector<vector<t> >(m, vector<t>(n,a)) ));
#define case std::cout <<"Case #" <<qqq+1<<": "
#define res resize
#define as assign
#define ffor for(;;)
#define ppri(a,b) std::cout << a<<" "<<b << std::endl
#define pppri(a,b,c) std::cout << a<<" "<<b <<" "<< c<<std::endl
#define aall(x,n) (x).begin(),(x).begin()+(n)
#define ssum(a) accumulate(a,0ll) 

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
//typedef long long T;
ll ceil(ll a,ll b){
    return ((a+b-1)/b);
}
const int INF = 1000000000;
const ll INF64 = 9223372036854775807ll;
const ll MOD = 1000000007ll;
const dou pi=3.141592653589793;
//mapは、if関数などで覗いただけで構成されるので注意しよう！
//std::vector<vector<int>> g;


//std::vector<std::set<int>> g;

int main(){
    int a,b,k;
    std::cin >> a>>b>>k;
    std::set<int> s;
    rrep(i,a,a+k)s.insert(i);
    rrep(i,b-k+1,b+1)s.insert(i);
    erep(i,s){
        if(i>=a&&i<=b)std::cout << i << std::endl;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define mod 1e9 +7;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<int> vi;
const double phi = (1 + sqrt(5)) / 2;
const double phi_ = (1 - sqrt(5)) / 2;
ll fib(ll n){
    double res = pow(phi, n+1) - pow(phi_, n+1);
    return res / sqrt(5);
}
ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}
ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}
string to_bin_string(ll n){
    stringstream ss;
    ss << bitset<8>(n); //任意の桁数<m>
    string s = ss.str();
    return s;
}
int main()
{
    ll n; cin >> n;
    vll a(n), b(n, 0), cnt(3, 0);
    rep(i,n){
        ll tmp;
        cin >> tmp;
        a[i] = tmp;
        while(tmp % 2 == 0){
            b[i]++;
            tmp /= 2;
        }
    }
    rep(i,n){
        if(b[i] < 2)cnt[b[i]]++;
        else cnt[2]++;
    }
    if(cnt[1] == 0)cnt[2]++;
    cout << ((cnt[0] <= cnt[2])?"Yes":"No") << endl;
    return 0;
} 

Measured memory_bytes: 1792
n = gets.to_i
x = gets.split.map(&:to_f)
y = gets.split.map(&:to_f)
p1, p2, p3 = 0, 0, 0;
max_array = []
n.times do |i|
  q = (x[i] - y[i]).abs
  max_array << q
  p1 += q
  p2 += q ** 2
  p3 += q ** 3
end
puts p1
puts Math.sqrt(p2)
puts p3 ** Rational(1, 3)
puts max_array.max

Measured memory_bytes: 6208
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <string>

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

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

  int menu[5];
  int mod[5];
  int ans = 0;

  int last = 10;
  int id = 0;
  for (int i=0;i<5;i++) {
    cin >> menu[i];
    mod[i] = menu[i] % 10;
    if((last > mod[i]) && (mod[i] != 0)) {
      last = mod[i];
      id = i;
    }
  }
  for (int i=0;i<5;i++) {
    if(mod[i] == 0 || id == i) {
      ans += menu[i];
    }
    else {
      ans += menu[i] + (10 - mod[i]);
    }
  }

  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>

using namespace std;

int main(){

	int height,width,tmp;
	scanf("%d %d",&height,&width);

	int** table = new int*[height+1];
	table[0] = new int[width+1];
	for(int i=0; i < width+1; i++)table[0][i] = 0;

	for(int i=1; i <= height; i++){
		table[i] = new int[width+1];
		table[i][0] = 0;
		for(int k=1; k <= width; k++){
			scanf("%d",&tmp);
			table[i][k] = 1-tmp;
		}
	}

	int max_r = 0;

	for(int i=1; i <= height; i++){
		for(int k=1; k <= width; k++){
			if(table[i][k] != 0){
				table[i][k] = min(table[i-1][k-1],min(table[i][k-1],table[i-1][k]))+1;
				max_r = max(max_r,table[i][k]);
			}
		}
	}

	printf("%d\n",max_r*max_r);

    return 0;
}

Measured memory_bytes: 10416
#include<bits/stdc++.h>
#define pb emplace_back
using namespace std;
using ll = long long;
const int maxn = 300010;
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	map<string, int> mp;
	int n;
	cin >> n;
	while (n--) {
		string a;
		cin >> a;
		++mp[a];
	}
	for (string a : {"AC","WA","TLE","RE"}) 
		cout << a << " x " << mp[a] << '\n';
}



Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define int long long
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 1e5 + 5;
int n, L;
string s[N];
int getGrundy(int x) {
	//Find maximum power of 2 x divides.
	int ans = 1;
//	cout << "x = " << x << "\n";
	while (x % 2 == 0) {
		ans *= 2;
		x /= 2;
	}
	return ans;
}
int grundyXOR = 0;
struct Trie {
	struct Node {
		int child[2], dep = 0;
		bool fin = 0;
	} t[N << 2];
	int sz = -1;
	void fill(int id) {
		memset(t[id].child, -1, sizeof t[id].child);
		t[id].fin = 0;
	}
	void init() {
		fill(++sz);
		t[sz].dep = 0;
	}
	void add(string s) {
		int curNode = 0;
		fw (i, 0, s.length()) {
			if (t[curNode].child[s[i] - '0'] == -1) {
				fill(++sz);
				t[curNode].child[s[i] - '0'] = sz;
				t[sz].dep = t[curNode].dep + 1;
			}
			curNode = t[curNode].child[s[i] - '0'];
		}
		t[curNode].fin = 1;
	}
	void dfs(int u) {
//		cout << "u = " << u << "\n";
		int cntChild = 0;
		if (t[u].child[0] != -1) {
			dfs(t[u].child[0]);
			cntChild++;
		}
		if (t[u].child[1] != -1) {
			dfs(t[u].child[1]);
			cntChild++;
		}
		if (cntChild == 1) {
			grundyXOR ^= getGrundy(L - t[u].dep);
		}
	}
} trie;
signed main() {
	#ifdef BLU
	in("blu.inp");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> L;
	fw (i, 0, n) cin >> s[i];
	trie.init();
	fw (i, 0, n) trie.add(s[i]);
	trie.dfs(0);
	if (grundyXOR != 0) cout << "Alice";
	else cout << "Bob";
	return 0;
}

Measured memory_bytes: 16080
function test(input) {
  arr = input.split('');
  if (arr[3] = '7') {
    arr.splice(3, 1);
    arr.splice(3, 0, '8');
  }
  var str = arr.join('');
  console.log(str);
}
test(require("fs").readFileSync("/dev/stdin", "utf8"));

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

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


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

int main()
{
	int Count = 0;
	int n;
	cin >> n;
	vector<int> S;
	for(int i = 0; i < n; i++){
		int s;
		cin >> s;
		S.push_back(s);
	}
	int q;
	cin >> q;
	for(int i = 0; i < q; i++){
		int t;
		cin >> t;
		vector<int>::iterator it = find(S.begin(), S.end(), t);
		if(it != S.end()){
			Count++;
		}
	}
	cout << Count << endl;
	return 0;
}

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

int main() {
  	int N, K, R, S, P;
  	string T;
  	cin >> N >> K >> R >> S >> P >> T;
  	int count = 0;
  
  	for (int i = 0; i < K; i++){
      	int dp[3][(N + K - i - 1) / K];
      	for (int x = 0; x < 3; x++) for (int y = 0; y < (N + K - i - 1) / K; y++) dp[x][y] = 0; 
      	if (T[i] == 's') dp[0][0] = R;
      	if (T[i] == 'p') dp[1][0] = S;
      	if (T[i] == 'r') dp[2][0] = P;
      	for (int j = 1; j < (N + K - i - 1) / K; j++){
          	dp[0][j] = max(dp[1][j - 1], dp[2][j - 1]);
          	dp[1][j] = max(dp[0][j - 1], dp[2][j - 1]);
          	dp[2][j] = max(dp[0][j - 1], dp[1][j - 1]);
          	if (T[i + j * K] == 's') dp[0][j] += R;
          	if (T[i + j * K] == 'p') dp[1][j] += S;
          	if (T[i + j * K] == 'r') dp[2][j] += P;
        }
      	count += max(max(dp[0][(N + K - i - 1) / K - 1], dp[1][(N + K - i - 1) / K - 1]), dp[2][(N + K - i - 1) / K - 1]);
    }
  
  	cout << count << endl;
}

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

#import fileinput
import math

def main():

    num = int(input())

    inputLine = input()
    array = list(map(int, inputLine.strip().split()))

    mx = max(array)
    mn = min(array)
    sm = sum(array)

    print('%d %d %d' % (mn, mx, sm))

if __name__ == '__main__':
    main()

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

int main() {
    int N;
    cin >> N;
    vector<int> t(N), a(N);
    for (int i = 0; i < N; i++)
        cin >> t[i] >> a[i];

    long long x = 1, y = 1, m;
    for (int i = 0; i < N; i++) {
        m = max((x - 1) / t[i] + 1, (y - 1) / a[i] + 1);
        x = m * t[i];
        y = m * a[i];
    }
    cout << x + y << endl;
    return 0;
}

Measured memory_bytes: 256