akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bits/stdc++.h>
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <iterator>
#include <type_traits>
#include <vector>

// lib/pow2.hpp
#ifndef POW2_HPP
#define POW2_HPP

/*
usage:

tools::pow2(5) => 32
*/


namespace tools {
  template <typename T, typename std::enable_if<std::is_unsigned<T>::value, std::nullptr_t>::type = nullptr>
  constexpr T pow2(const T x) {
    return static_cast<T>(1) << x;
  }

  template <typename T, typename std::enable_if<std::is_signed<T>::value, std::nullptr_t>::type = nullptr>
  constexpr T pow2(const T x) {
    return static_cast<T>(static_cast<typename std::make_unsigned<T>::type>(1) << static_cast<typename std::make_unsigned<T>::type>(x));
  }
}

#endif

// lib/util.hpp
#ifndef UTIL_HPP
#define UTIL_HPP


typedef ::std::int_fast64_t i64;
typedef ::std::uint_fast64_t u64;
typedef ::std::int_fast32_t i32;
typedef ::std::uint_fast32_t u32;

namespace tools {
  template <typename T>
  void read(::std::istream& is, ::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    vector.reserve(size);
    ::std::copy_n(::std::istream_iterator<T>(is), size, ::std::back_inserter(vector));
  }
  template <typename T>
  void read(::std::vector<T>& vector, const typename ::std::vector<T>::size_type size) {
    ::tools::read(::std::cin, vector, size);
  }

  template <typename T, ::std::size_t N>
  void read(::std::istream& is, ::std::array<T, N>& array) {
    ::std::copy_n(std::istream_iterator<T>(is), N, array.begin());
  }
  template <typename T, ::std::size_t N>
  void read(::std::array<T, N>& array) {
    ::tools::read(::std::cin, array);
  }
}

#endif

// main.cpp

int main() {
  i64 N;
  std::cin >> N;
  std::vector<i64> D;
  tools::read(D, N);

  std::array<i64, 13> occurrences;
  std::fill(occurrences.begin(), occurrences.end(), 0);
  for (const i64& D_i : D) {
    ++occurrences[D_i];
  }

  if (occurrences[0] >= 1 || occurrences[12] >= 2 || std::any_of(occurrences.begin() + 1, occurrences.begin() + 12, [](const i64& occurrence) {
    return occurrence >= 3;
  })) {
    std::cout << 0 << std::endl;
    return 0;
  }

  std::set<i64> time({0});
  if (occurrences[12] == 1) time.insert(12);
  for (i64 i = 1; i <= 11; ++i) {
    if (occurrences[i] == 2) {
      time.insert(i);
      time.insert(24 - i);
    }
  }

  std::vector<i64> unique;
  for (i64 i = 1; i <= 11; ++i) {
    if (occurrences[i] == 1) {
      unique.push_back(i);
    }
  }

  i64 answer = std::numeric_limits<i64>::min();
  for (i64 state = 0; state < tools::pow2<i64>(unique.size()); ++state) {
    std::set<i64> buffer = time;
    for (i64 i = 0; i < static_cast<i64>(unique.size()); ++i) {
      buffer.insert(((state >> i) & 1) == 0 ? unique[i] : 24 - unique[i]);
    }
    i64 possible_answer = 24 - *buffer.rbegin();
    for (auto prev_it = buffer.begin(), it = ++buffer.begin(); it != buffer.end(); prev_it = it, ++it) {
      possible_answer = std::min(possible_answer, *it - *prev_it);
    }
    answer = std::max(answer, possible_answer);
  }
  std::cout << answer << std::endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define ld long double
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define mod 1000000007
using namespace std;

int dp[100002];
int n;
vector<int> a;

int fun(int k){
	if(dp[k]!=-1)
		return dp[k];
	int mx = 0;
	for(int i=0;i<n;++i){
		if(k-a[i]<0)
			continue;
		mx = max(mx,(1+fun(k-a[i]))%2);
	}
	return dp[k]=mx;
}

int main(){
	ios_base::sync_with_stdio(false); 
	cin.tie(NULL);cout.tie(NULL);
	int k;
	cin>>n>>k;
	a.resize(n);
	memset(dp,-1,sizeof dp);
	for (int i = 0; i < n; ++i)
	{
		cin>>a[i];
	}
	if(fun(k))
		cout<<"First";
	else
		cout<<"Second";
	// cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
	return 0;
}

Measured memory_bytes: 5376
import java.util.Scanner;

public class Main {
	void run() {
		Scanner scan = new Scanner(System.in);
		double a = scan.nextDouble();
		double b = scan.nextDouble();
		double c = scan.nextDouble();
		double s = 0.5 * a * b * Math.sin(Math.toRadians(c));
		double l = a + b + Math.sqrt((a*a) + (b*b) - (2*a*b*Math.cos(Math.toRadians(c))));
		double h = b * Math.sin(Math.toRadians(c));
		System.out.printf("%f %f %f", s, l, h);
	}
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 28328
// C - Lower
#include <bits/stdc++.h>
using namespace std;

int main(){
	int N; cin>>N;
	int ans = 0;
	int count = 0;
	int pre = 0, now;
	while(N--){
		cin>>now;
		ans = max(ans, (count = pre>=now? count+1: 0));
		pre = now;
	}
	cout<< ans <<endl;
}

Measured memory_bytes: 256
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

count = 0
loc = 0
locs = {0: 0}
ini = 0

while True:
    count += 1
    loc = a[loc] - 1
    
    if count == k:
        break
    if loc in locs:
        ini = locs.get(loc)
        break
    locs[loc] = count

if count != k:
    rest = int((k - ini) % (count - ini))
    if rest <= 0:
        print(loc + 1)
    else:
        d = 0
        while True:
            d += 1
            loc = a[loc] - 1
            if d == rest:
                print(loc + 1)
                break
else:
    print(loc + 1)



Measured memory_bytes: 110868
#include<bits/stdc++.h>
using namespace std;
int main(){
        vector<int> al(26,0);
        string w;
        cin>>w;
        for(int i=0; i<w.size(); i++)
                al[w[i]-'a']++;
        for(auto x:al){
                if(x%2!=0){
                        cout<<"No";
                        return 0;
                }
        }
        cout<<"Yes";
}

Measured memory_bytes: 256
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    a = [int(i) for i in input().split()]
    b = []

    for i in a:
        if i in b:
            b.remove(i)
        else:
            b.append(i)
    print(b[0])

Measured memory_bytes: 3828
// Knock, Knock. Tera baap aaya
#include <bits/stdc++.h>
#define int long long
#define sz(x) (int)(x.size())
using namespace std;

int32_t main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);  

    int ans = 0;
    int k;	cin >> k;
    for(int i = 1; i <= k; i++)
    	for(int j = 1; j <= k; j++)
    		for(int l = 1; l <= k; l++)
    			ans += __gcd(i, __gcd(j, l));
    		cout << ans;
}


Measured memory_bytes: 3640
import java.util.*;

class Main{
	public static void main(String[] $){
		System.err.println();
		Scanner s=new Scanner(System.in);
		//int n=s.nextInt();
		char[]c=s.next().toCharArray();
		Arrays.sort(c);
		System.out.println(c[0]==c[1]&&c[2]==c[3]&&c[1]!=c[2]?"Yes":"No");
	}
}


Measured memory_bytes: 22228
#include <stdio.h>

int f(int a, int b, int n);

int main(int argc, const char *argv[])
{
	int a, b, n;
	while(scanf("%d%d%d", &a, &b, &n)!=EOF)
		printf("%d\n", f(a, b, n));	
	return 0;
}

int f(int a, int b, int n)
{
	int i, s = 0, tmp = a%b*10;
	for(i=0; i<n; i++){
		s += tmp/b;
		tmp = tmp%b*10;
	}
	
	return s;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int main() {
	LL n;
	cin >> n;
	
	inc1(i, 3500) {
	inc1(j, 3500) {
		LL d = (4 * i * j - n * (i + j));
		if(d != 0) {
			LL m = n * i * j % d;
			LL k = n * i * j / d;
			if(m == 0 && k > 0) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}
		}
	}
	}
	assert(false);
}


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

class Main {
    public static void main(String args[]) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        Long n = Long.parseLong(br.readLine());
        long res = 1 + (n>2?1:0);
        for(long i = 2;i*i <= n; ++i){
            long t = n;
            long mod = t%i;
            if(mod==0){
                while(t%i==0){
                    t/=i;
                }
                if(t==1 || t%i==1)
                    res++;
            }
            else if(mod==1) {
                res += 1 + (i*i!=n-1?1:0);
            }
        }
        System.out.println(res);
        
    }
}


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

int main(void) {
    int n, dn, tmp, ans=0;
    cin >> n;
    for (int i = 1; i <= n; i++ ) {
        tmp = i;
        dn = 1;
        while (tmp/=10) dn++;
        if (dn%2) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import stdin
from collections import deque
def main():
    #入力
    readline=stdin.readline
    k=int(readline())

    lunlun_number=[]
    d=deque(map(str,range(1,10)))
    cnt=0
    while cnt<k:
        now=d.popleft()
        lunlun_number.append(now)
        cnt+=1
        if now[-1]=="0":
            nex=("0","1")
        elif now[-1]=="9":
            nex=("8","9")
        else:
            last=int(now[-1])
            nex=(str(last-1),str(last),str(last+1))
        for x in nex:
            d.append(now+x)

    print(lunlun_number[k-1])

if __name__=="__main__":
    main()

Measured memory_bytes: 29688
import java.io.IOException;
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

	static int[][] map;
	static int[][] directions8= {{-1,-1},{-1,0},{-1,1},{0,-1},{0,1},{1,-1},{1,0},{1,1}};
	static int[][] directions4= {{-1,0},{1,0},{0,-1},{0,1}};
	static long  ans;
	static int[] parent;//union-find用
	static int[] rank;//union-find用
	static int mod = 1000000007;

	public static void main(String[] args) throws IOException {

		Scanner sc = new Scanner(System.in);
		long N = sc.nextInt();
		long all = 1;
		long no09 = 1;
		long no0 = 1;
		for(long i = 0;i<N ; i++) {
			all*=10;
			no0 *= 9;
			no09*=8;
			all%=1000000007;
			no0 %= 1000000007;
			no09%=1000000007;
		}
		no0 = (no0*2)%1000000007;
		ans = all - no0;
		ans %=1000000007;
		ans += no09;
		ans %=1000000007;
		ans=(ans+mod)%mod;

		System.out.println(ans);
	}

	//素数判定
	public static boolean isPrime(long num) {
		if (num < 2) return false;
		else if (num == 2) return true;
		else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

		double sqrtNum = Math.sqrt(num);
		for (int i = 3; i <= sqrtNum; i += 2)
		{
			if (num % i == 0)
			{
				// 素数ではない
				return false;
			}
		}

		// 素数である
		return true;
	}

	//BFS用に二つの配列を足し算する
	static int[] addArrayElms(int[] a, int[] b) {
		int[] c = new int[a.length];
		for(int i = 0; i < a.length; i++) {
			c[i] = a[i] + b[i];
		}
		return c;
	}

	//	//二分探索
	//k <= num となる最小の配列要素kのインデックスを返す
	static private int binarySearch(long num, long[] orderedArray){
		int lowerBorder = -1;
		int upperBorder = orderedArray.length;
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedArray[mid]<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//二分探索
	//k <= num となる最小のList要素kのインデックスを返す
	static private int binarySearch(long num, ArrayList<Long> orderedList){
		int lowerBorder = -1;
		int upperBorder = orderedList.size();
		int mid;

		while(upperBorder - lowerBorder >1) {
			mid = (upperBorder + lowerBorder)/2;
			if(orderedList.get(mid)<=num) {
				lowerBorder = mid;
			}else {
				upperBorder = mid;
			}
		}
		return lowerBorder;
	}

	//aとbの最小公倍数を求める
	public static int gcd(int a, int b) {
		return b == 0 ? a: gcd(b, a % b);
	}
	public static long gcd(long a, long b) {
		return b == 0 ? a: gcd(b, a % b);
	}

	//Union-Find用の配列を要素数nで初期化
	static void ufInit(int n){
		parent = new int[n];
		rank = new int[n];
	}

	//Union-Findの要素の最上位の親（グループ名）を返す
	static int ufFind(int a) {
		if(parent[a]==a) {
			return a;
		}else {
			return ufFind(parent[a]);
		}
	}

	//Union-Find木を連結する
	static void ufUnite(int a, int b) {
		a = parent[a];
		b = parent[b];

		if(a==b) {
			return;
		}
		if(rank[a] > rank[b]){
			parent[b]=a;
		}else {
			parent[a]=b;
			if(rank[a]==rank[b]) {
				rank[b]++;
			}
		}
	}

	static boolean ufSame(int a, int b) {
		return ufFind(a)==ufFind(b);
	}
}


Measured memory_bytes: 35660
# AOJ 0130 Train
# Python3 2018.6.19 bal4u

for _ in range(int(input())):
	s = list(input())
	ans = []
	dir = '>'
	for i in range(len(s)):
		if s[i].isalpha():
			if dir == '>':
				if s[i] not in ans: ans.append(s[i])
			else:
				if s[i] not in ans: ans.insert(0, s[i])
		elif s[i] == '>' or s[i] == '<': dir = s[i]
	print(*ans, sep='')


Measured memory_bytes: 5632
#include<bits/stdc++.h>
using namespace std;
int h,w,n,cou;
set<pair<int,int> > s;
long long grid[12];

int main()
{
	int a,i,j;
	int r,c;
	
	scanf("%d %d %d",&h,&w,&n);
	int ha = h-2,wa = w-2;
	grid[0] = ((long long)ha * (long long)wa );
	for(a=1;a<=n;a++)
	{
		scanf("%d %d",&r,&c);
		if(r+2<=h && c-2>=1) //downleft
		{
			cou = 0;
			for(i=r;i<=r+2;i++)
				for(j=c-2;j<=c;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r-2>=1 && c-2>=1) //topleft
		{
			cou = 0;
			for(i=r-2;i<=r;i++)
				for(j=c-2;j<=c;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r-2>=1 && c+2<=w) //topright
		{
			cou = 0;
			for(i=r-2;i<=r;i++)
				for(j=c;j<=c+2;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r+2<=h && c+2<=w) //downright
		{
			cou = 0;
			for(i=r;i<=r+2;i++)
				for(j=c;j<=c+2;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(c-2>=1 && r-1>=1 && r+1<=h) //left
		{
			cou = 0;
			for(i=r-1;i<=r+1;i++)
				for(j=c-2;j<=c;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r-2>=1 && c-1>=1 && c+1<=w) //top
		{
			cou = 0;
			for(i=r-2;i<=r;i++)
				for(j=c-1;j<=c+1;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(c+2<=w && r-1>=1 && r+1<=h) //right
		{
			cou = 0;
			for(i=r-1;i<=r+1;i++)
				for(j=c;j<=c+2;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r+2<=h && c-1>=1 && c+1<=w) //down
		{
			cou = 0;
			for(i=r;i<=r+2;i++)
				for(j=c-1;j<=c+1;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		if(r-1>=1 && c-1>=1 && r+1<=h && c+1<=w) //center
		{
			cou = 0;
			for(i=r-1;i<=r+1;i++)
				for(j=c-1;j<=c+1;j++)
					if( s.count({i,j}) ) cou++;
			grid[cou]--; grid[cou+1]++;
		}
		
		s.insert({r,c});
	}
	
	for(i=0;i<=9;i++)
	{
		printf("%lld\n",grid[i]);
	}
}

Measured memory_bytes: 8520
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce
import pprint
sys.setrecursionlimit(10 ** 9)


INF = 10 ** 20
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


a, b, m = LI()
A = LI()
B = LI()
ret = min(A) + min(B)
for i in range(m):
    x, y, c = LI()
    ret = min(A[x -1]+B[y-1]-c, ret)


print(ret)


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

int main() {
  int N, Y=0;
  string C;
  
  cin >> N;
  for (int i; i < N; i++) {
    cin >> C;
    if (C == "Y")
      Y++;
  }
  
  if (Y > 0)
    cout << "Four" << endl;
  else
    cout << "Three" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<string>
#include<bitset>
using namespace std;
#define ll long long
const ll INF = 1LL << 60;

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

class UnionFind {
	vector<int> data;
public:
	UnionFind(int size) : data(size, -1) { }
	bool unionSet(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool findSet(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
};

//input
ll N,M,L;
string S;
int main() {
	int N;
	int H[110];
	cin >> N;
	for (int i = 0; i < N; i++) cin >> H[i];
	int ans = 0;
	int max = 0;
	for (int i = 0; i < N ;i++) {
		if (H[i] >= max) {
			max = H[i];
			ans++;
		}
	}
	cout << ans;
	return 0;
}

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

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

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

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

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

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

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

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

fn main() {
    input!{
        bells: [u64; 3],
    }
    let mut bells = bells;
    bells.sort();
    println!(
        "{}",
        bells[0] + bells[1]
    );
}


Measured memory_bytes: 4352
#include <cstdio>
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>

using namespace std;
int main(){
	int r,d,x_2000;

	scanf("%d %d %d",&r,&d,&x_2000);

	for(int i=0;i<10;i++){
		x_2000=r*x_2000-d;
		cout<<x_2000<<endl;
	}

	return 0;
}

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

using namespace std;


const int ms = 1e5 + 17;
long long a[ms], b[ms];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);


    long long n, h;
    cin >> n >> h;

    long long mx = 0;
    long long sum = 0;

    for(int i = 1; i <= n; ++i)
    {
        cin >> a[i] >> b[i];

        mx = max(a[i], mx);
        sum += b[i];
    }

    sort(b + 1, b + n + 1);

    long long amount = 1e15;

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

    for(int i = n; i >= 1; --i)
    {
        long long ta = n - i + 1ll;

        int temp = h - b[i];
        if(temp > 0)
        {
            int val = temp / mx;

            if(temp % mx == 0)
                ta += val;
            else
                ta += val + 1;
        }

        amount = min(ta, amount);

    }

   cout << amount << '\n';


}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FOR_IN(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)

// 可変引数で最大公約数を求める関数
// コンパイルオプションに"-std=c++17"を追加
template <class T>
T vgcd(T m, T n) {
  return std::gcd(m, n);
}

template <class T, class... Args>
T vgcd(T a, Args... args) {
  return vgcd(a, vgcd(args...));
}

int main(void){
    int K;
    cin >> K;
    ll ans = 0;
    FOR_IN(i,1,K){
        FOR_IN(j,1,K){
            FOR_IN(k,1,K){
                ans += vgcd(i,j,k);
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
h, w = map(int, input().split())
S = [list(input()) for i in range(h)]

ans = 0

for i in range(h):
    for j in range(w):
        if S[i][j] == '.':
            d = [[-1 for i in range(w)] for j in range(h)]
            que = []
            que.append([i, j])
            d[i][j] = 0

            while len(que) != 0:
                p = que.pop(0)
                for dx, dy in zip((1, 0, -1, 0), (0, 1, 0, -1)):
                    nx = p[0] + dx
                    ny = p[1] + dy
                    if 0 <= nx < h and 0 <= ny < w and S[nx][ny] != '#' and d[nx][ny] == -1:
                        que.append([nx, ny])
                        d[nx][ny] = d[p[0]][p[1]] + 1

            for _ in d:
                ans = max(ans, max(_))

print(ans)


Measured memory_bytes: 3188
import java.util.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args){
    Scanner sc = new Scanner(in);
    long x = sc.nextLong();
	 	long y = sc.nextLong();
		long cnt = 0;

		while (x <= y) {
			x *= 2;
			cnt++;
		}

		out.println(cnt);
	}
}


Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int sum = 0;
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int[] T = new int[N];
		for(int i = 0; i < N; i++) {
			T[i] = scan.nextInt();
		}
		int M = scan.nextInt();
		int[] P = new int[M];
		int[] X = new int[M];
		for(int i = 0; i < M; i++) {
			P[i] = scan.nextInt();
			X[i] = scan.nextInt();
		}
		for(int i = 0; i < M; i++) {
			for(int j = 0; j < N; j++) {
				if(P[i] - 1 == j) {
					sum += X[i];
				} else {
					sum += T[j];
				}
			}
			System.out.println(sum);
			sum = 0;
		}
		scan.close();
	}

}


Measured memory_bytes: 21716
n,k=map(int,input().split())
a=list(map(int,input().split()))
t,ans=2**40,0
while t:
	c=sum([(a[i]&t)//t for i in range(n)])
	if k<t or c*2>=n:
		ans+=t*c
	else:
		ans+=t*(n-c)
		k -= t
	t //= 2
print(ans)

Measured memory_bytes: 14620
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    pn, cn = map(int, input().split())
    st = [[set(), set()] for _ in range(cn)]
    # 同じチャンネルの連続した番組を結合
    for _ in range(pn):
        s, t, c = map(int, input().split())
        c -= 1
        if s in st[c][1]:
            st[c][1].remove(s)
            if t in st[c][0]:
                st[c][0].remove(t)
            else:
                st[c][1].add(t)
        elif t in st[c][0]:
            st[c][0].remove(t)
            st[c][0].add(s)
        else:
            st[c][0].add(s)
            st[c][1].add(t)
    #print(st)
    # 座標圧縮
    tt = set()
    for c_st in st:
        for s in c_st[0]:
            tt.add(s)
        for t in c_st[1]:
            tt.add(t)
    tn = len(tt)
    ttoi = {}
    for i, t in enumerate(sorted(tt)):
        ttoi[t] = i
    #print(ttoi)
    # imos法のためにチャンネル数の増減をcntに入力
    cnt = [0] * (tn + 1)
    for c_st in st:
        for s in c_st[0]:
            i = ttoi[s]
            cnt[i] += 1
        for t in c_st[1]:
            i = ttoi[t]
            cnt[i + 1] -= 1
    #print(cnt)
    # 累積和をとって最大のチャンネル数を取得
    ans = 0
    for i in range(tn):
        cnt[i + 1] += cnt[i]
        ans = max(ans, cnt[i + 1])
    #print(cnt)
    print(ans)

main()


Measured memory_bytes: 37428
l=gets.to_i

way=1
v_num=1
ans=[]
while 2*way<=l
  v_num+=1
  ans << [v_num-1,v_num,0]
  ans << [v_num-1,v_num,way]
  way*=2
end

rest=l-way
until rest==0
  pow=1
  i=1
  while 2*pow<=rest
    i+=1
    pow*=2
  end
  ans << [i,v_num,way]
  way+=pow
  rest-=pow
end

puts [v_num,ans.size]*" "
ans.each{|seq|puts seq*" "}

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

const int maxn = 100 + 7;
const int mod = 1e9 + 7;

int h[maxn];

long long power(int x, int times) { 
    long long rt = 1, base = x;
    while (times) {
        if (times & 1) rt = rt * base % mod;
        base = base * base % mod;
        times >>= 1;
    }
    return rt;
}

int dp1(int x, int y, int level) {
    static bool vis[maxn][maxn];
    static int f[maxn][maxn];
    if (vis[x][y]) return f[x][y];
    vis[x][y] = true;

    int MIN = h[x];

    long long cnt1 = 1;
    for (int i = x; i <= y; i++) {
        MIN = min(MIN, h[i]);
    }

    for (int i = x; i <= y; i++) 
        if (h[i] != MIN) {
            int j = i;
            while (j <= y && h[j] != MIN) j++;
            j--;
            cnt1 = cnt1 * dp1(i, j, MIN) % mod;
            i = j;
        }
    cnt1 = cnt1 * power(2, MIN - level) % mod;
    //cout << x << ' ' << y << ' ' << level << ' ' << cnt1 << endl;
    return f[x][y] = cnt1;
}

int dp2(int x, int y, int level) {
    static bool vis[maxn][maxn];
    static int f[maxn][maxn];
    if (vis[x][y]) return f[x][y];
    vis[x][y] = true;

    int MIN = h[x], k = 0;

    long long cnt1 = 1, cnt2 = 1;
    for (int i = x; i <= y; i++) {
        MIN = min(MIN, h[i]);
    }

    for (int i = x; i <= y; i++) 
        if (h[i] != MIN) {
            int j = i;
            while (j <= y && h[j] != MIN) j++;
            j--;
            cnt1 = cnt1 * dp1(i, j, MIN) % mod;
            cnt2 = cnt2 * (dp1(i, j, MIN) + dp2(i, j, MIN)) % mod;
            i = j;
        }
        else {
            k++;
        }
    // cout << cnt1 << ' ' << cnt2 << endl;
    int &rt = f[x][y];
    rt = ((cnt2 * power(2, k) % mod + cnt1 * (power(2, MIN - level) - 2) % mod) % mod + mod) % mod;
    // cout << cnt1 * (power(2, MIN - level) - 2) % mod << endl;
    // cout << cnt2 * power(2, k) % mod << endl;
    // cout << endl;
    
    // cout << x << ' ' << y << ' ' << level << ' ' << rt << endl;
    // cout << cnt1 << ' ' << cnt2 << ' ' << k << ' ' << MIN << endl;   
    return rt;
}

int main() {
    int n;
    scanf("%d", &n);
    

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

    cout << dp2(1, n, 0) << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <list>
#include <vector>
static const int MAXN = 1e5 + 4;

int n, m;
std::vector<int> e[MAXN];

bool vis[MAXN] = { false };
std::list<int> route;
bool append_mode = false;   // false = push_front, true = push_back
void dfs(int u)
{
    vis[u] = true;
    for (int v : e[u]) if (!vis[v]) {
        if (append_mode) route.push_back(v); else route.push_front(v);
        dfs(v); break;
    }
}

int main()
{
    scanf("%d%d", &n, &m);
    int u, v;
    for (int i = 0; i < m; ++i) {
        scanf("%d%d", &u, &v); --u, --v;
        e[u].push_back(v);
        e[v].push_back(u);
    }

    u = 114514 % n;
    route.push_back(u);
    append_mode = false; dfs(u);
    append_mode = true; dfs(u);

    bool first = true;
    printf("%lu\n", route.size());
    for (int u : route) {
        if (first) first = false; else putchar(' ');
        printf("%d", u + 1);
    }
    putchar('\n');
    return 0;
}


Measured memory_bytes: 9472
#include<bits/stdc++.h>
#define int long long
#define REP(i,a,n) for(int i=a;i<(n);i++)
#define RE return
#define FILL(a,b) memset(a,b,sizeof(a))
#define SO(a) sort(all(a))
#define pb push_back
#define sz(a) a.size()
#define V vector
#define ld long double
#define viit(a) vector<int>::iterator a
#define IT iterater
#define FOR(i,a,n) for(int i=a;i<=(n);i++)
#define B(s) s.back()
#define all(a) a.begin(),a.end()
#define ER1(a) a.erase(a.begin())
#define ER0(a) a.erase(a.end())
#define pii pair<int,int>
#define pause system("PAUSE")
#define cls system("CLS")
using namespace std;
int n,k,a[200005];
signed main()
{
    ios::sync_with_stdio(0);
	cin>>n>>k;
	int k2=n-k+1;
	REP(i,0,n)
	cin>>a[i];
	REP(i,0,k2-1){
		if(a[i]<a[i+k])cout<<"Yes\n";
		else cout<<"No\n";
	} 
    return 0;
}


Measured memory_bytes: 5112
#include <bits/stdc++.h>
/*cout<<setprecision(5)<<ret<<endl;で、数字部分を計5桁表示かつゼロ埋め無*/
/*cout<<fixed<<setprecision(5)<<ret<<endlで、小数部のみ5桁表示かつゼロ埋め有*/
using namespace std;

typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
/* [Shift+Command+b]（コンパイル）ー＞[Ctrl+Shift+`]（ターミナル起動）ー＞[./a.out] */

//////////////////
//  A
/*int main(void){
    int a,b,c;cin>>a>>b>>c;
    int d=a-b;
    if(d>c){
        cout<<"0"<<endl;
    }else{
        cout<<c-d<<endl;
    }
    return 0;
}*/
//////////////////
//  B
int main(void){
    int n;cin>>n;
    int cnt=0;
    for(int i=1;i<=n;i++){
        if(to_string(i).length()%2==1)cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}
//////////////////
//  C 
/*int main(void){

    return 0;
}*/
//////////////////
//  D
/*int main(void){

    return 0;
}*/


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

#define int long long

const int N=500005,mod=1000000007;

int n,t[N],Q[N],L[N],R[N],f[N];

vector<int> V[N];

struct node
{
	int b,k;
}p[N];

bool cmp(node x1,node x2)
{
	if(x1.k!=x2.k) return x1.k<x2.k;
	return x1.b<x2.b;
}

int lowbit(int x)
{
	return x&(-x);
}

void update(int x,int k)
{
	++x;
	for(;x<=n+1;x+=lowbit(x)) t[x]=(t[x]+k)%mod;
	return ;
}

int query(int x)
{
	if(x<=0) return 0;
	int res=0;
	for(;x>=1;x-=lowbit(x)) res=(res+t[x])%mod;
	return res;
}

int query(int l,int r)
{
	++l;
	++r;
	return (query(r)-query(l-1)+mod)%mod;
}

signed main()
{
	//freopen("river.in","r",stdin);
	//freopen("river.out","w",stdout);
	ios::sync_with_stdio(false);
	int cnt=0;
	cin>>n;
	for(int i=1;i<=n;i++) cin>>p[i].b>>p[i].k;
	sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;i++)
	{
		if(cnt==0||p[i].b>p[Q[cnt]].b) Q[++cnt]=i;
		int l=1,r=cnt,ans=i;
		while(l<=r)
		{
			int mid=(l+r)/2;
			if(p[Q[mid]].b>p[i].b)
			{
				ans=Q[mid];
				r=mid-1;
			}
			else l=mid+1;
		}
		L[i]=ans;
	}
	cnt=0;
	for(int i=n;i>=1;i--)
	{
		if(cnt==0||p[i].b<p[Q[cnt]].b) Q[++cnt]=i;
		int l=1,r=cnt,ans=i;
		while(l<=r)
		{
			int mid=(l+r)/2;
			if(p[Q[mid]].b<p[i].b)
			{
				ans=Q[mid];
				r=mid-1;
			}
			else l=mid+1;
		}
		R[i]=ans;
	}
	for(int i=1;i<=n;i++) V[R[i]].push_back(L[i]);
	f[0]=1;
	update(0,1);
	for(int i=1;i<=n;i++)
	{
		sort(V[i].begin(),V[i].end());
		for(int j=0;j<V[i].size();j++) 
		{
			int x=query(V[i][j]-1,i);
			f[i]=(f[i]+x)%mod;
			update(i,x);
		}
	}
	cout<<f[n]<<endl;
	return 0;
}


Measured memory_bytes: 41344
#include <stdio.h>

int main(void)
{
	int H, W, i, j;

	while(1) {
		scanf("%d %d", &H, &W);

		if (H == 0 && W == 0) break;

		for (i = 0; i < W; i++) printf("#");
		printf("\n");

		for (i = 0; i < H - 2; i++) {
			printf("#");
			for (j = 0; j < W - 2; j++) {
				printf(".");
			}
			printf("#\n");
		}

		for (i = 0; i < W; i++) printf("#");
		printf("\n\n");
	}

	return 0;
}

Measured memory_bytes: 588
inf = float('inf')
N = int(input())
MRp = -inf
MR = -inf
MRm = -inf
mRp = inf
mR = inf
mRm = inf
MUp = -inf
MU = -inf
MUm = -inf
mUp = inf
mU = inf
mUm = inf

for i in range(N):
	x, y, d = input().split()
	x, y = int(x), int(y)
	if d == 'R':
		MRp = max(MRp, x)
		mRp = min(mRp, x)
		MU = max(MU, y)
		mU = min(mU, y)
	elif d == 'L':
		MRm = max(MRm, x)
		mRm = min(mRm, x)
		MU = max(MU, y)
		mU = min(mU, y)
	elif d == 'U':
		MUp = max(MUp, y)
		mUp = min(mUp, y)
		MR = max(MR, x)
		mR = min(mR, x)
	else:
		MUm = max(MUm, y)
		mUm = min(mUm, y)
		MR = max(MR, x)
		mR = min(mR, x)

t = [0]
if MR > MRp:
	t.append(MR - MRp)
if MRm > MRp:
	t.append((MRm - MRp) / 2)
if MRm > MR:
	t.append(MRm - MR)
if mRm > mR:
	t.append(mRm - mR)
if mRm > mRp:
	t.append((mRm - mRp) / 2)
if mR > mRp:
	t.append(mR - mRp)
if MU > MUp:
	t.append(MU - MUp)
if MUm > MUp:
	t.append((MUm - MUp) / 2)
if MUm > MU:
	t.append(MUm - MU)
if mUm > mU:
	t.append(mUm - mU)
if mUm > mUp:
	t.append((mUm - mUp) / 2)
if mU > mUp:
	t.append(mU - mUp)

ans = inf
for i in t:
	dx = max(MRp + i, MR, MRm - i) - min(mRp + i, mR, mRm - i)
	dy = max(MUp + i, MU, MUm - i) - min(mUp + i, mU, mUm - i)
	ans = min(ans, dx * dy)
print(ans)

Measured memory_bytes: 3192
from sys import stdin
import fractions
from functools import reduce
A,B=[int(x) for x in stdin.readline().rstrip().split()]
data=[int(x) for x in stdin.readline().rstrip().split()]
data=[abs(i-B) for i in data]

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

print(gcd_list(data))

Measured memory_bytes: 16308
/*#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")*/
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;

#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()
#define int long long
typedef long long ll;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;

main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int n, ans = 0, sum = 0;
    cin >> n;
    vector <int> v(n);
    for (auto &it : v) {
        cin >> it;
        sum += it;
    }
    for (auto it : v) {
        ans += (sum - it)  * it;
    }
    cout << ans / 2;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using namespace std;
using vi = vector<int64_t>;
using vvi = vector<vi>;

int main(int argc, const char * argv[]) {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    string s,res;
    cin >> s;
    rep(i,s.size()){
        if(s.at(i)!='B') res.push_back(s.at(i));
        if(s.at(i)=='B' && !res.empty()) res.pop_back();
    }
    cout << res << endl;
}


Measured memory_bytes: 256
N = int(input())
A = [0] * N
B = [0] * N
cnt = 0

for i in range(N):
    A[i], B[i] = map(int, input().split())

for i in range(N - 1, -1, -1):
    A[i] += cnt

    if A[i] == 0:
        continue

    if A[i] > B[i]:
        B[i] = (1 + (A[i] - 1) // B[i]) * B[i]

    cnt += B[i] - A[i]

print(cnt)

Measured memory_bytes: 14836
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define T pair<int, int>
#define ordered_set tree<T, null_type,less<T>, rb_tree_tag,tree_order_statistics_node_update>
#define int long long
#define MOD 1000000007
#define pb push_back 
#define ins insert
#define fast(); ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int m(int a) {
    return ((a%MOD)+MOD)%MOD;
}
int p(int a, int b) {
    if (b==0) return (int)1;
    int x = p(a, b>>1);
    if (b & 1) return m(x*m(a*x));
    return m(x*x);
}
signed main(){
    fast();
    int n, m;
    cin >> n >> m;
    cout << (n*(n-1)+m*(m-1))/2 << endl;
}

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

int main(){
  ll l,r; cin >> l >> r;
  r = min(r, l+4038);
  int mn = 999999999;
  for(ll i = l; i <= r; i++){
    for(ll j = i+1; j <= r; j++){
      int temp = (i*j) % 2019;
      mn = min(mn, temp);
    }
  }
  cout << mn << endl;
  return 0;
}

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

using i64=int64_t;

#define rep(i,x,y) for(i64 i=i64(x),i##_max_for_repmacro=i64(y); i<i##_max_for_repmacro; ++i)
#define debug(x) #x << "=" << (x)
 
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif
 
const int inf=1.01e9;
const i64 inf64=4.01e18;
const double eps=1e-9;
 
template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

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

    vector<int> a(N);
    rep(i,0,N) cin >> a[i];

    sort(rbegin(a),rend(a));

    int alice=0,bob=0;
    rep(i,0,N){
        if(i%2==0) alice+=a[i];
        else bob+=a[i];
    }

    cout << alice-bob << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(16);
    solve();
    return 0;
}


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

using namespace std;

int main() {
  string s, t;
  cin >> s >> t;
  int ss = s.length(), ts = t.length();
  REP(i, ss) {
    REP(j, ts) {
      if (s[i] < t[j]) {
        cout << "Yes" << endl;
        return 0;
      }
    }
  }
  if (ss >= ts) {
    cout << "No" << endl;
    return 0;
  }
  vector<bool> used(ts, false);
  REP(i, ss) {
    bool f = false;
    REP(j, ts) {
      if (!used[j] && s[i] == t[j]) {
        used[j] = true;
        f = true;
        break;
      }
    }
    if (!f) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}


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

void solve(void)
{
    int n;
    cin >> n;

    vector<int> c(n - 1), s(n - 1), f(n - 1);
    rep(i, n - 1) cin >> c[i] >> s[i] >> f[i];
    rep(i, n)
    {
        int time = 0;
        for (int j = i; j < n - 1; ++j)
        {
            if (time < s[j])
                time = s[j];
            else if (time % f[j] != 0)
                time += f[j] - time % f[j];
            time += c[j];
        }
        cout << time << endl;
    }
}
int main(void) { solve(); }


Measured memory_bytes: 3592
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i, c) for(int i=0; i<(int)c; i++)
const ll INF=1000000000000001;

int main() {
	int n,m,k;
	cin>>n>>m>>k;
	vector<ll>a(n);
	vector<ll>b(m);
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<m;i++){
		cin>>b[i];
	}
	ll t=0;
	rep(i,m) t+=b[i];
	int j=m;
	int ans=0;
	rep(i,n+1){
		while(j>0 && t>k){
			--j;
			t-=b[j];
		}
		if(t>k) break;
		ans=max(ans,i+j);
		if(i==n) break;
		t+=a[i];
	}
	cout <<ans << endl;
	return 0;
}


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

int a[50][50];

void dfs(int j,int i){
  
  a[j][i]=0;
for(int k=-1 ; k <= 1 ; k++){
    for(int l=-1 ; l <= 1 ; l++){
      if( l== 0 && k== 0 )continue;
      if( (0 <= j+l && j+l <= 50)&&(0<=i+k && i+k <= 50)){
      if(a[j+l][i+k])dfs(j+l,i+k);
      }
    }
 }
} 
int main(){
  
  int w,h,counter=0;
  
  while(1){
    
    cin >>w>>h;
    
    if( w == 0 && h == 0 )break;
    
    counter=0;
    
    for(int i=0 ; i < h ; i++){
      for(int j=0 ; j < w ; j++){
	cin >>a[j][i];
      }
    }
    
    for(int i=0 ; i < h ; i++){
      for(int j=0 ; j < w ; j++){
	
	if(a[j][i]){
	  dfs(j,i);
	  counter++;
	}
	
      }
    }
    
    cout<<counter<<endl;
    
  }
  
  return 0;
}

Measured memory_bytes: 1312
#include <bits/stdc++.h>
#define fst first
#define snd second
#define fore(i,a,b) for(int i=a,ThxDem=b;i<ThxDem;++i)
#define pb push_back
#define ALL(s) s.begin(),s.end()
#define FIN ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define SZ(s) int(s.size())
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;

int vis[100010];
vector<int> g[100010],a;

int get(int pos){
	int v=a[pos]; vis[pos]=1;
	for(auto x:g[pos]) if(!vis[x]) v+=get(x);
	return v%26;
}

int main(){FIN;
	string s; int q; cin>>s>>q;
	s="a"+s+"a";
	fore(i,1,SZ(s)) a.pb((s[i]-s[i-1]+26)%26);
	int n=SZ(a);
	fore(i,0,n) g[i].pb(n-i-1);
	while(q--){
		int l,r;cin>>l>>r;
		g[l-1].pb(r); g[r].pb(l-1);
	}
	fore(i,0,n) if(!vis[i]&&get(i)) cout << "NO\n",exit(0);
	cout<<"YES\n";
}

Measured memory_bytes: 8808
#include <iostream>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cstring>
#include<cmath>
using namespace std;
int main()
{
    char a[2][3];
    int n;
    while(~scanf("%d",&n))
    {
        int i;
        for(i=sqrt(n); i>0; --i)
        {
            if(i*i<=n)
            {
                printf("%d\n",i*i);
                break;
            }
        }

    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int a[3], n;
  cin >> n;
  for (int i=0; i<n; ++i) {
    cin >> a[0] >> a[1] >> a[2];
    sort(begin(a), end(a));
    if (a[0]*a[0] + a[1]*a[1] == a[2]*a[2]) {
      cout << "YES" << "\n";
    } else {
      cout << "NO" << "\n";
    }
  }
}


Measured memory_bytes: 3056
#include <bits/stdc++.h>
using namespace std;
using pint = pair<int, int>;
using ll = long long;
using ull = unsigned long long;
using vll = vector<long long>;
using pll = pair<ll, ll>;
#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)
#define VREP(s, ite) for (auto ite = s.begin(); ite != s.end(); ++ite)
#define FI first
#define SE second
#define ALL(v) v.begin(), v.end()
#define endl "\n"
#define ciosup  \
    cin.tie(0); \
    ios::sync_with_stdio(false);
#define eb emplace_back
#define vint vector<int>
constexpr ll INF = 1e15 + 7LL;
constexpr ll MOD = 1e9 + 7LL;
template <typename T>
istream &operator>>(istream &is, vector<T> &v) {
    for (int i = 0; i < v.size(); ++i) {
        is >> v[i];
    }
    return is;
}
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (int i = 0; i < v.size() - 1; ++i) {
        os << v[i] << " ";
    }
    if (v.size() > 0) {
        os << v[v.size() - 1] << endl;
    }
    return os;
}

bool judge(int a, int b, int c) { return (b > a) && (c > b); }

bool dfs(int a, int b, int c, int rem) {
    if (judge(a, b, c)) return true;
    if (rem == 0) return false;
    if (dfs(2*a, b, c, rem - 1) || dfs(a, 2*b, c, rem - 1) || dfs(a,b,2*c, rem - 1)) return true;
    return false;
}


int main() {
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    if (dfs(a,b,c,k)){
        cout << "Yes" << endl;
    }else {
        cout << "No" << endl;
    }
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cout << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cout << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using TUPLE = tuple<int, int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 1ll << 60;
const int mod = 1e9 + 7;
using Graph = vector<vector<int>>;

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

    int n;
    cin >> n;
    vi a(n);
    map<int, int> mp;
    rep(i, n) {
        cin >> a[i];
        mp[a[i]]++;
    }

    bool ret = [&](){
        if (n % 2) {
            if (mp[0] != 1) {
                return false;
            }
            for (int i = 2; i < n; i += 2) {
                if (mp[i] != 2) {
                    return false;
                }
            }
        }
        else {
            for (int i = 1; i < n; i += 2) {
                if (mp[i] != 2) {
                    return false;
                }
            }
        }
        return true;
    }();

    if (!ret) {
        cout << 0 << endl;
        return 0;
    }

    int e = n / 2;
    int t = 1;
    rep(i, e) {
        t *= 2;
        t %= mod;
    }
    cout << t << endl;
}


Measured memory_bytes: 4992
//srinivas
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
//#include <boost/multiprecision/cpp_int.hpp>
//using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;

#define all(c) (c).begin(),(c).end()
#define endl "\n"
#define ff first
#define ss second
#define allr(c) (c).rbegin(),(c).rend()
#define fr(x,in,n,r) for(ll x=in;x<n;x+=r)
#define ifr(x,n) for(ll x=0;x<n;x++)
#define dfr(x,n) for(ll x=n-1;x>=0;x--)
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define pof(a) pop_front(a)
#define pob(a) pop_back(a)
#define eb(a) emplace_back(a)
#define ef(a) emplace_front(a)
#define fstm(m,n,r) m.reserve(n);m.max_load_factor(r)
#define os tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long long ll;
typedef map<ll,ll> mll;
typedef map<string,ll> msll;
typedef unordered_map<ll,ll> umap;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
typedef long double ld;
#define mod 1000000007
#define N 100001
vll v[N];
bool vis[N];ll dp[N];

void dfs(ll u){
    vis[u]=1;
    ifr(i,v[u].size()){
        if(!vis[v[u][i]])
            dfs(v[u][i]);
        dp[u]=max(dp[u],1+dp[v[u][i]]);
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,m,x,y;
    cin>>n>>m;
    ifr(i,m){
        cin>>x>>y;
        v[x].pb(y);
    }
    ifr(i,n){
        if(!vis[i+1])
            dfs(i+1);
    }
    ll ans=-1;
    ifr(i,n)ans=max(ans,dp[i+1]);
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 8704