akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! scan {
    () => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().to_string()
        }
    };
    (;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().split_whitespace().map(|s| s.to_string()).collect::<Vec<String>>()
        }
    };
    (;;$n:expr) => {
        {
            (0..$n).map(|_| scan!()).collect::<Vec<_>>()
        }
    };
    ($t:ty) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t:ty),*) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            (
                $(iter.next().unwrap().parse::<$t>().unwrap(),)*
            )
        }
    };
    ($t:ty;;) => {
        {
            let mut line: String = String::new();
            std::io::stdin().read_line(&mut line).unwrap();
            line.split_whitespace()
                .map(|t| t.parse::<$t>().unwrap())
                .collect::<Vec<_>>()
        }
    };
    ($t:ty;;$n:expr) => {
        (0..$n).map(|_| scan!($t;;)).collect::<Vec<_>>()
    };
    ($t:ty; $n:expr) => {
        (0..$n).map(|_|
                    scan!($t)
        ).collect::<Vec<_>>()
    };
    ($($t:ty),*; $n:expr) => {
        (0..$n).map(|_|
                    scan!($($t),*)
        ).collect::<Vec<_>>()
    };
}

fn print_route(route: Vec<(usize, usize)>) {
    println!("{}", route.len());
    for (a, b) in route.into_iter() {
        println!("{} {}", a, b);
    }
}

fn main() {
    let (n, mut k) = scan!(usize, usize);
    let max = (n - 2) * (n - 1) / 2;
    if max < k {
        println!("-1");
        return;
    }

    let mut route = vec![(n - 1, n)];
    for i in 1..n - 1 {
        route.push((i, n - 1));
    }

    let mut index = 1;
    k = max - k;
    if k == 0 {
        print_route(route);
        return;
    }
    loop {
        route.push((index, n));
        k -= 1;
        if k == 0 {
            print_route(route);
            return;
        }

        let to = index + 1;
        for i in to..n - 1 {
            route.push((index, i));
            k -= 1;
            if k == 0 {
                print_route(route);
                return;
            }
        }
        index += 1;
    }
}


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

public class Main {
	static int mod = (int) 1e9 + 7;
	static int DX[] = { -1, 0, 1, 0 }, DY[] = { 0, -1, 0, 1 };
	
	static List<ArrayList<Integer>> to;
	static int N, K;
	static long ans;
	public static void main(String[] args) {
		FastScanner fs = new FastScanner(System.in);
		N = fs.nextInt();
		K = fs.nextInt();
		to = new ArrayList<>();
		for(int i=0;i<N;i++) to.add(new ArrayList<>());
		for(int i=0;i<N-1;i++) {
			int a = fs.nextInt()-1, b = fs.nextInt()-1;
			to.get(a).add(b);
			to.get(b).add(a);
		}
		
		ans = 1;
		dfs(0, -1 , K, 0);
		System.out.println(ans);
		
	}
	static void dfs(int v, int parent, int div, int depth) {
		ans *= div;
		ans %= mod;
		int i=0;
		if(depth==0)i=1;
		else i=2;
		for(int t:to.get(v)) {
			if(t==parent)continue;
			dfs(t, v, K-i, depth+1);
			i++;
		}
		return;
	}
}

//高速なScanner
class FastScanner {
	private BufferedReader reader = null;
	private StringTokenizer tokenizer = null;

	public FastScanner(InputStream in) {
		reader = new BufferedReader(new InputStreamReader(in));
		tokenizer = null;
	}

	public String next() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new StringTokenizer(reader.readLine());
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	public String nextLine() {
		if (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken("\n");
	}

	public long nextLong() {
		return Long.parseLong(next());
	}

	public int nextInt() {
		return Integer.parseInt(next());
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

	public int[] nextIntArray(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = nextInt();
		return a;
	}

	public long[] nextLongArray(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nextLong();
		return a;
	}
}

Measured memory_bytes: 74336
#include <bits/stdc++.h>
 
using namespace std;
 
#define MD 1000000007
typedef long long int ll;


int main(){
	ll n;
	cin>>n;
	ll f[n+1]={0};
	for(int i=2;i<=n;i++){
		int a=i;
		for(int j=2;j<=a;j++){
			while(a%j==0){
				f[j]++;
				a/=j;
			}
		}
	}
	ll ans=1;
	for(int i=2;i<=n;i++){
		ans*=(f[i]+1);
		ans%=MD;
	}
			
	cout<<ans<<endl;
    return 0;
}

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

int main(){
    int x,y;
    cin >> x >> y;
    if(y % 2 == 0 && 2 * x <= y && y <= 4 * x){
        cout << "Yes" << endl;
    }
    else cout << "No" << endl;
}

Measured memory_bytes: 3592
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.StringTokenizer;

public class Main {

    static int N;
    static int S;
    static int[] X;

    public static void main(String[] args) {
        FastScanner sc = new FastScanner(System.in);
        N = sc.nextInt();
        S = sc.nextInt();
        X = sc.nextIntArray(N);

        System.out.println(solve());
    }

    static int gcd(int a, int b) {
        while (b > 0) {
            int c = a;
            a = b;
            b = c % b;
        }
        return a;
    }

    static int solve() {
        for (int i = 0; i < N; i++) {
            X[i] = Math.abs(X[i] - S);
        }
        int ans = X[0];
        for (int i = 1; i < N; i++) {
            ans = gcd(ans, X[i]);
        }
        return ans;
    }

    @SuppressWarnings("unused")
    static class FastScanner {
        private BufferedReader reader;
        private StringTokenizer tokenizer;

        FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken("\n");
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


Measured memory_bytes: 34900
import java.util.Scanner;

public class Main {

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

		String S = sc.next();
		String ans = "";

		if ( S.contains("a") && S.contains("b") && S.contains("c") ) {
			ans = "Yes";
		} else {
			ans = "No";
		}

		System.out.println( ans );
	}
}

Measured memory_bytes: 23764
#include<stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAX 100000

int main(){
	char* str;
	int* num;
	str =  (char *)malloc(MAX * sizeof(char));
	num =  (int *)malloc(MAX * sizeof(int));
	int N,Q;
	scanf("%d %d\n",&N,&Q);
	gets(str);
	int cnt = 0;
	num[0]=0;
	for(int i = 1; i < N; i++){
		if(str[i-1] == 'A' && str[i] == 'C')cnt++;
		num[i] = cnt;
	}
	for(int i = 0; i < Q; i++){
		int r = 0,l = 0;
		scanf("%d %d",&r, &l);
		printf("%d\n",num[l-1]-num[r-1]);
	}

	free(str);
	free(num);
	return 0;
}


/*int main(){
	char* str;
	str =  (char *)malloc(MAX * sizeof(char));
	int N,Q;
	scanf("%d %d\n",&N,&Q);
	gets(str);

	for(int i = 0; i < Q; i++){
		int r = 0,l = 0,cnt = 0;
		scanf("%d %d",&r, &l);
		for(int j = r-1;j < l-1 ;j++){
			if(str[j] == 'A' && str[j+1] == 'C')cnt++;
		}
		printf("%d\n",cnt);
	}

	free(str);
	return 0;
}*/













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

typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pair<int, int> > vii;
#define rrep(i, m, n) for(int (i)=(m); (i)<(n);  (i)++)
#define  rep(i, n)    for(int (i)=0; (i)<(n);  (i)++)
#define  rev(i, n)    for(int (i)=(n)-1; (i)>=0; (i)--)
#define vrep(i, c)    for(__typeof((c).begin())i=(c).begin(); i!=(c).end(); i++)
#define  ALL(v)       (v).begin(), (v).end()
#define mp            make_pair
#define pb            push_back
template<class T1, class T2> inline void minup(T1& m, T2 x){ if(m>x) m=static_cast<T2>(x); }
template<class T1, class T2> inline void maxup(T1& m, T2 x){ if(m<x) m=static_cast<T2>(x); }

#define INF 1000000000
#define MOD 1000000009
#define EPS 1E-9

const int MAX_W = 30;
int w, n;
int a, b;
int shff[MAX_W];

int main()
{
  cin >> w >> n;

  rep(i, w) shff[i] = i;
  rep(i, n){
    scanf(" %d,%d", &a, &b);
    swap(shff[a-1], shff[b-1]);
  }

  rep(i, w) cout << shff[i] + 1 << endl;

  return 0;
}

Measured memory_bytes: 1240
using System;
namespace pro
{
    class MainClass
    {
        public static void Main()
        {
            int n = int.Parse(Console.ReadLine());
            string[] str0 = Console.ReadLine().Split(' ');
            int[] a = new int[n];
            for(int i = 0; i < n; i++)
            {
                a[i] = int.Parse(str0[i]);
            }
            string[] str1 = Console.ReadLine().Split(' ');
            int[] b = new int[n];
            for (int i = 0; i < n; i++)
            {
                b[i] = int.Parse(str1[i]);
            }
            string[] str2 = Console.ReadLine().Split(' ');
            int[] c = new int[n - 1];
            for (int i = 0; i < n-1; i++)
            {
                c[i] = int.Parse(str2[i]);
            }

            int d = 0;
            for(int i = 0; i < n; i++)
            {
                d += b[i];
                if (i != 0 && a[i] - a[i - 1 ]== 1)
                {
                    d += c[a[i - 1]-1];
                }
            }
            Console.WriteLine(d);
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(v,c) for(auto v=begin(c);v!=end(c);v++)
#define FOR(v,a,n) for(int v=a;v<(int)(n);v++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(v,n) FOR(v,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
const int INF = 1e9;

int main(int argc, char const *argv[]) {
    int a,b;
    cin>>a>>b;
    if((a>0 && b>0) || (a<0 && b<0 && (b-a+1)%2==0)) cout<<"Positive"<<endl;
    else if(a<=0 && b>=0) cout<<"Zero"<<endl;
    else if(a<0 && b<0 && (b-a+1)%2==1) cout<<"Negative"<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cstdlib>
#include <cstdio>
#include <string>
#include <cstring>
#include <cassert>
#include <utility>
#include <iomanip>

using namespace std;

#define sz(x) (int) x.size()
#define unique(x) x.erase(unique(x.begin(), x.end()), x.end())
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x)) 
#define y1 aksjdaskdjksjfksdjf
#define left kdnvldvoiwejifejg
#define right lkdsjflksdjfdjfk
#define prev asdasfsadjkjsdfjs
#define tm aklsjdasjdasjdkdjjf

const int MAXN = 100500;

int n, need;
int h[MAXN];

int main() { 

  scanf("%d %d", &n, &need);
  for (int i = 0; i < n; i++) {
    scanf("%d", &h[i]);
  }

  sort(h, h + n);

  int ans = -1;
  for (int i = 0; i < n; i++) {
    if (i + need - 1 >= n) {
      break;
    }
    int curDiff = h[i + need - 1] - h[i];
    if (ans == -1 || curDiff < ans) {
      ans = curDiff;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 640
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
//#include <atcoder/all>
//using namespace atcoder;
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#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 Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};


int main(){
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
// cout << fixed << setprecision(10);
    int n;
    cin>>n;
    int x;
    vector<queue<int>> b(n);
    rep(i,n)rep(j,n-1){
        cin>>x;
        x --;
        b[i].emplace(x);
    }
    set<int> seen;
    int ans=-1;
    bool f=1;
    while(f){
        f=0;
        rep(i,n){
            if(b[i].empty()) continue;
            int op=b[i].front();
            if(op<i) continue;
            if(seen.count(op) || seen.count(i)) continue;
            if(b[op].front() != i) continue;
            f=1;
            b[i].pop();
            b[op].pop();
            seen.emplace(op);
            seen.emplace(i);
        }
        ans ++;
        seen.clear();
    }
    rep(i,n){
        if(!b[i].empty()){
            cout<<-1<<endl;
            return 0;
        }
    }
    cout<<ans<<endl;
}/*
./problem.exe
*/

Measured memory_bytes: 7908
#include<bits/stdc++.h>
#define de(x) cout<<#x<<"="<<x<<endl;
#define dd(x) cout<<#x<<"="<<x<<" ";
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define repd(i,a,b) for(int i=a;i>=(b);--i)
#define repp(i,a,b,t) for(int i=a;i<(b);i+=t)
#define ll long long
#define mt(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define inf 0x3f3f3f3f
#define INF 0x3f3f3f3f3f3f3f3f
#define pii pair<int,int>
#define pdd pair<double,double>
#define pdi pair<double,int>
#define mp(u,v) make_pair(u,v)
#define sz(a) a.size()
#define ull unsigned long long
#define ll long long
#define pb push_back
#define PI acos(-1.0)
#define qc std::ios::sync_with_stdio(false)
#define db double
const int mod = 1e9+7;
const int maxn = 1e5+5;
const double eps = 1e-6;
using namespace std;
bool eq(const db &a, const db &b) { return fabs(a - b) < eps; }
bool ls(const db &a, const db &b) { return a + eps < b; }
bool le(const db &a, const db &b) { return eq(a, b) || ls(a, b); }
ll kpow(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
int main()
{
	int n,a,b;
	scanf("%d%d%d",&n,&a,&b);
	int d = b - a;
	d = (d&1);
	puts(d?"Borys":"Alice");
	return 0;
}





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

//for loop関係
#define rep(i,a,n) for(int i=(a);i<(n);++i)
#define repe(i,a,n) for(int i=(a);i<=(n);++i)
#define rrep(i,n,a) for(int i=(n);n>(a);--i)
#define rrepe(i,n,a) for(int i=(n);n>=(a);--i)

//略記
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define all(v) v.begin(),v.end()
#define ENDL << "\n"

using ll = long long;
using P = pair<int,int>;
using itn = int;

//定数
const int INF = 1<<30;
const ll MOD = 1000000007;
const long double PI =(acos(-1));

/***スニペット***
ifelse, isprime, torad, todeg, lcm, bfs
****************/

//隣接リスト
vector<int> to[100005];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int a;
    string s;
    cin >> a >> s;
    if(a>=3200) cout << s ENDL;
    else cout << "red" ENDL;
    
    return 0;
}

Measured memory_bytes: 5924
import sys
input = sys.stdin.readline

N,M,P=map(int,input().split())
EDGE=[list(map(int,input().split())) for i in range(M)]

for i in range(M):
    EDGE[i][2]-=P

from collections import deque

Q=deque([1])

ANS=[-float("inf")]*(N+1)
ANS[1]=0

for i in range(N+1):
    for a,b,p in EDGE:
        if ANS[a]+p>ANS[b]:
            ANS[b]=ANS[a]+p
    
#print(max(ANS[N],0))


import copy
ANS2=copy.deepcopy(ANS)

for i in range(N+1):
    for a,b,p in EDGE:
        if ANS2[a]+p>ANS2[b]:
            ANS2[b]=ANS2[a]+p
    
#print(max(ANS2[N],0))

if ANS[N]<ANS2[N]:
    print(-1)
else:
    print(max(ANS2[N],0))
    
                
        
        


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

int n, m, c, t, x = INT_MAX;
int main(){
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        cin >> c >> t;
        if(t <= m) x = min(x, c);
    }
    if(x == INT_MAX) cout << "TLE";
    else cout << x;
}


Measured memory_bytes: 256
use std::cmp;
use std::io::{self, Read};

struct Scanner<'a> {
    it: std::str::SplitWhitespace<'a>,
}

impl<'a> Scanner<'a> {
    fn new(s: &'a String) -> Scanner<'a> {
        Scanner {
            it: s.split_whitespace(),
        }
    }

    fn read<T: std::str::FromStr>(&mut self) -> Option<T> {
        self.it.next().and_then(|s| s.parse().ok())
    }

    fn read_vec<T: std::str::FromStr>(&mut self, n: usize) -> Option<Vec<T>> {
        (0..n).map(|_| self.read()).collect()
    }

    fn read_vec2d<T: std::str::FromStr>(&mut self, m: usize, n: usize) -> Option<Vec<Vec<T>>> {
        (0..m).map(|_| self.read_vec(n)).collect()
    }
}

fn main() {
    let stdin = {
        let mut s = String::new();
        io::stdin().read_to_string(&mut s).unwrap();
        s
    };
    let mut sc = Scanner::new(&stdin);

    let mut abc: Vec<i32> = sc.read_vec(3).unwrap();
    abc.sort_by(|a, b| b.cmp(a));

    let ans = abc[0] * 10 + abc[1] + abc[2];

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


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count());
const int N = 200;
int n,cost[N][N],dis[N],ans = -1,root,color[N];
bool vis[N];
int dfs(int u){
	vis[u] = 1;
	int mx = dis[u],mx1 = 0;
	for(int i = 0;i < n;i++)
		if(!vis[i] && cost[u][i]){
			int temp = dfs(i);
			if(temp > mx)swap(temp,mx);
			mx1 = max(mx1,temp);
		}
	if(u == root)ans = max(ans,mx + mx1 + 1);
	ans = max(ans,mx + 1);
	return mx;
}
void find(int u){
	root = u;
	memset(dis,-1,sizeof dis);
	dis[u] = 0;
	queue<int>q;
	q.push(u);
	while(!q.empty()){
		int x = q.front();
		q.pop();
		for(int i = 0;i < n;i++)
			if(cost[x][i] && dis[i] == -1){
				dis[i] = dis[x] + 1;
				q.push(i);
			}
	}
	memset(vis,0,sizeof vis);
	dfs(u);
}
void find1(int u){
	for(int i = 0;i < n;i++)
		if(cost[u][i]){
			if(color[i] == -1){
				color[i] = color[u]^1;
				find1(i);
			}
			if(color[i] == color[u]){
				puts("-1");
				exit(0);
			}
		}
}
int main(){
	//freopen("input.txt","r",stdin);
	memset(color,-1,sizeof color);
	scanf("%d",&n);
	for(int i = 0;i < n;i++)
		for(int j = 0;j < n;j++)
			scanf("%1d",&cost[i][j]);
	color[0] = 0;
	find1(0);
	for(int i = 0;i < n;i++)
		find(i);
	printf("%d\n",ans);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
    int n; cin >> n;
    vector<int> v(n+1, 0);
    for(int i = 1; i <= n; i++)
        cin >> v[i];
    bool ok = false;
    int nxt = 1, cnt = 0;
    while(n--){
        if(v[nxt] == 2){
            ok = true;
            cnt++;
            break;
        }
        nxt = v[nxt];
        cnt++;
    }
    cout << (ok ? cnt : -1) << endl;
}


Measured memory_bytes: 768
#include<bits/stdc++.h>
#define Fail puts("NO"),exit(0);
#define eps 1e-10
#define maxn 200010
#define maxm 100010
#define inf 999999999999999
#define mod 998244353
#define pi acos(-1)
#define mp(x,y) make_pair(x,y)
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int>pii;
typedef bitset<maxn> bit;
int read()
{
    int x=0,f=1;
    char ch=getchar();
    while(ch-'0'<0||ch-'0'>9){if(ch=='-') f=-1;ch=getchar();}
    while(ch-'0'>=0&&ch-'0'<=9){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,m;
int main()
{
    n=read();m=log2(n);
    if((1<<m)==n)   return puts("No"),0;
    puts("Yes");
    printf("%d %d\n",1,2);
    printf("%d %d\n",2,3);
    printf("%d %d\n",3,n+1);
    printf("%d %d\n",n+1,n+2);
    printf("%d %d\n",n+2,n+3);
    for(int i=2;2*i+1<=n;i++)
    {
        printf("%d %d\n",1,2*i);
        printf("%d %d\n",1,2*i+1);
        printf("%d %d\n",2*i,2*i+n+1);
        printf("%d %d\n",2*i+1,2*i+n);
    }
    if(!(n&1))
    {
        for(int i=2;i<=n;i++)
        {
            if(i==3)  continue;
            int y=(i^1^n);
            if(y==3||y>n)  continue;
            printf("%d %d\n",n,i);
            printf("%d %d\n",2*n,y);
            break;
        } 
    }
    return 0;
}

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

using namespace std;

#define all(v)			((v).begin()), ((v).end())
#define SZ(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
#define pb			    push_back

typedef long long ll;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);

    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5])
    	cout << "Yes";
    else
    	cout << "No";

    return 0;
}

Measured memory_bytes: 256
import math
import numpy as np

a, b, h, m = map(int, input().split())

A = np.array([a*math.sin(math.radians(360*h/12 + 30*m/60)), a*math.cos(math.radians(360*h/12 + 30*m/60))])
B = np.array([b*math.sin(math.radians(360*m/60)), b*math.cos(math.radians(360*m/60))])

print(math.sqrt(sum(A**2) + sum(B**2) - 2*np.dot(A, B)))


Measured memory_bytes: 27212
#include <iostream>
#include <string>
#include <vector>
using namespace std;

int main() {
  vector<int> result;
  while (true) {
    int a, b;
    string op;

    cin >> a >> op >> b;
    if (op == "?") {
      break;
    } else if (op == "+") {
      result.push_back(a + b);
    } else if (op == "-") {
      result.push_back(a - b);
    } else if (op == "*") {
      result.push_back(a * b);
    } else if (op == "/") {
      result.push_back(a / b);
    }
  }

  for (int i : result) {
    cout << i << endl;
  }
}


Measured memory_bytes: 3168
n = int(input())
s = [list(map(int, input().split()))]

s[0].sort(reverse=True)

t = [s[0].pop(0)]
s.append([0 for _ in range(2 ** n - 1)])
a = 0
b = 1
p = 1
q = 2 ** n - 1
for _ in range(n):
    #print(s)
    j = 0
    k = 0
    for i in range(p):
        if j >= q:
            print('No')
            exit()
        #print(i, t, s)
        while t[i] <= s[a][j]:
            s[b][k] = s[a][j]
            j += 1
            k += 1
            if j >= q:
                print('No')
                exit()
        t.append(s[a][j])
        j += 1
    t.sort(reverse=True)

    #print(i, j, q)
    while j < q:
        s[b][k] = s[a][j]
        k += 1
        j += 1
    a, b = b, a
    #print(s)
    q -= p
    p *= 2
print('Yes')

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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;

struct uf_tree
{
    vector<int> par, rank;
    uf_tree(int n) : par(n), rank(n)
    {
        for (int i = 0; i < n; i++)
        {
            par[i] = i;
            rank[i] = 0;
        }
    }

    int find(int x)
    {
        if (x == par[x])
            return x;
        return par[x] = find(par[x]);
    }

    void unite(int x, int y)
    {
        x = find(x);
        y = find(y);

        if (x == y)
            return;

        if (rank[x] < rank[y])
            swap(x, y);
        par[y] = x;
        rank[x] += rank[y];
    }

    bool same(int x, int y)
    {
        return find(x) == find(y);
    }
};

struct edge
{
    int from, to, cost;
    bool operator<(const edge &e) const
    {
        return cost < e.cost;
    }
};

struct chart
{
    int x, y, p;
    bool operator<(const chart &c) const
    {
        return x < c.x;
    }
};

int kruskal(int n, vector<edge> ed)
{
    int sum = 0;
    sort(ALL(ed));

    uf_tree uf(n + 1);

    rep(i, ed.size())
    {
        if (!uf.same(ed[i].from, ed[i].to))
        {
            sum += ed[i].cost;
            uf.unite(ed[i].from, ed[i].to);
        }
    }

    return sum;
}

int main()
{
    int n;
    cin >> n;
    vector<edge> ed;
    vector<chart> vec(n);
    rep(i, n)
    {
        cin >> vec[i].x >> vec[i].y;
        vec[i].p = i;
    }

    rep(k, 2)
    {
        sort(ALL(vec));
        rep(i, n - 1)
        {
            edge e;
            e.from = vec[i].p, e.to = vec[i + 1].p, e.cost = abs(vec[i].x - vec[i + 1].x);
            ed.push_back(e);
        }
        rep(i, n) swap(vec[i].x, vec[i].y);
    }

    OP(kruskal(n, ed));

    return 0;
}

Measured memory_bytes: 7536
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"

#define lp(n) for (int i = 0; i < n; i++)
#define LP(n,i) for (int i = 0; i < n; i++)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nya_n "(=^･ω･^=)"
typedef long long ll;
using namespace std;

int n, m, p[100000], x, y, cnt, g[100000];
bool vtd[100000];
vector<int>gp[100000];

int dfs(int x) {
	vtd[x] = true;
	lp(gp[x].size()) {
		if (!vtd[gp[x][i]]) {
			g[gp[x][i]] = g[x];
			dfs(gp[x][i]);
		}
	}
	return 0;
}


int main() {
	cin >> n >> m;
	lp(n)
		cin >> p[i];
	lp(m) {
		cin >> x >> y;
		gp[x - 1].push_back(y - 1);
		gp[y - 1].push_back(x - 1);
	}
	lp(n)
		vtd[i] = false;
	lp(n) {
		if (!vtd[i]) {
			g[i] = i;
			dfs(i);
		}
	}
	cnt = 0;
	lp(n) {
		if (g[i] == g[p[i] - 1])cnt++;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 9600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  map<int,int> mp;
  int x;
  for(int i=0;i<n-1;i++)
  {
    cin>>x;
    mp[x]++;
  }
  for(int i = 1;i<=n;i++)
    cout<<mp[i]<<endl;
  return 0;
}


Measured memory_bytes: 12972
<?php

function check($S){
        if ($S=='T') {
                return 'T';
        } else if($S == 'F') {
                return 'F';
        }
        for ($i=0; $i < strlen($S); $i++) {
                if ($S[$i]==='(') {
                        $count=1;
                        for ($j=$i+1; $j<strlen($S); $j++) {
                                if ($S[$j]===')') {
                                        $count--;
                                        if ($count==0) {
                                                $S=substr($S,0,$i).check(substr($S,$i+1,$j-$i-1)).substr($S,$j+1);
                                                $i=0;
                                                break;
                                        }
                                } else if($S[$j]==='('){
                                        $count++;
                                }
                        }
                }
        }
        $Sprev='0';
        while ($Sprev!==$S) {
                $Sprev=$S;
                $S=str_replace(['-T','-F'],['F','T'],$S);
        }
        $Sprev='0';
        while ($Sprev!==$S) {
                $Sprev=$S;
                $S=str_replace(['T*T','T*F','F*T','F*F'],['T','F','F','F'],$S);
        }
        $Sprev='0';
        while ($Sprev!==$S) {
                $Sprev=$S;
                $S=str_replace(['T+T','T+F','F+T','F+F'],['T','T','T','F'],$S);
        }
        $S=str_replace(['T->T','T->F','F->T','F->F'],['T','F','T','T'],$S);
        $Sprev='0';
        while ($Sprev!==$S) {
                $Sprev=$S;
        }
        return $S;
}

while(1){
        $S=trim(fgets(STDIN));
        if ($S==='#') {
                break;
        }
        $C=[];
        for ($i=0; $i < strlen($S); $i++) {
                @$C[$S[$i]]++;
        }
        $d=[];
        foreach ($C as $x => $y) {
                if ('a' <= $x && $x<='k') {
                        @               $d[$x]++;
                }
        }
        $e=[];
        $index=0;
        foreach ($d as $k => $v) {
                $e[$index++]=$k;
        }

        $memo=sizeof($e);
        $flag=true;
        for ($i=0; $i < (1<<$memo); $i++) {
                $j=$i;
                $index=0;
                $replace=[];
                for ($k=0; $k < $memo; $k++) {
                        $replace[$index++]=(($j%2==1)?'T':'F');
                        $j>>=1;
                }
                $Scopy=$S;
                $Sreplace=str_replace($e,$replace,$Scopy);
                list($left,$right)=explode('=',$Sreplace);
                if (check($left)!==check($right)) {
                        $flag=false;
                        break;
                }
        }
        if ($flag) {
                echo 'YES'.PHP_EOL;
        }else{
                echo 'NO'.PHP_EOL;
        }
}

Measured memory_bytes: 15544
from itertools import accumulate, islice
from bisect import bisect_left
 
n = int(input())
xs = [int(x) for x in input().split()]
 
ys = list(accumulate(xs))
zs, total = ys[:-1], ys[-1]
 
res = max(xs) - min(xs)
for i, z in islice(enumerate(zs), 1, n-1):
    j = bisect_left(zs, z//2)
    splits = ((zs[j+k], z - zs[j+k]) for k in (-1, 0, 1) if 0 <= j+k <= i)
    a, b = min(splits, key=lambda s:abs(s[0]-s[1]))
 
    j = bisect_left(zs, (total - z)//2 + z)
    splits = ((zs[j+k] - z, total - zs[j+k]) for k in (-1, 0, 1) if i <= j+k <= n-2)
    c, d = min(splits, key=lambda s:abs(s[0]-s[1]))
 
    minn, _, _, maxx = sorted((a,b,c,d))
    if maxx - minn < res:
        res = maxx - minn
 
print(res)

Measured memory_bytes: 24832
#include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define REP(i, n) for(int (i)=0; (i)<(n); (i)++)
typedef long long ll;
ll const MOD = 1e9+7;
ll const INF = 1e18;
using namespace std;

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

    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    REP(i,n){
        cin >> a[i] >> b[i];
    }

    ll ans = 0;

    for(int i=n-1; i>=0; i--){
        a[i] += ans;
        ans += (b[i] - a[i]%b[i]) % b[i];
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env ruby

n = gets.to_i
line1 = gets.split.map {|num| num.to_i }
line2 = gets.split.map {|num| num.to_i }

(0..n-1).reverse_each do |i|
  line2[i] += line2[i+1].to_i
  line1[i] += [line1[i+1].to_i, line2[i]].max
end

puts line1[0]

Measured memory_bytes: 1788
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    x = min(a[i], b[i])
    ans += x
    a[i] -= x
    b[i] -= x

    ans += min(b[i], a[i + 1])
    a[i + 1] = max(0, a[i + 1] - b[i])
print(ans)


Measured memory_bytes: 19116
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

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

using namespace std;

int main() {
    int n, l;
    cin >> n >> l;

    vector<int> apple;
    rep(i, n) {
        apple.push_back(l + i);
    }

    int min = abs(apple[0]);
    int min_num = 0;
    rep(i, n) {
        if (min > abs(apple[i])) {
            min = abs(apple[i]);
            min_num = i;
        }
    }
    int ans = 0;
    rep(i, n) {
        ans += apple[i];
    }
    cout << ans - apple[min_num];


    return 0;
}

Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
//同じ作業繰り返す系の問題：収束先を見つける
//過半数：N/2.0で判定
//優先度付きキュー
//priority_queue<
//ll,
//vector<ll>
//> q;
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
#define PI 3.14159265358979323846264338327950L
using namespace std;

//割るやつ
const ll MOD = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

//a,bの最小公倍数
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1));
}

//Nのd桁目の数
ll dignum(ll N, ll d) {
	ll x = pow(10, d);
	N %= x;
	ll y = pow(10, d - 1);
	N /= y;
	return N;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

ll RS(ll N, ll P, ll M) {
	if (P == 0) return 1;
	if (P % 2 == 0) {
		ll t = RS(N, P / 2, M);
		return t * t % M;
	}
	return N * RS(N, P - 1, M);
}

vector<int> IntegerToVector(int bit, int N) {
    vector<int> S;
    for (int i = 0; i < N; ++i) {
        if (bit & (1 << i)) {
            S.push_back(i);
        }
    }
    return S;
}

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

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

Measured memory_bytes: 11000
#include<bits/stdc++.h>
using namespace std;
long long n;
vector<long long>altura;
int dp[100003];
int rec(int i){
    if(dp[i]!=-1)return dp[i];
    if(i==n-1){
        return 0;
    }
    //dp[pos]=rec(pos+2)+
    if(i+2<=n-1)dp[i]=min(rec(i+2)+abs(altura[i]-altura[i+2]),rec(i+1)+abs(altura[i]-altura[i+1]));
    else dp[i]=rec(i+1)+abs(altura[i]-altura[i+1]);
    return dp[i];
}
int main(){
    cin>>n;
    memset(dp,-1,sizeof dp);
    altura.resize(n);
    for(int i=0;i<n;i++)cin>>altura[i];
    dp[n-1]=0;
    cout<<rec(0);


}



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

int main() {
  string s, t;
  cin >> s >> t;
  if(s.size() < t.size()) cout << "UNRESTORABLE" << endl;
  else {
    vector<string> ans(0);
    for(int i=0;i<=s.size()-t.size();i++) {
      string sub = s.substr(i, t.size());
      string result = s;
      for(int j=0;j<sub.size();j++) {
        if(sub[j] == '?') sub[j] = t[j];
      }
      if(sub == t) {
        for(int j=0;j<i;j++) {
          if(s[j] == '?') result[j] = 'a';
        }
        for(int j=i;j<i+t.size();j++) {
          result[j] = t[j-i];
        }
        for(int j=i+t.size();j<s.size();j++) {
          if(s[j] == '?') result[j] = 'a';
        }

        ans.push_back(result);
      }
    }

    if(ans.size()==0) {
      cout << "UNRESTORABLE" << endl;
    } else {
      sort(ans.begin(), ans.end());
      cout << ans[0] << endl;
    }
  }
}

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

int main()
{
  int h, w; cin >> h >> w;
  vector<string> s(h);
  rep(i, h) cin >> s[i];

  rep(i, h) rep(j, w) {
    if (s[i][j] == '#') {
      if (s[max(0, i-1)][j] == '.'
        && s[min(h-1, i+1)][j] == '.'
        && s[i][max(0, j-1)] == '.'
        && s[i][min(w-1, j+1)] == '.') {
          cout << "No" << endl;
          return 0;
      }
    }
  }
  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;
using namespace std;
int main()
{
  long long n,ans;
  long double m;
  cin>>n>>m;
  m=round(m*100);
  ans=(n*m)/100;
  cout<<ans;
  
}



Measured memory_bytes: 3760
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x
    
    def size(self, x):
        return -self.parents[self.find(x)]
    
    def isSame(self, x, y):
        return self.find(x) == self.find(y)

def solve():
    N, T = map(int,input().split())
    A = list(map(int,input().split()))

    uf = UnionFind(N)

    mn_idx_list = []
    mn = float('inf')
    max_diff = 0
    for i in range(N):
        mn = min(mn, A[i])
        if mn == A[i]:
            mn_idx_list.append(i)
        else:
            mn_idx_list.append(mn_idx_list[-1])

        max_diff = max(max_diff, A[i] - mn)
    
    for i in range(N):
        if A[i] - A[mn_idx_list[i]] == max_diff:
            uf.unite(i, mn_idx_list[i])
    
    parents_set = set()
    for i in range(N):
        if uf.size(i) == 1:
            continue
        parents_set.add(uf.find(i))
    
    print(len(parents_set))

if __name__ == '__main__':
    solve()


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

int main(){
  vector<char> C(3);
  cin >> C.at(0) >> C.at(1) >> C.at(2);
  int count = 0;
  
  for(int i=0;i<3;i++){
    if(C.at(i) == '1'){
      count++;
    }
  }
  
  cout << count <<endl;
}


Measured memory_bytes: 256
A = list(input())
if A[0] == A[1] == A[2]:
  print(A[0]+A[0]+A[0])
else:
  if A[0] == A[1]:
    if A[1]>A[2]:
      print(A[0]+A[0]+A[0])
    else:
      A[0] = str(int(A[0])+1)
      print(A[0]+A[0]+A[0])
  else:
    if A[0]>A[1]:
      print(A[0]+A[0]+A[0])
    else:
      A[0] = str(int(A[0])+1)
      print(A[0]+A[0]+A[0])

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    for(int i=1; i<=9;i++){
        for(int j=1; j<=9; j++){
            if(i*j == n){
                cout<<"Yes"<<endl;
                return 0;
            }
        }
    }
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define M 1000000007
#define U 998244353
#define N 1300005
#define int long long
#define sz(c) (int)c.size()
#define fr first
#define ll long long 
#define sc second
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a ; i<n ; i++)
#define r0 return 0;
#define endl '\n'
#define INF (int)1e15
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
int power(int x, unsigned int y, unsigned int m)
{
    if (y == 0)
        return 1;
    int p = power(x, y/2, m) % m;
    p = (p * p) % m;
    return (y%2 == 0)? p : (x * p) % m;
}
signed main()
{
    ios_base::sync_with_stdio(0);
    int TESTS=1;
    // cin>>TESTS;
    while(TESTS--)
    {   
        int n;
        cin>>n;
        int a[n+1];
        rep(i,1,n+1) cin>>a[i];
        int dp[n+1];
        dp[1] = 0;
        rep(i,2,n+1){
            if(i==2){
                dp[2] = dp[1]+abs(a[2]-a[1]);
            }
            else{
                dp[i] = min(dp[i-1]+abs(a[i-1]-a[i]),dp[i-2]+abs(a[i-2]-a[i]));
            }
        }
        cout<<dp[n];
    }       
}     

Measured memory_bytes: 1792
#include <iostream>
#include <vector>

int main() {
    
    std::vector <int> v;
    int N, q, val;
    std::cin >> N;
    for (int i = 0; i < N; i++) {
        std::cin >> q;
        if (q == 0) {
            std::cin >> val;
            v.push_back(val);
        }
        else if (q == 1) {
            std::cin >> val;
            std::cout << v[val] << std::endl;
        }
        else if (q == 2) {
            v.pop_back();
        }
    }
    
    return 0;
}


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

int main(){
  string S;
  cin >> S;
  int ans = 700;
  if (S.at(0) == 'o') ans += 100;
  if (S.at(1) == 'o') ans += 100;
  if (S.at(2) == 'o') ans += 100;
  cout << ans << endl;
}

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

int main() {
    int n;
    cin >> n;
    vector<vector<pair<int,int>>> xy(n);
    for(int i = 0; i < n; i++) {
        int x, y;
        int a;
        cin >> a;
        for (int j = 0; j < a; j++) {
            cin >> x >> y;
            xy[i].emplace_back(--x, y);
        }
    }

    int ret = 0;
    for (int status = 0; status < (1<<n); status++) {
        bitset<16> bs(status);
        int count = 0;
        bool ok = true;
        for (int i = 0; i < n; i++) {
            if (!bs[i]) continue;
            for ( auto s : xy[i]) {
                if (bs[s.first] != s.second ) ok = false;
            }
        }
        if (ok) {
            ret = (std::max)(ret, (int)bs.count());
        }
    }
    cout << ret << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N=2*1e5+100;
int n,f,z,k,a[N],b[N],w,zero;
bool check(int mid)
{
	int cnt=0;
	if (mid==0)
	  cnt+=z*f+zero;
	if (mid<0)
	{
		for (int i=1;i<=f;i++)
		{
			int aim=(mid%a[i]==0)?mid/a[i]:(mid/a[i]+1);
			int pos=lower_bound(b+1,b+1+z,aim)-b;
			cnt+=z-pos+1;
		}
	}
	if (mid>0)
	{
		
		for (int i=1;i<=f;i++)
		{
			if (-a[i]>mid) continue;
			a[i]=-a[i];
			int aim=mid/a[i];
			aim=-aim;
			a[i]=-a[i];
			int pos=lower_bound(a+1,a+1+f,aim)-a;
			cnt+=f-pos+1;
			if (i>=pos) cnt--;
		}
		for (int i=1;i<=z;i++)
		{
			if (b[i]>mid) continue;
			int aim=mid/b[i];
			int pos=upper_bound(b+1,b+1+z,aim)-b;
			cnt+=pos-1;
			if (i<=pos-1) cnt--;
		}
		cnt/=2;
		cnt+=z*f+zero;
	}
	return cnt>=k;
}
signed main()
{
	scanf("%lld%lld",&n,&k);
	for (int i=1;i<=n;i++)
	{
		int num;
		scanf("%lld",&num);
		if (num<0) a[++f]=num;
		if (num>0) b[++z]=num;
		if (num==0) zero++;
	}
	zero=zero*(zero-1)/2+zero*(f+z);
	sort(a+1,a+1+f);
	sort(b+1,b+1+z);
	int l=-1e18,r=1e18;
	while (l<r)
	{
		int mid=(l+r)>>1;
		if (check(mid)) r=mid;
		else l=mid+1;
	}
	printf("%lld\n",r);
}

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

int pop[100100];

int main() {
	int K = 1;
	string S;
	cin >> S;
	int n = S.size()/2;
	if(S.size() % 2 == 0) {
		if(S[n] != S[n-1]) {
			K = S.size()/2;
		}
		else {
			int a;
			a = 0;
			for(int i = 0; i < S.size()/2; i++) {
				if(S[n] == S[n+i] && S[n-1] == S[n-1 -i]) a++;
				else break;
			}
			K = S.size() / 2 + a;
		}
	}
	else {
			int a;
			a = 0;
			for(int i = 0; i <= S.size()/2; i++) {
				if(S[n] == S[n+i] && S[n] == S[n-i]) a++;
				else break;
			}
			K = S.size() / 2 + a;
	}
	cout << K << endl;
}


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

string s;
int k;
int main(){
    cin >> k;
    cin >> s;
    int a= s.size();
    if (a <= k){
        rep(i,a) cout << s[i];
        cout << endl;
    }
    else{
        rep(i,k) cout << s[i];
        cout <<"..." << endl;
    }
}

Measured memory_bytes: 3636
#include<iostream>
#include<string.h>
#include<ctype.h>
#include<string>
#include<math.h>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#define pi 3.141592653589
#define rep(i,a,n) for(int i=a;i<n;i++)
#define INF 1e9
#define LINF 1e17
#define ll long long
#define MOD (int)(1e9+7)
#define pii pair<int,int>
using namespace std;

int solve(string s) {
	int tmp = 0;
	rep(i, 0, s.size()) {
		tmp += s[i] - '0';
	}

	return tmp;
}

int main() {

	int n, a, b;
	int ans = 0;

	cin >> n >> a >> b;
	rep(i, 1, n + 1) {
		string s = to_string(i);
		int sum = solve(s);
		if (sum >= a&&sum <= b) {
			ans += stoi(s);
		}
	}
	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
 
int main(void)
{
  int length = 0;
  int height = 0;
  int area = 0;
  int cir = 0;
 
  scanf("%d %d", &length, &height);
  area = length * height;
  cir = length*2 + height*2;
 
  printf("%d %d\n", area, cir);
 
  return 0;
}

Measured memory_bytes: 596
import java.util.Scanner;
public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    String s = scan.nextLine();
    if(s.charAt(0) == s.charAt(1) && s.charAt(1) == s.charAt(2)){
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}


Measured memory_bytes: 21972
/**


  ######                                                                     ######   #     #  #######
  #     #    ##    #####   #    #  #    #  #    #  #   ####   #    #  #####  #     #  #     #       #
  #     #   #  #   #    #  #   #   #   #   ##   #  #  #    #  #    #    #    #     #  #     #      #
  #     #  #    #  #    #  ####    ####    # #  #  #  #       ######    #    ######   #######     #
  #     #  ######  #####   #  #    #  #    #  # #  #  #  ###  #    #    #    #   #    #     #    #
  #     #  #    #  #   #   #   #   #   #   #   ##  #  #    #  #    #    #    #    #   #     #   #
  ######   #    #  #    #  #    #  #    #  #    #  #   ####   #    #    #    #     #  #     #  #######



**/
/*

    BismiLLAHIR RAHMANIR RAHIM
    It's not how you look or who you are underneath, it's what you do that defines you

                                ------********-------

    Status : ;
    TC: xxx/xxx;
    DOS: ;
    OJ: ;

*/

#include <bits/stdc++.h>

using namespace std;

#define test        cout<<"thiq ase boss"<<endl;
#define PB          push_back
#define PF          push_front
#define PII         pair <int,int>
#define MII         map <int,int>
#define MSI         map <string,int>
#define MIS         map <int,string>
#define MLI         map <long long int,int>
#define MIL         map <int,long long int>
typedef long long int           LL;
typedef vector <string>         VS;
typedef vector <int>            VI;
typedef vector <char>           VC;
typedef vector <LL>             VLL;

const int INF = 1e9;
const int MX = 1e9;
const double PI = acos(-1);

/* Functions */

int main() {
    //#ifdef LU_SERIOUS
        //freopen("geta.txt","r",stdin);
    //#endif // LU_SERIOUS
    LL n,x,a,b,c,lo,hi,i,j,ans=0,sum,dif;
    vector <LL> vl;
    while (cin >> n >> x) {
        vl.clear();
        ans = dif = sum = 0;
        for (i = 0; i < n; i++) {
            scanf("%lld",&c);
            vl.PB(c);
        }
        for (i = 1; i < vl.size(); i++) {
            sum = vl[i] + vl[i-1];
            if (sum > x) {
                dif = sum - x;
                ans += dif;
                if (dif <= vl[i]) {
                    vl[i] -= dif;
                }
                else {
                    dif -= vl[i];
                    vl[i] = 0;
                    vl[0] -= dif;
                }
            }
        }
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 1400