akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;

 

int main() {
    vector<int> N(4), cnt(4);
    rep(i,4) cin >> N.at(i);
    rep(i,4) {
        if (N.at(i) == 1) ++cnt.at(0);
        if (N.at(i) == 9) ++cnt.at(1);
        if (N.at(i) == 7) ++cnt.at(2);
        if (N.at(i) == 4) ++cnt.at(3);
    }
    rep(i,4) {
        if (cnt.at(i) != 1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line = br.readLine();
		double r = Double.parseDouble(line);

		double ensyu = 2 * r * Math.PI;
		double menseki = r * r * Math.PI;
		// TODO ?????????????????????????????????????????????
		System.out.println(String.format("%.6f", menseki) + " "
				+ (String.format("%.6f", ensyu)));
	}
}

Measured memory_bytes: 24724
#include<iostream>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
using namespace std;

int main(){
	int m,n,c,a;
	cin>>m;
	rep(i,m){
		cin>>c>>a>>n;
		int sum=0;
		while(c>=1 && a>=1 && n>=1){c--;a--;n--;sum++;}
		while(c>=2 && a>=1){c-=2;a--;sum++;}
		while(c>=3){c-=3;sum++;}
		cout<<sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <vector>

int main() {
    int n, k, q;
    std::cin >> n >> k >> q;
    std::vector<int> score(n, 0);
    for (int i = 0; i < q; ++i) {
        int a;
        std::cin >> a;
        --a;
        ++score[a];
    }

    for (auto x : score) {
        std::cout << (k - q + x > 0 ? "Yes" : "No") << std::endl;
    }
    return 0;
}


Measured memory_bytes: 1024
#include <queue>
#include <vector>
#include <iostream>
#include <algorithm>
#define sqr(x) ((x) * (x))
using namespace std;
int n, q, s, t, b[1009], x[1009], y[1009];
int main() {
	while (cin >> n, n) {
		for (int i = 0; i < n; i++) cin >> b[i] >> x[i] >> y[i];
		vector<vector<int> > G(n);
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				if (sqr(x[i] - x[j]) + sqr(y[i] - y[j]) <= 2500) {
					G[i].push_back(j);
					G[j].push_back(i);
				}
			}
		}
		cin >> q;
		while (q--) {
			cin >> s >> t;
			for (int i = 0; i < n; i++) {
				if (b[i] == s) {
					s = i; break;
				}
			}
			for (int i = 0; i < n; i++) {
				if (b[i] == t) {
					t = i; break;
				}
			}
			vector<double> dist(n, 1.0e+10); dist[s] = 0.0;
			vector<int> pre(n, -1);
			queue<pair<double, int> > que; que.push(make_pair(0.0, s));
			while (!que.empty()) {
				int u = que.front().second; que.pop();
				for (int e : G[u]) {
					double d2 = hypot((double)(x[u] - x[e]), (double)(y[u] - y[e]));
					if (dist[e] > dist[u] + d2) {
						dist[e] = dist[u] + d2;
						pre[e] = u;
						que.push(make_pair(-dist[e], e));
					}
				}
			}
			if (dist[t] >= 9.0e+9) cout << "NA" << endl;
			else {
				vector<int> ret;
				while (t != s) {
					ret.push_back(b[t]);
					t = pre[t];
				}
				reverse(ret.begin(), ret.end());
				cout << b[s];
				for (int i : ret) cout << ' ' << i;
				cout << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3208
use std::io;
use std::io::{BufRead, Write};

fn solve<R: BufRead, W: Write>(mut input: R, mut output: W) {
    let mut buf = String::new();
    input.read_line(&mut buf).unwrap();
    let (a, b): (usize, usize) = {
        let mut split = buf.split_whitespace();
        (
            split.next().unwrap().parse().unwrap(),
            split.next().unwrap().parse().unwrap(),
        )
    };
    writeln!(output, "{}", if a > 8 || b > 8 { ":(" } else { "Yay!" }).unwrap();
}

fn main() {
    let stdin = io::stdin();
    let stdout = io::stdout();
    solve(stdin.lock(), stdout.lock());
}

#[cfg(test)]
mod tests {
    fn test(input: &str, output: &str) {
        let mut v: Vec<u8> = Vec::new();
        ::solve(input.as_bytes(), &mut v);
        assert_eq!(String::from_utf8(v).unwrap(), output);
    }

    #[test]
    fn case1() {
        test(
            "5 4
", "Yay!\n",
        );
    }

    #[test]
    fn case2() {
        test(
            "8 8
", "Yay!\n",
        );
    }

    #[test]
    fn case3() {
        test(
            "11 4
", ":(\n",
        );
    }
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    char c[3][2];
    rep(i,2){
        rep(j,3){
            cin>>c[j][i];
        }
    }
    bool flag=true;
    rep(i,2){
        rep(j,3){
            if(c[j][i]!=c[2-j][1-i])flag=false;
        }
    }
    if(flag)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;

    return 0;
}


Measured memory_bytes: 3656
#include <iostream>
using namespace std;
int main(void){
  int X;
  cin >> X;
  int i;
  for(i = X; true; i++){
    int count = 0;
    for (int j = i / 2; j > 0; j--){
      if(i % j == 0){
        count++;
      }
    }
    if(count == 1){
      break;
    }
  }
  cout << i;
  return 0;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;

int main(){
    double n, m;
    cin >> n >> m;
    vector<double> a(n);
    double sum = 0.0;
    rep(i, n) {
        cin >> a[i];
        sum += a[i];
    }
    int cnt = 0;
    rep(i, n) {
        if (a[i] < (sum / (4*m))) continue;
        cnt++;
    }
    if (cnt >= m) puts("Yes");
    else puts("No");
    return 0;
}

Measured memory_bytes: 256
/* 
	Author: ankrypt
*/


#include <bits/stdc++.h>

using namespace std;

#define MOD 1000000007
#define ll long long int
#define u64 unsigned long long int

ll N;
string S = "";
ll pref[300005];
ll suff[300005];
ll eS[300005];
ll wS[300005];
ll foundE = 0;
ll foundW = 0;
ll cntE = 0;
ll cntW = 0;

int main() {
	scanf("%lld", &N);
	if(S[0] == 'E') {
		foundE = 1;
	}
	else if(S[0] == 'W') {
		foundW = 1;
	}
	cin >> S;
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == 'E'){
			cntE++;
		}
		else {
			cntW++;
		}
	}
	for(int i = 0; i < S.size(); i++) {
		if(S[i] == 'E') {
			foundE++;
		}
		else {
			foundW++;
		}
		eS[i] = cntE - foundE;
		wS[i] = foundW;
	}
	wS[0] = 0;
	// for(int i = 0; i < N; i++) {
	// 	cout << eS[i] << " ";
	// }
	// cout << "\n";
	// for(int i = 0; i < N; i++) {
	// 	cout << wS[i] << " ";
	// }
	ll ans = 1e9;
	ll sum = 0;
	for(int i = 0; i < N; i++) {
		sum = eS[i] + wS[i];
		ans = min(ans, sum);
	}
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Measured memory_bytes: 6788
import sys
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
A = tuple(map(int, readline().split()))
Q = int(readline())
m = map(int, read().split())

counter = defaultdict(int)
for x in A:
    counter[x] += 1

total = sum(A)
for b, c in zip(m, m):
    total += (c - b) * counter[b]
    counter[c] += counter[b]
    counter[b] = 0
    print(total)

Measured memory_bytes: 34580
#include<stdio.h>
#include<iostream>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
#include<algorithm>
#include<string.h>
#include<functional>
#include<limits.h>
#include<stdlib.h>
#include<cmath>
#include<cstring>
#include<set>
#include<climits>
#include<deque>
#include<iomanip>
#include<utility>
using namespace std;

#define intmax INT_MAX
#define lmax LONG_MAX
#define uintmax UINT_MAX
#define ulmax ULONG_MAX
#define llmax LLONG_MAX
#define ll long long
#define rep(i,a,N) for((i)=(a);(i)<(N);(i)++)
#define rrp(i,N,a) for((i)=(N)-1;(i)>=(a);(i)--)
#define llfor ll i,j
#define sc(a) cin>>a
#define pr(a) cout<<a<<endl
#define pY puts("YES")
#define pN puts("NO")
#define py puts("Yes")
#define pn puts("No")
#define pnn printf("\n")
#define all(a) a.begin(),a.end()
#define push(a,b) (a).push_back(b)
#define llvec vector<vector<ll>>
#define charvec vector<vector<char>>
#define size(a,b) (a,vector<ll>(b))
#define llpvec vector<pair<ll,ll>>
#define S 21 
llfor;
const ll mod=1000000007;
/*pi*/const double pi=acos(-1);
/*繰り上げ除算*/ll cei(ll x,ll y){ll ans=x/y;if(x%y!=0)ans++;return ans;}
/*最大公約数*/ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}
/*最小公倍数*/ll lcm(ll x,ll y){return x/gcd(x,y)*y;}
/*n乗*/ll llpow(ll x,ll n){ll ans=1;rep(i,0,n){ans*=x;}return ans;}
/*階乗*/ll fact(ll x){ll ans=1;rep(i,0,x)ans*=(x-i);return ans;}
/*nCr*/ll ncr(ll n,ll r){return fact(n)*fact(n-r)/fact(r);}
/*nPr*/ll npr(ll n,ll r){return fact(n)/fact(n-r);}
/*primejudge*/bool prime(ll a){if(a<=1)return false;for(i=2;i*i<=a;i++){if(a%i==0)return false;}return true;}
/*Fibonacci数列*/ll fib(ll x){ll fibo[x+10];fibo[0]=1;fibo[1]=1;fibo[2]=1;rep(i,3,x+1)fibo[i]=fibo[i-1]+fibo[i-2];return fibo[x];}
/*桁数*/ll dig(ll n){ll d=1,tmp=n;while(tmp/10>0){tmp/=10;d++;}return d;}
/*行列のコピー*/void matcpy(ll a[S][S],ll b[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)b[i][j]=a[i][j];/*(aをbに)*/i=t;}
/*行列のリセット*/void matrst(ll a[S][S]){ll t=i;rep(i,0,S)rep(j,0,S)a[i][j]=0;i=t;}
/*行列の2乗*/void matpow(ll a[S][S]){ll ans[S][S];matrst(ans);ll t=i,k;rep(i,0,S)rep(j,0,S)rep(k,0,S)ans[i][j]+=a[i][k]*a[k][j];matcpy(ans,a);i=t;}
/*行列の乗算*/void matmul(ll a[S][S],ll b[S][S], ll as[S][S]){ll t=i,k;matrst(as);rep(i,0,S)rep(j,0,S)rep(k,0,S)as[i][j]+=a[i][k]*b[k][j];i=t;}
//ll ans=0;
////////////////////////////////////////////////////////////
int main(){
// ll a,b;cin>>a>>b;
 ll n;cin>>n;
 char c[n+10];
 ll w=0,r=0;
 rep(i,0,n){
  sc(c[i]);
  if(c[i]=='W')w++;
  else r++;
 }
 ll ans=0;
 bool st=false;
 rep(i,0,r){
  if(c[i]=='W')ans++;
 }
 pr(ans);
return 0;}

// (10^x -1)*7/9=n*k
// (10^x -1)*7=n*k*9
// nが7の倍数じゃないときは、kは7の倍数

Measured memory_bytes: 3820
#include <iostream>
#include <vector>
#include <string>
#include <list>
#include <queue>
#include <algorithm>
#define rep(i, n) for(i = 0; i < (n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define MOD 1000000007
#define PI 3.14159265358979323846
#define INF 1 << 30

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

int main(void) {
	int num, i, ok = true;
	string s, a;
	cin >> s >> a;
	if (s.size() + 1 == a.size()) {
		rep(i, s.size()) {
			if (s[i] != a[i]) {
				ok = false;
				break;
			}
		}
	}
	else
		ok = false;
	if (ok)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 3596
// Template {{{
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0; i<(int)(n); ++i)
using namespace std;
typedef long long LL;

#ifdef LOCAL
#include "contest.h"
#else
#define error(args...) 
#endif

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
inline bool valid(int x, int w) { return 0 <= x && x < w; }

void iostream_init() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.setf(ios::fixed);
    cout.precision(12);
}
//}}}

LL H, W, h, w;
LL d[500][500] = {};
bool find1() {
    REP(y, H) REP(x, W) {
        if(y % h == h-1 && x % w == w-1) {
            d[y][x] = -h*w;
        } else {
            d[y][x] = 1;
        }
    }
    LL s = 0;
    REP(y, H) REP(x, W) {
        s += d[y][x];
    }
    return s > 0;
}

bool find2() {
    // [0, bh] (bh, h-1]
    // [0, bw] (bw, w-1]
    REP(y, H) REP(x, W) {
        if(y % h == h-1 && x % w == w-1) {
            d[y][x] = -1000000000;
        } else if(y % h == 0 && x % w == 0) {
            d[y][x] = 1000000000-1;
        } else {
            d[y][x] = 0;
        }
    }
    LL s = 0;
    REP(y, H) REP(x, W) {
        s += d[y][x];
    }
    return s > 0;
}

int main(){
    iostream_init();
    while(cin >> H >> W >> h >> w) {
        if(find1()) {
            cout << "Yes" << endl;
            REP(y, H) {
                REP(x, W) {
                    cout << d[y][x];
                    if(x == W-1) {
                        cout << endl;
                    } else {
                        cout << " ";
                    }
                }
            }
        } else if(find2()) {
            cout << "Yes" << endl;
            REP(y, H) {
                REP(x, W) {
                    cout << d[y][x];
                    if(x == W-1) {
                        cout << endl;
                    } else {
                        cout << " ";
                    }
                }
            }
        } else {
            cout << "No" << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb emplace_back
typedef pair<int,int> pi;

int n, cnt[300005][2], ans = 1e9;

int query(int qs, int qe, int id) {
	if (qe <= qs) return 0;
	if (qs) return cnt[qe][id] - cnt[qs-1][id];
	return cnt[qe][id];
}

int main() {
	ios_base::sync_with_stdio(0); 
	cin.tie(0);
	cin >> n;
	for (int i = 0; i < n; ++i) {
		char ch; cin >> ch;
		++cnt[i][(ch=='W')];
		if (i) {
			cnt[i][0] += cnt[i-1][0];
			cnt[i][1] += cnt[i-1][1];
		}
	}
	for (int i = 0; i < n; ++i) {
		int need = query(0,i-1,1) + query(i+1,n-1,0);
		ans = min(ans, need);
		// cout << need << ' ';
	}
	cout << ans;
	return 0;
}


Measured memory_bytes: 5960
from __future__ import division, print_function
# import threading
# threading.stack_size(2**27)
# import sys
# sys.setrecursionlimit(10**7)
# sys.stdin = open('inpy.txt', 'r')
# sys.stdout = open('outpy.txt', 'w')
from sys import stdin, stdout
import bisect            #c++ upperbound
import math
import heapq
i_m=9223372036854775807
def inin():
    return int(input())
def stin():
    return input()
def spin():
    return map(int,stin().split())
def lin():                           #takes array as input
    return list(map(int,stin().split()))
def matrix(n):
    #matrix input
    return [list(map(int,input().split()))for i in range(n)]

################################################
def string2intlist(s):
    return list(map(int, s))

def calculate_sum(a, N): #sum of a to N
    # Number of multiples 
    m = N / a 
    # sum of first m natural numbers 
    sum = m * (m + 1) / 2
    # sum of multiples 
    ans = a * sum
    return ans
def series(N):
    return (N*(N+1))//2

def count2Dmatrix(i,list):
    return sum(c.count(i) for c in list)

def modinv(n,p):
    return pow(n,p-2,p)

def GCD(x, y): 
    x=abs(x)
    y=abs(y)
    if(min(x,y)==0):
        return max(x,y)
    while(y): 
        x, y = y, x % y 
    return x
def LCM (x, y):
    return (x * y) // GCD(x, y)
    
def Divisors(n) : 
    l = []  
    for i in range(1, int(math.sqrt(n) + 1)) :
        if (n % i == 0) : 
            if (n // i == i) : 
                l.append(i) 
            else : 
                l.append(i)
                l.append(n//i)
    return l
def isprime(n):
    for i in range(2, int(math.sqrt(n))+1):
        if n%i==0:
            return False
    return True
prime=[]
def SieveOfEratosthenes(n): 
    global prime
    prime = [True for i in range(n+1)] 
    p = 2
    while (p * p <= n): 
        if (prime[p] == True): 
            for i in range(p * p, n+1, p): 
                prime[i] = False
        p += 1
    f=[]
    for p in range(2, n): 
        if prime[p]: 
            f.append(p)
    return f
q=[]       
def dfs(n,d,v,c):
    global q
    v[n]=1
    x=d[n]
    q.append(n)
    j=c
    for i in x:
        if i not in v:
            f=dfs(i,d,v,c+1)
            j=max(j,f)
            # print(f)
    return j
# d = {}
 
"""*******************************************************"""
s = stin()
t = stin()
c,d = 0,0
for i in range(len(s)-len(t)+1):
    d=0
    for j in range(len(t)):
        if s[i+j]==t[j]:
            d+=1
    # print(c, d)
    c=max(d,c)
print(len(t)-c)
# for i in range(len(t), 0,-1):
#     # print(t[:i])
#     if t[:i] in s:
#         # print(c)
#         break
#     else:
#         c+=1
#     # print(t[:i], t[:i] in s)
# for i in range(len(t)):
#     # print(t[i:])
#     if t[i:] in s:
#         # print(d)
#         break
#     else:
#         d+=1
# # print("ab" in s)
# print(min(c, d))

Measured memory_bytes: 73228
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define VPII vector<pair<int,int> >
#define F first
#define S second
#define RF(x) freopen(x,"r",stdin)
#define WF(x) freopen(x,"w",stdout)
typedef long long LL;
using namespace std;
typedef pair<LL,LL> PLL;
typedef pair<int,int> PII;
const LL MOD = 1e9+7;
const LL INF = 1LL<<50;
const double eps = 1e-13;

char s[109];
char t[109];

int main(){
	RS(s);int n=LEN(s);
	int ans=0;
	REP(c,26){
		bool done=0;
		int l=n;
		REP(i,n)t[i]=s[i];
		while(!done){
			done=1;
			REP(i,l){
				if(t[i]!='a'+c){
					done=0;break;
				}
			}
			if(done)break;
			l--;
			REP(i,l){
				if(t[i]=='a'+c||t[i+1]=='a'+c)t[i]='a'+c;
			}
		}
		ans=max(ans,l);
	}
	printf("%d",n-ans);
}


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

vector<ll> solve(int n, int q, vector<ll> const & a, vector<ll> const & x) {
    vector<ll> acc(n + 1);
    partial_sum(ALL(a), acc.begin() + 1);
    vector<ll> acc_even(n + 1);
    REP (i, n) {
        acc_even[i + 1] = acc_even[i] + (i % 2 == 0 ? a[i] : 0);
    }

    vector<int> order(q);
    iota(ALL(order), 0);
    sort(ALL(order), [&](int i, int j) { return x[i] > x[j]; });

    auto get_l_r = [&](int k) {
        int l = max(0, n - 2 * k);
        int r = n - k;
        return make_pair(l, r);
    };
    auto pred = [&](ll x, int k) {
        int l, r; tie(l, r) = get_l_r(k);
        ll d = max(abs(a[l] - x), abs(a[r - 1] - x));
        return not (l - 1 >= 0 and abs(a[l - 1] - x) <= d);
    };

    vector<ll> answer(q);
    int k = 1;
    for (int i : order) {
        while (k < (n + 1) / 2 and not pred(x[i], k)) ++ k;
        int l, r; tie(l, r) = get_l_r(k);
        answer[i] = (acc[n] - acc[r]) + (n % 2 == 0 ? acc[l] - acc_even[l] : acc_even[l]);
    }
    return answer;
}

int main() {
    int n, q; cin >> n >> q;
    vector<ll> a(n); REP (i, n) cin >> a[i];
    vector<ll> x(q); REP (i, q) cin >> x[i];
    for (ll y_i : solve(n, q, a, x)) {
        cout << y_i << endl;
    }
    return 0;
}


Measured memory_bytes: 4608
from sys import exit, setrecursionlimit, stderr
from functools import reduce
from itertools import *
from collections import defaultdict, Counter
from bisect import bisect

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

L = 41

A, B = reads()
def solve(n):
  ans = 0
  for i in range(L+1):
    q, r = divmod(n, 2 ** (i + 1))
    ans |= ((q * (2 ** i) + max(0, r - 2 ** i)) & 1) << i
  return ans
print(solve(A) ^ solve(B+1))


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

int main(int argc,char** argv)
{
	int a, b, x, y;
	scanf("%d%d",&a, &b);
	x = a + b;
	y = x / 2;
	if(x % 2 > 0){
		y++;
	}
	printf("%d\n",y);
	return(0);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define mod 1000000007ll
#define mod1 998244353ll
#define endl "\n"
#define inf (ll)1e18+1
using namespace std::chrono;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    ll n,k,s;
    cin>>n>>k>>s;
    vector<ll> ar(n);
    ll temp=(ll)1e9;
    ll x=0;
    for(x=0;x<k;x++){
        ar[x]=s;
    }
    for(;x<n;x++){
        if(temp==s){
            temp--;
        }
        ar[x]=temp;
        temp--;
    }
    for(ll x:ar){
        cout<<x<<" ";
    }
    cout<<endl;
    return 0;
}

Measured memory_bytes: 2176
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <limits.h>	
#define inf (INT_MAX-1)
#define INF 9223372036854775807
#define sq(n) ((n)*(n))
#define rep(i,n) for(i=0;i<n;i++)
#define rev(i,n) for(i=n-1;i>=0;i--)
const int mod=(int)1e09+7;

int in(void){
	int i;scanf("%d",&i);
	return i;
}
long long llin(void){
	long long i;scanf("%lld",&i);
	return i;
}
double din(void){
	double i;scanf("%lf",&i);
	return i;
}
void chin(char s[]){
	scanf("%s",s);
}
void print(int a){
	printf("%d\n",a);
}
void llprint(long long a){
	printf("%lld\n",a);
}
void dprint(double a){
	printf("%.10f\n",a);
}
void print2(int a,int b){
	printf("%d %d\n",a,b);
}
long long max(long long a,long long b){
	return a>b?a:b;
}
long long min(long long a,long long b){
	return a<b?a:b;
}
long long llabs(long long a){
	return a>0?a:-a;
}
double dmax(double a,double b){
	return a>b?a:b;
}
int cmp(const void *a,const void *b){
	return *(long long *)a-*(long long *)b;
}

int main(void){
	int h=in(),r=in();
	if(h<0&&h<-r){
		print(-1);
	}
	else if(h<0&&h==-r){
		print(0);
	}
	else{
		print(1);
	}
	return 0;
}

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

int main(){
  int N, M, x1, x2;
  cin >> N >> M;
  vector<int> number(N, 0);
  for (int i = 1; i < M + 1; i++){
    cin >> x1 >> x2;
    for (int j = 0; j < N; j++){
      if(x1 == j + 1){
        number.at(j)++;
      }
      if(x2 == j + 1){
        number.at(j)++;
      }
    }
  }
  for (int i = 0; i < N; i++){
    cout << number.at(i) << endl;
  }
  return 0;
}

Measured memory_bytes: 3588
#include <stdio.h>

int main(int argc, char *argv[])
{
    int i, N, K, n;
    scanf("%d %d", &N, &K);
    if ( N == 1 ){
        printf("%d\n", K);
    } else {
        for ( n = K, i = 1; i < N; i++ ){
            n *= K - 1;
        }
        printf("%d\n", n);
    }
    return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 10005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
	if(c == '-') f = -1;
	c = getchar();
    }
    while(c >= '0' && c <= '9') {
	res = res * 10 +c - '0';
	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
const int MOD = 1000000007;
int N,M,s[2],l[2];
int inc(int a,int b) {
    return a + b >= MOD ? a + b - MOD : a + b;
}
int mul(int a,int b) {
    return 1LL * a * b % MOD;
}
void update(int &x,int y) {
    x = inc(x,y);
}
void Solve() {
    read(N);read(M);
    int x;
    for(int i = 1 ; i <= N ; ++i) {
	read(x);
	x = (x + MOD) % MOD;
	update(l[0],inc(mul(i - 1,x),MOD - s[0]));
	update(s[0],x);
    }
    int y;
    for(int i = 1 ; i <= M ; ++i) {
	read(y);
	y = (y + MOD) % MOD;
	update(l[1],inc(mul(i - 1,y),MOD - s[1]));
	update(s[1],y);
    }
    out(mul(l[0],l[1]));
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
}


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

int main(void) {
    // insert code here...
    int count = 0;
    int num[3];
    for(int i = 0; i < 3; i++){
        cin >> num[i];
    }
    
    sort(num, num + 3);
//    for(int i = 0; i < 3; i++){
//        cout << num[i] << endl;
//    }
    
    int a, b;
    
    a = num[2] - num[1];
    while(a > 0){
        num[0]++;
        num[1]++;
        a--;
        count++;
    }
    
    b = num[2] - num[0];
    
    while(b > 0){
        num[0]+=2;
        b-=2;
        count++;
    }
    
    if(b<0){
        count++;
    }
    
    cout << count << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define REP(i, n) FOR(i, 0, n)

using namespace std;

int main() {
    long long n;
    cin >> n;
    long long a[n];
    deque<long long> b;
    REP(i, n) {
        cin >> a[i];
        if(n%2 == 0) {
            if(i % 2 == 0) b.push_back(a[i]);
            else b.push_front(a[i]);
        }else{
            if(i %2 == 0) b.push_front(a[i]);
            else b.push_back(a[i]);
        }
    }
    for(auto& e : b) cout << e << " ";
    cout << "\n";
}

Measured memory_bytes: 5376
import std.stdio;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.functional;
import std.bigint;
import std.numeric;
import std.array;
import std.math;
import std.range;
import std.container;
import std.ascii;
void times(alias fun)(int n) {
    foreach(i; 0..n) fun();
}
auto rep(alias fun, T = typeof(fun()))(int n) {
    T[] res = new T[n];
    foreach(ref e; res) e = fun();
    return res;
}
// fold was added in D 2.071.0.
template fold(fun...) if (fun.length >= 1) {
    auto fold(R, S...)(R r, S seed) {
        static if (S.length < 2) {
            return reduce!fun(seed, r);
        } else {
            return reduce!fun(tuple(seed), r);
        }
    }
}

void main() {
    writeln(readln.split.to!(int[]).sum==5+7+5 ? "YES":"NO");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    for(int i=0; i<9999; i++){
            for(int j=0; j<9999; j++){
                    if(n == i*7 + j*4){
                            cout<< "Yes" <<endl;
                            return 0;
                    }
            }
    }
    cout<< "No" <<endl;
}


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

# from collections import deque

def linput(ty=int, cnv=list):
    return cnv(map(ty, input().split()))

def vinput(rep=1, ty=int, cnv=list):
    return cnv(ty(input().rstrip()) for _ in "*"*rep)

def gcd(n,m):
    while m: n,m = m, n%m
    return n

def lcm(n,m): return n*m//gcd(n,m)

def main():
    N,M = linput()

    vR = [0, 1,] + [0,]*(N-1)
    vN = [0, 1,] + [1,]*(N-1)

    res = 0

    for _ in range(M):
        a,b = linput()
        if vR[a]:
            vR[b] = 1
        if vN[a]==1:
            vR[a] = 0

        vN[a] -= 1
        vN[b] += 1

    res = sum(vR)
    print(res)
    # sT = "No Yes".split()
    # print(sT[res])
    # for vR in mR:
    #     print(*vR, sep="")

main()


Measured memory_bytes: 11088
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
using namespace std;
int main() {
	char n[4];
	cin >> n;
	for (int i = 0; i < strlen(n); i++)
	{
		if (n[i] == '1')n[i] = '9';
		else if (n[i] == '9')n[i] = '1';
	}
	cout << n;
	return 0;
}

Measured memory_bytes: 256
S = input()

L = []

cnt = 1
temp = S[0]
for i in range(len(S)-1):
    if S[i+1] == temp:
        cnt += 1
    else:
        L.append(cnt)
        temp = S[i+1]
        cnt = 1
        
L.append(cnt)

ans = 0
if S[0] == "<":
    for i in range(len(L)):
        if i%2 == 0:
            ans += L[i]*(L[i]+1)//2
        else:
            if L[i] > L[i-1]:
                ans += L[i]*(L[i]+1)//2
                ans -= L[i-1]
            else:
                ans += L[i]*(L[i]-1)//2
else:
    for i in range(len(L)):
        if i%2 == 1 or i == 0:
            ans += L[i]*(L[i]+1)//2
        else:
            if L[i] > L[i-1]:
                ans += L[i]*(L[i]+1)//2
                ans -= L[i-1]
            else:
                ans += L[i]*(L[i]-1)//2
            
print(ans)

Measured memory_bytes: 52424
x, n = map(int, input().split())
if n==0:
    print(x)
else:
    p = list(map(int, input().split()))
    p.sort()
    i = 0
    while i < n and p[i] < x:
        i += 1

    if p[i] != x:
        print(x)
    else:
        j = 1
        up = x+j
        down = x-j
        while True:
            if i-j>=0 and p[i-j] != x-j:
                print(x-j)
                break
            elif i-j < 0:
                print(x-j)
                break
            if i+j<n and p[i+j] != x+j:
                print(x+j)
                break
            elif i+j >= n:
                print(x+j)
                break
            j += 1


Measured memory_bytes: 9220
#include <stdio.h>
int main(void){
    /* 変数宣言，ちゃんと初期化しよう */
    int A = 0;
    int B = 0;
    int ans = 0;
    /* 変数宣言終わり */
    
    /* 入力を受け付ける部分*/
    
    // %dはdecimalの略．つまり，入力を10進数として扱うよという意味．
    scanf("%d %d", &A, &B);
    
    /* 入力を受け付ける部分終わり*/
    
    
    /* 何か処理*/
    ans = A%B;
    
    
    if(A%B == 0){
      /* 真の場合の処理 */
      ans = 0;
    }else{
      /* 偽の場合の処理 */
      ans = 1;
    }
    
    for(int i = 0; i < 10; i++){ 
      // i = 0,1,2,3,4,5,6,7,8,9のとき処理される
      
    }
    
    /* 何か処理終わり*/
    
    
    /* 出力する部分*/
    
    printf("%d", ans); // %dの部分にansの値が表示される
    
    /* 出力する部分*/
    
    
    
    return 0;
}


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

int main(){
	double a, b, c, d, e, f;
	while (cin >> a >> b >> c >> d >> e >> f){
		/*
		a = 2;
		b = -1;
		c = -3;
		d = 1;
		e = -1;
		f = -3;
		*/
		double x, y;
		x = (c * e - b * f) / (a * e - b * d);
		y = (c * d - a * f) / (b * d - a * e);
		if (x == -0.000) x = 0.000;
		if (y == -0.000) y = 0.000;
		cout << fixed << setprecision(3) << x << " " << y << endl;
	}
	return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>

using namespace std;
template<class T1, class T2> inline void chkmin(T1 &x, const T2 &y) {if (x > y) x = y;}
template<class T1, class T2> inline void chkmax(T1 &x, const T2 &y) {if (x < y) x = y;}
#define all(c) (c).begin(), (c).end()
#define sz(c) (int)(c).size()
#define mp make_pair
#define pb push_back
#define read(FILENAME) freopen((string(FILENAME) + ".in").c_str(), "r", stdin)
#define write(FILENAME) freopen((string(FILENAME) + ".out").c_str(), "w", stdout);
const int MAXN = 300228;


bool good[MAXN];


int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	//read("input");
	string s;
	cin >> s;
	for (int i = 0; i < sz(s) - 1; i++) {
		if (s[i] == 'B' && s[i + 1] == 'C') {
			good[i] = true;
		}
	}
	int last = 0;
	long long ans = 0;
	for (int i = 0; i < sz(s); i++) {
		if (s[i] == 'A') {
			last++;
		} else {
			if (good[i]) {
				ans += last;
			} else {
				if (i == 0 || !good[i - 1]) {
					last = 0;
				}
			}
		}
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 788
#include<stdio.h>
int main()
{
	int a, b;
	scanf("%d %d", &a, &b);
	char ans[102][102];
	int i, j;
	for (i = 0; i < 100; i++)
		for (j = 0; j < 50; j++)
			ans[i][j] = '#';
	for (i = 0; i < 100; i++)
		for (j = 50; j < 100; j++)
			ans[i][j] = '.';
	a--;
	b--;
	i = j = 0;
	while (a > 0)
	{
		ans[i][j] = '.';
		i += 2;
		if (i == 100)
		{
			i = 0;
			j += 2;
		}
		a--;
	}
	i = 0;
	j = 99;
	while(b > 0)
	{
		ans[i][j] = '#';
		i += 2;
		if (i == 100)
		{
			i = 0;
			j -= 2;
		}
		b--;
	}
	printf("100 100\n");
	for (i = 0; i < 100; i++)
		ans[i][100] = '\0';
	for (i = 0; i < 100; i++)
		printf("%s\n", ans[i]);
	return 0;
}

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

const char *p;

void parse(){
	if(*p == 'm'){
		++p;
		parse();
		if(*p++ != 'e'){ throw 0; }
		parse();
		if(*p++ != 'w'){ throw 0; }
	}
}

int main(){
	string s;
	cin >> s;
	p = s.c_str();
	bool cat = false;
	try{
		parse();
		cat = !*p;
	}catch(...){}

	cout << (cat ? "Cat\n" : "Rabbit\n");
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  string b;
  cin >> b;

  if (b[0] == 'A')
    cout << 'T' << endl;
  else if (b[0] == 'T')
    cout << 'A' << endl;
  else if (b[0] == 'G')
    cout << 'C' << endl;
  else
    cout << 'G' << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl

int n;
int a[100005],b[100005],c[100005],ori[100005];
ll extra=0;
vector<pii>ex;

int main()
{
	SPEED;	
	cin>>n;
	for(int i=1;i<=n;i++)
		cin>>a[i],ori[i]=a[i];
	for(int i=1;i<=n;i++)
		cin>>b[i];
	for(int i=1;i<=n;i++)
		if(a[i]>b[i])
			extra+=a[i]-b[i],ex.pb(mp(a[i]-b[i],i)),a[i]=b[i];
	for(int i=1;i<=n;i++)
		if(a[i]<b[i])
			extra-=b[i]-a[i],a[i]=b[i];
	if(extra<0)
		return cout<<-1<<endl,0;
	sort(ex.begin(), ex.end());
	for(auto j:ex)
	{
		if(j.FF<=extra)
		{
			a[j.SS]=ori[j.SS];
			extra-=j.FF;
		}
		else
			a[j.SS]+=extra,extra=0;
	}
	int ans=0;
	for(int i=1;i<=n;i++)
		if(a[i]==ori[i])
			ans++;
	cout<<n-ans<<endl;
	return 0;
}

Measured memory_bytes: 2044
#include <bits/stdc++.h>
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define vec_input(v) for(auto it=v.begin();it!=v.end();it++){cin>>*it;}
#define vec_debug(v) for(auto it=v.begin();it!=v.end();it++){cerr<<*it<<" ";}cerr<<endl;
#define yn(ans) cout<<(ans?"Yes":"No")<<endl
#define YN(ans) cout<<(ans?"YES":"NO")<<endl
using namespace std;
using ll = long long;
template <typename T>T digitsum(T n);
template <typename T>bool isPrime(T n);
template <typename T>vector<pair<T, T>> prime_factor(T n);
long long int intpow(long long int,long long int);
template <typename T>T intlog(T);
long long int combination(long long int,long long int);
long long int series_sum(long long int);

int main(){
    ll a,v,b,w,t;
    cin>>a>>v>>b>>w>>t;
    YN(abs(b-a)<=(v-w)*t);
}

long long int series_sum(long long int n){
    long long int ans=0;
    for(long long int i=1;i<=n;i++){
        ans+=i;
    }
    return ans;
}
template <typename T>
T digitsum(T n){
    string s=to_string(n);
    T sum=0;
    T d=1;
    for(T e=0;e<s.length();e++){
        sum+=(n/d)%10;d*=10;
    }
    return sum;
}
template <typename T>
bool isPrime(T n){
    if(n<=1)return false;
    if(n==2)return true;
    if(n%2==0)return false;
    for(T q=3;q*q<=n;q+=2){
        if(n%q==0)return false;
    }
    return true;
}
template <typename T>
vector<pair<T, T>> prime_factor(T n) {
    vector<pair<T, T>> ret;
    if(n%2==0){
        T tmp = 0;
        while (n % 2 == 0) {
            tmp++;
            n /= 2;
        }
        ret.push_back(make_pair(2, tmp));
    }
    for (T i = 3; i*i <= n; i+=2) {
        if(n%i==0){
            T tmp = 0;
            while (n % i == 0) {
                tmp++;
                n /= i;
            }
            ret.push_back(make_pair( i, tmp));
        }
    }
    if (n != 1) ret.push_back(make_pair(n, 1));
    return ret;
}
long long int intpow(long long int x,long long int n){
    long long int ans=1;
    for(int i=0;i<n;i++){
        ans*=x;
    }
    return ans;
}
template <typename T>T intlog(T x){
    string a=to_string(x);
    return a.length()-1;
}
long long int combination(long long int a,long long int b){
    queue<long long int> bunsi,bunbo;
    long long int ans=1;
    b=min(b,a-b);
    for(int i=0;i<b;i++){
        bunsi.push(a-i);
        if(b-i>=2)bunbo.push(b-i);
    }
    while(bunsi.size()!=0||bunbo.size()!=0){
        ans*=bunsi.front();
        bunsi.pop();
        if(ans%bunbo.front()==0){
            ans/=bunbo.front();
            bunbo.pop();
        }
    }
    return ans;
}

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

using namespace std;

int main()
{
  int n, m;
  cin >> n >> m;
  
  map<int, int> map;
  for(int i=0; i<n; i++){
    int a, b;
    cin >> a >> b;
    map[a] += b;
  }
  //for(auto i : map)
  //  cout << i.first << " " << i.second << endl;
  
  int cnt = 0;
  long long price = 0;
  for(auto i : map){
    long long num = i.second;
    if(cnt + num <= m){
      price += (long long)i.first * num;
      cnt += num;
      //printf("%d x %lld  -> %lld %d\n", i.first, num, price, count);
    }
    else{
      num = m - cnt;
      price += (long long)i.first * num;
      //printf("%d x %lld  -> %lld %d\n", i.first, num, price, count);
      break;
    }
  }
  cout << price << endl; 
    
  return 0;
}


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

using namespace std;

#define MOD 1000000007
#define INF INT_MAX
#define ll long long

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

	int x, y;
	if (a < c) {
		x = c;
	}
	else {
		x = a;
	}
	if (b > d) {
		y = d;
	}
	else {
		y = b;
	}

	int res = 0;
	if (y - x > 0) {
		res = y - x;
	}
	printf("%d\n", res);


	return (0);
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define int long long
#define vec(a,n) vector<int> (a)((n))
#define Vec(a,n) vector<string> (a)((n))
#define P pair<int,int>
#define PQ(n) priority_queue<P,vector<P>,greater<P>> (n)
#define pq(n) priority_queue<int> (n)
using namespace std;

signed main(){
    int h,w;
    cin >> h >> w;
    REP(i,w+2){
        cout << "#";
    }
    cout << endl;
    REP(i,h){
        cout << "#";
        string s;
        cin >> s;
        cout << s << "#" << endl;
    }
    REP(i,w+2){
        cout << "#";
    }

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;
ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
	int H, W;
	cin >> H >> W;
    vector<vector<string>> S(H, vector<string>(W));
    char c1, c2;
    rep(i,H) rep(j,W) {
        cin >> S[i][j];
        if (S[i][j]=="snuke") {
        	cout << (char)('A' + j) << i+1 << endl;
        }
    }
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <cmath>
#include <cstdio>
#include <istream>
#include <sstream>
#include <iomanip>
using namespace std;

typedef ostringstream oss;
typedef istringstream iss;

typedef vector<int> vi;
typedef vector< vi > vvi;

typedef long L;
typedef long long LL;

const int SECOND_OF_DAY = 24 * 60 * 60;

LL toSecond(int h, int m, int s) {
	return (LL)h * 60 * 60 + (LL)m * 60 + (LL)s;
}

int main(void) {
	int N;
	while (cin >> N, N) {
		vi time(SECOND_OF_DAY, 0);

		for (int i = 0; i < N; i++) {
			int h, m, s;
			char buf;
			cin >> h >> buf >> m >> buf >> s;
			LL start = toSecond(h, m, s);
			cin >> h >> buf >> m >> buf >> s;
			LL end = toSecond(h, m, s);

			for (LL i = start; i < end; i++) {
				time[i]++;
			}
		}

		cout << *(max_element(time.begin(), time.end())) << endl;
	}

	return 0;
}

Measured memory_bytes: 1532
N = int(input())
S = []
T = []
for _ in range(N):
    s, t = input().split()
    S.append(s)
    T.append(int(t))
X = input()

for i, s in enumerate(S):
    if s == X:
        a = i

ans = sum(T[a + 1:])

print(ans)


Measured memory_bytes: 3316
#include <stdio.h>

int main(void){
    char str1[6];
    int n=0;
    scanf("%s",str1);
    if(str1[2]==str1[3])n++;
    if(str1[4]==str1[5])n++;
    if(n==2){
        printf("Yes");
    }else{
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
N = int(input())
a = [int(x) for x in input().split()]
def dp(N,a):
    F = [0]*(len(a))
    F[0]=0
    F[1]=abs(a[1]-a[0])
    if N == 1: return F[0]
    elif N == 2: return F[1]
    for n in range(2,N):
        F[n] = min(F[n-1] + abs(a[n]-a[n-1]),F[n-2]+abs(a[n]-a[n-2]))
    return F[-1] 
print(dp(N,a))

Measured memory_bytes: 13980
n = int(input())
d = []
for _ in range(n):
    x, l = map(int, input().split())
    d.append([x-l, x+l])

d.sort(key=lambda x: x[1])

c = -float("inf")
ans = 0
for i in range(n):
    if c <= d[i][0]:
        c = d[i][1]
        ans += 1

print(ans)


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

using namespace std;

#define ll long long

ll r[110][100010], v[110], w[110];

main()
{
    ll i, j, k, n, res=0;

    cin>>n>>k;

    for(i=1; i<=n; i++) scanf("%lld %lld", &w[i], &v[i]);
    for(i=1; i<=100000; i++) r[0][i]=1000000000000000000;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=100000; j++)
        {
            if((j-v[i])>=0)
            {
                r[i][j]=min(r[i-1][j-v[i]]+w[i], r[i-1][j]);
            }
            else r[i][j]=r[i-1][j];
        }
    }

    for(i=1; i<=100000; i++) if(r[n][i]<=k) res=i;

    cout<<res;
}


Measured memory_bytes: 80128
Input = gets.chomp

def calc(str,prev)
  	cnt = 0
	str.chars{|c| c.match(/[ATCG]/) ? cnt +=1 : break}
    cnt = [prev, str.length < 1 ? cnt : calc(str.split("").drop(1).join, cnt)].max
end

puts calc(Input,0)

Measured memory_bytes: 1916
N, M = [int(_) for _ in input().split()]
A = [input() for i in range(N)]
B = [input() for i in range(M)]
 
def check(N, M, A, B):
    for i in range(N - M + 1):
        for j in range(N - M + 1):
            if all(a[j:j+M] == b for a, b in zip(A[i:i+M], B)):
                return True
    return False
 
if check(N, M, A, B):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    string s;
    cin >> s;
    int K;
    cin >> K;

    set<string> str_set;
    REP(i, s.size()) {
        FOR(j, 1, 5 + 1) {
            if (i + j - 1 < s.size()) {
                str_set.insert(s.substr(i, j));
            }
        }
    }
    priority_queue<string, vector<string>, greater<string>> q;
    for (string str : str_set) {
        q.push(str);
    }

    string ans;
    LOOP(K) {
        ans = q.top();
        q.pop();
    }

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


Measured memory_bytes: 1920
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;
int main(){
  long long int N;
  scanf("%lld", &N);
  vector<pair<long long int, long long int> > TA(N, pair<long long int, long long int>(0,0));
  for (int i = 0; i < N; i++){
    scanf("%lld%lld", &(TA[i].first), &(TA[i].second));
  }
  long long int nowT = TA[0].first;
  long long int nowA = TA[0].second;
  for (int i = 1; i < N; i++){
    long long int tempT = TA[i].first;
    long long int tempA = TA[i].second;
    while((tempT < nowT) || (tempA < nowA)){
      long long int mul1 = nowT / tempT;
      long long int mul2 = nowA / tempA;
      tempT *= max(mul1, mul2);
      tempA *= max(mul1, mul2);
      if ((tempT < nowT) || (tempA < nowA)){
        tempT += TA[i].first;
        tempA += TA[i].second;
      }
    }
    nowT = tempT;
    nowA = tempA;
    //cerr << nowT << ',' << nowA << endl;
  }
  cout << (nowT+nowA) << endl;
  return 0;
}


Measured memory_bytes: 256
/*
**    Author : Dhiraj Govindvira
**      Date : 12-Sep-2020 ~ Saturday
**      Time : 11:33:53 PM
*/

#ifdef Dhiraj
    #include "D:/dhiraj/Programming/debug.h"
#else
    #include <bits/stdc++.h>
    using namespace std;
    #define d(...) 11
    #define cerr if(0) cerr
#endif

// Macro --------------------------------------------------------------------

#define ll                  long long int
#define FOR(i, a, b, s)     for(ll i = (a); ((s) > 0 ? i < (b) : i > (b)); i += (s))
#define FOR1(b)             FOR(i, 0, b, 1)
#define FOR2(i, b)          FOR(i, 0, b, 1)
#define FOR3(i, a, b)       FOR(i, a, b, (a) <= (b) ? 1 :-1)
#define FOR4(i, a, b, s)    FOR(i, a, b, s)
#define GET5(a, b, c, d, e, ...) e
#define FORC(...)           GET5(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)
#define loop(...)           FORC(__VA_ARGS__)(__VA_ARGS__)
#define all(x)              x.begin(), x.end()
#define rall(x)             x.rbegin(), x.rend()
#define endl                '\n'

// Template -----------------------------------------------------------------

// multiple input
template <typename... T> 
inline void inp(T&... args) {
    ((cin >> args), ...);
}
// scan vector
template <typename T> 
inline istream& operator >>(istream &in, vector<T> &a) {
    for(auto &x : a) in >> x;
    return in;
}
// scan pair
template <typename T, typename U> 
inline istream& operator >>(istream &in, pair<T, U> &a) {
    in >> a.first >> a.second; 
    return in;
}

// Solve --------------------------------------------------------------------

const ll Mod = 1e9 + 7;
inline ll md(ll x, ll M = Mod)
{
    x %= M;
    return ((x < 0) ? (x + M) : x);
}

ll f(vector<ll> a, ll k)
{
    sort(all(a));

    ll l = 0, r = a.size() - 1;
    ll ans = 1;
    if(k & 1)
    {
        ans *= a[r];
        r--, k--;
        if(ans < 0) {
            while(k > 0) {
                ans *= a[r];
                ans = md(ans);
                r--, k--;
            }
            return md(ans);
        }
    }
    while(k > 0)
    {
        ll x = a[l] * a[l + 1];
        ll y = a[r] * a[r - 1];
        if(x > y) {
            ans *= md(x);
            l += 2;
        }
        else {
            ans *= md(y);
            r -= 2;
        }
        ans = md(ans);        
        k -= 2;
    }
    return md(ans);
}

void solve(int &T)
{
    ll n, k;
    cin >> n >> k;
    
    vector<ll> a(n);
    cin >> a;

    cout << f(a, k) << endl;
}

// Main ---------------------------------------------------------------------

int main()
{
    #ifdef Dhiraj
        freopen("D:/dhiraj/Programming/i1.txt", "r", stdin);
        freopen("D:/dhiraj/Programming/o1.txt", "w", stdout);
        // freopen("D:/dhiraj/Programming/e1.txt", "w", stderr);
    #endif

    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    for(int i = 1; i <= t; i++) {
        cerr << "Case #" << i << "\n";
        solve(i);
    }
    return 0;
}

Measured memory_bytes: 6360
#include <bits/stdc++.h>
using namespace std;
int n;
long long sum=0;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)
		if(i%3!=0&&i%5!=0)sum+=i;
	printf("%lld\n",sum);
	return 0;
} 

Measured memory_bytes: 3816