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

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    string s,t;
    cin>>s>>t;
    
    int slen = s.length() , tlen = t.length() , flag = 0;

    for(int i = 0 ; i <slen ;i++){
        if(s[i] != t[i]){
            cout<<"No";
            flag = 1;
            break;
        }
    }

    if(tlen == slen + 1 && flag == 0)
    cout<<"Yes";

    return 0;

}


Measured memory_bytes: 3672
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<vector<int>> d;
vector<bool> visited;
vector<int> r;
int res;
int inf=1e18;
int N,M,R;



void dfs(int i,int pre,int dis){
	
	if(i==R){
		res=min(res,dis);
		return;}	

	for(auto&& w:r){
	if(visited[w])continue;
	visited[w]=true;
		if(pre==-1)dfs(i+1,w,0);
		else dfs(i+1,w,dis+d[w][pre]);
	visited[w]=false;
	}
	return;	
}


signed main(){
	cin>>N>>M>>R;
	r.resize(R);
	for(auto&& w:r){cin>>w;w--;}
	d.resize(N,vector<int>(N,inf));
	visited.resize(N,false);
	for(int i=0;i<N;i++){
		d[i][i]=0;
	}
	for(int i=0;i<M;i++){
		int a,b,c;cin>>a>>b>>c;a--;b--;
		d[a][b]=d[b][a]=c;


	}
	for(int i=0;i<N;i++){
	for(int j=0;j<N;j++){
	for(int k=0;k<N;k++){
		d[j][k]=min(d[j][k],d[j][i]+d[i][k]);
}
}	
}
	res=inf;
	dfs(0,-1,0);
	cout<<res<<endl;

}


Measured memory_bytes: 512
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>

#define                           int                         long long
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<int,int>
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);




using namespace std;

const int inf=1e18;
const int mod=1e9+7;
const int M=100009;

inline int bigmod(int B,int P){int R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline int ad(int x,int y){int ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int sub(int x,int y){int ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline int gun(int x,int y){int ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}


 main()

{
    fast
    int n,a,b;
    cin>>n>>a>>b;
    int gap=abs(a-b)-1;
    if(gap%2==0)
    {
        cout<<"Borys"<<endl;
    }
    else
    {
        cout<<"Alice"<<endl;
    }
    return 0;

}





































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

bool ans = true;

bool isPalindrome(string n){
  for(int i = 0; i < n.size()/2 + 1; i++){
    if(n.at(i) != n.at(n.size()-i-1)){
      ans = false;
    }
  }
  return ans;
}

int main() {
  string S;
  cin >> S;
  
  isPalindrome(S);
  
  string M = S.substr(0, S.size()/2);
  isPalindrome(M);
  
  string N = S.substr(S.size()/2 + 1, S.size()/2);
  isPalindrome(N);

  if(ans)cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int main(){

	vector<int> V;

	int num_query;
	scanf("%d",&num_query);

	int command,tmp;

	for(int loop = 0; loop < num_query; loop++){
		scanf("%d",&command);

		switch(command){
		case 0:
			scanf("%d",&tmp);
			V.push_back(tmp);
			break;
		case 1:
			scanf("%d",&tmp);
			printf("%d\n",V[tmp]);
			break;
		case 2:
			V.pop_back();
			break;
		}
	}

	return 0;
}



Measured memory_bytes: 3896
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
#define MAX 200
#define max 1000000

void initialize();
int isEmpty();
int isFull();
void push(int);
int pop();

int top;
int S[max];

int main(){
    char c[max];
    int sum = 0;
    int a,b;

    initialize();

    while(cin >> c){
        if(c[0] == '-'){
            a = pop();
            b = pop();
            push(b - a);
        }
        else if(c[0] == '+'){
            push(pop() + pop());
        }
        else if(c[0] == '*'){
            push(pop() * pop());
        }
        else{
            push(atoi(c));
        }   
    }
    
    printf("%d\n",S[1]);

    return 0;
}


void initialize(){
    top = 0;
}

int isEmpty(){
    if(top == 0)return 1; 
    return 0;
}

int isFull(){
    if(top >= MAX - 1)return 1;
    return 0;
}

void push(int x){
    if(isFull())fprintf(stderr,"Overflow");
    top++;
    S[top] = x;
}

int pop(){
    if(isEmpty())fprintf(stderr,"Anderflow");
    top--;
    return S[top+1];
}


Measured memory_bytes: 3240
m,s[]={0,31,60,91,121,152,182,213,244,274,305,335};
main(d){char a[7][9]={"Thurs","Fri","Satur","Sun","Mon","Tues","Wednes"};
  while(1)
    {
      scanf("%d%d",&m,&d);
      if(!m)exit(0);
      d+=s[m-1];
      printf("%sday\n",&a[(d%7)?(d%7-1):6][0]);
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
  
int main() {
  int N,M,q;
  cin >> N >> M >> q;
  vvi G(N,vi(N,0));
  rep(i,M) {
    int l,r;
    cin >> l >> r;
    l--;
    r--;
    G[l][r]++;
  }
  vvi sum(N+1,vi(N+1,0));
  rep(i,N) {
    rep(j,N) {
      sum[i+1][j+1] += sum[i+1][j] + sum[i][j+1] + G[i][j] - sum[i][j];
    }
  }
  rep(i,q) {
    int x,y;
    cin >> x >> y;
    cout << sum[y][y] - sum[x-1][y] << endl; 
  }

  return 0;
}

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

using namespace std;

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

    int n;
    cin >> n;

    vector<pair<int , int> > v(n);
    for (int i = 0 ;i < n ;i++)
        cin >> v[i].first >> v[i].second;


    sort(v.begin() , v.end() , [&](auto &a , auto &b) {
       return a.second < b.second;
    });

    int cur = 0;
    for (int i = 0 ;i < n ;i++) {
        if (cur + v[i].first > v[i].second) {
            cout << "No";
            return 0;
        }
        cur += v[i].first;
    }

    cout << "Yes";
}

Measured memory_bytes: 1792
//code_sm
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int> 
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu ((int)1e9+7)
#define set0(a) memset(a,0,sizeof(a))

//sieve generation begin
vi PRIME;
void sieve(int n)
{
	bool a[n+1];
	memset(a,0,sizeof(a));
	a[0]=1;
	a[1]=1;
	for(int i=2;i*i<=n;i++)
	{
		if(a[i]==0)
		{
			for(int j=i*i;j<=n;j+=i)
			a[j]=1;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]==0)
		PRIME.pb(i);
	}
}
//sieve generation end
ll gcd(ll a,ll b)
{
	while(b%a)
	{
		ll c=b;
		b=a;
		a=c%a;
	}
	return a;
}
ll bigpow(ll x,ll y)
{
	if(y==0)
	return 1;
	else if(y&1)
	{
		return (x*bigpow((x*x)%chotu,(y-1)/2))%chotu;
	}
	else 
	return bigpow((x*x)%chotu,y/2);
}
void solve()
{
fastio
int n,k;
cin>>n>>k;
si s;
while(k--)
{
	int d;
	cin>>d;
	while(d--)
	{
		int x;
		cin>>x;
		s.insert(x);
	}
	}
	int size=(int)s.size();
	cout<<n-size;	
}
int main()
{
//code
fastio
int t;
t=1;
while(t--)
{
	solve();
	cout<<'\n';
}

}

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

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

//全部cに塗り替える時の違和感の合計
int dc(vector<int> clist, int c, vector<vector<int>> d) {
    int res = 0;
    for (int i = 0; i < clist.size(); i++) res += clist[i] * d[i][c];
    return res;
}

int main() {
    int n, c;
    cin >> n >> c;
    vector<vector<int>> d(c, vector<int>(c));
    for (int i = 0; i < c; i++) {
        for (int j = 0; j < c; j++) {
            cin >> d[i][j];
        }
    }
    vector<vector<int>> count(3, vector<int>(c, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            int tc;
            cin >> tc;
            tc--;
            count[(i + j) % 3][tc]++;
        }
    }
    int ans = INT_MAX;
    vector<int> v(3);
    for (int i = 0; i < c; i++) {
        v[0] = dc(count[0], i, d);
        for (int j = 0; j < c; j++) {
            if (i == j) continue;
            v[1] = dc(count[1], j, d);
            for (int k = 0; k < c; k++) {
                if (j == k || k == i) continue;
                v[2] = dc(count[2], k, d);
                chmin(ans, v[0] + v[1] + v[2]);
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

var (
	read  = bufio.NewReader(os.Stdin)
	write = bufio.NewWriter(os.Stdout)
)

func yesno(result bool) {
	if result {
		fmt.Fprintln(write, "Yes")
	} else {
		fmt.Fprintln(write, "No")
	}
}

func printansStr(result bool, a, b string) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func printansInt(result bool, a, b int) {
	if result {
		fmt.Fprintln(write, a)
	} else {
		fmt.Fprintln(write, b)
	}
}

func main() {
	defer write.Flush()

	var a, b int
	fmt.Fscan(read, &a, &b)

	printansInt(a <= 9 && b <= 9, a*b, -1)

}


Measured memory_bytes: 640
//21, 07, 2018, 09:53:29 Rafaelcs cpp
#include <bits/stdc++.h>

using namespace std;
typedef pair<int, int> pii;
typedef long double ld;
typedef long long ll;

typedef unsigned long long ull;

int a[3];
vector<int>v;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    
    for(int i = 0 ; i < 3 ; i++){
        cin >> a[i];
    }

    sort(a, a + 3);

    int best = 1e9;

    do{
        int tmp = abs(a[1] - a[0]) + abs(a[2] - a[1]);

        best = min(best, tmp);

    }while(next_permutation(a, a + 3));

    cout << best << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        String[] inputs = sc.nextLine().split(" ");
        int W = Integer.parseInt(inputs[0]);
        int a = Integer.parseInt(inputs[1]);
        int b = Integer.parseInt(inputs[2]);

        if ((a <= b && b <= a + W) || (a <= b + W && b + W <= a + W)) {
            System.out.println(0);
        } else {
            int result = Math.min(Math.abs(b - a - W), Math.abs(b + W - a));
            System.out.println(result);
        }
    }
}

Measured memory_bytes: 21844
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream> 
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
using namespace std;
#define eps 0.000000001
#define LONG_INF 10000000000000000
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007
#define REP(i,n) for(long long i = 0;i < n;++i)
int main() {
#define int long long
	int n;
	cin >> n;
	vector<long long> a;
	long long sum = 0;
	REP(i, n) {
		int tmp;
		cin >> tmp;
		a.push_back(tmp);
		sum += tmp;
	}
	long long hoge = 0;
	int ans = 0;
	long long nya = LONG_INF;
	for (int i = 0;i < n-1;++i) {
		sum -= a[i];
		hoge += a[i];
		if (llabs(hoge - sum) < nya) {
			nya = llabs(hoge - sum);
			ans = i+1;
		}
	}
	cout << nya << endl;
	return 0;
}

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

using namespace std;

const int MAX = 1e5 + 10;
int N, Q;
string S;
int l[MAX], r[MAX];

int cnt[MAX];

int calc(int ll, int rr) {
    int ans = cnt[rr] - cnt[ll - 1];
    if (ll - 2 >= 0 && S[ll - 2] == 'A' && S[ll - 1] == 'C') {
        ans--;
    }
    return ans;
}

int main() {
    cin >> N >> Q;
    cin >> S;
    for (int i = 0; i < Q; i++) {
        cin >> l[i] >> r[i];
    }

    for (int i = 0; i < N - 1; i++) {
        if (S[i] == 'A' && S[i + 1] == 'C') {
            cnt[i + 2] = 1;
        }
    }
    for (int i = 0; i < MAX - 1; i++) {
        cnt[i + 1] += cnt[i];
    }

    // cout << S << endl;
    // for (int i = 0; i < S.size() + 1; i++) {
    //     cout << (i) << ": " << cnt[i] << endl;
    // }

    for (int i = 0; i < Q; i++) {
        cout << calc(l[i], r[i]) << endl;
    }
}


Measured memory_bytes: 2176
#include <iostream>
#include <iomanip>
#include<math.h>
#include<list>
#include <algorithm>
#include<set>
#include<vector>
#include<math.h>
#include<map>
#include<string>
#include <numeric>
#include <queue>
#include <sstream>
#include <bitset>
#include<stack>

using namespace std;
using ll = long long;
using vll = vector<long long>;
using sll = set<long long>;

template<typename T>
T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T>
T lcm(T a, T b) { return a / gcd(a, b) * b; }

template<typename T>
map<T, T> getPrimeFactor(T n) {
	map<T, T> res;
	for (T i = 2; i * i <= n; ++i) {
		while (n % i == 0) {
			res[i] ++;
			n /= i;
		}
	}
	if (n != 1) res[n] = 1;
	return res;
}

template<typename T>
bool IsPrimeNumber(T num)
{
	if (num <= 2) return true;
	else if (num % 2 == 0) return false;

	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			return false;
		}
	}

	return true;
}

long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

#define rep(i,s,e) for(ll i=s;i<e;i++)
#define repeq(i,s,e) for(ll i=s;i<=e;i++)

int main() {
	ll N, M;
	std::cin >> N >> M;

	std::cout << N * (N - 1)/2 + M * (M - 1)/2 << endl;

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int a,b,c,k;
int main()
{
    scanf("%d%d%d%d",&a,&b,&c,&k);
    int cnt=0;
    while(b<=a) b*=2,cnt++;
    while(c<=b) c*=2,cnt++;
    if(cnt>k) puts("No"); else puts("Yes");
    return 0;
 }

Measured memory_bytes: 3688
import java.util.*;

public class Main {

    static final int MOD=1000000007;

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int n =sc.nextInt();
        int b[] = new int[n];
        int ans[] = new int[n];
        for(int i=0;i<n;i++)b[i]=sc.nextInt();

        for(int j=n;j>0;j--) {

            int remove = -1;
            int index=-1;
            for (int i = 0; i < j; i++) {
                if (b[i] == i + 1) {
                    remove = Math.max(remove, b[i]);
                    index = i;
                }
            }

            if (remove == -1) {
                System.out.println(-1);
                return;
            }
            b[index]=-1;
            ans[j-1]=remove;
            boolean flag=false;
            for(int i=0;i<j-1;i++){
                if(flag){
                    b[i]=b[i+1];
                }else{
                    if(b[i]==-1){
                        flag=true;
                        b[i]=b[i+1];
                    }
                }

            }

        }
        for(Integer a:ans) System.out.println(a);
    }
}


Measured memory_bytes: 23636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const ll MOD = 1000000007;
const ld PI = acos(-1);  
const ld EPS = 0.0000000001;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define rep(i, n) for(ll i=0; i<(ll)(n); i++)
#define repd(i, n) for(ll i=n-1; 0<=i; i--)
#define FOR(i, a, b) for(ll i=a; i<(ll)(b); i++)
#define FORD(i, a, b) for(ll i=a-1; (ll)(b)<=i; i--)
#define ALL(x) x.begin(), x.end()
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
    string s;   cin >> s;
    ll q, state=0;   cin >> q;
    rep(i, q){
        ll op;  cin >> op;
        if(op==1){
            state = !state;
        }else{
            ll a;
            char c; cin >> a >> c;
            a--;
            if(state) a = !a;
            if(!a) s = c+s;
            else s += c;
        }
    }
    if(state) reverse(ALL(s));
    cout << s << endl;
}


Measured memory_bytes: 4720
n = int(input())
H = list(map(int,input().split()))
inf = float('INF')
dp = [inf]*n
dp[0] = 0
for i in range(0,n-1):
    if i != n-2:dp[i+2]=min(dp[i+2],dp[i]+abs(H[i+2]-H[i]))

    dp[i+1]=min(dp[i+1],dp[i]+abs(H[i+1]-H[i]))

print(dp[-1])

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

using namespace std;

typedef long long ll;
typedef long long unsigned int llui;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef set<int> si;
typedef map<string, int> msi;
typedef map<int, int> mii;

#define INF 1000000000
#define MOD 1000000007
#define EPS 1e-9
#define DEBUG(x) cout<< '>' << #x << ':' << x << "\n";
#define ALL(x) (x).begin(), (x).end()
#define SORT(x) sort((x).begin(),(x).end())
#define UNIQUE(x) SORT(x),(x).erase(unique((x).begin(),(x).end()),(x).end())
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define LB lower_bound
#define UB upper_bound
#define SZ(a) int((a).size())
#define CLR(a) memset(a,0,sizeof(a))
#define SET(a,b) memset(a,b,sizeof(a))

#define FOR(i,a,b) for (int i = int(a); i < int(b); i++)
#define FORD(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 REP1(i,n) for (int i = 1; i <= int(n); i++)
#define REV(i, n) for (int i = int(n)-1; i >=0 ; i--)

#define sd(n) scanf("%d",&n)
#define dsd(n) int n; scanf("%d",&n)
#define sd2(a,b) scanf("%d%d",&a,&b)
#define dsd2(a,b) int a,b; scanf("%d%d",&a,&b)
#define sd3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define dsd3(a,b,c) int a,b,c; scanf("%d%d%d",&a,&b,&c)
#define pd(n) printf("%d\n",n)
#define pds(n) printf("%d ",n)
#define sll(n) scanf("%lld",&n)
#define dsll(n) ll n; scanf("%lld",&n)
#define sll2(a,b) scanf("%lld%lld",&a,&b)
#define dsll2(a,b) ll a,b; scanf("%lld%lld",&a,&b)
#define sll3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define dsll3(a,b,c) ll a,b,c; scanf("%lld%lld%lld",&a,&b,&c)
#define pll(n) printf("%lld\n",n)	
#define plls(n) printf("%lld ",n)	
#define print(x) cout<< x << "\n"

#define trace(x) cout << '>' << #x << ':' << x << "\n"
#define trace2(x,y) cout<< '>' << #x << ':' << x << " | " << #y << ':' << y << "\n"
#define trace3(a,b,c) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n"
#define trace4(a,b,c,d) cout<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n"

inline int two(int n) { return 1 << n; }
inline int test(int n, int b) { return (n>>b)&1; }
inline void set_bit(int & n, int b) { n |= two(b); }
inline void unset_bit(int & n, int b) { n &= ~two(b); }
inline int last_bit(int n) { return n & (-n); }
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }

#define LSOne(S) (S&(-S))

const double pi = acos(-1);
const int oo = 0x3f3f3f3f;

int cmp(double x, double y = 0, double tol = EPS) {
    return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1;
}

/////////////////////////////////////////////////////////////////////

const int MAX_N = 110;
//int arr[MAX_N];

int main(){
    dsd(n);
    vvi V(n,vi(3));
    vvi A(n,vi(3));
    REP(i,n) REP(j,3) sd(A[i][j]);
    REP(j,3) V[0][j]=A[0][j];
    REP1(i,n-1){
        REP(j,3){
            int n=(j+1)%3,p=(j+2)%3;
            V[i][j]=max(V[i-1][n],V[i-1][p]);
            V[i][j]+=A[i][j];
        }
    }
    int ans=0;
    REP(i,3) ans=max(ans,V[n-1][i]);
    pd(ans);
	return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <math.h>
#include <complex>
#include <cstdio>
#include <iomanip>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef double D;      // 座標値の型。doubleかlong doubleを想定
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;
const D EPS = (1e-10);    // 許容誤差。問題によって変える
#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

namespace std {
  bool operator<(const P a, const P b) {
    return a.X != b.X ? a.X < b.X : a.Y < b.Y;
  }
}

// 内積　dot(a,b) = |a||b|cosθ
D dot(P a, P b) {
  return (conj(a)*b).X;
}
// 外積　cross(a,b) = |a||b|sinθ
D cross(P a, P b) {
  return (conj(a)*b).Y;
}

int ccw(P a, P b, P c) {
  b -= a;  c -= a;
  if (cross(b,c) >  EPS) return +1;  // counter clockwise
  if (cross(b,c) < -EPS) return -1;  // clockwise
  if (dot(b,c)   < -EPS) return +2;  // c--a--b on line
  if (norm(b) < norm(c)) return -2;  // a--b--c on line or a==b
  return 0;                          // a--c--b on line or a==c or b==c
}

bool isecLP(P a1, P a2, P b) {
  return abs(ccw(a1, a2, b)) != 1;
}

bool isecLL(P a1, P a2, P b1, P b2) {
  return !isecLP(a2-a1, b2-b1, 0) || isecLP(a1, b1, b2);
}

VP convexHull(VP &ps) {
  int n = ps.size(), k = 0;
  sort(ps.begin(), ps.end());
  VP ch(2*n);
  for (int i = 0; i < n; ch[k++] = ps[i++]) // lower-hull
    while (k >= 2 && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;  // 余計な点も含むなら == -1 とする
  for (int i = n-2, t = k+1; i >= 0; ch[k++] = ps[i--]) // upper-hull
    while (k >= t && ccw(ch[k-2], ch[k-1], ps[i]) <= 0) --k;
  ch.resize(k-1);
  return ch;
}

D area(const VP& ps) {
  D a = 0;
  rep (i, ps.size()) a += cross(ps[i], ps[(i+1) % ps.size()]);
  return a / 2;
}

int main() {
  D x, y;
  VP ps;
  while (scanf("%lf,%lf", &x, &y) != EOF) {
    ps.push_back(P(x, y));
  }
  std::cout << fixed << setprecision(9) << abs(area(ps)) << std::endl;
  return 0;
}

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

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        boolean b = false;
        if (Algorithm.isNibeki((n))){
            Algorithm.prYesNo(0);
        }else {
            Algorithm.prYesNo(1);
            System.out.println(1 +" " + 2);
            System.out.println(1 +" " + 3);
            System.out.println(3 +" " + (n+2));
            System.out.println((n+1) +" " + (n+2));
            System.out.println(2 +" " + (n+3));
            for (int i = 4; i <= n; i++) {
                if(i == n && i % 2 == 0){
                    b = true;
                    break;
                }
                    System.out.println(1 + " " + i);
            }
            for (int i = n+4; i <=2*n; i++) {
                if(n%2 == 0 && i == 2*n){
                    break;
                }
                if (Algorithm.isOdd(i-n)){
                    System.out.println(i + " " + (i-n-1));
                }else{
                    System.out.println(i + " " + (i-n+1));
                }
            }

            if(b){
                int nn = n;
                int k = 1;
                while(nn != 1){
                    nn = nn>>1;
                    k = k<<1;
                }
                System.out.println(n + " " + k);
                System.out.println(2*n + " " + (n^1^k) );
            }
        }


        sc.close();
    }
}

class Algorithm{
    public static void prYesNo(int y){
        System.out.println(y == 1 ? "Yes" : "No");
    }
    public static boolean isOdd(int n){
        return n % 2 == 1;
    }

    public static boolean isNibeki(int n){
        if (n==1){
            return true;
        }
        if(n%2==0){
            return isNibeki(n/2);
        }else {
            return false;
        }
    }
}



Measured memory_bytes: 45860
#include <iostream>
#include <array>
#include <string>

int main() {
  std::array<std::array<std::array<int, 10>, 3>, 4> rooms {};
  for (int i=0; i<4; i++)
    {
      for(int j=0; j<3; j++)
        rooms.at(i).at(j).fill(0);
    }

  int n;
  std::cin >> n;

  int b, f, r, v;

  for (int i=0; i<n; i++)
    {
      std::cin >> b >> f >> r >> v;
      rooms.at(b-1).at(f-1).at(r-1) += v;
    }

  for (int b=0; b<4; b++)
    {
      for (int f=0; f<3; f++)
        {
          for (int r=0; r<10; r++)
            std::cout << ' ' << rooms.at(b).at(f).at(r);
          std::cout << std::endl;
        }if (b!=3)
      std::cout << std::string(20, '#') << std::endl;
    }
}


Measured memory_bytes: 3136
INF = 10 ** 9 + 7

S = input()
# dp[i][j]はうしろからi桁を13で割った余りがjであるものの個数
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= INF
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= INF
    mul = mul * 10 % 13  # 計算量削減のためここで13で割っている

print(dp[len(S)][5])

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  long long ans = 1000, kabu = 0;
  rep(i,n) {
    if(i == n-1) {
      ans += kabu * a[i];
      break;
    }else if(a[i] < a[i+1] && kabu == 0) {
      kabu = ans / a[i];
      ans -= kabu * a[i];
    }else if(a[i] > a[i+1] && kabu != 0) {
      ans += kabu * a[i];
      kabu = 0;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 3632
N = int(input())

A = tuple(map(int, input().split()))

has_zero = False
min_abs = 10**5
sum_abs = 0
for i in range(N):
    if A[i] == 0:
        has_zero = True
    sum_abs += abs(A[i])
    if abs(A[i]) < min_abs:
        min_abs = abs(A[i])

minus = (tuple(filter(lambda x: x < 0, A)))
cnt_minus = len(minus)
if cnt_minus % 2 == 0 or has_zero == True:
    print(sum_abs)
else:
    print(sum_abs - 2*min_abs)



Measured memory_bytes: 14452
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<cmath>
#include<algorithm>
#include<map>
#include<vector>
#include<sstream>
#include<iostream>
using namespace std;
struct Data{
    char c;
    int n;
    Data(){
        n = 0;
        c = 'A';
    }
};
Data a[1000020];
int main(void){

    int n,m;
    while(cin>>n>>m,n){
        string s;
        cin>>s;
        string t = "";
        for(int i = 0;i < 1000020;i++)a[i] = Data();
        for(int i = 0;i < s.size()-1;i++){
            if(s[i] == 'I' && s[i+1] == 'O'){
                t += 'J';
                i++;
            }
            else t += s[i];
        }
        char ch = 'A';
        int g = -1;
        for(int i = 0;i < t.size();i++){
            if(ch == t[i])a[g].n++;
            else{
                ch = t[i];
                g++;
                a[g].c = ch;
                a[g].n = 1;
            }
        }
        g++;
        int ans = 0;
        for(int i = 0;i < g;i++){
            if(a[i].c == 'J'){
                if(a[i].n > n)ans += a[i].n - n;
                if(a[i].n >= n && a[i+1].c == 'I')ans++;
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 10980
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String S = sc.next();

		String[] list = S.split("", 0);

		if (list[2].equals(list[3])  & list[4].equals(list[5])) {
			System.out.println("Yes");
		}else {
			System.out.println("No");
		}
	}
}

Measured memory_bytes: 21844
// 

#include <cstdio>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <map>
#include <cmath>
#include <stack>

#define REP(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;

int main(){
  int a, b;
  int cnt = 0;

  cin >> a >> b;
  cnt += (a-1);
  if(a <= b) cnt++;
  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < n; i++)
#define repr(i, n) for(ll i = n; i >= 0; i--)
#define inf LLONG_MAX
#define all(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;


int main()
{
    ll n; cin >> n;
    ll o = 0, e = 0, e4 = 0;
    rep(i, n) {
        ll num; cin >> num;
        if (num % 4 == 0) {
            e4++;
        } else if (num % 2 == 0) {
            e++;
        } else {
            o++;
        }
    }

    if (e == 0) {
        if (o <= e4 + 1) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    } else {
        if (o <= e4) {
            cout << "Yes" << endl;
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

var sc *bufio.Scanner

const BufferSize = 1024

func nextInt() int {
	if !sc.Scan() {
		panic(nil)
	}
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var production bool

func debugf(format string, v ...interface{}) {
	if !production {
		fmt.Printf(format, v...)
	}
}

const MOD = 1000000000 + 7

// sum
// 1 2 3
// 2 5 9
// 3 9 19

// dp
// 1 1 1
// 1 2 3
// 1 3 6

func answer(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	s := make([]int, n)
	t := make([]int, m)
	dp := make([][]int, n)
	sum := make([][]int, n)

	for i := range s {
		s[i] = nextInt()
		dp[i] = make([]int, m)
		sum[i] = make([]int, m)
	}
	for i := range t {
		t[i] = nextInt()
	}

	for i := range s {
		for j := range t {
			if s[i] == t[j] {
				dp[i][j] = 1
				if i > 0 && j > 0 {
					dp[i][j] += sum[i-1][j-1]
					dp[i][j] %= MOD
				}
			}
			sum[i][j] = dp[i][j]
			if i > 0 {
				sum[i][j] += sum[i-1][j]
				sum[i][j] %= MOD
			}
			if j > 0 {
				sum[i][j] += sum[i][j-1]
				sum[i][j] %= MOD
			}
			if i > 0 && j > 0 {
				sum[i][j] -= sum[i-1][j-1]
				if sum[i][j] < 0 {
					sum[i][j] += MOD
				}
				sum[i][j] %= MOD
			}
		}
	}
	debugf("dp: %v\n", dp)
	debugf("sum: %v\n", sum)
	_, _ = fmt.Fprintf(writer, "%d", sum[n-1][m-1]+1)
}

func seek(s *[]int, t *[]int, c *[][]int, i int, j int) int {
	ans := 0
	if i+1 >= len(*s) || j+1 >= len(*t) {
		return 0
	}
	if (*c)[i+1][j+1] >= 0 {
		return (*c)[i+1][j+1]
	}

	for k := i + 1; k < len(*s); k++ {
		for l := j + 1; l < len(*t); l++ {
			if (*s)[k] == (*t)[l] {
				ans++
				ans %= MOD
				ans += seek(s, t, c, k, l)
				ans %= MOD
			}
		}
	}

	(*c)[i+1][j+1] = ans
	//debugf("i: %d, j: %d, ans: %d\n", i, j, ans)
	return ans
}

func answer_naive(reader io.Reader, writer io.Writer) {
	sc = bufio.NewScanner(reader)
	buf := make([]byte, BufferSize)
	sc.Buffer(buf, 1e+6)
	sc.Split(bufio.ScanWords)
	n := nextInt()
	m := nextInt()
	s := make([]int, n)
	t := make([]int, m)
	c := make([][]int, n)

	for i := range s {
		s[i] = nextInt()
		c[i] = make([]int, m)
		for j := range t {
			c[i][j] = -1
		}
	}
	for i := range t {
		t[i] = nextInt()
	}

	for i := 0; i < n; i++ {
		for j := 0; j < m; j++ {
			_ = seek(&s, &t, &c, n-i-1, n-j-1)
		}
	}

	ans := 1
	ans += seek(&s, &t, &c, -1, -1)
	/*
		for i := 0; i < n; i++ {
			for j := 0; j < m; j++ {
				if s[i] == t[j] {
					ans++
					ans %= MOD
					ans += seek(&s, &t, &c, i, j)
					ans %= MOD
				}
			}
		}
	*/
	_, _ = fmt.Fprintf(writer, "%d", ans)
}

func main() {
	production = true
	answer(os.Stdin, os.Stdout)
}


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

int main()
{
  vector<int> card(9);
  for (int i = 0; i < 3; i++)
    for (int j = 0; j < 3; j++)
      cin >> card.at(i * 3 + j);

  vector<bool> hit(9);
  
  int n;
  cin >> n;
  
  int tmp;
  vector<vector<int>> patterns = {
    {0, 1, 2},
    {3, 4, 5},
    {6, 7, 8},
    {0, 3, 6},
    {1, 4, 7},
    {2, 5, 8},
    {0, 4, 8},
    {2, 4, 6}
  };
  
  for (int i = 0; i < n; i ++)
  {
    cin >> tmp;
    auto idx = find(card.begin(), card.end(), tmp);
    if (idx != card.end())
    {
      hit.at(distance(card.begin(), idx)) = true;
      for (int j = 0; j < 8; j ++)
      {
        if (
          hit.at(patterns.at(j).at(0)) == true && 
          hit.at(patterns.at(j).at(1)) == true && 
          hit.at(patterns.at(j).at(2)) == true
        )
        {
          cout << "Yes" << endl;
          return 0;
        }
      }
    }
  }

  cout << "No" << endl;

  return 0;
}



Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**9)

def main():
    n = int(input())
    a = [input() for i in range(n)]

    C = {'AC': 0,
         'WA': 0,
         'TLE': 0,
         'RE': 0
         }

    for i_a in a:
        for j_C, j_num in C.items():
            if i_a == j_C:
                C[j_C] = j_num + 1

    for j_C, j_num in C.items():
        print('%s x %s' % (j_C, j_num))
    return


if __name__ == "__main__":
    main()
    sys.exit(0)

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

using namespace std;
#define FOR(i,bg,ed) for(int i=bg;i<ed;i++)
#define REP(i,n) FOR(i,0,n)


typedef vector<int> V;
int f(int bg,V bit,V b){
    int ret=0;
    int id=0;
    int n =bit.size();
    for(auto &it:b){
        while(it>0){
            //cout<<id<<endl;
            int i;
            for(i=id;bit[i]!=bg;i++){
                if(i+1>=n)return 1000000;
            }
            while(i>id){
                swap(bit[i],bit[i-1]);
                ret++;
                i--;
            }
            id++;
            it--;
        }
        bg=1-bg;
    }
    return ret;
}
int main(){
    int n,m;
    cin>>n>>m;
    V a(n);
    V b(m);
    REP(i,n)cin>>a[i];
    REP(i,m)cin>>b[i];
    cout<<min(f(0,a,b),f(1,a,b))<<endl;
    return 0;
}

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

#define df(b, e) ((b) > (e))
#define fore(i, b, e) for(auto i = (b) - df(b, e); i != e - df(b, e); i += 1 - 2 * df(b, e))
#define sz(x) (int) x.size()
#define all(x) x.begin(), x.end()
#define f first
#define s second
#define pb push_back

typedef long long lli;
typedef long double ld;
typedef pair<int, int> ii;

template <class T>
struct rge { T b, e; };

template <class T>
rge<T> range(T i, T j) {
  return rge<T>{i, j};
}

template <class T> auto dud(T *x) -> decltype(cerr << *x, 0);
template <class T> char dud(...);

struct debug {
#ifdef LOCAL
  ~debug() { cout << endl; }

  template <class T>
  typename enable_if<sizeof dud<T>(0) != 1, debug &>::type operator << (T i) {
    cout << boolalpha << i;
    return *this;
  }

  template <class T>
  typename enable_if<sizeof dud<T>(0) == 1, debug &>::type operator << (T i) {
    return *this << range(begin(i), end(i));
  }

  template <class A, class B>
  debug & operator << (pair<A, B> d) {
    return *this << "(" << d.first << ", " << d.second << ")";
  }

  template <class T>
  debug & operator << (rge<T> d) {
    *this << "[";
    for (auto it = d.b; it != d.e; ++it)
      *this << ", " + 2 * (it == d.b) << *it;
    return *this << "]";
  }
#else
  template <class T> 
  debug & operator << (const T&) {
    return *this; 
  }
#endif
};

#define deb(...) " " << #__VA_ARGS__ ": " << (__VA_ARGS__) << " "

const int N = 101;
const int D = 80;

bitset<N> isp;
vector<int> primes;
unordered_map<lli, int> mem[N][D]; // won't work
int n;

vector< pair<lli, int> > factorialFactors(int n) {
  vector< pair<lli, int> > fac;
  for (lli p: primes) {
    if (n < p)
      break;
    lli mul = 1LL, k = 0;
    while (mul <= n / p) {
      mul *= p;
      k += n / mul;
    }
    fac.pb({p, k});
  }
  return fac;
}

int inline dp(int i, int divs, lli num, vector< pair<lli, int> > &fac) {
  if (divs % 2 == 0)
    return 0;
  if (i == sz(fac))
    return 0;
  if (divs == 75)
    return 1;
  if (mem[i][divs].count(num))
    return mem[i][divs][num];
  int ans = 0;
  lli mul = 1LL;
  fore (k, 0, fac[i].s + 1) {
    if (divs * (k + 1) > 75)
      break;
    ans += dp(i + 1, divs * (k + 1), num * mul, fac);
    mul *= fac[i].f;
  }
  return mem[i][divs][num] = ans;
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  isp.set();
  isp[0] = isp[1] = 0;
  fore (i, 2, N) if (isp[i]) {
    primes.pb(i);
    if (1LL * i * i < N)
      for (int j = i * i; j < N; j += i)
        isp[j] = 0;
  }
  cin >> n;
  auto fac = factorialFactors(n);
  debug() << deb(fac);
  cout << dp(0, 1LL, 1LL, fac) << '\n';
  return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define rep2(i,a,n) for(int i=(a); i<(n); i++)
#define all(vec) vec.begin(),vec.end()
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
int main() {
  string W; cin >> W;
   
  map<char, int> mp;
    rep(i, W.size()) mp[W[i]]++;
  for (auto itr : mp){
    if (itr.second%2 == 1) {cout << "No" << endl; return 0;}
  }
  cout << "Yes" << endl;
  return 0;
}
  

Measured memory_bytes: 3616
#include<stdio.h>
int main(){

  int s,i,j,temp,a[20];

  for(i=0;i<10;i++)
      scanf("%d",&a[i]);

  for(i=0;i<10;i++){
      for(j=i+1;j<10;j++){
           if(a[i]>a[j]){
               temp=a[i];
              a[i]=a[j];
              a[j]=temp;
           }
      }
  }
  for(i=9;i>=7;i--)
      printf("%d\n",a[i]);

  return 0;
}

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

int main(){
  int N, L;
  cin >> N >> L;
  int S=0;
  for(int i=0; i<N; i++) S+=L+i;
  if (L<=0 && L+N-1>=0) cout << S;
  else if (abs(L)<abs(L+N-1)) cout << S-L;
  else cout << S-(L+N-1);
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(cin.hasNext()){
			String str = cin.next();
			String ans = "";
			for(int i = 0; i < str.length();i++){
				if(str.charAt(i)=='@'){
					i++;
					int c = str.charAt(i)-'0';
					i++;
					for(int j = 0;j  < c;j++){
						ans+=str.charAt(i);
					}
				}
				else{
					ans+=str.charAt(i);
				}
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 11000
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int x,a;
    cin >> x;
    a = x / 100;
    if (a * 100 <= x && x <= a * 105)
    {
         cout << '1' << endl;
    }else{
         cout << '0' << endl;
     }
}

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

int gcd(int x,int y){
	if(y==0) return x;
	else return gcd(y,x%y);
}

int lcm(int x,int y){
	return x*y/gcd(x,y);
}
 
signed main(){
	char w,x,y,z;
	cin>>w>>x>>y>>z;
	int a=w-'0',b=x-'0',c=y-'0',d=z-'0';
	if(a+b+c+d==7)cout<<a<<'+'<<b<<'+'<<c<<'+'<<d<<'='<<7<<endl;
	else if(a-b+c+d==7)cout<<a<<'-'<<b<<'+'<<c<<'+'<<d<<'='<<7<<endl;
	else if(a+b-c+d==7)cout<<a<<'+'<<b<<'-'<<c<<'+'<<d<<'='<<7<<endl;
	else if(a+b+c-d==7)cout<<a<<'+'<<b<<'+'<<c<<'-'<<d<<'='<<7<<endl;
	else if(a-b-c+d==7)cout<<a<<'-'<<b<<'-'<<c<<'+'<<d<<'='<<7<<endl;
	else if(a-b+c-d==7)cout<<a<<'-'<<b<<'+'<<c<<'-'<<d<<'='<<7<<endl;
	else if(a+b-c-d==7)cout<<a<<'+'<<b<<'-'<<c<<'-'<<d<<'='<<7<<endl;
	else if(a-b-c-d==7)cout<<a<<'-'<<b<<'-'<<c<<'-'<<d<<'='<<7<<endl;
}

Measured memory_bytes: 256
class Node
    attr_accessor :parent, :rank
  
    def initialize(n)
      @parent = n
      @rank = 0
    end
  end
  
class UnionFindTree
  def initialize(n)
    @nodes = (0..n).to_a.map { |i| Node.new(i) }
  end

  def find(x)
    return x if @nodes[x].parent == x

    return @nodes[x].parent = find(@nodes[x].parent)
  end

  def unite(a, b)
    a = find(a)
    b = find(b)
    return if a == b

    if @nodes[a].rank < @nodes[b].rank
      @nodes[a].parent = b
    else
      @nodes[b].parent = a
      @nodes[a].rank += 1 if @nodes[a].rank == @nodes[b].rank
    end
  end
 
  def same?(a, b)
    find(a) == find(b)
  end
  
  def parents
    @nodes.map(&:parent)
  end
end
  
n,m = gets.chomp.split.map(&:to_i)
p = gets.chomp.split.map(&:to_i)
tree = UnionFindTree.new(n)
m.times do
  x, y = gets.chomp.split.map(&:to_i)
  tree.unite(x,y)
end

ans = 0
for i in 1..n
    ans += 1 if tree.same?(i, p[i-1])
end
puts ans

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

using namespace std;

typedef long long ll;
const int MAX = 100005;
const int MOD = 1000000007;

#define F first
#define S second


void solve()
{
	ll n;
	cin>>n;
	vector<pair<ll,ll> > arr(n);
	for(int i=0;i<n;i++)
	{
		cin>>arr[i].S>>arr[i].F;
	}
	sort(arr.begin(),arr.end());
	ll time=0;
	ll flag=1;
	for(int i=0;i<n;i++)
	{
		if(arr[i].F>=(arr[i].S+time))
		{
			time+=arr[i].S;
		}
		else
		{
			flag=0;
			time+=arr[i].S;
		}
	}
	if(flag)
		cout<<"Yes\n";
	else
		cout<<"No\n";
	return;
}
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	solve();
	return 0;
}

Measured memory_bytes: 3328
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;

int main()
{
	double r;
	cin >> r;
	cout << fixed << setprecision(6);
	cout << r * r * M_PI << " " << 2 * r * M_PI << endl;
	return 0;
}



Measured memory_bytes: 3272
#include <bits/stdc++.h>
#define err(args...) {}
#ifdef DEBUG
#include "_debug.cpp"
#endif
using namespace std;
using ll = long long;
template <typename T> using lim = numeric_limits<T>;
template <typename T> istream& operator>>(istream& is, vector<T>& a) { for(T& x : a) { is >> x; } return is; }
const int N = 50;
int n, a, x[N];
ll mem[N+1][N*N+1][N+1];
ll C(int i, int sum, int sel) {
    ll& ans = mem[i][sum][sel];
    if(ans == -1) {
        if(i == n) {
            ans = sel * a == sum;
        } else {
            ans = C(i + 1, sum, sel) + C(i + 1, sum + x[i], sel + 1);
        }
    }
    return ans;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> a;
    for(int i = 0; i < n; i++) {
        cin >> x[i];
    }
    memset(mem, -1, sizeof mem);
    cout << C(0, 0, 0) - 1 << endl;
    return 0;
}


Measured memory_bytes: 51072
n = int(input())
a = list(map(int,input().split()))
pdt = 1
a.sort()
for i in range(n):
  pdt *= a[i]
  if pdt==0:
    print(pdt)
    break
  elif pdt>10**18:
    print(-1)
    break
else:
  print(pdt)

Measured memory_bytes: 21632
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#define MOD 1000000007
using namespace std;

typedef pair<int, int> P;
typedef pair<long long, long long> LLP;

int main() {
    int N;
    cin >> N;
    int V[N], C[N];
    int sum = 0;
    for (int i = 0; i < N; i++) {
        cin >> V[i];
    }
    for (int i = 0; i < N; i++) {
        cin >> C[i];
    }
    for (int i = 0; i < N; i++) {
        sum += (V[i] > C[i] ? V[i] - C[i] : 0);
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

#define ll long long int

int main() {
  int n;
  cin >> n;
  int a = 0;
  for(int i=1; i<=n; i++) {
    int m;
    cin >> m;
    if(m != i) {
      a++;
    }
  }
  if(a == 0 || a == 2) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//
//
//using namespace __gnu_pbds;
using namespace std;

#define pb                     push_back
#define ll                     long long
#define forn(i,n)              for(int i=0; i<(int)n; i++)
#define forn1(i,n)              for(int i=1; i<=(int)n; i++)

#define sfd(a)                 scanf("%d", &a)
#define sffd(a,b)              scanf("%d%d", &a, &b)
#define sffl(a,b)              scanf("%lld%lld", &a,&b)
#define sfl(a)                 scanf("%lld", &a)

#define pii                    pair<int , int>
#define pll                    pair<ll , ll>
#define ff                     first
#define ss                     second
#define mem(a, val)            memset(a, val, sizeof(a))
#define all(x)                 (x).begin(), (x).end()

#define mx                     200005
#define INF_mx                 1e18
#define gcd(a,b)               __gcd(a, b)
#define lcm(a,b)               (a*b)/__gcd(a,b)
#define PRINT                  cout<<"hi"<<endl
#define PI acos(-1)
#define fast_in_out          ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define Q    int q; cin>>q; while(q--)
/*
tree<
       int,
     null_type,
     less<int>,
     rb_tree_tag,
     tree_order_statistics_node_update>t;
*/

int main()
{
   string s, t;
   cin>>s;
   t=s;
   reverse(all(t));
   if(s==t){
        int sz=s.size();
     for(int i=0, j=(sz/2)-1;  i<=j ; i++, j-- ){
        if(s[i]!=s[j]) {puts("No");return 0;}
     }
     for(int i=(sz+3)/2-1, j=sz-1 ;  i<=j ; i++, j-- ){
        if(s[i]!=s[j]) {puts("No");return 0;}
     }
     puts("Yes");
   }else puts("No");
    return 0;
}
/*

 6 4

 2 4 5
 0

*/


Measured memory_bytes: 256