akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define il inline
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define mid ((l+r)>>1)
#define MAXN 100050
#define MAXM 
#define mod
#define inf (1<<30)
#define eps (1e-6)
#define alpha 0.75
#define rep(i, x, y) for(register int i = x; i <= y; ++i)
#define repd(i, x, y) for(register int i = x; i >= y; --i)
#define file(s) freopen(s".in", "r", stdin), freopen(s".my", "w", stdout)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, int> pli;
typedef pair <int, ll> pil;
typedef pair <ll, ll> pll;
template <typename T> il bool chkmin(T &x, T y) {return x > y ? x = y, 1 : 0;}
template <typename T> il bool chkmax(T &x, T y) {return x < y ? x = y, 1 : 0;}
template <typename T> il void read(T &x) {
	char ch = getchar(); int f = 1; x = 0;
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	x *= f;
}
template <typename T, typename... Args> il void read(T &x, Args &...args) {
	read(x), read(args...);
}
int n, deg[MAXN];
vector <int> adj[MAXN];
int c[MAXN], ans[MAXN], q[MAXN], fr, re;
int main() {
	read(n); int u, v;
	rep(i, 1, n-1) read(u, v), adj[u].pb(v), adj[v].pb(u), ++deg[u], ++deg[v];
	rep(i, 1, n) read(c[i]);
	sort(c+1, c+n+1); 
	rep(i, 1, n) if(deg[i] == 1) q[re++] = i;
	rep(i, 1, n) {
		u = q[fr++];
		for(auto v: adj[u]) 
			if(deg[v] > 1) {
				--deg[v];
				if(deg[v] == 1) q[re++] = v;
			}
		ans[u] = c[i];
	}
	ll _w = 0;
	rep(i, 1, n-1) _w += c[i];
	cout << _w << endl;
	rep(i, 1, n) cout << ans[i] << ' ';
	return 0; 
}

Measured memory_bytes: 3200
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
using namespace std;
const ll mod=1e9+7;
const ll inf = (ll)1e17;
const ld eps = 1e-12;
const ld PI = 3.14159265358979323846;
ll mul(ll a, ll b, ll m = mod) { return (ll)(a * b) % m;}
ll add(ll a, ll b, ll m = mod) { a += b; if(a >= m) a -= m; if(a < 0) a += m; return a;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}




const int MAX = 1000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];

void init_binomial_coefficient() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

long long binomial_coefficient(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    ll x,y;
    cin>>x>>y;
    if((x+y)%3!=0 || max(x,y)>2*min(x,y) || x<=0 ||y<=0){
        cout<<0<<endl;
        return 0;
    }
    init_binomial_coefficient();


    ll a=(2*y-x)/3;
    ll b=(2*x-y)/3;
    cout << binomial_coefficient(a+b, b) << endl;
    return 0;
    }


Measured memory_bytes: 23680
#include <stdio.h>

int main(){
    int n, w[100];
    int i, min = 100, t, s1, s2, add, mint;

    scanf("%d", &n);
    for(i=0; i<n; i++)
        scanf("%d", &w[i]);

    for(t=0; t<n-1; t++){
        s1 = 0;
        s2 = 0;

        for(i=0; i<=t; i++){
            s1 += w[i];
        }

        for(i=t+1; i<n; i++){
            s2 += w[i];
        }

        add = s1 - s2;
        if(add < 0)
            add *= -1;
        
        if(min > add){
            min = add;
            mint = t;
        }
    }

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

    return 0;
}

Measured memory_bytes: 128
#include <iostream>

using namespace std;

int main() {
    string S;
    int i = 0;

    // input
    cin >> S;

    // process
    for (i = 1; i < 4; i++) {
        if (S[i] == S[0]) {
            break;
        }
        if (i >= 3) {
            cout << "No" << endl;
            return 0;
        }
    }

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

    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
/**
 *  http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_3_D
 */
#include <iostream>
#include <string>
#include <stack>
#include <vector>

using namespace std;

int
main()
{
    string line;
    getline(cin, line);

    stack<int> pond;
    stack<pair<int, int> > areastack;
    int total = 0;
    for (int i = 0; i < line.length(); i++) {
        if (line[i] == '\\') {
            pond.push(i);
        } else if (pond.size() > 0 && line[i] == '/') {
            int j = pond.top();
            pond.pop();
            int a = i - j;
            total += a;
            while (areastack.size() > 0 && areastack.top().first > j) {
                a += areastack.top().second;
                areastack.pop();
            }
            areastack.push(make_pair(j, a));
        }
    }

    vector<int> areas(areastack.size());
    int index = 0;
    while (areastack.size() > 0) {
        areas[index++] = areastack.top().second;
        areastack.pop();
    }

    cout << total << endl;
    cout << areas.size();
    for (auto it = areas.crbegin(); it != areas.crend(); it++) {
        cout << ' ' << *it;
    }
    cout << endl;

    return 0;
}

Measured memory_bytes: 3212
#include<iostream>
#include<algorithm>
#define MAX 100000
using namespace std;

int n, A[MAX+1], L[MAX];

int lis(){
    L[0] = A[0];
    int length = 1;

    for(int i=0; i<n; i++){
        if(L[length-1] < A[i]){
            L[length++] = A[i];
        }else{
            *lower_bound(L, L+length, A[i]) = A[i];
        }
    }

    return length;
}

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

    cout << lis() << endl;

    return 0;
}


Measured memory_bytes: 3876
x,y = map(int,input().split())

if  (y - x*2)%2 == 0:
    a = (y-x*2)//2
    b = x - a
    if a < 0 or b < 0:
        print("No")
        exit(0)
    elif y == b * 2 + a * 4:
        print("Yes")
    else:
        print("No")
else:
    print("No")

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

int main(){
    string s;
    cin >> s;
    int n = s.size();
    vector<char>  ss(n);
    vector<int> a(n+1);
    bool f = true;
    int id = 0;
    for(int i = 0;i < n;i++){
        if(s[i] != 'x') ss[id++] = s[i];
    }
    for(int i = 0;i < id/2;i++){
        if(ss[i] != ss[id-i-1]) f = false;
    }
    int count = 0;
    int id2 = 0;
    for(int i = 0;i < n;i++){
        if(id2 < id && s[i] == ss[id2]){
            a[id2++] = count;
            count = 0;
        }else{
            count++;
        }
    }
    a[id2++] = count;
    int ans = 0;
    for(int i = 0;i < id2/2;i++){
        ans += max(a[i], a[id2-i-1])-min(a[i], a[id2-i-1]);
    }
    if(!f)  cout << -1 << endl;
    else    cout << ans << endl;
}

Measured memory_bytes: 896
/* 
 * Project: AtCoder Beginners Contest 170 A - Five Variables
 * Author: toms74209200 <https://github.com/toms74209200>
 *
 * Created on 2020/06/14
 * Copyright (c) 2020 toms74209200
 * 
 * This software is released under the MIT License.
 * http://opensource.org/licenses/mit-license.php
 */
#include <cstdio>
using namespace std;

int a[5];

void solve() {
    for (int i=0;i<5;i++) {
        if (a[i] == 0) {
            printf("%d\n", i+1);
            return;
        }
    }

}

int main() {

    for (int i=0;i<5;i++) {
        scanf("%d", &a[i]);
    }

    solve();

}

Measured memory_bytes: 3100
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <iomanip>

using namespace std;

using ll = long long;
using ld = long double;
using lli = long long int;

#define PI 3.14159265358979323846264338327950L

int main(){
  long long N;
  long long div_cnt=0, z=1;
  long long i, j;

  cin >> N;

  for(i=2; i*i<=N; i++){
    z = 1;
    if(N % i == 0){
      z *= i;
      while(N % z == 0){
        // cout << "Z:" << z << ", N, N/Z:" << N_z << ", ";
        N /= z;
        div_cnt++;
        z *= i;
      }
      
      while(N % i == 0){
        N /= i;
      }
    }
  }
  
  // cout << "last_N:" << N << endl;
  if(N != 1){
    div_cnt++;
  }

  cout << div_cnt << endl;
  
  return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n,k;
  int price=0;
  cin>>n>>k;
  vector<int>p(n,0);
  for(int i=0;i<n;i++){
    cin>>p[i];
  }
  sort(p.begin(),p.end());
  for(int i=0;i<k;i++){
    price+=p[i];
  }
   cout<<price<<endl;
}

Measured memory_bytes: 3572
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <cmath>
#define INF 1000000007
using namespace std ;

int main(int argc, char const *argv[])
{

	string s ;
	cin>>s ;

	map<char,int> m ;

	int flag = 0 ;
	for(auto i : s) m[i]++ ;
	for(auto i : m) if(i.second % 2 != 0){flag = 1 ; break ;}

	if(flag) cout<<"No"<<endl ;
	else cout<<"Yes"<<endl ;
	
	return 0;
}

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

int main(){
  int w,h; cin >> h >> w;
  int n; cin >> n;
  map<pair<int, int>, int> mp;
  for(int i=0;i<n;i++){
  	int a,b; cin >> a >> b;
    for(int dx=-1; dx <= 1; dx++)
      for(int dy=-1; dy <= 1;dy++)
       if(a+dx >= 2 && b+dy >= 2 && a+dx <= h-1 && b+dy <= w-1){
         if(mp.count(make_pair(a+dx,b+dy)) == 0) mp[make_pair(a+dx,b+dy)] = 1;
         else mp[make_pair(a+dx,b+dy)]++;
       }
    //cout << "a:" << mp[make_pair(3,4)] << endl;
  }
  long long int ml = (long long) (w-2) * (long long) (h-2);
  vector<long long int> ans(10);
  ans[0] = ml;
  for(auto x: mp){
  	ans[x.second]++;
    ans[0]--;
  }
  for(int i=0;i<10;i++) cout << ans[i] << endl;
  return 0;
}

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

int main(){
	int ans = 0;
	string s;
	cin >> s;
	if (s[0] == 'o')ans++;
	if (s[1] == 'o')ans++;
	if (s[2] == 'o')ans++;
	cout << 700 + 100 * ans << endl;	
}


Measured memory_bytes: 256
#include <cstdio>
 
int main()
{
    int n,key;
 
    while (scanf("%d", &n), n) {
	int a[n];
	for (int i = 0; i < n; i++) {
	    scanf("%d", a + i);
	}
 
	scanf("%d", &key);
 
	int lb = 0, ub = n-1, cnt = 0;
	while (ub - lb >= 0) {
	    int mid = (lb + ub) / 2;
	    cnt++;
 
	    if (key == a[mid]) {
		break;
	    }
	    if (key < a[mid]) {
		ub = mid - 1;
	    } else {
		lb = mid + 1;
	    }
	}   
	printf("%d\n", cnt);
    }
    return 0;
}

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

void Main()
{
  ll a,b,k; cin >> a >> b >> k;
  ll cnt;
  cnt = min(k, a);
  a -= cnt;
  if (a == 0) {
    cnt = min(k-cnt, b);
    //cout << cnt << endl;
    b -= cnt;
  }
  cout << a << " " << b << endl;
}

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


Measured memory_bytes: 3596
#include <bits/stdc++.h>  // ver2.2.2
#define int long long
#define endl "\n"
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define VVi vector<Vi>
#define Vs vector<string>
#define Pii pair<int,int>
#define VPii vector<Pii>
#define Tiii tuple<int,int,int>
#define PQi priority_queue<int>
#define PQir priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define itos to_string
#define stoi stoll
#define FI first
#define SE second
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define sortr(v) sort(v,greater<>())
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repeq(i,a,b) for(int i=a;i<=b;i++)
#define repreq(i,a,b) for(int i=a;i>=b;i--)
#define leng(n) (int)(log10(n)+1)
#define dem(a,b) ((a+b-1)/(b))
#define Vin(a) rep(iI,0,a.size())cin>>a[iI]
#define Vout(a) rep(lZ,0,a.size()-1)cout<<a[lZ]<<' ';cout<<a.back()<<endl
#define VVout(a) rep(lY,0,a.size()){Vout(a[lY]);}
#define VPout(a) rep(lX,0,a.size())cout<<a[lX].FI<<' '<<a[lX].SE<<endl
#define INF 3000000000000000000  //  3.0*10^18(MAXの1/3くらい)
#define MAX LLONG_MAX
#define MOD 1000000007  //  10^9 + 7
using namespace std;
int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm
void uniq(Vi &v){sort(ALL(v)); v.erase(unique(ALL(v)),v.end());}  //  uniqのやつ
int mypow(int x, int n, int m){  //  累乗x^n(mod m)  O(log(n))
if(n==0)return 1;if(n%2==0)return mypow(x*x%m,n/2,m);else return x*mypow(x,n-1,m)%m;}
int digisum(int n){int s=0;while(n!=0){s+=n%10;n/=10;}return s;}  //  桁和
int stpow(int n){if(n==0)return 1;int a=1;rep(i,1,n+1)a=a*i%MOD;return a;}
Vi stpowV(){Vi a(100001);a[0]=1;repeq(i,1,100000)a[i]=a[i-1]*i%MOD;return a;}
vector<int> divisor(int n){  //  約数列挙 O(√n)
Vi r;for(int i=1;i*i<=n;i++){if(n%i==0){r.pb(i);if(i*i!=n)r.pb(n/i);}}sort(ALL(r));
return r;}
vector<pair<int,int>> fac(int n) {  //  素因数分解
vector<Pii>r;for(int i=2;i*i<=n;++i){if(n%i)continue;r.emplace_back(i,0);while(n%i==0){
n/=i;r.back().second++;}}if(n!=1)r.emplace_back(n,1);return r;}
bool prime(int n){  //  素数判定
if(n<2)return false;else if(n==2)return true;else if(n%2==0)return false;
double s=sqrt(n);for(int i=3;i<=s;i+=2){if(n%i==0){return false;}}return true;}
Vi primevec(){  //  素数配列
int N=1000000;int l[N];Vi a(0);for(int i=0;i<N;i++){l[i]=1;}for(int i=2;i<sqrt(N);i++){
if(l[i]){for(int j=0;i*(j+2)<N;j++){l[i*(j+2)]=0;}}}for(int i=2;i<N;i++){if(l[i]){
a.pb(i);}}return a;}
int comb(int n, int r){  //  nCr (MOD環境下)
int a=1;for(int i=n;i>n-r;--i){a=a*i%MOD;}for(int i=1;
i<r+1;++i){a=a*mypow(i,MOD-2,MOD)%MOD;}return a%MOD;}



signed main() {
  cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);cout<<fixed<<setprecision(12);
  int N;
  cin >> N;
  string s;
  cin >> s;
  int ans = 1;
  char now,next;
  now = s[0];
  rep(i,i,s.size()){
    if(now == s[i]) continue;
    else {
      ans++;
      now = s[i];
    }
  }
  
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
int QQ(int i,int j){
  int Q;
  Q=i*j;
  return Q;
}
signed main(){
  cin.tie(NULL);
  ios::sync_with_stdio(false);
  int i,j,Q;
  for(i=1;i<=9;i++){
    for(j=1;j<=9;j++){
      Q=QQ(i,j);
      cout<<i<<"x"<<j<<"="<<Q<<'\n';
    }
  }
  return(0);
}



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

int main() {
    int x,y;
    cin>>x>>y;
    string s = "No";
    rep(i,x+1){
        if(i*2+(x-i)*4==y){
            s = "Yes";
        }
    }
    cout<<s<<endl;
}

Measured memory_bytes: 3624
import sys

stdin = sys.stdin

ns = lambda : stdin.readline().rstrip()
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
sys.setrecursionlimit(10 ** 7)

def main():
  s = ns()

  if s == "SUN":
    print(7)
  elif s == "MON":
    print(6)
  elif s == "TUE":
    print(5)
  elif s == "WED":
    print(4)
  elif s == "THU":
    print(3)
  elif s == "FRI":
    print(2)
  elif s == "SAT":
    print(1)

if __name__ == '__main__':
  main()

Measured memory_bytes: 3064
#include<stdio.h>
int main(void){
	int N,m,a,b;
	scanf("%d", &N);
	m=N;
	a=N%10;
	N=N/10;
	b=N%10;
	if(a!=9&&b!=9){
		printf("No\n");
	}
	else if(a==9&&b!=9){
		printf("Yes\n");
	} 
	else {
		printf("Yes\n");
	}
	return 0;
}

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

char S[2000][2000];
int L[2000][2000];
int R[2000][2000];
int U[2000][2000];
int D[2000][2000];
int H, W;

int main() {
  cin >> H >> W;
  for (int i = 0; i < H; ++i) {
    cin >> S[i];
  }

  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      if (S[i][j] == '#') {
        continue;
      }
      else {
        L[i][j] = (j == 0) ? 1 : L[i][j-1]+1;
        U[i][j] = (i == 0) ? 1 : U[i-1][j]+1;
      }
    }
  }
  for (int i = H-1; i >= 0; --i) {
    for (int j = W-1; j >= 0; --j) {
      if (S[i][j] == '#') {
        continue;
      }
      else {
        R[i][j] = (j == W-1) ? 1 : R[i][j+1]+1;
        D[i][j] = (i == H-1) ? 1 : D[i+1][j]+1;
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < H; ++i) {
    for (int j = 0; j < W; ++j) {
      ans = max(ans,
                L[i][j] + U[i][j] + R[i][j] + D[i][j] - 3);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 66688
# 解法 RとLで別々に偶数回とても大きな回数移動させたときにどこに行くかを記録する．
S = input()
import math

count = 0
# まずRについて，調べていく
A = [0 for _ in S]
for i,s in enumerate(S):
    if s == 'L':
        A[i-1] += math.ceil(count/2)
        A[i] += math.floor(count/2)
        count = 0
        continue
    count += 1
count = 0
lenA = len(A)
for i,s in enumerate(S[::-1]):
    if s == 'R':
        A[lenA-i] += math.ceil(count/2)
        A[lenA-i-1] += math.floor(count/2)
        count = 0
        continue
    count += 1
print(' '.join([str(a) for a in A]))


Measured memory_bytes: 17124
#include<algorithm>
#include<cstdio>
#include<cstring>
using namespace std;
int a[200][200],b[200][200],c[1000],d[1000][200],n,m,l;
int fn(int p,int q){
  int i;
  if(p+1==l)
    return 0;
  if(d[p][q])
    return d[p][q];
  int mn=a[c[p]][c[p+1]]+fn(p+1,q);
  for(i=0;i<n;++i){
    if(i!=q&&b[q][i]!=(1<<29))
      mn=min(mn,a[c[p]][q]+b[q][i]+a[i][c[p+1]]+fn(p+1,i));
  }
  return d[p][q]=mn;
}
int main(){
  int i,j,k;
  while(scanf("%d%d",&n,&m),n||m){
    fill(a[0],a[0]+200*200,1<<29);
    fill(b[0],b[0]+200*200,1<<29);
    for(i=0;i<n;++i)
      a[i][i]=b[i][i]=0;
    for(i=0;i<m;++i){
      int p,q,r;
      char s;
      scanf("%d%d%d %c",&p,&q,&r,&s);
      --p;
      --q;
      if(s=='L'){
	if(a[p][q]>r)
	  a[p][q]=a[q][p]=r;
      }else{
	if(b[p][q]>r)
	  b[p][q]=b[q][p]=r;
      }
    }
    for(k=0;k<n;++k){
      for(i=0;i<n;++i){
	for(j=0;j<n;++j){
	  a[i][j]=min(a[i][j],a[i][k]+a[k][j]);
	  b[i][j]=min(b[i][j],b[i][k]+b[k][j]);
	}
      }
    }
    scanf("%d",&l);
    for(i=0;i<l;++i){
      scanf("%d",c+i);
      --c[i];
    }
    memset(d,0,sizeof(d));
    printf("%d\n",fn(0,c[0]));
  }
  return 0;
}

Measured memory_bytes: 1900
#include <algorithm>
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#include <climits>
#include <utility>
#include <deque>
#include <list>
using namespace std;

int main()
{
	cout << fixed << setprecision(6);
	int n;
	cin >> n;
	vector<int> pls(n);
	for (auto& p : pls)cin >> p;

	int cnt = 0;
	for (int i = 0; i < n - 2; ++i) {
		if ((pls[i] > pls[i + 1] && pls[i + 1] > pls[i + 2]) ||
			(pls[i] < pls[i + 1] && pls[i + 1] < pls[i + 2])) {
			++cnt;
		}
	}

	cout << cnt << endl;

	return 0;
}

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


int main(){
  int n;
  cin>>n;
  vector<string>s(n);
  rep(i,n)cin>>s[i];
  sort(s.begin(),s.end());
  vector<int>a(n,1);
  int j=0,M=1;
  rep(i,n-1){
    if(s[i]==s[i+1])a[j]++;
    else j=i+1;
    M=max(M,a[j]);
  }
  rep(i,n){
    if(M==a[i])cout<<s[i]<<endl;
  }
}


Measured memory_bytes: 15104
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <map>
#include <deque>
using namespace std;

#define REP(i,n) for(int i = 0; i < n; i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pi> vpi;
typedef vector<ll> vll;
typedef vector<vll> vvll;

double EPS = 1e-9;
int INFi = 1000000005;
long long INFll = 1000000000000000005ll;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};
ll MOD = 1000000007;

const int MAX_N = 200000;

int par1[MAX_N];
int rk1[MAX_N];

void init1(int n){
  REP(i,n){
    par1[i] = i;
    rk1[i] = 0;
  }
}

int find1(int x){
  if(par1[x] == x){
    return x;
  }else{
    return par1[x] = find1(par1[x]);
  }
}

void unite1(int x, int y){
  x = find1(x);
  y = find1(y);
  if(x==y) return;
  if(rk1[x] < rk1[y]){
    par1[x] = y;
  }else{
    par1[y] = x;
    if(rk1[x] == rk1[y]) rk1[x]++;
  }
}

bool same1(int x, int y){
  return find1(x) == find1(y);
}

int par2[MAX_N];
int rk2[MAX_N];

void init2(int n){
  REP(i,n){
    par2[i] = i;
    rk2[i] = 0;
  }
}

int find2(int x){
  if(par2[x] == x){
    return x;
  }else{
    return par2[x] = find2(par2[x]);
  }
}

void unite2(int x, int y){
  x = find2(x);
  y = find2(y);
  if(x==y) return;
  if(rk2[x] < rk2[y]){
    par2[x] = y;
  }else{
    par2[y] = x;
    if(rk2[x] == rk2[y]) rk2[x]++;
  }
}

bool same2(int x, int y){
  return find2(x) == find2(y);
}

int main(){
  int n, k, l;
  cin >> n >> k >> l;
  int p[k], q[k], r[l], s[l];
  init1(n); init2(n);
  REP(i,k){
    cin >> p[i] >> q[i];
    unite1(p[i]-1, q[i]-1);

  }
  REP(i,l){
    cin >> r[i] >> s[i];

    unite2(r[i]-1, s[i]-1);
  }

  map<pair<int, int>, int>  mp;

  REP(i,n){
    mp[make_pair(find1(i), find2(i))]++;
  }

  REP(i,n){
    cout << mp[make_pair(find1(i), find2(i))] << endl;
  }


  return 0;
}


Measured memory_bytes: 16640
#include <bits/stdc++.h>
#define rep(i, a, b) for(int i = a; i < b; i++)
#define Rep(i, a, b) for(int i = a; i <= b; i++)
#define repr(i, a, b) for(int i = a; i >= b; i--)
#define _GLIBCXX_DEBUG
#define Vl vector<ll>
#define Vs vector<string>
#define Vp vector<pair<ll, ll>>
#define P pair<ll, ll>
#define ld long double
using ll = long long;
#define ALL(v) (v).begin(),(v).end()
#define endl "\n"
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define co(x) cout << x << endl
#define coel cout << endl
#define pb push_back
#define sz(v) ((ll)(v).size())
using namespace std;  
const double pi = acos(-1.0);
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define pp pair<ll, pair<ll, ll>> 
#define fi first
#define se second

void print(Vl vec){
    rep(i, 0, sz(vec)){
        if(i) cout << " ";
        cout << vec[i];
    }
    coel;
}

////////////////////////////////////////////////////////

//暗証番号は1000通り

int main() {
    ll n; string s; cin >> n >> s;
    ll cnt = 0;
    for(char a = '0'; a <= '9'; a++){
        for(char b = '0'; b <= '9'; b++){
            for(char c = '0'; c <= '9'; c++){
                bool f = false, ff = false;
                rep(i, 0, n){
                    if(!f && s[i] == a) f = true;
                    else if(f && !ff && s[i] == b) ff = true;
                    else if(ff && s[i] == c){
                        cnt++; break;
                    }
                }
            }
        }
    }
    co(cnt);

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
int max(int a, int b){
    return (a > b) ? a : b;
}
int main(void){
    int A, B;
    scanf("%d%d", &A, &B);
    printf("%d\n", max(A + B, max(A - B, A * B)));
    return 0; 
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define int long long
main(){
int n;
cin>>n;
int A[n];
int mn = INT_MAX ,mx = -100000000;

for(int i=0 ; i<n ; i++) {
   cin>>A[i];
   mn = min(A[i] , mn);
   mx = max(A[i] , mx);
}

vector<int>vec;

for(int i=mn ; i<=mx ; i++){
    int sum = 0;
    for(int j=0 ; j<n ; j++){
        sum += ((A[j]-i) * (A[j] - i));
    }
    vec.push_back(sum);
}

int ans = vec[0];

for(auto x : vec){
    ans = min(x , ans);
    //cout<<x<<endl;
}

cout<<ans<<endl;
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;

int sum[2][10001], c[2][10001];
vector<int>E[10001], G[10001];
int main() {
	int n, r;
	while (scanf("%d%d", &n, &r), n) {
		memset(sum, 0, sizeof(sum));
		memset(c, 0, sizeof(c));
		rep(i, 10001)E[i].clear(), G[i].clear();
		int h = 0, w = 0;
		rep(i, n) {
			int x1, y1, x2, y2; scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
			h = max(h, x2 + 1); w = max(w, y2 + 1);
			E[x1].push_back(y1); E[x2].push_back(y2);
			G[x1].push_back(y2); G[x2].push_back(y1);
		}
		int a = 0, b = 0;
		rep(i, h) {
			rep(j, w)sum[i & 1][j] = c[i & 1][j] = c[!(i & 1)][j];
			for (int j : E[i])sum[i & 1][j]++, c[i & 1][j]++;
			for (int j : G[i])sum[i & 1][j]--, c[i & 1][j]--;
			for (int j = 1; j < w; j++)sum[i & 1][j] += sum[i & 1][j - 1];
			rep(j, w) {
				if (sum[i & 1][j])a++;
				if (!sum[i & 1][j] != !sum[!(i & 1)][j])b++;
				if (j == 0 && sum[i & 1][j])b++;
				if (j && !sum[i & 1][j] != !sum[i & 1][j - 1])b++;
			}
		}
		printf("%d\n", a);
		if (r == 2)printf("%d\n", b);
	}
}

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

const int nmax = 8;
bool graph[nmax][nmax];

int dfs(int v, int N, bool visited[nmax]) {

  bool all_visited = true;

  for (int i = 0; i < N; ++i) {
    if (visited[i] == false)
      all_visited = false;
  }
  if (all_visited) {
    return 1;
  }
  int ret = 0;
  for (int i = 0; i < N; ++i) {
    if (graph[v][i] == false) continue;
    if (visited[i]) continue;
    visited[i] = true;
    ret += dfs(i, N, visited);
    visited[i] = false;
  }
  return ret;
}

int main(void) {
  int N, M;
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    int A, B;
    cin >> A >> B;
    graph[A - 1][B - 1] = graph[B - 1][A - 1] = true;
  }
  bool visited[nmax];
  for (int i = 0; i < N; ++i) {
    visited[i] = false;
  }
  visited[0] = true;
  cout << dfs(0, N, visited) << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
vector<int>adj[100009];
int dp[100009],n,m,x,y,ans;
int dfs(int x){
    if(dp[x]+1)return dp[x];
    int an=0;
    for(int i=0;i<adj[x].size();i++)
        an=max(an,dfs(adj[x][i]));
    return dp[x]=an+1;
}
int main(){
    memset(dp,-1,sizeof(dp));
    cin>>n>>m;
    for(int i=0;i<m;i++){
        cin>>x>>y;
        adj[x].push_back(y);
    }
    for(int i=1;i<=n;i++){
        ans=max(ans,dfs(i));
    }
    cout<<ans-1;
}

Measured memory_bytes: 8192
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> 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 mod 998244353
#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())
int n,m;
vector<int>G[100005];
vector<int>edge[100005];
vector<P>vec;
int dep[100005];
bool used[100005];
void dfs(int v,int d){
	if(used[v]) return ;
	used[v] = 1; dep[v] = d;
	for(int i=0;i<G[v].size();i++){
		int to = G[v][i];
		if(used[to] && dep[to] < dep[v]-1){
			vec.pb(mp(v,to)); //cout << v << " " << to << endl;
			continue;
		}else if(used[to]) continue;
		edge[v].pb(to); //cout << v << " " << to << endl;
		dfs(to,d+1);
	}
}
void dfss(int v,int d){
	dep[v] = d;
	for(int i=0;i<edge[v].size();i++){
		dfss(edge[v][i],d+1);
	}
}
vector<P>ans;
int par[100005];

void make(int v,int u){
	for(int i=0;i<edge[v].size();i++){
		make(edge[v][i],v);
	}
	if(u == -1) return;
	if(par[v] == 0){
		par[u]^=1;
		ans.pb(mp(u,v)); //cout << u << " " << v << endl;
	}
	else{
		par[v]^=1;
		ans.pb(mp(v,u)); //cout << v << " " << u << endl;
	}
}
int main(){
	scanf("%d%d",&n,&m);
	if(m%2 == 1){
		puts("-1");
		return 0;
	}
	for(int i=0;i<m;i++){
		int a,b; scanf("%d%d",&a,&b);
		G[a].pb(b);
		G[b].pb(a);
	}
	dfs(1,0);
	dfss(1,0);
	assert(vec.size() == m-n+1);
	for(int i=0;i<vec.size();i++){
		int x = vec[i].fi, y = vec[i].sc;
		if(dep[x] > dep[y]) swap(x,y);
		ans.pb(mp(x,y)); //cout << x << " " << y << endl;
		par[x]^=1;
	}
	make(1,-1);
	repn(i,n) assert(par[i] == 0);
	rep(i,ans.size()){
	    cout << ans[i].fi << " " << ans[i].sc << endl;
	//	printf("%d %d\n",ans[i].fi,ans[i].sc);
	}
}

Measured memory_bytes: 24308
#include "bits/stdc++.h"
using namespace std;

int main() {
	long long N, ANS = 1, MOD = 1000000007;
	string S;
	cin >> N >> S;
	S = 'W' + S + 'W';
	vector<long long> V1, V2;
	V1.resize(N * 2 + 1);
	V2.resize(N * 2);
	for (int i = 0; i < N * 2 + 1; i++) {
		if (S[i] == S[i + 1]) V1[i] = 0;
		else V1[i] = 1;
	}
	for (int i = 0; i < N * 2; i++) {
		if (V1[i] == 0) {
			V2[i] = 0;
			V1[i + 1] = V1[i + 1] ^ 1;
		}
		else {
			V2[i] = 1;
		}
	}
	long long Cur = 0;
	for (int i = 0; i < N * 2; i++) {
		if (V2[i] == 0) {
			if (Cur == 0) {
				cout << 0 << endl;
				return 0;
			}
			ANS *= Cur;
			ANS %= MOD;
			Cur--;
		}
		else {
			Cur++;
		}
	}
	if (Cur != 0) {
		cout << 0 << endl;
		return 0;
	}
	for (int i = 1; i <= N; i++) {
		ANS *= i;
		ANS %= MOD;
	}
	cout << ANS << endl;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <random>
using namespace std;
#define ll long long
#define fr first
#define sc second
#define pll pair<ll, ll>
#define all(v) v.begin(), v.end()

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N; cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; i++) cin >> v[i];
	sort(all(v));

	int cnt = 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 (v[i] != v[j] && v[j] != v[k] && v[i] != v[k] && v[i] + v[j] > v[k])
					cnt++;
	cout << cnt << '\n';
	return 0;
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long int a,b,d=1;
  cin>>a;
  int c=1;
  for(int i=0;i<a;i++){
    cin>>b;
    if(b%2==0)d*=2;
    c*=3;
  }
  cout<<c-d;
}

Measured memory_bytes: 256
n,m,x=map(int,input().split())
A=[list(map(int,input().split())) for _ in range(n)]

ans=10**10
for i in range(2**n):
    num=format(i,"b").zfill(n)
    C=[0 for _ in range(m)]
    point=0
    for j,k in enumerate(num):
        if k=="1":
            c,B=A[j][0],A[j][1:]
            for v,s in enumerate(B):
                C[v] +=s
            point +=c
    flag=1
    for i in range(m):
        if C[i]>=x:continue
        else:
            flag=0
            break
    if flag:ans=min(ans,point)
print(ans if ans!=10**10 else -1)

Measured memory_bytes: 69368
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef long double ld;
const double pi=acos(-1.0);
const ll mod=pow(10,9)+7;
const ll INF=pow(2,31)-1;
typedef pair<int,int> P;
typedef vector<int> vi;

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

ll gcd(ll a , ll b){
	if(b == 0) return a;
	return gcd(b , a % b);	
}
ll lcm(ll a , ll b){
	ll g = gcd(a , b);
	ll lc = (a/g) * b;
	return lc;
}

int main(){
    ios::sync_with_stdio(false);
    char a;
    cin >> a;
    if(isupper(a)) cout << 'A' << endl;
    else cout << 'a' << endl;
    return 0;
}

Measured memory_bytes: 3632
// Sky's the limit :)
#include <bits/stdc++.h>
using namespace std;
#define int long long

signed main() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    int T = 1; 
    // cin >> T; 
    while (T--) {
        int n, k;
        cin >> n >> k;
        int a[n + 1];
        for(int i = 1; i <= n; i++)
            cin >> a[i];

        int curr = 1;
        vector<int> v;
        v.push_back(curr);
        
        int t = 0, sz;
        map<int, int> mp;
        mp[1] = t++;
        
        while(true) {
            curr = a[curr];
            if(mp.find(curr) != mp.end()) {
                sz = t - mp[curr];
                break;
            }
            v.push_back(curr);
            mp[curr] = t++;
        }

        // cout << sz << '\n';
        // for(auto x : v)
        //     cout << x << ' ';
        // cout << '\n';

        n = v.size();
        if(k < n)
            cout << v[k] << '\n';
        else {
            k -= (n - sz);
            cout << v[n - sz + (k % sz)] << '\n';
        }
        
    }
    
    return 0;
}



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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  vector<int> v(m);
  REP(i, m) {
    cin >> v[i];
  }

  sort(v.begin(), v.end(), greater<int>());

  vector<int> w;
  REP (i, m - 1) {
    w.push_back(abs(v[i] - v[i + 1]));
  }

  sort(w.begin(), w.end(), greater<int>());

  LL ans = 0;
  FOR (i, n - 1, m - 1) {
    ans += w[i];
  }

  cout << ans << endl;
}


Measured memory_bytes: 1276
#include <stdio.h>

int main(void)
{
    int  x, y, t, i;
	
	while (scanf("%ld %ld", &x, &y), x || y){
		if (x < y){
			t = x;
			x = y;
			y = t;
		}
		i = 0;
		while (y){
			t = x % y;
			x = y;
			y = t;
			i++;
		}
		printf("%ld %ld\n", x, i);
	}
	
	return (0);
}

Measured memory_bytes: 600
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

int main(void) {
	int N, i, tmp, sum, cost, average;
	double _average;
	vector<int> a;
	// get input -----------------------------
	cin >> N;
	sum = 0;
	for (i = 0; i < N; i++) {
		cin >> tmp;
		sum += tmp;
		a.push_back(tmp);
	}
	// get average ----------------------------
	_average = (double)sum / N;
	average = (int)round(_average);
	// calc cost -----------------------------
	cost = 0;
	for (i = 0; i < N; i++) {
		cost += (a[i] - average) * (a[i] - average);
	}
	// disp answer --------------------------
	cout << cost << endl;
	return 0;
}



Measured memory_bytes: 256
#!/usr/bin/env python3
from fractions import Fraction
import sys


def g():
    i = 1
    while True:
        si = str(i)
        ni = min({
            int(si[:j] + "9" * (len(si) - j))
            for j in range(len(si) + 1)
        }, key=lambda a: (Fraction(a, sum(int(x) for x in str(a))), a))
        yield ni
        i = ni + 1


def solve(K: int):
    it = g()
    for i in range(K):
        print(next(it))


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    K = int(next(tokens))  # type: int
    solve(K)


if __name__ == '__main__':
    main()


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


int main()
{
ll k,n,sum=0,i,j;
cin>>n>>k;
ll arr[n];
for(i=0;i<n;i++)
{
  cin>>arr[i];
  
}
sort(arr,arr+n);

for(i=0;i<n-k;i++)
{
  sum+=arr[i];
}
cout<<sum<<endl;




return 0;

}

Measured memory_bytes: 1792
MOD = 10 ** 9 + 7
n = int(input())

memo = [{} for _ in range(n + 1)]

def ok(last4):
    for i in range(4):
        t = list(last4)
        if i >= 1:
            t[i - 1], t[i] = t[i], t[i - 1]
        if ''.join(t).count('AGC') >= 1:
            return False
    return True

def dfs(cur, last3):
    if last3 in memo[cur]:
        return memo[cur][last3]
    if cur == n:
        return 1
    ret = 0
    for c in 'AGCT':
        if ok(last3 + c):
            ret += dfs(cur + 1, last3[1:] + c)
            ret %= MOD
    memo[cur][last3] = ret
    return ret 

print(dfs(0, 'XXX'))

Measured memory_bytes: 75952
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>

using namespace std;

int main() {
    string A, B, C;
    
    cin >> A >> B >> C;

    int size_A = A.size();
    int size_B = B.size();

    if ((A[size_A - 1] == B[0]) && (B[size_B - 1] == C[0])) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
   int a,b,i;
   scanf("%d%d",&a,&b);

   if((a==b) || (a<b)){
   }else {i=a; a=b; b=i;}

   for(i=0;i<b;i++)
      printf("%d",a);
   printf("\n");

   return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map> 
#include <map> 
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
#include <bitset>
using namespace std;
typedef long long LL;

int main(void) {
	LL n, a, b;

	cin >> n >> a >> b;

	cout << min(n*a, b) << endl;


	return 0;
}

Measured memory_bytes: 256
using System;

class program
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int lpoint = 0, rpoint = 0;

        for (int i = 0; i < n; i++)
        {
            var str = Console.ReadLine().Split(' ');
            var left = str[0];
            var right = str[1];

            if (left.CompareTo(right) > 0)
            {
                lpoint += 3;
            }
            else if (left.CompareTo(right) == 0)
            {
                lpoint++;
                rpoint++;
            }
            else
            {
                rpoint += 3;
            }
        }

        Console.WriteLine("{0} {1}", lpoint, rpoint);
    }
}

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

bool is_prime(int n){
    for(int i=2; i*i<=n; i++){
        if(n%i==0){
            return false;
        }
    }
    return true;
}

int main(){
    int n;
    cin >> n;
    int l, i = 0, a[n];
    while (cin >> l) {
        a[i] = l;
        i++;
        if (i >= n) {
            break;
        }
    }
    int count =0;
    for (int j = 0; j<n; j++){
        if (is_prime(a[j])){
            count ++;
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 3116
using System;
using System.Linq;//リストの使用
using System.Collections.Generic;
using System.Text;//テキストの高速出力に必要
class Program
{
	static void Main()
	{
		string[] input = Console.ReadLine().Split(' ');
		long l = long.Parse(input[0]);
		long r = long.Parse(input[1]);
		long answer = 2019;

    for(long i = l; i <= Math.Min(l+3000,r-1); i++)
    {
      for(long j = i+1; j <= Math.Min(i+3000,r); j++)
      {
        answer = Math.Min(answer, (i*j)%2019);
      }
    }

		Console.WriteLine(answer);
	}
}

Measured memory_bytes: 11092
a, b = (int(x) for x in input().split())
aa = int(min(a/0.08, b/0.1))
bb = int(max(a/0.08, b/0.1))
ans = -1
for c in range(1500):
    if int(c*0.08) == a and int(c*0.1) == b:
        ans = c
        break
print(ans)


Measured memory_bytes: 38512
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();

        char[] arr = sc.next().toCharArray();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = Character.getNumericValue(arr[i]);
        }
        int ans = 0;
        for (int i = 0; i < 10; i++) {
            for (int j = 0; j < 10; j++) {
                for (int k = 0; k < 10; k++) {
                    boolean jb = false;
                    boolean kb = false;
                    for (int m = 0; m < n; m++) {
                        if(kb){
                            if(jb){
                                if(a[m] == i){
                                    ans++;
                                    break;
                                }
                            }else{
                                if(a[m] == j) jb = true;
                            }
                        }else{
                            if(a[m] == k)kb = true;
                        }
                    }
                }
            }
        }
        System.out.println(ans);
        sc.close();

    }

}


Measured memory_bytes: 22228
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+10;
int a[maxn];
int b[maxn];

int main()
{
     int n;
   string s;
   cin>>s;
   int sum=0;
   n=s.size();
   for(int i=0;i<n;i++)
            {
                if(s[i]=='o')
                    sum++;
            }
            if(sum+(15-n)>=8)
                puts("YES");
            else
                puts("NO");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(v) (v).begin(), (v).end()
typedef long long int lint;
using namespace std;

int main() {
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        while (a % 2 == 0) {
            a /= 2;
            ans++;
        }
    }
    cout << ans << endl;
}

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

int main()
{
    int n, ans=0;
    map<long long, long long> mp;
    scanf("%d",&n);
    for(int i = 0; i < n; i++)
    {   long long x;
        scanf("%lli",&x);
        mp[x]++;
    }

    for(auto it = mp.begin(); it != mp.end(); it++)
    {
        //cout << it->first <<" "<< it->second<<"\n";
        if((it->second) > 0)
            ans += (it->second)%2;
    }
    printf("%d\n",ans);
    return 0;
}


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

#define int long long

#define REP(i, a) for(int i = 0; i < (a); i++)

using namespace std;

signed main()
{
    cout << fixed << setprecision(10);

    while(true)
    {
        int H, W; cin >> H >> W;
        if(H == 0 && W == 0) break;
        REP(i, H)
        {
            REP(j, W)
            {
                if(i == 0 || i == H-1 || j == 0 || j == W-1) cout << '#';
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;
    }
}


Measured memory_bytes: 3092
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
using namespace std;
#pragma warning (disable: 4996)

int N, M, X;
int C[14], A[14][14];

int main() {
	cin >> N >> M >> X;
	for (int i = 0; i < N; i++) {
		cin >> C[i];
		for (int j = 1; j <= M; j++) cin >> A[i][j];
	}

	int minx = (1 << 30);
	for (int i = 0; i < (1 << N); i++) {
		int r[14]; for (int j = 0; j < 14; j++) r[j] = 0;

		int price = 0;
		for (int j = 0; j < N; j++) {
			if ((i / (1 << j)) % 2 == 0) continue;
			price += C[j];
			for (int k = 1; k <= M; k++) r[k] += A[j][k];
		}
		
		bool flag = false;
		for (int j = 1; j <= M; j++) {
			if (r[j] < X) flag = true;
		}
		if (flag == false) minx = min(minx, price);
	}

	if (minx == (1 << 30)) cout << "-1" << endl;
	else cout << minx << endl;
	return 0;
}

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

int main()
{
    int a, b, c;
    cin >> a >> b >> c;
    if (a > b) {
        swap(a, b);
    }
    if (b > c) {
        swap(b, c);
    }
    if (a > b) {
        swap(a, b);
    }
    cout << a << " " << b << " " << c << endl;

    return 0;
}



Measured memory_bytes: 3104
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define pi 3.141592653589793
#define debug(x) cout << #x << " = " << x << '\n';
using namespace std;



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


    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int j = 0; j < n; j++) cin >> b[j];


    vector<int> c(n);
    for (int i = 0; i < n; i++) {
        c[i] = i + 1;
    }

    int aa = 0, bb = 0;
    int fact[n + 1];
    fact[0] = 1;
    for (int i = 1; i < n + 1; i++) fact[i] = fact[i - 1] * i;
    for (int i = 0; i < fact[n]; i++) {
        if (c == a) aa = i;
        if (c == b) bb = i;
        next_permutation(c.begin(), c.end());
    }

    cout << abs(aa - bb);

}

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

int main() {

    long long int n;
    cin >> n;

    long long int ans = n - 1;
    for ( long long int i = 2; i * i <= n; i++ ) {
        if ( ( n % i ) != 0 ) continue;
        ans = min( ans, n / i + i - 2 );
    }

    cout << ans << endl;

    return 0;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
//#include<tr1/unordered_map>
#pragma GCC optimize ("Ofast")
#define ll long long
#define pll pair<long long,long long>
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forn(i, n) for(int i=0; i<int(n); i++)
#define Forn(i, n) for(int i=1; i<=int(n); i++)

using namespace std;

const int inf = 1000000009;

int n, m;
int pr[1010];
int unlock[1010];

int dp[5010][1010];
bool memo[5010][1010];

int f(int mask, int y)
{
    if(y == m)
    {
        if(mask == 0) return 0;
        return inf;
    }
    if(mask == 0) return 0;

    if(memo[mask][y]) return dp[mask][y];
    int ans = 0;
    int cur = unlock[y];
    int rem = mask - (mask & cur);
    ans = min(f(mask, y+1), pr[y] + f(rem, y+1));

    memo[mask][y] = 1;
    dp[mask][y] = ans;
    return ans;
}

int main()
{
    cin.tie(0); ios_base::sync_with_stdio(false);
    cin >> n >> m;
    forn(i, m)
    {
        int x;
        cin >> x;
        pr[i] = x;
        int num = 0;
        int y;
        cin >> y;
        forn(ii, y)
        {
            int k;
            cin >> k;
            num += (1<<(k-1));
        }
        unlock[i] = num;
    }
    int ans = f((1<<n)-1, 0);
    if(ans >= inf)
    {
        cout << -1 << endl;
    }
    else cout << ans << endl;

}


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

struct SegmentTree {
  vector< int > seg, add;
  int sz;
  SegmentTree(int n)
  {
    sz = 1;
    while(sz < n) sz *= 2;
    seg.assign(sz * 2 + 1, 0), add.assign(sz * 2 + 1, 0);
  }
  void Add(int a, int b, int x, int k, int l, int r)
  {
    if(a >= r || b <= l) {
      return;
    } else if(a <= l && r <= b) {
      add[k] += x;
    } else {
      Add(a, b, x, 2 * k + 1, l, (l + r) / 2);
      Add(a, b, x, 2 * k + 2, (l + r) / 2, r);
      seg[k] = seg[2 * k + 1] + add[2 * k + 1] + seg[2 * k + 2] + add[2 * k + 2];
    }
  }
  int Query(int a, int b, int k, int l, int r)
  {
    if(a >= r || b <= l) return(0);
    if(a <= l && r <= b) return(seg[k] + add[k]);
    return(Query(a, b, 2 * k + 1, l, (l + r) / 2) + Query(a, b, 2 * k + 2, (l + r) / 2, r) + add[k]);
  }
  void Add(int a, int b, int x)
  {
    Add(a, b, x, 0, 0, sz);
  }
  int Query(int a, int b)
  {
    return(Query(a, b, 0, 0, sz));
  }
};


int main()
{
  int N, M, P[100000];
  scanf("%d %d", &N, &M);
  SegmentTree segtree(N);
  for(int i = 0; i < M; i++) {
    scanf("%d", &P[i]);
    --P[i];
  }
  for(int i = 1; i < M; i++) {
    int u = min(P[i - 1], P[i]), v = max(P[i - 1], P[i]);
    segtree.Add(u, v, 1);
  }
  long long ret = 0;
  for(int i = 0; i < N - 1; i++) {
    long long used = segtree.Query(i, i + 1);
    int A, B, C;
    scanf("%d %d %d", &A, &B, &C);
    ret += min(used * A, C + used * B);
  }
  cout << ret << endl;
}

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

using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,n,m) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define VEC2(x,a,b) vector<vector<ll>> x = vector<vector<ll>>(a,vector<ll>(b,0))
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cinv(v,n,m) FOR(i,n,m) cin>>v.at(i)
#define coutv(v,n,m) FOR(i,n,m) cout<<v.at(i) <<" "; cout<<endl
#define cout(n) cout<<fixed<<setprecision(n)

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

    ll k,a,b;
    cin>>k>>a>>b;

    if(a+1>=b || k<=a) cout<<k+1<<endl;
    else{
      k = k - a + 1;
      ll res = a;
      res += k%2;
      res += (k/2)*(b-a);
      cout<<res<<endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	ll t=1;
	//cin>>t;
	while(t--){
		ll n,k;
		string s;
		cin>>n>>k>>s;
		for(int i=0;i<n;i++){
			if(i!=k-1){
				cout<<s[i];
			}
			else{
				if(s[i]=='A'||s[i]=='B'||s[i]=='C')
				cout<<char(s[i]-'A'+97);
				else
					cout<<s[i];
			}
		}
		cout<<endl;
	}
}

Measured memory_bytes: 256