akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

const int MAXN = 1005;
const int MAXV = MAXN * (MAXN - 1) / 2;
vector<int> to[MAXV];
int id[MAXN][MAXN];
int toId(int i, int j) {
    if(i > j) {
        swap(i, j);
    }
    return id[i][j];
}
int n;

//メモ化再帰
bool visited[MAXV];
bool calculated[MAXV];
int dp[MAXV];
int dfs(int v) {
    if(visited[v]) {
        //既に計算済み
        if(!calculated[v]) {
            return -1;
        }
        return dp[v];
    }
    visited[v] = true;
    dp[v] = 1;
    for(int u : to[v]) {
        int res = dfs(u);
        if(res == -1) {
            return -1;
        }
        dp[v] = max(dp[v], res + 1);
    }
    calculated[v] = true;
    return dp[v];
}
int main() {
    cin >> n;
    vector<vector<int>> a(n, vector<int>(n - 1));
    REP(i, n) {
        REP(j, n - 1) {
            cin >> a[i][j];
            a[i][j]--;
        }
    }
    //頂点の数
    int V = 0;
    REP(i, n) {
        REP(j, n) {
            if(i < j) {
                id[i][j] = V++;
            }
        }
    }
    REP(i, n) {
        REP(j, n - 1) { a[i][j] = toId(i, a[i][j]); }
        REP(j, n - 2) {
            //逆向きに辺をはる
            to[a[i][j + 1]].push_back(a[i][j]);
        }
    }
    int ans = 0;
    REP(i, V) {
        int res = dfs(i);
        if(res == -1) {
            puts("-1");
            return 0;
        }
        ans = max(ans, res);
    }
    cout << ans << endl;
    return 0;
}

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

const long long INF = 1000000000;

typedef long long ll;

#define writeln(n) cout<<n<<"\n"
#define rep(i,n) for(int i=0; i<(n); ++i)

typedef pair<int, int> P;
typedef pair<string, int> Psi;



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

	int n,m;cin>>n>>m;

	ll kaisuu = 1LL<<m;

	ll times = 1900*m+100*(n-m);

	cout<<times*kaisuu<<endl;




}


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

int main(){
	const int nmax = 21;
	int route[nmax][nmax];
	int n;
	int m;
	int a, b, c, d;
	int x1, x2, y1, y2;
	char ch;
	int cost1, cost2;
	cin >> n >> m;
	for(int i = 0; i < nmax; i++){
		for(int j = 0; j < nmax; j++){
			route[i][j] = -1;
		}
	}
	for(int i = 0; i < m; i++){
		cin >> a >> ch >> b >> ch >> c >> ch >> d;
		route[a][b] = c;
		route[b][a] = d;
	}
	for(int i = 1; i < nmax; i++){
		for(int j = 1; j < nmax; j++){
			if(route[j][i] != -1)
				for(int k = 1; k < nmax; k++)
					if(route[i][k] != -1)
						if(route[j][k] == -1 || (route[j][i] + route[i][k] < route[j][k]))
							route[j][k] = route[j][i] + route[i][k];
		}
	}
	cin >> x1 >> ch >> x2 >> ch >> y1 >> ch >> y2;
	cost1 = route[x1][x2];
	cost2 = route[x2][x1];
	cout << y1 - y2 - cost1 - cost2 << endl;
	return 0;
}

Measured memory_bytes: 0
s = list(input())
t = list(input())

ans = 0
for i in range(len(s) - len(t) + 1):
    cnt = 0
    for j in range(len(t)):
        if s[i + j] == t[j]:
            cnt += 1
            
    ans = max(ans, cnt)

print(len(t) - ans)


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

int main(void){
    int n;
    cin >> n;
    vector<int> A(n);
    for(int i=0;i<n;i++){
        cin >> A[i];
    }
    int ans=0;
    while(1){
        for(int i=0;i<n;i++){
            if(A[i]%2){
                cout << ans << endl;
                exit(0);
            }
            A[i] /= 2;
        }
        ans++;
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
typedef long long ll;
using namespace  std;
const ll INF = 1e18;
const ll MOD = 1000000007;
const int N = 101;
ll n , A[N],ans;


int main(){
    fastIO;
    cin>>n;
    for(int i = 1 ; i<=n ; i++)cin>>A[i];
    for(int i = 1 ; i<=n ; i++){
        for(int j = i+1 ; j<=n ; j++){
            for(int k = j+1 ; k<=n ; k++){
                set<int> st;
                st.insert(A[i]),st.insert(A[j]),st.insert(A[k]);
                if(st.size()==3 && A[i]+A[j]>A[k] && A[i]+A[k]>A[j] && A[k]+A[j]>A[i]){
                    ans++;
                }
            }
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3592
import java.io.*;
import java.util.*;

public class Main {
	static final int MOD = (int)1e9+7;

	public static void main(String[] args){
		FastScanner sc = new FastScanner(System.in);
		PrintWriter out = new PrintWriter(System.out);

		solve(sc,out);

		out.flush();
	}

	public static void solve(FastScanner sc, PrintWriter out) {
		int n = sc.nextInt();
		
		int[] a = sc.nextIntArray(n*2);
		
		Arrays.sort(a);
		
		int res = 0;
		
		for(int i = 0; i < n*2; i+=2) {
			res+=a[i];
		}
		
		out.println(res);
	}

	public static long gcd(long a, long b) {
		if(a < b) return gcd(b, a);
		if(b == 0) return a;
		return gcd(b, a % b);
	}

	public static long lcm(long a, long b) {
		return a / gcd(a, b) * b;
	}

	public static long factorial(int n) {
		long a;

		if(n > 0) {
			a = n * factorial(n - 1);
		}else{
			a = 1;
		}

		return a;
	}
}

class Pair<K, V> extends AbstractMap.SimpleEntry<K, V> {

    public Pair(K key, V value) {
        super(key, value);
    }

    public Pair<V, K> swap() {
    	return new Pair<V, K>(getValue(), getKey());
    }
 }

class UnionFind {
	int[] par;

	public UnionFind(int n) {
		par = new int[n];

		Arrays.fill(par, -1);
	}

	int root(int x) {
		if(par[x] < 0) return x;
		return par[x] = root(par[x]);
	}

	boolean unite(int x,int y) {
		x = root(x);
		y = root(y);

		if(x == y) return false;

		if(size(x) < size(y)) {
			int tmp = x;
			x = y;
			y = tmp;
		}

		par[x] += par[y];
		par[y] = x;

		return true;
	}

	boolean same(int x,int y) {
		int rx = root(x);
		int ry = root(y);
		return rx == ry;
	}

	int size(int a) {
		return -par[root(a)];
	}
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;

    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }

        return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }

    public int nextInt() {
        return Integer.parseInt(next());
    }

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

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++)
            a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++)
            a[i] = nextLong();
        return a;
    }
}

Measured memory_bytes: 20692
R,G,B,N = map(int,input().split())
ans = 0
for r in range(N+1):
    if r*R > N: break
    for g in range(N+1):
        if r*R + g*G > N: break
        rem = N - r*R - g*G
        if rem%B == 0:
            ans += 1
print(ans)

Measured memory_bytes: 40684
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int n = stdIn.nextInt();
        int[] a = new int[4];
        for(int i = 0 ; i < 4; i++){
            a[i] = n % 10;
            n /= 10;
        }
        System.out.println((a[0] == a[1] || a[1] == a[2] || a[2] == a[3]) ? "Bad" : "Good");
    }
}

Measured memory_bytes: 22612
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
    int N,K; cin>>N>>K;
    char D[K]; REP(i,K) cin>>D[i];
    int ans = N;
    while (true) {
        string tmp = to_string(ans);
        bool flag = true;
        REP(i,tmp.size()) {
            REP(j,K) {
                if (tmp[i]==D[j]) {
                    flag = false;
                    break;
                }
            }
            if (!flag) break;
        }
        if (!flag) ans++;
        else break;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
def main():
  def update(k,x):
    k+=N0-1
    data_min[k]=data_max[k]=x
    while k>=0:
      k=(k-1)//2
      a,b=data_min[2*k+1],data_min[2*k+2]
      data_min[k]=a if a<b else b
      a,b=data_max[2*k+1],data_max[2*k+2]
      data_max[k]=a if a>b else b
  def query_min(l,r):
    L,R=l+N0,r+N0
    s=INF
    while L<R:
      if R&1:
        R-=1
        t=data_min[R-1]
        if t<s:s=t
      if L&1:
        t=data_min[L-1]
        if t<s:s=t
        L+=1
      L//=2
      R//=2
    return s
  def query_max(l,r):
    L,R=l+N0,r+N0
    s=0
    while L<R:
      if R&1:
        R-=1
        t=data_max[R-1]
        if t>s:s=t
      if L&1:
        t=data_max[L-1]
        if t>s:s=t
        L+=1
      L//=2
      R//=2
    return s
  def root(x):
    while table[x]>=0:x=table[x]
    return x
  def unite(x,y):
    x=root(x)
    y=root(y)
    if x!=y:
      if table[x]>table[y]:x,y=y,x
      table[x]+=table[y]
      table[y]=x
  def same(x,y):return root(x)==root(y)
  def size(x):return-table[root(x)]
  n,k,*p=map(int,open(0).read().split())
  N0=2**(n-1).bit_length()
  INF=10**18
  data_min=[INF]*2*N0
  data_max=[0]*2*N0
  table=[-1]*n
  c=[0]
  for a,b in zip(p,p[1:]):c+=c[-1]+(a<b),
  *c,f=[b-a==k-1for a,b in zip(c,c[k-1:])]
  x=not f
  for i,q in enumerate(p):update(i,q)
  for i,(a,b,c)in enumerate(zip(p,p[k:],c)):
    f|=c
    if not c and(a!=query_min(i,i+k)or b!=query_max(i+1,i+k+1)):x+=1
  print(x+f)
main()

Measured memory_bytes: 103356
/* include c++ libraries */
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <queue>
#include <set>

/* include c-lang libraries */
#include <climits>
#include <cmath>

/* include my libraries */
//#include <show_vec.hh>


#define DEBUG if(false)

using namespace std;

void drop_num_in_vec(vector<int> &v, int a){
  int size = v.size();
  int left = 0, center = size / 2, right = size-1;
  while(true){
    if(v[center] == a){
      v.erase(v.begin()+center);
      break;
    }
    if(v[center] > a){
      right = center-1;
      center = (left + right)/2;
    }
    if(v[center] < a){
      left = center+1;
      center = (left + right)/2;
    }
  }
}

int main(){
  int N, M;
  cin >> N >> M;
  vector<vector<int>> A(N);
  vector<int> Mark_to(N, -1);
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    A[a-1].push_back(b-1);
    A[b-1].push_back(a-1);
  }
  for(int i = 0; i < N; i++){
    sort(A[i].begin(), A[i].end());
  }

  queue<int> que;
  que.push(0);
  while(que.size() > 0){
    int curr = que.front();
    que.pop();
    for(int i = 0; i < A[curr].size(); i++){

      int next = A[curr][i];
      //printf("curr : %d\n", curr);
      //printf("next : %d\n\n", next);
      if(0 != A[next].size() && Mark_to[next] == -1){
        Mark_to[next] = curr+1;
        que.push(next);
        //printf("Marck : %d -> %d\n", next+1, curr+1);
        // drop in A
        drop_num_in_vec(A[next], curr);
      }
    }
    A[curr].resize(0);
  }

  bool boolean = true;
  for(int i = 1; i < N; i++){
    if(Mark_to[i] == -1){
      boolean = false;
      break;
    }
  }
  if(boolean){
    cout << "Yes" << endl;
    for(int i = 1; i < N; i++){
      cout << Mark_to[i] << endl;
    }
  }else{
    cout << "No" << endl;
  }


  return 0;
}


Measured memory_bytes: 10248
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
using namespace std;
int num[30];

void func(int,int,int);

int main(){
  int n;
  while(cin>>num[0],num[0]){
    n=num[0];
    for(int i=n;i>0;i--){
      func(0,i,n-i);
    }
    memset(num,0,sizeof(num));
  }
  return 0;
}

void func(int l,int m,int n){
  if(n==0){
    for(int i=0;i<l;i++){
      printf("%d ",num[i]);
    }
    printf("%d\n",m);
  }
  
  else{
    num[l]=m;
    for(int i=n;i>0;i--){
      if(i<=num[l]){
        func(l+1,i,n-i);
      }
    }
  }
}

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

#ifndef LOCAL_
#define fprintf if( false ) fprintf
#endif // LOCAL_
#define dumpi(x1) fprintf(stderr, "#%s.%d (%s) = (%d)\n", __func__, __LINE__, #x1, x1);
#define dumpii(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%d, %d)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpiii(x1, x2, x3) fprintf(stderr, "#%s.%d (%s, %s, %s) = (%d, %d, %d)\n", __func__, __LINE__, #x1, #x2, #x3, x1, x2, x3);
#define dumpl(x1) fprintf(stderr, "#%s.%d (%s) = (%ld)\n", __func__, __LINE__, #x1, x1);
#define dumpll(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%ld, %ld)\n", __func__, __LINE__, #x1, #x2, x1, x2);
#define dumpd(x1) fprintf(stderr, "#%s.%d (%s) = (%lf)\n", __func__, __LINE__, #x1, x1);
#define dumpdd(x1, x2) fprintf(stderr, "#%s.%d (%s, %s) = (%lf, %lf)\n", __func__, __LINE__, #x1, #x2, x1, x2);

template<long P = 1000000007>
class Mod {
public:
  Mod() : a(0) {}
  Mod(long x) : a(x) {}
  long get() { return a; }
  Mod operator + (Mod x) { return Mod<P>((a + x.get()) % P); }
  Mod operator += (Mod x) { a = (a + x.get()) % P; return *this; }
  Mod operator - (Mod x) { return Mod<P>((a + P - x.get()) % P); }
  Mod operator -= (Mod x) { a = (a + P - x.a) % P; return *this; }
  Mod operator * (Mod x) { return Mod<P>((a * x.get()) % P); }
  Mod operator *= (Mod x) { a = (a * x.a) % P; return *this; }
  Mod operator / (Mod x) { return *this * pow(x, P - 2); }
  Mod operator /= (Mod x) { a = (*this * pow(x, P - 2)); return *this; }
private:
  long a;
};

template<typename T>
T pow(T x, long n) {
  T res = 1;
  T p = x;
  while( n != 0 ) {
    if( n & 0x01 ) res *= p;
    p *= p;
    n >>= 1;
  }
  return res;
}

long xs[112345];
long n;

long solve() {
  Mod<> x = 1;
  long c = 0;
  long rem = n;
  for(long i = 1; i <= n; ++i) {
    c += 1;
    if( c > (xs[i] + 1) / 2 ) {
      x = x * std::min(c, rem);
      rem -= 1;
      c -= 1;
    }
  }
  while( rem != 1 && rem != 0 ) {
    x *= rem;
    rem -= 1;
  }      
  return x.get();
}

int main() {
  scanf("%ld", &n);
  for(int i = 1; i <= n; ++i) {
    scanf("%ld", &xs[i]);
  }
  long t = solve();
  printf("%ld\n", t);  
  return 0;
}

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

template<typename T>
map<T, ll> factorize(T x) {
	map<T, ll> res;
	for (int i = 2; i * i <= x; i++) {
		while (x % i == 0) {
			x /= i;
			res[i]++;
		}
	}
	if (x != 1) res[x]++;
	return res;
}

struct mint {
	ll x;
	mint() :x(0) {}
	mint(ll x) :x((x% mod + mod) % mod) {}
	// mint(ll x):x(x){}
	mint& fix() { x = (x % mod + mod) % mod; return *this; }
	mint operator-() const { return mint(0) - *this; }
	mint operator~() const { return mint(1) / *this; }
	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) { (x *= a.pow(mod - 2).x) %= mod; return *this; }
	mint operator+(const mint& a)const { return mint(*this) += a; }
	mint operator-(const mint& a)const { return mint(*this) -= a; }
	mint operator*(const mint& a)const { return mint(*this) *= a; }
	mint operator/(const mint& a)const { return mint(*this) /= a; }
	mint pow(ll t) const {
		if (!t) return 1;
		mint res = pow(t / 2);
		res *= res;
		return (t & 1) ? res * x : res;
	}
	bool operator<(const mint& a)const { return x < a.x; }
	bool operator==(const mint& a)const { return x == a.x; }
};

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	//素因数分解
	map<ll, ll> LCM;
	rep(i, n) {
		for (auto& c : factorize(a[i])) {
			if (LCM[c.first] < c.second) {
				LCM[c.first] = c.second;
			}
		}
	}
	//そのままlcmは作れないので素因数分解してからする
	mint lcm = 1;
	for (auto& c : LCM) {
		rep(i, c.second) {
			lcm *= c.first;
		}
	}
	mint sum = 0;
	rep(i, n) {
		mint b = lcm / a[i];
		sum += b;
	}
	cout << sum.x << endl;
	return 0;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
#define INF 2147483647
#define INF_LL 9223372036854775807
#define MOD 1000000007
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;

int main() {
	ll N, A, B;
	cin >> N >> A >> B;
	vector<ll> P(N);
	for (int i = 0; i < N; i++)cin >> P[i];
	sort(P.begin(), P.end());
	vector<ll> a, b, c;
	for (int i = 0; i < N; i++) {
		if (P[i] <= A) {
			a.push_back(P[i]);
		}
		else if (A < P[i] && P[i] <= B) {
			b.push_back(P[i]);
		}
		else {
			c.push_back(P[i]);
		}
	}

	cout << min(a.size(),min(b.size(),c.size())) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
  
using namespace std;
  
#define rep(i,n) REP(i,0,n)
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define repr(i, n) REPR(i, n, 0)
#define REPR(i, s, e) for(int i=(int)(s-1); i>=(int)(e); i--)
#define pb push_back
#define all(r) r.begin(),r.end()
#define rall(r) r.rbegin(),r.rend()
#define fi first
#define se second
  
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
 
const int INF = 1e9;
const ll MOD = 1e9 + 7;
double EPS = 1e-8;

int main(){
    ll a, b, c;
    cin >> a >> b >> c;
    ll d = a + b;
    cout << b + min(d+1, c) << endl;    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            //var one = cin.ReadLine.Split(' ');
            //var A = int.Parse(one[0]);
            //var B = int.Parse(one[1]);
            //var K = int.Parse(one[2]);

            var S = cin.ReadLine;
            var zero = S.Where(x => x == '0');
            var one = S.Where(x => x == '1');
            
            int result = 0;
            if (zero.Count() - one.Count() > 0)
            {
                result = one.Count() * 2;
            }
            else
            {
                result = zero.Count() * 2;
            }
            Console.Write(result);
        }

    }
    public class deci
    {
        public bool IsFinish { get; set; } = false;
        public int Len { get; set; }
    }
    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }
        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; ++i)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }
        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}

Measured memory_bytes: 13372
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;

struct edge { ll to, cost; };
// firstは最短距離、secondは頂点の番号
ll V;
vector<edge> G[1000000LL]; ll d[1000000LL];
void dijkstra(ll s) {
	// greater<P>を指定することでfirstが小さい順に取り出せるようにする 
	priority_queue<P, vector<P>, greater<P>> que; 
	fill(d, d + V + 1, LINF);
	d[s] = 0LL;
	que.push(P(0LL, s));
	while (!que.empty()) {
		P p = que.top(); que.pop();
		ll v = p.second;
		if (d[v] < p.first) continue;
		for (ll i = 0; i < G[v].size(); i++) {
			edge e = G[v][i];
			if (d[e.to] > d[v] + e.cost) {
				d[e.to] = d[v] + e.cost;
				que.push(P(d[e.to], e.to)); 
			}
		}	 	
	}
}


int main(){
	cin>>V;
	for(int i = 0; i < V - 1; i++) {
		ll a,b,c;cin>>a>>b>>c;
		edge e;
		e.to = b;
		e.cost = c;
		G[a].pb(e);
		edge e2;
		e2.to = a;
		e2.cost = c;
		G[b].pb(e2);

	}

	ll q,k;cin>>q>>k;
	dijkstra(k);
	for(int i = 0; i < q; i++) {
		ll x,y;cin>>x>>y;
		cout << d[x] + d[y] << endl;
		
	}

	return 0;
}

Measured memory_bytes: 33904
#include<iostream>
#include<string>

using namespace std;

int main() {
  string S;
  cin >> S;

  int count = 0;
  int max = 0;
  for(int i = 0; i < S.size(); i++) {
    char enki = S[i];
    if(enki == 'A') {
      count++;
    }else if(enki == 'T'){
      count++;
    }else if(enki == 'C'){
      count++;
    }else if(enki == 'G'){
      count++;
    }else{
      if(max < count) {
        max = count;
      }
      count = 0;
    }
  }
  if(max < count) {
    max = count;
  }
  
  cout << max << endl;

  return 0;
}



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

int ave(int n, vector<int> a){
  int ans=0;
  for(int i=0;i<n;i++){
    ans += a.at(i);
  }
  double cnt = ans;
  ans /= n;
  cnt /= n;
  if(cnt - ans >= 0.5){
    ans++;
  }
  return ans;
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin >> a.at(i);
  }
  int k=ave(n,a);
  int ans =0;
  for(int i=0;i<n;i++){
    ans += (a.at(i) -k)*(a.at(i)-k);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			@SuppressWarnings("unused")
			int a = scanner.nextInt(), b = scanner.nextInt(), c = scanner.nextInt();
			int k = scanner.nextInt();
			int sum = Math.min(k, a);
			k -= Math.min(k, a);
			k -= Math.min(k, b);
			sum -= k;
			System.out.println(sum);
		}
	}
}


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

long long int countsum(long long int m){
  long long int sum=1;
  if(m==1) return 0; 
  for(long long int i=2;i*i<=m;i++){
    if(i*i==m) sum++;
    else if(m%i==0) sum+=2;
  }
  return sum;
}

bool flag(long long int n,long long int i){
  while(n%i==0) n/=i;
  if((n-1)%i==0) return true;
  else return false;
}

int main(){
  long long int n,m;
  long long sum=1;
  cin >> n;
  m=n-1;
  sum += countsum(m);
  for(long long int i=2;i*i<=n;i++){
    if(i*i==n) sum++;
    else if(n%i==0){
      if(flag(n,i)) sum++;
      if(flag(n,n-i)) sum++;
    }
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int count = 0;
    bool ans = true;

    if (s[0] != 'A') ans = false;
    for (int i=1; i<n; i++) {
        if (i>1 && i!=n-1 && s[i] == 'C') count++;
        else if (s[i]>='A' && s[i]<='Z') ans = false;
    }
    ans &= (count==1);

    cout << (ans? "AC" : "WA") << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string s;
    cin>>s;
    int n = s.size();
    string a = s.substr(0,(n-1)/2);
    string b = s.substr((n+1)/2);
    string a1 = s.substr(0,(n-1)/2);
    string b1 = s.substr((n+1)/2);
    reverse(a.begin(), a.end());
    reverse(b.begin(), b.end());
    if(((a == a1) && (b == b1))&& (a == b)){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int top, S[1000];
 
void push(int x) {
  S[++top] = x;
}
 
int pop() {
  top--;
  return S[top+1];
}
 
int main() {
  int a, b;
  top = 0;
  char s[100];
 
  while( scanf("%s", s) != EOF ) {
    if(s[0] == '+') {
      a = pop();
      b = pop();
      push(a+b);
    } else if(s[0] == '-') {
      b = pop();
      a = pop();
      push(a-b);
    } else if(s[0] == '*') {
      a = pop();
      b = pop();
      push(a*b);
    } else {
      push(atoi(s));
    }
  }
 
  printf("%d\n", pop());
 
  return 0;
}

Measured memory_bytes: 980
import math
import itertools

k = int(input())
l = list(range(1, k+1))

ans = 0

add = (0, 1, 3, 6)

for c in itertools.combinations_with_replacement(l, 3):
    ans += math.gcd(math.gcd(c[0], c[1]), c[2]) * add[len(set(c))]
    
print(ans)


Measured memory_bytes: 73820
#どっちで出すか注意, rstrip注意
#提出前に見返すこと！
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations, accumulate
    #from itertools import product
    from bisect import bisect_left,bisect_right
    import heapq
    from math import floor, ceil
    #from operator import itemgetter

    #inf = 10**17
    mod = 10**9 + 7

    d = int(input())
    if d==25:
        print('Christmas')
    elif d==24:
        print('Christmas Eve')
    elif d==23:
        print('Christmas Eve Eve')
    else:
        print('Christmas Eve Eve Eve')

if __name__ == '__main__':
    main()

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

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)round(x))<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

typedef pair<int,int> P;
typedef pair<ll,P> PP;

int N, M, S, T;
vector<P> t[2][100002];
ll dp[2][100002];
ll dp_rev[2][100002];
ll ans[100002];

void dijk() {
  memset(dp, -1, sizeof(dp));

  priority_queue<PP, vector<PP>, greater<PP>> q;
  q.push(PP(0, P(0, S)));
  q.push(PP(0, P(1, S)));

  while (!q.empty()) {
    PP p = q.top();
    q.pop();

    ll cur_cost = p.first;
    int cur_flg = p.second.first;
    int cur_pos = p.second.second;

    if (dp[cur_flg][cur_pos] != -1) {
      continue;
    }

    dp[cur_flg][cur_pos] = cur_cost;

    for (int i = 0; i < t[cur_flg][cur_pos].size(); i++) {
      P next = t[cur_flg][cur_pos][i];
      int pos = next.first;
      ll cost = next.second;
      q.push(PP(cur_cost + cost, P(cur_flg, pos)));
    }
  }
}

void dijk_rev() {
  memset(dp_rev, -1, sizeof(dp_rev));

  priority_queue<PP, vector<PP>, greater<PP>> q;
  q.push(PP(0, P(0, T)));
  q.push(PP(0, P(1, T)));

  while (!q.empty()) {
    PP p = q.top();
    q.pop();

    ll cur_cost = p.first;
    int cur_flg = p.second.first;
    int cur_pos = p.second.second;

    if (dp_rev[cur_flg][cur_pos] != -1) {
      continue;
    }

    dp_rev[cur_flg][cur_pos] = cur_cost;

    for (int i = 0; i < t[cur_flg][cur_pos].size(); i++) {
      P next = t[cur_flg][cur_pos][i];
      int pos = next.first;
      ll cost = next.second;
      q.push(PP(cur_cost + cost, P(cur_flg, pos)));
    }
  }
}

void solve() {
  dijk();
  dijk_rev();

  for (int i = N - 1; i >= 0; i--) {
    ll mn = dp[0][i]  + dp_rev[1][i];
    if (i == S) {
      mn = min(mn, dp_rev[1][i]);
    } else if (i == T) {
      mn = min(mn, dp[0][i]);
    }

    ans[i] = mn;

    if (i < N - 1) {
      ans[i] = min(ans[i], ans[i + 1]);
    }
  }

  for (int i = 0; i < N; i++) {
    cout << 1000000000000000LL - ans[i] << endl;
  }
}

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

  while (cin >> N >> M >> S >> T) {
    S--;
    T--;
    for (int i = 0; i < 2; i++) {
      for (int j = 0; j < 100002; j++) {
        t[i][j].clear();
      }
    }

    for (int i = 0; i < M; i++) {
      int U, V, A, B;
      cin >> U >> V >> A >> B;
      U--;
      V--;
      t[0][U].push_back(P(V, A));
      t[0][V].push_back(P(U, A));
      t[1][U].push_back(P(V, B));
      t[1][V].push_back(P(U, B));
    }

    solve();
  }
}


Measured memory_bytes: 28408
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<complex>
#include<iomanip>
 
#define EPS (1e-10)
using namespace std;
#define PI (3.1415926535)
 
int main(){
	double x[4], y[4];
	int n;

	cin >> n;

	while(n--){
		for(int i = 0; i < 4; i++){
			cin >> x[i] >> y[i];
		}
		double px, py, qx, qy;
		px = x[1] - x[0];
		py = y[1] - y[0];
		qx = x[3] - x[2];
		qy = y[3] - y[2];

		if(px*qy - qx*py == 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}

	return 0;
}

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


int main(void){
    vector<int>a(3);
    rep(i,3){
        int x;
        cin >> x;
        a.push_back(x);
    }
    int k;
    cin >> k;
    sort(a.begin(),a.end(),greater<int>());
    rep(i,k){
        a[0] = a[0] * 2;
    }
    int ans = 0;
    rep(i,3){
        ans += a[i];
    }
    cout << ans << endl;
    
    return 0;
}



























































Measured memory_bytes: 256
n = int(input())
hs = [int(c) for c in input().split()]
dp = [0] * n
dp[0] =  0
dp[1] = abs(hs[0] - hs[1])
for i in range(2, n):
  dp[i] = min(dp[i-1] + abs(hs[i-1] - hs[i]), dp[i-2] + abs(hs[i-2] - hs[i]))
print(dp[-1])

Measured memory_bytes: 13980
import java.util.Scanner;

public class Main {
	static Scanner sc = new Scanner(System.in);
	static int N = Integer.parseInt(sc.next());
	static int W = Integer.parseInt(sc.next());
	static int[] v = new int[N];
	static int[] w = new int[N];
	static int[] dp = new int[W+1];
	public static void main(String[] args) {
		for (int i = 0; i < N; i++) {
			v[i] = Integer.parseInt(sc.next());
			w[i] = Integer.parseInt(sc.next());
		}
		for (int i = 0; i <N; i++) {
			for (int j = W; j >= w[i]; j--) {
				dp[j] = Math.max(dp[j], dp[j-w[i]]+v[i]);
			}
		}
		System.out.println(dp[W]);
	}
}



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

int main(void){

  int buf,res=0;

  for(int i=0;i<5;i++){
    cin >> buf;
    if(buf < 40) buf = 40;
    res += buf;
  }

  res /= 5;

  cout << res << endl;
  
  return 0;
}

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

using namespace std;

int main() {
    long long int A, B, C, K;
    cin >> A >> B >> C >> K;

    if (K <= A) {
        cout << K << endl;
    } else if (K <= (A + B)) {
        cout << A << endl;
    } else {
        cout << A - (K - (A + B)) << endl;
    }
}

Measured memory_bytes: 3640
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
typedef long long ll;
const ll longinf=1LL<<60;
using namespace std;
ll n;

int main()
{
    cin >> n;
    ll ans =0;
    for (ll i=1; i<=sqrt(n)+1; ++i)
    {
        ll num = n/i -1;
        if (num<=0) continue;
        if (n/num == n%num)
            ans+=num;
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
class Matrix
  attr_reader :dimensions

  def initialize(dimensions)
    @dimensions = dimensions
  end

  def scalar_multiplication_count(other)
    # Requires that matrixes can be multiplied.
    @dimensions[0] * @dimensions[1] * other.dimensions[1]
  end
end

class MatrixesMultiplication
  def initialize(matrixes)
    # Requires that matrixes can be multiplied.
    @matrixes = matrixes
  end

  def product(start_index, end_index)
    Matrix.new([
      @matrixes[start_index].dimensions[0],
      @matrixes[end_index].dimensions[1]
    ])
  end

  def min_multiplication_count
    if @min_multiplication_count_table.nil?
      create_min_multiplication_count_table
    end
    @min_multiplication_count_table[0][@matrixes.length - 1]
  end

  private def create_min_multiplication_count_table
    @min_multiplication_count_table = (0...@matrixes.length).map do
      Array.new
    end

    (1..@matrixes.length).each do |multiply_element_count|
      part_count = @matrixes.length - multiply_element_count + 1
      (0...part_count).each do |shift_count|
        part_start_index = shift_count
        part_end_index = part_start_index + multiply_element_count - 1
        save_min_partial_multiplication_count(
          part_start_index,
          part_end_index
        )
      end
    end
  end

  private def save_min_partial_multiplication_count(start_index, end_index)
    @min_multiplication_count_table[start_index][end_index] =
      min_partial_multiplication_count(start_index, end_index)
  end

  # Requires to be called incremental arguments.
  private def min_partial_multiplication_count(start_index, end_index)
    # Abbreviation
    t = @min_multiplication_count_table

    if end_index - start_index == 0
      return 0
    end

    multiply_element_count = end_index - start_index + 1
    options = (1..(multiply_element_count - 1)).map do |left_part_element_count|
      left_part_min_count =
        t[start_index][start_index + left_part_element_count - 1]
      right_part_min_count =
        t[start_index + left_part_element_count][end_index]
      left_product =
        product(start_index, start_index + left_part_element_count - 1)
      right_product =
        product(start_index + left_part_element_count, end_index)

      left_part_min_count + right_part_min_count +
        left_product.scalar_multiplication_count(right_product)
    end

    options.min
  end
end

n = gets.chomp.to_i
matrixes = (1..n).map do
  dimensions = gets.chomp.split(' ').map(&:to_i)
  Matrix.new(dimensions)
end

min_count = MatrixesMultiplication.new(matrixes).min_multiplication_count
puts min_count



Measured memory_bytes: 6920
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ll N; cin >> N;
	
	ll tens = 1, nine = 1, eig = 1;
	for (int i = 1; i <= N; i++) {
		tens = (tens * 10) % DIV;
		nine = (nine * 9) % DIV;
		eig = (eig * 8)%DIV;
	}
	ll ans = tens - ((ll)2 * nine) % DIV + eig;
	ans += DIV;
	ans %= DIV;
	cout << ans%DIV << endl;
}

Measured memory_bytes: 3632
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <queue>
#include <map>
#include <string>
#include <vector>
#include <set>
#include <math.h>
#include <stack>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define ll long long
#define chushihua(x,y) memset(x,y,sizeof x)
using namespace std;
const int MAXX = 100000 + 10;
const double PI = 3.14159265358979323846;
const ll mod = 1000000007;
//int main() {
//	int  t;
//	string n;
//	int a[11];
//	while (cin >> n >> t) {
//		chushihua(a);
//		int len = n.length();
//		for (int i = 0; i < t; i++) {
//			int x;
//			scanf("%d", &x);
//			a[x] = 0;
//		}
//		int pos = 0;
//		for (int i = 0; i <=9; i++) {
//
//		}
//	}
//	return 0;
//}
int main() {
	string x;
	stack<char > s;
	while (cin >> x) {
		int len = x.length();
		for (int i = 0; i < len; i++) {
			if (x[i] == 'B') {
				if (!s.empty()) {
					s.pop();
				}
			}
			else {
				s.push(x[i]);
			}
		}
		char p[100];
		int pos = 0;
		while (!s.empty()) {
			p[pos++] = s.top();
			s.pop();
		}
		for (int i = pos-1; i >= 0; i--) {
			cout << p[i];
		}
		cout << endl;
	}
	return 0;
}

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

signed main(){
	string S; cin>>S;
	int N=S.size();
	bool ans=true;
	if(N%2==1)ans=false;
	for(int i=0;i<N-1;i+=2){
		if(S[i]!='h' || S [i+1]!='i'){
			ans=false; break;
		}
	}
	cout<<(ans ? "Yes" : "No")<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <list>
#include<vector>
#include <sstream>
#include <stdio.h>
#include <valarray>
#include <iomanip>
using namespace std;
vector<int> Data;


int main(void)
{
	long long int Max;
	cin >> Max;

	long long int Sum=0;

	for (long long int Target=1;Target<=Max;Target++)
	{
		if (Target%3==0)
		{
			continue;
		}

		if (Target % 5 == 0)
		{
			continue;
		}

		Sum += Target;
	}

	cout << Sum << endl;

	return 0;
}

Measured memory_bytes: 3160
def main():
    
    IN = [int(_) for _ in input().split()]
    A = [int(_) for _ in input().split()]
    N = IN[0]
    K = IN[1]

    #移動経路を記録する配列
    l = []
    l.append(1)
    #次のポータルのindexを指す変数
    nextInd = 1
    #1回遷移したかどうかを記録する配列
    mark = [False] * N
    mark[0] = True
    #ループ直前までに何回移動したかを記録する変数
    startLoopCount = 0
    #移動経路の記録、次のindexが1回行ったことがある場合に終了
    while True:
        nextInd = A[nextInd-1]
        if mark[nextInd-1]:
            startLoopCount = l.index(nextInd)
            break
        l.append(nextInd)
        mark[nextInd-1] = True
    #遷移部分とLoop部分と分ける
    move = l[0:startLoopCount]
    loop = l[startLoopCount:len(l)]

    # print(startLoopCount)
    # print(move)
    # print(loop)
    
    if K < startLoopCount:
        print(move[K])
        return
    index = (K - startLoopCount) % len(loop)
    print(loop[index])
    return

if __name__ == "__main__":
    main()


Measured memory_bytes: 32352
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
//#define ARRAY(type,n) (type *)malloc(sizeof(type)*n)
template<typename T>
T* ARRAY(int n){
	(T*)malloc(sizeof(T)*n);
}
template<typename T>
T** ARRAY2(int m,int n){
	T** type = (T**)malloc(sizeof(T*)*m);
	for(int i=0;i<m;i++){
		type[i]=(T*)malloc(sizeof(T)*n);
	}
	return type;
}

int main(void){
	int n;
	cin>>n;
	string s;
	string memo;
	cout<<0<<endl;
	cin>>memo;
	//cout<<n-1<<endl;
	//cin>>s;
	int jama;
	//if(s==memo)
	int d,u;
	d=0;
	u=n;
	if(memo=="Vacant"){
		return 0;
	}
	int now = n;
	int st=-1;
	int check = 0;
	rep(i,19){
		if(st==(d+u)/2){
			if(check==1){
				cout<<st+1<<endl;
				cin>>s;
				if(s=="Vacant"){
					return 0;
				}
			}else{
				check=1;
			}
			
			
		}
		cout<<(d+u)/2<<endl;
		st = (d+u)/2;
		cin>>s;
		if(((d+u)/2-d)%2==0){
			if(s==memo){
				d=(d+u)/2;
				memo = s;
			}else{
				u=(d+u)/2;
			}
		}else{
			if(s==memo){
				u=(d+u)/2;
			}else{
				d=(d+u)/2;
				memo = s;
			}
		}

		if(s=="Vacant"){
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 852
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ALDS1_7_D {
    class Problem {
        private int _pos;
        private List<int> _pre, _in, _post;

        public void Run() {
            Read();
            Rec(0, _pre.Count);

            StringBuilder sb = new StringBuilder();
            foreach (int n in _post)
                sb.Append(" " + n);
            Console.WriteLine(sb.ToString().TrimStart());
        }

        private void Read() {
            Console.ReadLine();
            _pre = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            _in = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            _post = new List<int>();
        }

        private void Rec(int left, int right) {
            if (left >= right)
                return;
            int cur = _pre[_pos++];
            int mid = _in.IndexOf(cur);
            Rec(left, mid);
            Rec(mid + 1, right);
            _post.Add(cur);
        }
    }

    class Program {
        static void Main(string[] args) {
            Problem p = new Problem();
            p.Run();
        }
    }
}

Measured memory_bytes: 10104
#include <iostream>
#include <iomanip>
#include <cmath>
#include <functional>
#include <algorithm>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <boost/range/irange.hpp>
#include <boost/container/static_vector.hpp>
#include <boost/utility/string_ref.hpp>

template <class Integer>
auto boost_irange(Integer last) { return boost::irange(static_cast<Integer>(0), last); }
template <class Integer>
auto boost_irange(Integer first, Integer last) { return boost::irange(first, last); }

class input
{
    std::istream& cin;

public:
    input() : cin(std::cin)
    {
        std::cin.tie(nullptr);
        std::ios::sync_with_stdio(false);
    }

    template <class T>
    inline input& operator>>(T& var)
    {
        cin >> var;
        return *this;
    }
    template <class T>
    inline input& operator,(T& var)
    {
        cin >> var;
        return *this;
    }

    template <class T>
    inline T read()
    {
        T var;
        cin >> var;
        return var;
    }

    template <class InputIterator>
    inline void read(InputIterator head, std::size_t n)
    {
        for (std::size_t i = 0; i < n; ++i) {
            cin >> *head;
            ++head;
        }
    }

    template <class T, class F>
    inline void online(std::size_t n, F&& f)
    {
        T var;
        for (std::size_t i = 0; i < n; ++i) {
            cin >> var;
            f(var);
        }
    }
};
template <class T, std::size_t n>
std::istream& operator>>(std::istream& in, std::array<T, n>& var)
{
    for (std::size_t i = 0; i < n; ++i) {
        in >> var[i];
    }
    return in;
}

class output
{
    std::ostream& cout;

public:
    class proxy
    {
        std::ostream& cout;

    public:
        proxy() : cout(std::cout) {}
        ~proxy() { cout << std::endl; }
        template <class T>
        proxy& operator,(T&& val)
        {
            cout << ' ' << val;
            return *this;
        }
    };

public:
    output() : cout(std::cout)
    {
        cout << std::fixed << std::setprecision(15);
    }

    template <class T>
    proxy operator<<(T&& val)
    {
        cout << val;
        return {};
    }
};

int main()
{
    input in;
    output out;

    int N, K, Q;
    in >> N, K, Q;

    std::vector<int> score(N);
    in.online<int>(Q, [&](int i) { ++score[i - 1]; });

    for (auto s : score) {
        if (K - Q + s > 0) {
            out << "Yes";
        } else {
            out << "No";
        }
    }

    return 0;
}


Measured memory_bytes: 1152
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	Scanner sc = new Scanner(System.in);

	void run() {
		for (;;) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if ((n | m) == 0) return;
			double[][] g = new double[n][n];
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					g[i][j] = sc.nextDouble();
				}
			}

			double[][] dp = new double[m][n];
			for (int i = 0; i < n; i++) dp[0][i] = 1;
			for (int i = 0; i < m - 1; i++) {
				for (int j = 0; j < n; j++) {
					for (int k = 0; k < n; k++) {
						dp[i+1][k] = Math.max(dp[i+1][k], dp[i][j] * g[j][k]);
					}
				}
			}
			
			double max = 0;
			for(int i=0;i<n;i++) max = Math.max(max, dp[m-1][i]);
			BigDecimal bd = new BigDecimal(max);
			System.out.println(bd.setScale(2, BigDecimal.ROUND_HALF_UP));
		}
	}

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

	void debug(Object... o) {
		System.out.println(Arrays.deepToString(o));
	}

	void debug2(double[][] array) {
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				System.out.print(array[i][j]);
			}
			System.out.println();
		}
	}
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
typedef vector < vector<ll> > Mat;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

int N; string S;
int W[int(2e5+5)], R[int(2e5+5)];

int main(){
  cin >> N >> S;
  int ans = N;

  for (int i = 1; i <= N; i++){
    R[i] = R[i-1];
    if (S[i-1] == 'R') R[i]++;
  }
  for (int i = N; i >= 1; i--){
    W[i] = W[i+1];
    if (S[i-1] == 'W') W[i]++;
  }

  for (int i = 0; i <= N; i++){
    ans = min(ans, max(i - R[i], (N - i) - W[i+1]));
  }
  cout << ans << endl;

  return 0;
}


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

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int stu;
  bool list[31] = {false};
  for(int i=0;i<28;i++) {
    cin >> stu;
    list[stu] = true;
  }
  for(int i=1;i<=30;i++) {
    if(!list[i]) {
      cout << i << endl;
    }
  }
}

Measured memory_bytes: 1196
ans='No'
n=int(input())
a=list(map(int, input().split()))
f=0
t=0
for i in a:
  if i%4==0:
    f+=1
  elif i%2==0:
    t+=1
if n//2<=f or n-2*f<=t:
  ans='Yes'
print(ans)

Measured memory_bytes: 19936
N = int(input())
L = list(map(int, input().split()))

ans = 0
for i in range(N):
    li = L[i]
    for j in range(i+1, N):
        lj = L[j]
        if li == lj:
            continue
        for k in range(j+1, N):
            lk = L[k]
            if lk in [li, lj]:
                continue
            lMax = max(li, lj, lk)
            ans += li + lj + lk - lMax > lMax

print(ans)

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

int main() {
  int K;
  int A,B;
  cin >>K;
  cin >>A>>B;
  
  if (B-A>=B%K){
    cout<<"OK"<<endl;
  }
  else{
    cout<<"NG"<<endl;
  }
}


Measured memory_bytes: 3636