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

#define NDEBUG
#ifdef DEBUG
#include "../cout11.h"
#undef NDEBUG
#endif
#include <cassert>

typedef long long ll;
typedef long double Double;
typedef unsigned long long ull;
typedef pair<int,int> ii;
typedef pair<ll,ll> llll;
typedef pair<double,double> dd;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<ii> vii;
typedef vector<vector<ii>> vvii;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<long double> vD;

#define sz(a)  int((a).size())
#define pb  push_back
#define FOR(var,from,to) for(int var=(from);var<=(to);++var)
#define rep(var,n)  for(int var=0;var<(n);++var)
#define rep1(var,n)  for(int var=1;var<=(n);++var)
#define repC2(vari,varj,n)  for(int vari=0;vari<(n)-1;++vari)for(int varj=vari+1;varj<(n);++varj)
#define ALL(c)  (c).begin(),(c).end()
#define RALL(c)  (c).rbegin(),(c).rend()
#define tr(i,c)  for(auto i=(c).begin(); i!=(c).end(); ++i)
#define found(s,e)  ((s).find(e)!=(s).end())
#define mset(arr,val)  memset(arr,val,sizeof(arr))
#define mid(x,y) ((x)+((y)-(x))/2)
#define IN(x,a,b) ((a)<=(x)&&(x)<=(b))
#define cons make_pair

int solve(int D,int G,vi& p,vi& c) {
    int P = 1 << D;
    vector<int> bonus(P, 0), bonus_k(P, 0);
    for (int i=0,b=1; i<D; ++i,b<<=1) {
        bonus[b] = (i+1)*100 * p[i] + c[i];
        bonus_k[b] = p[i];
    }
    // zeta
    for (int i=0,b=1; i<D; ++i,b<<=1) {
        for (int j=0; j<P; ++j) {
            if (j & b) bonus[j] += bonus[j ^ b];
            if (j & b) bonus_k[j] += bonus_k[j ^ b];
        }
    }

    int best = INT_MAX;
    for (int j=0; j<P; ++j) {
        int rest = G - bonus[j], bk = bonus_k[j];
        if (rest <= 0) {
            best = min(best, bk);
        } else {
            for (int i=D-1,b=1<<(D-1); i>=0; --i,b>>=1) {
                if (!(j & b)) {
                    int u = (i+1)*100, k = max(0, (rest+u-1)/u);
                    if (k <= p[i]) {
                        best = min(best, bk+k);
                    }
                }
            }
        }
    }
    return best;
}

int main() {
    int D,G; cin >> D >> G;
    vi p(D), c(D);
    rep(i,D) cin >> p[i] >> c[i];
    cout << solve(D,G,p,c) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define IL inline
#define RG register
using namespace std;

const int N=2e5+3;

int n,m,a[N],b[N],ans[2];

IL int gi() {
	RG int x=0,p=1; RG char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-') p=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	return x*p;
}

IL int check(int val) {
	RG int i,fl=1;
	for(i=1;i<=n;++i) b[i]=a[i]>=val;
	for(i=2;i<=n;++i) fl&=b[i]^b[i-1];
	if(fl) return b[1];
	ans[0]=ans[1]=n;
	for(i=2;i<=n;++i) 
		if(b[i]==b[i-1])
			ans[b[i]]=min(ans[b[i]],abs(m-i));
	for(i=n-1;i;--i)
		if(b[i]==b[i+1])
			ans[b[i]]=min(ans[b[i]],abs(m-i));
	return ans[1]<ans[0];
}

int main()
{
	RG int i,l,r,mid;
	m=gi(),n=r=(m<<1)-1,l=1;
	for(i=1;i<=n;++i) a[i]=gi();
	while(l<r) {
		mid=l+r+1>>1;
		if(check(mid)) l=mid;
		else r=mid-1;
	}
	printf("%d\n",r);
	return 0;
}
//Median Pyramid Hard


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include<cmath>
#define N 100005
#define A 1000005
#define MOD 1000000007 // //100000000 998244353 //
#define inf 1000000000000000000
#define ll long long
//#define M_PI 3.141592653589793238463

using namespace std;

#define pii pair<ll, ll>
#define piii pair<ll, pii>
#define ft first
#define sd second
#define pb push_back
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n-1; i >= 0; i--)
#define itr(it, x) for(auto it = x.begin(); it != x.end(); it++)
#define mem(a, b) memset(a, (ll)b, sizeof(a))
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define edge(v, x, y) v[x].pb(y); v[y].pb(x);
#define popcount __builtin_popcount
#define ANS(s) {cout << s << "\n"; return;}

//~~~~~~fancy print~~~~~~~//
#define printpii(a) cout << a.ft << " " << a.sd << endl;
#define printpiii(a) cout << a.ft << " " << a.sd.ft << " " << a.sd.sd << endl;
#define print(a, n) rep(i, n) cout << a[i] << " "; cout << endl;
#define printv(v) for(auto x: v)cout << x << " "; cout << endl;
#define printm(a, n, m) rep(i, n) { rep(j, m) cout << a[i][j] << "\t"; cout << endl;}

ll lx[4] = {0, 0, 1, -1};
ll ly[4] = {1, -1, 0, 0};
ll dx[8] = {0, 0, 1, -1, 1, -1, 1, -1};
ll dy[8] = {1, -1, 0, 0, 1, 1, -1, -1};
void fast(){ios_base::sync_with_stdio(false);cin.tie(0);cout << setprecision(12) << fixed;}
ll lcm(ll a, ll b) {return (a/__gcd(a, b))*b; }

void solve()
{
    ll n;
    cin >> n;
    ll a[26], b[26]; mem(a, 0);
    rep(i, n){
        string s;
        cin >> s;
        if(i == 0) {
            for(auto x: s) a[x-'a']++;
        }
        else{
            mem(b, 0);
            for(auto x: s) b[x-'a']++;
            rep(i, 26) a[i] = min(a[i], b[i]);
        }
    }//print(a, 26);
    rep(i, 26)
    {
        char x = (char) i + 'a';
        rep(j, a[i])cout << x;
    }
}

int main(){
    /*#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif*/
    fast();
    ll t = 1; //cin >> t;
    while(t--){
        solve();
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<string,int>;

const int MOD = 1e9 + 7;
const int INF = 1001001001;


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

    string s;
    cin >> s;

    map<char, int> mc;
    rep(i, s.size()){
        mc[s[i]]++;
    }

    if(mc.size() == 4){
        cout << "Yes" << endl;
    }else{
        if(mc.size() == 2 && ((mc['N'] > 0 && mc['S'] > 0) || (mc['E'] > 0 && mc['W'] > 0))){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 256
N = int(input())
from math import sqrt
#N mod K = 0 or 1 となるk をさがす
#K = Nの約数　or N-1 の約数
def divisor(num):
    max_num = int(sqrt(num))
    divisor_list = []
    for i in range(1, max_num + 1):
        if num % i == 0:
            if i != 1:
                divisor_list.append(i)
            if num // i != 1:
                divisor_list.append(num//i)
    #sorted_divisor_list = sorted(divisor_list)
    return divisor_list

K_1 = divisor(N-1)
K_2 = divisor(N)
K_3 = []
count = 0
for k in K_2:
    temp = N
    while temp % k == 0:
        temp //= k
    if temp == 1 or temp % k == 1:
        count += 1
        K_3.append(k)
kk = K_1 + K_3
ans = len(set(kk))
print(ans)

Measured memory_bytes: 65560
#include <iostream>
#include <cmath>
#include <stdint.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string.h>
#include <set>
using namespace std;
 
#define int long long
 
 
int gcd(int a, int b){
	
	if(b==0){
		return a;
	}
	
	return gcd(b,a%b);
	
}
 
 int lcm(int a, int b)  
 {  
    return (a*b)/gcd(a, b);  
 }  
 
 
int f(int x){
	
	
	int res = 0;
	
	while( x%2 == 0){
		
		x/=2;
		res++;
	}
	
	return res;
	
}
int g[16][16];
 
int32_t main() {
 	
 
 	
 	int n;
 	
 	cin >> n;
 	
 	for(int i=0; i<n; i++){
 		
 		for(int j=0; j<n; j++){
 			
 			g[i][j] = -1;
 			
 			
 			
		}
 		
	 }
 		
 		
 		
 		
 	for(int i=0; i<n; i++){
 		
 		int m;
 		cin >> m;
 	 
 		for(int j=0; j<m; j++){	
		 	int x, y;		 
			cin >> x >> y;	
			x--;		
		 	g[i][x] = y;
		}
 		
	 }
 
 	 int ans =0 ;
	  
	  for(int i=0; i< 1<<n; i++ ){
	  	
	  	vector<int> d(n);
	  	
	  	for(int  j=0; j<n; j++){
	  	//	int f = 1 << j;
		  if(i>>j&1) {
		  	d[j] = 1;
		  }	
	  		
		}
	  	
	  	bool ok =true;
	  	for(int j=0; j<n; j++){
	  		
	  		if(d[j]){
	  			
	  			for(int k=0; k<n; k++){
	  			
				  	if(g[j][k] == -1)
				  		continue;
	  				if(g[j][k] != d[k])
	  					ok = false;
				}
	  			
			}
		  	
		}
	  	
	  			  	
		  	if(ok){
		  		int tmp = __builtin_popcount(i);
			  	if(tmp > ans){
			  		ans = tmp;
				}
		  	 
		  	}
	  	 
	  } 
 	 
 	  	cout << ans << endl;
 	  
 	  
}
 
 
 

Measured memory_bytes: 3160
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main() {
    vector<ll> a(3);
    ll ans;
    rep(i,3) cin>>a[i];
    sort(all(a));
    if(a[0]%2==1&&a[1]%2==1&&a[2]%2==1) ans=a[0]*a[1];
    else ans=0;
    cout<<ans;
}

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

vector<string> a;

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

    int n = s.size(), m = t.size();
    for(int i=0;i<n;i++){
        if((s[i]==t[0] || s[i]=='?') && m <= n - i){
            string ss = s; bool ok = true;
            for(int j=0;j<m;j++){
                if(s[i+j] != t[j] && s[i+j] != '?') ok = false;
                else ss[i+j] = t[j];
            }

            if(ok){
                for(int i=0;i<n;i++) if(ss[i]=='?') ss[i] = 'a';
                a.push_back(ss);
            }
        }
    }

    if(a.size()){
        sort(a.begin(), a.end());
        cout << a[0] << endl;
    }
    else cout << "UNRESTORABLE" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>
#include <climits>
#include <ctime>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef double db;
#define lowbit(x) (x)&(-x)
#define gcd(a,b) __gcd(a,b)
#define sqre(x) (x)*(x)
#define mem(x,y) memset(x,y,sizeof(x))
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
const int MaxN = 1e6 + 1005;
const int inf = 1e8;
const double PI = acos(-1.0);
const LL mod = 100000007;

priority_queue<int,vector<int> ,greater<int> > que;
vector<int> t[MaxN];

set<int> st;
int main()
{
	int n;cin >> n;
	while(n--){
		int x;
		cin >> x;
		st.insert(x);
	}
	cout << st.size() << endl;
	return 0;
}

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

using namespace std;

#define int long long
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CINT(...)                                                              \
    int __VA_ARGS__;                                                           \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Yes(a) cout << (a ? "Yes" : "No") << "\n"
#define YES(a) cout << (a ? "YES" : "NO") << "\n"
#define Printv(v)                                                              \
    {                                                                          \
        FOREACH(x, v) { cout << x << " "; }                                    \
        cout << "\n";                                                          \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef unsigned long long ul;
typedef vector<ll> VL;
typedef pair<ll, ll> PL;

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

ll X, A;

signed main() {
    cin >> X >> A;
    cout << (X < A ? 0 : 10) << "\n";
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main{
	
	static int n ;
	static List<ArrayList<Edge>> Node;
	static int []colar;

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		n = Integer.parseInt(sc.next());
		
		Node = new ArrayList<ArrayList<Edge>>();
		colar = new int [n];
		
		for(int i = 0 ; i < n ;i++) {
			Node.add(new ArrayList<Edge>());
		}
		
		for(int i = 0 ;i < n-1 ;i++) {
			int v = Integer.parseInt(sc.next());
			int u = Integer.parseInt(sc.next());
			int l = Integer.parseInt(sc.next());
			
			Node.get(v-1).add(new Edge(u-1,l));
			Node.get(u-1).add(new Edge(v-1,l));
		}
		for(int i = 0 ; i < n ;i++) {
			colar[i] = -1;						//まだ色を塗っていないとして初期化
		}
		
		colar[0] = 0;							//原点をまずは色を塗る
		dfs(0);
		
		for(int i = 0 ; i < n ;i++) {
			System.out.println(colar[i]);
		}

	}
	
	static void dfs(int from) {
		
		for(Edge e: Node.get(from)) {
			if(colar[e.getTo()] != -1) {
				continue;
			}
			if(e.getLength() % 2 == 0) {
				colar[e.getTo()] = colar[from];
				dfs(e.getTo());
			}
			else {
				colar[e.getTo()] =(colar[from] + 1)%2;
				dfs(e.getTo());
			}
		}
	}

}



class Edge{
	private int to ;
	private int lenght;
	
	public Edge( int to , int lenght) {
		this.to = to;
		this.lenght = lenght;
	}
	public int getTo() {
		return to;
	}
	public int getLength() {
		return lenght;
	}
	
}


Measured memory_bytes: 82372
#include<bits/stdc++.h>
using namespace std;
map<string, int>mp;
int main(){
    int n;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        mp[s]++;
    }
    int maxcnt = 0;
    for(auto it = mp.begin(); it != mp.end(); it++)
        if(it->second > maxcnt) maxcnt = it->second;
    for(auto it = mp.begin(); it != mp.end(); it++)
        if(it->second == maxcnt) cout << it->first << '\n';
}

Measured memory_bytes: 25216
package main

import "fmt"

func main() {
	var n, k int
	fmt.Scan(&n, &k)
	var d int
	var a int
	s := make([]int, n, n)
	for i := 0; i < k; i++ {
		fmt.Scan(&d)
		for l := 0; l < d; l++ {
			fmt.Scan(&a)
			s[a-1] = 1
		}
	}
	num := 0
	for i := 0; i < n; i++ {
		if s[i] == 0 {
			num++
		}
	}
	fmt.Println(num)
}

Measured memory_bytes: 2252
#include<stdio.h>
int m[]={2189,89,1232,866,1796,2603},a,b,c,d,r;char s[99];int main(){for(s[87]=1,s[78]=4,s[69]=3,s[83]=2;~scanf("%s",s);d=s[*s],*s<60?printf(r?"%d\n":0,r),a=c=r=0,b=1:d?d=d+c&3,a=m[a]>>3*d&7,b=m[b]>>3*d&7:c+=*s-76?1:3,r+=a%3?b%3?(b+6-a)%6<3?2:5:3+!b:a?6:1);}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <queue>
#include <map>
#include <numeric>
#include <unordered_map>
#include <iomanip>
#include <functional>
#include <bitset>
#include <complex>
#include <stack>



#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n-1); i >= 0; i--)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()

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

typedef long long ll;

using namespace std;


int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n;cin>>n;
  string s;cin>>s;
  if(n%2){
    cout<<"No"<<endl;
    return 0;
  }
  ll f=1;
  rep(i,n/2){
    if(s[i]!=s[i+n/2])f=0;
  }
  if(f){
    cout<<"Yes"<<endl;
  }
  else {
    cout<<"No"<<endl;
  }
  return 0;

}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Scanner;

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

	static void solver() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[] a = new int[m];
		ArrayList<Integer> odd = new ArrayList<Integer>();
		ArrayList<Integer> ord = new ArrayList<Integer>();
		for (int i = 0; i < m; i++) {
			a[i] = sc.nextInt();
			if (a[i] % 2 != 0) {
				odd.add(a[i]);
				ord.add(i);
			}
		}
		if (m == 1) {
			show(a);
			if (a[0] != 1) {
				System.out.println(2);
				System.out.println((a[0] - 1) + " " + 1);
			} else {
				System.out.println(1);
				System.out.println(a[0]);
			}
			return;
		} else if (m == 2) {
			show(a);
			int count = 1;
			if (a[0] != 1)
				count++;
			if (a[1] != 1)
				count++;
			System.out.println(count);
			if (a[0] != 1)
				System.out.print((a[0] - 1) + " ");
			System.out.print(2);
			if (a[1] != 1)
				System.out.println(" " + (a[1] - 1));
			else
				System.out.println();
			return;
		}

		if (odd.size() > 2) {
			System.out.println("Impossible");
			return;
		} else {
			if (ord.size() > 0) {
				int d = a[0];
				a[0] = odd.get(0);
				a[ord.get(0)] = d;
				if (ord.size() == 2) {
					d = a[m - 1];
					a[m - 1] = odd.get(1);
					a[ord.get(1)] = d;
				}
			}
			show(a);
			int count = m - 1;
			if (a[0] != 1)
				count++;
			if (a[m - 1] != 1)
				count++;
			System.out.println(count);
			System.out.print((a[0] != 1 ? (a[0] - 1) + " " : ""));
			for (int i = 1; i < m - 1; i++) {
				System.out.print(a[i] + " ");
			}
			System.out.print(2);
			System.out.println((a[m - 1] != 1 ? " " + (a[m - 1] - 1) : ""));
			return;
		}
	}

	static void show(int[] a) {
		for (int i = 0; i < a.length; i++) {
			System.out.print(a[i] + (i == a.length - 1 ? "\n" : " "));
		}
	}
}


Measured memory_bytes: 9804
#include<bits/stdc++.h>
using namespace std;
long long a,b,c,d,i,e,f,g,n,m,k,l,in[200005],out[200005],maxx,C[200005],S[200005],B[22][200005],ver,u,u1,q;
vector <long long> v[200005];
string s,t;
int main()
{
           cin>>n;
           for(long long i=1;i<=n;i++)
           cin>>C[i];
           for(long long i=1;i<n;i++)
           {
                      if(C[i]>=C[i+1]) k++;
                      else { maxx=max(maxx,k); k=0; }
                      //cout<<k<<" ";
           }
           cout<<max(maxx,k);
           
}

Measured memory_bytes: 10496
#include<stdio.h>

int max(int x, int y){
  return (x > y) ? x : y;
}

int main(){
  int n;
  scanf("%d", &n);
  
  int a[2][n];
  for(int i = 0; i < 2; i++) for(int j = 0; j < n; j++) scanf("%d", &a[i][j]);
  
  int dp[3][n + 1];
  for(int i = 0; i < 2; i++) for(int j = 0; j < n; j++) dp[i][j] = 0;
  dp[0][0] = a[0][0];
  
  for(int j = 0; j < n; j++){
    for(int i = 0; i < 2; i++){
      dp[i + 1][j] = max(dp[i][j] + a[i + 1][j], dp[i + 1][j]);
      dp[i][j + 1] = max(dp[i][j] + a[i][j + 1], dp[i][j + 1]);
    }
  }
  
  printf("%d\n", dp[1][n - 1]);
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define END << endl;
#define SP << " " << 
int gcd( int m, int n ){
	if ( ( 0 == m ) || ( 0 == n ) )return 0;
	while( m != n ){
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}
using namespace std;

int main(void){
  int N,M;
  cin >> N>>M;
  int a = gcd(N,M);
  int n = N/a;
  int m = M/a;
  cout << (n+m-1)*a+1 END
  return 0;
}


Measured memory_bytes: 3100
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using graph = vector<vector<int>>;
using wgraph = vector<vector<pair<int, lint>>>;
const lint INF = 1001001001001001LL;
const lint MOD = 1000000007LL;
int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

void yes(){ cout << "yes" << endl; }
void Yes(){ cout << "Yes" << endl; }
void YES(){ cout << "YES" << endl; }
void no(){ cout << "no" << endl; }
void No(){ cout << "No" << endl; }
void NO(){ cout << "NO" << endl; }
void possible(){ cout << "possible" << endl; }
void Possible(){ cout << "Possible" << endl; }
void POSSIBLE(){ cout << "POSSIBLE" << endl; }
void impossible(){ cout << "impossible" << endl; }
void Impossible(){ cout << "Impossible" << endl; }
void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define drep(i,n) for(int i = (n)-1; i >= 0; i--)
#define srep(i,s,t) for(int i = s; i < t; i++)
#define all(a) a.begin(),a.end()

int main(){
  int a; cin >> a;
  string s; cin >> s;
  if(a >= 3200) cout << s << endl;
  else cout << "red" << endl;  
  return 0;
}


Measured memory_bytes: 256
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust, fromMaybe)
import qualified Data.Map.Strict as M


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine

readInts :: IO [Int]
readInts = map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine

split :: (a -> Bool) -> [a] -> [[a]]
split f [] = []
split f as = let
    (fo, la) = span f as
    las = case la of
        [] -> []
        xs -> split f $ tail xs
    in
        case fo of
            [] -> las
            xs -> xs : las

solve :: Int -> Int -> Int -> [Int] -> [Bool]
solve people point qs anss =
     fmap (\man -> (>= leastAns) $ fromMaybe 0  $ M.lookup man points) [1..people]
    where
        init = M.fromList $ zip [1..people] $ repeat 0
        leastAns = qs - (point - 1)
        points = foldl' (\dic answer -> M.adjust (+1) answer dic) init anss

main = do
    (people, point, qs) <- readTuple3
    anss <- replicateM qs readInt
    forM_ (solve people point qs anss) $ \a ->
        putStrLn $ if a  then  "Yes" else "No"


Measured memory_bytes: 48764
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<climits>
#include<iostream>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<map>
#include<set>
#include<algorithm>
#include<numeric>

#define rep(n) for(int i=0;i<n;i++)
#define repp(j, n) for(int j=0;j<n;j++)
#define reppp(i, m, n) for(int i=m;i<=n;i++)
#define all(c) c.begin(), c.end()
#define rall(c) c.rbegin(), c.rend()
#define MOD 1000000007
#define MAX 1000000001
#define INF 1410065408
#define EPS 1e-9
#define DEBUG 0
#define ll long long
#define Pll pair<ll, ll>
#define Pii pair<int, int>
 
using namespace std;
struct edge{int from, to; ll cost;};

signed main(){
    ios::sync_with_stdio(0); cin.tie(0);
    int n; ll tmp;
    cin >> n;
    map<ll, ll> mp;
    rep(n){
        cin >> tmp;
        mp[tmp]++;
    }

    ll ans = 0;
    for(auto itr=mp.begin();itr!=mp.end();++itr){
        if(itr->first < itr->second){
            ans += itr->second - itr->first;
        }else if(itr->first > itr->second){
            ans += itr->second;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 6272
#include <stdio.h>
#include <stdlib.h>

struct Node{
    int key,parent,left,right;
};

void pre(struct Node *T,int h){
    if(h==-1) return;
    printf(" %d",T[h].key);
    pre(T,T[h].left);
    pre(T,T[h].right);
}
void in(struct Node *T,int h){
    if(h==-1) return;
    in(T,T[h].left);
    printf(" %d",T[h].key);
    in(T,T[h].right);
}

int main(void){
    int m,n,i,h=-1;
    char command[10];
    scanf("%d",&m);
    struct Node *T=malloc(sizeof(struct Node)*m);
    for(i=0;i<m;i++){
        T[i].parent=-1;
        T[i].left=T[i].right=-1;
    }
    for(i=0;i<m;i++){
        scanf("%s",command);
        if(command[0]=='i'){
            int x=h,y=-1,z;
            scanf("%d",&z);
            T[i].key=z;
            while(x!=-1){
                y=x;
                if(z<T[x].key) x=T[x].left;
                else x=T[x].right;
            }
            T[i].parent=y;
            if(y==-1) h=i;
            else if(z<T[y].key) T[y].left=i;
            else T[y].right=i;
        }
        else if(command[0]=='f'){
            int x=h,k;
            scanf("%d",&k);
            while(x!=-1){
                if(k==T[x].key) break;
                else if(k<T[x].key) x=T[x].left;
                else x=T[x].right;
            }
            if(x!=-1) printf("yes\n");
            else printf("no\n");
        }
        else if(command[0]=='p'){
            in(T,h);
            printf("\n");
            pre(T,h);
            printf("\n");
        }
    }
    
    return 0;
}



Measured memory_bytes: 9508
using System;

class Program
{
    static void Main(string[] args)
    {
        var d = new[] {
            Console.ReadLine(),
            Console.ReadLine(),
            Console.ReadLine()
        };

        var i = new[] { 0, 0, 0 };
        var n = 0;

        while (i[n] < d[n].Length)
        {
            var m = d[n][i[n]] - 'a';
            i[n]++;
            n = m;
        }

        Console.WriteLine((char)(n + 'A'));
    }
}


Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b; cin >> a >> b;
	if(a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
		cout << "Possible" << endl;
	else cout << "Impossible" << endl;
	return 0;
}


Measured memory_bytes: 256
S = input()
part0 = int(S[0:2])
part1 = int(S[2:])

def ismonth(number):
    if number > 0 and number < 13:
            return True
    return False

if ismonth(part0) and ismonth(part1):
        print("AMBIGUOUS")
elif ismonth(part0):
        print("MMYY")
elif ismonth(part1):
        print("YYMM")
else:
        print("NA")

Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <stack>
using namespace std;
int main(){
  string str;
  string tmp;
  while(getline(cin, str) && str != "."){
    int p = 0, q = 0;
    bool flag = 1;
    tmp = "";
    
    for(int i = 0 ; i < str.size() ; i++){
      if(str[i] == '[' || str[i] == '(' || str[i] == ']' || str[i] == ')'){
	tmp += str[i];
      }
    }
    
    /*for(int i = 0 ; i < tmp.size() ; i++){
      if(tmp[i] == '(' && tmp[i+1] == ']') flag = 0;
      if(tmp[i] == '[' && tmp[i+1] == ')') flag = 0;
      }*/
    
    for(int i = 0 ; i < tmp.size() ; i++){
      //printf("p = %d, q = %d\n", p, q);
      if(p < 0 || q < 0){
	flag = 0;
	break;
      }
      if(tmp[i] == '(') p++;
      if(tmp[i] == '[') q++;
      if(tmp[i] == ')') p--;
      if(tmp[i] == ']') q--;
    }
    if(p != 0 || q != 0) flag = 0;

    
    stack<char> st;
    
    for(int i = 0 ; i < tmp.size() ; i++){
      if(tmp[i] == '(' || tmp[i] == '[') st.push(tmp[i]);
      else if(tmp[i] == ')'){
	if(st.empty() || st.top() != '('){ flag = 0; break;}
	else st.pop();
      }
      else if(tmp[i] == ']'){
	if(st.empty() || st.top() != '['){ flag = 0; break;}
	else st.pop();
      }
    }
    
    //cout << tmp << endl;
    //printf("p = %d, q = %d\n", p, q);*/
    if(flag) cout << "yes" << endl;
    else cout << "no" << endl;    
  }
  return 0;
}

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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

typedef long long ll;
typedef pair<int, int> p;

int main(){
  ll a, b;
  cin >> a >> b;
  if(a * b <= 0) cout << "Zero" << endl;
  else if(a > 0 && b > 0) cout << "Positive" << endl;
  else if((b - a) % 2 == 0) cout << "Negative" << endl;
  else cout << "Positive" << endl;
}


Measured memory_bytes: 256
import itertools

n = int(input())
lst = list(map(int, input().split()))

accum_xor = []
s = 0
for i in lst:
    s = s ^ i
    accum_xor.append(s)

accum_lst = list(itertools.accumulate(lst))

def bisearch(start, n, accum_xor, accum_lst):
    low = start
    high = n
    while True:
        i = (low+high)//2
        if start == 0:
            if accum_xor[i] == accum_lst[i]:
                low = i
            else:
                high = i
        else:
            if accum_xor[start-1] ^ accum_xor[i] == accum_lst[i] - accum_lst[start-1]:
                low = i
            else:
                high = i
        if high - low <= 1:
            if start == 0:
                if accum_xor[high] == accum_lst[high]:
                    flg = True
                else:
                    flg = False
            else:
                if accum_xor[start-1] ^ accum_xor[high] == accum_lst[high] - accum_lst[start-1]:
                    flg = True
                else:
                    flg = False
            break
    return high if flg else low

s = 0
for i in range(n):
    a = bisearch(i, n-1, accum_xor, accum_lst) - i + 1
    s += a
print(s)

Measured memory_bytes: 87872
#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;

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 _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

int N, D;
int X[200000], Y[200000], B[200000];
multiset<int> Sx, Sy;

void add(int x) {
  Sx.insert(X[x]);
  Sy.insert(Y[x]);
}
void del(int x) {
  Sx.erase(Sx.find(X[x]));
  Sy.erase(Sy.find(Y[x]));
}

signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N >> D;
  vector<P> xs;
  rep(i, N) {
    cin >> X[i] >> Y[i] >> B[i];
    xs.pb(P(B[i], i));
  }
  sort(all(xs));
  long long m = 0;
  int r = 0;
  for (P p : xs) {
    int x = p._2;
    while (r < N && xs[r]._1 <= B[x]+D) add(xs[r++]._2);
    if (!Sx.empty()) {
      m = max(m, 1LL*(*Sx.rbegin() - *Sx.begin()) * (*Sy.rbegin() - *Sy.begin()));
    }
    del(x);
  }
  cout << m << "\n";
  return 0;
}

Measured memory_bytes: 25328
#include<stdio.h>
int min(int a,int b)
{
	if(a<b)
	a=a;
	if(a>b)
	a=b;
	return a;
}
int max(int a,int b )
{
	if(a>b)
	a=a;
	if(a<b)
	a=b;
	return a;
}
int main()
{
	int a,b,c,d;
	int sum;
	scanf("%d%d%d%d",&a,&b,&c,&d);
	if (b<c||d<a)
	sum = 0;
	else
	{
		sum=min(b,d)-max(a,c);
	}
		printf("%d\n",sum);
	return 0;
}


Measured memory_bytes: 128
from heapq import heapify, heappop, heappush
N, K = map(int, input().split())
V = list(map(int, input().split()))
answer = 0

for i in range(K + 1):
    for j in range(K - i + 1):
        if i + j > N:
            break
        heap = V[:i] + V[N - j:]
        heapify(heap)
        for _ in range(K - i - j):
            if heap:
                temp = heappop(heap)
            else:
                heappush(heap, 0)
                break
            if temp >= 0:
                heappush(heap, temp)
                break
        answer = max(answer, sum(heap))

print(answer)

Measured memory_bytes: 3064
S = list(map(str,input()))
i = 0
ans = 0
for i in range(len(S)):
  if (i+1)%2 == 1:
    if S[i] == "L":
      ans = ans + 1
  else:
    if S[i] == "R":
      ans = ans + 1
if ans == 0:
  print("Yes")
else:
  print("No")

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

#define Online 1
// #define multitest 1
#define Debug 1
typedef long long ll;
typedef long double ld;
#define f first
#define s second
#define pb push_back
#define mp make_pair
const long long mod = 1000000007;
const long long High = 1e16;
void ControlIO();
void TimerStart();
void TimerStop();
#ifdef Debug
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
	std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
	const char *comma = strchr(names + 1, ',');
	std::cerr.write(names, comma - names) << " = " << arg1;
	ZZ(comma, args...);
}
#else
#define db(...)
#endif

void solve()
{
    int n,k;
    string s;
    cin >> n >> k >> s;
    s[k-1] += 32;
    cout << s;
}

int main()
{
	ControlIO();
	int t = 1;
#ifdef multitest
	cin >> t;
#endif
	TimerStart();
	while (t--)
		solve();
	TimerStop();
	return 0;
}

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

auto TimeStart = chrono::steady_clock::now();
auto TimeEnd = chrono::steady_clock::now();

void TimerStart()
{
#ifndef Online
	TimeStart = chrono::steady_clock::now();
#endif
}

void TimerStop()
{
#ifndef Online
	TimeEnd = chrono::steady_clock::now();
	auto ElapsedTime = TimeEnd - TimeStart;
	cout << "\n\nTime elapsed: " << chrono::duration<double>(ElapsedTime).count() << " seconds.\n";
#endif
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <map>
#define eps 0.0000000001
#define maxn 300009
#define inf 0x3f3f3f3f
#define mod 1000000009
#define ll long long
using namespace std;
struct ee
{
    ll v,n;
}p[maxn];
ll n,k;
bool cmp(ee aa,ee bb)
{
    return aa.v<bb.v;
}
int main()
{
    //freopen("d:\\in.txt","r",stdin);
    scanf("%lld%lld",&n,&k);
    for(int i=1;i<=n;i++)
    {
        ll a,b;
        scanf("%lld%lld",&a,&b);
        p[i].v=a;
        p[i].n=b;
    }
    sort(p+1,p+n+1,cmp);
    ll t=0;
    for(int i=1;i<=n;i++)
    {
        t+=p[i].n;
        if(t>=k)
        {
            printf("%lld\n",p[i].v);
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (long long i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (long long i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) begin(obj), end(obj)
#define RALL(obj) rbegin(obj), rend(obj)
#define fi first
#define se second
using ii = pair<int, int>;
vector<ii> dirs = {
  {1, 0}, {0, 1}, {-1, 0}, {0, -1},  // 4方向
  {1, 1}, {-1, 1}, {-1, -1}, {1, -1},  // 斜め
  {0, 0},  // 自身
};
template <class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } return false; }
template <class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } return false; }
template <class T, class S> vector<T> make_vec(size_t n, S x) { return vector<T>(n, x); }
template <class T, class... Ts> auto make_vec(size_t n, Ts... ts) { return vector<decltype(make_vec<T>(ts...))>(n, make_vec<T>(ts...)); }

// debug
template <class T> ostream& operator<<(ostream& s, vector<T>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : " "); return s; }
template <class T> ostream& operator<<(ostream& s, vector<vector<T>>& d) { REP (i, d.size()) s << d[i] << (i == d.size() - 1 ? "" : "\n"); return s; }
template <class T, class S> ostream& operator<<(ostream& s, pair<T, S>& p) { s << "{" << p.first << ", " << p.second << "}"; return s; }
template <class T, class S> ostream& operator<<(ostream& s, map<T, S> m) { for (auto it = m.begin(); it != m.end(); it++) { s << *it << (next(it) == m.end() ? "" : "\n"); } return s; }
#ifdef _MY_DEBUG
  #define dump(...) cerr << "/* " << #__VA_ARGS__ << " :[" << __LINE__ << ":" << __FUNCTION__ << "]" << endl, dump_func(__VA_ARGS__), cerr << "*/\n\n";
#else
  #define dump(...)
  #define endl "\n"
#endif
void dump_func() { cerr << endl; }
template <class Head, class... Tail> void dump_func(Head&& h, Tail&&... t) { cerr << h << (sizeof...(Tail) == 0 ? "" : ", "), dump_func(forward<Tail>(t)...); }

struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
constexpr int MOD = 1000000007;
// *************** TEMPLATE END *************** 

signed main() {
  int n, m; cin >> n >> m;
  vector<vector<int>> s(m);
  REP (i, m) {
    int k; cin >> k;
    REP (j, k) {
      int x; cin >> x;
      x--;
      s[i].push_back(x);
    }
  }
  vector<int> p(m); REP (i, m) cin >> p[i];

  int ans = 0;
  REP (S, 1LL << n) {
    bool all = true;
    REP (i, m) {
      int num = 0;
      for (int x: s[i]) {
        if (S >> x & 1) num++;
      }
      if (num % 2 != p[i]) all = false;
    }
    ans += all;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 9e18;
constexpr int inf = 1e9;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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;
};
 
// intやllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ---------------------------------------------------------------------------
 
 ll calc(string S){
   vector<P> vp;
   for(int i=0; i<S.size(); i++){
     if(vp.empty() || vp.back().first != S[i]){
       vp.push_back(P(S[i],0));
     }
     vp.back().second++;
   }
   ll res = 0;
   for(auto p: vp){
     res += p.second/2;
   }
   return res;
 }

 int main(){
   string S;
   cin >> S;
   ll K;
   cin >> K;
   if(S == string(S.size(),S[0])){
     cout << (S.size()*K)/2 << endl;
     return 0;
   }
   cout << calc(S) + (calc(S+S) - calc(S)) * (K-1) << endl;
   return 0;
 }

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

using namespace std;

int main()
{
  int n, A[4];
  fill(A, A + 4, 0);
  char b[10];
  while (scanf("%d,%s ", &n, b) == 2) {
    if (b[0] == 'A') {
      if (b[1] == 'B') {
	A[2]++;
      } else {
	A[0]++;
      }
    } else if (b[0] == 'B') {
      A[1]++;
    } else if (b[0] == 'O') {
      A[3]++;
    }
  }
  for (int i = 0; i < 4; i++) {
    printf("%d\n", A[i]);
  }
  return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
    int s ;
    cin >> s ;
    int s1 ;
    s1 = s%10 ;
    int s10 ;
    s10 = ((s-s1)%100)/10 ;
    int s100 ;
    s100 = ((s-10*s10-s1)%1000)/100;
    cout << s1+s10+s100;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;


int main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
 
    fastio

    ll n, i, j, k;
    cin>>n>>k;
    ll dp[n+9], a[n+9];
    for(i=0; i<n; i++)
    {
        cin>>a[i];
    }

    dp[n-1]=0;
    dp[n-2]=abs(a[n-1]-a[n-2]);
    for(i=n-3; i>=0; i--)
    {
        ll mn=INT_MAX;
        for(j=1; j<=k; j++)
        {
            if(i+j==n)
                break;
            mn=min(mn, dp[i+j]+abs(a[i]-a[i+j]));
        }
        dp[i]=mn;
    }
    cout<<dp[0];
}



Measured memory_bytes: 5188
let n, k = Scanf.scanf "%d %d\n" (fun n k -> n, k)
let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun i -> i))

let rec f l r =
  if r <= l then r
  else
    let m = (l + r) / 2 in
    let k' = Array.fold_left (fun i j -> i + (j - 1) / m) 0 a in
    if k < k' then f (m + 1) r
    else f l m

let () = Printf.printf "%d\n" (f 1 1000000000)


Measured memory_bytes: 7472
#include<iostream>
#include<vector>
#include<string>
#include<array>
#include<algorithm>
#include<list>
#include<cmath>
#include<iomanip>
#include<queue>
#include<functional>
#include<climits>
#include<iterator>
#include<unordered_set>
#include<unordered_map>
#include<map>
#include<set>
#include<typeinfo>
using namespace std;

const double pi=4*atan(1.0);

constexpr long long mod=static_cast<long long>(1e9+7);

using cWeightEdges=vector<vector<pair<int,int>>>;
using cEdges=vector<vector<int>>;

int main(){
	int N,A,B;
	cin>>N>>A>>B;
	int ans=0;
	for(int i=0;i<N;++i){
		int t;
		cin>>t;
		if(A<=t && t<B)++ans;
	}
	cout<<N-ans<<endl;
//	system("pause");
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <algorithm>
#include <cstring>

std::string s1,s2;

int dp[4001][4001];

int main() {
    
    while(std::cin>>s1>>s2) {
        
        std::memset(dp,0,sizeof(dp));
        
        for(int i=1;i<=s1.size();++i){
            for(int j=1;j<=s2.size();++j){
                if(s1[i-1]==s2[j-1])
                    dp[i][j]=dp[i-1][j-1]+1;
            }
        }
        
        int ans=0;
        
        for(int i=1;i<=s1.size();++i){
            for(int j=1;j<=s2.size();++j){
                ans=std::max(ans,dp[i][j]);
            }
        }
        
        std::cout<<ans<<std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 65544
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

s = map(int, raw_input().split())
if s[0] < s[1]:
    print "%d" % gcd(s[1], s[0])
else:
    print "%d" % gcd(s[1], s[0])

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

using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using ull = unsigned long long;
using vb = vector<bool>;
using vvb = vector<vb>;
using vd = vector<double>;
using vvd = vector<vd>;
using vvvd = vector<vvd>;
using vs = vector<string>;
using vvs = vector<vs>;
using vc = vector<char>;
using vvc = vector<vc>;
using ii = pair<int,int>;
using vii = vector<ii>;
using vvii = vector<vii>;
using dd = pair<double, double>;
using vdd = vector<dd>;
using vvdd = vector<vdd>;
using Mii = map<int,int>;
using vMii = vector<Mii>;

#define fi first
#define se second
#define INF INT_MAX
#define mod(a,m) (a%m+m)%m
#define PB push_back
#define MP make_pair

const int MOD = 1e9 + 7;

vvi G;
vi rnk;
vvi memo;

void get_rank() {
	int n = G.size();
	rnk = vi(n, -1);
	rnk[0] = 0;
	queue<int> q;
	q.push(0);
	while (not q.empty()) {
		int x = q.front();
		q.pop();
		for (int u : G[x]) {
			if(rnk[u] == -1) {
				rnk[u] = rnk[x] + 1;
				q.push(u);
			}
		}
	}
}

int dp(int i, int w) {
	int& ans = memo[i][w];
	if(ans != -1) return ans;
	ans = 1;
	for (int u : G[i]) {
		if(rnk[u] > rnk[i]) {
			ll temp = w? dp(u, 0) + dp(u, 1) : dp(u, 1);
			temp *= ans;
			ans = temp % MOD; 
		}
	}
	return ans;
}

int main(){
//	cout.setf(ios::fixed);
//	cout.precision(4);
	int n;
	while (cin >> n) {
		G = vvi(n);
		for (int i = 0; i < n - 1; ++i) {
			int x, y;
			cin >> x >> y; x--; y--;
			G[x].push_back(y);
			G[y].push_back(x);
		}
		get_rank();
		memo = vvi(n, vi(2, -1));
		int ans = (dp(0, 1) + dp(0, 0)) % MOD;
		cout << ans << '\n';
	}
}




Measured memory_bytes: 18560
package main

import "fmt"

func main(){
	var N int
	var ans int64
	var L [100]int64

	fmt.Scan(&N)

	L[0] = 2
	L[1] = 1

	for i := 2 ; i <= N ; i++{
		L[i] = L[i-1] + L[i-2]
	}
	/*for i := 0 ; i <= N ; i++ {
		ans += L[i]
	}*/
	ans = L[N]
	fmt.Println(ans)
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
	int n,a,b;cin >> n >> a >> b;
	if(a%2 == b%2){
		cout << (b-a)/2 << endl;
		return 0;
	}
	int ret = 1e18;
	{
		int tmp = a + abs(b-1-a)/2;
		ret = min(tmp,ret);
	}
	{
		int tmp = (n-b)+ 1 + abs(b-a-1)/2;
		ret = min(tmp,ret);
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;

int main(){
    int a,b,c;
    string ans;
    cin >> a >> b;
    if (a%500 <= b) {
        ans = "Yes";
    }else{
        ans = "No";
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.util.function.*;

final class Solver {
	static final Solver INSTANCE = new Solver();

	void solve(Supplier<String> sc) {
		int N = Integer.parseInt(sc.get());
		int K = Integer.parseInt(sc.get());
		var mod = 1000000007;
		long sum = 0;
		var ints = new long[K];
		for (int i = K; i >= 1; i--) {
			int count = 0;
			long minus = 0;
			for (int j = i; j <= K; j+=i) {
				if (j % i != 0) continue;
				count += 1;
				minus = (minus + ints[j - 1]) % mod;
			}
			long pow = (modpow(count, N, mod) - minus) % mod;
			ints[i - 1] = pow = pow < 0 ? pow + mod : pow;
			sum = (sum + ((i * pow) % mod)) % mod;
		}
		System.out.println(sum % mod);
	}

	int gcd(int a, int b) {
	    return b == 0 ? a : gcd(b, a % b);
	}

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

class Main {
	public static void main(String... args) {
		var reader = new BufferedReader(new InputStreamReader(System.in));
		Solver.INSTANCE.solve(new Supplier<>() {
			private StringTokenizer line;

			public String get() {
				try {
					return (line = line != null && line.hasMoreTokens() ? line : new StringTokenizer(reader.readLine())).nextToken();
				} catch (IOException e) {
					throw new UncheckedIOException(e);
				}
			}
		});
	}
}

Measured memory_bytes: 33660
import math

S = input().strip()
Q = int(input().strip())
order = 1
tmp = 'T'

for i in range(Q):
  q = input().strip().split()
  #print(q)
  if q[0] == '1':
    # 反転
    # S = S[::-1]
    order *= -1
  else:
    F = q[1]
    if F == '1':
      if order == 1:
        # 先頭にCを追加
        # S = q[2] + S
        tmp = q[2] + tmp
      else:
        # 末尾にCを追加
        # S = S + q[2]
        tmp = tmp + q[2]
    else:
      if order == 1:
        # 末尾にCを追加
        # S = S + q[2]        
        tmp = tmp + q[2]
      else:
        # 先頭にCを追加
        # S = q[2] + S
        tmp = q[2] + tmp

S = tmp.replace('T', S)        
print(S[::order])

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

int main(){
int a,b,c;
cin >> a >> b >> c;
if(a == b && a != c){
    cout << "Yes" << endl;
    return 0;
    }
if(a ==c && a != b){
    cout << "Yes" << endl;
    return 0;
}
if(b==c && a != b){
    cout << "Yes" << endl;
    return 0;
}
cout << "No" << endl;
return 0;
}

Measured memory_bytes: 256