akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
int main(){
    int multiple;
    int start;
    int end;
    scanf("%d", &multiple);
    scanf("%d %d", &start, &end);
    int length = end - start;
    int count;
    for(int i = 0; i <= length ; i++){
        int total = start % multiple;
        start++;
        if(total == 0){
            count++;
        }
        else{
            count = count + 0;;
        }
    }
    if(count > 0){
        printf("OK\n");
    }
    else{
        printf("NG\n");
    }
    return 0;
}

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

 
int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b;
	cin >> a >> b;
	if (a==1){ a += 13; }
	if (b==1){ b += 13; }
	if (a>b){ cout << "Alice" << endl; }
	else if (a<b){ cout << "Bob" << endl; }
	else { cout << "Draw" << endl; }
}

Measured memory_bytes: 256
import java.io.*;
import java.util.*;
 
public class Main {
    static final long MOD = 1000000007L;
    static final int INF = 50000000;
    static final int NINF = -50000000;
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter pw = new PrintWriter(System.out);
        
        int N = sc.ni();
        int[] type = new int[4];
        for (int i = 0; i < N; i++) {
        	String s = sc.next();
        	if (s.equals("AC")) {
        		type[0] += 1;
        	} else if (s.equals("WA")) {
        		type[1] += 1;
        	} else if (s.equals("TLE")) {
        		type[2] += 1;
        	} else {
        		type[3] += 1;
        	}
        }
        
        pw.println("AC x " + type[0]);
        pw.println("WA x " + type[1]);
        pw.println("TLE x " + type[2]);
        pw.println("RE x " + type[3]);
        
        pw.close();
    }
    
    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;
 
        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
 
        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
 
        int ni() {
            return Integer.parseInt(next());
        }
 
        long nl() {
            return Long.parseLong(next());
        }
 
        double nd() {
            return Double.parseDouble(next());
        }
 
        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }
    }
}

Measured memory_bytes: 47488
#include<bits/stdc++.h>
using namespace std;
long long s,k,n;
int a[100+10];
int main()
{
	cin>>n>>k;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	sort(a+1,a+1+n);
    for(int i=n;i>=n-k+1;i--)
    {
        s+=a[i];
    }
	cout<<s<<endl;
     

    return 0;
}


Measured memory_bytes: 256
#include <cstdio>
bool prime[104730];
int main() {
for(int i=2;i*i<=104729;i++)
for(int j=i*2;j<=104729;j+=i)prime[j]=true;
int n;
while(scanf("%d",&n),n) {
int p=0,sum=0;
for(int i=2;i<=104729;i++) {
if(!prime[i])sum+=i,p++;
if(p==n)break;
}
printf("%d\n",sum);
}
}

Measured memory_bytes: 1128
# abc137_b.py
# https://atcoder.jp/contests/abc137/tasks/abc137_b

# B - One Clue /
# 実行時間制限: 2 sec / メモリ制限: 1024 MB
# 配点 : 200点

# 問題文
# 数直線上に 2000001個の石が置かれています。
# これらの石の座標は −1000000,−999999,−999998,…,999999,1000000です。
# これらの石のうち、ある連続する K個の石が黒で塗られており、それ以外の石は白で塗られています。
# また、座標 Xにある石は黒で塗られていることが分かっています。
# 黒で塗られている石が置かれている可能性のある座標をすべて、小さい順に出力してください。

# 制約
#     1≤K≤100
#     0≤X≤100
#     入力中の値はすべて整数である。

# 入力
# 入力は以下の形式で標準入力から与えられる。
# K X

# 出力
# 黒で塗られている石が置かれている可能性のある座標をすべて、空白で区切って小さい順に出力せよ。

# 入力例 1
# 3 7

# 出力例 1
# 5 6 7 8 9

# 黒で塗られた石の数が 3個であることと、座標 7 の石が黒で塗られていることが分かっています。このとき、次の 3通りの可能性が考えられます。

#     黒で塗られた 3個の石は座標 5,6,7に置かれている。
#     黒で塗られた 3個の石は座標 6,7,8に置かれている。
#     黒で塗られた 3個の石は座標 7,8,9に置かれている。

# よって、黒で塗られている石が置かれている可能性のある座標は 5,6,7,8,9の 5つです。

# 入力例 2
# 4 0

# 出力例 2
# -3 -2 -1 0 1 2 3

# 負の座標に黒で塗られている石が置かれている可能性もあります。

# 入力例 3
# 1 100

# 出力例 3
# 100


global FLAG_LOG
FLAG_LOG = False


def log(value):
    # FLAG_LOG = True
    # FLAG_LOG = False
    if FLAG_LOG:
        print(str(value))


def calculation(lines):
    # S = lines[0]
    # N = int(lines[0])
    K, X = list(map(int, lines[0].split()))
    # values = list(map(int, lines[1].split()))
    # values = list(map(int, lines[2].split()))
    # values = list()
    # for i in range(6):
    #     values.append(int(lines[i]))
    # valueses = list()
    # for i in range(M):
    #     valueses.append(list(map(int, lines[i+1].split())))

    n = X - (K-1)

    results = list()
    for i in range(K*2-1):
        results.append(str(n+i))

    return [' '.join(results)]


# 引数を取得
def get_input_lines(lines_count):
    lines = list()
    for _ in range(lines_count):
        lines.append(input())
    return lines


# テストデータ
def get_testdata(pattern):
    if pattern == 1:
        lines_input = ['3 7']
        lines_export = ['5 6 7 8 9']
    if pattern == 2:
        lines_input = ['4 0']
        lines_export = ['-3 -2 -1 0 1 2 3']
    if pattern == 3:
        lines_input = ['1 100']
        lines_export = ['100']
    return lines_input, lines_export


# 動作モード判別
def get_mode():
    import sys
    args = sys.argv
    global FLAG_LOG
    if len(args) == 1:
        mode = 0
        FLAG_LOG = False
    else:
        mode = int(args[1])
        FLAG_LOG = True
    return mode


# 主処理
def main():
    import time
    started = time.time()
    mode = get_mode()
    if mode == 0:
        lines_input = get_input_lines(1)
    else:
        lines_input, lines_export = get_testdata(mode)

    lines_result = calculation(lines_input)

    for line_result in lines_result:
        print(line_result)

    # if mode > 0:
    #     print(f'lines_input=[{lines_input}]')
    #     print(f'lines_export=[{lines_export}]')
    #     print(f'lines_result=[{lines_result}]')
    #     if lines_result == lines_export:
    #         print('OK')
    #     else:
    #         print('NG')
    # finished = time.time()
    # duration = finished - started
    # print(f'duration=[{duration}]')


# 起動処理
if __name__ == '__main__':
    main()


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

int main() {
  int r;
  int r2;
  cin >> r;

  r2 = r * r;

  cout << r2  << endl;

  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
constexpr int MOD = 1000000007;
int main()
{
    int N;
    cin >> N;
    FOR(i, 0, 10) {
        FOR(j, 0, 10) {
            if(i*j == N) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
S = input()
K = int(input())

n = len(S)
s = S[0]
c = 0

if S.count(s) == n:
  print((n*K)//2)
  exit()
else:
  head = 1
  for i in range(1, n):
    if S[i] == s:
      head += 1
    else:
      c += head//2
      S = S[i:]
      break
  if S[-1] == s:
    tail = 1
    for i in range(-2, -n, -1):
      if S[i] == s:
        tail += 1
      else:
        c += tail//2
        S = S[:i+1]
        break
    c += (K-1)*((head + tail)//2)
  else:
    c += (K-1)*(head//2)
  start = 0
  s = S[start]
  S += 'X'
  for i in range(1, len(S)):
    if S[i] != s:
      c += K*((i - start)//2)
      start = i
      s = S[start]
print(c)

Measured memory_bytes: 3064
#n=int(input())
a,b=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]

import math
flag=False
ans=-1
for i in range(1,10001):
    a2=i*0.08
    a1=int(i*0.08)
    b1=int(i*0.1)

    if a1==a and b1==b:
        ans=i
        break
print(ans)





Measured memory_bytes: 3060
#include <iostream>
#include<cmath>
#include<algorithm>
#include<vector>
#include<string>

using namespace std;
#define PI acos(-1)

int main()
{
	long long A;
	string B;

	cin >> A >> B;

	long long C = (B[0] - '0') * 100 + (B[2] - '0') * 10 + (B[3] - '0');
	cout << A * C / 100 << endl;
	

}



Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// debug
template <typename T, typename U>
ostream &operator<<(ostream &os, const pair<T, U> &p){
  os << "(" << p.first << "," << p.second << ")";return os;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  for (auto it = v.begin();it != v.end();++it){
    if(it != v.begin())os << " ";os << *it;
  }return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &mp){
  for(auto x: mp)os << "(" << x.first << "," << x.second << ")" << endl;
  return os;
}
template<typename T, int SIZE>
int array_length(const T (&)[SIZE]){return SIZE;}
template<typename T, int N>
void PRINTF(const T (&a)[N], int s = N, int t = -1, bool f = true){
	if(t == -1){rep(i,s){if(i)cout << " ";cout << a[i];}}
	else repi(i,s,t){if(i!=s)cout << " ";cout << a[i];}
	if(f)cout << "\n";
}
template<typename T, int N1, int N2>
void PRINTF(const T (&a)[N1][N2], int h = N1, int w = N2){
	rep(i,h){rep(j,w){cout << a[i][j] << " \n"[j==w-1];}}
}
string substr(const string &str, int S1, int S2 = -1){
  if(S2 == -1)return str.substr(S1);
  return str.substr(S1, S2-S1);
}
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef pair<P, int> Pi;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);

int a[200000];
signed main(){
  int n;cin >> n;
  rep(i,n)cin >> a[i];
  int cnt = count(a, a+n, 0);
  int sum = 0;
  rep(i,n)sum += abs(a[i]);
  if(cnt > 0){
    cout << sum << endl;return 0;    
  }
  rep(i,n-1)if(a[i] < 0){
    a[i] = -a[i];a[i+1] = -a[i+1];
  }
  if(a[n-1] > 0){
    cout << sum << endl;return 0;
  }
  a[n-1] = -a[n-1];
  int mn = *min_element(a, a+n);
  cout << sum-2*mn << endl;
  return 0;
}






Measured memory_bytes: 1024
fun main(args: Array<String>) {
    abc150c()
}

fun abc150c() {
    val n = readLine()!!.toInt()
    val p = readLine()!!.split(' ').map { it.toInt() }.joinToString("")
    val q = readLine()!!.split(' ').map { it.toInt() }.joinToString("")

    val perms = permutations((1..n).toList()).map { it.toString() }

    val a = perms.indexOf(p)
    val b = perms.indexOf(q)

    val answer = Math.abs(a - b)

    println(answer)
}

fun permutations(base: List<Int>, add: String = "", ret: MutableList<Int> = mutableListOf()): List<Int> {
    if (base.size == 1) {
        ret.add((add + base[0]).toInt())
    } else {
        for (i in base.indices) {
            permutations(
                base.subList(0, i) + base.subList(i + 1, base.size),
                add + base[i],
                ret
            )
        }
    }
    return ret
}


Measured memory_bytes: 62728
s = input()
s = set(s)
data = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
for i in range(len(data)):
    if data[i] not in s:
        print(data[i])
        break
else:
     print('None')   

Measured memory_bytes: 9256
N, K = map(int, input().split())
max_K = (N - 1) * (N - 2) // 2
if K > max_K:
	print(-1)

L = []
M = 0

for i in range(2, N + 1):
	L.append((1, i))
	M += 1
	
k = max_K

if K == k:
	print(M)
	for l in range(M):
		print(L[l][0], L[l][1])

for i in range(2, N):
	for j in range(i + 1, N + 1):
		L.append((i, j))
		k -= 1
		M += 1
		if K == k:
			print(M)
			for l in range(M):
				print(L[l][0], L[l][1])
				

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

using namespace std;
int main() {
  int a, b;
  cin >> a >> b;
  if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0)
    cout << "Possible" << endl;
  else
    cout << "Impossible" << endl;
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;

public class Main {
	final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9
	final int _intMin = Integer.MIN_VALUE;
	final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18
	final long _longMin = Long.MIN_VALUE;
	static boolean bElapsed = false;

	void solve() {
		int n = readNum();
		int k = readNum();
		int[] ia = readNums();
		int ans = 0;
		for (int i = 0; i < n; i++) {
			int d1 = ia[i] * 2;
			int d2 = (k - ia[i]) * 2;
			ans += min(d1, d2);
		}
		pln(ans);
	}

	int min(int a, int b) {
		return (a < b) ? a : b;
	}

	int pint(String s) {
		return Integer.parseInt(s);
	}

	long plong(String s) {
		return Long.parseLong(s);
	}

	String readLine() {
		try {
			return _in.readLine();
		} catch (IOException e) {
			throw new RuntimeException(e);
		}
	}

	int readNum() {
		String line = readLine();
		return pint(line);
	}

	String[] readFlds() {
		String line = readLine();
		return line.split(" ");
	}

	int[] readNums() {
		String[] flds = readFlds();
		int[] nums = new int[flds.length];
		for (int i = 0; i < flds.length; i++) {
			nums[i] = pint(flds[i]);
		}
		return nums;
	}

	void p(char c) {
		_out.print(c);
	}

	void pln(char c) {
		_out.println(c);
	}

	void p(double d) {
		_out.print(d);
	}

	void pln(double d) {
		_out.println(d);
	}

	void p(long l) {
		_out.print(l);
	}

	void pln(long l) {
		_out.println(l);
	}

	void p(String s) {
		_out.print(s);
	}

	void pln(String s) {
		_out.println(s);
	}

	static BufferedReader _in;
	static PrintWriter _out;

	public static void main(String[] args) {
		long start = System.currentTimeMillis();
		_in = new BufferedReader(new InputStreamReader(System.in));
		_out = new PrintWriter(System.out);
		new Main().solve();
		_out.flush();
		long end = System.currentTimeMillis();
		if (bElapsed) {
			System.err.println((end - start) + "ms");
		}
	}
}


Measured memory_bytes: 21332
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	int x,y,sx,sy,cost;
};
int a[1001];

int main() {

	int n,k;
	cin>>n>>k;
	rep(i,n)cin>>a[i];
	sort(a,a+n);

	ll t=0;
	rep(i,k){
		t+=a[i];
	}
	cout<<t<<endl;
	return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
int main(){
	int N,a,b;
	cin >> N;
	cin >> b;
	int ans = b;
	for(int i=1;i<N;i++){
		cin >> a;
		ans += max(0,a-b);
		b = a;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
import sys,math
from collections import deque,defaultdict
import operator as op
from functools import reduce
sys.setrecursionlimit(10**6) 

I=sys.stdin.readline

 #s="abcdefghijklmnopqrstuvwxyz"

#
def ii():
	return int(I().strip())
def li():
	return list(map(int,I().strip().split()))
def mi():
	return map(int,I().strip().split())

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x





	

def main():
	s=I().strip()
	arr=s.split("S")
	ans=0
	for i in arr:
		ans=max(ans,len(i))
	print(ans)

	













	
	
	






		







		
		
	
		

	







		









if __name__ == '__main__':
	main()

Measured memory_bytes: 9440
#include <iostream>
#include <complex>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cassert>
using namespace std;

typedef complex<double> Point;
typedef pair<Point, Point> Line;
	

void reverse(vector<Point> &p) {
	vector<Point> q;
	for (int i = (int)p.size() - 1; i >= 0; i--) q.push_back(p[i]);
	p = q;
}

double area(vector<Point> p) {
	double ret = 0;
	int i;
	
	for (i = 0; i < p.size() - 1; i++) {
		ret += (p[i].real() - p[i+1].real()) * (p[i].imag() + p[i+1].imag());
	}
	ret += (p[i].real() - p[0].real()) * (p[i].imag() + p[0].imag());
	return ret / 2;
}

double circum(vector<Point> p) {
	double ret = 0;
	int i;
	
	for (i = 0; i < p.size(); i++) {
		ret += abs(p[(i + 1) % p.size()] - p[i]);
	}
	return ret;
}

double cross(Point a, Point b) {
	return imag(conj(a) * b);
}

Point cross_point(Point a, Point b, Point c, Point d) {
	double A = cross(b - a, d - c);
	double B = cross(b - a, b - c);
	double eps = 1e-12;
	
	if (abs(A) < eps && abs(B) < eps) return c;
	if (abs(A) < eps) assert(false);
	return c + B / A * (d - c);
}

void move(Line &l, double dist) {
	Point trans = Point(0, 1) * (l.second - l.first); trans /= abs(trans);
	trans *= dist;
	
	l.first += trans;
	l.second += trans;
}

vector<Point> small_poly(vector<Point> p, double dist) {
	vector<Line> lines;
	vector<Point> poly;
	
	for (int i = 0; i < p.size(); i++) {
		lines.push_back(Line(p[i], p[(i + 1) % p.size()]));
	}
	
	for (int i = 0; i < p.size(); i++) {
		move(lines[i], dist);
	}
	
	for (int i = 0; i < p.size(); i++) {
		Point crs = cross_point(lines[i].first, lines[i].second, lines[(i+1) % p.size()].first, lines[(i+1) % p.size()].second);
		poly.push_back(crs);
	}
	return poly;
}

double max_length(vector<Point> p) {
	double ret = 0;
	int i;
	
	for (i = 0; i < p.size(); i++) {
		ret = max(ret, abs(p[(i + 1) % p.size()] - p[i]));
	}
	return ret;
}

int main() {
	double x, y;
	vector<Point> p; p.resize(3);
	
	cin >> x >> y; p[0] = Point(x, y);
	cin >> x >> y; p[1] = Point(x, y);
	cin >> x >> y; p[2] = Point(x, y);
	if (area(p) < 0) { reverse(p); }
	
	double st = 0;
	double ed = area(p) / circum(p) * 2;
	double mid;
	
	for (int i = 0; i < 100; i++) {
		mid = (st + ed) / 2;
		
		vector<Point> poly = small_poly(p, mid);
		//cout << mid << " " << area(poly) << " " << max_length(poly) << endl;
		if (max_length(poly) >= 2 * mid) { st = mid; }
		else { ed = mid; }
	}
	
	printf("%.14f\n", st);
	return 0;
}

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

string s[100];
int H, W;

int main() {
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		cin >> s[i];
	}
	for (int i = 0; i < H; i++) {
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
	return 0;
}

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

//#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);

signed main() {
	int N; cin >> N;
	vector<int> T(N); rep(i, 0, N) { cin >> T[i]; }
	int M; cin >> M;
	vector<int> P(M), X(M); rep(i, 0, M) { cin >> P[i] >> X[i]; P[i]--; }
	rep(i, 0, M) {
		int ans = 0;
		rep(j, 0, N) {
			if (j == P[i])ans += X[i];
			else ans += T[j];
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define ep emplace_back
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(v) v.begin(), v.end()
#define revall(v) v.rbegin(), v.rend()
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){ if(y<h && y>=0 && x<w && x>=0) return true; return false; }
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;
	vector<int> a(n);
	vector<string> s(n);
	rep(i,n) cin >> s.at(i) >> a.at(i);
	string x;cin >> x;
	int ans = 0;
	bool flg = false;
	rep(i,n){
		if(flg) ans += a.at(i);
		if(s.at(i) == x) flg = true;
	}
	cout << ans << endl;
}


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

int main(){
  int i;
  double n, sum=0, ans, ichi=1.0;
  cin >> n;
  vector <int> a(n);
  for(i=0; i<n; i++){
    cin >> a[i];
    sum += ichi / a[i];
  }
  ans = ichi / sum;
  cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.NoSuchElementException;

public class Main {

	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		PrintWriter out = new PrintWriter(System.out);

		char[] s = sc.next().toCharArray();

		out.println((s[0] == s[1] && s[1] == s[2]) || (s[1] == s[2] && s[2] == s[3]) ? "Yes" : "No");
		out.flush();
	}

}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) return true;
		else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) return false;
		}
		return true;
	}

	private byte readByte() {
		if (hasNextByte()) return buffer[ptr++];
		return -1;
	}

	private boolean isPrintableChar(byte c) {
		return '!' <= c && c <= '~';
	}

	private void skipUnprintable() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		byte b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public int nextInt() {
		if (!hasNext()) throw new NoSuchElementException();
		int n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

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

	public long nextLong() {
		if (!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		byte b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) throw new NumberFormatException();
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

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

Measured memory_bytes: 21204
import java.util.Arrays;
import java.util.HashSet;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.util.TreeSet;

public class Main {

	public static class Tag implements Comparable<Tag> {
		int a, b, c;
		boolean ok;

		public Tag(int a, int b, int c, boolean ok) {
			this.a = a;
			this.b = b;
			this.c = c;
			this.ok = ok;
		}

		@Override
		public int compareTo(Tag arg0) {
			if (this.ok && !arg0.ok) {
				return -1;
			} else if (!this.ok && arg0.ok) {
				return 1;
			} else {
				return 0;
			}
		}
	}

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

		while (true) {
			final int a = sc.nextInt();
			final int b = sc.nextInt();
			final int c = sc.nextInt();

			if (a == 0 && b == 0 && c == 0) {
				break;
			}

			final int N = sc.nextInt();

			Tag[] tags = new Tag[N];

			for (int i = 0; i < N; i++) {
				tags[i] = new Tag(sc.nextInt(), sc.nextInt(), sc.nextInt(),
						sc.nextInt() == 1);
			}

			Arrays.sort(tags);

			int[] variables = new int[a + b + c + 1];

			for (int i = 0; i < a + b + c + 1; i++) {
				variables[i] = 2;
			}

			//while (true) {
				//boolean updated = false;
				for (int i = 0; i < N; i++) {
					if (tags[i].ok) {
						variables[tags[i].a] = 1;
						variables[tags[i].b] = 1;
						variables[tags[i].c] = 1;
					} else {
						if (variables[tags[i].a] == 1
								&& variables[tags[i].b] == 1) {
							variables[tags[i].c] = 0;
							//updated = true;
						} else if (variables[tags[i].b] == 1
								&& variables[tags[i].c] == 1) {
							variables[tags[i].a] = 0;
							//updated = true;
						} else if (variables[tags[i].c] == 1
								&& variables[tags[i].a] == 1) {
							variables[tags[i].b] = 0;
							//updated = true;
						}
					}
				}

				//if (!updated) {
					//break;
				//}
			//}

			for (int i = 1; i < a + b + c + 1; i++) {
				System.out.println(variables[i]);
			}
		}

	}

}

Measured memory_bytes: 12000
N = int(input())
A = list(map(int, input().split()))
t = sum(A)
B = [0] * N
for i in range(0, N, 2):
  B[0] += A[i]
B[0] = 2 * B[0] - t

for i in range(1,N):
  B[i] = 2 * A[i-1] - B[i-1]

for i in range(N):
  print(B[i],end=" ")

Measured memory_bytes: 86564
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    int a, b, c;
    cin >> a >> b >> c;

    int sum = 0;
    for(int i=0; i<b; ++i){
        sum += a;
        if(sum % b == c){
            cout << "YES" << endl;
            return 0;
        }
    }

    cout << "NO" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.util.function.*;

class Main {
    static Scanner scanner = new Scanner();
    static int mod = 1000000007;
    static long inf = 0xfffffffffffffffL;

    void solve() {
        int x = scanner.nextInt();
        int y = x / 100;
        int z = x % 100;
        System.out.println(y * 5 >= z ? 1 : 0);
    }

    public static void main(String[]$) {
        try {
            new Main().solve();
            System.out.flush();
        } catch (Throwable t) {
            System.out.flush();
            t.printStackTrace();
        }
    }
}

class System {
    static PrintWriter out = new PrintWriter(java.lang.System.out);

    static void exit() {
        java.lang.System.exit(0);
    }
}

class Scanner {
    private BufferedReader reader = new BufferedReader(new InputStreamReader(java.lang.System.in), 0x10000);
    private StringTokenizer tokenizer;

    String next() {
        try {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                tokenizer = new StringTokenizer(reader.readLine());
            }
        } catch (IOException ignored) {
        }
        return tokenizer.nextToken();
    }

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

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

    char[][] nextCharArray(int n, int m) {
        char[][] a = new char[n][m];
        for (int i = 0; i < n; i++) {
            a[i] = next().toCharArray();
        }
        return a;
    }

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

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

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

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


Measured memory_bytes: 21460
#[allow(unused_macros)]
macro_rules ! for_ { ( $ init : stmt ; $ cond : expr ; $ incr : expr , $ body : block ) => ( { $ init ; while $ cond { $ body $ incr ; } } ) ; }

fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let _: usize = iter.next().unwrap().parse::<usize>().unwrap();
    let k: usize = iter.next().unwrap().parse::<usize>().unwrap();
    let s: String = iter.next().unwrap().parse::<String>().unwrap();
    
    let mut sum = vec![];
    let mut current = true;
    let mut acc = 0;
    for c in s.chars() {
        match (c, current) {
            ('0', false) | ('1', true) => acc += 1,
            ('0', true) | ('1', false) => {
                sum.push(acc);
                acc = 1;
                current = !current;
            },
            _ => ()
        }
    }
    sum.push(acc);
    if !current {sum.push(0);}

    let mut sum_of_sum: Vec<u64> = vec![0u64;sum.len()+1];
    for i in 0..sum.len() {
        sum_of_sum[i+1] = sum_of_sum[i] + sum[i];
    }

    let mut max = 0u64;
    for_!(let mut i = 0; i <= sum.len(); i+=2, {
        let j = std::cmp::min(sum.len(), i+k*2+1);
        max = std::cmp::max(max, sum_of_sum[j] - sum_of_sum[i]);
    });
    println!("{}", max);
}

Measured memory_bytes: 6396
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int b=0,r=0;
  for(int i=0;i<s.size();i++){
  if(s[i]=='0')r++;
  else b++;
  }
  cout<<min(b,r)*2;
  return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
constexpr long INF = 1LL << 62;
constexpr int MOD = 1e9 + 7;


int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int n; cin >> n;
    char a[300000]; for(int i=0; i < n; ++i) cin >> a[i];

    vector<int> l(n+1), r(n+1);
    for(int i=0; i < n; ++i) {
        if(a[i]=='W') l[i+1] = l[i] + 1;
        else l[i+1] = l[i];
    }
    for(int i=0; i < n; ++i) {
        if(a[n-i-1]=='E') r[n-i-1] = r[n-i] + 1;
        else r[n-i-1] = r[n-i];
    }

    int ans = 1e9;
    for(int i=0; i < n; ++i) 
        ans = min(ans, l[i] + r[i+1]);

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

Measured memory_bytes: 2944
#include<bits/stdc++.h>
using namespace std; 
#define ll long long int
#define pb push_back
#define mp make_pair
#define pll pair<ll,ll>
#define INF LLONG_MAX
#define PI acos(-1)
const ll MOD = 1e9 + 7;
#define fir first
#define sec second
#define all(x) x.begin(),x.end()
#define mem(a,b) memset(a,b,sizeof(a))
#define rep(c,a,b) for(ll c=a;c<b;c++)
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define min_heap priority_queue<pll,vector<pll>,greater<pll> >
ll dx4[]={-1,1,0,0};
ll dy4[]={0,0,-1,1};
ll dx8[]={-1,-1,-1,0,1,1,1,0};
ll dy8[]={-1,0,1,1,1,0,-1,-1};
bool isvalid(ll x,ll y,ll n,ll m)
{
	return (x>=0 and y>=0 and x<n and y<m);
}
int main()
{
	IOS
	ll n;
	cin>>n;
	cout<<(n*(n-1))/2;
}

Measured memory_bytes: 256
// Nguyen Anh Tu
#include <bits/stdc++.h>
#define FOR(x,a,b) for(int x=a;x<=b;x++)
#define FORD(x,a,b) for(int x=a;x>=b;x--)
#define maxn 100005
#define maxc 1000000007
#define MOD 1000000007
#define reset(x,y) memset(x,y,sizeof(x))
#define task "frog"
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair<int,int>
#define ll long long
#define bit(p,x) ((x>>p) & 1)
#define remain(a,b) (a+b >= MOD) ? (a+b - MOD) : (a+b)

using namespace std;
int n,a[maxn], k;
ll dp[maxn];
int main()
{
//    #ifndef ONLINE_JUDGE
    ios_base::sync_with_stdio(NULL); cin.tie(NULL); cout.tie(NULL);
//    freopen(task".inp","r",stdin);
//    freopen(task".out","w",stdout);
//    #endif
    cin >> n >> k;
    for(int i=1; i<=n; ++i)
    {
        cin >> a[i];
    }
    reset(dp,110);
    dp[1] = 0;
    for(int i=2; i<=n; ++i)
        for(int j=1; j<=min(i,k); ++j)
            dp[i] = min(dp[i], dp[i-j] + abs(a[i] - a[i-j]));
    cout << dp[n];
}


Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = b - 1; i >= a; --i)
#define SORT(v) sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define REV(v) reverse(v.begin(), v.end())
#define ITER(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define LB(v, x) (lower_bound(v.begin(), v.end(), x) - v.begin())
#define UB(v, x) (upper_bound(v.begin(), v.end(), x) - v.begin())
#define SZ(v) (int)v.size()
using namespace std;
using ll = long long;
using P = pair<int, int>;

class Graph {
	int N;
	vector<vector<P>> edge;

public:
	Graph(int N) : N(N), edge(N) {}
	void add(int s, int t, int d) {
		edge[s].emplace_back(t, d);
	}
	void ans() {
		vector<vector<int>> D(N, vector<int>(N, INT_MAX));
		REP(i, N) {
			D[i][i] = 0;
			for (auto &p : edge[i]) {
				int j, d;
				tie(j, d) = p;
				D[i][j] = d;
			}
		}
		REP(k, N) {
			REP(i, N) {
				REP(j, N) {
					if (D[i][k] < INT_MAX && D[k][j] < INT_MAX) {
						D[i][j] = min(D[i][j], D[i][k] + D[k][j]);
					}
				}
			}
		}
		REP(i, N) {
			if (D[i][i] < 0) {
				cout << "NEGATIVE CYCLE" << endl;
				return;
			}
		}
		REP(i, N) {
			REP(j, N) {
				if (D[i][j] < INT_MAX) {
					cout << D[i][j];
				} else {
					cout << "INF";
				}
				if (j < N - 1) cout << " ";
			}
			cout << endl;
		}
	}
};

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

	int V, E;
	cin >> V >> E;
	Graph graph(V);
	REP(i, E) {
		int s, t, d;
		cin >> s >> t >> d;
		graph.add(s, t, d);
	}
	graph.ans();

	return 0;
}


Measured memory_bytes: 3296
n = int(input())
a = list(map(int, input().split()))
memo = {}
for i in range(n):
    if a[i] not in memo:
        memo[a[i]] = 1
    else:
        memo[a[i]] += 1
ans = 0
for i in memo:
    ans += memo[i] * (memo[i] - 1) // 2
    
for i in range(n):
    print(ans - memo[a[i]] * (memo[a[i]] - 1) // 2 + (memo[a[i]] - 1) * (memo[a[i]] - 2) // 2)

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


#define BUF_SIZE 300
int main(void) {
  char line[BUF_SIZE];
  FILE *fp = stdin;
  if(!fgets(line, BUF_SIZE, fp)) return 0;

  int num;
  sscanf(line, "%d", &num);
  int *arr = malloc(sizeof(int)*num);
  int i, j;

  if(!fgets(line, BUF_SIZE, fp)) return 0;
  char* tmpbuf = line;
  for(i = 0; i < num; i++) {

    char *tmp = strtok(tmpbuf, " ");
    arr[i] = strtol(tmp, NULL, 10);
    tmpbuf = NULL;
  }

  int sum = 0;
  for(i = 0; i < num; i++) {
    for(j = i+1; j < num; j++) {
      sum += arr[i]*arr[j];
    }
  }

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

Measured memory_bytes: 128
#include <bits/stdc++.h>
#include <iostream>
using namespace  std;
const int N=1E5+5;

int main() {
string s;
cin>>s;
if(s[2]==s[3] && s[4]==s[5])
{
    cout<<"Yes";
}
else cout<<"No";
    return 0;
}

Measured memory_bytes: 384
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

//using
using VI = vector<int>;
using VVI = vector<VI>;
using VS = vector<string>;
using PII = pair<int, int>;
using LL = long long;

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

//constant
const int INF = 1 << 29;
const double EPS = 1e-10;
const double PI = acos(-1.0);

//debug
#define dump(x)  cout << #x << " = " << (x) << endl;

int main() {
  int N;
  cin >> N;
  VI A(N);
  VI B(N);
  REP(i, N) cin >> A[i] >> B[i];
  auto max_it = max_element(A.begin(), A.end());
  size_t index = distance(A.begin(), max_it);
  cout << A[index] + B[index] << endl;
  return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define PB push_back

constexpr int kP = 200003, kMod = 998244353, sz = 1 << 19;
const double pi = acos(-1);
typedef complex<double> cp;
const int maxn = sz;
struct FFT {
  int n, rev[maxn];
  cp omega[maxn], iomega[maxn];
  void init(int n) {
    this->n = n;
    for (int i = 0; i < n; i++) {
      omega[i] = cp(
        cos(2 * pi / n * i), sin(2 * pi / n * i));
      iomega[i] = conj(omega[i]);
    }
    int k = log2(n);
    for (int i = 0; i < n; i++) {
      int t = 0;
      for (int j = 0; j < k; j++)
        if (i & (1 << j)) t |= (1 << (k - j - 1));
      rev[i] = t;
    }
  }
  void transform(vector<cp>& a, cp* omega) {
    for (int i = 0; i < n; i++)
      if (i < rev[i]) swap(a[i], a[rev[i]]);
    for (int len = 2; len <= n; len <<= 1) {
      int mid = len >> 1;
      int r = n / len;
      for (int j = 0; j < n; j += len)
        for (int i = 0; i < mid; i++) {
          cp t = omega[r * i] * a[j + mid + i];
          a[j + mid + i] = a[j + i] - t;
          a[j + i] += t;
        }
    }
  }
  void fft(vector<cp>& a) { transform(a, omega); }
  void ifft(vector<cp>& a) {
    transform(a, iomega);
    for (int i = 0; i < n; i++) a[i] /= n;
  }
};
vector<ll> mul(vector<ll> a, vector<ll> b) {
  int n = sz;
  vector<cp> tmp_a(n), tmp_b(n);
  for (int i = 0; i < sz; i++)
    tmp_a[i] = cp(a[i], 0);
  for (int i = 0; i < sz; i++)
    tmp_b[i] = cp(b[i], 0);
  FFT solver;
  solver.init(n);
  solver.fft(tmp_a), solver.fft(tmp_b);
  for (int i = 0; i < n; i++) tmp_a[i] *= tmp_b[i];
  solver.ifft(tmp_a);
  vector<ll> ans(n);
  for (int i = 0; i < n; i++)
    ans[i] = round(tmp_a[i].real());
  return ans;
}


ll Pow(ll a, ll b) {
	ll ans = 1;
	while (b) {
		if (b & 1) ans = ans * a % kMod;
		a = a * a % kMod;
		b >>= 1;
	}
	return ans;
}
ll Rev(ll n) {return Pow(n, kMod - 2);}

int a[kP], seq[kP], idx[kP];
vector<ll> A(sz, 0);

int main() {
	int n; 
	ll ans = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	for (int i = 1; i <= n; i++) if (a[i] == 0) swap(a[i], a[n--]);
	seq[0] = 1;
	seq[1] = 5;
	for (int i = 2; i < kP - 1; i++) seq[i] = seq[i - 1] * 5 % kP;
	for (int i = 0; i < kP - 1; i++) idx[seq[i]] = i; 
	for (int i = 1; i <= n; i++) A[idx[a[i]]]++;
	A = mul(A, A);
	for (int i = 0; i < sz; i++) ans += A[i] * seq[i % (kP - 1)];
	for (int i = 1; i <= n; i++) ans -= seq[(idx[a[i]] << 1) % (kP - 1)];
	printf("%lld\n", ans >> 1);
}



Measured memory_bytes: 57244
#include<bits/stdc++.h>
using namespace std;
int main(){
int s;cin>>s;
  vector<int> v;
  int t=0;
  while(true){
   if(count(v.begin(),v.end(),s)!=0){
   cout<<t+1;
     break;
   }
   v.push_back(s);
    t++;
  if(s%2==0)
    s=s/2;
  else
    s=3*s+1;
  
  }
}

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

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
const ull mod = 1e9 + 7;
#define REP(i,n) for(int i=0;i<(int)n;++i)

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

template < typename T >
void vprint(T &v){
	REP(i, v.size()){
		cout << v[i] << " ";
	}
	cout << endl;
}

int main(){
	ll N;
	cin >> N;
	ll i = 0;
	ll j = N;
	cout << 0 << endl;
	string ival;
	cin >> ival;
	if(ival=="Vacant"){
		return 0;
	}
	string jval = ival;

	while(1){
		/*
		dump(i)
		dump(ival)
		dump(j)
		dump(jval)
		*/
		ll m = (i+j)/2;
		cout << m << endl;
		string mval;
		cin >> mval;
		if(mval=="Vacant"){
			return 0;
		}
		bool flag1 = ((m-i)%2==1);
		bool flag2 = (ival==mval);
		if((flag1&&flag2)||(!flag1&&!flag2)){
			j = m;
			jval = mval;
		}else{
			i = m;
			ival = mval;
		}
	}
    return 0;
}

Measured memory_bytes: 852
//minmax.cpp
#include<iostream>
using namespace std;
int main(){

	int i,num,tmp,min=1000000,max=-1000000;

        long sum=0;
	
	cin>> num;

	for(i=0;i<num;i++){
		cin>>tmp; 
		if(min>tmp){
			min=tmp;
		}
		if(max<tmp){
			max=tmp;
		}
		sum = sum + tmp;
	}
	
	cout<<min<<" "<<max<<" "<<sum<<endl;
}


Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define inf 1e12+1
typedef long long int ll;
typedef pair<ll,ll> mypair;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){

	ll v,e;
	cin>>v>>e;
	vector<vector<mypair> > g(v);
	vector<vector<ll> > dp(v,vector<ll>(v,inf) );
	ll s,t,d;
	rep(i,e){
	       	cin>>s>>t>>d,g[s].push_back(mypair(t,d) );
		dp[s][t]  = d;
	}
	rep(i,v)dp[i][i]=0;
	rep(k,v)rep(i,v)rep(j,v)if(dp[i][k]!=inf&dp[k][j]!=inf)dp[i][j] = min(dp[i][j],dp[i][k]+dp[k][j]);
	bool flag =false;
	rep(i,v)if(dp[i][i]!=0)flag = true;
	if(flag){
	cout<<"NEGATIVE CYCLE"<<endl;
	}else{
	rep(i,v){
	rep(j,v){
	if(dp[i][j]==inf)cout<<"INF";
	else cout<<dp[i][j];
	if(j==v-1){}
	else cout<<' ';
	}
	cout<<endl;
	}
	}
		
	

	return 0;
}







Measured memory_bytes: 3288
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <array>

using namespace std;

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

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

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

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

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(void) {

	int A, B, C;
	cin >> A >> B >> C;
	if (A <= C && C <= B) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> Point;
int N, a[101], b[101], c[101], d[101], B[101], vis[101];
vector<int> adj[101];

int dfs(int cur){
    if(vis[cur])    return 0;
    vis[cur] = 1;
    for(auto &next : adj[cur]){
        if(B[next] == -1 || dfs(B[next])){
            B[next] = cur;
            return 1;
        }
    }
    return 0;
}

int main(){
    memset(B, -1 ,sizeof(B));
    scanf("%d", &N);
    for(int i = 1; i <= N; i++){
        scanf("%d %d", a + i, b + i);
    }
    for(int i = 1; i <= N; i++){
        scanf("%d %d", c + i, d + i);
    }
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            if(a[i] < c[j] && b[i] < d[j])
                adj[i].push_back(j);
        }
    }
    int match = 0;
    for(int i = 1; i <= N; i++){
        memset(vis, 0, sizeof(vis));
        match += dfs(i);
    }
    printf("%d\n", match);
    return 0;
}

Measured memory_bytes: 256
#define R(x)if(r>x)r=x;
main(r,D,t,a,b,c,d,e,A,B,C){for(;scanf("%d%d%d%d%d%d%d%d",&a,&b,&c,&d,&e,&A,&B,&C)>7;printf("%d\n",r)){
	if(C>=d)r=a*A+b*B+e*C;
	else{
		r=a*A+b*B+c*C;
		D=d,d-=C,t=B<d?B:d,B-=t,d-=t,t=A<d?A:d,A-=t,d-=t;
		R(a*A+b*B+e*D)
	}
}exit(0);}

Measured memory_bytes: 600
#include<iostream>
#include <algorithm>
#include <string>
using namespace std;
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(int)(n); i++)
typedef long long ll;
const int INF = numeric_limits<int>::max();
const int MOD = (1e9 + 7);

int main(){
  ll N, K, a, b, tmp=0;
  cin >> N >> K;
  ll cnt[100001] = {0};
  rep(i, N){
    cin >> a >> b;
    cnt[a] += b;
  }
  rep(i, 100001){
    tmp += cnt[i];
    if(tmp >= K){
      cout << i << endl;
      break;
    }
  }
  
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <iomanip>
#include <stack>
#include <queue>
#include <numeric>
#include <map>
#include <unordered_map>
#include <set>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
#define mod 1000000007
using ll = long long;
using namespace std;

int main(){
  int N;
  cin >> N;
  char c;
  rep(i,N){
    cin >> c;
    if(c=='Y'){
      cout << "Four" << endl;
      return 0;
    }
  }
  cout << "Three" << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x,y;
    while(1){
        cin>>x>>y;
        if(x==0&&y==0){
            break;
        }
        else if(x>y){
            cout<<y<<" "<<x<<endl;
        }
        else{
            cout<<x<<" "<<y<<endl;
        }
    }
    return 0;
}


Measured memory_bytes: 2984
#include<iostream>
#include<cstdio>
#include<stack>
#include<string>
#include<sstream>
using namespace std;

stack<double> v;
string str;
int main(void){
    while(getline(cin,str)){
        stringstream ss(str);
        string num;
        while(ss >> num){
            if(num=="*"){
                double a=v.top();
                v.pop();
                double b=v.top();
                v.pop();
                v.push(a*b);
            }
            else if(num=="/"){
                double a=v.top();
                v.pop();
                double b=v.top();
                v.pop();
                v.push(b/a);
            }
            else if(num=="+"){
                double a=v.top();
                v.pop();
                double b=v.top();
                v.pop();
                v.push(a+b);
            }
            else if(num=="-"){
                double a=v.top();
                v.pop();
                double b=v.top();
                v.pop();
                v.push(b-a);
            }else{
                double c;
                stringstream numc;
                numc << num;
                numc >> c;
                v.push(c);
            }
        }
        double a=v.top();
        printf("%0.7f\n",a);
        v.pop();
    }
    return 0;
}

Measured memory_bytes: 1304