akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define REL

#pragma GCC target ("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <deque>
#include <queue>
#include <iomanip>
#include <cstdio>
#include <unordered_map>
#include <unordered_set>
#include <map>
#include <string>
#include <set>
#include <bitset>
#include <cstdint>
#include <cstring>
#include <cassert>
#include <complex>
#include <stack> 
#include <random>

using namespace std;

typedef int64_t i64;
typedef long long LL;
typedef long long ll;
typedef long double LD;
typedef complex <LD> cld;
typedef unsigned int uint;
typedef complex <double> cd;
typedef unsigned long long ULL;

#define endl "\n"
#define dendl "\n\n"
#define mp make_pair
#define mt make_tuple
#define size(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

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

template <typename T>
T sqr(T a) {
	return a * a;
}

template <typename T>
int sign(T a) {
	if (a == 0)
		return 0;
	return (a > 0 ? 1 : -1);
}

template <typename T>
bool uax(T& a, const T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

template <typename T>
bool uin(T& a, const T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}

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

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

mt19937_64 rnd(0);

const int LOG = 64;
const int N = (int)2e5 + 7;
const int MAXN = (int)1e6 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e9 + 7;
const int CONST = 450;
const LL LINF = (i64)1e18;
const LD PI = 3.1415926535897932384626433832795;
const LD EPS = 1;

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

void solve() {
	LL n; cin >> n;
	LL p[13] = {};
	p[0] = 1;
	for (int i = 1; i < 13; i++)
		p[i] = 1LL * p[i - 1] * 26;
	LL val = 0;
	int len = 0;
	for (int i = 1; i < 13; i++) {
		val += p[i];
		if (n <= val) {
			len = i;
			n -= val - p[i];
			break;
		}
	}
	for (int i = 0; i < len; i++) {
		for (char c = 'a'; c <= 'z'; c++) {
			LL val = p[len - i - 1];
			if (n <= val) {
				cout << c;
				break;
			}
			n -= val;
		}
	}
}

int main() {
	double start = clock();
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	cout << fixed << setprecision(20);
	cerr << fixed << setprecision(20);
#else
	cout << fixed << setprecision(20);
	ios_base::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	rnd.seed(time(0));
#endif
		
	int t = 1;
	for (int i = 0; i < t; i++) {
		solve();
	}

#ifdef _DEBUG
	cout << endl << "Time is " << (clock() - start) / 1000.0;
#endif
}

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

int main() {
  int K,A,B;
  cin>>K>>A>>B;
  int i=1;
  while(1){
    if(A<=K*i and K*i<=B){
      cout<<"OK";
      return 0;
    }
    if(K*i>B){
      cout<<"NG";
      return 0;
    }
    i++;
  }
}

Measured memory_bytes: 3636
#include<cstdio>
#include<cmath>
#include<string>
#include<vector>
#include<algorithm>

using namespace std;

int main()
{
	int n;

	scanf("%d", &n);

	char input[30001];
	string str;
	vector<int> pos[10];

	scanf("%s", input);

	str = input;

	for (int i = 0; i < n; i++)
	{
		pos[str[i] - '0'].push_back(i);
	}

	int sol = 0;

	for (int i = 0; i < 10; i++)
	{
		if (pos[i].empty())
		{
			continue;
		}

		for (int j = 0; j < 10; j++)
		{
			if (pos[j].empty())
			{
				continue;
			}

			for (int k = 0; k < 10; k++)
			{
				if (pos[k].empty())
				{
					continue;
				}

				int lb, ub;

				lb = pos[i].front();
				ub = pos[k].back();

				if (lb == ub)
				{
					continue;
				}

				vector<int>::iterator ret;

				ret = upper_bound(pos[j].begin(), pos[j].end(), lb);

				if (ret == pos[j].end() || *ret >= ub)
				{
					continue;
				}

				sol++;
			}
		}
	}

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

	return 0;
}

Measured memory_bytes: 512
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]


#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

import heapq

N = I()
A = III()
B = III()

x = []
for i,b in enumerate(B):
    heapq.heappush(x,(-b,i))

counter = 0

while x:
    temp = heapq.heappop(x)
    i = temp[1]
    b = -temp[0]
    a = B[(i-1)%N]
    c = B[(i+1)%N]
    if b == A[i]:
        continue
    elif b<A[i]:
        print(-1)
        exit()
    else:
        d,m = divmod(b-A[i],a+c)
        if d==0:
            print(-1)
            exit()
        elif m == 0:
            B[i] = A[i]
            counter = counter+d
        else:
            B[i] = A[i]+m
            heapq.heappush(x,(-B[i],i))
            counter = counter+d

print(counter)

Measured memory_bytes: 122992
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
const long long maxn = 1e6;
struct Node{
	int ai,bi;
}node[maxn];
bool cmp(Node a,Node b)
{
	if(a.bi == b.bi) return a.ai < b.ai;
	return a.bi < b.bi;
}
int main(void)
{
	scanf("%d",&n);
	for(int i = 1;i<=n;i++)
		scanf("%d %d",&node[i].ai,&node[i].bi);
	sort(node+1,node+1+n,cmp);
	int ans = 0;
	for(int i = 1;i<=n;i++)
	{
		if((ans + node[i].ai) <= node[i].bi) ans += node[i].ai;
		else{
			puts("No");
			return 0;
		}
	}
	puts("Yes");
	return 0;
}

Measured memory_bytes: 1792
w = int(input())
n = int(input())

amida = [i for i in range(1, w + 1)]
for _ in range(n):
    a, b = [int(i) - 1 for i in input().split(",")]
    amida[a], amida[b] = amida[b], amida[a]

for x in amida:
    print(x)



Measured memory_bytes: 5596
import java.util.*;
import java.io.*;
import java.lang.reflect.Array;
import java.math.BigInteger;

import static java.lang.Math.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
 
public class Main{
    static long mod=1000000007;
//    static int dx[]={-1,0,1,0};
//    static int dy[]={0,-1,0,1};

    public static void main(String[] args)   throws Exception, IOException{        
        Reader sc = new Reader(System.in);
        PrintWriter out=new PrintWriter(System.out);

//        int n=sc.nextInt();
        char c[]=sc.nextString().toCharArray();
        int n=15-c.length;
        for (int i = 0; i < c.length; i++) {
			if(c[i]=='o')n++;
		}
        
        
        out.println(n>=8?"YES":"NO");
        out.flush();
    }
    



    static boolean validpos(int x,int y,int r, int c){
        return x<r && 0<=x && y<c && 0<=y;
    }

    static void db(Object... os){
        System.err.println(Arrays.deepToString(os));
    }  
}

//class P {
//    int id, d;
//    P(int  id, int d) {
//        this.id=id;
//        this.d=d;
//    }
//}

//class P implements Comparable<P>{
//	int x,w,id,ox;
//	P(int id, int x, int w) {
//		this.id=id;
//		this.x=x;
//		this.w=w;
//	}
//
//	public int compareTo(P p){
//		if(x==p.x) {
//			return w-p.w;
//		}
//		return x-p.x;
//	}
//}

class Reader
{ 
    private BufferedReader x;
    private StringTokenizer st;
    
    public Reader(InputStream in)
    {
        x = new BufferedReader(new InputStreamReader(in));
        st = null;
    }
    public String nextString() throws IOException
    {
        while( st==null || !st.hasMoreTokens() )
            st = new StringTokenizer(x.readLine());
        return st.nextToken();
    }
    public int nextInt() throws IOException
    {
        return Integer.parseInt(nextString());
    }
    public int[] nextIntArray(int size) throws IOException{
    	int r[] = new int[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextInt(); 
		}
    	return r;
    }
    public long[] nextLongArray(int size) throws IOException{
    	long r[] = new long[size];
    	for (int i = 0; i < size; i++) {
			r[i] = this.nextLong(); 
		}
    	return r;
    }
    public long nextLong() throws IOException
    {
        return Long.parseLong(nextString());
    }
    public double nextDouble() throws IOException
    {
        return Double.parseDouble(nextString());
    }
}


Measured memory_bytes: 24532
import sys
input = sys.stdin.readline
sys.setrecursionlimit(100000000)
MOD = 10 ** 9 + 7
INF = 10 ** 10

MAXN = 100005
G = [[] for _ in range(MAXN)]
dp = [[] for _ in range(MAXN)]
deg = [0] * MAXN
parents = [-1] * MAXN
result = [0] * MAXN

def dfs1(v,mod,p = -1):
    ans = 1
    for i in range(deg[v]):
        e = G[v][i]
        if e == p:
            parents[v] = i
            continue
        dp[v][i] = dfs1(e,mod,v)
        ans *= dp[v][i] + 1
        ans %= mod
    return ans%mod

def dfs2(v,mod,res_p = 1,p = -1):
    if p != -1:
        dp[v][parents[v]] = res_p
    cuml = [1] * (deg[v] + 1)
    cumr = [1] * (deg[v] + 1)
    for i in range(deg[v]):
        cuml[i + 1] = cuml[i] * (1 + dp[v][i]) % mod
    for i in range(deg[v] - 1,-1,-1):
        cumr[i] = cumr[i + 1] * (1 + dp[v][i]) % mod
    result[v] = cumr[0]
    for i in range(deg[v]):
        e = G[v][i]
        if e == p:
            continue
        dfs2(e,mod,cuml[i] * cumr[i + 1] % mod,v)

def main():
    n,m = map(int,input().split())
    for _ in range(n - 1):
        x,y = map(int,input().split())
        x -= 1
        y -= 1
        G[x].append(y)
        G[y].append(x)
    
    for i in range(n):
        deg[i] = len(G[i])
        dp[i] = [1] * deg[i]
    
    dfs1(0,m)
    dfs2(0,m)
    for i in range(n):
        print(result[i])      

if __name__=='__main__':
    main()


Measured memory_bytes: 153132
import collections as co
n = int(raw_input())
aa = map(int, raw_input().split())

c = co.Counter(aa).most_common()

if len(c) > 2:
  print 'No'
  exit()

if len(c) == 1:
  cc = c[0][0]
  if cc == n-1:
    print 'Yes'
  elif cc*2 <= n:
    print 'Yes'
  else:
    print 'No'
  exit()

l = c[0]
s = c[1]
if l[0] < s[0]:
  l,s = s,l

if l[0] != s[0] + 1:
  print 'No'
  exit()

if (n-l[0])+1 <= l[1] <= (n-l[0])*2:
# if (n-l[0])+1 <= l[1] <= (n-l[0])*2 and n-(n-l[0])*2 <= s[1] <= l[0] - 1:
  print 'Yes'
else:
  print 'No'

Measured memory_bytes: 23908
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: i32 = read();
    let k: i32 = read();
    let mut ans = 1;

    for _ in 0..n {
        if ans * 2 < ans + k {
            ans *= 2;
        } else {
            ans += k
        }
    }
    println!("{}", ans);
}

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


Measured memory_bytes: 4352
#include<stdio.h>
int main ()
{
	long long int A[222222];
	long long int n;
	long long int d=1e9+7;
	scanf("%lld",&n);
	long long int sum=0;
	long long int num=0;
	int i;
	for(i=0;i<n;i++){
		scanf("%lld",&A[i]);
		sum+=A[i]*num;
		num+=A[i];
		sum%=d;
		num%=d;
	}
	printf("%lld",sum);
	return 0;
}

Measured memory_bytes: 3236
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <random>
#include <chrono>
#include <atcoder/all>
 
using namespace std;
using namespace __gnu_pbds;
using namespace atcoder;
 
#define endl '\n'
 
typedef long long ll;
typedef pair<int, int> pii;
typedef tree<int, null_type,less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
 
template<typename T>
static T randint(T lo, T hi){
	return uniform_int_distribution<T>(lo, hi)(rng);
}


int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
 
	// freopen("capastaty_input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	int t;
	cin >> t;

	while(t--){
		ll n, m, a, b;
		cin >> n >> m >> a >> b;
		cout << floor_sum(n, m, a, b) << endl;
	}


	return 0;
}


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


int main(void) {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int a, b;
	cin >> a >> b;
	
	cout << a * b << " " << 2 * (a + b) << "\n";

	return 0;
}

Measured memory_bytes: 1196
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <iostream>
#include <map>
#include <set>
#include <utility>
#include <vector>

using namespace std;

int main(){
  int N;
  scanf("%d", &N);
  map<int,int> a;
  for (int i = 1; i <= N; i++){
    int ai;
    scanf("%d", &ai);
    a[i] = ai;
  }
  int counter = 0;  
  for (int i = 1; i <= N; i++){
    if (a[a[i]] == i){
      counter++;
    }
  }
  counter /= 2;
  cout << counter << endl;
  return 0;
}


Measured memory_bytes: 4992
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

// repetition
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// container util
#define all(x) (x).begin(), (x).end()

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                         \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
       << " " << __FILE__ << endl;

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
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;
}
//

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

  string s, t;
  cin >> s >> t;
  int res = 0;
  rep(i, 3) if (s[i] == t[i]) res++;

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n,m) for(int i=n;i<(int)(m);i++)
#define rrep(i,n,m) for(int i=((int)(n)-1);i>=m;i--)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
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...));
}
int main(){
    int n;
    cin>>n;
    vector<int> a(n);
    rep(i,0,n)  cin>>a[i];
    sort(all(a));
    if(n%2==0){
        ll ans=0;
        rep(i,0,n/2) ans-=(ll)2*a[i];
        rep(i,n/2,n) ans+=(ll)2*a[i];
        ans-=a[n/2];
        ans+=a[n/2-1];
        cout<<ans<<endl;
    }
    else{
        ll ans=0;
        
        ll now=0;
        rep(i,0,n/2) now-=(ll)2*a[i];
        rep(i,n/2,n) now+=(ll)2*a[i];
        now-=a[n/2]+a[n/2+1];
        ans=max(ans,now);
        
        now=0;
        rep(i,0,n/2+1) now-=(ll)2*a[i];
        rep(i,n/2+1,n) now+=(ll)2*a[i];
        now+=a[n/2-1]+a[n/2];
        ans=max(now,ans);
        
        cout<<ans<<endl;
    }
}


Measured memory_bytes: 640
<?php
//error_reporting(0);
$S = trim(fgets(STDIN));
$T = trim(fgets(STDIN));

$s = array_fill(0,26,-1);
$g = array_fill(0,26,-1);

for($i=0;$i<strlen($S);$i++)  {
  $a = ord($S[$i])-ord('a');
  $b = ord($T[$i])-ord('a');
  if ($s[$a] != -1 || $g[$b] != -1) {
    if ($s[$a] != $b || $g[$b] =! $a) {
      printf("No\n");
      exit;
    }
  }
  else {
    $s[$a]=$b;
    $g[$b]=$a;
  }
}

printf("Yes\n");


Measured memory_bytes: 4268
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<functional>
using namespace std;
using ll = long long int;
#define rep(i, a, b) for (int(i) = a; (i) < (int)(b); (i)++)

int main(){
    string S;
    int Q,T,F;
    int rev_cnt=0;
    char C;
    string pre = "",post = "";
    cin >> S >> Q;
    for(int i=0;i<Q;i++){
        cin >> T;
        if (T==1) rev_cnt +=1;
        else{
            cin >>  F >> C;
            if(F==1 && rev_cnt%2==0) pre = C + pre;
            else if(F==1 && rev_cnt%2==1) post = post + C;
            else if (F==2 && rev_cnt%2==0) post = post + C;
            else pre = C + pre; 
        }
    }
    S = pre + S + post;
    if(rev_cnt%2==1) reverse(S.begin(),S.end());
    cout << S << endl;
}

Measured memory_bytes: 1512
#include <iostream>

using namespace std;

int main(){
    long long N, K;

    cin >> N >> K;

    long long min = N;
    long long tmp = 0;
    if( N % K == 0){
        cout << "0" << endl;
        return 0;
    }else{
        N = N % K;
    }

    while( true ){
        if(N-K > 0){
            N = N-K;
        }else{
            N = K-N;
        }
        if(min > N){
            min = N;
            // cout << "Min: " << min << endl;
        }else{
            break;
        }
    }

    cout << min << endl;

    return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef std::pair<int,int> pair2;
typedef std::pair<int,pair2> pair3;
const ll INF = 1LL<<60;

struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(int N) : par(N) { //最初は全てが根であるとして初期化
        for(int i = 0; i < N; i++) par[i] = i;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y) { // xとyの木を併合
        int rx = root(x); //xの根をrx
        int ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};


int main(){
ll N,M;
  cin>>N>>M;
  ll A[M],B[M];
  
  UnionFind tree(N+1);
  
  for(ll i=0;i<M;i++){
  cin>>A[i]>>B[i];
    tree.unite(A[i],B[i]);
  }
  
  
  vector<ll> count(N+1,0);
  
  for(ll i=1;i<N+1;i++){
  count[tree.root(i)]++;
  }
  ll ans=0;
  for(ll i=1;i<N+1;i++){
  ans=max(ans,count[i]);
  }
  
  cout<<ans<<endl;
  
}


Measured memory_bytes: 14672
#include <iostream>
#include <cstring>
#include <vector>
#define mod 1000000007
using namespace std;
typedef long long ll;
const int MAXN = 305;
vector<pair<int , int> >vc[MAXN];
int dp[MAXN][MAXN][MAXN];
bool check(int r , int g , int b) {
    int k = max(r , max(g , b));
    int len = vc[k].size();
    for(int i = 0 ; i < len ; i++) {
        int l = vc[k][i].first , x = vc[k][i].second;
        int cnt = 0;
        if(r >= l) cnt++;
        if(g >= l) cnt++;
        if(b >= l) cnt++;
        if(cnt != x) return false;
    }
    return true;
}
int main() {
    int n , m;
    cin >> n >> m;
    for(int i = 0 ; i < m ; i++) {
        int l , r , x;
        cin >> l >> r >> x;
        vc[r].push_back(make_pair(l , x));
    }
    memset(dp , 0 , sizeof(dp));
    dp[0][0][0] = 1;
    ll ans = 0;
    for(int r = 0 ; r <= n ; r++) {
        for(int g = 0 ; g <= n ; g++) {
            for(int b = 0 ; b <= n ; b++) {
                if(!dp[r][g][b]) continue;
                if(!check(r , g , b)) {
                    dp[r][g][b] = 0;
                    continue;
                }
                int k = max(r , max(g , b));
                if(k == n) ans = (ans + (ll)dp[r][g][b]) % mod;
                dp[k + 1][g][b] += dp[r][g][b] % mod;
                dp[k + 1][g][b] %= mod;
                dp[r][k + 1][b] += dp[r][g][b] % mod;
                dp[r][k + 1][b] %= mod;
                dp[r][g][k + 1] += dp[r][g][b] % mod;
                dp[r][g][k + 1] %= mod;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int N,Y;
  cin>>N>>Y;
  for(int i=0;i<=N;i++){
    for(int j=0;j<=N-i;j++){
      if(i*10000+j*5000+1000*(N-j-i)==Y){
        cout<<i<<" "<<j<<" "<<N-j-i<< endl;
        return 0;
      }
    }
  }
  cout<<"-1 -1 -1"<< endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int l = 0, M = 0, S = 0;
        for (int i = 0; i < N; ++i){
            l = sc.nextInt();
            M = Math.max(M, l);
            S += l;
        }

        System.out.println(2 * M < S ? "Yes" : "No");

        sc.close();
    }
}

Measured memory_bytes: 23892
process.stdin.on('data', function (chunk) {
    const n = chunk.toString();
    const a = n.replace("\n","");
    const arr = a.split(' ');
    const yoko = Number(arr[0]);
    const tate = Number(arr[1]);
    const x = Number(arr[2]);
    const y = Number(arr[3]);
    const r = Number(arr[4]);
    if(x-r < 0 || x+r > yoko || y-r < 0 || y+r > tate){
        console.log("No");
    }else{
        console.log("Yes");
    }
})



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

int main() {
  string s, t;
  cin >> s >> t;
  
  int ans = 0;
  for(int i = 0; i < (int)s.size(); i++){
    if(s.at(i) != t.at(i)) ans++;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 3912
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<string.h>
#include<complex>
#include<math.h>
using namespace std;
typedef long long int llint;
#define rep(i,n) for(int i=0;i<n;i++)

bool check(char a, char b) {
	return a > b;
}

int kuraiwa(int n) {
	int ans = 0;
	while (n > 0) {
		ans += n % 10;
		n /= 10;
	}
	return ans;
}

bool kaibun(int n) {
	int a[5];
	for (int i = 0; i < 5; i++) {
		a[i] = n % 10;
		n /= 10;
	}
	if (a[0] == a[4] && a[1] == a[3]) {
		return true;
	}
	else {
		return false;
	}
}

int main() {
	char s[220], t[110];
	cin >> s;
	int cnt = 0;
	rep(i, strlen(s)){
		if (i == 0){
			if (s[i] != 'A'){
				cout << "WA" << endl;
				return 0;
			}
		}
		else{
			if (s[i] == 'C'){
				if (cnt != 0){
					cout << "WA" << endl;
					return 0;
				}
				else if (i < 2 || strlen(s) - 2 < i){
					cout << "WA" << endl;
					return 0;
				}
				else{
					cnt++;
				}
			}
			else{
				if ('a' > s[i] || 'z' < s[i]){
					cout << "WA" << endl;
					return 0;
				}
			}
		}
	}
	if (cnt == 0){
		cout << "WA" << endl;
		return 0;
	}
	cout << "AC" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int 
#define fori(i,n) for(i=0; i<n; i++)
#define ford(i,n) for(i=n-1; i>=0; i--)
#define vi vector<int> 
#define vs vector<string>
#define vll vector<ll>
#define di deque<int>
#define vpii vector<pair<int,int>>
#define vpll vector<pair<ll,ll>>
#define pqi priority_queue<int>
#define pqll priority_queue<ll>
#define mod1 1000000007
#define mod2 998244353
#define pb push_back
#define fi first
#define se second

#define fast_cin() ios::sync_with_stdio(false); cin.tie(nullptr)

using namespace std;


int main(int argc, char const *argv[]){
    fast_cin();
    string a, b;
    cin>>a>>b;
    if(a.length()==1 && b.length()==1) cout<<(a[0]-48)*(b[0]-48)<<"\n";
    else cout<<"-1\n";
    return 0;
}



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

bool match(string s, string t){
    int l = s.length();
    for (int i = 0; i < l; ++i){
        if (s[i] != '?' && s[i] != t[i]){
            return false;
        }
    }
    return true;
}

int main() {
    string S, T, ans = "UNRESTORABLE";
    cin >> S >> T;
    int sl = S.length();
    int tl = T.length();
    for (int i = sl-tl; i >= 0; --i){
        string s = S.substr(i, tl);
        if (match(s, T)){
            ans = S.substr(0, i) + T + S.substr(i + tl, sl - tl - i);
            for (int j = 0; j < ans.length(); j++){
                if (ans[j] == '?') ans[j] = 'a';
            }
            break;
        }
    }
    cout << ans << endl;
    return 0;
}


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

using namespace std;

#define pb push_back
#define endl "\n"
#define all(x) x.begin(), x.end()
#define ll long long

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	double x[n];
	string s[n];
	for(int i = 0; i < n; i++) {
		cin >> x[i] >> s[i];
	}
	long double sum = 0;
	for(int i = 0; i < n; i++) {
		if(s[i] == "JPY") {
			sum += x[i];
		} else {
			sum += x[i] * 380000;
		}
	}
	cout << sum << "\n";
}



Measured memory_bytes: 256
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())
print(a[K - 1])

Measured memory_bytes: 9044
#include<bits/stdc++.h>
using namespace std;
#define fre(i,t,n)  for(int i =(t);i<=(n);++i)
#define fer(i,n,t)  for(int i =(n);i>=(t);--i)
#define mp make_pair
#define pb push_back
typedef long long ll;
void smain();
int main(){
    ios::sync_with_stdio(false);
    smain();
    return 0;
}
const int maxn = 1e6+100;
const ll MOD = 1000000007;
ll fac[maxn];
ll inv[maxn];
ll qp(ll a,ll n)
{
    ll ans=1,now=a%MOD;
    while(n)
    {
        if(n&1) ans=(ans*now)%MOD;
        now=now*now%MOD;
        n>>=1;
    }
    return ans;
}
ll C(int a,int b)
{
    if(a<b) return 0;
    return fac[a]*inv[b]%MOD*inv[a-b]%MOD;
}
ll pre[maxn];
void smain(){
    fac[0]=1;
    for(int i=1;i<maxn;++i) fac[i]=(fac[i-1]*i)%MOD;
    inv[maxn-1]=qp(fac[maxn-1],MOD-2);
    for(int i=maxn-2;i>=0;--i)  inv[i]=(inv[i+1]*(i+1))%MOD;
    int N;
    cin>>N;

    for(int K=1;K<N;++K)
        pre[K]=C(K-1,N-K-1)*fac[K]%MOD*fac[N-K-1]%MOD;
    ll ans=0,tmp;
    for(int K=1;K<N;++K)
    {
        tmp=(pre[K]-pre[K-1]+MOD)%MOD;
        ans=(ans+tmp*(K)%MOD)%MOD;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 23680
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
const ll MOD = 1e9 + 7 ;
const ll N = 1e5 + 10 ;
int arr[100];

int main(){
    fastio
int x,y;
cin>>x>>y;
if(x==y)
cout<<x+x<<endl;
else cout<<max(x,y)*2-1<<endl;

    return 0 ;
}

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 FOR(i,m,n) for(int i=int(m); i<int(n); i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VLL vector<long long>
#define VVI vector<vector<int>>
#define VVLL vector<vector<long long>>
#define VC vector<char>
#define VS vector<string>
#define VVC vector<vector<char>>
#define fore(i,a) for(auto &i:a)

typedef pair <int, int> P;
template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
const int  INF = 1 << 30;
const ll INFL = 1LL<<60;
const ll mod = 1000000007;		




int main() {

	char c;
	cin >> c;
	if (c == 'A')cout << 'T';
	else if (c == 'T')cout << 'A';
	else if (c == 'G')cout << 'C';
	else if (c == 'C')cout << 'G';

	cout << endl;



	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	int a,b;cin>>a>>b;
	cout<<max({a+b,a-b,a*b})<<endl;
}

Measured memory_bytes: 256
import java.util.*;
    public class Main{
    	public static void main(String[] args){
        	Scanner s  = new Scanner(System.in);
          	int n = s.nextInt();
          	if(n<3){
            System.out.println(0);
              return;
            }
          		long[] dp = new long[n+1];
          		long mod = (long)1e9 + 7;
          		dp[3] = 1;
          		dp[0] =1;
          		for(int i = 4;i<=n;i++){
                	for(int k = 3;i-k>=0;k++){
                    	dp[i] = dp[i] + dp[i-k];
                      	if(dp[i]>=mod) dp[i]-=mod;
                    }
                }
          		System.out.println(dp[n]);
           }
    }

Measured memory_bytes: 35836
#include<stdio.h>

int main(void)
{

    int S, h, m, s;

    scanf("%d",&S);

    h = S / 3600;
    S = S - h * 3600;
    m = S / 60;
    s = S - m * 60;

    printf("%d:%d:%d\n",h, m, s);

    return 0;
}


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

int main(){
    int64_t N;
    cin >> N;
    vector<int64_t> l;
    l.push_back(2);
    l.push_back(1);
    for(int i=2;i<=N;i++){
        l.push_back(l[i-2]+l[i-1]);
    }

    cout << l[N] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 101;
const int maxw = 1e5 + 1;

ll w[maxn], v[maxn], dp[maxn][maxw];

int main()
{
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    ll n, W;
    scanf("%lld%lld", &n, &W);
    for (int i = 1; i <= n; ++i)
        scanf("%lld%lld", &w[i], &v[i]);
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= W; ++j)
            if (j < w[i])
                dp[i][j] = dp[i - 1][j];
            else
                dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w[i]] + v[i]);
    printf("%lld\n", dp[n][W]);
}

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

using namespace std;
typedef long long ll;

#define MOD (long long)(1e9+7)
#define INF (1LL<<60)
#define rep(i,n) for(ll i = 0; i < (n); i++)
#define rep1(i,n) for(ll i = 1; i <= (n); i++)

template<class T> inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
template<class T> inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}


// 最大公約数
ll gcd(ll a, ll b)
{
  if(b == 0) return a;
  return gcd(b, a % b);
}

// mod m におけるa の逆元
ll modinv(ll a, ll m) {
  ll b = m, u = 1, v = 0;
  while (b) {
    ll t = a / b;
    a -= t * b; swap(a, b);
    u -= t * v; swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}

// 素因数分解
vector<pair<ll, ll>> prim;
void pf(ll n)
{
  ll s = sqrt(n);
  ll r = 0;
  for(ll i = 2; i <= s; i++) {
    if((n % i) == 0) {
      r = 0;
      do {
	r++;
	n = n / i;
      } while((n % i) == 0);
      prim.push_back({i, r});
    }
  }
  if(n > s) {
    prim.push_back({n, 1});
  }
}

void solve()
{
  // ll N; cin >> N;
  // ll N, K; cin >> N >> K;
  // ll x, y, z; cin >> x >> y >> z;
  ll a, b = 0; cin >> a;
  string s; cin >> s;
  rep(i, s.size()) {
    if(s[i] < '0' ||  s[i] > '9') continue;
    b = b * 10 + s[i] - '0';
  }
  
  ll ans = a * b / 100;

  cout << ans << endl;
}


int main(void)
{
  // ll t; cin >> t; rep(i, t)
  solve();
}


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

int isPrime(int);

int main(){

  int n,data[100000],i,c=0;

  scanf("%d",&n);

  for(i=0 ; i<n ; i++){
    scanf("%d",&data[i]);
    if(isPrime(data[i])==0) c++;
  }

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

return 0;

}


int isPrime(int x){

  int i,sq;

  sq=(int)sqrt(x);

  if(x==2) return 0;
  else if(x<2) return 1;
  else if(x%2==0) return 1;

  else{
    i=3;
    while(i<=sq){
      if(x%i==0) return 1;
      i+=2;
    }
  }

  return 0;
}

Measured memory_bytes: 636
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#define ARB ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
#define bp  __builtin_popcount
using namespace std;
using namespace __gnu_pbds;
typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const int maxn=1e8+5;
const  double EPS = 1e-14;
const int MOD = 1000000007;
int arr[maxn];
int fr[maxn]= {0};
int main()
{
    ARB
    int n;
    cin>>n;
    for(int i=1; i<n; i++)
        cin>>arr[i];
    for(int i=1; i<=n; i++)
        fr[arr[i]]++;
    for(int i=1; i<=n; i++)
        cout<<fr[i]<<endl;
}


Measured memory_bytes: 5164
//雪花飄飄北風嘯嘯
//天地一片蒼茫

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/rope>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
#define ll long long
#define ii pair<ll,ll>
#define iii pair<ll,ii>
#define fi first
#define se second
#define endl '\n'
#define debug(x) cout << #x << " is " << x << endl;

#define rep(x,start,end) for(auto x=(start)-((start)>(end));x!=(end)-((start)>(end));((start)<(end)?x++:x--))
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

#define indexed_set tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
//change less to less_equal for non distinct pbds, but erase will bug

mt19937 rng(chrono::system_clock::now().time_since_epoch().count());

int n;
string s[105];
ll cost[105];

ll w[105][25];
priority_queue<iii,vector<iii>, greater<iii> > pq; //bruh iii

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	rep(x,0,n){
		cin>>s[x];
		cin>>cost[x];
	}
	rep(x,n,n*2){ //reverse the strings for cute imple uwu
		s[x]=s[x-n];
		cost[x]=cost[x-n];
		
		reverse(all(s[x]));
	}
	
	memset(w,63,sizeof(w));
	
	rep(x,0,n*2){
		rep(len,0,sz(s[x])+1){
			rep(y,0,len) if (s[x][y]!=s[x][len-1-y]) goto bad;
			
			w[x][len]=cost[x];
			pq.push(iii(w[x][len],ii(x,len)));
			
			bad:;
		}
	}
	
	//rep(x,0,n*2) cout<<s[x]<<endl;
	
	//win state is sz(s[it.fi])==it.se
	while (!pq.empty()){
		ll weight;
		int idx,pos;
		
		weight=pq.top().fi;
		idx=pq.top().se.fi,pos=pq.top().se.se;
		pq.pop();
		
		if (w[idx][pos]!=weight) continue;
		
		if (sz(s[idx])==pos){
			cout<<weight<<endl;
			return 0;
		}
		
		int left=sz(s[idx])-pos;
		
		//cout<<idx<<" "<<pos<<" "<<weight<<" "<<left<<endl;
		
		int ss,ee;
		if (idx<n) ss=n,ee=n*2;
		else ss=0,ee=n;
		
		rep(x,ss,ee){
			if (sz(s[x])<=left){
				rep(y,0,sz(s[x])) if (s[x][y]!=s[idx][pos+y]) goto shit;
				
				if (w[idx][pos+sz(s[x])]>weight+cost[x]){
					w[idx][pos+sz(s[x])]=weight+cost[x];
					pq.push(iii(w[idx][pos+sz(s[x])],ii(idx,pos+sz(s[x]))));
				}
			}
			else{
				rep(y,0,left) if (s[x][y]!=s[idx][pos+y]) goto shit;
				
				//cout<<"debug: "<<x<<" "<<left<<endl;
				if (w[x][left]>weight+cost[x]){
					w[x][left]=weight+cost[x];
					pq.push(iii(w[x][left],ii(x,left)));
				}
			}
			
			shit:;
		}
	}
	
	cout<<"-1"<<endl;
}


Measured memory_bytes: 3576
def main():
    from collections import Counter
    import sys
    input = sys.stdin.buffer.readline

    _ = int(input())
    A = [int(i) for i in input().split()]

    ans = 0
    c = Counter(A)
    B = sorted(c.keys(), reverse=True)

    for b in B:
        if c[b] == 0:
            continue
        a = (2 ** b.bit_length()) - b
        if a == b:
            cur = c[b]//2
        else:
            if a in c:
                cur = min(c[a], c[b])
            else:
                cur = 0
        ans += cur
        # c[b] -= cur
        c[a] -= cur

    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 107028
#include <iostream>

using namespace std;

int S;
bool used[100000];

int main() {
    cin >> S;
    int count = 0;
    while (true) {
        if (used[S]) {
            cout << count+1 << endl;
            return 0;
        }
        used[S] = true;
        if (S&1) {
            S = 3*S+1;
        } else {
            S /= 2;
        }
        count++;
    }

}

Measured memory_bytes: 256
function Main(input) {
    var N = parseInt(input[0], 10);
    var K = parseInt(input[1], 10);
    var H = input.slice(2).map(a => parseInt(a, 10));

    var sorted = H.sort((a, b) => b - a);

    var needAtk = sorted.slice(K);

    var sum = 0;

    for (var i = 0; i < needAtk.length; i++) {
        sum += needAtk[i];
    }

    console.log(sum);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split(/\n|\s/));

Measured memory_bytes: 50208
n, y = map(int, input().split())

ans = []
for x in range(n+1):
  for p in range(n+1-x):
    z = n - x - p
    if y-10000*x-5000*p == 1000*z and x+p+z == n:
      print(x, p, z)
      ans.append((x, p, z))
      exit()

if len(ans) == 0:
  print(-1, -1, -1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vpi;
typedef vector<pair<long long, long long>> vpl;
typedef pair<int,int> pii;
typedef pair<long long, long long> pll;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
/*--------------------------------------------*/

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

    ll N;
    cin >> N;

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

    rep(i,N-1){
        ll tmp_a,tmp_b;
        cin >> tmp_a >> tmp_b;

        ll ia = tmp_a, ib = tmp_b;

        ll tm = max((a+tmp_a-1) / tmp_a,(b+tmp_b-1) / tmp_b);

        if(tm > 1.0){
            tmp_a *=tm;
            tmp_b *=tm;
            a = tmp_a;
            b = tmp_b;
        }
        

        // while(tmp_a < a || tmp_b < b){
        //     tmp_a = ia * j;
        //     tmp_b = ib * j;
        //     j++;
        // }

        chmax(a,tmp_a);
        chmax(b,tmp_b);


        

        // if(tm < 1.0){
        //     if(tmp_b / double(b) < 1.0){
        //         ll t = (b+tmp_b-1) / tmp_b;
        //         tmp_a *= t;
        //         tmp_b *= t;
        //     }else{
        //         ll t = (a+tmp_a-1) / tmp_a;                
        //         tmp_a *= t;
        //         tmp_b *= t;
        //     }
        // }else{

        // }
        //     a = tmp_a;
        //     b = tmp_b;
        
       // cout << tmp_a << ' ' << tmp_b << endl;


    }

    cout << a + b << endl;

}

Measured memory_bytes: 256
#include <iostream>
#include <string.h>
#include <algorithm>
#include <array>
#include <vector>
#include <cmath>

using namespace std;

int main( void ) {

    int N, tmp, hash;
    cin >> N;

    tmp = N;
    hash = 0;
    while ( tmp > 0 ) {
        hash += tmp % 10;
        tmp /= 10;
    }

    if ( N % hash == 0 ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            var input = Console.ReadLine().Split(' ');
            int a = int.Parse(input[0]);
            int b = int.Parse(input[1]);

            if (b % a ==0)
            {
                Console.WriteLine(a + b);
            } else
            {
                Console.WriteLine(b - a);
            }
        }
    }
}


Measured memory_bytes: 11092
<?php
list($n,$m)=explode(" ",trim(fgets(STDIN)));
$t=array_fill(1,$n,0);
$i=0;
while($i<$m){
  $q=explode(" ",trim(fgets(STDIN)));
  ++$t[$q[0]];
  ++$t[$q[1]];
  ++$i;
}
foreach($t as $v){
  if($v%2==1){
    echo "NO";
    exit;
  }
}
echo "YES";

Measured memory_bytes: 8824
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repi(i, s, n) for (int i = (s); i < (n); i++)
#ifdef LOCAL
#define INPUT_FILE                              \
  ifstream in("atcoder-problems/abc122_c.txt"); \
  cin.rdbuf(in.rdbuf());
#define print_vec(v)                        \
  rep(l, v.size()) { cout << v[l] << " "; } \
  cout << endl;
#else
#define INPUT_FILE
#define print_vec(v)
#endif
#define CIN_OPTIMIZE \
  cin.tie(0);        \
  ios::sync_with_stdio(false);
typedef pair<int, int> P;
typedef long long ll;
typedef pair<ll, ll> pl;
const int INF = 100100100;
const ll LINF = 1e18 + 100;
const int MOD = 1e9 + 7;

int main() {
  INPUT_FILE CIN_OPTIMIZE;

  int N, Q;
  cin >> N >> Q;

  string S;
  cin >> S;

  vector<int> l(Q), r(Q);
  rep(i, Q) {
    cin >> l[i] >> r[i];
    l[i]--;
    r[i]--;
  }

  vector<int> c(N, 0);
  repi(i, 1, N) {
    if (S[i - 1] == 'A' && S[i] == 'C') {
      c[i] = c[i - 1] + 1;
    } else {
      c[i] = c[i - 1];
    }
  }

  rep(i, Q) {
    cout << c[r[i]] - c[l[i]] << endl;
  }
}

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

long long int xorfunc(long long int n){
    if(n % 2 == 1) return (( (n+1) / 2 ) % 2);
    if(n % 2 == 0) return (( (n+1) / 2 ) % 2) ^ n;
};

int main(){
    long long int a, b;
    cin >> a >> b;
    
    long long int c = xorfunc(a-1) ^ xorfunc(b);
    cout << c << endl;
    return 0;
}

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

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

using namespace std;

struct GUIDELIST{
    string s;
    int point;
    int score;
    bool operator<(const GUIDELIST& right) const{
        return s == right.s ? point > right.point : s < right.s;
    }
};

int main(){
    int n;
    cin >> n;
    vector<GUIDELIST> S(n);
    cal(i, n) {
        cin >> S[i].s >> S[i].point;
        S[i].score = i + 1;
    }
    sort(S.begin(), S.end());
    
    cal(i, n) cout << S[i].score << endl;
    return 0;
}


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

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define rep2(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//indexは
long long INF = 1LL<<60;

int n;
void gene(int i,int rest,string s){
    if(s.size()==n){
        cout<<s<<endl;
        return;
    }
    if(i>n||rest<0)return;
    i++;
    rest--;
    for(int j=0;j<i+1;j++){
        //stringは記憶領域を共通してる?明示しないとコピー取らない?
        string t=s;
        char tmp='a'+j;
        if(tmp!='a'){
            char fb=tmp-1;
            if(s.find(fb)==string::npos)continue;
        }
        gene(i,rest,s+tmp);
    }
}

int main( ){
    cin>>n;
    gene(0,n,"");
    return 0;
}




Measured memory_bytes: 1536
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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; }
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};



int main(){
    LL n,k;cin >> n >> k;
    vector<LL> w(n),d(n);
    for (int i = 0; i < n; i++) {
        cin >> w[i] >> d[i];
    }
    LL l = 0,r = LINF;
    while(abs(r - l) > 1){
        LL m = (r - l) / 2 + l;
        auto f = [&](LL m){
            LL cnt = 0;
            for (int i = 0; i < n; i++) {
                if(m - w[i] < 0) continue;
                cnt += (m - w[i]) / d[i] + 1;
                if(cnt >= k) return true;
            }
            return false;
        };
        if(f(m)) r = m;
        else l = m;
    }
    cout << r << endl;
    return 0;
}


Measured memory_bytes: 1792
n, m = map(int, input().split())
h = list(map(int, input().split()))
rela = [[] for i in range(n)]
for i in range(m):
    ai, bi = list(map(int, input().split()))
    #ab.append(abi)
    ai -= 1
    bi -= 1
    rela[ai].append(bi)
    rela[bi].append(ai)
    
ans = 0
for i in range(n):
    flag = True
    for j in rela[i]:
        if h[j] >= h[i]:
            flag = False
    if flag:
        ans += 1
print(ans)

Measured memory_bytes: 29348
#include <iostream>
#include <vector>
#include <bitset>
#include <utility>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <cmath>
#include <map>
#include <set>
 
using namespace std;
typedef long long ll;
 
int main(){
  int N,M;
  cin >> N >> M;
  vector<int> h(N);
  for(int i=0;i<N;i++) cin >> h[i];
  vector<vector<int>> b(N);
  for(int i=0;i<M;i++){
    int A,B;
    cin >> A >> B; --A; --B;
    b[A].push_back(B);
    b[B].push_back(A);
  }

  int r=0;
  int f=0;
  for(int i=0;i<N;i++){
    f=0;
    for(int bi:b[i]){
      if(h[i]<=h[bi]) f=1;
    }
    if(f==0) r++;
  }

  cout << r << endl;

  return 0;
}


Measured memory_bytes: 8772
def solve(s):
    n = len(s)
    for i in range(n-1):
        if s[i] == s[i+1]:
            return '{0} {1}'.format(i+1, i+2)

    for i in range(n-2):
        if s[i] == s[i+2]:
            return '{0} {1}'.format(i+1, i+3)

    return '-1 -1'


s = input()
print(solve(s))


Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long int
#define sz  200010
using namespace std;


string ss[sz];

int main()
{

    string a,b;
    ll x,y;

    cin>>a>>b;
    x=a.length();
    y=b.length();


    if(x>y)
        cout<<"GREATER"<<endl;
    else if(x<y)
        cout<<"LESS"<<endl;
    else
    {


        for(ll i=0; i<x; i++)
        {
            if(a[i]>b[i])
            {
                cout<<"GREATER"<<endl;
                return 0;
            }
            else if(a[i]<b[i])
            {
                cout<<"LESS"<<endl;
                return 0;
            }
        }

        cout<<"EQUAL"<<endl;
    }

    return 0;
}



Measured memory_bytes: 1792