akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
/* #include <regex> */

using namespace std;

/* g++ -g -std=c++11 */

/* freopen("input.txt", "rt", stdin); */
/* freopen("output.txt", "wt", stdout); */

#define ALL(c)          (c).begin(), (c).end()
#define ALLR(c)         (c).rbegin(), (c).rend()
#define FOR(i,a,b)      for (int i=(a); i < (b); ++i)
#define FORR(i,a,b)     for (int i=(a); i > (b); --i)
#define FOR_ALL(i,c)    for (__typeof((c).begin()) i=(c).begin();   \
                             i != (c).end(); ++i)
#define FOR_ALLR(i,c)   for (__typeof((c).rbegin()) i=(c).rbegin(); \
                             i != (c).rend(); ++i)
#define SZ(array)       (sizeof(array)/sizeof(array[0]))
#define lc(x)           (x<<1)     /* 2*x */
#define rc(x)           (x<<1 | 1) /* 2*x+1 */
#define lowbit(x)       (x & (-x)) /* 0b10100 -> 0b100 */

typedef long long       LL;
typedef map<int,int>    MII;
typedef pair<int,int>   PII;
typedef set<int>        SI;
typedef vector<bool>    VB;
typedef vector<double>  VD;
typedef vector<int>     VI;
typedef vector<string>  VS;

/* check if a key is in container C */
template <class C>
inline bool in_(const typename C::key_type& k, const C& A)
{ return A.find(k) != A.end(); }
inline bool in_(const string& s, const string& S)
{ return S.find(s) != string::npos; }

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

int main()
{
#ifdef FOO_
    freopen("foo", "rt", stdin);
#endif
    ios::sync_with_stdio(false);
    int n,x;
    while (cin >> n >> x) {
        int g = 0;
        FOR(i,0,n) {
            int xi; cin >> xi;
            g = gcd(g,abs(xi-x));
        }
        cout << g << endl;
    }
    return 0;
}


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

class runtime_modint {
  using u64 = std::uint_fast64_t;

  static u64 &mod() {
    static u64 mod_ = 0;
    return mod_;
  }

public:
  u64 a;

  runtime_modint(const u64 x = 0) : a(x % get_mod()) {}
  u64 &value() noexcept { return a; }
  const u64 &value() const noexcept { return a; }
  runtime_modint operator+(const runtime_modint rhs) const {
    return runtime_modint(*this) += rhs;
  }
  runtime_modint operator-(const runtime_modint rhs) const {
    return runtime_modint(*this) -= rhs;
  }
  runtime_modint operator*(const runtime_modint rhs) const {
    return runtime_modint(*this) *= rhs;
  }
  runtime_modint operator/(const runtime_modint rhs) const {
    return runtime_modint(*this) /= rhs;
  }
  runtime_modint &operator+=(const runtime_modint rhs) {
    a += rhs.a;
    if (a >= get_mod()) {
      a -= get_mod();
    }
    return *this;
  }
  runtime_modint &operator-=(const runtime_modint rhs) {
    if (a < rhs.a) {
      a += get_mod();
    }
    a -= rhs.a;
    return *this;
  }
  runtime_modint &operator*=(const runtime_modint rhs) {
    a = a * rhs.a % get_mod();
    return *this;
  }
  runtime_modint &operator/=(runtime_modint rhs) {
    u64 exp = get_mod() - 2;
    while (exp) {
      if (exp % 2) {
        *this *= rhs;
      }
      rhs *= rhs;
      exp /= 2;
    }
    return *this;
  }

  static void set_mod(const u64 x) { mod() = x; }
  static u64 get_mod() { return mod(); }
};


int main(){
    uint_fast64_t n,x;
    uint_fast64_t m;
    cin >> n >> x >> m;
    runtime_modint::set_mod(m);
    runtime_modint xi;
    xi=x;
    uint_fast64_t sum=0;
    //vector<uint_fast64_t> sums(n);
    unordered_set<uint_fast64_t> xis;
    uint_fast64_t ls,le,ss,se,la;
    uint_fast64_t i=0;
    for(i=0;i<n;i++){
        uint_fast64_t a=xi.a;
        sum += a;
        //sums[n]=sum;
        if(xis.find(a)!= xis.end()){
          le=i;
          se=sum;
          la=a;
          goto loop;
        }
        xis.insert(a);
        xi = xi*xi;
    }
    cout << sum;
    return 0;
loop:
    xi=x;
    sum=0;
    for(i=0;i<n;i++){
      uint_fast64_t a=xi.a;
      //sums[n]=sum;
      sum += a;
      if(a == la){
        ls=i;
        ss=sum;
        goto loop2;
      }
      xi = xi*xi;
    }
loop2:
    sum+=(se-ss)*((n-i)/(le-ls) -1);
    i+=((n-i)/(le-ls) -1)*(le-ls);
    for(;i<n;i++){
        uint_fast64_t a=xi.a;
        sum += a;
        xi = xi*xi;
    }
    cout << sum-la;
    return 0;

}


Measured memory_bytes: 5304
#include <iostream>

using namespace std;

int main()
{
	int a, b;
	
	cin >> a >> b;
	
	if (a * b == 15) {
		cout << "*" << endl;
	}
	else if (a + b == 15) {
		cout << "+" << endl;
	}
	else {
		cout << "x" << endl;
	}
	
	return (0);
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

ll P[30];
ll N, K;

//! n回開催できる？
bool solve(ll n)
{
    vector<ll> v;
    REP(i, 30)
    {
        if (P[i] > 0)
            v.push_back(P[i]);
    }

    if (v.size() < K)
        return false;
    REP(i, n)
    {
        sort(v.begin(), v.end(), [](ll a, ll b) { return a > b; });
        REP(j, K)
        {
            if (v[j] <= 0)
                return false;
            v[j]--;
        }
    }
    return true;
}

int main()
{
    cin >> N >> K;
    memset(P, 0, sizeof(P));
    REP(i, N)
    {
        string S;
        cin >> S;
        P[S[0] - 'A']++;
    }

    ll ok = 0, ng = 100000;
    while (abs(ok - ng) > 1)
    {
        ll mid = (ok + ng) / 2;
        if (solve(mid))
            ok = mid;
        else
            ng = mid;
    }
    cout << ok << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
    string x;
    cin>>x;
    int len=x.length();
    if (x[len-1]=='s'){
        cout<<x<<"es"<<endl;
    }
    else{
        cout<<x<<'s'<<endl;
    }
}

Measured memory_bytes: 3624
import java.util.*;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        sc.nextLine();
        long a[][] = new long[n][2];
        for(int i = 0;i<n;i++){
            a[i][0] = sc.nextLong();
            a[i][1] = sc.nextLong();
            sc.nextLine();
        }
        Arrays.sort(a,(x,y) -> Long.compare(x[0],y[0]));
        long ans = 0;
        for(int i = 0;i<n;i++){
            if(m == 0){
                break;
            }else if(a[i][1] > m){
                ans += m * a[i][0];
                m = 0;
            }else{
                ans += a[i][0] * a[i][1];
                m -= a[i][1];
            }
        }

        System.out.println(ans);
    }
}

Measured memory_bytes: 160536
#include<bits/stdc++.h>
#define mp make_pair
#define f first
#define se second
#define pb push_back
#define ms memset
#define MOD 1000000007
#define sp fixed<<setprecision
#define sz sizeof
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
int pr[1000007];
bool isnotprime(ll x){if(x==1)return 1;if(x==2)return 0;if(x%2==0)return 1;return(pr[x/64]&(1<<((x>>1)&31)));}
void sieve(ll n){for(ll i=3;i*i<=n;i+=2){if(!isnotprime(i))for(ll j=i*i,k=i<<1;j<n;j+=k)pr[j/64]|=(1<<((j>>1)&31));}}
ll fpow(ll x,ll y){x=x%MOD;ll res=1;while(y){if(y&1)res=res*x;res%=MOD;y=y>>1;x=x*x;x%=MOD;}return res;}
ll inv(ll a,ll m){ll c=m;ll y=0,x=1;if(m==1)return 0;while(a>1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=c;return x;}
struct participant
{
  ll height;
  ll pow;
};
bool cmp(participant a, participant b)
{
  return (a.height+a.pow)<(b.height+b.pow);
}
int main(){
   ios_base::sync_with_stdio(false);
   cin.tie(0);
   cout.tie(0);
   ll n;
   cin>>n;
   vector<participant>a(n);
   for(int i=0;i<n;i++)
   {
     cin>>a[i].height>>a[i].pow;
   }
   sort(a.begin(),a.end(),cmp);
   ll dp[n+1];
   for(int i=0;i<=n;i++)
   dp[i]=1e12;
   dp[0]=0;
   for(int i=0;i<n;i++)
   {
     for(int j=n-1;j>=0;j--)
     {
       if(dp[j]<=a[i].height)
       dp[j+1]=min(dp[j+1],dp[j]+a[i].pow);
     }
   }
   ll res=0;
   for(ll i=1;i<=n;i++)
   {
     if(dp[i]<1e12)
     res=max(res,i);
   }
   cout<<res<<"\n";

}


Measured memory_bytes: 384
n, k = map(int,input().split())
x = list(map(int,input().split()))
result = []
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l * r >= 0:
        result.append(max(abs(l), abs(r)))
    else:
        result.append(abs(2*l-r))
        result.append(abs(2*r-l))
print(min(result))

Measured memory_bytes: 14392
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int X = Integer.parseInt(sc.next());
		
		int count=1;
		int distance=0;
		
		for(int i=0;i<N;i++) {
			int L=Integer.parseInt(sc.next());
			if(X>=distance+L) {
				distance+=L;
				count++;
			}else {
				break;
			}
			
		}
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 22868
n=int(input())
a=list(map(int,input().split()))
f=all((x%3==0)or(x%5==0) for x in a if x%2==0)
g=all(x%2==1 for x in a)
if g==True:
  print("APPROVED")
else:
  if f==True:
    print("APPROVED")
  else:
    print("DENIED")


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int main()
{
    int n, m;
    string a, b, ans = "" ;
    cin >> a >> b;
    n = a.size();
    m = b.size();
    ll p[n + 1][m + 1];
    for (int i = 0; i <= n; i++)
        for (int j = 0; j <= m; j++)
        {
            if (i == 0 || j == 0) p[i][j] = 0;
            else if (a[i - 1] == b[j - 1])
                p[i][j] = p[i - 1][j - 1] + 1;
            else p[i][j] = max(p[i - 1][j], p[i][j - 1]);
        }
    int i = n, j = m;
    while (i >= 0 && j >= 0)
    {
        if (a[i - 1] == b[j - 1]) {
            ans += a[i - 1];
            i--; j--;
        }
        else if (p[i - 1][j] > p[i][j - 1])
            i--;
        else j--;
    }
    int l = p[n][m];
    while (l > 0)
    {
        cout << ans[l - 1];
        l--;
    }
    cout << endl;
}

Measured memory_bytes: 70656
'use strict';
(function(input){
  input=input.trim().split(/\n/).map(str=>str.split(/\s+/).map(x=>x-0));
  const N=input[0][0];
  const dp=[[0,0,0]];
  for(let i=1;i<=N;i++){
    dp[i]=[0,0,0];
    for(let j=0;j<3;j++){
      dp[i][j]=Math.max(dp[i-1][(j+1)%3],dp[i-1][(j+2)%3])+input[i][j];
    }
  }
  const ans=Math.max.apply(null,dp[N]);
  console.log(ans);
})(require('fs').readFileSync('/dev/stdin','utf8'));

Measured memory_bytes: 53708
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int main() {
  int n,k;
  cin >> k >> n;
  int a[n];
  for(int i = 0; i < n; i++) {
    cin >> a[i];
  }

  int dist = 0;
  for(int i = 1; i < n; i++) {
    dist = max(a[i]-a[i-1],dist);
  }
  dist = max(k+a[0]-a[n-1],dist);

  cout << k-dist << endl;
  return 0;
}


Measured memory_bytes: 4412
import heapq
 
N,M = map(int,input().split())
Price_List = list(map(lambda x:x*(-1),map(int,input().split())))
heapq.heapify(Price_List)
for i in range(M):
    val = heapq.heappop(Price_List)* -1 // 2 * -1
    heapq.heappush(Price_List,val)
print(-sum(Price_List))

Measured memory_bytes: 83844
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
using namespace std;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef pair<int, int> P;
typedef pair<ll,ll> LP;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
//template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


void solve(){
    ll X;
    cin >> X;
    ll cur = 100;
    int ans = 0;
    while(cur < X){
        cur += cur / 100;
        ans++;
    }
    cout << ans << endl;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    solve();
    // int T; cin >> T; REP(t,T) solve();
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <functional>

using namespace std;


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

    string str;
    cin>>str;
    str[3]='8';
    cout<<str<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 998244353;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, S;
    cin >> n >> S;

    // 1-indexで考える
    vl a(n+1);
    exrep(i, 1, n) {
        cin >> a[i];
    }

    // dp1[l][r][s] :「l <= x_1 < … < x_k <= r」かつ「Σa_(x_i) (1 <= i <= k) = s」 をみたす(x_1, …,x_k)の個数
    // とおくと、
    // l = r のとき、 dp1[r][r][s] = １[(s = 0) ∨ (s = a[r])]  (ただし、１[bool] はbool = falseのとき0, bool = trueのとき1となる関数)
    // l < r のとき、 dp1[l][r][s] =  dp1[l][r-1][s] + dp1[l][r-1][s - a[r]]
    // このとき求める値は Σ(Σdp1[l][r][S] (1 <= l <= r)) (1 <= r <= n) なので、
    // dp2[r][s] = Σdp1[l][r][s] (1 <= l <= r) とおくと
    // 求める値は Σdp2[r][S] (1 <= r <= n) となる。
    // dp2[r][s] = Σdp1[l][r][s] (1 <= l <= r) = Σdp1[l][r][s] (1 <= l <= r-1) + dp1[r][r][s]
    //           = Σ(dp1[l][r-1][s] + dp1[l][r-1][s - a[r]]) (1 <= l <= r-1) + １[(s = 0) ∨ (s = a[r])]
    //           = dp2[r-1][s] + dp2[r-1][s - a[r]] + １[(s = 0) ∨ (s = a[r])]
    // となってO(n*S)になる。

    // dp1[l][r][s] :「l <= x_1 < … < x_k <= r」かつ「Σa_(x_i) (1 <= i <= k) = s」をみたす(x_1, …,x_k)の個数
    vvl dp2(n+1, vl(S+1));  // dp2[r][s] : Σdp1[l][r][s] (1 <= l <= r)
    exrep(r, 1, n) {
        exrep(s, 0, S) {
            ll x = 0;
            if(s == 0 || s == a[r]) {
                x = 1;
            }
            if(s >= a[r]) {
                dp2[r][s] = dp2[r-1][s] + dp2[r-1][s - a[r]] + x;
            }
            else {
                dp2[r][s] = dp2[r-1][s] + x;
            }
            dp2[r][s] %= mod;
        }
    }

    ll ans = 0;
    exrep(r, 1, n) {
        ans += dp2[r][S];
        ans %= mod;
    }

    out(ans);
    re0;
}

Measured memory_bytes: 70784
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long x,i=1,temp=26;
    cin>>x;
    x--;
    while(temp<=x){
        x-=temp;
        temp*=26;
        i++;
    }
    string out="";
    while(i--){
        out=(char)(x%26+'a')+out;
        x/=26;
    }
    cout<<out;
}


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

typedef long long ll;

using namespace std;

int h,w,n;
set<pair<int,int>> p;

ll cnt[10];

pair<int,int> countP(int x, int y)
{
    if(x+2 >= h || y + 2 >= w || x < 0 || y < 0)
        return {0,0};
    int t = 0;
    int l = 0;
    for(int i=x; i<=x+2; i++)
        for(int j=y; j<=y+2; j++)
            if(p.find({i,j}) != p.end()){
                t++;
                l = (i-x) * 3 + j-y;
            }
    return {t,l};
}

int main()
{
    cin >> h >> w >> n;
    int x,y;
    for(int i=0; i<n; i++)
    {
        cin >> x >> y;
        p.insert({x-1,y-1});
    }

    ll sum = 0;
    for(auto it : p)
    {
        x = it.first;
        y = it.second;
        for(int i = x - 2; i <= x; i++)
            for(int j=y-2; j <= y; j++)
            {
                pair<int,int> val = countP(i,j);
                if(val.first <= 0 || val.second > (x-i) * 3 + y-j)
                    continue;
                cnt[val.first]++;
                sum++;
            }
    }
    cnt[0] = 1ll * (h-2) * (w-2) - sum;
    for(int i=0; i<10; i++)
        cout << cnt[i] << "\n";
}


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

int main() {
    int h,w;
    cin >> h >> w;
    
    vector<string> startend(w + 2,"#");
    
    string line = "";
    for(int i = 0; i < w + 2; i++)
    {
        line += startend.at(i);
    }
    
    cout << line << endl;
    
    for(int i = 0; i < h; i++)
    {
        cout << "#";
        
        string buf;
        cin >> buf;
        cout << buf << "#" << endl;
    }
    
    
    cout << line << endl;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

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

        InputStreamReader is = new InputStreamReader(System.in);
        BufferedReader reader = new BufferedReader(is);

        List<String> mylist = new ArrayList<>();

        // 標準入力からの値を変数strinputに代入
        String strinput = reader.readLine();

        while (strinput != null) {

            mylist.add(strinput);
            strinput = reader.readLine();

        }

        String arr01[] = mylist.get(0).split(" ");

        String s = arr01[0];

        if (s.equals("AAA") || s.equals("BBB")) {
            System.out.println("No");
        } else {
            System.out.println("Yes");

        }

    }

}


Measured memory_bytes: 22228
/*
     AUTHOR : Ankit Kumar
     BRANCH : Information Technology
     INSTITUTE : Birla Institute of Technology
*/
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb push_back
#define MP make_pair
#define SET(a,val) memset(a,val,sizeof(a))
#define deci(n)         cout<<fixed<<setprecision(n);
#define show(a,l,r) for(int i=l;i<r;i++) cout<<a[i]<<" ";
const int N=100004;
const int dx[] = {-1, 0, 1, 0, -1,-1, 1, 1};
const int dy[] = { 0, 1, 0,-1, -1, 1,-1, 1};
char dir[]={'L','D','R','U'};
//int dx[]={2,-2,1,-1,2,-2,1,-1};//for knights
//int dy[]={1,1,2,2,-1,-1,-2,-2};
typedef long long int ll;
typedef long double ld;
const ll mod=1e9+7;
const ll inf=1e18+100;
int BIT[100005],n;
int prime[17],spf[17];
template<typename T>T lcm(T a, T b) {return a / gcd(a,b) * b;}
template<typename T> T min3(T a,T b,T c) {return min(a,min(b,c));}
template<typename T> T max3(T a,T b,T c) {return max(a,max(b,c));}
bool isVowel(char ch){ ch=toupper(ch); if(ch=='A'||ch=='U'||ch=='I'||ch=='O'||ch=='E') return true; return false;}
ll mInv(ll a, ll m)
{
    ll m0 = m;
    ll y = 0, x = 1;
    if (m == 1)
      return 0;
    while (a > 1)
    {
        ll q = a / m;
        ll t = m;
        m = a % m, a = t;
        t = y;
        y = x - q * y;
        x = t;
    }
    if (x < 0)
       x += m0;
return x;
}
ll power(ll x, ll y)
{
    ll res = 1;
    x = x % mod;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % mod;
        y = y>>1;
        x = (x*x)% mod;
    }
    return res;
}
ll gcd(ll a,ll b)
{
    if(b==0)
        return a;
    return gcd(b,a%b);
}
void update(int x, int delta)
{
    if(!x)
    {
        BIT[x]+=delta;
        return;
    }
      for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
ll query(int x)
{
     ll sum = BIT[0];
     for(; x > 0; x -= x&-x)
        sum += BIT[x];
     return sum;
}
void Sieve()
{
    for(int i=1;i<=N;i++)
        prime[i]=1;
    prime[0]=0;
    prime[1]=0;
    for (ll p=2; p*p<=N; p++)
    {
        if (prime[p] == 1)
        {
            for (ll i=p*p; i<=N; i += p)
                prime[i] = 0;
        }
    }
    for(int p=3;p<=N;p++)
        prime[p]+=prime[p-1];
}
void sieve()
{
    spf[1] = 1;
    for (int i=2; i<N; i++)
        spf[i] = i;
    for (int i=4; i<N; i+=2)
        spf[i] = 2;
    for (ll i=3; i*i<N; i++)
    {
        if (spf[i] == i)
        {
            for (ll j=i*i; j<N; j+=i)
                if (spf[j]==j)
                    spf[j] = i;
        }
    }
}
                         /******************Lets Code*******************/

int main()
{
    fast
    int t=1;
    //cin>>t;
    while(t--)
    {
        int k;
        string s;
        cin>>k;
        cin>>s;
        int n=s.size();
        for(int i=0;i<min(k,n);i++)
        cout<<s[i];
        if(n>k)
        cout<<"...";
        cout<<"\n";
    }
   	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>

int main(){
	int i;
	int n,k;
	int coin;
	double ans=0;
	scanf("%d %d",&n,&k);
	
	for(i=1;i<=n;i++){
		for(coin=1;;){
			if( (i*coin) >= k ){
				break;
			}else{
				coin<<=1;
			}
		}
		ans+=(1.0/(double)n)*(1.0/(double)coin);
	}
	printf("%.12lf\n",ans);
	return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

	public static final int BIG_NUM  = 2000000000;
	public static final int MOD  = 1000000007;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);

		double x[] = new double[100];
		double y[] = new double[100];
		double p_1 = 0,p_2 = 0,p_3 = 0,p_infinity = -1;

		int N = scanner.nextInt();

		for(int i = 0; i < N; i++)x[i] = scanner.nextDouble();
		for(int i = 0; i < N; i++)y[i] = scanner.nextDouble();

		for(int i = 0; i < N; i++){
			p_1 += Math.abs(x[i]-y[i]);
			p_2 += (x[i]-y[i])*(x[i]-y[i]);
			p_3 += Math.abs((x[i]-y[i])*(x[i]-y[i])*(x[i]-y[i]));
			p_infinity = Math.max(p_infinity, Math.abs(x[i]-y[i]));
		}

		System.out.printf("%.10f\n", p_1);
		System.out.printf("%.10f\n", Math.sqrt(p_2));
		System.out.printf("%.10f\n", Math.cbrt(p_3));
		System.out.printf("%.10f\n", p_infinity);
	}
}




Measured memory_bytes: 29104
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    ll n;cin>>n;
    vector<pair<ll,ll>> R(n),B(n);
    rep(i,n) cin>>R[i].first>>R[i].second;
    rep(i,n) cin>>B[i].first>>B[i].second;
    vector<bool> used(n,false);
    sort(R.rbegin(),R.rend());
    sort(B.begin(),B.end());
    ll res=0;
    rep(i,n){
        int id=-1;
        ll buf=-100;
        rep(j,R.size()){
            if((R[j].second<B[i].second)&&(R[j].first<B[i].first))if(chmax(buf,R[j].second))id=j;
        }
        if(id==-1)continue;
        res++;
        R.erase(R.begin()+id);
    }
    cout<<res<<endl;
}

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

namespace AtCoder.At_Coder_Beginner_Contest_169
{
    class B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] As = Console.ReadLine().Split(' ');

            Calc(N, As);
            //Console.ReadKey();
        }

        private static void Calc(int N, string[] As)
        {
            try
            {
                checked
                {
                    long[] Al = new long[As.Length];
                    long sum = 1;
                    for (int i = 0; i < N; i++)
                    {
                        Al[i] = long.Parse(As[i]);
                        if (Al[i] == 0)
                        {
                            Console.WriteLine(0);
                            return;
                        }
                    }

                    for (int i = 0; i < N; i++)
                    {
                        sum *= Al[i];
                    }

                    if(1000000000000000000 < sum)
                    {
                        Console.WriteLine(-1);
                        return;
                    }

                    Console.WriteLine(sum);
                }
            }
            catch (OverflowException)
            {
                Console.WriteLine(-1);
                return;
            }
        }
    }
}


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

int main(){
	int a,b;
	cin>>a;
	cin>>b;
	if(a == b) {
		cout<<"a == b"<<endl;
	} else if (a < b) {
		cout<<"a < b"<<endl;
	} else if (a > b) {
		cout<<"a > b"<<endl;
	}
	return 0;
}


Measured memory_bytes: 3092
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.Queue;

public class Main
{

    public static void main(String[] args) throws IOException
    {
        Queue<Integer> qBase = new LinkedList<Integer>();
        BufferedReader bReader =
                       new BufferedReader(new InputStreamReader(System.in));
        int inningCount = Integer.parseInt(bReader.readLine());
        int calcCount = 0;
        int point = 0;
        int out = 0;
        qBase.offer(0);
        qBase.offer(0);
        qBase.offer(0);
        while ( calcCount != inningCount )
        {
            String inputStr = bReader.readLine();
            if ( inputStr.equals("HIT") )
            {
                point += qBase.peek();
                qBase.poll();
                qBase.offer(1);
            }
            else if ( inputStr.equals("HOMERUN") )
            {
                point += qBase.peek();
                qBase.poll();
                point += qBase.peek();
                qBase.poll();
                point += qBase.peek();
                qBase.poll();
                point += 1;
                qBase.offer(0);
                qBase.offer(0);
                qBase.offer(0);
            }
            else if ( inputStr.equals("OUT") )
            {
                out++;
                if ( out == 3 )
                {
                    System.out.println(point);
                    calcCount++;
                    out=0;
                    point = 0;
                    qBase.clear();
                    qBase.offer(0);
                    qBase.offer(0);
                    qBase.offer(0);
                }
            }
            else
            {
            }
        }
    }
}

Measured memory_bytes: 8920
#include <stdio.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
using namespace std;

int main( void )
{
    int A, B;
    cin >> A >> B;

    if(A <= 5){
        cout << 0 << "\n";
    }else if(A <= 12){
        cout << B/2 << "\n";
    }else{
        cout << B << "\n";
    }


	return 0;
}

Measured memory_bytes: 256
#include <iostream>

// @idea: digit dp
//      n: total number of children
//      s   : current number of candies
//      dp(i, s) : all the ways s candies can be distributed from [1...i]

using namespace std;

const int NMAX = 1e2 + 11;
const int KMAX = 1e5 + 11;
const int MOD  = 1e9 + 7;

int n, k, a[NMAX], acc[KMAX], dp[NMAX][KMAX];

int solve(void)
{
    dp[0][0] = 1;

    for (int s = 1; s <= k; ++s)
        dp[0][s] = 0;

    for (int i = 1; i <= n; ++i)
    {
        acc[0] = dp[i - 1][0];
        for (int s = 1; s <= k; ++s)
            acc[s] = (acc[s - 1] + dp[i - 1][s]) % MOD;
        // reachable =  [s - a[i], s]
        for (int s = 0; s <= k; ++s)
            dp[i][s] =
                (acc[s] - (s - a[i] - 1 >= 0 ? acc[s - a[i] - 1] : 0) + MOD) %
                MOD;
    }

    return dp[n][k];
}

int main(void)
{
    cin >> n >> k;

    for (int i = 1; i <= n; ++i)
        cin >> a[i];

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 41600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const int inf = 1e9;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, b, a) for (int i = a - 1; i >= b; i--)
using Graph = vector<vector<int>>;
using pint = pair<int, int>;
int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
int dxx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dyy[8] = {-1, 0, 1, -1, 1, -1, 0, 1};

int main() {
    int n;
    cin >> n;
    int a[n];
    int sum = 0;
    rep (i, 0, n) {
        cin >> a[i];
        sum ^= a[i];
    }
    rep (i, 0, n) {
        int ans = sum ^ a[i];
        cout << ans << " ";
    }
}


Measured memory_bytes: 4368
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, n) for(int i = 1; i < n; i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define P pair<int, int>
typedef long long ll;
const ll mod = 1e9+7;

//繰り返し自乗法による累乗計算
//a**n
ll pow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = pow(a, n/2);
    return res * res;
  }
  return a * pow(a, n-1);
}
//繰り返し自乗法によるmod累乗計算
//a**n (mod)
ll modpow(ll a, ll n){
  if(n == 0) return 1;
  if(n%2 == 0){
    ll res = modpow(a, n/2);
    return res * res % mod;
  }
  return a * modpow(a, n-1) % mod;
}
//組み合わせ
//nCa
ll com(ll n, ll a){
  ll x = 1, y = 1;
  rep(i,a){
    x *= n-i;
    y *= i+1;
  }
  ll res = x / y;
  return res;
}
//組み合わせ(mod)
//nCa (mod)
ll modcom(ll n, ll a){
  ll x = 1, y = 1;
  rep(i, a){
    x = x * (n-i) % mod;
    y = y * (i+1) % mod;
  }
  ll ans = x * modpow(y, mod-2) % mod;
  return ans;
}
//gcd 最大公約数
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  return gcd(y, x%y);
}
//lcm 最小公倍数
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
//ngcd n個の最大公約数
ll ngcd(vector<ll> a){
  ll res;
  res = a[0];
  for(ll i = 1; i < a.size() && res != 1; i++) {
    res = gcd(a[i], res);
  }
  return res;
}
//nlcm n個の最小公倍数
ll nlcm(vector<ll> a) {
  ll res;
  res = a[0];
  for (ll i = 1; i < a.size(); i++) {
    res = lcm(res, a[i]);
  }
  return res;
}
// 素数判定
bool isprime(ll x){
  ll i;
  if(x < 2) return false;
  else if(x == 2) return true;
  if(x % 2 == 0) return false;
  for(i = 3; i*i <= x; i += 2){
    if(x % i == 0) return false;
  }
  return true;
}
// 桁和
ll digsum(ll x){
  ll res = 0;
  while(x > 0){
    res += x % 10;
    x /= 10;
  }
  return res;
}


int main(){
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int ans = max(min(b,d) - max(a, c), 0);
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

int main() {
    int n;  cin >> n;
    ll d;   cin >> d;
    vector<ll> x(n), y(n);
    for (int i = 0; i < n; i++)
        cin >> x[i] >> y[i];
    ll ans = 0;
    for (int i = 0; i < n; i++) {
        if (x[i]*x[i] + y[i]*y[i] <= d*d)
            ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6360
#include<iostream>
#include<vector>
#include<string>
#include<set>
#include<algorithm>

using namespace std;

int main()
{
	int n;
	while(cin >> n and n!=0)
	{
		set<pair<double,string>> st;
		for(int i=0;i<n;i++)
		{
			string l;
			double p,a,b,c,d,e,f,s,m;
			cin >> l >> p >> a >> b >> c >> d >> e >> f >> s >> m;
			double ef;
			ef=(f*s*m-p)/(a+b+c+(d+e)*m);

			st.insert(make_pair((-1)*ef,l));
		}

		for(auto itr=st.begin();itr!=st.end();itr++)
		{
			cout << (*itr).second << endl;
		}

		cout << "#" << endl;
	}

}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <locale>
#include <algorithm>

using namespace std;

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

	int A, B;
	cin >> A >> B;
	if (A > 12) {
		cout << B << endl;
	} else if(A >= 6) {
		cout << (B/2) << endl;
	} else {
		cout << 0 << endl;
	}

}


Measured memory_bytes: 888
//O(N^2)
#include <stdio.h>
#include <x86intrin.h>
typedef unsigned int uint;
inline uint read(){
    int flag=0;
    uint num=0;
    for(;;){
        int c = getchar_unlocked();
        if('0' <= c && c<= '9'){
            flag=1;
            num = num*10+(c-'0');
        }else if(flag){
            return num;
        }
    }
}
uint a[200000] __attribute__ ((aligned (16)));
uint b[200000] __attribute__ ((aligned (16)));
int main(void){
    uint n=read();
    uint s=0;
    uint ss[4];
    for(uint i=0; i<n; i++){
        a[i]=read();
    }
    for(uint i=0; i<n; i++){
        b[i]=read();
    }
    __m128i s0 = _mm_setzero_si128();
    __m128i s1 = _mm_setzero_si128();
    __m128i s2 = _mm_setzero_si128();
    __m128i s3 = _mm_setzero_si128();
    uint j;
    for(j=0; j<(n/4*4); j+=4){
        __m128i d = _mm_load_si128((__m128i*)(b+j));
        __m128i d0 = _mm_shuffle_epi32(d, 0x00);
        __m128i d1 = _mm_shuffle_epi32(d, 0x55);
        __m128i d2 = _mm_shuffle_epi32(d, 0xAA);
        __m128i d3 = _mm_shuffle_epi32(d, 0xFF);
        uint i;
        for(i=0; i<(n/16*16); i+=16){
            __m128i c0 = _mm_load_si128((__m128i*)(a+i+0));
            __m128i c1 = _mm_load_si128((__m128i*)(a+i+4));
            __m128i c2 = _mm_load_si128((__m128i*)(a+i+8));
            __m128i c3 = _mm_load_si128((__m128i*)(a+i+12));
            __m128i t0 = _mm_add_epi32(c0, d0);
            __m128i t1 = _mm_add_epi32(c1, d0);
            __m128i t2 = _mm_add_epi32(c2, d0);
            __m128i t3 = _mm_add_epi32(c3, d0);
            s0 = _mm_xor_si128(s0, t0);
            s1 = _mm_xor_si128(s1, t1);
            s2 = _mm_xor_si128(s2, t2);
            s3 = _mm_xor_si128(s3, t3);
            t0 = _mm_add_epi32(c0, d1);
            t1 = _mm_add_epi32(c1, d1);
            t2 = _mm_add_epi32(c2, d1);
            t3 = _mm_add_epi32(c3, d1);
            s0 = _mm_xor_si128(s0, t0);
            s1 = _mm_xor_si128(s1, t1);
            s2 = _mm_xor_si128(s2, t2);
            s3 = _mm_xor_si128(s3, t3);
            t0 = _mm_add_epi32(c0, d2);
            t1 = _mm_add_epi32(c1, d2);
            t2 = _mm_add_epi32(c2, d2);
            t3 = _mm_add_epi32(c3, d2);
            s0 = _mm_xor_si128(s0, t0);
            s1 = _mm_xor_si128(s1, t1);
            s2 = _mm_xor_si128(s2, t2);
            s3 = _mm_xor_si128(s3, t3);
            t0 = _mm_add_epi32(c0, d3);
            t1 = _mm_add_epi32(c1, d3);
            t2 = _mm_add_epi32(c2, d3);
            t3 = _mm_add_epi32(c3, d3);
            s0 = _mm_xor_si128(s0, t0);
            s1 = _mm_xor_si128(s1, t1);
            s2 = _mm_xor_si128(s2, t2);
            s3 = _mm_xor_si128(s3, t3);
        }
        for(; i<n; i++){
            s ^= a[i]+b[j+0];
            s ^= a[i]+b[j+1];
            s ^= a[i]+b[j+2];
            s ^= a[i]+b[j+3];
        }
    }
    for(; j<n; j++){
        for(uint i=0; i<n; i++){
            s ^= a[i]+b[j];
        }
    }
    s0 = _mm_xor_si128(s0, s2);
    s1 = _mm_xor_si128(s1, s3);
    s0 = _mm_xor_si128(s0, s1);
    _mm_storeu_si128((__m128i*)ss, s0);
    ss[0] ^= ss[2];
    ss[1] ^= ss[3];
    ss[0] ^= ss[1];
    printf("%u\n", ss[0]^s);
    return 0;
}

Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define Maxn 2007
using namespace std;
int x[Maxn],y[Maxn];
multiset<long double>s;
long double ans[Maxn];
int n;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++)
		scanf("%d%d",&x[i],&y[i]);
	for (int i=1;i<=n;i++)
	{
		s.clear();
		for (int j=1;j<=n;j++)
			if (j!=i)
			{
				long double now=atan2(y[j]-y[i],x[j]-x[i]);
				s.insert(now);
				s.insert(now+2*M_PI);
			}
		for (multiset<long double>::iterator it=s.begin();it!=s.end();it++)
		{
			multiset<long double>::iterator it1=it;
			if (it!=s.begin())
			{
				--it1;
				if ((*it)-(*it1)>M_PI)
				{
					ans[i]=(*it)-(*it1)-M_PI;
					break;
				}
			}
		}
	}
	long double sum=0.0;
	for (int i=1;i<=n;i++)
		sum+=ans[i];
	for (int i=1;i<=n;i++)
		printf("%.14Lf\n",(long double)ans[i]/sum);
	return 0;
}


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


int arr[110][110];
int cnt[11000];
int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	int n;
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &cnt[i]);
	}
	int idx = 1;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			while (cnt[idx] == 0)idx++;
			arr[i][j] = idx;
			cnt[idx]--;
		}
	}
	for (int i = 1; i < h; i += 2) {
		std::reverse(arr[i], arr[i] + w);
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			printf("%d ", arr[i][j]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 384
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		n=n-1;
		int answer=0;
		for(int i=1;i<n+1;i++){
			
			answer+=n/i;
			
	    }
		System.out.println(answer);
	}
	
	
}

Measured memory_bytes: 35696
#include <bits/stdc++.h>
using namespace std;
int main (){
	vector <pair <int, int> > rutas;
	pair <int, int> pares;
	int n, t , pasaje, minutos, p_min, r = 0; bool uno = true;
	cin >> n >> t;
	for (int i=1;i<=n;i++){
		cin >> pasaje >> minutos;
		if (minutos <= t){
			if (uno == true){
				p_min = pasaje;
				uno = false;
				r = pasaje;
			}
			else{
				if (pasaje < p_min){
					p_min = pasaje;
					r = pasaje;
				}
			}
		}
	}
	if (r == 0) cout << "TLE";
	else cout << r;
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define bitget(a, b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define vsort(x) sort(x.begin(), x.end())

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int ans = min(b, d) - max(a, c);
	if (ans < 0){
		cout << 0 << endl;
	}
	else{
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pfi(a) printf("%d",a);
#define pfl(a) printf("%lld",a);
#define pfin(a) printf("%d\n",a);
#define pfln(a) printf("%lld\n",a);
#define sfi(a) scanf("%d",&a);
#define sfl(a) scanf("%lld",&a);
#define pb push_back
#define f(i,a,b) for(int i=a;i<b;i++)
#define ll long long
const int MAXN=2e5+5;
const int M= 998244353;
const int modi6=166666668;


int main(){	

	int t;
	cin>>t ;

	set<string> st;

	while(t--){
		string s;
		cin>>s;

		st.insert(s);

	}

	cout<<st.size();
	
	return 0;	
}

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

int main()
{
    int K, N;
    cin >> K >> N;

    vector<int> vec(N);
    rep(i,N) cin >> vec[i];

    int ans = K;
    int tmp;
    rep(i,N){
        if(i == 0){
            tmp = vec[N-1] - vec[0];
            ans = min(ans, tmp);
            tmp = K - (vec[1] - vec[0]);
            ans = min(ans, tmp);
        }
        else if(i != N-1){
            tmp = K - (vec[i] - vec[i-1]);
            ans = min(ans, tmp);
            tmp = K - (vec[i+1] - vec[i]);
            ans = min(ans, tmp);           
        }
        else{
            tmp = K - (vec[i] - vec[i-1]);
            ans = min(ans, tmp);           
        }
    }

    cout << ans << endl;
    
    return 0;
}
//Ctrl+Shift+Bでコンパイルと実行を行ってデバッグすること

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
//#include <boost/multiprecision/cpp_int.hpp>
//using multiInt = boost::multiprecision::cpp_int;

using ll = long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
template <typename Q_temp>
using smaller_queue = priority_queue<Q_temp, vector<Q_temp>, greater<Q_temp>>;

const ll MOD = (ll)(1e9 + 7);
const int INF = (int)1e9;
const ll LINF = (ll)4e18;
const double PI = acos(-1.0);

#define REP(i, m, n) for (ll i = m; i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)
#define MP make_pair
#define MT make_tuple
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl
#define possible(n) cout << ((n) ? "possible" : "impossible") << endl
#define Yay(n) cout << ((n) ? "Yay!" : ":(") << endl
#define all(v) v.begin(), v.end()
#define NP(v) next_permutation(all(v))
#define dbg(x) cerr << #x << ":" << x << endl;

vector<int> Dx = {0, 0, -1, 1, -1, 1, -1, 1, 0};
vector<int> Dy = {1, -1, 0, 0, -1, -1, 1, 1, 0};

int main()
{
  int a, b;
  cin >> a >> b;
  cout << 6 - a - b << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <numeric>
#include <iomanip>

#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
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 ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
/* const int MOD = 998244353; */
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;
struct INIT { INIT(){
  cin.tie(0); ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
}}INIT;

vector<int> fac, finv, inv;

void comb_init(int n) {
  fac  = vector<int>(n);
  finv = vector<int>(n);
  inv  = vector<int>(n);
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < n; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
 
int comb(int n, int k) {
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main() {
  int H, W, A, B; 
  cin >> H >> W >> A >> B;

  comb_init(200020);

  int ans = 0;
  FOR(i, B+1, W+1){
    (ans += comb(H-A-1+i-1, i-1)*comb(A-1+W+1-i-1, W+1-i-1)) %= MOD;
  }
  cout << ans << "\n";

  return 0;
}

Measured memory_bytes: 4992
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    ans = set()
    for i in range(1, N+1):
        ans.add(i)
        if sum(ans) >= N:
            break
    m = sum(ans) - N
    if m in ans:
        ans.remove(m)
    for i in ans:
        print(i)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#include <stdio.h>
#include <vector>
#include <algorithm> // sort
#include <map>
using namespace std;

int main(){
    double l;
    cin>>l;
    std::cout << std::setprecision(16) << l*l*l/27.0;
    cout<<endl;
}

Measured memory_bytes: 256
package main

import (
    "fmt"
)

func main() {
    var n int
    fmt.Scan(&n)
    as := make([]int, n+1)
    for i := range as {
        fmt.Scan(&as[i])
    }
    bs := make([]int, n)
    for i := range bs {
        fmt.Scan(&bs[i])
    }

    var cnt int
    for i := range as {
        if i > 0 && bs[i-1] > 0 {
            if bs[i-1] >= as[i] {
                cnt += as[i]
                bs[i-1] -= as[i]
                as[i] = 0
                continue
            } else {
                cnt += bs[i-1]
                as[i] -= bs[i-1]
                bs[i-1] = 0
            }
        }
        if i < n {
            if bs[i] >= as[i] {
                cnt += as[i]
                bs[i] -= as[i]
                as[i] = 0
            } else {
                cnt += bs[i]
                as[i] -= bs[i]
                bs[i] = 0
            }
        }
    }

    fmt.Println(cnt)
}


Measured memory_bytes: 7296
// 1_7_B
#include<stdio.h>

int main(){
	int n, m, l, i, j, k;
	scanf("%d %d %d", &n, &m, &l);
	int mtrxA[n][m];
	int mtrxB[m][l];
	long long int result[n][l]; 
	
	for(i = 0; i < n; i++){
		for(j = 0; j < m; j++){
			scanf("%d", &mtrxA[i][j]);
		}
	}
	for(j = 0; j < m; j++){
		for(k = 0; k < l; k++){
			scanf("%d", &mtrxB[j][k]);
		}
	}

	for(i = 0; i < n; i++){
		for(k = 0; k < l; k++){
			result[i][k] = 0;
			for(j = 0; j < m; j++){
				result[i][k] += mtrxA[i][j]*mtrxB[j][k];
			}
		}
	}

	for(i = 0; i < n; i++){
		for(k = 0; k < l-1; k++){
			printf("%lld ", result[i][k]);
		}
		printf("%lld\n", result[i][k]);
	}
	return 0;
}

Measured memory_bytes: 752
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
typedef long long ll;

int as[10000+10];

int main(void) {
  int N;
  cin >> N;
  REP(i, N) {
    cin >> as[i];
  }
  int res = 0;
  REP(i, N) {
    while(as[i] % 2 == 0) {
      ++res;
      as[i] /= 2;
    }
  }
  cout << res << endl;
  return 0;
}



Measured memory_bytes: 256
def Warshall_Floyd(V, d):
    for k in range(V):
        for i in range(V):
            for j in range(V):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])
    return d


H, W = map(int, input().split())
cost = [list(map(int, input().split())) for _ in range(10)]
field = [list(map(int, input().split())) for _ in range(H)]

cost_list = Warshall_Floyd(10, cost)
ans = 0

for h in range(H):
    for w in range(W):
        if abs(field[h][w]) == 1:
            continue
        ans += cost_list[field[h][w]][1]

print(ans)

Measured memory_bytes: 3444
#include <iostream>
#include <algorithm>
using namespace std;
int math[9][9], jud[10] = {};
bool mmath[9][9];
void jj(int x, int y){
	int jud2[10][2];
	for(int i = 0; i < 10; i++){
		fill(jud2[i], jud2[i] + 2, -1);
	}
	for(int i = x; i < x + 3; i++){
		for(int j = y; j < y + 3; j++){
			if(jud2[math[i][j]][0] >= 0){
				mmath[i][j] = 1;
				mmath[jud2[math[i][j]][0]][jud2[math[i][j]][1]] = 1;;
			}
			jud2[math[i][j]][0] = i;
			jud2[math[i][j]][1] = j;
		}
	}
}
int main(){
	int n;
	cin >> n;
	for(int k = 0; k < n; k++){
		for(int i = 0; i < 9; i++)
			fill(mmath[i], mmath[i] + 9, 0);
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				cin >> math[i][j];
			}
		}
		for(int i = 0; i < 9; i++){
			fill(jud, jud + 10, -1);
			for(int j = 0; j < 9; j++){
				if(jud[math[i][j]] >= 0){
					mmath[i][j] = 1;
					mmath[i][jud[math[i][j]]] = 1;
				}
				jud[math[i][j]] = j;
			}
		}
		for(int i = 0; i < 9; i++){
			fill(jud, jud + 10, -1);
			for(int j = 0; j < 9; j++){
				if(jud[math[j][i]] >= 0){
					mmath[j][i] = 1;
					mmath[jud[math[j][i]]][i] = 1;
				}
				jud[math[j][i]] = j;
			}
		}
		jj(0, 0);	jj(3, 0);	jj(6, 0);
		jj(0, 3);	jj(3, 3);	jj(6, 3);
		jj(0, 6);	jj(3, 6);	jj(6, 6);
		for(int i = 0; i < 9; i++){
			for(int j = 0; j < 9; j++){
				if(!mmath[i][j])
					cout << ' ';
				else
					cout << '*';
				cout << math[i][j];
			}
			cout << endl;
		}
		if(k != n - 1)
			cout << endl;
	}
}

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


int main(int argc, char const *argv[])
{
	int a, b, c; cin >> a >> b >> c;
	int h = max({a, b, c});
	while (1) {
		if (h % 2 == (a + b + c) % 2) break;
		h++;
	}
	cout << (3 * h - (a + b + c)) / 2 << endl;
	return 0;
}


Measured memory_bytes: 256