akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}


int N;
int A[222];

string S;
void init() {
#ifdef MYTEST
    N = 99;
    REP (i, N) {
	S.push_back('R');
	S.push_back('B');
    }
    random_shuffle(S.begin(), S.end());
    random_shuffle(S.begin(), S.end());
#endif
}

int cnt;
int query(const VI &v) {
    assert((int)v.size() == N);
    REP (i, v.size()) REP (j, i) assert(v[i] != v[j]);
    REP (i, v.size()) assert(0 <= v[i] && v[i] < N*2);

    printf("?");
    REP (i, v.size()) printf(" %d", v[i] + 1);
    puts("");
    fflush(stdout);

#ifdef MYTEST
    cnt++;
    eprintf("cnt %d\n", cnt);
    int b = 0, r = 0;
    EACH (e, v) {
	if (S[*e] == 'R') r++;
	else b++;
    }
    assert(r + b == N);
    return b > r;
#else
    static char buf[111];
    scanf("%s", buf);
    assert(*buf != '-');
    return *buf == 'B';
#endif
}

int range_query(int s) {
    VI v;
    REP (i, N) v.push_back(s+i);
    return query(v);
}

void MAIN() {
    init();
    memset(A, -1, sizeof A);

    scanf("%d", &N);

    int c = range_query(0);

    // q[0] == c;
    // q[N] == 1-c;
    int lo = 0, hi = N;
    while (hi - lo > 1) {
	int mid = (lo + hi) / 2;
	int d = range_query(mid);
	if (d == c) lo = mid;
	else hi = mid;
    }

    A[lo] = c;
    A[lo+N] = 1 - c;
    VI v;
    for (int i=lo+1; i<lo+1+N; i++) v.push_back(i);

    REP (i, N*2) {
	if (i < lo || lo+N < i) {
	    v.back() = i;
	    A[i] = query(v);
	}
    }

    v.clear();
    REP (i, N*2) if ((int)v.size() < N/2 && A[i] == 0) v.push_back(i);
    REP (i, N*2) if ((int)v.size() < N-1 && A[i] == 1) v.push_back(i);
    v.push_back(-100);

    REP (i, N*2) {
	if (A[i] == -1) {
	    v.back() = i;
	    A[i] = query(v);
	}
    }

    printf("! ");
    REP (i, N*2) printf("%c", "RB"[A[i]]);
    puts("");
    fflush(stdout);
}


int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 724
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n = ni()
a = na()
flag = True
for x in a:
    if x % 2 == 1:
        continue
    if x % 2 == 0:
        if x % 3 == 0 or x % 5 == 0:
            continue
        else:
            flag = False
if flag:
    print('APPROVED')
else:
    print('DENIED')
    

Measured memory_bytes: 38256
#include <cstdlib>
#include <iterator>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cctype>
#include <functional>
#include <cmath>
using namespace std;

#define int long long

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

    int year = 0;
    int money = 100;
    while(true) {
        if(money >= x) {
            cout << year << endl;
            return 0;
        }
        year++;
        money *= 1.01;
    }
}


Measured memory_bytes: 3632
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <iomanip>
#include <algorithm>
#include <sstream>
#include <string>
#include <math.h>
#include <set>
using namespace std;
 
int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	for (int i=0;i<s.length();i++) {
		if (s[i]!=',') cout << s[i];
		else cout << ' ';
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
   int n,c=0; cin>>n;
   int a[n];
   for(int i=1;i<=n;i++) {cin>>a[i];
   if(i&1 && a[i]&1) c++;
   }
   cout<<c<<endl;
}


Measured memory_bytes: 3640
fun main(args: Array<String>) = yorukatsu6D()

fun yorukatsu6D() {
    val (a, b) = readLine()!!.split(' ').map { it.toLong() }

    val answer = primeFactorization(gcd(a, b))
        .map { it.key }.count() + 1

    println(answer)
}

private tailrec fun gcd(a: Long, b: Long): Long {
    return if (b == 0L) a else gcd(b, a % b)
}

private fun primeFactorization(n: Long): Map<Long, Long> {
    val factors = mutableMapOf<Long, Long>()
    var temp = n
    var i = 2L
    while (i * i <= temp) {
        while (temp % i == 0L) {
            factors[i] = (factors[i] ?: 0) + 1
            temp /= i
        }
        i++
    }
    if (temp > 1) factors[temp] = 1
    return factors
}


Measured memory_bytes: 38340
#include <stdio.h>

int main() {
    int h[10];
    int temp;
    int flag;
    int i = 0;
    for ( i = 0; i < 10; i++) {
        scanf("%d",&h[i]);

    }
    for ( i = 0; i < 10; i++) {
        flag = 0;
        for (int j = 0; j < 10; j++) {
            if (h[j] >= h[j + 1]) {
                temp = h[j];
                h[j] = h[j + 1];
                h[j + 1] = temp;
                flag = 1;
            }

        }
        if (flag == 0) {
            break;
        }
    }
    printf("%d\n%d\n%d\n", h[9], h[8], h[7]);
    return 0;
}

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

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

	vector<int> l(n), r(n);

	int ans = 0;

	for (int i = 0; i < n; i++) {
		cin >> l[i] >> r[i];
		ans += r[i] - l[i] + 1;
	}
	
	cout << ans << endl;
	return 0;
}


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

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define ALL(v) ((v).begin(),(v).end())
#define COUT(x) cout<<(x)<<"\n"


int main(){
    long double a,b,h,m;
    cin >> a >> b >> h >> m;
    if(h>=12) h-=12;
    long double shortime = h*30+(30/60.0)*m;
    long double longtime = 6*m;
    long double time = abs(longtime-shortime);
    long double kakudo = min(360-time,time);
    long double ans = sqrt(a*a+b*b-2*a*b*cos(kakudo*M_PI/180));
    cout << fixed << setprecision(20) << ans << endl;
    return 0;
}

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

const int N = 100010;

std::vector <int> e[N];
int n;

int dfs(int u, int fa){
	int cnt = 0;
	for (auto v : e[u]){
		if (v == fa){
			continue;
		}
		if (dfs(v, u)){
			++ cnt;
		}
	}
	if (cnt >= 2){
		printf("First\n");
		exit(0);
	}
	return !cnt;
}

int main(){
	scanf("%d", &n);
	for (int i = 0, u, v; i < n - 1; ++ i){
		scanf("%d%d", &u, &v);
		e[u].push_back(v);
		e[v].push_back(u);
	}
	return printf(dfs(1, 0) ? "First\n" : "Second\n"), 0;
}

Measured memory_bytes: 5888
#include <stdio.h>
int main (void) {
  int a, b, i;

  while ( scanf("%d %d", &a, &b) != EOF ) {
    int digits = 1, sum;
    for (sum = a+b; sum >= 10; sum /= 10) {
      digits++;
    }
    printf("%d\n", digits);
  }
  return 0;
}

Measured memory_bytes: 596
import java.util.*;
import java.math.RoundingMode;
import java.math.BigDecimal;
 
 
 
public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b= sc.next();
		String s = a+b;
		int val = Integer.parseInt(s);
		if((int)Math.sqrt(val)*(int)Math.sqrt(val)==val) {
			System.out.println("Yes");
		}
		else System.out.println("No");
	 }
}

Measured memory_bytes: 20688
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = System.Console.ReadLine().Trim().Split(' ');
            int iA = int.Parse(sS[0]);
            int iB = int.Parse(sS[1]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            int iS = iA * iB / 2;

            // 出力
            System.Console.WriteLine("{0}", iS.ToString());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include <iostream>
#include <fstream>
#include <cstdio>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <string.h>
#include <string>
#include <math.h>
#include <iomanip>
using namespace std;

#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define pb push_back

typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

const int mod = (int)1e9 + 7;
const int mod2 = 998244353;

ll exp(ll taban, ll us, ll md) {
    ll carpan = taban % md;
	if(carpan == 0) return 0;
    ll temp = us;
    ll res = 1;
    while(temp){
        if(temp % 2) res = (res*carpan) % md;
        temp /= 2;
        carpan = (carpan*carpan) % md;
    }
    return res;
}
 
ll ebob(ll a, ll b){
    if(!a)return b;
    return ebob(b%a, a);
}

ll ekok(ll a, ll b){
    return (a*b)/ebob(a, b);
}

ll mul(ll a, ll b, ll md){
	return a*b % md;
}

vector<ll> fact;
vector<ll> inv_fact;
void fact_init(int n){
	fact.resize(n+5);
	inv_fact.resize(n+5);
	fact[0] = inv_fact[0] = 1;
	for(int i = 1; i <= n; i++){
		fact[i] = (fact[i-1] * i) % mod;
		inv_fact[i] = exp(fact[i], mod-2, mod);
	}
}

ll komb(ll a, ll b){
	if(a < b) return 0;
	return fact[a] * (inv_fact[a-b] * inv_fact[b] % mod) % mod;
}


const int N = 2e5+5;

int main(){
	ios::sync_with_stdio(false); cin.tie(NULL);
	string s, t; cin>>s>>t;
	int n = s.size(), m = t.size();
	
	if(n < m){
		cout<<"UNRESTORABLE\n";
		return 0;
	}
	int target = -1;
	string ans;
	for(int i = n-m; i >= 0; i--){
		bool check = true;
		for(int j = i; j < i+m; j++){
			if(s[j] == '?' || (s[j] == t[j - i])){
			}else check = false;
		}
		if(check){
			string tmp;
			for(int j = 0; j < i; j++){
				tmp += (s[j] == '?' ? 'a' : s[j]);
			}
			tmp += t;
			for(int j = i+m; j < n; j++){
				tmp += (s[j] == '?' ? 'a' : s[j]);
			}
			ans.empty() ? ans = tmp : ans = min(ans, tmp);
		}
	}
	if(ans.empty()){
		cout<<"UNRESTORABLE\n";
		return 0;
	}
	cout<<ans<<"\n";
}

Measured memory_bytes: 256
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[]
    n=int(input())
    for i in range(n):
        s,p=input().split()
        l1=[s,-int(p),i+1]
        l.append(l1)
    from operator import itemgetter
    l2=sorted(l,key=itemgetter(0,1))
    for s,p,i in l2:
        print(i)
resolve()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
 
int main(void) {
  int a,b;
  cin >> a >> b;

  if(a==1&&b==2){cout << 3 << endl;}
  if(a==1&&b==3){cout << 2 << endl;}
  if(a==2&&b==1){cout << 3 << endl;}
  if(a==2&&b==3){cout << 1 << endl;}
  if(a==3&&b==1){cout << 2 << endl;}
  if(a==3&&b==2){cout << 1 << endl;}
  
  return 0;
}

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

int n, cnt;
string s;
int main() {
	cin >> n >> s;
	for(int i=0; i<n; i++) s[i]=='R' ? cnt++ : cnt--;
	cout << (cnt>0 ? "Yes" : "No");
	return 0;
}

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



int main(){
    int n;
    cin>>n;
    //仕事にかかるじかん
    vector<int>a(n);
    //締め切り
    vector<int>b(n);
    for(int i=0;i<n;i++) cin>>a[i]>>b[i];
    //仕事の終了時間,かかる時間
    vector<pair<int,int> >pair;
    for(int i=0;i<n;i++) pair.push_back(make_pair(b[i],a[i]));
    bool ans=true;
    int count=0;
    sort(pair.begin(),pair.end());

    for(int i=0;i<n;i++){
        count+=pair[i].second;
        if(count>pair[i].first) ans=false;
    }
    

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




}

Measured memory_bytes: 3956
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
	ll h,n;
	cin>>h>>n;
	vector< pair<ll,ll> > vec;
	for(ll i=0;i<n;i++){
		pair<ll,ll> p;
		cin>>p.first>>p.second;
		vec.push_back(p);
	}
	
	vector<ll> dp(h+1,1e18+5),mark(h+1,0);
	dp[h]=0;
	mark[h]=1;
	for(ll i=h;i>=1;i--){
		for(ll j=0;j<n;j++){
			if(mark[i]==1){
				pair<ll,ll> p=vec[j];
				dp[max((ll)0,i-p.first)]=min(dp[max((ll)0,i-p.first)],dp[i]+p.second);
				mark[max((ll)0,i-p.first)]=1;
			}
		}
	}
	
	cout<<dp[0]<<endl;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);
	
	public static void main(String[] args) {
		Main m = new Main();
		m.run();
	}
	
	void run() {
		int n = sc.nextInt();
		int q = sc.nextInt();

		char[] s = sc.next().toCharArray();
		char[] qt = new char[q];
		boolean[] ql = new boolean[q];

		for(int i = 0 ; i < q; i++) {
			qt[i] = sc.next().charAt(0);
			ql[i] = sc.next().charAt(0) == 'L'; 
		}
		int l = remLeft(s,qt,ql);
		int r = remRight(s,qt,ql);
		System.out.println(Math.max(0,r-l));
	}
	
	
	int remLeft(char[] s, char[]qt, boolean[] ql) {
		int l = 0;
		int r = s.length;
		for(;l!=r;) {
			int mid  = (l+r)/2;
			if(remL(s,qt,ql,mid)) {
				l = mid+1;
			}else {
				r = mid;
			}
		}
		return l;
	}

	int remRight(char[] s, char[]qt, boolean[] ql) {
		int l = 0;
		int r = s.length;
		for(;l!=r;) {
			int mid  = (l+r)/2;
			if(!remR(s,qt,ql,mid)) {
				l = mid+1;
			}else {
				r = mid;
			}
		}
		return l;
	}
	
	boolean remR(char[] s, char[] qt, boolean[] ql,int pos) {
		for(int i = 0; i < qt.length; i++) {
			if(pos == s.length) {
				return true;
			}
			if(s[pos] == qt[i]) {
				if(ql[i]) {
					pos--;
					pos = Math.max(0, pos);
				}else {
					pos++;
				}
			}
			
		}
		
		return pos == s.length;
				
	}

	boolean remL(char[] s, char[] qt, boolean[] ql,int pos) {
		for(int i = 0; i < qt.length; i++) {
			if(pos == -1) {
				return true;
			}
			if(s[pos] == qt[i]) {
				if(ql[i]) {
					pos--;
				}else {
					pos++;
					pos = Math.min(pos, s.length-1);
				}
			}
			
		}
		
		return pos == -1;
				
	}

}

Measured memory_bytes: 65732
n = int(input())
a = list(map(int, input().split()))
m = n//2

a.sort()
if a[0] >= 0:
    minus = [a[0]]
    plus = a[1:n]
elif a[n-1] <= 0:
    minus = a[0:n-1]
    plus = [a[n-1]]
else:
    for i in range(n):
        if a[i] > 0:
            point = i
            break
    minus = a[0:point]
    plus = a[point:n]
print(sum(plus)-sum(minus))
for i in range(n-1):
    mi = minus.pop(0)
    pl = plus.pop(0)
    if len(minus) >= len(plus):
        print(str(pl) +' '+str(mi))
        plus.append(pl-mi)
    else:
        minus.append(mi-pl)
        print(str(mi) +' '+str(pl))

Measured memory_bytes: 14144
/**
*    created: 14.05.2020 10:23:53
**/
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using namespace std;

signed main() {

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

    int a, b, t;
    cin >> a >> b >> t;
    int num = (2 * t + 1) / (2*a);
    cout << b * num << endl;
    return 0;
}

Measured memory_bytes: 3668
#include <stdio.h>

int main () {
	int N;
	int A[100000];
	scanf ("%d", &N);
	scanf ("%d", A);
	for (int i=1; i<N; i++) {
		int tmp;
		scanf ("%d", &tmp);
		A[i] = A[i-1] + (-2*(i%2)+1) * tmp;
	}
	int x = A[N-1]/2;
	printf ("%d ", 2*x);
	for (int i=1; i<N; i++)
		printf ("%d ", 2*(2*(i%2)-1)*(A[i-1]-x));
	printf ("\n");

	return 0;
}

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

int main(){
  int N; long long K; cin >> N >> K;
  vector<pair<int,int>> p;
  for(int i=0; i<N; i++){
    int a,b; cin >> a >> b;
    p.push_back(make_pair(a,b));
  }
  sort(p.begin(),p.end());
  for(int i=0; i<N; i++){
    if(K>p[i].second){
      K-=p[i].second;
    }else{
      cout << p[i].first << endl;
      return 0;
    }
  }
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
const int maxn=1050;
int m,n,a[maxn],b[maxn][maxn],k;

int main(){
    cin >> n;
    if (n%2==1) k=n; else k=n+1;
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
            if (i+j!=k) m++,b[i][j]=1;
    cout << m << endl;
    for (int i=1;i<=n;i++)
        for (int j=i+1;j<=n;j++)
            if (b[i][j]) cout << i << ' ' << j << endl;
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;
using System.Text;
using System.IO;
using static System.Math;
namespace AtCoder
{
    class Program
    {
        static public long[] Sarray() { return ReadLine().Split().Select(long.Parse).ToArray(); }
        static public List<long> Slist() { return ReadLine().Split().Select(long.Parse).ToList(); }
        static long Mod = (long)1e9 + 7;
        static void Main(string[] args)
        {
            SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
            var HW = Sarray();
            var H = HW[0];
            var W = HW[1];
            var Aij = Enumerable.Range(0, (int)H).Select(_ => new long[(int)W]).ToArray();
            for (var i = 0; i < H; ++i)
                Aij[i] = Sarray();
            var oddflg = false;
            Func<long, bool> InH = (h) =>
               {
                   if (0 <= h && h < H) return true;
                   return false;
               };
            Func<long, bool> InW = (w) =>
                {
                    if (0 <= w && w < W) return true;
                    return false;
                };
            var ans = new List<string>();
            for (var h = 0L; h < H; ++h)
            {
                for (var w = 0L; w < W; ++w)
                {
                    var tw = w;
                    var nw = tw + 1;
                    var nh = h;
                    if (h % 2 != 0)
                    {
                        tw = W - 1 - w;
                        nw = tw - 1;
                    }
                    if (Aij[h][tw] % 2 == 1) oddflg = !oddflg;
                    if (!InW(nw)) { ++nh; nw = tw; }
                    if (!InH(nh)) continue;
                    if (oddflg)
                        ans.Add($"{h + 1} {tw + 1} {nh + 1} {nw + 1}");
                }
            }
            WriteLine(ans.Count);
            foreach (var a in ans)
                WriteLine(a);
            Out.Flush();
        }
    }
}

Measured memory_bytes: 34844
#include <bits/stdc++.h>
using namespace std;
int main() {
  string a;
  cin>>a;
  int64_t n;
  cin>>n;
  int s=a.size();
  if(a==string(s,a[0])){
    cout<<s*n/2<<endl;
  }
  else{
    int ans1 = 0;
    for (int i = 0; i + 1 < s; i++) {
      if (a[i % s] == a[(i + 1) % s]) {
        ++ans1;
        ++i;
      }
    }
    int ans2 = 0;
    for (int i = 0; i + 1 < 2 * s; i++) {
      if (a[i % s] == a[(i + 1) % s]) {
        ++ans2;
        ++i;
      }
    }
    cout << ans1 + (ans2 - ans1) * (n - 1) << '\n';
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));



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

	string N,H,K;
	cin >> N>>H>>K;
	
	N[0] -= 32;
	H[0] -= 32;
	K[0] -= 32;

	cout << N[0] << H[0] << K[0] << endl;
	return 0;
}



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

void fnInput(llong& rnCoordx, llong& rnTimes, llong& rnMovmnt)
{
  cin >> rnCoordx >> rnTimes >> rnMovmnt;
}
  
llong fnMinCoordx(llong nCoordx, llong nTimes, llong nMovmnt)
{
  llong nQuotent  = abs(nCoordx) / nMovmnt;
  llong nRemain   = abs(nCoordx) % nMovmnt;

  if (nQuotent <= nTimes)
    if (nQuotent % 2 == nTimes % 2)
      return nRemain;
    else
      return abs(nRemain - nMovmnt);
  else
    return abs(nCoordx) - nTimes * nMovmnt;
}
  
int main()
{
  llong nCoordx, nTimes, nMovmnt;

  fnInput(nCoordx, nTimes, nMovmnt);
  cout << fnMinCoordx(nCoordx, nTimes, nMovmnt) << endl;

  return 0;
}

Measured memory_bytes: 3616
N, A, B = list(map(int, input().split()))
S = input()
ans = [False for i in range(N)]
a_sum, b_sum = 0, 0
for i, S_i in enumerate(S):
    if S_i == 'a' and a_sum+b_sum < A+B:
        a_sum += 1
        ans[i] = True
    elif S_i == 'b' and a_sum+b_sum < A+B and b_sum < B:
        b_sum += 1
        ans[i] = True

for ans_i in ans:
    if ans_i:
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 4784
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
#define foreach(it,s) for(__typeof((s).begin()) it=(s).begin();it!=(s).end();it++)
typedef long long ll;
const int Imx=2147483647;
const ll Lbig=2e18;
const int mod=1e9+7;
//My i/o stream
struct fastio
{
	char s[100000];
	int it,len;
	fastio(){it=len=0;}
	inline char get()
	{
		if(it<len)return s[it++];it=0;
		len=fread(s,1,100000,stdin);
		if(len==0)return EOF;else return s[it++];
	}
	bool notend()
	{
		char c=get();
		while(c==' '||c=='\n')c=get();
		if(it>0)it--;
		return c!=EOF;
	}
}_buff;
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putchar(' ')
#define putii(x,y) puti(x),puti(y)
#define putiii(x,y,z) putii(x,y),puti(z)
#define putsi(x) putnum(x),putchar('\n')
#define putsii(x,y) puti(x),putsi(y)
#define putsiii(x,y,z) putii(x,y),putsi(z)
inline ll getnum()
{
	ll r=0;bool ng=0;char c;c=_buff.get();
	while(c!='-'&&(c<'0'||c>'9'))c=_buff.get();
	if(c=='-')ng=1,c=_buff.get();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=_buff.get();
	return ng?-r:r;
}
template<class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline char getreal(){char c=_buff.get();while(c==' '||c=='\n')c=_buff.get();return c;}
int n,a[100111];
int main()
{
	geti(n);
	for(int i=1;i<=n;i++)geti(a[i]);
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	int it=1;
	while(it<n&&a[it+1]>=it+1)it++;
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]!=a[i+1])
		{
			if(i==it||a[i]==it)
			{
				ans|=abs(i-a[i])&1;
			}
		}
	}
	if(ans)puts("First");
	else puts("Second");
	return 0;
}


Measured memory_bytes: 768
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let n: usize = input();
    let a: Vec<f64> = (0..n).map(|_| input()).collect();

    let mut ans = 0.0;
    for i in 0..n {
        ans += 1.0 / a[i];
    }
    println!("{}", 1.0 / ans);
}


Measured memory_bytes: 4352
#include <stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
int main() {
	int N, Y,i,j;
	cin >> N;
	cin >> Y;
	for ( i = 0; i <= N; i++) {
		for ( j = 0; j+i <= N; j++) {
			if (Y - (10000 * i) - (5000 * j) - (1000 * (N - i - j)) == 0) {
				if (i+j+(N-i-j)==N) {
					cout << i << " " << j << " " << (N - i - j) << endl;
					return 0;
				}
			}
		}
	}
	cout << "-1 -1 -1" << endl;
	return 0;
}

Measured memory_bytes: 3560
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <queue>
#include <cmath>
#include <set>

using namespace std;

typedef long long ll;

const int MAX_N = (1 << 17);

int bit[MAX_N+1], n;

int sum(int i){
  int s = 0;
  while(i > 0){
    s += bit[i];
    i -= i & -i;
  }
  return s;
}

void add(int i, int x){
  while(i <= n){
    bit[i] = bit[i] + x;
    i = i + (i & -i);
  }
}

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int _n, q; cin >> _n >> q;
  //initialize
  n=1;
  while(n < _n){
    n = n*2;
  }
  for(int i=1;i<=n;i++){
    bit[i]=0;
  }
  for(int i=0;i<q;i++){
    int com, x, y;
    cin >> com >> x >> y;
    if(com == 0){
      add(x, y);
    }else{
      if(x == 1) cout << sum(y) << endl;
      else cout << sum(y) - sum(x-1) << endl;
    }
  }
}


Measured memory_bytes: 3648
from collections import deque
k = int(input())

Q = deque([i for i in range(1, 10)])    #Queue
for i in range(k):
    inum = Q[0] #important number
    op = inum % 10  #one place
    Q.popleft()
    for j in [-1, 0, 1]:
        if 0 <= op+j and op+j <= 9:
            Q.append(inum*10+(op+j))
        else:
            pass

ans = inum
print(ans)

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

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	char c;
	cin >> c;
	cout << (((int) c - 'a' < 0) ? 'A' : 'a') << "\n";	
	return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int> dp(100010, 1e9);
  vector<int> d;
  d.push_back(1);
  for(int i = 6; i <= n; i *= 6) d.push_back(i);
  for(int i = 9; i <= n; i *= 9) d.push_back(i);
  dp[0] = 0;
  for(int i = 0; i < d.size(); i++){
    for(int j = 0; j <= n; j++){
      if(j + d[i] > n) break;
      dp[j + d[i]] = min(dp[j + d[i]], dp[j] + 1);
    }
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 640
#include <stdio.h>

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

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

/*a,b,cの値が確定*/

if(a>b){
    d=a;
    a=b;
    b=d;
    d=0;
    if(b>c){
        d=b;
        b=c;
        c=d;
        d=0;
        if(a>b){
            d=a;
            a=b;
            b=d;
            printf("%d %d %d\n",a,b,c);
            }
            else{
                printf("%d %d %d\n",a,b,c);
                }
            }
    else{
        printf("%d %d %d\n",a,b,c);
        }
    } 
else{
    if(b>c){
        d=b;
        b=c;
        c=d;
        d=0;
        if(a>b){    
            d=a;
            a=b;
            b=d;
            d=0;
            printf("%d %d %d\n",a,b,c);
            }
        else{
            printf("%d %d %d\n",a,b,c);
            }
    }
else{
    printf("%d %d %d\n",a,b,c);
    }
    }
}


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

int main()
{
  int n, ans = 0;
  cin >> n;
  int l[n];
  
  for (int i = 0; i < n; i++){
      cin >> l[i];
  }
  for (int i = 0; i < n - 2; i++){
      int a = l[i];
      for (int j = i + 1; j < n; j++){
  		 int b = l[j];
         for (int k = j + 1; k < n; k++){
  		    int c = l[k];
           	if (a - b == 0 || a - c == 0 || b - c == 0) {
            }else{
              	if (a > b && a > c && b + c > a) ans++; 
                if (b > a && b > c && a + c > b) ans++;
                if (c > a && c > b && a + b > c) ans++;
            }
         } 
      }
  }
  cout << ans << endl;

  return 0;
} 


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-
#ARC075C
import sys

n=int(input())

#tmp = input().split()
#hoge = list(map(lambda a: int(a), tmp))

s=[]
sum=0
for i in range(0,n):
	tmp=int(input())
	s.append(tmp)
	sum+=tmp
s.sort()

#print(sum)
#print(s)

if(sum%10!=0):
	print(sum)
	sys.exit()
for i in range(0,n):
	if((sum-s[i])%10!=0):
		print(sum-s[i])
		sys.exit()
print(0)


Measured memory_bytes: 3064
// https://atcoder.jp/contests/dp/tasks/dp_d
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <limits>
using namespace std;

#define FOR(i, n) for (int i = 0; i < n; i++)
#define EACH(i, n) for (auto &i: n)

int main() {
  int n, w;

  cin >> n >> w;

  vector<long long> ww(n), v(n);
  FOR(i, n) {
    cin >> ww[i] >> v[i];
  }

  vector<vector<long long> > dp(n + 1, vector<long long>(w + 1, 0));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= w; j++) {
      if (j >= ww[i]) {
        dp[i + 1][j] = max(dp[i][j - ww[i]] + v[i], dp[i][j]);
      } else {
        dp[i + 1][j] = dp[i][j];
      }
    }
  }

  cout << *max_element(dp[n].begin(), dp[n].end()) << endl;

  return 0;
}


Measured memory_bytes: 80256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cstring>
#include <utility>
#include <numeric>

using namespace std;

int main(){

    int N, K;
    cin >> N >> K;
    int ans = 0;
    while(N > 0){
        ans++;
        N /= K;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int main(void) {
	int i;
	char buf[128], *ch;

	fgets(buf, sizeof(buf), stdin);
	ch = strtok(buf, " ");
	i = atoi(ch);

	if(i < 1200) {
		printf("ABC\n");
	} else {
		printf("ARC\n");
	}

	return 0;
}


Measured memory_bytes: 2008
import math
n, h = map(int, input().split())
list_a = []
list_b = []
for i in range(n):
  a, b = list(map(int, input().split()))
  list_a.append(a)
  list_b.append(b)
max_a = max(list_a)
use_b = [b for b in list_b if b > max_a]
use_b.sort(reverse=True)

count = 0
while h > 0:
  if len(use_b) > 0:
    h -= use_b.pop(0)
    count += 1
  else:
    count += math.ceil(h / max_a)
    break
print(count)

Measured memory_bytes: 12104
#include <bits/stdc++.h>
using namespace std;
using vi = vector<int>;
using ll = long long;
using ull = unsigned long long;

int main(int argc, char* argv[]) {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);

  /* */
  int a[3];
  cin >> a[0] >> a[1] >> a[2];
  sort(a, a + 3);
  printf("%s\n", a[0] + a[1] == a[2] ? "Yes" : "No");
  /* */

  return EXIT_SUCCESS;
}


Measured memory_bytes: 256
local mce, mfl, msq, mmi, mma = math.ceil, math.floor, math.sqrt, math.min, math.max
local n = io.read("*n")
local t = {}
for i = 1, n do
  t[i] = {}
  t[i].x, t[i].y = io.read("*n", "*n")
end
table.sort(t, function(v, w)
  if v.x == w.x then
    return v.y < w.y
  else
    return v.x < w.x
  end
end
)
-- for i = 1, n do print(t[i].x, t[i].y) end

local function getcost(p, q)
  local cost = 0
  if p == 0 then
    local done = 0
    local donelist = {}
    for i = 1, n do donelist[i] = false end
    while done < n do
      cost = cost + 1
      local idx = 1
      for i = 1, n do
        if not donelist[i] then idx = i break end
      end
      donelist[idx] = true
      done = done + 1
      local nx, ny = t[idx].x, t[idx].y + q
      local rep = true
      while rep do
        rep = false
        for i = 1, n do
          if nx == t[i].x and ny == t[i].y and not donelist[i] then
            ny = ny + q
            donelist[i] = true
            done = done + 1
            rep = true
          end
        end
      end
    end
  else
    local done = 0
    local donelist = {}
    for i = 1, n do donelist[i] = false end
    while done < n do
      cost = cost + 1
      local idx = 1
      for i = 1, n do
        if not donelist[i] then idx = i break end
      end
      donelist[idx] = true
      done = done + 1
      local nx, ny = t[idx].x + p, t[idx].y + q
      local rep = true
      while rep do
        rep = false
        for i = 1, n do
          if nx == t[i].x and ny == t[i].y then
            nx, ny = nx + p, ny + q
            donelist[i] = true
            done = done + 1
            rep = true
          end
        end
      end
    end
  end
  return cost
end

local ret = 50
for i = 1, n - 1 do
  for j = i + 1, n do
    local c = getcost(t[j].x - t[i].x, t[j].y - t[i].y)
    -- print(i, j, c)
    ret = mmi(ret, c)
  end
end
if(n == 1) then print(1) else print(ret) end


Measured memory_bytes: 760
#include <bits/stdc++.h>
#define base 1000000007LL
#define ll long long
#define X first
#define Y second
#define pb push_back
#define MAXN 21010
#define Scan(a) scanf("%I64d", &a)
#define CLR(a) memset(a,0,sizeof(a))
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORE(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)

using namespace std;

typedef pair<int, int> II;
typedef vector<II> vi;

int n, m, nt[1010], prime[1010], f[1010];

int main()
{
    ios::sync_with_stdio(0);
    //freopen("inp.txt", "r", stdin);
    //freopen("out.txt", "w", stdout);
    FOR(i,2,1000)
        if (nt[i] == 0) {
            nt[i] = 1;
            prime[++m] = i;
            for (int j = i*i; j <= 1000; j += i) nt[j] = -1;
        }
    cin >> n;
    FOR(i,2,n) {
        int h = i;
        FOR(j,1,m)
            while (h % prime[j] == 0) {
                f[j]++;
                h /= prime[j];
            }
    }
    ll res = 1;
    FOR(i,1,m) res = res * (f[i]+1) % base;
    cout << res;
    return 0;
}


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

int main()
{
    int A, B;
    cin >> A >> B;
    if(B == 1) cout << 0 << endl;
    else cout << (((B-1)%(A-1) != 0) ? (B-1)/(A-1)+1 : (B-1)/(A-1) ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int top, S[1000];

void push(int x) {
    S[++top] = x;
}

int pop() {
    top--;
    return S[top + 1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];
    while (scanf("%s", s) != EOF) {
        if (s[0] == '+') {
            a = pop();
            b = pop();
            push(a + b);
        } else if (s[0] == '-') {
            b = pop();
            a = pop();
            push(a - b);
        } else if (s[0] == '*') {
            a = pop();
            b = pop();
            push(a * b);
        } else {
            push(atoi(s));
        }
    }

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

    return 0;
}


Measured memory_bytes: 2764
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i,a,b) for(ll i=a;i<b;i++)
#define pb push_back
#define mp make_pair

int main()
{
	ll n; cin >> n;
	ll arr[n]; forn(i,0,n) cin >> arr[i];
	ll count = 0;

	forn(i,0,n)
	{
		ll a = arr[i];
		forn(j,i+1,n)
		{
			ll b = arr[j];
			forn(k,j+1,n)
			{
				ll c = arr[k];

				if((a==b) || (b == c) || (a ==c))
					continue;
				if( ((a+b) > c) && ((b+c) > a) && ((a+c)>b) )
					count++;
			}
		}
	}

	cout << count << endl;
}

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

int main( void ) {
    int t;
    cin >> t;
    int h = t / 3600;
    int m = (t - h *3600)/60;
    int s = t - h *3600-m*60;
    cout << h << ":" << m << ":" << s << endl;
}



Measured memory_bytes: 3072
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
#define rep(i, n) for(ll i = 0;i < n;i++)
#define all(i) i.begin(), i.end()
template<class T, class U> bool cmax(T& a, U b) { if (a<b) {a = b; return true;} else return false; }
template<class T, class U> bool cmin(T& a, U b) { if (a>b) {a = b; return true;} else return false; }

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

  ll h, w;
  cin >> h >> w;
  vector<string> s(h);
  rep(i, h) {
    cin >> s[i];
  }

  using pll = pair<ll, ll>;
  const vl dy = {0, 0, 1, -1};
  const vl dx = {1, -1, 0, 0};

  ll ans = 0;
  rep(i, h) rep(j, w) if (s[i][j] == '.') {
    vector<vl> dis(h, vl(w, -1));
    queue<pll> q;
    q.emplace(i, j);
    dis[i][j] = 0;
    while (q.size()) {
      ll y, x;
      tie(y, x) = q.front();
      q.pop();

      rep(d, 4) {
        ll ny = y + dy[d];
        ll nx = x + dx[d];

        if (0 <= ny and ny < h and 0 <= nx and nx < w and s[ny][nx] == '.' and dis[ny][nx] == -1) {
          q.emplace(ny, nx);
          dis[ny][nx] = dis[y][x]+1;
          cmax(ans, dis[ny][nx]);
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cmath>
int main() {
    double r;
    std::cin >> r;
    std::cout << std::setprecision(10) << std::fixed << r * r * M_PI << " " << 2 * r * M_PI << std::endl;
}


Measured memory_bytes: 3256
//  Created by conan1024hao in 2019.
//  Copyright © 2019 conan1024hao. All rights reserved.
//  専用ライブラリです、自由にコピーして構いません。
//  感谢看我的代码！Wechat:conan1024hao QQ:810396815
#pragma GCC optimize ("O3")
#include <iostream>
#include <iomanip>
#include <istream>
#include <ostream>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <string>
#include <ctime>
#include <cctype>
#include <cstdlib>
#define INF 10e16
#define MOD 1000000007
#define  mod 998244353
#define rep(i, a, n) for (ll i = a; i < (ll)(n); i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define mmax(x,y)(x>y?x:y)
#define mmin(x,y)(x<y?x:y)
#define chmax(x,y) x=mmax(x,y)
#define chmin(x,y) x=mmin(x,y)
#define all(x) (x).begin(),(x).end()
#define siz(x) (ll)(x).size()
#define PI acos(-1.0)
using namespace std;
//using Int=int_fast64_t;
typedef long long int ll;
typedef pair<ll,ll>Pll;
typedef pair<int,int>Pin;
long long GCD(long long a, long long b) { return b ? GCD(b, a%b) : a; }
long long LCM(long long a, long long b)  {return a/GCD(a,b)*b;}
int dx[8]={-1,0,1,0};
int dy[8]={0,-1,0,1};
char dir[4]={'u','l','d','r'};
ll cmp1(pair<ll,string>a,pair<ll,string> b){
        if(a.fi!=b.fi)
        return a.fi<b.fi;
        else
        return a.se<b.se;
}
//--------------------------------------------------------------------------

//---------------------------------------------------------------------------
int main(){//問題をちゃんと見ろ!!!!!!!!!!!!!!!!!      llか??????????        memset()!!!!!!!!!!!!       ペナを減らせ!!!!!!!!!!!!!
    cin.tie(0);
    ios::sync_with_stdio(false);
    //-------------------------------
    int a,b;cin>>a>>b;
    if(b>=a)
        cout<<a<<endl;
    else
        cout<<a-1<<endl;
    //-------------------------------
    return 0;
}
//---------------------------------------------------------------------------






Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
#include <algorithm> 
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i,n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repR(i,n) for(ll i=n;i>=0;i--)
#define all(v)(v).begin(),(v).end()
#define rall(v)(v).rbegin(),(v).rend()
#define F first
#define S second
#define pb push_back
#define pu push
#define COUT(x) cout<<(x)<<"\n"
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,vector<ll>,greater<ll>>
#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define mp make_pair
#define sz(x) (ll)(x).size()
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll MOD = 1000000007LL;
const ll INF = 1LL << 60;
using vll = vector<ll>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvll = vector<vll>;
using vstr = vector<string>;
using vc = vector<char>;
using vvc = vector<vc>;
template<class T> inline bool chmax(T& a, T b) { 
 if (a < b) { a = b; return true; } return false; 
}
template<class T> inline bool chmin(T& a, T b) {
 if (a > b) { a = b; return true; } return false; 
}
constexpr ll TEN(int n) { return (n == 0) ? 1 : 10 * TEN(n - 1); }
ll dx[4]={0,1,0,-1};
ll dy[4]={1,0,-1,0};
int main(){
  ll H,W,m;
  cin>>H>>W>>m;
  vll h(m),w(m);
  map<ll,ll> x,y;
  rep(i,m){
    cin>>h[i]>>w[i];
    x[h[i]]++;
    y[w[i]]++;
  }
  ll mx=0;
  ll my=0;
  for(auto p:x){
     chmax(mx,p.S);
  }
  for(auto p:y){
     chmax(my,p.S);
  }
  set<ll> xx;
  set<ll> yy;
  for(auto p:x){
    if(p.S==mx) xx.insert(p.F);
  }
  for(auto p:y){
    if(p.S==my) yy.insert(p.F);
  }
  ll com=sz(xx)*sz(yy);
  ll cu=0;
  rep(i,m){
    if(xx.count(h[i])&&yy.count(w[i])){
      cu++;
    }
  }
  if(com==cu){
    COUT(mx+my-1);
  }
  else{
    COUT(mx+my);
  }
}

Measured memory_bytes: 73360
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
#define N 5005
int n, m;
LL s1[N], ans, f[N];
int a[N][205], lg[N], mx[205][N][20];
inline int read()
{
	int x = 0, f = 1; char c = getchar();
	while (c < '0' || c>'9') { if (c == '-')f = -1; c = getchar(); }
	while (c >= '0' && c <= '9') { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(); }
	return x * f;
}
inline int Max(int i, int l, int r)
{
	int l1 = lg[r - l + 1];
	return max(mx[i][l][l1], mx[i][r - (1 << l1) + 1][l1]);
}
inline void dfs(int l, int r, int L, int R)
{
	if (l > r)
		return;
	int mid = (l + r) / 2, x1;
	for (int i = L; i <= min(mid, R); i++)
	{
		LL ml = s1[i] - s1[mid];
		for (int j = 1; j <= m; j++)
			ml += Max(j, i, mid);
		if (ml > f[mid])
			f[mid] = ml, x1 = i;
	}
	dfs(l, mid - 1, L, x1);
	dfs(mid + 1, r, x1, R);
}
int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 2; i <= n; i++)
		scanf("%lld", &s1[i]), s1[i] += s1[i - 1], lg[i] = lg[i >> 1] + 1;
	for (int i = 1; i <= n; i++)
		for (int j = 1; j <= m; j++)
			mx[j][i][0] = read();
	for (int i = 1; i <= m; i++)
		for (int k = 1; k < 20; k++)
			for (int j = 1; j + (1 << (k - 1)) <= n; j++)
				mx[i][j][k] = max(mx[i][j][k - 1], mx[i][j + (1 << (k - 1))][k - 1]);
	dfs(1, n, 1, n);
	for (int i = 1; i <= n; i++)
		ans = max(ans, f[i]);
	printf("%lld\n", ans);
}


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

#define PI 3.1415926535897932
#define MOD 1000000007
#define INF 1e9

#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define ALL(v) (v).begin(), (v).end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO  cout << "NO"  << endl
#define No  cout << "No"  << endl

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef vector<bool> vb;


void solve()
{
    int N; cin >> N;
    vi W(N); REP(i, N) cin >> W[i];
    vi sum(N+1); REP1(i, N) sum[i] += sum[i-1] + W[i-1];
    int ans = INF;
    REP(i, N-1)
    {
        int s1 = sum[i+1];
        int s2 = sum[N] - sum[i+1];
        ans = min(ans, abs(s1-s2));
    }
    cout << ans << endl;
} 
    
int main() 
{
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    solve();

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")

using namespace std;
#define int long long
#define test int t; cin >> t; while (t--)
#define deb(x) cerr << #x << " " << x << endl;
#define debb(x, y) cerr << #x << " = " << x << "," << #y << " = " << y << endl <<endl;
#define pb push_back
#define pp pop_back
#define mkp make_pair 
#define f first
#define s second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define MAX 50000

typedef long double ld;
const int N = 1e5 + 10;
const int maxn = 2e6 + 10;
const long double Pie = acos(-1);
 
signed main() {
    int n, d;
	cin >> n >> d;
	
	int cnt = 0;
	while (n--)
	{
		int x, y;
		cin >> x >> y;
		
		ld ans = sqrt(ld(1.0*x*x + 1.0*y*y));
		if (ans <= d)	cnt++;	
	}
	
	cout << cnt;
	return 0;
}


Measured memory_bytes: 3644
#include <iostream>  
#include <string.h>  
using namespace std;  
char A[104],B[105],C[105];  
int main()  
{  
    int a,b,c;  
    int la,lb,lc;  
  
    while(cin>>A>>B>>C)  
    {  
        int tmp;  
        la=strlen(A);  
        lb=strlen(B);  
        lc=strlen(C);  
        tmp=1;  
        a=b=c=-1;  
        while(1)  
        {  
            if(a==la)  
            {  
                cout<<"A"<<endl;  
                break;  
            }  
            else if(b==lb)  
            {  
                cout<<"B"<<endl;  
                break;  
            }  
            else if(c==lc)  
            {  
                cout<<"C"<<endl;  
                break;  
            }  
            if(tmp==1)  
            {  
                  a++;  
                tmp=A[a]-'a'+1;  
  
  
            }  
            else if(tmp==2)  
            {  
                 b++;  
                tmp=B[b]-'a'+1;  
  
            }  
            else if(tmp==3)  
            {  
               c++;  
                tmp=C[c]-'a'+1;  
  
            }  
        }  
        //cout<<(a+b)*h/2<<endl;  
    }  
    return 0;  
}  

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

void solve(long long N, long long K, long long S) {
    if (S == 1e9) {
        rep(i, N) {
            if (i < K) {
                cout << S << " ";
            } else {
                cout << 1 << " ";
            }
        }
    } else {
        rep(i, N) {
            if (i < K) {
                cout << S << " ";
            } else {
                cout << S + 1 << " ";
            }
        }
    }
}

int main() {
    long long N;
    scanf("%lld", &N);
    long long K;
    scanf("%lld", &K);
    long long S;
    scanf("%lld", &S);
    solve(N, K, S);
    return 0;
}


Measured memory_bytes: 3732
#include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
using namespace std;
typedef struct pair<int,int> P;
typedef long long ll;
int main() {
	int n;
	int c[501]={};
	int s[501]={};
	int f[501]={};

	cin>>n;
	for(int i=1;i<n;i++)cin>>c[i]>>s[i]>>f[i];

	for(int i=1;i<n;++i){
		int t=s[i]+c[i];
		for(int j=i+1;j<n;++j){
			int k=0;
			if((t-s[j])%f[j]>0)k=f[j]-(t-s[j])%f[j];
			if(t<s[j])k=s[j]-t;
			t=t+k+c[j];
		}
		cout<<t<<endl;
	}
	cout<<"0"<<endl;
//
//	string s;
//
//	cin>>a>>b>>s;
//	bool flg=true;
//	int i;
//	for(i=0;i<a;++i){
//		if(s[i]=='-')flg=false;
//	}
//	if(s[i]!='-')flg=false;
//	for(i=a+1;i<a+b+1;++i){
//		if(s[i]=='-')flg=false;
//	}
//	if(flg){
//		cout<<"Yes"<<endl;
//	}else{
//		cout<<"No"<<endl;
//	}
//	cout<<48-n<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define YES() printf("YES\n")
#define NO() printf("NO\n")
#define isYES(x) printf("%s\n",(x) ? "YES" : "NO")
#define Yes() printf("Yes\n")
#define No() printf("No\n")
#define isYes(x) printf("%s\n",(x) ? "Yes" : "No")
#define isIn(x,y,h,w) (x >= 0 && x < h && y >= 0 && y < w)

#define int long long
//using ll = long long;
using P = pair<int,int>;

ostream &operator<<(ostream &os,const P &p){ return os << "(" << p.first << "," << p.second << ")"; }

template<class T> T &chmin(T &a,const T &b){ return a = min(a,b); }
template<class T> T &chmax(T &a,const T &b){ return a = max(a,b); }
 
const int INF=1e+18;
const double EPS=1e-9;
const int MOD=1000000007;

const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};

signed main(){
	int n,r;
	cin >> n >> r;
	if(n >= 10) cout << r << endl;
	else cout << r + (100 * (10 - n)) << endl;
}

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

int main()
{
    int n;
    cin>>n;
    int p = ceil(n*1.0/1000);
        int re=0;
    for (size_t i = 0; i < p; i++)
    {
       re=n-1000;
       n=n-1000;
    }
    
    cout<<abs(re)<<endl;


    return 0;
}

Measured memory_bytes: 3624