akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define veci vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define vec2(a,b) vector<vec>(a,vec(b))
#define vec2ll(a,b) vector<vec>(a,vecll(b))
#define vec3(a,b,c) vector<vector<vec>>(a,vec2(b,c))
#define vec3ll(a,b,c) vector<vector<vecll>>(a,vec2ll(b,c))
#define fi first
#define se second
#define all(c) begin(c),end(c)
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))


using namespace std;
int in() {int x;cin>>x;return x;}
ll lin() {ll x;cin>>x;return x;}
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;}
template<class T> inline void print(pair<T,T> p){cout<<"("<<p.first<<","<<p.second<<") ";}
//template<class T> inline void print(vector<pair<T,T>> v){for(auto e:v)print(e); cout<<endl;}
//template<class T> inline void print(T v){for(auto e:v)cout<<e<<" ";cout<<endl;}
template<typename T>
istream& operator >> (istream& is, vector<T>& vec){
    for(T& x:vec) is >> x;
    return is;
}
const ll mod=1e9+7;

int main()
{
    string s;
    cin >> s;
    bool flag=false;
    rep(i,2){
        if(s[i]!=s[i+1]) flag=true;
    }
    if(flag){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    return 0;
} 

Measured memory_bytes: 256
// Etavioxy
#include<cstdio>
#include<cctype>
#include<cstring>
#include<algorithm>
#include<cmath>
#define il inline
#define ll long long
#define rep(i,s,t) for(register int i=(s);i<=(t);i++)
#define rev_rep(i,s,t) for(register int i=(s);i>=(t);i--)
#define each(i,u) for(int i=head[u];i;i=bow[i].nxt)
#define file(s) freopen(s".in" ,"r",stdin),freopen(s".out","w",stdout)
#define pt(x) putchar(x)
using namespace std;
il int ci(){
	register char ch;int f=1;
	while(!isdigit(ch=getchar()))f=ch=='-'?-1:1;
	register int x=ch^'0';
	while(isdigit(ch=getchar()))x=(x*10)+(ch^'0');
	return f*x;
}


bool visa[10],visb[10];
int fac[10];

int main(){
	int n=ci();
	fac[0]= 1;
	rep(i,1,n) fac[i]=i*fac[i-1];
	int A=1;
	rep(i,1,n){
		int x=ci();
		int cnt= 0;
		rep(j,1,x-1) if( visa[j]==0 ) cnt++;
		A+= cnt*fac[n-i];
		visa[x]=1;
	}
	int B=1;
	rep(i,1,n){
		int x=ci();
		int cnt= 0;
		rep(j,1,x-1) if( visb[j]==0 ) cnt++;
		B+= cnt*fac[n-i];
		visb[x]=1;
	}
	printf("%d\n",abs(A-B));
	return 0;
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
using namespace std;
#define EPS 1e-10
 
struct Point{
    double x,y;
    Point(){}
    Point(double _x,double _y){
        x=_x; y=_y;
    }
    Point operator +(const Point p)const{
        return Point(x+p.x,y+p.y);
    }
    Point operator -(const Point p)const{
        return Point(x-p.x,y-p.y);
    }
    Point operator *(const double d)const{
        return Point(x*d,y*d);
    }
    bool operator <(const Point &p)const{
        if(x==p.x) return y<p.y;
        return x<p.x;
    }
    double norm(){
        return x*x+y*y;
    }
	bool input(){
		if(cin>>x>>y) return true;
		return false;
	}
};
 
struct Line{
    Point a,b;
    Line(){}
    Line(Point _a,Point _b){
        a=_a; b=_b;
    }
	bool input(){
		if(a.input() && b.input()) return true;
		return false;
	}
};
 
struct Circle{
    Point c;
    double r;
    Circle(){}
    Circle(Point _c,double _r){
        c=_c; r=_r;
    }
};
 
double dot(Point p,Point q){
    return p.x*q.x+p.y*q.y;
}
 
double cross(Point p,Point q){
    return p.x*q.y-q.x*p.y;
}
 
int ccw(Point a,Point b,Point c){ //a,b,c,は全て異なる
	Point v1 = Point(b-a);
	Point v2 = Point(c-a);
    if(cross(v1,v2)>EPS) return +1; //a->b->c が反時計回り
    if(cross(v1,v2)<-EPS) return -1; //a->b->c が時計回り
	if(dot(v1,v2)<-EPS) return +2; //cがa-bより後ろ c<-a->b
	if(v1.norm()<v2.norm()) return -2; //cがa-bより前 a->b->c
    return 0; //cがa-b上 a->c->b
}
 
bool intersect_ss(Line l,Line m) {
    return ccw(l.a,m.a,l.b)*ccw(l.a,m.b,l.b)<=0 && ccw(m.a,l.a,m.b)*ccw(m.a,l.b,m.b)<=0;
}
 
bool crosspoint_ll(Line l,Line m,Point &p){
    Point a1,a2,b1,b2;
    a1 = l.b-l.a; a2 = m.b-m.a;
    b1 = m.a-l.a; b2 = m.b-l.a;
    double s1,s2;
    s1 = abs(cross(a1,b1)/2); s2 = abs(cross(a1,b2)/2);
    if(s1<EPS && s2<EPS) return false;
    p = Point(m.a.x+a2.x*s1/(s1+s2),m.a.y+a2.y*s1/(s1+s2));
    return true;
}
 
bool crosspoint_ss(Line l,Line m,Point &p){
    if(intersect_ss(l,m)==false) return false;
    return crosspoint_ll(l,m,p);
}
 
int crosspoint_cc(Circle c1,Circle c2,Point &p1,Point &p2){
    double d,a,t;
    d = sqrt((c2.c-c1.c).norm());
    if(d<abs(c1.r-c2.r) || c1.r+c2.r<d) return 0;
    a = acos((c1.r*c1.r+d*d-c2.r*c2.r)/(2*c1.r*d));
    t = atan2(c2.c.y-c1.c.y,c2.c.x-c1.c.x);
    p1 = Point(c1.c.x+c1.r*cos(t+a),c1.c.y+c1.r*sin(t+a));
    p2 = Point(c1.c.x+c1.r*cos(t-a),c1.c.y+c1.r*sin(t-a));
    if(abs(p1.x-p2.x)<EPS && abs(p1.y-p2.y)<EPS) return 1;
    return 2;
}
 
int main(){
	int Q;
	Point p1,p2,p3;
	p1.input(); p2.input();
	cin>>Q;
	for(int i=0;i<Q;i++){
		p3.input();
		int w = ccw(p1,p2,p3);
		if(w==1) puts("COUNTER_CLOCKWISE");
		else if(w==-1) puts("CLOCKWISE");
		else if(w==2) puts("ONLINE_BACK");
		else if(w==-2) puts("ONLINE_FRONT");
		else puts("ON_SEGMENT");
	}
}

Measured memory_bytes: 1192
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch SummerVacation | diff SummerVacation.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address SummerVacation.cpp && ./a.out

/*
 
 8/15/2019
 
 14:19-15:19 give up
 17:15- read editorials
 
 https://twitter.com/nabesan_go/status/1160185148605788162
 
 */

const int MAX_N=1e6+1;
int A[MAX_N],B[MAX_N];
int N,M;

VI D[MAX_N];
void solve() {
  REP(i,N) D[A[i]].push_back(i);
  LL res=0;
  priority_queue<int> Q;
  for(int i=M; i>=0; --i) {
    FORR(j,D[M-i]) Q.emplace(B[j]);
    if(SZ(Q)) {
//      dump(Q.top());
      res+=Q.top(), Q.pop();
    }
  }
  cout<<res<<endl;
}

void solve_wrong() {
  vector<tuple<int,int,int>> X;
  REP(i,N) X.emplace_back(A[i]+B[i],B[i],A[i]);
  sort(ALL(X)),reverse(ALL(X));
  LL res=0;
  REP(i,N) {
    int d,v; tie(ignore,v,d)=X[i];
//    dump(d,v);
    if(i+d<=M) res+=v;
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>N>>M;
  REP(i,N) cin>>A[i]>>B[i];
  solve();
  
  return 0;
}


Measured memory_bytes: 29952
#include <utility>
#include <stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<cmath>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define YES(b) std::cout<< (b ? "Yes" : "No")
using namespace std;
int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, ans = {};
	cin >> s;
	ans += 'A';
	cin >> s;
	ans += s[0];
	cin >> s;
	ans += 'C';
	cout << ans;
}


Measured memory_bytes: 256
#include <iostream>

int bubbleSort(int A[], int N)
{
    int sortedNum = 0;
    bool flag = true;
    while (flag)
    {
        flag = false;

        for (int j = N-1; j > 0; j--)
        {
            if (A[j] < A[j-1])
            {
                int temp = A[j];
                A[j]   = A[j-1];
                A[j-1] = temp;
                sortedNum++;
                flag = true;
            }
        }
    }

    return sortedNum;
}

int main()
{
    int num;
    std::cin >> num;

    int *element = new int[num];
    for (int i = 0; i < num; i++) std::cin >> element[i];

    int sortedNum = bubbleSort(element, num);

    for (int i = 0; i < num; i++)
    {
        std::cout << element[i];

        if (i < num - 1) std::cout << " ";
        else             std::cout << std::endl;
    }

    std::cout << sortedNum << std::endl;
}


Measured memory_bytes: 3092
import java.util.Arrays;

public class Main {

	private static void solve() {
		int n = ni();
		int[] a = na(n);
		Arrays.sort(a);
		
		if (a[0] + 1 < a[n-1]) {
			System.out.println("No");
		} else if (a[0] == a[n-1]) {
			if (n / a[0] >= 2 || a[0] == n - 1) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		} else {
			int x = a[0];
			int y = (int)Arrays.stream(a).filter(o -> o == x).count();
			int z = (x + 1) - y; //x+1の色数
			if (1 <= z && z <= (n - y) / 2 && y + (n - y) / 2 >= x && x >= y) {
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}
	}

	public static void main(String[] args) {
		new Thread(null, new Runnable() {
			@Override
			public void run() {
				long start = System.currentTimeMillis();
				String debug = args.length > 0 ? args[0] : null;
				if (debug != null) {
					try {
						is = java.nio.file.Files.newInputStream(java.nio.file.Paths.get(debug));
					} catch (Exception e) {
						throw new RuntimeException(e);
					}
				}
				reader = new java.io.BufferedReader(new java.io.InputStreamReader(is), 32768);
				solve();
				out.flush();
				tr((System.currentTimeMillis() - start) + "ms");
			}
		}, "", 64000000).start();
	}

	private static java.io.InputStream is = System.in;
	private static java.io.PrintWriter out = new java.io.PrintWriter(System.out);
	private static java.util.StringTokenizer tokenizer = null;
	private static java.io.BufferedReader reader;

	public static String next() {
		while (tokenizer == null || !tokenizer.hasMoreTokens()) {
			try {
				tokenizer = new java.util.StringTokenizer(reader.readLine());
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
		return tokenizer.nextToken();
	}

	private static double nd() {
		return Double.parseDouble(next());
	}

	private static long nl() {
		return Long.parseLong(next());
	}

	private static int[] na(int n) {
		int[] a = new int[n];
		for (int i = 0; i < n; i++)
			a[i] = ni();
		return a;
	}

	private static char[] ns() {
		return next().toCharArray();
	}

	private static long[] nal(int n) {
		long[] a = new long[n];
		for (int i = 0; i < n; i++)
			a[i] = nl();
		return a;
	}

	private static int[][] ntable(int n, int m) {
		int[][] table = new int[n][m];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[i][j] = ni();
			}
		}
		return table;
	}

	private static int[][] nlist(int n, int m) {
		int[][] table = new int[m][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < m; j++) {
				table[j][i] = ni();
			}
		}
		return table;
	}

	private static int ni() {
		return Integer.parseInt(next());
	}

	private static void tr(Object... o) {
		if (is != System.in)
			System.out.println(java.util.Arrays.deepToString(o));
	}
}


Measured memory_bytes: 38304
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long int

signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
	int N, K;
	cin >> N >> K;

	int ans = 0;
	if (K == 0) {
		cout << N * N << endl;
		return 0;
	}
	REP(b, K + 1, N) {
		int l = b - K;
		ans += l * (N / b);
		int tmp = max(0LL, N - (N / b) * b - K + 1);
		ans += tmp;
		// cout << ans << " " << l * (N / b) << " " << tmp << endl;
	}
	cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.Comparator;
import java.util.Scanner;

class Main{


	static int[][] map ;
	static long INF =Long.MAX_VALUE/2;
	static int n,m ;
	static	long[] dis;

	public static void main(String[] args) {


		Scanner sc = new Scanner(System.in);			//文字の入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();

		for(int i = 0;i < 10000;i++){
			int x = a * i;
			if(x % b == c){
				System.out.println("YES");
				return;

			}
		}




		System.out.println("NO");




	}
}





class MyComparator implements Comparator {

	public int compare(Object obj1, Object obj2) {

		int num1 = (int)obj1;
		int num2 = (int)obj2;

		if(num1 < num2) {
			return 1;
		} else if(num1 > num2) {
			return -1;
		} else{
			return 0;
		}
	}
}




Measured memory_bytes: 23124
#include<bits/stdc++.h>
using namespace std;
bool palindrome(string A,int pos1,int pos2){
    bool flag = 1;
   for(int i=pos1;i<=pos2;i++){
    if(A[i] != A[pos2-i])
        flag = 0;
   }
   return flag;
}

int main(){
string A;
int pos1,pos2;
bool flag1, flag2;
cin>>A;
int ln = A.size();
pos1 = 0;
pos2 = A.size()/2 - 1;
flag1 = palindrome(A,pos1,pos2);
pos1 = A.size()/2;
pos2 = A.size() - 1;
flag2 = palindrome(A,pos1,pos2);

if(flag1 == 1 && flag2 == 1){
    cout<<"Yes"<<endl;
}
else
    cout<<"No"<<endl;
}


Measured memory_bytes: 256
import sys
input=sys.stdin.readline

d=int(input())
C=list(map(int,input().split()))
S=[list(map(int,input().split())) for _ in range(d)]
A=[sorted([[j,S[i][j]] for j in range(26)],key=lambda x:x[1],reverse=True) for i in range(d)]


DP=[0]*26
for i in range(d):
    num,index=0,0
    for j in range(26):
        if A[i][j][1]-(C[j]*(i-DP[j]))>num:
            num=A[i][j][1]-C[j]*(i-DP[j])
            index=j
    DP[index]=i
    print(index+1)

Measured memory_bytes: 70296
n,m = map(int, input().split())
break_stair = [False for i in range(n)]
for i in range(m):
    break_stair[int(input())-1] = True
mod = 10**9+7
# i番目にたどり着く総数
dp = [0 for i in range(n+1)]
dp[0] = 1
if break_stair[0]:
    dp[1] = 0
else:
    dp[1] = 1
for i in range(n-1):
    if break_stair[i+1]:
        dp[i+2] = 0
    else:
        dp[i+2] = (dp[i] + dp[i+1])%mod
print(dp[n])

Measured memory_bytes: 50848
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int dm = 1 << 16;
char dn[dm], * di = dn;
inline void putint(int X) {
	int keta = 0;
	char C[10];
	while (X) {
		*(C + keta) = '0' + X % 10;
		X /= 10;
		keta++;
	}
	for (int i = keta - 1; i >= 0; i--)* di++ = (*(C + i));
	*di++ = '\n';
}

const ll mod = 998244353;
ll modpow(ll A, ll B) {
	ll kotae = 1;
	while (B > 0) {
		if (B & 1) kotae = kotae * A % mod;
		A = A * A % mod;
		B >>= 1;
	}
	return kotae;
}

const int IMAX = 4000;
int fac[IMAX + 1], ifac[IMAX + 1];
inline ll comb(int A, int B) {
	return fac[A] * ifac[B] % mod * ifac[A - B] % mod;
}

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



	int K, N;
	scanf("%d", &K);
	scanf("%d", &N);

	if (K == 1) {
		printf("0");
		return 0;
	}

	fac[0] = 1;
	rep1(i, IMAX) fac[i] = (ll)fac[i - 1] * i % mod;
	ifac[IMAX] = modpow(fac[IMAX], mod - 2);
	for (int i = IMAX; i > 0; i--) ifac[i - 1] = (ll)ifac[i] * i % mod;
	int H[1001];
	rep(i, 1001) {
		if (N >= 2 * i) {
			if (i & 1) H[i] = (ll)-fac[N + K - 1 - 2 * i] * ifac[N - 2 * i] % mod;
			else H[i] = (ll)fac[N + K - 1 - 2 * i] * ifac[N - 2 * i] % mod;
		}
	}

	int kotae[1001];
	rep1(i, (K + 1) / 2) {
		ll tmp = 0;
		for (int j = 0; j <= i && N >= j * 2; j++) {
			tmp += (ll)ifac[j] * ifac[i - j] % mod * H[j] % mod;
		}
		kotae[i] = (tmp % mod * ifac[K - 1] % mod * fac[i] % mod + mod) % mod;
	}

	rep1(i, (K + 1) / 2 - 1) {
		putint(kotae[i]);
		putint(kotae[i]);
	}
	putint(kotae[(K + 1) / 2]);
	if (!(K & 1)) {
		putint(kotae[(K + 1) / 2]);
		putint(kotae[(K + 1) / 2]);
	}
	for (int i = (K + 1) / 2 - 1; i >= 1; i--) {
		putint(kotae[i]);
		putint(kotae[i]);
	}

	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<queue>
#define int long long
#define mod (int)(1000000007)
using namespace std;
int test[213456]; string uiop[213456];
signed main() {
	int n, a, b = 0, c = 1234567890, ans = 0; string s; cin >> n;
	for (int h = 0; h < n; h++) {
		cin >> a; ans += abs(a); c = min(c, abs(a));
		if (a < 0) { b++; }
	}
	if (b % 2 == 0) { cout << ans << endl; }
	else { cout << ans - c - c << endl; }
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define dup(x,y) (((x)+(y)-1)/(y))
#define v(T) vector<T>
#define vv(T) v(v(T))
#define diup(v,a) distance((v).begin(),upper_bound((v).begin(),(v).end(),(a)))
#define dilo(v,a) distance((v).begin(),lower_bound((v).begin(),(v).end(),(a)))
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pil = pair<int,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(v.size())o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
const double eps = 1e-6;
const ll LINF = 100200300400500600ll;
const int INF = 1001001001;
//--------------------------------------------------------
#define fastio cin.tie(nullptr); std::ios::sync_with_stdio(false);
#define myio ifstream iofi; if(argc>1){iofi.open(argv[1]); std::cin.rdbuf(iofi.rdbuf());}
#define myloopset int loop = 1; if(argc>2) loop =stoi(argv[2]); rep(i,loop)
//--------------------------------------------------------------
template <class T> T chmin(T &a,T b){if(a>b){a=b; return 1;}else return 0;}
template <class T> T chmax(T &a,T b){if(a<b){a=b; return 1;}else return 0;}
const int dx[4] = {0,1,0,-1};
const int dy[4] = {-1,0,1,0};
#define MOD 1000000007

struct D21{
  int is,js;
  D21(int isize,int jsize){
    is = isize;
    js = jsize;
  }
  int operator()(int i,int j){
    return i*js+j;
  }
};


void Main(){
  string s,t;
  cin>>s>>t;
  int n = s.length();
  int m = t.length();
  vvi dp(n+2,vi(m+2,0));
  rep(i,n) rep(j,m) {
    if(s[i]==t[j]){
      dp[i+1][j+1] = dp[i][j]+1;
    } else {
      dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
    }
  }

  string ans;
  int d = dp[n][m]-1;
  drep(i,n){ 
    drep(j,m){
      if(dp[i+1][j+1]==d+1 and dp[i][j+1]==d and dp[i+1][j]==d and dp[i][j]==d){
        ans = s[i] + ans;
        d--; break; 
      }
    }
  }
  cout<<ans<<endl;
} signed main(int argc,char** argv)
{fastio; myio; myloopset Main();}


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

int main(){
    int n;
    cin>>n;
    int a[n];
    //this questions statement is not clear
    int mx=-1e8+5,count=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        count+=(a[i]>=mx);
        mx=max(mx,a[i]);
    }
    cout<<count;
    
}

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

int main() {
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if((A+B) > (C+D)){
    cout << "Left" << endl;
  }
  else if(((A+B) < (C+D))){
    cout << "Right" << endl;
  }
  else{
    cout << "Balanced" << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
#define pb push_back
#define ff first 
#define ss second  
typedef pair<int,int> pp;
bool com(pp x,pp y){
    return x.ff<y.ff;
} 
int N=1e5+9;
int main() {
	// your code goes here
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	ll l[n]; 
	ll ans=0;
	for(int i=0;i<n;i++) cin>>l[i];
	for(int i=0;i<n;i++){
	    for(int j=i+1;j<n;j++){ 
	        if(l[i]==l[j]) continue;
	        for(int k=j+1;k<n;k++){
	            if(l[k]==l[j]||l[k]==l[i]) continue;
	            int x=l[i]+l[j];
	            int y=l[i]+l[k];
	            int z=l[j]+l[k];
	            if(x<=l[k]||y<=l[j]||z<=l[i]) continue;
	            ans++;
	        }
	    }
	} 
	cout<<ans<<"\n";
	return 0; 
	
}


Measured memory_bytes: 3608
def bisearch(li, tgt):
    upper, lower = len(li)-1, 0
    while upper>=lower:
        mid = lower + (upper-lower)//2
        if(li[mid]==tgt):
            return mid
        elif(li[mid]>tgt):
            upper = mid-1
        else:
            lower = mid+1
        
    return -1

N = int(input())
S = [int(i) for i in input().split()]
Q = int(input())
T = [int(i) for i in input().split()]
cnt = 0
for t in T:
    if(bisearch(S, t)!=-1):
        cnt += 1
print(cnt)



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

using namespace std;
struct node
{
    int x,y;
    string s;
}a[105];
bool cmp(node a,node b)
{
    if(a.s!=b.s)
    return a.s<b.s;
    else
        return a.x>b.x;
}
int main()
{
    int i,n;
    scanf("%d",&n);
    for(i=0;i<n;i++)
    {
        cin>>a[i].s>>a[i].x;
        a[i].y=i+1;
    }
    sort(a,a+n,cmp);
    for(i=0;i<n;i++)
        printf("%d\n",a[i].y);
    return 0;
}


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

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

int main(){
    string s, t; cin>>s;
    ll n = s.size();
    vector<ll> cnt(n+1, 0);
    ll q=0;
    ll res = 0;
    ll mod = 1e9+7;
    rep(i, n){
        cnt[i+1] = cnt[i];
        if(s[i] == '?'){
            cnt[i+1]++;
            q++;
            continue;
        }
        t.push_back(s[i]);
    }
    if(q>=3){
        ll tmp = q*(q-1)*(q-2)/6;
        tmp %= mod;
        tmp *= modpow(3, q-3, mod);
        res += tmp;
        res %= mod;
    }
    rep(i, n){
        if(s[i]=='A'){
            res += (q-cnt[i+1])*(q-cnt[i+1]-1)/2 * modpow(3, q-2, mod);
        }else if(s[i]=='B'){
            res += cnt[i+1] * (q-cnt[i+1]) * modpow(3, q-2, mod);
        }else if(s[i]=='C'){
            res += cnt[i+1] * (cnt[i+1] - 1) /2 * modpow(3, q-2, mod);
        }
        res %= mod;
    }
    vector<vector<ll>> dp(n+1, vector<ll>(3, 0));

    dp[0][0] = 0; dp[0][1] = 0; dp[0][2] = 0;
    rep(i, n){
        dp[i+1] = dp[i];
        if(s[i] == 'A') dp[i+1][0]++;
        else if(s[i]=='B') dp[i+1][1] += dp[i][0];
        else if(s[i]=='C') dp[i+1][2] += dp[i][1];
        dp[i+1][0]%=mod;
        dp[i+1][1]%=mod;
        dp[i+1][2]%=mod;
    }
    res += dp[n][2] * modpow(3, q, mod);
    res %= mod;

    dp[0][0] = 0; dp[0][1] = 0; dp[0][2] = 0;
    rep(i, n){
        dp[i+1] = dp[i];
        if(s[i] == 'A') dp[i+1][0]++;
        else if(s[i]=='B') dp[i+1][1] += dp[i][0];
        else if(s[i]=='?') dp[i+1][2] += dp[i][1];
        dp[i+1][0]%=mod;
        dp[i+1][1]%=mod;
        dp[i+1][2]%=mod;
    }
    res += dp[n][2] * modpow(3, q-1, mod);
    res %= mod;

    dp[0][0] = 0; dp[0][1] = 0; dp[0][2] = 0;
    rep(i, n){
        dp[i+1] = dp[i];
        if(s[i] == 'A') dp[i+1][0]++;
        else if(s[i]=='?') dp[i+1][1] += dp[i][0];
        else if(s[i]=='C') dp[i+1][2] += dp[i][1];
        dp[i+1][0]%=mod;
        dp[i+1][1]%=mod;
        dp[i+1][2]%=mod;
    }
    res += dp[n][2] * modpow(3, q-1, mod);
    res %= mod;

    dp[0][0] = 0; dp[0][1] = 0; dp[0][2] = 0;
    rep(i, n){
        dp[i+1] = dp[i];
        if(s[i] == '?') dp[i+1][0]++;
        else if(s[i]=='B') dp[i+1][1] += dp[i][0];
        else if(s[i]=='C') dp[i+1][2] += dp[i][1];
        dp[i+1][0]%=mod;
        dp[i+1][1]%=mod;
        dp[i+1][2]%=mod;
    }
    res += dp[n][2] * modpow(3, q-1, mod);
    res %= mod;

    cout << res << endl;

    return 0;
}

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

using namespace std;
 
#define int long long
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define PI 3.14159265359
 
#define deb(x) {x}
#ifndef local
	#define deb(x) ;
#endif
///----------------------------------------------------------------------------------
 
int n,arr[200005];
map<int,int,greater<int> > M;

void solve()
{
	cin>>n;rep(i,0,n)cin>>arr[i],M[arr[i]]++;
	
	rep(i,0,n)
	{
		M[arr[i]]--;
		if (M[arr[i]]==0)M.erase(arr[i]);
		cout<<M.begin()->ff<<"\n";
		M[arr[i]]++;
	}
}

signed main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
 
    #ifdef local
    ///freopen("input.txt","r",stdin);
    ///freopen("output.txt","w",stdout);
    clock_t qwertyuiop = clock();
    #endif
 
 
    int t=1;
   // cin>>t;
    
    rep(a,0,t)
    {
        ///cout<<"Case #"<<a+1<<": ";
        solve();
    }
    #ifdef local
	{qwertyuiop = clock() - qwertyuiop;double time_taken = ((double)qwertyuiop)/CLOCKS_PER_SEC;cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "<<time_taken<<" seconds\n";}
	#endif
}

Measured memory_bytes: 10624
N = int(input())
red = []
blue = []
chosen = [0]*N
ans = 0
for i in range(N):
  a,b = map(int, input().split())
  red.append((a,b))
for i in range(N):
  c,d = map(int, input().split())
  blue.append((c,d))
  
red.sort(key=lambda x:x[1],reverse=True)
blue.sort(key=lambda x:x[0])

for i in range(N):
  for j in range(N):
    if blue[i][0] >= red[j][0] and blue[i][1] >= red[j][1] and chosen[j] == 0:
      chosen[j] = 1
      ans += 1
      break
      
print(ans)

Measured memory_bytes: 3064
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] a = new int[9];
		for(int i = 0; i < 9; i++) {
				a[i] = sc.nextInt();
		}
		int n = sc.nextInt();
		int[] b = new int[n];
		for(int i = 0; i < n; i++) {
			b[i] = sc.nextInt();
		}

		for(int i = 0; i < 9; i++) {
			for(int j = 0; j < n; j++) {
				if(a[i] == b[j]) {
					a[i] = 0;
				}
			}
		}
		boolean bool = false;
		if(a[0] == 0 && a[1] == 0 && a[2] == 0) {
			bool = true;
		}
		if(a[3] == 0 && a[4] == 0 && a[5] == 0) {
			bool = true;
		}
		if(a[6] == 0 && a[7] == 0 && a[8] == 0) {
			bool = true;
		}
		if(a[0] == 0 && a[3] == 0 && a[6] == 0) {
			bool = true;
		}
		if(a[1] == 0 && a[4] == 0 && a[7] == 0) {
			bool = true;
		}
		if(a[2] == 0 && a[5] == 0 && a[8] == 0) {
			bool = true;
		}
		if(a[0] == 0 && a[4] == 0 && a[8] == 0) {
			bool = true;
		}
		if(a[2] == 0 && a[4] == 0 && a[6] == 0) {
			bool = true;
		}
			if(bool) {
				System.out.println("Yes");
			}else {
				System.out.println("No");
			}
		sc.close();
	}
}

Measured memory_bytes: 35708
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int CX = 60;
const int CY = 60;
const int MAX_X = CX * 2 + 1;
const int MAX_Y = CY * 2 + 1;

const int dxs[] = { 1, 1, 0, -1, -1,  0 };
const int dys[] = { 0, 1, 1,  0, -1, -1 };

const int INF = 1 << 29;

/* typedef */

typedef pair<int,int> pii;

/* global variables */

int dists[MAX_Y][MAX_X];

/* subroutines */

/* main */

int main() {
  for (;;) {
    int tn, n;
    cin >> tn >> n;
    if (tn == 0) break;

    for (int y = 0; y < MAX_Y; y++)
      for (int x = 0; x < MAX_X; x++) dists[y][x] = INF;
    
    for (int i = 0; i < n; i++) {
      int x, y;
      cin >> x >> y;
      dists[y + CY][x + CX] = -1;
    }

    int sx, sy;
    cin >> sx >> sy;
    sx += CX, sy += CY;

    dists[sy][sx] = 0;

    queue<pii> q;
    q.push(pii(sx, sy));

    int count = 1;
    
    while (! q.empty()) {
      pii u = q.front(); q.pop();
      int& ux = u.first;
      int& uy = u.second;

      int ud = dists[uy][ux];
      if (ud >= tn) continue;

      for (int di = 0; di < 6; di++) {
	int vx = ux + dxs[di], vy = uy + dys[di];
	if (dists[vy][vx] >= INF) {
	  dists[vy][vx] = ud + 1;
	  q.push(pii(vx, vy));
	  count++;
	}
      }
    }

    cout << count << endl;
  }

  return 0;
}

Measured memory_bytes: 1276
using System;
using System.Linq;

namespace _5_A
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {
                int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
                if (x[0] == 0 && x[1] == 0)
                {
                    break;
                }
                for (int i = 0; i < x[0]; i++)
                {
                    for (int I = 0; I < x[1]; I++)
                    {
                        Console.Write("#");
                    }
                    Console.WriteLine();
                }
                Console.WriteLine();
            }
        }
    }
}



Measured memory_bytes: 8292
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
class Combination {
    int powmod(int a, int p) {
        int ans = 1;
        int mul = a;

        for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
            if ((p & 1) == 1) ans = (ans * mul) % mod;
        }

        return ans;
    }
public:
    int N;
    int mod;
    vector<int> fact;
    vector<int> revFact;

    Combination(int n, int m) : N(n), mod(m), fact(n+1), revFact(n+1) {
        fact[0] = 1;
        for (int i = 1; i <= N; i++) {
            fact[i] = fact[i-1] * i;
            fact[i] %= mod;
        }

        // Fermat's little theorem
        revFact[N] = powmod(fact[N], mod - 2);

        for (int i = N-1; i >= 0; i--) {
            revFact[i] = revFact[i+1] * (i+1);
            revFact[i] %= mod;
        }
    }

    int get(int a, int b) {
        if (a < 0 || b < 0) return 0;
        if (b > a) return 0;
        return (((fact[a] * revFact[b]) % mod) * revFact[a-b]) % mod;
    }
};

int powmod(int a, int p, int mod) {
    int ans = 1;
    int mul = a;

    for (; p > 0; p >>= 1, mul = (mul * mul) % mod) {
        if ((p & 1) == 1) ans = (ans * mul) % mod;
    }

    return ans;
}

signed main() {
    int N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;
    int K = B - A + 1;

    int fact[N+1];
    fact[0] = 1;
    for (int i = 1; i <= N; i++) {
        fact[i] = i * fact[i-1];
        fact[i] %= MOD;
    }

    Combination comb = Combination(N, MOD);

    int dp[K+1][N+1];
    fill(dp[0], dp[K+1], 0);
    dp[0][0] = 1;

    for (int i = 0; i < K; i++) {
        int human_n = i + A;

        for (int j = 0; j <= N; j++) {
            dp[i+1][j] = dp[i][j];
            for (int group_num = C; group_num <= D; group_num++) {
                if (j - human_n * group_num < 0) break;
                int up = (fact[j] * dp[i][j - human_n * group_num]) % MOD;
                int down = (((powmod(fact[human_n], group_num, MOD) * fact[group_num]) % MOD) * fact[j - human_n * group_num]) % MOD;
                dp[i+1][j] += (up * powmod(down, MOD - 2, MOD)) % MOD;
                dp[i+1][j] %= MOD;
            }
        }
    }

    cout << dp[K][N] << endl;

    return 0;
}

Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef long long ll;
int mod = 998244353;
int mul(int a, int b){
    return ((a%mod) * (b%mod))%mod;
}
int power(int a, int b){
    int z = 1; int x = a;
    while(b>0){
        if (b&1)z = mul(z, x);
        x = mul(x, x);
        b >>= 1;
    }
    return z;
}
int check(int x, int y, int z){
    return (x+y+z)*(x+y+z) - (x*y+y*z+z*x);
}
int32_t main()
{
    int N;
    cin>>N;
    vector<int> ans(10005);
    // ans[6] = 1, ans[11] = 3, ans[17] = 3, ans[18] = 3;
    for (int x=1; x*x<=10005; x++){
        for (int y =1; y*y<=10005; y++){
            for (int z = 1; z*z<=10005; z++){
                int k = check(x, y, z);
                if (k < 10005)ans[k]++;
            }
        }
    }
    
    for (int i=1; i<=N; i++)cout<<ans[i]<<endl;    
}


Measured memory_bytes: 3548
N=int(input())
A=list(map(int, input().split()))
if A.count(0)>0:
  print(0)
  exit()
  
for i in range(1, N):
  if A[0]*A[i]>10**18:
    print(-1)
    exit()
  else:
    A[0]*=A[i]
print(A[0])


Measured memory_bytes: 21652
#include<bits/stdc++.h>//本当は必要なヘッダファイルだけインクルードするべきです
using namespace std;//本当は個別にusingするか変数や関数ごとにstd::をつけるべきです
//本当は関数内に宣言し明示的に初期化するべきです
int64_t n,m,l,a[100][100],b[100][100],c[100][100],i,j,k;
int main(void){
  cin>>n>>m>>l;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin>>a[i][j];
    }
  }
  for(i=0;i<m;i++){
    for(j=0;j<l;j++){
      cin>>b[i][j];
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      for(k=0;k<m;k++){
        c[i][j]+=a[i][k]*b[k][j];
      }
    }
  }
  for(i=0;i<n;i++){
    for(j=0;j<l;j++){
      if(j==0)cout<<c[i][j];
      else cout<<" "<<c[i][j];
    }
    cout<<endl;
  }
  return 0;
}



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

namespace AtCoder.abc117
{
  class a
  {
    static void Main(string[] args)
    {
      string[] inStr = Console.ReadLine().Split(' ');
      double[] inDbl = { byte.Parse(inStr[0]), byte.Parse(inStr[1]) };//T X
      //Xt:t=T:x
      //Tt=Xtx
      //x=T/X
      Console.Write(inDbl[0] / inDbl[1]);
    }
  }
}


Measured memory_bytes: 11092
h, w = gets.chomp.split.map(&:to_i)
arr = Array.new(h)
h.times do |i|
	arr[i] = gets.chomp.split.map(&:to_i)
end

cnt = 0
ans = []

h.times do |i|
	w.times do |j|
		jj =  i.even? ? j : w - j - 1
		next if arr[i][jj].even?
		#右(左)
		if i.even? && jj < w - 1
			arr[i][jj + 1] += 1
			cnt += 1
			ans << [i, jj, i, jj + 1]
			next
		elsif
			i.even? == false && jj > 0
			arr[i][jj - 1] += 1
			cnt += 1
			ans << [i, jj, i, jj - 1]
			next
		end
		# 下
		if i < h - 1
			arr[i + 1][jj] += 1
			cnt += 1
			ans << [i, jj, i + 1, jj]
		end
	end
end

puts cnt
ans.each do |a|
	aaa = a.map{|aa| aa + 1}
	puts "#{aaa[0]} #{aaa[1]} #{aaa[2]} #{aaa[3]}"
end

# arr.each do |a|
# 	p a
# end

Measured memory_bytes: 34540
#include <stdio.h>

int main(void)
{
	int mass[1000];
	int n, m;
	int i;
	int me[1000];
	int koma;
	int count;
	
	while (1){
		scanf("%d %d", &n, &m);
		if (n == 0 && m == 0){
			break;
		}
		
		for (i = 0; i < n; i++){
			scanf("%d", &mass[i]);
		}
		
		for (i = 0; i < m; i++){
			scanf("%d", &me[i]);
		}
		
		
		koma = 0;
		count = 0;
		while (1){
			count++;
			koma += me[count - 1];
			
			if (koma >= n - 1){
				break;
			}
			
			koma += mass[koma];
			
			if (koma >= n - 1){
				break;
			}
		}
		
		printf("%d\n", count);
	}
	
	return (0);
}

Measured memory_bytes: 604
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

pub trait LexicalPermutation {
    fn next_permutation(&mut self) -> bool;
    fn prev_permutation(&mut self) -> bool;
}

impl<T> LexicalPermutation for [T]
where
    T: Ord,
{
    fn next_permutation(&mut self) -> bool {
        if self.len() < 2 {
            return false;
        }
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] >= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        let mut j = self.len() - 1;
        while j >= i && self[j] <= self[i - 1] {
            j -= 1;
        }
        self.swap(j, i - 1);
        self[i..].reverse();
        true
    }

    fn prev_permutation(&mut self) -> bool {
        if self.len() < 2 {
            return false;
        }
        let mut i = self.len() - 1;
        while i > 0 && self[i - 1] <= self[i] {
            i -= 1;
        }
        if i == 0 {
            return false;
        }
        self[i..].reverse();
        let mut j = self.len() - 1;
        while j >= i && self[j - 1] < self[i - 1] {
            j -= 1;
        }
        self.swap(i - 1, j);
        true
    }
}

fn main() {
    input! {
        a: usize,
        b: usize,
    }
    if a <= 8 && b <= 8 {
        println!("Yay!");
    } else {
        println!(":(");
    }
}


Measured memory_bytes: 4352
/*
Á·Ï°Ìâ£ºRoad Construction_AOJ 2249 
	Ë«cost²ÎÊý¸ÄÁ¼Dijkstra¡£ 
*/ 

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

const int MAX_V=10007;


typedef struct edge {
	int to, dis, cost;
	edge(){}
	edge(int to, int dis, int cost):to(to), dis(dis), cost(cost){}
	bool operator > (const edge &b) const
	{
		return dis!=b.dis? dis>b.dis : cost>b.cost;
	}//ÏÈ±È½Ï¾àÀë£¬ÔÙ±È½Ï»¨·Ñ 
}P;

int V, E;
vector<edge> G[MAX_V]; //ÏÂ±ê³äµ±from
int mark[MAX_V];

int dijkstra()
{
	int res=0;
	//°´ÕÕedge¶¨ÒåµÄË³ÐòÅÅÁÐ£¬ÏÈÈ¡³ö×îÊ¡µÄÂ· 
	priority_queue<P, vector<P>, greater<P> > que;
	fill(mark, mark+V, false);
	que.push(P(0,0,0));
	
	while(que.size()) //¸´ÔÓ¶ÈÎªO(|E|Xlog|V|) 
	{
		P p = que.top();
		que.pop();
		int v=p.to;
		if(mark[v])
			continue;
		mark[v]=true;
		res+=p.cost;
		for(int i=0; i<G[v].size(); i++)
		{
			edge e=G[v][i];
			que.push(P(e.to, p.dis+e.dis, e.cost));
		}
	}
	
	return res;
}

int main()
{
	while(scanf("%d%d", &V, &E)!=EOF)
	{
		if(V==0&&E==0)
			break;
		
		for(int i=0; i<=V; i++)
			G[i].clear();
		
		for(int i=0; i<E; i++)
		{
			int f, t, d, c;
			scanf("%d%d%d%d", &f, &t, &d, &c);
			f--;
			t--;
			G[f].push_back(P(t,d,c));
			G[t].push_back(P(f,d,c));
		}
		
		printf("%d\n", dijkstra());
		
		
		
		
	}
	
	
	return 0;
}






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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  ll wa = 0;
  ll ans1 = 0, ans2 = 0;

  for (int i = 0; i < n; i++) {
    wa += a[i];
    if (i % 2 == 1 && wa >= 0) {
      ans1 += wa + 1;
      wa = -1;
    } else if (i % 2 == 0 && wa <= 0) {
      ans1 += 1 - wa;
      wa = 1;
    }
  }

  wa = 0;
  for (int i = 0; i < n; i++) {
    wa += a[i];
    if (i % 2 == 0 && wa >= 0) {
      ans2 += wa + 1;
      wa = -1;
    } else if (i % 2 == 1 && wa <= 0) {
      ans2 += 1 - wa;
      wa = 1;
    }
  }
  cout << min(ans1, ans2) << endl;
  return 0;
}

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

const ll mod = 1e9 + 7;
ll dp[100005];

int main() {
    int n, m;
    cin >> n >> m;
    int a[m];
    map<int, int> mp;
    for (int i = 0; i < m; i++) {
        cin >> a[i];
        mp[a[i]]++;
    }
    dp[0] = 1;
    for (int i = 0; i <= n; i++) {
        if (mp[i] != 0) continue;
        if (mp[i + 1] != 0 && mp[i + 2] != 0) {
            cout << 0 << endl;
            return 0;
        }
        if (mp[i + 1] == 0) dp[i + 1] += dp[i];
        if (mp[i + 2] == 0) dp[i + 2] += dp[i];
        dp[i + 1] %= mod;
        dp[i + 2] %= mod;
    }
    cout << dp[n] % mod << endl;
    return 0;
}

Measured memory_bytes: 5888
//
//  main.cpp
//  ABC124
//
//  Created by hiroaki on 2019/05/07.
//  Copyright © 2019年 hiroaki. All rights reserved.
//

#include <iostream>
#include <vector>
#include <map>
#include <iterator>
#include <set>
#include <cmath>
#include <algorithm>
#include <locale>

#define int long long
#define pb(n) push_back(n)
#define For(n,i) for(int (i)=0;(i)<(n);(i)++)
//#define ForJ(n) for(int j=0;j<n;j++)
//#define ForK(n) for(int k=0;k<n;k++)
#define Pr(n) cout<<n<<endl;
#define INS(v,n) for(int i=0;i<n;i++){cin >>v.at(i);}//vector 代入
#define ELM 100001 //問題によっては1000000001に変更
using namespace std;

int Product_set_min(int la,int ra,int lb,int rb){//A<B
    int r=0;;
    if (la<ra&&ra<lb&&lb<rb) {
        r= 0;
    }else if(la<=lb&&lb<=ra&&ra<=rb){
        r= lb;
    }else if(lb<=la&&la<=ra&&ra<=rb){
        r= la;
    }else if(lb<=la&&la<=rb&&rb<=ra){
        r= la;
    }else if(lb<rb&&rb<la&&la<ra){
        r= 0;
    }
    return r;
}
int Product_set_max(int la,int ra,int lb,int rb){//A<B
    int r=0;;
    if (la<ra&&ra<lb&&lb<rb) {
        r= 0;
    }else if(la<=lb&&lb<=ra&&ra<=rb){
        r= ra;
    }else if(lb<=la&&la<=ra&&ra<=rb){
        r= ra;
    }else if(lb<=la&&la<=rb&&rb<=ra){
        r= rb;
    }else if(lb<rb&&rb<la&&la<ra){
        r= 0;
    }
    return r;
}
string min (string m){
    transform(m.begin(), m.end(), m.begin(),towlower);
    return m;
}
signed  main(){
    int a,b,c,d;
    cin >>a>>b>>c>>d;
    if(a<=c && c<= b && b<=d){
        cout<<b-c<<endl;
    }else if(c<=a && a<=d && d<=b){
        cout<<d-a<<endl;
    }else if(a<=c && c<=d && d<=b ){
        cout<<d-c<<endl;
    }else if(c<=a && a<=b && b<=d){
        cout<<b-a<<endl;
    }else{
        cout<<0<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from scipy.sparse.csgraph import floyd_warshall
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations, combinations_with_replacement
from heapq import heappop, heappush, heapify
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    n,k = inpm()
    a = inpl()
    ans = 0
    a.sort()
    for i in range(k):
        ans += a[i]
    print(ans)
    
if __name__ == "__main__":
    main()

Measured memory_bytes: 72924
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int maxn=2e5+5;
const int mod=1e9+7;

ll cnt[maxn];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n,k;
    cin>>n>>k;
    for(int i=1;i<maxn;i++)
    {
        cnt[i]=cnt[i-1]+i;
        cnt[i]%=mod;
    }
    ll ans=0;
    for(int i=k;i<=n;i++)
    {
        ans=ans+1ll*i*n%mod-cnt[i-1]*2+1;
        ans=(ans+mod)%mod;
    }
    ans++;
    ans%=mod;
    cout<<ans<<'\n';

}


Measured memory_bytes: 5224
#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repR(i, n) for(int i = (n) - 1; i > -1; i--)
#define rep1(i, n) for(int i = 1; i < (int)(n + 1); i++)
#define rep1R(i, n) for(int i = (n); i > 0; i--)
using namespace std;
static const int MAX = 100000;
int n, m, q;
int color[MAX] = {};
vector<int> G[MAX];

void searchGraph(int u, int c) {
  color[u] = c;
  for (size_t i = 0; i < G[u].size(); ++i) {
    int v = G[u][i];
    if (color[v] == 0) searchGraph(v, c);
  }
}

int main() {
  cin >> n >> m;
  rep(i, m) {
    int s, t;
    cin >> s >> t;
    G[s].push_back(t);
    G[t].push_back(s);
  }
  int c = 1;
  rep(i, n) {
    if (color[i] == 0) searchGraph(i, c);
    ++c;
  }
  cin >> q;
  rep(i, q) {
    int s, t;
    cin >> s >> t;
    if (color[s] == color[t]) cout << "yes" << endl;
    else cout << "no" << endl;
  }
  return 0;
}



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

#define debug(x) cout<<#x<<"="<<x<<endl
#define RD(x) freopen((x),"r",stdin)
#define WT(x) freopen((x),"w",stdout)
#define pii pair<int,int>
#define PQ priority_queue
#define ll long long
#define pb push_back
#define mp make_pair
const int INF=0x7fffffff;

string s;

int main(){
	cin>>s;
	cout<<s.substr(0,s.size()-8);
	return 0;
}

Measured memory_bytes: 256