akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define MAX_I INT_MAX //1e9
#define MIN_I INT_MIN //-1e9
#define MAX_UI UINT_MAX //1e9
#define MAX_LL LLONG_MAX //1e18
#define MIN_LL LLONG_MIN //-1e18
#define MAX_ULL ULLONG_MAX //1e19
  typedef long long ll;
  typedef pair<int,int> PII;
  typedef pair<char,char> PCC;
  typedef pair<ll,ll> PLL;
  typedef pair<char,int> PCI;
  typedef pair<int,char> PIC;
  typedef pair<ll,int> PLI;
  typedef pair<int,ll> PIL;
  typedef pair<ll,char> PLC;
  typedef pair<char,ll> PCL;

typedef struct{
  ll x,y,z;
}T;

const int L=8;
//type[k]:xyzで1の時負値
T type[L];

T max_T(T l, T r, T a, int k){
  r.x += a.x; r.y += a.y; r.z += a.z;
  ll l_sum = l.x*type[k].x + l.y*type[k].y + l.z*type[k].z;
  ll r_sum = r.x*type[k].x + r.y*type[k].y + r.z*type[k].z; 
  if(l_sum>r_sum) return l;
  else return r;
}

void print(T t){
  cout << t.x << " " << t.y << " " << t.z << "\t";
}

int main(void){
  int N,M;cin >> N >> M;
  vector<T> v(N);
  int i,j,k;
  REP(i,N) cin >> v[i].x >> v[i].y >> v[i].z;
  REP(k,L){
    type[k] = {(k>>2)%2==0?1:-1,(k>>1)%2==0?1:-1,k%2==0?1:-1};
  }

  //dp[i][j][k];i番目まで見て，j個選んだ時のtype kが最大となるそれぞれの値
  T dp[N+1][M+1][L];
  REP(j,M+1)REP(k,L) dp[0][j][k] = {type[k].x*MIN_LL, type[k].y*MIN_LL, type[k].z*MIN_LL};
  REP(k,L) dp[0][0][k] = {0,0,0};

  REP(i,N){
    REP(j,M+1){
      REP(k,L){
        dp[i+1][j][k] = dp[i][j][k];
        if(j==0|| j>i+1)continue;
        dp[i+1][j][k] = max_T(dp[i+1][j][k], dp[i][j-1][k],v[i],k);
        //print(dp[i+1][j][k]);
      }
      //cout << endl;
    }
    //cout << endl;
  }
  ll max = 0;
  REP(k,L){
    ll sum = abs(dp[N][M][k].x) + abs(dp[N][M][k].y) + abs(dp[N][M][k].z);
    if(sum>max) max = sum;
  }
  cout << max << endl;
  return 0;
}


Measured memory_bytes: 188160
#include <bits/stdc++.h>
#include<map>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(x) (x).begin(),(x).end()
using ll = long long;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2, 初期値));
//vector<vector<要素の型>> 変数名(要素数1, vector<要素の型>(要素数2));  // 初期値を省略


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	string ts="test";
	
	//int n; cin >> n;
	
	ll h; cin >> h;
	
	//cout << h << endl;
	
	h=log(h)/log(2);
	
	ll ans=0;
	
	while(h>=0){
		ans+=pow(2,h);
		h--;
	}
	
	cout << ans << endl;
	
	
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<iostream>
using namespace std;
 
int main(void) {
    
    int N,K;
    cin >> N >> K;
    string ds = "";
    for(int i = 0; i < K; i++) {
        char j;
        cin >> j;
        ds += j;
    }
    //cout << ds << endl;
    for(int i = N; i < 100000; i++) {
        string s = to_string(i);
        if (s.find_first_of(ds) == string::npos) {
            cout << s << endl;
            return 0;
        }
    }
    
}

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

namespace AtCoder
{

    class Program
    {
        static void Main()
        {
            Solve();

            Console.ReadKey();
        }

        static void Solve()
        {
            int N;int A;int B;
            Multi(out N, out A, out B);
            var ans = 0;
            for(int i = 1; i <= N; i++)
            {
                var sum = i.ToString().ToCharArray().Select(s => (int.Parse(s.ToString()))).Sum();
                if (A <= sum && sum <= B) ans += i;
            }

            Console.Write(ans);
        }



        static public string GetStr() { return Console.ReadLine(); }
        static public int GetInt() { return int.Parse(Console.ReadLine()); }
        static public long GetLong() { return long.Parse(Console.ReadLine()); }
        static public string[] GetStrArray() { return Console.ReadLine().Split(' '); }
        static public int[] GetIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
        static public long[] GetLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
        static public List<double> GetDoubleList() { return Console.ReadLine().Split(' ').Select(double.Parse).ToList(); }
        static public void WriteObjects<T>(IEnumerable<T> values) { foreach (var o in values) { Console.Write(o + " "); } }

        static bool eq<T, U>() => typeof(T).Equals(typeof(U));
        static T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
        static T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                           : eq<T, long>() ? ct<T, long>(long.Parse(s))
                           : eq<T, double>() ? ct<T, double>(double.Parse(s))
                           : eq<T, char>() ? ct<T, char>(s[0])
                                             : ct<T, string>(s);
        static void Multi<T>(out T a) => a = cv<T>(GetStr());
        static void Multi<T, U>(out T a, out U b)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
        }
        static void Multi<T, U, V>(out T a, out U b, out V c)
        {
            var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
        }
    }
}

Measured memory_bytes: 13396
import numpy as np

a1 = list(map(int, input().split(' ')))
a2 = list(map(int, input().split(' ')))
a3 = list(map(int, input().split(' ')))
n = int(input())

nums = [int(input()) for _ in range(n)]

arr = np.array([a1, a2, a3])
mask = np.zeros_like(arr)

for num in nums:
    idx = np.where(arr == num)

    if len(idx[0]) == 0:
        pass
    else:
        mask[idx] = 1

s_v = np.sum(mask, axis=0)
s_h = np.sum(mask, axis=1)
s_diag_1 = mask[0, 0] + mask[1, 1] + mask[2, 2]
s_diag_2 = mask[0, 2] + mask[1, 1] + mask[2, 0] 
s = np.maximum(np.concatenate([s_v, s_h, [s_diag_1], [s_diag_2]]) - 2, 0)

if np.max(s) > 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 20968
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,string> P;
int main(){
  string s1;
  int i;
  while(1){
    cin >> s1;
    if(s1=="0"){
      return 0;
    }
    int ans=(1<<29);
    map<string,int> mp;
    queue<P> que;
    que.push(P(0,s1));
    while(!que.empty()){
      int x=que.front().first;
      string s=que.front().second;
      que.pop();
      if(mp.find(s)!=mp.end() && mp[s]<=x){
        continue;
      }
      if(x>=ans){
        continue;
      }
      mp[s]=x;
      int res=0;
      for(i=1;i<s.size();i++){
        if(s[i-1]!=s[i]){
          res=1;
          break;
        }
      }
      if(res==0){
        ans=x;
        continue;
      }
      for(i=1;i<s.size();i++){
        string t=s;
        if(s[i-1]=='r' && s[i]=='g'){
          t[i-1]='b',t[i]='b';
          que.push(P(x+1,t));
        }
        if(s[i-1]=='r' && s[i]=='b'){
          t[i-1]='g',t[i]='g';
          que.push(P(x+1,t));
        }
        if(s[i-1]=='g' && s[i]=='b'){
          t[i-1]='r',t[i]='r';
          que.push(P(x+1,t));
        }
        if(s[i-1]=='g' && s[i]=='r'){
          t[i-1]='b',t[i]='b';
          que.push(P(x+1,t));
        }
        if(s[i-1]=='b' && s[i]=='g'){
          t[i-1]='r',t[i]='r';
          que.push(P(x+1,t));
        }
        if(s[i-1]=='b' && s[i]=='r'){
          t[i-1]='g',t[i]='g';
          que.push(P(x+1,t));
        }
      }
    }
    if(ans==(1<<29)){
      cout << "NA" << endl;
      continue;
    }
    cout << ans << endl;
  }
}


Measured memory_bytes: 5248
#include<bits/stdc++.h>
using namespace std;
int a[57];
priority_queue<int,vector<int>,greater<int> > q;
int main(){
    int n,m,mx=0;
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
		scanf("%d",&a[i]);
	for(int i=0;i<=min(m,n);++i)
		for(int j=0;j<=min(n-i,m-i);++j)
			for(int z=n+1;z>=max(n-(m-i-j)+1,i+1);--z){
				if(i+(n-z+1)<=j)
                    continue;
				for(int k=1;k<=i;++k)
					q.push(a[k]);
				for(int k=n;k>=z;--k)
					q.push(a[k]);
				for(int k=1;k<=j;++k)
					q.pop();
				int ans=0;
				while(!q.empty())
					ans+=q.top(),q.pop();
				mx=max(ans,mx);
			}
	printf("%d",mx);
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)

int W, H;
int M[7][7];
int D[7][7];


void show() {
  rep(i, H) {
    rep(j, W) printf("%3d", D[i][j]);
    printf("\n");
  }
  printf("\n");
}
bool equals(bool a, bool b) { return a && b || !a && !b; }
bool isOut(int &x, int &y) { return x < 0 || x >= W || y < 0 || y >= H; }

void dfs(int x, int y, bool visited[7][7]) {
  const static int dx[4] = {1,0,-1,0};
  const static int dy[4] = {0,1,0,-1};
  rep(i, 4) {
    if(D[y][x] >> i & 1) {
      int nx = x + dx[i];
      int ny = y + dy[i];
      if(isOut(nx, ny) || visited[ny][nx]) continue;
      visited[ny][nx] = true;
      dfs(nx, ny, visited);
    }
  }
}

int count() {
  int res = 0;
  bool visited[7][7];
  rep(i, H) fill(visited[i], visited[i]+W, false);
  rep(i, H) {
    rep(j, W) {
      if(M[i][j] != 1 && !visited[i][j]) {
	res++;
	visited[i][j] = true; 
	dfs(j, i, visited);
      }
    }
  }
  return res;
}

bool rec(int p) {
  if(p == W*H) {
    int tmp = count();
    return tmp == 1;
  }
  const static int TD[6] = {3, 5, 9, 6, 10, 12};
  int x = p%W;
  int y = p/W;
  if(M[y][x] == 0) {
    rep(i, 6) {
      if((TD[i] >> 0 & 1) && (x+1 >= W || M[y][x+1] == 1)) continue;
      if((TD[i] >> 1 & 1) && (y+1 >= H || M[y+1][x] == 1)) continue;
      if(!equals(TD[i] >> 2 & 1, (x-1 >= 0 && D[y][x-1] >> 0 & 1))) continue;
      if(!equals(TD[i] >> 3 & 1, (y-1 >= 0 && D[y-1][x] >> 1 & 1))) continue;
      D[y][x] = TD[i];
      if(rec(p+1)) return true;
    }
  } else {
    D[y][x] = 0;
    return rec(p+1);
  }

  return false;
}

void solve() {
  if(rec(0)) cout << "Yes" << endl;
  else       cout << "No" << endl;
}

main() {
  while((cin >> W >> H) && (W || H)) {
    rep(i, H) rep(j, W) cin >> M[i][j];
    solve();
  }
}

Measured memory_bytes: 856
#include <stdio.h>
#include <string.h>

char A[105];
char B[105];

int main() {

	int i;

	scanf("%s", A);
	scanf("%s", B);
	
	if (strlen(A) > strlen(B)) {
		printf("GREATER\n");
	}
	else if (strlen(A) < strlen(B)) {
		printf("LESS\n");
	}
	else {
		int flag = 0;
		for (i = 0; i < strlen(A); i++) {
			if (A[i] - '0' > B[i] - '0') {
				flag = 1;
				break;
			}
			else if (A[i] - '0' < B[i] - '0') {
				flag = 2;
				break;
			}
		}
		if (flag == 0) {
			printf("EQUAL\n");
		}
		else if (flag == 1) {
			printf("GREATER\n");
		}
		else {
			printf("LESS\n");
		}
	}

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
#include<algorithm>
#define N (300010)
int d[N],l[N],r[N],n,m,p[N];
struct ds{
	int c[N];
	void add(int x, int y ,int a){
		for (;x<N;x+=x&-x){
			c[x]+=a;
		}
		for (y++;y<N;y+=y&-y){
			c[y]-=a;
		}
	}
	int sum(int x){
		int res=0;
		for (;x;x-=x&-x){
			res+=c[x];
		}
		return res;
	}
	void init(void){
		for (int i=0;i<N;i++){
			c[i]=0;
		}
	}
} c2;
bool cmp(int &a, int &b){
	return d[a]<d[b];
}
int main(){
	scanf("%d%d",&n,&m);
	for (int i=1;i<=n;i++){
		scanf("%d%d",l+i,r+i);
		d[i]=r[i]-l[i]+1;
		p[i]=i;
	}
	std::sort(p+1,p+n+1,cmp);
	c2.init();
	for (int i=1,rr=1;i<=m;i++){
		while (rr<=n&&d[p[rr]]<i){
			c2.add(l[p[rr]],r[p[rr]],1);
			rr++;
		}
		int ans=n-rr+1;
		for (int j=i;j<=m;j+=i){
			ans+=c2.sum(j);
		}
		printf("%d\n",ans);
	}
}

Measured memory_bytes: 6656
#include<iostream>

int main(void){
	int a, b;
	char x;
	while(std::cin >> a >> x >> b){
		if(x == '?')
			break;
		else if(x == '+')
			std::cout << a+b << std::endl;
		else if(x == '-')
			std::cout << a-b << std::endl;
		else if(x == '*')
			std::cout << a*b << std::endl;
		else
			std::cout << a/b << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 30;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


ll dp[1100000], dpo[1100000];

int main() {

    rep(i, 1100000) dp[i] = INF, dpo[i] = INF;
    dp[0] = 0, dpo[0] = 0;

    rep(i, 1100000-1) {
        for(ll j = 1; j * (j+1) * (j+2) / 6 <= 1e6; j++) {
            ll x = j * (j+1) * (j+2) / 6;
            if(i >= x) {
                chmin(dp[i], dp[i - x] + 1);
                if(x % 2 == 1) chmin(dpo[i], dpo[i - x] + 1);
            }
        }
    }

    ll n;
    while(cin >> n) {
        if (!n) return 0;

        cout << dp[n] << " " << dpo[n] << endl;
    }
}



Measured memory_bytes: 20264
#include<bits/stdc++.h>
#define rep(i, n) for(int i = 0;i < (int)n;i++)
#define repb(i, n) for(int i = (int)n;i >= 0;i--)
#define reps(i, m, n) for(int i = (int)m;i < (int)n;i++)
#define repsb(i, m, n) for(int i = (int)m;i >= (int)n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define pb(a) push_back(a)
#define INF 999999999999999999
using namespace std;
int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};
using namespace std;
int main(int argc, char const *argv[]) {
    int temp[4];
    rep(i,4){
      cin>>temp[i];
    }
    cout<<min(temp[0],temp[1])+min(temp[2],temp[3])<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#define inf 99999999
int dp[10100][10100];

int max( int a , int b )
{
    if(a>b)return a;
    else return b;
}

int main(void)
{
    int N,W,v[10100],w[10100],i,j,M=0;
    scanf("%d %d",&N,&W);
    for(i=0;i<N;i++)scanf("%d %d",&v[i],&w[i]);
    dp[0][0]=0;
    for(i=1;i<N;i++)dp[0][i]=-inf;
    for(i=1;i<=N;i++){
        for(j=0;j<=W;j++){
            if(j-w[i-1]>=0)dp[i][j]=max(dp[i-1][j],dp[i-1][j-w[i-1]]+v[i-1]);
            else dp[i][j] = dp[i-1][j] ;
        }
    }
    /*for(i=0;i<=N;i++){
        for(j=0;j<=W;j++){
            printf("%d\n",dp[i][j]);
        }

    }*/

        for(j=0;j<=W;j++){
            M=max(dp[N][j],M);
        }
    printf("%d\n",M);

    return 0;
}

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

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

BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
String str = reader.readLine();
String[]array =str.split(" ",0);
int a =Integer.parseInt(array[0]);
int b =Integer.parseInt(array[1]);

if(a>b){
System.out.println("a > b");
}else if(a<b){
System.out.println("a < b");
}else if(a==b){
System.out.println("a == b");
}
}
}

Measured memory_bytes: 24236
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
const lint mod = 998244353;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd_calc(T a, T b){ if(b){ return gcd_calc(b, a % b); }else{ return a; }}
template<class T> T gcd(T a, T b){ if(a < b) swap(a, b); return gcd_calc(a, b); }
template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }
inline int at(int x, int k){ return (x >> k) & 1; }
random_device rnd;

int main(){
    int N;
    cin >> N;
    int ans = 0;
    for(int i = 1; i <= N; i++){
        ans += to_string(i).size() & 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
using namespace std;
#define repeat(i,n) for (int i = 0; (i) <(int) (n); ++(i))
#define repeat_from(i,m,n) for (int i = (m); (i) <(int) (n); ++(i))
void dfs(int x, int y, int n, vector<vector<int> > & k, vector<vector<bool> > const & c) {
    int h = c.size();
    int w = c.front().size();
    if (x < 0 or w <= x or y < 0 or h <= y) return;
    if (k[y][x] or not c[y][x]) return;
    k[y][x] = n;
    repeat_from (dy,-1,1+1) {
        repeat_from (dx,-1,1+1) {
            dfs(x+dx,y+dy,n,k,c);
        }
    }
}
int solve(vector<vector<bool> > const & c) {
    int h = c.size();
    int w = c.front().size();
    vector<vector<int> > k(h, vector<int>(w, 0));
    int n = 0;
    repeat (y,h) {
        repeat (x,w) {
            if (not k[y][x] and c[y][x]) {
                dfs(x,y,++n,k,c);
            }
        }
    }
    return n;
}
int main(void) {
    while (true) {
        int w, h; cin >> w >> h;
        if (w == 0 and h == 0) break;
        vector<vector<bool> > c(h, vector<bool>(w));
        repeat (y,h) {
            repeat (x,w) {
                int t; cin >> t;
                c[y][x] = t;
            }
        }
        cout << solve(c) << endl;
    }
    return 0;
}

Measured memory_bytes: 1412
main :: IO ()
main = do
    cs <- getContents
    putStr $ unlines $ map solve $ lines cs

solve :: String -> String
solve n = show $ length [ (a,b,c,d) | a<-[0..9], b<-[0..9], c<-[0..9], d<-[0..9], a+b+c+d == (read n) ]

Measured memory_bytes: 5092
#include<bits/stdc++.h>
using namespace std;
#define INF 10000000000

struct Cake{
        int W;
        int D;
        int S;
};

int main(){


    while(1){

        //??\???
        int n, w, d; cin >> n >> d >> w;
        if(!w) break;
        vector<int> p(n);
        vector<int> s(n);
        for(int i = 0; i < n; i++){
            cin >> p[i] >> s[i];
        }

        vector<Cake> cake(1);
        cake[0].W = w;
        cake[0].D = d;

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

            s[i] = s[i] % (2 * (cake[p[i] - 1].D + cake[p[i] - 1].W));
            Cake big, small;
            //??????????????????
            if(s[i] < cake[p[i] - 1].D){
                big.D = max(s[i], cake[p[i] - 1].D - s[i]);
                small.D = min(s[i], cake[p[i] - 1].D - s[i]);
                big.W = small.W = cake[p[i] - 1].W;
            }else if(s[i] < cake[p[i] - 1].D + cake[p[i] - 1].W){
                big.W = max(s[i] - cake[p[i] - 1].D, cake[p[i] - 1].W + cake[p[i] - 1].D - s[i]);
                small.W = min(s[i] - cake[p[i] - 1].D, cake[p[i] - 1].W + cake[p[i] - 1].D - s[i]);
                big.D = small.D = cake[p[i] - 1].D;
            }else if(s[i] < 2 * cake[p[i] - 1].D + cake[p[i] - 1].W){
                big.D = max(s[i] - cake[p[i] - 1].D - cake[p[i] - 1].W, 2 * cake[p[i] - 1].D + cake[p[i] - 1].W - s[i]);
                small.D = min(s[i] - cake[p[i] - 1].D - cake[p[i] - 1].W, 2 * cake[p[i] - 1].D + cake[p[i] - 1].W - s[i]);
                big.W = small.W = cake[p[i] - 1].W;
            }else{
                big.W = max(s[i] - 2 * cake[p[i] - 1].D - cake[p[i] - 1].W, 2 * (cake[p[i] - 1].D + cake[p[i] - 1].W) - s[i]);
                small.W = min(s[i] - 2 * cake[p[i] - 1].D - cake[p[i] - 1].W, 2 * (cake[p[i] - 1].D + cake[p[i] - 1].W) - s[i]);
                big.D = small.D = cake[p[i] - 1].D;
            }

            //cout << small.D << " " << small.W << endl;
            cake.erase(cake.begin() + p[i] - 1);
            cake.push_back(small);
            cake.push_back(big);

        }

        /*cout << endl;
        for(int j = 0; j < cake.size(); j++){
            cout << cake[j].D << " " << cake[j].W << endl;
        }*/

        vector<int> ans(n + 1);
        for(int i = 0; i <= n; i++){
            ans[i] = cake[i].D * cake[i].W;
        }

        sort(ans.begin(), ans.end());

        for(int i = 0; i <= n; i++){
            if(i != n) cout << ans[i] << " ";
            else cout << ans[i] << endl;
        }
        
    }
    
    return 0;
}

Measured memory_bytes: 3116
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <set>
#include <iomanip>
#include <stdio.h>
#include <sstream>
#include <string>
using namespace std;
int main(void){
  double l;
  cin>>l;
  cout<<fixed<<setprecision(10)<<pow(l/3, 3)<<endl;
}

Measured memory_bytes: 256
/*
NAME: jinxiaoguang
LANG: C++
TASK:
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
//#include <bits/stdc++.h>

using namespace std;
typedef long long LL;
const int inff=0x80000000;
const int infz=0x7fffffff;
const int mod=1e9+7;

int main()
{
double x,a,b;
	scanf("%lf%lf%lf",&x,&a,&b);
	puts(fabs(x-a)<fabs(x-b)?"A":"B");
}


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

int main(int argc, char const *argv[])
{
	string s;
	cin>>s;
	int f=1;
	for (int i = 0; i < s.size(); ++i)
	{
		if (i%2==0)
		{
			if (s.at(i)=='L')
			{
				f=0;
			}
		}
		else
		{
			if (s.at(i)=='R')
			{
				f=0;
			}
		}
	}
	if (f==1)
	{
		cout<<"Yes\n";
	}
	else
	{
		cout<<"No\n";
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
string to_string(const string& s) {
	return '"' + s + '"';
}
string to_string(const bool b) {
	return (b ? "true" : "false");
}
string to_string(const char* s) {
	return to_string((string)s);
}
string to_string(const char c) {
	string s = "'";
	s += c;
	s += "'";
	return s;
}
template<class T, class U>
string to_string(const pair<T, U>& p) {
	string s = "(";
	s += to_string(p.first);
	s += ", ";
	s += to_string(p.second);
	s += ")";
	return s;
}
template<class T>
string to_string(const T& a) {
	bool first = true;
	string s = "{";
	for (const auto& x : a) {
		if(!first){
			s += ", ";
		}
		first = false;
		s += to_string(x);
	}
	s += "}";
	return s;
}
void debug_out() {cerr << '\n';}
template<class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
	cerr << ' ' << to_string(head);
	debug_out(tail...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "] = ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(20);
	int n;
	cin >> n;
	int x, y;
	cin >> x >> y;
	--x;
	--y;
	vector<vector<int>> graph(n);
	for (int i = 0; i < n - 1; ++i) {
		graph[i].push_back(i + 1);
		graph[i + 1].push_back(i);
	}
	graph[x].push_back(y);
	graph[y].push_back(x);
	vector<vector<int>> dist(n, vector<int>(n, inf));
	for (int i = 0; i < n; ++i) {
		queue<int> q;
		q.push(i);
		vector<int>& d = dist[i];
		d[i] = 0;
		while (!q.empty()) {
			int v = q.front();
			q.pop();
			for (int u : graph[v]) {
				if (d[v] + 1 < d[u]) {
					d[u] = d[v] + 1;
					q.push(u);
				}
			}
		}
	}
	vector<int> answer(n);
	for (int i = 0; i < n; ++i) {
		for (int j = 0; j < n; ++j) {
			if (dist[i][j] != inf) {
				++answer[dist[i][j]];
			}
		}
	}
	answer.erase(answer.begin());
	for (int xx : answer) {
		cout << xx / 2 << ' ';
	}
	cout << '\n';
 	return 0;
}


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

int idk(int n);

int main()
{
    int n;

    cin >> n;

    cout << idk(n);

    return 0;
}

int idk(int n)
{
    if(n > 1)
        return n + idk(n - 1);
    else
        return 1;
}


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

using namespace std;


#define MAXN 100010

struct fenwick {
  vector<int> F;
  int N;

  void init(int n) {
    N = n;
    F.clear();
    F.resize(N+1);
  }

  void add(int k, int v) {
    if (k==0) return;
    while (k <= N) {
      F[k] += v;
      k += k&-k;
    }
  }

  int sum(int k) {
    int s = 0;
    while (k >= 1) {
      s += F[k];
      k -= k&-k;
    }
    return s;
  }
} f;

set<int> primes;
int P[MAXN];
void sieve() {
  for (int i = 2; i < MAXN; ++i) {
    if (!P[i]) {
      primes.insert(i);
      for (int j = 1; i*j < MAXN; ++j) {
        P[j*i] = 1;
      }
    }
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  f.init(MAXN);
  sieve();
  for (int i = 1; i < MAXN; ++i) {
    if (primes.count(i) && primes.count((i+1)/2)) f.add(i, 1);
  }
  int q;
  cin >> q;
  for (int i = 0; i < q; ++i) {
    int l, r;
    cin >> l >> r;
    cout << f.sum(r)-f.sum(l-1) << endl;
  }
  return 0;
}


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

using namespace std;
 

#define MAX 50

// Function to print Excel column name for a given column number 
void printString(long long int n) 
{ 
    char str[MAX]; // To store result (Excel column name) 
    long long int i = 0; // To store current index in str which is result 
  
    while (n > 0) { 
        // Find remainder 
        long long int rem = n % 26; 
  
        // If remainder is 0, then a 'Z' must be there in output 
        if (rem == 0) { 
            str[i++] = 'z'; 
            n = (n / 26) - 1; 
        } 
        else // If remainder is non-zero 
        { 
            str[i++] = (rem - 1) + 'a'; 
            n = n / 26; 
        } 
    } 
    str[i] = '\0'; 
  
    // Reverse the string and print result 
    reverse(str, str + strlen(str)); 
    cout << str; 
  
    return; 
} 
 
int main() {
   
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
     
    long long int n,num=0,num1=0;
    cin>>n;
    printString(n);
    
        
	return 0;
	
} 

Measured memory_bytes: 3608
#include <stdlib.h>
#include <stdio.h>
#include <math.h>

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

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MIN3(a, b, c) ((a) < (b) ? ((a) < (c) ? (a) : (c)) : ((b) < (c) ? (b) : (c)))
#define Max 1000

void solve(void){
    char s1[Max], s2[Max];
    scanf("%s\n", s1);
    scanf("%s\n", s2);
    int len1 = strlen(s1);
    int len2 = strlen(s2);

    int* mat;
    mat = (int *)malloc(sizeof(int)*(len1+1)*(len2+1));
    rep(len1+1, i) mat[i*(len2+1)] = i;
    rep(len2+1, j) mat[j] = j;

    rep(len1, i) {
        rep(len2, j) {
            int score = (s1[i] == s2[j] ? 0 : 1);
            mat[(i+1)*(len2+1)+j+1] = MIN3(mat[i*(len2+1)+j+1] + 1, mat[(i+1)*(len2+1)+j] + 1, mat[i*(len2+1)+j] + score);
        }
    }
  printf("%d\n", mat[(len1+1)*(len2+1)-1]);
}

int main(void){
  solve();
  return 0;
}

Measured memory_bytes: 5720
H, W = map(int, input().split())
mark_list = [["#"]*(W+2) for i in range(H+2)]
for i in range(1,H+1):
  w_list = input()
  for j in range(1,W+1):
    mark_list[i][j] = w_list[j-1]

# output
for i in mark_list[0]:
  print(i, end="")
print("")
for i in range(1,H+1):
  for j in range(W+2):
    print(mark_list[i][j], end="")
  print("")
for i in mark_list[H+1]:
  print(i, end="")
    

Measured memory_bytes: 4468
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
using namespace __gnu_pbds;
using namespace std;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
 
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<long long,long long> ii; 	
typedef complex<long double> com;

const ll mod = 1e9+7;

struct abc{
    ll a,b,c;
};

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
    ll n,m;
    cin >> n >> m;
    vector <abc> arr(n);
    for (int z=0;z<n;z++){
        cin >> arr[z].a >>arr[z].b >> arr[z].c;
    }  
    vector<vector<abc>> dp;
    ll ans = 0;
    for (int y=0;y<8;y++){
        ll temp = 0;
        vector <ll> wtf(n);
        for (int z=0;z<n;z++){
            wtf[z] = 0;
            if (y & 1) wtf[z] += (arr[z].a);
            else wtf[z] -= (arr[z].a);
            if (y & 2) wtf[z] += (arr[z].b);
            else wtf[z] -= (arr[z].b);
            if (y & 4) wtf[z] +=(arr[z].c);
            else wtf[z] -= (arr[z].c);
        }
        sort(wtf.rbegin(),wtf.rend());
        for (int z=0;z<m;z++){
            temp += wtf[z];
        }
        ans = max(ans,temp);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// Painting Graphs with AtCoDeer
// * frank_c1
// * 2017 / 09 / 30

#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;

const int maxn = 205;
const int mo = (int)(1e9) + 7;
int C[maxn][maxn], pw[maxn], inv[maxn];
int dfn[maxn], low[maxn], top;
vector<int> nxt[maxn];
pii stk[maxn];
int K, idx;
LL ret = 1;

void chk(int u, int v) {
	int cnt = 0, s = stk[top].second, succ = 1, lst = 0;
	while (top && stk[top] != make_pair(u, v)) {
		++cnt; if (lst && lst != stk[top].second) succ = 0; lst = stk[top].first; --top;
	} 
	if (stk[top] == make_pair(u, v)) {
		++cnt; if (lst && lst != stk[top].second) succ = 0; lst = stk[top].first; --top;
	} 
	if (!cnt) return;
	else if (cnt == 1) ret = ret * K % mo;
	else if (succ && lst == s) {
		LL buf = 0;
		for (int i = 1; i <= cnt; ++i) (buf += pw[__gcd(cnt, i)]) %= mo; buf = buf * inv[cnt] % mo;
		ret = ret * buf % mo;
	} else ret = ret * C[cnt + K - 1][K - 1] % mo;
}

void dfs(int x, int f) {
	dfn[x] = low[x] = ++idx;
	for (int i = 0; i < (int)nxt[x].size(); ++i) if (nxt[x][i] != f) {
		int v = nxt[x][i];
		stk[++top] = make_pair(x, v);
		if (!dfn[v]) {
			dfs(v, x); low[x] = min(low[x], low[v]);
			if (low[v] >= dfn[x]) chk(x, v);
 		} else if (dfn[v] < dfn[x]) {
 			low[x] = min(low[x], dfn[v]);
 		} else --top;
	} 
}

int main() {
	int n, m;
	scanf("%d%d%d", &n, &m, &K);
	int mx = m + K;
	for (int i = 0; i <= mx; ++i) C[i][0] = 1;
	for (int i = 1; i <= mx; ++i) for (int j = 1; j <= i; ++j) {
		C[i][j] = C[i - 1][j - 1] + C[i - 1][j]; if (C[i][j] >= mo) C[i][j] -= mo;
	} 
	pw[0] = inv[0] = 1; inv[1] = 1;
	for (int i = 1; i <= m; ++i) pw[i] = 1LL * pw[i - 1] * K % mo;
	for (int i = 2; i <= m; ++i) inv[i] = 1LL * (mo - (mo / i)) * inv[mo % i] % mo;
	for (int i = 1; i <= m; ++i) {
		int u, v; scanf("%d%d", &u, &v); nxt[u].push_back(v); nxt[v].push_back(u);
	}
	for (int i = 1; i <= n; ++i) if (!dfn[i]) dfs(i, 0);
	return printf("%lld\n", ret), 0;
}

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int s = sc.nextInt();
		int w = sc.nextInt();
		if (s > w) {
			System.out.println("safe");
		} else {
			System.out.println("unsafe");
		}

		sc.close();
	}

}

Measured memory_bytes: 27008
#include <bits/stdc++.h>
#define rep(var,cnt) for(int (var)=0; (var)<(int)(cnt); ++(var))
#define Rep(var,init,cnt) for(int (var)=(init); (var)<(int)(cnt); ++(var))
#define ran(var,vec) for(auto &(var):(vec))
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define SORT(v) sort(all(v))
#define RSORT(v) sort(rall(v))
#define SUM(v) accumulate(all(v),0)
#define tget(tp,idx) get<idx>(tp)
#define TF(flag) ((flag)?1:0)
#define YN(flag) cout<<(flag?"YES":"NO")<<endl;
#define Yn(flag) cout<<(flag?"Yes":"No")<<endl;
#define yn(flag) cout<<(flag?"yes":"no")<<endl;
#define Cout(v) cout<<(v)<<endl
using namespace std;

using ll = long long;
using ull = unsigned long long;
using pi = pair<int,int>;
using pl = pair<ll,ll>;
using ti = tuple<int,int,int>;
using tl = tuple<ll,ll,ll>;

template<typename T>
using vec = vector<T>;
template<typename T>
using mat = vector<vec<T>>;
template<typename T>
using cub = vector<mat<T>>;
template<typename T>
using val = valarray<T>;

template<typename T>
using pq = priority_queue<T>;
template<typename T>
using rpq = priority_queue<T,vec<T>,greater<T>>;

template<typename T1,typename T2>
ostream &operator<<(ostream &os, const pair<T1,T2> &p){
  os<<"P("<<p.first<<", "<<p.second<<") ";
  return os;
}

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

template<typename T>
ostream &operator<<(ostream &os, const vector<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

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

template<typename T>
ostream &operator<<(ostream &os, const valarray<T> &v){
  cout<<"V{";
  for(int i=0; i<(int)v.size(); ++i){
    os<<v[i]<<(i+1!=v.size()?" ":"");
  }
  cout<<"}";
  return os;
}

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

// Usual Template End ===================

// Template End =========================

int main(void){
  int N; cin>>N;
  if(N==1) Cout("Hello World");
  else{
    int A,B; cin>>A>>B;
    Cout(A+B);
  }
}












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

using namespace std;

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

int gcd(int a, int b){
	return b == 0 ? a : gcd(b, a % b);
}

int main() {
	int x, y; cin >> x >> y;
	cout << gcd(x, y) << endl;
}

Measured memory_bytes: 1160
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>

#define rep(i,a,b) for(int (i) = (a) ; (i) < (b) ; (i) ++)
#define anin(a) printf("%d\n",a);
#define ando(a)printf("%lf\n",a);

int main(void){
	int N;
	scanf("%d",&N);
	N = int(pow(N,3.0));
	anin(N);
	return 0;
}

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

template <typename T> void read_stdin(const size_t size, vector<T>& array)
{
   T value;
   for (size_t i(0); i < size; ++i) {
      cin >> value;
      array.push_back(value);
   }
}

template <typename T> void output_stdout(const vector<T>& array)
{
   for (const auto& value : array) {
      cout << value << endl;
   }
}

int main() {
   size_t N;
   string inputA, outputB;
   // read
   {
      cin >> N;
      cin >> inputA;
   }

   // process
   {
      for (const auto& v : inputA) {
         outputB += char((int(v) - 65 + N) % 26 + 65);
      }
   }

   // output
   {
      cout << outputB << endl;
   }
   
   return 0;
}


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

int main() {
	int h, w; cin >> h >> w;
	vector<vector<char> > s(h, vector<char>(w));
	REP(i, h) REP(j, w)
		cin >> s[i][j];

	vector<vector<int> > dp(h, vector<int>(w, INT_MAX));
	dp[0][0] = (s[0][0] == '#');
	REP(i, h) REP(j, w) {
		if (j != 0)
			dp[i][j] = min(dp[i][j], dp[i][j-1] + (s[i][j-1] == '.' && s[i][j] == '#'));
		if (i != 0)
			dp[i][j] = min(dp[i][j], dp[i-1][j] + (s[i-1][j] == '.' && s[i][j] == '#'));
	}
	cout << dp[h-1][w-1] << '\n';
	return 0;
}

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

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

   if (a <= 8 && b <= 8) {
       cout << "Yay!" << endl;
   } else {
       cout << ":(" << endl;
   }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    long long int n,k,h;
    cin>>n>>k;
    std::deque<long long int> deq;
    for (long long int i=0;i<n;i++) {
        cin>>h;
        deq.emplace_back(h);
    }
    sort(deq.begin(),deq.end(),greater<long long int>());
    long long int sum=0;
    for (long long int j=k;j<n;j++) {
        sum+=deq[j];
    }
    cout<<sum<<endl;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define txt                        \
    freopen("ip.txt", "r", stdin); \
    freopen("op.txt", "w", stdout)
#define a3 INT_MAX
#define i3 INT_MIN
#define a6 INT64_MAX
#define i6 INT64_MIN
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define fo(i, n) for (int i = 0; i < (int)n; i++)
#define rep(i, k, n) for (int i = k; k < (int)n ? i < (int)n : i > (int)n; k < (int)n ? i += 1 : i -= 1)
#define quickie                       \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);
#define div2(a) (!(a & 1))
#define deb(x) cout << (#x) << " " << (x) << "\n";
#define newl cout << "\n"
#define all(s) s.begin(), s.end()
#define pi 3.14159265358979323846
#define fp(x) fixed << setprecision(x) <<
template <class T>
T mod(T a)
{
    if (a < 0)
    {
        a += 1000000007;
    }
    return a % 1000000007;
}
template <class T>
T addmod(T a, T b)
{
    return (mod(a) + mod(b)) % 1000000007;
}
template <class T>
T prodmod(T a, T b)
{
    return (mod(a) * mod(b)) % 1000000007;
}
template <class T>
T bin_exp(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b % 2 == 0)
        res = bin_exp(a * a, b / 2);
    else
    {
        res *= a;
        temp = bin_exp(a, --b);
    }
    return res * temp;
}
template <class T>
T bin_expmod(T a, T b)
{
    T res = 1;
    T temp = 1;
    if (b <= 1)
        return a;
    if (b % 2 == 0)
        res = bin_expmod(prodmod(a, a), b / 2);
    else
    {
        res = prodmod(a, res);
        temp = bin_exp(a, --b);
    }
    return prodmod(res, temp);
}

template <class T>
int digit(T a)
{
    vector<long long> dig = {
        0,
        9,
        99,
        999,
        9999,
        99999,
        999999,
        9999999,
        99999999,
        999999999,
        9999999999,
        99999999999,
        999999999999,
        9999999999999,
        99999999999999,
        999999999999999,
        9999999999999999,
        99999999999999999,
        999999999999999999,
        INT64_MAX};
    auto it = lower_bound(dig.begin(), dig.end(), a);
    int idx = (it - dig.begin());
    return idx;
}
template <class T>
int sumAllInts(T n)
{
    int a = 1;
    int su = 0;
    while (n)
    {
        su += n % 10;
        n /= 10;
    }
    return su;
}
template <class T>
void split(char c, T s)
{
    int n = s.size();
    int i = 0;
    while ((cout << s[i], i += 1) && (i < n) && (cout << c << ' '))
        ;
}
void print(vi &vec)
{
    for (int i = 0; i < vec.size(); i++)
    {
        cout << vec[i] << " ";
    }
}

void solve()
{
    int a,b,c;
    cin>>a>>b>>c;
    rep(i,1,b+1){
        int temp = a;
        temp *= i;
        if(temp%b==c){
            cout<<"YES";
            return;
        }
    }
    cout<<"NO";
    return;
}
int main()
{
    quickie;
    //txt;
    int t = 1;
    while (t--)
    {
        solve();
        newl;
    }
    return 0;
}

Measured memory_bytes: 3604
import math
def merge(a, left, mid, right):
    global c
    n1 = mid - left
    n2 = right - mid
    l = a[left:left + n1]
    r = a[mid:mid + n2]
    l.append(10e10)
    r.append(10e10)
    i = 0
    j = 0
    for k in range(left, right):
        if l[i] < r[j]:
            a[k] = l[i]
            i += 1
        else:
            a[k] = r[j]
            c += n1 - i
            j += 1
 
def mergeSort(a, left, right):
    if left + 1 < right:
        mid = math.ceil((left + right) / 2)
        mergeSort(a, left, mid)
        mergeSort(a, mid, right)
        merge(a, left, mid, right)
 
n = int(input())
a = list(map(int,input().split()))
c = 0
mergeSort(a, 0, n)
print(c)


Measured memory_bytes: 28956
#include <bits/stdc++.h>
using namespace std;
#define all int i=0; i<n; i++
#define pb push_back
typedef long long int ll;

#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl '\n'
#define mod 1000000007

bool sortinrev(const pair<ll,ll> &a,  
               const pair<ll,ll> &b) 
{ 
       return (a.first > b.first); 
}
int main(){
	ll n,ans=0,aft=0,bef=0,k;
	cin>>n>>k;
	ll arr[n];
	ll i1=((k*(k+1))/2)%mod;
	ll i2=((k*(k-1))/2)%mod;
	for(all){
		cin>>arr[i];
	}
	for(int i=0; i<n; i++){
		aft=0;
		bef=0;
		for(int j=i+1; j<n; j++){
			if(arr[i]>arr[j] && i!=j){
				aft++;
				ans%=mod;
			}
		}
		for(int j=0; j<i; j++){
			if(arr[i]>arr[j] && i!=j){
				bef++;
				ans%=mod;
			}
		}
		
		ans+=(aft%mod*i1%mod)%mod;
		ans+=(bef%mod*i2%mod)%mod;
	}
	cout<<((ans%mod))<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef pair<int,int> pii;

int n,s;
int l[555],r[555],w[555][555],t[555];;
pii p[555];

int main(){
  scanf("%d%d",&n,&s); s--;
  rep(i,n){
    scanf("%d%d",l+i,r+i);
    p[i] = pii(r[i],i);
  }
  rep(i,n)rep(j,n)scanf("%d",&w[i][j]);
  rep(k,n)rep(i,n)rep(j,n)w[i][j] = min(w[i][j],w[i][k]+w[k][j]);

  sort(p,p+n);
  rep(i,n)t[i] = min(r[i]-l[i], r[i]-w[s][i]);

  rep(i,n){
    int v = p[i].second;
    if(t[v]<0)continue;

    for(int j=i+1;j<n;j++){
      int u = p[j].second;
      if(r[v]+w[v][u] <= r[u]){
	t[u] = max(t[u], t[v] + min(r[u]-w[v][u]-r[v], r[u]-l[u]) );
      }
    }
  }

  printf("%d\n",*max_element(t,t+n));
}  

Measured memory_bytes: 2124
fun main(args: Array<String>) {
    val (A, B, X) = listOfDouble()
    val R: Double
    val S = X / A
    if (A * B / 2.0 <= S) {
        val H = 2 * (A * B - S) / A
        R = Math.atan(H / A) * 180.0 / Math.PI
    } else {
        val W = 2 * S / B
        R = Math.atan(B / W) * 180.0 / Math.PI
    }
    println(R)
}
fun next() = readLine()!!
fun listOfString() = next().split(" ")
fun listOfDouble() = listOfString().map { java.lang.Double.parseDouble(it) } //{ it.toDouble() }


Measured memory_bytes: 36200
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;

namespace AtCoder
{
	public class ABC
	{
		static public void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
			Solve(args);
			Console.Out.Flush();
		}

		private const int mod = 1000000007;  // 10^9+7

		static public void Solve(string[] args)
		{
			//string s = Console.ReadLine();
			//int x = int.Parse(Console.ReadLine());
			//long x = long.Parse(Console.ReadLine());
			int[] vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
			//long[] vs = Console.ReadLine().Split().Select(long.Parse).ToArray();
			int n = vs[0];
			int m = vs[1];
			int[][] h = new int[2][];
			h[0] = Console.ReadLine().Split().Select(int.Parse).ToArray();
			h[1] = new int[n];
			for (int i = 0; i < m; i++) {
				vs = Console.ReadLine().Split().Select(int.Parse).ToArray();
				int a = vs[0] - 1;
				int b = vs[1] - 1;
				h[1][a] = Math.Max(h[1][a], h[0][b]);
				h[1][b] = Math.Max(h[1][b], h[0][a]);
			}
			System.Diagnostics.Debug.WriteLine(string.Join(" ", h[0]));
			System.Diagnostics.Debug.WriteLine(string.Join(" ", h[1]));
			int ans = 0;
			for (int i = 0; i < n; i++) {
				if (h[0][i] > h[1][i]) {
					ans++;
				}
			}
			Console.WriteLine(ans);

		}
	}
}


Measured memory_bytes: 50020
// 2020-08-07 09:28:16
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = long long;
using ld = long double;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
using P = pair<int, int>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }

int n, s[20];
void print() {
  rep(i, n) {
    cout << char('a' + s[i]);
  }
  cout << '\n';
}
void rec(int mx, int d) {
  if(d == n) {
    print();
    return;
  }
  rep(i, mx+2) {
    s[d] = i;
    rec(max(mx, i), d+1);
  }
}
void answer() {
  cin >> n;
  rec(-1, 0);
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

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

typedef int in;
#define int long long
#define f first
#define s second
#define pb push_back
#define RETURN exit(0)
#define pow(x,y) (int)(pow(x,y))
#define ceil(x) (int)(ceil(x))
#ifndef ONLINE_JUDGE
#define debug(x) cout<<x<<endl;
#else
#define debug(x) 42
#endif
const int MAX=1e5+5;
const int MOD=1e9+7;
const int MAAX=1e18;
const long double EPS=1e-6;
int power(int x,int y)
{
    if (y == 0)
        return 1;
    int a=power(x,y/2);
    if (y % 2 == 0)
        return a * a % MOD;
    else
        return x * a * a % MOD;
}



in main()
{
    //freopen("in.in","r",stdin);
    //freopen("out.out","w",stdout);
    int tc=1;
    //scanf("%lld",&tc);
    while(tc--)
    {
        int n;
        cin>>n;
        for(int i=0;i<n;i++){
            int a;
            cin>>a;
            if(a%2==0&&a%3&&a%5){
                cout<<"DENIED\n";
                goto a;
            }
        }
        cout<<"APPROVED\n";
        a:;
    }
    ///matensa4 tegarab el sample w te7ot el freopen w te3mel SCANF
    RETURN;
}


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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MAXM 100010
#define rep(i,n) for (int i = 0; i < (n); ++i)
const ll mod = 1e9+7;

ll m, n;
priority_queue<int> pq;
vector<vector <ll> >G(MAXM);
int main() {
    cin >> n >> m;
    ll a, b;
    rep(i,n) {
        cin >> a >> b;
        G[a].push_back(b);
    }

    ll ans=0;

    for(int i=1; i<=m; i++) {
        rep(k, G[i].size()) {
            pq.push(G[i][k]);
        }

        if(! pq.empty()) {
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans << endl;
}



Measured memory_bytes: 5632
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include<cmath>
#include<limits>
#define ll long long
#define ALL(x) (x).begin(),(x).end()
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define int_INF 2147483647
#define ll_INF 	9223372036854775807
#define MOD 100000007
#define vi vector<int>
#define vvi vector<vector<int>>
#define vll vector<long long>
#define pii pair<int,int>
#define vpii vector<pair<int,int>>
using namespace std;

int main() {
    int N; cin >> N;
    int M = N;
    string s = "";
    while (N != 0) {
        int l = abs(N) % 2;
        N -= l;
        N /= (-2);
        s += to_string(l);
    }

    reverse(s.begin(), s.end());
    if (M == 0) {
        s = "0";
   }
    cout << s << endl;
}


Measured memory_bytes: 256