akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m, x; cin >> n >> m >> x;
    vll c(n);
    vvll a(n, vll(m));
    for (ll i = 0; i < n; i++) {
        cin >> c[i];
        for (ll j = 0; j < m; j++) cin >> a[i][j];
    }

    ll ans = HIGHINF;
    for (ll state = 0; state < (1 << n); state++) {
        ll cost = 0;
        vll tmpa(m, 0);
        for (ll i = 0; i < n; i++) {
            if ((state >> i) & 1) {
                cost += c[i];
                for (ll j = 0; j < m; j++) tmpa[j] += a[i][j];
            }
        }

        bool ok = true;
        for (ll i = 0; i < m; i++) {
            if (tmpa[i] < x) ok = false;
        }

        if (ok) chmin(ans, cost);
    }

    if (ans == HIGHINF) cout << -1 << '\n';
    else cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3664
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)


def main():
    n = I()
    aa = [LI() for _ in range(n-1)]
    e = collections.defaultdict(list)
    for a,b,c in aa:
        e[a].append((b,c))
        e[b].append((a,c))

    def search(s):
        d = collections.defaultdict(lambda: inf)
        d[s] = 0
        q = []
        heapq.heappush(q, (0, s))
        v = collections.defaultdict(bool)
        while len(q):
            k, u = heapq.heappop(q)
            if v[u]:
                continue
            v[u] = True

            for uv, ud in e[u]:
                if v[uv]:
                    continue
                vd = k + ud
                if d[uv] > vd:
                    d[uv] = vd
                    heapq.heappush(q, (vd, uv))

        return d
    d = search(1)
    rr = []
    for i in range(1,n+1):
        rr.append(d[i]%2)

    return '\n'.join(map(str, rr))


print(main())




Measured memory_bytes: 82996
#include<iostream>
#include<vector>
#include<set>
using namespace std;
#define in(a,b) (a.find(b)!=a.end())
signed main(){
  string s;
  cin>>s;
  int gx,gy;
  cin>>gx>>gy;
  bool isx=true;
  vector<int> x,y;
  for(int i=0,n=s.size();i<n;++i){
    int c=i;
    while(i+1<n&&s[i]==s[i+1])i++;
    c=i-c+1;
    if(s[i]=='F'){
      if(isx){
        if(i-c+1==0)gx-=c;
        else x.push_back(c);
      }
      else y.push_back(c);
    }
    else isx=(isx^(c%2));
  }
  vector<set<int>> dpx(x.size()+1),dpy(y.size()+1);
  dpx[0].insert(0);
  dpy[0].insert(0);
  
  for(int i=0;i<x.size();++i){
    for(auto t:dpx[i]){
      dpx[i+1].insert(t+x[i]);
      dpx[i+1].insert(t-x[i]);
    }
  }
  for(int i=0;i<y.size();++i){
    for(auto t:dpy[i]){
      dpy[i+1].insert(t+y[i]);
      dpy[i+1].insert(t-y[i]);
    }
  }
  cout<<(in(dpx[x.size()],gx) && in(dpy[y.size()],gy)?"Yes":"No");
}

Measured memory_bytes: 188160
#include <iostream>

using namespace std;

int main(void) {
  int N;
  int U[110], D[110];
  
  cin >> N;
  U[0] = 0;
  for(int i = 1; i <= N; i++) {
    int A;
    cin >> A;
    U[i] = U[i - 1] + A;
  }
  for(int i = 1; i <= N; i++) {
    int A;
    cin >> A;
    D[i] = D[i - 1] + A;
  }
  
  int ma = -1;
  for(int i = 1; i <= N; i++) {
    ma = max(ma, U[i] + (D[N] - D[i - 1]));
  }
  cout << ma << endl;
  
  return 0;
}
  
  
  

Measured memory_bytes: 256
#import sys
#import numpy as np
import math
#from fractions import Fraction
import itertools
from collections import deque
from collections import Counter
#import heapq
#from fractions  import gcd
#input=sys.stdin.readline
import bisect
n=int(input())
ans=[0]*n
for x in range(1,100):
    for y in range(x,100):
        for z in range(y,100):
            res=x**2+y**2+z**2+x*y+y*z+z*x
            if res>n:
              continue
            if x==y==z:
                ans[res-1]+=1
            elif (x==y and y!=z) or (y==z and x!=y):
                ans[res-1]+=3
            elif x!=y and y!=z:
                ans[res-1]+=6
for i in range(n):
    print(ans[i])

Measured memory_bytes: 69736
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll zero = 0;
const ll INF = 10000000000000000; //10^16
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int L;
    cin >> L;
    double ans;
    ans = L*L*L/27.0;
    printf("%7lf", ans);

}

Measured memory_bytes: 256
N, Q = map(int, input().split())
S = input()
t = [0] * (N + 1)
for i in range(N):
    t[i + 1] = t[i] + (1 if S[i : i + 2] == 'AC' else 0)

for i in range(Q):
    l, r = map(int, input().split())
    print(t[r-1] - t[l-1])

Measured memory_bytes: 7748
#include <bits/stdc++.h>
using namespace std;
 
//Optimizations
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
//save time
#define endl '\n'
#define db(x) cerr << "> " << #x << ": " << x << endl
typedef long long ll;
 
//for sorting
#define all(a) a.begin(),a.end()
 
//Constants
#define PI   3.141592653593
#define MOD  1000000007LL
#define EPS  0.000000001
#define INF  0X3f3f3f3f
 
//loops
#define REP(i,n) 	    for(int i=0;i<(n);++i)
#define FOR(i,a,b)      for(int i=(a);i<(b);++i)
#define DFOR(i,a,b)     for(int i=(a);i>=(b);--i)
 
//vectors
#define vi vector<int>
#define vll vector<ll>
#define vii vector<pair<int,int>>
#define vlll vector<pair<ll,ll>>
#define pb 	push_back
 
//pairs
#define pi pair<int,int>
#define pll pair<ll,ll>
#define mp make_pair
#define F first
#define S second
 
//fast I/O
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
#define gc getchar
#define pc putchar
 
//If using cin and cout
#define IOS ios::sync_with_stdio(false)
#define TIE cin.tie(NULL);cout.tie(NULL)
 
//queue
#define di deque<int>
#define dll deque<ll>
#define qi queue<int>
#define PQ priority_queue
 
//general
#define E empty()
 
//Declare all variables and methods needed between this comment and the next one(OCD lol)
const int MAXN=0;
int main(){
    string a , b ; cin >> a >> b ;
    vector<vector<pair<int , pi>> > dp( a.length()+1, vector<pair<int, pi>>(b.length()+1, {0,{0,0}}));
    REP(i, a.length()){
        REP(j, b.length()){
            if(a[i] == b[j]){
                dp[i+1][j+1] = max(dp[i+1][j+1] , {dp[i][j].first+1, {i,j}} );
            }
            dp[i+1][j] = max(dp[i+1][j] , {dp[i][j].first, {i,j}} );
            dp[i][j+1] = max(dp[i][j+1] , {dp[i][j].first , {i,j}} );
        }
    }
    pair<int, pi> end = {0,{0,0}};
    REP(i, a.length()+1){
        REP(j, b.length()+1){
        end = max(end, {dp[i][j].first, {i,j}});
        }
    }
    pi pos = end.second;
   // cout << pos.first << " " << pos.second << endl;
    string s ; 
    while(pos.first!=0 || pos.second!=0){

        int i = pos.first,
        j = pos.second;

        pi prev = dp[i][j].second;
        if(prev.first == i-1 && prev.second == j-1){
            if(a[i-1] == b[j-1])
            s+=a[i-1];
        }
        pos = prev;
    }
    reverse(all(s));
    cout << s << endl;
    
}

Measured memory_bytes: 108776
//https://codeforces.com/contest/1334/problem/A
//BROWNIE TK

#include <bits/stdc++.h>
using namespace std;

typedef long long int lli;
typedef unsigned long long int ulli;
typedef long double ldb;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define pb push_back
#define popb pop_back()
#define pf push_front
#define popf pop_front()

#define si size()
#define be begin()
#define en end()
#define all(v) v.be, v.en

#define le length()
#define mp make_pair
#define mt make_tuple
#define acc(v) accumulate(all(v), 0)
#define F first
#define S second

#define pll pair<lli, lli>
#define pii pair<int, int>
#define pil pair<int, lli>

#define forz(i, n) for (int i = 0; i < n; i++)
#define fore(i, m, n) for (int i = m; i <= n; i++)
#define rforz(i, n) for (int i = n - 1; i >= 0; i--)
#define rfore(i, m, n) for (int i = n; i >= m; i--)

#define deci(n) fixed << setprecision(n)
#define high(n) __builtin_popcount(n)
#define highll(n) __builtin_popcountll(n)
#define parity(n) __builtin_parity(n)
#define ctz(n) __builtin_ctz(n)

#define bset(a, p) ((a) | (1ll << (p)))
#define bchk(a, p) ((a) & (1ll << (p)))
#define bxor(a, p) ((a) ^ (1ll << (p)));
#define brem(a, p) (bchk(a, p) ? (bxor(a, p)) : (a))
/*SOME BITMASK KNOWLEDGE
1)x & (x - 1):sets the last one bit of x to zero
power of two exactly when x & (x − 1) = 0.
2)x & -x:sets all the one bits to zero, except last one bit
3)x | (x - 1):inverts all the bits after the last one bit*/

#define lb lower_bound
#define ub upper_bound
#define er equal_range

#define findnot find_first_not_of

#define maxe *max_element
#define mine *min_element

#define mod2 1000000007
#define mod 998244353
#define gcd __gcd
#define kira ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)

#define endl "\n"
#define p0(a) cout << a << " "
#define p1(a) cout << a << endl
#define p2(a, b) cout << a << " " << b << endl
#define p3(a, b, c) cout << a << " " << b << " " << c << endl
#define p4(a, b, c, d) cout << a << " " << b << " " << c << " " << d << endl

#define oset tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define osetlli tree<lli, null_type, less<lli>, rb_tree_tag, tree_order_statistics_node_update>
//member functions :
//1. order_of_key(k) : number of elements sbtriectly lesser than k
//2. find_by_order(k) : k-th element in the set
#define ofk order_of_key
#define fbo find_by_order

/*STD funcions*/
lli power(lli x, lli y, lli p)
{
    lli res = 1;
    x = x % p;
    while (y > 0)
    {
        if (y & 1)
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;
    }
    return res;
}
lli modi(lli a, lli m) { return power(a, m - 2, m); }
/*CODE BEGINS*/

int main()
{
    kira;
    string s;
    cin>>s;
    if(s[0]=='7'||s[1]=='7'||s[2]=='7')p1("Yes");
    else p1("No");
    return 0;
}


Measured memory_bytes: 3652
program abc155a
integer :: a,b,c
read(*,*) a,b,c
 
if ((a == b .and. b /= c) .or. (b == c .and. c /= a) .or. (c == a .and. a /= b)) then
write(*,*) "Yes"
else
write(*,*) "No"
end if
 
 
end program abc155a


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#define rad M_PI/3
#define N 500001
#define Max 10000
#define NTL -1
int n;
int heap[Max];
int main(){
  int i,parent,left,right;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&heap[i]);
  }
  for(i=0;i<n;i++){
    printf("node %d: key = %d, ",i+1, heap[i]);
    parent = (i-1)/2;
    left = i*2+1;
    right = i*2+2;
    if(i!=0) printf("parent key = %d, ",heap[parent]);
    if(left<n)printf("left key = %d, ",heap[left]);
    if(right < n) printf("right key = %d, ", heap[right]);
    printf("\n");
  }
  return 0;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)

int main(){
 int n;
  cin >>n;
  vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(a.begin(),a.end());
  
  int x,y;
  x=*(upper_bound(a.begin(),a.end(),(a[n-1]/2))-1);
  y=*upper_bound(a.begin(),a.end(),(a[n-1]/2));
  if(a[n-1]-2*x<= 2*y-a[n-1]) cout << a[n-1] << " " << x << endl;
  else cout << a[n-1] << " " << y << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <string>
#include <cmath>

using std::cin;
using std::cout;
using std::endl;

int trans_str(std::string str) {
	int l = str.length();
	if ( l == 1 ) {
		return (int)(str[0]) - '0';
	}

	int sum = 0;
	int d;
	if ( str[0] == '-' ) {
		for (int i = 0; i < l-1; i++) {
			d = (int)(str[l-1-i]) - '0';
			sum += d * pow(10,i);
		}
		return -sum;
	}

	for (int i = 0; i < l; i++) {
		d = (int)(str[l-1-i]) - '0';
		sum += d * pow(10,i);
	}
	return sum;
}

bool check_sample(std::vector<int> v) {
	int size = v.size()-1;
	for (int i = 2; i < size; i++) {
		if ( i%2 == 0 ) {
			if ( v[i] <= v[i-1] ) {
				return false;
			}
		}
		else {
			if ( v[i] >= v[i-1] ) {
				return false;
			}
		}
	}
	return true;
}

int main(void) {
	int N;
	cin >> N;
	while ( N != 0 ) {
		std::vector<int> data(N+2,0);
		std::vector<int> xinds;
		std::string str;
		bool ex = false;
		bool seq = false;
		bool mode = false;
		data[0] = 1000000003;
		if ( N%2 == 0 ) {
			data[N+1] = -data[0];
		}
		else {
			data[N+1] = data[0];
		}
		for (int i = 0; i < N; i++) {
			cin >> str;
			if ( str[0] == 'x' ) {
				if ( mode ) {
					seq = true;
				}	
				ex = true;
				mode = true;
				xinds.push_back(i+1);
			}
			else {
				data[i+1] = trans_str(str);
				mode = false;
			}
		}

		if ( !ex ) {
			if ( check_sample(data) ) {
				cout << "ambiguous" << endl;
			}
			else {
				cout << "none" << endl;
			}
		}
		else {
			if ( seq ) {
				cout << "none" << endl;
			}
			else {
				int smin = -1000000003;
				int smax = 1000000003;
				int ind;
				for (std::vector<int>::iterator itr = xinds.begin(); itr != xinds.end(); ++itr) {
					ind = *itr;
					if ( ind%2 == 0 ) {
						if ( smin < data[ind-1]+1 ) {
							smin = data[ind-1]+1;
						}
						if ( smin < data[ind+1]+1 ) {
							smin = data[ind+1]+1;
						}
					}
					else {
						if ( smax > data[ind-1] ) {
							smax = data[ind-1];
						}
						if ( smax > data[ind+1] ) {
							smax = data[ind+1];
						}
					}
				}

				int ret = smin;
				int count = smax - smin;
				for (std::vector<int>::iterator itr = xinds.begin(); itr != xinds.end(); ++itr) {
					data[*itr] = ret;
				}

				if ( check_sample(data) ) {
					if ( count != 1 ) {
						if ( count < 0 ) {
							cout << "none" << endl;
						}
						else {
							cout << "ambiguous" << endl;
						}
					}
					else {
						cout << ret << endl;
					} 
				}
				else {
					cout << "none" << endl;
				}
			}
		}
		cin >> N;
	}

	return 0;
}

Measured memory_bytes: 3336
#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>;
const int INF = 1 << 29;
 
int main() {
	string s, t;
	cin >> s >> t;
	int l = s.size();
	bool can = false;
	if (s == t) can = true;
	string hozon = s;
	rep(i, l)
	{
		string ss = hozon[l-1] + hozon.substr(0, l-1);
		hozon = ss;
		if (ss == t) can = true;
	}
	if (can) cout << "Yes" << endl;
	else cout << "No" << endl;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <stack>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define EPS 1e-14

#define all(v) v.begin(),v.end()
#define INF 1<<30
#define mp make_pair
#define pb push_back

#define fi first
#define se second

#define each(it,c) for(auto it=(c).begin();it!=(c).end();it++)

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;

typedef long long ll;

int main(){
	int N;
	cin >> N;
	if(N%10 == N/100) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int m[100010];

int main(){
  long double n,k;
  cin >> n >> k;
  long double ans=0;
  for(int i=1;i<=n;i++){
    long double temp=i;
    while(temp<k){
      temp*=2;
    }
    temp/=i;
    ans+=1.0/temp;
  }
  cout << setprecision(15) << ans/n << endl;
return 0;}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MAXN 100010
bool isprime[MAXN],similar[MAXN];
int counter[MAXN];
int main() {
	for (int i=0; i<MAXN; i++) {
		isprime[i] = true;
		counter[i] = 0;
		similar[i] = false;
	}
	isprime[0] = false;isprime[1] = false;
	for (int i=2; i<MAXN; i++) {
		if (isprime[i]) {
			for (int j=2*i; j<MAXN; j+=i) {
				isprime[j] = false;
			}
		}
	}
	for (int i=0; i<MAXN; i++) {
		if (isprime[i] && isprime[(i+1)>>1]) {
			similar[i] = true;
		}
	}
	for (int i=1; i<MAXN; i++) {
		counter[i] = counter[i-1];
		if (similar[i]) {
			counter[i]++;
		}
	}
	int q,l,r;cin >> q;
	while (q--) {
		cin >> l >> r;
		cout << counter[r]-counter[l-1] << endl;
	}
	return 0;
}

Measured memory_bytes: 1152
#include<cstdio>
#include<algorithm>
#define MN 210001
using namespace std;

const int MOD=1e9+7;
int n,m,fa[MN],num=0;
long long mmh=0;
struct na{int x,y,p;}p[MN];
struct bi{int x,y,z;}B[MN];
bool cmpx(na a,na b){return a.x<b.x;}
bool cmpy(na a,na b){return a.y<b.y;}
bool cmp(bi a,bi b){return a.z<b.z;}
int gf(int x){return x==fa[x]?x:fa[x]=gf(fa[x]);}
int main(){
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d%d",&p[i].x,&p[i].y),p[i].p=i,fa[i]=i;
	sort(p+1,p+1+n,cmpx);
	for (int i=2;i<=n;i++) B[++num].x=p[i-1].p,B[num].y=p[i].p,B[num].z=p[i].x-p[i-1].x;
	sort(p+1,p+1+n,cmpy);
	for (int i=2;i<=n;i++) B[++num].x=p[i-1].p,B[num].y=p[i].p,B[num].z=p[i].y-p[i-1].y;
	sort(B+1,B+1+num,cmp);
	for (int i=1;i<=num;i++){
		B[i].x=gf(B[i].x);B[i].y=gf(B[i].y);
		if (B[i].x!=B[i].y) fa[B[i].x]=B[i].y,mmh+=B[i].z;
	}
	printf("%lld\n",mmh);
}

Measured memory_bytes: 4736
s = input()
if '01' <= s[:2] <= '12':
    if '01' <= s[2:] <= '12':
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if s[2:] > '12' or s[2:] == '00':
        print('NA')
    else:
        print('YYMM')


Measured memory_bytes: 2940
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<cmath>
#include<cstdio>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<set>
#include<utility>
using namespace std;
typedef pair<int,int> ii;
typedef long long ll;
typedef pair<int,int> P;
typedef unsigned long long int ull;
const int MOD=1e9+7;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
const int MAXN=100000;
const int MAXE=100000;
const int MAXV=10000;
const int INF=1e9;

vector<int> cnt(1e7+1,1);
int main(){
    int n;cin>>n;
  int i=0;
    for(i=2;i<=n;i++){
        for(int j=i;j<=n;j+=i) cnt[j]++;      
    }
    ll ans=0;
    for(ll j=1;j<=n;j++){
        ans+=j*cnt[j];
    }
    cout<<ans<<endl;
}

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

using namespace std;
typedef long long ll;

int main(){
    vector<ll> ps(5);
    for(int i = 0; i < 5; ++i){
        cin >> ps.at(i);
    }
    ll k;
    cin >> k;
    if(ps.back() - ps.front() > k){
        cout << ":(" << endl;
    }else{
        cout << "Yay!" << endl;
    }
    return 0;
}


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

def main():
    N = int(input())
    RL = []

    for _ in range(N):
        x, l = map(int, input().split())
        RL.append((x+l, x-l))
        
    RL = sorted(RL)
    maxR = RL[0][0]
    n = 1

    for r, l in RL[1:]:
        if l < maxR:
            continue
        
        maxR = r
        n += 1

    print(n)
    

if __name__ == '__main__':
    main()


Measured memory_bytes: 17816
#include <bits/stdc++.h>
using namespace std;
const int MAX_N=105;
const int MAX_K=100050;
const int MOD=1e9+7;
int dp[MAX_N][MAX_K],sum[MAX_N][MAX_K];
int a[MAX_N];
int main()
{
	int n,K;
	scanf("%i %i",&n,&K);
	for(int i=1;i<=n;i++)
	{
		scanf("%i",&a[i]);
	}
	for(int i=0;i<=K;i++)
	{
		if(i<=a[1])
		{
			dp[1][i]=1;
		}
		else
		{
			dp[1][i]=0;
		}
	}
	for(int i=2;i<=n;i++)
	{
		sum[i-1][0]=dp[i-1][0];
		for(int j=1;j<=K;j++)
		{
			sum[i-1][j]=sum[i-1][j-1]+dp[i-1][j];
			sum[i-1][j]%=MOD;
		}
		for(int j=0;j<=K;j++)
		{
			dp[i][j]=sum[i-1][j];
			if(j-a[i]-1>=0)
			{
				dp[i][j]-=sum[i-1][j-a[i]-1];
				if(dp[i][j]<0)
				{
					dp[i][j]+=MOD;
				}
			}
		}
	}
	printf("%i\n",dp[n][K]);
	return 0;
}

Measured memory_bytes: 81792
#include <iostream>

using namespace std;

int main(){
	int N; cin>>N;
	int a[110];
	int m[10100];
	for(int n=0; n<N; n++){
		cin>>a[n];
	}
	for(int b=0; b<10001; b++)
		m[b] = 1e9;
	m[0] = 0;
	int ans = 0;
	for(int x=0; x<10001; x++){
		if(m[x]<1e8){
			for(int y=m[x]; y<N; y++){
				m[x+a[y]] = min(y+1, m[x+a[y]]);
			}
		}
		if(m[x]<1e8&&x%10!=0)
			ans = max(ans, x);
	}
	cout << ans << endl;
	return 0;
}

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

int main() {

  int N, Y;
  cin >> N >> Y;

  string result = "-1 -1 -1";

  for (int i = 0; i <= N; i++) {

    for (int j = 0; j <= N - i; j++) {

      int k = N - i - j;
      int sum = i * 10000 + j * 5000 + k * 1000;
      if (sum == Y) {
        result = to_string(i) + " " + to_string(j) + " " + to_string(k);
        break;
      }

    }

  }

  cout << result << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

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

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

// Self settings
// clang-format off
#define MAX_N 100000
#define MAX 100000
#define INFTY (1<<30)
#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)
#define REP(i, N) for (int i = 0; i < (int)(N); ++i)
#define SLN(i,N) (i == N-1 ? "\n" : " ")
ll fact(ll n) { ll res = 1; for(ll i=2;i<=n;++i) res = res * i; return res;}
ll nCr(ll n, ll r) {return (fact(n)/fact(n-r)*fact(r)) ;}
ll gcd(ll a,ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
const ll MOD = 1e9+7;
const ll INF = 1LL << 60;
const int inf = 1000100011;
class Point { public: double x, y; Point(double x = 0, double y = 0) : x(x), y(y) {} Point operator+(Point p) { return Point(x + p.x, y + p.y); } Point operator-(Point p) { return Point(x - p.x, y - p.y); } Point operator*(double a) { return Point(a * x, a * y); } Point operator/(double a) { return Point(x / a, y / a); } double abs() { return sqrt(norm()); } double norm() { return x * x + y * y; } bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; } bool operator==(const Point& p) const { return fabs(x - p.y) < EPS && fabs(y - p.y) < EPS; } };
typedef Point Vector;
double norm(Vector a) { return a.x * a.x + a.y * a.y; }
double abs(Vector a) { return sqrt(norm(a));}
double dot(Vector a, Vector b) { return a.x * b.x + a.y * b.y; }
double cross(Vector a, Vector b) { return a.x * b.y - a.y * b.x; }
struct Segment { Point p1, p2; };
typedef Segment Line;
// clang-format on

#define M 2000

bool ab[100000], ac[100000], bc[100000];

bool match(char c1, char c2) { return (c1 == '?' || c2 == '?' || c1 == c2); }

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string a, b, c;
  cin >> a >> b >> c;

  int A = a.length();
  int B = b.length();
  int C = c.length();

  REP(i, A) REP(j, B) if (!match(a[i], b[j])) ab[i - j + 50000] = true;
  REP(i, A) REP(j, C) if (!match(a[i], c[j])) ac[i - j + 50000] = true;
  REP(i, B) REP(j, C) if (!match(b[i], c[j])) bc[i - j + 50000] = true;

  int ans = 3 * M;
  for (int i = -2 * M; i <= 2 * M; i++) {
    for (int j = -2 * M; j <= 2 * M; j++) {
      if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000]) {
        int L = min(0, min(i, j));
        int R = max(A, max(B + i, C + j));
        ans = min(ans, R - L);
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, k; cin >> n >> k;
    vector<int> num(n); REP(i, n) cin >> num[i];

    int res = 1;
    while(n > (k - 1) * res + 1) res++;

    cout << res << endl;
}

Measured memory_bytes: 640
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

#define NUM 999986

int* table,*ruisekiwa;
int N;

void func(){

	int prime,m,left,right;
	int to_people = 0,to_king = 0,tmp;

	for(int i = 0; i < N; i++){
		scanf("%d %d",&prime,&m);

		left = ruisekiwa[max(0,prime-m-1)];
		if(prime-m > NUM){
			left = ruisekiwa[NUM-1];
			right = ruisekiwa[NUM-1];
		}else if(prime+m >= NUM){
			right = ruisekiwa[NUM-1];
		}else{
			right = ruisekiwa[prime+m];
		}

		tmp = right - left;
		if(tmp == 0)to_king++;
		else{
			to_people += tmp-1;
		}
	}

	printf("%d\n",to_people-to_king);

}

int main(){

	table = new int[NUM];
	ruisekiwa = new int[NUM];

	for(int i = 0; i < NUM; i++){
		table[i] = 0;
		ruisekiwa[i] = 0;
	}

	int limit = sqrt(NUM);

	for(int i = 2; i <= limit; i++){
		if(table[i] == 0){
			for(int j = 2*i; j < NUM; j+=i){
				table[j] = 1;
			}
		}
	}

	for(int i = 2; i < NUM; i++){
		if(table[i] == 0){
			ruisekiwa[i] = 1;
		}
	}

	for(int i = 3; i < NUM; i++){
		ruisekiwa[i] += ruisekiwa[i-1];
	}

	while(true){
		scanf("%d",&N);
		if(N == 0)break;

		func();
	}

	return 0;
}

Measured memory_bytes: 10928
#include<bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  map<char, int> p;
  for(int i = 0; i < 4; i++) p[s[i]]++;
  vector<int> a;
  if(p.size() == 2) {
    for(auto i : p) {
      a.push_back(i.second);
    }
    if(a[0] == a[1]) cout << "Yes";
    else cout << "No";
  }
  else cout << "No";
}


Measured memory_bytes: 256
n,k=map(int,input().split())
h=list(map(int,input().split()))
dp=[0]*n
for i in range(1,n):
  dp[i]=dp[i-1]+abs(h[i-1]-h[i])
  for j in range(1,k+1):
    if i-j<0:
      break
    dp[i]=min(dp[i],dp[i-j]+abs(h[i-j]-h[i]))
    #print("i",i,"j",j,dp)
print(dp[-1])

Measured memory_bytes: 84948
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = -100100100;
// const int M = 1000000007;
const int M = 1046527;
typedef tuple<int,int, int> P;

vector<ll> d;
int n;
vector<int> a(50);

int solve(int i,int val){
    if(val==0)return 1;
    if(i==n)return 0;
    int ans = solve(i+1,val) || solve(i+1,val-a[i]);
    return ans;
}


int main(){
    int q;
    cin >> n;
    rep(i,n)cin>>a[i];
    cin >> q;
    vector<int> ans(q);
    rep(i,q){
        int m;
        cin >> m;
        ans[i] = solve(0,m);
    }
    rep(i,q){
        if(ans[i])cout<<"yes"<<endl;
        else cout << "no" << endl;
    }
    return 0;
}


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

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<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template<class T, class V>
typename enable_if<is_class<T>::value == 0>::type fill(T &t, const V &v) {
    t = v;
}
template<class T, class V>
typename enable_if<is_class<T>::value != 0>::type fill(T &t, const V &v){
    for (auto &e : t) fill(e, v);
}

#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }



int main() {
    string S;
    int K;
    cin >> S >> K;
    int N = (int)S.size();
    auto dp = make_vec<int>(N+1, N+1, K+1);
    for (int i = 0; i <= N; ++i) {
        for (int j = N; j >= i; --j) {
            for (int k = 0; k <= K; ++k) {
                if (i+1 <= N) chmax(dp[i+1][j][k], dp[i][j][k]);
                if (j-1 >= 0) chmax(dp[i][j-1][k], dp[i][j][k]);
                if (i+1 <= N && j-1 >= 0) {
                    if (k+1 <= K) chmax(dp[i+1][j-1][k+1], dp[i][j][k] + 1);
                    if (S[i] == S[j-1]) chmax(dp[i+1][j-1][k], dp[i][j][k] + 1);
                }
            }
        }
    }
    int res = 0;
    for (int k = 0; k <= K; ++k) {
        for (int i = 0; i <= N; ++i) chmax(res, dp[i][i][k] * 2);
        for (int i = 0; i < N; ++i) chmax(res, dp[i][i+1][k] * 2 + 1);
    }
    cout << res << endl;
}


Measured memory_bytes: 110336
#c=float('inf')
v={}
def rec(n,a,b,c,d):
    if n in v:
        return v[n]
    x=float('inf')
    if n==0:
        return 0
    if n==1:
        return d
    x=n*d
    if n%2==0:
            x=min(x,rec(n//2,a,b,c,d)+a)
    else:
            low=n//2
            up=n//2+1
            x=min(x,rec(low,a,b,c,d)+d*(n-low*2)+a)
            x=min(x,rec(up,a,b,c,d)+d*(up*2-n)+a)
    if n%3==0:
            x=min(x,rec(n//3,a,b,c,d)+b)
    else:
            low=n//3
            up=n//3+1
            x=min(x,rec(low,a,b,c,d)+d*(n-low*3)+b)
            x=min(x,rec(up,a,b,c,d)+d*(up*3-n)+b)
    if n%5==0:
            x=min(x,rec(n//5,a,b,c,d)+c)
    else:
            low=n//5
            up=n//5+1
            x=min(x,rec(low,a,b,c,d)+d*(n-low*5)+c)
            x=min(x,rec(up,a,b,c,d)+d*(up*5-n)+c)
    v[n]=x
    return x

for _ in range(int(input())):
    n,a,b,c,d=map(int,input().split())
    print(rec(n,a,b,c,d))
    v={}


Measured memory_bytes: 88696
n=input()
n=int(n)
sum=n *(n+1)//2
x=n//3
y=n//5
z=n//15
xsum= 3 *x*(x+1)//2
ysum= 5 *y*(y+1)//2
zsum= 15 *z*(z+1)//2

ans=sum-xsum-ysum+zsum
print(ans)

Measured memory_bytes: 9220
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
    using namespace std;
    using namespace __gnu_pbds;
    #define ll long long
    #define int long long
    #define pb push_back
    #define For(i,n) for(ll  i=0;i<n;i++)
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;clock_t clk = clock();
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define mod 998244353
    #define ld long double
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define fi first
    #define se second
    #define pii pair<ll,ll>
    #define what_is(x) cerr << #x << " is " << x << endl;
    #define time cerr << "Time (in ms): " << double(clock() - clk) * 1000.0 / CLOCKS_PER_SEC << '\n';
    const double pi=3.14159265358979323846264;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;

/**********************************************************************************************************************/
const ll man=(ll)2e5+5;
bool vis[man];
vector<ll>adj[man];
ll h[man];
ll ans=0;
void dfs(ll v)
{
    vis[v]=true;
    if(adj[v].size()==0)
    {
        ans++;
        return;
    }
    ll check=0;
    for(auto u:adj[v])
    {
        if(h[u]>=h[v])check++;
    }
    if(check==0)ans++;
    for(auto u:adj[v])
    {
        if(vis[u]==0)
        {
            dfs(u);
        }
    }
}
signed main()/*Check flow ---question galat mat padhna yr*/
{
    fast;
    ll n,m;
    cin>>n>>m;
    For(i,n)cin>>h[i+1];
    For(i,m)
    {
        ll u,v;
        cin>>u>>v;
        adj[v].pb(u);
        adj[u].pb(v);
    }
    
    for(ll i=1;i<=n;i++)
    {
        if(vis[i]==0)
        {
            dfs(i);
        }
    }
    cout<<ans<<endl;
}   

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

using namespace std;
using ll = long long;

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);
    return a / g * b;
}

int main()
{
    int n; cin >> n;
    vector<ll> t(n);

    for (int i = 0; i < n; ++i) cin >> t[i];

    ll ans = 1LL;
    for (int i = 0; i < n; ++i) {
        ans = lcm(ans, t[i]);
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
$n=<>;
@a=glob<>;

for($i=0;$i<$n;$i+=2){
    $e{$a[$i]}++;
    $o{$a[$i+1]}++;
}

@ee=sort {$e{$b} <=> $e{$a}} keys %e;
@oo=sort {$o{$b} <=> $o{$a}} keys %o;

if($ee[0]!=$oo[0]){
    print $n-$e{$ee[0]}-$o{$oo[0]};
} else{
    $x=$e{$ee[1]}+$o{$oo[0]};
    $y=$e{$ee[0]}+$o{$oo[1]};
    $z=($x>$y)?$x:$y;
    print $n-$z;
}


Measured memory_bytes: 29704
var
l:array[0..200] of longint;
s:array[0..200] of string[20];
i,n,j:longint;
begin
readln(n);
for i:=1 to n do 
begin 
  readln(s[i]);
  l[i]:=length(s[i]);
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if s[i]=s[j] then
begin
writeln('No');
halt;
end;
for i:=2 to n do
if s[i,1]<>s[i-1,l[i-1]] then
begin
writeln('No');
halt;
end;
writeln('Yes');
end.

Measured memory_bytes: 128
import bisect
import numpy as np
n=int(input())
l=list(map(int, input().split()))
l=np.array(l)
l.sort()
ans=0
for i in range(n-2):
  for j in range(i+1,n-1):
    if l[j]==l[i]:
      continue
    ans+=bisect.bisect_left(l, l[i]+l[j])-bisect.bisect_right(l, l[j]) #n未満の個数を数える
print(ans)

Measured memory_bytes: 26992
import bisect
from collections import defaultdict as dd

def factorize(n):
    b = 2
    fct = []

    while b * b <= n:
        while n % b == 0:
            n //= b
            fct.append(b)
        b += 1
    
    if n > 1:
        fct.append(n)
    
    return fct

N = int(input())
f = factorize(N)
dic = dd(int)

for val in f:
    if val != 1:
        dic[val] += 1
res = 0

ls = [1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66]

for val in dic.values():
    tmp = bisect.bisect_right(ls, val)
    res += tmp

print(res)

Measured memory_bytes: 9484
words = readlines.map{|i| i.chomp}
words.shift

rlt = nil

if words == words.uniq
  pword = words.shift
  words.each do |word|
    unless pword[-1] == word[0]
      rlt = 'No'
      break
    end
    pword = word
  end
else
  rlt = 'No'
end


puts rlt || 'Yes'

Measured memory_bytes: 1788
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
	static long GetIndex(char text)
	{
		return char.ToUpper(text) - 64;

	}
	static void Main(string[] args)
	{
		var input = long.Parse(Console.ReadLine());

		var ans = "";
		while (input > 0)
		{
			long mod = input % 26;
			var alphabet = Convert.ToChar(mod + 64);
			if (mod == 0)
			{
				alphabet = 'z';
				input--;
			}


			ans = Char.ToLower(alphabet) + ans;
			input /= 26;
		}

		System.Console.WriteLine(ans);
	}
}


Measured memory_bytes: 27828
#include<stdio.h>
int main()
{
    int A1,A2,A3;
    scanf("%d %d %d",&A1,&A2,&A3);
    if(A1+A2+A3>=22)
    {
        printf("bust\n");
    }
    else
    {
        printf("win\n");
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] token = br.readLine().split(" ");
		int n = Integer.parseInt(token[0]);
		int m = Integer.parseInt(token[1]);
		int l = Integer.parseInt(token[2]);
		int[][] a = new int[n][m];
		int[][] b = new int[m][l];

		for(int i = 0; i < n; i++){

			token = br.readLine().split(" ");

			for(int j = 0; j < m; j++){
				a[i][j] = Integer.parseInt(token[j]);
			}

		}

		for(int i = 0; i < m; i++){

			token = br.readLine().split(" ");

			for(int j = 0; j < l; j++){
				b[i][j] = Integer.parseInt(token[j]);
			}

		}

		for(int i = 0; i < n; i++){
			for(int j = 0; j < l; j++){

				long ans = 0;

				for(int k = 0; k < m; k++){
					ans += a[i][k] * b[k][j];
				}

				System.out.print(ans);

				if(j != l - 1){
					System.out.print(" ");
				}else{
					System.out.print("\n");
				}

			}
		}

	}
}

Measured memory_bytes: 39708
<?php
  list($n) = explode(" ", trim(fgets(STDIN)));

  $a = explode(" ", trim(fgets(STDIN)));

  $ng = 0;
  for ($i=1; $i<=$n; $i++) {
    if($a[$i-1] != $i){
      $ng++;
    }
  }

  if($ng <= 2){
    echo "YES";
  }else{
    echo "NO";
  }

Measured memory_bytes: 4604
#include <bits/stdc++.h>
#define il inline
#define ll long long
const int N=605,P=1e9+7;

int n,K,ans,to[N],s[N],f[N][N],g[N];

il int cal(int l,int r)
{
	if ((s[r]-s[l-1]&1)||(r-l+1&1)) return 0; int i;
	for (i=l; i<=r; i++) if (to[i]&&(to[i]<l||to[i]>r)) return 0;
	f[l][r]=g[s[r]-s[l-1]>>1];
	for (i=l+1; i<r; i++) f[l][r]=(f[l][r]-(ll)f[l][i]*g[s[r]-s[i]>>1]%P+P)%P;
	return (ll)f[l][r]*g[s[l-1]+s[n]-s[r]>>1]%P;
}

int main()
{
	scanf("%d%d",&n,&K),n+=n; int i,j,u,v;
	for (i=1; i<=K; i++) scanf("%d%d",&u,&v),to[u]=v,to[v]=u;
	for (i=1; i<=n; i++) s[i]=s[i-1]+(!to[i]);
    for (i=g[0]=1; i<N; i++) g[i]=(ll)g[i-1]*(i+i-1)%P;
	
	for (i=1; i<=n; i++) for (j=i+1; j<=n; j++) ans=(ans+cal(i,j))%P;
	printf("%d",ans);
	
	return 0;
}

Measured memory_bytes: 5184
#include <iostream>
using namespace std;
#include<string>
int main(){
	int sunadakun=0;
	string S,sunadatyan="abc";
      cin>>S;
      for(int ii=0;ii<3;ii++){
      	for(int i=0;i<3;i++){
      		if(S[i]==sunadatyan[ii]){
      			sunadakun=sunadakun+1;
      			break;
      		}
      	}
      }
      if(sunadakun==3){
      	cout<<"Yes"<<endl;
      }
      else{
      	cout<<"No"<<endl;
      }
}


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

int A, B, C, K;

int solve(int a, int b, int c, int k) {
  if(k == 0) return a + b + c;
  return max(solve(2*a, b, c, k -1), max(solve(a, 2*b, c, k - 1), solve(a, b, 2*c, k - 1)));
}

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

  cout << solve(A, B, C, K) << endl;
  return 0;
}


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

int main() {
  int n;
  cin>>n;
  unordered_map<int, int> seen;
  for(int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    seen[x]++;
  }
  int res = 1;
  for(pair<int, int> freq : seen) {
    int key = freq.first;
    int val = freq.second;
    // case 1: there are not exactly two of the same values
    // case 2: there are more than one or zero 0s if it's even or odd, resp
    // case 3: case 1 and case 2 don't hold so we multiple res by 2;
    if((n&1)==1 && (key&1)==1) {
      cout << 0 << endl;
      return 0;
    }
    if((n&1)==0 && (key&1)==0) {
      cout << 0 << endl;
      return 0;
    }
    if((key == 0) && ((n&1)==1) && (val != 1)) {
      cout << 0 << endl;
      return 0;
    }
    if((key == 0) && ((n&1)==0) && (val != 0)) {
      cout << 0 << endl;
      return 0;
    }
    if(key == 0) {
      continue;
    }
    if(val != 2) {
      cout << 0 << endl;
      return 0;
    }
    res = (res * 2) % (1000000000 + 7);
  }
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
// types
typedef long long ll; 
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
// IO
#define fo(i, n) for (int i = 0; i < n; i++)
#define fo1(i, n) for (int i = 1; i <= n; i++)
#define sc(n) scanf("%d", &n) 
#define sca(a, n) fo(i, n) sc(a[i])
#define pd(a) printf("%d ", a)
#define pld(a) printf("%d\n", a)
#define pda(a, n) fo(i, n) pd(a[i])
#define pl printf("\n")
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b) 
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
// math
const ll mod = 1e9+7;
template<typename T> T gcf(T a, T b) {return (b == 0) ? a : gcf(b, a%b);} 
template<typename T> T lcm(T a, T b) {return (a*b)/gcf(a, b);}
template<typename T> T sumTo(T x) {return x * (x+1) / 2;}
template<typename T> T sumSquaresTo(T x) {return x * (x+1) * (2*x+1) / 6;}
template<typename T> T ceilDiv(T n, T d) {return (n+d-1)/d;}

void solve() {
    char c; cin >> c;
    if ('a' <= c && c <= 'z') cout << 'a';
    else cout << 'A';
}

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

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

int main(){
  string n;
  cin >> n;
  rep(i,n.size()){
    if(n.at(i)=='7'){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};


int main() {

	char a,b,c;
	int e,f,g;
	cin>>a>>b>>c;

	if(a=='9'){
		e=1;
	}
	if(a=='1'){
		e=9;
	}
	if(b=='9'){
		f=1;
	}
	if(b=='1'){
		f=9;
	}
	if(c=='9'){
		g=1;
	}
	if(c=='1'){
		g=9;
	}

	cout<<e<<f<<g<<endl;



	return 0;
}


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

using namespace std;

int main() {
    int n;
    int x = 0;
    int max_x = 0;
    string s;

    cin >> n >> s;

    for (int i=0; i<s.size(); i++) {
        if(s[i]=='I') {
            x++;
        } else if(s[i]=='D') {
            x--;
        }

        max_x = max(max_x, x);
    }

    cout << max_x << endl;

    return 0;
}


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

int main(){
    
    int N;
    std::cin >> N;
    
    string ans;
    if (N == 0)
    {
        std::cout << 0 << std::endl;
    }
    else
    {
        while (N != 0)
        {
            if (abs(N) % 2 == 1)
            {
                ans = ans + "1";
                N -= 1;
            }
            else
            {
                ans = ans + "0";
            }
            
            N /= -2;
        }
    }
    
    for (int i = ans.length() - 1; i >= 0; i--) 
    {
        std::cout << ans[i];
    }
    std::cout << std::endl;
    
    return 0;
}

Measured memory_bytes: 256
Option Explicit On

Module Module1

    Sub Main()

        Dim X As Long = Console.ReadLine()

        Dim yokin As Long = 100
        Dim year As Long = 0
        Do
            yokin = Math.Floor(yokin * 1.01)
            year += 1
            If yokin >= X Then
                Console.WriteLine(year)
                Exit Do
            End If
        Loop
        Console.ReadLine()

    End Sub

End Module


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

int n,m;

int main(){
  int i,j;
  double max=0;
  cin >> n;
  for(i=1;i<=1000;i++)for(j=2;j<10;j++)if(pow(i,j)<=(double)n&&pow(i,j)>max){
	max=pow(i,j);
      }
  cout << (int)max << endl;

  return 0;
}


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

#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
typedef long long ll ;
typedef long double ld ;

const ll MOD = 998244353, INF = 2E18 + 5 ;
const double PI = 2 * acos(0.0) ;
const long double EPS = 1.0E-14 ;

int main()
{
    long double a, b, ans ;
    cin >> a >> b ;
    ans = a * b ;
    cout.precision(20) ;
    cout << floor(ans) ;

    return 0 ;
}


Measured memory_bytes: 3796
/*
 _    _    _______   _    _
| |  / /  |  _____| | |  / /
| | / /   | |       | | / /
| |/ /    | |_____  | |/ /
| |\ \    |  _____| | |\ \
| | \ \   | |       | | \ \
| |  \ \  | |_____  | |  \ \
|_|   \_\ |_______| |_|   \_\

*/
#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef double ld;
typedef pair <int, int> PII;
typedef pair <ll, ll> PLL;

#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define right(x) x << 1 | 1
#define left(x) x << 1
#define forn(x, a, b) for (int x = a; x <= b; ++x)
#define for1(x, a, b) for (int x = a; x >= b; --x)
#define mkp make_pair
#define sz(a) (int)a.size()
#define all(a) a.begin(), a.end()
#define y1 kekekek

const ll ool = 1e18 + 9;
const int oo = 1e9 + 9, base = 1e9 + 7;
const ld eps = 1e-7;
const int N = 2e6 + 6;

int n, a[N];
ll sum, ans;

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

    cin >> n;
    forn(i, 1, n) cin >> a[i];
    vector < int > st;
    st.eb(0);
    forn(i, 1, n) {
        while (sz(st) > 1 && a[st.back()] > a[i]) {
            sum -= 1ll * a[st.back()] * (st.back() - st[sz(st) - 2]);
            sum += 1ll * a[i] * (st.back() - st[sz(st) - 2]);
            st.pop_back();
        }
        st.eb(i);
        sum += a[i];
        ans += sum;
    }

    cout << ans << "\n";

	return 0;
}


Measured memory_bytes: 2168
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    int p = n % 1000;
    if(p == 0){
        cout << 0 << endl;
    }else{
        cout << 1000 -(n % 1000) << endl;
    }
}


Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		int[] a = new int[n];
		int count = 0;
		for(int i = 0; i < n; i++) {
			a[i] = scan.nextInt();
		}
		int i = 1;
		do {
			if(a[i] == a[i-1]){
				count++;
				i++;
			}
			i++;
		} while(i < n);
		System.out.println(count);
	}
}

Measured memory_bytes: 23252
import bisect
N=int(input())
A=sorted(list(map(int, input().split())))
B=sorted(list(map(int, input().split())))
C=sorted(list(map(int, input().split())))
#真ん中を固定
ba=0
bc=N
ans=0
for i in range(N):
    b=B[i]
    if ba!=N:
        while A[ba]<b:
            ba+=1
            if ba==N:
                break
    if bc!=0:
        while C[N-bc]<=b:
            bc-=1
            if bc==0:
                break
    ans+=ba*(bc)
    #print(ba,bc)
print(ans)


Measured memory_bytes: 23092