akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int main(void){
  char a[100], b[100];
  string c;
  int i, n;
  cin >> n;
  for(i = 0; i < n; i++){
    cin >> a[i];
  }
  for(i = 0; i < n; i++){
    cin >> b[i];
  }
  for(i = 0; i < n; i++){
    c = c + a[i];
    c = c + b[i];
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
typedef pair<int,int> P;
typedef pair<int, P> PP;
#define fi first
#define se second
#define rep(i,n) for(int i = 0;i < n;i++)
#define rrep(i,n) for(int i = 1;i <= n;i++)

char str[100][100], a[100][100];
int d[100][100];
int dy[] = {-1, 0, 0, 1};
int dx[] = {0, -1, 1, 0};
int main(){
	int h, w;
	fill((char*)a, (char*)(a+100), '#');
	fill((int*)d, (int*)(d+100), inf);
	scanf("%d%d", &h, &w);
	rep(i,h)scanf("%s", &str[i]);
	rrep(i,h)rrep(j,w){
		a[i][j] = str[i-1][j-1];
	}
	
	d[1][1] = 0;
	queue<PP> q;
	q.push(PP(0, P(1, 1)));
	while(!q.empty()){
		PP pp = q.front();q.pop();
		int y = pp.se.fi, x = pp.se.se, v = pp.fi;
		if(a[y][x] == '#')continue;
		if(d[y][x] < v)continue;
		for(int i = 0;i < 4;i++){
			int yy = y+dy[i], xx = x+dx[i];
			if(d[yy][xx] > d[y][x]+1 && a[yy][xx] == '.'){
				q.push(PP(d[y][x]+1, P(yy, xx)));
				d[yy][xx] = d[y][x]+1;
			}
		}
	}
	if(d[h][w] == inf){
		printf("-1\n");
		return 0;
	}
	
	int cnt = 0;
	rrep(i,h)rrep(j,w){
		if(a[i][j] == '.')cnt++;
	}
	/*rrep(i,h){
		rrep(j,w)printf("%c ", d[i][j]);
		printf("\n");
	}*/
	int ans = d[h][w]+1;
	ans = cnt-ans;
	printf("%d\n", ans);
	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[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
        }
        System.out.println( solve(N, A) );
    }

    private static String solve(int N, int[] A) {
        int n4 = 0; // 4の倍数
        int n1 = 0; // 2の倍数ではない
        for (int i = 0; i < N; i++) {
            if( A[i] % 4 == 0 ) {
                n4++;
            } else if( A[i] % 2 == 1 ) {
                n1++;
            }
        }

        // [1 4 1 4 と囲ってしまえる
        if( n4 >= n1 ) return "Yes";

        // [1 4 1] のように余計な1が邪魔をしないケース
        if( n1 == n4 + 1 && n1 + n4 == N ) return "Yes";

        return "No";
    }
}


Measured memory_bytes: 50428
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    N, *X = map(int, read().split())
    s = round(sum(X)/len(X))
    res = [(x - s) ** 2 for x in X]
    print(sum(res))
    
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <iostream>
#include <vector>
#include <map>
#include <set>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long> vl;

#define POW2(x) ((x) * (x))

int
main()
{
    int N;
    vector<int> a;
    cin >> N;
    for (int i = 0; i < N; ++i) {
        int tmp;
        cin >> tmp;
        a.push_back(tmp);
    }
    const int l = -100, r = 101;
    int min_cost = 200 * 200 * N;
    int min_num = -100;
    for(int i = l; i < r; ++i) {
        int cost = 0;
        for (int j = 0; j < N; ++j) {
            cost += POW2(a[j] - i);
        }
        
        if (cost <= min_cost) {
            min_num = i;
            min_cost = cost;
        }
    }
    cout << min_cost << endl;
    return 0;
}


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

using namespace std;

void solve() {
  string a;
  cin >> a;

  cout << (a[0] == a[1] && a[1] == a[2] ? "No" : "Yes") << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  solve();
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void){

int n;
int i,j;
int dummy;
double ans=0;


scanf("%d",&n);

float v[n];

for(i=0;i<n;i++){
    scanf("%f",&v[i]);
}

//バブルソートしまーす。小さい順に並べます。
for(i=0;i<n;i++){
    for(j=i+1;j<n;j++){
        if(v[i]>v[j]){
            dummy=v[i];
            v[i]=v[j];
            v[j]=dummy;
        }
    }
}
for(i=0;i<n;i++){
    v[i+1]=(v[i]+v[i+1])/2;
}
ans=v[n]*2;
printf("%f",ans);


   
    

    return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
#include<utility>
#include<map>
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int INF = 1001001001;

ll pow_mod(ll p, ll n, ll m) {
	if (n == 0) return 1;
	else if (n == 1) return p % m;
	else if (n % 2 == 1) return p * pow_mod(p, n - 1, m) % m;
	else {
		ll tmp = pow_mod(p, n / 2, m);
		return (tmp * tmp) % m;
	}
}

ll gcd(ll x, ll y) {
	if (y == 0) {
		return x;
	}
	return gcd(y, x % y);
}

ll com_mod(ll n, ll k, ll m) {
	if (k == 0) return 1;
	else {
		ll x = 1;
		ll y = 1;
		for (ll i = 0; i < k; i++) {
			x = (x * (n - i)) % m;
			y = (y * (i + 1)) % m;
		}
		ll res = (x * pow_mod(y, m - 2, m)) % m;
		return res;
	}
}

int main() {
	int n, k;
	string s;
	cin >> n >> k >> s;
	s[k - 1] = 'a' + (s[k - 1] - 'A');
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3612
/**
 *    author:  tourist
 *    created: 26.05.2018 15:04:10       
**/
#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int ans = (int) 2e9;
  for (int bound : a) {
    vector<int> c;
    multiset<int> s;
    for (int i = 0; i <= n; i++) {
      if (i == n || a[i] < bound) {
        sort(c.begin(), c.end());
        for (int j = 0; j <= (int) c.size() - k; j++) {
          s.insert(c[j]);
        }
        c.clear();
      } else {
        c.push_back(a[i]);
      }
    }
    if ((int) s.size() < q) {
      continue;
    }
    auto it = s.begin();
    for (int i = 0; i < q - 1; i++) {
      it++;
    }
    ans = min(ans, *it - bound);
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;



namespace Test1 {

    class ClassMain {

        static int[] combinationTable = new int[31];
        public static void Main(String[] args) {
            
            int dan;
            initTable();
                
            while ((dan=int.Parse(Console.ReadLine()))!=0) {
                int num_combi = combinationTable[dan];        


                Console.WriteLine(1+num_combi/3650);                
            }
        }

        public static void initTable() {
            combinationTable[0] = 1;
            combinationTable[1] = 1;
            combinationTable[2] = 2;
            combinationTable[3] = 4;
            for (int i = 4; i <= 30; i++) {
                combinationTable[i] =
                    combinationTable[i - 1] + combinationTable[i - 2] + combinationTable[i - 3];
                //Console.WriteLine(i + "," + combinationTable[i]);
            }
        }
        
        
    }
}

Measured memory_bytes: 5612
# coding: utf-8
class CPU():
    def __init__(self, in_quantum):
        self.quantum = in_quantum
        self.total_time = 0
        
    def deal(self, in_process, in_time):
        sum_process_time = 0
        this_process_time = 0

        sum_process_time += in_time[0]
        
        if sum_process_time > self.quantum:
            remain_time = sum_process_time - self.quantum
            this_process_time = in_time[0] - remain_time
            sum_process_time = self.quantum
        
            in_process.append(in_process[0])
            in_time.append(remain_time)
            
            self.total_time += this_process_time
        else:
            this_process_time = in_time[0]
            self.total_time += this_process_time
            #make log
            self.makeLog(in_process[0])

        in_process.pop(0)
        in_time.pop(0)
        
        return in_process, in_time

    def makeLog(self, in_process):
        print(in_process, self.total_time)

    
processes = []
times = []
    
data_cnt, quantum =  list(map(int,input().split(" ")))  

for i in range(data_cnt):
    tmp_process, tmp_time = input().split(" ")
    processes.append(tmp_process)
    times.append(int(tmp_time))

objCPU = CPU(quantum)

while True:
    processes, times = objCPU.deal(processes, times)

    if len(processes) == 0:
        break

Measured memory_bytes: 11552
def divisor(n):
    A = []
    for i in range(1,int(n**0.5)+1):
        if n%i == 0:
            if n//i == i:
                A.append(i)
            else:
                A.append(i)
                A.append(n//i)
    A = [a for a in A if a > 2]
    return A

n = int(input())
A = divisor(n)
ans = 0
for a in A:
    i,j = divmod(n,a-1)
    if i == j:
        ans += a-1
print(ans)

Measured memory_bytes: 3292
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
using namespace std;
typedef long long ll;
 vector<pair<ll,ll>> P;
//vectorをpairに入れてsortする
 int main(){
   ll n,m; cin >> n >> m;
   ll a,b; ll ans=0;
   for(int i=0;i<n;i++){
     cin >> a >> b;
    P.push_back({a,b});
   }
   sort(P.begin(),P.end());
   for(int i=0;i<n;i++){
     if(P[i].second<=m){
       ans+=P[i].first*P[i].second;
       m-=P[i].second;
     }
     else{
       ans+=m*P[i].first;
       break;
     }
   }
   cout << ans <<endl;
   return 0;
 }
 

Measured memory_bytes: 2420
N, D = map(int, input().split())

points = [list(map(int, input().split())) for _ in range(N)]

seisuuninaru = {i**2 for i in range(128)}

cnt = 0
for i in range(N):
    for j in range(i):
        kyori = 0
        for k in range(len(points[i])):
            kyori += (points[i][k] - points[j][k]) ** 2
        if kyori in seisuuninaru:
            cnt += 1

print(cnt)


Measured memory_bytes: 3060
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product, combinations_with_replacement
import sys
import bisect
import string
import math
import time


def I(): return int(input())
def S(): return input()
def MI(): return map(int, input().split())
def MS(): return map(str, input().split())
def LI(): return [int(i) for i in input().split()]
def LI_(): return [int(i)-1 for i in input().split()]
def StoI(): return [ord(i)-97 for i in input()]
def ItoS(nn): return chr(nn+97)
def input(): return sys.stdin.readline().rstrip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def print_matrix(mat):
    for i in range(len(mat)):
        print(*['IINF' if v == IINF else "{:0=4}".format(v) for v in mat[i]])


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**19
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']
show_flg = False
# show_flg = True


def main():
    N = I()
    X = S()
    bit_cnt = X.count('1')
    one_inv_cnt = bit_cnt - 1
    zero_inv_cnt = bit_cnt + 1
    MAX = 2 * 10 ** 5 + 1

    # 大きい数の余り
    # 繰り返し２乗法の発展？
    zero_mod = 0
    one_mod = 0
    # for i in range(len(X)-1, -1, -1):
    for i in range(0, len(X)):
        b = int(X[i])
        if one_inv_cnt != 0:
            one_mod = (one_mod * 2 + b) % one_inv_cnt
        zero_mod = (zero_mod * 2 + b) % zero_inv_cnt

    f = [0] * MAX
    pop_count = [0] * MAX
    for i in range(1, MAX):
        pop_count[i] = pop_count[i//2] + i % 2
        f[i] = f[i % pop_count[i]] + 1

    for i in range(len(X)-1, -1, -1):
        if X[N-1-i] == '1':
            if one_inv_cnt != 0:
                nxt = one_mod
                nxt -= pow(2, i, one_inv_cnt)
                nxt %= one_inv_cnt
                print(f[nxt] + 1)
            else:
                print(0)
        else:
            nxt = zero_mod
            nxt += pow(2, i, zero_inv_cnt)
            nxt %= zero_inv_cnt
            print(f[nxt] + 1)


if __name__ == '__main__':
    main()


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

using namespace std;
using ll = long long;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n, l; cin >> n >> l;
	vector<string> v(n); for(auto &x : v) cin >> x;
	sort(v.begin(), v.end());
	for(auto &x : v) cout << x;
	return 0;
}

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<n; ++i)
#define rep1(i, n) for (int i=1; i<=n; ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main() {
    string s; cin >> s;
    if (s=="Sunny") cout << "Cloudy";
    else if (s=="Cloudy") cout << "Rainy";
    else cout << "Sunny";
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
use proconio::input;
use proconio::marker::Chars;

fn main() {
    input! {
        s: Chars
    };
    let i_a = s.iter().position(|&c| c == 'A').unwrap();
    let i_z = s.iter().rposition(|&c| c == 'Z').unwrap();
    let ans = s[i_a..i_z + 1].iter().count();
    println!("{}", ans);
}


Measured memory_bytes: 3012
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <numeric>
#include <set>
#include <unordered_set>
#include <queue>
#include <boost/math/constants/constants.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;
#define ll long long
#define rep(i, n) for(int i = 0;i < n;i++)
#define FOR(i, n, m) for(int i=n; i<m; ++i)

int main(){
  ll N;
  cin >> N;
  ll A[100];
  ll B[100];
  ll C[100];
  
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> B[i];
  rep(i, N-1) cin >> C[i];
  
  ll sum = 0;
  ll past = -10;
  
  rep(i,N){
    sum += B[A[i]-1];
    if(past+1==A[i]) sum+=C[A[i]-2];
    past = A[i];
    //cout << sum << endl;
  }

  cout << sum << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <vector>
#include <queue>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>
#include <cmath>
#include <set>
#include <functional>
#include <iostream>
#define MOD 1000000007LL
double EPS=1e-10;
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int n;
int p;
int dp[101][101][101];
int cost[101][101];
int x[101],y[101];


int main(void){
	scanf("%d%d",&n,&p);
	for(int i=0;i<n;i++){
		scanf("%d%d",&x[i],&y[i]);
	}
	for(int i=0;i<n;i++){
		int prev=0;
		for(int j=i;j<n;j++){
			int nx=max(0,x[j]-prev);
			int newcost=max(y[j]-nx,0);
			prev=newcost;
			cost[i][j+1]=newcost;
		}
	}
	for(int i=0;i<=n;i++){
		for(int j=0;j<=n;j++){
			for(int k=0;k<=n;k++){
				dp[i][j][k]=-1;
			}
		}
	}
	dp[0][0][0]=p;
	int res=0;
	for(int i=0;i<n;i++){
		for(int j=0;j<=i;j++){
			for(int k=0;k<=i;k++){
				if(dp[i][j][k]>=0.0){
					dp[i+1][j][i+1]=max(dp[i+1][j][i+1],dp[i][j][k]);
					int val=x[i]-cost[k][i];
					if(val-y[i]>=0){
						dp[i+1][j+1][i+1]=max(dp[i+1][j+1][i+1],dp[i][j][k]);
						res=max(res,j+1);
						//printf("%d %d %d %f\n",i+1,j+1,i+1,dp[i+1][j+1][i+1]);
					}else if(dp[i][j][k]-cost[k][i+1]>=0){
						dp[i+1][j+1][k]=max(dp[i+1][j+1][k],dp[i][j][k]-cost[k][i+1]);
						res=max(res,j+1);
						//printf("%d %d %d %f %f\n",i+1,j+1,k,dp[i+1][j+1][k],cost[k][i+1]);
					}
				}
			}
		}
	}
	printf("%d\n",res);
	return 0;
}

Measured memory_bytes: 7256
//g++ -std=c++14 test.cpp -o test.out

#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map> 
#include <unordered_map> 
#include <utility>
#include <limits.h>
#include <bitset>
#include <set>
using namespace std;
 
#define LL long long int
const LL INF = (1LL<<60);
const int INF_INT = 2147483647-1e6-1;
const LL mod = 1000000007ll;
const int mod_int = 1000000007;

LL N,L;
LL A[100000];

string ans = "Impossible";
vector<LL> order;

void solve(){
	int bound = -1;
	for(int i=0;i<=N-2;i++){
		if(A[i]+A[i+1]>=L){
			bound = i+1;
			ans = "Possible";
			break;
		}
	}
	if(bound==-1) return;
	for(int i=1;i<bound;i++) order.push_back(i);
	for(int i=N-1;i>=bound;i--) order.push_back(i);
}

int main(){
    cin >> N >> L;
    for(int i=0;i<N;i++) cin >> A[i];

    solve();

	cout << ans << endl;
	for(int i=0;i<order.size();i++) cout << order[i] << endl;
    return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h> 
using namespace std; 
#define ll long long int
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,k;
	cin>>n>>k;
	vector<ll>arr(n);
	for(ll i =0;i<n;i++)cin>>arr[i];
	sort(arr.begin(),arr.end());
	ll sum = 0;
	for(ll i=0;i<k;i++)sum+=arr[i];
	cout<<sum<<endl;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (b - a == c - b) {
    cout << "YES" << endl;
  } else
    cout << "NO" << endl;
}

Measured memory_bytes: 3604
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
using namespace std;

#define rep(i,n) for(int i = 0; i<n; ++i)
#define REP(i,n) for(int i = 1; i<=n; ++i)
#define all(x) begin(x),end(x)
#define showall(obj) for(auto x:obj)cout<<x<<endl;
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
typedef vector<int> vint;
typedef vector<ll> vll;
const int inf = 100100100;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int n;
void dfs(string s, char mx){
	if(s.size() == n){
		cout<<s<<endl;
		return;
	}
	for(char c = 'a'; c<=mx+1; ++c){
		string t = s;
		t += c;
		dfs(t, max(mx,c));
	}
}

int main(){
	cin>>n;
	dfs("", 'a'-1);
	return 0;
}


Measured memory_bytes: 1536
# coding: utf-8
# Here your code !
import sys
sys.setrecursionlimit(10**7)

def solve():
    N, M = map(int, input().split())
    edges = [[] for _ in [0] * N]
    for _ in [0] * M:
        a, b = map(int, input().split())
        edges[a-1].append(b-1)
        edges[b-1].append(a-1)
    bridges = len(get_lowlink(edges, M)[0])
    print(bridges)
 
"""
edge_numはedgeの数
"""
def get_lowlink(edges, edge_num):

 
    n = len(edges)
    order = [-1] * n
    low = [float("inf")] * n
    bridges = []
    articulations = [0] if edge_num == n-1 and len(edges[0]) > 1 else []
    append_bridge, append_articulation = bridges.append, articulations.append
 
    def dfs(v, prev, k):
        order[v] = low[v] = k
 
        is_articulation = False
        for dest in edges[v]:
            if order[dest] == -1:
                dfs(dest, v, k + 1)
                if low[v] > low[dest]:
                    low[v] = low[dest]
                if order[v] < low[dest]:
                    append_bridge((v, dest))
                is_articulation |= order[v] <= low[dest]
 
            elif dest != prev and low[v] > order[dest]:
                low[v] = order[dest]
 
        if v > 0 and is_articulation:
            append_articulation(v)
 
    dfs(0, 0, 0)
    return bridges, articulations
 
 
if __name__ == "__main__":
    solve()

Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<queue>
#include<cstring>
#include<vector>

using namespace std;

typedef long long ll;

int main(){
  int a[5],k;
  for(int i=0;i<5;i++){
    scanf("%d",&a[i]);
  }
  scanf("%d",&k);

  if(a[4]-a[0]>k){
    printf(":(\n");
  }else{
    printf("Yay!\n");
  }
  
  return 0;
}



Measured memory_bytes: 256
// AOJ CGL_4_B Diameter of a Convex Polygon
// 2018.5.3 bal4u

#include <stdio.h>
#include <stdlib.h>
#include <math.h>

#define EPS 1e-8

typedef struct { double x, y; } PP;

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

double dbl()
{
	int minus = 0;
	double x, y;
	int n = 0, c = gc();
	if (c == '-') minus = 1, c = gc();
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');

	if (c == '.') {
		x = 0;
		y = 1, c = gc();
		do y *= 0.1, x += y * (c & 0xf), c = gc(); while (c >= '0');
		x += n;
	} else x = n;
	if (minus) x = -x;
	return x;
}

PP vsub(PP p1, PP p2) { PP r; r.x = p1.x - p2.x, r.y = p1.y - p2.y; return r; }
double cross(PP a, PP b) { return a.x * b.y - a.y * b.x; }
double norm(PP a) { return a.x * a.x + a.y * a.y; }

double convexDiameter(int n, PP *poly)
{
	int i, j, maxi, maxj;
	double maxd, d;

	int is = 0, js = 0;
	for (i = 1; i < n; i++) {
		if (poly[i].y > poly[is].y) is = i;
		if (poly[i].y < poly[js].y) js = i;
	}
	maxd = norm(vsub(poly[is], poly[js]));

	i = maxi = is;
	j = maxj = js;
	poly[n] = poly[0];
	do {
		if (cross(vsub(poly[i+1], poly[i]), vsub(poly[j+1], poly[j])) >= 0) {
			if (++j == n) j = 0;
		} else {
			if (++i == n) i = 0;
		}
	    if ((d=norm(vsub(poly[i], poly[j]))) > maxd) {
			maxd = d;
			maxi = i; maxj = j;
		}
	} while (i != is || j != js);
	return maxd; /* farthest pair is (maxi, maxj). */
}

PP p[80005];

int main()
{
	int n, i;

	n = in();
	for (i = 0; i < n; i++) p[i].x = dbl(), p[i].y = dbl();
	printf("%.10lf\n", sqrt(convexDiameter(n, p)));
	return 0;
}



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


void solve(std::string S){
    ll n = S.length();
    ll cnt = 0;
    for(ll i=0; i< n-1; i++){
        if(S.at(i)!=S.at(i+1)) cnt ++;
    }
    cout << cnt << endl;
}

int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 512
n = gets.chomp.to_i
i = 1

def check_mod_10(arg)
  @result += " #{i}" if arg % 10 == 3
end

@result = ""
while i <= n
  x = i
  if x % 3 == 0
    @result += " #{i}"
  else
    begin
      if x % 10 == 3
        @result += " #{i}"
        break
      end
    end while (x = x / 10) > 0
  end
  i += 1
end

puts @result



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


int main(){
  int a, b;
  cin >> a >> b;
  int d = a - 2 * b;
  if (d >= 0){
    cout << d << endl;
  }else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<vector>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
const int mod=998244353;
int n,k,l[11],r[11];
ll f[200001],s[200001];
int main(){
	cin>>n>>k;
	n--;
	for(int i=1;i<=k;i++) cin>>l[i]>>r[i];
	s[0]=f[0]=1;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=k;j++){
			if(i<l[j]) continue;
			if(i<=r[j]) f[i]=(f[i]+s[i-l[j]])%mod;
			else f[i]=(f[i]+mod+s[i-l[j]]-s[i-r[j]-1])%mod;
		}
		s[i]=(s[i-1]+f[i])%mod;
	}
	cout<<f[n];
}

Measured memory_bytes: 6740
n = int(input())
a = [0] + list(map(int,input().split())) + [0]

cost = 0
for i in range(n+1):
  cost += abs(a[i+1]-a[i])
  
for i in range(1,n+1):
  if (a[i]>a[i-1] and a[i]>a[i+1]) or (a[i]<a[i-1] and a[i]<a[i+1]):
    print(cost - abs(a[i]-a[i-1]) - abs(a[i]-a[i+1]) + abs(a[i+1]-a[i-1]))
  else:
    print(cost)

Measured memory_bytes: 20576
N, M = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(N)]
cd = [list(map(int, input().split())) for _ in range(M)]


for i in range(N):
    tmp = []
    for j in range(M):
        tmp.append(abs(ab[i][0] - cd[j][0]) + abs(ab[i][1] - cd[j][1]))
    print(tmp.index(min(tmp))+1)

Measured memory_bytes: 3064
// 🚽 = 2 Minutes
// 🚽 + 📱 = 5 Minutes
// 🚽 + 📱 + ⁣📶 = 10 Minutes
// 🚽 + 📱 + 📶 + 🔋 = Infinite 

/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

// input/output
#include <iostream>
#include <fstream>
#include <sstream>
// container class
#include <array>
#include <deque>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
// math, algorithm
#include <algorithm>
#include <cmath>
#include <complex>
#include <numeric>
// etc
#include <bitset>
#include <cassert>
#include <cctype>
#include <cstring>
#include <chrono>
#include <iomanip>
#include <random>
#include <utility>
// using-directive
using namespace std;
// alias template
using int64 = long long;
using vi = vector<int>;
using vl = vector<int64>;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
// text macro replacement
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define print(x) cout << (x) << '\n'
#define debug(x) cerr << #x << ": " << (x) << '\n'
#define dbg(v) for (size_t _ = 0; _ < v.size(); ++_){cerr << #v << "[" << _ << "] : " << v[_] << '\n';}
// variadic template
template<typename T> inline void chmin(T &a, T b) {if (a > b) a = b; return;}
template<typename T> inline void chmax(T &a, T b) {if (a < b) a = b; return;}
// constant
const int INF = (1<<30) - 1;
const int64 INF64 = (1LL<<62) - 1;
const int MOD = 1000000007;

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

  deque<int> dq;

  int query; cin >> query;

  for (int i = 0; i < query; ++i) {
    int op; cin >> op;
    if (op == 0) {
      int d; cin >> d;
      int x; cin >> x;
      if (d == 0) {
        dq.push_front(x);
      } else {
        dq.push_back(x);
      }
    } else if (op == 1) {
      int p; cin >> p;
      cout << dq[p] << '\n';
    } else {
      int d; cin >> d;
      //int x; cin >> x;
      if (d == 0) {
        dq.pop_front();
      } else {
        dq.pop_back();
      }
    }
  }

  return 0;
}


Measured memory_bytes: 4604
import collections
S = [i for i in input()]
T = [i for i in input()]
Scount = collections.Counter(S)
Tcount = collections.Counter(T)
check = True
for (s,t) in zip(Scount.most_common(),Tcount.most_common()):
    if s[1]!=t[1]:
        check = False
        break
if check == True:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 7292
#include<stdio.h>
#include<stdlib.h>
long minf(long a,long b){
  if(a>b){
    return b;
  }else{
    return a;
  }
}

long maxf(long a,long b){
  if(a>b){
    return a;
  }else{
    return b;
  }
}

int main(){
  long long n = 0;
  long long W = 0;
  long long w[100] = {};
  long long v[100] = {};
  long long dp[100][100001] = {};
  long long min = -1;
  long long max = -1;
  
  long i = 0;
  long j = 0;
  
  scanf("%lld %lld",&n,&W);
  
  for(i=0;i<n;i++){
    scanf("%lld %lld",&w[i],&v[i]);
  }
  
  for(j=0;j<=100000;j++){
      if(w[0] <= j){
        dp[0][j] = v[0];
      }else{
        dp[0][j] = 0;
      }
  } 
  
  for(i=1;i<n;i++){
    for(j=0;j<=100000;j++){
      if(w[i] > j){
        dp[i][j] = dp[i-1][j];
      }else{
        dp[i][j] = maxf(dp[i-1][j-w[i]]+v[i],dp[i-1][j]);
      }
    }  
  }
  printf("%lld",dp[n-1][W]);
  return 0;
}
    

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)

int main(){
    int H, W;
    cin >> H >> W;
    int h,w;
    cin >> h>> w;

    cout << H*W - h*W - w*(H-h) << endl;
    return 0;
}


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

int main()
{
	int N,K,i;
	int num = 1;
	
	cin >> N >> K;
	

	for (i = 0; i < N; i++){
		
		if (num < K){
			num = num*2;
		}else{
			num = num + K;
		}
	}
	cout << num << endl;
}

Measured memory_bytes: 3652
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	S := sc.nextStr()
	if S[2] == S[3] && S[4] == S[5] {
		fmt.Fprintln(wtr, "Yes")
	} else {
		fmt.Fprintln(wtr, "No")
	}
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<int, int> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
// #define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
// #define h 998244353
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
    if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int MAXN = 1e5+7;

// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
// #define trace6(a, n,i;b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;

// Constants //
 
/*** Template Ends ***/
ld euclid(ld x,ld y,ld i,ld j)
{
  return sqrt(abs(x*x-i*i)+abs(y*y-j*j));
}
void solve()
{
 ll n,r;
 cin>>n>>r;
 if(n>=10)
  cout<<r;
  else
    cout<<r+100*(10-n);
}
int main()
{ 
  // ios;
  // fxreopen("inputt.txt", "w", stdout);
  ll t;
  // cin >> t;
  t=1;
  while(t--)
    solve();
  return 0;
}

Measured memory_bytes: 256
//============================================================================
// Name        : abc056_A.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
	int w, a, b;

	cin >> w >> a >> b;

	vector<int> x = { a, b };

	sort(x.begin(), x.end());
	x.at(0) += w;

	for (int var = 0; true; ++var) {
		int tmp = x.at(0) + var;
		if (tmp >= x.at(1)) {
			cout << var << endl;
			break;
		}
	}

	return 0;
}


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

int main() {
  string s, t; cin >> s >> t;
  bool is_match;
  for (int i=0; i<s.size(); i++) {
    is_match = true;
    for (int j=0; j<t.size(); j++) {
      if (s.at((i+j)%s.size()) != t.at(j)) {
        is_match=false; break;
      }
    }
    if (is_match) {
      cout << "Yes" << endl; break;
    }
  }
  if (!is_match) cout << "No" << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()

using namespace std;


int main(){

    string s;
    cin >> s;
    bool ans = true;

    rep(i,s.size()){
        if(i % 2 == 0){
            if(s[i] == 'L'){
                ans = false;
                break;
            }
        }else{
            if(s[i] == 'R'){
                ans = false;
                break;
            }
        }

    }


    cout << (ans ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<iostream>
#include<queue>
#include<vector>
#include <bitset>
using namespace std;
#define INF 1000000000000
#define MAX 1000000000000000000
typedef long long ll;
typedef pair<ll,int> P;
typedef pair< pair<int,int>, int> p; 
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/

int main(){
    int N,count=0;
    cin>>N;
    ll a;
    vector<P> V;
    for(int i=0;i<N;i++){
        bool flag=false;
        cin>>a;
        for(int i=0;i<(int)V.size();i++){
            if(V[i].first==a){
                V[i].second++;
                flag=true;
            }
        }
        if(V.size()>=4){
            cout<<"No"<<endl;
            return 0;
        }
        if(flag) continue;
        V.push_back(P(a,1));
    }
    if((int)V.size()==3){
        int x=V[0].first^V[1].first;
        x^=V[2].first;
        if(x==0 && V[0].second==V[1].second && V[1].second==V[2].second){
            cout<<"Yes"<<endl;
        }else cout<<"No"<<endl;

    }else if((int)V.size()==2){
        if((V[0].first==0 && V[0].second*2==V[1].second) || (V[1].first==0 && V[1].second*2==V[0].second) ){
            cout<<"Yes"<<endl;  
        }else cout<<"No"<<endl;
    }else if((int)V.size()==1){
        if(V[0].first==0) cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }else cout<<"No"<<endl;
}

Measured memory_bytes: 256
N = int(input())
s = []
t = []
for i in range(N) :
    p, q = input().split()
    s.append(p)
    t.append(int(q))
X = input()

xi = s.index(X)
ans = 0
for i in range(xi+1, N) :
    ans += t[i]

print(ans)


Measured memory_bytes: 38384
import java.util.*;

public class Main {
	
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			if(n == 0) break;
			ArrayList<TreeSet<Integer>> data = new ArrayList<TreeSet<Integer>>();
			for(int i=0; i < n; i++){
				data.add(new TreeSet<Integer>());
				int m = sc.nextInt();
				for(int j=0; j < m; j++){
					data.get(i).add(sc.nextInt());
				}
			}
			int m = sc.nextInt();
			TreeSet<Integer> klist = new TreeSet<Integer>();
			for(int i=0; i < m; i++){
				klist.add(sc.nextInt());
			}
			int ind = -1;
			for(int i=0; i < n; i++){
				boolean flg = true;
				for(int result: klist){
					if(! data.get(i).contains(result)){
						flg = false;
					}
				}
				if(flg){
					if(ind == -1){
						ind = i+1;
					}
					else{
						ind = -1;
						break;
					}
				}
			}
			System.out.println(ind);
		}
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 16000
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
using namespace __gnu_pbds; 
using namespace std;

#define ff              first
#define ss              second
#define int             long long
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             998244353
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define FIO             ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
mt19937                 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int fc[100001], in[100001];
vector<vector<int>> adj;
int pwmd(int a, int n)
{
	if (!n)
		return 1;
	int pt = pwmd(a, n / 2);
	pt *= pt, pt %= mod;
	if (n & 1)
		pt *= a, pt %= mod;
	return pt;
}


int32_t main()
{
	string s,t;
	cin>>s>>t;
	int flag=1;

	for(int i=0;i<s.length();i++)
		if(s[i]!=t[i])
			flag=0;

	if(t.length()<=s.length())
		flag=0;

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

Measured memory_bytes: 3640
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#define SIZE 100005
#define INF 1000000005

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

struct UF
{
	int par[SIZE],rank[SIZE];
	
	void init(int n)
	{
		for(int i=0;i<n;i++)
		{
			par[i]=i;
			rank[i]=0;
		}
	}
	int find(int x)
	{
		if(par[x]==x) return x;
		return par[x]=find(par[x]);
	}
	void unite(int x,int y)
	{
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]) par[x]=y;
		else
		{
			par[y]=x;
			if(rank[x]==rank[y]) rank[x]++;
		}
	}
	bool same(int x,int y)
	{
		return find(x)==find(y);
	}
};
UF uf;
int A[SIZE];
vector <int> vec[SIZE];

int main()
{
	int n,m;
	scanf("%d %d",&n,&m);
	uf.init(n+2);
	for(int i=0;i<n;i++)
	{
		scanf("%d",&A[i]);
	}
	for(int i=0;i<m;i++)
	{
		int x,y;
		scanf("%d %d",&x,&y);
		uf.unite(x,y);
	}
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(uf.find(i)==i) cnt++;
		int p=uf.find(i);
		vec[p].push_back(A[i]);
	}
	if((cnt-1)*2>n)
	{
		puts("Impossible");
		return 0;
	}
	if(cnt==1)
	{
		puts("0");
		return 0;
	}
	ll ret=0;
	vector <int> vt;
	for(int i=0;i<n;i++)
	{
		if(uf.find(i)==i)
		{
			sort(vec[i].begin(),vec[i].end());
			ret+=vec[i][0];
			for(int j=1;j<vec[i].size();j++) vt.push_back(vec[i][j]);
		}
	}
	sort(vt.begin(),vt.end());
	for(int i=0;i<cnt-2;i++) ret+=vt[i];
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 6912
#include <stdio.h>
#include <math.h>
#include <stdlib.h>

int main (void) {
    int N, X;
    int i, j, count, count2;
    int integer, value, value2;
    
    scanf("%d", &X);
    
    if(X>=400 && X <= 599)  printf("8");
    else if (X >=600 && X <=799) printf("7");
    else if (X >=800 && X <=999) printf("6");
    else if (X >=1000 && X <=1199) printf("5");
    else if (X >=1200 && X <=1399) printf("4");
    else if (X >=1400 && X <=1599) printf("3");
    else if (X >=1600 && X <=1799) printf("2");
    else if (X >=1800 && X <=1999) printf("1");
    
    
    return 0;
}


Measured memory_bytes: 2084
#include <bits/stdc++.h>
using namespace std ;
inline long long Readin() {
	long long K = 0 , F = 1 ; char C = ' ' ;
	while( C < '0' or C > '9' ) F = C == '-' ? -1 : 1 , C = getchar() ;
	while( C <= '9' and C >= '0' ) K = ( K << 1 ) + ( K << 3 ) + C - '0' , C = getchar() ;
	return F * K ;
}
int main() {
	int A = Readin() , B = Readin() , C = Readin() ;
	return not printf( "%d\n" , ( A - B + 1 ) * ( A - C + 1 ) ) ; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll n;
  cin >> n;
  ll sum = 0;
  FOR(i, 1, n + 1) { sum += i; }
  cout << sum << endl;
  return 0;
}

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

int main(){
 ios_base::sync_with_stdio(0);
 cin.tie(0), cout.tie(0);

 int k,n;
 cin >> k >> n;
 vector<int> ve;
 for(int i=1; i<=n; i++){
 	int x;
 	cin >> x;
 	ve.push_back(x);
 }
 int maks = 0;
 for(int i=0; i<n-1; i++){
 	maks = max(maks, ve[i+1]-ve[i]);
 }
 maks = max(maks, ve[0]+k-ve[n-1]);
 cout << k-maks << "\n";

}


Measured memory_bytes: 1400
n=int(input())
HPOINT=0
TPOINT=0
for _ in range(n):
  HANAKO,TAROU=input().split()
  if HANAKO>TAROU:
    HPOINT += 3
  elif HANAKO<TAROU:
    TPOINT += 3
  elif HANAKO==TAROU:
    HPOINT+=1
    TPOINT+=1
print(HPOINT,TPOINT)
  
    

Measured memory_bytes: 7644
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll m, d;
  cin >> m >> d;
  if (d < 10) {
    cout << 0 << endl;
    return 0;
  }

  ll ans = 0;
  FOR(i, 1, m + 1) {
    FOR(j, 10, d + 1) {
      ll d1 = j / 10, d10 = j % 10;
      ll mul = d1 * d10;
      if (d1 >= 2 && d10 >= 2 && i == mul) {
        ans++;
      }
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
using namespace std;
int main() {
  int a,b,q;
  cin >> a >> b >> q;
  long* s = new long[100002];
  long* t = new long[100002];
  long* x = new long[100000];
  s[0] = -1000000000000;
  s[a+1] = 1000000000000;
  t[0] = -1000000000000;
  t[b+1] = 1000000000000;
  for(int i=1;i<=a;i++) cin >> s[i];
  for(int i=1;i<=b;i++) cin >> t[i];
  for(int i=0;i<q;i++) cin >> x[i];

  for(int i=0;i<q;i++){
    long xi = x[i];

    int sa,tb;
    int bb=0,ee=a+1;
    while(ee-bb>1){
      int mid = (bb+ee)/2;
      if(s[mid]<xi){
        bb = mid;
      } else {
        ee = mid;
      }
    }
    sa = bb;
    bb=0,ee=b+1;
    while(ee-bb>1){
      int mid = (bb+ee)/2;
      if(t[mid]<xi){
        bb = mid;
      } else {
        ee = mid;
      }
    }
    tb = bb;

    long ans=1000000000000000000;

    ans = min(ans,abs(xi-s[sa+0])+abs(t[tb+0]-s[sa+0]));
    ans = min(ans,abs(xi-s[sa+1])+abs(t[tb+0]-s[sa+1]));
    ans = min(ans,abs(xi-s[sa+0])+abs(t[tb+1]-s[sa+0]));
    ans = min(ans,abs(xi-s[sa+1])+abs(t[tb+1]-s[sa+1]));
    ans = min(ans,abs(xi-t[tb+0])+abs(s[sa+0]-t[tb+0]));
    ans = min(ans,abs(xi-t[tb+1])+abs(s[sa+0]-t[tb+1]));
    ans = min(ans,abs(xi-t[tb+0])+abs(s[sa+1]-t[tb+0]));
    ans = min(ans,abs(xi-t[tb+1])+abs(s[sa+1]-t[tb+1]));

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


Measured memory_bytes: 3712
import java.util.*;
class Main{
    public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int N =	sc.nextInt();
	int T =	sc.nextInt();
	int[] cost = new int[N];
	int[] time = new int[N];
	for(int i = 0; i< N; i++) {
            cost[i] = sc.nextInt();
	    time[i] = sc.nextInt();
            if(time[i] > T) cost[i] = 1001;
	}
	int min	= 1001;
	for(int i = 0; i< N; i++) {
            if(cost[i] < min) min = cost[i];
	}
	if(min == 1001)	{
            System.out.println("TLE");
        }else {
            System.out.println(min);
	}

    }
}

Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>

using namespace std;

template <typename T>
static inline void ArrayInput(vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cin >> *itr;
}

template <typename T>
static inline void ArrayPut(const vector<T>& A) {
  for (auto itr = A.begin(); itr < A.end(); ++itr) cout << *itr << " ";
  cout << endl;
}

bool Sec_compare(pair<uint64_t, uint64_t> a, pair<uint64_t, uint64_t> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}

int main() {
  uint64_t A, B;
  cin >> A >> B;

  if (A > 9 || B > 9) {
    cout << "-1" << endl;
  } else {
    cout << A * B << endl;
  }

  return 0;
}


Measured memory_bytes: 256
n = int(input())

dicts = {}
dicts[1] = "a"
dicts[2] = "b"
dicts[3] = "c"
dicts[4] = "d"
dicts[5] = "e"
dicts[6] = "f"
dicts[7] = "g"
dicts[8] = "h"
dicts[9] = "i"
dicts[10] = "j"
dicts[11] = "k"
dicts[12] = "l"
dicts[13] = "m"
dicts[14] = "n"
dicts[15] = "o"
dicts[16] = "p"
dicts[17] = "q"
dicts[18] = "r"
dicts[19] = "s"
dicts[20] = "t"
dicts[21] = "u"
dicts[22] = "v"
dicts[23] = "w"
dicts[24] = "x"
dicts[25] = "y"
dicts[0] = "z"
arr = []
while n > 0:
    add = n % 26
    arr.append(add)
    n = n // 26 
    if add == 0:
        n -= 1

revarr = arr[::-1]
ans = ""
# print(arr)
#print(revarr)
for i in revarr:
    ans += dicts[i]
print(ans)



Measured memory_bytes: 61824
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cctype>
#include <sstream>
#include <cmath>
#include <climits>
#include <set>
#include <map>

using namespace std;

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

typedef vector<int> vi;
typedef pair<string, int> psi;

string itoa(int v)
{
	stringstream sstr;
	sstr << v;
	return sstr.str();
}

int a[4];

vector<psi> search(int left, int right)
{
	if(right-left == 1)
		return vector<psi>(1, psi(itoa(a[left]), a[left]));

	vector<psi> ret;
	reep(i, left+1, right){
		vector<psi> b = search(left, i);
		vector<psi> c = search(i, right);
		rep(j, b.size()) rep(k, c.size()){
			ret.push_back(psi(string("(") + b[j].first + "+" + c[k].first + ")", b[j].second+c[k].second));
			ret.push_back(psi(string("(") + b[j].first + "-" + c[k].first + ")", b[j].second-c[k].second));
			ret.push_back(psi(string("(") + b[j].first + "*" + c[k].first + ")", b[j].second*c[k].second));
		}
	}

	return ret;
}

int main()
{
	while(1){
		rep(i, 4) scanf("%d", &a[i]);
		if(!a[0]) break;
		sort(a, a+4);

		bool con = true;
		do{
			vector<psi> h = search(0, 4);
			rep(i, h.size()){
				if(h[i].second == 10){
					puts(h[i].first.c_str());
					con = false;
					break;
				}
			}
		}while(con && next_permutation(a, a+4));

		if(con)
			puts("0");
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using ll = int64_t;
using ul = uint64_t;
using namespace std;

void solve() {
    int n;
    cin >> n;
    vector<int> slimes(n);
    for (auto &s : slimes) cin >> s;

    int prev = slimes.front();
    int cnt = 0, subcnt = 1;
    for (size_t i = 1; i < slimes.size(); i++) {
        if (slimes.at(i) == prev) {
            subcnt++;
        } else {
            cnt += subcnt / 2;
            subcnt = 1;
        }
        prev = slimes.at(i);
    }
    if (subcnt != 1) {
        cnt += subcnt / 2;
    }
    cout << cnt << endl;
}

int main() {
    fastIO;
    // rep(i, 4) {
    //     cout << ">>>>>>>>>> NO. " << (i + 1) << endl;
    //     solve();
    //     cout << endl;
    // }
    solve();
}


Measured memory_bytes: 3600