akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
const long long INF = (1LL << 32);
const long long MOD = 1000000007;
const long double PI = 3.1415926;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()
typedef long long int ll;
typedef vector<ll> vi;
typedef vector<pair<ll, ll>> vp;
typedef vector<string> vs;
typedef vector<char> vc;
typedef list<ll> lst;
typedef pair<ll, ll> P;
template <class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

#define Endl endl

/*--------------------template--------------------*/


int main() {
    cin >> n >> m >> k;
    cout << (n + m >= k ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include <iomanip>
#include<map>
#include <random>
#include<type_traits>
using namespace std;


int main() {
	long long int N, A, B,a, x, X[1000000] = {0,0};
	cin >> N >> A >> B;
	cin >> x;
	for (long long int i = 2; i <= N; i++) {
		cin >> a;
		X[i] = a - x;
		x = a;
	}
	a = 0;
	for (long long int i = 2; i <= N; i++) {
		if (X[i]*A>=B) {
			a += B;
		}
		else {
			a += X[i] * A;
		}
	}
	
	cout << a << endl;
}

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

using namespace std;

#define IOS                       \
    ios_base::sync_with_stdio(0); \
    cin.tie(NULL);                \
    cout.tie(NULL);
#define pb push_back
#define mp make_pair
#define Debug(x) cout << #x " = " << (x) << endl
#define SORT(a) sort(a.begin(), a.end())
#define SORTR(a) sort(a.rbegin(), a.rend())

int main()
{
    IOS;

    int a;
    cin >> a;

    long long int x = a + (a * a) + (a * a * a);

    cout << x << endl;

    return 0;
}


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

using namespace std;
#define int long long
#define double long double

int n, k;
int a[100010];

main()
{
    ios_base::sync_with_stdio(0);
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];
    int g = 0;
    for(int i = 0; i < n; i++) g = __gcd(g, a[i]);
    for(int i = 0; i < n; i++){
        if(a[i] >= k){
            if((a[i] - k) % g == 0){
                cout << "POSSIBLE" << endl;
                exit(0);
            }
        }
    }
    cout << "IMPOSSIBLE" << endl;
}


Measured memory_bytes: 1024
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );

		int nou = str.length() - str.replace("N", "").length();
		int wes = str.length() - str.replace("W", "").length();
		int sou = str.length() - str.replace("S", "").length();
		int eas = str.length() - str.replace("E", "").length();


		String answer = "Yes";

		if((nou==0 && sou!=0) || (nou!=0 && sou==0)){
			answer = "No";
		}else if((wes==0 && eas!=0) || (wes!=0 && eas==0)){
			answer = "No";
		}

		System.out.println(answer);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
	int n;cin >> n;
	vector<pair<int, int>> pv;
	for(int i =0; i < n; i++){
		pair<int, int> p;
		cin >> p.first;
		p.second = i;
		pv.push_back(p);
	}

	sort(pv.begin(), pv.end());

	for(int i = 0; i < n; i++)cout << pv[i].second + 1 << " ";
	cout << endl;

}

Measured memory_bytes: 1780
#include"bits/stdc++.h"
using namespace std;
using ll = int64_t;

ll gcd(ll a, ll b) {
    return (b == 0 ? a : gcd(b, a % b));
}

ll f(ll x, ll y) {
    //x以下でyで割り切れるものの数
    return x / y;
}

ll solve(ll x, ll C, ll D) {
    //x以下でCでもDでも割り切れないものの数
    return x - f(x, C) - f(x, D) + f(x, C * D / gcd(C, D));
}

int main() {
    ll A, B, C, D;
    cin >> A >> B >> C >> D;

    cout << solve(B, C, D) - solve(A - 1, C, D) << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	double a=100.0,x;
	int i,j,k;
	cin>>x;
	for(i=1;;i++){
		a*=1.01;
		long long int b;
		b=(long long int)a;
		a=b*1.00;
		if(a>=x)break;
	}
	cout<<i;
	getchar();getchar();
}

Measured memory_bytes: 3724
#include <bits/stdc++.h>
using namespace std;
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
int main(){
	
	int W,H;
	while(cin>>W>>H,W){
		int MP[105][105]={0};
		int x=1,y=1,d=0;
		string s;
		for(int i=0;i<105;i++){
			MP[0][i]=1;
			MP[i][0]=1;
			MP[W+1][i]=1;
			MP[i][H+1]=1;
		}
		while(cin>>s){
			int k=0;
			if(s=="STOP")break;
			if(s=="FORWARD")cin>>k;
			if(s=="BACKWARD"){
				cin>>k;
				d=(d+2)%4;
			}
			if(s=="RIGHT")d=(d+1)%4;
			if(s=="LEFT")d=(d+3)%4;
			
			for(int i=0;i<k;i++){
				if(MP[x+dx[d]][y+dy[d]]==0){
					x+=dx[d];
					y+=dy[d];
				}
			}
			
			if(s=="BACKWARD")d=(d+2)%4;
		}
		cout<<x<<" "<<y<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1264
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#include <unordered_map>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) < (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MODU 1000000007LL
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
#define pritnf printf
#define scnaf scanf
#define itn int
#define PI 3.141592653589


#define izryt bool
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*)array, (T*)(array + N), val);
}
pll Dir[8] = { //移動
	{ 0 ,1 },{ -1 ,0 },{ 1 ,0 },{ 0 ,-1 },
	{ 1 ,1 },{ 1 ,-1 },{ -1 ,1 },{ -1 ,-1 }
};

//[a, b)
#define Getsum(ar, a,b) (ar[b] - ar[a])
#define INF 10000000000000000LL

struct Edge {
	ll from, to;
	ll w;
};
signed main(void) {

	ll a, b, x;
	cin >> a >> b >> x;
	ll k = (x - a) / (a - b);
	if (x - a < 0) k = -1;
	k++;
	k %= MODU;

	cout << ((k *( a%MODU))%MODU + x - (k * ((a - b)%MODU))%MODU)%MODU << endl;

	return 0;
}


Measured memory_bytes: 3076
#include "bits/stdc++.h"

using namespace std;

typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back
#ifdef Debug
#define dump(x)  cerr << #x << " = " << (x) << endl
#else
#define dump(x)
#endif

int main(){
	int n,k;
	int r;

	while(cin>>n>>k){
		vector< vector<int> > bunny(60);

		bool edge[60][60];
		rep(i,60)rep(j,60)edge[i][j]=false;

		rep(i,k){
			int m;
			cin>>m;
			rep(j,m){	
				int b;
				cin>>b;			
				bunny[i].pb(b);
			}
		}
		cin>>r;
		rep(i,r){
			int a,b;
			cin>>a>>b;
			edge[a][b] = edge[b][a] = true;
		}

		int sum=0;

		rep(i,k){
			rep(j,bunny[i].size()){
				rep(k,bunny[i].size()){
					if( edge[ bunny[i][j] ][ bunny[i][k] ]==true ){
						sum++;
						break;
					}
				}
			}
		}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1224
var v = require('fs').readFileSync('/dev/stdin', 'utf8');
var n = v.split(" ").map(Number);
var W = n[0], H = n[1], x = n[2], y = n[3], r = n[4];
if (x-r >= 0 && y-r >= 0 && x-r < W && y-r < W && x < H && y < H && r >= 0 && r < W && r < H){
    console.log("Yes");
} else {
    console.log("No")
}


Measured memory_bytes: 15364
n, m = gets.chomp.split.map(&:to_i)
a = Array.new(n, Array.new(2))
for i in 0..(n - 1)
  a[i] = gets.chomp.split.map(&:to_i)
end
a.sort! {|i, j| i[0] <=> j[0]}
money = 0
i = 0
while m > 0
  if m >= a[i][1]
    money += a[i][0] * a[i][1]
    m -= a[i][1]
  else
    money += a[i][0] * m
    break
  end
  i += 1
end
puts money

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

using namespace std;

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

int main() {
	int sw[10], sk[10];
	REP(i,10) cin >> sw[i];
	REP(i,10) cin >> sk[i];

	sort(sw, sw+10); reverse(sw, sw+10);
	sort(sk, sk+10); reverse(sk, sk+10);
	int tw = 0;
	REP(i,3) tw += sw[i];
	int tk = 0;
	REP(i,3) tk += sk[i];

	cout << tw << ' ' << tk << endl;

	return 0;
}

Measured memory_bytes: 1176
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<vector>
#include<cstdlib>
#include<map>
#include<queue>
#include<stack>
#include<deque>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<numeric>
#include<cctype>
#include<random>

//#include<boost/circular_buffer.hpp>
using namespace std;

//cout << fixed << setprecision(10);
typedef long long ll;
#define PI 3.141592653589793
#define Yes(a) a ? "Yes" : "No";
#define YES(a) a ? "YES" : "NO";
#define rep(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
	if (a < b) {
		int tmp = a;
		a = b;
		b = tmp;
	}
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}

int lcm(int a, int b) {
	long long int L;
	L = (a * b) / gcd(a, b);
	return L;
}

vector<long long  int> Prime;
void Eratosthenes(long long int n) {
	vector<bool> is_prime(n, true);
	for (int i = 2; i * i <= n; i++) {
		;
		if (is_prime.at(i)) {
			for (int j = i * i; j <= n; j += i) {
				is_prime.at(j) = false;
			}
		}
		Prime.emplace_back(i);
	}
}

/*
map<int, int> prime;
void Prime_number(long long int n) {
	for (int i = 2; i <= n; i++) {
		int count = 0;
		while (n % i == 0) {
			count++;
			n /= i;
		}
		if (count != 0) {
			prime.insert(make_pair(i, count));
		}
	}
}
*/
//std::cout.fill('0');

int keta(long long int N) {
	int k = 0;
	while (N > 0) {
		N /= 10;
		k++;
	}
	return k;
}



int Combination(int n, int m) {
	long long int s = 1, t = 1;
	int tmp = n;
	while (n - m != tmp) {
		s *= tmp;
		tmp--;
	}
	tmp = m;
	while (tmp != 1) {
		t *= tmp;
		tmp--;
	}
	return s / t;
}


int main() {
	long long int n;
	int a, b;
	cin >> a >> b;
	if (a * b == 2)
		cout << 3 << endl;
	if (a * b == 3)
		cout << 2 << endl;
	if (a * b == 6)
		cout << 1 << endl;
}


/*
int main() {
	int n; cin >> n;
	vector<int> f(n);
	vector<int> t(n,1);
	int x[15][15], y[15][15];
	int p[15][15], q[15][15];
	vector<int> a(n);
	int count = 0, ans = 0;

	for (int i = 0; i < n; i++) {
		cin >> f.at(i);
		for (int j = 0; j < f.at(i); j++) {
			cin >> p[i][j] >> q[i][j];
		}
	}
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			a.at(i) = f.at(i);
			for (int j = 0; j < a.at(i); j++) {
				x[i][j] = p[i][j]; y[i][j] = q[i][j];
			}
		}

		for (int i = 0 ; i < n; i++) {
			if (t.at((i+k)%n) == 0) {
				for (int j = 0; j < a.at((i + k) % n); j++) {
					if (y[(i + k) % n][j] == 1)
						y[(i + k) % n][j] = 0;
					else
						y[(i + k) % n][j] = 1;
				}
			}
			for (int j = 0; j < a.at(i); j++) {
				a.at(x[(i + k) % n][j] - 1) *= y[(i + k) % n][j];
			}
		}
		count = 0;
		for (int i = 0; i < n; i++) {
			if (a.at(i) == 1)
				count++;
		}
		ans = max(ans, count);
	}
	cout << ans << endl;
}
*/

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <queue>
typedef long long ll;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define mod 1000000007

string divide[4] = {"dream","dreamer","erase","eraser"};

int main(){
	int N;
	cin >> N;
	vector<int> V(N);
	vector<int> C(N);
	for(int i = 0; i < N; i++) cin >> V[i];
	for(int i = 0; i < N; i++) cin >> C[i];
	int ans = 0;
	for(int i = 0; i < N; i++){
		if(V[i] > C[i]){
			ans += V[i] - C[i];
		}
	}
	cout << ans << endl;
}

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


int main(){
    int h,n,c2,c2t;
    cin >> h >> n;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(h+1);
    for(int i = 0; i < n;i++){
        cin >> a[i] >> b[i];
    }
    c[0] = 0;
    for(int i = 1;i <= h;i++){
      c2 = 300000000;
      for(int j = 0; j < n;j++){
          c2t = c[max(0,i-a[j])] + b[j];
          if(c2t < c2) c2 = c2t;
      }
      c[i] = c2;  
    }
    cout << c[h] << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a,c;
  string b;
  int min,max;

  while(1){
  cin >> a >> b >> c;
    if(b == "+"){
    cout << a + c << endl;
    } else if(b == "-"){
    cout << a - c << endl;    
    } else if(b == "*"){
    cout << a * c << endl;    
    } else if(b == "/"){
    cout << a / c << endl;    
    } else break;
  }
}


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

using namespace std;

int main()
{
    long   a[100001],b[100001],c[100001],n,i;
    cin>>n;
    for(i=1;i<=n;i++)
    {
        cin>>a[i]>>b[i]>>c[i];
    }
    int A[n],B[n],C[n];
    A[1]=a[1];
    B[1]=b[1];
    C[1]=c[1];
    for(i=2;i<=n;i++)
    {
        A[i]=a[i]+max(B[i-1],C[i-1]);
        B[i]=b[i]+max(A[i-1],C[i-1]);
        C[i]=c[i]+max(B[i-1],A[i-1]);
    }
    cout<<max(A[n],max(B[n],C[n]));
    return 0;
}


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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int A, B;
    cin >> A >> B;
    
    int res;
    if (B % A == 0) {
        res = A + B;
    } else {
        res = B - A;
    }
    
    cout << res << endl;
    
    return 0;
}



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

int main(){
  int A ,B;
  cin >> A >> B;
  int goukei = A + B;
  int amari = goukei % 2;
  
  if(amari == 0) cout << goukei/2 << endl;
  else cout <<(goukei - amari + 2)/2 <<endl; 
}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<string>
#include<algorithm>
using namespace std;

int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a==b)cout<<c<<endl;
	else if(b==c)cout<<a<<endl;
	else cout<<b<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int n;
int cnt = 0;
void merge(int a[], int left, int mid, int right){
    int i = left;
    int j = mid+1;
    int t[n];
    int k = 0;
    while(i <= mid && j <= right){
        if(a[i] <= a[j]) t[k++] = a[i++];
        else t[k++] = a[j++];
    }
    while(i <= mid) t[k++] = a[i++];
    while(j <= right) t[k++] = a[j++];

    for(int p = 0; p < k; p++){
        *(a+left+p) = t[p];
        cnt++;
    }
}
void mergeSort(int a[], int left, int right){
    if(left < right){
        int mid = (left + right) / 2;
        mergeSort(a, left, mid);
        mergeSort(a, mid+1, right);
        merge(a, left, mid, right);
    }
}
int main(){
    scanf("%d", &n);
    int a[n];
    for(int i = 0; i < n; i++) scanf("%d", &a[i]);
    int left = 0;
    int right = n-1;
    mergeSort(a, left, right);
    for(int i = 0; i < n; i++) {
        printf("%d", a[i]);
        if(i == n-1) printf("\n");
        else printf(" ");
    }
    printf("%d\n", cnt);
    return 0;
}


Measured memory_bytes: 5600
"""
author : halo2halo
date : 9, Jan, 2020
"""

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

N = int(readline())
S = read().decode('utf8').rstrip()

# print(type(S))
# print(N//2)
# print(S)
# print(''.join(S[:N // 2]+S[:N//2]) )

flag = False
if N % 2 == 0:
    M = N // 2
    flag = S[:M] == S[M:]

ans = 'Yes' if flag else 'No'
print(ans)


Measured memory_bytes: 3064
import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int K = sc.nextInt();
    for (int i = A; i < A+K && i <= B; i++) {
      System.out.println(i);
    }
    int start = Math.max(A+K, B-K+1);
    for (int i = start; i <= B; i++) {
      System.out.println(i);
    }
  }
}

Measured memory_bytes: 23636
import java.util.*;
public class Main{
    public static void main(String[] args){
	new Main().run();
    }
    Scanner sc = new Scanner(System.in);

    int[] coins = new int[18]; // do not use [0].
    int pattern;

    void run(){
	for(int i=0; i<coins.length; i++)
	    coins[i] = i*i;

	while(sc.hasNext()){
	    int n = sc.nextInt();
	    if(n!=0){
		int level = coins.length-1;
	        pattern = 0;
		while(coins[level]>n) level--;
		solve(n, level);
		System.out.println(pattern);
	    }
	}
    }

    void solve(int n, int level){
	//System.out.println("*"+n+" "+level);
	if(level==0) return;	

	// テ、ツスツソテ」ツつ湘」ツ?堙」ツ?ォテヲツャツ。テ」ツ?ク
	solve(n, level-1);

	// テ、ツスツソテ」ツ?」テ」ツ?ヲテ」ツ?凝」ツつ嘉」ツ??」ツつづ」ツ??、ツクツ?ヲツ楪?orテヲツャツ。テ」ツ?ク
	n -= coins[level];
	if(n==0) {
	    pattern++;
	    return;
	}
	if(n>=coins[level]) solve(n, level);
	else solve(n, level-1);
    }
}

Measured memory_bytes: 19652
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
using namespace std;

long long gcd( long long a, long long b ) {
    
    long long c = a%b;
    
    if ( !c ) { return b; }
    
    return gcd(b,c);
    
}

int main() {
    
    int N;
    long long K;
    vector<long long> A;
    
    cin >> N >> K;
    
    bool is_ok = false;
    for ( int i = 0; i < N; i++ ) {
        long long a;
        cin >> a;
        A.push_back(a);
        if ( K == a ) { is_ok = true; }
    }
    
    if ( is_ok ) {
        cout << "POSSIBLE" << endl;
        return 0;
    }
    
    if ( A.size() == 1 ) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    
    sort( A.begin(), A.end() );
    reverse( A.begin(), A.end());
    
    if ( K > A[0] ) {
        cout << "IMPOSSIBLE" << endl;
        return 0;
    }
    
    for ( int i = 1; i < N; i++ ) {
        
        if ( gcd( A[0], A[i] ) == 1 ) {
            cout << "POSSIBLE" << endl;
            return 0;
        }
        
    }
    
    
    
    if ( gcd(A[0],K) != 1 ) {        
        cout << "POSSIBLE" << endl;
        return 0;
    }
    
    
    cout << "IMPOSSIBLE" << endl;
    
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define For(i,x,y) for (register int i=(x);i<=(y);i++)
#define FOR(i,x,y) for (register int i=(x);i<(y);i++)
#define Dow(i,x,y) for (register int i=(x);i>=(y);i--)
#define Debug(v) for (auto i:v) printf("%lld ",i);puts("")
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define ep emplace_back
#define siz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define fil(a,b) memset((a),(b),sizeof(a))
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pa;
typedef pair<ll,ll> PA;
typedef vector<int> poly;
inline ll read(){
    ll x=0,f=1;char c=getchar();
    while ((c<'0'||c>'9')&&(c!='-')) c=getchar();
    if (c=='-') f=-1,c=getchar();
    while (c>='0'&&c<='9') x=x*10+c-'0',c=getchar();
    return x*f;
}

int main(){
	int A=read(),a=read();
	int B=read(),b=read();
	int T=read();
	if (abs(A-B)<=1ll*T*(a-b)) puts("YES");
		else puts("NO");
}

Measured memory_bytes: 3608
s = input()
k = int(input())

# s = "1124"
# k = 3

ch_cnt = 0
first_num = 1

for ch in s:
    if ch != "1":
        first_num = int(ch)
        break
    ch_cnt += 1

# print(first_num, k)

if k <= ch_cnt:
    print(1)
else:
    print(first_num)


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

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

   vector<vector<int>> vec(9, vector<int>(9));
   for (int i=0; i<9; i++)
      for (int j=0; j<9; j++)
         vec.at(i).at(j) = (i+1)*(j+1);

   bool flag = false;
   for (int i=0; i<9; i++)
      for (int j=0; j<9; j++)
         if (vec.at(i).at(j) == N){
            flag = true;
            break;
         }

   if (flag)
      cout << "Yes" << endl;
   else
      cout << "No" << endl;

}



Measured memory_bytes: 256
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n; cin >> n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  deque<int> d;
  
  
  d.push_front(a[0]);
  
  for(int i = 1;i < n;i++){
    int p = lower_bound(d.begin(),d.end(),a[i]) - d.begin();
    if(p == 0){
      d.push_front(a[i]);
    }else{
      d[p-1] = a[i];
    }
  }
  
  cout << d.size() << endl;
  
  return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

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;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    vc<pair<string,int>> p;
    int t=0;
    rep(i,N){
        string s; int a;
        cin >> s >> a;
        t+=a;
        p.eb(s,t);
    }
    string S; cin >> S;
    for(auto a:p){
        if(a.fi==S) cout << p[SZ(p)-1].se-a.se << endl;
    }
}

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

#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin>>s;
    int ans=0;
    for(int i=0;i<4;i++){
        if(s[i]=='2'){
            ans++;
        }
    }
    cout<<ans<<endl;
    return 0;
}


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

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

  vector<int> a(n);
  rep(i,n) cin >> a[i];
  int mi = *min_element(a.begin(),a.end());
  int ma = *max_element(a.begin(),a.end());
  int mi_idx = min_element(a.begin(),a.end()) - a.begin();
  int ma_idx = max_element(a.begin(),a.end()) - a.begin();

  cout << (n - 1)*2 << '\n';
  if(ma >= -mi) {
    for (int i = 0; i < n; i++) {
      if(i == ma_idx) continue;
      cout << ma_idx + 1 << ' ' << i + 1 << '\n';
    }
    for (int i = 1; i < n; i++) {
      cout << i << ' ' << i + 1 << '\n';
    }
  } else {
    for (int i = 0; i < n; i++) {
      if(i == mi_idx) continue;
      cout << mi_idx + 1 << ' ' << i + 1 << '\n';
    }
    for (int i = n - 2; i >= 0; i--) {
      cout << i + 2 << ' ' << i + 1 << '\n';
    }
  }

}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int ans = 700;
  for(int i = 0; i < 3; i++)
    if(s[i] == 'o')
      ans += 100;
  cout << ans << endl;
  return 0;
}

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

#define LL long long

#define FOR(INDEX, START, END) for (LL INDEX = (START); INDEX < (END); ++INDEX)
#define REP(INDEX, COUNT) for (LL INDEX = 0; INDEX < (COUNT); ++INDEX)

int main()
{
	LL S, W;
	cin >> S >> W;

	if (W >= S) {
		cout << "unsafe" << endl;
	}
	else {
		cout << "safe" << endl;
	}

	return 0;
}


Measured memory_bytes: 3624
H = []
W = []
while(True):
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    else:
        H.append(x)
        W.append(y)
for i in range(len(H)):
    for j in range(H[i]):#行数
        if j == 0:#上段
            print(W[i]*"#")
            
        elif j+1 == H[i]:#下段
            print(W[i]*"#"+"\n")
            
        else:#中段
            print("#"+(W[i]-2)*"."+"#")#列数


Measured memory_bytes: 5628
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) ((y)<0||(x)<0||(y)>=(h)||(x)>=(w))
#define dump(...)
const signed INF_=1001001001; const long long INF=1001001001001001001LL;
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v))os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
    is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a,const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a,const U &b){return a>b?a=b,1:0;}
template<class T> using heap=priority_queue<T,vector<T>,greater<T>>;
struct{template<class T> operator T(){T x;cin>>x;return x;}} IN;
struct before_main_function {
    before_main_function() {
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    int a, b, c, K;
    cin >> a >> b >> c >> K;
    K %= 2;
    int ans = a - b;
    if (K) ans *= -1;
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

int n;
int a[200];

int main() {
	int i;
	
	cin >> n;
	rep(i, n) cin >> a[i];
	
	int ans = 1e+9;
	rep(i, n) {
		int cnt = 0;
		while (a[i] % 2 == 0) {
			a[i] /= 2;
			cnt++;
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String args[]){

		Scanner sc = new Scanner (System.in);
		int n= sc.nextInt();
		int bfr[][][]= new int[4][3][10];
		int b,f,r;
		int v=0;

		for(int i=0;i<n;++i){
			b= sc.nextInt();
			f=sc.nextInt();
			r=sc.nextInt();
			v=sc.nextInt();
			bfr[b-1][f-1][r-1]= bfr[b-1][f-1][r-1] + v;
		}
		for (int a=0;a<=3;++a){
			for (int aa =0;aa<=2;++aa){
				for (int aaa = 0; aaa<=9;++aaa){
					System.out.print(" "+bfr[a][aa][aaa]);
				}
				System.out.println();
			}
			if (a!=3)System.out.println("####################");
		}

	}
}


Measured memory_bytes: 29112
#include <iostream>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
using namespace std;

int main(){
    int n;
    cin >> n;
    vector<long> v(n); 

    for(int i=0; i<n; i++) {
        cin >> v[i];
    }

    int cnt=0;
    bool flag = false;

    while(!flag) {
        for(int i=0; i<n; i++) {
            if(v[i] % 2 != 0) flag = true;
            v[i] /= 2;
        }
        if(!flag) cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
S = str(input())
T = str(input())
numS=len(S)
numT=len(T)
S+=" "
ref=""
cand=""
judge=True
ans=-1
result=""
for i in range(0,numS-numT+1):
    cand=""
    ref=S[i:i+numT]
    judge=True
    #refについてTと一致させられるか検討
    for j in range(0,numT):
        if(ref[j]!=T[j] and ref[j]!="?"):
            judge=False
    if(judge):
        cand=S[:i]+T+S[i+numT:]
        tmp=""
        for i in range(0,numS):
            if(cand[i]=="?"):
                tmp+="a"
            else:
                tmp+=cand[i]
        if(result==""):
            result=tmp
        else:
            if(result>tmp):
                result=tmp
    #結果が現在のものと比べて優秀かどうかを比較
if(result==""):
    print("UNRESTORABLE")
else:
    print(result)

Measured memory_bytes: 3192
#include <stdio.h>
#include <stdlib.h>

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

    long long int *a;
    long long int *b;
    long long int temp;
    int i;
    a = (long long int *)malloc(sizeof(long long int) * n + 1);
    a[0] = 0;
    for (i = 1; i < n + 1; i++)
    {
        scanf("%lld", &temp);
        a[i] = a[i - 1] + temp;
    }
    b = (long long int *)malloc(sizeof(long long int) * m + 1);
    b[0] = 0;
    for (i = 1; i < m + 1; i++)
    {
        scanf("%lld", &temp);
        b[i] = b[i - 1] + temp;
    }

    int answer = 0;
    int j = m;
    for (i = 0; i < n + 1; i++)
    {
        if (a[i] > k)
        {
            break;
        }
        while (b[j] > k - a[i])
        {
            j -= 1;
        }
        answer = answer > (i + j) ? answer : (i + j);
    }

    printf("%d\n", answer);

    free(a);
    free(b);
    return 0;
}

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

int main() {
  int n,m;
  while(cin >> n >> m && n) {
    int a[n];
    for(int i=0; i<n; i++) cin >> a[i];
    vector<int> b(m);
    for(int i=0; i<m; i++) {
      if(i<a[0]) b[i]=1;
      else b[i]=0;
    }
    sort(b.begin(),b.end());
    bool ok=0;
    do{
      int cnt=a[0];
      string s="";
      for(int i=0; i<m; i++) {
	if(b[i]) s+='1';
	else s+='0';
      }
      bool ck=1;
      for(int i=1; i<n; i++) {
	if(s[i-1]=='1') cnt--;
	if(cnt<a[i]) {
	  s+='1';
	  cnt++;
	} else s+='0';
	if(cnt!=a[i]) ck=0;
      }
      if(ck) {
	ok=1;
	cout << s << endl;
	break;
      }
    } while(next_permutation(b.begin(),b.end()));
    if(!ok) cout << "Goofy" << endl;
  }
  return 0;
}

Measured memory_bytes: 1224
from math import gcd
import itertools

def calc(a,b,c):
    x=gcd(a,b)
    y=gcd(x,c)
    return y

n=int(input())
A=list(itertools.combinations_with_replacement(range(1,n+1), 3))

ans=0
for a,b,c in A:
    if a==b==c:
        ans+=calc(a,b,c)
    elif a!=b and a!=c and b!=c:
        ans+=calc(a,b,c)*6
    else:
        ans+=calc(a,b,c)*3
print(ans)

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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  for (int b = 1; b <= n; b++) {
      ans += max(b - k, 0) * (n / b) + max(n % b - k + 1, 0);
  }
  if (k == 0) {
      ans -= n;
  }
  cout << ans;
}


Measured memory_bytes: 256
import itertools

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

case = list(itertools.product(range(4), repeat=N))
ans = 10 ** 7

for i in range(len(case)):
    if case[i].count(1) != 0 and case[i].count(2) != 0 and case[i].count(3) != 0:
        listA = []
        listB = []
        listC = []    
        for j in range(N):
            if case[i][j] == 1:
                listA.append(l[j])
            elif case[i][j] == 2:
                listB.append(l[j])
            elif case[i][j] == 3:
                listC.append(l[j])
        ansA = abs(sum(listA) - A) + 10 * (len(listA) - 1)
        ansB = abs(sum(listB) - B) + 10 * (len(listB) - 1)
        ansC = abs(sum(listC) - C) + 10 * (len(listC) - 1)
#        print(listA, listB, listC)
#        print(ansA, ansB, ansC)
        anstmp = ansA + ansB + ansC
#        print(anstmp)
        if anstmp < ans :
            ans = anstmp
    else:
        pass

print(ans)

Measured memory_bytes: 10916
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int (i)=0;i<(n);i++)
#define rrep(i,n) for(int (i)=1;i<=(n);i++)
#define REP(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define MOD 1000000007
#define INF 1e18
#define int long long
#define endl "\n"
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
typedef long long ll;
typedef pair<int, int> P;
int gcd(int a,int b){return b?gcd(b,a%b):a;};
int lcm(int a,int b){return a/gcd(a,b)*b;};
int mod(int a,int b){return (a+b-1)/b;};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N],const T &val){std::fill((T*)array,(T*)(array+N),val);}
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 {
public:
	vector <ll> par; // 各元の親を表す配列
	vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)

	// Constructor
	UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}
	void init(ll sz_) {
		par.resize(sz_);
		siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
		for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
	}

	// Member Function
	// Find
	ll root(ll x) { // 根の検索
		while (par[x] != x) {
			x = par[x] = par[par[x]]; // x の親の親を x の親とする
		}
		return x;
	}

	// Union(Unite, Merge)
	bool unite(ll x, ll y) {
		x = root(x);
		y = root(y);
		if (x == y) return false;
		// merge technique（データ構造をマージするテク．小を大にくっつける）
		if (siz[x] < siz[y]) swap(x, y);
		siz[x] += siz[y];
		par[y] = x;
		return true;
	}

	bool same(ll x, ll y) { // 連結判定
		return root(x) == root(y);
	}

	ll getsize(ll x) { // 素集合のサイズ
		return siz[root(x)];
	}
};

signed main() {
	cin.tie(nullptr);
	cout.tie(nullptr);
	ios::sync_with_stdio(false);
	//cout << fixed << setprecision(15);
	
	int n, m;
	cin >> n >> m;
	UnionFind ut(n);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		ut.unite(a, b);
	}
	cout << *max_element(all(ut.siz)) << endl;
	return 0;
}

Measured memory_bytes: 6316
#include <iostream>
#include<string>
using namespace std;
int main(){
    int N;
    cin>>N;
    int L[N];
    int sum=0;
    int max;
    max=-100000;
    for(int i=0; i<N; i++){
        cin>>L[i];
    }
    for(int j=0; j<N; j++){
        sum=sum+L[j];
        if(L[j]>max){
            max=L[j];
        }
        
    }
    if(max<sum-max){
        cout<<"Yes";
    }
    else {
        cout<<"No";
    }
return 0;
}



Measured memory_bytes: 256
s = list(input())
t = list(input())
cnt = 0
for i in range(len(s)):
    x = t[-1]
    t.pop()
    t.insert(0, x)
    if s == t:
        print("Yes")
        break
    else:
        cnt += 1
        if cnt == len(s):
            print("No")
            break

Measured memory_bytes: 9060
#include <iostream>
#include <algorithm>
#include <numeric>
#include <vector>
#include <cassert>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;

#define REP2(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define REP(i, n) REP2(i, 0, n)
#define ALL(c) (c).begin(), (c).end()
#define ITER(c) __typeof((c).begin())
#define PB(e) push_back(e)
#define FOREACH(i, c) for(ITER(c) i = (c).begin(); i != (c).end(); ++i)
#define MP(a, b) make_pair(a, b)
#define PARITY(n) ((n) & 1)

typedef long long ll;
typedef pair<ll, ll> P;
const int INF = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-10;



int best;
int best_count;
vector<int> res;


void dfs(string n, int sum, int target, vector<int> v){
  if(sum > target) return;
  if(n == ""){
    if(sum > best){
      best = sum;
      best_count = 1;
      res = v;
    }else if(sum == best){
      best_count++;
    }
    return;
  }
  
  REP(i, n.size()){
    string n1 = n.substr(0, i + 1);
    string n2 = n.substr(i + 1);
    
    vector<int> v2 = v;
    v2.push_back(atoi(n1.c_str()));
    dfs(n2, sum + atoi(n1.c_str()), target, v2);
  }
}
int main(){
  string sheet;
  int target;
  while(cin >> target >> sheet && (sheet != "0" || target > 0)){
    best = -1;
    best_count = 0;
    dfs(sheet, 0, target, vector<int>());
    if(best == -1){
      cout << "error" << endl;
    }else if(best_count > 1){
      cout << "rejected" << endl;
    }else{
      cout << best << " " ;
      REP(i, res.size()) cout << res[i] << (i + 1 == (int)res.size() ? '\n' : ' ');
    }
  }
  return 0;
}

Measured memory_bytes: 1244
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

int main()
{
	int h, w;
	int n;

	cin >> h >> w;
	cin >> n;
	vector<int> a(n);
	vector< vector<int> > arr;
	arr.resize(h);
	for (int i = 0; i < h; i++) {
		arr[i].resize(w);
	}

	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int ind = a.size() - 1;
	for (int y = 0; y < w; y++) {
		for (int x = 0; x < h; x++) {
			if (y % 2 == 0) {
				arr[x][y] = ind + 1;
			}
			else {
				arr[h - x - 1][y] = ind + 1;
			}
			if (--a[ind] == 0) {
				ind--;
			}
		}

	}
	for (int y = 0; y < h; y++) {
		for (int x = 0; x < w; x++) {
			cout << arr[y][x];
			if (x != w - 1) {
				cout << " ";
			}
		}
		cout << endl;;
	}
}

Measured memory_bytes: 384
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.NoSuchElementException;

public class Main {

	static PrintWriter out;
	static InputReader ir;

	static void solve() {
		int k = ir.nextInt();
		int x = ir.nextInt();
		out.println(k * 500 >= x ? "Yes" : "No");
	}

	public static void main(String[] args) {
		ir = new InputReader(System.in);
		out = new PrintWriter(System.out);
		solve();
		out.flush();
	}

	static class InputReader {

		private InputStream in;
		private byte[] buffer = new byte[1024];
		private int curbuf;
		private int lenbuf;

		public InputReader(InputStream in) {
			this.in = in;
			this.curbuf = this.lenbuf = 0;
		}

		public boolean hasNextByte() {
			if (curbuf >= lenbuf) {
				curbuf = 0;
				try {
					lenbuf = in.read(buffer);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (lenbuf <= 0)
					return false;
			}
			return true;
		}

		private int readByte() {
			if (hasNextByte())
				return buffer[curbuf++];
			else
				return -1;
		}

		private boolean isSpaceChar(int c) {
			return !(c >= 33 && c <= 126);
		}

		private void skip() {
			while (hasNextByte() && isSpaceChar(buffer[curbuf]))
				curbuf++;
		}

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

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

		public int nextInt() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

		public long nextLong() {
			if (!hasNext())
				throw new NoSuchElementException();
			int c = readByte();
			while (isSpaceChar(c))
				c = readByte();
			boolean minus = false;
			if (c == '-') {
				minus = true;
				c = readByte();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res = res * 10 + c - '0';
				c = readByte();
			} while (!isSpaceChar(c));
			return (minus) ? -res : res;
		}

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

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

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

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

	static void tr(Object... o) {
		out.println(Arrays.deepToString(o));
		out.flush();
	}
}


Measured memory_bytes: 21076
#include<iostream>
#define int long long
using namespace std;
const int N=2e5+2;
const int inf=1e18+7;
int ar[N],sum[N],pos[N],pos1[N];
int getsum(int l,int r){
	return sum[r]-sum[l-1];
}
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,ans=inf;
	cin>>n;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		sum[i]=sum[i-1]+ar[i];
	}
	pos[2]=1;
	for(i=3;i<=n;i++){
		pos[i]=pos[i-1];
		while(pos[i]+1<i&&abs(getsum(1,pos[i])-getsum(pos[i]+1,i))>abs(abs(getsum(1,pos[i]+1)-getsum(pos[i]+2,i)))){
			pos[i]++;
		}
		//cout<<pos[i]<<" ";
	}
	//cout<<endl;
	pos1[n-1]=n;
	for(i=n-2;i>=1;i--){
		pos1[i]=pos1[i+1];
		while(pos1[i]-1>i&&abs(getsum(pos1[i],n)-getsum(i,pos1[i]-1))>abs(getsum(pos1[i]-1,n)-getsum(i,pos1[i]-2))){
			pos1[i]--;
		}
		//cout<<pos1[i]<<" ";
	}
	//cout<<endl;
	for(i=2;i<n-1;i++){
ans=min(ans,max(max(sum[pos[i]],sum[i]-sum[pos[i]]),max(sum[pos1[i+1]-1]-sum[i],sum[n]-sum[pos1[i+1]-1]))-min(min(sum[pos[i]],sum[i]-sum[pos[i]]),min(sum[pos1[i+1]-1]-sum[i],sum[n]-sum[pos1[i+1]-1])));
	}
	cout<<ans;
}

Measured memory_bytes: 6528
x,n = map(int, input().split())

p = list(map(int, input().split()))
ans = 0

for i in range(-200, 200):
    if(not i in p):
        if((abs(x-ans) > abs(x-i)) or(abs(x - ans) == abs(x - i) and i < ans)):
            ans = i

print(ans)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
 
using namespace std;
 
#define Q int t; scanf("%d", &t); for(int q=1; q<=t; q++)
typedef long long int lli;
typedef pair<lli, int> pi;
 
lli lcm(lli a, lli b) {return (a*b)/__gcd(a, b);}
 
int main()
{
    double w, h, a, b;
    cin >> w >> h >> a >> b;
    double v = w*h/2.0;
 
    cout << fixed << setprecision(10) << v << " " << (a*2 == w && b*2 == h) << "\n";
 
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int bigit(int n){
  int ans=0; 
  while(n!=0){
    ans+=n%10;
    n=n/10;
  }
  return ans;
}
  int main(){
    int n;
    cin>>n;
    if(n%bigit(n)==0){
      cout<<"Yes"<<endl;
    } else {
      cout<<"No"<<endl;
    }
  }

Measured memory_bytes: 3624
defmodule Main do
  def main do
    n = IO.read(:line) |> String.trim |> String.to_integer
   	if IO.gets("") |> String.trim |> String.split |> Enum.uniq |> length == 4 do
    	IO.puts("Four")
    else
        IO.puts("Three")
    end
  end
end


Measured memory_bytes: 30660
#Changing a Character
N,K = map(int,input().split())
S = input()
if S[K-1] == "A":
    S = S[0:K-1] + "a" + S[K:N]
elif S[K-1] == "B":
    S = S[0:K-1] + "b" + S[K:N]
else:
    S = S[0:K-1] + "c" + S[K:N]
print(S)

Measured memory_bytes: 2940
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
const long double eps = 1e-12;
#define LONG_INF 1e18
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define REP(a,b) for(long long a = 0;a < b;++a)
long long powing(long long now,long long b) {
	long long ans = 1;
	while (b != 0) {
		if (b % 2 == 1) {
			ans *= now;
			ans %= MAX_MOD;
		}
		now *= now;
		now %= MAX_MOD;
		b /= 2;
	}
	return ans;
}
int main() {
#define int long long
	string a, b;
	cin >> a >> b;
	long long n;
	cin >> n;
	if (b.length() >= n) {
		//koutiku
		string hoge;
		for (int q = 0; q < n; ++q) {
			hoge.push_back(b[b.length() - q - 1]);
		}
		string s = hoge + a + hoge + b;
		for (int q = 0; q < s.length(); ++q) {
			if (s[q] != s[s.length() - 1 - q]) {
				cout << 0 << endl;
				return 0;
			}
		}
		cout << 1 << endl;
		return 0;
	}
	string hoge;
	for (int q = 0; q < b.length(); ++q) {
		hoge.push_back(b[b.length() - q - 1]);
	}
	map<long long, char> now_going;
	for (int q = 0; q < hoge.size(); ++q) {
		now_going[q] = hoge[q];
	}
	for (long long q = 0; q < a.length(); ++q) {
		now_going[(q + n)] = a[q];
	}
	for (long long q = 0; q < hoge.length(); ++q) {
		now_going[(q + n + (long long) a.length())] = hoge[q];
	}
	for (long long q = 0; q < b.length(); ++q) {
		now_going[(q + 2 * n + (long long)a.length())] = b[q];
	}
	long long final_length = (long long)(a.length() + b.length()) + 2LL * n;
	int going = final_length / 2;
	for (int i = (final_length - 1) / 2; i >= 0; --i) {
		if (now_going[i] == 0) {
			if (now_going[going] == 0) break;
			now_going[i] = now_going[going];
			going++;
			continue;
		}
		if (now_going[going] == 0) {
			now_going[going] = now_going[i];
			going++;
			continue;
		}
		if (now_going[i] != now_going[going]) {
			cout << 0 << endl;
			return 0;
		}
		going++;
	}
	for (long long q = 0;; ++q) {
		if (now_going[(n + (long long)a.length()) + q] == 0) {
			break;
		}
		if (now_going[q] == 0) {
			now_going[q] = now_going[(n + (long long)a.length()) + q];
		}
		else {
			if (now_going[q] != now_going[(n + (long long)a.length()) + q]) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	long long top = -10;
	for (long long q = n - 1;; --q) {
		if (now_going[q] == 0) {
			top = q;
			break;
		}
	}
	if (top == -10) {
		cout << 1 << endl;
		return 0;
	}
	long long bot = 0;
	for (long long q = 0;; ++q) {
		if (now_going[q] == 0) {
			bot = q;
			break;
		}
	}
	cout << powing(26,(top - bot + 2)/2) << endl;
}


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

// 連結成分分解　（連結成分ごとにグラフを再構築、Sはグラフの集合）
struct CC{
  int n;
  vector<vector<int> >G,rG;
  vector<int>used;
  vector<vector<vector<int> > >S;
  CC(int sz):n(sz),G(sz),rG(sz),used(sz){}
  void add(int from,int to){
    G[from].push_back(to);
    rG[to].push_back(from);
  }
  void CC_dfs1(int x,int &cnt,map<int,int>& m){
    m[x]=cnt++;
    used[x]=1;
    for(int i=0;i<G[x].size();i++){
      if(used[G[x][i]])continue;
      CC_dfs1(G[x][i],cnt,m);
    }
    for(int i=0;i<rG[x].size();i++){
      if(used[rG[x][i]])continue;
      CC_dfs1(rG[x][i],cnt,m);
    }
  }
  void CC_dfs2(int x,vector<vector<int> > &v,map<int,int>& m,vector<int> &vis){
    vis[m[x]]=1;
    for(int i=0;i<G[x].size();i++){
      v[m[x]].push_back(m[G[x][i]]);
      if(vis[m[G[x][i]]])continue;
      CC_dfs2(G[x][i],v,m,vis);
    }
    for(int i=0;i<rG[x].size();i++){
      if(vis[m[rG[x][i]]])continue;
      CC_dfs2(rG[x][i],v,m,vis);
    }
  }
  void build(){
    for(int i=0;i<n;i++)used[i]=0;
    for(int i=0;i<n;i++){
      if(used[i])continue;
      int cnt=0;
      map<int,int>M;
      CC_dfs1(i,cnt,M);
      vector<vector<int> >v(cnt);
      vector<int>U(cnt,0);
      CC_dfs2(i,v,M,U);
      S.push_back(v);
    }
  }
};

signed main(){
  int n,m,ans=0;
  cin>>n>>m;
  CC C(n);
  for(int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;a--;b--;
    C.add(a,b);
  }
  C.build();
  int N=C.S.size();
  for(int i=0;i<N;i++,ans++){
    vector<vector<int> >V=C.S[i];
    for(int j=0;j<V.size();j++){
      ans+=V[j].size()-1;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3372