akhauriyash/Code-Regression huggingface dataset:
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <vector>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>

using namespace std;

#define LL long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define rep(i,a,b) for(int i = (a) ; i <= (b) ; i++)
#define per(i,a,b) for(int i = (a) ; i >= (b) ; i--)
#define mem(a) memset(a,0,sizeof(a))
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define fast_io ios::sync_with_stdio(false)

const int INF = 1e9;
const LL mod = 1e9 + 7;
const int maxn = 2e5 + 7;

char s[maxn];
int L[maxn],R[maxn];

int main() {
    int n,k,c;
    while(~scanf("%d%d%d",&n,&k,&c)) {
        scanf("%s",s);
        int len = strlen(s);
        int cnt = 0;
        rep(i,0,len-1) {
            if(s[i] == 'o') {
                L[++cnt] = i + 1;
                i += c;
            }
            if(cnt == k) break;
        }
        cnt = 0;
        per(i,len-1,0) {
            if(s[i] == 'o') {
                R[++cnt] = i + 1;
                i -= c;
            }
            if(cnt == k) break;
        }
        rep(i,1,k) {
//            cout << L[i] << " " << R[i] << endl;
            if(L[i] == R[k+1-i]) {
                pd(L[i]);
            }
        }
    }
    return 0;
}


Measured memory_bytes: 3200
#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str,x)))
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	N,R = MI()
	if(N <10):
		print(R + 100 * (10-N))
	else:
		print(R)

if __name__ == '__main__':
	main()

Measured memory_bytes: 3064
#include<iostream>
using namespace std;
int main(){
	while(1){
		int n,count=0;
		bool l,r,flag;
		flag = true;
		l = false;
		r = false;
		cin >> n;
		if(n==0)	break;
		for(int i=0;i<n;i++){
			string str;
			cin >> str;
			if(str=="lu"){
				l = true;
			}
			else if(str=="ru"){
				r = true;
			}
			else if(str=="ld"){
				l = false;
			}
			else if(str=="rd"){
				r = false;
			}
			if(r&&l&&flag){
				flag = false;
				count++;
			}
			else if(!r&&!l&&!flag){
				flag = true;
				count++;
			}
		}
		cout << count << endl;
	}
}


Measured memory_bytes: 3156
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
a = list(Counter(A).values())


def f(x):
    while x >= 3:
        x = x // 3 + x % 3
    return x


a = [f(i) for i in a]
one = a.count(1)
two = a.count(2)

if two % 2 == 0:
    print(one + two)
else:
    print(one + two - 1)

Measured memory_bytes: 18648
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <cmath>
#include <cstring>

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

using namespace std;

int H, N;
int A[100001];

int main() {
    int H, N;
    cin >> H >> N;
    rep(i, N) cin >> A[i];
    int sum = 0;
    rep(i, N) sum += A[i];
    cout << (sum >= H ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 640
N = int(input())
P = list(map(int, input().split()))

mins = [P[i] for i in range(N)]

for i in range(1, N):
    if mins[i] > mins[i-1]:
        mins[i] = mins[i-1]


ans = 1
for i in range(1, N):
    if mins[i-1] >= P[i]:
        ans += 1

print(ans)

Measured memory_bytes: 32368
#include<stdio.h>
int main(){
  int A[100][100],b[100],c[1000],x[100];
  int n,m;
  int i,j;
  
  scanf("%d%d",&n,&m);
  for(i=0;i<n;i++)
    for(j=0;j<m;j++)
      scanf("%d",&A[i][j]);

  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      if(i==0){
	scanf("%d",&x[j]);
	b[j]=x[j];
      }
      c[i]+=A[i][j]*b[j];
    }
  }

  for(i=0;i<n;i++)
    printf("%d\n",c[i]);

return 0;
}

Measured memory_bytes: 1860
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define pr1(a) (#a)<<"="<<(a)
#define pr2(a,b) pr1(a)<<", "<<pr1(b)
#define pr3(a,b,c) pr2(a,b)<<", "<<pr1(c)
#define pr4(a,b,c,d) pr3(a,b,c)<<", "<<pr1(d)
#define pr5(a,b,c,d,e) pr4(a,b,c,d)<<", "<<pr1(e)
#define int long long
#define double long double
using namespace std;
const int N = 100010;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class RSQ{
public:
  typedef long long ll;
  ll n;
  vector<ll> dat,td;
  
  RSQ(){n = -1;}
  RSQ(int n_){
    n=1;
    while(n<n_)n*=2; //要素数nを2のべき乗に
    dat.resize(2*n-1,0),td.resize(2*n-1,0);
  }
  
  //[a,b)の区間にxを加算する,query(a,b,x);
  ll add(int a,int b,ll x,int k=0,int l=0,int r=-1){
    if(r==-1) r=n, assert(a < n && b <= n);
    if(r<=a||b<=l)return 0;
    if(a<=l&&r<=b){
      dat[k]+=(r-l)*x; 
      td[k]+=x;
      return dat[k];
    }

    dat[k]+=(min(r,b)-max(l,a))*x;
    ll kl=k*2+1,kr=k*2+2,t=td[k]*(r-l)/2;
    dat[kl]+=t, dat[kr]+=t;
    td[kl]+=td[k], td[kr]+=td[k];
    td[k]=0;

    ll vl=add(a,b,x,k*2+1,l,(l+r)/2);
    ll vr=add(a,b,x,k*2+2,(l+r)/2,r);
    return vl+vr;
  }
  
  //[a,b)の総和を得る
  ll sum(int a,int b){return add(a,b,0);}
};


signed main(){
  int n,m;
  cin>>n>>m;

  vector<P> A(n);
  cin>>A;
  sort(A.begin(),A.end(),[](auto a,auto b){return a.second-a.first < b.second - b.first;});
  
  RSQ rsq(m+10);

  int idx = 0;
  for(int i=1;i<=m;i++){
    while(idx < n && A[idx].second - A[idx].first+1 < i){
      rsq.add(A[idx].first,A[idx].second+1,1);
      idx++;
    }
    int ans = n-idx;
    for(int j=0;j<=m;j+=i) ans += rsq.sum(j,j+1);
    cout<<ans<<endl;   
  }
  
  return 0;
}


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

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    vector <string> v(3);
    cin>>v[0]>>v[1]>>v[2];
    int i=0,j=0,k=0;
    int cur=0;
    bool  f=1;
    while(1)
    {char c;
        if(cur==0)
        {
           if(i==v[0].length())
            break;
            c=v[0][i++];
        }
        else if(cur==1)
        {
            if(j==v[1].length())
            break;
                c=v[1][j++];
        }
        else
        {
            if(k==v[2].length())
            break;
            c=v[2][k++];
        }
        if(c=='a')
            cur=0;
        else if(c=='b')
            cur=1;
        else
            cur=2;
    }
    if(cur==0)
        cout<<"A\n";
    else if(cur==1)
        cout<<"B\n";
    else
        cout<<"C\n";
    

    
    return 0;   
}


 
 


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

vector<vector<int>> g(100200);
vector<int> c(100200);
map<pair<int, int>, int> mp;
int mx;

void dfs(int v, int p) {
    int i = 1;
    for (auto u : g[v])
        if (u != p) {
            if (i == c[v])
                i++;
            mp[make_pair(min(u, v), max(u, v))] = i;
            mx = max(mx, i);
            c[u] = i;
            dfs(u, v);
            i++;
        }
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    // cout << fixed << setprecision(10);
    int n;
    mx = 0;
    cin >> n;
    vector<int> a(n - 1), b(n - 1);
    rep(i, 0, n - 1) {
        cin >> a[i] >> b[i];
        g[a[i]].emplace_back(b[i]);
        g[b[i]].emplace_back(a[i]);
    }
    dfs(1, 0);
    cout << mx << endl;
    rep(i, 0, n - 1) {
        cout << mp[make_pair(a[i], b[i])] << endl;
    }
    return 0;
}

Measured memory_bytes: 16384
#!/usr/bin/env python
from math import *
def g(x):
	y = (int((1000 * abs(x)) * 2 + 1) // 2) / 1000
	if x < 0:
		y *= -1
	return y
def func(x):
	x1, y1, x2, y2, x3, y3 = x
	
	a = x1 - x2
	b = y1 - y2
	c = (x1 * x1 + y1 * y1 - x2 * x2 - y2 * y2) / 2
	d = x1 - x3
	e = y1 - y3
	f = (x1 * x1 + y1 * y1 - x3 * x3 - y3 * y3) / 2
	x = (e * c - b * f) / (a * e - b * d)
	y = (a * f - d * c) / (a * e - b * d)
	r = sqrt((x1 - x) * (x1 - x) + (y1 - y) * (y1 - y))
	x = "{0:.3f}".format(g(x))
	y = "{0:.3f}".format(g(y))
	r = "{0:.3f}".format(g(r))
	print(x + " " + y + " " + r)
n = int(input())
a = []
for _ in range(n):
	a.append(list((map(float, input().split()))))
for i in a:
	func(i)


Measured memory_bytes: 5700
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = LLONG_MAX/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

int main(){
    ll n,m; cin >> n >> m;
    vector<ll> s(n);
    rep(i,n) cin >> s[i];
    vector<ll> t(m);
    rep(i,m) cin >> t[i];
    vector<vector<ll>> dp(n,vector<ll>(m,0)), sum(n+1, vector<ll>(m+1,0));
    // if(s[0] == t[0])dp[0][0] = 1;
    rep(i,n){
        rep(j,m){
            if(s[i] != t[j])dp[i][j] = 0;
            else dp[i][j] = (sum[i][j] + 1) % MOD;
            sum[i+1][j+1] = (sum[i][j+1] + sum[i+1][j] - sum[i][j] + dp[i][j]) % MOD;
            if(sum[i+1][j+1] < 0)sum[i+1][j+1] += MOD;
        }
    }
    cout << (sum[n][m] + 1) % MOD << endl;
}

Measured memory_bytes: 62976
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define endl "\n"
const int MOD=1e9+7;
#ifndef HOME
#define cerr if(0)cerr
#endif

int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin>>n;
    int a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    int c=1;
    int x=a[0];
    for(int i=1;i<n;i++){
        if(a[i]>=x){
            c++;
            x=a[i];
        }
    }
    cout<<c<<endl;
    return 0;
    
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

const ll mod=1000000007;
const ll inf=LONG_LONG_MAX;

int main(){

  ll n,m;
  cin >> n>> m;
  vector<vector<ll>> G(n);
  for(int i=0;i<m;i++){
    ll u,v;
    cin >> u >> v;
    G[u-1].push_back(v-1);
  }
  ll s,t;
  cin >> s >> t;
  ll dist[n];
  for(int i=0;i<n;i++)dist[i]=-1;
  dist[s-1]=0;
  queue<ll> q;
  q.push(s-1);

  bool first[n];//1歩目で来たことがあるか
  bool second[n];//2ほめで来たことがあるか
  for(int i=0;i<n;i++){
    first[i]=false;
    second[i]=false;
  }

  while(!q.empty()){
    ll a=q.front();
    q.pop();

    for(int i=0;i<G[a].size();i++){
      if(first[G[a][i]])continue;
      else first[G[a][i]]=true;
      for(int j=0;j<G[G[a][i]].size();j++){
        if(second[G[G[a][i]][j]])continue;
        else second[G[G[a][i]][j]]=true;
        for(int k=0;k<G[G[G[a][i]][j]].size();k++){
          if(dist[G[G[G[a][i]][j]][k]]==-1){
            dist[G[G[G[a][i]][j]][k]]=dist[a]+1;
            q.push(G[G[G[a][i]][j]][k]);
          } 
        }
      }
    }

  }

  cout << dist[t-1] << endl;


}

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

int main(int argc, char **argv) {
  int i;
  int N, M;
  cin >> N >> M;

  vector<int> X(N, -1);
  bool unable = false;
  int s, c;

  for (int i = 0; i < M; ++i) {
    cin >> s >> c;
    --s;
    if (X[s] == -1 || X[s] == c)
      X[s] = c;
    else
      unable = true;
  }

  if (N > 1 && X[0] == 0)
    unable = true;

  if (!unable) {
    for (int i = 0; i < N; ++i) {
      if (X[i] == -1) {
        if (i == 0 && N > 1) {
          X[i] = 1;
        } else {
          X[i] = 0;
        }
      }
      cout << X[i];
    }
  } else {
    cout << -1;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>

#define p pair<int,int>
using namespace std;

vector<vector<p >> graph;
vector<bool> ret;
vector<bool> visited;

void dfs(int v, bool flag) {
    ret[v] = flag;
    visited[v] = true;

    for (auto edge:graph[v]) {
        if (!visited[edge.first]) {
            dfs(edge.first, flag == (edge.second % 2 == 0));
        }
    }
}

int main() {
    int n;
    cin >> n;
    graph = vector<vector<p >>(n);

    for (int i = 0; i < n - 1; i++) {
        int u, v, w;
        cin >> u >> v >> w;
        u--;
        v--;
        graph[u].push_back(p(v, w));
        graph[v].push_back(p(u, w));
    }

    ret = vector<bool>(n);
    visited = vector<bool>(n);
    dfs(0, true);

    for (int i = 0; i < n; i++) {
        cout << (ret[i] ? 0 : 1) << endl;
    }
    return 0;
}

Measured memory_bytes: 7808
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

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

  static class KStones {
    public final void solve(int testNumber, InputReader in, PrintWriter out) {
      int n = in.nextInt();
      int k = in.nextInt();
      int[] a = in.nextIntArray(n);
      boolean[] dp = new boolean[k + 1];
      for (int x : a) {
        dp[x] = true;
      }
      for (int i = 0; i <= k; i++) {
        for (int x : a) {
          if (i >= x) {
            dp[i] |= !dp[i - x];
          }
        }
      }
      out.println(dp[k] ? "First" : "Second");
    }
  }

  static final class InputReader {
    private final InputStream stream;
    private final byte[] buf = new byte[1 << 16];
    private int curChar;
    private int numChars;

    public InputReader() {
      this.stream = System.in;
    }

    public InputReader(final InputStream stream) {
      this.stream = stream;
    }

    private final int read() {
      if (this.numChars == -1) {
        throw new UnknownError();
      } else {
        if (this.curChar >= this.numChars) {
          this.curChar = 0;

          try {
            this.numChars = this.stream.read(this.buf);
          } catch (IOException ex) {
            throw new InputMismatchException();
          }

          if (this.numChars <= 0) {
            return -1;
          }
        }

        return this.buf[this.curChar++];
      }
    }

    public final int nextInt() {
      int c;
      for (c = this.read(); isSpaceChar(c); c = this.read()) {}

      byte sgn = 1;
      if (c == 45) { // 45 == '-'
        sgn = -1;
        c = this.read();
      }

      int res = 0;

      while (c >= 48 && c <= 57) { // 48 == '0', 57 == '9'
        res *= 10;
        res += c - 48; // 48 == '0'
        c = this.read();
        if (isSpaceChar(c)) {
          return res * sgn;
        }
      }

      throw new InputMismatchException();
    }

    private static final boolean isSpaceChar(final int c) {
      return c == 32 || c == 10 || c == 13 || c == 9
          || c == -1; // 32 == ' ', 10 == '\n', 13 == '\r', 9 == '\t'
    }

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


Measured memory_bytes: 23636
#include <stdio.h>
#define MAX 10000
#define NIL -1

typedef struct node{
    int p,l,r;
}Node;
Node T[MAX];
int n;

void preParse(int u){
    if(u==NIL)
        return;
    printf(" %d",u);
    preParse(T[u].l);
    preParse(T[u].r);
}

void inParse(int u){
    if(u==NIL)
        return;
    inParse(T[u].l);
    printf(" %d",u);
    inParse(T[u].r);
}

void postParse(int u){
    if(u == NIL)
        return;
    postParse(T[u].l);
    postParse(T[u].r);
    printf(" %d",u);
}
int main(void){
    int i,v,l,r,root;
    scanf("%d",&n);
    for(i=0;i<n;i++)
        T[i].p=NIL;
    for(i=0;i<n;i++){
        scanf("%d %d %d",&v,&l,&r);
        T[v].l=l;
        T[v].r=r;
        if(l != NIL)
            T[l].p=v;
        if(r != NIL)
            T[r].p=v;
    }
    for(i=0;i<n;i++)
        if(T[i].p == NIL)
            root=i;
    puts("Preorder");
    preParse(root);
    puts("");
    puts("Inorder");
    inParse(root);
    puts("");
    puts("Postorder");
    postParse(root);
    puts("");
    return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(x) (x).begin(),(x).end()
template <class T> inline bool chmin(T &a, T b) {if (a > b){a = b;return true;}return false;}
template <class T> inline bool chmax(T &a, T b) {if (a < b){a = b;return true;}return false;}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;cin>>s;
    int k;cin>>k;
    vector<string> tt;
    for(int i=0;i<s.size();i++){
        for(int j=1; j<=k && i+j<=s.size();j++){
            string t = s.substr(i, j);
            tt.push_back(t);
        }
    }
    sort(tt.begin(), tt.end());
    tt.erase(unique(tt.begin(), tt.end()), tt.end());
    cout<<tt[k-1]<<endl;
}

Measured memory_bytes: 1660
n,k = map(int,input().split())
count = 0
c = int((n-1)*(n-2)/2)
if k > c:
    print(-1)
else:
    print(n-1+c-k)
    for i in range(n-1):
        print(1,i+2)
    if k < c:
        for i in range(2,n+1):
            for j in range(i+1,n+1):
                print(i,j)
                count = count + 1
                if count == c-k:
                    break
            if count == c-k:
                break

Measured memory_bytes: 3608
from datetime import datetime

S = input()

try:
    datetime.strptime(S, '%m%y')
except:
    try:
        datetime.strptime(S, '%y%m')
    except:
        print("NA")
    else:
        print("YYMM")
else:
    try:
        datetime.strptime(S, '%y%m')
    except:
        print("MMYY")
    else:
        print("AMBIGUOUS")





Measured memory_bytes: 4588
#include <iostream>
#include <string>
#include <functional>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <math.h>
#include <iomanip>
#include <map>

using namespace std;
using ll = long long;

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

	double cnt = 0;
	for (int i = 1; i <= n; ++i)
	{
		if (i >= k)
			cnt += 1;
		else
		{
			int omote = ceil(log2(double(k) / i));
			cnt += 1 / pow(2, omote);
		}
	}

	cout << setprecision(18) << cnt / n << endl;


	return 0;
}

Measured memory_bytes: 256
(defun is-prime(x i)
  (if (= x 1)
	nil
	(if (= x 2)
	  t
	  (if (zerop (mod x i))
		nil
		(if (<= (* i i) x)
		  (is-prime x (1+ i))
		  t)))))

(defun func(x)
  (if (is-prime x 2)
	x
	(func (1+ x))))

(let ((x (read)))
  (princ (func x)))


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

int main(){
	priority_queue<int> que;
	for(int i = 0;i < 5;i++){
		int a;
		cin >> a;
		que.push(a);
	}
	while(!que.empty()){
		if(que.size() > 1)
			cout << que.top() << " ";
		else
			cout << que.top();
		que.pop();
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 1212
n = gets.to_i
ary = gets.split.map(&:to_i)
positive = ary.select(&:positive?).sort
negative = ary.reject(&:positive?).sort
if positive.empty?
  positive[0] = negative[-1]
  negative.delete_at(-1)
end
if negative.empty?
  negative[0] = positive[0]
  positive.delete_at(0)
end

result = []

positive[0..-2].each do |i|
  result.push("#{negative[0]} #{i}")
  negative[0] -= i
end
negative.each do |i|
  result.push("#{positive[-1]} #{i}")
  positive[-1] -= i
end

puts positive[-1]
puts result

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

using namespace std;

const int N = 100010;



int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    double res = 0.0;
    for (int i = 1; i <= n; i++) {
        double cur = 1.0 / n;
        int u = i;
        while (u < k) {
            cur *= 0.5;
            u *= 2;
        }
        res += cur;
    }
    cout << setprecision(10) << fixed << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
	int N;
	int a[128];
	int i;
	int mimorinn = 1, mareitaso = 0;
	if (scanf("%d", &N) != 1) return 1;
	for (i = 0; i < N; i++) {
		if (scanf("%d", &a[i]) != 1) return 1;
	}
	a[N] = 0;
	for(i = 1; i <= N; i++) {
		if (a[i - 1] != a[i]) {
			mareitaso += mimorinn / 2;
			mimorinn = 1;
		} else {
			mimorinn++;
		}
	}
	printf("%d\n", mareitaso);
	return 0;
}

/*

連続している所を適当に潰す。色はいっぱいあるからぶつけずにできる。

*/


Measured memory_bytes: 1736
#include<bits/stdc++.h>
using namespace std ;
int main () {
  int W ,H ,x ,y,r ;
  cin >> W >> H >> x >> y >> r ;
  if(0 <= x-r && 0 <= y -r&&W >= x+r&&H>=y+r) cout << "Yes" << endl ;
  else cout << "No" << endl ;
}


Measured memory_bytes: 3100
#include <cstdio>

int main(){
    char c;
    scanf("%c",&c);
    if(c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o'){
        printf("vowel");
    }
    else{
        printf("consonant");
    }
    printf("\n");

    return 0;
}

Measured memory_bytes: 128
n,m = gets.split(" ").map(&:to_i)

if n == 0 || m == 0
  ans = 0
elsif n == 1 || m == 1
  ans = n * m == 1 ? 1 : n * m - 2
elsif n == 2 || m == 2
  ans = 0
else
  ans = n * m - ((n * 2) + (m * 2) - 4)
end

puts ans

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(n) for(ll i = 0;i < n;++i)
#define rep2(i, n) for(ll i = 0; i < n; ++i)
#define rep3(i, a, b) for(ll i = a; i < b; ++i)
#define rep4(i, a, b, c) for(ll i = a; i < b; i += c)

ll n, m, q;
vector<ll> a, b, c, d;
ll ans = 0;

void dfs(vector<ll> A) {
    if (A.size() == n + 1) {
        ll score = 0;
        rep2(i, q) {
            if (A[b[i] - 1] - A[a[i] - 1] == c[i]) score += d[i];
        }

        ans = max(ans, score);
        return;
    }

    while(A.back() <= m) {
        vector<ll> temp = A;
        temp.push_back(A.back());
        dfs(temp);
        A.back()++;
    }
}

int main() {
    cin >> n >> m >> q;

    a = b = c = d = vector<ll>(q);
    rep2(i, q) {
        cin >> a[i] >> b[i] >> c[i] >> d[i];
    }

    dfs(vector<ll>(1, 1));
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3640
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s, t;
    cin >> s >> t;
    int n = s.size();
    REP(i, n) {
        REP(j, n) {
            if(t[j] != s[(j + i) % n]) break;
            if(j == n - 1) {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

    cout << "No" << endl;
    return 0;
}


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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)
#define TO_STRING(VariableName) # VariableName
#define LOG(x) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<endl;
#define LOG2(x,y) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<endl;
#define LOG3(x,y,z) if(DEBUG)cout<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;
#define LOG4(w,x,y,z) if(DEBUG)cout<<TO_STRING(w)<<"="<<w<<" "<<TO_STRING(x)<<"="<<x<<" "<<TO_STRING(y)<<"="<<y<<" "<<TO_STRING(z)<<"="<<z<<endl;

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

lli aSum[200100];
lli bSum[200100];


void func(long long N, long long M, long long K, std::vector<long long> A, std::vector<long long> B){


    REP(i,0,N){
        aSum[i+1] = aSum[i]+A[i];
    }
    REP(i,0,M){
        bSum[i+1] = bSum[i]+B[i];
    }
    bSum[M+1]=INF;

    lli ans = -INF;
    REP(i,0,N+1){
        lli left = K-aSum[i];
        if(left<0)break;
        lli cnt = (lli)(upper_bound(bSum,bSum+M+1,left)-bSum);
        if(cnt!=0)cnt--;

        chmax(ans,cnt+i);
    }

    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long M;
    scanf("%lld",&M);
    long long K;
    scanf("%lld",&K);
    std::vector<long long> A(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
    }
    std::vector<long long> B(M);
    for(int i = 0 ; i < M ; i++){
        scanf("%lld",&B[i]);
    }
    func(N, M, K, std::move(A), std::move(B));
    return 0;
}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
 #include <bits/stdc++.h>
using namespace std;
 
#define froop1(a,n) for(int i = a;i < n;i++)
#define froop2(a,n) for(int i = a;i > n;i--)
int main(){
	string a;
    cin >> a;
  if(a == "ARC"){
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
    
}
return 0;
}

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

int main() {
	int n,a,n4=0,n2=0;
	cin>>n;
	for(int i=0;i<n;i++) {
		cin>>a;
		if(a%4==0) n4++;
		else if(a%2==0) n2++;
	}
	cout<<(n/2<=n4+n2/2?"Yes":"No")<<"\n";
	return 0;
}

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

int main()
{
	int h, w;
	char c[100][100];
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cout << c[i][j];
		}
		cout << endl;
		for (int k = 0; k < w; k++) {
			cout << c[i][k];
		}
		cout << endl;
	}
}

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

Measured memory_bytes: 3120
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
using namespace std; using ll = long long; using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
//**デバッグ準備**//
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop//
//bitSearch, bitList, gcdlcm, isPrime, primeFactorize, Npow, divisor, modinv, dfs, bfs, eratos//
//dijkstra, WarshallFloyd, BellmanFord, UnionFind, COM, digitDP ,RMQ//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R;
ll MOD = 1000000007; ll INF = 1LL << 62; ll ans = INF; ll z = 0, o = 1;
vl flag, color, D; vll path;
int main() {
	string A, B, C;
	cin >> A >> B >> C;
	ll a=0, b=0, c=0;
	ll now = 0;
	while (true) {
		if (now == 0) {
			if (a == A.length()) {
				cout << "A" << endl;
				exit(0);
			}
			else {
				
				if (A[a] == 'a') now = 0;
				else if (A[a] == 'b') now = 1;
				else now = 2;
				a++;
			}
		}
		if (now == 1) {
			if (b == B.length()) {
				cout << "B" << endl;
				exit(0);
			}
			else {
				
				if (B[b] == 'a') now = 0;
				else if (B[b] == 'b') now = 1;
				else now = 2;
				b++;
			}
		}
		if (now == 2) {
			if (c == C.length()) {
				cout << "C" << endl;
				exit(0);
			}
			else {
				
				if (C[c] == 'a') now = 0;
				else if (C[c] == 'b') now = 1;
				else now = 2;
				c++;
			}
		}
	}
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
 
#define MAXX 500005
 
#define PI   3.14159265358979323846264338327950
 
#define PB push_back 
#define F first
#define S second
 
#define fixx(n) fixed << setprecision(n)
 
#define ll 	  long long 
 
#define mod  1000000007


 
int main()
{
	FAST;
	string s;
	cin >> s;
	ll k = 0;
	for(int i = 0; i < s.size(); i ++){
		k += s[i]-48;
	}
	if(k % 9){
		cout << "No";
		return 0;
	}
	cout << "Yes";
	return 0;
}

Measured memory_bytes: 3736
#include <time.h>

#include <stdlib.h>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <cstdint>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <bitset>
#include <iterator>
#include <deque>
#include <string>
#include <queue>
#include <omp.h>
#include <fstream>   // ifstream, ofstream
typedef int64_t ll;
using namespace std;
const ll INF=1e10;
#include <cstdint>
#include <iostream>
#include <utility>
#include <map>

int64_t gcd(int64_t a,int64_t b){//calc gcd
	if(a==0){
		return b;
	}else if(b==0){
		return a;
	}else if(a>b){
		return gcd(a%b,b);
	}else{
		return gcd(b%a,a);
	}
}
std::pair<int64_t,int64_t> extgcd(int64_t a,int64_t b){//a*(pair->first) + b*(pair->second) = gcd(a,b)
	if(a==0){
		return std::make_pair(0,1);
	}else if(b==0){
		return std::make_pair(1,0);
	}else{
		if(a>b){
			std::pair<int64_t,int64_t> d=extgcd(a%b,b);
			return std::make_pair(d.first,d.second-(a/b)*d.first);
		}else{
			std::pair<int64_t,int64_t> d=extgcd(a,b%a);
			return std::make_pair(d.first-(b/a)*d.second,d.second);
		}
	}

}
int64_t inline normalize_mod(int64_t a,int64_t m){
	return (m+a%m)%m;
}
int64_t mod_inv(int64_t a,int64_t m){//a^-1(mod m),m is a prime number
	int64_t raw=extgcd(a,m).first;
	return normalize_mod(raw,m);;
}
std::map<int64_t,int64_t> factorization(int64_t n){
	std::map<int64_t,int64_t> retval;
	for(int64_t i=2;i*i<=n;i++){
		int64_t counter=0;
		while(n%i==0){
			n=n/i;
			counter++;
		}
		if(counter!=0){
			retval.emplace(i,counter);
		}
	}
	return retval;
}
std::pair<int64_t,int64_t> mod_fact(int64_t n,int64_t m){//n!=first*m^second
	if(n==0){
		return std::make_pair(1,0);
	}else{

		std::pair<int64_t,int64_t> d=mod_fact(n/m,m);
		int64_t second=d.second+n/m;
		int64_t first;
		if((n/m)%2==0){
			first=1;
		}else{
			first=m-1;
		}
		for(int64_t i1=1;i1<=(n%m);i1++){
			first=normalize_mod(first*i1,m);
		}
		return std::make_pair(first,second);
	}
}


int main(){
	string s;
	cin>>s;
	reverse(s.begin(),s.end());
	ll *a=new ll[s.size()];
	ll *b = new ll[s.size()];
	a[0]=3;
	if(s[0]=='0'){
		b[0]=1;
	}else{
		b[0]=3;
	}
	for(ll i1=1;i1<s.size();i1++){
		a[i1]=normalize_mod(3*a[i1-1],1e9+7);
		if(s[i1]=='0'){
			b[i1]=b[i1-1];
		}else{
			b[i1]=normalize_mod(a[i1-1]+2*b[i1-1],1e9+7);
		}
	}
	cout<<b[s.size()-1]<<endl;
}


Measured memory_bytes: 2048
#include <iostream>

using namespace std;

int main(void)
{
  long H, N;
  int A[100000];

  cin >> H >> N;

  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }

  long sum = 0;

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

  if (H <= sum) {
    cout << "Yes";
  } else {
    cout << "No";
  }

  return 0;
}


Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
using namespace std;
int c[100002];
int main()
{
	int n,m;
	int a,b;
	int rec;
	int ans=0;
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d%d",&a,&b);
		if(c[a]==0)
			c[a]=b;
		else
			c[a]=min(c[a],b);
	}
	rec=n+1;
	for(int i=1;i<=n;i++)
	{
		if(rec==i)
		{
			ans++;
			rec=n+1;
		}
		if(c[i]!=0)
			rec=min(rec,c[i]);
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
typedef long long LL;
typedef unsigned long long ULL;
#define debug printf("fuck %d\n", __LINE__);
inline LL read() {
	LL res = 0, bo = 1;
	char ch = getchar();
	while(ch < '0' || ch > '9') { if (ch == '-') bo = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') { res = (res << 1) + (res << 3) + ch - '0'; ch = getchar(); }
	return bo * res;
}
template<typename T> void read(T &x) { x = read(); }
template<typename T, typename ...Argv> void read(T &a, Argv &...argv) { read(a); read(argv...); }

const int N = 3e3 + 10, p = 1e9 + 7, inv2 = (p + 1) / 2;

int f[N][N], a[N], g[N][N];

int main() {
	int n = read(), m = read(), now = 1;
	for (int i = 1; i <= n; ++ i) read(a[i]);
	for (int i = 1; i <= n; ++ i) for (int j = 1; j <= n; ++ j) f[i][j] = a[i] > a[j];
	for (; m -- > 0; ) {
		int x = read(), y = read();
		for (int i = 1; i <= n; ++ i) {
			if (i == x || i == y) continue;
			g[i][y] = g[i][x] = 1LL * (f[i][x] + f[i][y]) * inv2 % p;
			g[x][i] = g[y][i] = 1LL * (f[x][i] + f[y][i]) * inv2 % p;
		}
		for (int i = 1; i <= n; ++ i) {
			if (i == x || i == y) continue;
			f[i][y] = g[i][y]; f[i][x] = g[i][x];
			f[x][i] = g[x][i]; f[y][i] = g[y][i];
		}
		f[y][x] = f[x][y] = 1LL * (f[x][y] + f[y][x]) * inv2 % p;
		now = (now << 1) % p;
	}
	int ans = 0;
	for (int i = 1; i <= n; ++ i) {
		for (int j = i; j <= n; ++ j) {
			(ans += f[i][j]) %= p;
		}
	}
	std::cout << 1LL * ans * now % p << std::endl;
}

Measured memory_bytes: 71040
T = []
W = input().lower()
count = 0
while True:
    str = input()
    if 'END_OF_TEXT' == str:
        break
    else:
        T.append(str.lower().split())

for i in range(len(T)):
    for j in T[i]:
        if W == j:
            count = count + 1
        #print(j)

print(count)


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

#define ll long long
#define FOR(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define REP(i, x) for (int i = 0; i < (int)(x); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define RREP(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (int i = ((int)(x)); i > 0; i--)
#define INF 2147483647
#define LLINF 9223372036854775807LL
#define vi vector<int>
#define vvi vector<vector<int>>
#define vvvi vector<vector<vector<int>>>
#define pi pair<int, int>
#define ALL(a) (a).begin(), (a).end()
#define BIT(n) (1LL << (n))

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

int main(){
ll N; cin>>N;
set<string> S;
REP(i,N){
string tmp; cin>>tmp;
S.insert(tmp);
}
cout<<S.size()<<endl;
}

Measured memory_bytes: 19168
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
int main()
{
    int n;
    cin>>n;
    vector<double> v;
    v.push_back(0.0);
    for(int i=0;i<n;i++)
    {
        double value;
        cin>>value;
        v.push_back(value);
    }

    double dp[n+1][n+1];
    memset(dp,0.0,sizeof(dp));
    dp[0][0]=1.0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0)
            {
                dp[i][j]=(dp[i-1][j])*(1.0-v[i]);
            }
            else
            {
                dp[i][j]=((dp[i-1][j])*(1.0-v[i])+(dp[i-1][j-1])*v[i]);
            }
        }
    }
    double res=0.0;
    for(int i=ceil((n+1)/2);i<=n;i++)
    {
        res+=dp[n][i];
    }
    cout<<setprecision(10)<<res<<endl;;
    return 0;
}

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

using namespace std;

#ifndef aa
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#define int long long
typedef long long ll;
typedef long double ld;
#define double long double
#define pii pair<int,int>
#define pdd pair<double,double>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define frev(a,b,c) for(int a=c; a>=b; a--)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
#define deb(x) cout << x << endl
#define done(x) {cout << x << endl;return;}
const ll infl = 0x3f3f3f3f3f3f3f3fLL;
const int infi = 0x3f3f3f3f;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());
//const int mod = 998244353;
const int mod = 1e9 + 7;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int, int>> vpii;
typedef map<int, int> mii;
typedef set<int> si;
typedef set<pair<int,int>> spii;
typedef queue<int> qi;


const int N = 1e5+5;
int f[N];

void solve() {

  int n,x=0;
  cin>>n;
  vi a(n);
  rep(i,0,n)
    cin>>a[i], x^=a[i];

  rep(i,0,n){
    if(i) x^=a[i-1];
    x^=a[i];
    cout<<x<<endl;
  }
  
}


signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    //srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(15);
    int t = 1;
   //cin >> t;

    while (t--)
        solve();
#ifdef aa
    cout << endl << endl << endl << endl << "Time elapsed: " << (double)(clock() - clk) / CLOCKS_PER_SEC << endl;
#endif
    return 0;
}







int powm(int a, int b) {
    int res = 1;
    while (b) {
        if (b & 1)
            res = (res*a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

int divide(int a, int b) {
    return (a % mod) * powm(b, mod - 2) % mod;
}

int norm(int a) {
    while (a >= mod) a -= mod;
    while (a < 0) a += mod;
    return a;
}


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


Measured memory_bytes: 4760
#include <iostream>
#include <iomanip>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int main()
{
    int n, m;
    cin >> n >> m;
    int road[2 * m];
    repi(i, 2 * m, 0)
    {
        cin >> road[i];
    }
    repi(i, n, 0)
    {
        int cnt = 0;
        repi(j, 2 * m, 0)
        {
            if (road[j] == i + 1)
            {
                cnt++;
            }
        }
        cout << cnt << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  char c;
  cin >> c;
  
  if (c == 'a' || c=='i' || c=='u'|| c=='e'|| c=='o'){
    cout << "vowel" <<endl;}
    else {cout << "consonant" << endl;}
  
}

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

#define int long long
#define double long double
#define pq priority_queue
#define pb push_back
#define mp make_pair

int root(int dsu[],int x)
{
  while(dsu[x]!=x)
  {
    dsu[x]=dsu[dsu[x]];
    x=dsu[x];
  }
  return x;
}

void init(int dsu[], int n)
{
  for(int i=0;i<=n;i++)
  {
    dsu[i]=i;
  }
}

void un(int dsu[],int x,int y)
{
  int a=root(dsu,x);
  int b=root(dsu,y);
  dsu[a]=dsu[b];
}

void printprecise(double l,int precision){
    std::cout << std::fixed;
    std::cout << std::setprecision(precision);
    std::cout << l <<endl;
}

int gcd(int x,int y)
{
  if(x==0)
  {
    return y;
  }
  else
  {
    return gcd(y%x,x);
  }
}

int lcm(int x,int y)
{
  return (x*y)/gcd(x,y);
}

main() 
{

  
  int n,w;
  cin>>n>>w;
  int k[n+1][w+1]={0};
  int wt[n];
  int v[n];
  for(int i=0;i<n;i++)
  {
    cin>>wt[i]>>v[i];
  }
  for(int i=0;i<=n;i++)
  {
    for(int j=0;j<=w;j++)
    {
      if(i==0||j==0)
      {
        k[i][j]=0;
      }
      else if(wt[i-1]<=j)
      {
        k[i][j]=max(k[i-1][j],v[i-1]+k[i-1][j-wt[i-1]]);
      }
      else
      {
        k[i][j]=k[i-1][j];
      }
    }
  }
  cout<<k[n][w];

}

  // #ifndef ONLINE_JUDGE
  // cout << "\nTime Elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
  // #endif
// }
// #ifndef ONLINE_JUDGE
// cout << "\nTime Elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " s\n";
// #endif

Measured memory_bytes: 79104
N,C = map(int,input().split())
D = [list(map(int,input().split())) for i in range(C)]
c = [list(map(int,input().split())) for i in range(N)]
color = [{} for i in range(3)]
for h in range(N):
    for w in range(N):
        if c[h][w] not in color[(h+w+2)%3]:
            color[(h+w+2)%3][c[h][w]] = 1
        else:
            color[(h+w+2)%3][c[h][w]] += 1

ans = float('inf')
for c1 in range(1,C+1):
    for c2 in range(1,C+1):
        if c1 != c2:
            for c3 in range(1,C+1):
                if c1 != c3 and c2 != c3:
                    cand = 0
                    for k,v in color[0].items():
                        cand += D[k-1][c1-1]*v
                    for k,v in color[1].items():
                        cand += D[k-1][c2-1]*v
                    for k,v in color[2].items():
                        cand += D[k-1][c3-1]*v
                    ans = min(ans,cand)
print(ans)

Measured memory_bytes: 47580
#include<cstdio>
#include<algorithm>

using namespace std;

int M,y,n,m;
int a,c;
double b;
int main(void){
	scanf("%d",&M);
	for(int ddd=0;ddd<M;ddd++){
		scanf("%d",&m);
		scanf("%d",&y);
		scanf("%d",&n);
		int res=m;
		for(int i=0;i<n;i++){
			scanf("%d %lf %d",&a,&b,&c);
			if(a==1){
				int nd=m;
				for(int j=0;j<y;j++){
					nd+=nd*b;
					nd-=c;
				}
				res=max(res,nd);
			}else{
				int nd=m,ndd=0;
				for(int j=0;j<y;j++){
					ndd+=nd*b;
					nd-=c;
				}
				res=max(res,nd+ndd);
			}
		}
		printf("%d\n",res);
	}
	return 0;
}

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

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var A = int.Parse(input[0]);
            var B = int.Parse(input[1]);
            var C = int.Parse(input[2]);
            var K = int.Parse(input[3]);

            int ans = 0;
            ans += A <= K ? A : K;
            K -= A;
            if (K > 0)
            {
                K -= B;
                if (K > 0)
                {
                    ans -= C <= K ? C : K;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 17876
#include<bits/stdc++.h>
#define f(i,a,b) for(register int i=a;i<=b;++i)
#define ff(i,a,b) for(register int i=a;i>=b;--i)
#define debug(x) cerr << #x << " : " << x << " " << endl
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<string, string> pss;
const ll mod = 1e9 + 7;
const ull mod1 = 2e18 + 7;
const int inf = 0x3f3f3f3f;
const double tiaohe = 0.57721566490153286060651209;
ll oula(ll x) { ll res = x;f(i, 2, x / i) { if (x % i == 0) { res = res / i * (i - 1);while (x % i == 0) x /= i; } }if (x > 1) res = res / x * (x - 1);return res; }
ll quickmod(ll a, ll n, ll m) { ll s = 1;while (n) { if (n & 1) { s = s * a % m; }a = (a*a) % m;n = n / 2; }return s; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
void ex_gcd(ll a, ll b, ll &x, ll &y, ll &d) { if (!b) { d = a, x = 1, y = 0; } else { ex_gcd(b, a % b, y, x, d);y -= x * (a / b); } }
ll inv(ll t, ll p) { ll d, x, y;ex_gcd(t, p, x, y, d);return d == 1 ? (x % p + p) % p : -1; }
bool isPrime(ll x) { if (x == 2)return true;if (x % 2 == 0)return false;for (ll i = 2;i*i <= x;i++) if (x % i == 0)return false; return true; }
//double a = log(n) +tiaohe + 1.0 / (2 * n);
double eqa = (1 + sqrt(5.0)) / 2.0;
const int N = 6e5 + 5;
int t;
vector<pii> a[20];
int main()
{
	//freopen("in.txt", "r", stdin);
	int n;
	while (cin >> n)
	{
		int x, y, m;
		f(i, 1, n)
		{
			scanf("%d", &m);
			while (m--)
			{
				scanf("%d%d", &x, &y);
				a[i].emplace_back(pii{ x,y });
			}
		}
		int ans = 0;
		f(i, 0, (1 << n) - 1)
		{
			int fg = 1,cot=0;
			set<int> st;
			f(j, 0, n - 1)//1-n
			{
				if (i >> j & 1)st.insert(j + 1);
			}
			for (auto I : st)
			{
				for (auto i : a[I])
				{
					if(i.second==1)
					{
						if (!st.count(i.first)) { fg = 0;goto hh; }
					}
					else if (i.second == 0)
					{
						if (st.count(i.first)) { fg = 0;goto hh; }
					}
				}
			}
		hh:if (fg)ans = max(ans, (int)st.size());
		}
		cout << ans << endl;
	}
	return 0;
}

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

#define rep(i,n) for(ll i=0;i<(n);++i)
using ll = long long;
using pll = pair<ll,ll>;
constexpr ll INF = (1LL<<60);
constexpr ll MOD = (1e9+7);
//constexpr ll MOD = (998244353);
template<class T> bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a,const T &b){if(a>b){a=b;return 1;}return 0;}
#if loc||debg||local||debug
void dump(){cerr<<endl;}
template<class T,class... Ts> void dump(T&& h, Ts&&... t){cerr<<h<<", ";dump(forward<Ts>(t)...);}
#else
template<class T,class... Ts> void dump(T&& h, Ts&&... t){}
#endif
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
template<class T> ostream &operator<<(ostream& os,vector<T>const& v){for(auto const& vi:v)os<<vi<<" ";return os;}
template<class T>vector<T> vec(size_t a){return vector<T>(a);}
template<class T, class... Ts>auto vec(size_t a, Ts... ts){return vector<decltype(vec<T>(ts...))>(a, vec<T>(ts...));}
template<class T>vector<T> _vec(size_t a,T v){return vector<T>(a,v);}
template<class T, class... Ts>auto _vec(size_t a, Ts... ts){return vector<decltype(_vec<T>(ts...))>(a, _vec<T>(ts...));}

int in(){int x;scanf("%d",&x);return x;}

int main(){

  int n;
  cin>>n;
  map<ll,ll> m;
  rep(i,n)m[in()]++;

  bool ok=true;
  for(auto x:m)if(x.second>=2)ok=false;
  cout<<(ok?"YES":"NO")<<endl;

}

Measured memory_bytes: 12800