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

#define int long long
#define MAX_N (200005)
#define INF (1LL<<60)
#define EPS (1e-7)
#define DEBUG(x) cerr << #x <<":"<< x << endl;
#define DEBUGVC(x) cerr << #x <<": "; for(auto p:(x)) cerr << p <<" "; cerr << endl;
#define DEBUGVCP(x) for(auto p:(x)) cerr << #x <<": "<< p.first <<", "<< p.second << endl;
#define DEBUG2(x, y) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y << endl;
#define DEBUG3(x, y, z) cerr << #x <<" : "<< x <<", "<< #y <<" : "<< y <<", "<< #z <<" : "<< z << endl;
const int MOD = (int)1e9+7;

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

const int MAX_V = 200000, MAX_E = 1000;

int V, E;
vector<edge> G[MAX_V];
int d[MAX_V];
vector<bool> F(MAX_V,false);
vector<int> ans(MAX_V);

void dfs(int s, int b){
    //DEBUG(s);
    for(int i=0; i<G[s].size(); i++){
        int u = G[s][i].to;
        int w = G[s][i].cost;
        if(F[u]) continue;
        F[u]=true;
        //DEBUG2(u,w);
        int a;
        if(w%2!=0){
            if(b==0){
                a = 1;
            }else {
                a = 0;
            }
        } else {
            a = b;
        }
        ans[u] = a;
        dfs(u, a);
    }
}

signed main() {
    cin >> V;
	for (int i = 0; i < V-1; i++) {
		int s, t, cost;
		cin >> s >> t >> cost;
		s--; t--;
		G[s].push_back(edge{ t, cost });
		G[t].push_back(edge{ s, cost });
	}
    F[0]=true;
    ans[0]=0;
    dfs(0,0);

    for(int i=0; i<V; i++){
        cout << ans[i] << endl;
    }

}

Measured memory_bytes: 13440
#include<stdio.h>
int main(){
    int x,y,z,tmp;
    int gcd;
    scanf("%d %d", &x,&y);
    if(x<y){
      tmp=x;
      x=y;
      y=tmp;
    }
    while((z = x % y) != 0)
    {
        x = y;
        y = z;
        z=x%y;
    }
    printf("%d\n",y);
    return 0;
}



Measured memory_bytes: 2108
#include<bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define ll long long
#define all(x) (x).begin(),(x).end()
#define rep(i, n) for(ll i = 0; i < n; i++)
const ll INF = 1LL << 60;

int main(){
    int N, M; cin >> N >> M;
    vector<vector<int>> lights(M);
    rep(i, M){
        int k; cin >> k;
        rep(j, k){
            int s; cin >> s;
            lights[i].push_back(s - 1);
        }
    }
    vector<int> p(M);
    rep(i, M) cin >> p[i];
    ll ans = 0;
    for(int i = 0; i < (1 << N); i++){
        bitset<10> s(i);
        bool flag = true;
        rep(i, M){
            int tmp = 0;
            rep(j, lights[i].size()) tmp += s.test(lights[i][j]);
            if(tmp%2 != p[i]){
                flag = false;
                break;
            }
        }
        if(flag == true) ans++;
    }
    cout << ans << endl;
} 

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#pragma GCC optimize ("O2,unroll-loops")
//#pragma GCC optimize("no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<pii, int> piii;
typedef pair<ll, ll> pll;
#define debug(x) cerr<<#x<<'='<<(x)<<endl;
#define debugp(x) cerr<<#x<<"= {"<<(x.first)<<", "<<(x.second)<<"}"<<endl;
#define debug2(x, y) cerr<<"{"<<#x<<", "<<#y<<"} = {"<<(x)<<", "<<(y)<<"}"<<endl;
#define debugv(v) {cerr<<#v<<" : ";for (auto x:v) cerr<<x<<' ';cerr<<endl;}
#define all(x) x.begin(), x.end()
#define pb push_back
#define kill(x) return cout<<x<<'\n', 0;

const ld eps=1e-7;
const int inf=1000000010;
const ll INF=10000000000000010LL;
const int mod=1000000007;
const int MAXN=100010, LOG=20;

int n, m, k, u, v, x, y, t, a, b, ans;
int mark[MAXN];

int G(int x, int k){
	while (x%k){
		int tmp=x/k;
		x-=tmp+1;
		if (x<=tmp*k) continue ;
		int dwn=0, up=x/(tmp+1)+1;
		while (up-dwn>1){
			int mid=(dwn+up)>>1;
			int xx=x-mid*(tmp+1);
			if (xx<=tmp*k) up=mid;
			else dwn=mid;
		}
		x-=dwn*(tmp+1);
	}
	return x/k;
}

int main(){
	ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin>>n;
	while (n--){
		cin>>x>>k;
		ans^=G(x, k);
	}
	cout<<(ans?"Takahashi\n":"Aoki\n");
	
	return 0;
}


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

public class Main {	

	private static void solve(){
		//Implement solution here.
		int N = ni();
		int K = ni();
		int[] p = na(N);
		Arrays.sort(p);
		int result = 0;
		for(int i = 0; i < K; i++)result+=p[i];
		System.out.println(result);
	}

	//Switch input source (stdin/file)
	private static BufferedReader br;
	public static void main(String[] args){
		br = new BufferedReader(new InputStreamReader(System.in));
		String debugDataPath = System.getenv("DD_PATH");        
		if(debugDataPath != null){
			try{
				br = new BufferedReader(new InputStreamReader(new FileInputStream(new File(debugDataPath))));
			}catch(Exception e){
				throw new RuntimeException(e);
			}
		}
		boolean hasNext = true;
		while(hasNext){
			solve();	
			try{
				br.mark(1);
				if(br.read() > 0){
					br.reset();			
					System.out.println("---");
				} else {
					hasNext = false;
				}
			}catch(Exception e){
				throw new RuntimeException(e);
			} 
		}
	}

	//Input read utility
	private static StringTokenizer tokenizer = null;
	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(br.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}
	//Get next single int
	private static int ni() {
		return Integer.parseInt(next());
	}
	//Get next single long
	private static long nl() {
		return Long.parseLong(next());
	}
	//Get next single double
	private static double nd() {
		return Double.parseDouble(next());
	}
	//Get next int array from one line
	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}
	//Get next char array from one line
	private static char[] ns() {
		return next().toCharArray();
	}
	//Get next long array from one line
	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}
}


Measured memory_bytes: 25944
import sys

A, B, C, D, E, F = map(int, sys.stdin.readline().rstrip().split())

q = [A, B]
water = []
while q:
    num = q.pop()
    if 100 * num <= F:
        water.append(num)
    else:
        continue
    q.append(num + A)
    q.append(num + B)

water = set(water)
w_ans = 0
s_ans = 0
nodo_ans = -1 # 濃度が0のときにも答えの更新が行われるようにする
V = [C, D]

for w in water:
    max_s = min(E * w, F - w * 100) # 溶かせる砂糖の量の最大値
    dp = [[0] * (max_s + 1) for _ in range(3)]
    dp[0][0] = 1
    for i in range(2):
        v = V[i]
        for j in range(max_s + 1):
            if j - v >= 0:
                dp[i + 1][j] = max(dp[i][j], dp[i][j - v], dp[i + 1][j - v])
            else:
                dp[i + 1][j] = dp[i][j]

    for i, d in enumerate(dp[2]):
        if d > 0:
            nodo = i * 100 / (100 * w + i)
            if nodo_ans < nodo:
                s_ans = i
                w_ans = w * 100
                nodo_ans = nodo

print(w_ans + s_ans, s_ans)

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

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

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

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

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

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

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

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

use std::collections::VecDeque;

fn main() {
    input!{
        h: usize,
        w: usize,
        board: [chars; h],
    }

    let mut dist: Vec<Vec<i32>> = vec![vec![-1; w]; h];
    let mut black_cells: VecDeque<(i32, i32)> = VecDeque::new();

    for i in 0..h {
        for j in 0..w {
            if board[i][j] == '#' {
                dist[i][j] = 0;
                black_cells.push_front((i as i32, j as i32));
            }
        }
    }

    let mut d = 0;
    while !black_cells.is_empty() {
        match black_cells.pop_front() {
            Some((y, x)) => {
                d = dist[y as usize][x as usize];
                // for (dy, dx) in &[(1, 0), (0, 1), (-1, 0), (0, -1)] {
                for &(dy, dx) in &[(1, 0), (0, 1), (-1, 0), (0, -1)]{
                    let nh = y + dy;
                    let nw = x + dx;
                    if nh < 0 || h as i32 <= nh || nw < 0 || w as i32 <= nw {
                        continue
                    }
                    if dist[nh as usize][nw as usize] == -1 {
                        dist[nh as usize][nw as usize] = d + 1;
                        black_cells.push_back((nh, nw));
                    }

                }
            }
            None => break
        }
    }

    println!("{}", d);
}


Measured memory_bytes: 21752
n,a,b=map(int,input().split())
ans=0
if a==0:
    ans=0
elif b==0:
    ans=n
else:
    ans=a*(int(n/(a+b)))
    n=n%(a+b)
    while True:
        if n==0:
            break
        if n-a<0:
            ans+=n
            break
        else:
            ans+=a
            break

print(ans)

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<map>
#include<iomanip>
#include<sstream>
using namespace std;


int main() {
	long long int n,t[234567], a[234567], s[200005] = {},two=1,taka=0,ao=0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >>t[i]>> a[i];
		
	}
	taka = t[0];
	ao = a[0];
	for (int i = 1; i < n; i++) {
		taka = max((taka-1) / t[i] + 1, (ao-1) / a[i] + 1)*t[i];
		ao= max((taka - 1) / t[i] + 1, (ao - 1) / a[i] + 1)*a[i];

	}
	cout << taka+ao;
}

Measured memory_bytes: 2304
class ST
	def initialize n
		@l = (1<<(n-1).bit_length)-1
		@h = [0]*(@l+@l+1)
	end
 
	def max
		return @h[0]
	end
 
	def [] l,r
		return if r < l
		l,r = @l+l+1,@l+r+1
		lx,rx = @h[l-1],@h[r-1]
		while l <= r
			lx = @h[l-1] if lx < @h[l-1]
			rx = @h[r-1] if rx < @h[r-1]
			l = (l+1)/2
			r = (r-1)/2
		end
		return lx < rx ? rx : lx
	end
 
	def []= i,v
		j = @l+i+1
		@h[j-1] = v
		@h[j-1] = v while 0 < (j/=2) && @h[j-1] < v
		return v
	end
end

N,K = gets.split.map(&:to_i)
max = ST.new 3000001
N.times{
	a = gets.to_i
	max[a] = 1+max[[a-K,0].max,[300000,a+K].min]
}
p max.max


Measured memory_bytes: 79912
#include<iostream>
#include<vector>
#include<cassert>
using namespace std;

int main(void)
{
    int N;
    cin >> N;

    assert(N <= 10^5 and N >= 1);

    int n1 = 9;
    int n2 = 900;
    int n3 = 90000;

    int num;
    if (N < 10) {
        num = N;
    } else if (N < 100) {
        num = n1;
    } else if (N < 1000) {
        num = N - 99 + n1;
    } else if (N < 10000) { 
        num = n1 + n2;
    } else if (N < 100000) {
        num = N - 9999 + n1 + n2;
    } else {
        num = n1 + n2 + n3;
    }

    cout << num << endl;

    return 0;
}

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

int main(){
  int n,ans=0;string s;cin>>n>>s;
  REP(i,s.size()-2){
    if(s.at(i)=='A'&&s.at(i+1)=='B'&&s.at(i+2)=='C') ans++;
  }

  cout<<ans;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "trace.h"
#else
#define trace(args...)
#endif

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define all(v) (v).begin(), (v).end()
void solve(int test) {
    int n, k;
    cin >> n >> k;
    vector<int> a(n);
    for (int& e : a) cin >> e;
    for (int i = k; i < n; i++) {
        // a[i] / a[i-k]
        if (a[i] <= a[i - k])
            cout << "No\n";
        else
            cout << "Yes\n";
    }
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t = 1;
    // cin >> t;
    for (int i = 1; i <= t; i++) {
        // cout << "Case #" << i << ": ";
        solve(i);
        cout << "\n";
    }
}


Measured memory_bytes: 3988
use proconio::input;
use proconio::marker::Usize1;
use std::collections::VecDeque;

struct Node {
    edge: Vec<(usize, i64)>,
    parent: usize,
    depth: i64,
}

struct RootedTree {
    node: Vec<Node>,
    root: usize,
}

impl Node {
    fn new(parent: usize) -> Self {
        Node {
            edge: Vec::new(),
            parent: parent,
            depth: 0,
        }
    }
}

impl RootedTree {
    fn new(n: usize, r: usize) -> Self {
        RootedTree {
            node: (0..n).map(|i| Node::new(i)).collect(),
            root: r,
        }
    }

    fn add_edge(&mut self, v0: usize, v1: usize, weight: i64) {
        self.node[v0].edge.push((v1, weight));
        self.node[v1].edge.push((v0, weight));
    }

    fn build(&mut self) {
        let mut q: VecDeque<(usize, usize, i64)> = VecDeque::new();
        q.push_back((self.root, self.root, 0));

        while let Some((i, p, d)) = q.pop_back() {
            self.node[i].depth = d;
            self.node[i].parent = p;
            if let Some(idx) = self.node[i].edge.iter()
                .position(|&(i, _)| i == p) {
                self.node[i].edge.remove(idx);
            }

            for &(nxt, weight) in self.node[i].edge.iter() {
                let depth = weight + d;
                q.push_back((nxt, i, depth));
            }
        }
    }
}

fn main()
{
    input! {
    n:usize,
    v:[(Usize1,Usize1,i64);n-1],
    }

    let mut tree = RootedTree::new(n, 0);
    for &(a, b, w) in v.iter() {
        tree.add_edge(a, b, w);
    }

    tree.build();

    for _n in tree.node.iter() {
        println!("{}", _n.depth % 2);
    }
}

Measured memory_bytes: 15344
#create date: 2020-03-28 21:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    s = ns()
    if s[2]==s[3] and s[4] == s[5]:
        print("Yes")
    else:
        print("No")

if __name__ == "__main__":
    main()

Measured memory_bytes: 3060
def main():
    MOD = 10 ** 9 + 7
    S = input()
    N = len(S)
    mod13 = [[0] * 13 for _ in range(N + 1)]
    mod13[0][0] = 1
    exponent = 1
    for i in range(1, N + 1):
        c = S[-i]
        if c == "?":
            for n in range(10):
                m = n * exponent % 13
                for r in range(13):
                    mod13[i][(r + m) % 13] += mod13[i - 1][r]
        else:
            m = int(c) * exponent % 13
            for r in range(13):
                mod13[i][(r + m) % 13] = mod13[i - 1][r]
        exponent = exponent * 10 % 13
        for r in range(13):
            mod13[i][r] %= MOD
    print(mod13[N][5])

if __name__ == "__main__":
    main()

Measured memory_bytes: 61788
#include<stdio.h>

int main(){
    int i, k = 0, cnt_ch[26] = {};
    char str[1200], j;
    while(scanf("%s", str) != EOF){
        for(i = 0; str[i] != '\0'; i++){
            if(str[i] >= 'A' && str[i] <= 'Z'){
                str[i] = str[i] + 32;
            }
            for(j = 'a'; j >= 'a' && j <= 'z'; j++){

                if(str[i] == j){
                    cnt_ch[k]++;
                }
                k++;
            }
            k = 0;
        } 
    }
    j = 'a';
    for(i = 0; i < 26; i++){
        printf("%c : %d\n", j, cnt_ch[i]);
        j++;
    }
    return 0;
}


Measured memory_bytes: 2104
import java.util.Comparator;
import java.util.Scanner;

/* static int java.util.Arrays.binarySearch(int[] a, int key); */


public class Main {
    Scanner sc = new Scanner(System.in);
    int n;
    public void run(){
        n = sc.nextInt();
        solve();
    }
    public void solve(){
        // a[i]を2で割った総数
        int suma2 = 0;

        for(int i = 0; i < n; i++){
            long ai = sc.nextInt();
            int a2 = 0;
            while(ai % 2 == 0){
                a2++;
                ai /=  2;
            }

            suma2 += a2;
        }

        System.out.println(suma2);
    }

    public static void main(String[] args){
        new Main().run();
    }

    static class Pair {
        int first,second;
        public Pair(int a,int b) {
            this.first = a;
            this.second = b;
        }
    }
    static class Edge{
        int to, cost;
        public Edge(int a, int b){
            this.to = a;
            this.cost = b;
        }
    }
    class MyComparator implements Comparator {
        @Override
        public int compare (Object arg0, Object arg1) {
            int x = ((Pair)arg0).first;
            int y = ((Pair)arg1).first;

            if (x < y) {
                return 1;
            } else if (x > y) {
                return -1;
            } else{
                return 0;
            }
        }
    }
    static class UnionFind{
        int par[];
        int rank[];

        //n要素で初期化
        public UnionFind(int maxn){
            par = new int[maxn];
            rank = new int[maxn];

            for(int i = 0; i < maxn; i++){
                par[i] = i;
                rank[i] = 0;
            }
        }

        //木の根を求める
        int find(int x){
            if(par[x] == x){
                return x;
            }
            else {
                return par[x] = find(par[x]);
            }
        }

        // xとyの属する集合を併合
        void unite (int x, int y){
            x = find(x);
            y = find(y);
            if(x == y){
                return;
            }

            if(rank[x] < rank[y]){
                par[x] = y;
            }
            else{
                par[y] = x;
                if(rank[x] == rank[y]) rank[x]++;
            }
        }

        // xとyが同じ集合に属するか否か
        boolean same(int x, int y){
            return find(x) == find(y);
        }
    }

}

Measured memory_bytes: 33740
n = int(input())
job = []

for i in range(n):
  job.append(list(map(int,input().split())))

job.sort(key = lambda x:x[1])

flg = True
a = 0
for i in job:
  a += i[0]
  if(a > i[1]):
    flg = False
    break

if(flg):
  print("Yes")
else:
  print("No")

Measured memory_bytes: 53720
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<utility>
#include<functional>
#include<algorithm>
#include<queue>
#include<map>
#include<string>
#include<numeric>


#define FOR(i, a, b) for(int i=a; i<b; i++)
#define rep(i, n) for(int i=0; i<n; i++)
#define COUT(a) cout << a << endl;
#define PB push_back

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

ll H, W;
vector<char> answer;
vector<vector<char>> field;


int main() {
    ll N, a, b;
    cin >> N;

    if (N == 1){
        COUT("Hello World");
    }else if (N == 2){
        cin >> a >> b;
        COUT(a+b);
    }
}



Measured memory_bytes: 256
import sys
if sys.argv[-1] == 'ONLINE_JUDGE':
    import os, zlib, base64
    open('solve.pyx', 'wb').write(zlib.decompress(base64.b85decode("c${@o!EWOq5WPprKa5;8O17@4)XOT8uY0VN^KMlU7$>M05QEe0e*F%ZcHOPY#SHJwd(1Oepbe!d8B2Sx(w!!G!d~6ntXEe{$T(#ujZfM{>c!cQD3o^zDM^<^XT6eESaTHNHJ!b?@4gE%32%c`&#XwoO=EcFo`|AqWd~K*dpP>ZX;NoY&;1W+=>zx@Wsos5-moG15!g+I0LqNP$HWreen7els^sH4VJ_DzrEviKoiI8m^hWrQgiOk7jJK5R+g@mzx^oB(I5{HmEC@}-n*DkOyowsTDJzM98|rypTy2d@;CBDcay?=^VL@bD4vq^#o&$*ez9Qt>qU1ZwjQ=1qfAAA9&;GN17=3(%6Gs|o%dACg9VKo2duF7h8(IjFTZS54);5d%LkovRnOc}yxU5&DciUX+Yu&W4VcO=ft3*x)zG>*e;Y*3>fsuiKmSGKu{0?z@*wrW(LbDWGY}jLSsS}z367)UXEwk_Dl=EFG4f*XX81qnB_m^W;-IdS_pBw%Hson8D")))
    os.system('cythonize -i -3 -b solve.pyx')
import solve

Measured memory_bytes: 10956
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

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

#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
#define MAX_N (100001)
typedef long long ll;

using namespace std;


int gcd(int a, int b) {
	if (a < b) return gcd(b, a);
	if (b != 0) {
		int k = a % b;
		a = b;
		b = k;
		return gcd(a, b);
	}
	else {
		return a;
	}
}


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n; cin >> n;
	vector<vector<int>> gcdv(201, vector<int>(201, 0));
	for (int a = 1; a <= n; a++)
		for (int b = 1; b <= n; b++) {
			gcdv[a][b] = gcd(a, b);
	}
	int ans = 0;
	for (int a = 1; a <= n; a++)
		for (int b = 1; b <= n; b++)
			for (int c = 1; c <= n; c++) {
				ans += gcdv[gcdv[a][b]][gcdv[b][c]];
			}
	cout << ans << endl;
}


Measured memory_bytes: 3744
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#define REL
#endif
#include <algorithm>
#include <string>
#include <iostream>
#include <complex>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <stack>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <random>
#include <set>
#include <vector>
#include <unordered_map>
#include <bitset>
#include <unordered_set>
#include <array>
#include <forward_list>
#include <chrono>
#include <iomanip>
#include <utility>
#include <assert.h>

//#pragma GCC optimize("Ofast")
//#pragma target("sse", "sse1")

#define mp make_pair
#define pb push_back

#define endl '\n'

using namespace std;
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

mt19937 gen(34);
//mt19937_64 gen(41);


int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#else
	//freopen("rps2.in", "r", stdin);
	//freopen("rps2.out", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//----------------------------------------------//
	ll n, k;
	cin >> n >> k;
	cout << min(n % k, k - (n % k));
	//----------------------------------------------//

	return 0;
}




Measured memory_bytes: 256
// #include {{{
#include <iostream>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <ctime>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <bitset>
#include <vector>
#include <complex>
#include <algorithm>
using namespace std;
// }}}
// #define {{{
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define de(x) cout << #x << "=" << x << endl
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define per(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define fi first
#define se second
// }}}

const int N = 2e5 + 10 , P = 1e9 + 7;
inline void pp(int &x,int d){if((x+=d)>=P)x-=P;}
int n,Mx[N],Mn[N];
pii a[N];
vi V;

int main(){
    scanf("%d",&n);
    rep(i,0,n) scanf("%d%d",&a[i].fi,&a[i].se),V.pb(a[i].se);
    sort(all(V));
    sort(a,a+n);
    rep(i,0,n) a[i].se=lower_bound(all(V),a[i].se)-V.begin();
    Mx[0]=a[0].se;
    rep(i,1,n) Mx[i]=max(Mx[i-1],a[i].se);
    Mn[n-1]=a[n-1].se;
    per(i,0,n-1) Mn[i]=min(Mn[i+1],a[i].se);
    vector<pii> f;
    f.pb(mp(0,1));
    int s=1,c=0,ans=0;
    rep(i,0,n) {
        // [Mn[i] , Mx[i]]
        while(c<sz(f)&&f[c].fi<Mn[i])
            pp(s,P-f[c++].se);
        if(Mx[i]+1==n) pp(ans,s);
        f.pb(mp(Mx[i]+1,s)); pp(s,s);
    }
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 6388
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ar              array
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("ip1.txt", "r", stdin);
	freopen("op1.txt", "w", stdout);
#endif
}
bool sortbysec(const pair<int, int> &a,
               const pair<int, int> &b);
int gcd(int a, int b) ;
int prime(int n);
int power(int x, int y);
int lcm(int a, int b);
int32_t main()
{
	k_007();
	int n;
	cin >> n;
	int a[n];
	f(i, n) cin >> a[i];
	int maxi = a[0];
	int mini = a[0];
	int ans = 1;
	for (int i = 1; i < n; i++)
	{
		if (maxi >= a[i] && mini >= a[i])
		{
			ans++;
		}

		maxi = max(maxi, a[i]);
		mini = min(mini, a[i]);
	}

	cout << ans << endl;

}


bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
	return (a.second < b.second);
}
int gcd(int a, int b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int prime(int n) {
	int flag = 1;
	for (int i = 2; i <= sqrt(n); i++) {
		if (n % i == 0) {flag = 0; break;}
	}
	return flag;
}
int power(int x, int y)
{
	if (y == 0)
		return 1;
	else if (y % 2 == 0)
		return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
	else
		return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
	return (a * b) / gcd(a, b);
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] In = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            int n = In[0];
            int d = In[1];
            int cnt = 0;
            for(int i=0; i < n; i++)
            {
                int[] In2 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                long x = In2[0];
                long y = In2[1];
                double c = Math.Sqrt(x * x + y * y);
                if (c <= d) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


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

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	string s;cin >> s;
	string t;cin >> t;
	int ans = 999999;

	for(int i = 0; i < s.length()-t.length()+1; i++){
		int tmp = 0;	
		for(int j = 0; j < t.length(); j++){
			if(s[i+j] != t[j]){
				tmp++;
			}	
		}
		ans = min(tmp,ans);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3644
package main

import (
	"fmt"
)

func main() {
	// fmt.Println(os.Args)
	var N, X, T, p int
	fmt.Scan(&N, &X, &T)

	p = int(N/X) * T
	if N%X != 0 {
		p += T
	}

	fmt.Println(p)
}


Measured memory_bytes: 1768
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
	int a[5000];
	int n,k;
	cin>>n>>k;
	for(int i=0;i<n;i++)
	cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<k;i++)
	sum+=a[i];
	cout<<sum;
}

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

int main() {
  int n, k, x, y, sum = 0;
  cin >> n >> k >> x >> y;
  for (int i = 1; i <= n; i++) {
    if (i <= k)
      sum += x;
    else
      sum += y;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[] a = new int[n];
        for(int i=0; i<n; i++) {
            a[i] = in.nextInt();
        }
        int xor = 0;
        for(int i=0; i<n; i++) {
            xor = xor ^ a[i];
        }
        if(xor != 0) {
            System.out.println("No");
            return;
        }
        System.out.println("Yes");
    }
}


Measured memory_bytes: 51808
#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,y;
    cin >> x >> y;
    for(int i=0;i<=x;i++){
        if(2*(x-i)+4*i==y){
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  bool a =false;
  cin >> N;
  vector<string> S(N);
  for(int i=0;i<N;i++){
    cin >> S.at(i);
  }
  for(int i=0;i<N;i++){
    if(S.at(i) == "Y"){
      a = true;
    }
  }
  if(a == true) cout << "Four" << endl;
  if(a == false) cout << "Three" << endl;

}

Measured memory_bytes: 3580
#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(void){
    // Your code here!
    int a,b,c;
    cin>>a>>b;
    a-=a/b*b;
    for(int i=0;;i++){
        if(i==0){
            c=a;
        }
        else{
            if(abs(a-b)<c){
                c=abs(a-b);
                a=a-b;
            }
            else{
                break;
            }
        }
    }
    cout<<c;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <deque>

long long mod = 1e9+7;
class Mint {
public:
  long long x;
  Mint(){}; // 引数なしでも定義できるように引数なしコンストラクタも用意しておく
  Mint(long long a){
    x = a%mod;
    while(x<0){
      x += mod;
    }
  };
  Mint& operator += (const Mint &a){
    x+=a.x;
    x%=mod;
    return *this;
  }
  Mint& operator -= (const Mint &a){
    x += (mod - a.x);
    x%=mod;
    return *this;
  }
  Mint& operator *= (const Mint &a){
    x*=a.x;
    x%=mod;
    return *this;
  }

  // a^n mod を計算する
  // Useaeg: Mint z = y.pow(y, n);
  Mint pow(Mint a, long long n) const {
    Mint y(1);
    Mint b(a);
    while (n > 0) {
      if (n & 1) y *= b;
      b *= b;
      n >>= 1;
    }
    return y;
  }

  // a^{-1} mod を計算する
  Mint modinv(const Mint &a) const {
    return pow(a, mod-2);
  }

  Mint& operator /= (const Mint &a) {
    x *= modinv(a).x;
    x %= mod;
    return *this;
  }

  Mint operator + (Mint &a) const {
    Mint y(*this);
    y += a;
    return y;
  }

  Mint operator - (Mint &a) const {
    Mint y(*this);
    y -= a;
    return y;
  }

  Mint operator * (Mint &a) const {
    Mint y(*this);
    y *= a;
    return y;
  }

  Mint operator / (Mint &a) const {
    Mint y(*this);
    y/=a;
    return y.x;
  }

  // nCk @mod を計算する
  Mint nCk(Mint &n, const long long k) const {
    Mint y = Mint(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
      y /= i;
    }
    return y;
  }

  // nPk @mod を計算する
  Mint nPk(Mint &n, long long k) const {
    Mint y(1);
    for (Mint i(0); (i.x)<k; i.x++){
      y *= (n-i);
    }
    return y;
  }
};

int main(){
  int N;
  std::cin >> N;
  std::vector<long long > A(N);
  for (int i=0; i<N; i++) {
    std::cin >> A[i];
  }
  long long m[84], s[84], r[84];
  m[0]=1000;
  s[0]=0;
  r[0]=0;
  for (int i=0; i<N; i++) {
    m[i+1] = std::max(m[i], s[i]*A[i]+r[i]);
    if (s[i] * A[i] + r[i] >= m[i]) {
      s[i+1] = s[i];
      r[i+1] = r[i];
    } else {
      s[i+1] = m[i]/A[i];
      r[i+1] = m[i]%A[i];
    }
    //printf("m[%d]=%d\n", i+1, m[i+1]);
    //printf("s[%d]=%d\n", i+1, s[i+1]);
    //printf("r[%d]=%d\n", i+1, r[i+1]);

  }
  std::cout << m[N] << std::endl;
  return 0;
}

Measured memory_bytes: 3220
import java.util.Scanner;

public class Main {
    public static void main(String... args) {
        Scanner sc = new Scanner(System.in);
        String w = sc.nextLine().toLowerCase();
        int count = 0;

        while(true) {
        	String t = sc.nextLine();
        	if(t.equals("END_OF_TEXT")) {
        		break;
        	}
        	t = t.toLowerCase();

        	String[] wordArray = t.split(" ");
        	for(String word : wordArray) {
        		if(w.equals(word)) {
        			count++;
        		}
        	}
        }
        System.out.println(count);
    }
}


Measured memory_bytes: 26208
/* Filename: ABC042C.java
 * Author: Mushiyo
 */

import java.util.Scanner;

public class Main{

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

		while (input.hasNext()) {
			int N = input.nextInt(), D = input.nextInt();
			boolean[] hate = new boolean[10];

			for (int i = 0; i < D; ++i) {
				hate[input.nextInt()] = true;
			}

			int pay = N;
			while (true) {
				int tmp = pay;
				while (tmp > 0 && hate[tmp % 10] == false) {
					tmp /= 10;
				}
				if (tmp == 0) {
					break;
				} else {
					++pay;
				}
			}
			
			System.out.println(pay);
		}
	}

}


Measured memory_bytes: 9428
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String[] s = sc.nextLine().split(" ");
        int hituji = Integer.parseInt(s[0]);
        int okami = Integer.parseInt(s[1]);
        if (hituji > okami) {
            System.out.println("safe");
        } else {
            System.out.println("unsafe");
        }
    }
}

Measured memory_bytes: 35748
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

int main() {
	ios::sync_with_stdio(false);

	ll n; cin >> n;

	// xx is wert, yy sind kosten
	vector<vector<pair<ll,ll>>> dp(n, vector<pair<ll,ll>>(n,mp(oo,oo)));
	FOR(i,0,n) {
		cin >> dp[0][i].xx;
		dp[0][i].yy = 0;
	}

	// fuer alle stufen ab laenge 1 + 1
	FOR(i,1,n) {
		// laufe alle eintraege ab
		FOR(k,0,n-i) {
			// laufe alle teillängen ab - 1 bis i-1 - und berechne das minimum
			ll mini = oo;
			dp[i][k].xx = dp[0][k].xx + dp[i - 1][k+1].xx;
			FOR(j,0,i) {
				ll teil1len = j;
				ll teil2len = i - j - 1;

				ll kosten = dp[teil1len][k].yy + dp[teil2len][teil1len+k+1].yy
					+ dp[teil1len][k].xx + dp[teil2len][teil1len+k+1].xx;
				mini = min (mini, kosten);
			}
			dp[i][k].yy = mini;
		}
	}


	cout << dp[n-1][0].yy << endl;


	return 0;
}


Measured memory_bytes: 2816
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            decimal iH = decimal.Parse(sS[0]);
            decimal iW = decimal.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            decimal iOut = Math.Truncate(((iH * iW) + 1M) / 2M);
            if (iH == 1M || iW == 1M) { iOut = 1M; }

            // 出力
            System.Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include <cassert>
#include <cstdio>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <algorithm>

using namespace std;
using lint = long long;
constexpr int MOD = 1000000007, INF = 1010101010;
constexpr lint LINF = 1LL << 60;

#ifdef _DEBUG
#include "../../library/library/debug_template.cpp"
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

struct init {
	init() {
		cin.tie(nullptr); ios::sync_with_stdio(false);
		cout << fixed << setprecision(10);
	}
} init_;

int main() {

	int N, K;
	cin >> N >> K;
	vector<int> p(N);
	for (int i = 0; i < N; i++) cin >> p[i];
	sort(p.begin(), p.end());

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

	cout << ans << "\n";

	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<ll, ll> PLL;
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) \
  for (int i = static_cast<int>(a); i < static_cast<int>(b); ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, ) (__VA_ARGS__)  // NOLINT

signed main() {
	ll n;
	set<string> s;
	cin >> n;
	rep(i, n) {
		string x;
		cin >> x;
		s.insert(x);
	}
	cout << s.size() << endl;
	return 0;
}


Measured memory_bytes: 19108
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
 
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
typedef complex<double> P;
static const double EPS = 1e-8;
static const int INF = (int)1e8;
 
#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
#define FOREQ(i,k,n) for (int i=(k); i<=(int)(n); ++i)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define FIND(m,w) ((m).find(w)!=(m).end())
 
int main(void){
  int e;
  while(cin>>e,e){
    int ans = e;
    for(int z = 0; z*z*z<=e; z++){
      for(int y = 0; y*y+z*z*z<=e; y++){
        int x = e - y*y - z*z*z;
        ans = min(ans,x+y+z);
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>


#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S,False(1,-1);
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}

template<typename A,size_t N,typename T>
void Fill(A(&array)[N],const T &val){
    fill((T*)array,(T*)(array+N),val);
}


int main(){
    string s;
    cin >> s;
    int cnt = 0;
    string t = "keyence";
    rep(i, 7){
        if(s[i] == t[i])cnt++;
        else break;
    }
    reverse(ALL(s));
    reverse(ALL(t));
    rep(i, 7){
        if(s[i] == t[i])cnt++;
        else break;
    }
    cout << (cnt >= 7 ? "YES" : "NO") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
int main(){
	int i,n,m,b;
	int hazu=0;
	scanf("%d",&n);
	scanf("%d",&m);
	int a[m];
	int t[n];
	for(i=0;i<n;i++){
		t[i]=0;
	}
	for(i=0;i<m;i++){
	 scanf("%d",&a[i]);
	}
	for(i=0;i<m;i++){
		for(int j=0;j<n;j++){
         scanf("%d",&b);
         if(b==a[i]){
        	 t[j]+=1;
         }
         else{
        	 hazu+=1;
         }
		}
		t[a[i]-1]+=hazu;
		hazu=0;
	}
	for(i=0;i<n;i++){
		printf("%d\n",t[i]);
	}
	return 0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(ll i = 0; i < n; i++)
typedef long long ll;
using namespace std;
#define llMAX numeric_limits<long long>::max()
#define intMAX numeric_limits<int>::max()
#define d_5 100000
#define d9_7 1000000007
#define vll vector<vector<long long>>
#define vl vector<long long>
#define vi vector<int>
#define vii vector<vector<int>>
#define pb push_back
#define pf push_front
#define ld long double
#define ll long long

int main(void){
  int n,m;
  cin>>n>>m;
  string s;
  cin>>s;
  vi recs(n+1,0);
  vi ans;
  int now=0;
  int nowmax=0;
  int nowrecmax=0;
  int endflag=0;//2が失敗
  while(endflag==0){
    int premax=nowmax;
    rep(i,m){
      now++;
      if(now==n){
        ans.pb(i+1);
        endflag=1;
        break;
      }
      if(s[n-now]=='0'){
        nowmax=now;
      }
    }
    if(premax==nowmax&&endflag==0){
      endflag=2;
      break;
    }
    if(endflag==0){
      now=nowmax;
      ans.pb(nowmax-premax);

    }
  }
  if(endflag==2){
    cout<<-1<<endl;
  }else{
    for(int i=0;i<ans.size();i++){
      cout<<ans[ans.size()-1-i]<<endl;
    }
  }
  return 0;
}

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

#define IOS cin.tie(0);ios::sync_with_stdio(0)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>

const int INF = 1e9;
const int MOD = 1e9+7;
using Graph = vector<vector<ll>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template <class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);}//最小公倍数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//void print(){}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

const int NMAX = 200;
bool flag;

bool comp(int x,int y){
    return abs(0-x)<abs(0-y);
}

bool source(vector<int> vec1,vector<int> vec2,int c){
    int sum=c;
    for(int i=0;i<vec1.size();i++){
        sum+=vec1[i]*vec2[i];
    }
    return sum>0?true:false;
}

signed main(){
//    IOS;
    CIN(N,M,C);
    vi B(M);
    rep(i,M) cin>>B[i];
    vvi A(N,vi(M));
    rep(i,N)rep(j,M)cin>>A[i][j];
    int ans=0;
    rep(i,N){
        if(source(A[i],B,C))ans++;
    }
    printf("%d\n",ans);

    return 0;
}

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

int	main(){
 int	N;
 cin >> N;
  
  int	A;
  A = 0;
  for (int i=0; i<N; i++) {
  	int a, b;
    cin >> a >> b;
    A += b - a + 1;
  }
  cout << A << endl;
  
}


Measured memory_bytes: 256
import sys
input = sys.stdin.buffer.readline
N = int(input())
A = list(map(int, input().split()))
d = 0
ans = 1
for i in range(1, N):
    if A[i - 1] < A[i]:
        if d < 0:
            ans += 1
            d = 0
        elif d == 0:
            d = 1
    elif A[i - 1] > A[i]:
        if d > 0:
            ans += 1
            d = 0
        elif d == 0:
            d = -1
print(ans)


Measured memory_bytes: 18336
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int A[100005];
int main(void){
    int n,ans=1,check=0;cin>>n;
    for(int i=0;i<n;i++)cin>>A[i];
    for(int i=1;i<n;i++){
        cin >> A[i];
        int d = A[i] - A[i-1];
        if(d>0){
            if(check==-1) {ans++;check=0;}
            else check=1;
        }else if(d<0){
            if(check==1) {ans++; check=0;}
            else check=-1;
        }
    }
    cout<<ans<<endl;
    
    return 0;
}


Measured memory_bytes: 640
program ABC056A
    implicit none
    character(1)::a,b
    read(5,*)a,b

    if(a=="H".and.b=="H")then
        print'(A)',"H"
    else if(a=="D".and.b=="H")then
        print'(A)',"D"
    else if(a=="H".and.b=="D")then
        print'(A)',"D"
    else if(a=="D".and.b=="D")then
        print'(A)',"H"
    end if
end program ABC056A

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<n;i++)
string S;
bool check(int a,int b){
    if(a&(1<<b)){
        return true;
    }
    return false;
}
int main(){
    cin >> S;
    int len = S.size()-1;
    ll ans = 0;
    for(int i=0;i<(1<<len);i++){
        int r = 0;
        int l = 0;
        ll tmp = 0;
        for(r=0;r<len;r++){
            if(check(i,r)){
                string s2 = S.substr(l,r-l+1);
                ll num = stoll(s2);
                tmp += num;
                l = r+1;
            }
        }
        string s3 = S.substr(l,r-l+1);
        tmp += stoll(s3);
        ans += tmp;
    }
    cout << ans << endl;
    return 0;

}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<map>

using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

unsigned long mypow(unsigned long n, unsigned long x){
    
    if(x == 0) return 1;
    
    int i;
    unsigned long ans = n;
    for(i=1; i<x; i++) ans *= n;

    return ans;
}

int main(){

    unsigned long H;
    cin >> H;

    
    unsigned long depth = 0;
    
    for(; H != 1; H /= 2, depth++);

    unsigned long ans = 1;
    
    int i;
    for(i=1; i <= depth; i++) ans += mypow(2, i);

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 888