akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author HossamDoma
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {

            int n = in.nextInt();

            boolean ok = n % 10 == 9;

            if (!ok) {
                n /= 10;
                ok = n % 10 == 9;
            }

            out.println(ok ? "Yes" : "No");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

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

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

    }
}



Measured memory_bytes: 23380
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Text.RegularExpressions;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var nd = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            int n = nd[0], d = nd[1];
            List<int>[] ls = new List<int>[n];
            for (int i = 0; i < n; i++)
                ls[i] = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32).ToList();
            int kq = 0;
            for (int i = 0; i < n - 1; i++)
                for (int j = i + 1; j < n; j++)
                {
                    double kc = 0;
                    for (int l = 0; l < d; l++)
                        kc += Math.Pow(ls[i][l] - ls[j][l], 2);
                    kc = Math.Sqrt(kc);
                    if (kc % 1 == 0) kq++;
                }
            Console.WriteLine(kq);
        }
    }
}


Measured memory_bytes: 13396
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x) cout<<#x<<" = "<<(x)<<endl;
#define Yes(x) cout<<(x?"Yes":"No")<<endl;
#define YES(x) cout<<(x?"YES":"NO")<<endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a; cin >> a;
  string s; cin >> s;
  COUT(a>=3200?s:"red");
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;

const int MAX = 100000;
const int MAX2 = 200000;

/**
 * Union-Find木です。
 * クラスカル法でも扱う時にどうぞ
 */
typedef class unionFind {
	private:
		vector<int> parent; // 負数ならばデータ数、正数ならば親の場所
	public:
		unionFind(int n) : parent(n, -1){}
		int find(int n);
		void unite(int n, int m);
		bool isEqual(int n, int m);
} UnionFind;

/**
 * nの属している木の頂点を返します
 * @param n 調べるデータ
 * @return nが属している木の頂点
 */
int unionFind::find(int n) {
	if (parent[n] < 0) return n;
	return parent[n] = find(parent[n]);
}

/**
 * nの属する木とmの属する木を結合します
 * @param n 結合したいデータ
 * @param m 結合したいデータ
 */
void unionFind::unite(int n, int m) {
	n = find(n);
	m = find(m);
	if (n == m) return;
	if (parent[n] > parent[m]) {
		parent[m] += parent[n];
		parent[n] = m;
	} else {
		parent[n] += parent[m];
		parent[m] = n;
	}
}

/**
 * nとmが同じ木に属しているか調べます
 * @param n 調べるデータ
 * @param m 調べるデータ
 * @return 同じ木に属していたならtrue
 */
bool unionFind::isEqual(int n, int m) {
	return find(n) == find(m);
}

/**
 * aとbの町における道を作る料金を返すよ！
 */
int cost(pair<int, int> a, pair<int, int> b) {
	return min(abs(a.first - b.first), abs(a.second - b.second));
}


int main() {
	int N;
	static int x[MAX], y[MAX];
	cin >> N;
	for (int i = 0;i < N;i ++) cin >> x[i] >> y[i];
	
	static pair<pair<int, int>, int> city[MAX];
	static pair<int, pair<int, int> > edge[MAX2];
	for (int i = 0;i < N;i ++) {
		city[i] = make_pair(make_pair(x[i], y[i]), i);
	}
	sort(city, city+N); // まずはx軸方向の辺
	for (int i = 0;i < N - 1;i ++) {
		edge[i] = make_pair(cost(city[i].first, city[i + 1].first), make_pair(city[i].second, city[i + 1].second));
	}
	for (int i = 0;i < N;i ++) {
		city[i] = make_pair(make_pair(y[i], x[i]), i);
	}
	sort(city, city+N); // 	次はy軸方向の辺
	for (int i = 0;i < N - 1;i ++) {
		edge[i + N - 1] = make_pair(cost(city[i].first, city[i + 1].first), make_pair(city[i].second, city[i + 1].second));
	}
	sort(edge, edge + 2 * N - 2); // これで距離最小から調べる状態にできた
	int connect = 0, cost = 0; // 繋いだ道の数とその長さ
	UnionFind uni(N);
	for (int i = 0;i < 2 * N - 2;i ++) {
		if (!uni.isEqual(edge[i].second.first, edge[i].second.second)) {
			connect ++;
			cost += edge[i].first;
			if (connect >= N - 1) {
				cout << cost;
				return 0;
			}
			uni.unite(edge[i].second.first, edge[i].second.second);
		}
	}
	return 0;
}
/*
31536000のコメント解説欄
ここテンプレで用意してるから、A問題とかだとこの先空欄の危険あり

どう見ても最小全域木
なので最小全域木のライブラリ貼り付けると速いよ
……まぁ、それだとあれだし解説していくね

まず、辺の数がそのままだとO(N^2)、これで最小全域木はそもそも動かない
辺の数を減らしてみようか
まず、x軸だけで考えてみよう
位置関係がA---B--Cとなっているときに、AとCを繋ぐ必要は？ないよね、Bを経由させてあげれば良い
同様にy軸も同じことが言える
ということは、xかyで隣り合った方向にしか接続しない
これで辺の数が2N-2に減った、後はそこからN-1本を絞り込むのはそれこそ最小全域木
私はクラスカル法派なのでUnion-Findを使うよ
*/

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

typedef struct node{
	struct node*oya;
	struct node*ko[2];
	int val;
}node;

int push(node*v,node*oya,int dir,int val){
	if(!v){
		v=(node*)calloc(1,sizeof(node));
		(*v).oya=oya;
		(*v).val=val;
		(*oya).ko[dir]=v;
	}else{
		int d=(*v).val<val;
		push((*v).ko[d],v,d,val);
	}
}

node*find(node*v,int val){
	if(!v)return 0;
	if((*v).val==val)return v;
	int d=(*v).val<val;
	return find((*v).ko[d],val);
}
node*nxt(node*v){
	if((*v).ko[0])return nxt((*v).ko[0]);
	if((*v).ko[1])return nxt((*v).ko[1]);
	return v;
}

void del(node*v){
	if(!v)return;
	if((*v).ko[0]){
		if((*v).ko[1]){
			node*nnn=nxt((*v).ko[1]);
			(*v).val=(*nnn).val;
			del(nnn);
		}else{
			if((*(*v).oya).ko[0]==v)(*(*v).oya).ko[0]=(*v).ko[0];
			else (*(*v).oya).ko[1]=(*v).ko[0];
			(*(*v).ko[0]).oya=(*v).oya;
			free(v);
		}
	}else{
		if((*v).ko[1]){
			if((*(*v).oya).ko[0]==v)(*(*v).oya).ko[0]=(*v).ko[1];
			else (*(*v).oya).ko[1]=(*v).ko[1];
			(*(*v).ko[1]).oya=(*v).oya;
			free(v);
		}else{
			if((*(*v).oya).ko[0]==v)(*(*v).oya).ko[0]=0;
			else (*(*v).oya).ko[1]=0;
			free(v);
		}
	}
}

void f(node*v,int mode){
	if(!v)return;
	if(mode==0)printf(" %d",(*v).val);
	f((*v).ko[0],mode);
	if(mode==1)printf(" %d",(*v).val);
	f((*v).ko[1],mode);
}


node root;
int main(){
	int n;
	scanf("%d",&n);
	while(n--){
		char s[10];
		scanf("%s",s);
		if(s[0]=='p'){
			f(root.ko[0],1);
			puts("");
			f(root.ko[0],0);
			puts("");
		}else if(s[0]=='i'){
			int t;
			scanf("%d",&t);
			push(root.ko[0],&root,0,t);
		}else if(s[0]=='f'){
			int t;
			scanf("%d",&t);
			puts(find(root.ko[0],t)?"yes":"no");
		}else if(s[0]=='d'){
			int t;
			scanf("%d",&t);
			del(find(root.ko[0],t));
		}
	}
}


Measured memory_bytes: 20456
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

	cout << (a * b % 2 == 0 ? "Even" : "Odd") << endl;

}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

import sys

def is_right_triangle(hypotenuse, x, y):
    if x**2 + y**2 == hypotenuse**2:
        return True
    return False

def main():
    N = int(input())
    for i in range(N):
        length = [int(n) for n in input().split()]
        length.sort(reverse=True)
        ret = 'YES' if is_right_triangle(*length) else 'NO'
        print(ret)

if __name__ == '__main__':
    main()

Measured memory_bytes: 7604
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys
sys.setrecursionlimit(10**7)
from pprint import pprint as pp
from pprint import pformat as pf

import math
#from sortedcontainers import SortedList, SortedDict, SortedSet # no in atcoder
import bisect


if __name__ == '__main__':
    any_haver = set()
    num_nusuke, num_treat_type = list(map(int, input().split()))
    for i in range(num_treat_type):
        _ = int(input())
        treat_haver = list(map(int, input().split()))
        for nusuke_id in treat_haver:
            any_haver.add(nusuke_id)
    # check
    count_not_have = 0
    for nusuke_id in range(1, num_nusuke + 1):
        #print('nusuke_id') # debug
        #print(nusuke_id) # debug
        if nusuke_id not in any_haver:
            count_not_have += 1
    #print('count_not_have') # debug
    #print(count_not_have) # debug
    print(count_not_have)



    #print('\33[32m' + 'end' + '\033[0m') # debug


Measured memory_bytes: 68704
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <unordered_map>
#include <ctime>
#include <list>
#include <numeric>
#include <utility>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod 1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

/*---------------------------------------------------*/

int main(){
  ll n,q;
  ll t,x,d;
  ll c[1005],apple[1005]={0};
  cin>>n;
  REP(i,1,n+1)cin>>c[i];
  cin>>q;
  rep(i,q){
    cin>>t>>x>>d;
    if(t==1){
      apple[x]+=d;
      if(c[x]<apple[x]){
	cout<<x<<endl;
	return 0;
      }
    }
    if(t==2){
      apple[x]-=d;
      if(apple[x]<0){
	cout<<x<<endl;
	return 0;
      }
    }
  }
  cout<<0<<endl;
  return 0;
}



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

using namespace std;

#define ll long long

int main()
{
	string s;
	cin >> s;

	ll aCount = 0;
	ll ans = 0;

	if (s.size() < 3) {
		cout << 0 << endl;
		return 0;
	}

	for (size_t i = 0; i < s.size() - 2; i++) {
		if (s[i] == 'A') {
			aCount++;
		} else {
			aCount = 0;
		}

		if (s.substr(i, 3) == "ABC") {
			ans += aCount;
			s[i + 2] = 'A';
			i++;
			aCount--;
		}
	}

	cout << ans << endl;

	return 0;
}


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

void winter_is_coming()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL); cout.tie(NULL );
}

long long n,m,ans=0,w,b;
char ch[401][401];
int vis[401][401];
bool valid(int x,int y, char c)
{
    if(x>=0 && x<n && y>=0 && y<m && !vis[x][y] && ch[x][y]!=c )return true;
    return false;
}
void dfs(int x,int y)
{
   if(ch[x][y]=='.')w++;
   else             b++;

    if(valid(x+1,y,ch[x][y]))
    {
        vis[x+1][y]=1,dfs(x+1,y);
    }
    if(valid(x-1,y,ch[x][y]))
    {
        vis[x-1][y]=1,dfs(x-1,y);
    }
    if(valid(x,y+1,ch[x][y]))
    {
        vis[x][y+1]=1,dfs(x,y+1);
    }
    if(valid(x,y-1,ch[x][y]))
    {
        vis[x][y-1]=1,dfs(x,y-1);
    }
}
int main()
{
   winter_is_coming();

   cin>>n>>m;
   for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin>>ch[i][j];

   for(int i=0;i<n;i++)
   {
      for(int j=0;j<m;j++)
      {
        w=b=0;
        if(!vis[i][j] && ch[i][j]=='#') vis[i][j]=1,dfs(i,j);
        ans+=w*b;
      }
   }
   cout<<ans<<"\n";


    return 0;
}


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

int main(void)
{
  int ans;
  int A, B;
  cin >> A >> B;
  if(A>B)ans = 2*A - 1;
  else if(A<B)ans = 2*B - 1;
  else ans= 2*A;
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS 
#include <stdio.h>

void swap(int* a, int* b);

int main()
{
	int a, b, c;
	a = 0, b = 0, c = 0;

	scanf("%d %d %d", &a, &b, &c);

	if (a >= 1 && a <= 10000 && b >= 1 && b <= 10000 && c >= 1 && c <= 10000) {
		if (a > b) { swap(&a, &b); }
		if (a > c) { swap(&a, &c); }
		if (b > c) { swap(&b, &c); }

		printf("%d %d %d\n", a, b, c);
	}
	return 0;
}

void swap(int* a, int* b) {
	int temp = *a;
	*a = *b;
	*b = temp;
}


Measured memory_bytes: 2036
#include <stdio.h>
int main(void)
{
	int i,sum;
	char num[1000];
	while(1){
		scanf("%s",num);
		sum=0;
		i=0;
		while(num[i] != '\0'){
			sum+=num[i]-'0';
			i++;
		}
		if(sum==0) break;
		printf("%d\n",sum);
	}
    return 0;
}

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


typedef long long ll;
typedef pair<ll,int> P;

struct edge {int to; ll cost; };

int dx[] = {-1, 1, 0,  0};
int dy[] = { 0, 0, 1, -1};
 
int main(){
  int n;
  cin >> n;
  string ans;
  cin >> ans;
  if(n<3200) ans = "red";
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3608
/*
 _     _                             
| |__ | |__   __ _  __ _ _   _  __ _ 
| '_ \| '_ \ / _` |/ _` | | | |/ _` |
| |_) | | | | (_| | (_| | |_| | (_| |
|_.__/|_| |_|\__,_|\__, |\__, |\__,_|
                   |___/ |___/       
*/
#include<bits/stdc++.h>

#define ll          long long
#define pb          push_back
#define ppb         pop_back
#define	endl		'\n'
#define mii         map<ll int,ll int>
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define what_is(x)  cerr << #x << " is " << x << endl;
using namespace std;

#define N  100005

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int TESTS=1;
	// cin>>TESTS;
	while(TESTS--)
	{
		ll int h,a;
		cin>>h>>a;
		ll int ans=(h+a-1)/a;
		cout<<ans<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#create date: 2020-07-07 11:00

import sys
stdin = sys.stdin

def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))

def main():
    n, d = na()
    m = 2 * d + 1
    print((n-1)//m + 1)

if __name__ == "__main__":
    main()

Measured memory_bytes: 9100
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        String t = sc.next();
        int cnt = 0;
        for (int i = 0; i < s.length(); i++) {
            if (s.charAt(i) != t.charAt(i)) cnt++;
        }
        System.out.println(cnt);


    }
}


Measured memory_bytes: 41224
#include <iostream>
#include <string>
#include <algorithm>
#include<vector>

using namespace std;

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

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

   ll a,b,k,s,l;
   cin>>a>>b>>k;
   if(k<=a)
   {
       cout<<a-k<<" "<<b<<endl;
   }
   else
   {
       if((k-a)<=b)
       {
           cout<<"0"<<" "<<b-(k-a)<<endl;
       }
       else cout<<"0"<<" "<<"0"<<endl;
   }
   }




Measured memory_bytes: 3632
/** 
 * Dont raise your voice, improve your argument.
 * --Desmond Tutu
 */

#include <bits/stdc++.h>
using namespace std;
typedef unsigned int uint;
typedef long long ll;

#define fori(n) for(ll i=0; i<(n); i++)
#define forn(i, n) for(ll i=0; i<(n); i++)
#define forn3(i, x, n) for(ll i=(x); i<(n); i++)

int main() {
cin.tie(nullptr);
std::ios::sync_with_stdio(false);
    int n;
    cin>>n;
    vector<int> h(n);
    vector<int> c(n);
    fori(n)
        cin>>h[i];

    c[0]=0;
    c[1]=abs(h[1]-h[0]);
    forn3(i, 2, n)
        c[i]=min(c[i-1]+abs(h[i-1]-h[i]), c[i-2]+abs(h[i-2]-h[i]));

    cout<<c[n-1]<<endl;
        

}



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

x, y = [int(x) for x in input().split()]
ans = 0

for i in [x, y]:
    if i == 1:
        ans += 300000
    elif i == 2:
        ans += 200000
    elif i == 3:
        ans += 100000
    
if x == 1 and y == 1:
    ans += 400000

print(ans)

    


Measured memory_bytes: 38256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>

using namespace std;

class Fenwick {
public:
	Fenwick(int _N) : N(_N), v(N+1, 0) {}
private:
	int N;
	vector<int> v;
public:
	void add(int val, int p){
		for(int i=p;i<=N;i+=i&-i) v[i] += val;
	}
	int sum(int p){
		int res = 0;
		for(int i=p;i>0;i-=i&-i) res += v[i];
		return res;
	}
};

int main(){
	std::ios_base::sync_with_stdio(false);
	int N, M;
	while(cin >> N >> M){
		Fenwick f(M+1);

		vector<pair<int,int>> r(N);
		for(int i=0;i<N;i++) cin >> r[i].first >> r[i].second;
		sort(r.begin(), r.end(), [](const pair<int,int>& a, const pair<int,int>& b){
				return a.second - a.first < b.second - b.first;
				});
		cout << N << endl;
		int c = 0;
		for(int d=2;d<=M;d++){
			while(c < N && r[c].second - r[c].first < d - 1){
				f.add(1, r[c].first);
				f.add(-1, r[c].second+1);
				++c;
			}
			int res = N - c;
			for(int j=d;j<=M;j+=d) res += f.sum(j);
			cout << res << endl;
		}
	}
}


Measured memory_bytes: 3712
#include <algorithm>
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <unordered_map>
#include <utility>
#include <vector>

using namespace std;

#define ll long long
#define forn(i, n) for (ll i = 0; i < (ll) n; ++i)
#define sz(a) static_cast<int>(a.size())

char buff[(int) 1e6 + 17];
const ll inf = (ll) 1e9 + 7ll;

const int maxn = (int) 2e5 + 17;

int n;
ll a[maxn];

bool read() {
    if (scanf("%d", &n) != 1)
        return false;

    forn (i, n)
        scanf("%d", a + i);

    return true;
}

void solve() {
    ll sum = accumulate(a, a + n, 0ll);

    if (sum % (1ll * n * (n + 1) / 2) == 0) {
        ll k = sum / (1ll * n * (n + 1) / 2);

        if (k == 0) {
            if (sum == 0)
                printf("YES\n");
            else
                printf("NO\n");

            return ;
        }

        for (int i = 0; i < n; ++i) {
            ll A = a[(i + 1) % n] - a[i];

            if ((k - A) % n != 0 || (k - A) / n < 0) {
                printf("NO\n");
                return ;
            }
        }

        printf("YES\n");
    } else {
        printf("NO\n");
    }
}

int main() {
#if SEREZHKA
    freopen("file.in", "r", stdin);
#endif

    while (read())
        solve();

    return 0;
}


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

// Returns <value of the unit after combining, cost of combination> 
pair<ll, ll> f(vector<ll>& A, int i, int j, vector<vector<pair<ll, ll> >> &dp) {
  	// base case 
	if(i == j) {
      	return {A[i], 0};
    }
  
  	if(dp[i][j].first!=0) {
      	return dp[i][j];
    }
  
  	ll minCost = LONG_MAX;
  	ll size = 0;
  	for(int k=i; k<j;k++){
      	auto x =  f(A, i, k, dp);
      	auto y = f(A, k+1, j, dp);
		size = x.first + y.first;
      
      	ll cost = size + x.second + y.second;
    	minCost = min(minCost, cost);
    }
  	dp[i][j] = {size, minCost};
  	return {size, minCost};
}

int main() {
	int N;
  	cin>>N;
  	vector<ll> A(N, 0);
  	for(int i=0 ; i<N; i++)
      	cin>>A[i];
  
  	vector<vector<pair<ll, ll> >> dp(N, vector<pair<ll, ll>>(N, {0, 0}));
  	cout<< f(A, 0, A.size()-1, dp).second;
 	
  	return 0; 
}

Measured memory_bytes: 2816
#include <iostream>
#include <algorithm>
#include <cmath>
#include <climits>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <unordered_map>
using namespace std;

int main() {
  int N, X;
  cin >> N >> X;
  int total = 0;
  int min = INT_MAX;
  for (int i = 0; i < N; i++) {
    int tmp;
    cin >> tmp;
    total += tmp;
    if (tmp < min) {
      min = tmp;
    }
  }
  X -= total;
  int sum = N + X / min;
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int a, b;
  char op;
  
  scanf("%d %c %d", &a, &op, &b);
  
  if( op == '+' ) printf("%d\n", a+b);
  else {          printf("%d\n", a-b);}
  
  
  return 0;
  
}       

Measured memory_bytes: 128
#include<iostream>

const int MAX_N = 1 << 18, INF = 1 << 24;

class SegmentTree{
public:
	SegmentTree(int _n){
		n = 1;
		while(n < _n)n *= 2;
		for(int i=0;i<2*n-1;i++){
			data[i] = 0;
		}
	}

	void add(int k, int a){
		k += n - 1;
		data[k] = a;
		while(k > 0){
			k = (k-1) / 2;
			data[k] = data[k*2+1] + data[k*2+2];
		}
	}

	int calculate(int a, int b){
		return _calculate(a, b, 0, 0, n);
	}
private:
	int data[MAX_N];
	int n;
	int _calculate(int a, int b, int k, int l, int r){
		if(r <= a || b <= l)return 0;

		if(a <= l && r <= b)return data[k];
		else{
			int l_child = _calculate(a, b, 2*k+1, l, (l+r) / 2),
				r_child = _calculate(a, b, 2*k+2, (l+r) / 2, r);
			return l_child + r_child;
		}
	}
};

int main(){
	int n, k;
	while(std::cin >> n >> k, n){
		SegmentTree st(n);
		for(int i=0;i<n;i++){
			int a_i;
			std::cin >> a_i;
			st.add(i, a_i);
		}

		int res = -INF;

		for(int i=0;i+k-1<n;i++){
			res = std::max(res, st.calculate(i, i+k));
		}

		std::cout << res << std::endl;
	}
}

Measured memory_bytes: 2184
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

// auto mod int
// https://youtu.be/L8grWxBlIZ4?t=9858
// https://youtu.be/ERZuLAxZffQ?t=4807 : optimize
// https://youtu.be/8uowVvQ_-Mo?t=1329 : division
const int mod = 998244353;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

int main(){
  int n;
  cin >> n;
  map<int, int> mp;
  vector<int> d(n);
  rep(i, n){
    int in;
    cin >> in;
    bool end = false;
    if(i == 0){
      if(in != 0) end = true;
    }else{
      if(in == 0) end = true;
    }
    if(end == true){
      cout << 0 << endl;
      return 0;
    }
    d.at(i) = in;
    mp[in]++;
  }
  sort(d.begin(), d.end());
  mint ans = 1;
  rep2(i, 1, n){
    mint add = mp[d.at(i)-1];
    ans *= add;
  }
  cout << ans.x << endl;

  return 0;
}

Measured memory_bytes: 5376
#include<iostream>
#include<string>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<tuple>
#include<vector>
#include<map>
using namespace std;

static const int MAX_N = 120;

int main(void){
  int N;
  vector<string> W;
  cin >> N;
  for(int i = 0; i < N; i++){
    string temp;
    cin >> temp;
    W.push_back(temp);

  }
  //同じ単語が複数回ないかと最初と最後が一致しているかを調べる。
  bool isOK = true;
  //複数回ないか
  for(int i = 0; i < N; i++){
    for(int j = i + 1; j < N; j++){
      if(W[i] == W[j]){
        isOK = false;
        break;
      }
    }
    if(!isOK) break;
  }
  //次の単語の最初と前の単語の最後が一致しているか。
  for(int i = 0; i < N - 1; i++){
    if(W[i].back() != W[i + 1].front()){
      isOK = false;
      break;
    }
  }
  if(isOK) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

namespace ConsoleApplication9
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int intNumber = 1; intNumber < 10; intNumber++)
            {
                for (int intNumber2 = 1; intNumber2 < 10; intNumber2++)
                {
                    Console.WriteLine(intNumber.ToString() + "x" + intNumber2.ToString() + "=" + intNumber * intNumber2);
                }
            }
            Console.ReadLine();
        }
    }
}

Measured memory_bytes: 9096
import sys
from bisect import *
from collections import *
from copy import deepcopy
from heapq import *
from itertools import *
from math import *
from operator import *
import numpy as np

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N,K = map(int, input().split())
    S = list(input())

    cnt = 0
    prev = ''
    for s in S:
        if s == 'L' and prev == 'R' or s == 'R' and prev == 'L':
            cnt += 1
        prev = s

    unhappy_cnt = cnt + 1
    max_changable = unhappy_cnt//2
    print(min(N-1, N-unhappy_cnt+2*min(max_changable, K)))


if __name__ == '__main__':
    main()

Measured memory_bytes: 15188
import sys
stdin = sys.stdin
 
sys.setrecursionlimit(10**5) 
 
def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x)-1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

n = ni()
march = {"M": 0, "A": 0, "R": 0, "C": 0, "H": 0}
for _ in range(n):
    s = lc()
    if s[0] in march.keys():
        march[s[0]] += 1
        
ans = 0
vals = list(march.values())
for i in range(5):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans += vals[i]*vals[j]*vals[k]
            
print(ans)

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

#undef int
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
#define int long long int
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	int t = 1;
	while (t--) {
		int n;
		cin >> n;
		string s;
		cin >> s;
		int last = n - 1, cnt = 0;
		for (int i = 0; i < n; i++) {
			if (s[i] == 'W') {
				if (last == -1) break;
				while (s[last] != 'R') {
					last--;
					if (last == -1) break;
				}
				if (last > i) {
					cnt++;
					last--;
					if (last == -1) break;
				}
				else break;
			}
		}
		cout << cnt << endl;
	}
	return 0;
}

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

public class Main
{
	public static void main(String[] arg) throws IOException
	{
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		
		String s;
		while((s=br.readLine())!=null){
			double x1 = Double.parseDouble(s.split(" ")[0]);
			double y1 = Double.parseDouble(s.split(" ")[1]);
			double x2 = Double.parseDouble(s.split(" ")[2]);
			double y2 = Double.parseDouble(s.split(" ")[3]);
			double x3 = Double.parseDouble(s.split(" ")[4]);
			double y3 = Double.parseDouble(s.split(" ")[5]);
			double xp = Double.parseDouble(s.split(" ")[6]);
			double yp = Double.parseDouble(s.split(" ")[7]);
			if(inTriangle(x1,y1,x2,y2,x3,y3,xp,yp))
				System.out.println("YES");
			else 	
				System.out.println("NO");
		}
	}
	private static boolean inTriangle(double x1, double y1, double x2, double y2, double x3, double y3, double xp, double yp)
	{
		// equation -> y = [0]x + [1]
		double[] eq12 = new double[2];
		double[] eq13 = new double[2];
		double[] eq23 = new double[2];
		
		if((x2-x1)==0) eq12[0]=(y2-y1);
		else eq12[0] = (y2-y1) / (x2-x1);
		eq12[1] = y1 - x1 * eq12[0];
		if((x3-x1)==0) eq13[0]=(y3-y1);
		else eq13[0] = (y3-y1) / (x3-x1);
		eq13[1] = y1 - x1 * eq13[0];
		if((x3-x2)==0) eq13[0]=(y3-y2);
		else eq23[0] = (y3-y2) / (x3-x2);
		eq23[1] = y2 - x2 * eq23[0];
		
		if(yp > (eq12[0] * xp + eq12[1])) {
			if(y3 < (eq12[0] * x3 + eq12[1])) return false;
		} else
			if(y3 > (eq12[0] * x3 + eq12[1])) return false;
		if(yp > (eq13[0] * xp + eq13[1])) {
			if(y2 < (eq13[0] * x2 + eq13[1])) return false;
		} else
			if(y2 > (eq13[0] * x2 + eq13[1])) return false;
		if(yp > (eq23[0] * xp + eq23[1])) {
			if(y1 < (eq23[0] * x1 + eq23[1])) return false;
		} else
			if(y1 > (eq23[0] * x1 + eq23[1])) return false;
		return true;
	}
}

Measured memory_bytes: 10000
i = int(input())
renzoku_double_count = 0
r = "No"
for i in range(i):
  inp = input().split(" ")
  dice0= int(inp[0])
  dice1= int(inp[1])
  if dice0 == dice1:
    renzoku_double_count += 1
  else:
    renzoku_double_count = 0
  if renzoku_double_count == 3:
    r  = "Yes"
    break
print(r)

Measured memory_bytes: 9180
#include<iostream>
#include<complex>
#include<vector>

using namespace std;

typedef complex<long double> P;
typedef vector<P> Polygon;

long double cross(P a,P b){
  return (conj(a)*b).imag();
}

double area(const Polygon &p){
  double a=0;
  for(int i=0;i<p.size();i++){
    a+=cross(p[(i+1)%p.size()],p[i]);
  }
  return fabs(a)/2;
}

P intersection(P a1,P a2,P b1,P b2){
  P a=a2-a1;
  P b=b2-b1;
  return a1+a*cross(b,b1-a1)/cross(b,a);
}
  
Polygon cut(P a,P b,const Polygon &p){
  int n=p.size();
  vector<double> c(n);
  for(int i=0;i<n;i++){
    c[i]=cross(b-a,p[i]-a);
  }
  Polygon r;
  for(int i=0;i<n;i++){
    if(c[i]>=0){
      r.push_back(p[i]);
    }
    if(c[i]*c[(i+1)%n]<0){
      r.push_back(intersection(a,b,p[i],p[(i+1)%n]));
    }
  }
  return r;
}


int main(){
  for(int N;cin>>N,N;){
    Polygon p;
    for(int i=0;i<N;i++){
      double x,y;
      cin>>x>>y;
      p.emplace_back(x,y);
    }
    double wa=area(p);
    double l=1e-5,r=acos(0)*2+1e-5;
    double la,ra;
    for(int i=0;i<N;i++){
      Polygon lp=cut(P(0,0),p[i],p),rp=cut(P(0,0),p[(i+1)%N],p);
      la=area(lp);
      ra=area(rp);
      if((la/wa-.5)*(ra/wa-.5)<=0){
	l=arg(p[i]);
	r=arg(p[(i+1)%N]);
	break;
      }
    }
    for(int i=0;i<1000;i++){
      double m=(l+r)/2;
      auto mp=cut(P(0,0),polar(2.,m),p);
      double ma=area(mp);
      if(ma/wa==.5){
	l=m;
	break;
      }else if((la/wa-.5)*(ma/wa-.5)>=0){
	l=m;
	la=ma;
      }else{
	r=m;
	ra=ma;
      }
    }
    cout.precision(15);
    auto ans=polar(2.,l);
    cout<<fixed<<ans.real()<<' '<<ans.imag()<<endl;
  }
}

Measured memory_bytes: 1320
import java.util.*;

public class Main{

	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		
		int[] list = {0,1,3,1,2,1,2,1,1,2,1,2,1};
		
			if(list[x] == list[y]){
				System.out.println("Yes");
			} else{
				System.out.println("No");
			}
	}
}

Measured memory_bytes: 21844
//自称高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
    int ans = 0;
	string s;
	cin >> s;
	REP(i, s.size())
	{
		if(s[i] == '+') ans ++;
		else ans --;
	}
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 10000000000
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
typedef pair<double, double> doup;
ll rec(ll n);
 
int main(void) {
    ll n;
    cin >> n;
    string s;
    
    if(n==0) cout << 0 << endl;
    while(abs(n)>0) {
        if(n&1) {
            s='1'+s;
            n--;
        }
        else {
            s='0'+s;
        }
        n/=-2;
    }
    
    cout << s << endl;
}

Measured memory_bytes: 256
n = int(raw_input())
s = raw_input()
aa = s.split(" ")
aa = [int(x)-1 for x in aa]

ctr = 0

for i in range(n):
	if i == aa[aa[i]]:
		ctr = ctr + 1

ctr = ctr / 2

print(str(ctr))

Measured memory_bytes: 11904
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    long long n,x,t,s;
    cin>>n>>x>>t;
    s=n/x;
    if(n%x!=0)
    {
        s++;
    }
    cout<<(s*t)<<endl;
    return 0;
}

Measured memory_bytes: 3592
#include <iostream>
#include <algorithm>
#include <map>
#include <utility>
#include <vector>
#include <cstdio>
#include <iomanip>
#include <cmath>
using namespace std;
using ll = long long;
#define rep(i, n) for(int i = 0; i < n; i++)

int main() {
    string str;
    cin >> str;

    if (str[0]==str[1] && str[2]==str[3]) {
        if (str[1]!=str[3]) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (str[1]==str[3] && str[0]==str[2]) {
        if (str[0]!=str[1]) {
            cout << "Yes" << endl;
            return 0;
        }
    } else if (str[0]==str[3] && str[1]==str[2]) {
        if (str[0]!=str[1]) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef long long ll;

using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>

const ll maxs = 1e6+5;
const ll lmaxs = 20;
ll mod = 1e9+7;
ll oo = 1e15;

#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define I insert
#define endl '\n'

using vvll = vector< vector<ll> >;
using vll = vector<ll> ;
#define pbds tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define fastio(); ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);


ll fast(ll x,ll y){
    ll res=1;
    while(y){
        if(y&1){
            res = res*x%mod;
        }
        x = x*x%mod;
        y >>= 1;
    }
    return res;
}

ll inv(ll n){
    return fast(n,mod-2);
}

void pre(){
   
}


void solve(){

    ll a,b,h,m;
    cin >> a >> b >> h >> m;
    double pi = acosl(-1.0l);
    double angle1 = (2*pi)/12*h;
    double angle2 = (2*pi)/60*m;
    angle1 += (2*pi)/(12*60)*m;
    double diff = angle1 - angle2;
    if(diff < 0){
        diff += 2*pi;
    }
    if(diff==pi){
        cout << a + b;
    }
    else{
        double ans = a*a + b*b - (2*a*b*cos(diff));
        ans =  sqrtl(ans);
        cout << fixed << setprecision(10) << ans << endl;
    }
    
}

int main(){
    // #ifndef ONLINE_JUDGE
    // freopen("input00.txt","r",stdin);
    // #endif
    IOS;
    pre();
    ll T = 1;   
    //cin>>T;
    ll tt=1;
    while(T--){
        //cout << "Case #" << tt << ": ";
        tt++;
        solve();
    }
    return 0;
}

Measured memory_bytes: 4244
#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    long int n,W;
    cin>>n>>W;
    vector<pair<long int,long int> > wv(n+1,make_pair(0,0));
    vector< vector<long int> > s(n+1 ,vector<long int>( W+1,0));
    for(long int i=1;i<=n;i++)
        cin>>wv[i].first>>wv[i].second;
 
    sort(wv.begin(),wv.end());
    /*for(int i=0;i<=n;i++)
    {
        cout<<wv[i].first<<" "<<wv[i].second<<endl;
    }*/
    for(long int i=1;i<=n;i++)
    {
        for(long int j=1;j<=W;j++)
        {
            if(j<wv[i].first)
                s[i][j]=s[i-1][j];
            else
                s[i][j]=max(wv[i].second + s[i-1][j-wv[i].first],s[i-1][j]);
        }
    }
    cout<<s[n][W];
    return 0;
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end())

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M; cin >> N >> M;
  vector<vector<ll>> cakes(N, vector<ll>(3));
  REP(i, N) REP(j, 3) cin >> cakes[i][j];

  ll ans = 0;
  REP(bit, 1 << 3) {
    REP(i, N) REP(j, 3) {
      if (bit >> j & 1) cakes[i][j] *= -1LL;
    }
    vector<vector<ll>> dp(N + 1, vector<ll>(M + 1, -1e13));
    dp[0][0] = 0;
    REP(i, N) REP(j, M + 1) {
      if (j == 0) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i][j - 1] + accumulate(cakes[i].begin(), cakes[i].end(), 0LL));
      }
    }
    ans = max(ans, dp[N][M]);
    REP(i, N) REP(j, 3) {
      if (bit >> j & 1) cakes[i][j] *= -1LL;
    }
  }

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


Measured memory_bytes: 8216
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define nn '\n'
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg){cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg){cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg){cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#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 out(n) cout << n << '\n';
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n /= 2; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

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

    int a,b,c; cin >> a >> b >> c;
    out(max(c-(a-b),0LL))

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
const double pi = 3.141592653589793238462643383279;
using namespace std;
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
 
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
 
//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007
 
 
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
 
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
 
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)

//ここから編集 


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);

    int K, X; cin >> K >> X;

    if(500*K >= X) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3592
#include <iostream>

using namespace std;
int main() {

   int A,B;
   cin>>A>>B;
   if((A==1 && B==2) || (A==2 && B==1))
       cout<<"3"<<endl;
   else if((A==3 && B== 1) ||(A==1 && B== 3) )
       cout<<"2"<<endl;
   else
       cout<<"1"<<endl;
    return 0;
}

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

int main()
{
        ll N;
        cin >> N;
        vector<ll> a(N, 0);
        ll sum = 0;
        for (int i = 0; i < N; ++i) {
                cin >> a[i];
                sum += a[i];
        }
        ll dif = 0;
        ll suma = 0;
        for (int i = 0; i < N-1; ++i) {
                suma += a[i];
                ll sumb = sum - suma;
                ll d = abs(sumb - suma);
                if (i == 0) dif = d;
                else if (d < dif) dif = d;
        }
        cout << dif << endl;



}


Measured memory_bytes: 1792
using System;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var ny = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        for(var i=0;i<=ny[0];i++)
            for(var j = 0; j <= ny[0]; j++)
            {
                var h = ny[0] - i - j;
                if (h < 0) break;
                if (i * 10000 + j * 5000 + h * 1000 == ny[1])
                {
                    WriteLine($"{i} {j} {h}");
                    return;
                }
            }
        WriteLine("-1 -1 -1");
    }
}


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

int main()
{
    string s;
    int n;
    cin>>n>>s;
    for(int i=0;i<s.size();i++){
        if(s[i]+n>90) s[i]-=(25-n+1);
        else s[i]+=n;
    }
    cout<<s;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b) - 1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define rrep(i, n) for(int i = (n) - 1; i >= 0; i--)
#define ALL(i) (i).begin(),(i).end()
#define RALL(i) (i).begin(),(i).end(),greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second

typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
#define TENFIVE2 200005
// #define int long long
const int INF = 999999999;
const int MOD = 1e9 + 7;
const double EPS = 1e9 + 7;
const double PI = acos(-1);
const int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};

inline int in(){int x;std::cin>>x;return x;}

using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
using vii = vector<vector<int> >;
using vl = vector<long long>;
using vp = vector<pint>;

template <typename T> void print(T x) { std::cout << x << '\n'; }
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
  std::fill((T*)array, (T*)(array + N), val);
}
signed main(){
  // int N;
  string S;
  cin>>S;
  int ans1 = 0,ans2=0;
  rep(i,S.size()){
    if(S[i] != '1' && i % 2 == 0 )ans1++;
    if(S[i] != '0' && i % 2 == 1 )ans1++;
  }
  rep(i,S.size()){
    if(S[i] != '0' && i % 2 == 0 )ans2++;
    if(S[i] != '1' && i % 2 == 1 )ans2++;
  }

  int ans = min(ans1,ans2);
  print(ans);

  return 0;
}


Measured memory_bytes: 512
def main():
    S = input()
    N = len(S)
    ok = True
    if S[0] == "0" or S[N-1] == "1":
        ok = False
    for i in range(N-1):
        if S[i] != S[N-2-i]:
            ok = False
    if not ok:
        print(-1)
        return
    prev = 1
    for i in range(2, N+1):
        print(prev, i)
        if S[i-2] == "1":
            prev = i


if __name__ == "__main__":
    main()


Measured memory_bytes: 47576
N = int(input())
n=0
ans = 0
ans2 =0
for i in range(1,N+1):
    n=i
    res = 0
    while n % 2 ==0:
        n=n//2
        res = res + 1
        if ans < res:
            ans = res
            ans2 =i
if ans2==0:
	print(1)
else:
	print(ans2)

Measured memory_bytes: 3060
#define Q(y)m[y]&1&&v[y]<t?v[*++e=y]=v[x]+1:0
m[1<<20],v[1<<21],*d,*e;w,p[10],x,t,i,c;main(n){scanf("%*d%d%d",&w,&n);for(x=w++;c=~getchar(x++);m[x]=c>12?p[c-13]=x,11:c)c=~c%88%35;for(;i<n;)for(d=e=v+(1<<20),t=++v[*e=p[i++]];c=v[p[i]],c<t;Q(x-1),Q(x+1),Q(x-w),Q(x+w))x=*d++;x=!printf("%d\n",c-n);}

Measured memory_bytes: 8532
#include <bits/stdc++.h>
using namespace std;
using ll =long long;
#define all(v) v.begin(),v.end()
 
int main() {
  ll A,B;
  cin>>A>>B;
  vector<ll> As(0);
  vector<ll> Bs(0);
 if(A*50%4==0) {
As.push_back(A*50/4);
 }
  for(ll i=A*50/4+1;i<(A+1)*50/4;i++) {
As.push_back(i);
  }
  if((A+1)*50%4!=0) {
As.push_back((A+1)*50/4);
  }
  
  
  for(ll i=B*10;i<(B+1)*10;i++) {
Bs.push_back(i);
  }
  
  for(ll i=0;i<As.size();i++) {
for(ll j=0;j<Bs.size();j++) {
if(As[i]==Bs[j]) {
cout<<As[i]<<endl;
  return 0;
}
}
  }
  
  
  cout<<-1<<endl;
}
  
  
 

Measured memory_bytes: 3644
#include <stdio.h>

int main(){
  long long x,a[5000];
  scanf("%lld",&x);
  a[0]=100;
  for(int i=1;i>0;i++){
    a[i]=a[i-1]+(a[i-1]-(a[i-1]%100))/100;
    if(a[i]>=x){printf("%d",i);return 0;}
  }
}


Measured memory_bytes: 1696