akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int         long long
#define endl        "\n"

const int mod = 1e9+7;

inline int add(int a, int b) { int res = a + b; if(res >= mod) res -= mod;  return res; }
inline int sub(int a, int b) { int res = a - b; if(res < 0) res += mod; return res;}
inline int mul(int a, int b) { return (a * b)%mod; }

void solve() {
    string s; cin >> s;
    if(s[0]=='7' or s[1] == '7' or s[2] == '7') {
        cout << "Yes" << endl;
        return;
    }
    cout << "No" << endl;
}

signed main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(12);

    int T = 1;
    //cin >> T;

    while(T--) {
        solve();
    }
    return 0;
}

Measured memory_bytes: 3640
while True:
    n, x = map(int, input().split())
    cnt = 0
    if n == x == 0:
        break
    if x >= 6:
        for a in range(1, n - 1):
            for b in range(a + 1, n):
                for c in range(b + 1, n + 1):
                    if a + b + c == x:
                        cnt += 1
    print(cnt)



Measured memory_bytes: 5596
from itertools import combinations_with_replacement
N, M, Q = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
for pattern in combinations_with_replacement(range(1, M + 1), N):
    tmp_ans = 0
    pattern = list(pattern)
    for a, b, c, d in X:
        if pattern[b - 1] - pattern[a - 1] == c:
            tmp_ans += d
    ans = max(ans, tmp_ans)

print(ans)


Measured memory_bytes: 9060
#include <bits/stdc++.h> 
using namespace std;
///////////////////////////////////////////
const long long int INF = INT32_MAX;
const long long int Mod = 1000000007;
const long long int mod = 100000;//10^5
using ll = long long int; //long long int は64bit
using ci = const int; using vi = vector<int>; using Vi = vector<long long int>; using pii = pair<int,int>;
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define rep(i,N) for(int i=0;i<N;i++)
#define np nullptr
template<class T>bool chmax(T &former, const T &b) { if (former<=b) { former=b; return true; } return false; }
template<class T>bool chmin(T &former, const T &b) { if (b<former) { former=b; return true; } return false; }
template<class T>T sqar(T x){ return x*x; }//sqrt(x)は平方根;
#define Sort(v) std::sort(v.begin(), v.end(), std::greater<decltype(v[0])>()) //降順でVをソート
#define fill(x,num) memset(x,num,sizeof(x));
typedef vector<vector<ll> > matrix;
//       cin.tie(0);ios::sync_with_stdio(false);
void cinit(){cin.tie(0);ios::sync_with_stdio(false);}
//////////////////////////^^ *Emile ^^^//////////////////////////////////////////////////////

ll n;
Vi v;

void down(int l,int r,int num){
	for(int i=l;i<=r;i++){
		v[i]-=num;
	}
}

int main(){
	cin>>n;ll aa;ll minm=101;
	rep(i,n){
		cin>>aa;
		v.pb(aa);
		//chmin(minm,aa);
	}
	ll ans = 0;
	//ans++;
	//cout<<"a"<<endl;
	int l,r;
	while(1){
		l=0;r=0;
		rep(i,n){
			if(v[i]!=0){l=i;break;}
			if(i==n-1)l=i;
		}
		if(l==n-1 && v[l]==0)break;
		for(int i=l;i<n;i++){
			if(v[i]==0){r=i-1;break;}
			else if(i==n-1){
				r=i;
			}
		}
		if(l==n-1 && v[l]==0)break;
		minm=101;
		for(int i=l;i<=r;i++){
			chmin(minm,v[i]);
		}
		down(l,r,minm);
		ans += minm;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
 
main(){
 int a,b;
 scanf("%d%d",&a,&b);
 
 if(-1000<=a&&b<=1000){
 if(a<b){
 	printf("a < b\n");
 }	
 else if(a>b){
 	printf("a > b\n");
 }
 else if(a==b){
 	printf("a == b\n");
 }
}
 return 0;
}

Measured memory_bytes: 1008
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	
	if((abs(a-b)<=d && abs(b-c)<=d) || abs(a-c)<=d){
	    cout<<"Yes";
	}else{
	    cout<<"No";
	}
	return 0;
}


Measured memory_bytes: 3600
#include <stdio.h>
#include <algorithm>
int n;
long long x;
char s[100000][15];
long long a[100000];
long long ans;
int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%s", s[i]);
		std::sort(s[i], s[i] + 10);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 10; j++) {
			a[i] *= 26;
			a[i] += s[i][j] - 'a';
		}
	}
	std::sort(a, a + n);
	x = 1;
	for (int i = 1; i < n; i++) {
		if (a[i] == a[i - 1])x++;
		else {
			ans += x * (x - 1) / 2;
			x = 1;
		}
	}
	ans += x * (x - 1) / 2;
	printf("%lld\n", ans);
}

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

int min(int a,int b){
    return a>b ? b : a;
}

int max(int a,int b){
    return a<b ? b :a;
}

int abs(int a){
    return a< 0 ? -a : a;
}

int main(){
    int k,d,dig[1000000],i,j,sum;

    cin >> k;

    d=1;
    dig[0]=0;
    while(k){
        i=0;
        while(d!=i+1){
            if(dig[i]!=9 && dig[i]-1!=dig[i+1])break;
            dig[i]=0;
            i++;
        }
        dig[i]++;
        if(dig[d-1]==10){
            dig[d]=1;
            dig[d-1]=0;
            d++;
            i++;
        }
        for(j=1;j<10 && i-j>=0;j++)dig[i-j]=max(dig[i-j+1]-1,0);
        k--;
      
/*        for(i=d-1;i>=0;i--)cout << dig[i];
        cout << endl;
*/    }

    for(i=d-1;i>=0;i--)cout << dig[i];
    cout << endl;

    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
	int N,K;
	scanf("%d\n%d", &N,&K);
	int start = 1;
	while(N--){
		int A= start*2;
		int B= start+K;
		start = A>B?B:A;
	}
	printf("%d\n",start);
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define LL long long
#define REP(i,n) for(int i=0;i<(n);++i)
#define PER(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define PII pair<int,int>
#define PLI pair<long long, int>
#define PLL pair<long long, long long>
#define MOD ((LL)998244353) 
#define INF ((int)1e9+7)
#define INFLL ((LL)1e18)
#define ALL(x) (x).begin(),(x).end()
#define BIT(x) (1LL << (x))
#define int long long
using namespace std;

LL modinv(LL a){
	LL b = MOD, u = 1, v = 0;
	while(b){
		LL t = a / b;
		a -= t * b;swap(a, b);
		u -= t * v;swap(u, v);
	}
	u%=MOD;
	if(u < 0) u += MOD;
	return u;

}
LL exp(LL a, LL b){
	LL res = 1;
	LL sum = a;
	while(b){
		if(b&1)res = (res * sum) % MOD;
		sum = (sum * sum) % MOD;
		b>>=1;
	}
	return res;
}

LL factorial(LL x){
	if(x<=1){
		return 1;
	}
	return x * factorial(x-1) % MOD;
}

int N;
vector<LL> A, B;

LL getnum(int p){
	int pm = p==0?N-1:p-1;
	int pp = p+1==N?0:p+1;
	return B[pm] + B[pp];
}

LL getmax(int p){
	int pm = p==0?N-1:p-1;
	int pp = p+1==N?0:p+1;
	return max(B[pm], B[pp]);
}

signed main(){
	cin >> N;
	A.resize(N);
	B.resize(N);
	foreach(i, A)cin>>i;
	foreach(i, B)cin>>i;
	priority_queue<PLL> que;
	REP(i, N){
		if(A[i]==B[i])continue;
		que.push(PLL(B[i], i));
	}
	LL ans = 0;
	while(!que.empty()){
		PLL d = que.top();
		que.pop();
		if(d.first != B[d.second])continue;
		LL time = max(1LL, (B[d.second]-max(A[d.second], getmax(d.second)))/getnum(d.second));
		B[d.second] -= time * getnum(d.second);
		if(B[d.second]<A[d.second]){
			cout << -1 << endl;
			return 0;
		}
		ans += time;
		if(A[d.second]==B[d.second])continue;
		que.push(PLL(B[d.second], d.second));
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 9584
#!/usr/bin/env python3
from heapq import heappush, heappushpop

N = int(input())
A = list(map(int, input().split()))

pq1 = []
pq2 = []
for i in range(N):
    heappush(pq1, A[i])
    heappush(pq2, -A[-i - 1])

acc1 = [sum(pq1)] * (N + 1)     # acc1 > 0
acc2 = [sum(pq2)] * (N + 1)     # acc2 < 0
for (i, a) in enumerate(A[N:2 * N]):
    acc1[i + 1] = acc1[i] + a - heappushpop(pq1, a)
for (i, a) in enumerate(A[N:2 * N][::-1]):
    acc2[-i - 2] = acc2[-i - 1] + (-a) - heappushpop(pq2, -a)

ans = float('-inf')
for x, y in zip(acc1, acc2):
    ans = max(ans, x - (-y))

print(ans)


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

int main() {
    string S;
    cin >> S;
    int cnt=0;
    int ans = 0;
    for (int i=0; i<=2; i++) {
        if (S.at(i)=='R') cnt++;
        else {
            ans = max(cnt, ans);
            cnt=0;
        }
    }
    ans = max(cnt, ans);
    cout << ans;
}

Measured memory_bytes: 3636
n,c=map(int,input().split())
D=[list(map(int,input().split())) for _ in range(c)]
Grid=[list(map(int,input().split())) for _ in range(n)]
Counter=[[0]*c for _ in range(3)]
for i in range(n):
    for j in range(n):
        Counter[(i+j)%3][Grid[i][j]-1]+=1

Cost=[[0]*c for _ in range(3)]
for i in range(3):
    for j in range(c):
        for k,cnt in enumerate(Counter[i]):
            Cost[i][j]+=D[k][j]*cnt
ans=float('inf')
for i in range(c):
    for j in range(c):
        for k in range(c):
            if i==j or j==k or k==i:
                continue
            ans=min(ans,Cost[0][i]+Cost[1][j]+Cost[2][k])
print(ans)

Measured memory_bytes: 44124
#include <iostream>
#include <numeric> //For gcd()
#define ll long long int
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define fo(i, n) for (int i = 0; i < n; ++i)
#define foe(i, n) for (int i = 1; i <= n; ++i)
#define Fo(i, k, n) for (int i = k; i < n; ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++(i))
#define vi vector<int>
#define vll vector<ll>
#define vvl vector<vector<ll>>
#define vpll vector<pair<ll, ll>>
#define MOD 998244353
#define MAX 1024
using namespace std;
using pi = pair<ll, ll>;

int32_t main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll s,w;
	cin>> s>> w;
	if(w >= s){
		cout<<"unsafe"<<endl;
	} else cout<<"safe"<<endl;
}

Measured memory_bytes: 3124
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

int main() {
    ll N, X;
    cin >> N >> X;
    V<ll> L(N);
    for(ll &e : L) cin >> e;
    ll now = 0;
    ll ans = 1;
    for(ll i = 0; i < N; i++) {
        now += L[i];
        if(now > X) break;
        ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100001];
int main(){
	string s;
	cin>>s;
	int n=s.length();
	for(int i=0;i<n;i++)a[i]=1;
	for(int i=0;i<n;i++){
		int j=i,k=i;
		if(s[i]=='R'){
			while(s[j]==s[j+1])j++;
			for(;i<=j;i++)a[i]--,a[j+(j-i)%2]++;
		}
	}
	for(int i=n-1;i>=0;i--){
		int j=i;
		if(s[i]=='L'){
			while(s[j]==s[j-1])j--;
			for(;i>=j;i--)a[i]--,a[j-(i-j)%2]++;
		}
	}
	for(int i=0;i<n;i++)printf("%d ",a[i]);
}

Measured memory_bytes: 1024
/**
 *    author:  whohet
 *    created: 11-07-2020 17:31:17
**/

#include<bits/stdc++.h>
#define fasterthanlight ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define test int T; cin>>T; while(T--)
#define endl "\n"
#define int long long
#define vi vector<int>
#define pb push_back
#define mod 1000000007
#define MAX 1e9
#define MIN -1e9
#define hi "visited\n" //sasta debugging
using namespace std;

signed main()
{
	fasterthanlight;
	int n;
	cin >> n;
	int arr[n + 1];
	int ans = 0;
	for (int i = 1; i <= n; i++)
	{
		cin >> arr[i];
		if (arr[i] % 2 == 1 && i % 2 == 1)
			ans++;
	}
	cout << ans;



	//cout << "\n\n"<<"Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " seconds.\n";
	return 0;
}


Measured memory_bytes: 3680
#include<bits/stdc++.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main(){
    int n;
    cin >> n;
    int p[n];
    int ans=0;
    for(int i=0;i<n;i++)cin >> p[i];
    for(int i=1;i<n-1;i++){
        if((max(p[i-1],p[i])==p[i] && max(p[i],p[i+1])!=p[i]) || (max(p[i+1],p[i])==p[i] && max(p[i],p[i-1])!=p[i]))
        ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <stack>
using namespace std;
typedef long long LL;
stack <LL> num;
int pre[300];
char str[100];
void calc (char op) {
     int u = num.top(); num.pop();
     int v = num.top(); num.pop();
     if (op == '+')
        num.push(u+v);
     else if (op == '*')  
        num.push(u*v) ;   
}
LL solve1 (void) {
   int n = strlen(str);
   while ( !num.empty() )
        num.pop();
   stack <char> stk;
   for (int i=0;i<n;++i) 
       if ('0'<= str[i] && str[i]<='9')
          num.push(str[i]-'0');
       else {
          while ( !stk.empty() && pre[stk.top()] > pre[str[i]] ) {
                calc (stk.top());
                stk.pop();  
          }
          stk.push(str[i]);
       }   
   while ( !stk.empty() ) {
         calc(stk.top());
         stk.pop();
   }
   return num.top();      
}
LL solve2 (void) {
   LL sum = str[0]-'0';
   int n = strlen(str);
   for (int i=1;i<n;++i)
      if (str[i] == '+')
        sum += str[i+1]-'0';
      else if ( str[i]=='*' )
        sum *= str[i+1]-'0';
   return sum;        
}
int main(void) {
    int bod_ans;
    pre['+'] = 1;
    pre['*'] = 2;
    while ( scanf("%s",str)==1 ) {
          scanf ("%lld",&bod_ans); 
          LL ans1 = solve1();
          LL ans2 = solve2();
          if (ans1 == bod_ans && ans2 == bod_ans)
            puts("U");
          else if (ans1 == bod_ans)
            puts("M");
          else if (ans2 == bod_ans)
            puts("L");
          else
            puts("I");
    }
    return 0;
}

Measured memory_bytes: 1176
n,y=gets.split.map(&:to_i)
r=->mnus,k{mnus.map{|mnu|m,n,u=mnu;(0..(m<n/k ?m:n/k)).map{|i|[m-i,n-k*i,[*u,i]]}}.flatten(1)}
puts r[r[[[n,y,[]]],10000],5000].find{|v,w,u|(1000*v==w)&&(break [*u,v])}&.join(' ') || '-1 '*3

Measured memory_bytes: 252412
#include<bits/stdc++.h>
using namespace std;
int main(){
    int A, B, C, D, N, ans=0;
    vector<int> V(3);
    char tmp1, tmp2;
    string S;
    bool flag=true;
    
    cin >> A >> B >>C;

    if(abs(B-A) >abs(C-A))
    	puts("B");
    else
    	puts("A");

    // string S;
    // cin >>S;
    // cout << S + "pp"<<endl;
    // if(A+B==C || B+C==A || C+A==B)
    // 	puts("Yes");
    // else
    // 	puts("No");
}


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

int main() {
    int answer = 0;
    int n;
    cin >> n;
    vector<int> p(n);
    for (int i = 0; i < n; i++) cin >> p[i];

    for (int i = 1; i < n - 1; i++) {
        if ((p[i] < p[i + 1] && p[i - 1] < p[i]) ||
            (p[i] > p[i + 1] && p[i - 1] > p[i]))
            answer += 1;
    }

    cout << answer << endl;
}


Measured memory_bytes: 256
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <bits/stdc++.h>

#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define mod 1000000007
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define FOR(i, x, y) for (int i = x; i <= y; i++)
//#define tr(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)

//using namespace __gnu_pbds;

using namespace std;

//template <typename T> using ordered_set =  tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

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

if (a == b) {
	cout << "Draw";
	return 0;
}

if (a == 1)
	a = 14;
if (b == 1)
	b = 14;
	if (a > b)
	cout << "Alice";
	else
	cout << "Bob";
	return 0;
	
}


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

int n, m;
char a[N][N];
int main()
{
	int i, j;
	cin >> n >> m;
	for (i = 0; i < n; i++) {
		scanf ("%s", a[i]);
	}
    for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (j == 0 || i % 2 == 0 && j < m - 1 || a[i][j] == '#') printf("#");
			else printf(".");
		}
		puts("");
    }
    puts("");
    for (i = 0; i < n; i++) {
		for (j = 0; j < m; j++) {
			if (j == m - 1 || i % 2 == 1 && j > 0 || a[i][j] == '#') printf("#");
			else printf(".");
		}
		puts("");
    }
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<sstream>
#include<complex>
#include<functional>
#include<vector>
#include<map>
#include<queue>
#include<deque>
#include<stack>
#include<set>

using namespace std;
#define endl '\n'
#define eb emplace_back
#define fst first
#define scd second
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define YES(n) cout << ((n) ? "YES" : "NO" ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No" ) << endl

constexpr int MOD = 1000000007;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int>> vii;
typedef vector<ll> vl;

ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

// value
int N;

void solve() {

	double ans = 0.0;

	cin >> N;
	for (int i = 0; i < N; i++) {
		double x;
		string u;
		cin >> x >> u;
		if (u == "JPY") {
			ans += x;
		}
		else {
			ans += (x * 380000.0);
		}
	}

	cout << ans << endl;

	return;

}

int main() {

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

	solve();

	return 0;

}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main() {
	int N;
	cin >> N;
	vector<string> S(N);
	vector<string> T;
	map<string, int> M;
	int count = 0;
	for (int i = 0; i < N; i++) {
		cin >> S[i];
		M[S[i]]++;
		count = max(count, M[S[i]]);
	}
	for (auto temp : M) {
		if (temp.second == count) T.push_back(temp.first);
	}
	sort(T.begin(), T.end());
	for (string t : T) cout << t << endl;
	return 0;
}

Measured memory_bytes: 33464
#include<stdio.h>
#include<math.h>
int cpcc(int p0[2],int r0,int p1[2],int r1,double s[2],double t[2]){
  int x1=p1[0]-p0[0],y1=p1[1]-p0[1],sx=y1,sy=-x1;
  long long a=x1*x1+y1*y1,b=r0*r0-r1*r1+a;
  double c=sqrt(a),d=b/(2*c),e=sqrt(r0*r0-b*b/(4.0*a));  
  if(a>(r0+r1)*(r0+r1))return 0;
  s[0]=p0[0]+(x1*d+sx*e)/c;
  s[1]=p0[1]+(y1*d+sy*e)/c;
  t[0]=p0[0]+(x1*d-sx*e)/c;
  t[1]=p0[1]+(y1*d-sy*e)/c;
  return 1;
}
int main(){
  int p0[2],p1[2],r0,r1,j;
  double a[2][2],e=0.0000005;
  scanf("%d %d %d %d %d %d",&p0[0],&p0[1],&r0,&p1[0],&p1[1],&r1);
  cpcc(p0,r0,p1,r1,a[0],a[1]);
  if(fabs(a[0][0]-a[1][0])<e)j=a[0][1]+e<a[1][1]?0:1;
  else                       j=a[0][0]+e<a[1][0]?0:1;
  printf("%.9f %.9f %.9f %.9f\n",a[j][0],a[j][1],a[1-j][0],a[1-j][1]);
  return 0;
}

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

int main() {
    char c;
    cin >> c;
    
    if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
        cout << "vowel" << endl;
    } else {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 3532
n = int(input())
s = input()
# 左からi文字目までに存在するW,Eの累積和
east = [0] * (n + 1)
west = [0] * (n + 1)
for i in range(n):
    east[i + 1] = east[i]
    west[i + 1] = west[i]
    if s[i] == 'E':
        east[i + 1] += 1
    else:
        west[i + 1] += 1

ans = float('inf')
for i in range(1, n):
    tmp = west[i - 1] + east[-1] - east[i]
    ans = min(ans, tmp)
# N番目
ans = min(ans, west[n - 1])
print(ans)

Measured memory_bytes: 17564
#include<iostream>
#include<queue>
#include<memory>
#include<map>
#include<set>
#include<unordered_map>
#include<array>
#include<vector>
#include<algorithm>
#include<list>
#include<limits>
#include<stdio.h>
#include<math.h>
#include<string>

using namespace std;
using ll = long long;
using vec = vector<ll>;
using mat = vector<vec>;
using lst = list<ll>;
using pr  = pair<ll, ll>;

const ll MOD = 1000000007;

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

	cout << min(K, A) - max(0, K - A - B) << endl;

	return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include<iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,n) for(ll i=0;i<n;i++)
#define NO cout<<"NO"<<endl;
#define YES cout<< "YES"<<endl;
#define No cout<< "No"<<endl;
#define Yes cout<< "Yes"<<endl;
#define all(a) a.begin(),a.end()
#define P pair<int,int>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない

int main(){
    
    int n;
    cin >> n;
    for(int i=1;i<=n;i++){
        double c = (double)i*1.08;
        int C = (int)c;
        if(n==C){
            cout << i<<endl;
            return 0;
        }
    }
    cout << ":("<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 1000000007
#define rep(i, N) for(ll i = 0; i < N; i++)
#define rep2(i, j, k) for(ll i = j; i < k; i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define print(x) cout << x << "\n"
#define print2(x, y) cout << x << " " << y << "\n"
#define printv(vec) rep(lp, vec.size()) cout << vec[lp] << " "; print("");
#define ALL(v) v.begin(), v.end()
#define SUM(v) accumulate(ALL(v), 0)
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define SORT(v) sort(ALL(v))
#define REV(v) reverse(ALL(v))
typedef long long ll;
using namespace std;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vs = vector<string>;

vl bfs(vvl& G, ll s){
    deque<ll> q;
	q.push_front(s);
	ll N = G.size();
    vl d(N, -1);
    d[s] = 0;
    while(!q.empty()){
        ll node = q.back();
		q.pop_back();
		rep(i, G[node].size()){
			ll nx = G[node][i];
            if(d[nx] == -1){
                q.push_front(nx);
                d[nx] = d[node] + 1;
			}
		}
	}
    return d;
}

void Main(){
	
	ll N;
	cin >> N;
	vvl v(N, vl());
	rep(i, N - 1){
		ll in1, in2;
		cin >> in1 >> in2;
		v[in1 - 1].push_back(in2 - 1);
		v[in2 - 1].push_back(in1 - 1);
	}
	
	vl res1 = bfs(v, 0);
	vl res2 = bfs(v, N - 1);
	ll cnt1 = 0;
	ll cnt2 = 0;
	rep(i, N){
		if(res1[i] <= res2[i]) cnt1 += 1;
		else cnt2 += 1;
	}
	if(cnt1 > cnt2) print("Fennec");
	else print("Snuke");
	
}

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

	Main();
    
	return 0;
	
}





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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, a, b, c[37];

int main() {
	cin >> n >> a >> b;
	
	incII(i, 1, n) {
		string s = to_string(i);
		int d = 0;
		inc(j, s.size()) { d += s[j] - '0'; }
		c[d] += i;
	}
	
	int ans = 0;
	incII(i, a, b) { ans += c[i]; }
	
	cout << ans << endl;
	
	return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef long double ld;
typedef vector<ld> vd;
typedef bool bl;
typedef vector<bl> vb;
typedef unordered_map<ll,unordered_map<ll,ll>> graph;

const ll e5 = 1 << 20;
const ll mod = 998244353;
const ll e3 = 1 << 13;
const ll INF = 1ll << 60;

ll n;
ll a[e5];
ll cnt;
bl flag;


int main(){
  cin >> n;
  for(ll i = 0;i < n;i++) cin >> a[i];
  for(ll i = 0;i < n;i++){
    if(a[i] < 0) cnt++;
    if(a[i] == 0) flag = true;
  }
  for(ll i = 0;i < n;i++){
    a[i] = abs(a[i]);
  }
  if(flag || cnt%2 == 0){
    cout << accumulate(a,a+n,0ll) << endl;
  }else{
    ll ans = accumulate(a,a+n,0ll);
    ans -= 2*(*min_element(a,a+n));
    cout << ans << endl;
  }

}


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

n = int(input())
a = 0
b = 0
c = 0
d = 0
for i in range(n):
    s = input()

    if s == 'AC\n':
        a += 1
    elif s == 'WA\n':
        b += 1
    elif s == 'TLE\n':
        c += 1
    else:
        d += 1

print("AC x "+str(a))
print("WA x "+str(b))
print("TLE x "+str(c))
print("RE x "+str(d))

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

int main() {
  string a="CODEFESTIVAL2016";
  string b;
  cin>>b;
  int c=0;
  for(int i=0;i<16;i++){
    if(!(a.at(i)==b.at(i))){
      c++;
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for(ll i=ll(a);i<ll(b);i++)
#define irep(i,a,b) for(ll i=ll(a);i>=ll(b);i--)
#define pb push_back
#define mp make_pair
#define F .first
#define S .second 
using ll=long long;
using ld=long double;
using namespace std;
const ll mod=1e9+7;
ll a[210000];
int main(){
    ld n,ans=0;
    cin>>n;
    ld a=(n-((ll)n/2))/n;
    cout<<fixed<<setprecision(10)<<a;
}

Measured memory_bytes: 256
def abc063_c():
    from itertools import combinations
    import numpy as np
    n = int(input())
    s = np.array([int(input()) for _ in range(n)])
    score = 0
    if sum(s % 10) == 0:
        print(0)
    else:
        for i in range(n + 1, 0, -1):
            for seq in combinations(s, i):
                tmp = sum(seq)
                if tmp % 10 and tmp > score:
                    score = tmp
            if score:
                break
        print(score)


abc063_c()

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

using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
#define REP(i,n) for(ll i = 0;i < (ll)n;i++)
#define REPD(i,n) for(ll i = (ll)n - 1;i >= 0;i--)
#define ALL(x) (x).begin(),(x).end()
#define FILLl(n,first_dimension_size,value) fill((ll*)n,(ll*)(n+first_dimension_size),value)
#define FILL(n,first_dimension_size,value) fill((int*)n,(int*)(n+first_dimension_size),value)
#define INF (1 << 29)
#define MOD 1000000007
//int dx[4] = {1,0,0,-1};
//int dy[4] = {0,1,-1,0};


int main(){

  
  int x,t;
  cin >> x >> t;
  if(x > t)cout << x -t << endl;
  else cout << 0 << endl;



  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>

using namespace std;

class Solver {
    public:
        string s;
        string solve() {
            string plain = "";
            for (int i = 0; i < (int)s.length(); ++i) {
                if (s[i] < 'A' + 3) {
                    plain += 'Z' + s[i] - 'A' - 2;
                } else {
                    plain += s[i] - 3;
                }
            }
            return plain;
        }
};

int main() {
    Solver s;
    cin >> s.s;
    cout << s.solve() << endl;
}

Measured memory_bytes: 1192
#include<iostream>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<cmath>
#include<algorithm>
#include<bitset>
#include<map>
#include<unordered_map>
#include<functional>
#include<set>
#include<numeric>

#pragma region
using namespace std;
#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); i++)
#define rep(i,n) FOR(i,0LL,n)
#define RFOR(i,r,n) for(ll i=(ll)(n-1);i>=r;i--)
#define rrep(i,n) RFOR(i,0LL,n)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define COUNT(a,y,x) upper_bound(all(a), y) - lower_bound(all(a), x)
#define UNIQUE(a) sort(all(a)); a.erase(unique(all(a)), a.end())
#define SUM(a) accumulate(all(a),0LL)
#define pb push_back
#define endl '\n'
typedef long long int ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<string> vs;
typedef map<ll, ll> MAP;
const ll inf = 2222222222222222222LL;
const ll mod = 1000000007LL;

ll n = 0, m = 0, ans = 0, cnt = 0, tmp = 0, ma = -inf, mi = inf;
string s;
bool ok = true, flag = false;
ll dx[9] = { 0,1,-1,0,0,1,1,-1,-1 }, dy[9] = { 0,0,0,1,-1,1,-1,1,-1 };
#pragma endregion
#define MAX 222222





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

  ll a, b;
  cin >> a >> b;
  cout << a + b / 2 << endl;




	return 0;
}

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

int main() {
	int n;
	cin >> n;
	
	long long sum = 0, ans = 0;
	vector<long long> v(n, 0);
	for (auto &x : v) {
		cin >> x;
		sum += x;
	}
	
	for (int i = 0; i < n; ++i) {
		ans += v[i] * (sum - v[i]);
	}
	
	cout << ans / 2 << "\n";
	
	return 0;
}

Measured memory_bytes: 256
k=int(input())
ans=[[i for i in range(1,10)]]
d=9
while d<k:
    ans.append([])
    for i in ans[-2]:
        x=str(i)
        z=int(x[-1])
        ans[-1].append(x+str(z))
        if z<=8:
            ans[-1].append(x+str(z+1))
        if z>=1:
            ans[-1].append(x+str(z-1))
    d+=len(ans[-1])
ans[-1].sort()
print(ans[-1][k-d-1])

Measured memory_bytes: 17268
#include<bits/stdc++.h> //Ithea Myse Valgulious
namespace chtholly{
typedef long long ll;
#define re0 register int
#define rel register ll
#define rec register char
#define gc getchar
//#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<23,stdin),p1==p2)?-1:*p1++)
#define pc putchar
#define p32 pc(' ')
#define pl puts("")
/*By Citrus*/
char buf[1<<23],*p1=buf,*p2=buf;
inline int read(){
  int x=0,f=1;char c=gc();
  for (;!isdigit(c);c=gc()) f^=c=='-';
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return f?x:-x;
  }
template <typename mitsuha>
inline bool read(mitsuha &x){
  x=0;int f=1;char c=gc();
  for (;!isdigit(c)&&~c;c=gc()) f^=c=='-';
  if (!~c) return 0;
  for (;isdigit(c);c=gc()) x=(x<<3)+(x<<1)+(c^'0');
  return x=f?x:-x,1;
  }
template <typename mitsuha>
inline int write(mitsuha x){
  if (!x) return 0&pc(48);
  if (x<0) pc('-'),x=-x;
  int bit[20],i,p=0;
  for (;x;x/=10) bit[++p]=x%10;
  for (i=p;i;--i) pc(bit[i]+48);
  return 0;
  }
inline char fuhao(){
  char c=gc();
  for (;isspace(c);c=gc());
  return c;
  }
}using namespace chtholly;
using namespace std;
const int yuzu=2e5;
typedef ll fuko[yuzu|10];
fuko a;
int main() {
  int i,n=read();
  ll a,b,x=0,t;
  cin>>a>>b;
  for (i=3;i<=n;++i) read(t),x^=t;
  if (x>a+b||(a+b-x)%2) return puts("-1")&0;
  ll w=(a+b-x)/2,m=w;
  if (w>a||(w&x)) return puts("-1")&0;
  for (i=56;~i;--i) if ((x>>i&1)&&(m+(1ll<<i))<=a) m+=1ll<<i;
  printf("%lld\n",!m?-1:a-m); 
}

Measured memory_bytes: 3752
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define se second
#define fi first
#define ll long long int
#define INF INT_MAX
#define mod
#define chutiyaap ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
bool sortbysec(const pair<ll,ll> &a,const pair<ll,ll> &b){return (a.second < b.second);}
ll gcd(ll a, ll b){if(a==0)return b;return gcd(b % a, a);}
int main()
{
	chutiyaap;
	ll n;cin>>n;
	for(ll i=sqrt(n);i>=1;i--)
	{
		if(!(n%i))
		{
			cout<<(i+n/i-2);
			return 0;
		}
	}
}


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

#define uint unsigned int
#define ll long long
#define ull unsigned long long
#define ld long double
#define rep(i, l, r) for (int i = l; i < r; i++)
#define repb(i, r, l) for (int i = r; i > l; i--)
#define sz(a) (int)a.size()
#define fi first
#define se second
#define mp(a, b) make_pair(a, b)

using namespace std;

const int N = 100000;
const int inf = (int)1e9 + 1;
const ll big = (ll)1e18 + 1;
const int P = 239;
const int MOD = (int)1e9 + 7;
const int MOD1 = (int)1e9 + 9;
const double eps = 1e-9;
const double pi = atan2(0, -1);
const int ABC = 26;

int main()
{
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.precision(20);
    int n, m, k;
    cin >> n >> m >> k;
    rep(i, 0, n + 1)
        rep(j, 0, m + 1)
            if (i * (m - j) + j * (n - i) == k)
            {
                cout << "Yes\n";
                return 0;
            }
    cout << "No\n";
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pi;
int h,w,m;
set<pi>mp;
int count_x[300005];
int count_y[300005];
int main(){
	cin>>h>>w>>m;
	while(m--){
		int y,x;
		cin>>y>>x;
		count_x[x]++;
		count_y[y]++;
		mp.insert(make_pair(y,x));
	}
	vector<int>arr;
	vector<int>brr;
	int mx = 0;
	for(int i=1; i<=h; i++) mx = max(mx,count_y[i]);
	for(int i=1; i<=h; i++) if(count_y[i]==mx) arr.push_back(i);
	mx = 0;
	for(int i=1; i<=w; i++) mx = max(mx,count_x[i]);
	for(int i=1; i<=w; i++) if(count_x[i]==mx) brr.push_back(i);
	for(int i=0; i<arr.size(); i++){
		for(int j=0; j<brr.size(); j++){
			if(mp.find(pi(arr[i],brr[j]))==mp.end()){
				cout<<count_y[arr[i]]+count_x[brr[j]];
				return 0;
			}
		}
	}
	cout<<count_y[arr[0]]+count_x[brr[0]]-1;
}

Measured memory_bytes: 23768
#include<bits/stdc++.h>
#define ll long long
#define p 998244353
using namespace std;
int jc[10000010],njc[10000010],inv[10000010];
int C(int x,int y){
	if(x<y)return 0;
	return 1ll*jc[x]*njc[y]%p*njc[x-y]%p;
}
int f(int n,int m){
	if(n==0&&m==0)return 1;
	if(m>n)return 0;
	return (C(n+m,m)-C(n+m,m-1)+p)%p;
}
int n,A,B;
int main(){
	cin>>n>>A>>B;
	for(int i=0;i<2;i++)
	jc[i]=njc[i]=inv[i]=1;
	for(int i=2;i<=n;i++){
		jc[i]=1ll*jc[i-1]*i%p;
		inv[i]=1ll*inv[p%i]*(p-p/i)%p;
		njc[i]=1ll*njc[i-1]*inv[i]%p;
	}
	int ans=0;
	if(A==0&&B==0){
		cout<<1;
		return 0;
	}
	for(int k=0;k<B&&n-B-k-1>=0&&A-k>=0;k++){
		(ans+=1ll*C(A-k+n-B-k-1,n-B-k-1)*f(B-1,k)%p)%=p;
	}
	
	if(n==A+B)(ans+=f(B-1,A))%=p;
	cout<<ans;
	return 0;
}


Measured memory_bytes: 117504
// Best practice
 
#include<bits/stdc++.h>
 
#define int         long long
#define pb          push_back
#define pf          emplace_front
#define all(a)      (a).begin(),(a).end()
#define rall(a)     (a).rbegin(),(a).rend()
#define pii 		pair<int,int>
#define psi 		pair<string,int>
#define vi 			vector<int>
#define vpii  		vector<pii>
#define vvi 		vector<vi>
#define sz(x)	    (int)(x).size()
#define x           first
#define y           second
#define endl        '\n'
#define tezz        ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define MOD         1000000007
#define hell        998244353
#define prec(n) 	fixed<<setprecision(n)
#define ini(a, i) 	memset(a, i, sizeof(a))
#define output(x)   cout << (x ? "YES" : "NO")<<endl;
using namespace std;
 
#define debug(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<i<<" "; cout<< "]" << endl
#define debugp(vec) cout<<(#vec)<<" : [ "; for (auto& i: vec) cout<<"("<<i.x<<","<<i.y<<")"<<" "; cout<< "]" << endl
#define trace(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args);cout << endl; }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << "[" << *it << ": " << a << "]\t";
    err(++it, args...);
}
 
// const int dx[4] = { -1, 1, 0, 0};
// const int dy[4] = {0, 0, -1, 1};
// int dX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
// int dY[] = { -1, 0, 1, -1, 1, -1, 0, 1 };
 
 
// Code from Here -------------------------------------------------------------------------------

signed main() {
	tezz
 
	// #ifndef ONLINE_JUDGE
	// 	freopen("input.txt", "r", stdin);
	// 	freopen("output.txt", "w", stdout);
	// #endif

	int n, k;
	cin >> n >> k;
	vi a(n);
	for(int i=0; i<n; i++){
		cin >> a[i];
	}
	int dp[n];
	dp[0]=0;
	for(int i=1; i<n; i++){
		dp[i]=INT_MAX;
		for(int j=1; j<=k; j++){
			if(i>=j)dp[i] = min(dp[i], dp[i-j]+abs(a[i]-a[i-j]));
		}
	}
	cout << dp[n-1] << endl;
 
	return 0;
}  

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
  os << "(" << p.first << "," << p.second << ")";
  return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
  os << "{";
  rep(i, (int)v.size()) {
    if (i)
      os << ",";
    os << v[i];
  }
  os << "}";
  return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
  for (auto val : array)
    std::cout << val << ", ";
  std::cout << "\n";
}

const int mod = 1e9 + 7;
const int inf = 1e9 + 5;

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

  int a, b; std::cin >> a >> b;
  int ans = -1;
  rep(i, 10000) {
    if (a == int(i * 0.08) && b == int(i * 0.1)) {
      ans = i;
      break;
    }
  }
  std::cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep2(j,n) for(int j = 0; j < (n); ++j)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define srep2(j,s,t) for (int j = s; j < t; ++j)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("YES");}else{puts("NO");}
const int MX = 200005;
vi posx[100010];
vi posy[100010];
int memo[100010];
 
int dfs(int pos){
  int maxlength = 0;
  if(memo[pos] == -1){
    rep(i,sz(posy[pos])){
      maxlength = max(maxlength,1 + dfs(posy[pos][i]));
    }
    memo[pos] = maxlength;
  } else {
    maxlength = max(maxlength,memo[pos]);
  }
  return maxlength;
}
 
int main() {
  rep(i,100010){
    memo[i] = -1;
  }
  int N,M;
  cin >> N >> M;
  rep(i,M) {
    int x,y;
    cin >> x >> y ;
    P p = make_pair(x,y);
    posx[x].pb(y);
    posy[y].pb(x);
  }
  int ans = 0;
  
  srep(i,1,N+1){
    if(sz(posx[i]) == 0){
      rep2(j,sz(posy[i])){
        ans = max(ans,1+ dfs(posy[i][j]));
      }
    }
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
	int n, k;
	scanf("%d %d", &n, &k);
	vector<int> a(n);
	int left = 1, right = 0;
	for (int i = 0; i < n; i++) {
		scanf("%d", &a[i]);
		right = max(right, a[i]);
	}

	while (left < right) {
		int mid = (left + right) >> 1;
		long long t = 0;
		for (int i = 0; i < n; i++)
			t += (a[i] - 1) / mid;
		if (t <= k)
			right = mid;
		else
			left = mid + 1;
	}

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

	return 0;
}

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

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    string s;
    cin >> s;
    string fi = s.substr(0, 2);
    string en = s.substr(2, 2);
    int f = stoi(fi);
    int e = stoi(en);
    if(f != 0 && f < 13 && e != 0 && e < 13)
    {
        cout << "AMBIGUOUS\n";
    }
    else if(f != 0 && f < 13)
    {
        cout << "MMYY\n";
    }
    else if(e != 0 && e < 13)
    {
        cout << "YYMM\n";
    }
    else
    {
        cout << "NA\n";
    }

    return 0;
}


Measured memory_bytes: 3588
import java.util.*;
public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new AOJ2399().doIt();
	}

	class AOJ2399{
		int n,m;
		ArrayList<ArrayList<Integer>> list;
		int[] target;
		HashSet<Integer> set;
		void solve(){
			set = new HashSet<Integer>();
			for(int i=0;i<m;i++)set.add(target[i]);
			boolean[] who = new boolean[n];
			for(int i=0;i<n;i++){
				int cnt = 0;
				for(int s=0;s<list.get(i).size();s++)if(set.contains(list.get(i).get(s)))cnt++;
				if(cnt==m)who[i] = true;
			}
			int cnt = 0;
			int memo = -1;
			for(int i=0;i<n;i++)if(who[i]){
				memo = i+1;cnt++;
			}
			if(cnt!=1)System.out.println("-1");
			else System.out.println(memo);
		}
		
		void doIt(){
			while(in.hasNext()){
				n = in.nextInt();
				if(n==0)break;
				list = new ArrayList<ArrayList<Integer>>();
				for(int i=0;i<n;i++){
					list.add(new ArrayList<Integer>());
					int k = in.nextInt();
					for(int s=0;s<k;s++)list.get(i).add(in.nextInt());
				}
				m = in.nextInt();
				target = new int[m];
				for(int i=0;i<m;i++)target[i] = in.nextInt();
				solve();
			}
		}
	}
}

Measured memory_bytes: 65104
# -*- coding: utf-8 -*-

n = int(input())
li = [list(map(int, input().split())) for i in range(n)]
li.sort(key=lambda x: x[2])
a, b, c = li[-1]
for x in range(101):
    for y in range(101):
        h = abs(x-a) + abs(y-b) + c
        if all(k == max(h-abs(x-i)-abs(y-j), 0) for i, j, k in li):
            print(x, y, h)
            exit()


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

using namespace std;

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

int main(){
    int n, q, t = 0; 
    cin >> n >> q;

    queue<pair<string, int> > task;
    rep(i,n){
        string name;
        int time;
        cin >> name >> time;
        task.push(make_pair(name, time));
    }

    while(!task.empty()){
        pair<string, int> tmp = task.front();
        string name = tmp.first;
        int time = tmp.second;
        if(time - q > 0){
            t += q;
            task.pop();
            task.push(make_pair(name, time-q));
        } else{
            t += time;
            task.pop();
            cout << tmp.first << " ";
            cout << t << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 6328
#include <iostream>
#include <vector>
#include <string>
#include <cstdlib>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <stack>
#include <math.h>
#include <string.h>
#include <map>
#include <bitset>
#include <queue>


#define Z class
#define ln cout<<'\n'
#define ll long long
#define ld long double
#define rep(i, n) for(int i = 0; i < (n); ++i)
//ASCII a=97, A=65
// int H[N]; rep(i,N) scanf("%d", &H[i]);
// int max_x = *std::max_element(x.begin(), x.end());
// int min_y = *std::min_element(y.begin(), y.end());
// sort(vec.begin(), vec.end()); std::greater<>()
// reverse(vec.begin(), vec.end());
// scanf("%s",s);
// printf("%d\n",end-start+1);
// ceil (a + (b - 1)) / b

using namespace std;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
using pll = pair<long long, long long>;

template<class T> inline bool chmax(T& a, T b){ if(a < b) { a=b; return 1; }return 0;}
template<class T> inline bool chmin(T& a, T b){ if(a > b) { a=b; return 1; }return 0;}
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}

int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
const long long INF = 1LL << 60;
const int MOD = 1000000007;

int main() {
    int N; cin >> N;
    string s; cin >> s;
    
    //Eの数とWの数を集計
    int sumE = 0;
    int sumW = 0;
    rep(i, s.length()) {
        if (s[i] == 'E') sumE++;
        else sumW++;
    }
    
    //方向転換する人数は、文字列の長さ - 1 が最大値
    //Eの累積和とWの累積和を保持する変数を用意
    int res = s.length() - 1;
    int curE = 0;
    int curW = 0;

    //s[i]がEのとき、turnWを１減らす（２重カウントしてる）
    //i番目より左側にいるWはEに方向転換するのでそのままcurWを使う
    rep(i, s.length()){
        int turnW = sumE - curE;
        if(s[i] == 'E') --turnW;
        res = min(res, turnW + curW);
        
        //現在位置の要素は足す
        if(s[i] == 'E') ++curE;
        else ++curW;
    }
    
    cout << res << endl;
}



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

//motoを暗号化規則によって暗号化する
string crypt(string moto,int n)
{
	bool f[26]={};
	f[0]=true;
	int p;
	for(int i=0;i<n;++i)
	{
		p=moto[i]-'a';
		if(!f[p])
		{
			f[p]=true;
			--moto[i];
		}
	}
	return moto;
}
string a[1<<22];
string s;
string t;	
int ans;
void saiki(string tmp,int i,int n)
{
	if(i==n)
	{
		if(crypt(tmp,n)==s)
		{
			a[ans]=tmp;
			ans++;
		}
		return;
	}
	if(tmp[i]!='z')
	{
		saiki(tmp,i+1,n);
		tmp[i]++;
		saiki(tmp,i+1,n);
	}else{
		saiki(tmp,i+1,n);
	}
	return;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	bool f;
	int n;
	int i;
	int bit;
	while(1)
	{
		ans=0;
		cin>>s;
		n=s.size();
		if(s[0]=='#')
			break;
		saiki(s,0,n);
		cout<<ans<<endl;
		if(ans>10)
		{
			for(i=0;i<5;i++)
				cout<<a[i]<<endl;
			for(i=ans-5;i<ans;i++)
				cout<<a[i]<<endl;
		}else{
			for(i=0;i<ans;i++)
				cout<<a[i]<<endl;
		}
	}
	return 0;
}


Measured memory_bytes: 36892