akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);
const double eps=1e-8;

struct point{
	double x,y;
	point operator+(point Gep){
		return point{x+Gep.x,y+Gep.y};
	}
	point operator-(point Gep){
		return point{x-Gep.x,y-Gep.y};
	}
	point operator*(double Gex){
		return point{x*Gex,y*Gex};
	}
	point operator/(double Gex){
		if(!Gex) return point{0,0}; 
		return point{x/Gex,y/Gex};
	}
	bool operator==(point Gep){
		return fabs(x-Gep.x)<eps&&fabs(y-Gep.y)<eps;
	}
};

class Geom{
	private:
	vector<point> Ge;
	vector<pair<point,point> > Geseg,Geline;
	public:
	void line_push(point Gex,point Gey){
		Geline.push_back(make_pair(Gex,Gey));
	}
	void seg_push(point Gex,point Gey){
		Geseg.push_back(make_pair(Gex,Gey));
	}
	void point_push(point Gex){
		Ge.push_back(Gex);
	}
	point DIP(pair<point,point> Gex,pdd Gey){
		double Gea=Gey.first,Geb=Gey.second;
		point Ge1=Gex.first,Ge2=Gex.second;
		return (Ge1*Geb+Ge2*Gea)/(Gea+Geb);
	}
	point POI(pair<point,point>Gex,pair<point,point> Gey){
		pair<point,point> Ge1(PRO(Gex,Gey.first),PRO(Gex,Gey.second));
		pdd Ger(EXTLEN(Gey.first,Ge1.first),EXTLEN(Gey.second,Ge1.second));
		return DIP(Ge1,Ger);
	}
	double IP(point Gex,point Gey){
		return Gex.x*Gey.x+Gex.y*Gey.y;
	}
	double CP(point Gex,point Gey){
		return Gex.x*Gey.y-Gey.x*Gex.y;
	}
	double LEN(point Gex){
		return sqrt(Gex.x*Gex.x+Gex.y*Gex.y);
	}
	double EXTLEN(point Gex,point Gey){
		return LEN(Gex-Gey);
	}
	point PRO(pair<point,point> Gea,point Gex){
		point Ge1=Gex-Gea.second,Ge2=Gea.first-Gea.second;
		return Ge2*(IP(Ge1,Ge2)/(LEN(Ge2)*LEN(Ge2)))+Gea.second;
	}
	point REF(pair<point,point> Gea,point Gex){
		point Ge1=PRO(Gea,Gex);
		return Ge1*2-Gex;
	}
	int PJUD(point Gea,point Geb,point Gex){
		if(Gea==Geb||Gex==Geb) return 0;
		point Ge1=Gea-Gex,Ge2=Geb-Gex;
		double Getmp=CP(Ge1,Ge2);
		if(Getmp>0) return 1;
		if(Getmp<0) return 2;
		if(IP(Ge1,Ge2)<0) return 3;
		if(LEN(Ge1)<LEN(Ge2)) return 4;
		return 5;
	}
	int LJUD(pair<point,point> Gex,pair<point,point> Gey){
		point Ge1=Gex.first-Gex.second,Ge2=Gey.first-Gey.second;
		if(!CP(Ge1,Ge2)) return 2;
		if(!IP(Ge1,Ge2)) return 1;
		return 0;
	}
	pair<point,point> line_open(int Gex){
		return Geline[Gex];
	}
	point point_open(int Gex){
		return Ge[Gex];
	}
	pair<point,point> seg_open(int Gex){
		return Geseg[Gex];
	}
};

int q;
double x,xx,y,yy,xxx,yyy;

int main(){
	cin>>q;
	for(int i=0;i<q;i++){
		Geom geo;
		for(int j=0;j<2;j++){
			int a,b,c,d;
			cin>>a>>b>>c>>d;
			geo.line_push(point{a,b},point{c,d});
		}
		cout<<geo.LJUD(geo.line_open(0),geo.line_open(1))<<endl;
	}
}

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

signed main(){

  int n,q;
  cin>>n>>q;

  vector<queue<int>> a(n);
  while(q--){
    int com;
    cin>>com;
    if(com==0){
      int t,x;
      cin>>t>>x;
      a[t].push(x);
    }
    if(com==1){
      int t;
      cin>>t;
      if(a[t].empty())continue;
      cout<<a[t].front()<<endl;
    }
    if(com==2){
      int t;
      cin>>t;
      if(a[t].empty())continue;
      a[t].pop();
    }
  }

}


Measured memory_bytes: 4396
a,b,c=map(int,input().split())
if a%2==b%2 and b%2==c%2:
    x=sorted([a,b,c])
    print((x[2]-x[1])//2+(x[2]-x[0])//2)
elif a%2==b%2:
    a+=1
    b+=1
    x=sorted([a,b,c])
    print((x[2]-x[1])//2+(x[2]-x[0])//2+1)
elif b%2==c%2:
    b+=1
    c+=1
    x=sorted([a,b,c])
    print((x[2]-x[1])//2+(x[2]-x[0])//2+1)
else:
    c+=1
    a+=1
    x=sorted([a,b,c])
    print((x[2]-x[1])//2+(x[2]-x[0])//2+1)



Measured memory_bytes: 3064
import java.io.*;
import java.util.*;
public class Main {
    public static void main(String args[]) {
        Scanner in = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int t = 1;//in.nextInt();
        for (int i = 1; i <= t; ++i){
            int x = in.nextInt();
            int y = in.nextInt();
            int z = in.nextInt();
            System.out.println(z+" "+x+" "+y);
        }
    }
}

Measured memory_bytes: 23124
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "iomanip"
#include "random"

using namespace std;

const long long int MOD = 1000000007;
const long double EPS = 0.00000001;
const long double PI = 3.1415926535897932384626433;

long long int N, M, K, H, W, L, R;


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

	cin >> N;
	vector<vector<long long int>>dis(N, vector<long long int>(N, 0));
	vector<vector<long long int>>edge(N, vector<long long int>(N, 1000000000000));
	vector<vector<bool>>flag(N, vector<bool>(N, true));
	bool can = true;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			cin >> dis[i][j];
			if (j < i&&dis[i][j] != dis[j][i]) {
				can = false;
			}
			edge[i][j] = min(edge[i][j], dis[i][j]);
			edge[j][i] = min(edge[j][i], dis[i][j]);
			if (i == j) {
				if (dis[i][j]) {
					can = false;
				}
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			for (int k = 0; k < N; k++) {
				if (i == k || j == k)continue;
				if (edge[i][k] + edge[j][k] <= edge[i][j]) {
					edge[i][j] = edge[i][k] + edge[j][k];
					flag[i][j] = false;
					flag[j][i] = false;
					break;
				}
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			if (!flag[i][j]&&i!=j) {
				edge[i][j] = 1000000000000;
			}
		}
	}
	for (int k = 0; k < N; k++) {
		for (int i = 0; i < N; i++) {
			for (int j = 0; j < N; j++) {
				edge[i][j] = min(edge[i][j], edge[i][k] + edge[k][j]);
			}
		}
	}
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < N; j++) {
			//cout << edge[i][j] << " " << dis[i][j] << endl;
			if (edge[i][j]!= dis[i][j]) {
				can = false;
			}
		}
	}
	if (!can) {
		cout << "-1\n";
		return 0;
	}
	for (int i = 0; i < N; i++) {
		for (int j = i + 1; j < N; j++) {
			if (flag[i][j]) {
				M += edge[i][j];
			}
		}
	}
	cout << M << endl;
	return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);i++)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int a,b,c;
  cin >> a >> b >> c;
  if(a+b==c || b+c==a || c+a==b)cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
 
#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define loop for(;;)
 
struct S002 {
  int n;
  S002& operator > (long& x) {
    n = x;
    return *this;
  }
  S002& operator > (long&& x) {
    n = x;
    return *this;
  }
  S002& operator >= (long& x) {
    if( scanf("%ld", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (double& x) {
    if( scanf("%lf", &x) <= 0 ) exit(0);
    return *this;
  }
  S002& operator >= (std::string& s) {
    if( not (std::cin >> s) ) exit(0);
    return *this;
  }
  template<typename a>
  S002& operator >= (std::vector<a>& v) {
    v.resize(n);
    for(long i = 0; i < n; ++i) {
      *this >= v[i];
    }
    return *this;
  }
  template<typename a, std::size_t s>
  S002& operator >= (std::array<a, s>& x) {
    for(long i = 0; i < (long)s; ++i) {
      *this >= x[i];
    }
    return *this;
  }
};

struct Solver {
  std::array<std::string, 3> xs;
  Solver() {
    S002 r;
    r >= xs;
  }
  void solve() {
    if( xs[1][0] == '+' ) {
      printf("%ld\n", stol(xs[0]) + stol(xs[2]));
    }
    else {
      printf("%ld\n", stol(xs[0]) - stol(xs[2]));
    }
  }
};
 
int main() {
  for(;;) std::unique_ptr<Solver>(new Solver())->solve();
  return 0;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  string s;
  cin >> s;
  map<string, int> m;
  m["SUN"] = 7;
  m["MON"] = 6;
  m["TUE"] = 5;
  m["WED"] = 4;
  m["THU"] = 3;
  m["FRI"] = 2;
  m["SAT"] = 1;
  cout << m[s] << endl;
}

Measured memory_bytes: 256
import java.util.*;
 
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int []a = new int[N];
    for(int i=0;i<N;i++){
      a[i]=sc.nextInt();
    }
    int max=a[0];
    int min=a[0];
    for(int i=0;i<N;i++){
      if(max<a[i]){
        max=a[i];
      }
    }

    for(int i=0;i<N;i++){
      if(min>a[i]){
        min=a[i];
      }
    }
    System.out.println(max-min);
  } 
}

Measured memory_bytes: 21972
import java.util.Scanner;

public class Main {
    static int n = 0;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";

        String a = sc.nextLine();
        if (s.contains(a)) {
            System.out.println("A");
        } else {
            System.out.println("a");
        }

    }
}

Measured memory_bytes: 35692
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
using namespace std;

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

const int inf = 1e9 + 1;
const double eps = 1e-9;
const int MAXN = 1e5 + 1;

int gcd(int a, int b){
    if (!b) return a;
    else return gcd(b, a%b);
}

ll lcm(ll a, ll b){
    return ll(ll(a*b)/ll(gcd(a, b)));
}

int a, b;
string s1, s2;

int main(){

    cin >> a >> b;
    cin >> s1 >> s2;
    ll sol = lcm(a, b);
    int start_gcd = gcd(a, b);
    int temp = start_gcd;
    while (temp > 1){
        a /= temp;
        b /= temp;
        temp = gcd(a, b);
    }

    if (min(a,b) == 1 && a != b){
        cout << -1;
        return 0;
    }

    for (int i = 0; i < start_gcd; i++){
        if (s1[i*a] != s2[i*b]){
            cout << -1;
            return 0;
        }
    }

    cout << sol;

    return 0;

}

Measured memory_bytes: 512
#include<iostream>
using namespace std;
int main()
{
	int a[33]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k;
	scanf("%d",&k);
	printf("%d",a[k-1]);
	return 0;
 } 

Measured memory_bytes: 256
#include<iostream>
#include<string>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
typedef long long ll;

int main(){
    int n;
    cin >> n;
    string s;
    int abclen[26];
    rep(i,26) abclen[i]=100;
    for(int i=0; i<n; i++){
        cin >> s;
        int len = s.length();
        int tmplen[26];
        rep(j,26) tmplen[j] = 0;
        for(int j=0;j<len; j++){
            int tmp=s[j]-'a';
            tmplen[tmp]++;
        }
        for(int j=0; j<26; j++){
            if(tmplen[j]<abclen[j]){
                abclen[j]=tmplen[j];
            }
        }
    }
    for(int i=0; i<26; i++){
        int tmp=abclen[i];
        if(tmp>0){
            int abc = 'a'+i;
            char sub = abc;
            for(int j=0; j<tmp; j++){
                cout << sub;
            }
        }
    }
    cout << endl; 
    return 0;
}

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



int main() { // claudio van
  ll a, b; scanf("%lld %lld", &a, &b);
  ll x = 0;
  if (a != 0) {
    a--;
    ll la = a / 4 * 4;
    for (ll i = la; i <= a; ++i) {
      x ^= i;
    }
  }
  ll lb = b / 4 * 4;
  ll y = 0;
  for (ll i = lb; i <= b; ++i) {
    y ^= i;
  }
  printf("%lld\n", x ^ y);
  return 0;
}

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

int main(){
	int n,m,x,y,i,j;
	int xc[100],yc[100];
	cin>>n>>m>>x>>y;
	for (i=1;i<=n;i++)
		cin>>xc[i];
	for (i=1;i<=m;i++)
		cin>>yc[i];
	sort(xc+1,xc+n+1);
	sort(yc+1,yc+m+1);
	if((xc[n]<yc[1]) &(x<y)&(yc[1]>x)&(xc[n]<y)) cout<<"No War";
	else cout<<"War";
		
}

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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef complex<double> point;
#define xx real()
#define yy imag()

#define REP(i, a, b) for(int i = (a); i < (int)(b); i++)
#define REPN(i, a, b) for(int i = (a); i <= (int)(b); i++)
#define FA(it, x) for(__typeof((x).begin()) it = (x).begin(); it != (x).end(); it++)
#define SZ(x) (int)(x).size()
#define BE(x) (x).begin(), (x).end()
#define SORT(x) sort(BE(x))
#define _1 first
#define _2 second

#define x1 gray_cat_x1
#define y1 gray_cat_y1

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

#define file "I1"

const double EPS = 1e-9;
const double PI = acos(-1.);
const int INF = 1e9;
const ll MOD = 1e9 + 7;

const int MAXN = 2e5 + 5;

ll dp[MAXN];
ll dp_sum[MAXN];

int val[MAXN];

void solve(){
	int n;
	scanf("%d", &n);
	int top = 1;
	REPN(i, 1, n) {
		scanf("%d", &val[top]);
		if (top == 1 || val[top] != val[top - 1]) {
			top++;
		}
	}
	
	/*REP(i, 0, top) {
		printf("%d ", val[i]);
	}
	putchar('\n');*/
	
	dp[0] = 1;
	dp_sum[val[1]] = 1;
	REP(i, 1, top) {
		dp[i] = dp_sum[val[i]];
		dp_sum[val[i + 1]] = (dp_sum[val[i + 1]] + dp[i]) % MOD;
		
		//printf("%d %lld\n", val[i], dp[i]);
	}
	printf("%lld\n", dp[top - 1]);
}   

int main(){

    //freopen(file".in", "r", stdin); freopen(file".out", "w", stdout);
    int t = 1;
    //cin >> t;
    while(t--){
        solve();    
    }
}


Measured memory_bytes: 4096
#include <bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<sstream>

using namespace std;

#define open  freopen("input.txt","r",stdin)
#define close  freopen ("output.txt","w",stdout)
#define db double
#define ll long long
#define llu unsigned long long
#define loop(i,a,n) for(int i=a;i<=n;i++)
#define sf scanf
#define sf1(a) sf("%d",&a)
#define sf2(a,b) sf("%d %d",&a,&b)
#define sf3(a,b,c) sf("%d %d %d",&a,&b,&c)
#define sf4(a,b,c,d) sf("%d %d %d %d",&a,&b,&c,&d)
#define sfd(a) sf("%lf",&a)
#define sfd2(a,b) sf("%lf %lf",&a,&b)
#define sfl1(a) sf("%lld",&a)
#define sfl2(a,b) sf("%lld %lld",&a,&b)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pf printf
#define pfi(x) pf("%d",x)
#define pfl(x) pf("%lld",x)
#define NL puts("")
#define bug pf("here is bug\n")
#define pft(tc) printf("Case %d:",tc++)
#define PI (2.0*acos(0.0))
//#define PI acos(-1.0)
#define mem(a,v) memset(a,v,sizeof a)
#define endl '\n'
#define pb push_back
#define xx first
#define yy second
#define mp make_pair
#define all(a) a.begin(),a.end()


template <class T> inline T bigmod(T p,T e,T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a,T b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
template <class T> inline T lcm(T a,T b)
{
    return (a/gcd(a,b))*b;
}
template <class T> inline T modinverse(T a,T M)
{
    return bigmod(a,M-2,M);
}   // M is prime}
template <class T> inline T bpow(T p,T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}




//int dx[]={1,1,0,-1,-1,-1,0,1};int dy[]={0,1,1,1,0,-1,-1,-1};//8 direction
//int dx[]={2,1,-1,-2,-2,-1,1,2};int dy[]={1,2,2,1,-1,-2,-2,-1};//Knight Direction
//int dx[]={0,1,0,-1};int dy[]={1,0,-1,0}; //4 Direction


#define inf 99999999
#define MX 1000006
#define mod (ll) 1000000007
#define eps 1e-6
#define ub upper_bound // return the right most index of x<val
#define lb lower_bound // return the right most index of x<=val



struct data
{
    int e1,e2,e3;
    data() {}
    data(int a,int b,int c)
    {
        e1=a,e2=b,e3=c;
    }
    bool friend operator<(data a,data b)
    {
        return  a.e1> b.e1;// sort decreasingly but increasingly for priority_queue
    }
};


int n,m,k;
ll N,M,K;

int chk(ll i,ll j)
{
	int c1=0,c2=0;
	while(i){
		c1++;
		i/=10;
	}
	while(j){
		c2++;
		j/=10;
	}
	return max(c1,c2);
}

int main()
{
    int t,tc=1;
	sfl1(N);
	int ans=99999999;
	for(ll i=1;i*i<=N;i++){
		if(N%i==0){
			ans=min(ans,chk(i,N/i));
		}
	}
	pfi(ans);
	NL;
    return 0;
}

/*




*/


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
typedef long long ll;
typedef pair<ll,ll> pr;
typedef vector<ll> vc;
typedef unordered_map<ll,ll> umap;
#define pb emplace_back
#define rep(i,a,b) for(ll i=a;i<=b;i++)
#define repr(i,a,b) for(ll i=a;i>=b;i--)
#define reps(i,v) for(ll i=0;i<v.size();i++)
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
const ll mod = 1e9+7;

int main() {
    // your code goes here
    ll n,m,a,b,c,d;
    cin >> n >> m;
    if(n%2==1){
        a=1; b=n;
        rep(i,1,m){
            cout << a << " " << b << endl;
            a++; b--;
        }
    } else {
        if(n%4==0){
            a=1; b=n/2; c=n/2+1; d=n-1;
        } else {
            a=1; b=n/2-1; c=n/2; d=n-1;
        }
        rep(i,1,m){
            if(i%2==1){
                if(n%4==0){
                    cout << a << " " << b << endl;
                    a++; b--;
                } else {
                    cout << c << " " << d << endl;
                    c++; d--;
                }
            } else {
                if(n%4==2){
                    cout << a << " " << b << endl;
                    a++; b--;
                } else {
                    cout << c << " " << d << endl;
                    c++; d--;
                }
            }
        }
    }
    return 0;
}

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

#define     FasterIO        ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     bug(a,b)        cout<<a<<"\t"<<b<<"\n";
#define     Case(a,b)       cout<<"Case "<<a<<": "<<b<<"\n";
#define     precision(a,b)  fixed<<setprecision(a)<<b
#define     lp(i,a,b)       for(int i=a;i<b;i++)
#define     Endl            "\n"
#define     tab             "\t"
#define     reset(a,b)      memset(a,b,sizeof(a));
#define     sf(a)           scanf(" %d", &a);
#define     sfl(a)          scanf(" %lld", &a);
#define     srt(a)          sort(a.begin(),a.end());
#define     ALL(a)          a.begin(),a.end()
#define     pb(a)           push_back(a)
#define     pi              2*acos(0.0)

typedef long long int ll;
typedef unsigned long long int ull;

const int sz=1e5+9 , infP=INT_MAX , infN=INT_MIN ,mod=1e9+7, eps=1e-9;


void ini(){

    return;
}
ll dp[sz];

void solve(){
    ll n , m, k, l, r, ans=0;
    cin>>n>>k;
    ll a[n];
    for(auto &i:a)cin>>i;
    dp[0]=0;
    for(int i=1;i<n;i++){
        for(int j=i-1,l=1;j>=0 && l<=k;l++,j--){
            if(l==1){
                dp[i]=dp[j]+abs(a[i]-a[j]);
            }else{
                dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
            }
        }
    }

    cout<<dp[n-1]<<Endl;


}

int main(){
    FasterIO;
    #ifndef ONLINE_JUDGE
        freopen("input.in","r",stdin);
        freopen("output.in","w",stdout);
    #endif
    ini();
    int t=1;
    // cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 5136
#include <stdio.h>

int main(){
	int N;
	scanf("%d",&N);
	char S[256],T[256];
    char ans[256];
    for(int i=0;i<256;i++){
        ans[i]='\0';
    }
    for(int i=0;i<256;i++){
        S[i]='\0';
        T[i]='\0';
    }
	scanf("%s %s",S,T);
	
	/*printf("S=%s\n",S);
	printf("T=%s\n",T);*/
	for(int i=0;i<N;i++){
		ans[i*2]=S[i];
		ans[i*2+1]=T[i];
		/*printf("%s\n",ans);*/
	}
	
	printf("%s\n",ans);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void)
{
    long h, w, ans;
    scanf("%ld %ld", &h, &w);

    ans =  h*w/2 + (h%2!=0 && w%2!=0);
    if(h == 1 || w == 1) ans = 1;
    printf("%ld\n", ans);

    return 0;
}

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

#ifdef DEBUG
#define PRINT(x)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#x<<" = "<<(x)<<endl;
#define PRINTA(a,first,last)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<(first)<<", "<<(last)<<")"<<endl;\
    for (int _i=(first);_i<(last);++_i){cout<<#a<<"["<<_i<<"] = "<<(a)[_i]<<endl;}
#define PRINTI(a,i)\
    cout<<"func "<<__func__<<": line "<<__LINE__<<": "<<#a<<"["<<#i<<"] = "<<#a<<"["<<(i)<<"] = "<<(a)[i]<<endl;
#define dprintf(...) printf(__VA_ARGS__)
#else
#define PRINT(x)
#define PRINTA(a,first,last)
#define PRINTI(a,i)
#define dprintf(...)
#endif

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define MOD 1000000007
//#define MOD 998244353

using namespace std;

using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;

template <class T, class U> void amax(T& x, U y) {if (x < y) x = y;}
template <class T, class U> void amin(T& x, U y) {if (x > y) x = y;}

template <class T, class U>
std::ostream& operator<<(std::ostream &os, const std::pair<T, U> &p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}
 
template <class T>
std::ostream& operator<<(std::ostream &os, const std::vector<T> &v) {
    os << "[";
	for (int i = 0; i < v.size(); ++i) {
        if (i) {
            if (i % 5 == 0) {
                os << ",\n ";
            } else {
                os << ", ";
            }
        }
		os << v[i];
	}
	os << "]";
	return os;
}

template <class T>
using vec2 = vector<vector<T>>;

template <class T>
using vec3 = vector<vector<vector<T>>>;

template <class T>
vec2<T> vec2_init(int n0, int n1, T x = 0) {
    return vec2<T>(n0, vector<T>(n1, x));
}

template <class T>
vec3<T> vec3_init(int n0, int n1, int n2, T x = 0) {
    return vec3<T>(n0, vec2_init(n1, n2, x));
}

/*
 *           U P
 *           - x
 *            ^
 *            |
 * LEFT -y <--+--> +y RIGHT
 *            |
 *            v
 *           + x
 *         D O W N
 */

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

enum {
    DOWN,
    RIGHT,
    UP,
    LEFT,
};

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

    int N, X, T;
    cin >> N >> X >> T;
    int result = (N + X - 1) / X * T;
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<algorithm>  
#include<iostream>  
#include<cstdio>  
#include<map>  
#include<set>  
using namespace std;  
string s, t;  
set<string> S;  
  
void Work()  
{  
    int l1 = s.size();  
    int l2 = t.size();  
    for(int i = 0; i < l1; i++)  
    {  
        if(s[i] == '?' || s[i] == t[0])//如果字符相等  
        {  
            string tmp = s;              //构造判断子串之前的字符  
            for(int j = 0; j < i; j++)  
                if(tmp[j] == '?')  
                    tmp[j] ='a';      
            bool can = false;  
            for(int j = 0; j < l2; j++)    //判断是否为子串  
            {  
  
                if(tmp[i+j]!= '?' && tmp[i+j] != t[j])  //字符匹配  
                    break;  
                tmp[i+j] = t[j];  
                if(j == l2- 1) can = true;  
            }  
            if(can)  
            {  
                for(int j = i + l2; j < l1; j++) if(tmp[j] == '?') tmp[j] = 'a';//处理匹配后的字符  
                S.insert(tmp);  //压入容器  
            }  
        }  
    }  
    if(S.size() == 0) cout << "UNRESTORABLE" << endl;  
    else cout << *S.begin() << endl;  
}  
int main()  
{  
    cin >> s >> t;  
    Work();  
}  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<array>
#include <vector>
#include<deque>

int main() {
	int a,b,c;
	std::cin >> a;
	b = a / 111;
	b = b + 1;
	for (int i = 1; i <= 9; i++) {
		if (a == i * 111) {
			b = b - 1;
		}
	}
	c = b * 111;
	std::cout << c << std::endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
struct __INIT{__INIT(){cin.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);}} __init;
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define MOD 1000000007
#define INF (1<<30)
#define LINF (lint)(1LL<<56)
#define endl "\n"
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define Flag(x) (1<<(x))
#define Flagcount(x) __builtin_popcount(x)
#define pint pair<int,int>
#define pdouble pair<double,double>
#define plint pair<lint,lint>
typedef long long lint;
int dx[8]={1,1,0,-1,-1,-1,0,1};
int dy[8]={0,1,1,1,0,-1,-1,-1};

int main(void){
    string N;
    int D;
    cin >> N >> D;
    int L=N.length();
    lint dp[L+1][D][2]={};
    dp[0][0][0]=1;
    rep(i,L) rep(j,D) rep(k,2){
        int digit=N[i]-'0';
        rep(d,10){
            int i2=i+1,j2=j,k2=k;
            if(k==0){
                if(digit<d) continue;
                if(digit>d) k2=1;
            }
            dp[i2][(j2+d)%D][k2]=(dp[i2][(j2+d)%D][k2]+dp[i][j][k])%MOD;
        }
    }
    lint ans=(dp[L][0][0]+dp[L][0][1]-1)%MOD;
    if(ans<0) ans+=MOD;
    cout << ans << endl;
}

Measured memory_bytes: 15872
#include <bits/stdc++.h> 
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define dF(i,a,b) for(int i=a;i>=(b);--i)
#define inf 0x3f3f3f3f
#define infll 0x3f3f3f3f3f3f3f3f
#define pb push_back
#define maxnkp make_pair
#define fi first
#define se second
#define eps 1e-6
using namespace std;
typedef long long ll;
const int mods = 1e9+7;
const int maxn = 2e5+10;
const int N = 1e5+10;
const int E = 1e6+10; 
int n,m;
int a[maxn];
string s,t;

int main(){
	cin>>s>>t;
	cin>>n>>m;
	string tmp;
	cin>>tmp;
	if(tmp==s) n--;
	else m--;
	cout<<n<<" "<<m<<endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main() {
	int a, b;
	bool fi = true;
	while (cin >> a >> b, a || b) {
		if (!fi)cout << endl;
		fi = false;
		bool f = false;
		for (int i = a; i <= b; i++) {
			if (i % 400 == 0) {
				cout << i << endl;
				f = true;
			}
			else if (i % 100 == 0) {
			}
			else if (i % 4 == 0) {
				cout << i << endl;
				f = true;
			}
		}
		if (!f) cout << "NA" << endl;
	}
}


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

int getCost(int a, int b){
    return pow(a-b,2.0);
}

int main()
{
    int N;
    cin >> N;
    int input[N];
    int minCost = 10000*N;

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

    for(int i=-100; i <= 100; i++){
        int cost = 0;
        for(int j=0; j<N; j++){
            cost = cost + getCost(input[j], i);
        }
        if(cost < minCost){
            minCost = cost;
        }
    }
    cout << minCost << endl;
    return 0;
}

Measured memory_bytes: 3596
# include "algorithm"
# include "iostream"
# include "cstdio"
# define LC (x<<1)
# define RC (x<<1|1)

using namespace std;

const int maxm=2e5+10;
const long long Inf=1ll<<50;

int N,M;

struct Segment_Tree{
	int Left;
	int Right;
	long long Max;
	long long Lazy;
	# define Left(x) Tree[x].Left
	# define Right(x) Tree[x].Right
	# define Max(x) Tree[x].Max
	# define Lazy(x) Tree[x].Lazy
}Tree[maxm<<2];

struct line{
	int Left;
	int Right;
	int A;
	# define L(x) Line[x].Left
	# define R(x) Line[x].Right
	# define A(x) Line[x].A
}Line[maxm];

inline bool Comp(line x,line y){
	return x.Right==y.Right?x.Left<y.Left:x.Right<y.Right;
}

inline void Spread(int x){
	if(Lazy(x)){
		Max(LC)+=Lazy(x);
		Max(RC)+=Lazy(x);
		Lazy(LC)+=Lazy(x);
		Lazy(RC)+=Lazy(x);
		Lazy(x)=0;
	}
	return;
}

inline void Update(int x){
	Max(x)=max(Max(LC),Max(RC));
	return;
}

void Build(int x,int l,int r){
	Left(x)=l,Right(x)=r;
	if(l==r){
		return;
	}
	int Mid=l+r>>1;
	Build(LC,l,Mid);
	Build(RC,Mid+1,r);
	return;
}

void Change(int x,int l,int r,long long Data){
	if(l<=Left(x) && r>=Right(x)){
		Lazy(x)+=Data;
		Max(x)+=Data;
		return;
	}
	Spread(x);
	int Mid=(Left(x)+Right(x))>>1;
	if(l<=Mid) Change(LC,l,r,Data);
	if(r>Mid) Change(RC,l,r,Data);
	Update(x);
	return;
}

long long Query(int x,int l,int r){
	if(l<=Left(x) && r>=Right(x)){
		return Max(x);
	}
	Spread(x);
	int Mid=(Left(x)+Right(x))>>1;
	long long Result=-Inf;
	if(l<=Mid) Result=max(Result,Query(LC,l,r));
	if(r>Mid) Result=max(Result,Query(RC,l,r));
	return Result;
}

int main(){
	register int i,k=1;
	scanf("%d%d",&N,&M);
	Build(1,0,N);
	for(i=1;i<=M;i++) scanf("%d%d%d",&L(i),&R(i),&A(i));
	sort(Line+1,Line+1+M,Comp);
	for(i=1;i<=N;i++){
		Change(1,i,i,Query(1,0,i));
		while(R(k)==i && k<=M){
			Change(1,L(k),R(k),A(k));
			k++;
		}
	}
	printf("%lld",Query(1,0,N));
	return 0;
}

Measured memory_bytes: 16640
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>

using namespace std;

double data[10][3];
int n;

const double EPS = 1e-9;
#define EQ(a,b) (abs(a - b) < EPS)

void rotate(double arr[], double rad)
{
	double x, y;
	x = arr[0] * cos(rad) - arr[1] * sin(rad);
	y = arr[0] * sin(rad) + arr[1] * cos(rad);
	arr[0] = x, arr[1] = y;
}

bool checked[10];

int main(void)
{
	while(scanf("%d", &n), n)
	{
		double s = 1, e = 9999;
		for(int i=0;i<n;i++)
		{
			scanf("%lf %lf %lf", data[i], data[i] + 1, data[i] + 2);
			e = min(e, data[i][2]);
		}

		for(int q=0;q<100;q++)
		{
			double mid = (s + e) / 2;
			double r[10];
			for(int i=0;i<n;i++)
			{
				double rad = acos(mid / data[i][2]);
				r[i] = data[i][2] * sin(rad);
			}
			
			bool isAble = false;

			vector <pair<double, double> > cand;
			for(int i=0;i<n;i++) cand.push_back(make_pair(data[i][0], data[i][1]));
			for(int i=0;i<n;i++)
			{
				for(int j=i+1;j<n;j++)
				{
					double dist = hypot(data[i][0] - data[j][0], data[i][1] - data[j][1]);
					if(dist > r[i] + r[j]) continue;
					if(dist + min(r[i], r[j]) < max(r[i], r[j])) continue;
					double rad = acos((r[i] * r[i] + dist * dist - r[j] * r[j]) / 2 / r[i] / dist);
					double dir[2];
					dir[0] = data[j][0] - data[i][0], dir[1] = data[j][1] - data[i][1];
					double temp = hypot(dir[0], dir[1]);
					dir[0] /= temp, dir[1] /= temp;
					double cx = data[i][0] + dir[0] * r[i] * cos(rad);
					double cy = data[i][1] + dir[1] * r[i] * cos(rad);
					rotate(dir, acos(-1.0) / 2);
					cand.push_back(make_pair(cx + dir[0] * r[i] * sin(rad), cy + dir[1] * r[i] * sin(rad)));
					cand.push_back(make_pair(cx - dir[0] * r[i] * sin(rad), cy - dir[1] * r[i] * sin(rad)));
				}
			}

			for(int i=0;i<cand.size();i++)
			{
				memset(checked, 0, sizeof(checked));
				bool flag = true;
				for(int j=0;j<n;j++)
				{
					double dist = hypot(cand[i].first - data[j][0], cand[i].second - data[j][1]);
					if(dist > r[j] && !EQ(dist, r[j])) { flag = false; break; }
				}
				if(flag) { isAble = true; break; }
			}

			if(isAble) s = mid;
			else e = mid;
		}

		printf("%.10lf\n", s);
	}

	return 0;
}

Measured memory_bytes: 1204
#include <iostream>

using namespace std;
int N;

bool check(string W[]) {
    for(int i = 0; i < N; i++ ) {
        for (int j = 0; j < i; j++) {
            if (W[j] == W[i]) {
                return false;
            }
        }


        if (i == N - 1) {
            break;
        }

        if (W[i][W[i].length()-1] != W[i+1][0]) {
            return false;
        }
    }

    return true;
}

int main(void){
    cin >> N;

    string W[N];    
    for(int i = 0; i < N; i++ ) {
        string w;
        cin >> w;
        W[i] = w;
    }

    if(check(W)) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;

}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int a,b; char op = ('+' || '-');
    cin >>a>>op>>b;
    switch(op)
    {
    case '+':
        cout <<a+b;
        break;
    case '-':
        cout <<a-b;
        break;
    }
    return 0;
}


Measured memory_bytes: 256
n = int(input())
a = list(map(int,input().split()))
kabu = 0
m = 1000
for i in range(1,n):
    if a[i] > a[i-1] and kabu == 0:
        kabu = m//a[i-1]
        m -= kabu*a[i-1]
        #print(m,kabu)
        continue
    elif a[i] < a[i-1] and kabu != 0:
        m += kabu*a[i-1]
        kabu = 0
        #print(m,kabu)
        continue
if kabu != 0:
    m += kabu*a[-1]
print(m)

Measured memory_bytes: 61972
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <functional>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cctype>

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

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, int> P;
typedef std::pair<P, int> PP;
struct edge{ int to, time, cost; };
const double esp = 1e-9;
const int infi = (int)1e+9 + 10;
const ll infll = (ll)1e+17 + 10;

int n, q;
int score[(int)1e+7 + 1];
std::vector<int> v;
std::multiset<int> leader;

int main(){
	std::cin >> n >> q;
	rep(i, n)std::cin >> score[i], v.push_back(score[i]);
	std::sort(v.begin(), v.end());
	rep(i, q){
		char que[10];
		int a;
		std::cin >> que >> a;
		if (que[0] == 'A')leader.insert(score[a - 1]);
		else if (que[0] == 'R')leader.erase(leader.lower_bound(score[a - 1]));
		else{
			int ans = -1;
			int l = 0, r = infi;
			while (l != r){
				int m = (l + r) / 2, fail = 0, prev = 0;
				for (std::multiset<int>::iterator it = leader.begin(); it != leader.end(); ++it){
					int pos = std::lower_bound(v.begin(), v.end(), *it - m) - v.begin();
					fail += std::max(pos - prev, 0);
					prev = std::upper_bound(v.begin(), v.end(), *it) - v.begin();
				}
				fail += std::max(n - prev, 0);
				if (fail <= a)ans = m, r = m;
				else l = m + 1;
			}
			if (ans == -1)std::cout << "NA" << std::endl;
			else std::cout << ans << std::endl;
		}
	}
	return 0;
}

Measured memory_bytes: 11120
n,m=map(int,input().split())
ks=[]
for _ in range(m):
	rr=list(map(int,input().split()))
	ks.append(rr)
p=list(map(int,input().split()))
def two(x):
	return "0"*(n-len(bin(x)[2:]))+bin(x)[2:]
ans=0
for i in range(2**n):
	r=two(i)
	f=1
	for j in range(m):
		cnt=0
		for k in range(ks[j][0]):
			if r[ks[j][k+1]-1]=="1":
				cnt+=1
		if cnt%2!=p[j]:
			f=0
			break
	ans+=f
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int n,m;
	cin>>n>>m;
	int arr[200];
	int sum=0;
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
		sum+=arr[i];
	}
	int q;
	if(sum%(4*m)!=0)q=sum/(4*m)+1;
	else q=sum/(4*m);
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(arr[i]>=q)ans++;
	}
	//cout<<s<<endl;
	//cout<<ans<<endl;
	if(ans>=m)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n), b(n);
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];

  ll ans = 0;
  for (int i = n - 1; i >= 0; i--) {
    ans += (a[i] + ans + (b[i] - 1)) / b[i] * b[i] - a[i] - ans;
  }
  cout << ans << endl;
}


Measured memory_bytes: 1920
Q, H, S, D = map(int, input().split())
N = int(input())
ans = 0

while N > 0:
    if N == 1:
        ans += min(4*Q, 2*H, S)
        break
    else:
        M = N//2
        ans += min(8*M*Q, 4*M*H, 2*M*S, M*D)
        N -= 2*M

print(ans)

Measured memory_bytes: 3064
n = int(input())
A = list(map(int,input().split()))
B = A[:]
for i in range(1,n):
    B[i] += B[i-1]
C = B[:]
cnt1 = 0
cnt2 = 0
if B[0]<=0:
    cnt1 += abs(1-B[0])
    cnt2 += 1-B[0]
    B[0] += cnt2
for i in range(1,n):
    if i%2==0:
        if B[i]+cnt2<=0:
            cnt1 += abs(1-B[i]-cnt2)
            cnt2 += 1-B[i]-cnt2
            B[i] += cnt2
    else:
        if B[i]+cnt2>=0:
            cnt1 += abs(-1-B[i]-cnt2)
            cnt2 += -1-B[i]-cnt2
            B[i] += cnt2
cnt3 = 0
cnt4 = 0
if C[0]>=0:
    cnt3 += abs(-1-C[0])
    cnt4 += -1-C[0]
    C[0] += cnt4
for i in range(1,n):
    if i%2==0:
        if C[i]+cnt4>=0:
            cnt3 += abs(-1-C[i]-cnt4)
            cnt4 += -1-C[i]-cnt4
            C[i] += cnt4
    else:
        if C[i]+cnt4<=0:
            cnt3 += abs(1-C[i]-cnt4)
            cnt4 += 1-C[i]-cnt4
            C[i] += cnt4
print(min(cnt1,cnt3))

Measured memory_bytes: 63216
#include <functional>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

template <ll mod> class ModInt {
    ll a;
public:
    constexpr ModInt(const ll a = 0) noexcept : a((a % mod + mod) % mod) {}
    constexpr ll &value() noexcept { return a; }
    constexpr ModInt operator + (const ModInt &rhs) const noexcept { return ModInt(*this) += rhs; }
    constexpr ModInt operator - (const ModInt &rhs) const noexcept { return ModInt(*this) -= rhs; }
    constexpr ModInt operator * (const ModInt &rhs) const noexcept { return ModInt(*this) *= rhs; }
    constexpr ModInt operator / (const ModInt &rhs) const noexcept { return ModInt(*this) /= rhs; }
    constexpr ModInt &operator += (const ModInt &rhs) noexcept {
        a += rhs.a;
        if (a >= mod) a -= mod;
        return *this;
    }
    constexpr ModInt &operator -= (const ModInt &rhs) noexcept {
        a -= rhs.a;
        if (a < mod) a += mod;
        return *this;
    }
    constexpr ModInt &operator *= (const ModInt &rhs) noexcept {
        a = a * rhs.a % mod;
        return *this;
    }
    constexpr ModInt pow(ll t) const noexcept {
        if (t == 0) return 1;
        auto ret = pow(t >> 1);
        ret *= ret;
        if (t & 1) ret *= *this;
        return ret;
    }
    constexpr ModInt inv() const noexcept { return pow(mod - 2); }
    constexpr ModInt operator /=(const ModInt &rhs) { return (*this) *= rhs.inv(); }
    constexpr bool operator == (const ModInt &rhs) const noexcept { return this->a == rhs.a; }
    constexpr bool operator != (const ModInt &rhs) const noexcept { return this->a != rhs.a; }
    friend constexpr ostream &operator << (ostream &os, const ModInt &rhs) noexcept { return os << rhs.a; }
    friend constexpr istream &operator >> (istream &is, ModInt &rhs) {
        is >> rhs.a;
        return is;
    }
};
using mint = ModInt<MOD>;

class Combination {
public:
    vector <mint> fac, inv, fiv;

    Combination(int N) : fac(N + 1), inv(N + 1), fiv(N + 1) {
        fac[0] = inv[0] = fiv[0] = fac[1] = inv[1] = fiv[1] = 1;
        for (ll i = 2; i <= N; i++) {
            fac[i] = fac[i - 1] * i; // n!
            inv[i] = inv[MOD % i] * (MOD - MOD / i); // n^-1
            fiv[i] = fiv[i - 1] * inv[i]; // (n!)^-1
        }
    }

    mint C(ll n, ll k) {
        if (k < 0 || n < k) return 0;
        return fac[n] * fiv[k] * fiv[n - k];
    }
};

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

    int h, w, a, b;
    cin >> h >> w >> a >> b;
    Combination com(h + w);
    mint ans = 0;
    for (int i = b; i < w; i++) {
        ans += com.C(h - a - 1 + i, i) * com.C(a - 1 + w - i - 1, w - i - 1);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 4992
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// #include<ext/pb_ds/tag_and_trait.hpp>
// using namespace __gnu_pbds;
using namespace std;
using ll=long long;
#define double long double
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
// using llset=tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define print(v) cout<<v<<endl
#define printyes cout<<"Yes"<<endl
#define printno cout<<"No"<<endl
#define printYES cout<<"YES"<<endl
#define printNO cout<<"NO"<<endl
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas x,ddatas y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

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

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

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

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

int main(){
  // startupcpp();
  // ll test;cin>>test;while(test--){
  ll i,j,N,H,W,ans;
  cin>>N>>H>>W;
  set<ll> se;
  se.insert(N);
  se.insert(H);
  se.insert(W);
  if(se.size()==2)printyes;
  else printno;
  return 0;
}

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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int N = int.Parse(input[0]);
            int M = int.Parse(input[1]);
            int X = int.Parse(input[2]);
            
            int[] nums = new int[N+1];
            
            input = Console.ReadLine().Split(' ');
            for(int i = 0 ; i < M ; i++)
            {
                int x = int.Parse(input[i]);
                nums[x]++;
            }

            int a = 0;
            int b = 0;
            for(int i = 0 ; i <= X ; i++)
            {
                a += nums[i];
                
            }
            for(int i = X ; i <= N ; i++)
            {
                b += nums[i];
            }
            Console.WriteLine(Math.Min(a,b));
        }
    }
}

Measured memory_bytes: 11092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,ans=0;
    cin>>n;
    if(n%2==1){
        for(int i=1;(n-1)/2>=i;++i)
        ans+=2*i;
    }
    else{
        for(int i=1;n/2>=i;++i)
        ans+=2*i-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3616
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <math.h>
#include <vector>

using namespace std;

int main() {

	unsigned long K;
	unsigned long N = 100;
	int i;

	cin >> K;

	for (i = 0; N < K; i++) {
		N = N + N / 100;
	}

	cout << i;

	return 0;

}

Measured memory_bytes: 3636
n, m = map(int, input().split())
a = [0]*(n+1)

for i in range(m):
        l, r = map(int, input().split())
        a[l-1] += 1
        a[r] -= 1
for i in range(n): a[i+1] += a[i]

print(a.count(m))

Measured memory_bytes: 6900
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<map>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////   
/////////////////////////
int main(){

   
   int n;
   I(n);
   int sum = 0;
   int ar[n+2];
   for(int i = 1;i<=n;i++){
       I(ar[i]);
       sum+= ar[i];
   }
   sort(ar +1, ar+ n + 1);
   sum -= ar[n];
   if(sum > ar[n])cout<<"Yes"<<endl;
   else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;

class Main{

    public static void main(String args[]) throws Exception{
        Main main = new Main();
    }

    public Main(){
        Scanner scanner = new Scanner(System.in);
        int X;
        X = scanner.nextInt();

        if(X==2){
            System.out.println("2");
            return;
        }
        if( (X&1) == 0 ) X++;

        while(!check(X)) X+=2;

        System.out.println(X);
    }

    boolean check(int X){
        int n = 3;
        while(n*n <= X){
            if(X%n==0) return false;
            n+=2;
        }
        return true;
    }
}


Measured memory_bytes: 23508