akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
 
int main()
{
    int q1, b, c1, c2, q2;
 
    while (scanf("%d", &q1), q1) {
	scanf("%d %d %d %d" ,&b ,&c1 ,&c2 ,&q2);
 
	int cnt1 = b / c1;
	if (cnt1 > q2) {
	    cnt1 = q2;
	}
	b -= cnt1 * c1;
 
	int cnt2 = b / c2;
	if (cnt2 < 0) {
	    cnt2 = 0;
	}
	b -= cnt2 * c2;
 
	while (true) {
	    if (cnt1 + cnt2 >= q1 || cnt1 <= 0) {     
		break;  
	    } 
	    cnt1--;
	    b += c1;
 
	    b += cnt2 * c2;
	    cnt2 = b / c2;
	    b -= cnt2 * c2;
	}
 
	if (cnt1 <= 0) {
	    puts("NA");
	} else {
	    printf("%d %d\n" ,cnt1 ,cnt2);
	}
    }
    return 0;
}

Measured memory_bytes: 2684
#include<stdio.h>
int main()
{
    int k,a,b,s;
    scanf("%d %d %d",&k,&a,&b);
    if(a%k==0) printf("OK\n");
    else {
        s=a/k +1;
        if((k*s)<=b)
        {
            printf("OK\n");
        }
        else printf("NG\n");
    }

}


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




void solve()
{
       
       int n;  
       cin >> n ;
      // double p[n];
       
      vector< double > dp(n+1,0);
       //double memo[n+1][n+1]; 
       
       // probality of getting 
       dp[0] = 1; 
       
       for(int i = 1 ; i <= n ; i ++)
       {
            double p_head ; cin >> p_head;
            double p_tail = 1.0 - p_head; 

            for(int j = i ; j >= 0  ; j --)
            {
            	dp[j] = ( ( j == 0 ) ? 0 : dp[j-1] * p_head ) + dp[j] * p_tail;
            }

       }
    
    
      
      
       int k = n/2 + 1 ;

       double res = 0 ;

       for(int i = k ; i <= n ; i ++)
       	   res += dp[i];

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


}

int main()
{

	 //ios_base::sync_with_stdio(false);
	 //cin.tie(NULL);

	 int test = 0, t = 1;
	 if(test) cin >> t;
	 for(int i = 0 ; i < t ; i ++)
	 {
         solve(); 
	 }

	return 0;
}


Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <list>

#define mp make_pair
#define pb push_back

using namespace std;

typedef pair<int, int> pii;

const int MAXN = 1000;
const int inf = 1e9;
const long double eps = 1e-8;
const int Q = 1e9 + 7;

void add(map<int, int> &m, int x) {
    if (m.find(x) != m.end())
        m[x]++;
    else
        m.insert(mp(x, 1));
}

void remove(map<int, int> &m, int x) {
    if (m.find(x) != m.end()) {
        m[x]--;
        if (m[x] == 0)
            m.erase(x);
    }
}

int a[MAXN][MAXN];

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

    /*int n;
    cin >> n;
    vector<int> a(n);
    map<int, int> m;

    for (int i = 0; i < n; i++) {
        cin >> a[i];
        add(m, a[i]);
    }

    for (int i = 0; i < n; i++) {
        remove(m, a[i]);
        if (a[i] != m.size()) {
            cout << "No";
            return 0;
        }
        add(m, a[i]);
    }

    cout << "Yes";*/

    int n, m, h, w;
    cin >> n >> m >> h >> w;

    long long sum = 0;
    int p = inf / (h * w);

    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++) {
            if ((i + 1) % h == 0 && (j + 1) % w == 0)
                a[i][j] = (-p) * (h * w - 1) - 1;
            else
                a[i][j] = p;
            sum += a[i][j];
        }

    if (sum > 0) {
        cout << "Yes\n";
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++)
                cout << a[i][j] << " ";
            cout << "\n";
        }
    } else {
        cout << "No";
    }

    return 0;
}

Measured memory_bytes: 4736
#include<bits/stdc++.h>
#define endl  "\n"
#define ll long long
#define PI acos(-1.0)
#define test cout<<"\n****\n"
#define precise fixed(cout);cout<<setprecision(12)
#define fast  ios_base :: sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using  namespace  std;


int main(){

    int x;
    cin>>x;

    if(x==0){
        cout<<"1\n";
    } else{
        cout<<"0\n";
    }


    return 0;
}


Measured memory_bytes: 3620
H, W = gets.split.map(&:to_i)
as = readlines.map{|l| l.split.map(&:to_i)}

ans = []
i, j, d = 0, 0, 1
loop do
  i1, j1 = i, j + d
  i1, j1, d = i1 + 1, W - 1, -d if j1 == W
  i1, j1, d = i1 + 1, 0, -d if j1 == -1
  break if i1 == H
  if as[i][j].odd?
    as[i][j] -= 1
    as[i1][j1] += 1
    ans << [i + 1, j + 1, i1 + 1, j1 + 1]
  end
  i, j = i1, j1
end
puts ans.size
ans.each{|l| puts l.join(' ')}

Measured memory_bytes: 30332
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
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; 
}
vll tt(2*100000+1);
ll solve(ll n){
  if(n==0) return 0;
  ll cu=__builtin_popcount(n);
  return solve(n%cu)+1;
}
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll n;
  cin>>n;
  string t;
  cin>>t;
  ll cu=0;
  rep(i,sz(t)){
    if(t[i]=='1') cu++;
  }
  ll a=max(1LL,cu-1);
  ll b=min(n,cu+1);
  vll ta(n);
  vll tb(n);
  ll cua=0;
  ll cub=0;
  ll cuaa=1;
  ll cubb=1;
  rep(i,n){
      ta[i]=cuaa%a;
      tb[i]=cubb%b;
    cuaa*=2;
    cubb*=2;
    cuaa%=a;
    cubb%=b;
  }
  reverse(all(t));
  ll aa=0;
  ll bb=0;
  rep(i,n){
    if(t[i]=='1'){
      aa+=ta[i];
      aa%=a;
      bb+=tb[i];
      bb%=b;
    }
  }
  cua=aa;
  cub=bb;
  for(int i=n-1;i>=0;i--){
    if(t[i]=='1'){
      if(cu==1){
        COUT(0);
        continue;
      }
      cua-=ta[i];
      if(cua<0){
        cua+=a;
      }
      COUT(solve(cua)+1);
      cua=aa;
      
    }
    else{
      cub+=tb[i];
      cub%=b;
      COUT(solve(cub)+1);
      cub=bb;
    }
  }
}

Measured memory_bytes: 8384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int t[] = new int[n + 1];
		int x[] = new int[n + 1];
		int y[] = new int[n + 1];

		t[0] = 0;
		x[0] = 0;
		y[0] = 0;
		String ans = "Yes";
		int jik, xky, yky, sou, a;
		for (int i = 1; i <= n; i++) {
			t[i] = sc.nextInt();
			x[i] = sc.nextInt();
			y[i] = sc.nextInt();
			jik = t[i] - t[i - 1];// jikの移動回数で
			xky = Math.abs(x[i] - x[i - 1]);// x移動距離
			yky = Math.abs(y[i] - y[i - 1]);// y移動距離
			sou = yky + xky;
			if (sou > jik) {
				ans = "No";
			} else {// sou<=jik
				a = jik - sou;
				if (a % 2 != 0) {
					ans = "No";
				}
			}

		}
		System.out.println(ans);

	}
}

Measured memory_bytes: 91488
def main():
    from fractions import gcd
    from functools import reduce

    def cal(a, b):
        t = a * b // gcd(a, b)
        return t

    n, *t = map(int, open(0).read().split())
    ans = reduce(cal, t)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 5716
arr = gets.chomp.split.map{|x| x.to_i}
cnt_7 = 0
cnt_5 = 0

arr.length.times do |i|
  if arr[i] == 5
    cnt_5 += 1
  elsif arr[i] == 7
    cnt_7 += 1
  end
end

if cnt_5 == 2 && cnt_7 == 1
  puts 'YES'
else
  puts 'NO'
end



Measured memory_bytes: 1788
// Problem : B - Count Balls
// Contest : AtCoder Beginner Contest 158
// URL : https://atcoder.jp/contests/abc158/tasks/abc158_b
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using namespace std;

int main()
{
	unsigned long long n,a,b;
	cin>>n>>a>>b;
	cout << a * (n/(a+b)) + min(a, n%(a+b));
    return 0;
}

Measured memory_bytes: 256
#include <numeric>
#include <iostream>
using namespace std;
int main() {
    int n; cin >> n;
    string s; cin >> s;
    bool dp[3][1000] = {};
    for (char c : s) {
        int d = c - '0';
        for (int i = 0; i < 100; i++) if (dp[1][i]) dp[2][10*i+d] = true;
        for (int i = 0; i < 10; i++) if (dp[0][i]) dp[1][10*i+d] = true;
        dp[0][d] = true;
    }
    cout << accumulate(dp[2], dp[2]+1000, 0) << endl;
}


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

# define ll long long 

ll maxAbsValExpr(vector<ll>& x, vector<ll>& y) {
        ll res = 0, n = x.size(), smallest, cur;
        for (ll p : {1, -1}) {
            for (ll q : {1, -1}) {
                smallest = p * x[0] + q * y[0] ;
                for (ll i = 1; i < n; ++i) {
                    cur = p * x[i] + q * y[i] ;
                    res = max(res, cur - smallest);
                    smallest = min(smallest, cur);
                }
            }
        }
        return res;
    }


int main() {

  ll n;
  cin>>n;
  vector<ll> x(n);
  vector<ll> y(n);

  for(ll i=0;i<n;i++)
  {
    cin>>x[i]>>y[i];
  }

 cout<<maxAbsValExpr(x,y)<<endl;
    
}

Measured memory_bytes: 6420
#include <iostream>
#include <vector>
#include <utility>
#include <limits.h>
#include <algorithm>
using namespace std;
 
int N,K;
int main(){
	cin >> N >> K;
	vector<int> X(N,0),Y(N,0);
	vector<int> x,y;
	for(int i=0;i<N;i++){
		cin >> X[i] >> Y[i];
		x.push_back(X[i]);
		y.push_back(Y[i]);
	}
	sort(x.begin(),x.end());
	sort(y.begin(),y.end());
	long long ans = 1LL*(x[N-1]-x[0])*(y[N-1]-y[0]);
	for(int xi=0;xi<N;xi++){
		for(int xj=xi+1;xj<N;xj++){
			for(int yi=0;yi<N;yi++){
				for(int yj=yi+1;yj<N;yj++){
					int num = 0;
					long long lx = x[xi],rx = x[xj];
					long long by = y[yi],uy = y[yj];
					for(int i=0;i<N;i++){
						if(lx<=X[i] && X[i]<=rx && by<=Y[i] && Y[i]<=uy) num++;
					}
					if(num>=K) ans = min(ans,1LL*(rx-lx)*(uy-by));
				}
			}
		}
	}
	cout << ans << endl;
}

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

typedef long long ll;
const int maxn=18;
const int maxm=150;
const int mod=1e9+7;
int a[maxn][maxn];
int dp[(1<<16)+10];
int n, m;

bool check(int x){ return  ((x&3)==3) || ((x&3)==0) ; }

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

int out[maxn];
ll pw[maxm];

void init(){
	for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) if(a[i][j]) out[i] |= (1<<(j-1));
	pw[0]=1;
	for(int i=1;i<=m;i++) pw[i]=pw[i-1]*2%mod;
}

int main(){

	scanf("%d%d", &n, &m);
	int x, y;
	for(int i=1;i<=m;i++){
		scanf("%d%d", &x, &y);
		a[x][y]=1;
	}
	init();
	dp[0]=1;
	for(int i=1;i<(1<<n);i++)if(check(i)){
		for(int s=i;s;s=(s-1)&i)if(check(s)){
			int t=i^s, cnt=0, c=1;
			for(int j=1;j<=n;j++) if(s & (1<<(j-1))) cnt+=__builtin_popcount(out[j]&t);
			for(int j=1;j<=n;j++) if(t & (1<<(j-1))) c=c*(pw[ __builtin_popcount(out[j]&s) ]-1)%mod;
			add(dp[i], pw[cnt]*dp[t]%mod*c%mod);
		}
	}
	printf("%lld\n", (pw[m]-dp[(1<<n)-1]+mod)%mod);
	return 0;
}

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

int main(){
  int N;
  cin >> N;
  vector<string> data(N);
  for(int i=0; i<N; i++){
    cin >> data.at(i);
  }
  sort(data.begin(),data.end());
  int sum = 1;
  for(int i=0; i < N-1; i++){
    if(data.at(i) != data.at(i+1)){
      sum++;
    }
  }
 cout << sum << endl;
}

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

#define F first
#define S second

using namespace std;
typedef long double ld;
typedef long long ll;

const int max_n = 100011, inf = 1000111222;
const ll inff = 1000111222333444;

string s;
ll n, dp[max_n][13];

int get_mod(int mod, int new_d) {
    return (mod * 10 + new_d) % 13;
}

const int mod = 1000000007;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    cin >> s;
    n = s.length();
    if (s[0] == '?') {
        for (int i = 0; i < 10; ++i) dp[0][get_mod(0, i)] += 1;
    } else {
        dp[0][s[0] - '0'] = 1;
    }
    for (int i = 1; i < n; ++i) {
        for (int w = 0; w < 13; ++w) {
            if (s[i] == '?') {
                for (int q = 0; q < 10; ++q) {
                    dp[i][get_mod(w, q)] += dp[i - 1][w];
                }
            } else {
                dp[i][get_mod(w, s[i] - '0')] += dp[i - 1][w];
            }
        }
        for (int w = 0; w < 13; ++w) {
            dp[i][w] %= mod;
        }
    }
    cout << dp[n - 1][5] << endl;
    return 0;
}


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

int main() {
  int n;
  cin >>n;
  vector<long long>a(n+2);
  vector<long long>b(n+2);
  b[0]=0;
  a[0]=0;
  b[n+1]=0;
  a[n+1]=0;
  for(int i=1;i<n+2;i++){
    cin>>a[i];
  }
  long long sum=0;
  for(int i=1;i<n+2;i++){
    b[i]=a[i]-a[i-1];
    sum+=abs(b[i]);
  }
  long long tobasu=0;
  long long tasu=0;
  for(int i=1;i<=n;i++){
    tobasu=abs(b[i])+abs(b[i+1]);
    tasu=abs(a[i+1]-a[i-1]);
    cout<<sum-tobasu+tasu<<endl;
  }
  return 0;
}

  
  

Measured memory_bytes: 2816
#include <bits/stdc++.h>
using namespace std;
#define MAX 100000

int main() {
    char S[MAX];
    int s0=0,s1=0;

    scanf("%s", S);

    for (int i = 0; S[i] != '\0' ; ++i) {
        if((i%2==0) && (S[i] != '0')){
            s0++;
        } else if ((i%2==1) && (S[i] != '1')){
            s0++;
        }
        if((i%2==0) && (S[i] != '1')){
            s1++;
        } else if ((i%2==1) && (S[i] != '0')){
            s1++;
        }
    }
    cout << min(s0, s1) << endl;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{

string n ; 
cin >> n;

for (char c:n) {
    if (c=='1'){
        cout << 9 ;
    }
        else {
            cout << 1 ;
        }
    
}

return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,ans=0;
    long long a[4]={25,10,5,1};
    cin>>n;
    for(int i=0;i<4;i++){
        ans+=n/a[i];
        n=n%a[i];
        if(n==0){
            break;
        }
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 3120
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
#define ll long long

const int INF = 1e9;
const long long LLINF = 1e18;

using namespace std;

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

/*==================================================*/
/*variable*/

/*==================================================*/
/*function*/

/*==================================================*/

int main() {

    int a, b;
    cin>>a>>b;

    if(a % 2 == 1 & b % 2 == 1){
        cout<<"Odd"<<endl;
    }else{
        cout<<"Even"<<endl;
    }

    return 0;
}


Measured memory_bytes: 256
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        // mazu input
        int n = sc.nextInt();
        int q = sc.nextInt();
        String s = sc.next();
        String[] choice = new String[q];
        String[] lORr = new String[q];
        for (int i = 0; i < q; i++) {
            choice[i] = sc.next();
            lORr[i] = sc.next();
        }
        int pivotl = -1;
        int pivotr = n;

        for (int i = q-1; i >= 0; i--) {
            if (lORr[i].equals("L")) {
                if (s.charAt(pivotl + 1) == choice[i].charAt(0)  ){
                    pivotl++;
                }
                if (pivotr < n) {
                    if (s.charAt(pivotr) == choice[i].charAt(0)) {
                        pivotr++;
                    }
                }
            }else{ // R
                if (s.charAt(pivotr - 1) == choice[i].charAt(0) ) {
                    pivotr--;
                }
                if (pivotl > -1) {
                    if (s.charAt(pivotl) == choice[i].charAt(0) ) {
                        pivotl--;
                    }
                }
            }
            if (pivotr-pivotl <= 1) {
                break;
            }
        }

        System.out.println(pivotr-pivotl-1);


        sc.close();
    }

}





Measured memory_bytes: 82256
#include <stdio.h>

int main(void)
{
	int i,j,k,n,key;
	scanf("%d",&n);
	int a[n];
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	
	printf("%d",a[0]);
	for(k=1;k<n;k++) printf(" %d",a[k]);
	printf("\n");
	
	for(i=1;i<n;i++){
		key=a[i];
		j=i-1;
		while(j>=0&&a[j]>key){
			a[j+1]=a[j];
			j--;
		}
		a[j+1]=key;
		
		printf("%d",a[0]);
		for(k=1;k<n;k++) printf(" %d",a[k]);
		printf("\n");
		
	}
	
	return 0;
}

Measured memory_bytes: 604
from collections import Counter 
from collections import defaultdict
from collections import deque
import math
import itertools
import heapq
import sys
sys.setrecursionlimit(10**6)

#n=int(input())
#n,m=list(map(int,input().split()))
#a=list(map(int,input().split()))
input_list = lambda : list(map(int,input().split()))

n=int(input())
a=input_list()
ans=float("inf")
l=0
r=sum(a)
for each in a:
    l+=each
    r-=each
    ans=min(ans,abs(l-r))

print(ans)




Measured memory_bytes: 3316
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define trace1(x)                cerr<<#x<<": "<<x<<endl
#define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
#define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
#define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
#define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
#define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
 int main(){
	FAST_IO;
    int n, k;
    cin >> n >> k; 
    int arr[n]; 
    for(int i=0; i < n; i++){
        cin >> arr[i]; 
    }
    int minm = INT_MAX;
    for(int i=0; i < n; i++){
        minm = min(minm, arr[i]);
    }
    int w = k;
    bool dp[2][w+1];
    for(int i = 0; i < minm; i++){
        for(int pl = 0; pl < 2; pl++){
                dp[pl][i] = (bool)abs(pl - 1); 
        }
    }

    for(int i = minm; i <= w; i++){
        for(int pl = 0; pl < 2; pl++){
            dp[pl][i] = (bool)abs(pl - 1);
            for(int k=0; k < n; k++){
                if(i >= arr[k] && dp[abs(pl-1)][i - arr[k]] == pl){
                    dp[pl][i] = pl;
                    break; 
                }             
            }
        }
    }
    
    bool ans = dp[0][w];

    if(ans == 0){
        cout << "First" << endl;
    }
    else{
        cout << "Second" << endl;
    }
    return 0; 
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int ans = c - (a - b);

    if (ans >= 0) cout << ans << endl;
    else cout << 0 << endl;

    return 0;
}

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

int main() {
    ll n, m;
    cin >> n; cin >> m;
    ll mod = 1e9 + 7;
    auto xs = vector<ll>(n);
    auto ys = vector<ll>(m);
    for (int i=0; i<n; i++)
        cin >> xs[i];
    for (int i=0; i<m; i++)
        cin >> ys[i];

    ll xans = 0, yans = 0;
    //cout << endl;
    for (int i=0; i<n-1; i++) {
        xans += (xs[i+1] - xs[i]) * (n-i-1) * (i+1);
        xans %= mod;
    }
    for (int i=0; i<m-1; i++) {
        yans += (ys[i+1] - ys[i]) * (m-i-1) * (i+1);
        yans %= mod;
    }
     
    cout << xans * yans % mod << endl;
}


Measured memory_bytes: 1920
import math
from collections import Counter
n = int(input()) # 24
val = n
l = []

i = 2
while i <= int(math.sqrt(n)):
    if n % i == 0:
        n //= i
        l.append(str(i))
    else:
        i += 1
#print(l)
if n != 1:
    l.append(str(n))
# print(Counter(ans))
answer = 0
#print("counter", Counter(l))
for a, b in Counter(l).items():
    z = 0
    for i in range(1, b+1):
        z += i
        if b - z < 0:
            break
        answer += 1
print(answer)


Measured memory_bytes: 9484
import Control.Monad
import Data.Char

main = do
    s <- getLine
    putStrLn $ solve s 0 True

solve :: String -> Int -> Bool -> String
solve ""        i False         = "AC"
solve ""        i True          = "WA"
solve ('A': st) 0 c             = solve st 1 c
solve ( _ : st) 0 c             = "WA"
solve ('C': st) i c | i >= 2 && st /= "" && c = solve st (succ i) False
                    | otherwise = "WA"
solve ( s : st) i c | isLower s = solve st (succ i) c
                    | otherwise = "WA"

Measured memory_bytes: 380
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
ll M=1e9+7;
const ll mxx=1e5+7;


int main()
{
	
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    cout<<max({a*d,a*c,b*c,b*d});

}

Measured memory_bytes: 3668
// agc041_a
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <type_traits>
#include <typeindex>
#include <unordered_map>
#include <unordered_set>
#endif

template <typename A, typename B> bool cmin(A &a, const B &b) {
  return a > b ? (a = b, true) : false;
}
template <typename A, typename B> bool cmax(A &a, const B &b) {
  return a < b ? (a = b, true) : false;
}
const double PI = acos(-1);
const double EPS = 1e-9;
int inf = sizeof(int) == sizeof(long long) ? 2e18 : 1e9 + 10;
int dx[] = {0, 1, 0, -1};
int dy[] = {1, 0, -1, 0};
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  ll n, a, b;
  cin >> n >> a >> b;

  if ((b - a) % 2 == 0) {
    cout << (b - a) / 2 << endl;
  } else {
    cout << min((n - b), (a - 1)) + 1 + (b - a - 1) / 2 << endl;
  }
  return 0;
}


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

signed main(){
    string s;
    cin>>s;
    int n=s.size();
    vector<int> v(n,0);
    rep(jfkdlsj,2){
        int c=0;
        rep(i,n){
            if(s.at(i)=='L'){
                v[i]+=c/2;
                v[i-1]+=c-c/2;
                c=0;
            }else c++;
        }
        reverse(all(v));
        rep(i,n){
            if(s.at(i)=='R')s.at(i)='L';
            else s.at(i)='R';
        }
        reverse(all(s));
    }
    rep(i,n)cout<<v[i]<<endl;
}

Measured memory_bytes: 1408
#include <stdio.h>
int main(void){
    int a, b, d, r;
    double f;
    
    scanf("%d %d",&a, &b);
    
    1 <= a, b <= 1000000000;
    
    d = a / b;
    r = a % b;
    f = (double)a / (double)b;
    
    printf("%d %d %f \n", d, r, f);
    
    return (0);
    
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
int main(){
    int n,a,b;
    cin>>n>>a>>b;
    string s;
    cin>>s;
    int c=0;
    int x=0;
    for(int i=0;i<n;i++){
        if(s[i]=='c')cout<<"No"<<endl;
        if(s[i]=='a'){
            if(c<a+b){
                c++;
                cout<<"Yes"<<endl;
            }
            else cout<<"No"<<endl;
        }
        if(s[i]=='b'){
            if(c<a+b&&x<b){
                c++;
                x++;
                cout<<"Yes"<<endl;
            }
            else cout<<"No"<<endl;
        }
    }
    return 0;
}

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

int main() {
  int h,w;

  scanf("%d %d",&h,&w);
  while( h!=0 || w!=0) {
      cout << string(w,'#') << endl;

      for(int i=1;i<h-1;i++)
      {
          cout << "#" + string(w-2,'.') + "#" << endl;
      }

      if(h>1) {
          cout << string(w,'#') << endl;
      }
      cout << endl;
      scanf("%d %d",&h,&w);
  }

  return 0;
}

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

class p{
  static void Main(){
    int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int[] X = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
    int[] Y = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
    Console.WriteLine(X[X.Length - 1] < Y[0]&&n[2] < Y[0]&&n[3] > X[X.Length - 1] ? "No War" : "War");
  }
}

Measured memory_bytes: 13396
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
//ll mod = 998244353;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    ll n, a, b;
    cin >> n >> a >> b;
    if (abs(a-b)%2==0) {
        cout << abs(a-b)/2LL << endl;
        return 0;
    }
    ll tmp1 = min(abs(a-1LL), abs(b-n));
    ll tmp2 = min(abs(b-1LL), abs(b-n));
    //cout << (abs(a-b)-1LL)/2LL << " " << tmp1 << " " << tmp2 << endl;
    cout << (abs(a-b)-1LL)/2LL + min(tmp1, tmp2) + 1LL << endl;
    return 0;
}


Measured memory_bytes: 3620
#include <iostream>
#include <string>
#include <utility>
#include <stack>
#include <vector>
#include <queue>
#include <algorithm>
#include <map>
#include <climits>
#include <set>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <cstring>
using namespace std;
int grid[20][20];
int move_h[4] = {-1, 1, 0, 0};
int move_w[4] = {0, 0, -1, 1};

const int MAX_THROW = 10;
int f(int s_h, int s_w, int g_h, int g_w, int move_ind, int throw_num, int h, int w){
  if(throw_num > MAX_THROW){
    return INT_MAX;
  }

  int cur_h = s_h;
  int cur_w = s_w;
  while(true){
    cur_h += move_h[move_ind];
    cur_w += move_w[move_ind];
    if(cur_h < 0 || cur_h >= h || cur_w < 0 || cur_w >= w){
      return INT_MAX;
    }

    if(grid[cur_h][cur_w] == 3){
      return throw_num;
    }

    if(grid[cur_h][cur_w] == 1){
      int block_h = cur_h;
      int block_w = cur_w;
      grid[block_h][block_w] = 0;

      cur_h -= move_h[move_ind];
      cur_w -= move_w[move_ind];
      int ret = INT_MAX;
      for(int i = 0; i < 4; i++){
        int next_h = cur_h + move_h[i];
        int next_w = cur_w + move_w[i];
        if(0 <= next_h && next_h < h && 0 <= next_w && next_w < w && grid[next_h][next_w] != 1){
          ret = min(ret, f(cur_h, cur_w, g_h, g_w, i, throw_num + 1, h, w));
        }
      }
      grid[block_h][block_w] = 1;
      return ret;
    }
  }
  return INT_MAX;
}

int main(){
  while(true){
    int w;
    int h;
    cin >> w >> h;
    if(w == 0 && h == 0){
      break;
    }

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

    int s_h = 0;
    int s_w = 0;
    int g_h = 0;
    int g_w = 0;
    for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++){
        if(grid[i][j] == 2){
          s_h = i;
          s_w = j;
        }
        if(grid[i][j] == 3){
          g_h = i;
          g_w = j;
        }
      }
    }

    int ans = INT_MAX;
    for(int i = 0; i < 4; i++){
      int next_h = s_h + move_h[i];
      int next_w = s_w + move_w[i];
      if(0 <= next_h && next_h < h && 0 <= next_w && next_w < w && grid[next_h][next_w] != 1){
        ans = min(ans, f(s_h, s_w, g_h, g_w, i, 1, h, w));
      }
    }

    if(ans == INT_MAX){
      cout << -1 << endl;
    } else {
      cout << ans << endl;
    }
  }
  return 0;
}



Measured memory_bytes: 3016
// B.

#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(int argc, char *argv[]) {
	int n;
	cin >> n;
	int ans = 1;
	while (ans <= n) {
		ans *= 2;
	}
	ans /= 2;
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < n; i++)

using namespace std;

void solve() {
  string s;
  cin >> s;
  unordered_set<char> st;
  for (char c: s) st.insert(c);
  if (s.size() == st.size()) cout << "yes" << endl;
  else cout << "no" << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

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

	string S;
	cin >> S;

	if (S.substr(0, N / 2 ) == S.substr(N / 2)) {
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}


	
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fo(i,w,n) for(int i=(int) w;i<(int) n;i++)
#define qi queue<int>
#define vi vector<int>
#define ll long long
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define pii pair<int,int>
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define fi first
#define se second
#define prq priority_queue
#define foreach(it,c) for(__typeof((c).begin()) it=c.begin();it!=c.end();it++)
using namespace std;
inline ll read(){
	ll x=0;
	int f=1;
	char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-')f=-f;
	for(;isdigit(c);c=getchar())x=x*10+(c-'0');
	return x*f;
}
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n,a,b;
	cin>>n>>a>>b;
	cout<<min(n*a,b)<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  int b[n];
  for ( int i = 1; i <= n-1; i++){
    cin >> b[i];
  }

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

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
#define fs first
#define sc second
using namespace std;

typedef pair<int,int> P;
typedef pair<int,P> E;

int n,m,i,j,cnt;
E e[11000];
int par[110],rank[110];

inline int find(int x){
  if(par[x] == x)return x;
  return par[x] = find(par[x]);
}

inline void unite(int a,int b){
  a = find(a); b = find(b);
  if(a==b)return;
  if(rank[a]<rank[b])par[b] = a;
  else{
    par[a] = b;
    if(rank[a]==rank[b])rank[b]++;
  }
}

int main(){
  while(scanf("%d%d",&n,&m),n||m){
    for(i=0;i<m;i++)scanf("%d%d%d",&e[i].sc.fs,&e[i].sc.sc,&e[i].fs);
    sort(e,e+m);

    int res = -1;
    for(i=0;i<m;i++){
      for(j=1;j<=n;j++){par[j] = j; rank[j] = 0;}

      cnt = 0;
      for(j=i;j<m;j++){
	if(find(e[j].sc.fs)!=find(e[j].sc.sc)){
	  unite(e[j].sc.fs,e[j].sc.sc);
	  cnt++;
	  if(cnt==n-1)break;
	}
      }
      if(cnt==n-1 && (res<0 || res>e[j].fs-e[i].fs))res = e[j].fs-e[i].fs;
    }
    printf("%d\n",res);
  }
}

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

using namespace std;

using ll = long long;

const int INF = 1e9;

int dp[1 << 26], a[200005];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int n = s.length();
    for (int i = 0; i < n; i++) {
        a[i + 1] = a[i] ^ (1 << (s[i] - 'a'));
    }
    fill_n(dp, 1 << 26, INF);
    dp[0] = 0;
    for (int i = 0; i < n; i++) {
        int tmp = INF;
        for (int j = 0; j < 26; j++) {
            tmp = min(tmp, dp[a[i + 1] ^ (1 << j)]);
        }
        dp[a[i + 1]] = min(dp[a[i + 1]], tmp + 1);
    }
    cout << max(dp[a[n]], 1) << endl;
    return 0;
}

Measured memory_bytes: 263572
#include<bits/stdc++.h>
#define ll long long int
#define F first
#define S second
#define pb push_back
#define sd(x) scanf("%d",&x)
#define sd2(x,y) scanf("%d%d",&x,&y);
#define sdl(x) scanf("%lld",&x)
#define sd2l(x,y) scanf("%lld%lld",&x,&y);
#define sz(x) (int)(x.size())
#define nax 101010
#define inf 1000000100
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MOD 1000000007
#define mp make_pair
#define pi pair<int ,int>
#define pii pair <pi,pi>
using namespace std;
int arr[nax];
int ans[nax];
vector< int > v1,v2,v3;
int main(int argc, char const *argv[])
{
  //freopen("input.txt","r",stdin);
  //freopen("output.txt","w",stdout); 
  int n;
  sd(n);
  for(int i = 1;i <= n; i++)
  {
    sd(arr[i]);
    if(arr[i]%4 == 0)
      v1.pb(arr[i]);
    else
      if(arr[i]%2 == 0)
      v2.pb(arr[i]);
    else
      v3.pb(arr[i]);
  }
  int c1,c2,c3;
  c1 = v1.size();
  c2 = v2.size();
  c3 = v3.size();
  if(c1 >= c3)
  {
    puts("Yes");
    return 0;
  }
  else
  {
    if(c3-c1 == 1 && c2 == 0)
      puts("Yes");
    else
      puts("No");
  }
  return 0;
}
 

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

int main()
{
    string S, T;
    cin >> S >> T;

    int idx;
    string ans = "UNRESTORABLE";
    if (S.size() < T.size())
    {
        cout << ans << endl;
        return 0;
    }
    for (idx = 0; idx <= S.size() - T.size(); idx++)
    {
        bool flag = true;
        for (int i = 0; i < T.size(); i++)
        {
            if (S[idx + i] != '?' && (S[idx + i] != T[i]))
            {
                flag = false;
                break;
            }
        }
        if (flag)
        {
            string tmp = S;
            replace(tmp.begin(), tmp.end(), '?', 'a');
            tmp.replace(idx, T.size(), T);
            if (ans.compare("UNRESTORABLE") == 0)
            {
                ans = tmp;
            }
            else
            {
                ans = min(ans, tmp);
            }
        }
    }
    cout << ans << endl;
}


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

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

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(100000)
V, E = int(input()), int(input())
L = []
visited = [0 for i in range(V)]
edges = [[] for i in range(V)]
#flag = 0

def visit(x):
#  if visited[x] == 1:
#    flag = 1
  if not visited[x]:
    visited[x] = 1
    for e in edges[x]:
      visit(e)
    L.append(x)

for i in range(E):
  s, t = map(int,input().split())
  edges[s - 1].append(t - 1)

for i in range(V):
  if not visited[i]:
    visit(i)
L.reverse()

flag = 0
for i in range(V):
  print(L[i] + 1)
  if not flag and i < V - 1 and (L[i + 1] not in edges[L[i]]):
    flag = 1
print(flag)


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

//def
#define debug(x) cout << #x << ": " << x << '\n'
#define out(x) cout << x << '\n'
#define repeat(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define revrepeat(i, a, b) for (int i = (int)(b)-1; i >= (int)(a); i--)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define revrep(i, n) for (int i = (int)(n)-1; i >= 0; i--)
#define foreach(e, v) for (auto &e : v)
#define all(x) (x).begin(), (x).end()
#define CYES cout << "Yes" << endl
#define CNO cout << "No" << endl
#define SPC(x) cout << fixed << setprecision(x)
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;
typedef vector<vector<ll>> vll;
typedef pair<int, int> P;
constexpr int MOD = 1e9 + 7;
constexpr int INF = __INT_MAX__;               // 2^31 - 1
constexpr long long INFLL = __LONG_LONG_MAX__; // 2^61 - 1
constexpr int MAX_N = 1e5 + 5;
constexpr double PI = acos(-1);

char c[8][8];
int cnt_h[8];
int cnt_w[8];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int h, w, k;
    cin >> h >> w >> k;
    rep(i, h) rep(j, w) cin >> c[i][j];

    int cnt_black = 0;
    rep(i, h) rep(j, w) if (c[i][j] == '#') cnt_black++;

    int ans = 0;
    rep(bit_h, 1 << h) {
        rep(bit_w, 1 << w) {
            vector<vector<bool>> checked(h, vector<bool>(w, false));
            int minus = 0;
            rep(i, h) rep(j, w) {
                if (bit_h & (1 << i)) {
                    rep(x, w) {
                        if (c[i][x] == '#' and !checked[i][x]) {
                            minus++;
                            checked[i][x] = true;
                        }
                    }
                }
                if (bit_w & (1 << j)) {
                    rep(x, h) {
                        if (c[x][j] == '#' and !checked[x][j]) {
                            minus++;
                            checked[x][j] = true;
                        }
                    }
                }
            }
            if (cnt_black - minus == k) ans++;
        }
    }
    out(ans);
    return 0;
}


Measured memory_bytes: 3632
<?php
    list($H,$W,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
    
    for($i=0;$i<$H;$i++){
        $map_info[] = str_split(trim(fgets(STDIN)));
    }
    
    $count=0;
    // var_dump($map_info);
    $main_map_info=$map_info;
    
    //列に対してビット全探索を行う
    for($bit=0;$bit<(1<<$W);$bit++){
        
        $map_info = $main_map_info;
        
        for($i=0;$i<$W;$i++){
            if($bit & (1<<$i)){
                //$iが赤色にする列を決定する。
                for($x=0;$x<$H;$x++){
                    $map_info[$x][$i] = "red";
                }
            }
        }
        //ここで一度保存
        $map_info_sub = $map_info;
        // var_dump($map_info);
        // exit;
        //行に対してビット全探索を行う。
        for($bitx=0;$bitx<(1<<$H);$bitx++){
            $map_info = $map_info_sub;
            for($j=0;$j<$H;$j++){
                if($bitx & (1<<$j)){
                //$jが赤色にする行を決定する。
                    for($y=0;$y<$W;$y++){
                        $map_info[$j][$y] = "red";
                    }
                }
            }
            //黒の残り数を数える
            $sum = 0;
            foreach($map_info as $value){
                $output = array_count_values($value);
                if(!empty($output["#"])){
                    $sum += $output["#"];
                }
            }
            if($sum==$K){
                $count++;
                // echo $sum."\n";
            }
        }
    }
    echo $count;
?>

Measured memory_bytes: 16236
#include<iostream>
#include<cstdio>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<queue>
#include<functional>

using namespace std;

typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<long long> vll;
typedef pair<long long, long long> pll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;


int main(){
	string N;
	cin >> N;
	if (N[0] == N[2]){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int main()
{
    int n;
    cin>>n;
    int arr[n][3];
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
        }
    }
    int dp[n][3];
    dp[0][0]=arr[0][0];
    dp[0][1]=arr[0][1];
    dp[0][2]=arr[0][2];
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(j==0)
            {
                dp[i][j]=max(dp[i-1][j+1],dp[i-1][j+2])+arr[i][j];
            }
            if(j==1)
            {
                dp[i][j]=max(dp[i-1][j-1],dp[i-1][j+1])+arr[i][j];
            }
            if(j==2)
            {
                dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+arr[i][j];
            }

        }
    }
    cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]))<<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
typedef long long ll;
int main(){
  int x,a;
  cin >> x >> a;
  if (x<a){
    cout << 0 << endl;
  }else{
    cout << 10 << endl;
  }
}

Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

class Main {

  public static void main(String[] args) {
    final FastScanner sc = new FastScanner();
    final PrintWriter writer = new PrintWriter(System.out);
    long a = sc.nextLong();
    long b = sc.nextLong();
    long answer = (a * b) / gcd(a, b);
    writer.println(answer);
    writer.flush();
    writer.close();
  }

  private static long gcd(long x, long y) {
    if (x == 0 || y == 0) {
      return x + y;
    }
    long max = Math.max(x, y);
    long min = Math.min(x, y);
    return gcd(max % min, min);
  }

  // FastScanner --
  static class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    public FastScanner() {
    }

    private boolean hasNextByte() {
      if (ptr < buflen) {
        return true;
      } else {
        ptr = 0;
        try {
          buflen = in.read(buffer);
        } catch (IOException e) {
          e.printStackTrace();
        }
        if (buflen <= 0) {
          return false;
        }
      }
      return true;
    }

    private int readByte() {
      if (hasNextByte())
        return buffer[ptr++];
      else
        return -1;
    }

    private boolean isPrintableChar(int c) {
      return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
      while (hasNextByte() && !isPrintableChar(buffer[ptr]))
        ptr++;
      return hasNextByte();
    }

    public String next() {
      if (!hasNext())
        throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while (isPrintableChar(b)) {
        sb.appendCodePoint(b);
        b = readByte();
      }
      return sb.toString();
    }

    public long nextLong() {
      if (!hasNext())
        throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
        minus = true;
        b = readByte();
      }
      if (b < '0' || '9' < b) {
        throw new NumberFormatException();
      }
      while (true) {
        if ('0' <= b && b <= '9') {
          n *= 10;
          n += b - '0';
        } else if (b == -1 || !isPrintableChar(b)) {
          return minus ? -n : n;
        } else {
          throw new NumberFormatException();
        }
        b = readByte();
      }
    }

    public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
        throw new NumberFormatException();
      return (int) nl;
    }

    public double nextDouble() {
      return Double.parseDouble(next());
    }
  }
}

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

using ll = long long int;

ll arr[200010] = {};

int main(void){
    int n;
    ll total = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> arr[i];
        total += arr[i];
    }
    
    ll a = 0,b = 1e15;
    
    for(int i = 0; i < n-1; i++){
        a += arr[i];
        b = min(abs((total-a)-a),b);
    }
    
    cout << b << endl;
    
}


Measured memory_bytes: 1792
s = input()
l = len(s)
mod = 10**9 + 7

# dp[i][j] = 上からi桁目まで見た時のjと合同な数の個数
dp =[[0]*13 for _ in range(l+1)]
dp[0][0] = 1
for i in range(l):
    if s[i] == '?':
        for j in range(13):
            for k in range(10):
                dp[i+1][(j*10+k)%13] += dp[i][j]
                dp[i+1][(j*10+k)%13] %= mod
    else:
        for j in range(13):
            dp[i+1][(j*10+int(s[i]))%13] += dp[i][j]
print(dp[l][5]%mod)


Measured memory_bytes: 61788
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define F first
#define S second
#define db double
#define pb push_back
using namespace std;



int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    ll tests=1;
   // cin>>tests;
    while(tests--)
    {
      ll n,m,p,i,penl=0;
      string s;
      cin>>n>>m;
      vector<ll>acc(n+1,0),pen(n+1,0);
      
      for(i=0;i<m;i++)
      {
          cin>>p>>s;
          if(s=="AC" || s=="ac" || s=="aC" || s=="Ac")
          {
              if(acc[p]!=1)
              penl+=pen[p];
                acc[p]=1;
              
          }
          else
          {
              pen[p]++;
          }
      }
      ll cnt=0;
      for(i=1;i<=n;i++)
      {
          if(acc[i]==1)
          cnt++;
      }
      cout<<cnt<<" "<<penl;
      
    }
    
    return 0;
}


Measured memory_bytes: 1792
a = gets.chomp.split.map{|aa|aa.to_i}
require 'prime'
b = a[1].prime_division
anan = Array.new(b.size).map{Array.new}
ans = []
for bb in 0...b.size
  b[bb][1].times do
    anan[bb].push(b[bb][0])
  end
end
for bb in 0...anan.size
  if (anan[bb].size / a[0]) >= 1
    (anan[bb].size / a[0]).times do
    	ans.push(anan[bb][0])
    end
  end
end
if ans.size == 0
  puts "1"
elsif a[0] == 1
  puts a[1]
elsif a[1] == 1
  puts "1"
else
  aaaa = 1
  puts ans.map{|aaa|aaaa = aaaa*aaa}.pop
end

Measured memory_bytes: 2300
import sys
readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
#mod = 998244353
INF = 10**18
eps = 10**-7

N = int(readline())
A = [int(readline()) for i in range(N)]

for a in A:
    if a%2:
        print('first')
        exit()
print('second')


Measured memory_bytes: 13372
#include<iostream>
#include<vector>

using namespace std;

int main(){
  int N,M; cin >> N >> M; int cnt = 0; vector<int> to(N);
  
  for(int i = 0; i < M; i++){
    int k ; cin >> k;
    for(int j = 0; j < k; j++){
      int s; cin >> s; s--; to[s] |= 1 << i;}}
  
  int p = 0;
  
  for(int j = 0; j < M; j++){
    int c; cin >> c; p |= c << j;}
  
 
  for(int s = 0; s < (1 << N); s++){
    int t = 0;//initialize
    for(int i = 0; i < N; i++){
      if( s >> i & 1){ t ^= to[i];}}
    if( t == p){ cnt++;}}
  
  cout << cnt << endl;
  
  return 0;
}


Measured memory_bytes: 764