akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>

using namespace std;

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

long gcd_mul(long * a, int N){
    long g = a[0];
    for (int i=0; i<N; i++){
        g = gcd(g, a[i]);
    }
    return g;
}

int main(){
   int K;
   cin >> K;
   long ans = 0;
   long s[3];
    for(long a=1; a<=K; a++){
        for(long b=1; b<=K; b++){
            for(long c=1; c<=K; c++){
                s[0] = a; s[1] = b; s[2] = c;
                ans += gcd_mul(s, 3);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
const int N=85,low=81*81;
int a[N][N],b[N][N];
bitset<N*N*2>dp[N][N];
int mx[N][N];
int n,m;
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        	scanf("%d",&a[i][j]);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
        	scanf("%d",&b[i][j]);
    dp[1][1].set(a[1][1]-b[1][1]+low,1);
    dp[1][1].set(b[1][1]-a[1][1]+low,1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
    	{ 
        	if(i==1&&j==1)
				continue;
        	int x=abs(a[i][j]-b[i][j]);
        	dp[i][j]=(dp[i-1][j]<<x)|(dp[i-1][j]>>x)|(dp[i][j-1]<<x)|(dp[i][j-1]>>x);
    	}
    int ans=1e9;
    for(int i=0;i<=low*2;i++)
        if(dp[n][m][i])
            ans=min(ans,abs(i-low));
    printf("%d\n",ans);
}

Measured memory_bytes: 12416
#include<bits/stdc++.h>
using namespace std;
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define pt pop_front
#define pk pop_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
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;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}

inline void solve(void){
  long N,A,B,C,D;
  in(N);
  in(A,B,C,D);
  A--;B--;C--;D--;
  string S;
  in(S);
  long cnt=0;
  up(i,A+1,C-1){
    if(S[i]=='#')cnt++;
    else cnt=0;
    if(cnt==2){
      out("No");
      return;
    }
  }
  cnt=0;
  int cnt2=0;
  bool f=false;
  up(i,B,D){
    if(S[i]=='#')cnt++;
    else cnt=0;
    if(cnt==2){
      out("No");
      return;
    }
    if(S[i]=='.')cnt2++;
    else cnt2=0;
    if(cnt2==3){
      f=true;
    }
  }
  if(C<D){
    out("Yes");
    return;
  }
  if(f||(S[D-1]=='.'&&S[D+1]=='.')||(S[B-1]=='.'&&S[B+1]=='.')){
    out("Yes");
  }else{
    out("No");
  }
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

int main()
{

    int a,b;
    cin>>a>>b;
    
    int sum=0,sub=0,mul=0,ans=0;
    sum=(a+b);
    sub=(a-b);
    mul=(a*b);

    ans=max(sum,max(sub,mul));
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 256
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    S = input().rstrip()
    T = input().rstrip()

    N = len(S)
    res = 0

    for i in range(N):
        if S[i] != T[i]:
            res += 1

    print(res)



main()


Measured memory_bytes: 9336
// AOJ 1054: Distorted Love
// 2017.9.28 bal4u@uu

#include <stdio.h>
#include <string.h>

typedef struct { int x1, y1, x2, y2; char nm[25]; int pag; } BTN;
typedef struct { char nm[25]; int bn; BTN btn[102]; } PAG;
PAG pag[200]; int n;
int buf[2000], size;
int now;

int whatPage(char *nm)
{
	int i;
	for (i = 0; i < n; i++) if (strcmp(nm, pag[i].nm) == 0) return i;
	while (1);   // panic
	return -1;
}

int main()
{
	int h, w, m, i, j, k, x, y;
	PAG *pp;
	char cmd[20];

	while (scanf("%d", &n) && n > 0) {
		scanf("%d%d", &w, &h);
		for (pp = pag, i = 0; i < n; i++, pp++) {
			scanf("%s%d", pp->nm, &k), pp->bn = k;
			for (j = 0; j < k; j++)
				scanf("%d%d%d%d%s", &pp->btn[j].x1, &pp->btn[j].y1,
					  &pp->btn[j].x2, &pp->btn[j].y2, &pp->btn[j].nm);
		}
		for (pp = pag, i = 0; i < n; i++, pp++)
			for (j = 0; j < pp->bn; j++) pp->btn[j].pag = whatPage(pp->btn[j].nm);

		now = 0, buf[0] = 0, size = 1;
		scanf("%d", &m);
		while (m-- > 0) {
			scanf("%s", cmd);
			if (*cmd == 'b') {
				if (now > 0) now--;
			} else if (*cmd == 'f') {
				if (now < size-1) now++;
			} else if (*cmd == 's') puts(pag[buf[now]].nm);
			else {		// click
				scanf("%d%d", &x, &y);
				pp = pag + buf[now];
				for (j = 0; j < pp->bn; j++) {
					if (pp->btn[j].x1 <= x && x <= pp->btn[j].x2 &&
						pp->btn[j].y1 <= y && y <= pp->btn[j].y2) {
						buf[++now] = pp->btn[j].pag;
						size = now+1;
						break;
					}
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1836
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <cstdio>
#include <string>
#include <vector>
#include <random>
#include <chrono>
#include <utility>
#include <numeric>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <sstream>
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <unordered_map>
using namespace std;

void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(bool x) {cerr << (x ? "true" : "false");}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}

template<typename T, typename V> void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i : x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";} void _print() {cerr << "]\n";}
template <typename T, typename... V>void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifdef HOME
#warning CHECK int:ll::INT_MAX:LLONG_MAX
#define maxn 20
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define maxn 2000006
#define gcd __gcd
#define debug(x...)
#endif

#define ff first
#define endl '\n'
#define ss second
#define inf 0x3f3f3f3f
#define MOD 1000000007
#define PI 3.14159265358979323846264338327950L
#define f(i,x,n) for(int i=x;i<=n;i++)
#define fr(i,x,n) for(int i=x;i>=n;i--)
struct _ { ios_base::Init i; _() { ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL); } } _;

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


int main() {

	long long  a, b, k; cin >> a >> b >> k;
	cout << max(0ll, a - k) << " " << max(0ll, b - max(0ll, (k - a)));

	return 0;
}

Measured memory_bytes: 3584
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <numeric>
#include <string>
#include <sstream>
#include <cmath>
#include <cstring>
#include <assert.h>
#include <utility>
#include <tuple>
#include <array>
#include <bitset>
#include <cstdlib>

using int64 = long long;

using namespace std;

#define int long long

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

    int n;
    int64 k;
    cin >> n >> k;

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

    int cur = 0;
    int64 turn = 0;
    vector<int64> timestamp(n, -1);
    while (turn < k && timestamp[cur] < 0) {
        // cerr << "turn: " << turn << " cur: " << cur + 1 << endl;
        timestamp[cur] = turn;
        cur = a[cur];
        turn++;
    }

    int ans = -1;
    if (turn == k) {
        ans = cur + 1;
    } else {
        int64 cycle = turn - timestamp[cur];
        /*
        cerr << "cycle: " << cycle << endl;
        cerr << "cur: " << cur << endl;
        */
        int64 remain = (k - turn) % cycle;
        for (int i = 0; i < remain; i++) {
            cur = a[cur];
            // cerr << "i: " << i << " remain: " << remain << " cur: " << cur + 1 << endl;
        }
        ans = cur + 1;
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 6020
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)




int main() {
	long long N,mx,mn;
	mx = 0;
	mn = 0;
	cin >> N;
	vector<long long> vec(N);
	rep(i, N) {
		cin >> vec.at(i);
		mx = max(mx, vec.at(i));
	}
	rep(i, N) {
		if (abs(mx  -2* vec.at(mn)) >abs( mx  - 2*vec.at(i))) {
			mn = i;
		}
	}
	if (vec.at(mn) ==  mx) {
		vec.at(mn) = 0;
	}
	cout << mx <<" "<< vec.at(mn) << endl;
}



Measured memory_bytes: 1024
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Map<Integer,Integer> map = new HashMap<>();
		for(int i=0;i<n;i++){
			int a = scanner.nextInt();
			if(map.containsKey(a)){
				map.put(a, map.get(a) + 1);
			}else{
				map.put(a, 1);
			}
		}
		int count = 0;
		for(Integer key : map.keySet()){
			if(map.get(key) < key){
				count += map.get(key);
			}else if(map.get(key) > key){
				count += map.get(key) - key;
			}
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 61468
#include <bits/stdc++.h>
#define EPS 1e-9
#define INF 1070000000LL
#define MOD 1000000007LL
#define fir first
#define foreach(it,X) for(auto it=(X).begin();it!=(X).end();it++)
#define numa(x,a) for(auto x: a)
#define ite iterator
#define mp make_pair
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define pb push_back
#define pf push_front
#define sec second
#define sz(x) ((int)(x).size())
#define ALL( c ) (c).begin(), (c).end()
#define gcd(a,b) __gcd(a,b)
#define mem(x,n) memset(x,n,sizeof(x))
#define endl "\n"
using namespace std;
template <int POS, class TUPLE> void deploy(std::ostream &os, const TUPLE &tuple){}
template <int POS, class TUPLE, class H, class ...Ts> void deploy(std::ostream &os, const TUPLE &t){ os << (POS == 0 ? "" : ", ") << get<POS>(t); deploy<POS + 1, TUPLE, Ts...>(os, t); }
template <class T,class U> std::ostream& operator<<(std::ostream &os, std::pair<T,U> &p){ os << "(" << p.first <<", " << p.second <<")";return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::vector<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T> std::ostream& operator<<(std::ostream &os, std::set<T> &v){ int remain = v.size(); os << "{"; for(auto e: v) os << e << (--remain == 0 ? "}" : ", "); return os; }
template <class T, class K> std::ostream& operator<<(std::ostream &os, std::map<T, K> &mp){ int remain = mp.size(); os << "{"; for(auto e: mp) os << "(" << e.first << " -> " << e.second << ")" << (--remain == 0 ? "}" : ", "); return os; }
#define DEBUG1(var0) { std::cerr << (#var0) << "=" << (var0) << endl; }
#define DEBUG2(var0, var1) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG1(var1); }
#define DEBUG3(var0, var1, var2) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG2(var1,var2); }
#define DEBUG4(var0, var1, var2, var3) { std::cerr << (#var0) << "=" << (var0) << ", ";DEBUG3(var1,var2,var3); }
using ll = long long;



int main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  int N;
  cin >> N;
  vector <vector <ll> > groups;
  ll A,B;
  cin >> A >> B;
  vector <ll> cg;
  rep(i,N){
    ll x;
    cin >> x;
    if (sz(cg) == 0) {
      cg.pb(x);
    } else {
      if ((x-cg.back())  * A <= B) {
        cg.pb(x);
      } else {
        groups.pb(cg);
        cg.clear();
        cg.pb(x);
      }
    }
  }
  groups.pb(cg);
  ll ans = (sz(groups)-1) * B;
  for (auto &g : groups) {
    ll cx = g[0];
    for (ll x : g) {
      ans += (x - cx) * A;
      cx = x;
    }
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;
using ll =long long;
typedef pair<int,int> P;
#define SORT(a) sort((a).begin(),(a).end())
#define REV(a) reverse((a).begin(),(a).end())
#define For(i, a, b)    for(int i = (a) ; i < (b) ; ++i)
#define rep(i, n)       For(i, 0, n)
#define debug(x)  cerr << #x << " = " << (x) << endl;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

void coY() {cout <<"Yes"<<endl;}
void coN(){cout <<"No"<<endl;}
 
//Write From this Line

//const ll mod = 1e9+7;
//const ll mod = 998244353;
int main()
{
	ll a, b, c, d;
	cin >> a >> b >> c >> d;

	ll A, B, C;
	A = b / c - (a + (c-1)) / c + 1;
	B = b / d - (a + (d-1)) / d + 1;
	ll k = (c * d) / __gcd(c,d);
	C = b / k - (a + (k-1)) / k + 1;
	ll nene = A + B - C;
	cout << b - a + 1 - nene << endl;
}


Measured memory_bytes: 3640
S = list(input())
ans = 0
for i in range(len(S)):
  if(i != 0):
    if(S[i] == S[i-1]):
      ans += 1
      if(S[i] == '0'):
        S[i] = '1'
      else: 
        S[i] = '0'
print(ans)     

Measured memory_bytes: 3956
N = int(input())
list_V = list(map(int, input().split()))
list_C = list(map(int, input().split()))
ans = 0
for i in range(N):
    currentValue = list_V[i] - list_C[i] 
    if currentValue > 0: 
        ans += currentValue 
print(int(ans))

Measured memory_bytes: 3060
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <bitset>
using namespace std;

#define int long long
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define index(xs, x) (int)(lower_bound(all(xs), x) - xs.begin())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int Q;
int calcX(int A, int B) { return (A+B) / (min(A,B)+1); }
int calcX2(int A, int B) {
  if (B >= A) return calcX(A, B);
  if (B == 0) return INF;
  return calcX(A, B-1);
}

char f(int A, int B, int pos, int x, int y) {
  bool flip = false;
  if (A < B) {
    swap(A, B);
    pos = A+B-1-pos;
    flip = true;
  }
  int X = calcX(A, B);
  char ret = '?';
  if (X == 1) {
    if (pos%2==0) ret = 'A';
    else ret = 'B';
  }
  else {
    if (pos < (X+1)*x) {
      if (pos%(X+1) == X) ret = 'B';
      else ret = 'A';
    }
    else {
      int rest_a = A-x*X-y, rest_b = B-x-y*X;
      //cout<<"x="<<x<<", y="<<y<<": rest_a="<<rest_a<<", rest_b="<<rest_b<<"\n";
      //assert(0<=rest_a && rest_a<=X && 0<=rest_b && rest_b<=X);
      pos -= (X+1)*x;
      if (pos < rest_a) ret = 'A';
      else {
        pos -= rest_a;
        if (pos < rest_b) ret = 'B';
        else {
          pos -= rest_b;
          assert(pos < (X+1)*y);
          if (pos%(X+1) == 0) ret = 'A';
          else ret = 'B';
        }
      }
    }
  }
  if (flip) return ret=='A'?'B':'A';
  else return ret;
}
P maxXY(int A, int B) {
  if (A<B) swap(A, B);
  int X = calcX(A, B);
  if (X==1) return P(-1, -1);
  //cout<<"X="<<X<<"\n";
  int lo = 0, hi = A+B+1;
  while (hi-lo > 1) {
    int mid = (lo+hi)/2;
    if (A-X*mid>=0&&B-mid>=0&&calcX2(B-mid, A-X*mid) <= X) lo = mid;
    //if (B-mid>=0&&min((B-mid)/X, A-X*mid)>=0) lo = mid;
    else hi = mid;
  }
  int x = lo;//, y = min((B-x)/X, A-X*x);
  A -= X*x;
  B -= x;
  lo = 0, hi = A+B+1;
  while (hi-lo > 1) {
    int mid = (lo+hi)/2;
    //if (B-X*mid>=0&&A-mid>=0&&calcX(B-X*mid, A-mid) <= X) lo = mid;
    if (B-X*mid>=0&&A-mid>=0) lo = mid;
    else hi = mid;
  }
  int y = lo;
  A -= y;
  B -= y*X;
  assert(A>=0&&B>=0);
  //cout<<"A="<<A<<", B="<<B<<" x="<<x<<", y="<<y<<"\n";
  return P(x, y);
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> Q;
  rep(i, Q) {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    c--, d--;

    int x, y; tie(x, y) = maxXY(a, b);
    for (int i=c; i<=d; i++) cout << f(a, b, i, x, y);
    cout<<"\n";
  }
  return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	private static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		String s = sc.next();
		boolean[] a = new boolean[26];
		for (int i = 0; i < s.length(); i++) {
			a[s.charAt(i) - 'a'] = true;
		}
		for (int i = 0; i < a.length; i++) {
			if (!a[i]) {
				System.out.println(Character.toChars(i + 'a'));
				return;
			}
		}
		System.out.println("None");
	}
}

Measured memory_bytes: 25072
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    double r = c * Math.PI / 180.0;
    double H = b * Math.sin(r);
    double S = a * H / 2;
    double L = a + b + Math.sqrt(H * H + (a - b * Math.cos(r)) * (a - b * Math.cos(r)));
    System.out.print(S + "\n" + L + "\n" + H + "\n");
  }
}


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

using namespace std;

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

    int zero = count(s.begin(), s.end(), '0');
    int one  = count(s.begin(), s.end(), '1');
    int ans = 2 * min(zero, one);

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 512
#include<stdio.h>

int main(void){
  int X, K;
  int Taka, i;
  
  scanf("%d", &X);
  
  Taka = X;
  K = 1;
  while(Taka % 360 != 0){
    Taka += X;
    K++;
  }
  
  printf("%d", K);
  
  return 0;
}

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

int main(void) {
    int n, odd = 0;
    cin >> n;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        if (a % 2)
            odd++;
    }
    cout << (!(odd % 2) ? "YES" : "NO") << endl;
}


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

using namespace std;



int main(){
    int N;
    cin >> N;
    int a = N/100;
    //int b = (N/10)%10;
    int c = N%10;

    if(a==c){
        puts("Yes");
        return 0;
    }else{
        puts("No");
        return 0;
    }

    return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> bottuns(N+1);
  
  for (int i = 1; i <= N; i++) {
    cin >> bottuns.at(i);
  }

  int id = 1, key = 2, count = 0, tmp;
  bool flag = false;
  
  while (bottuns.at(id) != 0) {
    
    count++;
    
    if (bottuns.at(id) == key) {
      flag = true;
      break;
    }
    
    else {
      tmp = bottuns.at(id);
      bottuns.at(id) = 0;
      id = tmp;
    }
    
  }
  
  if (flag) {
    cout << count << endl;
  }
  else {
    cout << -1 << endl;
  }
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define rep(i, N) for (int i = 0; i < N; i++)
using namespace std;
int main()
{
    int N, T;
    cin >> N >> T;
    vector<long long> t(N);
    rep(i, N)
    {
        cin >> t[i];
    }
    long long sum = 0;
    rep(i, N - 1)
    {
        if (t[i + 1] - t[i] > T)
        {
            sum += ((t[i + 1] - t[i]) - T);
        }
    }
    cout << t[N - 1] + T - sum << endl;
}


Measured memory_bytes: 1792
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define rrep(i, n) for(ll i=(n)-1; i >=0; i--)
#define ALL(v) v.begin(),v.end()
#define rALL(v) v.rbegin(),v.rend()
#define FOR(i, j, k) for(ll i=j;i<k;i++)
#define debug_print(var) cerr << #var << "=" << var <<endl;
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cerr<<v[i]<<" "
#define fi first
#define se second

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<ll, ll> P;
typedef long double ld;
struct edge{ll x, c;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  ll b=mod, u=1, v=0;
  while(b){
    ll t=a/b;
    a-=t*b; swap(a, b);
    u-=t*v; swap(u, v);
  }
  u%=mod;
  if(u<0)u+=mod;
  return u;
}

ll gcd(ll a, ll b){
  ll r = a%b;
  if(r==0) return b;
  else return gcd(b, a%b);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}
/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  set<char> s;
  cin >> S;
  rep(i, S.size()){
    s.insert(S[i]);
  }
  if(s.size()==S.size()){
    cout << "yes"<<endl;
  }else{
    cout << "no"<<endl;
  }
  return 0;
}


Measured memory_bytes: 3612
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

int main(){
    cin>>N;
    vec a(N);
    priority_queue<P, vector<P>, greater<P> > pque;
    mat dist(N,vec(N,INF));
    ll ans = 0;
    rep(i,N){
        dist[i][i] = 0;
        rep(j,N) cin>>a[j];
        reps(j,i+1,N){
            pque.emplace(a[j], i*N + j);
        }
    }
    while(!pque.empty()){
        P p = pque.top();
        pque.pop();
        ll u = p.se/N, v = p.se%N;
        bool new_road = true;
        rep(k,N){
            if(dist[u][k] + dist[k][v] < p.fi){
                cout<<-1<<endl;
                return 0;
            }else if(dist[u][k] + dist[k][v] == p.fi){
                new_road = false;
            }
        }
        if(new_road) ans += p.fi;
        dist[u][v] = dist[v][u] = p.fi;
    }
    cout<<ans<<endl;
    /*rep(i,N){
        rep(j,N) cout<<dist[i][j]<<' ';
        cout<<endl;
    }*/
}

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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

int main(){
	int n;
	int ans;
	int bef;
	cin >> n;

	int b[n-1];
	for(int i=0; i<n-1; i++)	cin >> b[i];

	ans = b[n-2];
	for(int i=n-1; i>1; i--){
		ans+=min(b[i-2],b[i-1]);
	}
	ans+=b[0];

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <climits>
#include <cassert>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <tuple>
#include <list>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <vector>

#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
#define FOR(x,xs) for(auto &x: xs)

using namespace std;
typedef long long ll;
typedef pair<int,int> PI;
typedef pair<ll,ll> PL;
typedef vector<int> VI;
typedef vector<ll> VL;

int main() {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<VL> as(N, VL(N));
  FOR(v,as) {
    FOR(x,v) {
      cin >> x;
    }
  }
  vector<VL> bs = as;
  REP(i,0,N) {
    REP(j,0,N) {
      REP(k,0,N) {
        bs[j][k] = min(bs[j][k], bs[j][i] + bs[i][k]);
      }
    }
  }
  REP(i,0,N) {
    REP(j,0,N) {
      if(as[i][j] > bs[i][j]) {
        cout << -1 << endl;
        return 0;
      }
    }
  }
  ll sum = 0;
  REP(i,0,N) {
    REP(j,i+1,N) {
      bool use = true;
      REP(k,0,N) {
        if(k != i && k != j && bs[i][j] == bs[i][k] + bs[k][j]) {
          use = false;
          break;
        }
      }
      if(use) {
        sum += bs[i][j];
      }
    }
  }
  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using P = pair<int, int>;
using vec = vector<int>;
using mat = vector<vector<int>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"

constexpr int MOD = 1000000007;
const int INF = 1 << 30;

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

    vec p;
    p.push_back(1);
    int i = 6;
    while (i <= n) {
        p.push_back(i);
        i *= 6;
    }
    int j = 9;
    while (j <= n) {
        p.push_back(j);
        j *= 9;
    }

    sort(all(p), greater<int>());

    int v = p.size();

    int dp[110000] = {};
    rep(i, 110000) dp[i] = INF;
    dp[0] = 0;

    rep(i, v) {
        for (int j = 0; j + p[i] <= n; j++) {
            dp[j+p[i]] = min(dp[j+p[i]], dp[j] + 1);
        }
    }

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

Measured memory_bytes: 640
import java.util.Scanner;

public class Main
{
    /*
     * a = bp + q
     * gcd(a, b) = gcd(b, q)
     */
    private static long gcd(long a, long b)
    {
        if (b == 0) {
            return a;
        }
        return gcd(b, a % b);
    }

    private static long lcm(long a, long b)
    {
        return a * b / gcd(a, b);
    }

    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.println(lcm(a, b));
    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP (i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back

using namespace std;

typedef long long ll;

const int INF = 1 << 30;

string cmp(string a, string b) {
  if (sz(a) == sz(b)) return a < b ? b : a;
  return sz(a) < sz(b) ? b : a;
}

int main() {
  int ma[] = {0, 2, 5, 5, 4, 5, 6, 3, 7, 6};

  int N, M;
  cin >> N >> M;

  int A[M];
  string dp[N + 1] = {""};
  rep (i, M) {
    cin >> A[i];
    if (ma[A[i]] <= N) dp[ma[A[i]]] = cmp(dp[ma[A[i]]], string() + (char)('0' + A[i]));
  }

  rep (i, N) {
    if (dp[i] == "") continue;
    rep (j, M) {
      if (i + ma[A[j]] > N) continue;
      dp[i + ma[A[j]]] = cmp(dp[i + ma[A[j]]], dp[i] + (char)('0' + A[j]));
    }
  }

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


Measured memory_bytes: 43648
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cstring>
#include<queue>
#include<tuple>
#include<utility>
#include<map>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include<stdlib.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define range(a) a.begin(), a.end()
#define endl "\n"
#define Yes() cout << "Yes" << endl
#define No() cout << "No" << endl
#define MP make_pair
using Graph = vector<vector<int>>;
const unsigned long long mod = 1e9 + 7;
const long long INF = 1LL<<60;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }

int main(void){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(a==c)
		cout << 0 << endl;
	else
		cout<<1<<endl;

	return 0;
}



Measured memory_bytes: 3628
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.array;
import std.range;
import std.math;

void main(){
	auto z=readln.split.to!(int[]),a=z[0],b=z[1];
	if(a<=8&&b<=8)writeln("Yay!");
	else writeln(":(");
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 100
int main(){
  int n,array[N],min,k  ,l,j,i,count=0,arr[N],temp;
  scanf("%d",&n);
  for(i = 0;i < n;i++){
    scanf("%d",&array[i]);
  }

  for(i=0;i<n;i++){

    k=i;

    for(j=i+1;j<n;j++){

      if(array[j]<array[k]){
	k=j;


      }
    }

    temp=array[i];
    array[i]=array[k];
    array[k  ]=temp;

    if(array[k  ] != array[i])
	count++;
  }

  for(i=0;i<n-1;i++){
    printf("%d ",array[i]);
  }
  printf("%d\n",array[n-1]);
  printf("%d\n",count);

  return 0;
}

Measured memory_bytes: 600
n = int(input())
answer_list = [0 for i in range(n)]
answer_count = [0 for i in range(n)]

for i in range(0,n):
    answer_list[i]=i+1
    while True:
        if answer_list[i]%2==0:
            answer_list[i]=answer_list[i]/2
            answer_count[i] +=1
        else:
            break
max_count = max(answer_count)
print(answer_count.index(max_count)+1)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
#define all(x) (x).begin(), (x).end()
#define endl '\n'
ll inf = LLONG_MAX;
long double pi = M_PI;
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}

//幅優先探索
//全て添字で扱うこと
vector<vll> bfs(ll n, vector<vll> &next, ll start) {
  queue<ll> task;
  task.push(start);

  vector<ll> visit(n, 0);
  visit[start] = 1;

  ll depth = 0;
  vector<vll> ans(2, vll(0));
  ans[depth % 2].push_back(start);
  depth++;

  while (task.size() > 0) {
    ll size = task.size();
    for (int i = 0; i < size; i++) {
      for (int j = 0; j < next[task.front()].size(); j++) {
        if (visit[next[task.front()][j]] == 0) {
          ans[depth % 2].push_back(next[task.front()][j]);
          task.push(next[task.front()][j]);
          visit[next[task.front()][j]] = 1;
        }
      }
      task.pop();
    }
    depth++;
  }
  return ans;
}

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

  vector<vll> next(n, vll(0));
  for (ll i = 0; i < n - 1; i++) {
    ll a, b;
    cin >> a >> b;
    next[a - 1].push_back(b - 1);
    next[b - 1].push_back(a - 1);
  }

  vector<vll> v = bfs(n, next, 0);
  if (v[0].size() > v[1].size()) swap(v[0], v[1]);

  queue<ll> one, two, three;
  for (ll i = 0; i < n; i++) {
    if ((i + 1) % 3 == 1) one.push(i + 1);
    else if ((i + 1) % 3 == 2) two.push(i + 1);
    else three.push(i + 1);
  }

  vll ans(n);
  if (v[0].size() <= three.size()) {
    for (ll i = 0; i < v[0].size(); i++) {
      ans[v[0][i]] = three.front();
      three.pop();
    }
    while (two.size() > 0) {
      one.push(two.front());
      two.pop();
    }
    while (three.size() > 0) {
      one.push(three.front());
      three.pop();
    }
    for (ll i = 0; i < v[1].size(); i++) {
      ans[v[1][i]] = one.front();
      one.pop();
    }
  }
  else {
    while (one.size() < v[0].size()) {
      one.push(three.front());
      three.pop();
    }
    while (two.size() < v[1].size()) {
      two.push(three.front());
      three.pop();
    }
    for (ll i = 0; i < v[0].size(); i++) {
      ans[v[0][i]] = one.front();
      one.pop();
    }
    for (ll i = 0; i < v[1].size(); i++) {
      ans[v[1][i]] = two.front();
      two.pop();
    }
  }

  for (ll i = 0; i < n - 1; i++) cout << ans[i] << " ";
  cout << ans[n - 1] << endl;
}

Measured memory_bytes: 18780
#include<cstdio>
#include<map>
using namespace std;
#define LL long long
map<LL,int>mp;
LL ans,w;
int main(){
	int n,x;scanf("%d",&n);
	for(int i=0;i<n;i++){
		mp[w]++;
		scanf("%d",&x);
		ans+=mp[w+=x];
	}
	printf("%lld",ans);
	return 0;
} 

Measured memory_bytes: 12672
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <vector>
#include <tuple>
#include <stack>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define watch(x) cout << (#x) << " is " << (x) << endl

typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;

int N;
vector<tuple<int, int, int>> triples;

int main()
{
    ios::sync_with_stdio(false);
    cin >> N;
    vi color(N + 1, -1);
    map<ii, int> dist;
    vector<vi> adj_list(N + 1, vector<int>(0));

    int u, v, w;
    rep(i, N - 1)
    {
        cin >> u >> v >> w;
        adj_list[u].push_back(v);
        adj_list[v].push_back(u);
        dist[{u, v}] = w;
        dist[{v, u}] = w;
    }

    stack<int> stk;
    stk.push({1});
    color[1] = 0;

    while (!stk.empty())
    {
        int curr = stk.top();
        stk.pop();
        cerr << "curr: " << curr << endl;
        for (auto &node : adj_list[curr])
        {
            if (color[node] == -1)
            {
                int c = (dist[{curr, node}] + color[curr]) % 2;
                stk.push(node);
                color[node] = c;
            }
        }
    }

    for (int i = 1; i <= N; ++i)
        cout << color[i] << endl;
}


Measured memory_bytes: 18816
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
ll MOD = 1e9 + 7;

template <typename T>
struct BinaryIndexedTree {
	vector<T> data;

	BinaryIndexedTree(int sz) { data.assign(++sz, 0); }

	T sum(int k) {
		T ret = 0;
		for (++k; k > 0; k -= k & -k) ret += data[k];
		return ret;
	}

	void add(int k, T x) {
		for (++k; k < data.size(); k += k & -k) data[k] += x;
	}
};

int main() {
	int N, Q;
	string S;
	cin >> N;
	cin >> S;
	cin >> Q;
	vector<BinaryIndexedTree<int>> bit(26, BinaryIndexedTree<int>(N));
	for (int i = 0; i < N; i++) {
		bit[S[i] - 'a'].add(i, 1);
	}
	for (int i = 0; i < Q; i++) {
		int type;
		cin >> type;
		if (type == 1) {
			int x;
			char c;
			cin >> x >> c;
			x--;
			bit[S[x] - 'a'].add(x, -1);
			bit[c - 'a'].add(x, 1);
			S[x] = c;
		}
		else {
			int l, r;
			cin >> l >> r;
			l--;
			r--;
			int ans = 0;
			for (int j = 0; j < 26; j++) {
				int tmp = bit[j].sum(r);
				if (l > 0) tmp -= bit[j].sum(l - 1);
				if (tmp > 0) ans++;
			}
			cout << ans << endl;
		}
	}
}

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

int main() {
  int n, m;
  cin >> n >> m;
  priority_queue<int> a;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    a.push(x);
  }
  for (int i = 0; i < m; ++i) {
    int x = a.top();
    a.pop();
    a.push(x / 2);
  }

  long long ans = 0;
  for (int i = 0; i < n; ++i) {
    ans += a.top();
    a.pop();
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 892
#include<iostream>
using namespace std;
 
int main(){
  int A,B;
  int ans = 0;
  cin >> A>> B;
  
  if(A>B){
    ans+=A;
    A--;
  }else{
    ans+=B;
    B--;
  }
  
  if(A>B){
    ans+=A;
    A--;
  }else{
    ans+=B;
    B--;
  }
  
  cout << ans << endl;
  
  return 0;
  
}

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

int main() {
	int a1, a2, a3;
	cin >> a1 >> a2 >> a3;

	if (a1 + a2 + a3 >= 22) cout << "bust" << endl;
	else cout << "win" << endl;

 	return 0;
 }

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

using ll = long long;

int main() {
    int n; cin >> n;
    int ans = 1e9;
    auto calc = [] (int n) {
        int res = 0;
        while(n) {
            res += n % 10;
            n /= 10;
        }
        return res;
    };
    for(int i = 1; i <= n / 2; ++i) {
        int j = n - i;
        ans = min(ans, calc(i) + calc(j));
    }
    cout << ans << endl;
}


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

int main() {
    int x1, y1, x2, y2, x3, y3, x4, y4;
    cin >> x1 >> y1 >> x2 >> y2;

    int x2x1 = x2 - x1;
    int y2y1 = y2 - y1;
    x3 = x2 - y2y1;
    y3 = y2 + x2x1;
    x4 = x1 - y2y1;
    y4 = y1 + x2x1;
    cout << x3 << ' ' << y3 << ' ' << x4 << ' ' << y4 << endl;

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace program{

	class workspace{

		static void Main(){
			string[] strNT = (Console.ReadLine().Split());
			string[] str = (Console.ReadLine().Split());

			int N = int.Parse(strNT[0]);
			int T = int.Parse(strNT[1]);

			List<int> t = new List<int>();
			for(int i = 0; i < str.Length; i++){
				t.Add(int.Parse(str[i]));
			}

			int time = 0;
			time = t.Count*T;	//oyuha t_n + T byougo made deru
			for(int i = 0; i < t.Count-1; i++){
				if(t[i + 1] - t[i] < T){
					time = time - T + t[i+1] - t[i];
				}
			}

			Console.WriteLine("{0}",time);

		}

	}

}

Measured memory_bytes: 28256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<iomanip>
#include<cstring>
#include<string>
#include<cmath>
#include<map>
#include<vector>
#include<queue>
#include<set>
#define ll long long
using namespace std;


int main()
{
    //freopen(".in","r",stdin);
    //freopen(".out","w",stdout);
	string s,t;
	cin>>s>>t;
	int lens,lent;
	lens=s.length();
	lent=t.length();
	int flag=1;
	for(int i=0;i<lens;i++){
		if(s[i]!=t[i]){
			flag=0;break;
		}
	}
	if(flag)cout<<"Yes";
	else cout<<"No";
    return 0;
}



Measured memory_bytes: 3620
import std.stdio, std.string, std.conv;
import std.range, std.algorithm, std.array, std.typecons, std.container;
import std.math, std.numeric, std.random, core.bitop;

enum inf = 1_001_001_001;
enum inf6 = 1_001_001_001_001_001_001L;
enum mod = 1_000_000_007L;

alias Ope = Tuple!(int, "y1", int, "x1", int, "y2", int, "x2");

void main() {
    int n, x;
    scan(n, x);
    auto xs = readln.split.to!(int[]);
    xs ~= x;
    xs.sort();
    int[] ds;
    foreach (i ; 0 .. n) {
        ds ~= xs[i + 1] - xs[i];
    }
    int ans;
    foreach (d ; ds) {
        ans = gcd(ans, d);
    }
    writeln(ans);
}





void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}


Measured memory_bytes: 4404
#include <iostream>

using namespace std;

int main(void){
	int n;

	cin >> n;
	
	int prime[55556] = {};
	
		

	for (int i = 2; i < 55556; i++){
		prime[i] = 1;
	}

	for (long long int i = 2; i < 55556; i++){
		if (prime[i] == 0)
			continue;
		for (long long int j = i * i; j < 55556; j += i){
			prime[j] = 0;
		}
	}

	int num = 0;
	for (int i = 2; i < 55556; i++){
		if (prime[i] == 1 && i % 5 == 1){
			cout << i << " ";
			num++;
		}
		if (num == n)
			break;
		
	}
	cout << endl;

			
}

Measured memory_bytes: 512
#include "bits/stdc++.h"

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

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

void Main() {
  int n, l;
  cin >> n >> l;
  int ans = 0;
  rep(i, n) ans += l + i;
  int mn = 1000;
  rep(i, n) if (abs(mn) > abs(l+i)) mn = l+i;
  ans -= mn;
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
  using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define endl "\n"
  #define int long long
  #define all(v) v.begin(),v.end()
  #define f first
  #define s second
  #define PB push_back
  #define MP make_pair
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  #define MOD 998244353
  #define N 1000001
  

  #define eps 1e-6

  const int INF = 2*1e18 + 1;
bool check(int n,int x,int arr[],int k)
{

  // finds the number of combinations less than x
  int ans = 0;

  for(int i = 0;i <= n-1; i++)
  {
    if(arr[i] > 0)
    {
      int low = -1, high = n;
      while(low + 1< high)
      {
        int mid = (high+low)/2;
        if(arr[i] * arr[mid] <= x)
        {
          low = mid;
        }
        else
        {
          high = mid;
        }
      }

      ans += high;
    }
    else
    {
        int low = -1, high = n;
      while(low + 1< high)
      {
        int mid = (high+low)/2;

        if(arr[i] * arr[mid] <= x)
        {
          high = mid;
        }
        else
        {
          low = mid;
        }
      }

      ans += (n-high);
    }
  if(arr[i]*arr[i] <= x) ans --;
  }

  ans/=2;

  if(ans < k)return 0;
  else return 1;

}

bool check1(int x)
{
  return x >= 55;
}
int binarysearch(int arr[],int n,int k)
{
  int low = -INF,high = INF;

  while(low <= high)
  {
    int mid = low + (high - low)/2;
    if(check(n,mid,arr,k))
    {
      high = mid - 1;
    }
    else
    {
      low = mid + 1;
    }
  }
  return low ;
}
int32_t main()
{




    int n,k;
    cin >> n >> k;

    int arr[n];

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

    sort(arr ,arr+n);

    cout << binarysearch(arr,n,k) << endl;

    return 0;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); i++)
#define FOR(i, a, b) for(ll i = a; i <= (ll)(b); i++)
#define INF 1e9
#define endl '\n'

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

    int N, M;
    cin >> N >> M;

    char AA[N][N];
    char BB[M][M];

    REP(y, N) {
        REP(x, N) { cin >> AA[y][x]; }
    }

    REP(y, M) {
        REP(x, M) { cin >> BB[y][x]; }
    }

    REP(x0, N - M + 1) {
        REP(y0, N - M + 1) {
            bool tmp = true;
            REP(x, M) {
                REP(y, M) {
                    if(AA[y0 + y][x0 + x] != BB[y][x]) {
                        tmp = false;
                    }
                }
            }
            if(tmp) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
 
 
using namespace std;
 
//conversion
//------------------------------------------
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();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
 
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))
 
//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//pair sort
bool compare_by_b(pair<LL, LL> a, pair<LL, LL> b) {
    if(a.second != b.second) return a.second < b.second;
    else return a.first < b.first;
}
std::uint32_t euclidean_gcd(std::uint32_t a, std::uint32_t b){return b != 0 ? euclidean_gcd(b, a % b) : a;}


void solve(long long N, long long K, std::vector<long long> t, std::vector<long long> d){
    
}

bool check(string str){
    char c = str[0];
    REP(i, str.size())if(c!=str[i])return false;
    return true;
}

int main(){
    string s;
    cin>>s;
    string chars = s;
    int ans = 500;
    if(check(s)){
        cout<<0<<endl;
        return 0;
    }
    REP(i, chars.size()){ 
        string str = s;
        int cnt =0;
        int len = s.size();
        while(len!=0){
            string nextstr="";
            REP(j, str.size()-1){
                if(str[j]==chars[i] || str[j+1]==chars[i])nextstr+=chars[i];
                else nextstr+=str[j];
            }
            cnt++;str=nextstr;
            debug(nextstr);
            if(check(nextstr))break;
        }
        ans=min(ans, cnt);
    }
    cout<<ans<<endl;
    return 0;
}

/*
123456


jackal
aacaa


whbrjpjyhsrywlqjxdbrbaomnw 26 (=13*2)

*/

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
int main(){
    ll n ,cont =0 ;
cin >>n ;
string s ;
cin >>s ;
for(int i=0 ; i<n ;i++)
{
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C'){cont +=1 ;}
}
cout <<cont <<endl;
    return 0 ;
}


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

using namespace std;

int main(void){

	int n;
	string s, t;
	string output;

	cin >> n >> s >> t;

	for(int i = 0; i < n; i++){

			output += s[i];
			output += t[i];

	}

	cout << output << endl;

return 0;
}

Measured memory_bytes: 256