akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<algorithm>
using namespace std;
int vector_finder(vector<int> vec, int number) {        //数値判定
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
int a_1(int a) {										//素数判定
	int x = 0;
	for (int i = 2; i < a; i++) {
		if (a % i == 0)x++;
	}
	if (x == 0) {
		return 0;//素数であるとき
	}
	if (x != 0) {
		return 1;//素数でないとき
	}
}
int gcd(int a, int b) {
	if (a < b) {
		a ^= b;
		b ^= a;
		a ^= b;
	}
	return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
	return a * b / gcd(a, b);
}
int main() {
	int n, k, ans = 0;
	cin >> n >> k;
	vector<int> p(n);
	for (int i = 0; i < n; i++) {
		cin >> p[i];
	}
	sort(p.begin(), p.end());
	for (int i = 0; i < k; i++) {
		ans += p[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }
int main(){
    ios::sync_with_stdio(false);
    int a,b,c;
    cin >> a >> b >> c;
    rep(i, b) rep(j, b){
        if((((a*i)%b)*j)%b == c) {
            cout << "YES" << endl;
            return 0;
        }
    }
    cout << "NO" << endl;
}

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

#define int long long
#define cint cpp_int
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) (((a)+(b)-1)/(b))
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/2
#define PI acos(-1.0)

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<Pii> VPii;
typedef vector<string> Vs;
typedef priority_queue<int> PQi;

template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
void vout(Vi &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vout(Vs &v){for(int i=0;i<(v).size();i++) cout<<v[i]<<" ";cout<<endl;}
void vvout(VVi &v){for(int i=0;i<(v).size();i++) vout(v[i]);}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}
int mypow(int x, int n, int m){if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digit(int k,int i){string s = to_string(k);return s[s.size()-i]-'0';}
void uniq(Vi &v){sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());} //vectorの同じ要素消す
int ctoi(char c){if(c>='0'&&c<='9'){return c-'0';}return 0;}
int leng(int n){string s=to_string(n); return s.size();} //intの桁数
int digitsum(int n){int ret=0; while(n>0){ret+=n%10;n/=10;}return ret;} //桁和
int lesscount(int x,Vi &a){return lower_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx未満の数の個数
int orlesscount(int x,Vi &a){return upper_bound(a.begin(),a.end(),x)-a.begin();} //vector aにおけるx以下の数の個数
int morecount(int x,Vi &a){return a.size()-orlesscount(x,a);} //vector aにおけるxより大きい数の個数
int ormorecount(int x,Vi &a){return a.size()-lesscount(x,a);} //vector aにおけるx以上の数の個数
int count(int x,Vi &a) {return upper_bound(ALL(a),x)-lower_bound(ALL(a),x);} //vector aにおけるxの個数
Vi accum(Vi &v){Vi ret((v).size()+1);REP(i,0,(v).size()) ret[i+1]=ret[i]+v[i];return ret;}
bool comp(Pii a,Pii b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}



signed main(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(15);
    string s,t;
    int q;
    cin>>s>>t>>q;
    Vi a(q),b(q),c(q),d(q);
    REP(i,0,q) cin>>a[i]>>b[i]>>c[i]>>d[i];

    int sn=s.size(),tn=t.size();
    Vi ssum(sn+1),tsum(tn+1);
    REP(i,0,sn){
        if(s[i]=='A') ssum[i+1]=ssum[i]+1;
        if(s[i]=='B') ssum[i+1]=ssum[i]+2;
    }
    REP(i,0,tn){
        if(t[i]=='A') tsum[i+1]=tsum[i]+1;
        if(t[i]=='B') tsum[i+1]=tsum[i]+2;
    }

    REP(i,0,q){
        int sq=ssum[b[i]]-ssum[a[i]-1];
        int tq=tsum[d[i]]-tsum[c[i]-1];
        if(sq%3==tq%3) cout<<"YES"<<endl;
        else cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 5584
A,B,K = map(int,input().split())
A1 = K - A
if A1 > 0:
    B1 = B - A1
    print(0,end =" ")
    if B1 < 0:
        print(0)
    else:
        print(B1)
else:
    A2 = A - K
    print(A2,end =" ")
    print(B)
    

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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    int n = 0;
    cin >> n;

    vi a(n);
    rep(i,0,n) cin >> a[i];

    ll r = 1000, s = 0;
    rep(i,0,n-1) {
        if(a[i] < a[i+1]) {
            if(r >= a[i]) {
                s += r/a[i];
                r -= (r/a[i])*a[i];
            }
        }else if(a[i] > a[i+1]) {
            r += (s*a[i]);
            s = 0;
        }
    }

    r += s*a[n-1];
    cout << r << "\n";

    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 3824
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
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; }

int D;
vector<int> c(26+1);
vector<vector<int>> s;

int compute_score(vector<int> t) {
    vector<vector<int>> last(D+1,vector<int>(26+1,0));
    int ans = 0;
    for(int d = 1; d <= D; d++) {
        last[d][t[d]] = d;
        ans += s[d][t[d]];
        for(int i = 1; i <= 26; i++) {
            if(i == t[d]) continue;
            last[d][i] = last[d-1][i];
            ans -= c[i]*(d-last[d][i]);
        }
    }
    return ans;
}
int INF = INT32_MAX>>2;
vector<int> greedy() {
    vector<int> t(D+1);
    vector<vector<int>> last(D+1,vector<int>(26+1,0));
    for(int d = 1; d <= D; d++) {
        int best_i = 0;
        int best_score_diff = -INF;
        for(int i = 1; i <= 26; i++) {
            int score_diff = s[d][i];
            for(int j = 1; j <= 26; j++) {
                if(i==j) continue;
                score_diff -= c[j]*(d-last[d][j]);
            }
            if(score_diff >= best_score_diff) {
                best_i = i;
                best_score_diff = score_diff;
            }
        }
        for(int i = 1; i <= 26; i++) {
            if(i == best_i) {
                last[d][i] = d;
                t[d] = i;
            } else {
                last[d][i] = last[d-1][i];
            }
        }
    }
    return t;
}

int main(){
    ios::sync_with_stdio(false);
    cin >> D;
    s.assign(D+1,vector<int>(26+1,0));
    for(int i = 1; i <= 26; i++) cin >> c[i];
    for(int d = 1; d <= D; d++) for(int i = 1; i <= 26; i++) cin >> s[d][i];

    vector<int> t = greedy();
    for(int d = 1; d <= D; d++) cout << t[d] << endl;
}


Measured memory_bytes: 3768
n = int(input())
a = list(map(int,input().split()))
su = sum(a)
q = int(input())
l = [0 for i in range(10**5+5)]
for j in a:
  l[j] += 1
for i in range(q):
  b,c = map(int,input().split())
  if l[b]==0:
    print(su)
  else:
    a = l[b]
    l[b] = 0
    l[c] += a
    su += (c-b)*a
    print(su)

Measured memory_bytes: 21056
#include <bits/stdc++.h>
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
//#define int long long
typedef long long ll;
using namespace std;
const int MOD = 1000000007;
const int INF = 1010000000;
const double EPS = 1e-10;
const pair<int,int> fd[] = {make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)}; 

signed main(){
  int n, h[100];cin>>n;rep(i,n)cin>>h[i];
  bool fin = false;int ans = 0;
  while(!fin){
    int l = n,r = n;
    rep(i,n){
      if(l < n && h[i] <= 0){
        r = i;break;
      }
      if(l == n && h[i]){
        l = i;
      } 
    }
    repd(i,l,r){
      h[i]--;
    }
    if(l == n){
      fin = true;
    }else{
      fin = false;
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{

    char a[3];
    a[0]='A';
    a[1]='B';
    a[2]='C';
    string s;
    int n,i,j,cnt=0;
    cin>>n;
    cin>>s;
    for(i=0;i<n;i++)
    {
        if(s[i]==a[0]){
                int t=i,c=1;
        for(j=1;j<3;j++)
        {
            if(t<n && s[t+1]==a[j]) {
                c++;
                t++;
            }
        }
        if(c==3) cnt++;
            i=t;
        }
    }

    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int S[100'001];

int main() {
    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> S[i];
    }

    int q, T, ans = 0;
    cin >> q;
    for (int i = 0; i < q; i++) {
        cin >> T;
        //(left, right]
        int left = -1, right = n - 1, mid;
        while (left < right) {
            mid = (left + right + 1) / 2;
            if (T > S[mid]) {
                left = mid;
            } else if (T < S[mid]) {
                right = mid - 1;
            } else {
                ans++;
                break;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3452
import java.io.*;
import java.util.*;


public class Main{
    public static void main(String[] args) {
        MyScanner sc = new MyScanner();
        out = new PrintWriter(new BufferedOutputStream(System.out));

        // Start writing your solution here. -------------------------------------
        long MOD = 998244353;
        int n = sc.nextInt(), s = sc.nextInt();
        int a[] = new int[n];
        long dp[][] = new long[n + 1][s + 1];
        long res = 0l;
        for(int i = 0; i < n; i++) a[i] = sc.nextInt();
        for(int i = 0;i <= n; i++) dp[i][0] = i + 1;
        for(int i = 1;i <= n; i++)
        {
            for(int j = 1; j < a[i - 1] && j < s; j ++) dp[i][j] = dp[i - 1][j];
            if(a[i - 1] > s) continue;
            for(int j = a[i - 1]; j < s; j ++) dp[i][j] = (dp[i - 1][j - a[i - 1]] + dp[i - 1][j]) % MOD;
            dp[i][s] = dp[i - 1][s - a[i - 1]];
            res += dp[i][s] * (n - i + 1);
        }
        out.println(res % MOD);
        /*
        int n      = sc.nextInt();        // read input as integer
        long k     = sc.nextLong();       // read input as long
        double d   = sc.nextDouble();     // read input as double
        String str = sc.next();           // read input as String
        String s   = sc.nextLine();       // read whole line as String

        int result = 3*n;
        out.println(result);                    // print via PrintWriter
        */

        // Stop writing your solution here. -------------------------------------
        out.close();
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;
    //-----------MyScanner class for faster input----------
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        int nextInt() {
            return Integer.parseInt(next());
        }
        long nextLong() {
            return Long.parseLong(next());
        }
        double nextDouble() {
            return Double.parseDouble(next());
        }
        String nextLine(){
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
    //--------------------------------------------------------
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;
   
  if(a==5 && b==5 && c==7){
    cout << "YES" << endl;
  }
  
  else if(a==5 && b==7 && c==5){
    cout << "YES" << endl;
  }
  
  else if(a==7 && b==5 && c==5){
    cout << "YES" << endl;
  }

  else {
    cout << "NO" << endl;
  }
}


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

enum face {
  TOP,
  FRONT,
  RIGHT,
  LEFT,
  BACK,
  BOTTOM
};

class dice {
  public:
    dice();
    void setDice(int spot, int eye);
    int getSpot(int top);
    void rollNorth();
    void rollSouth();
    void rollEast();
    void rollWest();
    void rollRight();
    void rollLeft();
    std::vector<dice> all_rolls();

    int& operator[] (face f) {return id[f];}
    const int& operator[] (face f) const {return id[f];}
    bool operator==(const dice &b) const {
      const dice &a = *this;
      return a[TOP] == b[TOP] && a[BOTTOM] == b[BOTTOM] &&
             a[FRONT] == b[FRONT] && a[BACK] == b[BACK] &&
             a[LEFT] == b[LEFT] && a[RIGHT] == b[RIGHT];
    }

    bool equivalent_to(const dice &di);

  private:
    void roll(face a, face b, face c, face d);
    std::vector<int> id;
};

dice::dice() {
  id.resize(6);
}

void dice::setDice(int spot, int eye) {
  switch(eye) {
    case TOP:
      id[TOP] = spot;
      break;
    case BOTTOM:
      id[BOTTOM] = spot;
      break;
    case FRONT:
      id[FRONT] = spot;
      break;
    case BACK:
      id[BACK] = spot;
      break;
    case LEFT:
      id[LEFT] = spot;
      break;
    case RIGHT:
      id[RIGHT] = spot;
      break;
  }
}

int dice::getSpot(int top) {
  return id[top];
}

void dice::rollNorth() {
  roll(TOP, FRONT, BOTTOM, BACK);
}

void dice::rollSouth() {
  roll(TOP, BACK, BOTTOM, FRONT);
}

void dice::rollEast() {
  roll(TOP, LEFT, BOTTOM, RIGHT);
}

void dice::rollWest() {
  roll(TOP, RIGHT, BOTTOM, LEFT);
}

void dice::rollRight() {
  roll(FRONT, LEFT, BACK, RIGHT);
}

void dice::rollLeft() {
  roll(FRONT, RIGHT, BACK, LEFT);
}

std::vector<dice> dice::all_rolls() {
  std::vector<dice> ret;
  for(int k = 0; k < 6; (k&1 ? rollEast(): rollNorth()), ++k) {
    for(int i = 0; i < 4; rollRight(), ++i) {
      ret.push_back(*this);
    }
  }
  return ret;
}

bool dice::equivalent_to(const dice &di) {
  for(int k = 0; k < 6; (k & 1 ? rollEast(): rollNorth()), ++k) {
    for(int i = 0; i < 4; rollRight(), ++i) {
      if(*this == di) {
        return true;
      }
    }
  }
  return false;
}


void dice::roll(face a, face b, face c, face d) {
  int tmp = id[a];
  id[a] = id[b];
  id[b] = id[c];
  id[c] = id[d];
  id[d] = tmp;
}

int main() {
  int d, n;
  std::cin >> n;
  std::vector<dice> dices(n);

  for(int i = 0; i < n; ++i) {
    dice di;
    for(int j = 0; j < 6; ++j) {
      std::cin >> d;
      di.setDice(d, j);
    }
    dices[i] = di;
  }

  for(int i = 0; i < n; ++i) {
    for(int j = i + 1; j < n; ++j) {
      if(dices[i].equivalent_to(dices[j])) {
        std::cout << "No" << std::endl;
        return 0;
      }
    }
  }
  std::cout << "Yes" << std::endl;

  return 0;
}

Measured memory_bytes: 3160
from heapq import heapify,heappop,heappush
N = int(input())
V = list(map(int,input().split()))
heapify(V)
while len(V) > 1:
    a = heappop(V)
    b = heappop(V)
    heappush(V,(a+b)/2)
print(V[0])

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
#include <string>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int arr[n];
	int c_odd=0;
	for( int i=0;i<n;i++)
		{
			cin>>arr[i];
			if(arr[i]%2!=0)
				c_odd++;
		}
	if(c_odd==0)
		cout<<"0\n";
	else
	{
		if(c_odd%2 != 0)
		{
			for( int i=1;i<n;i++)
				arr[0]+=arr[i];
			cout<<arr[0]<<"\n";
		}
		else
		{
			sort(arr,arr+n);
			int sum=0;
			bool found=false;
			for(int i=0;i<n;i++)
			{
				if((arr[i]%2 !=0) && found==false)
					found=true;
				else
					sum+=arr[i];
			}
			cout<<sum<<"\n";
		}
	}
	return 0; 
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
    int n1,n2,t,x,g;
    scanf("%d%d",&n1,&n2);
    if(n1==0)
        g=n1;
    else if(n2==0)
        g=n2;
    else{
    while(n2!=0){
        t=n2;
        n2=n1%n2;
        n1=t;

    }
    g=n1;
}
printf("%d\n",g);
}



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

int main() {
  string A,B,C;
  cin >> A >> B >> C;
  if (A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
    cout << "YES" << endl;
  }
  else {
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        m: usize,
    }
    println!(
        "{}",
        if n == 1 && m == 1 {
            1
        } else if min(n, m) == 1 {
            max(n, m) - 2
        } else {
            (n - 2) * (m - 2)
        }
    );
}


Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"os"
)

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wt = bufio.NewWriter(os.Stdout)
)

func next() string {
	sc.Scan()
	return sc.Text()
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func min(nums ...int) int {
	ret := nums[0]
	for _, v := range nums {
		if v < ret {
			ret = v
		}
	}
	return ret
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	s, t := next(), next()

	ans := len(t)
	for i := 0; i <= len(s)-len(t); i++ {
		need := 0
		for j := 0; j < len(t); j++ {
			if s[i+j] != t[j] {
				need++
			}
		}
		ans = min(ans, need)
	}

	puts(ans)
}


Measured memory_bytes: 1796
#include<iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<functional>
#include<string>
#include<iomanip>
#include<utility>
#include<string>
#include<map>
#include<unordered_map>
#include<queue>

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

using namespace std;

typedef long long ll;
typedef pair<int, int> Pi;
int gcd(int a, int b){return b ? gcd(b, a%b) : a;}
int lcm(int a, int b){return a*b / gcd(a, b);}


int main(){
    int n;
    cin >> n;
    vector<int> p(n+1);
    for(int i = 1; i <= n; i++) cin >> p[i];

    int ans = 0;
    for(int i = 1; i <= n; i++){
        if(p[i] == i){
            ans++;
            i++;
        }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3732
# -*- coding: utf-8 -*-

import sys
import math


debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        # for line in sys.stdin:
        #     lines.append(line)
        lines.append(input())
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    (h, n) = [int(e) for e in lines[0].split(" ")]
    a = [int(e) for e in lines[1].split(" ")]

    return (h, n, a)


def solve(h, n, a):

    total_a = sum(a)
    result = 'No'
    if h <= total_a:
        result = 'Yes'

    return result
    


def main():
    # 出力
    result = solve(*parse_input())
    if isinstance(result, list):
        for r in result:
            print("%s" % r, sep='')
    else:
        print("%s" % result, sep='')

if __name__ == '__main__':

    main()

Measured memory_bytes: 14552
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
  long long a,b;cin >> a >> b;
  if(a<=0 && 0<=b) cout << "Zero" << endl;
  else if(0<a) cout << "Positive" << endl;
  else cout << (((b-a+1)%2) ? "Negative":"Positive") << endl;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
#include<iostream>
#include<iomanip>
using namespace std;

int main() {
	int A, B;
	cin >> A >> B;
	for (int i = 0; i < 1000000; i++) {
		if (((i * 8) / 100 == A) && ((i * 10) / 100 == B)) {
			cout << i << "\n";
			return 0;
		}
	}
	cout << "-1\n";
}

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

using namespace std;
using ll = long long;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define INF 9223372036854775807
#define all(x) (x).begin(), (x).end()

ll ts = 1000000007;

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

  ll a, b, c, d;
  cin >> a >> b >> c >> d;

  cout << min(a, b) + min(c, d) << "\n";
}

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

public class Main {
    public static void main(String[] args) {
        try(Scanner sc = new Scanner(System.in)) {
            System.out.println(new Main().run(sc));
        }
    }

    public String run(Scanner sc) {
        int[] vars = Arrays.stream(sc.nextLine().split(" ")).mapToInt(s -> Integer.parseInt(s)).toArray();
        return String.valueOf(vars[0] * vars[1]);
    }
}


Measured memory_bytes: 35936
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main() {
	long long int n;
	cin >> n;
	
	vector<long long int> a(n);
	for (long long int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	vector<long long int> b(n + 1);
	b[0] = abs(a[0]);
	for (long long int i = 0; i < n; i++) {
		b[i + 1] = abs(a[i] - a[i + 1]);
	}
	b[n] = abs(a[n - 1]);

	long long int ans = 0;

	for (long long int i = 0; i <= n; i++) {
		ans += b[i];
	}
	//cout << ans << endl;
	cout << ans-b[0]-b[1]+abs(a[1]) << endl;
	for (long long int i = 1; i < n-1; i++) {
		cout << ans-b[i]-b[i+1]+abs(a[i+1]-a[i-1]) << endl;
	}
	cout << ans - b[n - 1] - b[n] + abs(a[n - 2]) << endl;
	return 0;
}

Measured memory_bytes: 2816
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <unordered_map>
#include <cmath>
#include <algorithm>

typedef long long ll;
typedef long double ld;

using namespace std;
int main()
{
  ll n, min_xy = 0;
  cin >> n;
  for (ll i = 1; i <= sqrt(n); ++i)
  {
    if (n % i == 0 && (min_xy == 0 || min_xy > n / i + i)) min_xy = n / i + i;
  }
  cout << min_xy - 2;
}


Measured memory_bytes: 3684
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
from itertools import product
from heapq import heappop, heappush
def resolve():
    n = int(input())
    S = [None] * n
    C = [None] * n
    for i in range(n):
        S[i], C[i] = input().split()
        C[i] = int(C[i])
    for i in range(n):
        S.append(S[i][::-1])
        C.append(C[i])

    # id[i][j] : index of S[i][j:]
    id = [[] for _ in range(2 * n)]
    N = 1
    for i in range(2 * n):
        for j in range(len(S[i])):
            id[i].append(N)
            N += 1

    # make graph
    E = [[] for _ in range(N)]
    for i, ni in product(range(2 * n), repeat = 2):
        if i // n == ni // n:
            continue
        for j in range(len(S[i])):
            now = S[i][j:]
            edge = S[ni]
            l = min(len(now), len(edge))
            if now[:l] != edge[:l]:
                continue
            nv = None
            if len(now) > len(edge):
                E[id[i][j]].append((id[i][j + len(edge)], C[ni]))
            elif len(now) < len(edge):
                E[id[i][j]].append((id[ni][len(now)], C[ni]))
            else:
                E[id[i][j]].append((0, C[ni]))

    # Dijkstra
    dist = [INF] * N
    queue = []
    for i, c in enumerate(C):
        dist[id[i][0]] = c
        heappush(queue, (c, id[i][0]))
    while queue:
        d, v = heappop(queue)
        if d != dist[v]:
            continue
        for nv, w in E[v]:
            if dist[nv] > d + w:
                dist[nv] = d + w
                heappush(queue, (d + w, nv))

    ans = dist[0]
    for i in range(2 * n):
        for j in range(len(S[i])):
            T = S[i][j:]
            if T == T[::-1]:
                ans = min(ans, dist[id[i][j]])

    if ans == INF:
        ans = -1
    print(ans)
resolve()

Measured memory_bytes: 74748
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N,K; cin>>N>>K;
  long ans=0;
  vector<long>H(N);
  for(int i=0;i<N;i++){cin>>H[i];}
  sort(H.begin(),H.end());
  for(int i=0;i<N-K;i++){
    ans += H[i];
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 1792
import scala.io.StdIn

object Main {
  def main(args: Array[String]): Unit = {
      val inputs = StdIn.readLine().split(" ").map(_.toInt)
      val (a, b, c) = (inputs(0), inputs(1), inputs(2))
      if(a < b && b < c)println("Yes")
      else println("No")
  }
}

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

using namespace std;

using ll = long long;
using P = pair<ll, ll>;
using edge = pair<ll, P>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
using Graph = vector<vector<ll>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int ddx[8] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll MOD = 1000000007;
const ll INF = 1000000000000000000L;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

ll dp[100][4][4][4];

void Main() {
    int N;
    cin >> N;
    dp[0][3][3][3] = 1;
    rep(i, N) {
        rep(j, 4) {
            rep(k, 4) {
                rep(m, 4) {
                    rep(l, 4) {
                        if (l == 2 && j == 1 && k == 0) continue;
                        if (l == 2 && j == 0 && k == 1) continue;
                        if (l == 1 && j == 2 && k == 0) continue;
                        if (l == 2 && j == 1 && m == 0) continue;
                        if (l == 2 && k == 1 && m == 0) continue;
                        dp[i + 1][l][j][k] += dp[i][j][k][m];
                        dp[i + 1][l][j][k] %= MOD;
                    }
                }
            }
        }
    }
    ll ans = 0;
    rep(j, 4) {
        rep(k, 4) {
            rep(m, 4) {
                ans += dp[N][j][k][m];
                ans %= MOD;
            }
        }
    }
    cout << ans << '\n';
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}

int addBits(int a, vi &bits, bool add) {
    int maxbit = 0;
    for (int i = 0; i < 20; ++i) {
        if (1 << i & a) {
            if (add)
                bits[i]++;
            else
                bits[i]--;
        }
        chmax(maxbit, bits[i]);
    }
    return maxbit;
}
int maxBits(vi &bits) {
    int ret = 0;
    for (auto &b : bits) {
        chmax(ret, b);
    }
    return ret;
}

int main() {
    int n;
    cin >> n;
    vi a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    vi bits(20, 0);
    int l = 0;
    int r = 0;
    ll ret = 0;
    while (l < n) {
        while (maxBits(bits) <= 1 && r < n) {
            addBits(a[r], bits, true);
            r++;
        }
        if (maxBits(bits) > 1) {
            addBits(a[r - 1], bits, false);
            r--;
        }
        ret += r - l;
        addBits(a[l], bits, false);
        l++;
    }
    cout << ret << "\n";
    return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) (v.begin(),v.end())
#define COUT(x) cout<<(x)<<endl

int n,m,q,a[50],b[50],c[50],d[50];

int dfs(vector<int> &A){
    if(A.size()==n){
        int score=0;
        for(int i=0;i<q;i++){
            if(A[b[i]]-A[a[i]] == c[i]){
                score += d[i];
            }
        }
        return score;//Aの項数がnまで行った時、dfsは値を返さなくてはいけない
    }
    
    int last = (A.empty() ? 1 : A.back());
    int Max = 0;
    for(int i=last;i<=m;i++){
        A.push_back(i);
        Max = max(Max,dfs(A));
        A.pop_back();
    }
    return Max;
}

int main(){
    cin >> n >> m >> q;
    for(int i=0;i<q;i++){
        cin >> a[i] >> b[i]>> c[i]>> d[i];
        a[i]--;
        b[i]--;
    }
    vector<int> A;
    COUT(dfs(A));
    return 0;
}

Measured memory_bytes: 3488
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
const int mod = 1e9 + 7;
typedef long long ll;
int n, m, x;

int ar[maxn];
int main()
{
    scanf("%d%d", &n, &m);
    for(int i=0;i<=n;i++)ar[i] = -1;
    for(int i=0;i<m;i++){
        int a, b;
        scanf("%d%d", &a, &b);
        if(a > n){
            printf("-1\n");
            return 0;
        }
        else if(ar[a] == b || ar[a] == -1){
            ar[a] = b;
            if(a == 1 && n > 1 && b == 0){
                printf("-1\n");
                return 0;
            }
        }
        else{
            printf("-1\n");
            return 0;
        }
    }
    for(int i = 1; i <= n; i++){
        if(ar[i] == -1){
            if(i == 1 && n != 1)ar[i] = 1;
            else ar[i] = 0;
        }
    }
    for(int i=1;i<=n;i++)printf("%d", ar[i]);
    printf("\n");

    return 0;
}


Measured memory_bytes: 256
import collections

N = int(input())
A = list(map(int, input().split()))
Q = int(input())
C = collections.Counter(A)
ans = sum(A)

for _ in range(Q):
    b, c = map(int, input().split())
    ans += c*C[b] - b*C[b]
    C[c] += C[b]
    C[b] = 0
    print(ans)

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

int main(){
   int n;
   string s;
   cin >> n >> s;
   int ans = 0;
   for(int i = 0; i < n - 1; i++){
      if(s[i] != s[i + 1]) ++ans;
   }
   ans++;
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 3672
#include <iostream>
#include <vector>
#include <queue>
#include <math.h>
#include <unordered_map>
#include <cstring>
#include <algorithm>
#include <set>
#include <climits>
#include <numeric>

//usings
using namespace std;

//type def
typedef long long int64;
typedef pair<int, int> ii;

//consts
const int mod = 1e9 + 7;

//methods
template<typename T>
bool chmax(T& source, const T& compare_to) {
    if(source < compare_to) {
        source = compare_to;
        return true;
    }
    return false;
}

int modpow(int64 base, int n) {
    int64 ret = 1;
    while(n) {
        if(n & 1) ret = ret * base % mod;
        base = base * base % mod;
        n >>= 1;
    }
    return ret;
}

class Solution {
private:
public:
    string solve(string& str) {
        int n = str.size();
        if(n > 1) {
            string s1 = str.substr(0,  (n - 1) / 2),
            s2 = str.substr((n - 1) / 2 + 1, (n - 1) / 2);
            int m = s1.size();
            if(m == 1 && s1 != s2) return "No";
            for(int l = 0, h = m - 1; l < h; ++l, --h) {
                if(s1[l] != s1[h] || s2[l] != s2[h]) return "No";
            }
            for(int i = 0; i < m; ++i) {
                if(s1[i] != s2[m - 1 - i]) return "No";
            }
        }
        return "Yes";
    }

};

int main() {
    string s;
    cin >> s;
    Solution sol;
    auto ret = sol.solve(s);
    cout << ret << endl;
}

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

int main() {
	int mountains_high[10];
	for (int i = 0; i < 10; i++) {
		cin >> mountains_high[i];
	}
	for (int i = 0; i < 9; i++) {
		for (int j = 0; j < 9; j++) {
			if (mountains_high[j] < mountains_high[j + 1])swap(mountains_high[j], mountains_high[j + 1]);
		}
	}
	for (int i = 0; i < 3; i++) {
		cout << mountains_high[i] << endl;
	}
	return 0;
}

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

int main(){
  int a,b,k; cin>>a >>b >>k;
  vector<int> ans;
  for(int i=min(a,b);i>0;i--){
    if(a%i == 0 && b%i == 0){
      ans.push_back(i);
    }
  }
  cout<<ans.at(k-1)<<endl;
}

Measured memory_bytes: 256
from collections import*
n,*v=map(int,open(0).read().split())
a,b=[Counter(v[i::2]).most_common()+[(0,0)]for i in(0,1)]
s,x=a[0]
t,y=b[0]
print(n-[x+y,max(x+b[1][1],y+a[1][1])][s==t])

Measured memory_bytes: 25336
#include <iostream>
#include <cmath>
#include <cstdlib>

int seat[100001];

signed main()
{
    std::ios_base::sync_with_stdio(false);

    auto read = [](int id) -> int {
        std::string str;
        std::cout << id << std::endl;
        std::cout.flush();
        std::cin >> str;
        switch (str[0])
        {
        case 'V':
            seat[id] = 0;
            break;
        case 'M':
            seat[id] = 1;
            break;
        case 'F':
            seat[id] = 2;
            break;
        }
        return seat[id];
    };

    int n;
    std::cin >> n;

    int left = 0, right = n - 1;
    if (!read(left) || !read(right))
        exit(0);
    while (left + 1 != right)
    {
        int mid = (left + right) / 2;
        if (!read(mid))
            exit(0);
        if (abs(seat[mid] - seat[left]) != ((mid - left) & 1))
            right = mid;
        else
            left = mid;
    }

    if (!read(left))
        exit(0);
    if (!read(right))
        exit(0);
}


Measured memory_bytes: 852
#include<iostream>
using namespace std;
int e,MIN,i,j;
main(){while(true){MIN=1<<27;cin>>e;if(!e){break;}for(i=0;i*i*i<=e;i++){for(j=0;j*j+i*i*i<=e;j++){MIN=min(MIN,i+j+e-(i*i*i+j*j));}}cout<<MIN<<endl;}}

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

// ARC-075-E

//セグメント木
// ref:https://ei1333.github.io/luzhiled/snippets/structure/segment-tree.html
template <typename Mnd>
struct segment_tree {
    int sz;
    vector<Mnd> data;
    function<Mnd(Mnd, Mnd)> f;
    Mnd e;
    //サイズだけ指定して初期化
    segment_tree(int _sz, function<Mnd(Mnd, Mnd)> _f, Mnd _e) : f(_f), e(_e) {
        sz = 1;
        while (sz < _sz) sz <<= 1;
        data.assign(sz * 2, e);
    }
    //参照渡しなので代入とかもできる
    Mnd& operator[](const int& k) {
        return data[k + sz];
    }
    //木を構築 O(n)
    void build() {
        for (int i = sz - 1; i > 0; i--)
            data[i] = f(data[2 * i], data[2 * i + 1]);
    }
    //更新しつつ木を再構築 O(log n)
    void update(int k, Mnd x) {
        data[k += sz] = x;
        while (k >>= 1) data[k] = f(data[2 * k], data[2 * k + 1]);
    }
    //[a,b)でのクエリに答える　O(log n)
    Mnd query(int a, int b) const {
        Mnd l = e, r = e;
        for (a += sz, b += sz; a < b; a >>= 1, b >>= 1) {
            if (a & 1) l = f(l, data[a++]);
            if (b & 1) r = f(r, data[--b]);
        }
        return f(l, r);
    }
};

// 転倒数を計算
// depend:segment_tree
template <typename T>
long long inversion_number(vector<T>& a) {
    using lint = long long int;
    int n = a.size();
    vector<T> b = a;
    sort(b.begin(), b.end());
    unordered_map<T, int> convert;
    for (int i = 0; i < n; i++) convert[b[i]] = i;
    segment_tree<lint> count(
        n, [](lint a, lint b) { return a + b; }, 0);
    lint res = 0;
    for (int i = 0; i < n; i++) {
        res += count.query(convert[a[i]] + 1, n);
        count.update(convert[a[i]], count[convert[a[i]]] + 1);
    }
    return res;
}

// 累積和
struct cumulative_sum {
    using lint = long long int;
    int sz;
    // data[i]:元の数列
    vector<lint> data;
    // cum[i]:[0,i)の和
    vector<lint> sum;
    // 要素数を指定して初期化
    cumulative_sum(const int _sz) : sz(_sz) {
        data.assign(sz, 0);
        sum.assign(sz + 1, 0);
    }
    lint& operator[](const int k) {
        return data[k];
    }
    // dataに基づいてsumを構築
    void build() {
        for (int i = 0; i < sz; i++) sum[i + 1] = sum[i] + data[i];
    }
    // [a,b)の和を求める
    lint query(const int a, const int b) {
        return sum[b] - sum[a];
    }
};

int main() {
    lint n, k;
    cin >> n >> k;
    cumulative_sum a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        a[i] -= k;
    }
    a.build();
    cout << n * (n + 1) / 2 - inversion_number(a.sum) << endl;
}

Measured memory_bytes: 17224
#include<cctype>
#include<string>
#include<algorithm>
#include<iostream>
#include<set>
#include<regex>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<ctime>
#include<vector>
#include<bitset>
#include<cstdio>
#include<numeric>
#include<utility>
#include<sstream>
#include<cstdlib>
#include<iomanip>
#include<cstring>
#include<map>
#include<functional>
#include<unordered_map>
#define _USE_MATH_DEFINES
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
#define pb(n) push_back(n)
#define ue(N) N.erase(unique(N.begin(),N.end()),N.end());
#define nou(S) cout << S
#define hou(S) cout << setprecision(30) << S << endl
#define vec(K,L,N,S) vector<L> K(N,S)
#define dv(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define tv(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define maxx 5100000
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
#define endl "\n"
typedef long long int lli;
typedef unsigned long long int uli;
const uli mod = 1e9 + 7;
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n,ma=-100000;
    cin >> n;
    map<string, int> s;
    for(int i = 0; i < n; ++i) {
        string a;
        cin >> a;
        ++s[a];
    }
    int m;
    cin >> m;
    for(int i = 0; i < m; ++i) {
        string a;
        cin >> a;
        --s[a];
    }
    s["AA"] = 0;
    for(auto i : s) {
        ma = max(ma, i.second);
    }
    cout << ma << endl;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    string a;
    cin>>a;
    string b=a;
    reverse(a.begin(),a.end());
    for(int i=0;i<a.size();++i){
        if(a[i]=='b') 
			a[i]='d';
        else if(a[i]=='d') 
			a[i]='b';
        else if(a[i]=='p') 
			a[i]='q';
        else if(a[i]=='q') 
			a[i]='p';
    }
    if(a==b) 
		cout<<"Yes";
    else 
		cout<<"No";
	return 0;
}

Measured memory_bytes: 512
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

i32 mod = 1000000007;

i32 inv (i32 a) {
  i32 t = 1;
  while (a > 1) {
    t = (i64) t * (mod - mod / a) % mod;
    a = mod % a;
  }
  return t;
}

i32 mod_pow (i32 r, i32 n, i32 mod) {
  i32 t = 1;
  i32 s = r;
  while (n > 0) {
    if (n & 1) t = (i64) t * s % mod;
    s = (i64) s * s % mod;
    n >>= 1;
  }
  return t;
}

i32 *fact = NULL;
i32 *iFact = NULL;
void init_fact (const i32 n) {
  fact = (i32 *) calloc (n + 1, sizeof (i32));
  fact[0] = 1;
  for (i32 i = 1; i <= n; ++i) {
    fact[i] = (i64) i * fact[i - 1] % mod;
  }
  iFact = (i32 *) calloc (n + 1, sizeof (i32));
  iFact[n] = inv (fact[n]);
  for (i32 i = n - 1; i >= 0; --i) {
    iFact[i] = (i64) (i + 1) * iFact[i + 1] % mod;
  }
}

i32 comb (i32 n, i32 k) {
  if (!(0 <= k && k <= n)) return 0;
  return (i64) fact[n] * iFact[k] % mod * iFact[n - k] % mod;
}

#define POS(i, j) ((i) * (n + 1) + (j))

void run (void) {
  i32 n;
  scanf ("%" SCNi32 "%" SCNi32, &n, &mod);
  init_fact (n);
  i32 *dp = (i32 *) calloc ((n + 1) * (n + 1), sizeof (i32));
  for (i32 i = 0; i <= n; ++i) {
    dp[POS(0, i)] = 1;
  }
  for (i32 i = 1; i <= n; ++i) {
    for (i32 j = 1; j <= n; ++j) {
      dp[POS(i, j)] = (dp[POS(i, j - 1)] + dp[POS(i - 1, j - 1)] + (i64) i * dp[POS(i, j - 1)]) % mod;
    }
  }
  i32 ans = 0;
  for (i32 i = 0, sign = 1; i <= n; ++i, sign *= -1) {
    i32 way = 0;
    i32 p = mod_pow (2, n - i, mod);
    for (i32 j = 0, a = 1; j <= i; ++j, a = (i64) a * p % mod) {
      way = (way + (i64) dp[POS(j, i)] * a)% mod;
    }
    i32 x = (i64) comb (n, i) * way % mod;
    i32 y = mod_pow (2, mod_pow (2, n - i, mod - 1), mod);
    ans = (ans + (i64) sign * x * y % mod + mod) % mod;
  }
  printf ("%" PRIi32 "\n", ans);
}

int main (void) {
  run();
  return 0;
}


Measured memory_bytes: 35328
class UnionFind
  def initialize(n)
    @data = Array.new(n, &:itself)
  end

  def show
    pp @data
  end

  def root(i)
    _compact!(i, _root(i))
  end

  def same?(i, j)
    root(i) == root(j)
  end

  def unite!(i, j)
    _compact!(i, root(j))
  end

  def _root(i)
    i = @data[i] until i == @data[i]
    i
  end

  def _compact!(i, r)
    until @data[i] == r
      tmp = @data[i]
      @data[i] = r
      i = tmp
    end
    r
  end
end

N, K, L = gets.chomp.split.map(&:to_i)
uf_road = UnionFind.new(N)
uf_train = UnionFind.new(N)
K.times do
  a, b = gets.chomp.split.map(&:to_i)
  uf_road.unite!(a - 1, b - 1)
end
L.times do
  a, b = gets.chomp.split.map(&:to_i)
  uf_train.unite!(a - 1, b - 1)
end

pair = Array.new(N, 0)
h = Hash.new(0)
N.times do |i|
  root_road = uf_road.root(i)
  root_train = uf_train.root(i)
  pair[i] = [root_road, root_train]
  h[[root_road, root_train]] += 1
end

ans = []
pair.each do |i|
  ans << h[i]
end
puts ans.join(' ')



Measured memory_bytes: 50464
const stdin = require('fs').readFileSync('/dev/stdin', 'utf8')

const d = Number(stdin.split('\n')[0])

let res = ''

if(d === 25){
  res = 'Christmas'
} else if(d === 24){
  res = 'Christmas Eve'
} else if(d === 23){
  res = 'Christmas Eve Eve'
}else if(d === 22){
  res = 'Christmas Eve Eve Eve'
}

console.log(res)

Measured memory_bytes: 7372
import re
list = re.split('(..)', input())[1::2]
a = int(list[0])
b = int(list[1])
if a>0 and a<=12 and b>=1 and b<=12:
    print("AMBIGUOUS")
elif a>12 and b>0 and b<=12:
    print("YYMM")
elif a==0 and b>0 and b<=12:
    print("YYMM")
elif a<=12 and a>0 and b>12:
    print("MMYY")
elif a<=12 and a>0 and b==0:
    print("MMYY")
else:
    print("NA")

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

using namespace std;

#define sz(vec) ( (int)(vec).size() )
using LL = long long;

int x, y;

int cal(int ran) {
    int ret = 0;
    while (ran <= 3) {
        ret += 100000;
        ++ran;
    }
    return ret;
}

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

    cin >> x >> y;
    cout << cal(x) + cal(y) + (max(x, y) == 1 ? 400000 : 0);

    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AOJ1_2_C
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);

            if(a<b)
            {
                if (c < a)
                {
                    Console.WriteLine(c + " " + a + " " + b);
                }
                else if (b < c)
                {
                    Console.WriteLine(a + " " + b + " " + c);
                }
                else
                {
                    Console.WriteLine(a + " " + c + " " + b);
                }
            }
            else if(a>b)
            {
                if(c>a)
                {
                    Console.WriteLine(b + " " + a + " " + c);
                }
                else if(b>c)
                {
                    Console.WriteLine(c + " " + b + " " + a);
                }
                else
                {
                    Console.WriteLine(b + " " + c + " " + a);
                }

            }

            //Console.WriteLine(Math.Min(a,Math.Min(b,c)) + " "
            //    + (Math.Min(a, Math.Min(b, c)), Math.Max(a, Math.Max(b, c)))
            //    + " " +Math.Max(a,Math.Max(b,c)));

        }
        //public int Max(params int[] nums)
        //{
        //    // 引数が渡されない場合
        //    if (nums.Length == 0) return 0;

        //    int max = nums[0];
        //    for (int i = 1; i < nums.Length; i++)
        //    {
        //        max = max > nums[i] ? max : nums[i];
        //        // Minの場合は不等号を逆にすればOK
        //    }
        //    return max;
        //}
    }
}



Measured memory_bytes: 15872
//Date and time of submission: 
 
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=1e5+5;
ll a,b,c;
int main() {
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);
	cin>>a>>b>>c;
	if(a+b>=c)
	cout<<"Yes";
	else
	cout<<"No";
	return 0;
}


Measured memory_bytes: 256