akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		
		if(A==1){
			System.out.println("YES");
		} else {
			boolean flag = false;
			for(int i=1; i<102; i++){
				if((B*i+C)%A == 0){
					System.out.println("YES");
					flag = true;
					break;
				}
			}
			if(!flag){
				System.out.println("NO");
			}
		}
		
		
	}

}

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

int main()
{
  int s, sec=0, min=0, hour=0;
  cin >> s;
  while (s > 0) {
    s--;
    sec++;
    if (sec == 60) {
      min++;
      sec=0;
    }
    if (min == 60) {
      hour++;
      min=0;
    }
  }
  cout << hour << ':' << min << ':' << sec << endl;
}



Measured memory_bytes: 3128
def f(a,n):
	for j in range(n):
		aa = ""
		s = a[0]
		c = 1
		for i in range(1,len(a)):
			if a[i] == s:
				c += 1
			else:
				aa += str(c) + s
				s = a[i]
				c = 1
		a = aa + str(c) + s
	return a
	
while 1:
	n = input()
	if n == 0: break
	a = raw_input()
	print f(a,n)

Measured memory_bytes: 4988
#include<iostream>
#include<utility>
#include<stack>
#include<algorithm>
using namespace std;
typedef pair<int,int> rectangle;
int h,w,max_measure,c[1400][1400];
int hist[1400][1400];


void gethist(){
    for(int j=0;j<w;++j){
        for(int i=0;i<h;++i){
            if(c[i][j]==0 && i>0){
                hist[i][j]=1+hist[i-1][j];
            }
            if(i==0){
                hist[i][j]=1-c[i][j];
            }
        }
    }
}

int dp_along_row(int size,int buffer[]){
    
    stack<rectangle> S;
    int max_v=0;
    buffer[size]=0; //likely to cause seg fault

    for(int i=0;i<=size;++i){
        
        rectangle rect;
        rect.first=buffer[i];
        rect.second=i;

        if(S.empty()){
            S.push(rect);
        }
        else{
            if(S.top().first<rect.first){
                S.push(rect);
            }
            else if(S.top().first>rect.first){
                
                int target=i;
                
                while(!S.empty() && S.top().first>=rect.first){
                    rectangle pre=S.top(); S.pop();
                    int area=pre.first*(i-pre.second);
                    max_v=max(max_v,area);
                    target=pre.second;
                }
                
                rect.second=target;
                S.push(rect);
            }
        }
    }

    return max_v;
}

int advanced_dp(){

    gethist();

    int max_v=0;
    for(int i=0;i<h;++i){
        max_v=max(max_v,dp_along_row(w,hist[i]));
    }
    return max_v;
}

int main(){
    cin>>h>>w;
    for(int i=0;i<h;++i){
        for(int j=0;j<w;++j){
            cin>>c[i][j];
        }
    }

    cout<<advanced_dp()<<endl;

}


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

int main(void){
  vector<int> data;
  int k;
  bool flag = false;
  data = vector<int>(5);

  for(int i=0;i<5;i++){
    cin >> data[i];
  }
  cin >> k;

  for(int i=1;i<5;i++){
    if(data[i]-data[0] > k){
      flag = true;
      break;
    }
  }
  if(flag){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }

  return 0;
}


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

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

#define MOD 1000000007

using namespace std;

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

	j=1;
	ans=0;
	for( i=0; i<n; i++ ){
		if( a[i] != j )	ans++;
		else			j++;
	}
	if( ans == n )	ans = -1;

	cout << ans;

	return 0;
}


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

#define pb   push_back
#define endl "\n"
#define ll   long long

#define W(t)            while(t--)
#define clr(a)          memset(a,0,sizeof(a))
#define rep(i,a,b)      for(i = a; i < b; i++)
#define IOS ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
#define mod 1000000007

int main()
{
	IOS
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ll ans = 0, n, i, j;
	cin >> n;

	ll a[n], pre_sum[n + 1] = {};

	rep(i, 0, n) {
		cin >> a[i];
		if (i == 0)
			pre_sum[i] = a[i];
		else
			pre_sum[i] = pre_sum[i - 1] + a[i];
	}
	rep(i, 0, n)
	{
		ll tmp = (pre_sum[n - 1] - pre_sum[i])%mod * a[i]%mod;
		tmp %= mod;
		ans += tmp;
		ans %= mod;
	}
	cout << ans << endl;



	return 0;
}

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

using namespace std;

int main() {
  int64_t A;
  string B;
  cin >> A >> B;
  int64_t u = (int64_t)stoi(B);
  int64_t l = 0LL;
  size_t i = B.find('.');
  if (string::npos != i) {
    l = (int64_t)stoi(B.substr(i + 1));
  }
  int64_t result = A * u + (A * l / 100LL);
  cout << result << endl;
  return 0;
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define pb push_back
#define srt(a) sort(a.begin(),a.end())
#define rsrt(a) sort(a.rbegin(),a.rend())
#define lb(a,b) lower_bound(a.begin(),a.end(),b)
#define ub(a,b) upper_bound(a.begin(),a.end(),b)
#define MOD ((int)(1000000007 ))
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
#define float long double
#define bigint __int128
#define sqrt sqrtl
#define cbrt cbrtl
#define endl '\n'
typedef vector<int> vi;
typedef vector<float> vf;
typedef pair<float,int> fi;
typedef pair<int,int> ii;
typedef pair<float,float> ff;
typedef vector<ff> vff;
typedef vector<ii> vii;
typedef vector<fi> vfi;
typedef vector<vi> vvi;
typedef vector<vf> vvf;
typedef vector<vii> vvii;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef priority_queue<int> pqi;
typedef priority_queue<ii> pqii;
typedef priority_queue<fi> pqfi;
typedef priority_queue <int, vector<int>, greater<int> > rpqi; 
typedef priority_queue <ii, vector<ii>, greater<ii> > rpqii; 
typedef priority_queue <fi, vector<fi>, greater<fi> > rpqfi;


vector<int> func(int n)
{
	vector<int>next(n);
	for(int i=0;i<n;i++)
	next[i]=(i+1)%n;
	
	vector<int>ans;
	
	int i=0;
	while( next[ next[i] ] != i )
	{
		int a=next[i];
		int b=next[ next[a] ];
		next[ next[a] ]=-1;
		next[a]=b;
		i=next[i];
	}
	for(int i=0;i<n;i++)
	{
		if(next[i]!=-1)
		{
			ans.push_back(i+1);
		}	
	}
	return ans;
}
int32_t main()
{
	IOS
	int n;cin>>n;
	vector<int>v(n);
	for(int i=0;i<n;i++)
	cin>>v[i];
	srt(v);
	
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int t=upper_bound(v.begin()+i,v.begin()+j,v[i]+v[j])-upper_bound(v.begin()+i,v.begin()+j,v[j]-v[i]);
			cnt+=min(j-i-1,t);
		}
	}
	cout<<cnt<<endl;
	
}
	
	
	
	
	
	
	
	

 


Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse2")

    /*
    ||||||||||||||||||||||||||||||||||||||||||||||||
       |      |||         |      ||||    ||||  |   |
      | |     |   |      | |     |   |  |      |   |
     |   |    |    |    |   |    |   |  |      |   |
    |||||||   |    |   |||||||   |||     |||   |||||
    |     |   |   |    |     |   | |        |  |   |
    |     |   |||      |     |   |  ||  ||||   |   |
    ||||||||||||||||||||||||||||||||||||||||||||||||

    */
    using namespace std;
    //#include "testlib.h"
    #define ff first
    #define ss second
    #define mp make_pair
    #define all(v) v.begin(),v.end()
    #define int long long
    #define ll long long
    #define M 1000000007
    #define inputarr(a,n) for(int i=0;i<n;++i) cin>>a[i]
    #define GCD(m,n) __gcd(m,n)
    #define LCM(m,n) m*(n/GCD(m,n))
    #define mii  map<ll ,ll >
    #define msi  map<string,ll >
    #define mis  map<ll int, string>
    #define rep(a,b)    for(ll i=a;i<b;i++)
    #define rep0(n)    for(ll i=0;i<n;i++)
    #define repi(i,a,b) for(ll i=a;i<b;i++)
    #define pb push_back
    #define vi vector<ll>
    #define mp make_pair
    #define vs vector<string>
    #define ppb pop_back
    #define endl '\n'
    #define asdf ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #define r0 return 0;
    #define FORD(i, a, b) for (int i = (int) (a); i >= (int) (b); --i)
    #define FORE(it, c) for (__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++it)
    #define inputoutput freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
    #define input freopen("input.txt", "r", stdin);
    #define Set(a, s) 4(a, s, sizeof (a))
    #define FOR repi
    #define pii pair<int,int>
    //#define float long double
    ll max(ll a, ll b) { return (a > b)? a : b;}
    int min(int a, int b) { return (a < b)? a : b;}


     int solve()
     {
     	int n;
     	cin>>n;
     	vi a(n+1),b(n);
     	inputarr(a,n+1);
     	inputarr(b,n);
        int ans=0;
        rep0(n){
        	ans+=min(a[i],b[i]);
        	b[i]-=min(a[i],b[i]);
               	ans+=min(a[i+1],b[i]);
        	a[i+1]-=min(a[i+1],b[i]);
        	//cout<<ans<<" ";
        }
        cout<<ans;
     }
    signed main()
    {   
        asdf
        int t=1;
        //cin>>t;
        while(t--)
        {
            solve();
        }     
        
}

Measured memory_bytes: 1792
a, b, c, x = (int(input()) for _ in range(4))
cnt = 0
for i in range(min(a, x // 500) + 1):
    for j in range(min(b, (x - 500 * i) // 100) + 1):
        if (x - 500 * i - 100 * j) // 50 <= c:
            cnt += 1
print(cnt)

Measured memory_bytes: 9184
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<map>
using namespace std;
char a[105][105],b[105][105];
int main(){
    int m,n;
    scanf("%d %d",&m,&n);
    for(int i = 1; i <= m; i++){
        for(int j = 1; j <= n; j++){
            scanf(" %c",&a[i][j]);
        }
    }
    for(int i = 1; i <= m + 2; i++){
        for(int j = 1; j <= n + 2; j++){
                b[i][j]='#';
        }
    }
    for(int i = 2; i <= m + 1; i++){
        for(int j = 2; j <= n + 1; j++){
                b[i][j] = a[i - 1][j - 1];
        }
    }
    for(int i = 1; i <= m + 2; i++){
        for(int j = 1;j <= n + 2; j++){
            printf("%c",b[i][j]);
        }
        if(i != m + 2)
        printf("\n");
    }
    return 0;
}


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

int main(){
  double a[1010];
  int i,n;
  double m,sum,siguma,A;
  
while(1){
  siguma =0;
  sum = 0;
scanf("%d",&n);
  if(n == 0) break;
  for(i=0;i<n;i++){
  	scanf("%lf",&a[i]);
  }
  for(i=0;i<n;i++){
  	sum +=a[i];
  }
  m =sum/n;
  
  for(i=0;i<n;i++){
   siguma += (a[i]-m)*(a[i]-m);
  }
  A = sqrt(siguma/n);
  
  printf("%f\n",A);
  
}
  return 0;
  
}



Measured memory_bytes: 2108
#include <stdio.h>

int max_fixed_price(int, int, int);

int main(void) {
  int x,y,s; // 変更前税率（％）、変更後税率（％）、税率変更前税込価格
  int t; // 税率変更前の片方の税込価格 
  int max; // 税率変更後の最大税込価格
  int r1, r2; 
  
  while (scanf("%d %d %d", &x, &y, &s) != EOF) { // データを一行読む
    if (0==x && 0==y && 0==s) // 入力がすべて 0 なら終了
      break;

    /* 税率変更前の税込価格の組み合わせを総当りで調べ、税率変更後の税込み最大価格を調べる */
    max = 0; // 税率変更後の最大価格を暫定0にしておく（すぐ変更される）
    for (t=1; t<=s/2; t++) { // tとs-tが税率変更前の税込価格の組み合わせ 半分の組み合わせを調べれば後は同じ
      /* それぞれの価格の税込み変更後の最大価格を求める */
      r1 = max_fixed_price(x,y,t);
      r2 = max_fixed_price(x,y,s-t);

      // もしも、tかs-tが税込価格としてとりえない値だったら
      if (r1 < 0 || r2 < 0)
	continue; // 次の組み合わせを調べる

      // 暫定最大価格なら更新
      if (max < r1+r2)
	max = r1+r2;
    }

    printf("%d\n", max); // 最大の税込価格を表示
  }
}

/* 税率変更後の税込み最大価格を調べる */
int max_fixed_price(int x, int y, int s) { // 変更前税率、変更後税率、税込み価格
  int p; // 税率変更前税抜き価格

  /* 税抜き価格として最大のものを求める */
  p = (int)(s*100.0/(100.0+x)); // 税抜き価格の下界
  while ((double)(p+1) < (s+1)*100.0/(100.0+x)) // 与えられた税込価格を越えないまで税抜き価格をインクリメント
    p++;

  /* 税抜き価格に税を含めたとき与えられた税込み価格と一致しなかったらエラー */
  if ((int)(p*(100.0+x)/100.0) != s)
    return -1;

  return (int)(p*(100.0+y)/100.0); // 最大の税込価格を返す
}

    

Measured memory_bytes: 1028
#include <iostream>

using namespace std;

int main()	{
  char a[55][55];
  char b[55][55];
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      cin >> a[i][j];
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      cin >> b[i][j];
  bool found = false;
  for (int i = 0; i <= n - m; i++)	{
    for (int j = 0; j <= n - m; j++)	{
      for (int x = i; x < i + m; x++)	{
        for (int y = j; y < j + m; y++)	{
          if (a[x][y] == b[x - i][y - j])
            found = true;
          else	{
            found = false;
            break;
          }
        }
        if (!found) break;
      }
      if (found == true)	{
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  cout << "No" << endl;
  return 0;
}



Measured memory_bytes: 3568
#include <stdio.h>

int main(void)
{
	int		n = 0;
	int		ii;
	int		n1;
	int		n2;
	int		a;
	int		b;
	
	while(1){
		scanf("%d", &n);
		if(n == 0){
			break;
		}
		a = 0;
		b = 0;
		for(ii = 0; ii < n; ii++){
			scanf("%d %d", &n1, &n2);
			if(n1 == n2){
				a += n1;
				b += n2;
			}else if(n1 > n2){
				a += n1 + n2;
			}else if(n1 < n2){
				b += n1 + n2;
			}
		}
		printf("%d %d\n", a, b);
	}
	
	return	0;
}


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

int n, res = 0, last = 0;

int main(){
	cin >> n;
	for (int i=1; i<=n; ++i){
		int tmp;
		cin >> tmp;
		if (tmp == last){
			res ++;
			last = 0;
		}
		else last = tmp;
	}
	cout << res;	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
typedef long long LL;
const int sz=2e5;
int A[sz]={0},town[sz]={0};
inline LL IN(void)
{
  LL x=0;int f=1;char c=getchar();
  while((c<'0'||c>'9')&&c!='-')c=getchar();
  if(c=='-')f=-f,c=getchar();
  while(c>='0'&&c<='9')x=x*10+c-48,c=getchar();
  return f*x;
}
int main(void)
{
  int N,i,j,p;LL K;
  N=IN(),K=IN();
  for(i=0;i<N;i++)A[i]=IN(),town[i]=-1;
  for(i=0,j=0;;i=A[i]-1,j++)if(town[i]<0)town[i]=j;else break;
  for(p=0;K>0;p=A[p]-1,K--)if(i==p){K%=town[i]-j;if(!K)break;}
  return printf("%d\n",p+1),0;
}

Measured memory_bytes: 3164
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;



int main(){
    cout << fixed << setprecision(7);
    int a,b,x; cin >> a >> b >> x;
    double ans = 0.0;
    if(x >= a*a*b/2.0){
        ans = atan((double)(2*a*a*b-2*x)/(a*a*a));
        ans *= 180/3.14159265;
    }
    else{
        ans = atan((double)a*b*b/(2*x));
        ans *= 180/3.14159265;
    }
    cout << ans << endl;
    
}


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

using namespace std;

int main() {
    unsigned int n, m;
    cin >> n >> m;

    vector<int> vtl(m), vtr(m);
    for (int i = 0; i < m; ++i) {
        cin >> vtl[i] >> vtr[i];
    }

    int ans = *min_element(vtr.begin(), vtr.end()) -
              *max_element(vtl.begin(), vtl.end()) + 1;
    ans = max(ans, 0);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <stdio.h>

int main(void) {
  int i, j, n, sum[100010], a, b, now = 0, ans = 0;
  for(i = 0; i < 100010; ++i) sum[i] = 0;
  scanf("%d", &n);
  for(i = 0; i < n; ++i) {
    scanf("%d%d", &a, &b);
    sum[a]++;
    sum[b + 1]--;
  }
  /*for(i = 0; i < 10; ++i) printf("%d ", sum[i]);
  printf("\n");*/
  for(i = 1; i < 100010; ++i) {
    now += sum[i];
    if(now + 1 >= i) ans = i - 1;
  }
  if(ans < 0) ans = 0;
  printf("%d\n", ans);
  return 0;
}


Measured memory_bytes: 3144
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const long long infll = (long long) 1.01e18;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

#ifdef DEBUG
mt19937 mrand(300); 
#else
mt19937 mrand(chrono::steady_clock::now().time_since_epoch().count()); 
#endif

int rnd(int x) {
  return mrand() % x;
}

const int mod = (int) 1e9 + 7;

int mul(int a, int b) {
  return (long long) a * b % mod;
}

void add(int &a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}

const int maxm = (int) 1e4 + 5;
int f[maxm], inv[maxm], finv[maxm];

void precalc() {
  f[0] = 1;
  for (int i = 1; i < maxm; i++) {
    f[i] = mul(f[i - 1], i);
  }
  inv[1] = 1;
  for (int i = 2; i < maxm; i++) {
    inv[i] = (mod - (long long) (mod / i) * inv[mod % i] % mod) % mod;
  }
  finv[0] = 1;
  for (int i = 1; i < maxm; i++) {
    finv[i] = mul(finv[i - 1], inv[i]);
  }
}

int c(int n, int k) {
  return mul(f[n], mul(finv[n - k], finv[k]));
}

const int maxn = (int) 2e5 + 5;
int n;
int a[maxn], b[maxn];

bool read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &a[i], &b[i]);
    b[i] += a[i];
  }
  return true;
}

const int X = 2005, maxx = 2 * X + 1;
int s[maxx][maxx];

void solve() {
  memset(s, 0, sizeof(s));
  for (int i = 0; i < n; i++) {
    int l = X + a[i] - b[i], r = X + a[i];
    add(s[r - l][l], 1);
  }
  for (int i = maxx - 2; i >= 0; i--) {
    for (int j = 0; j < maxx; j++) {
      add(s[i][j], s[i + 1][j]);
      if (j) {
        add(s[i][j], s[i + 1][j - 1]);
      }
    }
  }
  int res = 0;
  for (int i = -X; i < X; i++) {
    add(res, mul(s[0][X + i], s[0][X - i]));
  }
  for (int i = 0; i < n; i++) {
    add(res, mod - c(2 * b[i], 2 * a[i]));
  }
  res = mul(res, (mod + 1) / 2);
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef DEBUG
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (read()) {
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 64768
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// #include<deque>
// #include<multiset>
// #include<bitset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int k;
  cin >> k;
  if(k == 1) {
    cout << "1\n1\n";
    return 0;
  }
  int n = 2 * ((k + 3) / 4);
  cout << n << "\n";
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      int v = i & 1 ? (i + j) % n : n + (i + j) % n;
      if(v >= k) v -= n;
      cout << v + 1 << (j == n - 1 ? "" : " ");
    }
    cout << "\n";
  }
  return 0;
}


Measured memory_bytes: 1152
import sys

stdin = sys.stdin

ri = lambda: int(rs())
rl = lambda: list(map(int, stdin.readline().split()))  # applies to only numbers
rs = lambda: stdin.readline().rstrip()  # ignores trailing space

A = ri()
B = ri()
for i in [1, 2, 3]:
    if i != A and i != B:
        answer = i
print(answer)

Measured memory_bytes: 3060
#include<stdio.h>


int comb(int,int);
  int n;
  int A[2000];
int main()
{

  int q;
  int mi[2000];
  int i,search;
  

  scanf("%d",&n);
  for(i=0;i<n;i++)
    {
      scanf("%d",&A[i]);
    }
  scanf("%d",&q);
  for(i=0;i<q;i++)
    {
      scanf("%d",&mi[i]);
      search = comb(0,mi[i]);
      if(search==1) printf("yes\n");
      else if(search==0) printf("no\n");
    }
  return 0;
}


  int comb(int i, int m)
  {
    if(m==0) return 1; 
    if(i>=n) return 0;
    int res=comb(i+1, m) || comb(i+1, m-A[i]);
    return res;
  }

Measured memory_bytes: 588
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

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

  int sum = 0;
  for (int i = 1; i < n+1; i++) {
    sum += l+i-1;
  }
  int mindiffabs = 1000000000;
  int mindiff = 1000000000;
  for (int i = 1; i < n+1; i++) {
    int diff = - (l+i-1);
    if(mindiffabs > abs(diff)){
      mindiffabs = abs(diff);
      mindiff = diff;
    }
  }

  cout << sum + mindiff << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n,a[4][100005],res,t[5],ma[5];
int f[4][100005];

main()
{
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[1][i]>>a[2][i]>>a[3][i];
    for (long long i=1;i<=n;i++)
    {
        f[3][i]=max(f[2][i-1]+a[3][i],f[1][i-1]+a[3][i]);
        f[2][i]=max(f[3][i-1]+a[2][i],f[1][i-1]+a[2][i]);
        f[1][i]=max(f[3][i-1]+a[1][i],f[2][i-1]+a[1][i]);
    }
    cout<<max(f[3][n],max(f[2][n],f[1][n]));
}


Measured memory_bytes: 2560
#pragma region header
#include <bits/stdc++.h>
using namespace std;

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	string s;
	cin >> s;
	print(s.substr(0, 5) + " " + s.substr(6, 7) + " " + s.substr(14, 5));
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 256
n, m, l = gets.split.map(&:to_i)

a = n.times.map { gets.split.map(&:to_i) }
b = m.times.map { gets.split.map(&:to_i) }

a.each do |ai|
  row = b.transpose.map do |bj|
    ai.zip(bj).map {|i, j| i * j }.inject(:+)
  end
  puts row.join(' ')
end

Measured memory_bytes: 6420
#include<iostream>
using namespace std;
int main(){

  int n,q,wan,player[50],j;

  while(1){

    cin >>n>>q;

    if(n == 0 && q == 0)break;

    for(int i=0 ; i < n ; i++)player[i]=0;
    wan=q;
    j=0;
    
    while(1){
      
      if(wan != 0){
	player[j]++;
	wan--;
	if(wan == 0 && player[j] == q){
	  cout <<j<<endl; 
	  break;
	}
      }else{
	wan=player[j];
	player[j]=0;
      }   
      j++;
      if(j >= n)j=0;
    }
    
  }
  
  return 0;
}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
int main(void){
    int n,h; cin>>n>>h;
    int h2 = h;
    vector <pair<int,int>> k1(n),k2(n);
    for(int i=0;i<n;i++){
        int a,b; cin>>a>>b;
        k1[i]={a,b};
        k2[i]={b,a};
    }
    //強い刀で殴りまくる
    sort(k1.begin(),k1.end()); reverse(k1.begin(),k1.end());
    int saitsuyo = k1[0].F;
    int ans = h/saitsuyo +1;
    //saitsuyoよりも威力の高い刀は投げる
    sort(k2.begin(),k2.end());
    vector <int> nage;
    for(int i=0;i<n;i++){
        if(saitsuyo<k2[i].F) {nage.push_back(k2[i].F); }
    }
    int cnt = 0;
    for(int i=0;i<nage.size();i++){
        h-= nage[i]; cnt++;
    }
    //cout<<saitsuyo<<endl; cout<<h<<nage.size()<<endl;
    if(h<=0) {
        sort(nage.begin(),nage.end(),greater<int>() );
        int cnt=0;
        for(int i=0;i<nage.size();i++){
            h2-=nage[i]; cnt++;
            if(h2<=0){ cout<<cnt<<endl; return 0;}
        }
    }
    ans = min(ans, cnt + h/saitsuyo +bool(h%saitsuyo));
    cout<<ans<<endl;
}


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

template<class T> T gcd(T a, T b) {
    return (b ? gcd(b, a % b) : a);
}

const int MAX = 1e6;
vector<int> prime(MAX + 1, -1);

void settable() {
    for(int i = 2; i <= MAX; i++) {
        if(prime[i] == -1) {
            prime[i] = i;
            for(int j = i + i; j <= MAX; j += i) {
                prime[j] = i;
            }
        }
    }
}

int main() {
    settable();
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    vector<bool> ok(MAX + 1, false);
    bool ok1 = true, ok2 = true;
    for(int i = 0; i < n; i++) {
        int nn = a[i];
        if(nn == 1) continue;
        set<int> s;
        do {
            int d = prime[nn];
            s.insert(d);
            nn /= d;
        } while(nn > 1);

        for(auto dd : s) {
            if(ok[dd]) ok1 = false;
            ok[dd] = true;
        }
    }

    int G = 0;
    for(int i = 0; i < n; i++) {
        G = gcd(a[i], G);
    }
    ok2 = (G == 1);
    if(ok1) {
        cout << "pairwise coprime" << endl;
    } else if(ok2) {
        cout << "setwise coprime" << endl;
    } else {
        cout << "not coprime" << endl;
    }
    
}

Measured memory_bytes: 11168
#include<bits/stdc++.h>
#define fast {ios_base::sync_with_stdio(false);cin.tie(NULL);}
#define pb push_back
typedef long long int ll;
using namespace std;
int main(void){
	fast;
	ll n;
	cin>>n;
	string ans="";
	while(n!=0){
		n--;
		char c=(char)(n%26+'a');
		string add(1,c);
		ans=add+ans;
		n/=26;
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;

int main() {
#ifdef HIRO
  string file_path(QUIZ);
  ifstream cin(file_path + "/input.txt");
  std::cin.rdbuf(cin.rdbuf());
#endif
  int n;
  // int m;
  cin >> n;
  // cin >> m;
  int arr[n][3];
  for(int i = 0; i < n; ++i)
    cin >> arr[i][0] >> arr[i][1] >> arr[i][2]; 

  int st = 0, sx = 0, sy = 0;
  int et, ex, ey, t, x, y, dis;
  for(int i = 0; i < n; ++i) {
    et = arr[i][0];
    ex = arr[i][1];
    ey = arr[i][2];

    t = et - st;
    x = ex - sx;
    y = ey - sy;

    dis = abs(x) + abs(y);
    if(dis > t || dis % 2 != t % 2) {
      cout << "No";
      return 0;
    }

    st = et;
    sx = ex;
    sy = ey;
  }
  // cout << ans << endl;
  cout << "Yes";
  return 0;
}



Measured memory_bytes: 1408
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    char x;
    cin>>x;
    if('a'<=x && x<='z') cout<<'a'<<endl;
    else cout<<'A'<<endl;
}/*
./problem.exe
*/

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

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

#define MAX 200002
long long MOD = 1000000007;
long long MODPOW2[MAX] = {0};

void initModPow2(){
	MODPOW2[0] = 1;
	for(int i=1; i<MAX; i++){
		MODPOW2[i] = (MODPOW2[i-1]*2)%MOD;
	}
}

long long GCD(long long x, long long y){
        long long r=0;

        if( x<y ) swap(x, y);
        r = x % y;
        while(r!=0){
                x = y;
                y = r;
                r = x % y;
        }
        return y;
}

// U(u個)とV(v個)が直交しているとき、どの2つも内積が0にならない選び方の数
// 余事象で考えて、2**(u+v)から内積が0になりうる選び方の数を引く
long long countUV(long long u, long long v){
	long long a=0, b=0, c=0, ret=0;
	a = MODPOW2[u+v] % MOD;
	b = (MODPOW2[u] - 1) % MOD;
	b = (b*(MODPOW2[v] - 1)) % MOD;
	ret = (a - b) % MOD;
	if(ret<0) ret += MOD;
	return ret;
}

class Tilt{
public:
	long long x;
	long long y;
	Tilt(){x = 0, y = 0;}
	Tilt(long long x, long long y){
		if(x == 0){
			this->x = 0;
			this->y = 1;
		}
		else if(y == 0){
			this->x = 1;
			this->y = 0;
		}
		else{
			long p, a, b;
			p = GCD(x, y);
			a = x / p;
			b = y / p;
			//if(a > 0){
			if(b > 0){
				this->x = a;
				this->y = b;
			}
			else{
				this->x = 0 - a;
				this->y = 0 - b;
			}
		}
	}
	inline bool operator==(const Tilt &t) const{
		if(x == 0 && t.x != 0) return false;
		if(x != 0 && t.x == 0) return false;
		if(x == 0 && t.x == 0) return true;
		if(y == 0 && t.y != 0) return false;
		if(y != 0 && t.y == 0) return false;
		if(y == 0 && t.y == 0) return true;

		if(x == t.x && y == t.y){
			return true;
		}
		else{
			return false;
		}
	}
	inline bool operator!=(const Tilt &t) const{
		return !(this->operator==(t)) ;
	}
};

//ハッシュ関数定義
//約分されている前提で、分子の値を返す
class MyHash {
public:
	std::size_t operator() (const Tilt& t) const {
		return (std::size_t) abs(t.y);
	}
};

unordered_map<Tilt, long long, MyHash> m1;
unordered_map<Tilt, long long, MyHash> m2; //ワーク用

int main(int argc, char* argv[]){
	int N, M;
	long long zero = 0;

	cin >> N;
	m1.reserve(N);
	m2.reserve(N);

	initModPow2();
	long long ans=1; 
	for(int i=1; i<=N; i++){
		long long a, b;
		cin >> a >> b;

		if(a == 0 && b == 0){
			zero++;
			continue; //(0, 0)は除外するが、数えておく
		}
		Tilt t =Tilt(a, b);
		if(m1.count(t)==0){
			m1[t] = 1;
			m2[t] = 1;
		}
		else{
			long long v = m1[t];
			m1[t] = v+1;
			m2[t] = v+1;
		}
	}
	for(auto itr = m1.begin(); itr != m1.end(); itr++){
		if(m2.empty()) break;
		long long x, y, u, v;
		Tilt t = itr->first;
		auto tmpitr1 = m2.find(t);
		if(tmpitr1 == m2.end()){
			continue;
		}
		u = itr->second;
		x = t.x;
		y = t.y;
		Tilt w = Tilt(0 - y, x); //法線ベクトル
		auto tmpitr2 = m2.find(w);
		if( tmpitr2 != m2.end()){
			v = m1[w];
		}
		else{
			v = 0;
		}
		long long uvcnt = countUV(u, v);
		ans = (ans * uvcnt) % MOD;
		m2.erase(t);
		m2.erase(w);
	}
	ans = ans + (zero % MOD) -1 ; //(0, 0)は他のどの要素とも直交するので足す。まったく選ばないを引く。
	ans = ans % MOD;
	if(ans < 0) ans += MOD;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 26652
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define ll long long
#define ld long double
#define d1(x)  cerr << #x << "--> " << x << endl
#define d2(x, y)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<endl
#define d3(x, y,z)  cerr << #x << "--> " << x << " | " << #y << "--> " << y <<" | " << #z << "--> "<< z<< endl
#define vpll vector<pair<ll,ll>>
#define F first
#define S second
using namespace std;

ll mode=pow(10,9)+7;
bool cmp(pair<ll,ll> x, pair<ll, ll> y){
	return x.S<y.S;
}


int main(){ 
    
    #ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif
	
	ios::sync_with_stdio(0);
    cin.tie(0);
	
	ll n;
	cin>>n;
	ll a[n];
	ll f[n]={0};
	for (int i=0;i<n;i++){
		cin>>a[i];
		f[a[i]]++;
	}
	ll ans=1;
	for (int i=1;i<n;i++){
		ans=(ans%998244353*f[a[i]-1]%998244353)%998244353;
	}
	if (f[0]!=1 || a[0]!=0){
		cout<<0<<endl;
	}
	else{
		cout<<ans<<endl;
	}
		
 	return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
#define pb push_back
#define fi first
#define se second
 
const ll MOD = 1000000007;
 
int main() {
   int n; scanf("%d", &n);
   vector<int> a(n + 1); vector<int> b(n);
   for (int i = 0; i <= n; ++i)
      scanf("%d", &a[i]);
   for (int i = 0; i < n; ++i)
      scanf("%d", &b[i]);
   ll ans = 0;
   for (int i = 0; i < n; ++i) {
      ans += min(a[i], b[i]);
      b[i] = max(b[i] - a[i], 0);
      ans += min(a[i + 1], b[i]);
      a[i + 1] = max(a[i + 1] -  b[i], 0);
   }
   printf("%lld", ans);
   return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if(a == 1) a = 14;
  if(b == 1) b = 14;
  if(a > b) cout << "Alice" << endl;
  else if(a < b) cout << "Bob" << endl;
  else cout << "Draw" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
using namespace std;
int a[1005];
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d",&a[i]);
        sort(a,a+n);
        printf("%d\n",a[n-1]-a[0]);
    }
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll N = 1e9+7;
ll maxProductSubarrayOfSizeK(ll A[], ll n, ll k)
{
    sort(A, A + n);
 
 
    ll product = 1;
 
 
    if (A[n - 1] == 0 && (k & 1))
        return 0;
 
 
    if (A[n - 1] <= 0 && (k & 1))
    {
        for (ll i = n - 1; i >= n - k; i--)
        {
            product = (product*A[i])%N;
            product = (product+N)%N;
        }
        return product;
    }
    ll i = 0;
 
    ll j = n - 1;
 
 
    if (k & 1)
    {
        product = (product*A[j])%N;
        product = (product+N)%N;
        j--;
        k--;
    }
 
    k >>= 1;
    for (ll itr = 0; itr < k; itr++)
    {
        //cout<<i<<" "<<product<<endl;
        ll left_product = A[i] * A[i + 1];
 
        ll right_product = A[j] * A[j - 1];
 
        if (left_product > right_product)
        {
            product = (product*A[i])%N;
            product = (product*A[i+1])%N;
            product = (product+N)%N;
            i += 2;
        }
        else
        {
            product = (product*A[j])%N;
            product = (product*A[j-1])%N;
            product = (product+N)%N;
            j -= 2;
        }
    }
 
 
    return product;
}
 
int main()
{
    ll a[200009];
    ll i,j,k,n,m,x;
    cin>>n>>k;
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }
    cout << maxProductSubarrayOfSizeK(a, n, k);
 
    return 0;
}


Measured memory_bytes: 5144
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>


#define FOR(i,k,n) for(int(i)=(k);(i)<(n);++(i))
#define rep(i,n) FOR(i,0,n)
#define all(v) begin(v),end(v)

using namespace std;

int main()
{
  int n,k;
  cin >>n>>k;
  
  int ret =0;
  rep(i,n)
  {
    int l;
    cin >>l;
    
    if(k<=l)
    {
      ++ret;
    }
  }

  cout << ret;
	return 0;
}


Measured memory_bytes: 384
/**
 * @brief  : c++ code for AtCoder
 * @author : rk222
 * @created: 2019.06.01 20:59:36
 */

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<int, P> P1;

#define fr first
#define sc second
#define mp make_pair
#define pb push_back
#define rep(i, x) for (int i = 0; i < x; i++)
#define rep1(i, x) for (int i = 1; i <= x; i++)
#define rrep(i, x) for (int i = x - 1; i >= 0; i--)
#define rrep1(i, x) for (int i = x; i > 0; i--)
#define sor(v) sort(v.begin(), v.end())
#define rev(s) reverse(s.begin(), s.end())
#define lb(vec, a) lower_bound(vec.begin(), vec.end(), a)
#define ub(vec, a) upper_bound(vec.begin(), vec.end(), a)
#define uniq(vec) vec.erase(unique(vec.begin(), vec.end()), vec.end())
#define mp1(a, b, c) P1(a, P(b, c))

#define disp(x) cout << #x << ": " << x << endl
#define disp_vec(v)                                                                           \
    cout << #v << ":";                                                                        \
    rep(i, v.size()) cout << " " << v[i];                                                     \
    cout << endl

const int INF = 100000000;
const int M = 100000000;
const int dir_4[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}};
const int dir_8[8][2] = {{1, 0}, {1, 1}, {0, 1}, {-1, 1}, {-1, 0}, {-1, -1}, {0, -1}, {1, -1}};

/* ------------------------------------- */

int main() {
    string s;
    cin >> s;
    int sl = s.size();
    int cnt = 0;
    rep(i, sl) {
        if (s[i] == 'o') {
            cnt++;
        }
    }
    if (15 - sl + cnt > 7) {
        cout << "YES" << '\n';
    } else {
        cout << "NO" << '\n';
    }

    /* --------------------------------- */
    return 0;
}

Measured memory_bytes: 256
<?php


$sc = new Scanner();
$a = $sc->nextInt();
$b = $sc->nextInt();

//$a = 1;
//$b = 2;
$q = $a * $b % 2;

out::println($q == 1 ? 'Odd' : 'Even');





//----------------------------------------------------------------------------------
// Ref: https://qiita.com/yoshikyoto/items/6924478283dbdd549e4b
class Scanner {
  private $arr = array();
  private $count = 0;
  private $pointer = 0;
  public function next() {
    if($this->pointer >= $this->count) {
      $str = trim(fgets(STDIN));
      $this->arr = explode(' ', $str);
      $this->count = count($this->arr);
      $this->pointer = 0;
    }
    $result = $this->arr[$this->pointer];
    $this->pointer++;
    return $result;
  }
  public function hasNext() {
    return $this->pointer < $this->count;
  }
  public function nextInt() {
    return (int)$this->next();
  }
  public function nextDouble() {
    return (double)$this->next();
  }
}

class out {
  public static function println($str = "") {
    echo $str . PHP_EOL;
  }
}

?>


Measured memory_bytes: 3576
/***  بسم الله الرحمن الرحيم   ***/
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define endl                         '\n'	
#define Ceil(x,y)             ((x+y-1)/y)
#define sz(s)               (int)s.size()
#define RT(x)           return cout<<x,0;
#define mem(x,y)    memset(x,y,sizeof(x))
#define all(v) ((v).begin()), ((v).end())
#define watch(x) cout<<(#x)<<" = "<<x<<endl
#define test int t;cin>>t;while(t--)
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
const double PI = acos(-1), EPS = 1e-7;
const int OO = 0x3f3f3f3f, N = 2e5 + 5, mod = 1e9 + 7;
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return (!y) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return ((x / gcd(x, y)) * y); }

int main() {
	ll n, a, b;
	cin >> n>>a >> b;
	if(abs(a-b)%2==0)
		cout<<abs(a - b) / 2;
	else {
		if (a == 1 || b == n)cout << abs(a - b) / 2+1;
		else cout << abs(a - b) / 2 + min(a - 1, n - b)+1;
	}

}

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

namespace C
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var lr = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
            var min = (lr[0] % 2019 * lr[1] % 2019) % 2019;
            for (var i = lr[0]; i <= lr[1] - 1; i++)
            {
                for (var j = i + 1; j <= lr[1]; j++)
                {
                    min = Math.Min((i % 2019 * j % 2019) % 2019, min);
                    if (min == 0) break;
                }
                if (min == 0) break;
            }
            Console.WriteLine(min);
        }
    }
}


Measured memory_bytes: 13396
#include <iostream>
#include <string>
#define MAP 12
using namespace std;

int map[MAP][MAP];

bool valid(int y, int x) {
  if ((0 <= y && y < MAP) && (0 <= x && x < MAP)) {
    if (map[y][x] == 1)
      return true;
  }
  return false;
}

void remove_island(int y, int x) {
  int nx, ny;
  int dx[4] = {1, 0, -1, 0};
  int dy[4] = {0, 1, 0, -1};

  map[y][x] = 0;
  for (int i = 0; i < 4; i++) {
    ny = y + dy[i];
    nx = x + dx[i];
    if ((valid(ny, nx)))
      remove_island(ny, nx);
  }
}

int main() {
  char c[13];
  int ans;
  while (1) {
    for (int i = 0; i < MAP; i++) {
      if (!(cin >> c))
        return 0;
      for (int j = 0; j < MAP; j++) {
        map[i][j] = (int)(c[j] - '0');
      }
    }
    ans = 0;
    for (int i = 0; i < MAP; i++) {
      for (int j = 0; j < MAP; j++) {
        if (valid(i, j)) {
          remove_island(i, j);
          ans++;
        }
      }
    }
    cout << ans << endl;
  }
  return 0;
}

Measured memory_bytes: 3096
n = int(input())
li = list(map(int, input().split()))


def partition(A, p, r):
    x = A[r - 1]
    i = p - 1
    for j in range(p, r - 1):
        if A[j] <= x:
            i = i + 1
            A[i], A[j] = A[j], A[i]
    A[i + 1], A[r - 1] = A[r - 1], A[i + 1]
    return i + 1


index = partition(li, 0, n)
for i in range(n):
    if i == index:
        print('[{}]'.format(li[i]), end='')
    else:
        print('{}'.format(li[i]), end='')
    if i < n - 1:
        print(' ', end='')
print('')



Measured memory_bytes: 16384
using System;
using System.Collections.Generic;
using System.Text;

namespace AtTest.AGC_Challenge
{
    class _014_A
    {
        static void Main(string[] args)
        {
            Method(args);
            Console.ReadLine();
        }

        static void Method(string[] args)
        {
            int[] abc = ReadInts();
            if (abc[0]%2==0
                &&abc[0] == abc[1] && abc[1] == abc[2])
            {
                Console.WriteLine(-1);
                return;
            }
            int cnt = 0;
            while (abc[0] % 2 == 0 && abc[1] % 2 == 0 && abc[2] % 2 == 0)
            {
                int[] next = new int[3];
                next[0] = (abc[1] + abc[2])/2;
                next[1] = (abc[2] + abc[0])/2;
                next[2] = (abc[0] + abc[1])/2;
                abc = next;
                cnt++;
            }

            Console.WriteLine(cnt);
        }

        private static string Read() { return Console.ReadLine(); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 13140
N,K = map(int,input().split())
A = list(map(int,input().split()))
D = {}
for i in A :
    if i in D :
        D[i] += 1
    else :
        D[i] = 1
D = sorted(D.items(),key=lambda x:x[1])
counter = 0
answer = 0
for j in range(len(D)) :
    if len(D) - counter > K :
        counter += 1
        answer += D[j][1]
    else :
        print(answer)
        break


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

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

    for(int i = 0; i < (int)s.length(); i++){
        s[i] += n;
        if(s[i] > 'Z') s[i] -= 26;
    }

    cout << s << endl;
    return 0;
}

Measured memory_bytes: 256
import  math



A, B, H, M = map(int, input().split( ))

Hr = H * 30 + M * 30 / 60
Mr = M * 6
Dr = abs(Hr - Mr)

print((A**2 + B**2 - 2*(A * B* math.cos(math.radians(Dr))))**(1/2))


Measured memory_bytes: 9500
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int static dp[100001][4];
int vacation(vector<int>&a,vector<int>&b,vector<int>&c,int n,int current,int s=0)
{
    if(current==n)
        return 0;
     if(dp[current][s]!=-1)
         return dp[current][s];
    int A=INT_MIN,B=INT_MIN,C=INT_MIN;
    if(s==0||s==1)
        A=max(b[current]+vacation(a,b,c,n,current+1,2),c[current]+vacation(a,b,c,n,current+1,3));
    if(s==0||s==2)
        B=max(a[current]+vacation(a,b,c,n,current+1,1),c[current]+vacation(a,b,c,n,current+1,3));
    if(s==0||s==3)
        C=max(a[current]+vacation(a,b,c,n,current+1,1),b[current]+vacation(a,b,c,n,current+1,2));
    dp[current][s]=max(max(A,B),C);
    return dp[current][s];
    
}

int main() {
    memset(dp,-1,sizeof(dp));
	int n;
	cin>>n;
	vector<int>a,b,c;
	for(int i=0;i<n;i++)
	{
	    int aa,bb,cc;
	    cin>>aa>>bb>>cc;
	    a.push_back(aa);
	    b.push_back(bb);
	    c.push_back(cc);
	}
	cout<<vacation(a,b,c,n,0);
	return 0;
}

Measured memory_bytes: 15460
import java.util.Arrays;
import java.util.Scanner;

public class Main {
  Scanner sc;

  int mcxi(char c) {
    switch ( c ) {
    case 'm':
      return 1000;
    case 'c':
      return 100;
    case 'x':
      return 10;
    case 'i':
      return 1;
    }
    return c - '0';
  }

  boolean isMCXI(char c) {
    switch ( c ) {
    case 'm':
    case 'c':
    case 'x':
    case 'i':
      return true;
    }

    return false;
  }

  int MCXItoInt(String s) {
    int sum = 0;
    int v = 1;
    for ( char c : s.toCharArray() ) {
      if ( isMCXI( c ) ) {
        sum += v * mcxi( c );
        v = 1;
      } else {
        v = mcxi( c );
      }
    }

    return sum;
  }

  String I2MCXI(int v) {
    String str = "";
    if ( v / 1000 > 0 ) {
      int v_ = v / 1000;
      if ( v_ > 1 ) {
        str += v_;
      }
      str += 'm';

      v -= v_ * 1000;
    }
    if ( v / 100 > 0 ) {
      int v_ = v / 100;
      if ( v_ > 1 ) {
        str += v_;
      }
      str += 'c';

      v -= v_ * 100;
    }
    if ( v / 10 > 0 ) {
      int v_ = v / 10;
      if ( v_ > 1 ) {
        str += v_;
      }
      str += 'x';

      v -= v_ * 10;
    }
    if ( v > 0 ) {
      int v_ = v;
      if ( v_ > 1 ) {
        str += v_;
      }
      str += 'i';
    }

    return str;
  }

  void run() {
    int n = ni();
    for ( int i = 0; i < n; ++i ) {
      String a = sc.next();
      String b = sc.next();

      int v = MCXItoInt( a ) + MCXItoInt( b );

      System.out.println( I2MCXI( v ) );
    }
  }

  Main() {
    sc = new Scanner( System.in );
  }

  int ni() {
    return sc.nextInt();
  }

  public static void main(String[] args) {
    new Main().run();
  }

  void debug(Object... os) {
    System.err.println( Arrays.deepToString( os ) );
  }
}

Measured memory_bytes: 27148
"""
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)
"""
"""
def gcd(a, b):
    if b == 0: return a
    return gcd(b, a % b)
"""
import math

k = int(input())


cnt=0

for a in range(1, k+1):
    for b in range(1, k+1):
        tmp=math.gcd(a,b)       
        for c in range(1, k+1):
            cnt += math.gcd(tmp,c)

print(cnt)


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

void solve(long long N, long long A, long long B)
{
    long long AB = A + B;
    long long num = N / AB;
    if (N % AB != 0)
    {
        long long mod = N % AB;
        long long pls = A - mod >= 0 ? mod : A;
        cout << num * A + pls << endl;
    }
    else
    {
        cout << num * A << endl;
    }
}

int main()
{
    long long N;
    scanf("%lld", &N);
    long long A;
    scanf("%lld", &A);
    long long B;
    scanf("%lld", &B);
    solve(N, A, B);
    return 0;
}


Measured memory_bytes: 256