akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <numeric>

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }



int main() {
    string s; cin >> s;
    int ans = 0;
    rep(i, s.size()) {
        int tmp = 0;
        FOR(j,i,s.size()) {
            if(s[j] == 'A' || s[j] == 'C' || s[j] == 'T' || s[j] == 'G') tmp++;
            else break;
        }
        chmax(ans, tmp);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())

using namespace std;
typedef long long ll;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
const int INF = 1001001001;
const long long INFL = (1LL<<60);
const double eps = (1e-9);

int main()
{
  int n;
  cin >> n;
  rep(i, n) {
    int a;
    cin >> a;
    if (a % 2 != 0) continue;
    if (a % 3 != 0 && a % 5 != 0) {
      puts("DENIED");
      return 0;
    }
  }
  puts("APPROVED");

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}


template<typename F>
struct FixPoint : F{
  FixPoint(F&& f):F(forward<F>(f)){}
  template<typename... Args>
  decltype(auto) operator()(Args&&... args) const{
    return F::operator()(*this,forward<Args>(args)...);
  }
};
template<typename F>
inline decltype(auto) MFP(F&& f){
  return FixPoint<F>{forward<F>(f)};
}

//INSERT ABOVE HERE
const int MAX = 111;
int es[MAX][MAX]={};
signed main(){
  int n,m;
  cin>>n>>m;
  for(int i=0;i<m;i++){
    int u,v,w;
    cin>>u>>v>>w;
    u--;v--;
    es[u][v]=es[v][u]=w;
  }

  int ans=0;
  vector<int> used(n,0);
  MFP([&](auto dfs,int v)->void{
        int res=0,cnt=0;
        for(int i=0;i<n;i++){
          if(!used[i]) continue;
          cnt++;
          int tmp=1e9;
          for(int j=0;j<n;j++)
            if(i!=j&&used[j]) chmin(tmp,es[i][j]);
          if(tmp==0) return;
          res+=tmp;
        }
        if(cnt>1) chmax(ans,res);

        if(v==n) return;

        used[v]=1;
        dfs(v+1);
        used[v]=0;
        dfs(v+1);
      })(0);

  cout<<ans<<endl;
  return 0;
}



Measured memory_bytes: 3132
from heapq import heappush, heappop
import queue
import re
import math
import functools

def s_raw():
    return input().rstrip("\r")

def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return list(map(int, ss_raw()))


INF = 1 << 29


def make1d_arr(n, val=INF):
    return [val for i in range(n)]


def make2d_arr(h, w, val=INF):
    return [[val for i in range(w)]for i in range(h)]


def gcd(a, b):
    if(b == 0):
        return a
    return gcd(b, a % b)


def BFord(n,es):
    v_cost = [INF]*n
    v_cost[0] = 0
    for v in range(n*2):
        for e in es:
            frm = e[0]
            to = e[1]
            if v_cost[to] > v_cost[frm]+e[2]:
                v_cost[to] = v_cost[frm]+e[2]
                if v >= n:
                    v_cost[to] = -INF
        if v == n-1:
            prev = v_cost[:]
    v_cost = [-INF if prev[idx]!=v_cost[idx] else v_cost[idx] for idx in range(n)]
    return v_cost
    

def main():
    TS = [["R", "U", "D"], ["L", "U", "D"]]
    S = s_raw()
    for idx,c in enumerate(S):
        if not(c in TS[idx%2]):
            return "No"
    
    return "Yes"

if __name__ == "__main__":
    print(main())


Measured memory_bytes: 40492
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define ld long double
#define pll pair<ll, ll>
#define pii pair<int, int>
#define f first
#define se second
#define pb push_back
#define ft fflush(stdout)
 
 
using namespace std;
 
 
const int N = 523;
const int PLS = 3e5 + 123;
const ll mod = 1e9 + 7;
const ll inf = 1e16;


ll n, a[N], dp[N][N], p[N];
bool vis[N][N];


ll get(ll l, ll r) {
    return p[r] - p[l - 1];
}


void rec(ll l, ll r) {
    if (vis[l][r])
        return;
    vis[l][r] = 1;
    if (l == r) {
        dp[l][r] = 0;
        return;
    }
    dp[l][r] = inf;
    for (int i = l; i < r; i++) {
        rec(l, i);
        rec(i + 1, r);
        dp[l][r] = min(dp[l][r], dp[l][i] + dp[i + 1][r] + get(l, r));
    }
}


int main() {
    ios_base::sync_with_stdio(NULL);
    cin.tie(NULL); cout.tie(NULL);
    cin >> n;
    for (int i = 1; i <= n; i++)
        cin >> a[i];
    p[0] = 0;
    for (int i = 1; i <= n; i++)
        p[i] = p[i - 1] + a[i];
    rec(1, n);
    cout << dp[1][n];
}

Measured memory_bytes: 2176
n = int(input())
A = [0]*n
B = [0]*n
for i in range(n):
    a,b = map(int,input().split())
    A[i]=a%b
    B[i]=b
ans = 0
tmp=0
for i in range(n-1,-1,-1):
    tmp +=(B[i] -(tmp+A[i]))%B[i]
print(tmp)


Measured memory_bytes: 16704
#include <stdio.h>

main()
{
	int i,j;

	for(i = 1; i <= 9; i++)
	{
		for(j = 1; j<= 9; j++)
		{
			printf("%dx%d=%d\n", i, j, i*j);
		}
	}

	return 0;
}

Measured memory_bytes: 524
N = int(input())
A = input().split()
A = [int(a) for a in A]

min_a = 1
ans = 0
for n in range(N):
  if A[n] == min_a:
    min_a +=1
  else:
    ans += 1
    
if N == ans:
  print(-1)
else:
  print(ans)

Measured memory_bytes: 25768
#include <iostream>
#include <string>
using namespace std;
string s,t;
bool f=false;
int n;
int main(){
	cin>>s>>t;
	s+=t;
	n=stoi(s);
	for(int i=1;i<=10000;i++){
		if(i*i==n){
			f=true;
			break;
		}		
	}
	cout<<(f?"Yes":"No");
}
	


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n, m, indegree[100005], dp[100005];
vector< int > adj[100005];
 
int dfs( int node){
	if( dp[node] )
		return dp[node];
	int temp = 0;
	for( int i = 0 ; i < adj[node].size() ; i++ )
		temp = max( temp, dfs( adj[node][i]) + 1);
	dp[node] = temp;
	return temp;
}

int main(){
	cin >> n >> m;
	for( int i = 0 ; i < m ; i++ ){
		int u, v;
		cin >> u >> v;
		adj[u].push_back(v);
		indegree[v]++;
	}
	int ans = 0;
	for( int i = 1 ; i <= n ; i++ )
		if( !indegree[i] )
			ans = max( ans, dfs(i));
	cout << ans << endl;
	return(0);
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
#define FOR(i, a, b) for(int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define bit(x) (1L << (x))
using ll = long long;
using namespace std;

template<typename T>
vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
 
template<typename... Ts>
auto make_v(size_t a,Ts... ts){
    return vector<decltype(make_v(ts...))>(a,make_v(ts...));
}

int main() {
    string s; cin >> s;
    sort(s.begin(), s.end());

    if(s[0] == s[1] && s[2] == s[3] && s[0] != s[3])
        cout << "Yes" << endl;
    else 
        cout << "No" << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;


int main(){
  int A, B, C;
  cin >> A >> B >> C;
  if(A <= C && C <= B){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  
  return 0;
}



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

using namespace std;

int main()
{
    int n,j,i,co = 0;
    cin>>n;
    for(i = n; ; i++){
        for(j = 1; j <= i/2; j++)
        {
            if(i%j==0){co++;}
            //cout<<i<<" "<<j<<endl;
        }
        if(co==1){cout<<i<<endl; break;}
        else{co = 0;}
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-10;
const long long INFLL=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	for(int i=0;i<q;i++)
		t*=p;
	return t;
}

template <typename T>
struct has_iter
{
	private:
		template <typename U>
		static constexpr true_type check(typename U::iterator*);
		template <typename U>
		static constexpr false_type check(...);

	public:
		static constexpr bool value = decltype(check<T>(nullptr))::value;
};

template<typename T, typename U = typename T::iterator>
void print(const T& container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}

extern void* enabler;
template<typename Head, typename enable_if<!has_iter<Head>::value>::type*& = enabler>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

void io_speedup()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
}

template<typename T>
istream& operator >> (istream& is, vector<T>& vec)
{
	for(T& x: vec) is >> x;
	return is;
}

template<typename T>
vector<T> read(int n)
{
	vector<T> t(n);
	cin>>t;
	return t;
}

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}

int main()
{
	int n;
	cin>>n;
	vector<VI> a(n,VI(2));
	REP(i,n)
		cin>>a[i][0];
	REP(i,n)
		cin>>a[i][1];
	
	vector<VI> b(n,VI(2));
	b[0][0]=a[0][0];
	b[0][1]=b[0][0]+a[0][1];
	FOR(i,1,n)
	{
		b[i][0]=b[i-1][0]+a[i][0];
		b[i][1]=max(b[i][0]+a[i][1], b[i-1][1]+a[i][1]);
	}
	print(b[n-1][1]);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
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 Would
#define you
#define please

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


	int H, W, N;;
	cin >> H >> W >> N;

	pair<int, int> XY[200001];

	rep(i, N) {
		cin >> XY[i].first >> XY[i].second;
	}
	sort(XY, XY + N);
	
	int kotae = H;
	int jama = 0;
	rep(i, N) {
		if (XY[i].second < XY[i].first - jama) {
			kotae = XY[i].first - 1;
			break;
		}
		else if (XY[i].second == XY[i].first - jama) {
			jama++;
		}
	}
	co(kotae);

	Would you please return 0;
}

Measured memory_bytes: 1792
import java.util.*;

class Main {
	Scanner sc;
	int H, W;
	char[] S;
	
	private void calc() {
		sc = new Scanner(System.in);
		H = sc.nextInt()+2;
		W = sc.nextInt()+2;
		StringBuilder s = new StringBuilder();
		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < W; i++) sb.append('#');
		s.append(sb);
		for (int i = 0; i < H-2; i++) s.append("#"+sc.next()+"#");
		s.append(sb);
		S = s.toString().toCharArray();
		
		int max = 0;
		for (int p = 1 + W; p < H*W; p++) {
			if (S[p] != '.') continue;
			int[] a = farthestPlaceFrom(p);
			max = Math.max(max, a[1]);
		}
		
		System.out.println(max);
	}
	
	private int[] farthestPlaceFrom(int p) {
		final int[] DIR = new int[] { -W, W, -1, 1 };
		int[] dist = new int[H*W];
		for (int i = 0; i < H*W; i++) dist[i] = -1;
		Deque<Integer> q = new ArrayDeque<>();
		int max = 0;
		q.addLast(p);
		dist[p] = 0;
		while(!q.isEmpty()) {
			int v = q.removeFirst();
			for (int i = 0; i < DIR.length; i++) {
				int j = v+DIR[i];
				// ここの式あやしい
				if (S[j] == '.' && dist[j] < 0) {
					q.addLast(j);
					dist[j] = dist[v]+1;
					if (dist[j] > max) {
						max = dist[j];
						p = j;
					}
				}
			}
		}
		return new int[] {p, max};
	}

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

Measured memory_bytes: 24732
n = int(input())
a = list(map(int, input().split()))
a.sort()

ans = []
for i in range(1, n-1):
    if a[i] <= 0:
        ans.append([a[n-1], a[i]])
        a[n-1] += abs(a[i])

    else:
        ans.append([a[0], a[i]])
        a[0] -= a[i]
        
ans.append([a[n-1], a[0]])

print(a[n-1] - a[0])
for i in range(n-1):
    print(*ans[i])


Measured memory_bytes: 25220
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int N; cin >> N; 
	int A[262144] = {}; 
	for(int i = 0; i < (1 << N); i++) cin >> A[i]; 
	pair<int, int> first[262144] = {}; 
	pair<int, int> second[262144] = {}; 
	first[0] = make_pair(A[0], 0); 
	for(int bit = 1; bit < (1 << N); bit++){
		vector<pair<int, int>> V; 
		V.emplace_back(A[bit], bit); 
		for(int i = 0; i < N; i++){
			if(!((bit >> i) & 1)) continue; 
			int mask = bit - (1 << i); 
			V.emplace_back(first[mask]); 
			V.emplace_back(second[mask]); 
		}
		sort(V.begin(), V.end(), greater<pair<int, int>>()); 
		unique(V.begin(), V.end()); 
		first[bit] = V.at(0); 
		second[bit] = V.at(1); 
	}
	int mx = 0; 
	for(int i = 1; i < (1 << N); i++){
		mx = max(mx, first[i].first + second[i].first); 
		cout << mx << "\n"; 
	}
}

Measured memory_bytes: 8724
#include <stdio.h>
int main() {
	int a, b, x, y, z;
	int max;

	scanf("%d", &a);
	scanf("%d", &b);

	x = a + b;
	y = a - b;
	z = a * b;


	max = x;
	if (max < y) {
		max = y;
	}
	if (max < z) {
		max = z;
	}
	printf("%d\n", max);

	return 0;
}

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

const char of[] = "RGB";

int N, H[20], W[20];
char f[4][4];
int Qi, Qn, Q[65536], dp[65536];
int m, mask[2048], chg[256][4];

int main() {
    scanf("%d", &N);
    rep(i, N) scanf("%d%d", H+i, W+i);
    rep(i, 4) rep(j, 4) scanf(" %c", f[i]+j);
    memset(dp, -1, sizeof(dp));
    rep(k, N) {
        for(int i=-4; i<4; i++) for(int j=-4; j<4; j++) {
            int b = 0;
            rep(x, 4) rep(y, 4) if(i<=x && x<i+H[k] && j<=y && y<j+W[k]) {
                b |= 1<<(x*4+y);
            }
            mask[m++] = b;
        }
    }
    sort(mask, mask+m);
    m = unique(mask, mask+m)-mask;
    rep(i, m) rep(x, 4) rep(y, 4) if(mask[i]&(1<<(x*4+y))) {
        rep(k, 3) if(f[x][y]==of[k]) chg[i][k] |= 1<<(x*4+y);
    }
    dp[0] = 0;
    Q[Qn++] = 0;
    while(Qi<Qn && dp[65535]==-1) {
        const int cur = Q[Qi++];
        rep(i, m) rep(k, 3) {
            const int nxt = (cur&~mask[i]) | chg[i][k];
            if(dp[nxt]==-1) {
                dp[nxt] = dp[cur]+1;
                Q[Qn++] = nxt;
            }
        }
    }
    printf("%d\n", dp[65535]);
    return 0;
}

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

int main(){
    int n,k;
    cin >> n >> k;
    int h[n];
    for(int i=0;i<n;i++) cin >> h[i];
    sort(h,h+n);
    int res;
    int ans=1e9;
    for(int i=0;i<n-k+1;i++){
        res=h[i+k-1]-h[i];
        ans=min(ans,res);
    }
    cout << ans << endl;
}

Measured memory_bytes: 640
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
#include <iomanip>
using namespace std;
typedef long long ll;

const ll MOD = 1e9+7;
int a[1000][1000];
int now[1000];
bool flag[1000];
bool chan[1000];//前回変更したかどうか
int p[1000];//現在何番目
int main()
{
	int n;
	ll ans=0;
	cin>>n;
	for(int i=0;i<n;i++)
	{
		for(int j=0;j<n-1;j++)
		{
			cin>>a[i][j];
			a[i][j]--;
		}
		a[i][n-1]=1e8-1;
	}
	fill(p,p+1000,0);
	fill(chan,chan+1000,true);
	for(int i=0;i<n;i++)
		now[i]=a[i][p[i]];
	bool f=true;
	while(f)
	{
		f=false;
		fill(flag,flag+1000,false);
		ans++;
		//照合する
		for(int i=0;i<n;i++)
		{
			// if(!chan[i])
			// 	continue;
			//cerr<<p[i]<<" "<<now[i]<<endl;
			if((!flag[i]) && p[i]<n-1 && (!flag[now[i]]) && now[now[i]]==i)
			{
				f=true;
				p[i]++;
				p[now[i]]++;
				chan[i]=true;
				chan[now[i]]=true;
				flag[i]=true;
				flag[now[i]]=true;
				now[now[i]]=a[now[i]][p[now[i]]];
				now[i]=a[i][p[i]];
			}else{
				chan[i]=false;
			}
		}
	}
	//check
	for(int i=0;i<n;i++)
	{
		if(p[i]!=n-1)
		{
			cout<<-1<<endl;
			return 0;
		}
	}
	cout<<ans-1<<endl;
	return 0;
}


Measured memory_bytes: 4224
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define EL '\n'
#define el '\n'
#define rep(i, a, b) for (ll i = (a); i < (b); i++)
#define repd(i, a, b) for (ll i = (b)-1; i >= (a); i--)
#define large 1000000007
#define MOD 1000000007
#define pb() push_back()
#define MAX 10e+7
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
void solve()
{
int a,b;
cin>>a>>b;
cout<<a*b;

}
int main()
{
    solve();
  return 0;
}


Measured memory_bytes: 3632
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<string>
#include<cctype>
using namespace std;
int a,b;
char n[1001][1001];
long long  ans=0;
int main()
{
	scanf("%d%d",&a,&b);
	for(int i=1;i<=a;i++)
	 for(int j=1;j<=b;j++)
	 {
	 	scanf("%c",&n[i][j]);
	 	if(isspace(n[i][j]))scanf("%c",&n[i][j]);
	 }
	for(int i=1;i<=a;i++)
	{
	 for(int j=1;j<=b;j++)
	 {
	 	if(n[i][j]=='#')printf("%c",n[i][j]);
	else
	 	{
	 		if(n[i][j-1]=='#')ans++;
	 		if(n[i][j+1]=='#')ans++;
	 		if(n[i+1][j]=='#')ans++;
	 		if(n[i-1][j]=='#')ans++;
	 		if(n[i+1][j+1]=='#')ans++;
	 		if(n[i+1][j-1]=='#')ans++;
	 		if(n[i-1][j+1]=='#')ans++;
	 		if(n[i-1][j-1]=='#')ans++;
			printf("%lld",ans);
	 	}
  	  ans=0;
	 }
	puts("");
    }
    return 0;
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
#include<cassert>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
const int mod = 1000000007;
const int inf = 1ll << 61;
typedef pair<int, int> P;
typedef pair<int,P>PP;

signed main() {
	int n; cin >> n;
	string s; cin >> s;
	int cnt = 0;
	rep(i, n - 2)if (s[i] == 'A'&&s[i + 1] == 'B'&&s[i + 2] == 'C')cnt++;
	cout << cnt << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <queue>
using namespace std;

#define next '\n'
#define sp " "
#define print(x) cout << (x)
#define println(x) cout << (x) << next
#define stop return(0)
#define rep(i, n) for(int (i) = (0); (i) < (n); (++i))
#define FOR(i, start, end) for(int (i) = (start); (i) < (end); (++i))
#define foreach(e, elem) for(auto& (e) : (elem))
#define FAST ios::sync_with_stdio(false); cin.tie(nullptr)
#define size(s) (s).size()
#define all(vec) (vec).begin(), (vec).end()
#define pb(e) push_back(e);
using ll = long long;
using ull = unsigned long long;

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

    if((a == b && b != c && a != c) ||
        (a == c && a != b && b != c) ||
        (b == c && a != b && a != c)){
        println("Yes");
    }else{
        println("No");
    }
}

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

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

    if(a<b) cout << "a < b" << endl;
    if(a>b) cout << "a > b" << endl;
    if(a==b) cout << "a == b" << endl;
    
    return 0;
}


Measured memory_bytes: 3104
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

kotae = 0
K = int(input())

X = []
for i in range(1,K+1):
    for k in range(1,K+1):
        z = gcd(i,k)
        for l in range(1,K+1):
            kotae += gcd(z,l)
            
print(kotae)


Measured memory_bytes: 9168
s = input()

bool = True
for i in range(0,len(s)):
    if i % 2 == 0:
        if s[i] == 'L':
            bool = False
    else:
        if s[i] == 'R':
            bool = False
if bool :
    print('Yes')
else:
    print('No')

    

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

int main(){
  int N; cin>>N;
  vector<string> s(N);
  for(int i=0; i<N; i++) cin>>s[i];
  
  sort(s.begin(), s.end());
  
  int m=1,maxs=0;
  string t;
  t=s[0];
  
  for(int i=0; i<N-1; i++){
    if(t==s[i+1]){
      m++;
    }else{
      t=s[i+1];
      m=1;
    }
    maxs = max(maxs,m);
  }
//  cerr << maxs << endl;
  
  int ct=0;
  t=s[0];
  for(int i=0; i<N; i++){
    if(t==s[i]){
      ct++;
    }else{
      t=s[i];
      ct=1;
    }
    if(ct==maxs){
      cout << s[i] << endl;
    }else if(maxs==1){
      cout << s[i] << endl;
    }
  }
  
}


          

  
     

        
          
  
          

  

Measured memory_bytes: 9580
#include<bits/stdc++.h>
using namespace std;
int main() {
	int N; cin >> N;
	string W[N];
	for(int i = 0; i < N; i++) cin >> W[i];
	for (int i = 1; i < N; i++)
	{
		if(W[i-1][W[i-1].size()-1] != W[i][0]) {
			cout << "No" << endl;
			return 0;
		}
		for (int j = 0; j < i; j++)
		{
			if(W[i] == W[j]) {
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <utility>

#define fin stdin
#define fout stdout

char e[100009];
int s[100009];

inline std::pair <int, int> calc(char ch, int n){
    s[0]=0;
    int best = 10, poz = -1;
    for(int i = 1; i <= n; i ++){
        s[i] = s[i - 1];
        if(e[i] == ch) s[i] ++;
        else s[i] --;

        if(s[i] > best)
            return std::make_pair(poz, i);

        if(s[i - 1] < best)
            best = s[i-1], poz = i;
    }
    return std::make_pair(-1, -1);
}

int main(){
    int n = 0;
    char ch = fgetc(fin);

    while(ch != '\n'){
        e[++ n] = ch;
        ch = fgetc(fin);
    }

    bool f=1;
    for(char u = 'a'; u <= 'z' && f; u ++){
        std::pair <int, int> a = calc(u, n);
        if(a.first != -1) f=0, fprintf(fout, "%d %d\n", a.first, a.second);
    }
    if(f) fprintf(fout, "-1 -1\n");

    return 0;
}


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

using namespace std ;

string a ;

int main ( )  {
	cin >> a ;
	for ( int i = 0 ; i < a.size ( ) ; ++ i )  {
		if ( a [i] == 'A' && a [i + 1] == 'C' && i != a.size ( ) - 1 )  {
			return puts ( "Yes" ), 0 ;
		}
	}
	return puts ( "No" ), 0 ;
}


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

template <typename M>
struct DualSegmentTree {
    using T = typename M::T;

    DualSegmentTree(int n) {
        size = 1;
        height = 1;
        while (size < n) size <<= 1, height++;
        lazy.resize(2 * size, M::id);
    }

    T operator[](int k) {
        k += size;
        propagate(k);
        return lazy[k];
    }

    void update(int l, int r, const T& x) {
        l += size;
        r += size;
        propagate(l);
        propagate(r - 1);
        for (; l < r; l >>= 1, r >>= 1) {
            if (l & 1) lazy[l] = M::op(lazy[l], x), l++;
            if (r & 1) --r, lazy[r] = M::op(lazy[r], x);
        }
    }

private:
    int size, height;
    vector<T> lazy;

    void push(int k) {
        if (lazy[k] == M::id) return;
        lazy[2 * k] = M::op(lazy[2 * k], lazy[k]);
        lazy[2 * k + 1] = M::op(lazy[2 * k + 1], lazy[k]);
        lazy[k] = M::id;
    }

    void propagate(int k) {
        for (int i = height; i > 0; i--) push(k >> i);
    }
};

struct Monoid {
    using T = int;
    static inline const int id = 1e9;
    static T op(T a, T b) {
        return min(a, b);
    }
};

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

    int N, Q;
    cin >> N >> Q;
    DualSegmentTree<Monoid> st1(N - 2), st2(N - 2);
    st1.update(0, N - 2, N - 2);
    st2.update(0, N - 2, N - 2);
    ll ans = 1ll * (N - 2) * (N - 2);
    for (int i = 0; i < Q; i++) {
        int t, x;
        cin >> t >> x;
        x -= 2;
        if (t == 1) {
            int c = st1[x];
            ans -= c;
            st2.update(0, c, x);
        } else {
            int c = st2[x];
            ans -= c;
            st1.update(0, c, x);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 7356
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;

int main()
{
	int n;
	vector<int> a;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int num;
		cin >> num;
		a.pb(num);
	}

	int cnt = 0;
	int prev = -1;
	for (int i = 0; i < n; i++)
	{
		if ( a[i] == prev )
		{
			cnt++;
			prev = -1;
		}
		else
		{
			prev = a[i];
		}

	}

	cout << cnt << endl;

	return 0;
}


Measured memory_bytes: 256
#include<atcoder/all>
#include<algorithm>
#include<iostream>
using namespace std;

int main(){
    int n, m, a ,b;
    cin >> n >> m;
    atcoder::scc_graph scc_g(n);
    
    for(int i = 0;i < m;i++){
        cin >> a >> b;
        scc_g.add_edge(a, b);        
    }

    auto scc = scc_g.scc();
    cout << scc.size() << endl;
    for(auto component: scc){
        cout << component.size();
        for(auto v: component){
            cout << " " << v;
        }cout << endl;
    }
    return 0;
}

Measured memory_bytes: 40132
#include <bits/stdc++.h>
using namespace std;
int ton[10];
int main()
{
 int a, b, c, d, e;
 cin >> a >> b >> c >> d >> e;
  ton[a] = ton[b] = ton[c] = ton[d] = ton[e] = true;
  for (int i = 1;i <6;i++)if(!ton[i]){cout<<i<<endl;return 0;}
}

Measured memory_bytes: 3520
#include <iostream>
#include<deque>
#include<algorithm>
#include<list>
#include<stdio.h>
using namespace std;
int main(){

    deque<int> V;
    long long n;
    cin>>n;
    while(n>0){
        int a,b;
        scanf("%d%d",&a,&b);
        if(a==0){
            int c;
            scanf("%d",&c);
            if(b==0){
                V.push_front(c);
            }else{
                V.push_back(c);
            }
            
        }else if(a==1){
            
            cout<<V[b]<<endl;
            
        }else{
            if(b==0){
                V.pop_front();
            }else{
                V.pop_back();
            }
            
        }
        
        n--;
        if(n==0){return 0;}
    }
    
    
return 0;
}



Measured memory_bytes: 4684
<?php
  fscanf(STDIN, "%d%d", $n, $m);
  $min = min($n,$m);
  $max = max($n,$m);
  $s = abs($n-$m);
  const MOD = (10**9)+7;
  if($s < 2){
      $cal = 1;
      for($i=2; $i<=$min; $i++){
          $cal *= $i;
          $cal %= MOD;
          $cal *= $i;
          $cal %= MOD;
        //   echo $cal."\n";
      }
      if($s){
          $t = $max;
      }else{
          $t = 2;
      }
      $cal *= $t;
      echo $cal%MOD;
  }else{
      echo "0";
  }

Measured memory_bytes: 4728
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>

// 内部変数
static FILE *szpFpI;											// 入力

// 内部変数 - テスト用
#ifdef D_TEST
	static int siRes;
	static FILE *szpFpA;
	static int siTNo;
#endif

// １行出力
int
fOutLine(
	char *pcpLine				// <I> １行
)
{
	char lc1Buf[1024];

#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, pcpLine)) {
		siRes = -1;
	}
#else
	printf("%s", pcpLine);
#endif

	return 0;
}

// 最大公約数 - 取得
int
fGetGcd(
	int piVal1					// <I> 値１
	, int piVal2				// <I> 値２
)
{
	int liWork;

	// ユークリッドの互除法
	if (piVal1 < piVal2) {
		liWork = piVal1;
		piVal1 = piVal2;
		piVal2 = liWork;
	}
	while (piVal2 > 0) {
		liWork = piVal1 % piVal2;
		piVal1 = piVal2;
		piVal2 = liWork;
	}

	return piVal1;
}

// 実行メイン
int
fMain(
)
{
	int i, j, k;
	char lc1Buf[1024];

	// K - 取得
	int liK;
	fgets(lc1Buf, sizeof(lc1Buf), szpFpI);
	sscanf(lc1Buf, "%d", &liK);

	// 合計 - 取得
	int liSum = 0;
	for (i = 1; i <= liK; i++) {
		for (j = 1; j <= liK; j++) {

			// 最大公約数 - 取得
			int liGcd = fGetGcd(i, j);

			for (k = 1; k <= liK; k++) {

				// 最大公約数 - 取得
				int liGcd2 = fGetGcd(liGcd, k);

				// 合計 - 加算
				liSum += liGcd2;
			}
		}
	}

	return liSum;
}

// １回実行
int
fOne(
)
{
	int liRet;
	char lc1Buf[1024];

	// 入力 - セット
#ifdef D_TEST
	sprintf(lc1Buf, ".\\Test\\T%d.txt", siTNo);
	szpFpI = fopen(lc1Buf, "r");
	sprintf(lc1Buf, ".\\Test\\A%d.txt", siTNo);
	szpFpA = fopen(lc1Buf, "r");
	siRes = 0;
#else
	szpFpI = stdin;
#endif

	// 実行メイン
	liRet = fMain();

	// 出力
	sprintf(lc1Buf, "%d\n", liRet);
	fOutLine(lc1Buf);

	// 残データ有無
#ifdef D_TEST
	lc1Buf[0] = '\0';
	fgets(lc1Buf, sizeof(lc1Buf), szpFpA);
	if (strcmp(lc1Buf, "")) {
		siRes = -1;
	}
#endif

	// テストファイルクローズ
#ifdef D_TEST
	fclose(szpFpI);
	fclose(szpFpA);
#endif

	// テスト結果
#ifdef D_TEST
	if (siRes == 0) {
		printf("OK %d\n", siTNo);
	}
	else {
		printf("NG %d\n", siTNo);
	}
#endif

	return 0;
}

// プログラム開始
int
main()
{

#ifdef D_TEST
	int i;
	for (i = D_TEST_SNO; i <= D_TEST_ENO; i++) {
		siTNo = i;
		fOne();
	}
#else
	fOne();
#endif

	return 0;
}



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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define IMP cout << "IMPOSSIBLE" << endl
#define Imp cout << "Impossible" << endl
#define imp cout << "impossible" << endl
#define M1 cout << "-1" << endl
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T, typename U>
ostream &operator<<(ostream &os, pair<T, U> &p)
{
    os << "(" << p.first << ", " << p.second << ")";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using vpint = vector<pint>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

ll dp[55][55][2505];

void Main()
{
    arrayFill(dp, 0);
    ll n = in(), a = in();
    vll x = in(n);

    dp[0][0][0] = 1;

    rep(i, n) rep(j, 52) rep(k, 2502)
    {
        dp[i + 1][j][k] += dp[i][j][k];
        dp[i + 1][j + 1][k + x[i]] += dp[i][j][k];
    }

    ll ans = 0;
    rep(j, 52) rep(k, 2502)
    {
        if (j != 0 && (j * a == k))
            ans += dp[n][j][k];
    }
    cout << ans << endl;
}

signed main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 59520
N,K=map(int,input().split());p=[int(i)-1for i in input().split()];q=[int(i)-1for i in input().split()];T=lambda s,t:[s[t[i]]for i in range(N)];m=[[0for i in[0]*N]for i in[0]*6];m[0]=p;m[1]=q
def I(s):
 r=[0]*N
 for i in range(N):r[s[i]]=i
 return r
for i in range(4):m[i+2]=T(m[i+1],I(m[i]))
E=lambda s,k:T(E(T(s,s),k//2),s)if k%2 else (E(T(s,s),k//2)if k else list(range(N)));t=E(T(T(T(q,I(p)),I(q)),p),~-K//6);print(*[str(i+1)for i in T(T(t,m[~-K%6]),I(t))])

Measured memory_bytes: 40544
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	vector<long long> H(N), P(N);
	for (int i = 0; i < N; ++i) {
		cin >> H[i] >> P[i];
	}
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			if (H[i] + P[i] < H[j] + P[j]) {
				swap(H[i], H[j]);
				swap(P[i], P[j]);
			}
		}
	}
	vector<long long> dp = { 0 };
	for (int i = 0; i < N; ++i) {
		dp.push_back(1LL << 62);
		for (int j = i; j >= 0; --j) {
			if(dp[j] <= H[i]) dp[j + 1] = min(dp[j + 1], dp[j] + P[i]);
		}
	}
	int ans = -1;
	for (int i = 0; i <= N; ++i) {
		if (dp[i] != (1LL << 62)) ans = i;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
	Scanner in = new Scanner(System.in);
	public static void main(String[] args) {
		new Main();
	}
	public Main() {
		new AOJ0239();
	}

	class AOJ0239{
		public AOJ0239() {
			while(true){
				int n = in.nextInt();
				if(n==0)break;
				ArrayList<Sweet> list = new ArrayList<Sweet>();
				for(int i=0;i<n;i++)list.add(new Sweet(in.nextInt(),in.nextInt(), in.nextInt(), in.nextInt()));
				int P = in.nextInt(),Q = in.nextInt(),R = in.nextInt(),C = in.nextInt();
				boolean sw=false;
				for(int i=0;i<list.size();i++){
					if(list.get(i).p<=P&&list.get(i).q<=Q&&list.get(i).r<=R&&list.get(i).sum<=C){
						System.out.println(list.get(i).num);
						sw=true;
					}
				}
				if(sw==false)System.out.println("NA");
			}
		}
		class Sweet{
			int num,sum,p,q,r;
			public Sweet(int num,int p,int q,int r) {
				this.num = num;this.sum=p*4+q*9+r*4;this.p = p;this.q = q;this.r = r;
			}
		}
	}

}

Measured memory_bytes: 65700
import java.util.Scanner;

class Main
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		
		while (sc.hasNext())
		{
			double xa = sc.nextDouble(),
					ya = sc.nextDouble(),
					xb = sc.nextDouble(),
					yb = sc.nextDouble(),
					xc = sc.nextDouble(),
					yc = sc.nextDouble(),
					xd = sc.nextDouble(),
					yd = sc.nextDouble();
			double dotValue = dot(xa - xb, ya - yb, xc - xd, yc - yd);
			if (-0.000000001 < dotValue && dotValue < 0.000000000001)
			{
				System.out.println("YES");
			}
			else
			{
				System.out.println("NO");
			}
		}
	}
	private static double dot(double x1, double y1, double x2, double y2)
	{
		return x1 * x2 + y1 * y2;
	}
}

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

typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define foreach(itr,a) for(__typeof((a).begin()) itr=(a).begin(); itr!=(a).end(); itr++)
#define ALL(x) (x).begin(), (x).end()
#define pb push_back

int a[11];

void dfs(int depth, int l, int r) {
    if(depth == 10) {
        cout << "YES" << endl;
        return ;
    }

    int t = a[depth];
    if(l < t)
        dfs(depth+1, t, r);
    else if(r < t)
        dfs(depth+1, l, t);
    else
        cout << "NO" << endl;

    return ;
}

int main() {
    int n; cin >> n;
    rep(poyo,n) {
        rep(i,10) cin >> a[i];
        dfs(0,0,0);
    } 

    return 0;
}

Measured memory_bytes: 1152
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
    if a[a[i]-1]==i+1 and a[i]==a[a[a[i]-1]-1]:
        ans+=1
        a[a[i]-1]=0
        a[i]=0
print(ans)


Measured memory_bytes: 14004
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.SortedMap;
import java.util.TreeMap;

public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		Map<Integer, Integer> m1 = new HashMap<Integer, Integer>();
		String rec;
		while (!(rec = in.nextLine()).isEmpty()) {
			Integer num = Integer.valueOf(rec.split(",")[0]);
			m1.put(num, (m1.containsKey(num) ? m1.get(num) + 1 : 1));
		}
		SortedMap<Integer, Integer> m2 = new TreeMap<Integer, Integer>();
		while (in.hasNextLine()) {
			rec = in.nextLine();
			Integer num = Integer.valueOf(rec.split(",")[0]);
			if (m1.containsKey(num)) {
				m2.put(num, (m2.containsKey(num) ? m2.get(num) + 1 : 1));
			}
		}
		for (Integer key : m2.keySet()) {
			System.out.print(key);
			System.out.print(' ');
			System.out.print(m1.get(key) + m2.get(key));
			System.out.println();
		}
	}
}

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

class Program
{
    static void Main(string[] args)
    {
        var input1 = Console.ReadLine().ToCharArray();
        var input2 = Console.ReadLine().ToCharArray();
        var flag = true;
        for(var i = 0; i < input1.Length; i++)
        {
            if(input1[i] != input2[i])
            {
                flag = false;
            }
        }

        if (flag)
        {
            Console.WriteLine("Yes");
        }
        else
        {
            Console.WriteLine("No");
        }


        Console.ReadLine();

    }

  
}


Measured memory_bytes: 17352
import Control.Arrow
import Data.Char
import Data.List
import qualified Data.ByteString.Char8 as B
main=print.solve.unfoldr(B.readInt.B.dropWhile isSpace)=<<B.getContents
solve(n:k:as)=foldr(+)0.uncurry take.((subtract k).length&&&sort).map length.group.sort$as

Measured memory_bytes: 57740
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
using namespace std;

#define rep(i, e) for (int i = 0; i < e; i++)
#define repp(i, s, e) for (int i = s; i < e; i++)
#define N_Max 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long

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

const long long INF = 1LL << 60;
ll dp[100005];

int main()
{
    int n, a, b, c, d, k, x, ans = 0;
    // ll h[100005];
    // scanf("%d", &n);
    scanf("%d%d", &k, &x);
    for (int i = x - k + 1; i < x + k; i++)
    {
        if (i != x - k + 1)
            printf(" ");
        printf("%d", i);
    }
    printf("\n");
}

Measured memory_bytes: 256
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)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $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, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (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")
    };
}

#[allow(unused_imports)]
use num::integer::{gcd, lcm};
#[allow(unused_imports)]
use permutohedron::LexicalPermutation;
#[allow(unused_imports)]
use std::cmp;
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};
#[allow(dead_code)]
const MOD: i32 = 1e9 as i32 + 7;

fn main() {
    input!(n:i32,a:[i128;n]);
    let mut x:i128 = 1;
    let mut a = a.clone();
    a.sort();
    for elm in &a {
        x*=elm;
        if x > 1000000000000000000 {
            println!("-1");
            return;
        }
    }
    println!("{}",x);
}


Measured memory_bytes: 5944
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class CMultipleGift {
        public void solve(int testNumber, LightScanner in, PrintWriter out) {
            long t = in.longs(), y = in.longs();
            int i;
            for (i = 0; t <= y; i++, t *= 2) {
            }
            out.println(i);
        }

    }

    static class LightScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public LightScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
        }

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

        public long longs() {
            return Long.parseLong(string());
        }

    }
}



Measured memory_bytes: 21972
#include <stdio.h>

int main(){
	char str[1200];
	int alpha[26] ={0};
	char *p;
	int i;

	while(scanf("%s", str)!=EOF){
		for(p = str; *p != '\0'; p++){
			if('a'<=*p && *p <='z')
				alpha[*p-'a']++;
			if('A'<=*p && *p <='Z')
				alpha[*p-'A']++;
		}
	}
	for(i = 0;i < 26;i++){
		printf("%c : %d\n", 'a' + i, alpha[i]);
	}
	return 0;
}

Measured memory_bytes: 540
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
using namespace std;

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

int W, H;
vector<string> field;

int dfs(int y, int x) {
    int ans = 1; field[y][x] = '#';
    for (int k = 0; k < 4; k++) {
        int ny = y + dy[k], nx = x + dx[k];
        if (0 <= ny && ny < H && 0 <= nx && nx < W) {
            if (field[ny][nx] == '.') ans += dfs(ny, nx);
        }
    }
    return ans;
}

int main() {
    while (cin >> W >> H, W) {
        field.resize(H);
        for (int i = 0; i < H; i++) cin >> field[i];
        for (int y = 0; y < H; y++) for (int x = 0; x < W; x++) {
            if (field[y][x] == '@') cout << dfs(y, x) << endl;
        }
    }
    return 0;
}


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

int cnt[31];

int main() {
	int n, m;
	scanf("%d %d", &n, &m);

	for (int i = 1;i <= n;++i) {
		int k;
		scanf("%d", &k);

		for (int j = 1;j <= k;++j) {
			int u;
			scanf("%d", &u);

			cnt[u]++;
		}
	}

	int tot = 0;
	for (int i = 1;i <= m;++i)
		if (cnt[i] == n)
			tot++;

	printf("%d", tot);

	return 0;
}

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

ll ans,n;
ll c[100],w[100];
ll dp[100003][102];

ll solve(ll cur, ll i){
    if(cur<0)return -inf;
    if(dp[cur][i]==-1){
        if(cur==0 || i==n) return 0;
        dp[cur][i]=max(solve(cur-c[i],i+1) + w[i], solve(cur,i+1));
        return dp[cur][i];
    }
    return dp[cur][i];
}

int main(){
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cout.tie(NULL);
    ll ww;
    cin>>n>>ww;
    ll a,b;
    for(ll x=0; x<n; x++){
        cin>>c[x]>>w[x];
    }
    for(ll x=0; x<=ww; x++){
        for(ll y=0; y<=n; y++){
            dp[x][y]=-1;
        }
    }
    cout<<solve(ww,0);
    return 0;
}

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

int main() {
  int N; cin >> N;

  vector<int> factor(N + 1);
  for (int i = 2; i <= N; i++) {
    int n = i;
    for (int j = 2; j <= N; j++) {
      while (n % j == 0) {
        factor[j]++;
        n /= j;
      }
    }
  }

  long long ans = 1;
  const int MOD = 1e9 + 7;
  for (int i = 2; i <= N; i++) ans = (ans * (factor[i] + 1)) % MOD;

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<vector>
#include<cmath>
#include<map>
#include<cstdlib>
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<set>
#include<stack>
#include<bitset>
#include<functional>
#include<ctime>
#include<queue>
#include<deque>
#include<complex>
#include<cassert>
using namespace std;
#define pb push_back
#define pf push_front
typedef long long lint;
typedef complex<double> P;
#define mp make_pair
#define fi first
#define se second
typedef pair<int,int> pint;
#define All(s) s.begin(),s.end()
#define rAll(s) s.rbegin(),s.rend()
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
//問題文および制約はちゃんと確認しよう！
//サイズは10^5じゃなくて2×10^5とかかもしれないし、重要な制約・条件を見落としているかも
//とりあえずサンプルを読んでから解法を考えよう？
int main()
{
	int h,a;cin>>h>>a;cout<<(h+a-1)/a<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
          int x,y,z;
          do
          {
                    scanf("%d %d",&x,&y);
                    if(x==0&&y==0)
                    {
                              break;
                    }
                    if(y<x)
                    {
                    z=x;
                    x=y;
                    y=z;
                    }
                    else;
                    printf("%d %d\n",x,y);
          }
          while(x!=0||y!=0);
          return 0;

}



Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
	ll n,m;
	cin>>n>>m;
	ll x,y;
	x=(4*n-m)/2;
	y=(m-2*n)/2;
	if((x+y)==n&&(2*x+4*y)==m&&x>=0&&y>=0)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 3644
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;

constexpr long long int MOD = 1000000007;
//constexpr int MOD = 1000000007;
//constexpr int MOD = 998244353;
//constexpr long long int MOD = 998244353;
constexpr long double EPS = 1e-12;

//int N, M, K, H, W, L, R;
long long int N, M, K, H, W, L, R;


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

	N = 3;
	vector<vector<int>>v(N, vector<int>(N));
	for (auto &i : v)for (auto &j : i)cin >> j;
	cin >> M;
	set<int>s;
	for (int i = 0; i < M; i++) {
		cin >> K;
		s.insert(K);
	}
	for (int i = 0; i < N; i++) {
		bool flag = true;
		for (int j = 0; j < N; j++) {
			if (s.find(v[i][j]) == s.end())flag = false;
		}
		if (flag) {
			cout << "Yes\n";
			return 0;
		}
		flag = true;
		for (int j = 0; j < N; j++) {
			if (s.find(v[j][i]) == s.end())flag = false;
		}
		if (flag) {
			cout << "Yes\n";
			return 0;
		}
	}
	bool flag=true;
	for (int i = 0; i < N; i++)flag &= s.find(v[i][i]) != s.end();
	if (flag) {
		cout << "Yes\n";
		return 0;
	}
	flag = true;
	for (int i = 0; i < N; i++)flag &= s.find(v[i][N-i-1]) != s.end();
	if (flag) {
		cout << "Yes\n";
		return 0;
	}
	cout << "No\n";
	return 0;
}

Measured memory_bytes: 256