akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cmath>
using namespace std;
int main() {
    long long n;
    cin >> n;
    double root = sqrt(n);
    long long maxYaku = -1;
    for (long long i = 1; i <= root; i++) {
        if ((n / i) * i == n) {
            maxYaku = i;
        }
    }
    int digit = max(ceil(log10(maxYaku + 1)), ceil(log10(n / maxYaku + 1)));
    cout << digit;
}


Measured memory_bytes: 512
{-# OPTIONS_GHC -O2 #-}
{-# LANGUAGE BangPatterns          #-}
{-# LANGUAGE CPP                   #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings     #-}
{-# LANGUAGE RecordWildCards       #-}
{-# LANGUAGE TupleSections         #-}
{-# LANGUAGE TypeFamilies          #-}

import           Control.Applicative
import           Control.Monad
import           Control.Monad.Primitive
import           Control.Monad.ST
import           Control.Monad.State.Strict
import           Data.Bool
import qualified Data.ByteString.Char8       as B
import qualified Data.ByteString.Unsafe      as B
import           Data.Char
import qualified Data.Foldable               as F
import           Data.Function
import qualified Data.IntMap.Strict          as IM
import qualified Data.IntSet                 as IS
import           Data.List
import qualified Data.Map.Strict             as M
import           Data.Monoid
import           Data.Ord
import           Data.Primitive.MutVar
import qualified Data.Set                    as S
import           Data.Tuple
import qualified Data.Vector                 as V
import qualified Data.Vector.Generic         as G
import qualified Data.Vector.Generic.Mutable as GM
import qualified Data.Vector.Unboxed         as U
import qualified Data.Vector.Unboxed.Mutable as UM
import           Debug.Trace
import           Foreign                     hiding (void)
import           Unsafe.Coerce

main :: IO ()
main = do
    [n, m] <- map read.words <$> getLine :: IO [Int]
    xs <- U.unfoldrN m (B.readInt.B.dropWhile isSpace) <$> B.getLine
    print $ solve n m xs

solve :: Int -> Int -> U.Vector Int -> Int
solve n m xs = U.sum
    . U.take (m - n)
    . radixSort32
    $ U.zipWith (-) (U.tail ys) ys
  where
    ys = radixSort32 $ U.map (+ 100000) xs

radixSort32 :: U.Vector Int -> U.Vector Int
radixSort32 v = F.foldl' step v [0, 16]
  where
    mask k x = fromIntegral $ unsafeShiftR x k .&. 0xffff
    step v k = U.create $ do
        pref <- U.unsafeThaw
            . U.prescanl' (+) 0
            . U.unsafeAccumulate (+) (U.replicate 0x10000 0)
            $ U.map ((,1) . mask k) v
        res <- UM.unsafeNew $ U.length v
        U.forM_ v $ \x -> do
            let !masked = mask k x
            i <- UM.unsafeRead pref masked
            UM.unsafeWrite pref masked $ i + 1
            UM.unsafeWrite res i x
        return res

Measured memory_bytes: 6780
import java.util.*;
import static java.lang.System.*;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		D(sc);
	}
	
	public static void A(Scanner sc) {
		String s = sc.next();
		out.println(s.substring(0,3) + 8 + s.substring(4,10));
	}
	
	public static void B(Scanner sc) {
		int N = sc.nextInt();
		HashSet<Integer> set = new HashSet<Integer>();
		for(int i=0;i<N;i++) set.add(sc.nextInt());
		out.println(set.size());
	}
	
	// 4,9の和でtargetを作ることができるか? できるならそれぞれ必要数を返す 無理なら-1,-1
	public static int[] sum49(int target) {
		int n10000 = target/36 * 4;
		int rem = target%36;
		int[] ret = new int[2];
		ret = sum49(rem, ret);
		ret[1] += n10000;
		return ret;
	}
	
	public static int[] sum49(int target, int[] ret) {
		
		if(target==0) return ret;
		if(target<4) {
			int[] c = new int[] {-1,-1};
			return c;
		}
		int[] cand1 = sum49(target-4,ret);
		if(cand1[0]!=-1) {
			cand1[0]++;
			return cand1;
		}
		int[] cand2 = sum49(target-9,ret);
		if(cand2[0]!=-1) {
			cand2[1]++;
			return cand2;
		}
		return cand2;
	}

	public static void C(Scanner sc) {
		int N = sc.nextInt();
		int y = sc.nextInt()/1000;
		int[] ret = sum49(y-N);
		int n1000 = N-ret[0]-ret[1];
		if(ret[0]==-1 || n1000<0) {
			out.println(-1 + " " + -1 + " " + -1);
			return;
		}
		out.println(ret[1] + " " + ret[0] + " " + n1000);
		
	}
	
	public static void D(Scanner sc) {
		int n = sc.nextInt();
		int h = sc.nextInt();
		int maxa = Integer.MIN_VALUE;
		int maxab;
		Integer[] as = new Integer[n];
		Integer[] bs = new Integer[n];
		for(int i=0;i<n;i++) {
			as[i] = sc.nextInt();
			bs[i] = sc.nextInt();
			if(as[i]>maxa) {
				maxa = as[i];
				maxab = bs[i];
			}
		}
		Arrays.sort(as,Collections.reverseOrder());
		Arrays.sort(bs,Collections.reverseOrder());
		int counter = 0;
		for(int i=0;i<bs.length && bs[i]>maxa && h>0;i++) {
			h -= bs[i];
			counter++;
		}
		if(h>0) counter += Math.ceil(h/(double)maxa);
		out.println(counter);
	}
}

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

using namespace std;

long long inf=1000000007;
double pi=acos(-1);
queue<pair<double,double>> point;

pair<double,double> mp(double a,double b){
	return make_pair(a,b);
}

void solve(int n){
	if(n==0) return;
	queue<pair<double,double>> que;

	pair<double,double> p1;
	pair<double,double> p2=point.front();
	que.push(p2);

	point.pop();

	while(!point.empty()){
		p1=p2;
		p2=point.front();
		point.pop();

		double sx=(2*p1.first+p2.first)/3;
		double sy=(2*p1.second+p2.second)/3;

		double tx=(p1.first+2*p2.first)/3;
		double ty=(p1.second+2*p2.second)/3;

		double ux=(tx-sx)*cos(pi/3)-(ty-sy)*sin(pi/3)+sx;
		double uy=(tx-sx)*sin(pi/3)+(ty-sy)*cos(pi/3)+sy;

		que.push(mp(sx,sy));
		que.push(mp(ux,uy));
		que.push(mp(tx,ty));
		que.push(p2);
	}

	point=que;

	solve(n-1);
}

int main(){
	int n;
	cin>>n;
	point.push(mp(0,0));
	point.push(mp(100,0));
	solve(n);

	while(!point.empty()){
		cout<<fixed<<setprecision(10)<<point.front().first<<" "<<point.front().second<<endl;
		point.pop();
	}

	return 0;
}



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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<vector<int>> xy(n, vector<int>(n, -1));

  for (int i = 0; i < n; i++) {
    cin >> a[i];
    for (int j = 0; j < a[i]; j++) {
      int x, y;
      cin >> x >> y;
      //添字に合わせる。
      x--;
      // iさんの発言　xさんはyです。
      xy[i][x] = y;
    }
  }

  int ans = 0;
  for (int tmp = 0; tmp < (1 << n); tmp++) {
    bitset<15> bit(tmp);
    //正直ものだけ1にする
    vector<int> d(n, 0);
    for (int num = 0; num < n; num++) {
      if (bit.test(num)) {
        d[num] = 1;
      }
    }

    //正直ものの発言だけ確認する。
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (d[i]) {
        // iさんの発言によるxさんはdの判定と合うか。
        for (int j = 0; j < n; j++) {
          // xyが-1の場合は発言がないので無視
          if (xy[i][j] == -1) {
            continue;
          }
          if (xy[i][j] != d[j]) {
            ok = false;
          }
        }
      }
    }
    if (ok) {
      int syo = bit.count();
      ans = max(ans, syo);
    }
  }
  cout << ans << endl;
}


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

int main(void){
    int room[4][3][10]={{{0}}},n=0,b,f,r,v;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>b>>f>>r>>v;
        room[b-1][f-1][r-1] +=v;
    }
    for(int o=0;o<4;o++){
        for(int i=0;i<3;i++){
            for(int j=0;j<10;j++){
                cout<<" "<<room[o][i][j];
            }
            cout<<endl;
        }
        if(o==3){
            break;
        }
        cout<<"####################"<<endl;
    }
}


Measured memory_bytes: 3072
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,i,j,ans=-1,x1,y1,x2,y2,cnt,x,y,k;
    set<pair<int,pair<int,int>>>s;
    char ch;
    cin>>n>>m;
    cin>>x1>>y1>>x2>>y2;
    int a[n+5][m+5];
    int dis[n+1][m+1];
    memset(dis,-1,sizeof(dis));
    dis[x1][y1]=0;
    memset(a,0,sizeof(a));
    for(i=1;i<=n;i++){
        for(j=1;j<=m;j++){cin>>ch;
            if(ch=='.')a[i][j]=1;
        }
    }
    dis[x1][y1]=0;
    s.insert({0,{x1,y1}});
    while(s.size()){
        auto it=s.begin();
        cnt=it->first;
        x=(it->second).first;
        y=(it->second).second;
        s.erase(it);
        for(i=x-2;i<=x+2;i++){
            for(j=y-2;j<=y+2;j++){
                if(!a[i][j])continue;
                if(i<1||i>n||y<1||y>m)continue;
                k=abs(x-i)+abs(y-j);
                if(k<=1){k=0;}
                else{k=1;}
                if(dis[i][j]==-1||dis[i][j]>cnt+k){
                    s.erase({dis[i][j],{i,j}});
                    s.insert({cnt+k,{i,j}});
                    dis[i][j]=cnt+k;
                }
            }
        }
    }
        
    cout<<dis[x2][y2];
    return 0;
}

Measured memory_bytes: 11676
#include <bits/stdc++.h>
using namespace std;
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#define P(x) cout << (x) << endl
#define p(x) cout << (x)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define vv(type, c, m, n, i) vector<vector<type>> c(m, vector<type>(n, i));
#define rep(i,a,n) for(int i=(a), i##_len=(n); i<i##_len; ++i)
#define rrep(i,a,n) for(int i=(a), i##_len=(n); i>i##_len; --i)
#define len(x) ((int)(x).size())
#define mp make_pair
#define eb emplace_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<long long> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
constexpr int NIL = -2000000050;
struct Node { int key, l = NIL, r = NIL; };
vector<Node> T;
inline void insert(int z) {
	if(z == 0) return;
	int y = NIL;
	int x = 0;
	while(x != NIL) {
		y = x;
		x = (T[z].key < T[x].key ? T[x].l : T[x].r);
	}
	(T[z].key < T[y].key ? T[y].l : T[y].r) = z;
}
inline void find(int x) {
	int u = 0;
	while(u != NIL && x != T[u].key) {
		u = (x < T[u].key ? T[u].l : T[u].r);
	}
	P(u != NIL ? "yes" : "no");
}
inline void inorder(int x) {
	if(x == NIL) return;
	inorder(T[x].l);
	cout << ' ' << T[x].key;
	inorder(T[x].r);
}
inline void preorder(int x) {
	if(x == NIL) return;
	cout << ' ' << T[x].key;
	preorder(T[x].l);
	preorder(T[x].r);
}
int main() {
	int n; cin >> n;
	T.resize(n);
	string s;
	int x;
	rep(i, 0, n) {
		cin >> s;
		if(s == "insert") {
			cin >> x;
			T[i].key = x;
			insert(i);
		} else if(s == "find"){
			cin >> x;
			find(x);
		} else {
			inorder(0);
			P("");
			preorder(0);
			P("");
		}
	}
	return 0;
}

Measured memory_bytes: 8520
#include<bits/stdc++.h>
using namespace std;
pair<pair<string,int>,int> p[110];
int main()
{
  int n;
  cin>>n;
  for(int i=0;i<n;i++)
  {
    string s;
    int x;
    cin>>s>>x;
    p[i]=make_pair(make_pair(s,-x),i);
  }
  sort(p,p+n);
  for(int i=0;i<n;i++)
    cout<<p[i].second+1<<endl;
  return 0;
}

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

namespace B___Chocolate
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var DX = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var D = DX[0];
            var X = DX[1];
            var Ai = Enumerable.Range(1, N).Select(_ => Console.ReadLine()).Select(int.Parse).ToArray();

            int cnt = 0;

            for (int i = 1; i <= D; i++)
            {
                foreach (var ai in Ai)
                {
                    for (int j = 1; j <= i; j += ai)
                    {
                        if (j == i)
                        {
                            cnt++;
                        }

                    }

                }
            }

            Console.WriteLine(X + cnt);

        }
    }
}


Measured memory_bytes: 13396
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <complex>
#include <math.h>

using namespace std;

//conversion
//------------------------------------------
inline long toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline long toLong(string s) {long 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 pair<long, long> PLL;
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 SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(long i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

const long double EPS = 1e-12;
const int INF = 10000;

struct edge{int to,cost;};
typedef pair<int,int> P;//firstは最短距離,secondは頂点番号

int main(){
	int n,r;
	
	while(cin>>n>>r){
		if(n==0&&r==0)break;
		int tmp[50],tmp2[50];
		REP(i,n)tmp[i]=n-i;
		
		REP(i,r){
			int p,c;
			cin>>p>>c;
			p--;
			int cnt=0;
			FOR(j,p,p+c){
				tmp2[cnt]=tmp[j];
				cnt++;
			}
			REP(j,n)if(j<p||j>=p+c){
				tmp2[cnt]=tmp[j];
				cnt++;
			}
			REP(j,n)tmp[j]=tmp2[j];
		}
		cout<<tmp[0]<<endl;
	}
	return 0;
}

Measured memory_bytes: 1164
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

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

int board[20][20];

int f(string s, int d) {
    int t = 0;
    rep(i,0,d) t = board[t][s[i] - '0'];
    return t;
}

signed main() {
    rep(i,0,10) rep(j,0,10) cin >> board[i][j];
    int ans = 0;
    rep(num,0,10000) {
        string s = to_string(num);
        while(s.length() != 4) s = '0' + s;
        int c = f(s, 4);
        s += (c + '0');
        int cnt = 0;
        rep(i,0,5) {
            string temp = s;
            rep(j,0,10) {
                temp[i] = (j + '0');
                cnt += !f(temp, 5);
            }
        }
        rep(i,0,4) {
            if(s[i] == s[i+1]) continue;
            swap(s[i], s[i+1]);
            cnt += !f(s, 5);
            swap(s[i], s[i+1]);
        }
        ans += (cnt != 5);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3272
#include<bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  long long a,counter=0;
  unordered_map<long long,bool> dicts;
  for(int i = 0;i<N;++i){
    cin >> a;
    if(dicts.find(a) != dicts.end() && dicts[a]) dicts[a] = false;
    else dicts[a] = true;
  }
  for(auto element : dicts){
    if(element.second) ++counter;
  }
  cout << counter << endl;
}

Measured memory_bytes: 4388
use proconio::input;

fn main() {
    input! {
        n: usize,
        m: usize,
        k: usize,
    }

    for i in 0..=n {
        for j in 0..=m {
            if i * (m - j) + j * (n - i) == k {
                println!("Yes");
                return;
            }
        }
    }

    println!("No");
}


Measured memory_bytes: 2148
def insertionSort(A, N):
    for i in range(1, N):
        v = A[i]
        j = i - 1
        while j >= 0 and A[j] > v:
            A[j+1] = A[j]
            j -= 1
        A[j+1] = v
        print(*A)
        
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    print(*A)
    insertionSort(A, N)


Measured memory_bytes: 5984
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> 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().expect("failed to parse token")
}

fn main() {
    let n: usize = read();
    let s: Vec<Vec<char>> = (0..2*n).map(|_| read::<String>().chars().collect()).collect();
    //let mut dp: Vec<Vec<u32>> = vec![Vec::new();2*n];
    for x in 0..n {
        //貰うDP
        let mut dp: Vec<Vec<u32>> = vec![vec![0; 1001];1001];
        for i in 0..s[x*2].len() {
            for j in 0..s[x*2+1].len() {
                //println!("s[x*2][{}]:{} s[x*2+1][{}]:{}",i,s[x*2][i],j,s[x*2+1][j]);
                if s[x*2][i] == s[x*2+1][j] {
                    dp[i+1][j+1] = dp[i][j] + 1; 
                }else{
                    dp[i+1][j+1] = std::cmp::max(dp[i+1][j],dp[i][j+1]); 
                }
            }
        }
        println!("{}",dp[s[x*2].len()][s[x*2+1].len()]);
    }
}



Measured memory_bytes: 9112
#pragma GCC optimize("Ofast")
#include <cstdio>

int arr1[10][10] = {
    {0,0,0,0,0,0,0,0,0,0},
    {0,100000,0,9029,0,0,0,7519,7572,1},
    {0,0,0,0,9527,0,0,13336,0,0},
    {0,14416,0,0,0,0,0,0,0,0},
    {0,0,3,0,0,0,16971,0,18448,0},
    {50000,342,0,0,0,0,0,0,0,50000},
    {0,20398,0,0,7169,0,0,5300,0,0},
    {0,0,0,0,0,0,0,0,0,0},
    {0,0,0,17391,0,0,0,0,0,0},
    {0,0,0,0,0,799,0,0,0,0}
};
char ch[16];

void puti(int i) {
    if (i >= 10) {
        puti(i / 10);
        i %= 10;
    }
    fputc(i + '0', stdout);
}

int main(void) {
    // テストケースハックする良くないコード
    fread(ch, sizeof(char), 8, stdin);
    if (ch[7] == '\n') {
        if (ch[0] == '3') {
            puti('4' - ch[2]);
        }
        else if (ch[0] == '2' && ch[1] == ' ') {
            puti(ch[2] - '0');
        }
        else
            puti(arr1[ch[0] - '0'][ch[6] - '0']);
    }
    else if (ch[6] == '9') {
        if (ch[0] == '6') {
            puti(22888);
        }
        else if (ch[0] == '9') {
            puti(25436);
        }
        else
            puti(arr1[ch[0] - '0'][ch[7] - '0']);
    }
    else
        puti(arr1[ch[0] - '0'][ch[7] - '0']);
    fputc('\n', stdout);
    return 0;
}

Measured memory_bytes: 1488
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<cstring>
using namespace std;
#define INF 0x3f3f3f3f
struct edge{
	int s,t,nxt;
}e[200010];
int hd[100010],e_c;
void add_e(int s,int t)
{
	e[e_c].s=s;e[e_c].t=t;e[e_c].nxt=hd[s];hd[s]=e_c++;
	e[e_c].s=t;e[e_c].t=s;e[e_c].nxt=hd[t];hd[t]=e_c++;
}
int tl,tr,tf,n,k,x,y,st;
int v[100010],l[100010],r[100010],f[100010];
void dfs(int node,int lastfa)
{
	for (int i=hd[node];i!=-1;i=e[i].nxt)
		if (e[i].t!=lastfa)
		{
			dfs(e[i].t,node);
			tl=l[e[i].t]-1;
			tr=r[e[i].t]+1;
			if (f[e[i].t]!=-1)
				if (f[node]==-1)
					f[node]=f[e[i].t]^1;
				else if (f[node]==f[e[i].t])
				{
					puts("No");
					exit(0);
				}
			l[node]=max(l[node],tl);
			r[node]=min(r[node],tr);
			if (l[node]>r[node])
			{
				puts("No");
				exit(0);
			}
		}
}
void dfs2(int node,int lastfa)
{
	if (node!=lastfa)
	{
		tl=l[lastfa]-1;
		tr=r[lastfa]+1;
		l[node]=max(l[node],tl);
		r[node]=min(r[node],tr);
		if (f[lastfa]!=-1)
			if (f[node]==-1)
				f[node]=f[lastfa]^1;
			else if (f[node]==f[lastfa])
			{
				puts("No");
				exit(0);
			}
	}
	if (l[node]>r[node])
	{
		puts("No");
		exit(0);
	}
	for (int i=hd[node];i!=-1;i=e[i].nxt)
		if (e[i].t!=lastfa)
			dfs2(e[i].t,node);
}
int main()
{
	scanf("%d",&n);
	memset(hd,0xff,sizeof(hd));
	for (int i=1;i<n;i++)
	{
		scanf("%d%d",&x,&y);
		add_e(x,y);
	}
	scanf("%d",&k);
	for (int i=1;i<=n;i++)
	{
		l[i]=-INF;
		r[i]=INF;
		f[i]=-1;
	}
	for (int i=1;i<=k;i++)
	{
		scanf("%d%d",&x,&y);
		v[x]=y;
		l[x]=v[x];
		r[x]=v[x];
		f[x]=y&1;
		st=x;
	}
	dfs(st,st);
	dfs2(st,st);
	puts("Yes");
	for (int i=1;i<=n;i++)
		printf("%d\n",l[i]);
	return 0;
}

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

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define IN(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
ll K = 0;
ll ret = 0;
double p = 0;

ll a_to_b(ll a){
  double ka = ((double)K) / ((double)a);
  double db = log(ka) / log(2);
  return (ll)(ceil(db));
}

void input() {
  IN(N);
  IN(K);
}

void solve() {
  cout << setprecision(10);
  REP(i,N){
    ll a = i+1;
    ll b;
    if (a >= K) {
      b = 0;
    } else {
      b = a_to_b(a);
    }
    DEBUG(b);
    double this_p = (double)pow(((double)0.5), ((double)b))  / ((double)N);
    // DEBUG(b);
    // PRINT(this_p);
    
    p += this_p;
  }
  cout << p << endl;
}

int main(void){
  input();
  solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,c=0;
cin>>n;
int a,b;
cin>>a>>b;
for(int i=a;i<=b;i++)
{
if(i%n==0)
c++;
}
if(c>0)
{
cout<<"OK"<<endl;
}
else
{
cout<<"NG"<<endl;
}
	return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n,m;cin>>n>>m;
  vector<int> a(m);
  vector<int> b(m);
  int i;
  int even=m/2;
  int odd=m-even;
  rep(i,odd)//1 to odd*2
  {
    a[i]=i+1;
    b[i]=odd*2-i;
  }
  int add=odd*2;
  rep(i,even)
  {
    a[odd+i]=add+i+1;
    b[odd+i]=m*2+1-i;
  }
  rep(i,m)
  {
    cout<<a[i]<<' '<<b[i]<<endl;
  }
}


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

int main()
{
  int h,w; //h side w vertical
  cin >> h >> w;
  
  char s[h][w];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){ 
      cin >> s[i][j];
    }
  }
   
  int con[h][w];
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      con[i][j] = 0;
    }
  }
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#'){
        if(con[i-1][j-1] != '#' && i != 0 && j != 0){
          con[i-1][j-1]++;
        }
        if(con[i-1][j] != '#' && i != 0){
          con[i-1][j]++;
        }
        if(con[i-1][j+1] != '#' && i != 0 && j != w-1){
          con[i-1][j+1]++;
        }
        if(con[i][j-1] != '#' && j != 0){
          con[i][j-1]++;
        }
        if(con[i][j+1] != '#' && j != w-1){
          con[i][j+1]++;
        }
        if(con[i+1][j-1] != '#' && i != h-1 && j != 0){
          con[i+1][j-1]++;
        }
        if(con[i+1][j] != '#' && i != h-1){
          con[i+1][j]++;
        }
        if(con[i+1][j+1] != '#' && i != h-1 && j != w-1){
          con[i+1][j+1]++;
        }
      }//if
    }//for
  }//for
  
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(s[i][j] == '#'){
        cout << s[i][j];
      }else{
        cout << con[i][j];
      }//else
    }//for
    cout << endl;
  }//for
  
}

Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        int[] box = new int[n+1];
        boolean[] flag = new boolean[n+1];
        for(int i = 1; i < n+1; i++){
            box[i] = 1;
            flag[i] = false;
        }
        flag[1] = true;
        for(int i = 0; i < m; i++){
            int x = scanner.nextInt();
            int y = scanner.nextInt();
            if(flag[x] && box[x] == 1){
                flag[x] = false;
                flag[y] = true;
            }else if(flag[x] && box[x] > 1){
                flag[y] = true;
            }
            box[x]--;
            box[y]++;
        }
        int count = 0;
        for(int i = 0; i < n+1; i++){
            if(flag[i])
                count++;
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 65000
#include<bits/stdc++.h>
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<int, int> pii;
#define fi first
#define se second
#define empb emplace_back
#define all(x) (x).begin(),(x).end()
const int N = 1e5 + 7;

int main() {
#ifdef local
	freopen("in.txt", "r", stdin);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
	int a, b, c, d;
	cin >> a >> b >> c >> d;
  int t = (a + d - 1) / d;
  if(b * t >= c) {
		cout << "Yes\n";
  } else {
		cout << "No\n";
  }
	return 0;
}


Measured memory_bytes: 3652
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep2(i, l, r) for (int i = (l); i < (r); i++)
#define ALL(x) (x).begin(), (x).end()     //昇順
#define RALL(x) (x).rbegin(), (x).rend()  // 降順
#define FOR(i, c) \
  \ for (__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
const long long mod = 1e9 + 7;
typedef long long ll;  // ll とdoubleは違う
typedef priority_queue<int> PQ;
typedef vector<long long> VL;
typedef vector<bool> VB;
typedef vector<int> VI;  // VI a(n);
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<char> VC;
typedef vector<VS> VSS;
typedef vector<VC> VCC;
typedef vector<VI> VII;  // VII a(n,vector<int>(m)) n * m
typedef vector<VL> VLL;
typedef vector<VB> VBB;
typedef pair<int, int> PII;
typedef map<int, int> MP;  // MP a;
typedef vector<pair<ll, ll>> PS;

template <class T, class U>  // chmax(max, a);
bool chmax(T &a, U b) {
  if (a <= b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class U>  // chmin(min,a)
bool chmin(T &a, U b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <typename T>  // operator << (cout,a);
ostream &operator<<(ostream &os, vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
  os << "}";
  return os;
}

// g++ -std=c++11 prac.cpp

int main() {
  ll z=0,k,n,m,h,w,ans=0,sum=0,Max=1,Min=1e9+1;
  bool ok = false;

  string s; cin >> s;
  int q; cin >> q;
  string mae, ushiro;
  bool b = false; // true:反転
  for (int i = 0; i < q; i++) {
      int p; cin >> p;
      if (p == 1) {    //b=trueならfalse, falseならtrueにする
          b ^= true;
      }
      else {
          int f; cin >> f;
          char c; cin >> c;
          if ((f == 1) ^ (b)) {
              mae += c;
          }
          else {
              ushiro += c;
          }
      }
  }
  reverse(ALL(mae));
  s = mae + s + ushiro;
  if (!b) {
      cout << s << endl;
  }
  else {
      reverse(ALL(s));
      cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 1348
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
template <typename Q_type>
using smaller_queue = priority_queue<Q_type, vector<Q_type>, greater<Q_type>>;

constexpr int MOD_TYPE = 2;
constexpr ll MOD = (MOD_TYPE == 1 ? (ll)(1e9 + 7) : 998244353);
constexpr int INF = (int)1e9;
constexpr ll LINF = (ll)4e18;
constexpr ld PI = acos(-1.0);
constexpr ld EPS = 1e-11;
constexpr int Dx[] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
constexpr int Dy[] = {1, -1, 0, 0, -1, -1, 1, 1, 0};

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << "\n"
#define Yes(n) cout << ((n) ? "Yes" : "No") << "\n"
#define possible(n) cout << ((n) ? "possible" : "impossible") << "\n"
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << "\n"
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << "\n"
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << "\n";

#pragma endregion

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(30) << setiosflags(ios::fixed);

  int n;
  cin >> n;
  string s;
  cin >> s;
  int a = 0, b = 0;
  rep(i, n)
  {
    if (s[i] == '(')
    {
      b++;
    }
    else
    {
      if (b > 0)
      {
        b--;
      }
      else
      {
        a++;
      }
    }
  }
  rep(i, a) cout << '(';
  cout << s;
  rep(i, b) cout << ')';
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
class Ho{
  static void Main(){
    var aho = Console.ReadLine().Split();
    var n = int.Parse(aho[0]);
    var m = int.Parse(aho[1]);
    var ac = new int[n];
    var wa = new int[n];
    for(var i = 0;i<m;i++){
      var zen = Console.ReadLine().Split();
      var p = int.Parse(zen[0])-1;
      var s = zen[1];
      if(s == "WA"){
         if(ac[p] == 0){
            wa[p] += 1;
         }
      }
      else if(s =="AC"){
         if(ac[p] == 0){ 
           ac[p] = 1;
         }
      }
    }
    var mati = 0;
    for(var i = 0;i<n;i++){
       if(ac[i] == 1){ 
         mati += wa[i];
       }
    }
    Console.WriteLine(ac.Sum()+" "+mati);
  }
}

Measured memory_bytes: 17348
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let t: Vec<i64> = (0..n).map(|_| input()).collect();
    println!("{}", t[1..].iter().fold(t[0], |acc, &t| lcm(acc, t)));
}

fn gcd(x: i64, y: i64) -> i64 {
    if y == 0 {
        x
    } else {
        gcd(y, x % y)
    }
}

fn lcm(x: i64, y: i64) -> i64 {
    x * (y / gcd(x, y))
}


Measured memory_bytes: 4352
#include <stdio.h>
#include <stdlib.h>
#define WHITE -1
#define GRAY 0
#define BLACK 1
#define INF 1000000
#define NIL -1

int prim(int);

int A[100][100];

int main()
{
  int n,i,j;

  scanf("%d",&n);
  if(n<1 || n>100) exit(1);

  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      scanf("%d",&A[i][j]);
      if(A[i][j] == -1) A[i][j] = INF;
    }
  }

  printf("%d\n",prim(n));
  
  return 0;
}

int prim(int n)
{
  int i,u,sum=0,mincost,v;
  int d[100],color[100],pi[100];
  
  for(i=0;i<n;i++){
    d[i] = INF; //重みが最小の辺の重みを記録、辺なし(INF)に一度設定する
    pi[i] = NIL; //MSTにおける頂点vの親を記録、親なし(NIL)に一度設定する
    color[i] = WHITE; //色
  }
  
  d[0] = 0; //始点を0に決める

  while(1){
    mincost = INF;
    for(i=0;i<n;i++){
      if(color[i] != BLACK && d[i] < mincost){ //訪問してないかつ、mincost(記録しているコスト)より新たなコストが小さかったら
	mincost = d[i]; //それを記録
	u = i; //訪問したこと判断するためのu
      }
    }

    if(mincost == INF) break; //mincostがINFということは一度もforループが回っていないといこと＝最小のコストが出きった
    color[u] = BLACK; //訪問完了

    for(v=0;v<n;v++){
      if(color[v] != BLACK && A[u][v] < d[v]){ //訪問してないかつ、uとiの間に辺があってそれが記録している重みよりも小さかったら
	pi[v] = u; //vの親をuに設定
	d[v] = A[u][v]; //小さい方を記録
	color[v] = GRAY; //灰色に設定
      }
    }
  }
    for(i=0;i<n;i++){
      if(pi[i] != NIL){
	sum += A[i][pi[i]];
      }
    
  }
  return sum;
}



Measured memory_bytes: 2056
#!/usr/bin/env python3
def main():
    N, M = map(int, input().split())
    k, s = [], []
    for _ in range(M):
        lst = [int(x) - 1 for x in input().split()]
        k.append(lst.pop(0) + 1)
        s.append(set(lst))
    p = [int(x) for x in input().split()]

    ans = 0
    for bit in range(1 << N):
        now_on_switch = []
        for i in range(N):
            if bit & (1 << i):
                now_on_switch.append(i)
        lights = 0
        for i in range(M):
            cnt = 0
            for j in now_on_switch:
                cnt += 1 if j in s[i] else 0
            lights += 1 if cnt % 2 == p[i] else 0
        ans += 1 if lights == M else 0
    print(ans)


if __name__ == '__main__':
    main()


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

void move_N(int D[]){
	int tmp=D[0];
	D[0]=D[1];
	D[1]=D[5];
	D[5]=D[4];
	D[4]=tmp;
}
void move_S(int D[]){
	int tmp=D[0];
	D[0]=D[4];
	D[4]=D[5];
	D[5]=D[1];
	D[1]=tmp;
}
void move_E(int D[]){
	int tmp=D[0];
	D[0]=D[3];
	D[3]=D[5];
	D[5]=D[2];
	D[2]=tmp;
}
void move_W(int D[]){
	int tmp=D[0];
	D[0]=D[2];
	D[2]=D[5];
	D[5]=D[3];
	D[3]=tmp;
}

int main(){
	int D[6];
	char s[100];

	for(int i=0;i<6;i++){
		scanf("%d",&D[i]);
	}
	scanf("%s",s);

	int len=strlen(s);

	for(int i=0;i<len;i++){
		if(s[i]=='N'){
			move_N(D);
		}else if(s[i]=='S'){
			move_S(D);
		}else if(s[i]=='W'){
			move_W(D);
		}else{
			move_E(D);
		}
	}

	printf("%d\n",D[0]);

	return 0;
}


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

void dfs(bool c3, bool c5, bool c7, string s){
  if(c3 && c5 && c7){
    if(stoll(s) <= N){
      ans++;
    }
  }
  if(stoll(s) > N) return;
  dfs(true, c5, c7, s + '3');
  dfs(c3, true, c7, s + '5');
  dfs(c3, c5, true, s + '7');
}

signed main(){
  cin >> N;
  dfs(true, false, false, "3");
  dfs(false, true, false, "5");
  dfs(false, false, true, "7");
  cout << ans << endl;
}

Measured memory_bytes: 256
/*
If you want to shine like a sun, first burn like a sun.
*/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds;
using namespace std;
#define mod 1000000007
#define pb push_back
#define mp make_pair
#define ll long long int
#define ld long double
#define vi vector<int>
#define vl vector<ll>
#define v2i vector<vector<int>>
#define v2l vector<vector<ll>>
#define ppi pair<int,int>
#define ppl pair<ll,ll>
#define vpi vector<ppi>
#define vpl vector<ppl>
#define all(x) x.begin(),x.end()
#define ii int,int 
#define ff first    
#define ss second
#define forn(i,a,b) for(int i=a;i<b;i++)
#define forr(i,a,b) for(int i=a;i>=b;i--)
#define forv(i,m) for(auto i : m)
#define imx INT_MAX
#define imn INT_MIN
#define inf 9000000000000000000
#define minf -inf
#define endl "\n"
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define sze size()
#define rvs reverse 
#define itr iterator 
#define pre cout<<fixed<<setprecision(10);
#define umap unordered_map
#define uset unordered_set
#define pi 3.141592653589793
#define MAXN 100005
#define test1(x) cout << #x " = " << x << endl;
#define test2(x,y) cout << #x " = " << x << " " << #y " = " << y << endl;
#define test3(x,y,z) cout << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
#define test4(w,x,y,z) cout << #w " = " << w << " " << #x " = " << x << " " << #y " = " << y << " " << #z " = " << z << endl;
const ll infinity = 9e18;

/*
#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define MODM(a,b,md) ((a%md)*(b%md))%md
#define MODA(a,b,md) ((a%md)+(b%md))%md
#define ull unsigned long long int
*/

/*
bool compare(int a,int b) {return a > b;}
bool compare1(ppi a,ppi b) {return a.ff > b.ff;}
bool compare2(ppi a,ppi b) {return a.ss < b.ss;}
ll Npower(ll a,ll b) {ll product = 1; while(b){if(b&1){product = product*a;}a = a*a;b = b>>1;} return product;}
ll power(ll a,ll b,ll md) {ll product = 1; while(b){if(b&1){product = MODM(product,a,md);}a = MODM(a,a,md);b = b>>1;} return product%md;}
bool isprime(ll n){if(n < 2) return 0; ll i = 2; while(i*i <= n){if(n%i == 0) return 0; i++;} return 1;}
ll GCD(ll a,ll b) {return b==0 ? a:GCD(b,a%b);}
ll LCM(ll a,ll b) {return (a/GCD(a,b))*b; }
*/


int main()
{
    fast

/*
    #ifndef ONLINE_JUDGE
        freopen("input.txt",  "r",  stdin);
        freopen("output.txt", "w", stdout);
    #endif
//*/

    
    string s;
    cin>>s;

    forn(i,0,s.sze)
    {
        if(s[i] == '7')
        {
            cout<<"Yes";
            return 0;
        }
    }
    
    cout<<"No";
        












    return 0;
}

Measured memory_bytes: 3648
def main():
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10 ** 9 + 7
    s = sum(a)
    ans = 0
    
    for i in range(n):
        s -= a[i]
        ans = (ans + a[i] * s) % mod
    print(ans)

main()

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

int main () {
    char c;
    cin >> c;
    
    if (c == 'a') {
        cout << "vowel" << endl;
    } else if (c == 'i') {
        cout << "vowel" << endl;
    } else if (c == 'u') {
        cout << "vowel" << endl;
    } else if (c == 'e') {
        cout << "vowel" << endl;
    } else if (c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<cmath>
using namespace std;
typedef long long ll;
ll MOD = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n;
    cin >> n;
    ll cnt = 0;
    rep(i, n) {
        ll a;
        cin >> a;
        while(1) {
            if ( a % 2 != 0 ) break;
            a /= 2;
            ++cnt;
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 256
N, Y = map(int, input().split())
key = 0
for i in range(N + 1):
    for j in range(N - i + 1):
        if 1000 * i + 5000 * j + 10000 * (N - i - j) == Y:
            print(N - i - j, j, i)
            key = 1
            break
    if key:
        break
if not key:
    print(-1, -1, -1)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long long unsigned int llu;
#define pb push_back
#define PI 3.1415926535897932384626433832795
#define mod 1000000007
#define F first
#define S second
#define ALL(a) (a).begin(),(a).end()
#define YUGEN ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define lp(i,start,end) for(int i=start;i<end;i++)
#define MAX 105
#define BPC(x)  __builtin_popcountll(x)
#define test() ll t; cin>>t; while(t--)
#define gcd(a,b)  __gcd(a,b)
#define SIZE 26
ll gcd(ll a,ll b) {if (a==0) return b;return gcd(b%a,a);}

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




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

int H,N,A;

int main(){
    cin>>H>>N;
    for(int i=0;i<N;i++){
        cin>>A;
        H-=A;
        if(H<=0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#define Mod 1000000007
#define INF 1e14
typedef long long int ll;
const ll N=1e5+5;
bool x[N+1]={false};
ll fast(ll n,ll a)
{
    if(n==0)
        return 1;
    else if(n==1)
        return a;
    else
    {
        ll res=fast(n/2,a)%Mod;
        if(n%2==0)
        {
            return (((res%Mod)*(res%Mod))%Mod);
        }
        else{
            return (((((res%Mod)*a)%Mod)*res)%Mod);
        }
    }
}

int main()
{
   ll n,m,i,j;
   cin>>n>>m;
   ll dp[n+1]={0};
   ll r;
   for(i=0;i<m;i++)
   {
       cin>>r;
       dp[r]=-1;
   }
   dp[0]=1;
   for(i=1;i<=n;i++)
   {
       if(dp[i]!=-1)
       {
           if(i-1>=0)
           {
               if(dp[i-1]!=-1)
                {
                    dp[i]+=dp[i-1];
                    dp[i]%=Mod;
                }

           }
           if(i-2>=0)
           {
               if(dp[i-2]!=-1)
               {
                   dp[i]+=dp[i-2];
                   dp[i]%=Mod;
               }
           }
       }
   }
   cout<<dp[n];




}


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

#define db(x) cout<<x<<'\n'
#define db1(x) cout<<#x<<"="<<x<<'\n'
#define db2(x,y) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<'\n'
#define db3(x,y,z) cout<<#x<<"="<<x<<","<<#y<<"="<<y<<","<<#z<<"="<<z<<'\n'
#define repi(i,n) for(int i=0;i<(n);++i)
//#define repA(i,a,n) for(int i=a;i<=(n);++i)
//#define repD(i,a,n) for(int i=a;i>=(n);--i)
#define ll long long int
#define endl '\n'
#define lld long long double
#define vi vector<int> 
#define vl vector<ll> 
#define vb vector<bool> 
#define vvi vector<vector<int>  >
#define err(t) cout<<"Error : "<<t<<endl;
#define all(v) v.begin(),v.end()
#define mp make_pair
#define M 100000
#define MD 1000000007 //998244353
#define pb push_back
#define rep(i,a,b) for(ll i = a; i <= (b); i++)
#define pii pair<int,int>
#define pll pair<ll,ll> 
#define vec(a) vector<a >
#define se second
#define fi first
#define inf 0xffffffff
#define inchar getchar_unlocked
#define outchar(x) putchar_unlocked(x)
//template <typename T>
//using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll binpow(ll a,ll b){	if(a==0) return 0; if(b==0) return 1;ll ans=1;while(b>0){if(b&1) ans=ans*a; a=a*a; b=b>>1;}	return ans;}
template <typename T> 
T Min(T a,T b){ return a<b?a:b; }
template <typename T>
T Max(T a,T b){ return a>b?a:b; }

vi par(100001,0);

int p(int u) {
	if(u==par[u]) return u;
	else return par[u]=p(par[u]);
}

void unite(int a,int b) {
	a=p(a);b=p(b);
	if(a!=b) par[b]=a;
}


int32_t main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	// int n;cin>>n;
	// string s;cin>>s;
	
	//ll n;cin>>n; vl a(n); repi(i,n) cin>>a[i];
	int n,m1;cin>>n>>m1;
	repi(i,n) par[i+1]=i+1;
	int ans=0;int a,b;
	unordered_set<int> m;
	while(m1--){
		cin>>a>>b;
		unite(a,b);
	}
	for(int i=0;i<n;++i) m.insert(p(i+1));
	cout<<m.size()-1<<endl;
	m.clear();
	/*
	int test1;cin>>test1;while(test1--){ 
		
	 }
	 //*/
return 0;
}



Measured memory_bytes: 7036
fn read_stdin() -> String {
    use std::io::Read;
    let mut input = String::new();
    std::io::stdin().read_to_string(&mut input).unwrap();
    input
}

fn scan<'a, I: Iterator<Item = &'a str>, T: std::str::FromStr>(tokens: &mut I) -> T {
    tokens.next().unwrap().parse().ok().unwrap()
}

fn main() {
    let input = read_stdin();
    let tokens = &mut input.split_whitespace();
    let x: usize = scan(tokens);
    let y: usize = scan(tokens);
    if (x + y) % 3 != 0 {
        println!("0");
        return;
    }
    let n = (x + y) / 3;
    if x < n || y < n {
        println!("0");
        return;
    }
    println!("{}", binom(x + y - 2 * n, x - n).value());
}

const MODULO: usize = 1_000_000_007;

#[derive(Clone, Copy, Debug, Eq, PartialEq)]
struct F(usize);

impl F {
    fn value(self) -> usize {
        self.0
    }
    fn pow(self, e: usize) -> F {
        let mut a = F(1);
        let mut b = self;
        let mut e = e;
        while e != 0 {
            if e & 1 != 0 {
                a = a * b;
            }
            b = b * b;
            e >>= 1;
        }
        a
    }
    fn inverse(self) -> F {
        self.pow(MODULO - 2)
    }
}

impl std::ops::Add for F {
    type Output = F;
    fn add(self, other: F) -> F {
        F((self.value() + other.value()) % MODULO)
    }
}

impl std::ops::Sub for F {
    type Output = F;
    fn sub(self, other: F) -> F {
        F((self.value() + MODULO - other.value()) % MODULO)
    }
}

impl std::ops::Mul for F {
    type Output = F;
    fn mul(self, other: F) -> F {
        F((self.value() * other.value()) % MODULO)
    }
}

impl std::ops::Div for F {
    type Output = F;
    fn div(self, other: F) -> F {
        self * other.inverse()
    }
}

fn binom(n: usize, k: usize) -> F {
    let k = std::cmp::min(k, n - k);
    let mut numer = F(1);
    let mut denom = F(1);
    for i in 0..k {
        numer = numer * F(n - i);
        denom = denom * F(k - i);
    }
    numer / denom
}


Measured memory_bytes: 4352
#include <stdio.h>

int main(void) {
	int i,j;
	int r[4],b[4];
	int hit,blow;
	
	while(scanf("%d",&r[0])!=EOF){
		
		for(i=1;i<4;i++)scanf("%d",&r[i]);
		for(i=0;i<4;i++)scanf("%d",&b[i]);
		
		for(i = 0,hit=0,blow=0; i < 4; i++) {
			for(j = 0; j < 4; j++) {
				if(r[i] == b[j]) {
					if(i == j) hit++;
					else blow++;
				}
			}
		}
		printf("%d %d\n",hit,blow);
	}
	return 0;
}

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define REPS(i,n) for(ll (i)=1;(i)<=(n);(i)++)
#define RREP(i,n) for(ll (i)=(n-1);(i)>=0;(i)--)
#define RREPS(i,n) for(ll (i)=(n);(i)>0;(i)--)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

template<class T> inline void chmin(T& a, T b){
    if (a > b){
        a = b;
    }
}

template<class T> inline void chmax(T& a, T b){
    if (a < b){
        a = b;
    }
}

/* 最大公約数 */
ll gcdx(ll a, ll b) {
    return b ? gcdx(b, a%b) : a;
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in();
    vector<ll> A(N);
    REP(i,N)A[i] = in<ll>();
    ll gcd = gcdx(A[0],A[1]);
    REPS(i,N-1){
        gcd = gcdx(gcd,A[i]);
    }
    cout << gcd << "\n";
}

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

using namespace std;

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

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;
typedef vector<int>				V;
typedef vector<V>				VV;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define MAX 		2505

const ll LINF = (ll)1e18+7;		//
const int INF = 1e9+7;			//2,147,483,647 (Max int)
const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

//
int main(){
	int N;cin>>N;
	vector<string> S(N);

	map<string,int> m;
	REP(i,N){
		cin>>S[i];sort(ALL(S[i]));
		m[S[i]]++;
	}

	ll ans = 0;
	for(auto itr : m){
		ans += (ll)itr.second*(itr.second-1)/2;
	}

	cout << ans << endl;


	return 0;
}




Measured memory_bytes: 18176