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

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

using namespace std;

const int V_MAX=100;

bool augment(int u,bool *vis,int match[2][V_MAX],const vector<int> *G){
	if(u==-1) return true;

	rep(i,G[u].size()){
		int v=G[u][i];
		if(!vis[v]){
			vis[v]=true;
			if(augment(match[1][v],vis,match,G)){
				match[0][u]=v;
				match[1][v]=u;
				return true;
			}
		}
	}
	return false;
}

int bipartite_matching(int L,int R,const vector<int> *G){
	static int match[2][V_MAX];
	rep(u,L) match[0][u]=-1;
	rep(v,R) match[1][v]=-1;

	int res=0;
	static bool vis[V_MAX];
	rep(u,L){
		rep(v,R) vis[v]=false;
		if(augment(u,vis,match,G)) res++;
	}
	return res;
}

int main(){
	int n; scanf("%d",&n);
	int x[100];
	rep(i,n) scanf("%d",x+i);

	int ans_size;
	{
		vector<int> G[100];
		rep(u,n) rep(v,n) if(u!=v && x[u]%x[v]==0) G[u].push_back(v);
		ans_size=n-bipartite_matching(n,n,G);
	}

	vector<int> ans;
	rep(t,n){
		{
			bool ok=true;
			rep(i,ans.size()) if(x[ans[i]]%x[t]==0 || x[t]%x[ans[i]]==0) ok=false;
			if(!ok) continue;
			ans.push_back(t);
		}

		vector<int> y;
		for(int i=t+1;i<n;i++){
			bool ok=true;
			rep(j,ans.size()) if(x[ans[j]]%x[i]==0 || x[i]%x[ans[j]]==0) ok=false;
			if(ok){
				y.push_back(x[i]);
			}
		}

		int m=y.size();
		vector<int> G[100];
		rep(u,m) rep(v,m) if(u!=v && y[u]%y[v]==0) G[u].push_back(v);

		if((int)ans.size()+(m-bipartite_matching(m,m,G))<ans_size){
			ans.pop_back();
		}
	}

	rep(i,ans_size) printf("%d%c",ans[i]+1,i<ans_size-1?' ':'\n');

	return 0;
}

Measured memory_bytes: 0
#include<cstdio>
using namespace std;
int n,i,sum=0;
int main()
{
	scanf("%d",&n);
	if(n==3)
	{
		printf("2 5 63\n");
		return 0;
	}
	printf("2 ");
	sum=2;
	n--;
	for(i=4;n>5000||n%2||sum%3!=0;i+=2)
	{
		printf("%d ",i);
		sum+=i;
		n--;
	}
	for(i=3;n;i+=3)
	{
		if(i%2==0)continue;
		printf("%d ",i);
		n--;
	}
	return 0;
}

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

int main(){
  int N,c=0,tot=0;
  cin >> N;
  
  vector<int>d(N);
  
	rep(i,N)
      cin >> d.at(i);
  
  rep(i,N){
    for(int j=i+1;j<N;j++){
      c=d.at(i)*d.at(j);
      tot+=c;
    }
  }
  
  cout << tot << endl;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;
#define MAX 100000
#define NIL -1
struct node{
  int p ; //parent
  int l ; //left
  int r ; //right
};
struct node T[MAX];
int n, D[MAX];
///////////////////////////　プリント関数 //////////////////////////////////////////////////
void print(int r){
  cout << "node " << r << ": "<< "parent = " << T[r].p << ", "<< "depth = "<<D[r]<<", ";

  if(T[r].p== NIL) cout<<"root, ";
  else if(T[r].l==NIL) cout<< "leaf, ";
  else cout<<"internal node, ";
  cout << "[";

  for(int i=0,c=T[r].l;c != NIL ; i++,c=T[c].r){
    if(i) cout<<", ";
    cout<< c;
  }
  cout << "]"<<endl;
}


/////// 再帰的に深さを求める　//////////////////////////////////
int setDepth(int r,int p){
  D[r]= p;
  if(T[r].r !=NIL){
    setDepth(T[r].r,p);
  }
  if(T[r].l != NIL){
    setDepth(T[r].l,p+1);
  }
}
/////////////////////////////////////////////////////////////

int main(){
int id,k,c,r,l,a;
  cin>>n;
 for(int i=0;i<n;i++){
   T[i].p = T[i].l = T[i].r =NIL;
 }

  for(int i=0;i<n;i++){
    cin>> id >> k;     //節点の番号id、次数kを入力
    for(int j=0;j< k;j++){
      cin>> c;
      if(j==0){
        T[id].l= c;
      }
      else T[l].r=c;
      l = c;
      T[c].p = id ;
    }
  }

  for(int i=0;i<n;i++){
    if(T[i].p == NIL) a =i;
  }

  setDepth(a, 0);     //深さ探索
  for(int i=0;i<n;i ++){
   print(i);        //プリント関数
  }
  return 0;
}



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

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> ii;
typedef vector<ll> vi;
typedef vector<ii> vii;

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

	ll r,d,x; cin >> r >> d >> x;
	for(int i=1;i<=10;i++){
		x *= r;
		x -= d;
		cout << x << endl;
	}
}


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

int main(){
  ll S,c,ans = 0;cin >> S >> c;
  if(S*2 <= c){ans += S;c -= 2*S;ans += c/4;cout << ans << endl;}
  else cout << c/2 << endl;
  return 0;
}

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

const long long INF = 1e7 + 1;
const long long MOD = 1000000007;
const long double PI = 3.1415926;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,r,n) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(x) x.begin(),x.end()
#define RALL(x) x.rbegin(),x.rend()

using ll = long long int;
using ull = unsigned long long int;
using vi = vector<ll>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;

ll n, m, k, ans = 0, sum = 0, cnt = 0;
string s;
char c;

/*--------------------template--------------------*/

int main() {
    cin >> n;
    cout << n * n * n << endl;
}


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

int main() {
	int A, B, K;
	cin >> A >> B >> K;
	int count=0;
	for (int i=min(A,B); i>0; i--){
	    if (A%i==0 && B%i==0){
	        count++;
	        if (count==K){
	            cout << i << endl;
	            return 0;
	        }
	    }
	}
}


Measured memory_bytes: 256
H, W = gets.split.map(&:to_i)

S = Array.new(H+2)
S[0] = Array.new(H+2, '$')
H.times do |i|
  S[i+1] = ['$', *gets.chomp.split(''), '$']
end
S[H+1] = Array.new(H+2, '$')
S[0][1] = '.'

result = 0
steps = Array.new(H+2){ Array.new(W+2)}
steps[0][1] = 0
1.upto(H) do |y|
  if S[y][1] == '#' && S[y-1][1] != S[y][1]
    steps[y][1] = steps[y-1][1] + 1
  else  
    steps[y][1] = steps[y-1][1]
  end
  2.upto(W) do |x|
    step = nil
    if S[y][x] == '#' && S[y][x-1] != S[y][x]
      step = steps[y][x-1] + 1
    else
      step = steps[y][x-1]
    end
    unless y == 1
      ystep = nil
      if S[y][x] == '#' && S[y][x] != S[y-1][x]
        ystep = steps[y-1][x] + 1
      else
        ystep = steps[y-1][x]
      end
      step = ystep if ystep < step
    end
    steps[y][x] = step
  end
end

# require 'pp'
# pp steps
puts steps[H][W]

Measured memory_bytes: 3836
/**
 *    Coded by : lucky_21
 *               --------Lokesh Singh
**/

#include<bits/stdc++.h>
using namespace std;

#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;

#define     F           first
#define     S           second
#define     pb          push_back
#define     lb          lower_bound
#define     ub          upper_bound
#define     pii         pair<int,int>
#define     all(x)      x.begin(),x.end()
#define     fix         fixed<<setprecision(10)
#define     rep(i,a,b)  for(int i=int(a);i<=int(b);i++)
#define     repb(i,b,a) for(int i=int(b);i>=int(a);i--)
#define     FastIO      ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)

typedef double db;
typedef long long ll;

const int N=1e6+5;
const int mod=1e9+7;

signed main(){
    FastIO;
    ll n;
    cin>>n;
    vector<int>v;
    rep(i,2,sqrt(n)) if(n%i==0){
        int cnt=0;
        while(n%i==0) cnt++,n/=i;
        v.pb(cnt);
    }
    if(n>1) v.pb(1);
    int ans=0;
    for(int i:v){
        int j=1;
        while(j*(j+1)<=2*i) j++;
        ans+=j-1;
    }
    cout<<ans;
    return 0;
}


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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cout<<setprecision(32);

	int k;
	cin>>k;
	if(k <= 10){
		cout<<k<<endl;
		exit(0);
	}
	deque<ll>dq;
	for(int i = 1; i <= 9; i++){
		dq.push_back(i);
	}
	while(dq.size() < k){
		ll val = dq.front(); dq.pop_front(); k--;
		int dig = val%10;
		if(dig > 0)dq.push_back(val*10 + dig - 1);
		dq.push_back(val*10 + dig);
		if(dig < 9)dq.push_back(val*10 + dig + 1);
	}
	cout<<dq[k - 1]<<endl;

	return 0;
}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int Alice = 0;
  int Bob = 0;
  vector<int> card(N);
 int h = 0;
  while (h < N) 
  {cin >> card.at(h);  h++; }
  sort(card.begin() , card.end());
  reverse(card.begin() , card.end());
  if (N % 2 == 0)
  {
  int i = 1;
  while(i < N) {
    cin >> card.at(i - 1) >> card.at(i); 
    Alice +=card.at(i - 1); Bob +=card.at(i); i +=2;}
  } 
  
  if (N % 2 != 0)  
  { Alice +=card.at(N - 1);
  int j = 1;
  while(j < N) { 
    cin >> card.at(j - 1) >> card.at(j);
    Alice +=card.at(j - 1); Bob +=card.at(j); j +=2; }  
  } 

  if (N == 1) 
  { cin >> card.at(0); Alice = card.at(0); 
  }
 

cout << Alice - Bob;
                }

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

void chmin(long long &a, long long b) { if (a > b) a = b; }
void chmax(long long &a, long long b) { if (a < b) a = b; }
//void chmin(int &a, int b) { if (a > b) a = b; }
//void chmax(int &a, int b) { if (a < b) a = b; }

const long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

//重みある時
using Edge = pair<int,int>;
using Graph = vector<vector<Edge> >;

int main() {
    int n;
    cin >> n;
    vector<int> p(n),q(n),a(n);
    for (int i = 0; i < n; ++i) {
        cin >> p[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> q[i];
    }
    for (int i = 0; i < n; ++i) {
        a[i] = i+1;
    }
    int it = 0,pans = 0,qans = 0;
    do{
        it++;
        if(a == p) pans = it;
        if(a == q) qans = it;
    }while(next_permutation(a.begin(),a.end()));
    cout << abs(pans-qans) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin>>s;
	int k=1;
	string s1,s2;
	s1="";
	s2="";
	s1+=s[0];
	int i;
	i=1;
	while(i<s.length())
	{
		s2+=s[i];
		if(s2.compare(s1)==0)
		{
			i++;
			if(i<s.length())
			{
				s2+=s[i];
			}
			else
			{
			    k--;
			}
		}
		s1=s2;
		s2="";
		k++;
		i++;
	}
	cout<<k<<endl;
	return 0;
}

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

}


Measured memory_bytes: 2104
import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines


# rstrip().decode('utf-8')
# INF=float("inf")
#MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
#import numpy as np
# import operator
#import bisect
# from heapq import heapify,heappop,heappush
#from math import gcd
# from fractions import gcd
#from collections import deque
#from collections import defaultdict
# from collections import Counter
#from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())


def main():
	n=int(input())
	s=input().rstrip().decode('utf-8')
	
	ans=0
	
	for a in range(10):
		a=str(a)
		aidx=s.index(a) if a in s else -1
		if aidx!=-1:
			ss=s[aidx+1:]
			for b in range(10):
				b=str(b)
				bidx = ss.index(b) if b in ss else -1
				if bidx != -1:
					sss=ss[bidx+1:]
					for c in range(10):
						c=str(c)
						if c in sss:
							ans+=1
	
	print(ans)
	
	
if __name__ == "__main__":
		main()


Measured memory_bytes: 38640
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main() 
{
	ios_base::sync_with_stdio(NULL);cin.tie(NULL);
	ll a,b,c; cin>>a>>b>>c;
	swap(a,b);swap(a,c);
	cout<<a<<" "<<b<<" "<<c;
	return 0;
}

Measured memory_bytes: 256
let pi2 = atan 1. *. 8.

let () = Scanf.scanf "%d %d %d %d" @@ fun a b h m ->
  let x = float_of_int a *. sin ((float_of_int h +. float_of_int m /. 60.) *. pi2 /. 12.) in
  let y = float_of_int a *. cos ((float_of_int h +. float_of_int m /. 60.) *. pi2 /. 12.) in
  let x' = float_of_int b *. sin (float_of_int m *. pi2 /. 60.) in
  let y' = float_of_int b *. cos (float_of_int m *. pi2 /. 60.) in
  Printf.printf "%.15f" @@ sqrt @@ (x -. x') *. (x -. x') +. (y -. y') *. (y -. y')




Measured memory_bytes: 4492
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n, W;
    cin >> n >> W;
    vi w(n), v(n);
    rep(i, n) cin >> w[i] >> v[i];
    vvll dp(n+1, vll(W+1, 0));
    rep(i, n) {
        rep(j, W+1) {
            chmax(dp[i+1][j], dp[i][j]);
            if (j - w[i] >= 0) chmax(dp[i+1][j], dp[i][j - w[i]] + v[i]);
        }
    }
    cout << dp[n][W] << endl;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define show(x) {for(auto i: x){cout << i << " ";} cout << endl;}
using namespace std;
using ll = long long;
using P = pair<int, int>;

struct UnionFind {
    vector<int> d;
    UnionFind(int n): d(n,-1) {}
    int root(int x) {
        if (d[x] < 0) return x;
        return d[x] = root(d[x]);
    }
    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (d[x] > d[y]) swap(x,y);
        d[x] += d[y];
        d[y] = x;
        return true;
    }
    bool same(int x, int y) { return root(x) == root(y);}
    int size(int x) { return -d[root(x)];}
};  // UnionFind uf(N+1);  // 1-indexed

int deg[200005];
vector<int> graph[200005];

int main() {
    // unionfind のサイズ
    int N;
    cin >> N;
    vector<P> X(N);
    map<int, int> ytoid;
    vector<int> Y(N);
    UnionFind uf(N);   // 0-indexed
    rep(i, N) {
        cin >> X[i].first >> Y[i];
        X[i].first--;
        Y[i]--;
        X[i].second = i;
        ytoid[Y[i]] = i;
    }
    sort(X.begin(), X.end());
    set<int> st; // setのlower_bound
    rep(i, N) {
        int id = X[i].second;
        int y = Y[id];
        auto it = st.lower_bound(y);
        if (it != st.begin()) {
            it--;
            int target = *it;
            int target_id = ytoid[target];
            uf.unite(id, target_id);
        }
        st.insert(y);
    }
    st = set<int>();
    for (int i = N-1; i >= 0; i--) {
        int id = X[i].second;
        int y = Y[id];
        auto it = st.lower_bound(y);
        if (it != st.end()) {
            int target = *it;
            int target_id = ytoid[target];
            uf.unite(id, target_id);
        }
        st.insert(y);
    }
    st = set<int>();
    rep(i, N) {
        int id = X[i].second;
        int y = Y[id];
        auto it = st.lower_bound(y);
        auto it2 = st.begin();
        if (it != it2) {
            int target = *it2;
            int target_id = ytoid[target];
            uf.unite(id, target_id);
        }
        st.insert(y);
    }
    rep(i, N) {
        cout << uf.size(i) << '\n';
    }
    return 0;
    // ll, 0, -, 1i, for s&g, debug
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/10;
    public static final int inf = Integer.MAX_VALUE/10;

    static void solve(InputReader in, PrintWriter out){
        long h = in.nl(), w = in.nl();
        int n = in.ni();
        int[] dx = new int[]{0,0,1,1,1,0,-1,-1,-1};
        int[] dy = new int[]{0,1,1,0,-1,-1,-1,0,1};
        HashMap<Point, Integer> map = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int a = in.ni(), b = in.ni();
            for (int j = 0; j < 9; j++) {
                if(a+dx[j]<=1||a+dx[j]>=h||b+dy[j]<=1||b+dy[j]>=w) continue;
                Point p = new Point(a+dx[j], b+dy[j]);
                map.put(p, map.containsKey(p)?map.get(p)+1:1);
            }
        }
        long[] ans = new long[10];
        for(Point p: map.keySet()){
            ans[map.get(p)]++;
        }
        ans[0] = (h-2)*(w-2)-map.size();
        for(long l: ans) out.println(l);
    }
    public static class Point{
        int x, y;
        public Point(int x, int y){
            this.x = x; this.y = y;
        }
        @Override
        public boolean equals(Object o){
            return ((Point)o).x==x&&((Point)o).y==y;
        }
        @Override
        public int hashCode(){
            long res = 1114514;
            res *= x;
            res %= mod;
            res *= y;
            res %= mod;
            return (int)res;
        }
    }

    public static void main(String[] args) throws Exception{
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public Double nd(){
            return Double.parseDouble(ns());
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 113952
#include <iostream>
using namespace std;
int main()
{
	char a, b;
	cin >> a;
	if (60 <= a&&a <= 90)
	{
		cout << "A";
	}
	else if(97 <= a && a <= 122)
	{
		cout << "a";
	}
	cin >> b;
	if (60 <= b && b <= 90)
	{
		cout << "A";
	}
	else if (97 <= b && b <= 122)
	{
		cout << "a";
	}
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define rep(i, a, b) for (ll i = a; i < b; ++i)
#define ll long long
#define M 100000007
#define fr first
#define sc second
#define endl "\n"
#define vc vector
#define pb push_back
#define pii pair<ll, ll>
#define psi pair<string, ll>
#define fast                                                                   \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(0);                                                                  \
  cout.tie(0);
#define PI 3.14159265
#define r0 return 0
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define tr(c, i) for (typeof((c)).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c, x) ((c).find(x) != (c).end())
#define cpresent(c, x) (find(all(c), x) != (c).end())
#define what_is(x) cerr << #x << " is " << x << endl;
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<vi> vvi;
typedef vector<ii> vii;
const char char_max = (char)(((unsigned char) char(-1)) / 2);

int main() {
  fast
    string s;
    cin>>s;
    rep(i,0,s.length()){
        if(s[i]=='7'){
            cout<<"Yes";
            return 0;
        }
    }
    cout<<"No";
}



Measured memory_bytes: 3632
import java.io.*;
import java.util.ArrayDeque;
public class Main {
    public static void main(String[] args) throws IOException{
	BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
	int n = Integer.parseInt(reader.readLine());
	ArrayDeque<Integer> list = new ArrayDeque<Integer>();
	String input;
	for (int i = 0; i < n; i++) {
	    input  = reader.readLine();
	    if (input.equals("deleteFirst")) {
		list.removeFirst();
	    } else if (input.equals("deleteLast")) {
		list.removeLast();
	    } else {
		if (input.startsWith("insert")) {
		    list.addFirst(Integer.parseInt(input.substring(7)));
		} else if (input.startsWith("delete")) {
		    list.remove(Integer.parseInt(input.substring(7)));
		}
	    }
	}
	System.out.print(list.poll());
	while (list.size () != 0) {
	    System.out.print(" " + list.poll());
	}
	System.out.println();
    }
}

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

class FRAC{
public:
	int p,q;
	FRAC(){}
	FRAC(int x, int y):p(x),q(y){}
};

int a,l;
FRAC in;

int solve(FRAC n, int num, int q){
	if(in.p*n.q == in.q*n.p) return 1;
	if(num == l) return 0;
	int sum = 0;
	for(int i=q;n.q*i<=a;i++){
		FRAC m = FRAC(n.p*i+n.q, n.q*i);
		if(in.p*m.q < in.q*m.p) continue;
		sum += solve(m, num+1, i);
	}
	return sum;
}

int main(){
	while(cin>>in.p>>in.q>>a>>l,a){
		cout << solve(FRAC(0, 1), 0, 1) << endl;
	}
	return 0;
}

Measured memory_bytes: 868
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int n;
int a[100005];
ll sum=0;
void print(int x)
{
    if(!x)puts("First");
    else puts("Second");
}
int gcd(int x,int y)
{
    if(!y)return x;
    return gcd(y,x%y);
}
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    {
        scanf("%d",&a[i]);sum+=a[i];
    }
    int now=0;
    while(1)
    {
        if(n%2!=sum%2)return print(now),0;
        int id=0;
        for(int i=1;i<=n;i++)
        {
            if(a[i]%2==1&&a[i]!=1)
            {
                if(!id)id=i;
                else return print(now^1),0;
            }
        }
        if(!id)return print(now^1),0;
        a[id]--;
        int g=a[1];for(int i=2;i<=n;i++)g=gcd(g,a[i]);
        sum=0;
        for(int i=1;i<=n;i++)a[i]/=g,sum+=a[i];
        now^=1;
    }
    return 0;
}


Measured memory_bytes: 640
fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map(String::toInt)
    when {
        a >= 13 -> {
            println(b)
        }
        a in 6..12 -> {
            println(b/2)
        }
        else -> {
            println(0)
        }
    }
}

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

typedef long long int ll;
const int N = 5e5;
ll MOD = 1e9+7;
ll fat[N];

ll m(ll x, ll y){
	return (x * y) % MOD;
}

void build(){
	fat[0] = 1;
	for(ll i=1; i < N; i++)
		fat[i] = m(i, fat[i-1]);
}

ll fast_exp(ll x, ll y){
	ll ans = 1;
	ll tmp = x;
	while(y){
		if(y%2 == 1) ans = m(ans, tmp);
		tmp = m(tmp, tmp);
		y /= 2;
	}
	return ans;
}

ll d(ll x, ll y){
	return m(x, fast_exp(y, MOD-2));
}

ll sm(ll x, ll y){
	return (x + y) % MOD;
}

ll sb(ll x, ll y){
	return (MOD + (x%MOD) - (y%MOD)) % MOD;
}

ll ncr(ll x, ll y){
	return d(fat[x+y], m(fat[x], fat[y]));
}

int main(){
	build();
	ll h, w, a, b;

	cin >> h >> w >> a >> b;
	
	ll rm = 0;
	ll ans = 0;
	for(ll i=1; i <= h-a; i++){
		ll x1 = b;
		ll y1 = i-1;
		ll x2 = h-i;
		ll y2 = w-b-1;
		ll tmp1 = ncr(x1, y1);
		ll tmp2 = ncr(x2, y2);
		ans = sm(ans, m(sb(tmp1, rm), tmp2));
		rm = tmp1;
	}
	cout << ans << endl;
}

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

int main() {
	char S[4];
	string T;
	int a = 0;
	int A = 0;
	int b = 0;
	int B = 0;
	int c = 0;
	int C = 0;
	int q, w, z;
	int n = 0;
	int x = 0;
	int y = 0;
	int ans = 0;
	cin >> A>>S[0]>>B;
	if (S[0]=='+') {
		cout << A+B;
	}
	else {
		cout << A-B;
	}
	
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n)-1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(V, v) for (auto &&V : v)
#define all(x) (x).begin(), (x).end()
const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1e9 + 7;
const double EPS = 1e-9;
using lint = long long;

using namespace std;

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

  int n;
  cin >> n;
  vector<int> w(n), cumsum(n + 1);
  rep(i, n) cin >> w[i];
  rep1(i, n) cumsum[i] = cumsum[i - 1] + w[i - 1];
  int minsum = INF;
  rep(mid, n + 1) {
    minsum = min(minsum, abs(cumsum[mid] - (cumsum[n] - cumsum[mid])));
  }
  cout << minsum << endl;
  return 0;
}

Measured memory_bytes: 256
S = input()
K = int(input())
count = 0
if S[0] != '1':
    ans = S[0]
else:
    for i in range(len(S)):
        if S[i] == '1':
            count += 1
        else:
            ans = S[i]
            break
    if K > count:
        ans = S[i]
    else:
        ans = 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    string s;
    cin >> s;
    int n = s.size();

    vector<int> num(256, 0);
    for(int i=0; i<n; ++i)
        ++ num[s[i]];

    cout << min(num['K'], min(num['U'], min(num['P'], num['C']))) << endl;

    return 0;
}

Measured memory_bytes: 0
import sys
while(True):
    M,T,P,R=map(int,input().split())
    if (M,T,P,R)==(0,0,0,0):
        break
    points=[0 for i in range(T)]
    time=[0 for i in range(T)]
    penalty=[[0 for i in range(T)] for i in range(P)]
    for i in range(R):
        m,t,p,j=map(int,input().split())
        #正解したものをもう一度出すかどうかは考慮しない
        if j!=0:
            penalty[p-1][t-1]+=1
            continue
        points[t-1]+=1
        time[t-1]+=m+penalty[p-1][t-1]*20
    teams=[(points[i],time[i],i+1) for i in range(T)]
    teams.sort(key=lambda x:(-x[0],x[1],-x[2]))
    st=str(teams[0][2])
    for i in range(1,T):
        if (teams[i-1][0],teams[i-1][1])==(teams[i][0],teams[i][1]):
            st=st+"="
        else:
            st=st+","
        st=st+str(teams[i][2])
    print(st)
    


Measured memory_bytes: 5636
#include <iostream>
#include <algorithm>

using namespace std;

void SelectSort(int x[], int N);
void BubbleSort(int x[], int N);
void InsertSort(int x[], int N, int num);
void ShellSort(int x[], int N);
void Trace(int x[], int N);

int gCount = 0;

int main() {
    int N;

    cin >> N;

    int x[N];

    for (int i = 0; i < N; i++) {
        cin >> x[i];
    }
    //SelectSort(x, N);
    BubbleSort(x, N);
    Trace(x, N);
    cout << gCount << endl;

    return 0;
}


void SelectSort(int x[], int N) {
    int min;

    for (int i = 0; i < N - 1; i++) {
        min = i;
        for (int j = i; j < N; j++) {
            if (x[min] > x[j]) {
                min = j;
            }
        }
        if (i != min) {
            gCount++;
            swap(x[min], x[i]);
        }
    }
}

void BubbleSort(int x[], int N) {
    for (int i = 0; i < N - 1; i++) {
        for (int j = N - 1; j > i; j--) {
            if (x[j - 1] > x[j]) {
                swap(x[j - 1], x[j]);
                gCount++;
            }
        }
        //Trace(x, N);
    }
}

void Trace (int x[], int N) {
    int i;
    for (i = 0; i < N - 1; i++) {
        cout << x[i] << " ";
    }
    cout << x[i] << endl;
}

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

void OutputSolution(double a, double b, double c, double d, double e, double f)
{
	double y = (a*f - c*d) / (a*e - b*d);
	double x = (c-b*y) / a;
//	if(x == -0) x = 0;
//	if(y == -0) y = 0;
	cout << fixed << setprecision(3) << x << ' ' << y << endl;
}

int main()
{
	while(true){
		double a, b, c, d, e, f;
		cin >> a >> b >> c >> d >> e >> f;
		if(cin.eof()) break;
		OutputSolution(a, b, c, d, e, f);
	}
	return 0;
}

Measured memory_bytes: 3284
#include <bits/stdc++.h>
#include <algorithm>
#include <functional>

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

int gcd(int a, int b){
  int tmp, r;
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
  return b;
}

int main() {
  long int A, B, C;
  cin>>A>>B;
  //vector<int> p(N);
  C = A * B / gcd(A,B);
  cout<<C<<endl;
  
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int A[1000000],n;

int binarySearch(int key){
  int left = 0;
  int right = n;
  int mid;

  while(left < right){
    mid=(left+right)/2;
    if(key==A[mid]) return 1;
    if(key>A[mid])left = mid+1;
    else if(key<A[mid]) right = mid;
  }
  return 0;
}

int main(){
  int i,q,k,sum=0;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&A[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&k);
    if(binarySearch(k)) sum++;
  }
  printf("%d\n",sum);
  return 0;
}



Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
#define _overload3(_1,_2,_3,_4,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n,s) for (int i=n-1;i>=a;i--)
#define range(...) _overload3(__VA_ARGS__,per,repi,_rep,)(__VA_ARGS__)
#define _GLIBCXX_DEBUG
// head

int main(){
    char c[2][3];
    range(i,2){
        range(j,3){
            cin >> c[i][j];
        }
    }
    range(j,3){
        if (c[0][j]!=c[1][2-j]){
            cout << "NO" <<endl;
            return 0;
        }
    }
    cout << "YES" << endl;


}

Measured memory_bytes: 256
A, B, C, X, Y = map(int, input().split())
if X >= Y:
	a = X
else:
	a = Y
min = 2*C*a
for i in range(0, a):
	if X-i > 0 and Y-i > 0:
		ans = 2*C*i + (X-i)*A + (Y-i)*B
	elif X-i <= 0 and Y-i>=0:
		ans = 2*C*i + (Y-i)*B
	elif X-i >= 0 and Y-i <= 0:
		ans = 2*C*i + (X-i)*A
	if min > ans:
		min = ans
print(min)

Measured memory_bytes: 3064
N = gets.to_i

a = 1.step(N).map {|i|
  s = i.to_s
  [s[0].to_i,s[-1].to_i]
}.group_by(&:itself)
a.each {|k,v| a[k] = v.size }

ans = 0
a.each do |k,v|
  rk = k.reverse
  ans += v * a[rk] if a[rk]
end
puts ans


Measured memory_bytes: 18556
l = input().split()
a = int(l[0])
b = int(l[1])
k = int(l[2])

if a >= k:
  a -= k
  k = 0
  print(str(a) + " " + str(b))
else:
  k -= a
  a = 0
  if b >= k:
    b -= k
    print(str(a) + " " + str(b))
  else:
    print("0 0")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define md 1000000007
#define ld long double
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    long long n, i = 0, j= 0, k = 0, l = 0, m = 0, a = 0, b = 0, sum = 0, x = 0, y = 0, z = 0, c, p;
    ll arr[3];
    cin >> arr[0] >> arr[1] >> arr[2];
    sort(arr,arr+3);
    if(arr[1] == arr[0] && arr[1] != arr[2]){
        cout << "Yes";
    }
    else if(arr[2] == arr[1] && arr[1] != arr[0]){
            cout << "Yes";
    }
    else{
        cout << "No";
    }

    return 0;
}


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

using namespace std;

using ll = long long;

#define ALL(A) A.begin(),A.end()

// xxabxbxax => 
// abxbxxax => () a () 

vector<int> rev(string s)
{
    vector<int> ans;
    int counter = 0;
    
    if(s[0]!='x') ans.push_back(0);
    else counter++;

    
    for(int i=0;i<s.size()-1;i++)
    {
        if(s[i+1]!='x')
        {
            ans.push_back(counter);
            counter = 0;
        }
        else
        {
            counter++;
            if(i==s.size()-2)
            {
                ans.push_back(counter);
            }
        }
    }
    
    if(s[s.size()-1]!='x') ans.push_back(0);
    return ans;
}

int compare(vector<int> V)
{
    vector<int> V2 = V;
    reverse(ALL(V2));

    vector<int> Max(V.size(),0);
    for(int i=0;i<V.size();i++)
    {
        Max[i] = max(V[i],V2[i]);
    }

    return accumulate(ALL(Max),0) - accumulate(ALL(V),0);
}

bool kai(string s)
{
    string t1;
    for(auto x : s)
    {
        if(x != 'x') t1.push_back(x);
    }

    string t2 = t1;
    reverse(ALL(t2));

    if(t1==t2) return true;
    else return false;
}

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

    if(!kai(s))
    {
        cout << "-1" << endl;
        return 0;
    } 

    vector<int> V1 = rev(s);

    int ans = compare(V1);

    cout << ans << endl;

    return 0;

}

Measured memory_bytes: 2208
def remove_linked(x, y, DATA):
    DATA[x][y]=0# clear
    move = [[1, 0], [0, 1], [-1, 0], [0, -1]]#left, right, down, up
    for i, j in move:
        nx,ny=x+i,y+j#next x and y
        if -1<nx<12 and -1<ny<12 and DATA[nx][ny]:
            DATA=remove_linked(nx, ny, DATA)
    return DATA

while 1:
    DATA = [[int(x) for x in list(input())] for _ in range(12)]
    count = 0
    for x in range(12):
        for y in range(12):
            if DATA[x][y]:
                count += 1
                DATA = remove_linked(x, y, DATA)
    print (count)
    
    try:input()
    except:break

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

using namespace std;

typedef long long ll;

int main()
{
	ll N;
	vector<char> digits;
	cin >> N;
	while(N >= 1)
	{
		N -= 1;
		digits.push_back('a' + N % 26);
		N /= 26;
	}
	while (1)
	{
		cout << digits.back();
		digits.pop_back();
		if (digits.size() == 0)
			break;
	}
	cout << endl;
	return 0;
 }


Measured memory_bytes: 3616
using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        int[] nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = nk[0];
        int k = nk[1];

        double[] p = new double[n];

        for (int i = 0; i < n; i++)
        {
            int current = i+1;
            int count = 0;
            while (true)
            {
                if (current >= k) break;
                count++;
                current *= 2;
            }

            p[i] = (1 / (double)n) * (Math.Pow(0.5, count));
        }

        double ans = p.Sum();
        Console.WriteLine(ans);
    }

}


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

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

    int a,b,ab,x,y,l,ans = 0;
    cin >> a >> b >> ab >> x >> y;

    if(a + b >= ab * 2){
        if(x > y){
            ans = ab * y * 2 + (x - y) * a;
        }
        else{
            ans = ab * x * 2 + (y - x) * b;
        }
    }
    else{
        ans = a * x + b * y;
    }

    int mx = max(x,y) * ab * 2;

    cout << min(mx,ans) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <queue>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <stack>
#include <complex>
#include <ctime>
#include <unordered_map>
#pragma comment (linker, "/STACK:256000000")

using namespace std;

long long calc(long long x, long long y) {
	long long d = abs(abs(x) - abs(y));
	long long res = d + 2;

	if (x >= 0 && y >= 0) {
		if (x <= y) {
			res = min(res, d);
		}
	}

	if (x < 0 && y >= 0) {
		res = min(res, d + 1);
	}

	if (x <= 0 && y <= 0) {
		if (x <= y) {
			res = min(res, d);
		}
	}
	
	if (x >= 0 && y <= 0) {
		res = min(res, d + 1);
	}
	return res;
}

long long trivial(long long x, long long y) {
	map < long long, int > d;
	d[x] = 0;
	queue < long long > q;
	q.push(x);
	while (!q.empty()) {
		long long v = q.front();
		if (abs(v) > 20) {
			break;
		}
		q.pop();

		if (d.count(v + 1) == 0) {
			d[v + 1] = d[v] + 1;
			q.push(v + 1);
		}
		if (d.count(-v) == 0) {
			d[-v] = d[v] + 1;
			q.push(-v);
		}
	}
	return d[y];
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	long long x, y;
	cin >> x >> y;

	cout << calc(x, y) << endl;


	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int dp[105][4][2];

int main() {
    string s;
    int K;
    cin >> s >> K;
    int digit = s.size();
    dp[0][0][0] = 1;
    rep(i, 0, digit) {
        rep(j, 0, 4) {
            rep(k, 0, 2) {
                int nd = s[i]-'0';
                rep(d, 0, 10) {
                    int ni = i+1, nj = j, nk = k;
                    if(d != 0) nj++;
                    if(nj > K) continue;
                    if(k == 0) {
                        if(d > nd) continue;
                        if(d < nd) nk = 1;
                    }
                    dp[ni][nj][nk] += dp[i][j][k];
                }
            }
        }
    }
    int ans = dp[digit][K][0] + dp[digit][K][1];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	const double eps=1e-11;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		Console.WriteLine("{0}",n+n*n+n*n*n);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27540
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

typedef string::const_iterator state;
class parse_error {};

//Debug
//state it_begin, it_end;

void compare(state &it, char expected) {
	if (*it != expected) {
		cerr << "Expected '" << expected << "',";
		cerr << "got '" << *it << "'";

		//Debug
		//cerr << " rest \"";
		//while (it < it_end) {
		//	cerr << *it++;
		//}
		//cerr << "\"";

		cout << endl;
		throw parse_error();
	}
}

/*

EBNF

expression	= {['+'|'-'] term} | '=';
term		= factor {('*'|'/') factor};
factor		= '(' expression ')' | integer;
integer		= digit {digit};
digit		= '0'|'1'|'2'|'3'|'4'|'5'|'6'|'7'|'8'|'9';

*/

int expression(state &it);
int term(state &it);
int factor(state &it);
int integer(state &it);

int expression(state &it) {
	if (*it == '=')return 0;

	int ret = term(it);

	while (true) {
		if (*it == '+') {
			it++;
			ret += term(it);
		}
		else if (*it == '-') {
			it++;
			ret -= term(it);
		}
		else {
			break;
		}
	}

	return ret;
}

int term(state &it) {
	int ret = factor(it);

	while (true) {
		if (*it == '*') {
			it++;
			ret *= factor(it);
		}
		else if (*it == '/') {
			it++;
			ret /= factor(it);
		}
		else {
			break;
		}
	}
	return ret;
}

int factor(state &it) {
	if (*it == '(') {
		it++;
		int ret = expression(it);
		compare(it, ')');
		it++;
		return ret;
	}
	else {
		return integer(it);
	}
}

int integer(state &it) {
	int ret = 0;

	while (isdigit(*it)) {
		ret *= 10;
		ret += *it - '0';
		it++;
	}

	return ret;
}

int main() {
	int N; cin >> N;
	cin.ignore();
	for (int i = 0; i < N; i++) {
		string s;
		getline(cin, s);

		state it = s.begin();

		//Debug
		//it_begin = s.begin();
		//it_end = s.end();

		int ans = expression(it);
		compare(it, '=');
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 1212
import java.util.*;
import java.io.*;
import java.lang.Integer;
//fastest
class Main{
  static List dummy;

  public static void main(String args[])throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    int n = Integer.parseInt(br.readLine());
    init();
    for(int i = 0 ; i<n; i++){
      String s = br.readLine();
      if(s.charAt(0)=='i'){
        insert(Integer.parseInt(s.substring(7)));
      }else if(s.charAt(6)=='F'){
        deleteFirst();
      }else if(s.charAt(6)=='L'){
        deleteLast();
      }else{
        delete(Integer.parseInt(s.substring(7)));
      }
    }
    Print_list();
  }
  static void init(){
    dummy = new List();
    dummy.next=dummy;
    dummy.previous=dummy;
  }
  //insert
  static void insert(int n){
    List list = new List(n);
    list.next=dummy.next;
    dummy.next.previous=list;
    dummy.next=list;
    list.previous=dummy;
  }
  //ノードの削除メソッド
  static void deleteNode(List delete){
    if( delete == dummy)return;
    delete.previous.next=delete.next;
    delete.next.previous=delete.previous;
  }
  //指定したノードの削除
  static void delete(int n){
    deleteNode(listSearch(n));
  }
  //firstnode削除
  static void deleteFirst(){
    deleteNode(dummy.next);
  }
  //lastnode削除
  static void deleteLast(){
    deleteNode(dummy.previous);
  }
  //keyを使ってノードを探索
  static List listSearch(int n){
    List cur = dummy.next;
    while(cur.data!=n && cur!=dummy){
      cur = cur.next;
    }
    return cur;
  }
  //printメソッド
  static void Print_list(){
    List list = dummy.next;
    if(list != dummy){
      System.out.printf("%d",list.data);
      list = list.next;
    }
    while(list!=dummy){
      System.out.printf(" %d",list.data);
      list = list.next;
    }
    System.out.println();
  }
}
//listの構造体的役割
class List{
  public int data;
  public List next;
  public List previous;

  public List(){}
    public List(int n){
      this.data = n;
    }
  }



Measured memory_bytes: 206868
#include <stdio.h>
#include <stdlib.h>

int main()
{
	long long Q, H, S, D, N;
	scanf("%lld %lld %lld %lld", &Q, &H, &S, &D);
	scanf("%lld", &N);
	
	int i;
	long long ans[6] = {N * Q * 4, N * H * 2, N * S, (N % 2) * S + (N / 2) * D, (N % 2) * H * 2 + (N / 2) * D, (N % 2) * Q * 4 + (N / 2) * D}, min = ans[0];
	for (i = 1; i < 6; i++) if (ans[i] < min) min = ans[i];
	
	printf("%lld\n", min);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <cstdio>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>
#include <queue>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#define ll long long
#define fr(i,k,N) for(ll i=k; i<N;i++)
#define rep(i,N) for(ll i=0; i<N;i++)
#define ALL(v) v.begin(),v.end()
#define mp make_pair
using namespace std;
template <class X> void pr(X test){cout<<test<<endl;}
template <class X> void prr(X test){for(auto it:test){cout<<it<<endl;}}
template <class X> void prrr(X test){int f=0;for(auto it:test){cout<<(f++!=0?" ":"")<<it;}cout<<endl;}
template<typename X>
istream&operator>>(istream&i,vector<X>&v){for(X&x:v)i>>x;return i;}

class UF { // union find from https://github.com/kartikkukreja/blog-codes (MIT)
    // [usage]
    // auto uf = new UF(n);
    // uf->merge(l, r); // 0 <= l, r <= n-1
    // ...
public:
    int *id; // inner id
    int cnt; // number of all vartices
    int *sz; // sz[i] means size of i's set
    UF(int N)   {
        cnt = N;
        id = new int[N];
        sz = new int[N];
        for(int i=0; i<N; i++) {
            id[i] = i;
            sz[i] = 1;
        }
    }
    ~UF() {
        delete [] id;
        delete [] sz;
    }
    int find(int p) {
        int root = p;
        while (root != id[root]) root = id[root];
        while (p != root) {
            int newp = id[p];
            id[p] = root;
            p = newp;
        }
        return root;
    }
    void merge(int x, int y) {
        int i = find(x);
        int j = find(y);
        if (i == j) return;
        
        if (sz[i] < sz[j]) {
            id[i] = j;
            sz[j] += sz[i];
        } else {
            id[j] = i;
            sz[i] += sz[j];
        }
        cnt--;
    }
    bool connected(int x, int y) {
        return find(x) == find(y);
    }
    int count() {
        return cnt;
    }
};

// return sorted 約数list 1 <= x <= n
vector<ll> divv(ll n) {
  vector<ll> v;
  for(ll i = 1; i*i <= n; i++) {
    if(n%i == 0) {
      v.push_back(i);
      if(i*i != n) v.push_back(n/i);
    }
  }
  sort(ALL(v));
  return v;
}


int main() {
    string s;
    cin>>s;
    ll b = 0;
    ll sum = 0;
    for(auto it:s){
        if(it == 'B')b++;
        else sum+=b;
    }
    pr(sum);
}

Measured memory_bytes: 640
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <random>
#include <complex>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iomanip>
using namespace std;
 
#define REP(i,n) for(long long (i)=0;(i)<(long long)(n);(i)++)
#define RREP(i,n) for(long long (i)=(long long)(n)-1;i>=0;i--)
#define REMOVE(Itr,n) (Itr).erase(remove((Itr).begin(),(Itr).end(),n),(Itr).end())
typedef long long ll;
 
int main() {
 
    int N; cin >> N;
    vector<ll> D(N);
    REP(i,N) cin >> D[i];
 
    int M; cin >> M;
    vector<ll> T(M);
    REP(i,M) cin >> T[i];
 
    map<ll,ll> cnt1;
    map<ll,ll> cnt2;
 
    REP(i,N) cnt1[D[i]]++;
    REP(i,M) cnt2[T[i]]++;
 
    for (auto itr = cnt2.begin(); itr != cnt2.end(); itr++) {
        if (itr -> second > cnt1[itr -> first]) {
            cout << "NO" << endl;
            return 0;
        }
    }
 
    cout << "YES" << endl;
 
    return 0;
}

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

using namespace std;

int main() {
	string s, t;
	cin >> s >> t;
	int l = s.length();
	for (int i = 0; i < 111; i++) {
		s = s[l - 1] + s.substr(0, l - 1);
		if (s == t) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
}

Measured memory_bytes: 256