akhauriyash/Code-Regression huggingface dataset:
// https://atcoder.jp/contests/abc144/tasks/abc144_a

#include <bits/stdc++.h>
#define _overload3(_1, _2, _3, name, ...) name
#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) = (n); (i) >= (m); i--)
#define rep(...) _overload3(__VA_ARGS__, FOR, REP, )(__VA_ARGS__)
#define repr(...) _overload3(__VA_ARGS__, FORR, REPR, )(__VA_ARGS__)
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
#define INF 1e9
#define ALL(v) (v).begin(), (v).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;

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

  if (9 < a || 9 < b)
    cout << -1 << '\n';
  else
    cout << a * b << '\n';

  return 0;
}


Measured memory_bytes: 256
/**
*    author:  souzai32
*    created: 14.08.2020 16:26:53
**/

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

int main() {

    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a.at(i);
    vector<int> x(n,0);

    for(int i=0; i<n; i++){
        if(i%2) x.at(0)-=a.at(i);
        else x.at(0)+=a.at(i);
    }
    for(int i=1; i<n; i++){
        x.at(i)=2*a.at(i-1)-x.at(i-1);
    }
    for(int i=0; i<n; i++){
        if(i!=n-1) cout << x.at(i) << ' ';
        else cout << x.at(i) << endl;
    }

    return 0;
}

Measured memory_bytes: 4052
def main():
    K, A, B = map(int, input().split())
    if K < A + 1 or B - A <= 2:
        print(K + 1)
        return
    K -= A - 1
    retval = A + (K//2) * (B-A) + (K % 2)
    print(retval)


if __name__ == "__main__":
    main()


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

int main() {
	int N;
  	cin >> N;
  	vector<int> light(N);
    for(int i = 0; i < N ; i++){
    	cin >> light.at(i);
    }
  	int next = 1;
    bool check = false;
  	int counter = 1;
  	for(int i = 0; i < N ; i++){
    	next = light.at(next - 1);
      	if(next == 2){
        	check = true;
          	break;
        }else{
        	counter++;
        }
    }
  	if(check == false){
    	cout << -1 << endl;
    }else{
    	cout << counter << endl;
    }
}

Measured memory_bytes: 3760
A, B, C, D = map(int, input().split())
if A<C and C<B:
    if B<D:
        print(B-C)
    else:
        print(D-C)
elif C<=A and A<D:
    if  D<B:
        print(D-A)
    else:
        print(B-A)
else:
    print(0)

Measured memory_bytes: 3060
N, K, Q = [int(x) for x in input().split()]
A = [int(input()) for _ in range(Q)]
Point = [Q for _ in range(N)]
for i in range(Q):
  Point[A[i]-1] -= 1
for i in range(N):
  if(K-Point[i])>0:
    print('Yes')
  else:
    print('No')

Measured memory_bytes: 15292
import collections

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

    _max = 10 ** 6 + 1

    c = collections.Counter(A)

    ok_flag = [True] * _max   
    uniq_A = list(c.keys())
    uniq_A.sort()
    ans = 0

    for a in uniq_A:
        if ok_flag[a]:
            if c[a] == 1:
                ans += 1

            for i in range((_max - 1) // a + 1):
                ok_flag[a*i] = False
    
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 126568
#include <iostream>
#define ll long long
using namespace std;

ll mod=998244353;
const int arm=310000;
ll fac[arm], finv[arm], inv[arm];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<arm; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(ll n, ll k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}


int main() {
	ll N, A, B, K;
	cin >> N >> A >> B >> K;
	ll ans=0;
	COMinit(mod);
	for(ll i=0; i<=N && i*A<=K; ++i){
		ll j=(K-i*A)/B;
		if(i*A+j*B==K && j<=N){
			ans=(ans+(COM(N, i, mod)*COM(N, j, mod))%mod)%mod;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 7552
#include<stdio.h>

const static int MAX = 10000;
const static int NIL = -1;

typedef struct {
    int parent, left, right;
} Node;

Node T[MAX];
int n, D[MAX], H[MAX];

void setDepth(int u, int d) {
  if (u == NIL) return;
  D[u] = d;

  setDepth(T[u].left, d + 1);
  setDepth(T[u].right, d + 1);
}

int setHeight(int u) {
  int h1 = 0;
  int h2 = 0;

  if (T[u].left != NIL) {
    h1 = setHeight(T[u].left) + 1;
  }
  if (T[u].right != NIL) {
    h2 = setHeight(T[u].right) + 1;
  }

  H[u] = h1 > h2 ? h1 : h2;

  return H[u];
}

int getSibling(int u) {
  for (int i = 0; i < n; i++) {
    if (T[i].right == u) return T[i].left;
    else if (T[i].left == u) return T[i].right;
  }
  return NIL;
}

int main() {
  int v, l, r, root = 0;
  scanf("%d", &n);

  for (int i = 0; i < n; i++) T[i].parent = NIL;
  
  for (int i = 0; i < n; i++) {
    scanf("%d %d %d", &v, &l, &r);
    T[v].left = l;
    T[v].right = r;
    if (l != NIL)
      T[l].parent = v;
    if (r != NIL)
      T[r].parent = v;
  }

  for (int i = 0; i < n; i++) {
    if (T[i].parent == NIL) {
      root = i;
      break;
    }
  }

  setHeight(root);
  setDepth(root, 0);

  for (int i = 0; i < n; i++) {
    printf("node %d: parent = %d, sibling = %d, ", i, T[i].parent, getSibling(i));
    int cnt = 0;
    if (T[i].left != NIL) cnt += 1;
    if (T[i].right != NIL) cnt += 1;
    printf("degree = %d, depth = %d, height = %d, ", cnt, D[i], H[i]);
    if (root == i) printf("root");
    else if (cnt == 0) printf("leaf");
    else printf("internal node");
    printf("\n");
  }

  return 0;
}



Measured memory_bytes: 2756
#include <iostream>
#include <cstring>

using namespace std;

int main(){

	string s, t, u;
	int a, b;
	cin >> s >> t;
	cin >> a >> b;
	cin >> u;

	if(strcmp(s.c_str(), u.c_str()) == 0){
		cout << a-1 << ' ' << b << endl;
	}else{
		cout << a << ' ' << b-1  << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <cstdio>
#define INF 1LL<<60
#define MOD 1000000007ll
#define EPS 1e-10
#define REP(i,m) for(long long i=0; i<m; i++)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef long double ld;

int main(){
  int n, m, r;
  cin >> n >> m >> r;
  int town[r];
  REP(i, r) cin >> town[i];
  sort(town, town + r);
  ll d[n][n];
  REP(i, n){
    REP(j, n) d[i][j] = INF;
    d[i][i] = 0;
  }
  REP(i, m){
    int a, b, c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b] = c;
    d[b][a] = c;
  }
  REP(i, n){
    REP(j, n){
      REP(k, n){
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
      }
    }
  }
  ll ans = INF;
  do{
    ll tmp = 0;
    REP(i, r-1){
      tmp += d[town[i]-1][town[i+1]-1];
    }
    ans = min(tmp, ans);
  }while(next_permutation(town, town+r));
  cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
bool PN(int x) {
  if (x <= 1) return false;
  if (x == 2) return true;
  for (int i = 2; i < sqrt(x) + 1; i++) if (x % i == 0) return false;
  return true;
}
using namespace std;

int graph[8][8];


int dfs(int v, int n, bool visited[8]){
  bool all_visited = true;
  for(int i = 0; i < n; ++i){
    if(visited[i]== false) all_visited = false;
  }
  if(all_visited) return 1;

  int ret = 0;
  for(int i = 0; i < n; ++i){
    if(graph[v][i] !=1) continue;
    if(visited[i]) continue;
    visited[i] = true;
    ret += dfs(i, n, visited);
    visited[i] = false;
  }

  return ret;
}

void solve(){
  int n, m; cin >> n >> m;
  for(int i = 0; i < m; ++i){
    int a, b; cin >> a >> b;
    graph[a-1][b-1] = graph[b-1][a-1] = 1;
  }
  
  bool visited[8];
  for(int i = 0; i < n; ++i){
    visited[i] = false;
  }
  visited[0] = true;

  cout << dfs(0, n, visited) << endl;
}

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

Measured memory_bytes: 3656
import java.util.*;

class Main{

    void solve(){
        Scanner sc = new Scanner(System.in);

        while(true){
            int[] set = new int[3];
            set[0] = sc.nextInt();
            set[1] = sc.nextInt();
            set[2] = sc.nextInt();
            set[0] += sc.nextInt();
            set[1] += sc.nextInt();
            set[2] += sc.nextInt();

            if(set[0]==0 && set[1]==0 && set[2]==0) break;

            int max = 0;
            for(int i=0; i<3; i++){
                for(int j=0; j<3; j++){
                    for(int k=0; k<3; k++){
                        int num = (set[0]-i)/3 + (set[1]-j)/3 + (set[2]-k)/3;
                        int min = set[0] - (set[0]-i)/3*3;
                        min = Math.min(min, set[1] - (set[1]-j)/3*3);
                        min = Math.min(min, set[2] - (set[2]-k)/3*3);
                        max = Math.max(max, num + min);
                    }
                }
            }

            System.out.println(max);
        }
    }

    public static void main(String[] args){
        new Main().solve();
    }
}

Measured memory_bytes: 63964
N = int(input())
h = list(map(int, input().split()))

dp = [0] * N
dp[1] = abs(h[1]-h[0])
for i in range(2, N):
    dp[i] = min([dp[i-2]+abs(h[i]-h[i-2]), dp[i-1]+abs(h[i]-h[i-1])])
print(dp[N-1])

Measured memory_bytes: 20592
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);i++)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;i--)
#define lb lower_bound
#define ub upper_bound
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> void chmin(T& t, const U& u){if(t>u)t=u;}
template<typename T,typename U> void chmax(T& t, const U& u){if(t<u)t=u;}
template<typename T>T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T>T mpow(T a, T n) {
   T res = 1;
   for(;n;n>>=1) {
      if (n & 1) res = res * a;
      a = a * a;
   }
   return res;
}

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



signed main(){
    int n,ans=INF,res;cin>>n;
    vector<int> v(n);
    rep(i,0,n){
        cin>>v[i];
    }
    
    rep(i,-100,101){
        res=0;
        rep(j,0,n){
            res+=abs(v[j]-i)*abs(v[j]-i);
        }
        ans=min(ans,res);
        
    }
    cout<<ans<<endl;
}

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

vector<ll> fac{1};
vector<ll> ifac{1};
vector<ll> inv{1};

ll F(ll N, ll a, ll p){
 
  if(a%2 == 0){
    
    if(a == 0)return 1;
 
    else return (F(N, a/2, p)*F(N, a/2, p))%p;
    
  }
 
  else return N*F(N, a - 1, p)%p;
 
}

ll Com(ll n, ll k, ll p){

  return (((fac[n]*ifac[k])%p)*ifac[n - k])%p;

}

int main(){
ll N, A, B, K, p = 998244353, Ans = 0;cin >> N >> A >> B >> K;

ll f = 1;
  
if(K == 0){cout << 1;exit(0);}

rep(i, 1, N + 1){

  f *= i;f %= p;

  fac.push_back(f);

}

rep(i, 1, N + 1){

  inv.push_back(F(i, p - 2, p));

}

f = 1;

rep(i, 1, N + 1){

  f *= inv[i];f %= p;
  ifac.push_back(f);

}

/*for(auto v : fac )cout << v << " ";
cout << endl;
for(auto v : inv )cout << v << " ";
cout << endl;
for(auto v : ifac )cout << v << " ";
cout << endl;
*/

  
rep(i, 0, N + 1){

  if((K - A*i)%B != 0 )continue;

  ll j = (K - A*i)/B;
  
  if(j > N || j < 0)continue;

  Ans += Com(N, i, p)*Com(N, j, p);Ans %= p;

}
cout << Ans;

}

Measured memory_bytes: 14004
n=int(input())

x=list(map(int,input().split()))

count=0
for i in x:
  if i%2==0:
    if i%3==0 or i%5==0:
      count=count+0
    else:
      count=count+1
if count==0:
  print("APPROVED")
else:
  print("DENIED")

Measured memory_bytes: 3060
import collections
import sys

def solve(n, A, B):
  ans = B[:]
  same = collections.deque()
  for i, (a, b) in enumerate(zip(A, B)):
    if a == b:
      if same and B[same[0]] != a:
        j = same.popleft()
        B[i], B[j] = B[j], B[i]
      else:
        same.append(i)
 # print(A)
  #print(B)
  #print(same)
  if same:
    s = A[same[0]]
    to_swap = []
    possible = False
    for i, (a, b) in enumerate(zip(A, B)):
      if a != s and b!=s:
        to_swap.append(i)
      if len(to_swap) == len(same):
        possible = True
        break
    if not possible:
      print('No')
      return
    for i, j in zip(same, to_swap):
      B[i], B[j] = B[j], B[i]
  print('Yes')
  print(*B,sep=' ')


       


def main():
  input = sys.stdin.readline
  n = int(input())
  A = list(map(int, input().split()))
  B = list(map(int, input().split()))
  solve(n, A, B)

main()


Measured memory_bytes: 115860
import Control.Monad
import Text.Printf
import Control.Applicative
import Data.List as L

main :: IO()
main = do
  _ <- getLine
  a <- map read . words <$> getLine
  printf "%d" $ sum.map (\x -> length x * (length x - 1) `div` 2) $ group.sort $ scanl (+) 0 a


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

typedef long long ll;
typedef unsigned long long ull;
 
using tpl = tuple<int, int, int>;
typedef pair<int,int> pii;

void fastStream(){cin.tie(0);std::ios_base::sync_with_stdio(0);}

int N;
int A[200010];

int main(){

    cin >> N;
    for(int i = 0; i < N; i++) cin >> A[i];
    ll ans = 0;
    for(int i = 0; i < N; i++){
        if(A[i] == 0){
            while(i+1 < N && A[i] + 1 == A[i+1]) i++;
            ans += A[i];
        }
        else{
            if(i < A[i] || (i - 1 >= 0 && A[i-1] +1 < A[i])){
                cout << -1 << endl;
                return 0;
            }
            else{
                while(i+1 < N && A[i] + 1 == A[i+1]) i++;
                ans += A[i];
            }
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<unordered_set>
#include<unordered_map>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int inf=1e9+7;
const int mod=998244353;
int main(){
    while(1){
    ll r0,w0,c,r;cin>>r0>>w0>>c>>r;
    if(r0+w0+c+r==0)break;
    ll x=-1,y=inf;
    while(y-x>1){
        ll k=x+(y-x)/2;
        if(k*r>=c*w0-r0)y=k;
        else x=k;
    }
    cout<<y<<endl;
    }
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;

#define F first
#define S second
#define PB push_back
#define MK make_pair
#define REP(i, a, b) for (int i=a; i < b; i++)


bool sort_by(pi c, pi d){
	return c.S < d.S;
}

int main() {
	int n;
	map<string, int> m;
	cin >> n;
	ll ans = 0;
	string tmp;
	REP(i, 0, n){
		cin >> tmp;
		sort(tmp.begin(), tmp.end());
		ans += m[tmp];
		++m[tmp];
	}
	cout << ans;

}


Measured memory_bytes: 11136
#include <stdio.h>
#define mx 101
int main()
{
   int arows, acolumns,brows,bcolumns;
    long long int a[mx][mx],b[mx][mx];
    long long int prod[mx][mx];
    int i,j,k;
    long long int sum=0;
scanf("%d%d%d",&arows,&acolumns,&bcolumns);
for (i=0;i<arows;i++){
    for (j=0;j<acolumns;j++){
        scanf("%lld",&a[i][j]);
    }
}


for (i=0;i<acolumns;i++){
    for (j=0;j<bcolumns;j++){
        scanf("%lld",&b[i][j]);
    }
}


for(i=0;i<arows;i++){
        for(j=0;j<bcolumns;j++){
                for(k=0;k<acolumns;k++){
                    sum+=a[i][k]*b[k][j];
                } prod[i][j]=sum;
                sum=0;

        }
}

  for(i=0;i<arows;i++){
            for(j=0;j<bcolumns;j++){
                    printf("%lld",prod[i][j]);
                    if(j+1 == bcolumns)
        printf("\n");
      else
        printf(" ");
            }
    }




return 0;}



Measured memory_bytes: 2112
#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <random>
#include <vector>
#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))
#define whole(x) begin(x), end(x)
using ll = long long;
using namespace std;

template <typename T, typename Container>
T count_festival(Container const & a) {
    array<T, 8> dp = {};
    repeat (i, a.size()) {
        if (i % 8 == 0) {
            dp[i % 8] += a[i];
        } else {
            dp[i % 8] += dp[i % 8 - 1] * a[i];
        }
    }
    repeat_from (i, 1, 8) {
        dp[i] += dp[i - 1];
    }
    return dp[7];
}
string solve(ll k) {
    array<int, 80> a = {};
    auto get_length = [&]() {
        ll cnt = count_festival<ll>(a);
        assert (cnt <= k);
        return accumulate(whole(a), 0) + (k - cnt) + 7;
    };
    default_random_engine gen;
    for (int iteration = 0; get_length() > 5000; ++ iteration) {
        int limit = iteration < 5000 ? 8 : min<int>(a.size(), 8 + iteration / 100);
        int base = limit / 8 * 8;
        int i = uniform_int_distribution<int>(0, limit - 1)(gen);
        if (base <= i) {
            i = base + 8 - (i - base) - 1;
        }
        a[i] += 1;
        if (count_festival<double>(a) > k or count_festival<ll>(a) > k) {
            a[i] -= 1;
        }
    }
    string s;
    repeat (i, a.size()) {
        s += string(a[i], "FESTIVAL"[i % 8]);
    }
    s += string(k - count_festival<ll>(a), 'F');
    s += "ESTIVAL";
    return s;
}
int main() {
    ll k; cin >> k;
    string s = solve(k);
    cout << s << endl;
    return 0;
}


Measured memory_bytes: 256
while True:
    n = int(input())
    if n == 0:
        break

    a = list(map(int, input().split()))
    a.sort()
    mind = 1000000
    for i in range(len(a) - 1):
        mind = min(mind, a[i + 1] - a[i])
    print(mind)


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int,int> pii;
typedef pair<long long, int> pli;

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

ll mod = 1000000007;

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

  int n;
  cin >> n;
  vi a(n);
  rep(i,n)cin >> a[i];
  vi cnt(n);
  ll ret = 1;
  rep(i,n){
    cnt[a[i]]++;
    if(a[i]){
      int cand = cnt[a[i]-1] - cnt[a[i]] + 1;
      if(cand < 0)ret = 0;
      ret = ret * cand  % mod;
    }else{
      ret = ret * (3 - cnt[a[i]] + 1) % mod;
    }
  }

  cout << ret << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <string>
#include  <queue>
#include <vector>
#include  <cstdio>
#include <cstring>
#include<map>
#include<cmath>
#include<set>
//#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T mul(T p, T e, T M)
{
    ll ret = 0;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret + p) ;
        p = (p + p) ;
        if(ret>=M)ret-=M;
        if(p>=M)p-=M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 

#define  mx 200004
#define base 193ll
 
typedef pair<int,int >P;
//////////////////////////
////////////////////////
#define F(i,a,b) for(int i=a;i<b; i++)
#define LL long long
#define MX  1000007
#define md 1000000007ll
///////////////////////////
///////////////////////////

int main(){

    int ar[4];
    for(int i =1 ;i<=3;i++)I(ar[i]);
    sort(ar + 1, ar+ 3+ 1);
    cout<<(ar[3] - ar[ 1])<<endl;
    return 0;
}

Measured memory_bytes: 3736
import java.util.*;
public class Main{
	public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.next();
        String b = sc.next();
        String sum = a + b;
        
        if(Math.sqrt(Integer.parseInt(sum))%1 == 0){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
    }
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vll a(N);
    rep(i,N) cin>>a[i];
    ll prev=-1;
    ll ans=0;
    rep(i,N){
        if (prev+1<a[i]){
            cout<<"-1\n";
            return 0;
        }
        if (a[i]>0) ans++;
        if (a[i]>0 && prev>=a[i]) ans+=a[i]-1;
        prev=a[i];
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4780
ant = []
post = []
s = list(input())
q = int(input())
c = 0

for _ in range(q):
    l = input().split()
    if l == ['1']:
        c += 1
    elif l[1] == '1':
        if c % 2 == 0:
            ant.append(l[2])
        else:
            post.append(l[2])
    else:
        if c % 2 == 0:
            post.append(l[2])
        else:
            ant.append(l[2])

ans = ''
if c % 2 == 0:
    ant.reverse()
    for i in ant:
        ans += i
    for k in s:
        ans += k
    for j in post:
        ans += j
else:
    post.reverse()
    s.reverse()
    for i in post:
        ans += i
    for k in s:
        ans += k
    for j in ant:
        ans += j
        
print(ans)

Measured memory_bytes: 6460
A['   '];B,X,Y;W,J,I;main(M){scanf("%*d%d",&M);for(;~scanf("%d%d",&X,&Y);){for(B=Y+1,J=1;J*J<=M;J++)I=(X+J-1)/J,W=Y/J+1,A[I]++,A[W<B?W:B]--,B=I;for(I=1;I<B;I++)(X-1)/I<Y/I?A[I]++,A[I+1]--:0;}for(I=1;I<=M;I++)printf("%d\n",A[I]+=A[I-1]);}

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

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

    int A, B, C;
    int num[11] = {0};

    cin >> A >> B >> C;
    num[A]++;
    num[B]++;
    num[C]++;

    if (num[5] == 2 && num[7] == 1)
    {
        cout << "YES" << endl;
    }
    else
    {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
using System;
using System.IO;
using System.Text;

namespace Contest
{
    class Program
    {
        private Scanner sc;
        private string S, T;
        public void Solve()
        {
            sc = new Scanner();
            int N = sc.NextInt();

            int X = 800 * N;
            int Y = (N / 15) * 200;

            Console.WriteLine(X - Y);
        }

        static void Main() => new Program().Solve();
    }
}

class Scanner
{
    public Scanner()
    {
        _stream = new StreamReader(Console.OpenStandardInput());
        _pos = 0;
        _line = new string[0];
        _separator = ' ';
    }
    private readonly char _separator;
    private readonly StreamReader _stream;
    private int _pos;
    private string[] _line;
    #region get a element
    public string Next()
    {
        if (_pos >= _line.Length)
        {
            _line = _stream.ReadLine().Split(_separator);
            _pos = 0;
        }
        return _line[_pos++];
    }
    public int NextInt()
    {
        return int.Parse(Next());
    }
    public long NextLong()
    {
        return long.Parse(Next());
    }
    public double NextDouble()
    {
        return double.Parse(Next());
    }
    #endregion
    #region convert array
    private int[] ToIntArray(string[] array)
    {
        var result = new int[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = int.Parse(array[i]);
        }

        return result;
    }
    private long[] ToLongArray(string[] array)
    {
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = long.Parse(array[i]);
        }

        return result;
    }
    private double[] ToDoubleArray(string[] array)
    {
        var result = new double[array.Length];
        for (int i = 0; i < array.Length; i++)
        {
            result[i] = double.Parse(array[i]);
        }

        return result;
    }
    #endregion
    #region get array
    public string[] Array()
    {
        if (_pos >= _line.Length)
            _line = _stream.ReadLine().Split(_separator);
        _pos = _line.Length;
        return _line;
    }
    public int[] IntArray()
    {
        return ToIntArray(Array());
    }
    public long[] LongArray()
    {
        return ToLongArray(Array());
    }
    public double[] DoubleArray()
    {
        return ToDoubleArray(Array());
    }
    #endregion
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int main(){
  vector<char> ABC(3);
  for(int i=0;i<3;i++){
    cin >> ABC.at(i);
  }
  sort(ABC.begin(), ABC.end());
  if(ABC.at(0)=='a' && ABC.at(1)=='b' && ABC.at(2)=='c'){
    cout << "Yes" << endl;
  }
  else cout << "No" << endl;
}
  

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cout << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	int n, m; cin >> n >> m;
    int dp[1010][4400];
    rep(i, m + 1) {
        rep(bit, (1<<n)) {
            dp[i][bit] = INF;
        }
    }
    dp[0][0] = 0;
    rep(i, m) {
        int a, b; cin >> a >> b;
        int mask = 0;
        rep(i, b) {
            int d; cin >> d; --d;
            mask += (1<<d);
        }
        rep(bit, (1<<n)) {
            chmin(dp[i + 1][bit | mask], dp[i][bit] + a);
            chmin(dp[i + 1][bit], dp[i][bit]);
        }
    }
    if(dp[m][(1<<n) - 1] == INF) {
        cout << -1 << endl;
    } else {
        cout << dp[m][(1<<n) - 1] << endl;
    }
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 34688
import sys
from random import choice,randint
inp=sys.stdin.readline
out=sys.stdout.write
flsh=sys.stdout.flush
 
sys.setrecursionlimit(10**9)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]
 
def MI(): return map(int, inp().strip().split())
def LI(): return list(map(int, inp().strip().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines().strip()]
def LI_(): return [int(x)-1 for x in inp().strip().split()]
def LF(): return [float(x) for x in inp().strip().split()]
def LS(): return inp().strip().split()
def I(): return int(inp().strip())
def F(): return float(inp().strip())
def S(): return inp().strip()
def pf(s): return out(s+'\n')
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)

def main():
    n,a,b=MI()
    # n,a,b=randint(1,30),randint(1,10),randint(5,25)
    # print(n,a,b)
    if (b-a)%2==0:
        pf(str((b-a)//2))
    elif a==1 or b==n:
        pf(str((b-a+1)//2))
    else:
        mn = min(a-1,n-b)
        ans = (b-a+(mn*2)+1)//2
        ans = min([ans,n-a,b-1])
        pf(str(ans))

if __name__ == "__main__":
    main()

Measured memory_bytes: 4208
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define rush() int T;scanf("%d",&T);while(T--)
#define mm(a,b) memset(a,b,sizeof(a))
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define sc(a) scanf("%d",&a)
#define sc2(a,b) scanf("%d%d",&a,&b)
#define pf(a) printf("%d\n",a)
#define pf2(a,b) printf("%d %d\n",a,b)
#define p_f(a) printf("%d ",a)
#define pyn(a) if(a)puts("Yes");else puts("No");
#define fi first
#define se second
#define db double
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const db eps=1e-9;
int n,ans;
bool flag;
string s;
int main()
{
    cin>>n>>s;
    rep(i,0,s.size()-1){
        printf("%c",((s[i]-'A'+n)%26+'A'));
    }
    return 0;
}


Measured memory_bytes: 256
def solve(k, a, b):
    for x in range(a, b+1):
        if x % k == 0:
            return True
    return False


if __name__ == "__main__":
    k = int(input())
    a, b = map(int, input().split())
    print("OK" if solve(k, a, b) else "NG")

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

int main(){
  long long N,D,ans;
  double an;
  ans=0;
  cin>>N>>D;
 double a[N][D];
  for(int i=0;i<N;i++){
    for(int j=0;j<D;j++){
      cin>>a[i][j];
    }
  }
    for(int i=0;i<N;i++){
      for(int u=i+1;u<N;u++){
        an=0;
    for(int j=0;j<D;j++){
       an+=(a[i][j]-a[u][j])*(a[i][j]-a[u][j]);
    }
        an=sqrt(an);
        while(an>0){
an--;
        }
        if(an==0.00){
          ans++;
        }
  }
  }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define LL long long
#define PB push_back
#define MP make_pair

int N, M, Q;
list<int> ls;
bool alive[200000] ={};
int main(){
	scanf("%d%d%d", &N, &M, &Q);
	for(int i=0; i<N; i++) ls.push_back(i);
	auto now = ls.begin();
	for(int i=0; i<M; i++){
		int a;
		scanf("%d", &a);
		for(int j=0; j<a; j++){
			if(a%2 == 0){
				now++;
				if(now == ls.end()) now = ls.begin();
			}
			else{
				if(now == ls.begin()) now = ls.end();
				now--;
			}
		}
		now = ls.erase(now);
		if(now == ls.end()) now = ls.begin();
	}
	for(auto i=ls.begin(); i!=ls.end(); i++){
		alive[*i] = true;
	}
	for(int i=0; i<Q; i++){
		int q;
		cin >> q;
		printf("%d\n", alive[q]);
	}
}



Measured memory_bytes: 9428
#include<bits/stdc++.h>
using namespace std;
int main(){
    int i,j;
    string s;
    cin >> s;
    for(i=1;i<s.size()+1;i++){
        if(s.at(i-1)=='A'){
            break;
        }
    }
    for(j=s.size();j>0;j--){
        if(s.at(j-1)=='Z'){
            break;
        }
    }
    cout << j-i+1;
}

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

typedef long long ll;

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

    ll n;
    cin >> n;

    vector<ll> a(n);

    for(ll i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    ll sum = 0;

    for(ll i = 1; i < n; i++)
    {
        if(a[i] < a[i - 1])
        {
            ll diff = a[i - 1] - a[i];
            sum += diff;
            a[i] += diff;
        }
    }

    cout << sum;
    
    return 0;
}

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

int n, m;
long long mod = 1e9+7;
long long ans = 0;
long long a[200010];

long long fact(int x){
	if(x == 0) return a[0] = 1;
	return a[x] = x * fact(x-1) % mod;
}

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> m;
	if(n == m || n-1 == m || n == m-1){
		ans = fact(n) * fact(m) % mod;
		if(n == m) ans *= 2, ans %= mod;
	}
	cout << ans << "\n";
}

Measured memory_bytes: 2560
#include<iostream>
#include<string>
#include<bits/stdc++.h>
using namespace std;
int main() 
{ 
int n;
cin>>n;
int r,sum=0,c=0;
int temp=n;
while(temp!=0)
{
	r=temp%10;
	if(r==1)
{
	c++;
	
}
	
	temp=temp/10;
}


cout<<c;



return 0;  
}

Measured memory_bytes: 3624
public class Main {
	public static void main(String[] a) {
		for (int i = 1; i <= 9; i++) {
			for (int s = 1; s <= 9; s++) {
				int multiple = i * s;
				System.out.println(i + "x" + s + "=" + multiple);
			}

		}

	}

}

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

using namespace std;

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

vector<long int> f;

long int gcd(long int x, long int y){
    long int t;
    while(y != 0){
        t = x % y;
        x = y;
        y = t;
    }
    return x;
}

void fact(long int x){
    for(long int i = 2; i * i < x; i++){
        if (x % i == 0) f.push_back(i);
        while(x % i == 0) x = x / i;
    }
    if (x != 1) {
        f.push_back(x);
    }
    
    
}

int main(){
    long int a, b;
    cin >> a >> b;
    long int c = gcd(a, b);
    // cout << gcd(a, b) << endl;
    fact(c);
    long int ans = f.size() + 1;
    cout<< ans << endl;
}

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

int main(){
  ll n;
  cin>>n;
  ll a[n], sum = 0;
  for(ll i=0; i<n; i++){
 	cin>>a[i];
  }
  for(ll i=1; i<n; i++){
  	if(a[i]<a[i-1]){
    	sum = sum + a[i-1] - a[i];
    	a[i] += a[i-1] - a[i];  
    }
  }
  cout<<sum;
  return 0;
}

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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  ll h,n;
  cin >> h >> n;
  ll a[n];
  rep(i,n){
    cin >> a[i];
  }
  rep(i,n){
    h-=a[i];
  }
  if(h<=0){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;

}



Measured memory_bytes: 4372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0; i<(n); i++)
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main(){
    ll x,y; cin>>x>>y;
    ll waru=y/x;
    ll tmp=1, cnt=0;
    while(tmp<=waru){
        tmp*=2;
        cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	vector<int> d(3);
	rep(snip_i, 3) cin >> d.at(snip_i);
	sort(d.begin(), d.end());
	int ans = 0;
	while(d.at(2) != d.at(1)){
		d.at(1)++;
		d.at(0)++;
		ans++;
	}
	int diff = d.at(2) - d.at(0);
	ans += (diff+1)/2;
	if(diff % 2 == 1) ans++;
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define fr first
#define se second
#define ll long long
#define PI 3.1415926535 
#define pb push_back
#define mpr make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define senky_bansal ios_base::sync_with_stdio(false);
#define IIIT_ALLAHABAD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
signed main()
{   
      senky_bansal
      IIIT_ALLAHABAD
      
     
    ll p;
  cin>>p;
  cout<<3*p*p;
    
    
}
















Measured memory_bytes: 764
package main

import (
	"fmt"
	"strconv"
	"strings"
	"unicode/utf8"
)

func main(){
	var s string
	len := utf8.RuneCountInString(s)
	fmt.Scanf("%s",&s)
	sl := make([]string,len)
	sl = strings.Split(s,"")
	sum := 0
	input, _ := strconv.Atoi(s)
	for i := range sl {
		a, _ := strconv.Atoi(sl[i])
		sum = sum + a
	}
	var ans string
	if (input % sum) == 0 {
		ans = "Yes"
		} else {
		ans = "No"
	}
	fmt.Println(ans)
}

Measured memory_bytes: 640
#include <stdio.h>
#define max(p,q)((p>q)?(p):(q))

int dp[10010];
int main(){
	int n,m;
	scanf("%d%d",&n,&m);
	while(n--){
		int v,w;
		scanf("%d%d",&v,&w);
		for(int i=0;i<=m-w;i++)dp[i+w]=max(dp[i+w],dp[i]+v);
	}
	printf("%d\n",dp[m]);
}


Measured memory_bytes: 2112
//#pragma comment(linker, "/STACK:102400000,102400000")
#include <fstream>
#include <iostream>
#include <functional>
#include <algorithm>
#include <cstring>
#include <vector>
#include <string>
#include <cstdio>
#include <cmath>
#include <queue>
#include <stack>
#include <deque>
#include <ctime>
#include <list>
#include <set>
#include <map>
using namespace std;

typedef long long ll;
#define eps 1e-10
#define LL_INF 0x33ffffffffffffff
#define INF 0x3f3f3f3f
#define mem(a, b) memset(a, b, sizeof(a))
#define pper(i,n,m) for(int i = n;i >= m; i--)
#define repp(i, n, m) for (int i = n; i <= m; i++)
#define rep(i, n, m) for (int i = n; i < m; i++)
#define sa(n) scanf("%d", &(n))
#define mp make_pair
#define ff first
#define ss second
#define pb push_back

const int maxn = 2e5+5;
const double PI = acos(-1.0);
const ll mod = 1e9 + 7;
ll po(ll a, ll b,ll mod) { ll res = 1; a %= mod; for (; b; b >>= 1) { if (b & 1)res = res*a%mod; a = a*a%mod; }return res; }
ll gcd(ll a,ll b){ if(a==0){return b;}else{ return gcd(b%a,a);}}

char x[maxn];
int k;

void solve()
{
	scanf("%s",x+1);
	sa(k);

	int len=strlen(x+1);
	repp(i,1,len)
	{
		int t = (26-(x[i]-'a'))%26;
		//cout<<t<<endl;
		if(t<=k)
		{
			x[i]='a';
			k-=t;
		}
	}
	if(k)
	{
		x[len]= (x[len]-'a' + k)%26+'a'; 
	}
	cout<<x+1<<endl;
}

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


Measured memory_bytes: 384
#include<bits/stdc++.h>
#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 ALL(x) x.begin(),x.end()
#define REVERSE(x) reverse(x.begin(),x.end())
typedef long long LL;
const int INF=1000000007;
using namespace std;
int  main(){
  long double n;
  cin>>n;
  long double a[5];
  REP(i,5){
    cin>>a[i];
  }
  long double MIN=1000000000000000000;
  REP(i,5){
    MIN=min(a[i],MIN);
  }
  LL ans=4+ceil(n/MIN);
  cout<<ans;


}

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

int main(void){
    ll N; cin >> N;
    
    ll ans = 999999999999999;
    for(ll i = 1; i * i <= N; i++){
        if (N % i != 0) continue;
        ll distance = (i-1) + (N / i - 1);
        ans = min(ans, distance);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#pragma region _head

#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<set>
#include<iomanip>
#include<queue>
#include<stack>
#include<numeric>
#include<utility>
#include<regex>

#pragma region _define

#define f(i,a,b) for(int i=a;i<b;i++)
#define f_vI(v,n) f(i,0,n)cin>>v[i]
#define f_v2I(v1,v2,n) f(i,0,n)cin>>v1[i]>>v2[i]
#define f_v3I(v1,v2,v3,n) f(i,0,n)cin>>v1[i]>>v2[i]>>v3[i]
#define f_vO(v,n) f(i,0,n)cout<<v[i]<<endl
#define all(a) a.begin(),a.end()
#define size(s) s.size()
#define check() cout<<"! ! !"
#define endl "\n"
#define _y() cout<<"Yes"<<endl
#define _Y() cout<<"YES"<<endl
#define _n() cout<<"No"<<endl
#define _N() cout<<"NO"<<endl

#pragma endregion

#pragma region _using

using namespace std;

using LL = long long;
using st = string;
using vi = vector<LL>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vc = vector<char>;
using vs = vector<st>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vvvb = vector<vvb>;
using si = stack<LL>;
using ss = stack<st>;
using pi = pair<LL, LL>;
using v_pi = vector<pi>;

#pragma endregion

#pragma region _graph

#define node 50  //グラフの最大位数　適宜変更
//bool graph[node][node]; bool visited[node] = { false };
#define link(a,b,m) f(i,0,m){cin>>a[i]>>b[i]; a[i]--; b[i]--; graph[a[i]][b[i]]=graph[b[i]][a[i]]=true;}

#pragma endregion

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

#pragma endregion 

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

	int n;
	cin >> n;
	vi a(n);
	f_vI(a, n);
	map<LL, LL>m;
	f(i, 0, n) {
		m[a[i]]++;
	}
	bool f = true;
	int i;
	if (n % 2 != 0) {
		i = 0;
	}
	else {
		i = 1;
	}
	LL ans = 1;
	while (i < n) {
		if (i == 0) {
			if (m[i] != 1) {
				cout << 0;
				return 0;
			}
		}
		else if (m[i] != 2) {
			cout << 0;
			return 0;
		}
		if (m[i] == 2) {
			ans *= 2;
			ans %= 1000000007;
		}
		i += 2;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 4992
#include <iostream>
typedef long long ll;
using namespace std;

ll gcd(ll a, ll b) {
    if (a % b == 0) return b;
    else if (b % a == 0) return a;
    else return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
    if (a % b == 0) return a;
    else if (b % a == 0) return b;
    else return a / gcd(a, b) * b;
}
int main(void) {
    ll N;cin>>N;
    ll gen = 1;
    for (ll i = 1; i <= N; i++) {
        ll T;cin>>T;
        gen = lcm(gen, T);
    }
    cout << gen << endl;
    return 0;
}

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

int main(){
	ll A,B;
	cin >> A >> B;
	ll t = __gcd(A,B);
	ll ans = 1;

	for(int i=2;i<=1e6;i++){
		if(t%i!=0)continue;
		while(t%i==0){t/=i;}
		ans++;
	}
	if(t>1)ans++;
	cout << ans << endl;
}


Measured memory_bytes: 256
N,M = map(int,input().split())
X=sorted([int(i) for i in input().split()])

if N==1:
  print(X[M-1]-X[0])
elif N>=M:
  print(0)
else:
  Y=list()
  [Y.append(i-j) for i,j in zip(X[1:],X)] 
  Y.sort(reverse=True)
  print(sum(Y[N-1:]))


Measured memory_bytes: 13840
S  = raw_input()
SS = ">"+S+"<"
N = len(SS) - 1
A = [None for i in xrange(N)]

for i in xrange(N):
    if (SS[i] == ">" and SS[i+1] == "<"):
        A[i] = 0
        j = 0
        while (i-j-1)>=0 and SS[i-j] == ">":
            if A[i-j-1] == None:
                A[i-j-1] = j+1
            else:
                Max = max(A[i-j-1], j+1)
                A[i-j-1] = Max
            j += 1
        j = 0
        while (i+j+1)<N and SS[i+j+1] == "<":
            if A[i+j+1] == None:
                A[i+j+1] = j+1
            else:
                Max = max(A[i+j+1], j+1)
                A[i+j+1] = Max
            j += 1

print sum(A)            


Measured memory_bytes: 19560
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] a){
        for(int i = 1; i < 10; i ++){
            for(int j = 1; j < 10; j ++){
                int f = i*j;
                System.out.println(i + "x" + j + "=" + f );
            }    
        }
        

    }
}

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

using namespace std;

#define    watch(x); cout << "\n" <<  #x << " is: " << x << "\n";
#define    all(a) (a).begin(), (a).end()
#define    fi first
#define    se second

template<class A, class B>
ostream& operator << (ostream& output, const pair<A, B>& p) {
    output << "(" << p.first << ", " << p.second << ")";
    return output;
}

template<class A>
ostream& operator << (ostream& output, const vector<A>& a) {
    output << "[";
    for(auto it = a.begin(); it != a.end(); ++it) {
        if(it != a.begin()) {
            output << ", ";
        }
        output << *it;
    }
    output << "]";
    return output;
}

using lld = long long;
using pii = pair<int, int>;
using pll = pair<lld, lld>;

//const int inf = 1e9;
//const int mod = 1e9 + 7;
//const double PI = acos(-1.0);
const int mxN = 3003;


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
#ifndef ONLINE_JUDGE
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
#endif

    int n;
    cin >> n;
    lld ans = 0;
    for(int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        ans += a - 1;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3596
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <cassert>
#define rep(i,n) for(int i = 0; i < n; ++i )
using namespace std;
using ll = long long;
using P = pair<ll,ll>;

int main() {
  int n; ll c;
  cin >> n >> c;
  vector<ll> x(n), v(n);
  rep(i,n) cin >> x[i] >> v[i];

  vector<P> r(n+1),l(n+1);
  ll xi = 0, vi = 0;
  rep(i,n){
    xi = x[i]; vi += v[i];
    if(r[i].second-r[i].first<vi-xi){
      r[i+1].first = xi;
      r[i+1].second = vi; 
    }else{
      r[i+1] = r[i];
    }
  }
  xi = 0; vi = 0;
  rep(i,n){
    xi = c - x[n-1-i]; vi += v[n-1-i];
    if(l[i].second-l[i].first<vi-xi){
      l[i+1].first = xi;
      l[i+1].second = vi; 
    }else{
      l[i+1] = l[i];
    }
  }
  ll ans = 0;
  rep(i,n+1){
    ll v1 = r[i].second-r[i].first;
    ll v2 = l[n-i].second-l[n-i].first;
    ans = max({ans,v1,v2,v1+v2-r[i].first,v1+v2-l[n-i].first});
  }
  cout << ans << endl;
}

Measured memory_bytes: 4992
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cstring>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <stack>
#include <cmath>
#define ll long long
#define LINF 0x3f3f3f3f3f3f3f3f
#define INF 0x3f3f3f3f
#define PI 3.14159265
using namespace std;
const int MAX = 1e5 + 10;
const ll MOD = 1e9 + 7;
int N, M, K, Q;
ll dp[3000][60], A[60];

int main()
{
	int i, j, k;
	ll a;
	scanf("%d%lld", &N, &a);
	for (i = 1; i <= N; ++i) scanf("%d", A + i);
	for (i = 1; i <= N; ++i) {
		for (j = a*N; j >=1; --j) {
			for (k = 2; k <= i; ++k) {
				if (j - A[i] >= 0) dp[j][k] += dp[j - A[i]][k - 1];
			}
		}
		dp[A[i]][1]++;
	}
	ll sum = 0;
	for (i = 1; i <= N; ++i) {
		sum += dp[a*i][i];
	}
	printf("%lld", sum);

}

Measured memory_bytes: 1408