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

#define DEBUG(x) 			   cout << '>' << #x << ':' << x << endl;
#define D(x)        		   cerr << __LINE__ << ": " << #x << " = " << (x) << '\n'
#define DD(x,y)     		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << '\n'
#define DDD(x,y,z)  		   cerr << __LINE__ << ": " << #x << " = " << x << "   " << #y << " = " << y << "   " << #z << " = " << z << '\n'
#define DBG         		   cerr << __LINE__ << ": Hi" << '\n'
#define fresh                  {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
#define read                   freopen("in.txt","rt",stdin)
#define write                  freopen("out.txt","wt",stdout)
#define PI                     3.1415926535897932384626433832795
#define mems(ds_name,val)      memset(ds_name,val,sizeof(ds_name))
#define ll					   long long



int main()
{
//    write;
    fresh;
//    read;
   int d;cin>>d;
   if(d==25)cout<<"Christmas\n";
   if(d==24)cout<<"Christmas Eve\n";
   if(d==23)cout<<"Christmas Eve Eve\n";
   if(d==22)cout<<"Christmas Eve Eve Eve\n";
}


Measured memory_bytes: 256
fn readline<T: std::str::FromStr>() -> Vec<T> {
    let mut buff = String::new();
    std::io::stdin().read_line(&mut buff).ok();
    buff.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

fn main() {
    let input = readline::<i32>();
    let a = input[0];
    let b = input[1];
    let ans = if a > b {
        "a > b"
    } else if a < b {
        "a < b"
    } else {
        "a == b"
    };
    
    println!("{}", ans)
}


Measured memory_bytes: 5028
#include <cstdio>
#include <cassert>
#include <algorithm>
using namespace std;
#define ll long long

#define md 1000000007
#define mx 200005
int arr[mx];

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

    for(int i=0;i<n;i++){
        scanf("%d",arr+i);
    }

    sort(arr,arr+n,[](int a, int b){return abs(a)>abs(b);});

    bool solved=false;

    int fks=1;
    for(int i=0;i<k;i++){
        if(arr[i]<0) fks*=-1;
        if(arr[i]==0) fks*=0;
    }

    if(fks==1){
        solved=true;
        ll prod=1;
        for(int i=0;i<k;i++) prod=(prod*arr[i])%md;
        printf("%lld\n", prod);
    }
    else if(fks==0){
        solved=true;
        printf("0\n");
    }
    else{
        int last_neg=1,last_pos=-1,fst_neg=1,fst_pos=-1;
        int lpidx,lnidx;

        for(int i=0;i<k;i++){
            if(arr[i]>0) {last_pos=arr[i]; lpidx=i;}
            if(arr[i]<0) {last_neg=arr[i]; lnidx=i;}
        }
        for(int i=n-1;i>=k;i--){
            if(arr[i]>0) fst_pos=arr[i];
            if(arr[i]<0) fst_neg=arr[i];
        }

        ll prod1=-1,prod2=-1;
        if(last_neg<0 && fst_pos>0){
            solved=true;
            prod1=fst_pos;
            for(int i=0;i<k;i++) if(i!=lnidx) prod1=(prod1*arr[i])%md;
            assert(prod1>=0);
        }
        if(fst_neg<0 && last_pos>0){
            solved=true;
            prod2=fst_neg;
            for(int i=0;i<k;i++) if(i!=lpidx) prod2=(prod2*arr[i])%md;
            assert(prod2>=0);
        }

        if(prod1>=0 and prod2>=0){
            if(fst_pos*(ll)last_pos > fst_neg*(ll)last_neg){
                printf("%lld\n",prod1);
            }
            else{
                printf("%lld\n",prod2);
            }
        }
        else if(solved){
            printf("%lld\n",max(prod1,prod2));
        }
    }

    if(!solved){
        if(arr[n-1]==0){
            solved=true;
            printf("0\n");
        }
        else{
            solved=true;
            ll prod=1;
            for(int i=0;i<k;i++) prod=(prod*arr[n-1-i])%md;
            if(prod<0) prod=prod+md;
            printf("%lld\n",prod);
        }
    }
}


Measured memory_bytes: 2488
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

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

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		for(;;){
			int n=sc.nextInt();
			int m=sc.nextInt();
			int k=sc.nextInt();
			if((n|m|k)==0){
				break;
			}
			solve(n, m, k);
		}
	}

	void test(){
		int m=4;
		int[] a=new int[m*3+1];
		for(int i=1; i<=m; i++){
			// a[i]++;
			for(int j=1; j<=m; j++){
				// a[i+j]++;
				for(int k=1; k<=m; k++){
					a[i+j+k]++;
				}
			}
		}
		for(int i=0; i<a.length; i++){
			debug(i, a[i]);
		}
	}

	void solve(int n, int m, int cut){
		int[] a=new int[n*m+2];
		int[] b=new int[n*m+2];
		for(int i=1; i<=m; i++){
			a[i]=1;
		}
		for(int j=1; j<n; j++){
			System.arraycopy(a, 0, b, 0, n*m+1);
			Arrays.fill(a, 0);
			for(int i=1; i<=m; i++){
				for(int k=j;; k++){
					if(b[k]==0){
						break;
					}
					a[i+k]+=b[k];
				}
			}
		}

		double sum=Math.pow(m, n);
		double ans=0;
		for(int i=0; i<a.length; i++){
			int bill=Math.max(1, i-cut);
			ans+=a[i]*bill/sum;
		}
		println(ans+"");
	}

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

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

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


using namespace std;

typedef long long int llint;
#define abs absolute

struct node
{
    llint x, y, id;
};

struct edge
{
    llint start, end, weight;
};

inline llint absolute (llint a)
{
    return (a > 0) ? a : (- a);
}

inline bool x_asc (node a, node b)
{
    return (a.x < b.x);
}

inline bool y_asc (node a, node b)
{
    return (a.y < b.y);
}

inline bool weight_asc (edge a, edge b)
{
    return (a.weight < b.weight);
}

inline llint ancestor_recursive_search (vector <llint>& parent, llint id)
{
    if (parent[id] != id) parent[id] = ancestor_recursive_search(parent, parent[id]);
    return parent[id];
}

int main(int argc, char const *argv[])
{
    llint length; cin >> length;
    vector <node> city (length);
    for (llint i = 0 ; i <= length - 1 ; i++)
    {
        cin >> city[i].x >> city[i].y; city[i].id = i;
    };
    // cout << "Cities: " << endl;
    // for (node i : city) cout << i.x << " " << i.y << " - id = " << i.id << endl;
    sort (city.begin(), city.end(), x_asc);
    vector <edge> roads;
    for (llint i = 0 ; i <= length - 2 ; i++)
    {
        edge tmp;
        tmp.start = city[i].id; tmp.end = city[i + 1].id;
        tmp.weight = abs(city[i].x - city[i + 1].x);
        roads.push_back(tmp);
    };
    sort (city.begin(), city.end(), y_asc);
    for (llint i = 0 ; i <= length - 2 ; i++)
    {
        edge tmp;
        tmp.start = city[i].id; tmp.end = city[i + 1].id;
        tmp.weight = abs(city[i].y - city[i + 1].y);
        roads.push_back(tmp);
    };

    vector <llint> parent (length);
    for (llint i = 0 ; i <= length - 1 ; i++) parent[i] = i;
    sort(roads.begin(), roads.end(), weight_asc);

    // start MST computation

    llint out = 0;
    for (edge i : roads)
    {   
        // find both vertices' ancestor(s)
        llint start_vertex_ancestor = ancestor_recursive_search(parent, i.start), end_vertex_ancestor = ancestor_recursive_search(parent, i.end);

        // if they're not identical
        // then add to MST
        if (start_vertex_ancestor != end_vertex_ancestor)
        {
            // add to total weight
            out += i.weight;
            // and rewrite parent record
            parent[end_vertex_ancestor] = start_vertex_ancestor;
        }
    };

    cout << out;
}

Measured memory_bytes: 10864
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sys/time.h>
#include <cmath>
#include <tuple>
#include <queue>
#include <bitset>

using namespace std;

string s;
string ns;

void solve(string S, string T) {
    s = T;
    int ans = 0;
    while (s.size() <= S.size()) {
        bool flag = false;
        int i = 0;
        for (char c : S) {
            if (s[i] == c) {
                i++;
                if (i >= s.size()) {
                    flag = true;
                    break;
                }
            }
        }
        if (flag == false) {
            std::cout << ans << std::endl;
            return;
        }
        ans++;
        ns = "";
        if((T.size()+1)*s.size() + T.size() > S.size()){
            break;
        }
        for (int i = 0; i < T.size(); i++) {
            ns += s;
            ns.push_back(T[i]);
        }
        ns += s;
        s = ns;
    }
    std::cout << ans << std::endl;
    return;
}

int main() {

    string S, T;

    std::cin >> S >> T;
    solve(S, T);

    return 0;
}



Measured memory_bytes: 3392
#include <stdio.h>
int main(void){
 // Your code here!
 int n,i,a[1000];
 scanf("%d",&n);
 for(i=1; i<=n; i++){
 scanf("%d",&a[i]);
 }
 for(i=n ; i>=1 ; i--){
 printf("%d",a[i]);
 
 if(i==1) break;
 printf(" ");
 }
 printf("\n");
 return 0;
}


Measured memory_bytes: 2112
#include <algorithm>
#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
  string S; cin >> S;
  sort(S.begin(), S.end());

  cout << ((S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) ? "Yes" : "No") << endl;
  
  return 0;
}


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

int main(void)
{
	string str;
	
	while (getline(cin, str)){
		if (str == "END OF INPUT") return 0;
		string res;
		int len = str.size(), word = 0;
		
		for (int i = 0; i < len; i++){
			if (str[i] != ' '){
				word++;
			}
			else {
				res += word + '0';
				word = 0;
			}
		}
		if (str[len - 1] != ' ') res += word + '0';
		
		cout << res << endl;
	}
	
	return (0);
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
bool T=false;
void solve(){
    vector<long long> A(3);
    for (int i = 0; i < 3; i++)
    {
        cin>>A[i];
    }
    bool T=false;
    sort(A.begin(),A.end());
    if(A[0]==A[1]&&A[1]!=A[2])T=true;
    reverse(A.begin(),A.end());
    if(A[0]==A[1]&&A[1]!=A[2])T=true;
    if(T)cout<<"Yes";
    else cout<<"No";
}

int main(){
    solve();
    cout<<endl;
}

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

using namespace std;

typedef long long int lli;

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

    vector<vector<int>> edge(10000000, vector<int>());
    vector<int> indeg(10000000, 0);
    int n, a;

    cin >> n;
    for (int i=1; i<=n; i++) {
        int s, t;
        for (int j=0; j<n-1; j++) {
            cin >> a;

            t = min(i, a)*10000 + max(i, a);
            if (j != 0) {
                edge[s].push_back(t);
                indeg[t]++;
            }
            s = t;
        }
    }

    queue<int> qu;
    for (int i=1; i<=n; i++) {
        for (int j=i+1; j<=n; j++) {
            if (indeg[i*10000+j] == 0) qu.push(i*10000+j);
        }
    }

    int day = 1, match = 0;
    vector<int> used(1001, 0), zero(1001, 0);
    while (!qu.empty()) {
        int tmp = qu.front(); qu.pop();
        int x = tmp/10000, y = tmp%10000;

        // cout << tmp << endl;

        for (auto v : edge[tmp]) {
            // cout << v << " " << indeg[v] << endl;
            if (--indeg[v] == 0) qu.push(v);
        }

        if (used[x] || used[y]) {
            day++;
            used = zero;
        }

        used[x] = used[y] = 1;
        match++;
    }

    cout << ((match == n*(n-1)/2) ? day : -1) << endl;

    return 0;
}


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

int main() {
    int A, B, C, X;
    cin >> A >> B >> C >> X;
    int count;
    for(int i = 0; i <= A; i++) {
        for(int j = 0; j <= B; j++) {
            for(int k = 0; k <= C; k++) {
                if(X == 500 * i + 100 * j + 50 * k) count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}

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

using namespace std;

int main()
{
    int N, K;
    scanf("%d %d", &N, &K);
    int *x = new int[N];
    for (int i = 0; i < N; i++) {
        scanf("%d", x + i);
    }
    int res = INT_MAX;
    //if (K == 0) res = 0;
    //else res = INT_MAX;
    for (int i = 0; i <= N - K; i++) {
        int s = *(x+i);
        int e = *(x+i+K-1);
        if ( (s <= 0 && e <= 0) || (s >= 0 && e >= 0)) {
            res = min(res, max(abs(s), abs(e)));
        }
        else {
            res = min(res, min(2 * e - s, - 2 * s + e));
        }
        //cout << res << endl;
    }
    cout << res << endl;
    return 0;
}

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

const ll INF = 1001001001;

const double PI=3.141592653;

const ll sosu = 1000000007;//大きい素数

//提出のときに言語がc＋＋似合っていることを確認する

//絶対値の関数
int z(int a,int b){
  if(a>b) return a-b;
  else return b-a;
}

int main(){
  string s;
  cin>>s;
  
  for(int i=0;i<3;i++){
    cout<<s.at(i);
  }
  cout<<endl;
}


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

#define F first 
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 110, M = 1010, INF = 0x3f3f3f3f;

int n, m;
int f[N][N];
struct Edge
{
	int a, b, c;
}e[M];

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= n; i ++ )
		for (int j = 1; j <= n; j ++ )
			if (i == j) f[i][j] = 0;
			else f[i][j] = INF;
			
	for (int i = 0; i < m; i ++ )
	{
		int a, b, c;
		cin >> a >> b >> c;
		e[i] = {a, b, c};
		f[a][b] = f[b][a] = min(f[a][b], c);
	}
	
	for (int k = 1; k <= n; k ++ )
		for (int i = 1; i <= n; i ++ )
			for (int j = 1; j <= n; j ++ )
				f[i][j] = min(f[i][j], f[i][k] + f[k][j]);
				
	int res = 0;
	for (int i = 0; i < m; i ++ )
		if (e[i].c != f[e[i].a][e[i].b])
			res ++ ;
			
	cout << res << endl;
    return 0;
}

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

#define ull unsigned long long
#define ll long long
#define ld long double
#define endl << "\n"
#define sp << " "
#define spp << " " <<
#define allv(v) v.begin(),v.end()
#define lmax 9223372036854775807
#define lmin -9223372036854775807
#define lopi() for(i=0;i<n;++i)
#define loi(a,b) for(i=a;i<b;++i)
#define lopj() for(j=0;j<n;++j)
#define loj(a,b) for(j=a;j<b;++j)
#define ft first
#define sd second
#define pb push_back
#define pf push_pront
#define mod 1000000007
#define lower(str) transform(str.begin(), str.end(), str.begin(), ::tolower);
#define upper(str) transform(str.begin(), str.end(), str.begin(), ::toupper);
#define mset(a,b) memset(a,b,sizeof(a))
#define crap ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define PI acos(-1)

int main(){
//	crap ;
    int timer;
    // cin >>timer;
    timer=1 ;
    while(timer--){
    	ll n,m,i,j,k,a,b ;
    	n=5;
    	ll ans=0;
    	for(i=1;i<=n;++i){
    		cin >>j ;
    		if( j == 0 )
    			ans = i; 
    	}
    	cout << ans endl ;
    }
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define si(X) scanf("%d", &(X))
#define sll(X) scanf("%lld",&(X))
#define INFL 0x3f3f3f3f3f3f3f3fLL
ll gcd(ll a,ll b){
	if(b==0)
	return a;
	return gcd(b,a%b);
}
string toBin(ll a) {
	string res = "";
	while (a) {
		res += char((a & 1) + '0');
		a >>= 1;
	}
	reverse(res.begin(), res.end());
	return res;
}
const int mod = 1e16+7;
ll expo(ll base,ll pow){
    ll ans = 1;
    while(pow!=0){
        if(pow&1==1){
            ans = ans*base;
            ans = ans%mod;
        }
        base *= base;
        base%=mod;
        pow/=2;
    }
    return ans;
}
ll inv(ll x){
    return expo(x,mod-2);
}
bool isPal(string ss){
    int len = ss.length();
    for(int i = 0 ; i<len/2 ; i++){
	int comp = len-i-1;
	if(ss[i]!=ss[comp])
		return false;
	}
    return true;
}
double pi = 3.141592653589793238462643;
double error = 0.0000001;
/* -------Template ends here-------- */

const int M = 100001;
ll ans = 0;
ll vv(string str){
    //cout<<str<<endl;
    ll mul = expo(10 , (str.length() - 1));
    ll ans = 0;
    for(int i = 0 ; i<str.length() ; i++){
        ans += (str[i]-'0')*mul;
        //cout<<i<<"  "<<mul<<"  "<<ans<<endl;
        mul/=10;
    }
    return ans;
}
set<string> se;
ll cal(string str){
    ll res = 0;
    if(str[0] == '+')
        str = str.substr(1);
    string tot = "";
    if(se.count(str))
        return 0;
    se.insert(str);
    //cout<<str<<endl;
    for(int i = 0 ; i<str.length() ; i++){
        if(str[i] == '+'){
            res += vv(tot);
            tot = "";
        }
        else{
            tot+=str[i];
        }
    }
    res += vv(tot);
    //cout<<res<<endl;
    return res;

}
string val;
void rec(string str , int pos){
    if(pos == val.length()){

        ans += cal(str);
        //cout<<"here "<<str<<"  "<<cal(str)<<"   "<<ans<<endl;
        return;
    }

    rec(str+"+"+val[pos] , pos+1);
    rec(str+val[pos] , pos+1);
}

int main(){
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "wt", stdout);



    cin>>val;
    string t = "";
    t+=val[0];
    rec(t , 1);


    cout<<ans;












}














Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const long long md=1e9+7;
long long n,m,cc[3005],a[3005],dp[3005][3005];
char s[3005];
int main()
{
	scanf("%lld%lld%s",&n,&m,s+1);
	for(long long i=1;i<=n;a[i]=i,i++)cc[i]=cc[i-1]+(s[i]-'0');
	for(long long i=1,l,r;i<=m;i++)
	{
		scanf("%lld%lld",&l,&r);
		for(long long j=l;j<=r;j++)a[j]=max(a[j],r);
	}
	dp[0][0]=1;
	for(long long i=1;i<=n;i++)
	{
		for(long long j=0;j<=i;j++)
		{
			if(j>cc[a[i]])continue;
			if(i-j>a[i]-cc[a[i]])continue;
			dp[i][j]=dp[i-1][j];
			if(j)dp[i][j]=(dp[i][j]+dp[i-1][j-1])%md;
		}
	}
	printf("%lld\n",dp[n][cc[n]]);
	return 0;
}

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

#define all(x) x.begin(), x.end()
#define input() *istream_iterator<int>(cin)

int n, m;
vector<int> A, B;

int main() {
    scanf("%d %d", &n, &m);
    A.emplace_back(input());
    B.emplace_back(input());
    for(int i = 0; i < n; ++i) A.emplace_back(input());
    for(int i = 0; i < m; ++i) B.emplace_back(input());
    puts(*max_element(all(A)) >= * min_element(all(B)) ? "War" : "No War");
}

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

using namespace std;

#define Rep(i,a,b)  for (int i=(a);i<(b);i++)
#define rep(i,n)    for (int i=0;i<(n);i++)
#define all(x)      (x).begin(), (x).end()

#define ll long long

int main()
{
	// input
	int n;
	cin >> n;
	map<int, int> mv1, mv2;
	rep (i, n / 2) {
		int v1, v2;
		cin >> v1 >> v2;
		mv1[v1]++;
		mv2[v2]++;
	}
	// map to vector
	using pii = pair<int, int>;
	vector<pii> vp1, vp2;
	copy(all(mv1), back_inserter<vector<pii>>(vp1));
	copy(all(mv2), back_inserter<vector<pii>>(vp2));
	auto comp = [](const pii& l, const pii& r) {
			return l.second > r.second;
		};
	// vector sort greater
	sort(all(vp1), comp);
	sort(all(vp2), comp);
	// result
	if (mv1.size() == 1 && mv2.size() == 1 && vp1[0].first == vp2[0].first)
		cout << n / 2 << endl;
	else if (vp1[0].first != vp2[0].first)
		cout << n - vp1[0].second - vp2[0].second << endl;
	else
		cout << n - max(vp1[0].second + vp2[1].second, vp1[1].second + vp2[0].second) << endl;
}



Measured memory_bytes: 6136
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <tuple>
#include <cassert>

using namespace std;

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define mp(a,b) make_pair((a), (b))
#define mt(a,b,c) make_tuple((a),(b),(c))

typedef long long ll;

#define INF 1e+9
#define MAX_V 10005

struct edge {
    int to;
    int cost;
};

// <最短距離, 頂点の番号>
using P = pair<int, int>;

int V;
vector<edge> G[MAX_V];
int d[MAX_V];

void dijkstra(int s) {
    priority_queue<P, vector<P>, greater<P> > que;
    fill(d, d+V, INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
        P p = que.top();
        que.pop();
        int v = p.second;
        if (d[v] < p.first) continue;

        for (int i=0; i<G[v].size(); ++i) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(P(d[e.to], e.to));
            }
        }
    }
}


int main(){
    int h,w;
    cin >> h >> w;
    V = h * w + 2;
    vector<string> s(h);
    rep(i,h) cin >> s[i];
    rep(i,h) rep(j,w){
        if(i<h-1){
            if(s[i][j]<=s[i+1][j]) G[w*i+j].push_back({w*(i+1)+j, 0});
            else  G[w*i+j].push_back({w*(i+1)+j, 1});
        }
        if(j<w-1){
            if(s[i][j]<=s[i][j+1]) G[w*i+j].push_back({w*i+j+1, 0});
            else  G[w*i+j].push_back({w*i+j+1, 1});
        }
    }
    if(s[0][0]=='#') G[V-2].push_back({0, 1});
    else G[V-2].push_back({0, 0});

    if(s[h-1][w-1]=='#') G[V-3].push_back({V-1,0});
    else G[V-3].push_back({V-1, 0});
    dijkstra(V-2);
    cout << d[V-3] << endl;
    return 0;
}

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

#define REP(i, n, N) for(ll i=(n); i<(N); i++)
#define RREP(i, n, N) for(ll i=(N-1); i>=(n); i--)
#define LREP(lst,itr) for(auto itr = lst.begin(); itr != lst.end(); ++itr)
#define CK(n, a, b) ((a)<=(n)&&(n)<(b))
#define ALL(v) (v).begin(),(v).end()
#define MCP(a, b) memcpy(b,a,sizeof(b))
#define P(s) cout<<(s)<<endl
#define P2(a, b) cout<<(a)<<" "<<(b)<<endl
#define V2(T) vector<vector<T>>
typedef long long ll;
using namespace std;
const ll MOD = 1e9 + 7;
const ll INF = 1e18;

int main(){
    int sx,sy,tx,ty,diff_x,diff_y;
    cin >> sx >> sy >> tx >> ty;
    diff_x=abs(tx-sx);
    diff_y=abs(ty-sy);
    REP(i,0,diff_y)cout<<"U";
    REP(i,0,diff_x)cout<<"R";
    REP(i,0,diff_y)cout<<"D";
    REP(i,0,diff_x+1)cout<<"L";
    REP(i,0,diff_y+1)cout<<"U";
    REP(i,0,diff_x+1)cout<<"R";
    cout<<"DR";
    REP(i,0,diff_y+1)cout<<"D";
    REP(i,0,diff_x+1)cout<<"L";
    cout<<"U"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, a, b, c, d, e;

int main(){
	cin >> n >> a >> b >> c >> d >> e;
	ll neck = min(min(a, b), min(c, min(d, e)));
	ll ans = n/neck+4;
	if(n%neck != 0){ans++;}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
// this is a test submission for debugging a helper tool
//#include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define forr(i,m,n) for (int i=(m); i<=(n); i++)

#define MAXN 100000
int main() {
  int n;
  int a[MAXN];
  int h[MAXN];
  cin >> n;
  forr(i,0,n-1)
    cin >> h[i];
  a[0] = 0;
  a[1] = abs(h[1] - h[0]);
  forr(i,2,n-1) {
    a[i] =
     min(a[i-1] + abs(h[i] - h[i-1]), a[i-2] + abs(h[i] - h[i-2]));
  }
  cout << a[n-1] << endl;

}


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

using namespace std;

int main(){
	int n;
	cin>>n;
	
	vector<int> a(n);
	for(int i=0;i<n;i++)
		cin>>a[i];
	
	int mn=a[0],mx=a[0];
	for(int i=1;i<n;i++){
		if(mn>a[i])
			mn=a[i];
		if(mx<a[i])
			mx=a[i];
	}
	
	cout<<mx-mn<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
long infi = 99999999;
int main()
{
    int N;
    cin >> N;
    vector<int> P(N);
    rep(i, N) cin >> P.at(i);
    int min = P.at(0);//今までの最低
    int cnt = 1;
    for (int i = 0; i < N;i++)
    {
        if(P.at(i)<min){
            cnt++;
            min = P.at(i);
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(a, b) for (a = 0; a < b; a++)

int main(){
  
  int N, i;
  cin >> N;
  int A[N];
  
  rep(i, N){
    cin >> A[i];
  }
  
  rep(i, N){
    
    if ((A[i] % 2 == 0) && !(A[i] % 3 == 0) && !(A[i] % 5 == 0)){
      cout << "DENIED" << endl;
      return 0;
    }
  }
  cout << "APPROVED" << endl;
}

Measured memory_bytes: 256
N, K, Q = map(int, input().split())

score_1 = [K-Q for i in range(N)]
for i in range(Q):
    num1 = int(input())
    score_1[num1-1] = score_1[num1-1]+1

for i in range(len(score_1)):
    if(score_1[i]>0):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 7892
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 25;
string s;
long long int par[maxn] , ans;
int main(){
	cin >> s;
	if (s[0] == 'W') par[0] = 1;
	for (int i = 1; i < s.size(); i++){
		par[i] = par[i - 1];
		if (s[i] == 'W'){
			par[i]+= 1;
		}
	}
	for (int i = 0; i < s.size(); i++){
		if (s[i] == 'B'){
			ans += par[s.size() - 1] - par[i];
		}
	}
	cout << ans;
}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n)　for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    y /= gcd(x,y);
    return (x*y);
}

int main()
{
    ll n,max=0,min=M;
    cin >> n;
    vll d(n);
    rep(i,n){
        cin >> d[i];
        if(min >= d[i])min = d[i];
        if(max <= d[i])max = d[i];
    }
    cout << max-min << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define int long long
using namespace std;

typedef pair<int, int> Pii;

template<typename T>
void readvec(vector<T> &a);
void readindex(vector<int> &a);



signed main(){

    int M;
    cin >> M;
    cout << 24 + 24 - M;
    
    return 0;
}


template<typename T>
void readvec(vector<T> &a){
    REP(i, a.size()){
        cin >> a[i];
    }
}
void readindex(vector<int> &a){
    REP(i, a.size()){
        cin >> a[i];
        a[i]--;
    }
}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>

using namespace std;

typedef long long ll;
const ll mod=1e9+7;
const ll MAXN=1e5+10;
const ll INF=0x7fffffff;

int main()
{
	int n;
	cin>>n;
	if(n%10==9||n/10==9){
		cout<<"Yes"<<endl; 
	}
	else cout<<"No"<<endl;
	return 0;
}	 


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	k := make([]int, m)
	s := make([][]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&k[i])
		s[i] = make([]int, k[i])
		for j := 0; j < k[i]; j++ {
			fmt.Scan(&s[i][j])
			s[i][j]--
		}
	}
	p := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&p[i])
	}

	ans := 0
L:
	for i := 0; i < (1 << uint(n)); i++ {
		for j := 0; j < m; j++ {
			c := 0
			for _, v := range s[j] {
				if (i>>uint(v))&1 == 1 {
					c++
				}
			}
			c %= 2
			if c != p[j] {
				continue L
			}
		}
		ans++
	}
	fmt.Println(ans)
}


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

ll mod = 1e9+7;
#define NMAX 300010
ll fac[NMAX];
ll inv[NMAX];

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

ll mod_inv(ll a, ll mod){
    return mod_pow(a, mod-2, mod);
}

void mae_nck(){
    fac[1] = 1;
    inv[1] = 1;
    for(ll i = 2; i < NMAX; i++){
        fac[i] = (fac[i-1] * i)%mod;
        inv[i] = (inv[i-1] * mod_inv(i, mod))%mod;
    }
}

ll mod_nck(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    if(k == 0 || k == n) return 1;

    ll f = 1;
    rep(i, n-k+1, n+1){
        f = (f*(i%mod))%mod;
    }
    ll ret = ((f*inv[k])%mod)%mod;
    return ret;
}

int main(){
    ll n, a, b;
    cin >> n >> a >> b;
    mae_nck();
    ll ans = mod_pow(2,n,mod)-1;
    cerr << ans << endl;
    ans -= mod_nck(n,a);
    cerr << ans << endl;
    ans -= mod_nck(n,b);
    cerr << ans << endl;
    ans %= mod;
    if(ans < 0) ans += mod;
    cout << ans%mod << endl;
    return 0;
}

Measured memory_bytes: 4992
#include<stdio.h>
#include<map>
#include<algorithm>
#include<string.h>
#include<vector>
#include<math.h>
#include<stdlib.h>
#include<set>
#include<ctype.h>
using namespace std;

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

const int MM = 1000000007;
const int MX = 105;

short T[MX][MX][MX][MX];
int cnt[MX][MX];
char D[MX][MX];

int get_area(int sx, int sy, int ex, int ey){
	if( sx <= ex && sy <= ey ) return cnt[ex][ey] - cnt[ex][sy-1] - cnt[sx-1][ey] + cnt[sx-1][sy-1];
	else return 0;
}

int main()
{
	int H, W;
	auto *S = T[0], *E = T[1];
	scanf("%d%d", &H, &W);
	for(int i = 1; i <= H; i++) scanf("%s", D[i]+1);

	int x, y;
	for(int i = 1; i <= H; i++){
		for(int j = 1; j <= W; j++){
			if( D[i][j] == 'E' ) x = i, y = j;
			cnt[i][j] = cnt[i-1][j] + cnt[i][j-1] - cnt[i-1][j-1] + (D[i][j] == 'o');
		}
	}
	int ans = 0;
	for(int a = 0; a <= H; a++){
		for(int c = 0; a+c <= H; c++){
			for(int b = 0; b <= W; b++){
				for(int d = 0; b+d <= W; d++){
					if( a ){
						int sx = x + a, ex = x + a;
						int sy = max(b+1, y-d), ey = min(W-d, y+b);
						T[a][b][c][d] = max((int)T[a][b][c][d], T[a-1][b][c][d] + (a+1 <= x+a && x+a <= H-c? get_area(sx, sy, ex, ey) : 0));
					}
					if( c ){
						int sx = x - c, ex = x - c;
						int sy = max(b+1, y-d), ey = min(W-d, y+b);
						T[a][b][c][d] = max((int)T[a][b][c][d], T[a][b][c-1][d] + (a+1 <= x-c && x-c <= H-c? get_area(sx, sy, ex, ey) : 0));
					}
					if( b ){
						int sx = max(a+1, x-c), ex = min(H-c, x+a);
						int sy = y + b, ey = y + b;
						T[a][b][c][d] = max((int)T[a][b][c][d], T[a][b-1][c][d] + (b+1 <= y+b && y+b <= W-d? get_area(sx, sy, ex, ey) : 0));
					}
					if( d ){
						int sx = max(a+1, x-c), ex = min(H-c, x+a);
						int sy = y - d, ey = y - d;
//						printf("%d %d %d %d : %d %d %d %d\n", a, b, c, d, sx, sy, ex, ey);
						T[a][b][c][d] = max((int)T[a][b][c][d], T[a][b][c][d-1] + (b+1 <= y-d && y-d <= W-d? get_area(sx, sy, ex, ey) : 0));
					}
					ans = max(ans, (int)T[a][b][c][d]);
				}
			}
		}
	}
	printf("%d\n", ans);
}


Measured memory_bytes: 229504
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if((b-a)==(c-b)) puts("YES");
    else puts("NO");
    return 0;
}


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

class Program
{
    static void Main(string[] args)
    {
        int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = nums[0];
        int l = nums[1];

        int minAbs = int.MaxValue;
        for (int i = 0; i < n; i++)
        {
            minAbs = Math.Min(Math.Abs(l+i), minAbs);
        }

        int sum = 0;
        for (int i = 0; i < n; i++)
        {
            if(Math.Abs(l+i) != minAbs)
            {
                sum += l + i;
            }
        }

        Console.WriteLine(sum);
    }
}


Measured memory_bytes: 13268
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iostream>
#include <iostream>
#include <fstream>
#include <numeric>
#include <cstring>
#include <cassert>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <cmath>
#include <set>
#include <map>
#include <functional>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
using namespace std;
#define     loop(n,i,a)     for(int i=a;i<n;i++)
#define     loopR(n,i,a)    for(int i=n-1;i>=a;i--)
#define     all(arr,n)      arr,arr+n
#define     allv(v)         (v).begin(),(v).end()
#define     rallv(v)        (v).rbegin(),(v).rend()
#define     m_p             make_pair
#define     ll              long long
#define     pii             pair<ll,ll>
#define     vi              vector<int>
#define     vll             vector<ll>
#define     vii             vector<pair<ll,ll>>
#define     sz(x)           (int)x.size()
#define     pb              push_back
#define     endl            "\n"
#define     Endl            "\n"
#define     f               first
#define     s               second
#define     mem(dp,n)       memset(dp,n,sizeof dp)
int dx[] = { 1 , 0 ,-1 , 0 ,-1 ,-1 , 1 , 1 };
int dy[] = { 0 , 1 , 0 ,-1 ,-1 , 1 ,-1 , 1 };
void fast(){
    std::ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
}
vector<string> vec_splitter(string s) {
    s += ',';
    vector<string> res;
    while(!s.empty()) {
        res.push_back(s.substr(0, s.find(',')));
        s = s.substr(s.find(',') + 1);
    }
    return res;
}
void debug_out(
        vector<string> __attribute__ ((unused)) args,
        __attribute__ ((unused)) int idx,
        __attribute__ ((unused)) int LINE_NUM) { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(vector<string> args, int idx, int LINE_NUM, Head H, Tail... T) {
    if(idx > 0) cerr << ", "; else cerr << "Line(" << LINE_NUM << ") ";
    stringstream ss; ss << H;
    cerr << args[idx] << " = " << ss.str();
    debug_out(args, idx + 1, LINE_NUM, T...);
}
#define debug(...) debug_out(vec_splitter(#__VA_ARGS__), 0, __LINE__, __VA_ARGS__)
const ll mxN=2e6+10,oo=0x3f3f3f3f,MOD=998244353;
const double PI = acos(-1);

void solve(){
    string s,t;
    cin>>s>>t;
    int res=0;
    loop(sz(s),i,0)
        res+=(s[i]!=t[i]);
    cout<<res<<Endl;
}
int main() {
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    fast();
    solve();
}

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

int main() {
    string s;
    cin >> s;
    int n = s.size();

    int running = 0;
    for (int i = 0; i < n; ++i) {
        int d = s[i] - '0';
        running = (running + d) % 9;
    }
    cout << (running ? "No" : "Yes") << endl;
}


Measured memory_bytes: 3720
#include<stdio.h>
#include<string.h>
#include<math.h>

int main(){
	int tc;
	char x [10];
	int ac=0,wa=0,tle=0,re=0;
	scanf("%d",&tc);
	while(tc--){
		scanf("%s",&x);
		if(strcmp(x, "AC") ==0) ac++;
		else if (strcmp(x, "WA") ==0) wa++;
		else if (strcmp(x, "TLE") ==0) tle++;
		else if (strcmp(x, "RE") ==0) re++;
	}
	printf("AC x %d\n",ac);
	printf("WA x %d\n",wa);
	printf("TLE x %d\n",tle);
	printf("RE x %d\n",re);
	return 0;
}

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

int main()
{
  int a,s;
  cin >> a>>s ;
   if(a==1&&s!=1)
     cout << "Alice" << endl;
     else if(a!=1&&s==1)
       cout << "Bob" << endl;
   else if(a<s)
     cout << "Bob"<< endl;
     else if(a>s)
       cout << "Alice" << endl;
       else
         cout << "Draw" << endl;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5, INF = 0x3f3f3f3f;
inline int read() {
	int x = 0, f = 0; char ch = 0;
	while (!isdigit(ch)) f |= ch == '-', ch = getchar();
	while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return f ? -x : x;
}
int main() {
	string s; cin >> s;
	for (int i = 0; i < s.size(); i += 2) {
		if (s[i] != 'h' || s[i + 1] != 'i') {
			puts("No"); return 0;
		}
	} 
	puts("Yes");
	return 0;
}


Measured memory_bytes: 256
n = int(input())
B = list(map(int, input().split()))

A = [0]*n
A[0] = B[0]
A[n-1] = B[n-2]

if n >= 3:
    for i in range(1, n-1):
        A[i] = min(B[i], B[i-1])

print(sum(A))


Measured memory_bytes: 9184
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
using namespace std;
 
#define f first
#define s second
 
#define pb push_back
#define pp pop_back
#define mp make_pair
 
#define sz(x) (int)x.size()
#define sqr(x) ((x) * 1ll * (x))
#define all(x) x.begin(), x.end()
#define clr(a,v) memset(a, v, sizeof(a))
 
#define rep(i, l, r) for (int i = (l); i <= (r); i++)
#define per(i, l, r) for (int i = (l); i >= (r); i--)
#define reflex ios_base::sync_with_stdio(false)
 
#define nl '\n'
#define ioi exit(0);
 
 
#define PI 3.14159265
 
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
 
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int N= (int)2e5 + 7;
const int inf = (int)1e9 + 7;
const int mod = (int)1e9 + 7;
//const int mod = 1000000007;
const ll linf = (ll)1e18 + 7;
const ll limit = 2e9;

const int dx[] = {-1, 0, 1, 0, 1, -1, -1, 1};
const int dy[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int kx[] = {-1,1,2,2,1,-1,-2,-2};
const int ky[] = {2,2,1,-1,-2,-2,-1,1};
 
//const int mod = 998244353;
 
struct dsu{
	int parent[N];
	int cont;
	void make_set(int n){
		for(int i = 1; i <= n; i++)
			parent[i] = i;
		cont = n;
	}
	
	int find_set(int v){
		if(v == parent[v])
			return v;
		return find_set(parent[v]);
	}
	
	void union_sets(int a, int b){
		a = find_set(a);
		b = find_set(b);	
		if(a != b){
			parent[b] = a;
			cont--;
		}
	}	
};


    
int main(){
	string s; cin>> s;
	int n = s.size();
	string ans = "";
	for(int i = 0; i<n; i++)
		ans += 'x';
	cout<<ans;
	
	return 0;
}













Measured memory_bytes: 256
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use {
    proconio::{marker::*, *},
    std::{cmp::*, collections::*, mem::*},
};
fn main() {
    input! {//
        a:i64,
    }
    println!("{}", a * (1 + a * (1 + a)));
}


Measured memory_bytes: 2164
#define _USE_MATH_DEFINES
#include<iostream>
#include<string>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<random>
#include<functional>
#include<algorithm>
#include<stack>
#include<cstdio>
#include<cstring>
#include<bitset>
#include<unordered_map>
#include<climits>
#include<fstream>
#include<time.h>
#include<cassert>
#include<functional>
#include<numeric>
#include <tuple>

using namespace std;
#define ll long long
#define ld long double
#define int long long
#define all(a) (a).begin(),(a).end()
#define EPS (1e-13)
#define fs first
#define sc second
#define xx first
#define yy second.first
#define zz second.second
#define H pair<int, int>
#define P pair<int, pair<int, int>>
#define Q(i,j,k) mkp(i,mkp(j,k))
#define rep(i,n) for(int (i) = 0 ; (i) < (n) ; (i)++)
#define mkp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define crdcomp(b) sort(all((b)));(b).erase(unique(all((b))),(b).end())
#define ssp(i,n) (i==n-1?"\n":" ")
#define pb push_back
const int mod = 1e9 + 7;
const int Mod = 998244353;
const ll Inf = 3 * 1e18;
const int inf = 15 * 1e8;
ll read() {
	ll u, k = scanf("%lld", &u);
	return u;
}
ll gcd(ll i, ll j) {
	if (i > j) swap(i, j);
	if (i == 0) return j;
	return gcd(j % i, i);
}
ll mod_pow(ll x, ll n, ll p) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = res * x % p;
		x = x * x % p;
		n >>= 1;
	}
	return res;
}
ll bitcount(ll x) {
	int sum = 0;
	for (int i = 0; i < 60; i++)
		if ((1ll << i) & x) sum++;
	return sum;
}
/*const int fn_ = 2000000;
ll fact_[fn_], comp_[fn_];
ll comb(ll x, ll y, ll Mod = mod) {
	if (!fact_[0]) {
		fact_[0] = 1; comp_[0] = 1;
		for (int i = 1; i < fn_; i++) {
			fact_[i] = fact_[i - 1] * i % Mod;
			comp_[i] = mod_pow(fact_[i], Mod - 2, Mod);
		}
	}
	if (x < y) return 0;
	return fact_[x] * comp_[x - y] % Mod * comp_[y] % Mod;
}*/
//---------------------------------------------------

signed main() {
	int x;
	cin >> x;
	for (int i = x;; i++) {
		for (int j = 2; j * j <= i; j++) {
			if (i % j == 0) {
				goto loop;
			}
		}
		cout << i << endl;
		return 0;
	loop:;
	}
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
#include <typeinfo>

#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REP1(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREP1(i, x) for (int i = ((int)(x)); i > 0; i--)
//#define YES(ans) ans?cout<<"YES":cout<<"NO"

/*
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

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

using namespace std;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, m;
    int X, Y;
    cin >> n >> m >> X >> Y;
    int x[200];
    int y[200];
    REP(i, n)
    {
        cin >> x[i];
    }
    REP(i, m)
    {
        cin >> y[i];
    }
    sort(x, x + n);
    sort(y, y + m);
    if (max(X, x[n - 1]) < min(Y, y[0]))
        cout << "No War";
    else
        cout << "War";
}

Measured memory_bytes: 256
using System;    
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] AElem  = Console.ReadLine().Split(' ');
            List<int> A = new List<int>();
 
            for (int i = 0; i < N; i++)
            {
                A.Add(int.Parse(AElem[i]));
            }
 
            A.Sort();
 
            int min = A[0];
            int max = A[N - 1];
 
            int ans = max - min;
 
            Console.WriteLine(ans);
 
            return;
        }
    }

Measured memory_bytes: 11220
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <map>
#include <tuple>

#define INF 100100100100
#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;
using namespace std;

 
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    
    ll ans = 0;
    if(a+b+1 >= c){
        ans = b+c;
    }
    else{
        ans = a+b+1+b;
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define test int t; cin>>t; while(t--)
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back

typedef long long ll;
using namespace std;
int main()
{


            int n,k;
            cin>>n>>k;
            int a[n];
            for(int i=0;i<n;i++)
                cin>>a[i];
            for(int i=k,j=0;i<n;i++,j++)
                if(a[i]>a[j])
                cout<<"Yes"<<endl;
            else
                cout<<"No"<<endl;


return 0;

}


Measured memory_bytes: 4380
#include <bits/stdc++.h>
using namespace std;
    int main(){
        // Your code here!
        int N, K;
            cin >> N >> K;
                int x = 1;
                    int P = K;
        for(int i=0; 1;i=i++){
            if(N >= P){
                x += 1;
                P *= K;
            }else{
                cout << x;
                    return 0;
            }
        }
    return 0;}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
const double PI = 3.141592653589793238;
const double EPS = 1e-10;
ll W[50];
int V[50];
int C[50];
ll m[50];
vector<int> child[50];
ll dp[125001];
bool cmp(int L, int R) {
	return V[L] * W[R] > V[R] * W[L];
}
void dfs(int v) {
	V[v] = 1;
	W[v] = m[v];
	for (int c : child[v]) {
		dfs(c);
		V[v] += V[c];
		W[v] += W[c];
	}
}
int main() {
	int N;
	ll X, D;
	cin >> N >> X >> D;
	cin >> m[0];
	for (int i = 1; i < N; i++) {
		int p;
		cin >> m[i] >> p;
		p--;
		child[p].push_back(i);
	}
	dfs(0);
	C[0] = 50;
	for (int i = 1; i < N; i++) C[i] = min(50LL, D);
	vector<int> vec(N);
	for (int i = 0; i < N; i++) vec[i] = i;
	sort(vec.begin(), vec.end(), cmp);
	fill(dp, dp + 125001, 1LL << 60);
	dp[0] = 0;
	for (int i = 0; i < N; i++) {
		int num = C[i];
		for (int k = 1; num > 0; k <<= 1) {
			int mul = min(k, num);
			for (int j = 125000; j >= V[i] * mul; j--) {
				dp[j] = min(dp[j], dp[j - V[i] * mul] + W[i] * mul);
			}
			num -= mul;
		}
	}
	ll ans = 0;
	for (int i = 0; i <= 125000; i++) {
		if (dp[i] > X) continue;
		ll ret = i;
		ll T = X - dp[i];
		for (int j = 0; j < N; j++) {
			ll k;
			if (vec[j] == 0) k = T / W[vec[j]];
			else k = min(T / W[vec[j]], D - C[vec[j]]);
			T -= k * W[vec[j]];
			ret += k * V[vec[j]];
		}
		ans = max(ans, ret);
	}
	cout << ans << endl;
}

Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <fstream>
#include <algorithm>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <map>
#include <stack>
#include <set>
#define INF 0x3f3f3f3f
const int MOD=1e9+7;
const double eps=1e-8;
typedef long long ll;
//orz yht
using namespace std;
ll n;
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
    cin>>n;
    for(int i=sqrt(n);i>=1;i--){
    	if(n%i==0){
    		cout<<i+n/i-2;
    		return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 256
//============================================================================
// 
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

//============================================================================
#define PI 3.14159265359
#define succ(x) ((x)+1)
#define pred(x) ((x)-1)
//============================================================================
void enter()
{
    long a,b; char op[2];

    while(1){
        scanf("%ld", &a);
        scanf("%s", op);
        scanf("%ld", &b);
        switch(*op){
            case '+': a+=b; break;
            case '-': a-=b; break;
            case '*': a*=b; break;
            case '/': a/=b; break;
            default: return;
        }
        printf("%ld\n", a);
    }
}
//============================================================================
int main(void)
{
    enter();
    return 0;
}
//============================================================================

Measured memory_bytes: 600
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * The Shortest Path on A Rhombic Path - Accepted
 */
public class Main {

	public static int MAX = 100;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int[][] dp = new int[MAX][MAX];

		int prevLen = 0, maxLen = 0;
		while ((line = br.readLine()) != null && !line.isEmpty()) {

			String[] words = line.split(",");

			if (words.length > prevLen) {
				for (int i = 0, r = words.length - 1, c = 0; i < words.length; i++, r--, c++) {
					dp[r][c] = parseInt(words[i]);
				}
			} else {
				for (int i = 0, r = maxLen - 1, c = maxLen - words.length; i < words.length; i++, r--, c++) {
					dp[r][c] = parseInt(words[i]);
				}
			}
			prevLen = words.length;
			maxLen = Math.max(maxLen, words.length);
		} // end while

		for (int i = 1; i < maxLen; i++) dp[0][i] += dp[0][i - 1];
		for (int i = 1; i < maxLen; i++) dp[i][0] += dp[i - 1][0];

		for (int i = 1; i < maxLen; i++) {
			for (int j = 1; j < maxLen; j++) {
				dp[i][j] += Math.max(dp[i][j - 1], dp[i - 1][j]);
			}
		}
		System.out.println(dp[maxLen - 1][maxLen - 1]);
	} // end main
}

Measured memory_bytes: 24964