akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void resolve() {
    int n;
    cin >> n;
    VI d(n);
    REP(i,0,n) cin >> d[i];
    if (n == 1) {
        cout << 1 << endl;
        return;
    }
    int cnt = 1;
    sort(all(d));
    REP(i,1,n) {
        if (d[i-1] != d[i]) ++cnt;
    }
    cout << cnt << endl;
}

int main() {
    resolve();
    
    return 0;
}

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

int const N = 1e5+1;
string s[N];
int n;
map<string,int>mp;

int main(){
    scanf("%d",&n);
    for(int i = 0; i<n; ++i){
        cin >> s[i];
        sort(all(s[i]));
        ++mp[s[i]];
    }
    ll an = 0;
    for(auto i: mp){
        ll ad = 1ll*i.second*(i.second-1);
        ad /= 2;
        an = (ll)an + ad;
    }
    printf("%lld\n",an);
}


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

int main(){
    long N;
    string s;
    cin >> N >> s;
    array<long, 256> ans{};
    for(const auto& c : s)++ans[c];
    cout << accumulate(ans.begin(), ans.end(), 1LL, [](auto a, auto b){return a * (b + 1) % 1000000007;}) - 1 << endl;
    return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;
int main()
{
	int A[5];
	for(int i=0; i<3; i++){
		cin >> A[i];
	}
	sort(A,A+3);
	
	cout << A[2] * 10+ A[0] + A[1] << endl;
	
	return 0;
}



Measured memory_bytes: 256
//#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>


#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
//#define double long double

using namespace std;

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

const int MOD = 998244353;
const ll INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 200020;


bool found[30];
string S2;
int nex[200020][30];
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	string S, T; cin >> S >> T;
	int N = S.size();
	int M = T.size();
	map<char, int>mp;
	REP(i, 26) {
		char c = 'a' + i;
		mp[c] = i;
	}
	
	REP(i, N) {
		found[mp[S[i]]] = true;
	}
	REP(i, M) {
		if (!found[mp[T[i]]]) {
			print(-1);
			return 0;
		}
	}
	
	string S2=S+S;
	REP(i, 2 * N + 1) {
		REP(j, 30) {
			nex[i][j] = 1e9;
		}
	}
	//
	for (int i = 2 * N - 1; i >= 0; i--) {
		int now = mp[S2[i]];
		//print(now);
		REP(j, 26) {
			nex[i][j] = nex[i + 1][j] + 1;
		}
		nex[i][now] = 1;
	}
	//print("unko");
	ll ans = 0;
	int idx = 0;
	REP(i, M) {
		int now = mp[T[i]];
		ans += nex[idx][now];
		idx += nex[idx][now];
		idx %= N;
	}
	print(ans);
}



Measured memory_bytes: 47696
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 10e9;
void TravelingAtCoDeerProblem(){
	
	int n;
	cin >> n;
	int row = 1001;
	int high = -1;
	for (size_t i = 0; i < n; i++)
	{
		int a;
		cin >> a;
		row = min(a, row);
		high = max(a, high);
	}

	cout << (high - row) << endl;
}

int main() {
	TravelingAtCoDeerProblem();
	return 0;
}



Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int n, k;
	scanf("%d%d", &n, &k);

	double pr = 0;
	if (k <= n) pr = n-k+1;

	for (int i = 1; i <= n && i < k; i++) {
		if (i < k) {
			int s = i, cnt = 0;
			while (s < k) {
				cnt++;
				s *= 2;
			}
			pr += 1.0/(1<<cnt);
		}
	}
	printf("%.9f\n", pr/n);
}


Measured memory_bytes: 128
N = input()
A = [0]*N
B = [0]*N
for i in range(N):
    A[i],B[i] = map(int, raw_input().split())
c = 0
for i in range(N)[::-1]:
    a = B[i] - ((A[i]+c+B[i]-1)%B[i]+1)
    c += a
print c


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

using std::cin;
using std::cout;
using std::endl;
using std::string;
using std::vector;
using std::bitset;

#define rep(i,n)    for(int i=0; i<(int)n; i++)
#define reps(i,s,e) for(int i=s; i<(int)e; i++)
#define coutd(i) cout << std::fixed << std::setprecision(i)
typedef long double ld;
typedef long long ll;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef std::pair<int, int> pii;
typedef std::pair<ll, ll> pll;

template<class T>
using Set = std::set<T>;
template<class T, class U>
using Map = std::map<T, U>;

template<class T>
using Graph = vector<vector<T>>;

const int INT_BIG = 1<<28;

int main() {
    ll N;
    cin >> N;
    N -= 1;
    string ans = "";
    while (N >= 0) {
        ll index = N % 26;
        ans = (char)(index + 'a') + ans;
        if (N == 0) {
            break;
        }
        N /= 26;
        N -= 1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3628
import java.util.Scanner;

public class Main {
	private Scanner sc;

	public static void main(String[] args) {
		new Main();
	}
	
	public Main() {
		sc = new Scanner(System.in);
		
		int[] prev = {0};
		int[] next = {0};
		while (sc.hasNextLine()) {
			String[] nico = sc.nextLine().split(",");

			next = new int[nico.length];
			int[] num = new int[nico.length];
			for (int i = 0; i < nico.length; i++) {
				num[i] = Integer.parseInt(nico[i]);
				next[i] = 0;
			}

			for (int i = 0; i < nico.length; i++) {
				if (prev.length <= next.length) {
					if (i == 0) next[i] = prev[i] + num[i];
					else if (i == prev.length) next[i] = prev[i - 1] + num[i];
					else next[i] = num[i] + Math.max(prev[i- 1], prev[i]);
				} else {
					next[i] = num[i] + Math.max(prev[i], prev[i + 1]);
				}
			}
			prev = next;
		}
		
		System.out.println(next[0]);
	}
}

Measured memory_bytes: 27748
#include <bits/stdc++.h>
#define int long
#define ll long long
#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;
int gcd(int a,int b){return b ? gcd(b,a%b) : a;}
int lcm(int a,int b){return a/gcd(a,b)*b;}

main() {
    for(;;){
        string S; cin >> S;
        if(S.size()==1 && S[0]=='0') break;
        int ans=0;
        rep(i,S.size()){
            ans+=(int)S[i]-'0';
        }
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 3180
def rate(m, f, r)
  return 'F' if m == -1 || f == -1
  a = m + f
  return 'A' if 80 <= a
  return 'B' if 65 <= a && a < 80
  return 'C' if 50 <= a && a < 65 || r >= 50
  return 'D' if 30 <= a && a < 50
  return 'F'
end
readlines.each do |line|
  m, f, r = line.split.map(&:to_i)
  break if m == -1 && f == -1 && r == -1
  puts rate(m, f, r)
end

Measured memory_bytes: 6100
#include <bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using P = pair<int, int>;

vector<P> v[15];

int main() {
  int N;
  cin >> N;
  rep(i, N) {
    int a;
    cin >> a;
    rep(j, a) {
      int x, y;
      cin >> x >> y;
      x--;
      v[i].push_back({x, y});
    }
  }

  int ans = 0;

  rep(bit, (1<<N)) {
    bool f = true;
    rep(i, N) {
      if(bit & (1<<i)) {
        rep(j, v[i].size()) {
          if(v[i][j].second == 0) {
            if(bit & (1<<(v[i][j].first))){
              f = false;
              break;
            }
          } else {
            if(!(bit & (1<<v[i][j].first))){
              f = false;
              break;
            }
          }
        }
      }
      if(!f) break;
    }
      if(f){
        ans = max(ans, __builtin_popcount(bit));
        // cout << bit << endl;
      } 
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using Graph = vector<vector<int>>;
const int INF = 10000000;
#define mod 1000000007

ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
bool palin(int N){//Nが回文数かどうか
    string S = to_string(N);
    int M = (S.size()-1)/2 + 1;
    int n = S.size();
    bool flag = true;

    for(int i = M;i<n;i++){
        if(S[i] != S[n-i-1]) flag = false;
    }
   return flag;
}
/*まずゴールに辿り着けるかを探索　ゴールまでの距離を求める
最初の白マスの個数ー（距離＋１）が答え
たどり着けない場合、-1を出力
*/

ll factorial(ll n){
    ll i = 1;
    ll ans = 1;
    while(i<=n){
        ans = (i*ans)%mod;
        i++;
    }
    return ans;
}
 
ll calc(ll a,ll b ,ll p){
    if(b == 0){
        return 1;
    }
    else if(b %2 == 0){
        ll d = calc(a,b/2,p);
        return ((d%p)*(d%p))%p;
    }
    else{
        return ((a%p)*calc(a,b-1,p))%p;
    }
}
int main() {
    ll X,Y;
    cin >> X >> Y;


    if((2*Y-X)%3 != 0 || (2*X-Y)%3 != 0) cout << 0 << endl;
    else{
        ll n = (2*Y-X)/3;
        ll m = (2*X-Y)/3;
      if(n < 0 || m <0) cout << 0 << endl;
      else{
        ll ans = (((factorial(n+m)*calc(factorial(n),mod-2,mod))%mod)*calc(factorial(m),mod-2,mod))%mod;
    cout << ans << endl;
      }
    }
  
}


Measured memory_bytes: 256
#include <stdio.h>

int main (void)
{
  int n;
  int tmp;

  scanf("%d",&n);
  tmp = n % 10;
  if (tmp == 3) printf("bon\n");
  else if(tmp == 0 || tmp == 1 || tmp == 6 || tmp == 8) printf("pon\n");
  else printf("hon\n");
}

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

using namespace std;

int main(){
   ios_base::sync_with_stdio(false); cin.tie(NULL);
   int a, b, o, d, rta, i;

   cin >> a >> b;

   int balls[a+1];
   bool valid[a+1];

   for( i = 1; i <= a; i++ ){
        balls[i] = 1;
        valid[i] = false;
   }
   valid[1] = true;

   while( b-- ){
    cin >> o >> d;
    if( balls[o] > 0 ){
        balls[o]--;
        balls[d]++;
        if( valid[o] ){
            valid[d] = true;
            if( balls[o] == 0 ) valid[o] = false;
        }
    }
   }

   rta = 0;
   for( i = 1; i <= a; i++ ){
    if( valid[i] ) rta++;
   }

   cout << rta<< "\n";
   return 0;
}


Measured memory_bytes: 768
#include<iostream>
#include<unordered_map>
#include<bitset>
#include<math.h>
#include<vector>
#include<set>
#include<algorithm>
#include<ctype.h>
#include<unordered_set>
#include<string>
#include<iomanip>
#include<queue>
#include<limits>
#include<map>
#include<stack>
#include<iterator>
#include<cstring>
 
#include<deque>
#define pi 3.141592653589793238
#include<chrono>
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define MOD 1000000007
#define INF 999999999999999999 
#define pb push_back
#define ff first
#define ss second
 
#define mt make_tuple
#define ll long long
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
 
 
typedef tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
 
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
set<ll> s;

int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    fast;
    ll T = 1, i, j;
    
    //cin >> T;
    while (T--) {
        ll calcy = 0;
        ll n, m;
        cin >> n >> m;
        vector<ll> x(n), y(m);
        for(i = 0; i < n; i++){
            cin >> x[i];
        }
        for(i = 0; i < m; i++){
            cin >> y[i];
        }
        sort(x.begin(), x.end());
        sort(y.begin(), y.end());
        vector<ll> dp(n + 1);
        for(i = 0; i < m; i++){
            calcy -= (m - 1 - i) * y[i];
            calcy += i * (y[i]);
            calcy %= MOD;
        }
        ll calcx = 0;
        for(i = 0; i < n; i++){
            calcx -= (n - 1 - i) * x[i];
            calcx += i * (x[i]);
            calcx %= MOD;
        }
        cout << calcy * calcx % MOD;
    }
    return 0;
}

Measured memory_bytes: 5580
#include <iostream>
#include <vector>
#include <math.h>
using namespace std;

int Search(vector<int>& List, int Max);

int Search(vector<int>& List, int Max){
    int Count = 0;
    int TotalObject = 0;
    
    for(int i = 0; i < List.size(); i++){
        TotalObject += List[i];
        if(TotalObject > Max){
            Count++;
            TotalObject = 0;
            i--;
        } else if(TotalObject <= Max && i == List.size() - 1){
            Count++;
        }       
    }
    return Count;
}

int main(void){
    int ObjectNumber, TracKNumber, Object;
    int TotalObject = 0;
    int Max = 0;
    vector<int> List;
    
    std::cin >> ObjectNumber >> TracKNumber;
    
    List.clear();
    for(int i = 0; i < ObjectNumber; i++){
        std::cin >> Object;
        if(Max < Object)    Max = Object;
        TotalObject+= Object;
        List.push_back(Object);
    }
    
    if(TracKNumber == 1){
        cout << TotalObject << endl;
        return 0;
    }
    int Ans = ceil((double)TotalObject / TracKNumber);
    if(Max > Ans)   Ans = Max;
    
    bool IsAnswer = false;
    while(!IsAnswer){
        if(Search(List, Ans) <= TracKNumber){
            IsAnswer = true;
        } else {
            Ans++;
        }
    }
    cout << Ans << endl;
}

Measured memory_bytes: 1672
#include <bits/stdc++.h>
using std::cerr;
using std::endl;

const int N = 75 * 10, P = 1e9 + 7;

inline int fpow(int x, int y) {
  int ret = 1;
  for ( ; y; y >>= 1, x = 1ll * x * x % P)
    if (y & 1) ret = 1ll * ret * x % P;
  return ret;
}

int n, m, fac[N], inv[N];
char str[N];
int size[N];

inline int binom(int x, int y) {
  if (x < y || x < 0 || y < 0) return 0;
  return 1ll * fac[x] * inv[y] % P * inv[x - y] % P;
}

int val[N], tot;
int ans = 1;
int last[N];
bool vis[N];

inline bool check() {
  for (int i = 1; i <= m; ++i)
    vis[i] = 0, last[i] = 0;
  for (int i = 1, j = 1; i <= tot; ++i) {
    while (j <= m && str[j] != 'r') ++j;
    if (j > m) return 0;
    last[i] = j, vis[j] = 1;
    ++j;
  }
  for (int i = 1, j = 1; i <= tot; ++i) {
    if (val[i] == 1) continue;
    if (j <= last[i]) j = last[i] + 1;
    while (j <= m && str[j] != 'b') ++j;
    if (j > m) return 0;
    last[i] = j, vis[j] = 1;
    ++j;
  }

  for (int i = 1, j = 1; i <= tot; ++i) {
    if (val[i] <= 2) continue;
    if (j <= last[i]) j = last[i] + 1;
    for (int k = val[i] - 2; k; --k) {
      while (j <= m && vis[j]) ++j;
      if (j > m) return 0;
      vis[j] = 1, ++j;
    }
  }
  return 1;
}

void dfs(int left, int high) {
  if (check()) {
    int sum = tot + 1;
    for (int i = 1; i <= tot; ++i) {
      sum += size[val[i]];
      if (val[i] > 1) sum += 2;
    }
    int way = 1ll * binom(sum + left - 1, left);
    way = 1ll * way * fac[tot] % P;
    for (int i = 1, j = 1; i <= tot; i = j) {
      while (j <= tot && val[i] == val[j])
        ++j;
      way = 1ll * way * inv[j - i] % P;
    }
    ans = (ans + way) % P;
  }
  for (int i = 1; i <= high; ++i) {
    if (size[i] + 1 > left) break;
    val[++tot] = i;
    dfs(left - size[i] - 1, i);
    --tot;
  }
}

int main() {
  for (int i = fac[0] = 1; i < N; ++i)
    fac[i] = 1ll * fac[i - 1] * i % P;
  inv[N - 1] = fpow(fac[N - 1], P - 2);
  for (int i = N - 1; i; --i)
    inv[i - 1] = 1ll * inv[i] * i % P;
  scanf("%d %d %s", &n, &m, str + 1);
  size[1] = size[2] = 1;
  for (int i = 3; i < N; ++i)
    size[i] = size[i - 1] + 2;
  for (int i = 1; ; ++i) {
    if (size[i] > n) break;
    val[tot = 1] = i;
    dfs(n - size[i], i);
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3788
a,b,c,x=map(int,open(0).read().split())

total=0
for a_ in range(0,a+1):
  for b_ in range(0,b+1):
    y=x-a_*500-b_*100
    if y%50==0 and 0<=y//50<=c:
      total+=1
print(total)

Measured memory_bytes: 2940
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain, product
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    # 10**6
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     # 10**6
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp

#

class UnionFindEx:
    def __init__(self, size):
        #正なら根の番号、負ならグループサイズ
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   #負なら根
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    #サイズ更新
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    N = ii()
    X = input()
    X_POP = X.count('1')
    X_POP_P = X_POP + 1
    X_POP_N = X_POP - 1
    FX_P = 0
    FX_N = 0
    for i, b in enumerate(X):
        FX_P <<= 1
        FX_N <<= 1
        if b=='1':
            FX_P += 1
            FX_N += 1
        FX_P %= X_POP_P
        FX_N %= X_POP_N or 1
    #
    def popcount(n):
        return bin(n).count('1')
    def f(n):
        if n==0:
            return 0
        else:
            return f(n % popcount(n)) + 1
    ans = []
    for i, b in enumerate(reversed(X)):
        if b=='0':
            fx = f((FX_P + pow(2, i, X_POP_P)) % X_POP_P)+1
        else:
            if X_POP_N==0:
                fx = 0
            else:
                fx = f((FX_N - pow(2, i, X_POP_N)) % X_POP_N)+1
        ans.append(fx)
    print(*reversed(ans))



main()



Measured memory_bytes: 13408
#pragma once

#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;
long long int N,M,a[50][2],b[50][2],result[50],myMin;

long long int zettai(long long int a, long long int b) {
	if (0 <= a - b) {
		return a - b;
	}
	else {
		return b -a;
	}
}


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

	for (int i = 0; i < M; i++) {
		cin >> b[i][0] ;
		cin >> b[i][1];
	}

	for (int i = 0; i < N; i++) {
		myMin = 1000000000;
		for (int j = 0; j < M; j++) {
			if (myMin > zettai(a[i][0],b[j][0]) + zettai(a[i][1], b[j][1])) {
				myMin = zettai(a[i][0], b[j][0]) + zettai(a[i][1], b[j][1]);
				result[i] = j;
			}
		}

	}

	for (int i = 0; i < N; i++) {
		result[i]++;
		cout << result[i]<< endl;
	}

	return 0;
}




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

int main(){
  int n,k;
  cin >> n >> k;
  vector<int> a(n+1);
  for(int i=0;i<n;i++){
    int x;
    cin >> x;
    a[x]++;
  }
  sort(a.begin(),a.end());
  int ans=0;
  for(int i=0;i<n-k+1;i++) ans+=a[i];
  
  cout << max(0,ans) << endl;
}

Measured memory_bytes: 4004
#include <vector>
#include <cmath>
#include <iostream>
#include <algorithm>

typedef char                SINT8;
typedef unsigned char       UINT8;
typedef short               SINT16;
typedef unsigned short      UINT16;
typedef int                 SINT32;
typedef unsigned int        UINT32;
typedef long long           SINT64;
typedef unsigned long long  UINT64;
typedef double              DOUBLE;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

using namespace std;

int main() {

	string N;
	cin >> N;
	SINT32 ANS = 0;
	SINT32 BUF = 0;

	if (N[0] != 'A') {
		ANS = 1;
	}

	for (SINT32 i = 1; i < N.length(); i++) {
		if((N[i]>= 'a') && (N[i]<='z')){
		} else {
			if (N[i] != 'C') {
				ANS = 1;
			} else if (i == 1) {
				ANS = 1;
			} else if (i == N.length() - 1) {
				ANS = 1;
			} else {
				if (BUF == 1) {
					ANS = 1;
				} else {
					BUF = 1;
				}

			}
		}
	}

	if (BUF == 0) {
		ANS = 1;
	}
	if (ANS == 0) {
		cout << "AC" << endl;

	} else {
		cout << "WA"<< endl;
	}

	
	return 0;
}

//	sort(DATA.begin(),DATA.end());
//	sort(DATA.begin(),DATA.end(),std::greater<SINT32>());
//	__gcd(ANS,DATA[i]);

//	// DATA.emplace_back(BUF);	//後ろに追加

/*
	SINT32 M = 3;
	vector<pair<SINT32,SINT32>> DATA2(M);
	for (SINT32 i = 0; i < M; i++) {
		cin >> DATA2[i].first;
		cin >> DATA2[i].second;
	}
	sort(DATA2.begin(),DATA2.end());
	cout << DATA2[0].first << endl;
	cout << DATA2[0].second << endl;
*/

//		APOSI = lower_bound(ADATA.begin(),ADATA.end(),QDATA[i]) - ADATA.begin();
//		BPOSI = lower_bound(BDATA.begin(),BDATA.end(),QDATA[i]) - BDATA.begin();

Measured memory_bytes: 256
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <regex>
#define REP(i,n) for(int i = 0; i < n; i++)
#define FOR(i,j,n) for(int i = j; i < n; i++)
#define RFOR(i,j,n) for(int i = j-1; i >= n; i--)
#define PREC(n) fixed << setprecision(n)
#define print_array(v) REP(__k, v.size()) { cout << v[__k]; if(__k != v.size()-1) cout << " "; else cout << endl; }
#define YesorNo(a) printf(a?"Yes\n":"No\n")
#define _LIBCPP_DEBUG 0
using namespace std;
int64_t MOD = 1000000007;

bool is_acgt(string s) {
  bool flag = true;
  REP(i,s.size()) {
    if(s[i] == 'A') continue;
    if(s[i] == 'C') continue;
    if(s[i] == 'G') continue;
    if(s[i] == 'T') continue;
    flag = false;
  }
  return flag;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int res = 0;
  for(int i = 0; i < s.size(); i++) {
    for(int j = s.size() - i; j >= 1; j--) {
      string st = s.substr(i,j);
      if(is_acgt(st)) res = max(res,(int)st.size());
      //cout << i << " " << j << " " << st << endl;
    }
  }
  cout << res << endl;
  return 0;
}
//templete by private_yusuke

Measured memory_bytes: 256
import scala.io.StdIn.readInt

object Main extends App {
  val x = readInt()
  lazy val ys = 2 to (x / 2)
  
  def findPrime(x: Int): Int = {
    if (ys.exists(y => x % y == 0))
      findPrime(x + 1)
    else
      x
  }
  
  println(findPrime(x))
}

Measured memory_bytes: 54780
s = input()
n, m = s.split()
n = int(n)
m = int(m)

if n==1:
    print((m+1)%1000000007)
else:

    d = m // (n - 1)


    A = m - d * (n-1) + 1
    B = m - (n-1) + 1
    ans = (A+B)*d + (m+1)
    # ans = 2*(d*m+d)-(n-1)*(d+1)*d+m+1
    ans %= 1000000007
    print(ans)

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

#define rep(i,N) repf(i,0,N)
#define reps(i,N) repfs(i,0,N)
#define repf(i,a,b) for(int i=a;i<b;i++)
#define repfs(i,a,b) for(int i=a+1;i<=b;i++)
#define repr(i,N) for(int i=N-1;i>=0;i--)
#define reprs(i,N) for(int i=N;i>0;i--)

#define d(a) if(isDebugMode) cout<<#a<<"="<<a<<"."
#define d2(a,b) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<"."
#define d3(a,b,c) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<"."
#define d4(a,b,c,d) if(isDebugMode) cout<<#a<<"="<<a<<","<<#b<<"="<<b<<","<<#c<<"="<<c<<","<<#d<<"="<<d<<"."
#define da(arr,N){if(isDebugMode){rep(i,N){if(arr[i]==INF)printf("INF ");else cout<<arr[i]<<" ";} cout<<endl;}}
#define da2(arr,N,M){if(isDebugMode)rep(i,N){rep(j,M){if(arr[i][j]==INF)printf(" INF");else printf(" %3d",arr[i][j]);}cout<<endl;}}
#define pb push_back
#define pob pop_back

auto chmax =[](int &a,int b){ a = max(a, b);};
auto chmin =[](int &a,int b){ a = min(a, b);};

typedef long long ll;
typedef pair<int,int> P;
const int INF = 100000000;
const int MOD = 1000000007;
const int dx[4] = { 0, 1, 0,-1};
const int dy[4] = { 1, 0,-1, 0};

bool isDebugMode=1;
//--------------------------------------//
ll s;

void solve(){
	ll a=s%1000;
	ll ans=INF;
	while(s!=0){
		ans=min(ans,abs(753-a));
		s/=10;
		a=s%1000;
	}
	cout<<ans<<endl;
}

int main(){
	cin>>s;
	solve();
	return 0;
}


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

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

using Int = long long;
int mo = 1e9+7;
int inf = 1e9;

int N, M;
string S;

signed main()
{
    cin >> N >> M >> S;

    vector<int> ans;

    reverse(begin(S), end(S));

    int cur = 0;

    while (cur < N) {
        int nx = cur;
        int n = 0;

        for (int i = 1; i <= M; ++i) {
            if (cur + i > N) break;
            if (S[cur + i] == '0') {
                nx = cur + i;
                n = i;
            }
        }

        if (cur == nx) {
            cout << -1 << endl;
            return 0;
        }

        cur = nx;
        ans.push_back(n);
    }

    reverse(begin(ans), end(ans));

    rep(i, ans.size()) {
        if (i) printf(" ");
        printf("%d", ans[i]);
    }
    printf("\n");

    return 0;
}


Measured memory_bytes: 1144
N = int(input())
count = 0

for i in range(len(str(N))):
    if i%2 == 0:
        min = 10**i
        max = 10**(i+1)-1
        if  max < N:
            count += (max-min+1)
        else:
            count += (N-min+1)
            break
print(count)

Measured memory_bytes: 3060
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>

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

using std::map;
using std::set;
using std::bitset;
using std::vector;
using std::string;
using std::multimap;
using std::multiset;
using std::deque;
using std::queue;
using std::stack;
using std::pair;
using std::iterator;

using std::sort;
using std::stable_sort;
using std::reverse;
using std::max_element;
using std::min_element;
using std::unique;
using std::ios_base;
using std::swap;
using std::fill;

using std::setprecision;
using std::fixed;

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

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

#define int long long

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef string S;

#define F(i, n) for (int (i) = 0; (i) != (n); (i)++)
#define fi first
#define se second
#define re return
#define all(x) (x).begin(), (x).end()

const int N = 522220;
const int MOD = 1e9 + 7;
const double eps = 1e-8;

int n, x, a[N];
int ans;
int v[N];
int p[N];

int P(int i)
{
    if (i >= 0) return p[i];
    return 0;
}

signed main()
{
    srand(time(NULL));
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> x;
    for (int i = 0; i < n; i++) cin >> a[i];
    v[0] = 5;
    v[1] = 5;
    for (int i = 2; i < n; i++) v[i] = v[i - 1] + 2;
    reverse(a, a + n);
    for (int i = 0; i < n; i++)
        ans += 5 * a[i] + x, p[i] = P(i - 1) + a[i];
    for (int i = n; i < 2 * n; i++) p[i] = p[i - 1];
    for (int block_size = 1; block_size <= n; block_size++)
    {
        int res = x * block_size;
        int j = -1;
        for (int i = block_size - 1; i < n + block_size; i += block_size)
        {
            res += v[i / block_size] * (P(i) - P(i - block_size));
            if (res > ans) break;
        }
        ans = min(ans, res);
    }
    cout << ans + n * x;
}


Measured memory_bytes: 10496
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#define INF (2000000000)
using namespace std;

typedef vector<int> VI;
typedef vector<int>::iterator VII;
typedef vector<double> VD;
typedef vector<double>::iterator VDI;

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

int map[200][200];
bool done[200][200];

int xg, yg;

void Search(int y, int x)
{
	done[y][x] = true;
	for (int i = 0; i < 4; i++){
		if (!done[y + dy[i]][x + dx[i]] && map[y][x] == map[y + dy[i]][x + dx[i]]){
			Search(y + dy[i], x + dx[i]);
		}
	}
}

int main()
{
	int w, h;
	while (scanf("%d %d", &w, &h), w + h){
		memset(map, 0, sizeof(map));
		memset(done, 0, sizeof(done));
		
		int xs, ys;
		scanf("%d %d %d %d", &xs, &ys, &xg, &yg);
		
		int n;
		scanf("%d", &n);
		
		for (int i = 0; i < n; i++){
			int c, d, x, y;
			scanf("%d %d %d %d", &c, &d, &x, &y);
			
			int a = 2, b = 4;
			if (d == 1){
				swap(a, b);
			}
			
			for (int j = y; j < y + a; j++){
				for (int k = x; k < x + b; k++){
					map[j][k] = c;
				}
			}
		}
		
		if (map[ys][xs]) Search(ys, xs);
		
		printf(done[yg][xg] ? "OK\n" : "NG\n");
	}
	
	return 0;
}

Measured memory_bytes: 1376
#include<stdio.h>
int main()
{
    int A[3],B[3],i=0,max=0,j=0,s=0;
    for(i=0;i<3;i++)
    {
        scanf("%d",&A[i]);
    }
    for(j=0;j<3;j++)
    {max=A[j];
    for(i=j;i<3;i++)
    {
        if(A[i]>=max)
        {
            max=A[i];
            A[i]=A[j];
            A[j]=max;
        }
    }
    }
    for(i=0;i<2;i++)
    {
        s=s + A[i]-A[i+1];
    }

printf("%d\n",s);
    return 0;
}


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






int main() {
  int N;cin>>N;
  vector<tuple<string,int,int>>V(N);
  for(int i=0;i<N;i++){
    string s;
    int p;
    cin>>s>>p;
    V[i]=make_tuple(s,100-p,i+1);
    
  }
  sort(V.begin(),V.end());
  
  
  for(int i=0;i<N;i++){
    cout<<get<2>(V[i])<<endl;
  }
}



Measured memory_bytes: 636
from collections import deque
n = int(input())
dq = deque()
for i in range(n):
    stdin = input()
    if(stdin.split()[0] == "0"):
        if(stdin.split()[1] == "1"):
            dq.append(stdin.split()[2])
        else:
            dq.appendleft(stdin.split()[2])

    elif stdin.split()[0] == "1":
        print(dq[int(stdin.split()[1])])
    else:
        if stdin.split()[1] == "1":
              dq.pop()
        else:
              dq.popleft()
        
        



Measured memory_bytes: 34576
/*  -*- coding: utf-8 -*-
 *
 * a.cc: A: Buying Sweets
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

/* typedef */

/* global variables */

/* subroutines */

/* main */

int main() {
  int x, a, b;
  scanf("%d%d%d", &x, &a, &b);
  printf("%d\n", (x - a) % b);
  return 0;
}


Measured memory_bytes: 256
fun main(arr:Array<String>) {
    val (n,k) = readLine()!!.split(" ").map { it.toLong() }
    println(getAns(n,k))
}


fun getAns(default:Long, k:Long):Long {
    val tmp = default % k
    if(tmp <= k / 2) {
        return tmp
    } else {
        return k-tmp
    }
}

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

using namespace std;
int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && a!=c)
        cout<<"Yes"<<endl;
    else if(b==c && b!=a )
        cout<<"Yes"<<endl;
    else if(a==c && a!=b)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

   return 0;
}


Measured memory_bytes: 3612
n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = list(str(i) for i in input())

ans = [0] * n
def janken(te):
  if te == 'r':
    return p
  elif te == 's':
    return r
  else:
    return s
    
for i in range(n):
  konkai = janken(t[i])
  if i < k:
    ans[i] = konkai
  elif ans[i-k] != konkai:
    ans[i] = konkai
  else:
    if t[i-k] == t[i]:
      ans[i] = 0
    else:
      ans[i] = konkai
print(sum(ans))

Measured memory_bytes: 4788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int h, w, k;
    cin >> h >> w >> k;
    vector<string> s(h);
    rep(i, h)cin >> s[i];
    int ans = 0;
    rep(i, (1 << h))rep(j, (1 << w)){
        vector<string> t = s;
        rep(m, h){
            if(1 & (i >> m)){
                rep(n, w)t[m][n] = '.';
            }
        }
        rep(n, w){
            if(1 & (j >> n)){
                rep(m, h)t[m][n] = '.';
            }
        }
        int cnt = 0;
        rep(m, h)rep(n, w)if(t[m][n] == '#')cnt++;
        if(cnt == k)ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3648
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
typedef pair<ll, int> pl;
const ll N = 1e5 + 100;
const ll MOD = 1e9+7;


set<int> exist;
int x, n;
int a[N];



int main() {
	cin>>x>>n;
	for(int i=0;i<n;i++) {
        cin>>a[i];
        exist.insert(a[i]);
	}

	int ans = 1000000, pos = 1;
	for(int i=-50;i<=150;i++) {
        if(exist.count(i))continue;
        if (abs(i - x) < ans) {
            ans = abs(i - x);
            pos =i;
        }
	}
	cout<<pos<<endl;

    return 0;
}


Measured memory_bytes: 3616
#include <iostream> 
#include <vector>
#include <algorithm>

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

int main() {
    long long X;
    cin >> X;
    
    long long total = 100;
    int Counter = 0;
    for (int i = 0; total < X; i++) {
        total *= 1.01;
        Counter += 1;
    }
    cout << Counter << endl;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main(){
 	int n; cin >> n;
  	vector<int> v(n);
  	for(int&e:v)cin >> e;
  	sort(v.rbegin(),v.rend());
  	int ans = 0;
  	bool f = true;
  	for(int e:v){
     	if(f) ans += e;
      	else ans -= e;
      	f = !f;
    }
  	cout << ans << endl;
  	return 0;
}

Measured memory_bytes: 256
N = int(input())
W = list(map(int, input().split()))
S = 100

for T in range(N) :
  S1 = 0
  S2 = 0
  
  if(T == 0) :
    S1 = W[0]
  else :
    for i in range(T + 1) :
      S1 += W[i]
    
  for j in range(T + 1, N) :
    S2 += W[j]
     
  if(S > abs(S1 - S2)) :
    S = abs(S1 - S2)
  else :
    pass
  
print(S)

Measured memory_bytes: 3060
#include<stdio.h>

struct dice {
	int eye[6];
};

void rightroll(struct dice *a){
	int s = a->eye[0];
	a->eye[0] = a->eye[3];
	a->eye[3] = a->eye[5];
	a->eye[5] = a->eye[2];
	a->eye[2] = s;
}
void beyoroll(struct dice *a){
	int s = a->eye[0];
	a->eye[0] = a->eye[1];
	a->eye[1] = a->eye[5];
	a->eye[5] = a->eye[4];
	a->eye[4] = s;
}
void thisroll(struct dice *a){
	int s = a->eye[0];
	a->eye[0] = a->eye[4];
	a->eye[4] = a->eye[5];
	a->eye[5] = a->eye[1];
	a->eye[1] = s;
}
void leftroll(struct dice *a){
	int s = a->eye[0];
	a->eye[0] = a->eye[2];
	a->eye[2] = a->eye[5];
	a->eye[5] = a->eye[3];
	a->eye[3] = s;
}
void rsideroll(struct dice *a){
	int s = a->eye[1];
	a->eye[1] = a->eye[2];
	a->eye[2] = a->eye[4];
	a->eye[4] = a->eye[3];
	a->eye[3] = s;
}
void lsideroll(struct dice *a){
	int s = a->eye[1];
	a->eye[1] = a->eye[3];
	a->eye[3] = a->eye[4];
	a->eye[4] = a->eye[2];
	a->eye[2] = s;
}

int search(struct dice *a, struct dice *b){
	int i, j,k;
	int c = 0; //カウント用,=6で一致
	for (i = 0; i < 6; i++){
		if (a->eye[i] == b->eye[0]){
			c++;
			break;
		}
	} //串刺し固定
	if (c == 0)
		return 0;
	switch (i){
	case 0:
		break;
	case 1:
		beyoroll(a);
		break;
	case 2:
		leftroll(a);
		break;
	case 3:rightroll(a);
		break;
	case 4:
		thisroll(a);
		break;
	case 5:
		leftroll(a);
		leftroll(a);
		break;
	} //固定完了

	for (k = 0; k < 4; k++){
		for (j = 0; j < 4; j++){
			i = 0;
			c = 1;
			for (i = 1; i < 6; i++){
				if (a->eye[i] == b->eye[i]){
					c++;
				}
				if (c == 6){
					return 1;
				}
			}
			lsideroll(a);
		}
		beyoroll(a);
	}
	return 0;
}

int main(void){
	struct dice a[100];
	int n=0;
	int i = 0,j;
	scanf("%d", &n);
	for (; i < n; i++){
		for (j = 0; j < 6; j++){
			scanf("%d", &a[i].eye[j]);
		}
	}

	int c = 0;
	for (i = 0; i < n; i++){
		for (j = 1; i+j < n; j++){
			if (search(&a[i], &a[i + j]) == 1){
				c++;
				break;
			}
			else
				;
		}
	}
	if (c==0)
		printf("Yes\n");
	else
		printf("No\n");


	return 0;
}


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

int N;

int sumN(int N){
    int sum=0;
    while(N){
        sum+=N%10;
        N/=10;
    }
    return sum;
}

int main(){
    cin>>N;
    cout<<(N%sumN(N)?"No":"Yes");
    return 0;
}



Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	char c[3];
	char d[3];
	scanf("%s",c);
	scanf("%s",d);
	if(c[0]==d[2]&&c[1]==d[1]&&c[2]==d[0]){
		printf("YES\n");
	}
	else{
		printf("NO\n");
	}
	return 0;
}


Measured memory_bytes: 128
def score(base,type)
  base + type.size**2
end
io = STDIN
td = []
n,k=io.gets.split.map(&:to_i)
td=(1..n).map{io.gets.split.map(&:to_i)}.sort_by{|t,d|-d}
base=0
exchange_candidate=[]
type={}
(0...k).each do |i|
  t,d=td[i]
  base+=d
  if type[t]
    exchange_candidate << d
  end
  type[t]=true
end
ans=score(base,type)
(k...n).each do |i|
  t,d=td[i]
  next if type[t]
  break if exchange_candidate.empty?
  remove=exchange_candidate.pop
  type[t]=true
  base+=(d-remove)
  ans = [ans,score(base,type)].max
end
puts ans


Measured memory_bytes: 14544
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main implements Runnable {

	public static void main(String[] args) {

		new Thread(null, new Main(), "", 16 * 1024 * 1024).start();

	}

	@Override
	public void run() {
		exec();
	}

	private void exec() {

		FastScanner sc = new FastScanner(System.in);
		String s = sc.next();
		boolean good = true;
		for(int i = 1 ; i <= s.length() ; i++) {
			char c = s.charAt(i - 1);
			// 偶数
			if(i % 2 == 0) {
				if(c != 'L' && c != 'U' && c != 'D') {
					good = false;
				}
			} else {
				if(c != 'R' && c != 'U' && c != 'D') {
					good = false;
				}
			}
		}
		if(good) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}

class FastScanner {

	private final InputStream in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	public FastScanner(InputStream in) {
		this.in = in;
	}

	private boolean hasNextByte() {
		if(ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if(buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if(hasNextByte()) {
			return buffer[ptr++];
		} else {
			return -1;
		}
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while(hasNextByte() && !isPrintableChar(buffer[ptr])) {
			ptr++;
		}
		return hasNextByte();
	}

	public String next() {
		if (!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext()) {
			throw new NoSuchElementException();
		}
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)){
				return minus ? -n : n;
			}else{
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}

}


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

namespace CF2016A_C
{
    class Program
    {
        static char[] all = { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
        static void Main(string[] args)
        {
            var t = Console.ReadLine();
            int K = scan[0];
            int n = t.Length;
            int now = 0;
            char[] S = t.ToCharArray();
            while (now < n)
            {
                int d = all.Length - all.TakeWhile(a => a != S[now]).Count();
                if (S[now] != 'a' && d <= K)
                {
                    S[now] = 'a';
                    K -= d;
                }
                now++;
            }
            int noul = all.TakeWhile(a => a != S[n - 1]).Count();


           // Console.WriteLine(noul);
            if (K > 0)
            {
                noul += K;
                noul %= all.Length;
                //Console.WriteLine(noul);
                S[n - 1] = all[noul];
            }

            Console.WriteLine(S);

        }

        static int[] scan { get { return Array.ConvertAll(Console.ReadLine().Split(), int.Parse); } }
    }
}


Measured memory_bytes: 7616
#include<iostream>
#include<algorithm>
#include<vector>
#include<string.h>
#include<cstdlib>
#include<map>
#include<fstream>
#include<string>
#include<sstream>
#include<iomanip>
#include<cmath>
#include<random>
#include<set>
#include<queue>

using namespace std;

long long dp[3][100100] = {};
const long long INF = 1LL << 60;
#define MOD 1000000007
#define Int int64_t
#define PI 3.14159265358979
#define dump(a) cout << a << endl; 

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

/**
* @fn
* 最大値を取ります.Vector<int>を渡すこと.
*/
long long int imax(vector<int> a) {
	int MAX = -10000000;
	for (int i = 0; i < a.size(); i++) {
		if (MAX < a.at(i)) MAX = a.at(i);
	}
	return MAX;
}

/**
* @fn
* 最小値を取ります.Vector<int>を渡すこと.
*/
long long int imin(vector<int> a) {
	int MIN = 1000000000;
	for (int i = 0; i < a.size(); i++) {
		if (MIN > a.at(i)) MIN = a.at(i);
	}
	return MIN;
}

/**
* @fn
* 自然数について、桁数を求める
*/
Int getDigit(Int num) {
	return (Int)(log10(num)) + 1;
}


int get2Digit(Int num) {
	int cnt = 0;
	while (num > 0) {
		if (num % 2 != 0) {
			return cnt;
		}
		cnt++;
		num /= 2;
	}
}

long long int absmin(vector<int> a, long long int b) {
	int mini = 100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (mini > abs(a.at(i) - b)) {
			mini = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}


long long int absmax(vector<int> a, long long int b) {
	int max = -100000000;
	int d = 0;
	for (int i = 0; i < a.size(); i++) {
		if (max < abs(a.at(i) - b)) {
			max = abs(a.at(i) - b);
			d = i;
		}
	}
	return d;
}

int gcd(int a, int b)
{
	if (a < b) swap(a, b);
	if (b < 1) return -1;
	if (a % b == 0) return b;
	return gcd(b, a % b);
}

void haerobatya(int start, int end, char level) {
	if (start > end) swap(start, end);
	for (int i = start; i <= end; i++) {
		if (i < 100) {
			cout << "https://atcoder.jp/contests/abc0" << i << "/tasks/abc0" << i << "_" << level << endl;
		}
		else {
			cout << "https://atcoder.jp/contests/abc" << i << "/tasks/abc" << i << "_" << level << endl;
		}
	}
}

long long int cntmod(long long int warareru, long long int mod) {
	long long int i = 0;
	for (i = 0; true; i++) {
		if (warareru % mod == 0 && warareru >= mod) {
			warareru /= mod;
		}
		else {
			return i;
		}
	}
}

void ansYes(bool a) {
	if (a == true) cout << "Yes" << endl;
	else cout << "No" << endl;
}

void ansYES(bool a) {
	if (a == true) cout << "YES" << endl;
	else cout << "NO" << endl;
}


Int euclidean_gcd(Int a, Int b) {
	while (true) {
		if (a < b) swap(a, b);
		if (!b) break;
		a %= b;
	}
	return a;
}

typedef pair<int, int> pai;


//ここまでライブラリ
//ここから本文

int main() {
	int a, b;
	cin >> a >> b;
	dump(a + b / 2);
}


Measured memory_bytes: 256