akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>

using namespace std;

vector<vector<int> > G;
vector<long long> b, w;
typedef long long ll;
ll mod = 1e9+7;

ll dfs_b(int s, int p);

ll dfs_w(int s, int p) {
    if (w[s] != -1)
        return w[s];
    ll cnt = 1;
    for (auto u: G[s]) {
        if (u == p)
            continue;
        
        ll tmp = dfs_w(u, s) + dfs_b(u, s);
        tmp %= mod;
        cnt *= tmp;
        cnt %= mod;
    }

    return w[s] = cnt;
}

ll dfs_b(int s, int p) {
    if (b[s] != -1)
        return b[s];
    ll cnt = 1;
    for (auto u: G[s]) {
        if (u == p)
            continue;
        
        cnt *= dfs_w(u, s);
        cnt %= mod;
    }

    return b[s] = cnt;
}

int main() {
    int n;  cin >> n;
    G.resize(n);
    w.resize(n, -1);
    b.resize(n, -1);

    for (int i = 0; i < n-1; i++) {
        int x, y;   cin >> x >> y;
        G[x-1].push_back(y-1);
        G[y-1].push_back(x-1);
    }

    cout << (dfs_w(0, -1) + dfs_b(0, -1)) % mod << endl;
    
    return 0;
}

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

namespace AOJ0016
{
    class Program
    {
        static void Main()
        {
            var walker = new Walker();

            string line;
            while ((line = Console.ReadLine()) != null)
            {
                var values = line.Split(',').Select(int.Parse).ToArray();
                if (values[0] == 0 && values[1] == 0) break;
                walker.Walk(values[0]);
                walker.Rotate(-values[1]);
            }

            Console.WriteLine((int)walker.X);
            Console.WriteLine((int)walker.Y);
        }
    }

    class Walker
    {
        public double X { get; private set; }
        public double Y { get; private set; }
        public double Angle { get; private set; }

        public Walker()
        {
            Angle = 90;
        }

        public void Walk(double distance)
        {
            X += distance * Math.Cos(Angle / 180 * Math.PI);
            Y += distance * Math.Sin(Angle / 180 * Math.PI);
        }

        public void Rotate(double angle)
        {
            Angle += angle;
        }
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpii;

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

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

void solve(int test_case) {
	int n;
	cin>>n;
	vi arr(n+1);
	for(int i=1;i<=n;i++)cin>>arr[i];
	bitset<100001> b;
	int last = 1;
	bool loop =false;
	while(!loop&&last!=2) {
		if(b[last]){loop=true;break;}
		b[last]=1;
		last=arr[last];
	}
	if(!loop) {
		cout<<b.count();
	} else {
		cout<<-1;
	}
}

int main() {
	
	////// FILE BASED IO////
	//freopen("in", "r", stdin);
	//freopen("out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
}	


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

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int cnt=0;
  if(a==b) cnt++;
  if(b==c) cnt++;
  if(c==a) cnt++;
  
  if(cnt==1) cout << "Yes";
  else cout << "No";
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        int t = Integer.parseInt(sc.next());
        double a = Double.parseDouble(sc.next());
        double minDiff = Integer.MAX_VALUE;
        int ans = 0;

        List<Integer> heightList = new ArrayList<>();

        for (int i = 1; i <= n; i++) {
        	int x = Integer.parseInt(sc.next());
        	double ti = t - x * 0.006;
        	if (Math.abs(a - ti) < minDiff) {
                ans = i;
                minDiff = Math.abs(a - ti);
        	}
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 21588
#![allow(non_snake_case)]
use std::collections::HashMap;
use std::io::{stdin, Read};
use std::str::FromStr;
fn read_option<T: FromStr>() -> Option<T> {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok()
}
fn read<T: FromStr>() -> T {
    let opt = read_option();
    opt.expect("failed to parse token")
}

fn main() {
    let N: usize = read();
    let mut map: HashMap<String, usize> = HashMap::new();
    let mut rev_map: HashMap<usize, Vec<String>> = HashMap::new();
    let mut max = 0;
    for _ in 0..N {
        let str: String = read();
        let entry = map.entry(str.clone()).or_insert(0);
        *entry += 1;
        let entry2 = rev_map.entry(*entry).or_insert(vec![]);
        (*entry2).push(str.clone());
        max = std::cmp::max(*entry, max);
    }
    let mut vec = rev_map.get(&max).unwrap().clone();
    vec.sort();
    for v in vec {
        println!("{}", v);
    }
}


Measured memory_bytes: 35068
n, m = map(int, input().split())
A = [str(input()) for _ in range(n)]
B = [str(input()) for _ in range(m)]
for i in range(n-m+1):
    for j in range(n-m+1):
        for x in range(m):
            for y in range(m):
                if A[j+y][i+x] != B[y][x]:
                    break
            else:
                continue
            break
        else:
            print('Yes')
            exit()
else:
    print('No')


Measured memory_bytes: 3060
use std::io::*;
use std::str::FromStr;
use std::cmp::{max, min};

fn read<T: FromStr> () -> T {
    let stdin = std::io::stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn gcd(n: usize, m: usize) -> usize {
    let mut cn = n;
    let mut cm = m;
    while cm != 0 {
        cn = cm;
        cm = cn % cm;
    }
    cn
}

fn main() {
    let N: usize = read();
    let M: usize = read();
    let mut data: Vec<(usize, usize)> = (0..N).map(|_| (read(), read())).collect();
    data.sort_by_key(|x| x.0);

    let mut acc: usize = 0;
    let mut ans: usize = 0;
    for (a, b) in data {
        let min = std::cmp::min(M - acc, b);
        ans += a * min;
        acc += min;
        if acc == M {
            break;
        }
    }
    println!("{}", ans);
}



Measured memory_bytes: 6396
// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

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

#define MAXCHAR 255

using namespace std;

set<int> integers;
int main()
{
	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		int input = 0;
		cin >> input;
		integers.insert(input);
	}
	if (integers.size() == n)
	{
		cout << "YES"<<endl;
	}
	else
	{
		cout << "NO" << endl;
	}

	return 0;
}

Measured memory_bytes: 9600
#include<stdio.h>
/*
(a,b)のうち両方が生き残っている場合が存在することを、「ペアで生き残る」と呼ぶ。
(a,b)のうちどちらかを食べる人が来たとき、次のようになる：
(a,b)→ペアで生き残ることはない。
(x,y)→変わらない。
(a,x)→ちょっと考えると、これがペアで生き残る必要十分条件は、
       (a,b)と(b,x)がどちらもペアで生き残っていることである。
*/

int N,M,x[100000],y[100000];
int i,j, alive[400][400],memox[400],memoy[400];/*生→1, 死→0*/
int ans;

int main(void){



	scanf("%d %d", &N, &M);
	for(i=0;i<M;i++){
		scanf("%d %d", &x[i], &y[i]);
		x[i]--;
		y[i]--;
	}

	for(i=0;i<N;i++){
		for(j=0;j<N;j++){
			alive[i][j] = 1;
		}
	}

	for(i=0;i<M;i++){
		for(j=0;j<N;j++){
			/*(x[i], j)について*/
			if(x[i]!=j){
				if(alive[x[i]][y[i]] == 0 || alive[y[i]][j] == 0){
					memox[j] = 0;	
				}else{
					memox[j] = 1;
				}
			}

			/*(y[i], j)について*/
			if(y[i]!=j){
				if(alive[x[i]][y[i]] == 0 || alive[x[i]][j] == 0){
					memoy[j] = 0;
				}else{
					memoy[j] = 1;
				}
			}
		}

		for(j=0;j<N;j++){
			if(x[i]!=j){
				alive[x[i]][j] = alive[x[i]][j]*memox[j];
				alive[j][x[i]] = alive[j][x[i]]*memox[j];
			}
			if(y[i]!=j){
				alive[y[i]][j] = alive[y[i]][j]*memoy[j];
				alive[j][y[i]] = alive[j][y[i]]*memoy[j];
			}
		}

		alive[x[i]][y[i]] = 0;
		alive[y[i]][x[i]] = 0;

	}

	ans = 0;
	for(i=0;i<N;i++){
		for(j=i+1;j<N;j++){
			if(alive[i][j] == 1){
				ans++;
			}
		}
	}
	printf("%d\n",ans);
}


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


int main(){
  string s;
  cin >> s;

  int n;
  cin >> n;
  string res = "";

  int count = 0;
  res += s[0];
  
  for(int i=0; i<s.size(); i++){
    if(count == n){
      res += s[i];
      count = 0;
    }
    count++;
  }

  cout << res << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cmath>
#include<iomanip>
#include<set>
using namespace std;
int main(){
int n;

cin>>n;

while(n){
    if(n%10==7)
    {
        cout<<"Yes";
        return 0;
    }
    n/=10;
}
cout<<"No";

}

Measured memory_bytes: 3580
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

#include <vector>
#include <stdio.h>
#include <iostream>
#include <unordered_set>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <random>
#include <time.h>
#include <cassert>
// #include <multiset>

#define prev askdnsajd
#define rank asasdmdnasd
#define next lsjndajbs
#define hash asmdklansd
#define index asdklnas
#define right sld
#define left sldl
using namespace std;

typedef long long ll;
typedef long double dbl;

template<class T>
void print(vector<T> s){
	for (T x : s)
		cout << x << " ";
	cout << endl;
}

const int maxn = 2e5 + 7;
vector<int> g[maxn];
int color[maxn];

ll cntx, cnty;

void dfs(int v, int x){
	if (v >= x)
		cnty++;
	else
		cntx++;
	color[v] = 1;
	for (int u : g[v]){
		if (color[u] == 0)
			dfs(u, x);
	}
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);	
	int n;
	cin >> n;
	vector<pair<int, int> > s(n);
	int x = 0, y = 0;
	map<int, int> xx, yy;
	for (int i = 0; i < n; i++){
		cin >> s[i].first >> s[i].second;
		if (xx.find(s[i].first) == xx.end())
			xx[s[i].first] = x++;
		if (yy.find(s[i].second) == yy.end())
			yy[s[i].second] = y++;
	}
	for (int i = 0; i < n; i++){
		g[xx[s[i].first]].push_back(yy[s[i].second] + x);
		g[x + yy[s[i].second]].push_back(xx[s[i].first]);
	}
	ll answer = 0;
	for (int i = 0; i < n; i++){
		if (color[i] == 0){
			cntx = cnty = 0;
			// cout << "KEK" << endl;
			dfs(i, x);
			answer += cntx * cnty;
		}
	}
	cout << answer - n << endl;
	return 0;	
}	

Measured memory_bytes: 15872
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <limits>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define EXISTch(s,c) ((((s).find_first_of(c)) != std::string::npos)? 1 : 0)//cがあれば1 if(1)
#define SORT(c) sort((c).begin(),(c).end())

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int INF = (int)1000000007;
const LL MOD = (LL)1000000007;//10^9+7
const LL INF2 = (LL)100000000000000000;//10^18

int main() {
	LL n; cin >> n;
	vector<LL> a(n);

	LL mx = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		mx = max(mx, a[i]);
	}

	LL t = 1;
	LL cnt = 0;
	while (mx > t) {
		cnt++;
		t *= 2;
	}
	
	vector<LL> tb(cnt);

	for (LL i = 0; i < n; i++) {
		for (LL j = 0; j < cnt; j++) {
			if (a[i] & (1LL << j)) {
				tb[j]++;
			}
		}

	}

	LL ans = 0;
	for (LL i = 0; i < n - 1; i++) {
		for (LL j = 0; j < cnt; j++) {
			if (a[i] & (1LL << j)) {
				tb[j]--;
			}
		}

		for (LL j = 0; j < cnt; j++) {
			if (a[i] & (1LL << j)) {
				LL x = n - (i + 1) - tb[j];
				
				x *= (1LL << j)%MOD;
				ans += x;
				ans %= MOD;
			}
			else {
				LL x = tb[j];
				
				x *= (1LL << j) % MOD;
				ans += x;
				ans %= MOD;
			}
		}

	}

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


Measured memory_bytes: 2560
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int[] pa = new int[3];
    pa[0] = sc.nextInt();
    pa[1] = sc.nextInt();
    pa[2] = sc.nextInt();
    Arrays.sort(pa);
    System.out.println(pa[2] * 10 + pa[1] + pa[0]);
  }
}

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

using namespace std;

#define pb push_back
#define UN unsigned
#define ll long long

int main(void) {
	//ios::sync_with_stdio(0);
	int n, d;
	cin >> n >> d;

	int i = 0, ans = 0;

	while (ans < n) {
		ans += d * 2 + 1;
		i++;
	}

	cout << i;
	
	return 0;
}

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

int main(){
	int n;
	long long int v;
	long long int cnt = 0;
	long long int x[4][1000];
	long long int sum[1000000];
	cin >> n >> v;
	for(int i = 0;i < 4;i++){
		for(int j = 0;j < n;j++){
			cin >> x[i][j];
		}
	}
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			sum[i * n + j] = x[0][i] + x[1][j];
		}
	}
	sort(sum,sum + n * n);
	for(int i = 0;i < n;i++){
		for(int j = 0;j < n;j++){
			cnt += upper_bound(sum,sum + n * n,v - x[2][i] - x[3][j]) - lower_bound(sum,sum + n * n,v - x[2][i] - x[3][j]);
		}
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 10964
# x < y  を反転できる
#
# かっこいい手法

n = int(input())
A = list(map(int, input().split()))
absA = list(map(abs, A))
num_le0 = 0
for a in A:
    if a <= 0:
        num_le0 += 1
S = sum(absA)
ans = None

if num_le0 == 0 or num_le0 % 2 == 0:
    ans = S
else:
    ans = S - 2 * min(absA)

print(ans)



Measured memory_bytes: 64880
#include<stdio.h>
#include<string.h>
int main(){
    char tex[210], pat[200], temp[210];
    int i, k, t, p, f;
    scanf("%s", tex);
    scanf("%s", pat);
    strcpy(temp, tex);
    strcat(tex, temp);
    t = strlen(tex);
    p = strlen(pat);
    f = 0;
    for(i=0;i<t;i++){
        if(tex[i] == pat[0]){
            for(k=0;k<p && tex[i+k]==pat[k];k++){
            }
            if(k == p) {
                f = 1;
                printf("Yes\n");
                break;
            }
        }
    }
    if(f == 0) printf("No\n");
return 0;
}



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

typedef long long ll;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}


int H, W;
char S[20][20];
int rowperm[20];
bool row_used[20];

bool is_match(int j1, int j2){
    for(int i = 0; i < H; i++){
        if(S[rowperm[i]][j1] != S[rowperm[H - 1 - i]][j2]){
            return false;
        }
    }
    return true;
}

bool rec(int depth){
    if(depth == H / 2){
        // 奇数の場合、どれか一つを除いて判定
        for(int i = 0; i < W; i++){
            bool used[20] = {};
            if(W % 2){
                if(!is_match(i, i)){
                    continue;
                }
                used[i] = true;
            }
            
            // ２つのペアを作っていく
            for(int j = 0; j < W; j++){
                if(used[j]) continue;
                used[j] = true;
                bool ok = false;
                for(int k = 0; k < W; k++){
                    if(used[k]) continue;
                    if(j == k) continue;
                    if(is_match(j, k)){
                        used[k] = true;
                        ok = true;
                        break;
                    }
                }
                if(!ok) break;
            }

            int cnt = 0;
            for(int i = 0; i < W; i++)
                if(used[i]) cnt++;
            
            if(cnt == W) return true;

            if(W % 2 == 0) break;

            if(W % 2) used[i] = false;
        }
        return false;
    }
    else{
        int start = -1;
        // 使っていない一番左の要素は確定
        for(int i = 0; i < H; i++){
            if(row_used[i]) continue;
            start = i;
            break;
        }

        row_used[start] = true;
        rowperm[depth] = start;

        for(int i = start + 1; i < H; i++){
            if(row_used[i]) continue;
            rowperm[H - 1 - depth] = i;
            row_used[i] = true;
            if(rec(depth + 1))
                return true;
            row_used[i] = false;
        }
        row_used[start] = false;
    }
    return false;
}

bool solve(){
    // rowを決める
    if(H % 2){
        for(int i = 0; i < H; i++){
            row_used[i] = true;
            rowperm[H / 2] = i;
            if(rec(0)){
                return true;
            }
            row_used[i] = false;
        }
        return false;
    }
    else{
        return rec(0);
    }
}

int main(){
    cin >> H >> W;
    for(int i = 0; i < H; i++) cin >> S[i];
    if(solve()){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
//****** @mdazmat9 **********
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define UB upper_bound
#define LB lower_bound
#define BS binary_search
#define EB emplace_back
#define PB push_back
#define endl "\n"
#define MOD 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
int fast_pow(int x, int y, int p);


void solve() {
    int a,b,c;cin>>a>>b>>c;
    set<int> st;
    st.insert(a);
    st.insert(b);
    st.insert(c);
    if(st.size()==2){
        cout<<"Yes"<<endl;
    } else{
        cout<<"No"<<endl;
    }

}

int32_t main() {
    IOS;
    int test = 1;
     //cin >> test;
    while (test--) {
        solve();
    }
    return 0;
}
int fast_pow(int x, int y, int p) {
    int res = 1;
    x = x % p;
    while (y > 0) {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}

Measured memory_bytes: 256
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com

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

using namespace std;

int main() {
    for (int i = 1; i <= 5; ++i) {
        int x;
        cin >> x;
        if (x == 0) {
            cout << i << " ";
        }
    }
    return 0;
}


Measured memory_bytes: 3632
M, D = map(int, input().split())

ans = 0

if D < 22:
    print(0)
    exit()

for m in range(1, M+1):
    for d in range(22, D+1):
        d1, d10 = d%10, d//10
        ans += (d1 >= 2 and d10 >= 2 and d1 * d10 == m)

print(ans)


Measured memory_bytes: 2940
def get_d_1(n):
    return n % 10


def get_d_2(n):
    return (n % 100) // 10


def solve(X):
    while X > 0:
        d_1 = get_d_1(X)
        d_2 = get_d_2(X)
        if d_2 == 0:
            if d_1 == 0:
                return 1
            else:
                if d_1 > 5:
                    X -= 105
                else:
                    X -= 100 + d_1
        else:
            X -= 105
    if X == 0:
        return 1
    else:
        return 0


X = int(input())
print(solve(X))


Measured memory_bytes: 3060
N, *X = map(int, open(0).read().split())

X = sorted(((x, i) for i, x in enumerate(X, 1)), key=lambda x: x[0])
x_to_i = dict(X)

T = []
for x, i in X:
    T += [i] * (i - 1)
for x, i in X:
    T += [i] * (N - i)
T = iter(T)

C = [0] * (N + 1)
A = []
for x in range(1, N * N + 1):
    if x in x_to_i:
        i = x_to_i[x]
        if C[i] != i - 1:
            print("No")
            quit()
    else:
        i = next(T)
    C[i] += 1
    A.append(i)

print("Yes")
print(*A)

Measured memory_bytes: 12944
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
template<typename T> T gcd(T a,T b){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1ll<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};

int M_N = 10000;

vector<LL> fact;
vector<LL> inver(M_N+1);
 
LL combi(int n,int r){
    if(n<r||n<0||r<0) return 0;
    return fact[n]%mod*inver[n-r]%mod*inver[r]%mod;
}
 
 
LL fpow(LL a, LL n){
    LL x = 1;
    while(n > 0){
        if(n&1){
            x=x*a%mod;
        }
        a=a*a%mod;
        n >>= 1;
    }
    return x;
}
 
void set_combi(){
    LL s=1;
    fact.push_back(1);
    for(int i=1;i<=M_N;i++){
        s*=i;
        s%=mod;
        fact.push_back(s);
    }
    inver[M_N]=fpow(fact[M_N],mod-2);
    for(int i=M_N-1;i>=0;i--){
        inver[i]=inver[i+1]*(i+1)%mod;
    }
}
 
LL hcombi(int n,int r){
    return combi(n+r-1,r); 
}


int main(){
    set_combi();
    LL s;cin >> s;
    LL ans = 0;
    for (int k = 1; 2 * k + 1 <= s; k++) {
        ans = (ans + combi(s - 2 * k - 1, k - 1))%mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3868
x, n = map(int, input().split())
p = list(map(int, input().split()))

abs_min = 101
for i in range(0, 102):
    if i in p:
        continue
    tmp = abs(i - x)
    if abs(i - x) < abs_min:
        ans = i
        abs_min = tmp
print(ans)

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

using namespace std;

int main() {
    long long n, m;
    cin >> n >> m;
    vector<long long> weight, value;
    long long maxvalue = 0,max_weight=0;
    for (int i = 0; i < n; i++) {
        long long w, v;
        cin >> w >> v;
        weight.push_back(w);
        value.push_back(v);
        maxvalue += v;
        max_weight+=w;
    }
    long long dp[n + 1][maxvalue + 1];
    dp[0][0]=0;
    for (long long k = 1; k <= maxvalue; k++)
        dp[0][k] = max_weight+1;

    for (long long i = 0; i < weight.size(); i++) {
        for (long long val = 0; val <= maxvalue; val++) {
            if (value[i] > val) {
                dp[i + 1][val] = dp[i][val];
            } else {
                //cout<<"put in index="<<i+1<<" val="<<val<<",min_weight="<< min(dp[i][val], dp[i][val - value[i]] + weight[i])<<endl;
                dp[i + 1][val] = min(dp[i][val], dp[i][val - value[i]] + weight[i]);
            }
        }

    }
        for(long long val=maxvalue;val>=0;val--)
            if(m>=dp[n][val])
            {
                cout<<val<<' ';
                break;
            }


}

Measured memory_bytes: 82316
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip> //fixed << setprecision(10)
 
using namespace std;
 
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
 
typedef long long ll;
typedef vector<int> vi;
 
int main(){
    int n, r;
    cin >> n >> r;
 
    int ans;
    if(n < 10){
        ans = r + (100*(10-n));
    }
    else{
        ans = r;
    }
 
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long read(){
    long long ret=0,f=1;char ch=getchar();
    while(ch>'9'||ch<'0'){if(ch=='-')f=-f;ch=getchar();}
    while(ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar();
    return ret*f;
}
int main(){
    int n,k;
    cin>>n>>k;
    for(int i=k-n+1;i<=n+k-1;i++){
    	cout<<i<<" ";
	}
}


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

int ten(int n){
	while(1){
		if(n%10==3){
			return 1;
		}
	if(n/10==0) break;
		n/=10;
	}
	return 0;
}

int main(){
	int n,i;
	cin>>n;
	for(i=1; i<=n; i++){
		if(i%3==0){
			cout<<" "<<i;
		}
		if(i%3!=0 && ten(i)==1){
			cout<<" "<<i;
		}
	}
	cout<<"\n";
	return 0;
}


Measured memory_bytes: 3100
R = lambda: map(int, raw_input().split())
n, k = R()
p, c = R(), R()
p = [x - 1 for x in p]
vis = [False] * n
ans = max(c)

for i in xrange(n):
    if vis[i]:
        continue
    t = [c[i]]
    j = p[i]
    while j != i:
        vis[j] = True
        t.append(c[j])
        j = p[j]

    m = len(t)
    ts = sum(t)
    for i in xrange(len(t)):
        tmp = min(k, m)
        s = 0
        for j in xrange(tmp):
            s += t[(i + j) % m]
            tk = k - j - 1
            ans = max(ans, s + tk / m * max(0, ts))
print ans



Measured memory_bytes: 73772
S = input()
T = input()

d1 = {}
d2 = {}
ans = "Yes"
for s, t in zip(S, T):
    if s in d1:
        if d1[s] != t:
            ans = "No"
            break
    else:
        d1[s] = t
    if t in d2:
        if d2[t] != s:
            ans = "No"
            break
    else:
        d2[t] = s
print(ans)



Measured memory_bytes: 41968
//BUGSBUNNY
//IIT ROORKEE
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define double long double
#define ld long double
#define endl '\n'
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define vl vector<long long>
#define vpii vector<pii>
#define vpipii vector<pipii>
#define vb vector<bool>
#define pb push_back
#define pob pop_back
#define mp make_pair
#define pii pair<int,int>
#define pipii pair<int,pii>
#define piipi pair<pii,int>
#define pld pair<long double,long double>
#define mod 1000000007
// #define mod 163577857 
// #define mod 998244353
#define rep(i,n) for (ll i = 0; i < n; i++)
#define repp(i,a,b) for(ll i = a ; i<b ; i++)
#define reppr(i,a,b) for(ll i = a-1 ; i>=b ; i--)
#define repr(i,n) for (ll i = n - 1; i >= 0; i--)
#define ff first
#define ss second
#define pc putchar_unlocked
#define gc getchar_unlocked
#define inf 9223372036854775807
#define infn -9223372036854775807
#define pi 3.14159265358979323846
#define eps 0.0000000001
#define sp << " " <<
#define setprec(x) cout << fixed << setprecision(x);
#define REVERSE(a) reverse(all(a));
#define SORT(a) sort(all(a));
#define all(n) n.begin(),n.end()
 
//GCD and LCM
    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; }
 
//Modular Exponentiation
    int powmod(int x,int y) 
    { 
        if (y == 0) return 1; 
        int p = powmod(x, y/2) % mod; 
        p = (p * p) % mod;   
        return (y%2 == 0)? p : (x * p) % mod; 
    }
 
//Modular Inverse
    int inverse(int a) 
    { 
       return powmod(a,mod-2); 
    }


void solve();
signed main()
{
    //-------------------------------------------------------------------------------   
        ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
        clock_t clk = clock();
    //-------------------------------------------------------------------------------   
    //-------------------------------------------------------------------------------
        int t = 1;
        // cin >> t;       
        rep(i,t)
        {
            // cout << "Case #" << i+1 << ": ";
            solve();
        }
    //-------------------------------------------------------------------------------
        clk = clock() - clk;
        cerr << fixed << setprecision(12) << "Time: " << ((double)clk)/CLOCKS_PER_SEC;
    //-------------------------------------------------------------------------------
}

void solve()
{
    string s;
    cin >> s;
    if(s=="ABC")
        cout << "ARC";
    else
        cout << "ABC";   
}   

Measured memory_bytes: 3840
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>

#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)

using namespace std;

typedef long long LL;
typedef double db;

int get(){
	char ch;
	while(ch=getchar(),(ch<'0'||ch>'9')&&ch!='-');
	if (ch=='-'){
		int s=0;
		while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
		return -s;
	}
	int s=ch-'0';
	while(ch=getchar(),ch>='0'&&ch<='9')s=s*10+ch-'0';
	return s;
}

const int N = 1e+5+3;

set<int>s[N];
int siz[N],fa[N];
int n;
int tim;

int getfather(int x){
	if (fa[x]==x)return x;
	return fa[x]=getfather(fa[x]);
}

int k;
struct edge{
	int x,y;
	edge(const int x_=0,const int y_=0){x=x_;y=y_;}
}key[N];

void merge(int x,int y){
	x=getfather(x);y=getfather(y);
	if (x==y)return;
	tim++;
	s[x].erase(y);s[y].erase(x);
	if (s[x].size()<s[y].size())swap(x,y);
	int pk=k;
	fa[y]=x;
	for(set<int>::iterator h=s[y].begin();h!=s[y].end();h++){
		s[(*h)].erase(y);
		s[(*h)].insert(x);
		if (s[x].find((*h))!=s[x].end())key[++k]=edge(x,*h);
		s[x].insert(*h);
	}
	s[y].clear();
	int nk=k;
	fo(i,pk+1,nk)merge(key[i].x,key[i].y);
}

int main(){
	n=get();
	fo(i,1,n)fa[i]=i;
	tim=0;
	fo(i,1,n*2-2){
		int x=get(),y=get();
		x=getfather(x),y=getfather(y);
		siz[x]++;siz[y]++;
		if (s[x].find(y)==s[x].end())s[x].insert(y);
		else merge(x,y);
		if (s[y].find(x)==s[y].end())s[y].insert(x);
		else merge(x,y);
	}
	if (tim==n-1)printf("YES\n");else printf("NO\n");
	return 0;
}

Measured memory_bytes: 25216
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <sstream>
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <stack>
#include <list>
#include <numeric>
#include <bitset>
#include <ext/algorithm>
#include <ext/numeric>
#define ffor(_a,_f,_t) for(int _a=(_f),__t=(_t);_a<__t;_a++)
#define all(_v) (_v).begin() , (_v).end()
#define sz size()
#define pb push_back
#define SET(__set, val) memset(__set, val, sizeof(__set))
#define FOR(__i, __n) ffor (__i, 0, __n)
typedef long long LL; using namespace std;

int main() {
	string str;
	cin >> str;
	FOR (i, 4)
		cout << str[i];
	cout << " ";
	ffor (i, 4, str.sz)
		cout << str[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long powmod(long long px, long long py, long long pmod){
	if(py == 0) return 1;
	if(py % 2 == 0) return powmod((px * px) % pmod, py / 2, pmod);
	else return (px * powmod(px, py - 1, pmod)) % pmod;
} 
const long long mod=1e9+7;
int main() {
    // your code goes here
    long long n,i,j,a[300005],b[300005][70]={0},ans=0;
    cin >> n;
    for(i=0;i<n;i++){
        cin >> a[i];
        j=0;
        while(a[i]>0){
            b[i][j]=a[i]%2;
            a[i]=(a[i]-a[i]%2)/2;
            j++;
        }
    }
    for(j=0;j<=60;j++){
        long long aa=0,bb=0;
        for(i=0;i<n;i++){
            if(b[i][j]==1) aa++;
            else bb++;
        }
        aa=aa*bb%mod;
        ans=(ans+powmod(2,j,mod)*aa%mod)%mod;
    }
    cout << ans << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> Pi;
typedef vector<ll> Vec;
typedef vector<int> Vi;
typedef vector<string> Vs;
typedef vector<vector<ll>> VV;
typedef vector<vector<int>> VVi;

#define REP(i, a, b) for(ll i=(a); i<(b); i++)
#define PER(i, a, b) for(ll i=(a); i>=(b); i--)
#define rep(i, n) REP(i, 0, n)
#define per(i, n) PER(i, n, 0)
const ll INF=1e16+18;
const ll MAX=100005;
const ll MOD=1000000007;
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl;
#define YES(n) cout << ((n) ? "YES" : "NO") << endl;
#define ALL(v) v.begin(), v.end()
#define pb(x) push_back(x)
#define mp(a, b) make_pair(a,b)
#define Each(a,b) for(auto &a :b)
#define REPM(i, mp) for (auto i = mp.begin(); i != mp.end(); ++i)
#define dbg(x_) cerr << #x_ << ":" << x_ << endl;
#define dbgmap(mp) cerr << #mp << ":"<<endl; for (auto i = mp.begin(); i != mp.end(); ++i) { cerr << i->first <<":"<<i->second << endl;}
#define dbgarr(n,m,arr) rep(i,n){rep(j,m){cerr<<arr[i][j]<<" ";}cerr<<endl;}
#define dbgdp(n,arr) rep(i,n){cerr<<arr[i]<<" ";}cerr<<endl;
#define sum(v) accumulate(ALL(v),0)
#define fi first
#define se second

template<typename T1, typename T2>
ostream &operator<<(ostream &s, const pair<T1, T2> &p) { return s<<"("<<p.first<<", "<<p.second<<")"; }

// vector
template<typename T>
ostream &operator<<(ostream &s, const vector<T> &v) {
    int len=v.size();
    for(int i=0; i<len; ++i) {
        s<<v[i];
        if(i<len-1) s<<"	";
    }
    return s;
}

// 2 dimentional vector
template<typename T>
ostream &operator<<(ostream &s, const vector<vector<T> > &vv) {
    int len=vv.size();
    for(int i=0; i<len; ++i) {
        s<<vv[i]<<endl;
    }
    return s;
}

vector<pair<ll,ll>> factorize(ll n) {
    vector<pair<ll,ll>> res;
    for (ll i = 2; i*i <= n; ++i) {
        if (n%i) continue;
        res.emplace_back(i,0);
        while (n%i == 0) {
            n /= i;
            res.back().second++;
        }
    }
    if (n != 1) res.emplace_back(n,1);
    return res;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<std::setprecision(10);

    ll n,p;
    cin>>n>>p;

    vector<P> fact = factorize(p);

    ll ans=1;
    rep(i,fact.size()){
        P &f = fact[i];
        ans *= pow(f.fi,f.se/n);
    }
    cout<<ans<<endl;
    return  0;
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define EPS (1e-8)

const double PI = acos(-1);

typedef complex<double> P;
typedef P Vec;

double solve(int n) {
	vector<int> angle(n, 0);
	
	int in;
	FOR(i, 1, n) {
		scanf("%d", &in);
		angle[i] = angle[i - 1] + in;
	}
	
	double res = 0.0;
	REP(i, n) {
		P p1 = P(cos(angle[i] * PI / 180), sin(angle[i] * PI / 180));
		P p2 = P(cos(angle[(i + 1) % n] * PI / 180), sin(angle[(i + 1) % n] * PI / 180));
		
		double a = abs(p1), b = abs(p2 - p1), c = abs(p2);
		double s = (a + b + c) / 2.0;
		double S = sqrt(s * (s - a) * (s - b) * (s - c));
		res += S;
	}
	return res;
}

int main() {
	int m, n;
	while (cin >> m, m) {
		double s1 = solve(m);
		cin >> n;
		double s2 = solve(n);
		
		if (s1 >= s2 - EPS && s1 <= s2 + EPS)
			puts("0");
		else if (s1 > s2 + EPS)
			puts("1");
		else
			puts("2");
	}
	
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};

int main() {
  vector<int> a(3);
  rep(i,3) cin>>a[i];
  sort(all(a));
  reverse(all(a));
  int ans=0;
  if(a[0]!=a[1]&&a[1]!=a[2]&&a[2]!=a[0]){
    ans+=a[0]-a[1];
    a[2]+=a[0]-a[1];
    a[1]=a[0];
  }
  if(a[0]==a[1]&&a[0]!=a[2]){
    if((a[0]-a[2])%2==0){
      ans+=(a[0]-a[2])/2;
      cout<<ans<<endl;
      return 0;
    }
    if((a[0]-a[2])%2==1){
      ans+=(a[0]-a[2])/2+2;
      cout<<ans<<endl;
      return 0;
    }
  }
  if(a[0]!=a[1]&&a[1]==a[2]){
      cout<<a[0]-a[1]<<endl;
      return 0;
  }
  if(a[0]==a[1]&&a[1]==a[2]&&a[2]==a[0]){
    cout<<0<<endl;
    return 0;
  }
}

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

int gcd(int a,int b)
{
    if(b==0) return a;
    return gcd(b,a%b);
}

signed main()
{
    int N; cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a[i];
    }

    vector<int> L(N+1);
    L[0]=0;
    for(int i=0;i<N;i++){
        L[i+1]=gcd(L[i],a[i]);
    }

    vector<int> R(N+1);
    R[N]=0;
    for(int i=N-1;i>=0;i--){
        R[i]=gcd(R[i+1],a[i]);
    }

    int ans=0;
    for(int i=0;i<N;i++){
        ans=max(ans,gcd(L[i],R[i+1]));
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define len(v) ll(v.size())
#define fi first
#define se second

template <class T>
void cout_vec(const vector<T> &vec){
  for(auto itr:vec) cout<<itr<<' ';
  cout<<endl;
}

typedef pair<ll,ll> P;
const ll mod=1e9+7;
const ll inf=1e15;

int n,q;
vector<ll> a(100010,inf),sum(100010,0),even(100010,0),odd(100010,0);

bool solve(ll x,ll kai){
  if(kai<0 || kai>n) return false;
  ll ind=lower_bound(begin(a)+1,begin(a)+n+1,x-(a[kai]-x))-begin(a);
  //cout<<kai<<' '<<ind<<endl;
  return (n-kai)>=(kai-ind+1);
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin>>n>>q;
    FOR(i,1,n+1){
      cin>>a[i];
      sum[i]=a[i]+sum[i-1];
      if(i%2==0) even[i]=a[i]+even[i-2];
      else odd[i]=a[i]+odd[max(0ll,i-2)];
    }
    vector<ll> ans1;
    rep(loop,q){
      ll x,ans=0;
      cin>>x;
      ll low=1,high=n+10,mid;
      while(high-low>1){
        mid=(high+low)/2;
        //cout<<mid<<endl;
        if(solve(x,mid)) low=mid;
        else high=mid;
      }
      //cout<<low<<endl;
      ans+=sum[n]-sum[low];
      if(n%2==0) ans+=even[2*low-n];
      else{
        ans+=odd[max(0ll,2*low-n)];
      }
      ans1.push_back(ans);
    }
    cout_vec(ans1);
}

Measured memory_bytes: 5748
import collections

N = int(input())
A = list(map(int, input().split()))
counter = collections.Counter(A)
flag = True

if N % 2 != 0:
    for i in range(0, max(A) + 1):
        if i == 0:
            if counter[i] != 1:
                flag = False
                break
        elif (i % 2 == 0 and counter[i] != 2) or (i % 2 != 0 and counter[i] != 0):
            flag = False
            break                
    ans = 2 ** (max(A) // 2) % (10**9 + 7)

else:
    for i in range(0, max(A) + 1):
        if (i % 2 == 0 and counter[i] != 0) or (i % 2 != 0 and counter[i] != 2):
            flag = False
            break
    ans = 2 ** (max(A) // 2 + 1) % (10**9 + 7)

if flag:
    print(ans)
else:
    print(0)

Measured memory_bytes: 14820
use proconio::{fastout, input};
use std::collections::HashMap;

#[fastout]
fn main() {
    input! {
        n: isize,
        a: [isize; n],
        q: isize,
        bcs: [[isize; 2]; q],
    }

    let mut h: HashMap<isize, isize> = HashMap::new();
    let mut sum = 0;
    for i in a.iter() {
        *h.entry(*i).or_insert(0) += 1;
        sum += i;
    }

    // println!("{:?}", h);
    // println!("sum: {}", sum);
    for bc in bcs {
        let b = bc[0];
        let c = bc[1];

        let b_cnt = *h.entry(b).or_insert(0);
        *h.entry(c).or_insert(0) += b_cnt;
        *h.entry(b).or_insert(0) = 0;

        let inc = (c - b) * b_cnt;
        sum += inc;
        // println!("inc: {}", inc);
        println!("{}", sum);
    }
}


Measured memory_bytes: 13500
import collections
def solve():
  n = int(input())
  queue = []
  queue2 = []
  if n == 1:
    print(1)
    exit()
  for i in range(n):
   x,y = (int(i) for i in input().split())
   queue.append((x,y))
  for i in range(n):
    for j in range(n):
      if i!=j:
        x1,y1 = queue[i]
        x2,y2 = queue[j]
        p = x2-x1
        q = y2-y1
        queue2.append((p,q))
  #print(queue2)
  
  c = collections.Counter(queue2)
  ans = n
  print(ans-c.most_common()[0][1])
solve()


Measured memory_bytes: 3956
#include <bits/stdc++.h>
#include <vector>
#include <algorithm>
#include <cmath>

using namespace std;

int main(){

	int n, x, tmp, flag=0;

	cin>> n;

	x = n * 100 / 108;

	for (int i = x - 5;i < x + 5;i++) {
		tmp = i * 108 / 100;
		//cout << tmp << endl;
		if (tmp == n) {
			cout << i << endl;
			return 0;
		}
	}

	cout<< ":(" << endl;


}


Measured memory_bytes: 256
from __future__ import print_function
# import numpy as np
# import numpypy as np
import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

import math
import string
import fractions
from fractions import Fraction
from fractions import gcd

def lcm(n,m):
    return int(n*m/gcd(n,m))

import re
import array
import copy
import functools
import operator

import collections
import itertools
import bisect
import heapq


from heapq import heappush
from heapq import heappop
from heapq import heappushpop
from heapq import heapify
from heapq import heapreplace

from queue import PriorityQueue as pq

def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p//common , q//common )
# from itertools import accumulate
# from collections import deque

import random
import traceback

def main():
    x = int(input().strip())
    x_left=x%100                # x_leftはxの二桁目以下(0<=x_left<=99)
    x_d3above=x//100            # x_leftはxの三桁目以上(0<=x_d3above<=10^3)

    x_d1 = x_left % 10              # Xの一桁目
    x_d2 = x_left //10              # Xの二桁目

    sideEffect=0
    if x_d1==1:
        sideEffect+=100
    elif x_d1==2:
        sideEffect+=100
    elif x_d1==3:
        sideEffect+=100
    elif x_d1==4:
        sideEffect+=100
    elif x_d1==5:
        sideEffect+=100
    elif x_d1==6:
        sideEffect+=200
    elif x_d1==7:
        sideEffect+=200
    elif x_d1==8:
        sideEffect+=200
    elif x_d1==9:
        sideEffect+=200
    elif x_d1==0:
        pass
    else:
        eprint(x_d1)
        try:
            raise Exception
        except:
            traceback.print_exc("error!")

    if x_d2==1:
        sideEffect+=200
    elif x_d2==2:
        sideEffect+=400
    elif x_d2==3:
        sideEffect+=600
    elif x_d2==4:
        sideEffect+=800
    elif x_d2==5:
        sideEffect+=1000
    elif x_d2==6:
        sideEffect+=1200
    elif x_d2==7:
        sideEffect+=1400
    elif x_d2==8:
        sideEffect+=1600
    elif x_d2==9:
        sideEffect+=1800
    elif x_d2==0:
        pass
    else:
        eprint(x_d2)
        try:
            raise Exception
        except:
            traceback.print_exc()

    if (x//100)*100 < sideEffect:
        print(0)
    else:
        print(1)
        
    
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 66156
import java.util.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        
        int d = a / b ;
        int r = a % b ;
        double f = (double)a / (double)b ;
        
        System.out.print(d + " " + r + " ");
        System.out.printf("%f\n" , f);
    }
}


Measured memory_bytes: 26456
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

int main() {
  int N;
  cin >> N;
  vector<int> v;
  int a;
  cin >> a;
  v.push_back(a);
  rep(i, N-1) {
    int temp;
    cin >> temp;
    int ind = lower_bound(v.begin(), v.end(), temp) - v.begin();
    if(ind == 0) v.insert(v.begin(), temp);
    else v[ind-1] = temp;
  }
  cout << v.size() << endl;
  return 0;
}

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

int main()
{
    int n,m;
    cin>>n>>m;
    priority_queue<int,vector<int>,less<int>> que;
    for (int i=0;i<n;i++){
        int temp;
        cin>>temp;
        que.push(temp);
    }
    
    for (int i=0;i<m;i++){
        int x=que.top();
        que.pop();
        que.push((int)floor(x/2));
    }
    long long int ans=0;
    while(!que.empty()){
        ans+=que.top();
        que.pop();
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3856
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define per(i,a,n) for (int i=n;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define mem(a,b) memset(a,b,sizeof (a))
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll ksm(ll a,ll b){ll res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}

 
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	bool f1=false,f2=false;
	int cnt=1;
	while(a>0&&c>0){
		if(cnt&1){
			c-=b;
		}
		else{
			a-=d;
		}
		cnt++;
	}
	if(a<=0){
		printf("No");
	}
	else{
		printf("Yes");
	}
    return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<math.h>
#include <limits.h>
#include<stdlib.h>
#include<string.h>

int main() {
	char *s=(char*)malloc(sizeof(char)*200000);
	int hantei=0;

	scanf("%s", s);
	for (int i = 0; *(s + i) != '\0'; i++) {
		hantei += *(s + i) - 48;
	}

	if (hantei % 9 == 0) {
		printf("Yes\n");
	}
	else {
		printf("No\n");
	}
	

	return 0;
}

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0; i<(int)n; i++)
#define REPR(i, n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i, m, n) for(int i=(int)m; i<(int)n; i++)
#define FORR(i, m, n) for(int i=(int)m-1; i>=(int)n; i--)
#define ALL(x) (x).begin(), (x).end()
#define ASC(v) sort(ALL(v));
#define DESC(v) sort(ALL(v), greater<int>());
#define UNIQ(a) sort(ALL(a));(a).resize(unique(ALL(a)) - a.begin());
#define PRINTD(x, d) cout << fixed << setprecision(d) << x << "\n";
#define DEBUG(x) cout<<#x<<": "<<x<<"\n"
typedef long long ll;
const double PI = acos(-1);
ll lcm(ll a, ll b) { return a / __gcd(a, b) * b; }
bool isprime(int x){ int i; if(x<2)return 0; else if(x==2) return 1; if(x%2==0) return 0; for(i=3; i*i<=x; i+=2) if(x%i==0) return 0; return 1; }
int digsum(int n) { int r=0; while(n>0) { r+=n%10; n/=10; } return r; }
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a = b; return 1; } return 0; }


const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
	bool can = true;
	REP(i, S.size()) {
		if (i%2) {
			if (S[i]=='R') {
				can = false;
			}
		} else {
			if (S[i]=='L') {
				can = false;
			} 
		}
	}
	if (can) cout << YES << "\n";
	else cout << NO << "\n";
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256