akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define em emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

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

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int m, d; cin >> m >> d;

  int ans = 0;
  rep2(i, 1, m) rep2(j, 1, d) {
    int d1 = j % 10;
    int d2 = j / 10 % 10;

    if (d1 >= 2 && d2 >= 2 && d1 * d2 == i) ++ans;
  }

  cout << ans << endl;

  return (0);
}


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

int main(){ 
    string a;
    int b=0;
    cin>>a;
    for(int i=0;i<3;i++){
        if(a.at(i)==a.at(i+1)){
            b=1;
        }
    }
    if(b==0){
        cout<<"Good";
    }else{
        cout<<"Bad";
    }
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
//üª(x1,y1)-(x2,y2)Æ~ü(S(0,0),¼ar)Ì¤L_ÌÂ
//½¾µüªÌn_ÆI_ÍÆàÉ~ÌO¤É éÆ·éB
int count_common_circle_segment(int x1,int y1,int x2,int y2,int r){
	int x12=x2-x1;
	int y12=y2-y1;
	double d=fabs(-y12*x1+x12*y1)/hypot(x12,y12);
	int ip1=-x1*x12-y1*y12;
	int ip2=x2*x12+y2*y12;
	if(d==r){
		if(ip1>0&&ip2>0){
			return 1;
		}
	}else if(d<r){
		if(ip1>0&&ip2>0){
			return 2;
		}
	}
	return 0;
}
//´_(0,0)ªOp`ÌàÉ é©»è
int is_origin_inner_triangle(int x1,int y1,int x2,int y2,int x3,int y3){
	double o1,o2,o3;
	o1=(double)x2*y3-(double)y2*x3;
	o2=(double)x3*y1-(double)y3*x1;
	o3=(double)x1*y2-(double)y1*x2;
	return o1*o2>0&&o2*o3>0;
}
int main(){
	int x1,y1,x2,y2,x3,y3,x4,y4,r;
	int inner1,inner2,inner3;
	int common1,common2,common3;
	for(;scanf("%d%d%d%d%d%d%d%d%d",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4,&r),x1|y1;){
		x1-=x4,y1-=y4;
		x2-=x4,y2-=y4;
		x3-=x4,y3-=y4;
		inner1=x1*x1+y1*y1<=r*r;
		inner2=x2*x2+y2*y2<=r*r;
		inner3=x3*x3+y3*y3<=r*r;
		if(inner1&&inner2&&inner3){
			puts("b");
		}else if(!inner1&&!inner2&&!inner3){
			common1=count_common_circle_segment(x2,y2,x3,y3,r);
			common2=count_common_circle_segment(x3,y3,x1,y1,r);
			common3=count_common_circle_segment(x1,y1,x2,y2,r);
			if(common1==2||common2==2||common3==2){
				puts("c");
			}else if(common1==1||common2==1||common3==1){
				if(is_origin_inner_triangle(x1,y1,x2,y2,x3,y3))
					puts("a");//àÚ
				else
					puts("c");//OÚ
			}else{
				if(is_origin_inner_triangle(x1,y1,x2,y2,x3,y3))
					puts("a");
				else
					puts("d");
			}
		}else{
			puts("c");
		}
	}
	return 0;
}

Measured memory_bytes: 0
#include <stdio.h>
#include <iostream>



int main()
{
	int a, b;
	char c;

	while(true)
	{
	    std::cin >> a >> c >> b;
	    if(c=='?') break;
	    switch(c)
	    {
	        case '+':
	        printf("%d\n",a+b);
	        break;
	        
	        case '-':
	        printf("%d\n",a-b);
	        break;
	        
	        case '*':
	        printf("%d\n",a*b);
	        break;
	        
	        case '/':
	        printf("%d\n",a/b);
	        break;
	        
	        defalt:
	        break;
	      
	    }
	}
}


Measured memory_bytes: 3160
#include <bits/stdc++.h>
#include <iostream>
#define ll long long
#define mem(f, x) memset(f, x, sizeof(f))
#define INF 0x3f3f3f3f
using namespace std;
const int M = 2*1e5 + 50;
const int N = 2*1e5 + 50;
ll m, n;
int nxt[N];

int main( ){
    while( scanf( "%lld %lld", &n, &m ) != EOF ){
        for( int i = 1; i <= n; i++ )
            scanf( "%d", nxt+i );
        int lw = 1, fa = 1;
        lw = nxt[lw], fa = nxt[fa];
        fa = nxt[fa];
        int cnt = 1;
        bool flag = 0;
        while( lw != fa ){
            lw = nxt[lw];
            fa = nxt[fa], fa = nxt[fa];
            cnt++;
            if( cnt == m ){
                flag = 1;
                printf( "%d\n", lw );
                break;
            }
        }
        if( flag ) continue;
        fa = 1;
        while( lw != fa )
            lw = nxt[lw], fa = nxt[fa];
        // lw: 入环口
        fa = 1;
        while( fa != lw ){
            fa = nxt[fa];
            m--; //减去入环前部分长度
        }
        m %= cnt;
        fa = lw;
        while( m ){
            fa = nxt[fa];
            m--;
        }
        printf( "%d\n", fa );
    }
    return 0;
}


Measured memory_bytes: 4616
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <deque>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

deque<char> d;

int main() {
    string s;
    int q;
    cin >> s >> q;
    foreach(e, s){
        d.pb(e);
    }

    bool rev = false;
    rep(i, q){
        int query;
        cin >> query;

        if(query == 1){
            rev = !rev;
        }else{
            int f; char c;
            cin >> f >> c;

            if(f == 1){
                if(!rev){
                    d.push_front(c);
                }else{
                    d.push_back(c);
                }
            }else {
                if (!rev) {
                    d.push_back(c);
                } else {
                    d.push_front(c);
                }
            }
        }
    }

    if(rev){
        for(auto rb = d.rbegin(); rb != d.rend(); ++rb){
            print(*rb);
        }
    }else{
        foreach(e, d){
            print(e);
        }
    }
    cout << next;
}


Measured memory_bytes: 896
#include <stdio.h>
int main(void){
    int a;
    scanf("%d",&a);
    if(a==1||a==2||a==3||a==4||a==5||a==6||a==7||a==8||a==9||a==10||a==12||a==15||a==16||a==14||a==18||a==20||a==21||a==24||a==25||a==28||a==30||a==27||a==32||a==35||a==36||a==40||a==42||a==45||a==48||a==49||a==54||a==56||a==63||a==64||a==72||a==81){
        printf("Yes");
    }
    else{
        printf("No");
    }
    return 0;
}


Measured memory_bytes: 128
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2, gcd
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left, insort, insort_left
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7 
#mod = 998244353
from decimal import *
#import numpy as np
#decimal.getcontext().prec = 10

A, B, C, D, E, F = MAP()

water = set()

for a in range(F//(100*A)+1):
	for b in range((F-100*a*A)//(100*B)+1):
		water.add(100*(a*A+b*B))

sugar = [0]*(F+1)
sugar[0] = 1
for i in range(1, F+1):
	sugar[i] = 0<(sugar[i-C]*(0<i) + sugar[i-D]*(0<i))
#print(sugar)
"""
f = F//2
sugar = [0]*(F+1)
for c in range(f//C+1):
	for d in range((f-c*C)//D+1):
		sugar[c*C+d*D] = 1
print(sugar)
"""
sugar_acc = [0]*(F+1)
tmp = 0
for i in range(F//2+1):
	if sugar[i] == 1:
		tmp = i
	sugar_acc[i] = tmp

#print(water)
#print(sugar_acc)

ans = 0
den = 0
water_ans = 0
sugar_ans = 0
water = sorted(list(water))

for water_tmp in water[1:]:
	if E == 100:
		t = min(water_tmp, F-water_tmp)
	else:
		t = min(E*water_tmp//100, F-water_tmp)

	sugar_tmp = sugar_acc[t]
	if F < sugar_tmp + water_tmp:
		continue

	if sugar_tmp == 0:
		den_tmp = 0
	else:
		den_tmp = sugar_tmp/(sugar_tmp+water_tmp)

	#print(water_tmp, sugar_tmp, den_tmp, E*water_tmp//(100-E), F-water_tmp, t)
	if den <= den_tmp:
		den = den_tmp
		water_ans = water_tmp
		sugar_ans = sugar_tmp

print(water_ans+sugar_ans, sugar_ans)


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

int main() {
    int A, B;
    cin >> A;
    cin >> B;
    int x = A + B;
    int y = A - B;
    int z = A * B;
    if (x > y) {
        if (x > z) {
            cout << x;
        } else {
            cout << z;
        }
    } else if (y > z) {
        cout << y;
    } else {
        cout << z;
    }
    return 0;
}

Measured memory_bytes: 256
n = int(input())
l = []
for _ in range(n):
    x = int(input())
    l.append(x)
min_value = min(l[0],l[1])
max_difference = l[1]-l[0]
for i in range(2,n):
    max_difference = max(max_difference,l[i]-min_value)
    min_value = min(min_value,l[i])
print(max_difference)


Measured memory_bytes: 13588
#include<bits/stdc++.h>
#define ll long long int 
#define mod 1000000007
#define modulo 998244353
#define endl '\n'
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
using namespace std;
vector <int> adj[100001];
ll vis[100001];
ll fxp(ll a, ll b)
{
    if(b == 0)return 1;
	if(b%2 == 0){
		ll c = fxp(a,b/2);
		return (c*c)%1000000007;
	}
	return (a*fxp(a,b-1))%1000000007;
}
int lcm(int c,int d)
{
    int a=c;
    int b=d;
    int ans;
    if(a>=b)
    {
        while(b!=0)
        { 
            int x=b;
            b=a%b;
            a=x;
        }
        ans = ( c*d)/a;
    }
    else
    {
        while(a!=0)
        {
            int x=a;
            a=b%a;
            b=x;
        }
        ans = ( c*d)/b;  
    }
    return ans;
}
int root_find()
{
    ll x;
    for(int i=1;i<100001;i++)
    {
        if(adj[i].size()==1)
        {
            x = i;
            break;
        }
    }
    return x;
}
void dfs(int s,int y)
{
    for(int i=0;i<adj[s].size();i++)
    {
        if(adj[s][i]==y)
        continue;
        dfs(adj[s][i],s);
    }
}
void bfs(int s)
{
    queue <ll> q;
    q.push(s);
    vis[s]=1;
    while(!q.empty())
    {
        ll u = q.front();
        q.pop();
        for(int i=0;i<adj[u].size();i++)
        {
            if(vis[adj[u][i]]==0)
            {
            vis[adj[u][i]]=1;
            q.push(adj[u][i]);
            }
        }

    }
}
bool isPrime(ll n) 
{ 
    if (n <= 1)  return false; 
    if (n <= 3)  return true; 
  
    if (n%2 == 0 || n%3 == 0) return false; 
  
    for (int i=5; i*i<=n; i=i+6) 
        if (n%i == 0 || n%(i+2) == 0) 
           return false; 
  
    return true; 
}
ll smallestDivisor(ll n) 
{ 
    // if divisible by 2 
    if (n % 2 == 0) 
        return n/2; 
  
    // iterate from 3 to sqrt(n) 
    for (int i = 3; i * i <= n; i += 2) { 
        if (n % i == 0) 
            return n/i; 
    } 
  
    return n; 
}  
bool sortbysec(const pair<int,int> &a, 
              const pair<int,int> &b) 
{ 
    return (a.second < b.second); 
} 
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll n,x,t;
    cin>>n>>x>>t;
    ll ans = n/x;
    if(n%x!=0)
    ans++;
    ans = ans*t;
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 6000
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;

int main()
{
	string s;
	int a;
	cin >> a;
	cin >> s;
	if (a>=3200)
	{
		cout << s << endl;
	}
	else
	{
		cout << "red" << endl;
	}
	return 0;
}

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

#define rep(i,a) for(int i = 0; i < a; i++)

using namespace std;

const int N = 1000010;

int ns, nl;
int memo[1<<20];
int ans;
vector<int> ansv;
vector<int> vv;

struct edge{
    int id;
    int to;
    int cst;
};

vector<vector<edge> > G;

void rec(int station, int cst, int visited){
    if(memo[visited] >= cst) {
        //ansv.pop_back();
        return; 
    }
    ansv.push_back(station);
    //cout << station << " " << cst << " " << visited << endl;
    memo[visited] = cst;
    if(ans < cst){
        ans = cst;
        vv = ansv;
    }
    
    rep(i, G[station].size()){
        //cout << "b\n";
        if(!(visited & (1<<G[station][i].id))){
            visited |= (1<<G[station][i].id);
            rec(G[station][i].to, cst + G[station][i].cst, visited);
            visited &= ((1<<20)-1) - (1<<G[station][i].id);
        }
    }
    ansv.pop_back();
}

void solve() {
    ans = 0;
    rep(i, ns){
        memset(memo, -1, sizeof(memo));
        rec(i+1, 0, 0);
    }
    cout << ans << endl;
    rep(i, vv.size()) cout << vv[i] << (i < vv.size() - 1 ? " " : "\n");
}

int main(){
    while (cin >> ns >> nl, ns) {
        G.clear();
        G.resize(ns+1);
        int id = 0;
        rep(i, nl){
            int s1, s2, d;
            cin >> s1 >> s2 >> d;
            //cout << id << endl;
            G[s1].push_back((edge){id, s2, d});
            G[s2].push_back((edge){id, s1, d});
            id++;
        }
        //cout << "a" << endl;
        solve();
    }
    return 0;
}

Measured memory_bytes: 5324
/*  ex3_4
    ruuu0048 */
#include <stdio.h>

int main(void){

    int number; //Nの変数を宣言

    scanf("%d",&number); //変数にNの数を入力する

    int yes_no = 0; //0より大きかったらYes、0だったらNoと出力するための変数を宣言


    //一回でもi*jがNと一致したらyes_noが0より大きくなるにする

    for ( int i = 1; i <= 9; i += 1) //iが1から9まで計算する
    {
        for(int j = 1; j <= 9; j += 1){ //jが1から9まで計算する
            if(number == i * j){ //i*jがNと一致したら
                yes_no += 1; //1足す
            }
        }
    }
    
    if(yes_no > 0){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }
    
    
    return 0; 
}

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

struct Primes {
    vector<bool> is_prime;
    vector<int> primes;
    Primes(int n) {
        is_prime.assign(n + 1, true);
        is_prime[0] = is_prime[1] = false;
        for (int i = 2; i * i <= n; i++) if (is_prime[i]) {
            primes.emplace_back(i);
            for (int j = i + i; j <= n; j += i) is_prime[j] = false;
        }
    }
    bool operator[](int x) { return is_prime[x]; }
};

int main() {
    Primes is_prime((int)1e8);
    int n; cin >> n;
    int cnt = 0;
    while (n--) {
        int x; cin >> x;
        if (is_prime[x]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 14740
import java.util.Scanner;

public 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 / b;
        System.out.printf("%d %d %.5f\n", d, r, f);
    }
}


Measured memory_bytes: 26556
// https://onlinejudge.u-aizu.ac.jp/courses/lesson/2/ITP1/8/ITP1_8_D

#include <iostream>
#include <cstring>

int main()
{
    std::string s, p;
    std::string ss;
    std::cin >> s >> p;

    ss = s + s;

    if (strstr(ss.c_str(), p.c_str()) == NULL)
    {
        std::cout << "No" << std::endl;
    }
    else
    {
        std::cout << "Yes" << std::endl;
    }
}


Measured memory_bytes: 3176
#include<stdio.h>
#include<string.h>

int main(void)
{
   int a, b, i;
   char o[51], e[51], s[101];

   scanf("%s%s",o,e);
   a=strlen(o);
   b=strlen(e);
   for(i=0;i<a;i++){
      s[i*2]=o[i];
      s[i*2+1]=e[i];
   }
   s[a+b]='\0';
   printf("%s\n",s);
   return 0;
}

Measured memory_bytes: 1632
#include<bits/stdc++.h>
typedef double D;      // 座標値の型。doubleかlong doubleを想定
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)

typedef complex<D> P;  // Point
typedef vector<P> VP;
const D EPS = 1e-9;    // 許容誤差。問題によって変える
#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)
static const double pi = 3.141592653589793;
// 内積　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;
}

P rotateP(P a, P o ,D arg) { //点aを点oを中心に反時計周りにまわした複素数を返す。
	a -= o;
	a *= P(cos(arg / 180 * pi), sin(arg / 180 * pi));
	a += o;
	return a;
}
// 点の進行方向
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 isecSS(P a1, P a2, P b1, P b2) {
  return ccw(a1, a2, b1)*ccw(a1, a2, b2) <= 0 &&
         ccw(b1, b2, a1)*ccw(b1, b2, a2) <= 0;
}


P proj(P a1, P a2, P p) {
  return a1 + dot(a2-a1, p-a1)/norm(a2-a1) * (a2-a1);
}
bool isecSP(P a1, P a2, P b) {
  return !ccw(a1, a2, b);
}
D distSP(P a1, P a2, P p) {
  P r = proj(a1, a2, p);
  if (isecSP(a1, a2, r)) return abs(r-p);
  return min(abs(a1-p), abs(a2-p));
}

D distSS(P a1, P a2, P b1, P b2) {
  if (isecSS(a1, a2, b1, b2)) return 0;
  return min(min(distSP(a1, a2, b1), distSP(a1, a2, b2)),
             min(distSP(b1, b2, a1), distSP(b1, b2, a2)));
}
////////////////

int N,M,L;
int x,y,a,r;

D ds(array<P, 5> a, array<P, 5> b) {
	D res = 1e30;
	rep(i, 5) {
		rep(j, 5) {
			res = min(res,distSS(a[i] , a[(i + 1) % 5], b[j], b[(j+ 1) % 5]));
		}
	}
	return res;
}
				

int main() {
	while(cin >> N >> M >> L, N) {
		vector<array<P, 5> > stars;
		M --; L--;
		for(int n = 1; n <= N; n++) {
			cin >> x >> y >> a >> r;
			P p0, p1, p2, p3, p4, p5;
			p0 = P(x, y);
			p1 = p0 + P(0, r);
			p1 = rotateP(p1, p0, a);
			p2 = rotateP(p1, p0, 144);
			p3 = rotateP(p2, p0, 144);
			p4 = rotateP(p3, p0, 144);
			p5 = rotateP(p4, p0, 144);
			stars.push_back({p1,p2,p3,p4,p5});
		}
		
		double table[110][110];
		for(int n = 0; n < N; n++) {
			for(int i = 0; i < N; i++) {
				if(i == n) {
					table[i][n] = 0;
				} else {
					table[i][n] = ds(stars[i], stars[n]);
					table[n][i] = table[i][n];
				}
			}
		}
		rep(k, N) {
			rep(i, N){
				rep(j, N){
					table[i][j] = min(table[i][j],table[i][k] + table[k][j]);
				}
			}
		}
		cout << setprecision(20) << table[M][L] << endl;
	}
}
	





Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define f(i,x,n) for(int i=x;i<n;i++)
#define all(c) c.begin(),c.end()
#define debug(x) cerr << (#x) << "is "<< x << "\n"
using ll = long long;
using pii = pair<int,int>;
const int MOD = 1e9+7, N = 1e5 + 10;

void test();

int32_t main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int tt = 1;
	// cin >> tt;
	f(i,0,tt)
		test();
	return 0;
}

void test(){
	int n,k;
	cin >> n >> k;
	if(k==1){
		cout << "0\n";
	}
	else{
		cout << n-k << "\n";
	}
}

Measured memory_bytes: 256
#line 1 "abc159_b.cpp"
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
using P = std::pair<int, int>;
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

bool kaibun(string s) {
  int left = 0, right = s.length() - 1;
  while (left < right) {
    if (s[left] != s[right]) {
      return false;
    }
    left++;
    right--;
  }
  return true;
}

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

  if (kaibun(s) && kaibun(s.substr(0, n / 2)) && kaibun(s.substr((n + 1) / 2, n / 2))) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0
for i in range(a+1):
    for j in range(b+1):
        nc = (x - 500*i - 100*j) // 50
        if nc < 0 or c < nc:
            continue
        ans += 1

print(ans)


Measured memory_bytes: 3060
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dunk(n) cout << n << endl
#define all(v) v.begin(), v.end()
typedef long long ll;



int main() {
    double r;
    cin >> r;
    cout << fixed << setprecision(3);
    cout << M_PI*2*r << endl;
}


Measured memory_bytes: 3788
# %% constants
# ------------

# %% body
# -------

function main(io = stdin)
    readto(target = '\n') = readuntil(io, target)
    readnum(T::Type{<:Number} = Int; dlm = isspace, kwargs...) =
        parse.(T, split(readto(), dlm; kwargs...))

    # handle IO and solve
    N, = readnum()
    A = readnum()
    println(solve(N, A))
end

function solve(N, A)
    p = 1_000
    stock = 0
    for (Ai, d) in zip(A, diff(A))
        if d ≥ 0
            if stock === 0
                stock, p = divrem(p, Ai)
            end
        else
            if stock !== 0
                p += stock * Ai
                stock = 0
            end
        end
    end

    if stock !== 0
        p += stock * A[end]
        stock = 0
    end
    return p
end

@static if @isdefined(Juno)
    main(open(replace(@__FILE__, r"(.+)\.jl" => s"\1.in")))
else
    main()
end


Measured memory_bytes: 217264
#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#include <set>
using namespace std;
int main()
{
    char x,y,ch;
    cin>>x>>y;
    if(x>y)ch = '>';
    else if(x<y)ch = '<';
    else ch = '=';
    cout<<ch<<endl;
}


Measured memory_bytes: 256
mod=1000000007
N,M=map(int,input().split())
dp=[-1]*(N+1)
dp[0]=1

for i in range(M):
    dp[int(input())]=0
for i in range(1,1+N):
    if dp[i]==0:
        continue
    else:
        if i==1:
            dp[i]=dp[i-1]%mod
        else:
            dp[i]=(dp[i-1]+dp[i-2])%mod
if dp[N]==-1:
    print(0)
else:
    print(dp[N])

Measured memory_bytes: 6900
#include<bits/stdc++.h>
using namespace std;
int n;long long r;
int a[100001],b[100000];
int main()
{
	cin>>n;
	for (int i=0;i<=n;i++)
	    cin>>a[i];
	for (int i=0;i<n;i++)
	    cin>>b[i];
	for (int i=0;i<n;i++)
	{
		if (b[i]<=a[i])
		{
			r+=b[i];
			a[i]-=b[i];
		}
		else
		{
			r+=a[i];
			b[i]-=a[i];
			if (b[i]>=a[i+1])
			{
				r+=a[i+1];
				a[i+1]=0;
			}
			else
			{
				r+=b[i];
				a[i+1]-=b[i];
			}
		}
	}
	cout<<r<<endl;
	return 0;
}


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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define _GLIBCXX_DEBUG

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvd = vector<vd>;
using vvvi = vector<vvi>;
using vvvll = vector<vvll>;
using vvvd = vector<vvd>;

const double pi=3.141592653589793;

int main() {
    ll n,m;
    cin>>n>>m;
    vector<ll> vec;
    ll num=pow(2,n);
    ll dp[m+1][num];
    rep(i,m+1){
        rep(j,num){
            dp[i][j]=10000000000000;
        }
    }
    dp[0][0]=0;
    vll vec2;
    rep(i,m){
        ll a,b;
        cin>>a>>b;
        vec.push_back(a);
        ll num1=0;
        rep(j,b){
            ll c;
            cin>>c;
            num1+=pow(2,c-1);
        }
        //cout<<num1<<endl;
        vec2.push_back(num1);
    }
    for (int i=0;i<m;i++){
        for (int j=0;j<num;j++){
            dp[i+1][j]=min(dp[i][j],dp[i+1][j]);
            //cout<<j<<" "<<vec2[i]<<endl;
            //cout<<(j|vec2[i])<<endl;
            dp[i+1][int(j|vec2[i])]=min(dp[i][j]+vec[i],dp[i+1][int(j|vec2[i])]);
        }
    }
    if (dp[m][num-1]>=10000000000){
        cout<<-1<<endl;
    }
    else{
        cout<<dp[m][num-1]<<endl;
    }

    return 0;
}

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

long long MOD = pow(10, 9) + 7;

// O(sqrt(N))の素因数分解
int main(){
    int Q;
    cin >> Q;
    vector<int> bucket(Q+1, 1);

    if (Q == 1)
    {
        cout << 1 << endl;
        return 0;
    }
    for (int i = 2; i <= Q; i++)
    {
        int target = i;
        for (int j = 2; j <= i; j++)
        {
            if (target % j != 0)
            {
                continue;
            }
            
            while (target % j == 0)
            {
                bucket[j]++;
                target /= j;
            }
        }
    }
    long long ans = 1;
    for (int j = 0; j <= Q; j++)
    {
        ans *= bucket[j];
        ans = ans % MOD;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
typedef pair<double, long long> pdl;

const long double pi = 3.141592653589793;

#define debug(x) cout << #x << " = " << (x) << endl;
#define rep(i, n) for(int i = 0;i < n;i++)
#define pb push_back
#define mp make_pair
#define mod 1000000007


int n, x, y;
vector<pii> vx;
vector<pii> vy;
vector<pll> g[1<<20];
vector<bool> visited(1<<20, false);
vector<ll> dist(1<<20, LONG_LONG_MAX);

int main() {
  ios::sync_with_stdio(false);
  //freopen("input.in","r",stdin);
  //freopen("output.out","w",stdout);
  cin>>n;
  rep(i, n) {
      cin>>x>>y;
      vx.pb({x, i});
      vy.pb({y, i});
  }

  sort(vx.begin(), vx.end());
  sort(vy.begin(), vy.end());

  rep(i, vx.size()-1) {
      int wt = vx[i+1].first-vx[i].first;
      int x = vx[i].second;
      int y = vx[i+1].second;

      g[x].pb({wt, y});
      g[y].pb({wt, x});

      wt = vy[i+1].first-vy[i].first;
      x = vy[i].second;
      y = vy[i+1].second;

      g[x].pb({wt, y});
      g[y].pb({wt, x});
  }

  set<pll> pq;
  pq.insert({0, 1});
  ll answer = 0;


  while(not pq.empty()) {
      pii temp = *(pq.begin());
      pq.erase(pq.begin());
      if(visited[temp.second]) continue;
      visited[temp.second]=1;
      dist[temp.second]=temp.first;
      answer = answer + (long long)(temp.first);
      for(auto&z:g[temp.second]) {
          if(not visited[z.second] and z.first < dist[z.second]) {
              pq.erase({dist[z.second], z.second});
              dist[z.second]=z.first;
              pq.insert({z.first, z.second});
          }
      }
  }

  cout<<answer<<endl;

  return 0;
}


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

int main() {
  int N, X, T;
  cin >> N >> X >> T;

  if (X == 1) {
    cout << N * T << endl;
  }
  else if (N % X  == 0) {
    cout << N / X * T << endl;
  }
  else if (N % X != 0) {
    cout << ((N / X) + 1) * T << endl;
  }
}

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

using namespace std;

int main() {

    string S;
    cin >> S;

    int N = S.size();


    // 最初が0のやつと比べる
    // 01010101

    //
    int zeroOneCounter = 0;
    for (int i = 0; i < N; ++i) {
        if (atoi(S.substr(i, 1).c_str()) != (i % 2)) {
            ++zeroOneCounter;
        }
    }
    int oneZeroCounter = 0;
    for (int i = 0; i < N; ++i) {
        if (atoi(S.substr(i, 1).c_str()) == (i % 2)) {
            ++oneZeroCounter;
        }
    }

    if (zeroOneCounter > oneZeroCounter) {
        cout << oneZeroCounter;
    } else {
        cout << zeroOneCounter;
    }
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define vl vector
using namespace std;
int main()
{
    ll t,i,n;
    ll a,b,c;
    cin>>t;
    while(t--)
    {
        cin>>n;
        if(n%2==0 && (n%3 && n%5))
        {
            cout<<"DENIED";
            return 0;
        }
    }
    cout<<"APPROVED";
    return 0;
}

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int C = sc.nextInt();
		int B[] = new int[M];
		for (int i=0;i<M;i++) {
			B[i] = sc.nextInt();
		}
		int count =0;
		for (int i=0;i<N;i++) {
			int temp =0;
			for (int j=0;j<M;j++) {
				int t = sc.nextInt();
				temp +=t*B[j];
			}
			if (temp+C>0) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 37240
#include <iostream>
using namespace std;
int main(void){
  int N;
  cin >> N;
  int ret[N];
  for(int i = 0; N > i; i++){
    int x,y,b,p;
    //5.2
    int pb,pp;
    cin >> x >> y >> b >> p;
    pb = x * 5;
    pp = y * 2;
    int tmp = (x * b) + (y * p);
    if(b > 4 && p > 1){
      ret[i] = tmp * 8 / 10;
    } else if(b < 5 && p < 2){
      ret[i] = tmp;
    } else {
      int exa;
      if(b > 4){
        //bが5異常なのでpをppにした場合;
        exa = ((x * b) + (pp)) * 8 / 10;
      } else {
        exa = ((pb) + (y * p)) * 8 / 10;

      }
      ret[i] = (tmp > exa ? exa : tmp);
    }
  }
  for(int i = 0; N > i; i++){
    cout << ret[i] << endl;
  }
}


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

#define N 110
int n, k, a[N];

int main() {
	while (scanf("%d%d", &n, &k) != EOF) {
		for (int i = 1; i <= n; ++i) {
			scanf("%d", a + i);
		}
		int res = -1e9;
		for (int i = 1; i <= n; ++i) {
			for (int j = i; j <= n + 1; ++j) {
				vector <int> vec;
				for (int k = 1; k < i; ++k) {
					vec.push_back(a[k]);
				}
				for (int k = j; k <= n; ++k) {
					vec.push_back(a[k]);
				}
				int sze = (int)vec.size();
				if (sze > k) {
					continue; 
				}
				sort(vec.begin(), vec.end());
				int tmp = accumulate(vec.begin(), vec.end(), 0);
				int remind = k - sze;
				for (auto it : vec) {
					if (it < 0 && remind) {
						tmp -= it;
						--remind;
					}
				}
				res = max(res, tmp);
			}
		}
		printf("%d\n", res);
	}
	return 0;
}


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

using namespace std;

int main(){
	int N, M;
	while(cin >> N >> M){
		int thr = (int)sqrt(M);
		vector<int> l(N), r(N);
		for(int i=0;i<N;i++) cin >> l[i] >> r[i];
		for(int d=1;d<=thr;d++){
			int res = 0;
			for(int i=0;i<N;i++){
				if((l[i]+d-1)/d <= r[i]/d) ++res;
			}
			cout << res << endl;
		}
		vector<int> m(200001, 0);
		for(int i=0;i<N;i++){
			int checked = 200000;
			for(int c=1;c<=thr;c++){
				int left = (l[i]+c-1)/c;
				int right = min(r[i]/c, checked-1);
				m[left]++;
				m[right+1]--;
				checked = left;
			}
		}
		for(int i=0;i<200000;i++) m[i+1] += m[i];
		for(int d=thr+1;d<=M;d++){
			cout << m[d] << endl;
		}
	}
}



Measured memory_bytes: 4096
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <cstring>
#define ll long long
using namespace std;
int a[100005];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=0; i<n; i++)
        scanf("%d",&a[i]);
    int b,c,d;
    b=c=d=0;
    for(int i=0; i<n; i++)
    {
        if(a[i]%4==0)
            b++;
        else if(a[i]%2==0)
            c++;
        else
            d++;
    }
    //cout<<b<<c<<d<<endl;
    if(c>0)
    {
        if(b>=d)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    }
    else
    {
        if(b>=d-1)
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }

}


Measured memory_bytes: 640
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <numeric> // next_parmutation
#define ll long long
#define rep(i, n) for(int i = 0; i < (n); i++)

using namespace std;

int main() {
    int x[5];
    rep(i, 5){
        cin >> x[i];
        if(x[i] == 0){
            cout << i+1 << endl;
            break;
        }
    }
}

Measured memory_bytes: 3596
#include <bits/stdc++.h>
#define REP(i, a, b) for (int i = (a); i < (b); ++i)

using namespace std;
using ll = long long;

/**
 * main
 */
int main () {
  int L; cin >> L;

  double ans = pow((double) L / 3.0, 3);

  printf("%f\n", ans);
}


Measured memory_bytes: 256
N=int(input())
a=N//100
b=(N-a*100)//10
c=N-a*100-b*10
if a<b:
    N=(a+1)*111
elif a>b:
    N=a*111
elif a==b and a>=c :
    N=a*111
elif a==b and a<c :
    N=(a+1)*111
print(N)

Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>

using namespace std;

int calc_score(int D, const vector<int>& c, const vector<vector<int>>& s, const vector<int>& last, int d, int t)
{
	int v = s[d][t];
	for (int i = 0; i < 26; ++i) {
		if (i != t) {
			v -= c[i] * (d + 1 - last[i]);
		}
	}
	return v;
}

int simulate(int D, const vector<int>& c, const vector<vector<int>>& s, int t0, int t1)
{
	int score_total = 0;
	int v = 0;
	vector<int> last(26, 0);
	vector<int> t(D, -1);
	t[0] = t0;
	t[1] = t1;

	for (int d = 0; d < 2; ++d) {
		v += calc_score(D, c, s, last, d, t[d]);
		last[t0] = 1;

		score_total += max(1000 * 1000 + v, 0);
	}

	for (int d = 2; d < D; ++d) {
		int score_max = numeric_limits<int>::min();
		for (int k = 0; k < 26; ++k) {
			int score = calc_score(D, c, s, last, d, k);
			if (score_max < score) {
				score_max = score;
				t[d] = k;
			}
		}
		v += score_max;
		last[t[d]] = d + 1;

		score_total += max(1000 * 1000 + v, 0);
	}
	return score_total;
}

int main()
{
	int D;
	cin >> D;
	vector<int> c(26);
	for (auto& x : c) {
		cin >> x;
	}
	vector<vector<int>> s(D, vector<int>(26));
	for (auto& v : s) {
		for (auto& x : v) {
			cin >> x;
		}
	}

	int score_max = 0;
	
	vector<int> last(26, 0);
	vector<int> t(D, -1);

	for (int t0 = 0; t0 < 26; ++t0) {
		for (int t1 = 0; t1 < 26; ++t1) {
			int score = simulate(D, c, s, t0, t1);
			if (score_max < score) {
				score_max = score;
				t[0] = t0;
				t[1] = t1;
			}
		}
	}

	int v = 0;

	for (int d = 0; d < 2; ++d) {
		v += calc_score(D, c, s, last, d, t[d]);
		last[t[d]] = d + 1;
	}

	for (int d = 2; d < D; ++d) {
		int score_max = numeric_limits<int>::min();
		for (int k = 0; k < 26; ++k) {
			int score = calc_score(D, c, s, last, d, k);
			if (score_max < score) {
				score_max = score;
				t[d] = k;
			}
		}
		v += score_max;
		last[t[d]] = d + 1;
	}

	for (auto x : t) {
		cout << x + 1 << endl;
	}
}


Measured memory_bytes: 3672
////////////////////////////////////////////
///                                      ///
///         Template ver. 1 rapel        ///
/// Fear is Temporary, Regret is Forever ///
///          Must Try and Get AC         ///
///                                      ///
////////////////////////////////////////////
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <iomanip>

#include <algorithm>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <utility>

#include <math.h>
#include <complex>

#include <assert.h>
#include <time.h>
//#include <chrono>
//#include <random>

#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <bitset>

#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define PF push_front
#define POB pop_back
#define POF pop_front
#define endl '\n'
using namespace std;

typedef long long LL;
typedef unsigned long long ULL;

void desperate_optimization(int precision){
  	ios_base::sync_with_stdio(false);
  	cin.tie(0);
  	cout.tie(0);
  	cout.setf(ios::fixed);
  	cout.setf(ios::showpoint);
  	cout.precision(precision);
}

int dp[10][10];

string target="AKIHABARA";
string s;

int solve(int l,int r) {
	if(l == target.size() && r == s.size()) return 1;
	if(l == target.size()) return 0;
//	cout<<"CHECK "<<l<<" "<<r<<endl;
	int &res = dp[l][r];
	if(res != -1) return res;
	res = 0;
	if(target[l] == s[r]) res = max(res, solve(l + 1, r + 1));
	if(target[l] == 'A') res = max(res, solve(l + 1, r));
	return res;
}

void hora(int tc) {
	cin>>s;
	if(s.size() > target.size()) cout<<"NO"<<endl;
	else {
		memset(dp, -1, sizeof dp);
		int res = solve(0, 0);
		if(res == 1) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
}

int main(){
	desperate_optimization(10);
	int ntc = 1;
	//cin>>ntc;
	for(int tc = 1;tc <= ntc;tc++) hora(tc);
	return 0;
}




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



int main() {
  int x;
  cin >> x;
  if(x == 0) cout << 1 << endl;
  if(x == 1) cout << 0 << endl;
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	/** 進数のベース */
	private static final int RADIX = -2;

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			StringBuilder sb = new StringBuilder((0 == n) ? "0" : "");
			while (Math.abs(n) > 0) {
				int digit = n % RADIX;
				if (digit >= 0) {
					sb.append(digit);
					n /= RADIX;
				} else {
					sb.append(digit - RADIX);
					n = (n + RADIX) / RADIX;
				}
			}
			System.out.println(sb.reverse().toString());
		}
	}
}


Measured memory_bytes: 35836
#include <algorithm>
#include <cassert>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using namespace std;

typedef unsigned long ul;
typedef long long ll;
typedef pair<ul, ul> P;
#define REP(i, n) for (int i = 0; i < n; i++)
const int INF = 1 << 29;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N, K;
  string S;
  cin >> N >> K;
  cin >> S;
  vector<int> diff_num;
  diff_num.reserve(N);
  int number = 0;
  diff_num.emplace_back(0);
  deque<int> state_part;
  auto old_num = S[0];
  for (int ii = 1; ii < N; ii++) {
    if (old_num != S[ii]) {
      diff_num.emplace_back(ii);
      old_num = S[ii];
    }
  }
  int diff_point_num = diff_num.size();
  diff_num.emplace_back(N);
  vector<int> max_num(diff_point_num, 0);
  for (int ii = 0; ii < diff_point_num; ++ii) {
    if (S[diff_num[ii]] == '0') {
      max_num[ii] = diff_num[min(diff_point_num, 2 * K + ii)] - diff_num[ii];
    } else {
      max_num[ii] =
          diff_num[min(diff_point_num, 2 * K + 1 + ii)] - diff_num[ii];
    }
  }
  auto ans = *max_element(max_num.begin(), max_num.end());
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1232
from collections import Counter
import sys
input = sys.stdin.readline

N, K, L = map(int, input().split())

vec1, vec2 = [[] for _ in range(N)], [[] for _ in range(N)]

for _ in range(K) :
    p, q = map(int, input().split())
    vec1[p-1].append(q-1)
    vec1[q-1].append(p-1)
for _ in range(L) :
    r, s = map(int, input().split())
    vec2[r-1].append(s-1)
    vec2[s-1].append(r-1)

def bfs(v) :
    visited = [-1] * N
    n = 0
    for i in range(N) :
        if visited[i] < 0 :
            queue = [i]
            visited[i] = n
            j = 0
            while j < len(queue) :
                cur = queue[j]
                for nex in v[cur] :
                    if visited[nex] < 0 :
                        queue.append(nex)
                        visited[nex] = n
                j += 1
            n += 1
            
    return visited
    
visited1 = bfs(vec1)
visited2 = bfs(vec2)
p = [(visited1[i], visited2[i]) for i in range(N)]
c = Counter(p)

print(' '.join([str(c[p[i]]) for i in range(N)]))

Measured memory_bytes: 117164
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <clocale>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i, s, n) for(int i = (s), i##_len=(n); i < i##_len; ++i)
#define FORS(i, s, n) for(int i = (s), i##_len=(n); i <= i##_len; ++i)
#define VFOR(i, s, n) for(int i = (s); i < (n); ++i)
#define VFORS(i, s, n) for(int i = (s); i <= (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) FORS(i, 0, n)
#define VREP(i, n) VFOR(i, 0, n)
#define VREPS(i, n) VFORS(i, 0, n)
#define RFOR(i, s, n) for(int i = (s), i##_len=(n); i >= i##_len; --i)
#define RFORS(i, s, n) for(int i = (s), i##_len=(n); i > i##_len; --i)
#define RREP(i, n) RFOR(i, n, 0)
#define RREPS(i, n) RFORS(i, n, 0)
#define ALL(v) (v).begin(), (v).end()
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v), greater<decltype(v[0])>())
#define SZ(x) ((int)(x).size())
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define BIT(n) (1LL<<(n))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

using ll = long long;
using Pi_i = pair<int, int>;
using VI = vector<int>;
using VD = vector<double>;
using VLL = vector<ll>;
using VS = vector<string>;
using VC = vector<char>;
using VB = vector<bool>;

const int MOD = 1000000007;
const int INF = 1000000000;

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



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

int main(){
    int x, y; cin >> x >> y;
    cout << gcd(x, y) << "\n";
    return 0;
}



Measured memory_bytes: 3100
#include "bits/stdc++.h"
using namespace std;
int main()
{
	int q;
	cin >> q;
	bool prime[100001] = {};
	int n[100001] = {};
	prime[0] = true;
	prime[1] = true;
	for(int i = 2; i < 100001; i++)
	{
		for(int j = 2; j <= sqrt(i); j++)
		{
			if(!(i % j))
			{
				prime[i] = true;
				break;
			}
		}
	}
	for(int i = 3; i < 100000; i += 2)
	{
		n[i] = (!prime[i] && !prime[(i + 1) / 2]) + n[i - 2];
	}
	for(int i = 0, l, r; i < q; i++)
	{
		scanf("%d %d", &l, &r);
		printf("%d\n", n[r] - n[l - 2]);	
	}		
}

Measured memory_bytes: 1152
#include <iostream>
#include <queue>
#include <vector>

typedef long long ll;
using namespace std;
int main() {
  ll H, W;
  cin >> H >> W;
  vector<string> grid(H);
  for (ll i = 0; i < H; i++) {
    cin >> grid[i];
  }

  vector<vector<ll>> distance(H, vector<ll>(W, 0));
  queue<pair<ll, ll>> q;

  for (ll i = 0; i < H; i++) {
    for (ll j = 0; j < W; j++) {
      if (grid[i][j] == '#') {
        q.push(make_pair(i, j));
      }
    }
  }

  while (!q.empty()) {
    pair<ll, ll> pair = q.front();
    q.pop();

    ll x = pair.first;
    ll y = pair.second;

    if (x + 1 < H && grid[x + 1][y] != '#') {
      grid[x + 1][y] = '#';
      distance[x + 1][y] = distance[x][y] + 1;
      q.push(make_pair(x + 1, y));
    }
    if (x - 1 >= 0 && grid[x - 1][y] != '#') {
      grid[x - 1][y] = '#';
      distance[x - 1][y] = distance[x][y] + 1;
      q.push(make_pair(x - 1, y));
    }
    if (y + 1 < W && grid[x][y + 1] != '#') {
      grid[x][y + 1] = '#';
      distance[x][y + 1] = distance[x][y] + 1;
      q.push(make_pair(x, y + 1));
    }
    if (y - 1 >= 0 && grid[x][y - 1] != '#') {
      grid[x][y - 1] = '#';
      distance[x][y - 1] = distance[x][y] + 1;
      q.push(make_pair(x, y - 1));
    }
  }
  ll ans = 0;
  for (auto row : distance) {
    for (auto dist : row) {
      ans = max(ans, dist);
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main(){
  int N;  cin>>N;
  vector<int64_t> lnum(N+1);
lnum.at(0)=2; lnum.at(1)=1;
  for(int i=2; i<N+1; i++){
    
    lnum.at(i) = lnum.at(i-1) + lnum.at(i-2);
  }
  
  cout<<lnum.at(N)<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(v) v.begin(),v.end()
#define mem(arr) memset(arr, 0, sizeof(arr))
#define ff first
#define ss second
#define int long long int
const int MOD = 1e9 + 7;
const int INF = 1e18;
const int N = 1e6 + 20;
vector<int> g[N];
vector<int> vis(N);
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int tc = 1;
    while(tc--){
        int n;
        cin >> n;
        int a[n];
        for(int i = 0; i < n; i++){
            cin >> a[i];
        }
        int l = 0, r = n - 1;
        int ans = -1;
        while(l <= r){
            int mid = (l + r) / 2;
            int x = n - mid;
            int k = 1;
            for(int i = 0; i < n; i++){
                if(a[i] == k){
                    k++;
                }
            }
            k--;
            if(k >= x){
                ans = mid;
                r = mid - 1;
            }else{
                l = mid + 1;
            }
        }
        cout << ans << '\n';
    }
}

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

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = std::int64_t;
using P = std::tuple<int,int>;

int N, M;
std::vector<int> G[100100];
std::vector<int> order;
bool used[100100];
int rank[100100], parent[100100];

void dfs(int v){
    used[v] = true;

    for(int w : G[v]){
        unless(used[w]){
            dfs(w);
        }
    }

    rank[v] = order.size();
    order.emplace_back(v);
}

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

    std::cin >> N >> M;

    for(int i=0;i<N-1+M;++i){
        int A, B;
        std::cin >> A >> B;

        G[B].emplace_back(A);
    }

    for(int i=1;i<=N;++i){
        unless(used[i]){
            dfs(i);
        }
    }

    for(int u : order){
        if(G[u].empty()){
            continue;
        }

        int v = G[u][0];
        for(int w : G[u]){
            if(rank[w] > rank[v]){
                v = w;
            }
        }

        parent[u] = v;
    }

    for(int i=1;i<=N;++i){
        std::cout << parent[i] << std::endl;
    }
}


// #include <bits/stdc++.h>

// #define fst(t) std::get<0>(t)
// #define snd(t) std::get<1>(t)
// #define thd(t) std::get<2>(t)
// #define unless(p) if(!(p))
// #define until(p) while(!(p))

// using ll = std::int64_t;
// using P = std::tuple<int,int>;

// int N, M;
// std::vector<int> G[100100];
// std::vector<int> order;
// int parent[100100];
// bool used[100100];

// void dfs(int v){
//     for(int w : G[v]){
//         unless(used[w]){
//             dfs(w);
//         }
//     }

//     order.emplace_back(v);
// }

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

//   std::cin >> N >> M;

//   for(int i=0;i<N-1+M;++i){
//       int A, B;
//       std::cin >> A >> B;

//       G[B].emplace_back(A);
//   }

//   dfs(1);

//   for(int u : order){
//       if(G[u].size() == 0){
//           continue;
//       }

//       int v = G[u][0];

//       for(int w : G[u]){
//           if(std::lower_bound(order.begin(), order.end(), w) - order.begin()
//              > std::lower_bound(order.begin(), order.end(), v) - order.begin()){
//               v = w;
//           }
//       }

//       parent[u] = v;
//   }

//   for(int i=1;i<=N;++i){
//       std::cout << parent[i] << std::endl;
//   }
// }


Measured memory_bytes: 10616