akhauriyash/Code-Regression huggingface dataset:
k = int(input())

cache = {}
def tgcd(a, b, c):
    def gcd(a, b):
        if a < b:
            a, b = b, a
        if (a, b) in cache:
            return cache[a, b]
        elif b == 0:
            cache[a, b] = a
            return a
        else:
            res = gcd(b, a % b)
            cache[a, b] = res
            return res
    ab = gcd(a, b)
    return gcd(c, ab)

total = 0
for a in range(1, k + 1):
    for b in range(a, k + 1):
        for c in range(b, k + 1):
            local = tgcd(c, b, a)
            if a == b and b == c:
                total += local
            elif a != b and b != c and c != a:
                total += 6 * local
            else:
                total += 3 * local


print(total)


Measured memory_bytes: 71472
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int min=99999;
	int a;
	string s;
	cin>>s;
	for(int i=0;i<s.length()-2;i++)
	{
		a=(s[i]-'0')*100+(s[i+1]-'0')*10+s[i+2]-'0';
		if(a<753)  a=753-a;
		else a=a-753;
		if(a<min)  min=a;
	}
	cout<<min<<endl;
} 

Measured memory_bytes: 256
# Author: cr4zjh0bp
# Created: Sat Feb 29 04:25:06 UTC 2020
import sys
 
stdin = sys.stdin
inf = 1 << 60
mod = 1000000007
 
ni = lambda: int(ns())
nin = lambda y: [ni() for _ in range(y)]
na = lambda: list(map(int, stdin.readline().split()))
nan = lambda y: [na() for _ in range(y)]
ns = lambda: stdin.readline().rstrip()
nsn = lambda y: [ns() for _ in range(y)]
ncl = lambda y: [list(ns()) for _ in range(y)]
nas = lambda: stdin.readline().split()

n, a, b = na()

if abs(a - b) % 2 == 0:
    print(abs(a - b) // 2)
else:
    c = min(abs(1 - a), abs(n - a))
    d = min(abs(1 - b), abs(n - b))
    e = min(c, d)
    print(e + 1 + ((abs(a - b) - 1) // 2))

Measured memory_bytes: 3064
r, g, b = list(map(int,input().split()))
try_cnt = int(input())

while r >= g:
    try_cnt -= 1
    g *= 2        
    
while g >= b:
    try_cnt -= 1
    b *= 2

if try_cnt >= 0:
    print('Yes')
else:
    print('No')   

Measured memory_bytes: 9128
# D - Even Relation
from typing import List, Tuple


def main():
    N, *X = map(int, open(0).read().split())
    tree: List[List[Tuple[int, int]]] = [[] for _ in range(N + 1)]
    for u, v, w in zip(*[iter(X)] * 3):
        w %= 2
        tree[u].append((v, w)), tree[v].append((u, w))

    color = [-1] * (N + 1)
    color[1] = 1
    stack = [1]
    while stack:
        u = stack.pop()
        cur = color[u]
        for v, w in tree[u]:
            if color[v] != -1:
                continue
            color[v] = cur ^ w
            stack.append(v)

    print("\n".join(map(str, color[1:])))


if __name__ == "__main__":
    main()


Measured memory_bytes: 53728
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		Person[] ps = new Person[N];
		for(int y = 0;y < N;y++) {
			ps[y] = new Person();
		}
		
		int inA = sc.nextInt();
		for(int i = 0; i < inA ; i++) {
			ps[sc.nextInt()-1].inA = true;
		}
		
		int inB = sc.nextInt();
		for(int m = 0; m < inB; m++) {
			ps[sc.nextInt()-1].inB = true;
		}
		
		int inC = sc.nextInt();
		for(int l = 0;l < inC; l++) {
			ps[sc.nextInt()-1].inC = true;
		}
		
		int count = 0;
		for(Person p : ps) {
			if(p.check()) {
				count += 1;
			}
		}
		System.out.println(count);
 	}
	static class Person {
		public boolean inA = false;
		public boolean inB = false;
		public boolean inC = false;
		public Person() {
			
		}
		public boolean check() {
			if(inC == false) {
				return false;
			} else if(inA == false && inC == true) {
				return true;
			} else if(inB == true && inC == true) {
				return true;
			}
			return false;
		}
	}
}

Measured memory_bytes: 26716
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

now_time = [a, b, c, d, e]
next_time = []

for i in now_time:
    if i % 10 == 0:
        next_time.append(i)
    else:
        while i % 10 != 0:
            i += 1
        next_time.append(i)

combined = sorted([x - y for (x, y) in zip(next_time, now_time)])

best_time = sum(next_time) - max(combined)
print(best_time)

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

typedef vector<int> VI;
#define pb push_back
#define all(vec) (vec).begin(),(vec).end()

const int INF = 2000000000;

int x[5000], y[5000];
int sx[500000], sy[500000], ex[500000], ey[500000];
short num[5050][5050];

int find(VI &zip, int key, int type = 0)
{
	int l = 0, r = zip.size() - 1;
	while (true){
		if (l > r) return type ? l : r;
		int m = (l + r) / 2;
		if (zip[m] == key) return m;
		if (zip[m] < key) l = m + 1;
		else r = m - 1;
	}
}

int main()
{
	VI zip_x; zip_x.pb(-INF); zip_x.pb(INF);
	VI zip_y; zip_y.pb(-INF); zip_y.pb(INF);
	
	int n, m;
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++){
		scanf("%d %d", &x[i], &y[i]);
		zip_x.pb(x[i]);
		zip_y.pb(y[i]);
	}
	for (int i = 0; i < m; i++){
		scanf("%d %d %d %d", &sx[i], &sy[i], &ex[i], &ey[i]);
		//zip_x.pb(sx[i]);
		//zip_y.pb(sy[i]);
		//zip_x.pb(ex[i]);
		//zip_y.pb(ey[i]);
	}
	
	
	// 座標圧縮
	sort(all(zip_x));
	zip_x.erase(unique(all(zip_x)), zip_x.end());
	sort(all(zip_y));
	zip_y.erase(unique(all(zip_y)), zip_y.end());
	
	
	// 圧縮後の座標を受け取る
	for (int i = 0; i < n; i++){
		x[i] = find(zip_x, x[i]);
		y[i] = find(zip_y, y[i]);
	}
	for (int i = 0; i < m; i++){
		sx[i] = find(zip_x, sx[i], 1);
		sy[i] = find(zip_y, sy[i], 1);
		ex[i] = find(zip_x, ex[i]);
		ey[i] = find(zip_y, ey[i]);
	}
	
	
	//累積和
	for (int i = 0; i < n; i++){
		num[x[i]][y[i]]++;
	}
	for (int i = 1; i < zip_x.size(); i++){
		for (int j = 1; j < zip_y.size(); j++){
			num[i][j] += num[i - 1][j];
			num[i][j] += num[i][j - 1];
			num[i][j] -= num[i - 1][j - 1];
		}
	}
	
	/*
	puts("");
	for (int i = 0; i < zip_x.size(); i++){
		for (int j = 0; j < zip_y.size(); j++){
			printf("%d ", num[i][j]);
		}
		puts("");
	}
	puts("");
	*/
	
	for (int i = 0; i < m; i++){
		int res = num[ex[i]][ey[i]];
		res -= num[sx[i] - 1][ey[i]];
		res -= num[ex[i]][sy[i] - 1];
		res += num[sx[i] - 1][sy[i] - 1];
			
		printf("%d\n", res);
	}
	
	return 0;
}

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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vvint = vector<vint>;
using vvvint = vector<vvint>;
using vdouble = vector<double>;
using vvdouble = vector<vdouble>;
using vvvdouble = vector<vvdouble>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using uint = unsigned int;
using ull = unsigned long long;

template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;
constexpr int mod2 = 998244353;
template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2>
inline bool chmin(T1 &a, T2 b) { return (a > b && (a = b, true)); }
template<typename T1, typename T2>
inline bool chmax(T1 &a, T2 b) { return (a < b && (a = b, true)); }

template<typename T>
vector<T> makeVector(size_t a, T b) { return (vector<T>(a, b)); }
template<typename... Ts>
auto makeVector(size_t a, Ts... ts) { 
	return (vector<decltype(makeVector(ts...))>(a, makeVector(ts...)));
}

template<typename T>
bool isin(T y, T x, T h, T w) { return (0 <= y && 0 <= x && y < h && x < w); }
template<typename T>
bool isin1(T y, T x, T h, T w) { return (0 < y && 0 < x && y <= h && x <= w); }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	os << v[0];
	for (int i = 1; i < v.size(); i++) os << " " << v[i];
	return (os);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

template<typename T1, typename T2>
istream& operator >>(istream &is, pair<T1, T2> &p) {
	return (is >> p.first >> p.second);
}


void Main() {
	ll sum = 0;
	ll N; cin >> N;
	map<ll, ll> cnt;
	for (int i = 0; i < N; i++) {
		ll A; cin >> A;
		cnt[A]++;
		sum += A;
	}
	int Q; cin >> Q;
	while (Q--) {
		ll B, C; cin >> B >> C;
		sum -= cnt[B] * B;
		sum += cnt[B] * C;
		cnt[C] += cnt[B];
		cnt[B] = 0;
		cout << sum << el;
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(0);
	cout << fixed << setprecision(20);
	Main();
	return (0);
}


Measured memory_bytes: 9516
import java.io.*;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int a = saori.saori_hayami();
		int b = saori.saori_hayami();
		int c = saori.saori_hayami();
		if(a+b >= c){
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
		
		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 22612
H,W=map(int,input().split())
S=[list(input()) for i in range(H)]
flag=True
for i in range(H):
  for j in range(W):
    if S[i][j]==".":
      continue
    adj=[]
    if 0<i:
      adj.append(S[i-1][j])
    if i<H-1:
      adj.append(S[i+1][j])
    if 0<j:
      adj.append(S[i][j-1])
    if j<W-1:
      adj.append(S[i][j+1])
    # print(adj)
    if all('.'==m for m in adj):
      flag=False
print('Yes' if flag else 'No')
      


Measured memory_bytes: 3064
#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <db, db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))
#define sz(x) (int)(x.size())
#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline ll gcd(ll a,ll b){if(a==0) return b;return gcd(b%a,a);}
inline ll power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e18;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;
const int N=200005;
int pr[11];int cnt;
void recur(int x,int l,int dg,int n)
{
    if(dg==1)
    {
        x=x*10+l;
        if(x<=n)
            cnt++;
        return;
    }
    for(int i=0;i<10;i++)
    {
        recur(x*10+i,l,dg-1,n);
    }
}
int count(int f,int l,int n)
{
    //int cnt=0;
    cnt=0;
    if(f==l&&f<=n)
        cnt++;
    int dg=log10(n);
    dg++;
    if(dg>=2)
    {
        for(int i=2;i<dg;i++)
        {
            cnt=cnt+pr[i-2];
        }
        int v=n/pr[dg-1];
        v=v%10;
        if(f==v)
        recur(f,l,dg-1,n);
        else if(f<v)
        {
            cnt=cnt+pr[dg-2];
        }
    }
    return cnt;
}
void solve()
{
    int n;
    cin>>n;
    
    pr[0]=1;
    for(int i=1;i<=10;i++)
        pr[i]=10*pr[i-1];
    int ans=0;
    for(int i=1;i<=n;i++)
    {
        int last=i%10;
        int z=log10(i);
        int x=i/pr[z];
        int first=x%10;
        if(last)
        {
           int lst=first;
           int fst=last;
            ans=ans+count(fst,lst,n);
        }
    }
    cout<<ans<<endl;
}

int32_t main()
{
    IOS;
    int t;
    t=1;
    // cin>>t;
    while(t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define itn int
#define int long long
#define mod 1000000007
#define INFi 2147483647
#define INFl 9223372036854775807LL
#define fi first
#define se second
#define be begin()
#define en end()
#define re reverse
int abs(int a,int b){
    return max(a,b)-min(a,b);
}
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b[1000000],d,e;
    int c[100000]={};
    cin>>a>>d;
    for(int i=0;i<a;i++) cin>>b[i];
    for(itn i=1;i<d;i++) c[i]=abs(b[i],b[0]);
    for(int i=d;i<a;i++){
      for(int j=1;j<=d;j++){
	if(j==1) c[i]=abs(b[i],b[i-j])+c[i-j];
	else{
	  c[i]=min(c[i],abs(b[i],b[i-j])+c[i-j]);
	}
      }
    }
    cout<<c[a-1]<<"\n";
}


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

bool isPrime(int x){
    if(x==2){
        return true;
    }
    if(x<2||x%2==0){
        return false;
    }
    int i=3;
    while(i*i<=x){
        if(x%i==0){
            return false;
        }
        i+=2;
    }
    return true;
}
int main(){
    int n;
    cin>>n;
    int count=0;
    int a;
    for(int i=0;i<n;i++){
        cin>>a;
        if(isPrime(a)){
            count++;
        }
    }
    cout<<count<<endl;
    return 0;
}


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

#define int long long
#define INF 9223372036854775807
#define mod 1000000007

char tab[1009][1009];
int memo[1009][1009];

int h, w;
int dp(int i, int j){
    if(i == 0 && j == 0) return 1;
    if(i < 0 || j < 0 || i >= h || j >= w) return 0;
    if(memo[i][j] != -1) return memo[i][j];
    else{
        memo[i][j] = 0;
        if(i > 0 && tab[i-1][j] == '.'){
            memo[i][j] +=dp(i-1,j)%mod;
        }
        if(j > 0 && tab[i][j-1] == '.'){
            memo[i][j]+=dp(i,j-1)%mod;
        }
        return memo[i][j]%=mod;
    }
}

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

    cin >> h >> w;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> tab[i][j];
        }
    }
    for(int i = 0; i < 1009; i++){
        for(int j = 0; j < 1009; j++){
            memo[i][j] = -1;
        }
    }
    cout << dp(h-1,w-1) << endl;
}


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

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

  int ans= (S=="RRR") ? 3
          :(S=="SRR" || S=="RRS") ? 2
          :(S=="SSS") ? 0
                      : 1;
  
  cout << ans << endl;
}

Measured memory_bytes: 3592
#include <cstdio>
#include <cstring>

int len;
char S[100000];
const char words[4][8] = { "dream", "dreamer", "erase", "eraser" };
const int length[4] = { 5, 7, 5, 6 };

int f(int index) {
	if (index == len) return 1;
	if (index > len) return 0;
	for(int i = 0; i < 4; ++i) {
		int j;
		for(j = 0; j < length[i]; ++j) if (S[index + j] != words[i][j]) break;
		if (j == length[i]) { // matches
			if (f(index + length[i])) return 1;
		}
	}
	return 0;
}

int main() {
	scanf("%s", S);
	len = strlen(S);
	if (f(0)) printf("YES\n");
	else printf("NO\n");
	return 0;
}

Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;

namespace Strings
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            string sentenceS = input[0];
            string sentenceT = input[1];

            Console.WriteLine(sentenceT + sentenceS);            
        }
    }
}

Measured memory_bytes: 11092
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>
#include <numeric>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;

#define EPS (1e-7)
#define INF 1e18
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define PI (acos(-1))

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

int main() {
    ll N;
    cin >> N;
    vector<vector<P>> V(N);
    ll a, b, c;
    REP(i, N-1){
        cin >> a >> b >> c;
        a--;
        b--;
        V[a].push_back(P(b, c));
        V[b].push_back(P(a, c));
    }
    ll Q, K;
    cin >> Q >> K;
    K--;
    vector<P> x(Q);
    REP(i, Q) {
        cin >> x[i].first >> x[i].second;
        x[i].first--;
        x[i].second--;
    }

    vector<ll> d(N, INF);
    d[K] = 0;
    priority_queue<ll> q;
    q.push(K);
    while(q.size() > 0){
        ll e = q.top();
        q.pop();
        for(auto iter: V[e]) {
            if(d[iter.first] >= INF){
                d[iter.first] = min(d[iter.first], d[e] + iter.second);
                q.push(iter.first);
            }
        }

    }
    REP(i, Q){
        cout << (d[x[i].first] + d[x[i].second]) << endl;
    }


    return 0;
}

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  while(cin >> n,n){
    vector<pair<string,string>> s(n);
    rep(i,n){
      cin >> s[i].fi >> s[i].se;
    }
    int c = 1;
    sort(all(s));
    vector<string> t;
    t.push_back(s[0].se);
    rep(i,n-1){
      bool f = false;
      rep(j,t.size()){
        if(s[i+1].fi >= t[j]){
          f = true;
          t[j] = s[i+1].se;
          break;
        }
      }
      if(!f){
        ++c;
        t.push_back(s[i+1].se);
      }
    }
    std::cout << c << std::endl;
  }
  return 0;
}

Measured memory_bytes: 4140
#include<bits/stdc++.h>
#define pi acos(-1)
#define ll long long
#define pii pair<ll,ll>
#define debug(a) cout<<a<<'\n'
#define maxn 200009 /// I wanna be the wind
#define MOD 1000000007
#define F first
#define S second
#define rep(i, a, b) for(ll i = a; i < (b); ++i)
#define per(i, b, a) for(ll i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (ll)(x).size()
using namespace std;
const ll INF = 1e17 + 9;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,d;
    cin>>n>>d;
    d*=d;
    ll ans =0;
    rep(i,0,n){
        ll a,b;
        cin>>a>>b;
        if(a*a+b*b<=d)ans++;
    }
    cout<<ans<<"\n";
    return 0;  
}   

Measured memory_bytes: 3640
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
const int N = 100010;
int n;
int a[N];
bool flag=1;
bool vis[N];
int main(){
	scanf("%d",&n);
	for(int i=1; i<=n; i++){
		scanf("%d",&a[i]);
	}
//	for(int i=1; i<=n-1; i++){
//		if(a[i]-a[i+1]>1){
//			flag=0;
//			break;
//		}
//		else if(a[i]-a[i+1]==1){
//			a[i]--;
//			vis[i]=1;
//			if(!vis[i-1]){
//				a[i-1]--;
//			}
//			else{
//				flag=0;
//				break;
//			}
//		}
//	}
	for(int i=2; i<=n; i++){
		if(a[i]<a[i-1]){
			a[i]++;
		}
		if(a[i]<a[i-1]){
			flag=0;
			break;
		}
	}
	if(flag){
		printf("Yes");
	} 
	else{
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(){
  int i,j;
  char s[105],t[205];
  scanf("%s",&s);
  scanf("%s",&t);
  for(i=0;t[i]!=0;i++);
  for(j=0;s[j]!=0;j++,i++){
    t[i]=s[j];
  }
  t[i]=0;
  printf("%s",&t);
  return(0);
}


Measured memory_bytes: 128
// Problem : C - Repsept
// Contest : AtCoder - AtCoder Beginner Contest 174
// URL : https://atcoder.jp/contests/abc174/tasks/abc174_c
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define endl '\n'
int main()
{
	ll i,j,k,m,n,t;
	cin>>n;
	if(n==1 or n==7)
	{
		cout<<1;
		return 0;
	}
	{
		ll r=7;
		ll ctr=1;
		map<ll,ll> mp;
		while(r!=0)
		{
			r=r*10+7;
			r%=n;
			if(mp[r])
			{
				ctr=-1;
				break;
			}
			mp[r]++;
			ctr++;
		}
		cout<<ctr<<endl;
	}
}

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

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long 
#define M 1000000007
#define P pair<int,int>
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) FOR(i,0,n)
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265

int n,a[110000];

int main(){
  cin>>n;
  rep(i,n){
    cin>>a[i];
  }

  sort(a,a+n);

  int ans=0;
  ll s=0;
  rep(i,n){
    s+=a[i];
    if(2*s>=a[i+1]){
      ans++;
    }
    else
      ans=0;
  }

  cout<<ans<<endl;



  return 0;
}


Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    BufferedReader br;
    PrintWriter out;
    StringTokenizer st;
    boolean eof;
    final long MOD = 1000L * 1000L * 1000L + 7;

    void solveA() throws IOException {
        int x = nextInt();
        int t = nextInt();
        outln(Math.max(0, x - t));
    }
    void solveB() throws IOException {



    }
    void solveC() throws IOException {



    }
    void solveD() throws IOException {



    }

    void shuffle(int[] a) {
        int n = a.length;
        for(int i = 0; i < n; i++) {
            int r = i + (int) (Math.random() * (n - i));
            int tmp = a[i];
            a[i] = a[r];
            a[r] = tmp;
        }
    }
    private void outln(Object o) {
        out.println(o);
    }
    private void out(Object o) {
        out.print(o);
    }
    public Main() throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);

        solveA();

        out.close();
    }
    public static void main(String[] args) throws IOException {
        new Main();
    }

    public long[] nextLongArr(int n) throws IOException{
        long[] res = new long[n];
        for(int i = 0; i < n; i++)
            res[i] = nextLong();
        return res;
    }
    public int[] nextIntArr(int n) throws IOException {
        int[] res = new int[n];
        for(int i = 0; i < n; i++)
            res[i] = nextInt();
        return res;
    }
    public String nextToken() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (Exception e) {
                eof = true;
                return null;
            }
        }
        return st.nextToken();
    }
    public String nextString() {
        try {
            return br.readLine();
        } catch (IOException e) {
            eof = true;
            return null;
        }
    }
    public int nextInt() throws IOException {
        return Integer.parseInt(nextToken());
    }
    public long nextLong() throws IOException {
        return Long.parseLong(nextToken());
    }
    public double nextDouble() throws IOException {
        return Double.parseDouble(nextToken());
    }
}

Measured memory_bytes: 21076
S=input()
T=input()

best_num_char=0
for i in range(len(S)-len(T)+1):
    # print(T[i:])
    num_char=0
    for j in range(len(T)):
        num_char+=1 if S[i+j]==T[j] else 0
        # print(num_char,S[i + j])
    if best_num_char<num_char:
        best_num_char=num_char

# print(len(T))
print(len(T)-best_num_char)

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

int main() {
    string S, T="CODEFESTIVAL2016";
    cin >> S;
    int cnt=0;
    for(int i=0;i<16;i++){
    	if(S[i]!=T[i]) cnt++;
    }
    cout << cnt << endl;
    return 0;
}

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

using namespace std;

#define debug(n) cerr << #n << ':' << n << endl;
#define dline    cerr << __LINE__ << endl;

using ll = long long;
template<class T, class U> using P = pair<T,U>;
template<class T> using Heap = priority_queue<T>;
template<class T> using heaP = priority_queue<T,vector<T>,greater<T>>;
template<class T,class U> using umap = unordered_map<T,U>;
template<class T> using uset = unordered_set<T>;

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

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

template<class T, size_t N, class U>
void Fill(T (&a)[N], const U&v){
    fill((U*)a,(U*)(a+N),v);
}

template<class T>
istream& operator >> (istream&is, vector<T>&v){
  for(auto&e:v)is >> e;
  return is;
}

int main(){
  vector<int> v(3); cin >> v;
  sort(v.begin(), v.end());
  if(v[0] != v[2]){
    if(v[0] == v[1] || v[1] == v[2]) cout << "Yes\n";
    else cout << "No\n";
  } else cout << "No\n";
  return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  deque<int> b(0);
  for (int i = 0; i < n; i ++) {
    if (i % 2 == (n - 1) % 2) {
      b.push_front(a.at(i));
    } else {
      b.push_back(a.at(i));
    }
  }

  cout << b.at(0);
  for (int i = 1; i < n; i ++) {
    cout << " " << b.at(i);
  }
  cout << endl;
}


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

int main()
{
	long long int N, K, ans;
	cin>>N>>K;
	ans=N%K;
	
	while(1)
	{
		if(abs(ans-K)<ans)
			ans=abs(ans-K);
		else
			break;
	}
	
	cout<<ans;
	
	return 0;
}


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

int main()
{
    int n,i,j,k,a,b;
    string s;
    cin>>n;
    cin>>s;
    a=0;
    b=0;
    for(i=0;i<s.size();i++)
    {
        if(s[i]=='B')
        a++;
        else
        b++;
    }
    if(b>a)
    cout<<"Yes";
    else
    cout<<"No";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v) sort(v.begin(), v.end(), greater<ll>())

#define vfind(v, target) find(v.begin(), v.end(), target)
#define notFound(v, target) (vfind(v, target) == v.end())

#define ll long long
#define rep(i, s, g) for (ll i = (s); i < (g); i++)
#define MOD 1000000007
using namespace std;

ll gcd(ll x, ll y)
{
	while(y) {
    	ll r = x % y;
      	x = y; y = r;
    }
  	return x;
}

vector<pair<ll, int>> factorize(ll n) 
{
	vector<pair<ll, int>> res;
  for (ll i = 2; i * i <= n; i++) {
    if (n % i) continue;
    res.emplace_back(i, 0);
    while (n % i == 0) {
      n /= i;
      res.back().second++;
    }
  }
  if (n != 1) res.emplace_back(n , 1);
  return res;
}

int main()
{
  ll A, B; cin >> A >> B;
  ll g = gcd(A, B);
  auto f = factorize(g);
  int ans = f.size() + 1;
  cout << ans << endl;
}

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

int main(){
    int ans=0;
    string s;
    s[3];
    for(int i=0;i<3;i++){
        cin>>s[i];
    }

    for(int j=0;j<3;j++){
        if(s[j]=='7') ans++;
    }
    if(ans>0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3600
import bisect
from collections import Counter
n = int(input())
A = list(map(int,input().split()))
A.sort()
C = Counter(A)
ans = 0
for i in range(n-1,-1,-1):
    temp = A[i]
    beki = 1
    while beki <= temp:
        beki *= 2
    counterpart = beki-temp
    if C[counterpart] > 0 and C[temp] > 0 and counterpart != temp:
        C[counterpart] -= 1
        C[temp] -= 1
        ans += 1
    elif counterpart == temp and C[counterpart] > 1:
        C[counterpart] -= 2
        ans += 1
print(ans)


Measured memory_bytes: 33296
#include<stdio.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<queue>
using  namespace std;
long long a[2005][2004];
int main()
{
    long long n,m;
    long long i,j,k,flag,num[2006];
    scanf("%lld%lld",&n,&m);
    for(i=1;i<=n;i++)
        scanf("%lld",&num[i]);
    for(i=1;i<=n;i++){
        a[i][0]=num[i];
        for(k=1;k<=n-1;k++)
        {
            flag=i-k;
            if(flag<=0) flag=n+flag;
            a[i][k]=min(a[i][k-1],num[flag]);
        }
    }
    long long  minn=1e18;
    for(i=0;i<=n-1;i++){
        long long ans=0;
        for(j=1;j<=n;j++)
        {
            ans+=a[j][i];
        }
       // printf("%lld\n",ans+i*m);
        minn=min(minn,ans+m*i);
    }
    printf("%lld\n",minn);
    return 0;
}


Measured memory_bytes: 31616
/************************************************
 *Author* :zzy
 *Created Time* : 2019年08月04日 星期日 19时57分45秒
**Problem**:
**Analyse**:
**Get**:
**Code**:
*********************************************/

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
#define pr(x) cout << #x << ": " << x << " " 
#define pl(x) cout << #x << ": " << x << endl;
#define pri(a) printf("%d\n",(a))
#define xx first
#define yy second
#define sa(n) scanf("%d", &(n))
#define sal(n) scanf("%lld", &(n))
#define sai(n) scanf("%I64d", &(n))
#define vep(c) for(decltype((c).begin() ) it = (c).begin(); it != (c).end(); it++) 
const int mod = int(1e9) + 7, INF = 0x3f3f3f3f;
const int maxn = 1e5 + 13;

int main(void)
{
#ifdef LOCAL
 //freopen("in.txt", "r", stdin);
 //freopen("out.txt", "w", stdout);
#endif
    int a,b,c;
    sa(a);
    sa(b);
    sa(c);
    printf("%d",max(b+c-a,0));
 return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n, a, b;
   cin >> n >> a >> b;
   auto f = [](int n) {
      int sum = 0;
      while (n) {
         sum += n % 10;
         n /= 10;
      }
      return sum;
   };
   int ans = 0;
   rep(i, 1, n + 1) {
      int sum = f(i);
      if (sum >= a && sum <= b) ans += i;
   }
   cout << ans << endl;
   return 0;
}

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

int main() {
  int a,b,c,d;
  1<=a,b,c,d<=10;
  cin>>a>>b>>c>>d;

  if (a+b>c+d) {
    cout << "Left" << endl;
  }
  else if (a+b==c+d) {
    cout << "Balanced" << endl;
  }
  else {
    cout << "Right" << endl;
  }
}


Measured memory_bytes: 256
# 入力
[N,K] = list(map(int, input().split()))
A = list(map(int, input().split()))

# 処理
D = {}
for i in range(N):  # 各整数の個数を数える
  if A[i] in D:
    D[A[i]] += 1
  else:
    D[A[i]] = 1
    
L = list(D.values())[:]  # Dの値集合をコピー．
# D.values()はリストでないので，listで型変換する．

L.sort()  # Lをソート

ans = 0   # 答え
for i in range(len(L)-K):
  ans += L[i]

# 出力
print(ans)

Measured memory_bytes: 34172
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#define ll long long
void file(){
#ifndef ONLINE_JUDGE
	freopen("a_input.txt", "r", stdin);
	freopen("a_output.txt", "w", stdout);
#endif
}
void fast()
{
	std::ios_base::sync_with_stdio(0);
	cin.tie(NULL);
	cout.tie(NULL);
}
ll p[55], a[55];
void build(int n){
	if (n > 50)return;
	p[n] = 2 * p[n - 1] + 1;
	a[n] = 2 * a[n - 1] + 3;
	build(n + 1);
}
ll get(int n, ll x){
	if (n == 0)return x > 0;
	if (x <= a[n - 1] + 1)
		return get(n - 1, x - 1);
	return p[n - 1] + 1 + get(n - 1, x - 2 - a[n - 1]);
}
int main(){
	//file();
	fast();
	p[0] = 1;
	a[0] = 1;
	build(1);
	ll n, x;
	cin >> n>> x;
	cout << get(n, x) << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int N = in.nextInt();
		int[] ans = new int[N];
		ans[0] = 2;
		int ansPtr = 1;
		
		int[] prime = new int[1000];
		prime[0] = 2;
		int ptr = 1;
		int num = 3;
		while(ansPtr<N) {
			boolean isPrime = true;
			for(int i=1;i<ptr && prime[i]*prime[i]<=num;i++) {
				if(num%prime[i]==0) {
					isPrime = false;
					break;
				}
			}
			if(isPrime) {
				prime[ptr++] = num;
				if(num%5==1) {
					ans[ansPtr++] = num;
				}
			}
			num += 2;
		}
		
		for(int i=0;i<N;i++) {
			System.out.print(ans[i]+" ");
		}
		
		in.close();

	}

}


Measured memory_bytes: 19924
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;


     string str;

   bool flag=true;

      cin>>n;

      if(n>=30)cout<<"Yes"<<endl;

      else cout<<"No"<<endl;




}



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

lista = list(map(int,input().split()))

dp = [[0] * n for i in range(n)]

for i in range(n):
    dp[i][i] = lista[i]

for i in range(1,n):
    for j in range(i-1,-1,-1):
        dp[j][i] = max(lista[j] - dp[j+1][i], lista[i] - dp[j][i-1])

print(dp[0][n-1])


Measured memory_bytes: 135488
#include <cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll inf = 1000000007;
int main() {
	ll a;
	cin >> a;
	double b;
	cin >> b;
	ll ib = b * 100+0.5;
	a *=ib;
	a /= 100;
	cout << a << endl;
	return 0;
}


Measured memory_bytes: 3724
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
 
// Remove GCC optimizer for codechef
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
using namespace __gnu_pbds;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define endl "\n"
#define int long long
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
 
const int INF = 1e16;
const double PI = acos(-1);
const int N = 1e6 + 7;
int mod = 1e9 + 7;

const int maxn = 1e5 + 7;
int dp[maxn][2];

vector<int> graph[maxn];
int dfs(int u, int p)
{
    for(int &v: graph[u])
        if(v != p)
            dfs(v, u);
    int white = 1, black = 1;
    for(int &v: graph[u])
        if(v != p)
        {
            int t = dp[v][0] + dp[v][1];
            white *= t;
            white %= mod;
            black *= dp[v][0];
            black %= mod;
        }
    dp[u][0] = white;
    dp[u][1] = black;
    int ans = dp[u][0] + dp[u][1];
    ans %= mod;
    return ans;
}

int32_t main()
{
    IOS;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);

    int n;
    cin >> n;
    for(int i = 0; i < n - 1; i++)
    {
        int u, v;
        cin >> u >> v;
        graph[u].pb(v);
        graph[v].pb(u);
    }
    cout << dfs(1, 1) << endl;
    return 0;
}

Measured memory_bytes: 14208
H, W = map(int, input().split())
lines = []

for _ in range(H):
    a = list(input())
    if a.count('.') == W:
        a = len(a) * ['!']
    lines.append(a)

for w in range(W):
    c = True
    for h in range(H):
        if lines[h][w] == '#':
            c = False
            break
    if c:
        for h in range(H):
            lines[h][w] = '!'

for l in lines:
    if l.count('!') == W:
        continue
    for c in l:
        print('' if c == '!' else c, end='')
    print()


Measured memory_bytes: 4596
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		String str = sc.next();
		
		for(int i = 1; i < str.length(); i++) {
			if(str.charAt(i) == str.charAt(i - 1)) {
				System.out.println("Bad");
				return;
			}
		}
		
		System.out.println("Good");
	}

}


Measured memory_bytes: 22100
#include <stdio.h>

int main(void)
{
	int i, len[3], max = 0, num[4] = {0};
	
	while (1){
		for (i = 0; i < 3; i++){
			scanf("%d", &len[i]);
		}
		
		for (i = 0; i < 3; i++){
			if (len[max] < len[i]){
				max = i;
			}
		}
		
		if (len[(max) % 3] >= len[(max + 1) % 3] + len[(max + 2) % 3]){
			break;
		}
		
		num[0]++;
		if (len[max] * len[max] == len[(max + 1) % 3] * len[(max + 1) % 3] + len[(max + 2) % 3] * len[(max + 2) % 3]){
			num[1]++;
		}
		else if (len[max] * len[max] < len[(max + 1) % 3] * len[(max + 1) % 3] + len[(max + 2) % 3] * len[(max + 2) % 3]){
			num[2]++;
		}
		else {
			num[3]++;
		}
	}
	
	for (i = 0; i < 4; i++){
		if (i != 0){
			printf(" ");
		}
		
		printf("%d", num[i]);
	}
	
	puts("");
	
	return (0);
}

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

#define MOD 1000000007
typedef unsigned long long ull;

int main() {
    ull n,a,b;
    cin>> n>>a>>b;
    ull syou = n / (a+b);
    ull amari = n % (a+b);

    ull ans = 0;
    ans += syou * a;

    if (amari < a) {
        ans += amari;
    } else {
        ans += a;
    }

    cout << ans;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s,t;
	int count,max_count=2000;
	cin>>s>>t;
	for(int i=0;i<=(int)s.length()-(int)t.length();i++)
	{
		count=0;
		for(int j=0;j<(int)t.length();j++)
		{
			if(s[i+j]==t[j])
			{
				continue;
			}
			else
			{
				count++;
			}
		}
		max_count= min(count,max_count);
	}
	cout<<max_count;
	return 0;
}


Measured memory_bytes: 3628
# AOJ ITP2_7_D: Multi-Set
# Python3 2018.6.24 bal4u

from bisect import bisect_left, bisect_right, insort_left
dict = {}
keytbl = []
cnt = 0
q = int(input())
for i in range(q):
	a = list(input().split())
	ki = int(a[1])
	if a[0] == '0':
		if ki not in dict:
			dict[ki] = 1
			insort_left(keytbl, ki)
		else: dict[ki] += 1
		cnt += 1
		print(cnt)
	elif a[0] == '1': print(dict[ki] if ki in dict else 0)
	elif a[0] == '2':
		if ki in dict:
			cnt -= dict[ki]
			dict[ki] = 0
	else:
		L = bisect_left (keytbl, int(a[1]))
		R = bisect_right(keytbl, int(a[2]), L)
		r = []
		for j in range(L, R): r += [keytbl[j]]*dict[keytbl[j]]
		if r != []: print(*r, sep='\n')


Measured memory_bytes: 17908
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int n;cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  int sum = 0;
  rep(i,n) rep(j,n){
    if(i >= j)continue;
    sum += d[i] * d[j];
  }
  cout << sum << "\n";
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define MT make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define RT return
#define vv(a,b,c,d) vector<vector<a> >(b,vector<a>(c,d))
#define vvv(a,b,c,d,e) vector<vector<vector<a> > >(b,vv(a,c,d,e))
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vll = vector<ll>;

const int R[] = { 1,2,4 };
int N, A[100005];
int cnt[5];

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

    cin >> N;
    rep(i, N) {
        cin >> A[i];
        if (A[i] % 4 == 0)cnt[4]++;
        else if (A[i] % 2 == 0)cnt[2]++;
        else cnt[1]++;
    }

    int pre = 4, ok = 1;
    rep(i, N) {
        ok = 0;
        for (int j : R) {
            if (cnt[j] && pre*j % 4 == 0) {
                cnt[j]--;
                ok = 1;
                pre = j;
                break;
            }
        }
        if (!ok)break;
    }

    cout << (ok ? "Yes" : "No") << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <cmath>
#include <cstdio>
#include <algorithm>
using namespace std;

int main()
{
  int a, b, c;
  while (cin >> a >> b >> c) {
    if ((a|b|c) == 0)
      break;

    if (c == 0) {
      if (a != 1)
	printf("%d %d %d %d\n", a, b, 1, 0);
      else
	printf("%d %d %d %d\n", 1, max(0, b), 1, min(0, b));
      continue;
    }

    bool found = false;
    for (int p = 1; p*p <= a && !found; ++p) {
      if (a%p != 0)
	continue;

      int r = a / p;
      for (int q = -abs(c); q <= abs(c) && !found; ++q) {
	if (q == 0 || c%q != 0)
	  continue;

	int s = c / q;
	if (r*s + q*p == b) {
	  found = true;
	  if (p == r)
	    printf("%d %d %d %d\n", max(p, r), max(q, s), min(p, r), min(q, s));
	  else
	    printf("%d %d %d %d\n", max(p, r), q, min(p, r), s);
	  break;
	}
      }
    }

    if (!found)
      puts("Impossible");
  }
  return 0;
}

Measured memory_bytes: 888
n , m = map(int,input().split())
x = list(map(int,input().split()))
if n >= m :
  print(0)
  exit()
X = sorted(x)
y = []
for i in range(m-1):
    y.append(abs(X[i] - X[i+1]))

Y = sorted(y,reverse = True)

ans = sum(Y)
for i in range(n-1):
  ans = ans - Y[i]
print(ans)

Measured memory_bytes: 13960
#include<stdio.h>/*素数かどうか*/
int main(){
	int A;
	int B;
	int T;
	int Count;
	int x;
	scanf("%d%d%d",&A,&B,&T);
	x=(T+0.5)/A;
	Count=x*B;
	printf("%d",Count);
	return(0);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
#include<string.h>
#include<set>
#include<stdio.h>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include <cstdio>
#include <cstdlib>
#include<stack>
#include<vector>
int a[1100000];
int b[1100000];
int c[1100000];
int main()
{
    int n;
    cin>>n;
    int t;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&b[i]);
    for(int i=1;i<=n;i++)
        scanf("%d",&c[i]);
    sort(a+1,a+1+n);
    sort(b+1,b+1+n);
    sort(c+1,c+1+n);
    long long  add1=1;
    long long  add2=1;
    long long sum=0;
    for(int i=1;i<=n;i++)
    {
        while(a[add1]<b[i]&&add1<n)
            add1++;
        while(c[add2]<=b[i]&&add2<n)
            add2++;
        if(a[1]>=b[i]||c[n]<=b[i])
            continue;
        if(a[add1]<b[i])
            sum+=add1*(n-add2+1);
        else
            sum+=(add1-1)*(n-add2+1);
        //cout<<add1<<"_"<<add2<<endl;
        //cout<<sum<<endl;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 4864
#include <cstdio>
#include <algorithm>

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

using namespace std;

typedef pair<int, int> P;

int n;
P x[25];

int main(){
	while(true){
		scanf("%d", &n);
		if(n == 0){
			break;
		}
		rep(i, n){
			int a, b;
			scanf("%d%d", &a, &b);
			x[i] = P(b, a);
		}
		sort(x, x + n);
		int w = 0;
		bool ans = true;
		rep(i, n){
			w += x[i].second;
			if(w > x[i].first){
				ans = false;
				break;
			}
		}
		printf("%s\n", ans ? "Yes" : "No");
	}
	return 0;
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long ll;

void solve(){
    ll x;
    cin >> x;
    ll p = 100;
    int cnt = 0;
    while(p<x){
        p = p+(p/100);
        cnt++;
    }
    cout << cnt << endl;
}   

int main(){
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif
    // ios::sync_with_stdio(0);
    // cin.tie(0);
    // int t;
    // cin >> t;
    // while(t--){
    	solve();
    // }
}

Measured memory_bytes: 3604