akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cmath>

int a, b, c;

int main() {
    scanf("%d%d%d", &a, &b, &c);
    (c - a - b > 0 && (long long)(c - a - b) * (c - a - b) > (long long)a * b << 2) ? puts("Yes") : puts("No");
    return 0;
}


Measured memory_bytes: 128
let n = Scanf.scanf " %d" (+) 0
let ts = Array.init n @@ fun _ -> Scanf.scanf " %d" (+) 0
let s = Array.fold_left (+) 0 ts
let m = Scanf.scanf " %d" (+) 0
let pxs = Array.init m @@ fun _ -> Scanf.scanf " %d %d" @@ fun a b -> a - 1, b
let _ = Array.iter (fun (p, x) -> Printf.printf "%d\n" @@ s - ts.(p) + x) pxs

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
long long Cnt[200100],X[200100];
int main()
{
  int N;
  cin>>N;
  for(int i=0;i<N;i++)
  {
    cin>>X[i];
    X[i]--;
    Cnt[X[i]]++;
  }
  long long Ans=0;
  for(int i=0;i<N;i++)
    Ans+=Cnt[i]*(Cnt[i]-1)/2;
  for(int i=0;i<N;i++)
  {
    long long Res=Ans;
    Res-=Cnt[X[i]]-1;
    cout<<Res<<endl;
  }
  return 0;
}

Measured memory_bytes: 4736
import math
a, b, h, m = list(map(int, input().split()))
theta = abs(30 * h + (30 / 60 * m) - 6 * m)
theta = math.radians(min(360 - theta, theta))
print((b ** 2 + a ** 2 - 2 * b * a * math.cos(theta)) ** 0.5)


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

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
const ll mod = 1e9+7;
int inf = 1000000000; //10e9
 
int main() {

    int x;
    cin >> x;

    if(x>=30){
        cout << "Yes" << endl;
        return 0;
    }

    cout << "No" << endl;

    return 0;

}

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

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int a, b, c; cin >> a >> b >> c;
  int k; cin >> k;
  int cnt = 0;
  while(b <= a) {
    b *= 2;
    cnt++;
  }

  while(c <= b) {
    c *= 2;
    cnt++;
  }

  cout << (cnt <= k ? "Yes" : "No") << endl;

}








Measured memory_bytes: 3632
import numpy as np
import sys
input = sys.stdin.buffer.readline

N = int(input())
A = list(map(int, (input().split())))
A.sort()
cnt = np.zeros(10**6+10, dtype=np.int32)
for x in A:
    if cnt[x] != 0:
        cnt[x] = 2
        continue
    cnt[x::x] += 1
ans = 0
for x in A:
    if cnt[x] == 1:
        ans += 1
print(ans)

Measured memory_bytes: 45612
#include <bits/stdc++.h>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long long> A(3*N);
	for (auto& x : A) cin >> x;
	sort(A.rbegin(), A.rend());
	long long s = 0;
	for (int i = 0; i < N; ++ i) s += A[2*i+1];
	cout << s << endl;
}


Measured memory_bytes: 2560
#!python3

iim = lambda: map(int, input().rstrip().split())
from heapq import heappush, heappop

def resolve():
    N, W = iim()
    S = [list(iim()) for i in range(N)]

    def f1(v, w, m):
        mm = []
        i = 1
        while i <= m:
            yield i
            m -= i
            i <<= 1

        if m:
            yield m
    SS = list(sorted(((v*i, w*i) for v, w, m in S for i in f1(v, w, m)), key=lambda x: (x[0]/x[1], x[1]), reverse=True))
    NN = len(SS)

    def ubound(v, w, i):
        for j in range(i, NN):
            vj, wj = SS[j]

            if w + wj > W:
                return (-v, -v - (W - w) * vj / wj)

            w += wj
            v += vj

        return (-v, -v)

    u0, u1 =  ubound(0, 0, 0)
    um = u0
    ans = 0

    q = []
    heappush(q, (u1, u0, 0, 0, 0))

    #print(S, NN)
    #print(W, SS)
    while q:
        #print(q)
        uq0, uq1, vq, wq, i = heappop(q)

        if uq0 > um:
            break

        if i >= NN: continue

        vi, wi = SS[i]
        if wq + wi < W:
            heappush(q, (uq0, uq1, vq+vi, wq+wi, i + 1))

        u0, u1 = ubound(vq, wq, i + 1)
        if u1 <= um:
            if u0 < um:
                um = u0
            heappush(q, (u1, u0, vq, wq, i + 1))

    print(-um)



if __name__ == "__main__":
    resolve()



Measured memory_bytes: 5948
import java.util.*;
import java.io.*;
  class Main {
     
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
 
  public static void main(String args[]) throws  IOException {
      assign();
    int[] a=int_arr();
    int n=a[0],m=a[1];
    int[] arr=int_arr();
    int t=0;
    for(int x:arr){t+=x;}
    	int k=(int)Math.ceil((double)t/(4*m));
    int res=0;
    	for(int x:arr){
    		if(x>=k){res++;}
    	}
    	if(res>=m){out.write("Yes");}
    	else{out.write("No");}
    
    out.flush();
    
  }
}


Measured memory_bytes: 22356
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <queue>
#include <set>
using namespace std;

struct Dinic {
	static const int INF = 1e9;

	struct E {
		//to,??????,?????????index
		int to, cap, rev;
		E(int t, int c, int r) {
			to = t;
			cap = c;
			rev = r;
		}
	};

	//?????§????????°
	int MAX_V;
	vector<vector<E>>G;
	Dinic(int max_v) {
		MAX_V = max_v;
		G.resize(MAX_V);
	}

	//?????????
	inline void add_edge(int from, int to, int cap) {
		if (from == to)return;
		G[from].push_back(E(to, cap, G[to].size()));
		G[to].push_back(E(from, 0, G[from].size()-1));
	}

	//?????????
	inline void add_undirected_edge(int from, int to, int cap) {
		if (from == to)return;
		G[from].push_back(E(to, cap, G[to].size()));
		G[to].push_back(E(from, cap, G[from].size()-1));
	}

	//??±???
	vector<int>level;

	//??±?????????????????????
	void bfs(int s) {
		level.assign(MAX_V, -1);
		queue<int> que;
		level[s] = 0;
		que.push(s);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			for (int i = 0; i < G[v].size(); i++) {
				E &e = G[v][i];
				if (e.cap > 0 && level[e.to] < 0) {
					level[e.to] = level[v] + 1;
					que.push(e.to);
				}
			}
		}
	}

	//s -- v -- u -- t
	//t????????±???????????¢?´¢
	int dfs(int s, int u, int crr) {
		if (s == u || crr == 0)return crr;

		int sum = 0;

		for (int i = 0; i < G[u].size(); i++) {
			E& e = G[u][i];				//t??´
			E& ee = G[e.to][e.rev];		//s??´

			int v = e.to;
			if (level[v] >= level[u] || ee.cap <= 0)continue;

			int f = dfs(s, v, min(crr - sum, ee.cap));
			if (f <= 0)continue;

			//???????????´??°
			ee.cap -= f;
			e.cap += f;

			//???????????´??°
			sum += f;

			if (sum == crr)break;
		}

		return sum;
	}

	int max_flow(int s, int t) {
		int flow = 0;
		//t??????????????????????????§
		while(1){
			bfs(s);
			if (level[t] < 0)return flow;
			flow += dfs(s, t, INF);
		}
	}
};


int main()
{
	int V, E;
	cin >> V >> E;

	Dinic dnc(V);

	for (int i = 0; i < E; i++) {
		int u, v, c;
		cin >> u >> v >> c;
		dnc.add_edge(u,v,c);
	}

	cout << dnc.max_flow(0,V-1) << endl;

	return 0;
}

Measured memory_bytes: 3120
#include "bits/stdc++.h"

#define MOD 1000000007
#define rep(i, n) for(ll i=0; i < (n); i++)
#define ALL(v) v.begin(),v.end()
#define DUMP(i, v)for(ll i=0;i<v.size();i++)cout<<v[i]<<" "

using namespace std;
typedef long long int ll;
typedef vector<ll> llvec;
typedef vector<double> dvec;
typedef pair<int, int> P;
struct Edge{ll from, to, cost;};

ll mod(ll a, ll mod){
  ll res = a%mod;
  if(res<0)res=res + mod;
  return res;
}

ll modpow(ll a, ll n, ll mod){
  ll res=1;
  while(n>0){
    if(n&1) res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

ll modinv(ll a, ll mod){
  return modpow(a, mod-2, mod);
}

bool is_prime(ll n){
  ll i = 2;
  if(n==1)return false;
  if(n==2)return true;
  bool res = true;
  while(i*i <n){
    if(n%i==0){
      res = false;
    }
    i = i+1;
  }

  //if(i==1)res = false;
  if(n%i==0)res=false;
  return res;
}


/**************************************
** A main function starts from here  **
***************************************/
int main(){
  string S;
  cin >> S;
  bool ans = true;
  rep(i, S.size()){
    if((i+1)%2==1) ans = ans and (S[i]=='R' or S[i]=='U' or S[i]=='D');
    if((i+1)%2==0) ans = ans and (S[i]=='L' or S[i]=='U' or S[i]=='D');
  }

  cout << (ans? "Yes" : "No");
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define inf 2000000000 // 1e17
// 0-indexed
template <class T>
struct Dinic {
  struct edge {
    int to;
    T cap;
    int rev;
  };
  vector<vector<edge>> lst;
  vector<int> completed;
  vector<int> dist;
  Dinic(int n = 1) {
    // if 1-indexed
    //++n;
    lst.resize(n);
    completed.resize(n);
    dist.resize(n);
  }
  bool add(int start, int goal, T capacity) {
    lst[start].push_back(
        (edge){goal, capacity, (int)lst[goal].size()});
    lst[goal].push_back(
        (edge){start, 0, (int)lst[start].size() - 1});
    return 1;
  }
  // dist = time from start to now number
  void distbfs(int start) {
    fill(dist.begin(), dist.end(), -1);
    queue<int> bfsqu;
    dist[start] = 0;
    bfsqu.push(start);
    while(bfsqu.size() > 0) {
      int now = bfsqu.front();
      bfsqu.pop();
      for(int i = 0; i < lst[now].size(); ++i) {
        edge* nowe = &lst[now][i];
        if(nowe->cap > 0 && dist[nowe->to] < 0) {
          dist[nowe->to] = dist[now] + 1;
          bfsqu.push(nowe->to);
        }
      }
    }
  }
  T pathdfs(int now, int goal, T nf) {
    if(now == goal) return nf;
    for(int& i = completed[now]; i < lst[now].size(); ++i) {
      edge* e = &lst[now][i];
      if(e->cap > 0 && dist[now] < dist[e->to]) {
        T ans = pathdfs(e->to, goal, min(nf, e->cap));
        if(ans > 0) {
          e->cap -= ans;
          lst[e->to][e->rev].cap += ans;
          return ans;
        }
      }
    }
    return 0;
  }
  T solve(int start, int goal) {
    T ans = 0, nf = 0;
    while(1) {
      // bfs
      distbfs(start);
      // cannnot go to goal from start
      if(dist[goal] < 0) return ans;
      // reset
      fill(completed.begin(), completed.end(), 0);
      while((nf = pathdfs(start, goal, inf)) > 0) ans += nf;
    }
    return -1;
  }
};

int n, m;
Dinic<int> din;
vector<int> lst;

bool solve();

int main() {
  cin >> n >> m;
  din = Dinic<int>(n);
  for(int i = 0; i < m; ++i) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    din.add(a, b, 1);
    din.add(b, a, 1);
  }
  if(solve())
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

bool solve() {
  bool ch = 0;
  for(int i = 0; i < n; ++i) {
    if((din.lst[i].size() / 2) % 2 == 1) return 0;
    if(din.lst[i].size() / 2 >= 6)
      ch = 1;
    else if(din.lst[i].size() / 2 >= 4)
      lst.push_back(i);
  }
  if(ch) return 1;
  return lst.size() >= 3 ||
         (lst.size() == 2 &&
          din.solve(lst[0], lst[1]) == 2);
}

Measured memory_bytes: 10880
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

#define int long long int
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() )

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

template <typename T>
using vector2 = vector<vector<T>>;
template <typename T>
vector2<T> initVec2(size_t n0, size_t n1, T e = T()){
    return vector2<T>(n0, vector<T>(n1, e));
}

template <typename T>
using vector3 = vector<vector<vector<T>>>;
template <typename T>
vector3<T> initVec3(size_t n0, size_t n1, size_t n2, T e = T()){
    return vector3<T>(n0, vector2<T>(n1, vector<T>(n2, e)));
}

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

    string b;
    cin >> b;

    string s = "ACGT";
    string t = "TGCA";
    rep(i, SZ(b)){
        rep(j, 4){
            if(b[i] == s[j]){
                cout << t[j];
            }
        }
    }
    cout << endl;

    return 0;
}


Measured memory_bytes: 888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

ll func(ll n){
	if((n+1)%2==0){
		if((n+1)%4==0){
			return 0;
		}else{
			return 1;
		}
	}else{
		if((n+1)%4==1){
			return n;
		}else{
			return n^1;
		}
	}
}

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

	a = max((ll)0, a-1);
	
	ll ansa = func(a);
	ll ansb = func(b);
	
	cout << (ansa^ansb) << endl;
	
	return 0;
}

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

p = [None]*n

for i in range(n):
    p[i] = list(map(int,input().split()))

plan = [[0,0,0]]
plan.extend(p)

for i in range(n):
    diff = [plan[i+1][k] - plan[i][k] for k in range(len(plan[0]))]
    if (abs(diff[1])+abs(diff[2]))>diff[0] or (diff[0]-(abs(diff[1])+abs(diff[2])))%2==1:
        print('No')
        exit()

print('Yes')

Measured memory_bytes: 28068
import java.util.Scanner;

public class Main
{
	public static void main(String arg[])
	{
		Scanner sc = new Scanner(System.in);
		int a[] = new int[2];
		int b[] = new int[2];
		int c[] = new int[2];	
		int d[] = new int[2];

		while(sc.hasNext())
		{
			double le = sc.nextDouble();
			double ri = sc.nextDouble();
			for(;;)
			{
				if(le>=1.1 )
				{
					a[0]++;
					break;
				}	
				else if(le>=0.6 )
				{
					b[0]++;
					break;
				}	
				else if(le>=0.2 )
				{
					c[0]++;
					break;
				}	
				else
				{
					d[0]++;
					break;
				}	
			}
			for(;;)
			{
				if(ri>=1.1 )
				{
					a[1]++;
					break;
				}	
				else if(ri>=0.6 )
				{
					b[1]++;
					break;
				}	
				else if(ri>=0.2 )
				{
					c[1]++;
					break;
				}	
				else
				{
					d[1]++;
					break;
				}	
			}
		}
	System.out.println(a[0]+" "+a[1]);
	System.out.println(b[0]+" "+b[1]);
	System.out.println(c[0]+" "+c[1]);
	System.out.println(d[0]+" "+d[1]);
	}

}

Measured memory_bytes: 12000
#include <bits/stdc++.h>    
//#include <ext/pb_ds/assoc_container.hpp> 
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//using namespace __gnu_pbds; 
#define fastio() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb  push_back
#define show(x) cout<<(#x)<<" : "<<x<<endl;
#define ll  long long
#define ld  long double
#define fill(a,val) memset(a,val,sizeof(a))
#define mp  make_pair
#define ff  first
#define ss  second
#define pii pair<ll,ll>
#define sq(x) ((x)*(x))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define endl "\n"
#define int long long 
#define printclock cerr<<"Time : "<<1000*(ld)clock()/(ld)CLOCKS_PER_SEC<<"ms\n";
const ll MOD     = 1000*1000*1000+7;
const ll INF     = 1ll*1000*1000*1000*1000*1000*1000 + 7;
const ll MOD2    = 998244353;
const ll N       = 1000 * 100 + 10;
const ll N2      = 70;
const ld PI  = 3.141592653589793;
//template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);} 
ll power(ll x,ll y,ll p = LLONG_MAX ){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
ll lcm(ll a , ll b){return (a*b)/gcd(a,b);}
void solve(){
  #ifndef ONLINE_JUDGE    
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif
}
signed main()
{
    fastio();
    //cout<<fixed<<setprecision(20);
    //CHECK for LONG LONG and LONG DOUBLE
    //*comment for all except cc/cf   
    string a; 
    cin>>a; 
    cout<<a.substr(0,3);
    
    //printclock;
    return 0;
}
    

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

#define rep(i,N) for(int i=0;i<N;i++)
#define rep2(i,N) for(int i=1;i<=N;i++)
using namespace std;
long long  INF=1e18;
long long mod=1e9+7;
int dx[2]={1,0};
int dy[2]={0,1};
//status unsolved
long long block[3010][3010]={};
long long result[3010][3010][4]={};
int main(){
    long long r,c,k;
    cin>>r>>c>>k;

    rep(i,k){
        int r1,c1;
        long long v1;
        cin>>r1>>c1>>v1;
        block[r1][c1]=v1;
    }

    queue<int>q;
    //priority_queue< long long,vector<long long>,greater<long long>> Q[10][10];
    q.push(1);
    q.push(1);
    //rep(i,3)result[1][1][i]=block[1][1];
    result[1][1][0]=0;
    if(block[1][1]!=0){
        result[1][1][1]=block[1][1];
    }
    
    
    //priority_queue< long long,vector<long long>,greater<long long>>start;
    
    rep2(l,r)rep2(t,c){
        int nowy=l;
        int nowx=t;
        rep(i,2){
            int ny=nowy+dy[i];
            int nx=nowx+dx[i];

            if(nx<1 || nx>c || ny<1 || ny>r){
                continue;
            }
            else if(i==0){
                    rep(k,4){
                    //アイテムを拾わない
                    result[ny][nx][k]=max(result[nowy][nowx][k],result[ny][nx][k]);
                    }
                    if(block[ny][nx]!=0){
                        rep(k,3){
                        //アイテムを拾う
                        result[ny][nx][k+1]=max(result[nowy][nowx][k]+block[ny][nx],result[ny][nx][k+1]);
                        }
                    }
            
            }
            else{
                rep(k,4){
                    //アイテムを拾わない
                    result[ny][nx][0]=max(result[nowy][nowx][k],result[ny][nx][0]);
                }
                if(block[ny][nx]!=0){
                    rep(k,4){
                    //アイテムを拾う
                    result[ny][nx][1]=max(result[nowy][nowx][k]+block[ny][nx],result[ny][nx][1]);
                    }
                }
            }
        }
    }
    
    long long ans=-1;
    rep(i,4)ans=max(ans,result[r][c][i]);
    cout<< ans<<endl;
    
    return 0;

}
/*


*/


Measured memory_bytes: 356296
#include "bits/stdc++.h"
using namespace std;
#define REP(i,a) for(int i = 0; i < (a);i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;
using Graph = vector < vector<int>>;
/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}

int main() {
	int N, M;
	cin >> N >> M;
	int s[32][32] = {};
	for (int i = 0; i < N; i++) {
		int k = 0;
		cin >> k;
		for (int j = 0; j < k; j++) {
			int b;
			cin >> b;
			s[i][b] = 1;
		}
	}
	int ans = 0;
	for (int i = 1; i <= M; i++) {
		for (int j = 0; j < N; j++) {
			if (s[j][i] == 0) {
				break;
			}
			if (j == N - 1) {
				ans++;
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")

#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
tree<int,int,greater<int>,rb_tree_tag,tree_order_statistics_node_update> map_t;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define sz(x) (int)x.size()
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
#define REV(x) reverse(x.begin(),x.end())
int dx[]={-1,0,1,0};
int dy[]={0,-1,0,1};

int main() {
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    char n;
    cin >> n;
    if(n>='a' && n<='z') {
        cout << 'a';
        return 0;
    }
    cout << 'A';

    return 0;
}


Measured memory_bytes: 3656
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(v) (v).begin(),(v).end()
#define SZ(x) ((int)(x).size())
#define int long long
using namespace std;

signed main()
{   
    int a,b,t; cin>>a>>b>>t;
    cout<<b*(t/a)<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef double D;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
typedef long double ld;

#define rd(x) scanf("%d",&x)
#define rd2(x,y) scanf("%d %d",&x,&y)
#define rd3(x,y,z) scanf("%d %d %d",&x,&y,&z)
#define rl(x) scanf("%lld",&x)
#define rl2(x,y) scanf("%lld %lld",&x,&y)
#define rl3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z)
#define wd(x) printf("%d" ,x)
#define wd2(x,y) printf("%d %d",x,y)
#define wl(x) printf("%lld",x)
#define wl2(x,y) printf("%lld %lld",x,y)
#define PC(x) putchar(x)
#define GC() getchar()
#define NL printf("\n")
#define SP printf(" ")
 
#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define ITER(it,a) for (__typeof(a.begin()) it = a.begin(); it != a.end(); it++)
#define FILL(a,value) memset(a, value, sizeof(a))

#define F first
#define S second
#define MP make_pair
#define PB push_back


#define L_B lower_bound
#define U_B upper_bound

#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fr(i,s,e) for(int i=s;i<e;i++)
#define frl(i,s,e) for(ll i=s;i<e;i++)
#define frr(i,s,e) for(int i=s-1;i>=e;i--)
#define frv(i,a) for(int i = 0;i<(int)a.size();i++)
#define frvr(i,a) for(int i = a.size()-1;i>=0;i--)
#define tr(i,a) for(typeof(a.begin()) i = a.begin(); i != a.end();i++)

#define inf (1000*1000*1000+5)
#define mod 1000000007
#define maxn 100009
#define maxr 100009
int main(){
	//sstd::ios::sync_with_stdio(false); cin.tie(NULL);
	ll n;
	rl(n);
	map<ll,ll> mp;
	ll flag=0;
	fr(i,0,n)
	{
		ll x;
		rl(x);
		if(!mp.count(x))
		{
			mp[x]=1;

		}
		else
			flag=1;


	}
	if(flag==1)
		cout<<"NO\n";
	else
		cout<<"YES\n";
	return 0;
}

Measured memory_bytes: 12800
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)

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

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

const int inf = 1000000007;
const int MOD = 1000000007;
const long long INF = 1000000000000000007;

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

string S;
ll ans;
ll dpres[20], dpsum[20];

ll dfs(int cur) {
  /*
  if (dpsum[cur] != -INF) {
    ans += dpsum[cur];
    return dpres[cur];
  }
  */

  string s = S.substr(cur);
  ll sum = 0;
  sum += stoll(s);
  dpsum[cur] += sum;
  ll res = 1;
  for (int i = 1; i < s.size(); ++i) {
    string f = s.substr(0, i);
    string b = s.substr(i);
    ll patterns = dfs(cur + i);
    sum += stoll(f) * patterns;
    res += patterns;
  }
  dpsum[cur] = sum;
  ans += sum;
  return dpres[cur] = res;
}

int main() {
  rep(i, 0, 20) {
    dpres[i] = -INF;
    dpsum[i] = -INF;
  }
  cin >> S;
  ll res = dfs(0);
  cout << ans << endl;
}


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

#define MAX 2000000000

int n, m, x;
int ans = MAX;
int skill[13][13] = { 0 };
int cost[13] = { 0 };
bool selected[13] = { 0 };

int FindCost() {
	int level[13] = { 0 };
	int sum = 0;
	for (int i = 0; i < n; i++) {
		if (selected[i]) {
			sum += cost[i];
			for (int j = 0; j < m; j++) {
				level[j] += skill[i][j];
			}
		}
	}

	for (int i = 0; i < m; i++) {
		if (level[i] < x) {
			return MAX;
		}
	}

	return sum;
}

void DFS(int max, int idx, int cnt) {
	if (cnt == max) {
		ans = min(ans, FindCost());
		return;
	}

	for (int i = idx; i < n; i++) {
		if (selected[i]) {
			continue;
		}
		selected[i] = true;
		DFS(max, i, cnt + 1);
		selected[i] = false;
	}
}

int main() {
	cin >> n >> m >> x;
	for (int i = 0; i < n; i++) {
		cin >> cost[i];
		for (int j = 0; j < m; j++) {
			cin >> skill[i][j];
		}
	}

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

	if (ans == MAX) {
		cout << -1 << endl;
	}
	else {
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 3620
import sys

#fp = open("input.txt", "r")
fp = sys.stdin

while True:
    n = int(fp.readline()[:-1])
    if n == 0:
        break

    taro = []
    hanako = []

    for i in xrange(n):
        taro.append(int(fp.readline()[:-1]))
    for i in xrange(1, 2*n+1):
        if not i in taro:
            hanako.append(i)

    taro.sort()
    hanako.sort()

    card = [taro, hanako]

    field = 0
    turn = 0
    while len(taro) > 0 and len(hanako) > 0:
        flg = True
        for i in xrange(len(card[turn])):
            if card[turn][i] > field:
                field = card[turn].pop(i)
                flg = False
                break
        if flg:
            field = 0
        turn = 1 - turn
    print len(hanako)
    print len(taro)
        
        

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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  int f = floor(s.size()/2);
  for(int i=0; i<f; i++){
    if(s[0+i] != s[s.size()-1-i]) ans++; 
  }
  
  cout << ans << endl;
}
    

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
 
/*** Template Begins ***/
 
typedef long long    ll;
typedef pair<ll,ll>  pll;
typedef pair<ll, pair<ll, ll> > plll;
typedef vector<long long>  vll;
typedef vector<pll>  vp;
typedef long double ld;
#define rep(i,a,b) for(i=a;i<b;i++)
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define h         1000000000000000007LL
#define hell 1000000007LL
#define all(a)       (a).begin(),(a).end()
ll power(ll x, ll y, ll p)
{
  ll res = 1;
  x = x % p;
  while (y > 0)
  { 
     if (y & 1) 
      res = (res*x) % p;
    y = y>>1;
    x = (x*x) % p;
  } 
  return res; 
} 
const int M = 1005;
const int N = 1005;
const long double PI = acos(-1);
// Debug //
#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll euclid(ll x,ll y,ll a,ll b)
{
  return (a-x)*(a-x)+(b-y)*(b-y);
}
ll mod;
ll add(ll a,ll b)
{
  a%=mod;
  b%=mod;
  return (a+b)%mod;
}

ll sub(ll a,ll b)
{
  a%=mod;
  b%=mod;
  return (a-b+mod)%mod;
}
ll multiply(ll a,ll b)
{
  a%=mod;
  b%=mod;
  return (a*b)%mod;
}
ll inv(ll a)
{
  a = sub(a,0);
  return power(a,mod-2,mod);
}
//Constants // 
bool comp(ll a,ll b)
{
  return a>b;
}
void solve()
{ 
  ll a,b,c,k;
  cin>>a>>b>>c>>k;
  ll ans = 0 ;
  if(k)
  {
    ans += min(a,k);
    k-=min(a,k);
  }
  if(k)
  {
    // ans += min(a,k);
    k-=min(b,k);
  }
  if(k)
  {
    ans -= min(c,k);
    k-=min(c,k);
  }
  cout<<ans;
}
int main()
{ 
  // sieve();
  ios;
  // freopen("input.txt", "r", stdin);
  // freopen("output.txt", "w", stdout);
  ll t,i=1;
  t=1;
  // cin>>t;
  // preprocess();
  while(i<=t)
  {
    solve();
    i++;
  }
  return 0;
}

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

int main() {
	long long n,a,b;cin>>n>>a>>b;
	vector<long long> x(n);
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	long long ans=0;
	for(int i=1;i<n;i++){
		if(a*(x[i]-x[i-1])<b){
			ans+=a*(x[i]-x[i-1]);
		}else{
			ans+=b;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
/*=======================
Author    : Shounak Dey
Filename  : d.cpp
=======================	*/

#include<bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef unsigned long long int ull;

#define PB push_back
#define MK make_pair 
#define SZ(a) (int)(sizeof(a))
#define F first
#define S second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) for(int i=0;i<n;i++)
#define read(n) scanf("%d",&n)
#define readl(n) scanf("%lld",&n)
#define readul(n) scanf("%llu",&n);


#define SORTV(a) sort(a.begin(),a.end())
#define TEST int Test;cin >> Test;while(Test--)
#define gcd(a,b) __gcd(a,b)
#define ffs(a) __builtin_ffs(a) // find first set
#define clz(a) __builtin_clz(a) // count leading zeroes
#define ctz(a) __builtin_ctz(a) // count trailing zeroes
#define popc(a) __builtin_popcount(a) // count set bits
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)


#define error(args...) { vector<string> _v = split(#args, ','); err(_v.begin(), args); }

vector<string> split(const string& s, char c) {
	vector<string> v;
	stringstream ss(s);
	string x;
	while (getline(ss, x, c))
		v.emplace_back(x);
	return move(v);
}

void err(vector<string>::iterator it) {}
template<typename T, typename... Args>
void err(vector<string>::iterator it, T a, Args... args) {
	cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << '\n';
	err(++it, args...);
}

vector<ll> c;
vector<vector<ll>> adj;
vector<ll> visited;

void dfs(ll start,ll curr){
	visited[start] = 1;
	curr += c[start];
	c[start] = curr;
	for(auto it:adj[start]){
		if(!visited[it])
			dfs(it,curr);
	}
	return;
}

int main()
{
	fast_io;
	ll n,q;
	cin >> n >> q;
	c = vector<ll>(n,0);
	adj = vector<vector<ll>>(n,vector<ll>());
	visited = vector<ll>(n,0);
	REP(i,n-1){
		ll x,y;
		cin >> x >> y;
		x--;y--;
		adj[x].PB(y);
		adj[y].PB(x);
	}
	while(q--){
		ll x,v;
		cin >> v >> x;
		v--;
		c[v] += x;
		// for(auto it: c)
		// 	cout << it << " ";
		// cout << endl;
	}
	dfs(0,0);
	for(auto it: c)
		cout << it << " ";
	cout << endl;
	return 0;
}

Measured memory_bytes: 22784
/**
 ____ ____ ____ ____ ____
||a |||t |||o |||d |||o ||
||__|||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|/__\|

**/

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;

int n;

string s;

vector <int> aux;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    cin >> s;
    s = " " + s;
    for(int i = 1; i <= n; i++)
        if(s[i] == 'R')
            aux.push_back(i);
    int ans = 0;
    for(int i = 1; i <= n; i++)
        if(s[i] == 'W')
        {
            if(!aux.empty() && i < aux.back())
            {
                ans++;
                swap(s[i], s[aux.back()]);
                aux.pop_back();
            }
        }
    int cnt = 0;
    int mx = 0;
    for(int i = 1; i <= n; i++)
    {
        if(s[i] == 'R')
            mx = max(mx, cnt);
        else
            cnt++;
    }
    ans += mx;
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 4536
#include<bits//stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1;i <=n;i++)
#define ALL(a) a.begin(),a.end()
typedef long long ll;
typedef long double ld;
int main(){
  string s,t;int n,m,ans = 0;char c;
  cin >> n >> m;vector<int> a(n);
  rep(i,n) cin >> a[i];
  sort(ALL(a));
  rep(i,m){
    ans += a[i];
  }cout << ans << endl;
}

Measured memory_bytes: 3636
//****** @mdazmat9 **********
    #include<bits/stdc++.h>
    using namespace std;
    #define int long long
    #define UB upper_bound
    #define LB lower_bound
    #define BS binary_search
    #define EB emplace_back
    #define endl "\n"
    #define MOD 1000000007
    #define F first
    #define S second
    #define ALL(a) (a).begin(),(a).end()
    #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
    int fast_pow(int x, int y, int p);

    void solve() {
        int h,w,n;
        cin>>h>>w>>n;
        int ans=n/(max(h,w));
        if(n%(max(h,w))!=0)ans++;
        cout<<ans<<endl;
    }
     
    int32_t main() {
        IOS;
        int test = 1;
        //cin >> test;
        while (test--) {
            solve();
        }
        return 0;
    }
    int fast_pow(int x, int y, int p) {
        int res = 1;
        x = x % p;
        while (y > 0) {
            if (y & 1)
                res = (res * x) % p;
            y = y >> 1;
            x = (x * x) % p;
        }
        return res;
    }

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
using namespace std;
int vis[27];
char s[27];
const char m[]="zyxwvutsrqponmlkjihgfedcba";
int main(){
	register int n, i, j, cnt;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	if (n == 26) {
		for (i = 1; i <= n; ++i) if (s[i] != m[i - 1]) break;
		if (i == 27) puts("-1");
		else {
			for (i = 1; i <= n; ++i) if (s[i] == 'z') break;
			for (++i; i <= n; ++i) if (s[i] > s[i - 1]) break;
			if (i == 27) {
				for (i = 1; i <= n; ++i) if (s[i] == 'z') break;
				for (j = 1; j < i; ++j) vis[s[j] - 'a'] = 1;
				for (j = s[i - 1] - 'a' + 1; j < 26; ++j) if (vis[j] == 0) break;
				s[i - 1] = j + 'a', s[i] = 0;
			}
			else {
				for (i = n; i; --i) if (s[i] > s[i - 1]) break;
				for (j = 1; j < i; ++j) vis[s[j] - 'a'] = 1;
				for (j = s[i - 1] - 'a' + 1; j < 26; ++j) if (vis[j] == 0) break;
				s[i - 1] = j + 'a', s[i] = 0;
			}
			puts(s + 1);
		}
		return 0;
	}
	for (i = 1; i <= n; ++i) vis[s[i] - 'a'] = 1;
	for (i = 0; i < 26; ++i) if (vis[i] == 0) break;
	printf("%s%c", s + 1, i + 'a');
	return 0;
}

Measured memory_bytes: 128
//挿入ソート
import java.util.Scanner;

class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int N = stdIn.nextInt();			//数列の長さを入力
		int[] a = new int [N];				//数列の要素
		
		for(int i = 0; i < a.length; i++) {
			a[i] = stdIn.nextInt();
		}
		int v;
		int j;
		
		for(int k = 0; k < a.length - 1 ; k++) {
			System.out.print(a[k] + " ");
		}
		System.out.println(a[a.length - 1]);
		
		for(int i = 1; i < a.length; i++) {
			v = a[i];
			j = i - 1;
			
			while(j >= 0 && a[j] > v) {
				a[j + 1] = a[j];
					j--;
			}
			a[j + 1] = v;
			
			for(int k = 0; k < a.length - 1 ; k++) {
				System.out.print(a[k] + " ");
			}
				System.out.println(a[a.length - 1]);
		}
	}

}



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

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
typedef vector<ll> vll;
typedef vector<ld> vld;
typedef vector<pll> vpl;
typedef vector<vll> vvll;

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define yes cout<<"Yes"<<endl
#define YES cout<<"YES"<<endl
#define no cout<<"No"<<endl
#define NO cout<<"NO"<<endl
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


vll call(vpl h){
  ll n=h.size();
  sort(ALL(h));

  vll res(n+1);

  vvll dp(20,vll(20,LLINF));
  dp[0][0]=0;
  REP(l,n){
    for(ll r=l+1; r<=n; r++){
      ll now=LLINF;
      for(ll k=l; k<r; k++){
        ll s=0;
        for(ll i=l; i<r; i++)
          s+=abs(h[i].FI-h[k].FI)*h[i].SE;
        now=min(now,s);
      }


      REP(j,n)
        dp[r][j+1]=min(dp[l][j]+now,dp[r][j+1]);


      //axis check
      now=0;
      for(ll i=l; i<r; i++)
        now+=abs(h[i].FI)*h[i].SE;
      REP(j,n)
        dp[r][j]=min(dp[l][j]+now,dp[r][j]);
    }
  }


  REP(i,n+1)res[i]=dp[n][i];
  return res;
}

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

  ll n;
  cin>>n;
  vll x(n),y(n),p(n);
  REP(i,n)cin>>x[i]>>y[i]>>p[i];

  vll ans(2*n+1,LLINF);
  REP(i,(1<<n)){
    vpl ax,ay;
    REP(j,n){
      if((i>>j)&1)
        ax.push_back(pll(x[j],p[j]));
      else
        ay.push_back(pll(y[j],p[j]));
    }

    vll rx=call(ax);
    vll ry=call(ay);

    REP(j,rx.size())REP(k,ry.size())ans[j+k]=min(ans[j+k],rx[j]+ry[k]);
  }

  REP(i,n+1)cout<<ans[i]<<endl;

}



Measured memory_bytes: 3676
#include<stdio.h>
int main(){
  int data[10];
  int temp;
  int i,j;
  for(i=0;i<10;i++){
    scanf("%d",&data[i]);
  }
  for(i=0;i<3;i++){
    for(j=0;j<9-i;j++){
      if(data[j]>data[j+1]){
	temp=data[j];
	data[j]=data[j+1];
	data[j+1]=temp;
      }
    }
    printf("%d\n",data[j]);
  }
  return 0;
}

Measured memory_bytes: 1028
#include <iostream>

using namespace std;

using ll = long long;

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

const int MOD = (int) 1e9 + 7;

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

    ll x, y;
    cin >> x >> y;

    if (abs(x - y) <= 1) cout << "Brown" << endl;
    else cout << "Alice" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i=0;i<int(n);++i)
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
// for copy
// for(int i=0;i<N;++i) {
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;

int main(void) {
  int N;
  cin >> N;
  vector<char> S(N);
  REP(i,N) cin >> S[i];
  int ans=1;
  for(int i=1;i<N;++i) {
    if(S[i-1]!=S[i]) ans++;
  }
  pr(ans);

  return 0;
}



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

int main(){
  int n;
  cin >> n;
  string s,sub1,sub2;
  cin >> s;
  vector<int> sumw(n+1,0), sumb(n+1,0);

  rep(i,n) {
    sumw[i+1] += sumw[i];
    sumb[i+1] += sumb[i];
    if (s[i] == '.') sumw[i+1]++;
    else sumb[i+1]++;
  }

  int res = 1e9;
  rep(i,n+1) {
    res = min(res,sumb[i]+sumw[n]-sumw[i]);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 2180
#include <stdio.h>
#include <math.h>

int main(void){
  int a, b, c,k;
  double C;
  scanf("%d", &a);
  scanf("%d", &b);
  c = b;
  while(c > 0){
  	c /= 10;
    k++;
  }
  a = a * pow(10,k);
  c = a + b;
  C = sqrt(c);
  if(ceil(C) == floor(C))
    printf("Yes");
  else
    printf("No");
  return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long ;
using ld=long double;


int main(){
    int n;
    string s;
    cin>>n;
    int a;
    vector<tuple<string,int,int>> v(n);
    for(int i=0;i<n;i++){
        cin>>get<0>(v[i])>>get<1>(v[i]);
        get<1>(v[i])=100-get<1>(v[i]);
        get<2>(v[i])=i+1;
    }
    sort(v.begin(),v.end());
    for(int i=0;i<n;i++){
        cout<<get<2>(v[i])<<endl;
    }
    return 0;
}

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

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

    int n;
    cin >> n;
    
    int ans = 1e9;
    REP(i, n){
        int a, cnt = 0;
        cin >> a;
        while(!(a % 2)){
            a /= 2;
            cnt++;
        }
        ans = min(ans, cnt);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#N=gets.to_i
#S=gets.chomp
#A=(0...N).map{gets.to_i}
#sum=A.inject(&:+)
#B=gets.split.map(&:to_i)

S=gets.chomp

if S !~ /\d+/
  puts "NA"
end

A,B=S[0..1],S[2..3]

aflag= 1<=A.to_i && A.to_i<=12
bflag= 1<=B.to_i && B.to_i<=12

if aflag && bflag
  puts "AMBIGUOUS"
elsif aflag
  puts "MMYY"
elsif bflag
  puts "YYMM"
else
  puts "NA"
end

Measured memory_bytes: 1788
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;

#define FOR(i,s,e) for (int i = int(s); i != int(e); i++)
#define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define ISEQ(c) (c).begin(), (c).end()

int main(){
	string s;
	cin >> s;
	int st = -1;
	int en = -1;

	FOR(i,0,s.length()-1){
		if (s[i] == s[i+1]){
			st = i+1;
			en = i+2;
			break;
		}
		if (i < s.length()-3){
			if(s[i] == s[i+2]){
				st = i+1;
				en = i+3;
			}
		}
	}
	cout << st << " " << en << endl;
	return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <tuple>
#include <cstdio>
#include <bitset>
#include <sstream>
#include <iterator>
#include <numeric>
#include <map>
#include <cstring>
#include <set>
#include <functional>
#include <iomanip>

using namespace std;

#define DEBUG_ //!!$BDs=P;~$K%3%a%s%H%"%&%H(B!!
#ifdef DEBUG_
#define dump(x)  cerr << #x << " = " << (x) << endl;
#else
#define dump(x)  ;
#endif

#define equals(a,b) (fabs((a)-(b)) < EPS)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SZ(x) ((int)(x).size())
#define pb push_back
#define eb emplace_back

//#define int long long

typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;

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

    template <typename T>
std::string printVector(const std::vector<T> &data)
{
    std::stringstream ss;
    std::ostream_iterator<T> out_it(ss, ", ");
    ss << "[";
    std::copy(data.begin(), data.end() - 1, out_it);
    ss << data.back() << "]";
    return ss.str();
}

template <typename T>
void print_array(const T &ary, int size){
    REP(i,size){
        cout << ary[i] << " ";
    }
    cout << endl;
}

const int mod = 1e9+7;
const LL LINF = 1001002003004005006ll;
const int INF = 1001001001;
const double EPS = (1e-10);
const long double PI = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899;
int dx[] = {0,0,-1,1};
int dy[] = {-1,1,0,0};


signed main(int argc, char const *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << setprecision(12);
    int  a; cin >> a ;
    cout << a + a*a + a*a*a << endl;


}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std ;
#define int long long
int n , k  ;
const int N = 2e5 + 10 ;
int a[N] , sum[N] ;
map < int , int > mp ;
signed main() {
  ios :: sync_with_stdio(false) ;
  cin.tie(nullptr) ;
  cout.tie(nullptr) ;
  cin >> n >> k ;
  sum[0] = 0 ; for(int i = 1 ; i <= n ; i ++) { cin >> a[i] ; }
  for(int i = 1 ; i <= n ; i ++) { sum[i] = (sum[i - 1] + a[i] - 1 + k) % k ; }
  int ans = 0 ; mp[0] = 1 ;
  for(int i = 1 ; i <= n ; i ++) {
    if(i >= k) { mp[sum[i - k]] -- ; }
    ans += mp[sum[i]] ++ ;
  }
  cout << ans << '\n' ;
  return 0 ;
}

Measured memory_bytes: 15872
N,K = map(int, input().split())
A = [int(a) for a in input().split()]

ans = [[0, A[i]] for i in range(N)]
idx = 1
for k in range(K):
    for i in range(N):
        ans[i][k%2] = 0
    for i in range(N):
        ans[max(0, i-ans[i][(k+1)%2])][k%2] += 1
        if i+ans[i][(k+1)%2] < N-1:
            ans[i+ans[i][(k+1)%2]+1][k%2] -= 1
    for i in range(N-1):
        ans[i+1][k%2] += ans[i][k%2]
    idx += 1
    idx %= 2
    if ans[0][k%2] == N:
        break

ans2 = [0]*N
for i in range(N):
    ans2[i] = ans[i][idx]
    
print(*ans2)

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

typedef long long LL;  //Attention!!
using namespace std;

#define fillchar(a, x) memset(a, x, sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'

const int M = 1000000007;

bool dis[10];

bool like(int k)
{
while(k!=0)
	{
	if(dis[k%10]) return false;		
	k /= 10;
	}	
return true;
}

int main()
{
ios_base::sync_with_stdio(0); cout.precision(15);cout.setf(ios::fixed);
int n,k;
int i,m;
cin>>n>>k;

for(i=0;i<k;i++)
	{cin>>m;
	dis[m] = true;
	}

for(i=n;;i++)
	if(like(i))
		break;
cout<<i<<endl;	
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int a,b,c,count=0;
	scanf("%d %d %d",&a,&b,&c);

	if(1<=a && c<=10000 && a<=b)
	{
		for (a; a <= b; a++)
		{
			if (c%a == 0)
			{
				count+=1;
			}
		}
		printf("%d\n",count);
	}
	return 0;
}

Measured memory_bytes: 1028
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i,count=0;
  if(n%2==0){
    for(i=0;i<n/2;i++){
      if(s[i]!=s[n/2+i]){
        count++;
      }
    }
    if(count==0){
      cout << "Yes" << endl;
    }
  }
  if(n%2==1 || count>=1){
    cout << "No" << endl;
  }
}

Measured memory_bytes: 256