akhauriyash/Code-Regression huggingface dataset:
#include <algorithm>
#include <bitset>
#include <cmath>
#include <iostream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <unordered_map>
#include <unordered_set>
using namespace std;

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

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

// Bit begin

class Bit {
 public:
  vector<int> bit;

  Bit(int n) : bit(n+1) {}

  int Sum(int i) {
    ++i;
    int s = 0;
    while (i > 0) {
      s += bit[i];
      int last_bit = i & (-i);
      i -= last_bit;
    }
    return s;
  }

  void Add(int i, int x) {
    ++i;
    while (i <= bit.size()) {
      bit[i] += x;
      int last_bit = i & (-i);
      i += last_bit;
    }
    return;
  }
};

// Bit end

const int kMaxN = 100000;

int N;
int A[kMaxN];
int ans = 0;

signed main() {
  cin >> N;
  REP(i, N) { cin >> A[i]; }

  int lb = 1, ub = NINTH_POWER_OF_TEN+1;
  while (ub > lb+1) {
    // cout << lb << " " << ub << endl;
    int x = (ub+lb)/2;

    int a[N];
    REP(i, N) {
      if (A[i] < x) {
        a[i] = -1;
      } else {
        a[i] = 1;
      }
    }

    int S[N+1];
    S[0] = 0;
    REP(i, N) { S[i+1] = S[i] + a[i]; }
    REP(i, N+1) { S[i] += N; }

    int sum = 0;
    Bit b(2*N+1);
    FOR(r, 0, N) {
      sum += b.Sum(S[r]);
      b.Add(S[r], 1);
    }

    if (sum >= (N*(N+1)/2 + 1) / 2) {
      lb = x;
    } else {
      ub = x;
    }
  }
  ans = lb;

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4200
#include <bits/stdc++.h>
using namespace std;
#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 all(a) (a).begin(),(a).end()
#define print(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<_<<", "; cerr<<"]"<<endl; }
#define printpair(v) { cerr<<#v<<": [ "; for(auto _ : v) cerr<<"{"<<_.first<<","<<_.second<<"}"<<", "; cerr<<"]"<<endl; }
#define dump(x) cerr<<#x<<": "<<x<<endl;
#define bit(k) (1LL<<(k))
#define Yes "Yes"
#define No "No"
#define YES "YES"
#define NO "NO"
typedef long long ll;

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

const int INF = (ll)1e9;
const ll INFLL = (ll)1e18+1;
const ll MOD = (ll)1e9+7;
const double PI = acos(-1.0);
/*
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 string dir = "DRUL";
*/

struct mint {
    long long x;
    mint(long long _x=0):x((_x%MOD+MOD)%MOD){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += MOD-a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res*=a;
    }
    mint modpow(long long t) const {
        if (!t) return 1;
        mint a = modpow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }
    // for prime MOD
    mint inv() const {
        return modpow(MOD-2);
    }
    mint& operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res/=a;
    }
};
//桁DP
//上からi桁目まで見たときに以下flagの有無による個数
mint dp[100010][2];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string L;
    cin >> L;
    int N = L.size();

    dp[0][0] = 1;
    for(int i = 0; i < N; i++){
        int d = L[i] - '0';
        rep(j,2){
            for(int k = 0; k <= ((j) ? 1: d); k++){
                dp[i+1][j || k < d] += dp[i][j] * (k ? 2:1);
            }
        }
    }
    cout << (dp[N][0] + dp[N][1]).x << endl;
}

Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        sc.close();

        switch (d) {
        case 22:
            System.out.println("Christmas Eve Eve Eve");
            break;
        case 23:
            System.out.println("Christmas Eve Eve");
            break;
        case 24:
            System.out.println("Christmas Eve");
            break;
        case 25:
            System.out.println("Christmas");
            break;
        default:
            break;
        }
    }

}


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

// 最大公約数
ll gcd(ll m, ll n) {
  if (n == 0) return m;
  else return gcd(n, m % n);
}

int main() {
    ll K;
    cin >> K;
    ll ans = 0;
    for (int i = 1; i <= K; i++) {
        for (int j = 1; j <= K; j++) {
            ll g = gcd(i, j);
            for (int k = 1; k <= K; k++) {
                ans += gcd(g, k);
            }
        }
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>
#include <iomanip>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

struct edge{
	ll to,cost;
	edge(ll _to,ll _cost):to(_to),cost(_cost){}
};

vector<edge> G[100001]; 

bool used[100001];
ll d[100001];

bool solve(ll now,ll dis){
	if(d[now] != INF){
		if(d[now] != dis)return false;
		return true;
	}
	d[now] = dis;
	used[now] = true;

	bool res = true;
	rep(i,G[now].size()){
		ll to = G[now][i].to;
		ll cost = G[now][i].cost;
		res &= solve(to,dis+cost);
	}
	return res;
}

ll n,m;

int main(){
	cin >> n >> m;
	rep(i,m){
		ll l,r,d;
		cin >> l >> r >> d;
		l--; r--;
		G[l].push_back(edge(r,d));
		G[r].push_back(edge(l,-d));
	}

	rep(i,n)d[i] = INF;
	bool ok = true;
	rep(i,n){
		if(used[i])continue;
		ok &= solve(i,0);
	}
	if(ok)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 16512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);

		int N = scan.nextInt();
		int M = scan.nextInt();

		int h[] = new int[N];
		int max[] = new int[N];

		for(int i = 0; i < N; i++) {
			h[i] = scan.nextInt();
			max[i] = 0;
		}

		int ans = 0;

		for(int i = 0; i < M; i++) {
			int a = scan.nextInt();
			int b = scan.nextInt();

			max[a - 1] = Math.max(max[a - 1], h[b - 1]);
			max[b - 1] = Math.max(max[b - 1], h[a - 1]);
		}

		for(int i = 0; i < N; i++) {
			if(h[i] > max[i]) {
				ans++;
			}
		}

		System.out.println(ans);

	}

}

Measured memory_bytes: 50032
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FasterScanner in = new FasterScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, FasterScanner in, PrintWriter out) {
            final int a = in.nextInt();
            final int b = in.nextInt();
            String ans = (a > 8 || b > 8) ? ":(" : "Yay!";
            out.println(ans);
        }

    }

    static class FasterScanner {
        private InputStream in;
        private byte[] buffer;
        private int bufPointer;
        private int bufLength;

        public FasterScanner(InputStream in) {
            this.in = in;
            buffer = new byte[1024];
        }

        private boolean hasNextByte() {
            if (bufPointer < bufLength) return true;
            bufPointer = 0;
            try {
                bufLength = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            return (bufLength > 0);
        }

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

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

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

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

        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || b > '9') throw new NumberFormatException();

            while (true) {
                if (b >= '0' && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if (b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }

    }
}



Measured memory_bytes: 21716
import sys 

N, M = map(int, input().split())
A = [list(input()) for _ in range(N)]
B = [list(input()) for _ in range(M)]


c = N - M + 1

for ic in range(c):
    for jc in range(c):
        cnt = 0
        for i in range(M):
            for j in range(M):
                if A[ic + i][jc + j] == B[i][j]:
                    cnt += 1

        if cnt == M * M:
            print("Yes")
            sys.exit()
else:
    print("No")



Measured memory_bytes: 9144
#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
using namespace std;
int main()
{
    long long int n,m,a,b,c,s;
    scanf("%lld",&s);
    scanf("%lld",&a);
    s--;
    while(s--)
    {
        scanf("%lld",&b);
        {
            if(a<b)
            swap(a,b);
            m=a;n=b;
            while(b!=0)
            {
                c=a%b;
                a=b;
                b=c;
            }
            a=m/a*n;
        }
    }
    printf("%lld",a);
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
#include <queue>
#define INF 9999999999
using namespace std;
typedef long long int ll;

int main() {
	int N;
	cin >> N;
	cout << N / 3 << endl;
	return 0;
}


Measured memory_bytes: 256
import Foundation

func readWords<T>(_ f: (Substring) -> T) -> [T] {
    return readLine()!.split(separator: " ").map(f)
}


func main() {
/* 
(考察過程)
偶奇性っぽい
貪欲？
とりあえず最もシンプルな具体例をあげてみる

1種類1個の場合first
1種類2個の場合second
1種類n個の場合n%2==1 ? first : second

2種類1個の場合first
2種類2個の場合second

1種類1個1種類2個の場合 first

手を動かしてみる(希望的観測)
2種類 奇数個 偶数個の場合

いろいろ試してみたら
firstが偶数偶数を保つことができればfirstが勝てそう
[3 6] f:[2 6] s:[1 5] f:[0 4] s:[0 3] f:[0 2] s:[0 1] f win.
      f:[2 6] s:[2 5] f:[2 4] s:[2 3] f:[2 2] s:[2 1] f:[2 0] s:[1 0] f win.

n種類でも同じことが言えそう。
(証明もどき)相手が食べることによって絶対奇数が含まれてしまうなら相手は[0 0 ...]にすることができないから。

→最初からすべてが偶数ならsecond
それ以外ならfirst
*/

    let n = Int(readLine()!)!
    let A = (1...n).map { _ in Int(readLine()!)! }

    if A.allSatisfy({ $0 % 2 == 0}) {
        print("second")
    } else {
        print("first")
    }
}

main()

Measured memory_bytes: 13008
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<utility>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<queue>
#include<stack>
#define ll int64_t
#define REP(i, n) for (ll i=0; i<n; i++)
using namespace std;

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

    string S;
    cin >> S;

    int n = S.size();
    ll ans = 0;
    REP (i, 1 << n - 1) {
        ll sub = S[0] - '0';
        REP (j, n - 1) {
            if (i & 1 << j) {
                ans += sub;
                // cout << "i:" << i << " j:" << j << " ans:" << ans << "\n";
                sub = S[j + 1] - '0';
            } else {
                sub = sub * 10 + S[j + 1] - '0';
            }
        }
        ans += sub;
        // cout << "i:" << i << " ans:" << ans << "\n";
    }

    cout << ans << "\n";

}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <array>
#include <set>
#include <map>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cstdint>
#include <cassert>

using namespace std;
using i64 = int64_t;
using i32 = int32_t;
template<class T, class U> void init_n(vector<T>& v, size_t n, U x) 
{ v = vector<T>(n, x); }
template<class T> void init_n(vector<T>& v, size_t n) { init_n(v, n, T()); }
template<class T> void read_n(vector<T>& v, size_t n, size_t o = 0) 
{ v = vector<T>(n+o); for (size_t i=o; i<n+o; ++i) cin >> v[i]; }
template<class T> void read_n(T a[], size_t n, size_t o = 0)
{ for (size_t i=o; i<n+o; ++i) cin >> a[i]; }
template<class T> T gabs(const T& x) { return max(x, -x); }
#define abs gabs

i64 n, x;
vector<i64> a;
int main() {
  cin >> n >> x;
  read_n(a, n);
  sort(begin(a), end(a));
  i64 ans = 0;
  for (i64 i = 0; i < n; ++i) {
    x -= a[i];
    if (x >= 0) ans++;
  }
  if (x > 0) ans--;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<stack>
#include<string.h>
#include<queue>
#include<ctype.h>
#include<map>
#include<string>
using namespace std;
int main(){
    int a,b;
    scanf("%d%d",&a,&b);
    char ch[102][102];
    string str[102];
    for(int i=0;i<a;i++){
        scanf("%s",ch[i]);
        str[i]=ch[i];
    }
    sort(str,str+a);
    for(int i=0;i<a;i++){
        cout<<str[i];
    }
    cout<<endl;
}

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

int main(){
  int n,x,t;
  cin >> n >> x >> t;
  int ans = 0;
  
  if(n%x==0){
    ans = (n / x) * t;
  }
  else{
    ans = (n / x) * t + t;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    // N*s+M*t - s*t =k;
    ll n,m,k;
    std::cin >> n>>m>>k;
    
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= m; j++) {
            if( k == m*i+n*j-2*i*j ){
                std::cout << "Yes" << std::endl;
                return 0;
            }
        }
    }
    
    std::cout << "No" << std::endl;
    
    
}


Measured memory_bytes: 256
#include <iostream>
#include <climits>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
 
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

#define MOD 1000000007LL

int main()
{
  ll N;

  cin >> N;
  if (N==0) printf("1\n"); else printf("0\n");

  return 0;
}


Measured memory_bytes: 3592
import java.io.InputStream;
import java.io.IOException;
import java.io.PrintStream;
import java.util.*;

public class Main {

  public static void main(String[] args) {
    solve(System.in, System.out);
  }

  static void solve(InputStream is, PrintStream os) {
    Scanner sc = new Scanner(is);

    /* read */
    long n = sc.nextInt();
    long k = sc.nextInt();

    long ans = 0;
    for (int a = 1; a <= n ; a++) {
      long aModK = a % k;
      long bModK = k - aModK;
      long cModK = k - aModK;
      long nModK = n % k;
      if ((bModK + cModK) % k == 0) {
        long bcCandidate = bModK <= nModK ? n / k + 1 : n / k;
        ans += bcCandidate * bcCandidate;
      }
    }
    os.println(ans);
  }

  private static class Scanner {

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

    Scanner(InputStream is) {
      this.is = is;
    }

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

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

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

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

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

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

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

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


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

const ll mod = 1000000007;

int main(){
	int n, k;
	vector<int> a;
	vector<vector<ll> > dp;
	vector<ll> pre;
	
	cin>>n>>k;
	
	a.assign(n+1, 0);
	dp.assign(k+1, vector<ll> (n+1, 0));
	pre.assign(k+1, 0);
	
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	
	for(int i=0;i<=n;i++){
		dp[0][i] = 1;
	}
	pre[0] = dp[0][n];
	for(int i=1;i<=k;i++){
		pre[i] = pre[i-1]+dp[i][n];
	}

	for(int j=n-1;j>=0;j--){
		for(int i=0;i<=k;i++){
			dp[i][j] = (pre[i]-pre[max(0, i-a[j])]+dp[max(0, i-a[j])][j+1])%mod;
			while(dp[i][j] < 0){
				dp[i][j] += mod;
			}
		}
		pre[0] = dp[0][j];
		for(int i=1;i<=k;i++){
			pre[i] = (pre[i-1]+dp[i][j])%mod;
			while(pre[i]<0){
				pre[i] += mod;
			}
			/*if(pre[i] < 0)
				cout<<"ok\n";*/
		}
	}

	cout<<dp[k][0]<<"\n";

	return 0;
}

/*
dp[i][j] = No. of ways to distribute i candies among 1, 2, .... j children.(TLE)

pre[i] = SIGMA (dp[j][curr], j=0 to i)
*/

Measured memory_bytes: 83072
#include<bits/stdc++.h>
using namespace std;
int n,Z1[500100],Z2[500100],pri[500100],mp[500100],res;
char s[500100];
void Zalgo(int *Z){
	int l=0,r=0;
	for(int i=1;i<n;i++){
		if(i<=r)Z[i]=min(Z[i-l],r-i);
		while(i+Z[i]<n&&s[Z[i]+i]==s[Z[i]])Z[i]++;
		if(i+Z[i]>r)r=i+Z[i],l=i;
	}
}
void ural(){
	for(int i=2;i<=n;i++){
		if(!pri[i])pri[++pri[0]]=i,mp[i]=i;
		for(int j=1;j<=pri[0]&&i*pri[j]<=n;j++){
			pri[i*pri[j]]=true,mp[i*pri[j]]=pri[j];
			if(!(i%pri[j]))break;
		}
	}
}
vector<int>v[500100];
void fact(){
	for(int i=2;i<=n;i++)for(int j=i;j!=1;j/=mp[j])if(v[i].empty()||v[i].back()!=mp[j])v[i].push_back(mp[j]);
}
bool chepre(int x){
	for(auto i:v[x]){
		int j=x/i;
		if(Z1[j]+j>=x)return false;
	}
	return true;
}
bool chesuf(int x){
	x=n-x;
	for(auto i:v[x]){
		int j=x/i;
		if(Z2[j]+j>=x)return false;
	}
	return true;
}
bool checkallsame(){
	for(int i=1;i<n;i++)if(s[i]!=s[0])return true;
	return false;
}
int main(){
	scanf("%s",s),n=strlen(s);
	ural(),fact();
	Zalgo(Z1),reverse(s,s+n),Zalgo(Z2);
	if(!checkallsame()){printf("%d\n1\n",n);return 0;}
	if(chepre(n)){printf("1\n1\n");return 0;}
	puts("2");
	for(int i=1;i<n;i++)res+=(chepre(i)&&chesuf(i));
	printf("%d\n",res);
	return 0;
} 

Measured memory_bytes: 36224
n,W = map(int,input().split())
w = [0]*n
v = [0]*n
for i in range(n): w[i],v[i] = map(int,input().split())
mv = sum(v)
dp = [[float("INF")]*(mv+1) for _ in range(n+1)]
dp[0][0] = 0
for i in range(n):
    for s in range(mv+1):
        if s - v[i] < 0: dp[i+1][s] = dp[i][s]
        else: dp[i+1][s] = min(dp[i][s], dp[i][s-v[i]] + w[i])
ans = 0
for x in range(1,mv+1):
    if dp[n][x] <= W: ans = x
print(ans)

Measured memory_bytes: 308168
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
using namespace std;
#define MOD 1000000007
#define INF 1<<30
#define LINF (ll)1<<62
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(ll i=(a); i<(b); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> P;
typedef vector<pair<ll, ll>> vpl;

int main(){
    ll n; cin >> n;
    string s; cin >> s;
    ll k; cin >> k; k--;
    char a;

    rep(i,n) if(i == k) a = s[i];
    rep(i,n) if(s[i] != a) s[i] = '*';
    cout << s << endl;
}

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

using namespace std;

#define INF (1ll << 62)
#define pb push_back
#define ii pair<int,int>
#define OK cerr <<"OK"<< endl
#define debug(x) cerr << #x " = " << (x) << endl
#define ff first
#define ss second
#define int long long
#define tt tuple<int, int, int>
#define endl '\n'

signed main () {
  
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

  int n, k;

  cin >> n >> k;

  vector<int> dp(n + 1);
  vector<int> arr(n + 1);

  for(int i = 1; i <= n; i++) {
  	cin >> arr[i];
  }

  for(int i = 2; i <= n; i++) {
  	dp[i] = INF;
  	for(int j = 1; j <= k; j++) {
  		if(i - j >= 1) {
  			dp[i] = min(dp[i], abs(arr[i] - arr[i - j]) + dp[i - j]);
  		} else {
  			break;
  		}
  	}
  }

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

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
using namespace std;
int main(void){
	int num;
	double w,h;
	while(scanf("%d,%lf,%lf",&num,&w,&h) != EOF){
		if(w/(h*h)>=25.0) cout << num << "\n";
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <list>
#include <utility>
#include <tuple>
#include <cstdio>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <cmath>
#include <limits>
#include <iomanip>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
using namespace std;
const long long INF = 1LL << 60;
typedef long long ll;
int main() {
    string S;
    cin >> S;
    vector<char> vec(S.size());
    for(int i=0;i<S.size();i++){
        vec[i]=S[i];
    }
    int cnt=0;
    for(int i=1;i<S.size();i++){
        if( (vec[i-1-cnt]=='0'&&vec[i-cnt]=='1')||(vec[i-1-cnt]=='1'&&vec[i-cnt]=='0')){
            vec.erase(vec.begin() +(i-cnt));
            vec.erase(vec.begin() +(i-1-cnt));
            cnt+=2;
        }
    }
    cout << cnt << endl;
}

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

using namespace std;

int n, at[20], ta;
vector< int > v[20];
long long ans;

int main() {
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		scanf("%d", &ta);
		for (int j = 0; j < 20; j++)
			if (ta & (1 << j))
				v[j].push_back(i);
	}
	for (int i = 0; i < 20; i++) {
		v[i].push_back(INT_MAX);
		v[i].push_back(INT_MAX);
	}
	for (int i = 0; i < n; i++) {
		ta = n;
		for (int j = 0; j < 20; j++) {
			ta = min(ta, v[j][at[j] + 1]);
			if (v[j][at[j]] == i)
				at[j]++;
		}
		ans += ta - i;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 8256
import java.util.*;

public class Main {
    public static void main(String args[]) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] a = new int[N];
        HashMap<Integer, Integer> count = new HashMap<>();
        for (int i = 0; i < N; i++) {
            a[i] = scanner.nextInt();
            int c = count.getOrDefault(a[i], 0);
            count.put(a[i], ++c);
        }
        long allpair = 0;
        for (int i : count.values()) {
            if (i > 0) {
                allpair += (long) i * ((long) i - 1) / 2;
            }
        }
        for (int i = 0; i < N; i++) {
            int num = a[i];
            long ans = allpair;
            if (count.get(num) > 1) {
                ans -= (count.get(num) - 1);
            }
            System.out.println(ans);
        }
    }
}

Measured memory_bytes: 106348
#include<iostream>
using namespace std;
int main(){

    int k;
    int a,b;
    cin>>k>>a>>b;
    int qa,ra,qb,rb;
    qa=a/k;
    ra=a%k;
    qb=b/k;
    rb=b%k;
    if(ra==0||rb==0){
        cout<<"OK";
    }
    else if(qb-qa>0){
        cout<<"OK";
    }
    else
        cout<<"NG";


}


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

int main() {
int n,k,ar[100000];
cin>>n>>k;
for(int i=0;i<n;i++)cin>>ar[i];
sort(ar,ar+n);
int sum=0;
for(int i=0;i<min(k,n);i++)sum+=ar[i];
cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 3608
import java.util.*;

public class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    
    int N = sc.nextInt();
    int R = sc.nextInt();
    int ans = R;
    if ( N < 10 ) {
      ans += 100 * (10 - N);
    }
    System.out.printf("%d", ans) ;
    sc.close();
  }
}

Measured memory_bytes: 25300
N = int(input())
A = []
ans = 0
for i in range(0, N):
    A.append(int(input()))
    ans += A[i]
A.sort()
if (ans % 10) != 0:
    print(ans)
else:
    s = [a for a in A if a % 10 != 0]
    if len(s) == 0:
        print(0)
    else:
        print(ans-s[0])


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

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define RREP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();++i)
#define LET(x,a) __typeof(a) x(a)
//#define IFOR(i,it,c) for(__typeof((c).begin())it=(c).begin();it!=(c).end();++it,++i)
#define ALL(c) (c).begin(), (c).end()
#define MP make_pair

#define EXIST(e,s) ((s).find(e)!=(s).end())

#define RESET(a) memset((a),0,sizeof(a))
#define SET(a) memset((a),-1,sizeof(a))
#define PB push_back
#define DEC(it,command) __typeof(command) it=command

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define debug2(x) cerr << #x << " = [";REP(__ind,(x).size()){cerr << (x)[__ind] << ", ";}cerr << "] (L" << __LINE__ << ")" << endl;

const int INF=0x3f3f3f3f;

typedef long long Int;
typedef unsigned long long uInt;
typedef long double rn;

typedef pair<int,int> pii;

/*
#ifdef MYDEBUG
#include"debug.h"
#include"print.h"
#endif
*/
// }}}

int N,D,Q;
int d[500010];
Int length[500010];
bool ans[500010];

int main(){
	cin>>N>>D;
	REP(i,N)cin>>d[i];
	length[N] = 1;
	for(int i=N-1;i>=0;i--){
		if(length[i+1]*2>d[i])length[i] = length[i+1] + d[i];
		else length[i] = length[i+1];
	}
	Int x = D;
	REP(i,N){
		if(x>=length[i+1]){
			ans[i] = true;
		}else{
			ans[i] = false;
		}
		Int x2 = abs(x-d[i]);
		if(x2<x)x = x2;
	}
	cin>>Q;
	REP(i,Q){
		int q;
		cin>>q;q--;
		if(ans[q]){
			cout<<"YES"<<endl;
		}else{
			cout<<"NO"<<endl;
		}
	}
	
	return 0;
}


Measured memory_bytes: 8320
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

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

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

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

using MIte = multimap<ll, ll, greater<ll> >::iterator;

ll dp[3001][3001] = { 0 };

//1959
int main() {
//	ios_base::sync_with_stdio(false);
//	cin.tie(0);
//	cout.tie(0);

	// long long?
	string s,t;
	cin >> s >> t;

	for (int i = 0; i != s.length(); ++i) {
		for (int j = 0; j != t.length(); ++j) {
			if (s[i] == t[j]) {
				dp[i + 1][j + 1] = dp[i][j] + 1;
			}
			else {
				dp[i + 1][j + 1] = max(dp[i + 1][j], dp[i][j + 1]);
			}
		}
	}

	int idx1 = s.length();
	int idx2 = t.length();
	string str = "";
	while (1) {
		if (dp[idx1][idx2] == dp[idx1 - 1][idx2]) {
			idx1--;
		}
		else if (dp[idx1][idx2] == dp[idx1][idx2 - 1]) {
			idx2--;
		}
		else {
			str = s[idx1 - 1] + str;
			idx1--;
			idx2--;
		}

		if (idx1 <= 0 || idx2 <= 0) {
			break;
		}
	}

	cout << str << endl;

	return 0;
}


Measured memory_bytes: 70656
n,m=map(int,input().split())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
l=a[0]//2
ll=a[0]
for i in range(1,n):
  if a[i]%2:odd=True
  else:even=True
  l=lcm(l,a[i]//2)
  ll=lcm(ll,a[i])
  if l>m:print(0);exit()
for i in range(n):
  if l%a[i]==0:print(0);exit()
print((m-l)//ll+1)

Measured memory_bytes: 14484
n = int(input())
s = input()
ans = 0

def can_made(string, num):
    flag = False
    start_ind = string.find(num[0])
    if start_ind >= 0:
        second_str = string[start_ind+1::]
        second_ind = second_str.find(num[1])
        if second_ind >= 0:
            third_str = second_str[second_ind+1::]
            if third_str.find(num[2]) >= 0:
                flag = True
    #if flag: print(second_ind, num)
    return flag


for i in range(1000):
    num = str(i).zfill(3)
    if can_made(s, num): ans += 1
print(ans)


Measured memory_bytes: 42352
b = input()
let = 'ATGC'
prev = b[0]
high = 0
leng = 0
stop = False

if prev in let:
    leng = 1
    high = 1
    
for i in range(1,len(b)):
    if leng == 0 and b[i] in let:
        leng = 1
    if b[i] in let and prev in let:
        leng += 1
        stop = False
    else:
        stop = True
        if leng > high:
            high = leng
            leng = 0
    prev = b[i]
    
if not stop:
    if leng > high:
        high = leng
    
print(high)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int N=1e6+10;
int b[N],a[N],q[N],v[N];

int  gcd(int a,int b)
{
	if(b==0)
	{
		return a;
	}
	return gcd(b,a%b);
}
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	scanf("%d",&n);
	int flag1=0,flag2=0;
	unordered_map <int ,int > primes;
	for(int i=0;i<n;i++)
	{

		scanf("%d",&a[i]);
		b[i]=a[i];

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


		for(int j=2;j<=a[i]/j;j++)
		{
			int c=1;
			while(a[i]%j==0)
			{
				a[i]/=j;
				if(c)
				{
					c=0;
					primes[j]++;
					if(primes[j]>1){flag1=1;break;}
				}

			}

		}
		if(a[i]>1)primes[a[i]]++;
		if(primes[a[i]]>1){flag1=1;break;}
	}





	for(int i=0;i<n-1;i++)
	{
		b[i+1]=gcd(b[i],b[i+1]);
		if(b[i+1]==1)
		{
			flag2=2;
			break;
		}
		//printf("%d\n",a[i+1]);
	}
	if(!flag1)puts("pairwise coprime");
	else if(flag2)puts("setwise coprime");
	else puts("not coprime");
	return 0;
}


Measured memory_bytes: 11444
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <map>
#include <queue>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;
string s;
string rbg = "rbg";
char calc(char a, char b)
{
    for(int i = 0; i < rbg.size(); i++) if(rbg[i] != a and rbg[i] != b) return rbg[i];
}
bool check(string s)
{
    char ch = s[0];
    for(int i = 0; i < s.size(); i++) if(ch != s[i]) return false;
    return true;
}
int solve()
{
    map<string, int> mp;
    queue<pair<string, int>> que;
    que.push(make_pair(s, 0));
    while(que.size())
    {
        pair<string, int> p = que.front(); que.pop();
        string target = p.first;
        int cnt = p.second;
        if(mp.count(target)) continue;
        if(check(target)) return cnt;
        mp[target] = cnt;
        int pos = 0;
        while(pos < target.size() - 1)
        {
            string next_target = target;
            char a = next_target[pos], b = next_target[pos + 1];
            if(a != b)
            {
                next_target[pos] = next_target[pos + 1] = calc(a, b);
                que.push(make_pair(next_target, cnt + 1));
            }
            pos++;
        }
    }
    return -1;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    while(cin >> s, s != "0")
    {
        int ans = solve();
        if(ans == -1) cout << "NA" << endl;
        else cout << ans << endl;
    }
    return 0;
}




Measured memory_bytes: 5248
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include<stack>
#include<sstream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<list>
#include<numeric>
#include <utility>
typedef long long ll;

#define pi 3.14159265358979323846
#define VI vector<int>
#define VLL vector<long long>
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
const ll MOD = 1e9 + 7;
using namespace std;
template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}

template<typename T>
T binarysearch(vector<T> A, T key) {
	ll left = 0;ll right = 4;ll mid;
	while (left < right) {
		mid = (left + right) / 2;
		if (key == A[mid]) return 1;
		if (key > A[mid]) left = mid + 1;
		else if (key < A[mid]) right = mid;
	}
	return 0;
}

template<typename T>
T finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) { // 発見できたとき
		return 1;
	}
	else { // 発見できなかったとき
		return 0;
	}
}
ll frac(ll n)//階乗
{
	if (n == 0) {
		return 1;
	}
	return (n * frac(n - 1)) % MOD;
}

template<typename T>
T keta(T a) {
	ll kazu = 1;
	while (1) {
		if (a / 10 != 0) { a /= 10;kazu++; }
		else break;
	}
	return kazu;
}//桁数


template<typename T>
T nCr(ll n, T r) {
	ll ans = 1;
	for (int i = n; i > n - r; --i) {
		ans = ans * i;
	}
	for (int i = 1; i < r + 1; ++i) {
		ans = ans / i;
	}
	return ans;
}
/*char r[4];
int yaju[4];
char op[3];
int sum = 0;
scanf("%s", r);
for (int i = 0;i < 4;i++) {
	yaju[i] = r[i] - '0';
}
*///map < string, ll> s;

/*i++ずつずらす
a[0] a[1] a[2]//a[1] a[2] a[3]
a[0] a[2] a[4]//a[1] a[3] a[5]
/*if (N % 2 != 0)a = N / 2;
else a = N / 2 - 1;
for (int i = 1;i <= a;i++) {
	for (int j = 0;j < N - (i * 2);j++) {
		if (S[j] != S[j + i] && S[j + i * 2] != S[j] && S[j + i] != S[j + i * 2]) sum--;
		if (sum == 0)break;
	}
}*/

//mapの使い方
/*map<int, int> mp;
for (int i = 0; i < N; i++)
	mp[a[i]]++;

int ans = 0;
for (auto p : mp) {
	int x = p.first;
	int n = p.second;
	if (n < x) ans += n;
	else ans += n - x;
}*/

int main() {
	ll x;
	cin>>x;
	cout << std::fixed << std::setprecision(12) << ((double)x/3)*((double)x/3)*((double)x/3)<< endl;
}

Measured memory_bytes: 3776
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
    vector<int> v;
    for(int i = 0; i < 3; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.begin(), v.end());
    string str;
    for(int i = 0; i < 3; i++) {
        str += to_string(v[i]);
        str += " ";
    }
    str.pop_back();
    cout << str << endl;
}

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

using namespace std;

typedef long long int ll;

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

  int n;
  cin >> n;
  int a = n % 10;
  if(n % 10 == 3){
    cout << "bon" << '\n';
  }else if(n % 10 == 0 || a == 1 || a == 6 || a == 8) cout << "pon\n";
  else cout << "hon\n";
}


Measured memory_bytes: 3668
function Main(input) {
	var n = input.split(' ');
	var c = 0;
	for(var i=0; i<3; i++){
		n[i] = parseInt(n[i], 10);
	}
	if(n[0] == n[1]){
		c++;
	}
	if(n[1] == n[2]){
		c++;
	}
	if(n[2] == n[0]){
		c++;
	}
	if(c == 1){
		console.log('Yes');
	}else{
		console.log('No');
	}
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


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


int main() {

    int a, b, c, d;
    cin >> a >> b >> c >> d;
    if (abs(a-c) <= d || abs(a-b) <= d && abs(b-c) <= d) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
    return 0;
}

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

int main() {
    
    int N;
    string s;
    
    int n = 0;
    int n_max = 0;
    
    cin >> N;
    cin >> s;
    
    for ( int i = 0; i < N; i++ ) {
        if ( s.substr( i, 1 ) == "I" ) { n++; }
        else { n--; }
        
        n_max = max( n, n_max );
    }
    
    
    
    cout << n_max << endl;
    
    
    
    return 0;
}

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

int main() {
  int n;cin>>n;
  vector<string> s(n);
  vector<int> vec(4);
  rep(i,n)cin>>s[i];
  rep(i,n){
    if(s[i]=="AC")vec[0]++;
    else if(s[i]=="WA")vec[1]++;
    else if(s[i]=="TLE")vec[2]++;
    else vec[3]++;
  }
  cout<<"AC x "<<vec[0]<<endl;
  cout<<"WA x "<<vec[1]<<endl;
  cout<<"TLE x "<<vec[2]<<endl;
  cout<<"RE x "<<vec[3]<<endl;
}

Measured memory_bytes: 6344
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither long longo the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const long long inf=0x3f3f3f3f;
const double eps=1e-6;
const long long mod=1000000007;
typedef long long ll;
inline string getstr(string &s,long long l,long long r){string ret="";for(long long i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
long long modpow(long long x,long long y,long long md=mod){long long ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline long long Rand(){return rand()*32768+rand();}
long long n,k,s,t;
long long a[55];
long long c[55][55];
vector<long long>g1[20],g0[20];
long long num[55],ban[55];
long long calc(long long x,long long y){
	if(y>x)return 1ll<<x;
	else{
		long long ret=0;
		for(long long i=0;i<=y;i++)ret+=c[x][i];
		return ret;
	}
}
long long func(long long mask){
	map<long long,long long>mp;
	long long sum=0;
	for(long long i=1;i<=n;i++)if(!ban[i]){
		mp[a[i]&mask]++;sum++;
	}
	long long ans=0;
	for(auto p:mp){
		ans+=calc(p.second,k)-1;
	}
	ans++;
//	cerr<<"return: "<<mask<<" "<<ans<<endl;
	return ans;
}
signed main(){
	string s;cin>>s;cout<<s[0]<<s[1]<<s[2]<<endl;
  	return 0;
}

Measured memory_bytes: 3596
import sys
input = sys.stdin.readline
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from fractions import *
def print_ans(N, a_list):
    """Test Case
    >>> print_ans(3, [0, 7, 6, 8, 0])
    2
    >>> print_ans(3, [0, 12, 15, 18, 0])
    6
    >>> print_ans(2, [0, 1000000000, 1000000000,0])
    1000000000
    """
    l_list = [0 for _ in range(N + 2)]
    r_list = [0 for _ in range(N + 2)]
    for i in range(1, N + 1):
        l_list[i] = gcd(l_list[i-1], a_list[i])
    for i in range(N, 0, -1):
            r_list[i] = gcd(r_list[i + 1], a_list[i])
    m_list = [0 for _ in range(N + 1)]
    for i in range(1, N + 1):
        m_list[i] = gcd(l_list[i - 1],r_list[i+ 1])
    print(max(m_list))

if __name__ == '__main__':
    N = int(input().rstrip())
    a_list = [0] + list(map(int, input().rstrip().split())) + [0]
    print_ans(N, a_list)


Measured memory_bytes: 16100
#include <iostream>
#include <vector>
#include <algorithm>
#define llint long long

using namespace std;

llint n, W;
llint w[105], v[105];
vector<llint> vec[4], sum[4];

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

  cin >> n >> W;
  for(int i = 1; i <= n; i++) cin >> w[i] >> v[i];
  for(int i = 1; i <= n; i++){
    vec[w[i]-w[1]].push_back(v[i]);
  }
  for(int i = 0; i < 4; i++){
    sort(vec[i].rbegin(), vec[i].rend());
    llint s = 0;
    sum[i].push_back(0);
    for(int j = 0; j < vec[i].size(); j++){
      s += vec[i][j];
      sum[i].push_back(s);
    }
  }

  llint ans = 0;
  for(int i = 0; i <= vec[0].size(); i++){
    for(int j = 0; j <= vec[1].size(); j++){
      for(int k = 0; k <= vec[2].size(); k++){
        for(int l = 0; l <= vec[3].size(); l++){
          if(w[1]*i+(w[1]+1)*j+(w[1]+2)*k+(w[1]+3)*l > W) continue;
          ans = max(ans, sum[0][i]+sum[1][j]+sum[2][k]+sum[3][l]);
        }
      }
    }
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
/* package codechef; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;

/* Name of the class has to be "Main" only if the class is public. */
public class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
		// your code goes here
		Scanner sc=new Scanner(System.in);
		int n=sc.nextInt();
		int k=sc.nextInt();
		int a[]=new int[n];
		for(int i=0;i<n;i++){
		    a[i]=sc.nextInt();
		}
		int dp[]=new int[k+1];
		Arrays.fill(dp,2);
		for(int i=1;i<=k;i++){
		    for(int j=0;j<n;j++){
		        if(a[j]>i) continue;
		        
		        if(dp[i-a[j]]==2)
		        dp[i]=1;
		    }
		}
		String ans= dp[k]==1 ? "First":"Second";
		System.out.println(ans);
	}
}


Measured memory_bytes: 22484
n = int(input())
a=[0] * (n+1)
b=[0] * (n+1)
c=[0] * (n+1)
aux = [ [0] * 5 for _ in range(n+1)]

for i in range(1,n+1):
    a[i],b[i],c[i] = input().split()

a = [int(i) for i in a]
b = [int(i) for i in b]
c = [int(i) for i in c]

aux[1][1]=a[1]
aux[1][2]=b[1]
aux[1][3]=c[1]



for i in range(2,n+1):
    aux[i][1]+=max(aux[i-1][2],aux[i-1][3])+a[i]
    aux[i][2]+=max(aux[i-1][1],aux[i-1][3])+b[i]
    aux[i][3]+=max(aux[i-1][1],aux[i-1][2])+c[i]

print(max(aux[n][1],aux[n][2],aux[n][3]))

Measured memory_bytes: 45352
/*
 * ID: ITP1_5_C 
 * Problem: draw checkerboad
 */

#include <stdio.h>

int main(void)
{
    int height, width;
    int i, j;

    while (1) {
        scanf("%d %d", &height, &width);
        if (height == 0 && width == 0)
            return 0;

        for (i = 0; i < height; i++) {
            for (j = 0; j < width; j++)
                printf("%c", (i + j) % 2 ? '.' : '#');
            printf("\n");
        }
        printf("\n");
    }
    return 0;
}



Measured memory_bytes: 2048
#include <stdio.h>
 
int main(void)
{
    char op[20000];
    int a[20000], b[20000];
    int i, j;
    
    for(i=0; i<20000; i++){
        scanf("%d %c %d", &a[i], &op[i], &b[i]);
        if(op[i]=='\?'){
            break;
        }
    }
    
    for(j=0; j<i; j++){
        switch(op[j]){
            case '+':
            printf("%d\n", a[j]+b[j]);
            break;
            case '-':
            printf("%d\n", a[j]-b[j]);
            break;
            case '*':
            printf("%d\n", a[j]*b[j]);
            break;
            case '/':
            printf("%d\n", a[j]/b[j]);
            break;
        }
    }
    
    return 0;
}

Measured memory_bytes: 616
#include<stdio.h>
int main()
{
    int a,b,c,sum=0;
    scanf("%d%d%d",&a,&b,&c);
    if(a>=b)
    {
        sum=b;
        if(a>=c)
            sum+=c;
        else
            sum+=a;
    }
    else
    {
        sum=a;
        if(b>=c)
            sum+=c;
        else
            sum+=b;
    }
    if(b>=c)
    {
        sum=c;
        if(b>=a)
            sum+=a;
        else
            sum+=b;
    }
    else
    {
        sum=b;
        if(c>=a)
            sum+=a;
        else
            sum+=c;
    }
    if(a>=c)
    {
        sum=c;
        if(a>=b)
            sum+=b;
        else
            sum+=a;
    }
    else
    {
        sum=a;
        if(c>=b)
            sum+=b;
        else
            sum+=c;
    }
    printf("%d\n",sum);
    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_ll = pair<ll, ll>;
int main() {
	int A, B, C; cin >> A >> B >> C;
	if ((C >= A && C <= B) || (C >= B && C <= A))yes;
	else no;
	cin >> A;
}

Measured memory_bytes: 256
n = int(input())
s = input()
list = [c  for c in s]

if len(list) % 2 == 0:
    l = int(len(list)/2)
else:
    l= int((len(list)+1)/2)

harf = list[:l]

if list == harf + harf:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll n,b=0,a=0,c=100000000000000000;
  cin>>n;
  ll v[n];
  for(ll i=0;i<n;i++){
    cin>>v[i];
    b+=v[i];
  }
  for(ll i=0;i<n-1;i++){
    a+=v[i];
    b-=v[i];
    c=min(c,abs(a-b));
  }
  cout<<c<<endl;
}

Measured memory_bytes: 1792