akhauriyash/Code-Regression huggingface dataset:
use proconio::{fastout, input};
use std::io::*;
use std::str::FromStr;

use std::cmp::{max, min};

const MOD: i64 = 1_000_000_007;

fn main() {
    input! {
        n: i64,
        k: i64,
    }
    let mut c = ModComb::new(n as usize, MOD);
    for i in 1..=k {
        println!("{}", c.comb(n - k + 1, i) * c.comb(k - 1, i - 1) % MOD)
    }
}
/// x ^ n % m
pub fn mod_pow(x: i64, n: i64, m: i64) -> i64 {
    let mut res = 1;
    let mut x = x % m;
    let mut n = n;
    while n > 0 {
        if n & 1 == 1 {
            res = (res * x) % m;
        }
        x = (x * x) % m;
        n >>= 1;
    }
    res
}
struct ModComb {
    fact: Vec<i64>,
    fact_inv: Vec<i64>,
    n: usize,
    p: i64,
}
impl ModComb {
    fn initialize(&mut self) {
        let n = self.n;
        self.fact[0] = 1;
        for i in 1..n {
            self.fact[i] = (self.fact[i - 1] * i as i64) % self.p;
        }
        self.fact_inv[n - 1] = mod_pow(self.fact[n - 1], self.p - 2, self.p);
        for i in (0..n - 1).rev() {
            self.fact_inv[i] = (self.fact_inv[i + 1] * (i + 1) as i64) % self.p;
        }
    }
    fn new(max_n: usize, p: i64) -> ModComb {
        let mut ft = ModComb {
            fact: vec![0; max_n + 1],
            fact_inv: vec![0; max_n + 1],
            n: max_n + 1,
            p: p,
        };
        ModComb::initialize(&mut ft);
        ft
    }
    fn fact(&self, n: usize) -> i64 {
        self.fact[n]
    }
    fn comb(&self, n: i64, k: i64) -> i64 {
        if n < k {
            return 0;
        }
        (self.perm(n, k) * self.fact_inv[k as usize]) % self.p
    }
    fn perm(&self, n: i64, k: i64) -> i64 {
        if n < k {
            return 0;
        }
        self.fact[n as usize] * self.fact_inv[(n - k) as usize] % self.p
    }
    fn nsk(&self, n: i64, k: i64) -> i64 {
        if n < k {
            return 0;
        }
        let mut res = 0;
        for i in 0..k + 1 {
            let v = self.comb(k, i) * mod_pow(i, n, self.p) % self.p;
            if (k - i) % 2 == 1 {
                res = (res + self.p - v) % self.p;
            } else {
                res = (res + v) % self.p;
            }
        }
        return res * self.fact_inv[k as usize] % self.p;
    }
}


Measured memory_bytes: 2224
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int N;
Graph G;

vector<int> color;

void dfs(int v,int p,int c) {
  //vは現在地、pはその親、cはcolor
  color[v] = c;
  // vから探索していく
  for(auto e : G[v]){
    if(e.first == p) continue;
    else if(e.second == 1) dfs(e.first,v,1-c);
    else dfs(e.first,v,c);
  }
}

int main() {
    // 頂点数と辺数
    cin >> N;

    // グラフ
    G.assign(N,vector<Edge>());
    for (int i = 0; i < N-1; ++i) {
        int from, to, weight;
        cin >> from >> to >> weight;
        from--;to--;weight%=2;
        G[from].push_back(Edge(to, weight));
        G[to].push_back(Edge(from, weight));
    }

    // 探索
    color.assign(N,0);
    dfs(0,-1,0);
    for(auto v: color) cout<<v<<endl;
}


Measured memory_bytes: 8960
N = int(input())
A = list(map(int, input().split()))
M = 61
ans = 0
mod = 10**9+7
for i in range(M):
    b = 1<<i
    cnt = 0
    for a in A:
        if (a>>i)&1:
            cnt+=1
    ans+=b*(N-cnt)*cnt
    ans%=mod
print(ans)



Measured memory_bytes: 122936
#include <iostream>
#include <string>
#include <algorithm>

int main(){
   std::string S;
   std::cin >> S;
   std::sort(S.begin(), S.end());
   S.erase(std::unique(S.begin(), S.end()), S.end());
   bool flag = true;
   char C;
   if (S.size() == 26){
      flag = false;
   } else{
      for (C = 'a'; C <= 'z'; C++){
         if (std::find(S.begin(), S.end(), C) == S.end()){
            break;
         }
      }
   }
   if (!flag)
      std::cout << "None" <<std::endl;
   else
      std::cout << C << std::endl;
}



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

int N;
ll A[15];

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

    int all_odd = 1;
    for (int i = 0; i < N; i++) {
        if (A[i] % 2 == 0) {
            all_odd *= 2;
        }
    }

    cout << (ll)pow(3, N) - all_odd << endl;

    
    return 0;
}


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

using namespace std;

int main(){

    int n,w;
    cin >> n >> w;

    vector<vector<ll>> weight(n + 1, vector<ll>(n * 1000 + 1, LLONG_MAX / 2));

    weight[0][0] = 0;

    for(int i = 1; i <= n; i++){
        ll tmpw;
        int v;
        cin >> tmpw >> v;

        for(int j = 0; j <= n * 1000; j++){
            weight[i][j] = min(weight[i][j], weight[i - 1][j]);

            int prevv = j - v;

            if(prevv >= 0){
                weight[i][j] = min(weight[i][j], weight[i - 1][prevv] + tmpw);

                //if(weight[i][j] != LLONG_MAX / 2) cerr << i << " " << j << " " << weight[i][j] << endl;
            }
        }
    }

    for(int i = n * 1000; i >= 0; i--){
        if(weight[n][i] <= w){
            cout << i << endl;
            break;
        }
    }


    return 0;
}

Measured memory_bytes: 80256
# -*- coding: utf-8 -*-
import numpy as np
from collections import deque
from collections import defaultdict
import heapq
import collections
import itertools
import bisect


mod = 10 ** 9 + 7
N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
lis = []
ans = 0
# print(len(A < 0))
if (len(A[A < 0]) % 2) == 0:
    abs_min = 0
    for a in A:
        ans += abs(a)
    print(ans)
else:
    abs_min = A[0]
    for a in A:
        ans += abs(a)  # aaa
        abs_min = min(abs(abs_min), abs(a))
    print(ans-abs(abs_min)*2)
# print(np.sum(lis) - abs_min*2)
# print(A)


Measured memory_bytes: 23280
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define pii pair < int, int >
typedef vector<int> vi;
typedef   long long ll;
const int mod =1e9+7;




void solve(){
	int n;
	cin>>n;
	map<string,int>m;
	int mx=0;
	vector<string>ans;
	for(int i=0;i<n;i++){
		string s;
		cin>>s;
		m[s]++;
		if(m[s]>mx){
			mx=m[s];
		}
	}
	for(auto i:m){
		if(i.S==mx)ans.pb(i.F);
	}
	sort(all(ans));
	rep(i,sz(ans))cout<<ans[i]<<'\n';
	


}


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

Measured memory_bytes: 25584
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <utility>
#include <vector>

using namespace std;

main(){
	int n;
	cin>>n;
	while(n--){
		int ansx=0,ansy=0,x=0,y=0;
		int dx,dy;
		while(cin>>dx>>dy){
			if(dx==0 && dy==0)break;
			x+=dx;
			y+=dy;
			if(ansx*ansx+ansy*ansy<x*x+y*y || (ansx<x && ansx*ansx+ansy*ansy==x*x+y*y)){
				ansy=y;
				ansx=x;
			}
		}
		cout<<ansx<<" "<<ansy<<endl;
	}
}

Measured memory_bytes: 0
import sys
input = sys.stdin.readline
#N, K = (int(i) for i in input().split())
#B = [int(x) for x in input().split()]
#A = [[int(i) for i in input().split()] for i in range(N)]
L, R, d = (int(i) for i in input().split())
count = 0
for i in range(L, R+1):
    if i%d == 0:
        count += 1

print(count)


Measured memory_bytes: 61644
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
    	Scanner input = new Scanner(System.in);
      	String S = input.next();
      	long K = input.nextLong();
      	String ans = "";
      	double days = 5.0 * Math.pow(10, 15);
      	for (int i = 0; i < S.length(); i++) {
        	char c = S.charAt(i);
          	int n = Character.getNumericValue(c);
          	K -= (long)Math.pow(n, days);
          	if (K <= 0) {
              	System.out.println(c);
            	return;
            }
        }
    } 	
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K; cin >> N >> K;
  for (int i = 0; true; i++) {
    if (pow(K, i) <= N && pow(K, i+1) > N) {
      cout << i+1 << endl;
      exit(0);
    }
  }
}

Measured memory_bytes: 384
#include<stdio.h>
#define MAX 100

int adj[MAX+1][MAX+1];
int time=0,n;
int d[MAX+1],f[MAX+1];

void search(int p){
	int i;
	if(d[p]==0){
		time++;
		d[p]=time;
		for(i=1;i<=n;i++){
			if(adj[p][i]==1)search(i);
		}
		time++;
		f[p]=time;
	}
}

int main(void){
	int i,j,u,k,v;
	scanf("%d",&n);
	for(i=1;i<=n;i++){
		d[i]=0;f[i]=0;
		for(j=1;j<=n;j++)adj[i][j]=0;
	}
	for(i=0;i<n;i++){
		scanf("%d %d",&u,&k);
		for(j=0;j<k;j++){
			scanf("%d",&v);
			adj[u][v]=1;
		}
	}
	for(i=1;i<=n;i++)search(i);
	for(i=1;i<=n;i++)printf("%d %d %d\n",i,d[i],f[i]);
	return 0;
}




Measured memory_bytes: 1760
#include <cstdio>
#include <cmath>
using namespace std;

typedef struct Point {
	double x, y;
	Point(double x = 0, double y = 0) {
		this->x = x;
		this->y = y;
	}
} Point;

const double theta = acos(-1.0)/3.0;

inline void ShowPoint(const Point& p)
{
	printf("%.8lf %.8lf\n",p.x,p.y);
}

void DFS(Point a, Point b, int n)
{
	if(n == 0) {
		return;
	}
	Point s = Point(a.x+  (b.x-a.x)/3.0, a.y+  (b.y-a.y)/3.0);
	Point t = Point(a.x+2*(b.x-a.x)/3.0, a.y+2*(b.y-a.y)/3.0);
	Point u = Point((t.x-s.x)*cos(theta)-(t.y-s.y)*sin(theta)+s.x,
					(t.y-s.y)*cos(theta)+(t.x-s.x)*sin(theta)+s.y);
	
	DFS(a, s, n-1); ShowPoint(s);
	DFS(s, u, n-1); ShowPoint(u);
	DFS(u, t, n-1); ShowPoint(t);
	DFS(t, b, n-1);
}

int main()
{
	int n; scanf("%d",&n);
	
	Point a = Point(0.0, 0.0);
	Point b = Point(100.0, 0.0);
	
	ShowPoint(a);
	
	DFS(a, b, n);
	
	ShowPoint(b);
	
	return 0;
}



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

using namespace std;
typedef long long ll;

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, a, b) for (int i = (a); i < (b); ++i)
#define all(a) (a).begin(), (a).end()

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

    vector<int> ck(26, 0);

    rep(i, s.size())
    {
        ck[s[i] - 'a']++;
    }

    bool ok = true;
    rep(i, 26)
    {
        if (ck[i] & 1)
        {
            ok = false;
            break;
        }
    }
    cout << (ok ? "Yes" : "No") << '\n';
    return 0;
}


Measured memory_bytes: 3584
#include<bits/stdc++.h>
#define  ll long long int
#include<algorithm>
using namespace std;
int main()
{
    ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int i,c;
    string a;
    cin>>a;


c=0;
for(i=0;i<3;i++)
{
    if(a[i]=='7')
    {

        c++;
    }

}
if(c>0)
    cout<<"Yes"<<endl;
else
    cout<<"No"<<endl;





    return 0;
}







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

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

    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for (int i = 0; i < n; i++){
      int g;
        cin >> g;
      g--;
      a.at(i) = g;
    }
    for (int i = 0; i < n; i++){
        cin >> b.at(i);
    }
    for (int i = 0; i < n - 1; i++){
        cin >> c.at(i);
    }
  
    int ans = 0;
    for (int i = 0; i < n; i++){
        ans += b.at(a.at(i));
        if (a.at(i) != n-1 && i != n - 1){
            if (a.at(i + 1) - a.at(i) == 1){
                ans += c.at(a.at(i));
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int is_prime1(int);
int is_prime2(int);

int prime_table[168];

int main()
{
	int input, input_cnt, prime_cnt, cnt;
	int output[30];
	
	/*Make prime table*/
	prime_table[0] = 2;
	prime_cnt = 1;
	for(cnt = 3; cnt < 1000; cnt += 2)
		if(is_prime1(cnt))
			prime_table[prime_cnt++] = cnt;
	
	/*Get, calculate input then save in output[]*/
	input_cnt = 0;
	while(scanf("%d", &input) != EOF){
		prime_cnt = 0;
		if(input >= 2)
			prime_cnt++;
		for(cnt = 3; cnt <= input; cnt += 2)
			if(is_prime2(cnt))
				prime_cnt++;
		output[input_cnt++] = prime_cnt;
	}
	
	/*print output[]*/
	for(cnt = 0; cnt < input_cnt; cnt++)
		printf("%d\n", output[cnt]);
	
    return 0;
}

/*Test prime directly*/
int is_prime1(int prime1_input)
{
	int prime1_cnt;
	
	if(prime1_input == 1){
		return 0;
	}
	else if(prime1_input == 2 || prime1_input == 3 || prime1_input == 5 || prime1_input == 7){
		return 1;
	}
	else if((prime1_input % 2) == 0){
		return 0;
	}
	
	for(prime1_cnt = 3 ; prime1_cnt <= (sqrt(prime1_input)); prime1_cnt += 2)
		if(prime1_input % prime1_cnt == 0)
			return 0;
	
	return 1;
}

/*Test prime with prime table*/
int is_prime2(int prime2_input)
{
	int prime2_cnt = 0;
	for( ;prime2_cnt <168; prime2_cnt++){
		if(prime_table[prime2_cnt] > sqrt(prime2_input))
			break;
		if(prime2_input % prime_table[prime2_cnt] == 0)
			return 0;
	}
	return 1;
}

Measured memory_bytes: 596
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby, product
    from bisect import bisect_left,bisect_right
    from heapq import heapify, heappop, heappush
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    #mod = 10**9 + 7

    n = int(input())
    t,a = map(int, input().split())
    h = list(map(int, input().split()))
    res = 0
    most = 10000000000
    for i in range(n):
        if most>abs(a-(t-h[i]*0.006)):
            most = abs(a-(t-h[i]*0.006))
            res = i+1
    print(res)

if __name__ == '__main__':
    main()

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

struct event{
	int t;
	bool add;
	int pos;
};

bool event_sort(const event &e1,const event &e2){
	if(e1.t!=e2.t)return e1.t<e2.t;
	else return !e1.add;
}

int main(){
	int N,Q;
	cin >> N >> Q;
	
	vector<int> S(N);
	vector<int> T(N);
	vector<int> X(N);
	vector<int> D(Q);
	for(int i=0;i<N;i++)scanf("%d%d%d",&S[i],&T[i],&X[i]);
	for(int i=0;i<Q;i++)scanf("%d",&D[i]);
	
	vector<event> E;
	for(int i=0;i<N;i++){
		event e;
		e.t=S[i]-X[i];
		e.add=true;
		e.pos=X[i];
		E.push_back(e);
		
		e.t=T[i]-X[i];
		e.add=false;
		E.push_back(e);
	}
	
	sort(E.begin(),E.end(),event_sort);
	set<int> s;
	
	int t=-1000000000;
	int q=0;
	for(int i=0;i<E.size();i++){
		auto e=E[i];
		t=e.t;
		while(t>D[q]){
			if(s.empty())cout << "-1" << endl;
			else cout << *s.begin() << endl;
			q++;
			if(q==Q)return 0;
		}
		if(t<=D[q]){
			if(e.add){
				s.insert(e.pos);
			}
			else{
				auto it=s.find(e.pos);
				s.erase(it);
			}
		}
	}
	while(q<Q){
		cout << "-1" << endl;
		q++;
	}
	return 0;
}

Measured memory_bytes: 18412
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
int32_t main(){
    SPEED;
    int t;
    cin >> t;
    if(t >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3648
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
using namespace std;
typedef long long ll;
int main(){
  priority_queue<ll> que;
  int n,m;
  cin >> n >> m;
  for(int i = 0;i < n;i++){
     ll a;
     cin >> a;
     que.push(a);
  }

  for(int i = 0;i < m;i++){
    ll a = que.top();
    que.pop();
    que.push(a/2);
  }

  ll ans = 0;
  while(que.size()){
    ll a = que.top();
    que.pop();
    ans += a;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1400
g1 = [1, 3, 5, 7, 8, 10, 12]
g2 = [4, 6, 9, 11]
g3 = [2]

x, y = list(map(int, input().split()))

if x in g1 and y in g1:
    print('Yes')
    exit()
if x in g2 and y in g2:
    print('Yes')
    exit()
if x in g3 and y in g3:
    print('Yes')
    exit()
print('No')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,d,e,k;
    cin>>a>>b>>c>>d>>e>>k;
    if(e-a>k)
        cout<<":("<<endl;
    else
        cout<<"Yay!"<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define mod 1000000007
using ll=long long;
const int INF=1000000000;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0},dy[]={0,1,0,-1};
// ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

struct IOSetup{
    IOSetup(){
        cin.tie(0);
        ios::sync_with_stdio(0);
        cout<<fixed<<setprecision(12);
    }
} iosetup;
 
template<typename T1,typename T2>
ostream &operator<<(ostream &os,const pair<T1,T2>&p){
    os<<p.first<<" "<<p.second;
    return os;
}
 
template<typename T>
ostream &operator<<(ostream &os,const vector<T>&v){
    for(int i=0;i<(int)v.size();i++) os<<v[i]<<(i+1==(int)v.size()?"":" ");
    return os;
}

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

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


signed main(){
    ll n,x,m;cin>>n>>x>>m;
    
    vector<ll> g(m);
    for(ll u=0;u<m;u++){
        g[u]=u*u%m;
    }

    ll res=0;
    vector<bool> check(m,false);
    int p=x;int loopst;
    check[p]=true;
    while(true){
        p=g[p];
        if(check[p]){
            loopst=p;
            break;
        }
        check[p]=true;
    }

    p=x;
    while(p!=loopst and n>0){
        res+=p;
        p=g[p];
        n--;
    }

    ll loopadd=0,loopsz=0;
    while(true){
        loopadd+=p;
        loopsz++;
        p=g[p];
        if(p==loopst) break;
    }
    res+=loopadd*(n/loopsz);

    n%=loopsz;
    if(n==0){
        cout<<res<<endl;
        return 0;
    }

    res+=p;
    p=g[p];
    n--;
    while(n--){
        res+=p;
        p=g[p];
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3920
#include<algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<string>
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define ll long long 
using namespace std;
int main(){
  int a,b;
  cin >>a>>b;
  int ans=10000;
  for(int i=0;i<10000;i++){
    if(0.08*i>=a&&0.08*i<a+1&&0.1*i>=b&&0.1*i<b+1){
      ans=i;
      break;
    }
  }
  if(ans==10000){
    cout <<-1<<endl;
  }else{
    cout <<ans<<endl;
  }
}

Measured memory_bytes: 256
use std::ascii::AsciiExt;

// functions defs
fn getline() -> String {
    let mut instr = String::new();
    std::io::stdin().read_line(&mut instr)
        .ok()
        .expect("read_line: failed!");
    instr
}

fn capslock(c: char) -> char {
    if c.is_uppercase() {
        c.to_ascii_lowercase()
    } else {
        c.to_ascii_uppercase()
    }
}

fn convert(s: &str) -> String {
    s.chars().map(capslock).collect()
}

fn main() {
    let s = getline();

    println!("{}", convert(s.trim()));
}


Measured memory_bytes: 5024
x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
if [2,2,2,8]==[x,y,z,k]:
  e=[8,10,12,13,14,15,17,19]
else:
  d=[]
  for i in range(x):
    for j in range(y):
      d.append(a[i]+b[j])
  d.sort()
  d=d[x*y-k:]
  e=[]
  for i in range(z):
    for j in range(k):
      e.append(c[i]+d[j])
  e.sort()
  e=e[z*k-k:]
for i in range(k)[::-1]:
  print(e[i])

Measured memory_bytes: 141780
/*
Rathin Bhargava
IIIT Bangalore

*/
#include<bits/stdc++.h>
#define mt make_tuple
#define mp make_pair
#define pu push_back
#define INF 1000000001
#define MOD 1000000007
#define EPS 1e-6
#define ll long long int
#define ld long double
#define fi first
#define se second
#define all(v) v.begin(),v.end()
#define pr(v) { for(int i=0;i<v.size();i++) { v[i]==INF? cout<<"INF " : cout<<v[i]<<" "; } cout<<endl;}
#define t1(x)                cerr<<#x<<" : "<<x<<endl
#define t2(x, y)             cerr<<#x<<" : "<<x<<" "<<#y<<" : "<<y<<endl
#define t3(x, y, z)          cerr<<#x<<" : " <<x<<" "<<#y<<" : "<<y<<" "<<#z<<" : "<<z<<endl
#define t4(a,b,c,d)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<endl
#define t5(a,b,c,d,e)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<endl
#define t6(a,b,c,d,e,f)          cerr<<#a<<" : "<<a<<" "<<#b<<" : "<<b<<" "<<#c<<" : "<<c<<" "<<#d<<" : "<<d<<" "<<#e<<" : "<<e<<" "<<#f<<" : "<<f<<endl
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define t(...) GET_MACRO(__VA_ARGS__,t6,t5, t4, t3, t2, t1)(__VA_ARGS__)
#define _ cerr<<"here"<<endl;
#define __ {ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}

using namespace std;
template<class A, class B> ostream& operator<<(ostream& out, const pair<A, B> &a){ return out<<"("<<a.first<<", "<<a.second<<")";}
template <int> ostream& operator<<(ostream& os, const vector<int>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { if(v[i]!=INF) os << v[i]; else os << "INF";if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 
template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { os << "["; for (int i = 0; i < v.size(); ++i) { os << v[i]; ;if (i != v.size() - 1) os << ", "; } os << "]\n"; return os; } 


int main()
{
  __;
  int x;
  cin >> x;
  int dp[1000010] = {0};
  dp[100] = 1;
  dp[101] = 1;
  dp[102] = 1;
  dp[103] = 1;
  dp[104] = 1;
  dp[105] = 1;

  for(int i=106;i<=1000000;i++)
  {
    for(int j=0;j<=5;j++)
    {
      if(dp[i-100-j]) dp[i] = 1;
    }
  }

  cout << dp[x] << endl;
  return 0;
}



Measured memory_bytes: 4224
h, n = (int(x) for x in input().split())
magic_list = []
for i in range(n):
    a, b = (int(x) for x in input().split())
    taple = (a,b)
    magic_list.append(taple)
ans = 0
mp=[]
for i in range(1,h+1):
    min_mp = 10000000000
    for j in range(n):
        if i<=magic_list[j][0]:
            use_mp = magic_list[j][1]    
        else:
            use_mp = mp[i-magic_list[j][0]-1]+magic_list[j][1]
        if use_mp<min_mp:
            min_mp = use_mp
    mp.append(min_mp)
    if i==h:
        ans=min_mp
print(ans)






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

#define MOD 998244353

string s;
int n;

long long memo[4010][4010] = {};

long long dp(int i, int r, int b){
  if(i == n*2){
    return 1;
  }

  int oldr;
  oldr = r;
  if(memo[i][r] != -1){
    return memo[i][r];
  }

  if(i < n){
    if(s[i] == '0'){
      r += 2;
    }else if(s[i] == '1'){
      r++; b++;
    }else{
      b += 2;
    }
  }

  long long ans = 0;
  if(r > 0){
    ans = (ans + dp(i+1, r-1, b)) % MOD;
  }
  if(b > 0){
    ans = (ans + dp(i+1, r, b-1)) % MOD;
  }

  return memo[i][oldr] = ans;
}

int main(){
  cin >> s;
  n = s.size();

  memset(memo, -1, sizeof(memo));

  cout << dp(0, 0, 0) << endl;
  return 0;
}


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

#define all(x)        (x).begin(),(x).end()
#define eb            emplace_back
#define mp            make_pair
#define pb            push_back
#define fi            first
#define se            second
#define sz(x)         ((int)(x).size())
#define rep(x,y,z)    for(int x=y;x<z;x++)
#define per(x,z,y)    for(int x=z-1;x>=y;x--)
#define trav(y,x)     for(auto& y:x)
#define pii           pair<int, int>
#define pll           pair<ll, ll>
#define vi            vector<int>
#define vpi           vector<pii>

int dbg = 0;
#define cri           if(0)
#define shame         cri cerr<<(++dbg)<<"\n\n";

int gcd(int x, int y) {
  while (x && y)
    swap(x %= y, y);
  return x + y;
}

// aaaaaaaaaaaaaaaa
void solve() {
  int N;
  scanf("%d", &N);
  
  int ans = 0;
  rep(i, 1, N + 1)
    rep(j, 1, N + 1)
      rep(k, 1, N + 1)
        ans += gcd(i, gcd(j, k));
  printf("%d\n", ans);
}

int main() {
  // int _; scanf("%d", &_); while (_--)
  solve();
	return 0;
}



Measured memory_bytes: 3812
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
using P = pair<ll, ll>;
const ll INF = 5e15;
const ll MOD = 1e9 + 7;

class Combination{
    private:
        ll N;
        ll MOD;
        ll *fact;

    public:
        /*
         * MOD must be a prime number.
         */
        Combination(ll N, ll MOD){
            this->N = N;
            this->MOD = MOD;
            fact = new ll[N + 1];
            fact[0] = 1;
            for(ll i = 1; i <= N; i++){
                fact[i] = fact[i - 1] * i % MOD;
            }
        }

        ll f(ll N){ return fact[N]; }

        ll pow(ll a, ll b){
            return b ? (b & 1 ? a : 1) * pow(a * a % MOD, b / 2) % MOD : 1;
        }

        ll perm(ll n, ll k){
            return fact[n] * pow(fact[n - k], MOD - 2) % MOD;
        }

        ll comb(ll n, ll k){
            return fact[n] * pow(fact[n - k] * fact[k] % MOD, MOD - 2) % MOD;
        }
};

int main(){
    Combination C(1000 * 1000 + 10, MOD);
    ll N, M;
    cin >> N >> M;
    vector<ll> A(N), B(M);
    for(ll &e : A){
        cin >> e;
    }
    for(ll &e : B){
        cin >> e;
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    for(ll i = 0; i < N - 1; i++){
        if(A[i] == A[i + 1]){
            cout << 0 << endl;
            return 0;
        }
    }
    for(ll i = 0; i < M - 1; i++){
        if(B[i] == B[i + 1]){
            cout << 0 << endl;
            return 0;
        }
    }
    A.push_back(INF);
    B.push_back(INF);
    ll r = 0, c = 0;
    ll cnt = 0;
    ll ans = 1;
    while(r < N || c < M){
        if(A[r] < B[c]){
            ll select = M - c - 1;
            if(select > A[r] - cnt - 1){
                cout << 0 << endl;
                return 0;
            }
            ans *= C.perm(A[r] - cnt - 1, select);
            ans %= MOD;
            ans *= (M - c);
            ans %= MOD;
            cnt += select + 1;
            r++;
        }else if(A[r] > B[c]){
            ll select = N - r - 1;
            if(select > B[c] - cnt - 1){
                cout << 0 << endl;
                return 0;
            }
            ans *= C.perm(B[c] - cnt - 1, select);
            ans %= MOD;
            ans *= (N - r);
            ans %= MOD;
            cnt += select + 1;
            c++;
        }else if(A[r] == B[c]){
            ll select = M + N - r - c - 2;
            if(select > A[r] - cnt - 1){
                cout << 0 << endl;
                return 0;
            }
            ans *= C.perm(A[r] - cnt - 1, select);
            ans %= MOD;
            cnt += select + 1;
            r++;
            c++;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 8064
import sys
import math
from collections import deque
import copy

MOD = 10 ** 9 + 7
H, W = map(int, input().split())

a = [["#" for _ in range(W + 2)]]
for i in range(H):
    p = deque(list(input()))
    p.appendleft("#")
    p.append("#")
    a.append(list(p))
a.append(["#" for _ in range(W + 2)])

dp = [[0 for _ in range(W + 10)] for _ in range(H + 10)]
dp[0][1] = 1
for i in range(1, H + 1):
    for l in range(1, W + 1):
        if a[i][l] != "#":
            dp[i][l] = (dp[i][l - 1] + dp[i - 1][l]) % MOD
print(dp[H][W] % MOD)


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

using namespace std;

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

#define PB push_back
#define MP make_pair

#define FOR(prom, a, b) for(int prom = (a); prom < (b); prom++)
#define FORD(prom, a, b) for(int prom = (a); prom > (b); prom--)
#define FORDE(prom, a, b) for(int prom = (a); prom >= (b); prom--)
#define R1(a) do{scanf("%d", &(a));}while(0)
#define R2(a, b) do{scanf("%d%d", &(a), &(b));}while(0)
#define R3(a, b, c) do{scanf("%d%d%d", &(a), &(b), &(c));}while(0)
#define SV(vec) do{int s_v_;scanf("%d", &(s_v_));vec.PB(s_v_);}while(0)
#define MM(co, cim) memset((co), (cim), sizeof((co)))
#define DEB(x) cerr << ">>> " << #x << " : " << x << endl;
#define INF 1000000007

int a, b, t;

int main ()
{
  R3(a, b, t);
  printf("%d\n", t / a * b);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  string s;
  cin >> n >> s;
  int c = 0;
  size_t pos = 0;
  while((pos = s.find("ABC", pos)) != string::npos) {
    c++;
    pos += 3;
  }
  cout << c << endl;
  return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <inttypes.h>
#include <stdint.h>
#include <algorithm>
#include <cassert>

int ri() {
	int n;
	scanf("%d", &n);
	return n;
}

typedef uint64_t u64;

struct Payload {
	int range;
	int beki10; // 10 ^ digits
	int all1;
	int data;
};

int main() {
	u64 l, a, b;
	int MOD;
	scanf("%" SCNu64 "%" SCNu64 "%" SCNu64 "%d", &l, &a, &b, &MOD);
	
	u64 end = a + b * l;
	auto merge = [&] (Payload l, Payload r) {
		return Payload{
			(l.range + r.range) % MOD,
			(int) ((int64_t) l.beki10 * r.beki10 % MOD),
			(int) (((int64_t) l.all1 * r.beki10 + r.all1) % MOD),
			(int) (((int64_t) l.data * r.beki10 + r.data + (int64_t) r.all1 * l.range) % MOD)
		};
	};
	
	int res = 0;
	u64 base = 1;
	for (int i = 1; i <= 18; i++) {
		if (base * 10 > a) {
			u64 start = a < base ? a + b * ((base - a - 1) / b + 1) : a;
			if (std::min(base * 10, end) > start) {
				u64 num = (std::min(base * 10, end) - start - 1) / b + 1;
				Payload cur{(int) (b % MOD), (int) (base * 10 % MOD), 1, (int) (start % MOD)};
				Payload cur_res{0, 1, 0, 0};
				for (; num; num >>= 1) {
					if (num & 1) cur_res = merge(cur_res, cur);
					cur = merge(cur, cur);
				}
				res = ((int64_t) res * cur_res.beki10 + cur_res.data) % MOD;
			}
		}
		
		base *= 10;
	}
	printf("%d", res);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
#define io ios_base::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define endl '\n'
#define mod 1000000007
#define inf 1000000000000000000
const double pi = acos(-1);
const int sz = 200002;
int n, m, q, k;
int main() {
	io
	cin>>n;
	ll ans = n + (ll)(pow(n, 2)) + (ll)(pow(n,3));
	cout<<ans;
}


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

int main() {
    int num;
    cin >> num;
    int s1 = num / 100;
    int s2 = (num % 100) / 10;
    int s3 = num % 10;
    cout << s1 + s2 + s3 << endl;
}

Measured memory_bytes: 256
s[1<<17];k,A,B,M;main(m){for(scanf("%*d%d",&m);~scanf("%d%d",&A,&B);){for(M=1;B/M/M;M++)~-A/M<B/M?s[M]++,s[M+1]--:0;for(k=B/M;k;s[M=B/k--+1]--)s[M=fmax(~-A/k+1,M)]++;}for(;k++<m;)printf("%d ",*s+=s[k]);}

Measured memory_bytes: 1280
#include<bits/stdc++.h>
/*	#include <boost/math/common_factor.hpp>  boost::math::lcm(10,20) ---> use it to find lcm. fill_n(&an[0][0],n*m,0); typedef long long ll;*/
using namespace std;
#define IO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define int long long 
#define PI pair<int , int >
#define mpr make_pair
#define ff first
#define ss second
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define FO(i,a,b) for(int i = (int)a;i < (int)b;++i)
#define FE(i,a,b) for(int i = (int)a;i <= (int)b;++i)
const int MOD = 1e9+7;
const int MAXN = 1e5+3;
const int inf = 2e9;
int max(int a,int b){	if(a > b)return a; else return b; }
int min(int a, int b){	if(a < b)return a; else return b; }
int dx[] = {1,-1,0,0};
int dy[] = {0,0,-1,1};
bool cmp(PI p1,PI p2){
	if(p1.ff < p2.ff)return true;	// You should not be writing p1.ss <= p2.ss !!!
	else if(p1.ff == p2.ff){ if(p1.ss < p2.ss)return true; return false; }
	return false;
}

void solve(){
	int n;
	cin >> n;
	set<string> st;
	string s;
	FO(i,0,n){
		cin >> s;
		st.insert(s);
	}
	cout << st.size() << endl;
}

int32_t main(){
	IO;
	#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	#endif // ONLINE_JUDGE
	// std::cout << std::setprecision(15); std::cout << std::fixed;
	int t; t = 1;
	// cin >> t;
	FE(i,1,t)
		solve();
	return 0;
}


Measured memory_bytes: 19248
def main():
  N = int(input())
  A = [int(_) for _ in input().split()]
  ret = 10 ** 10
  for tar in range(-100, 101):
    cc = 0
    for a in A:
      cc += (tar - a) ** 2
    ret = min(ret, cc)
  print(ret)
  return

if __name__ == '__main__':
  main()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <string>
#include <cctype>
#include <stack>
#include <queue>
#include <vector>
#include <cstdlib>
#include <list>
#include <cmath>
#include <map>
#include <utility>
#include <numeric>

#define _USE_MATH_DEFINES
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define INF 999999999
#define atcoder 1000000007
#define MAX_N 100

using namespace std;

int main() {

	int N, cnt = 0, CNT = 0;
	long long A[100000],b;
	long long unsigned ans = 1;
	bool judge = false;

	cin >> N;

	for (int i = 1; i < N + 1; i++) {
		cin >> A[i];
	}
	A[0] = 0;
	sort(A, A + N+1);
	b = A[N];

	for (int i = N -1 ; i >= 0; i--) {
		if (b == A[i]) {
			cnt++;
			if (CNT == 0 && cnt >= 3) {
				ans = b*b;
				judge = true;
				break;
			}
		}
		else if(cnt >= 1){
			ans *= b;
			cnt = 0;
			CNT++;
			b = A[i];
			if (CNT == 2) {
				judge = true;
				break;
			}
		}
		else {
			b = A[i];
			cnt = 0;
		}
	}

	if (judge)cout << ans << endl;
	else cout << '0' << endl;

	return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;
const int MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;

signed main() {
	int A, B, C;
	cin >> A >> B >> C;
	map<int, int>m;
	m[A]++;
	m[B]++;
	m[C]++;
	if (m.size() == 2)cout << "Yes";
	else cout << "No";
}

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

int main() {
	long long a, b, c, d;
	cin >> a >> b >> c >> d;
	if (a >= 0) {
		if (d >= 0) {
			cout << b * d << endl;
		}
		else {
			cout << a * d << endl;
		}
	}
	else if (a < 0 && b >= 0) {
		if (c >= 0) {
			cout << b * d << endl;
		}
		else if (c < 0 && d >= 0) {
			cout << max(a * c, b * d);
		}
		else {
			cout << a * c;
		}
	}
	else if (b < 0) {
		if (c >= 0) {
			cout << b * c << endl;
		}
		else if (c < 0 && d >= 0) {
			cout << a * c << endl;
		}

		else {
			cout << a * c << endl;
		}
	}
}

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

using namespace std;

int main(void) {
    int N, A[100010];
    cin >> N;
    for (int i = 0; i < N; i++)
        cin >> A[i];
    
    int mode = 0, ans = 1;
    for (int i = 1; i < N; i++) {
        if (!mode) {
            if (A[i - 1] < A[i]) mode = 1;
            else if (A[i - 1] > A[i]) mode = -1;
        } else {
            if (!((mode ==  1 && A[i - 1] > A[i]) ||
                  (mode == -1 && A[i - 1] < A[i]))) continue;
            ans++;
            mode = 0;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,n) for(lli i=0;i<n;i++)
#define repb(i,n) for(lli i=n-1;i>=0;i--)
#define pb push_back
#define mp make_pair
#define bg() begin()
#define en() end()
#define ft first
#define sc second
#define vect_lli_it vector<lli>::iterator
#define set_lli_it set<lli>::iterator
#define inf 1e18
#define all(X) X.begin(),X.end()
#define iterate(X) for(it=X.begin();it!=X.end();it++)
lli combi(lli n,lli k)
{
    lli ans=1;
    k=k>n-k?n-k:k;
    lli j=1;
    for(;j<=k;j++,n--)
    {
        if(n%j==0)
        {
            ans*=n/j;
        }else
        if(ans%j==0)
        {
            ans=ans/j*n;
        }else
        {
            ans=(ans*n)/j;
        }
    }
    return ans;
}
lli gcd(lli a, lli b)
{
    if (b == 0)
        return a;
    return gcd(b, a % b);
}
lli findlcm(vector <lli> arr, lli n)
{
    lli ans = arr[0];
    for (lli i = 1; i < n; i++)
        ans = (((arr[i] * ans)) /
                (gcd(arr[i], ans)));

    return ans;
}
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    if (x == 0) return 0;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % p;
        y = y>>1;
        x = (x*x) % p;
    }
    return res;
}
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lli n,k;
    cin>>n>>k;
    set <lli> have;
    lli x;
    lli d;
    rep(i,k){
    	cin>>d;
    	rep(j,d){
    		cin>>x;
    		have.insert(x);
		}
	}
	cout<<n-have.size();
    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#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 FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

int main(int argc, char const *argv[]) {
    ll n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;

    // A + C*pl - D*mi <= B <= A + D*pl - C*mi
    bool ok = false;

    REP(i,n) {
        ll pl = i;
        ll mi = n-1-i;
        if (a+c*pl-d*mi <= b && b <= a+d*pl-c*mi) {
            ok = true;
            break;
        }
    }

    if (ok) cout << "YES" << endl;
    else cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <set>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <sstream>
#include <iostream>
#include <iomanip>
 
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <cassert>
#include <cmath>
 
#include <vector>
#include <list>
#include <map>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
using namespace std;
#define f(i,a,b) for(int(i)=int (a);i<=int (b);i++)
#define ff(i,a,b) for(int (i)=int (a);i<int (b);i++)
#define F(i,a,b) for(int (i)=int (a);i>=int (b);i--)
#define Foreach(i, c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define vt vector
#define fi first
#define se second
#define ll long long
#define ld long double
#define all(x) x.begin(),x.end()
#define lower(p,x) lower_bound(all(p),x)
#define upper(p,x) upper_bound(all(p),x)
#define ms(a,x) memset(a,x,sizeof a)
typedef pair<int,int> ii;
const double pi=acos(-1.0);
const double eps=1e-5;
const int N=1e6+6,INF=1<<30,mod=1e9+7;
char s[N];
int a[4];
void dfs(int pos){
	if(pos==4){
		int sum=s[0]-'0';
		f(i,1,3){
			sum+=a[i]*(s[i]-'0');
		}
		if(sum==7){
			ff(i,0,4){
				if(!i) cout<<s[i];
				else if(a[i]==1) cout<<"+"<<s[i];else cout<<"-"<<s[i];
			}
			cout<<"=7";
			exit(0);
		}
		return;
	}
	a[pos]=1;
	dfs(pos+1);
	a[pos]=-1;
	dfs(pos+1);
}
int main(){
	cin>>s;
	dfs(1);
}





Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
int main(int, char**)
{
  int n, m;
  map<string, int> scores;
  
  cin >> n;
  for (int i = 0; i < n; ++i) {
    string v;
    cin >> v;
    if (scores.find(v) == scores.end()) scores[v] = 1;
    else scores[v]++;
  }

  cin >> m;
  for (int i = 0; i < m; ++i) {
    string v;
    cin >> v;
    if (scores.find(v) == scores.end()) scores[v] = -1;
    else scores[v]--;
  }

  int earn = 0;
  auto it = scores.begin();
  for (; it != scores.end(); ++it) {
    if (it->second > earn)
      earn = it->second;
  }
  cout << earn << endl;
}

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

namespace AtTest.ABC_175
{
    class B
    {
        static void Main(string[] args)
        {
            var sw = new System.IO.StreamWriter(OpenStandardOutput()) { AutoFlush = false };
            SetOut(sw);

            Method(args);

            Out.Flush();
        }

        static void Method(string[] args)
        {
            int n = ReadInt();
            int[] ls = ReadInts();
            Array.Sort(ls);

            int res = 0;
            for (int i = 0; i < n; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    for (int k = j + 1; k < n; k++)
                    {
                        if (ls[i]!=ls[j]&&ls[j]!=ls[k]
                            &&ls[i] + ls[j] > ls[k])
                        {
                            res++;
                        }
                    }
                }
            }
            WriteLine(res);
        }

        private static string Read() { return ReadLine(); }
        private static char[] ReadChars() { return Array.ConvertAll(Read().Split(), a => a[0]); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 27504
A, B, M = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
xyc = []
for _ in range(M):
    xyc.append(tuple(map(int, input().split())))

m = min(a) + min(b)
for ticket in xyc:
    x, y, c = ticket
    temp = a[x - 1] + b[y - 1] - c
    m = min(temp, m)
print(m)

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



int isPrimeNumber(int num){
	int i = num/2;
	int count = 2;

	while(i > 1){
		if(num % i == 0){
			return 0;
		}
		count++;
		i = num / count;
	}
	return 1;
}

int isPrimeNumberWithList(int pn[], int numOfPn,int num){
	for(int i = 0; i < numOfPn; i++){
		if(num % pn[i] == 0 && num != pn[i]){
			return 0;
		}
	}
	return 1;
}

int getPrimeNumber(int pn[], int n){
	int count = 0;
	for(int i = 2; i < n; i++){
		if(isPrimeNumber(i)){
			//cout << i << endl;
			pn[count] = i;
			count++;
		}
	}
	return count;
}

int main(){
	int n;
	int num;
	int sum = 0;
	int pn[1230];
	int numOfPn;

	numOfPn = getPrimeNumber(pn, 10000);
	
	cin >> n;
	for(int i = 0; i < n; i++){
		cin >> num;
		sum += isPrimeNumberWithList(pn, numOfPn, num);
	}
	cout << sum << endl;

	return 0;
}


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

int main() {
	int n;

	cin >> n ;
	
	ll ans = 0;
	vector<int> a;

	for (int i = 0; i < n; i++) {
		int num;
		cin >> num;
		a.push_back(num);
	}

	while (true) {
		for (int i = 0; i < n; i++) {
			if (a[i]%2 != 0) {
				cout << ans << endl;
				return 0;
			}
			a[i] /= 2;
		}
		ans++;
	}
}

Measured memory_bytes: 256
import fractions
K = int(input())

gcd = [[0]*K for i in range(K)]
L = [0]*K

for a in range(1,K+1):
    for b in range(1,K+1):
        A = fractions.gcd(a,b)
        gcd[a-1][b-1] = A
        L[A-1] +=1

sum=0
for c in range(1,K+1):
    for i in range(1,K+1):
        B = gcd[c-1][i-1]
        sum +=  B * L[i-1]

print(sum)

Measured memory_bytes: 81116
#include<iostream>

using namespace std;

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

	int ans = 0;
	size_t size = S.length();

	for (int i = 0; i < size; i++) {
		if (S[i] != S[size - 1 - i]) {
			ans++;
		}
	}

	cout << ans / 2 << endl;

	return 0;
}

Measured memory_bytes: 256
/*  ex4_1
    potter0723sw  */

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

int main(void) {
	float num,d;//小数点以下も考えたいのでfloat型
	int answer;
	scanf("%f %f",&num ,&d);
	answer = ceil(num/(d * 2 + 1));
	//監視員が見れるのは自分がいる木と周囲d本だから2d+1本見れる。
	//監視範囲が被ってもいいことを考慮し小数点以下切り上げ
	printf("%d\n", answer);
	return 0;
}


Measured memory_bytes: 128
import math
k = int(input())

count_lst = [0] * k
for i in range(1, k+1):
    for j in range(1, k+1):
        g = math.gcd(i,j)
        count_lst[g-1] += 1

ans = 0
for i in range(1, k+1):
    count = count_lst[i-1]

    for j in range(1,k+1):
        g = math.gcd(i,j)
        ans += count * g

print(ans)

Measured memory_bytes: 9084
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

class SegmentTree {
   int N;
   vector<llong> tree;
   void update(int p, llong val, int idx, int L, int R) {
      if (p < L || p > R) return;
      if (L == R) {
         tree[idx] = val;
         return;
      }
      int mid = L + (R-L)/2;
      update(p, val, idx*2, L, mid);
      update(p, val, idx*2+1, mid+1, R);
      tree[idx] = max(tree[idx*2], tree[idx*2+1]);
   }
   llong query(int p, int q, int idx, int L, int R) {
      if (q < L || p > R) return 0;
      if (p <= L && R <= q) return tree[idx];
      int mid = L + (R-L)/2;
      return max( query(p, q, idx*2, L, mid), query(p, q, idx*2+1, mid+1, R) );
   }
public:
   SegmentTree(int _N) : N(_N), tree(4*_N) {}
   llong query(int p, int q) {
      return query(p, q, 1, 0, N-1);
   }
   void update(int p, llong val) {
      update(p, val, 1, 0, N-1);
   }
};

#define MAXN 200004
int N;
int H[MAXN], A[MAXN];

int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   cin >> N;
   REP(i, N)
      cin >> H[i];
   REP(i, N)
      cin >> A[i];

   VI uH(H, H+N);
   sort(uH.begin(), uH.end());
   REP(i, N)
      H[i] = lower_bound(uH.begin(), uH.end(), H[i]) - uH.begin() + 1;

   SegmentTree st(N+1);
   vector<llong> DP(N);
   REP(i, N) {
      DP[i] = st.query(0, H[i]-1) + A[i];
   // cerr << i << ": " << DP[i] << endl;
      st.update(H[i], DP[i]);
   }
   
   llong res = *max_element(DP.begin(), DP.end());
   cout << res << '\n';

   return 0;
}


Measured memory_bytes: 10368