akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
 
#define IOS 		ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sd(n)       scanf("%d", &n)
#define sdd(a,b)    scanf("%d %d", &a, &b)
#define sddd(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define sld(n)      scanf("%lld", &n)
#define slld(a,b)   scanf("%lld %lld", &a, &b)
#define sllld(a,b,c) scanf("%lld %lld %lld", &a, &b, &c)
#define slu(n)      scanf("%llu", &n)
#define sllu(a,b)   scanf("%llu %llu", &a, &b)
#define slllu(a,b,c) scanf("%llu %llu %llu", &a, &b, &c)
#define ss(a)		scanf("%s", a)
#define inStrAftInSome cin.ignore(numeric_limits<streamsize>::max(),'\n')		//input string(with whitespace) after input something(char, int, bool, str)
#define all(a) 		a.begin(),a.end()
#define unq(x)      x.erase(unique(all(x)), x.end()
#define mp 			make_pair
#define sz(av) 		int((av).size())					//return size of vec
#define CLR(arr)    memset(arr, 0, sizeof(arr))			//assign 0 to whole arr
#define SET(vec)    memset(arr, -1, sizeof(arr))		//assign -1 to whole arr
#define CLRV(vec)	fill(vec.begin(), vec.end(), 0)		//assign 0 to whole vec
#define SETV(vec,n,a) vec.assign(n, a)	
#define vtd(rowsize,colsize,type,name) 		vector < vector <type> > name(rowsize,vector <type> (colsize)); 	//assign to first n elements value a in vec
#define SETB(a)		memset(a, true, sizeof(a))			//boolean array initialize by true value
#define CLRB(a)		memset(a, false, sizeof(a))			//boolean array initialize by false value
#define vintitr 	vector<int>::iterator
#define vlnlnitr 	vector<long long>::iterator
#define sintitr 	set<int>::iterator
#define slnlnitr 	set<long long>::iterator
#define aa			first
#define bb			second
#define mod 		1000000007
#define PI 			acos(-1.00)
#define psb 		push_back
#define ppb			pop_back
#define ppb			pop_back
#define psf			push_front
#define ppf			pop_front
#define in 			inset
#define rep(i, n) 	for(int i=0; i<n; i++)
#define repi(i,j,n) for(int i=j; i<=n; i++)
#define rof(i, n)   for(int i=n-1; i>=0; i--)
#define min3(a,b,c) (min((c),min((a),(b))))
#define max3(a,b,c) (max((a),max((b),(c))))
#define __lcm(a, b)	a*b / __gcd(a, b)
#define __builtin_zerocount(a)	8*sizeof(a)-__builtin_popcount(a)-__builtin_clz(a)-__builtin_ctz(a)
#define D(t)        cerr << #t " = " <<t  << '\n'
#define DBG         cerr << "Hi!" << '\n'
 
 
typedef long long	 		ll;
typedef unsigned long long	llu;
typedef long double			ld;
typedef pair<int, int> 		pii;

int main()
{
	//freopen("t.in","r",stdin);
	//freopen("t.out","w",stdout);
	IOS;
	int n;
	cin >> n;
	int a[n+1];
	double ans = 0;
	rep(i, n)
	{

		cin >> a[i];
		ans += 1.0 / a[i];
	}
	printf("%lf\n", 1/ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define mk make_pair
#define fs first
#define sc second
using namespace std;
typedef long long ll;
typedef long double ld;
char s[1010], t[1010];
int tt, ss;
bool chck(int x){
  for(int i=x; i<x+tt; ++i){
    if(s[i]!='?'&&s[i]!=t[i-x])
      return 0;
  }
  return 1;
}
int main(){
  scanf("%s%s",s,t);
  ss=strlen(s);
  tt=strlen(t);
    int ans=-1;
    for(int i=ss-tt; i>=0; --i){
      if(chck(i)){
        ans=i;
        break;
      }
    }
    if(ans==-1){
      cout<<"UNRESTORABLE"<<endl;
    }
    else{
      for(int i=ans; i<ans+tt; ++i){
        s[i]=t[i-ans];
      }
      for(int i=0; i<ss; ++i)
        if(s[i]=='?')
          s[i]='a';
      printf("%s\n",s);
    }

  return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9) + 7;
const double PI = acos(-1);
const double EPS = 1e-9;
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, M; cin >> N >> M;
	vector<int>ball(N, 1);
	vector<int>red(N, 0); red[0] = 1;
	rep(i, 0, M) {
		int x, y; cin >> x >> y;
		x--, y--;
		ball[x]--; ball[y]++;
		if (red[x] == 1)red[y] = 1;
		if (ball[x] == 0)red[x] = 0;
	}
	cout << count(all(red), 1) << endl;
	return 0;
}

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

using namespace std;

int main(){
        int N, T;
        cin>>N>>T;
        vector <int> a(N);
        for(int i=0;i<N;i++){
                cin>>a[i];
        }
        int dx[100011];
        int dn[100011];
        dx[N-1]=a[N-1];
        dn[0]=a[0];
        for(int i=1;i<N;i++){
                dn[i]=dn[i-1];
                dn[i]=min(dn[i], a[i]);
        }
        for(int i=N-2;i>=0;i--){
                dx[i]=dx[i+1];
                dx[i]=max(dx[i], a[i]);
        }
        /*for(int i=0;i<N-1;i++){
                cout<<dx[i+1]<<"-"<<dn[i]<<endl;
        }*/
        int dmax=0;
        for(int i=0;i<N-1;i++){
                if(dx[i+1]-dn[i]){
                        dmax=max(dmax, dx[i+1]-dn[i]);
                }
        }
        int res=0;
        int nowx=-1, nown=-1;
        for(int i=0;i<N-1;i++){
                if(nowx!=dx[i+1]&&nown!=dn[i]&&dmax==dx[i+1]-dn[i]){
                        res++;
                        nowx=dx[i+1];
                        nown=dn[i];
                }
        }
        cout<<res<<endl;
        return 0;
}


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

vector<int> city(200,-1);
int getId(int i){
	if(i==city[i]) return i;
	else return getId(city[i]);
}
int main(){
	for(;;){
		int n,m;
		cin>>n>>m;
		if(n+m==0) break;
		priority_queue< pair< int, pair<int,int> >, vector< pair< int, pair<int,int> > >, greater< pair< int, pair<int,int> > > > bridge;
		for(int i=0; i<n; i++){
			city[i]=i;
		}
		for(int x,y,c;m--;){
			cin>>x>>y>>c;
			bridge.push(make_pair(c, make_pair(x,y)));
		}
		int total=0;
		for(;bridge.size();){
			int cost = bridge.top().first;
			pair<int,int> br = bridge.top().second;
			bridge.pop();
			if(getId(br.first) != getId(br.second)){
				city[getId(br.first)] = getId(br.second);
				total += cost;
			}
		}
		cout<<total<<endl;
	}
}

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

int main() {
  int N;
  cin >> N;
 vector<char> S(N);
  
  for (int i = 0; i < N; i++) {
  cin >> S.at(i);
}
  
  bool F = false;
  for(int i = 0; i < N; i++){
  if(S.at(i) == 'Y'){
    F = true;
  }
  }
  if(F){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }
}

Measured memory_bytes: 256
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
import queue
import copy

# 最大公約数
def gcd(m,n):
  x = max(m,n)
  y = min(m,n)
  if x%y == 0:
    return y
  else:
    while x%y != 0:
      z = x%y
      x = y
      y = z
    else:
      return z

# 幅優先探索(BFS)でスタート座標(x, y)からの最大距離返す
def bfs(SS, x, y, H, W):#入力(座標系(迷路), x, y, xの端, yの端)
  x_next = [0, 0, -1, 1]
  y_next = [1, -1, 0, 0]
  tempx = x
  tempy = y
  mlength = 0
  q = deque()
  xytuple = (x, y, 0)
  q.append(xytuple)


  while q:
    xytuple = q.popleft()
    SS[xytuple[0]][xytuple[1]] = "x" #探索した場所は探索できないようにする
    for i in range(4): #このforで上下左右を調べてる
      tempx = xytuple[0] + x_next[i]
      tempy = xytuple[1] + y_next[i]
      #print(tempx, tempy, xytuple[2])
      #print(S)
      if(0 <= tempx and tempx < H and 0 <= tempy and tempy < W and SS[tempx][tempy] == "."):
        temptuple = (tempx, tempy, xytuple[2]+1)
        SS[temptuple[0]][temptuple[1]] = "x" #探索した場所は探索できないようにする
        mlength = max(mlength, xytuple[2] +1)
        q.append(temptuple)
      #print(q)
  return mlength

#素因数分解
def prime_factorize(n):
  a = []
  while n % 2 == 0:
    a.append(2)
    n //= 2
  f = 3
  while f * f <= n:
    if n % f == 0:
      a.append(f)
      n //= f
    else:
      f += 2
  if n != 1:
    a.append(n)
  return a

#重複を検出
def has_duplicates(seq):
  return len(seq) != len(set(seq))



#X = str(input()).split()
#a = [int(x) for x in input().split()]


N = int(input())
A = [int(x) for x in input().split()]

a = abs(A[0])

for i in range(N-1):
  a += abs(A[i+1] - A[i])

a += abs(A[N-1])

print(a-abs(A[0])-abs(A[1]-A[0])+abs(A[1]))

for i in range(1, N-1):
  print(abs(a-abs(A[i+1]-A[i])-abs(A[i]-A[i-1])+abs(A[i+1]-A[i-1])))

print(a-abs(A[N-1])-abs(A[N-1]-A[N-2])+abs(A[N-2]))




Measured memory_bytes: 64088
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	private static final String WAR = "War";
	private static final String NO_WAR = "No War";
	
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		
		// 設定情報
		int xCount = scan.nextInt();
		int yCount = scan.nextInt();
		int xPosition = scan.nextInt();
		int yPosition = scan.nextInt();
		
		// xの情報
		int[] x = new int[xCount];
		for(int i=0;i<xCount;i++){
			x[i] = scan.nextInt();
		}
		
		// yの情報
		int[] y = new int[yCount];
		for(int i=0;i<yCount;i++){
			y[i] = scan.nextInt();
		}
		
		// xの値のソート
		Arrays.sort(x);
		// yの値のソート
		Arrays.sort(y);
		
		// xの最大値 ＞＝ yの最小値となるかどうか判定する
		String result;
		if(x[xCount-1] >= y[0]){
			result = WAR;
		}else{
			// Zの範囲判定考慮追加 X < Z ≦ Y
			if(x[xCount-1] > xPosition &&
					y[0] <= yPosition){
				result = NO_WAR;
			}else{
				result = WAR;
			}
		}
		
		System.out.println(result);
		
		

	}

}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
// statics
using namespace std;
using int64 = int_fast64_t;
using PAIR = pair<int, int>;
constexpr int INF = 1 << 30;
constexpr int64 LINF = 1LL << 60;
constexpr int MOD = 1e9 + 7;
constexpr int MAX_N = 1e5 + 1;

// init/input
#define int int64
#define INIT ios::sync_with_stdio(false);cin.tie(0);
#define VAR(type, ...) type __VA_ARGS__;MACRO_VAR_Scan(__VA_ARGS__);
template<typename T> void MACRO_VAR_Scan(T &t) {cin>>t;}
template<typename First, typename...Rest> void MACRO_VAR_Scan(First &first, Rest&...rest) {cin>>first;MACRO_VAR_Scan(rest...);}
#define VEC(type, c, n) vector<type> c(n);for(auto &&i:c)cin>>i;

// out
#define OUT(dist) cout<<(dist);
#define FOUT(n, dist) cout<<fixed<<setprecision(n)<<(dist);
#define SP cout<<" ";
#define BR cout<<"\n";
#define debug(x) cerr<<#x<<":"<< (x);BR;

// utility
#define ALL(a) (a).begin(), (a).end()
#define EACH(i, a) for(auto &&i:(a))
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RFOR(i, a, b) for(int i=(b)-1;i>=0;--i)
#define REP(i, n) for(int i=0;i<(n);++i)
#define RREP(i, n) for(int i=(n)-1;i>=0;--i)

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

signed main() {
  INIT;
	VAR(int, h, w);
	VEC(string, s, h);

	bool ok = true;
	REP(hi, h) {
		REP(wi, w) {
			if (s[hi][wi] == '.') continue;
			bool tmp = false;
			REP(i, 4) {
				int ny = hi + dy[i];
				int nx = wi + dx[i];
				if (!(0 <= ny && ny < h &&
							0 <= nx && nx < w)) continue;
				if (s[hi][wi] == '#') {
					tmp |= (s[ny][nx] == '#');
				}
			}
			ok &= tmp;
			//debug(hi);
			//debug(wi);
			//OUT(tmp ? "o" : "x")BR;
		}
	}
	OUT(ok ? "Yes" : "No")BR;
	
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define loop(i, a, b) for(li i=a; i<=b; i++)
#define stuff ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
typedef long long li;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<li, li> lii;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<ii> vii;
typedef vector<lii> vlii;
li mod = 1e9+7;
li expo(li base, li exponent)
{
	li ans=1;
	while(exponent)
	{
		if(exponent&1) ans = (ans*base)%mod;
		base = (base*base)%mod;
		exponent >>= 1;
	}
	return ans;
}
li gcd(li x, li y)
{
	if(y==0) return x;
	return gcd(y, x%y);
}


typedef tree<li, null_type, less<li>,
rb_tree_tag, tree_order_statistics_node_update> ordered_set;

int main()
{
	stuff;
	// #ifndef ONLINE_JUDGE 
	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
	// freopen("error.txt", "w", stderr);
	// #endif

	li n, m;
	cin >> n >> m;
	vector<li> h(n);
	vector<vector<li> > g(n);
	for(int i=0; i<n; i++) cin >> h[i];
	for(int i=0, x, y; i<m; i++)
	{
		cin >> x >> y;
		--x; --y;
		g[x].pb(y); g[y].pb(x);
	}
	li cnt=0;
	for(int i=0; i<n; i++)
	{
		bool ok=true;
		for(auto v : g[i])
		{
			if(h[v]>=h[i]) ok=false;
		}
		if(ok) cnt++;
	}
	cout << cnt;
	return 0;
}


Measured memory_bytes: 9772
#include <algorithm>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <queue>
#include <stack>
#include <utility>
#include <vector>
using std::cin;
using std::cout;
using std::endl;

int h, w;

int get_a(void) {
    return w;
}
int get_b(void) {
    int a, b, c, k = h / 3, l = w / 2;
    if (h % 3 == 1) {
        if (w % 2 == 0) {
            a = w * k;
            b = (2 * k + 1) * l;
            c = b;
            return a - b > 0 ? a - b : b - a;
        } else {
            a     = w * k;
            b     = (l + 1) * (2 * k + 1);
            c     = l * (2 * k + 1);
            int d = std::abs(a - b);
            int e = std::abs(b - c);
            int f = std::abs(c - a);
            if (a > b && a > c)
                return a;
            else if (b > a && b > c)
                return b;
            else
                return c;
        }
    } else {
        if (w % 2 == 0) {
            a = (k + 1) * w;
            b = (2 * k + 1) * l;
            c = b;
            return a - b > 0 ? a - b : b - a;
        } else {
            a     = (k + 1) * w;
            b     = (l + 1) * (2 * k + 1);
            c     = l * (2 * k + 1);
            int d = std::abs(a - b);
            int e = std::abs(b - c);
            int f = std::abs(c - a);
            if (d > e && d > f)
                return d;
            else if (e > d && e > f)
                return e;
            else
                return f;
        }
    }
}
int get_c(void) {
    return h;
}
int get_d(void) {
    int a, b, c, k = w / 3, l = h / 2;
    if (w % 3 == 1) {
        a = k * h;
    } else {
        a = (k + 1) * h;
    }
    if (h % 2 == 0) {
        b = (2 * k + 1) * l;
        c = b;
        return std::abs(a - b);
    } else {
        b     = (2 * k + 1) * (l + 1);
        c     = (2 * k + 1) * (l);
        int d = std::abs(a - b);
        int e = std::abs(b - c);
        int f = std::abs(c - a);
        if (d > e && d > f)
            return d;
        else if (e > d && e > f)
            return e;
        else
            return f;
    }
}

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

    cin >> h >> w;
    if (h % 3 == 0 || w % 3 == 0) {
        cout << 0 << endl;
    } else {
        // cout << get_a() << " " << get_b() << " " << get_c() << " " << get_d()
        //<< endl;
        cout << std::min(std::min(get_a(), get_b()), std::min(get_c(), get_d()))
             << endl;
    }

    return 0;
}


Measured memory_bytes: 504
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
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 int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n,k;
    cin >> n >> k;
    set<int> se;
    rep(i,k) {
        int d;
        cin >> d;
        se.insert(d);
    }
    rep2(i,n,1000000) {
        string s = to_string(i);
        bool ok =  true;
        for(char c : s) {
            if(se.count(c-'0')) {
                ok = false;
                break;
            }
        }
        if(ok) {
            cout << i << endl;
            return 0;
        }
    }
}


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

#define debug(a) cout << #a << " " << a << endl;
#define _debug(a, i) cout << #a << "[" << i << "]" \
						  << " = " << a[i] << endl;
#define fastio                        \
	ios_base::sync_with_stdio(false); \
	cin.tie(0);                       \
	cout.tie(0);
#define PI 3.141592654

using namespace std;

using ll = long long;
const int MOD = 1e9 + 7;
const ll INF = 1e18 + 9;

ll powmod(ll base, ll exp, const ll MOD){ll ans = 1;while (exp){	if (exp & 1)	ans = (ans * base) % MOD;base = (base * base) % MOD;exp >>= 1;}return ans;}
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a, b); }
ll modInverse(ll n, const ll p) { return powmod(n, p - 2, p); }
void add(ll &x, ll v)
{
	x = (x + v) % MOD;
	if (x < 0)
		x += MOD;
}
//ll f[500005];
//ll kCn(ll k, ll n) { return (f[n] * modInverse((f[n - k] * f[k]) % MOD, MOD)) % MOD; }


const int mxN = 2e5 + 100;
ll a[mxN];


void test_case() {
	
}

int main()
{
	fastio;
	int n;
	cin >> n;

	for (int i = 1; i <= n; ++i) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1, greater<ll>());

	ll ans = 0;
	ans += a[1];
	//cout << 1 << " ";
	for (int i = 1, j = 1; i + 1 < n; ++i) {
		if (i % 2 == 1)
			++j;
		ans += a[j];
		//cout << j << " ";
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 5212
import math
import fractions

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def ValueToBits(x,digit):
    res = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        res[i]=now%2
        now = now >> 1
    return res

def BitsToValue(arr):
    n = len(arr)
    ans = 0
    for i in range(n):
        ans+= arr[i] * 2**i
    return ans

def ValueToArray10(x, digit):
    ans = [0 for i in range(digit)]
    now = x
    for i in range(digit):
        ans[digit-i-1] = now%10
        now = now //10
    return ans
'''
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 2
N = 10 ** 6 + 2
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)
'''


#a = list(map(int, input().split()))

s = input()
n = len(s)

ans = 'Yes'
for i in range(n//2):
    if(s[i]!=s[n-1-i]):
        ans = 'No'
for i in range(n//4):
    if(s[i]!=s[(n-1)//2-1-i]):
        ans = 'No'
        
for i in range(n//4):
    if(s[(n+3)//2-1+i]!=s[n-1-i]):
        ans = 'No'
        
print(ans)











Measured memory_bytes: 63980
import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10**9)
INF = 10**19
MOD = 10**9 + 7
EPS = 10**-10

def SCC(N, edges):
    """ 強連結成分分解 """

    nodes1 = [[] for i in range(N)]
    nodes2 = [[] for i in range(N)]
    for u, v in edges:
        nodes1[u].append(v)
        nodes2[v].append(u)

    T = []
    visited = [False] * N
    def rec1(cur):
        visited[cur] = True
        for nxt in nodes1[cur]:
            if not visited[nxt]:
                rec1(nxt)
        T.append(cur)

    for u in range(N):
        if not visited[u]:
            rec1(u)

    visited = [False] * N
    group = [0] * N
    grpnum = 0
    def rec2(cur):
        group[cur] = grpnum
        visited[cur] = True
        for nxt in nodes2[cur]:
            if not visited[nxt]:
                rec2(nxt)

    for u in reversed(T):
        if not visited[u]:
            rec2(u)
            grpnum += 1
    return grpnum, group

N, M = MAP()
edges = []
for i in range(M):
    a, b = MAP()
    edges.append((a, b))

grpnum, group = SCC(N, edges)
ans = [[] for i in range(grpnum)]
for i in range(N):
    ans[group[i]].append(i)

print(grpnum)
for i in range(grpnum):
    ans[i].insert(0, len(ans[i]))
    print(*ans[i])


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

int max(int a, int b){
  return (a<b?b:a);
}

int main(int argc, char *argv[])
{
  int testcase = 0;
  scanf("%d", &testcase);
  
  while(testcase--){
    
    int i, j;
    int m, n, o;
    scanf("%d%d%d", &m, &n, &o);
    int walks[1+m][1+n];
    int prohibited[1+m][1+n][2];
    
    for(i = 0; i < 1+m; ++i){
      for(j = 0; j < 1+n; ++j){
        prohibited[i][j][0] = 0;
        prohibited[i][j][1] = 0;
      }
    }
    
    for(i = 0; i < o; ++i){
      int ti, tj, tti, ttj;
      scanf("%d%d%d%d", &ti, &tj, &tti, &ttj);
      if( tj == ttj ){
        prohibited[max(ti,tti)][tj][0] = 1;
      }else if( ti == tti ){
        prohibited[ti][max(tj,ttj)][1] = 1;
      }
    }
    
    walks[0][0] = 1;
    for(i = 0; i < 1+m; ++i){
      for(j = 0; j < 1+n; ++j){
        if( i == 0 && j == 0 ) continue;
        walks[i][j] = 0;

        if( i > 0 && !prohibited[i][j][0] ){
          walks[i][j] += walks[i-1][j];
        }
        if( j > 0 && !prohibited[i][j][1] ){
          walks[i][j] += walks[i][j-1];
        }
      }
    }
    
    if( walks[m][n] == 0 ){
      puts("Miserable Hokusai!");
    }else{
      printf("%d\n", walks[m][n]);
    }

  }
  return (EXIT_SUCCESS);
}

Measured memory_bytes: 0
fun main(args: Array<String>) {
    var (a, b, c, d) = readLine()!!.split(" ").map { it.toInt() }
    while (c > 0 && a > 0) {
        c -= b
        a -= d
    }
    if (c <= 0) {
        println("Yes")
    } else {
        println("No")
    }
}

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

int n;

void solve()
{
    string ans = "No";
    for (int i = 1; i < 10; i++)
    {
        for (int j = 1; j < 10; j++)
        {
            if (i * j == n)
                ans = "Yes";
        }
    }

    cout << ans;
}

int main()
{
    cin >> n;

    solve();
}


Measured memory_bytes: 256
#include <stdio.h>

int main() {
    long a = 0, b = 0;
    
    scanf("%ld %ld", &a, &b);
    printf("%ld ", a/b);
    printf("%ld ", a%b);
    printf("%f\n", (double)a/(double)b);                            

    return 0;
}


Measured memory_bytes: 2084
A,B,C = map(int,input().split())
def operate(a,b,c,t):
    if not (a % 2 == 0 and b % 2 == 0 and c % 2 == 0):
        return t
    (a,b,c) = (b//2 + c//2,c//2 + a//2,a//2 + b//2)
    return operate(a,b,c,t+1)
if A == B == C and A % 2 == 0:
    ans = -1
else:
    ans = operate(A,B,C,0)
print(ans)

Measured memory_bytes: 3064
# -*- coding:utf-8 -*-
import numpy as np
N, K = [int(i) for i in input().split()]
# print("N:{}, K:{}".format(N, K))

cnt = np.zeros([1, N], dtype=int)
# print(cnt.shape)

## 繰り返しの回数はお菓子の種類に依存
for i in range(K):
    
    ## お菓子の種類dとそのお菓子dを持っている人の番号A
    d = int(input())
    A = [int(i) for i in input().split()]
    # print("d:{}, A:{}".format(d, A))
    
    ## お菓子dを持っている人の番号に値を代入
    for j in range(0, len(A)):
        cnt[0][A[j]-1] = 1
        
        # print("A[j]:{}".format(A[j]-1))
    
    
# print(cnt == 0)
print(np.count_nonzero(cnt == 0))
        



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

using namespace std;

#define fcout(d) cout << fixed << setprecision(d)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define repU(i,s,t) for(int i = (s); i <= (t); ++i)
#define repD(i,t,s) for(int i = (t); i >= (s); --i)
#define all(v)  begin(v),end(v)
#define clr(v) fill(all(v),0)
#define l_bnd lower_bound
#define u_bnd upper_bound
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define mkp make_pair
#define mkt make_tuple
#define fir first
#define sec second
#define q_ceil(n,d) ((n - 1)/(d) + 1)
#define parity(a,b) (((a)^(b)) & 1 ^ 1)

typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const pair<int,int> DIR[] = { {1,0},{0,1},{-1,0},{0,-1},{1,1},{-1,1},{-1,-1},{1,-1} };
const int INF_32 = -1 + (1 << 30);
const ll INF_64 = -1 + (1LL << 62);
const int MOD = 1e9 + 7;

ull next_subset(ull s){
	ull tem = s + (s & -s);
	ull btm = (~tem & s) / (s & -s) >> 1;
	return btm | tem;
}


int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	string s1,s2;
	cin>>n>>s1>>s2;
	ll ans = 1;
	int md = 0;
	rep(i,n){
		if(s1[i] == s2[i]){
			if(md == 0) ans *= 3;
			if(md == 1) ans *= 2,ans %= MOD;
			md = 1;
		}else{
			++i;
			if(md == 0) ans = 6;
			if(md == 1) ans *= 2,ans %= MOD;
			if(md == 2) ans *= 3,ans %= MOD;
			md = 2;
		}
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
typedef long long ll;
bool isprime(ll x){
  for(ll i=2;i*i<=x;i++){
    if(x%i==0) return false;
  }
  return true;
}
int main(){
  ll x;
  cin>>x;
  while(!isprime(x)) x++;
  cout<<x<<endl;
}


Measured memory_bytes: 256
// Author: HarshKumar

#include <bits/stdc++.h>
using namespace std;
#define ll int64_t
const ll N = 1e6 + 6, M = 1e9 + 7;
ll f(ll x)
{
    return x * (x + 1) / 2;
}
int main()
{
    ios::sync_with_stdio(false), cin.tie(nullptr);
    ll n, k, s = 0;
    cin >> n >> k;
    for (ll i = k; i <= n + 1; i++)
        s = (s + f(n) - f(n - i) - f(i - 1) + 1 + N * M) % M;
    cout << s;
}


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

int main()
{
	int n,ans=0;
	cin>>n;
	int a[n+1]={},b[n+1]={};
	vector<int> vec;
	for(int i = 1 ; i <= n ; i++)
	{
		cin>>a[i];
	}
	for(int i = n ; i >= 1 ; i--)
	{
		int sum = 0;
		
		for(int j = i ; j <= n ; j += i)
		{
			sum += b[j];
			sum %= 2;
		}
		if( sum != a[i] )
		{
			b[i]++;
			b[i] %= 2;
			ans++;
			vec.push_back(i);
		}
		
	}
	cout<<ans<<"\n";
	for(unsigned int i = 0; i < vec.size() ; i++)
		cout << vec[i] << " ";
	

	return 0;
}


Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
typedef unsigned int uint;
using namespace std;

struct edge {
    ll from;
    ll to;
    ll cost;
};

typedef pair <ll, ll> P;
const ll INF = 1LL << 40, V = 300;
ll n, d[V];
vector <edge> G[V];

bool compareTwoEdge(edge e1, edge e2) {
    return e1.cost < e2.cost;
}

void dijkstra(ll s) {
    priority_queue<P, vector<P>, greater<P>> q;
    fill(d, d+V, INF);
    d[s] = 0;
    q.push(P(0, s));

    while (!q.empty()) {
        P p = q.top();
        q.pop();
        ll v = p.second;
        if (d[v] < p.first) continue;
        for (int i = 0; i < G[v].size(); i++) {
            edge e = G[v][i];
            if (d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                q.push(P(d[e.to], e.to));
            }
        }
    }
}

int main() {
    cin.sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    ll a[n][n];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            cin >> a[i][j];
        }
    }

    vector<edge> vec;
    for (int i = 0; i < n-1; i++) {
        for (int j = i+1; j < n; j++) {
            edge e = {i, j, a[i][j]};
            vec.push_back(e);
        }
    }

    sort(vec.begin(), vec.end(), compareTwoEdge);

    ll ans = 0LL;
    for (int i = 0; i < vec.size(); i++) {
        edge e = vec[i];
        dijkstra(e.from);
        if (d[e.to] > e.cost) {
            G[e.from].push_back(e);
            edge e2 = {e.to, e.from, e.cost};
            G[e.to].push_back(e2);
            ans += e.cost;
        } else if (d[e.to] < e.cost) {
            ans = -1LL;
            break;
        }
    }

    cout << ans << "\n";
    return 0;
}

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

int main(){
  string s;
  bool frag = false;
  cin >> s;
  for(int i=0;i<s.size();i++){
    if(s[i] == '7'){
      frag = true;
      break;
    }
  }
  if(frag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include <iostream>

using namespace std;

long long a,b;

int main(){
    cin >> a >> b;
    long long c;
    if(a > b){
        c = a;
        a = b;
        b = c;
    }
    if(a == 1){
        if(b == 1){
            cout << 1 << endl;
            return 0;
        }
        if(b == 2){
            cout << 0 << endl;
        }
        cout << b-2 << endl;
        return 0;
    }
    if(a == 2){
        cout << 0 << endl;
        return 0;
    }
    cout << (a-2) * (b-2) << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  int c = sc.nextInt();
  if(a != b && a != c && b != c)System.out.println("3");
  else if(a == b && a == c)System.out.println("1");
  else System.out.println("2");
}
}


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

const int mod=1000000007;
int n,k,m,a[25010],f[25010][410],sum[25010][410],pl,pr,mi[25010],ans,invC[410],c[410][410],jc[410],g[25010][410],sg;
bool bo[410],Bo;

int quickmi(int a,int b)
{
	int t=1;
	for (; b; b>>=1,a=1ll*a*a%mod)
		if (b&1) t=1ll*t*a%mod;
	return t;
}

int add(int x,int y) {return (x+y>=mod?x+y-mod:x+y);}

int main()
{
	for (int i=0; i<=400; i++)
	{
		c[i][0]=1,jc[i]=(i==0?1:1ll*jc[i-1]*i%mod);
		for (int j=1; j<=i; j++) c[i][j]=(c[i-1][j-1]+c[i-1][j])%mod;
	}
	scanf("%d%d%d",&n,&k,&m),mi[0]=1,ans=0;
	for (int i=1; i<=25000; i++) mi[i]=1ll*k*mi[i-1]%mod;
	for (int i=1; i<=m; i++) scanf("%d",&a[i]);
	f[1][1]=sum[1][1]=k;
	for (int i=2; i<=n; i++)
	{
		for (int j=1; j<k; j++)
			f[i][j]=(1ll*(k-j+1)*f[i-1][j-1]+sum[i-1][j])%mod;
		sum[i][k]=0;
		for (int j=k-1; j; j--) sum[i][j]=add(sum[i][j+1],f[i][j]);
	}
	for (int i=1; i<=m-k+1; i++)
	{
		memset(bo,0,sizeof(bo)),Bo=1;
		for (int j=i; j<=i+k-1; j++) 
		{
			if (bo[a[j]]) {Bo=0; break;}
			bo[a[j]]=1;
		}
		if (Bo) return printf("%d\n",1ll*mi[n-m]*(n-m+1)%mod),0;
	}
	Bo=1,memset(bo,0,sizeof(bo));
	for (int i=1; i<=m; i++)
	{
		if (bo[a[i]]) {Bo=0; break;}
		bo[a[i]]=1;
	}
	for (int i=0; i<=k; i++) invC[i]=quickmi(1ll*c[k][i]*jc[i]%mod,mod-2);
	if (Bo)
	{
		g[1][1]=k,sg=(k==2?2:0);
		for (int i=2; i<=n; i++)
		{
			g[i][1]=(mi[i]<sg?mi[i]-sg+mod:mi[i]-sg);
			for (int j=2; j<k; j++)
				g[i][j]=(1ll*(k-j+1)*g[i-1][j-1]-g[i-1][k-1]+mod)%mod;
			sg=(1ll*k*sg+g[i][k-1])%mod;
		}
		for (int i=0; i<=n; i++)
		{
			sum[i][0]=0;
			for (int j=1; j<k&&i+j<=n; j++) sum[i][j]=(sum[i][j-1]+1ll*invC[j]*g[i+j][j])%mod;
		}
		for (int i=1; i<=n-m+1; i++)
		{
			int res=0;
			for (int j=i+m-1; j<=n&&j<i+k-1; j++)
			{
				int nw1=1ll*g[j][j-i+1]*invC[j-i+1]%mod;
				int nw2=(j==n?1:sum[n-j-1][j-i+1]);
				res=(res+1ll*nw1*nw2%mod*c[k-m][j-(i+m-1)]%mod*jc[j-(i+m-1)])%mod;
			}
			ans=(ans+1ll*mi[n-m]-res+mod)%mod;
		}
	} else
	{
		memset(bo,0,sizeof(bo));
		for (int i=1; i<=m; i++)
		{
			if (bo[a[i]]) {pl=i; break;}
			bo[a[i]]=1;
		}
		memset(bo,0,sizeof(bo));
		for (int i=m; i; i--)
		{
			if (bo[a[i]]) {pr=i; break;}
			bo[a[i]]=1;
		}
		for (int i=1; i<=n-m+1; i++)
		{
			int nw1=0,nw2=0;
			for (int j=pl-1; j<k; j++) nw1=(nw1+1ll*f[i+pl-2][j]*invC[j]%mod*c[k-pl+1][j-pl+1]%mod*jc[j-pl+1])%mod;
			for (int j=m-pr; j<k; j++) nw2=(nw2+1ll*f[n-(i+m-1)+m-pr][j]*invC[j]%mod*c[k-m+pr][j-m+pr]%mod*jc[j-m+pr])%mod;
			ans=(ans+mi[n-m]+1ll*(mod-nw1)*nw2)%mod;
		}
	}
	return printf("%d\n",ans),0;
}

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

int main(){
    ll a[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    ll k;
    cin>>k;
    k--;
    cout<<a[k]<<endl;
}


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

int main()
{
	string s;
	cin >> s;
	int a = 0, b = 0, c= 0;
	for(int i = 0; i < 3; i++)
		if(s[i] == 'a') a++;
		else if(s[i] == 'b') b++;
		else if(s[i] == 'c') c++;
	if(a == 1 && b == 1 && c == 1)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

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

#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int n; cin >> n;
    vector<int> a(n);
    for(int i=0; i<n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    
    cout << a.at(n-1) - a.at(0) << endl;
    return 0;
}

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

//型定義
typedef long long ll;

//定数
const int INF=1e+9;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

int main(){
    ll N;
    cin>>N;
    vector<ll> C(N-1),S(N-1),F(N-1);
    REP(i,N-1){
        cin>>C[i]>>S[i]>>F[i];
    }

    REP(i,N-1){
        ll time=(C[i]+S[i]);
        REP2(j,i+1,N-1){
            ll k=max((time-1LL)/F[j]+1,S[j]/F[j]);
            time=k*F[j];
            time+=C[j];
        }
        cout<<time<<endl;
        
    }
    cout<<0<<endl;
}

Measured memory_bytes: 3540
#include<stdio.h>
#include<stdlib.h>
int main()
{
    long long int n,i,j,r=0,g=0,b=0;
    long long int count;
    scanf("%d ",&n);
    char s[n+2];
    for(i=1; i<=n; i++)
    {
        scanf("%c",&s[i]);
        if(s[i]=='R')
            r++;
        else if(s[i]=='G')
            g++;
        else
            b++;
    }
    count=r*g*b;
    for(j=1; j<n-1; j++)
    {
        i=1;
        while(j+i*2<=n)
        {
            if(s[j]!=s[j+i] && s[j+i]!=s[j+2*i] && s[j]!=s[j+2*i])
                count-=1;
            i+=1;
        }
    }
    printf("%lld\n",count);
    return 0;
}


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

typedef struct s{int p,n;}s;

int cmp(const void *a,const void *b)
{
	return ((s*)a)->p-((s*)b)->p;
}

int main()
{
	int f,i,m,n,q[100][2];
	s x[25];
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++)
		x[i].n=i+1,x[i].p=(i==1?10000:0);
	for(i=0;i<m;i++)
	{
		scanf("%d%d",&q[i][0],&q[i][1]);
		q[i][0]--,q[i][1]--;
	}
	for(;;)
	{
		f=0;
		for(i=0;i<m;i++)
			if(x[q[i][0]].p>=x[q[i][1]].p)
			{
				x[q[i][1]].p=x[q[i][0]].p+1;
				f=1;
			}
		if(!f)
			break;
	}
	qsort(x,n,sizeof(s),cmp);
	for(i=0;i<n;i++)
		printf("%d\n",x[i].n);
	return 0;
}

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

int main(){
  int n,k;
  cin>>n>>k;
  set<int>st;
  rep(i,k){
    int d;
    cin>>d;
    rep(i,d){
      int a;
      cin>>a;
      if(!st.count(a))st.insert(a);
    }
  }
  int cnt=0;
  for(int i=1;i<=n;i++){
    if(!st.count(i))cnt++;
  }
  cout<<cnt<<endl;
}

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

#ifdef _DEBUG
#define debug(x) cerr << "line: " << __LINE__ << ", func: " << __func__ << " ->  " << #x << " = " << x << endl
#else
#define debug(x)
#endif

#define all(s) begin(s), end(s)
#define rall(s) rbegin(s), rend(s)
#define rep(i, a, b) for (int i = (a); i < (b); i++)
#define rrep(i, a, b) for (int i = ((a)-1); i >= (b); i--)
#define pb push_back
#define sz(a) int((a).size())
#define put(a) ((cout) << (a) << (endl))
#define putf(a, n) ((cout) << (fixed) << (setprecision(n)) << (a) << (endl))
#define deg2rad(x) (((x)*PI) / (180.0))
#define rad2deg(x) (((x) * (180.0)) / PI)

using namespace std;

using ll = long long;
using ull = unsigned long long;
using i_i = pair<int, int>;
using ll_ll = pair<ll, ll>;
using d_ll = pair<double, ll>;
using ll_d = pair<ll, double>;
using d_d = pair<double, double>;

static constexpr ll LL_INF = 1LL << 60;
static constexpr int I_INF = 1 << 28;
static constexpr double PI = static_cast<double>(3.14159265358979323846264338327950288);
static constexpr double EPS = numeric_limits<double>::epsilon();

static map<type_index, const char* const> scanType = {
    {typeid(int), "%d"}, {typeid(ll), "%lld"}, {typeid(double), "%lf"}, {typeid(char), "%c"}};

template <class T> static void scan(vector<T>& v);
[[maybe_unused]] static void scan(vector<string>& v, bool isWord = true);
template <class T> static inline bool chmax(T& a, T b);
template <class T> static inline bool chmin(T& a, T b);
template <class T> static inline T gcd(T a, T b);
template <class T> static inline T lcm(T a, T b);
template <class A, size_t N, class T> static void Fill(A (&arr)[N], const T& val);
template <class T> T mod(T a, T m);

int main(int argc, char* argv[]) {
  long long N;
  scanf("%lld", &N);
  std::string S;
  std::cin >> S;

  ll e_count = 0, w_count = 0;
  rep(i, 0, N) e_count += S[i] == 'E';

  ll ans = LL_INF;
  rep(i, 0, N) {
    if (S[i] == 'E') e_count--;
    if (i != 0) w_count += S[i - 1] == 'W';
    chmin(ans, w_count + e_count);
  }

  put(ans);
  return 0;
}

template <class T> static void scan(vector<T>& v) {
  auto tFormat = scanType[typeid(T)];
  for (T& n : v) {
    scanf(tFormat, &n);
  }
}

static void scan(vector<string>& v, bool isWord) {
  if (isWord) {
    for (auto& n : v) {
      cin >> n;
    }
    return;
  }

  int i = 0, size = v.size();
  string s;
  getline(cin, s);

  if (s.size() != 0) {
    i++;
    v[0] = s;
  }

  for (; i < size; ++i) {
    getline(cin, v[i]);
  }
}

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

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

template <class T> inline T gcd(T a, T b) { return __gcd(a, b); }

template <class T> inline T lcm(T a, T b) { return (a * b) / gcd(a, b); }

template <class A, size_t N, class T> void Fill(A (&arr)[N], const T& val) {
  std::fill((T*)arr, (T*)(arr + N), val);
}

template <class T> T mod(T a, T m) { return (a % m + m) % m; }


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

int main(){
    int S;
    cin >> S;
    
    int h = S / 3600;
    int m = (S - (h * 3600))/ 60;
    int s = S - ((h * 3600) + (m * 60));
    cout << h << ":" << m << ":" << s << endl;
}


Measured memory_bytes: 3104
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))
min_num = float('inf')
result = 0
for i in range(N):
  if min_num > abs(A-(T-H[i]*0.006)):
    min_num = abs(A-(T-H[i]*0.006))
    result = i+1
print(result)

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, P> PP;

int main()
{
	int n;
	while (cin >> n) {
		if (n == 0)return 0;
		P a[105000];

		string s1, s2;
		for (int i = 0; i < n; i++) {
			cin >> s1 >> s2;
			int hour1 = (int)(s1[0] - '0') * 10 + (int)(s1[1] - '0');
			int min1= (int)(s1[3] - '0') * 10 + (int)(s1[4] - '0');
			int sec1 = (int)(s1[6] - '0') * 10 + (int)(s1[7] - '0');
			int hour2 = (int)(s2[0] - '0') * 10 + (int)(s2[1] - '0');
			int min2 = (int)(s2[3] - '0') * 10 + (int)(s2[4] - '0');
			int sec2 = (int)(s2[6] - '0') * 10 + (int)(s2[7] - '0');
			a[i].first = 3600 * hour1 + 60 * min1 + sec1;
			a[i].second = 3600 * hour2 + 60 * min2 + sec2;
		}
		sort(a, a + n);
		/*
		for (int i = 0; i < n; i++) {
			cout << a[i].first <<" "<< a[i].second << endl;
		}
		*/

		priority_queue<int,vector<int>,greater<int> >que;
		que.push(a[0].second);
		int cnt = 1;
		for (int i = 1; i < n; i++) {
			
			if (que.empty()) {
				cnt++;
				que.push(a[i].second);
			}
			else {
				int k = que.top();
				if (a[i].first >= k) {
					que.pop();
					que.push(a[i].second);
					continue;
				}
				else {
					cnt++;
					que.push(a[i].second);
				}
			}
		}
		cout << cnt << endl;

	}

	return 0;
}

Measured memory_bytes: 4032
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define eps 1e-10
#define MAXN 1005
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
    res = 0;T f = 1;char c = getchar();
    while(c < '0' || c > '9') {
    	if(c == '-') f = -1;
    	c = getchar();
    }
    while(c >= '0' && c <= '9') {
    	res = res * 10 +c - '0';
    	c = getchar();
    }
    res *= f;
}
template<class T>
void out(T x) {
    if(x < 0) {x = -x;putchar('-');}
    if(x >= 10) {
	out(x / 10);
    }
    putchar('0' + x % 10);
}
int64 N;
void Solve() {
    read(N);
    int64 ans = 0;
    for(int64 i = 1 ; i <= N ; ++i) {
        int64 r = N / (N / i);
        int64 t = N / i;
        if(N % t == 0) {
            int64 k = N / t - 1;
            if(k >= i && k <= r) ans += k;
        }
        i = r;
    }
    out(ans);enter;
}
int main() {
#ifdef ivorysi
    freopen("f1.in","r",stdin);
#endif
    Solve();
    return 0;
}


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

#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

int main() {
  string at, s, c;
  cin >> at >> s >> c;
  cout << 'A' << s.at(0) << 'C' << endl;
}


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

typedef long long LL;

int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	LL L, R, ans; std::cin >> L >> R;
	if (L == R) return std::cout << "1\n", 0;
	LL p = 1LL << std::__lg(L ^ R);
	L &= p - 1, R &= p - 1;
	LL q = R ? 1LL << std::__lg(R) + 1 : 1;
	ans = (p - L) * 2 + q;
	if (q > L) ans -= q - L;
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 764
#include <iostream>

using namespace std;

int main(){
    ios::sync_with_stdio(false);

    int a, b, x;

    cin>>a>>b>>x;

    if(a+b >= x and a <= x){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }

    return 0;
}

Measured memory_bytes: 256
my $N = <STDIN>;
my $s = <STDIN>;
my @dat = split(/ /,$s);
my $sum = $dat[0];
for(my $i=0;$i<($N-1);$i++){
  if( ($dat[$i+1]-$dat[$i]) > 0){
     $sum = $sum + ($dat[$i+1]-$dat[$i]);
  }
}
print "$sum";

Measured memory_bytes: 512
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

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;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#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 ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

vector<long long> KnapsackProblem(vector<long long> &v, vector<long long> &w, long long W) {
  size_t n = v.size();
  vector<vector<long long>> dp(n + 1, vector<long long> (W + 1, -INF));
  dp[0][0] = 0;
  for(size_t i = 0; i < n; i++) {
    for(size_t j = 0; j <= W; j++) {
      if(dp[i][j] == -1) continue;
      if(j < w[i]) {
        dp[i + 1][j] = dp[i][j];
      } else {
        dp[i + 1][j] = max(dp[i][j], dp[i + 1][j - w[i]] + v[i]);
      }
    }
  }
  return dp[n];
}

int main(){
  
  lint x; cin >> x;
  vector<lint> v(6, 1);
  vector<lint> w(6);
  for(int i = 0; i < 6; i++) w[i] = 100 + i;
  auto hoge = KnapsackProblem(v, w, x * 5);
  
  if(hoge[x] > 0) cout << 1 << endl;
  else cout << 0 << endl;
  return 0;
}


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

int main () {
  string S ;
  cin >> S ;
  
  string div[4] = {"dream","dreamer","erase","eraser"} ;
  
  reverse(S.begin(),S.end()) ;
  
  bool can = true ;
  for(int i = 0 ; i < 4 ;i++) {
    reverse(div[i].begin(),div[i].end()) ;
  }
  for(int i = 0 ; i < S.size() ;) {
    bool can2 = false ;
    for(int j = 0 ; j < 4 ; j++ ){
      string d = div[j] ;
      if(S.substr(i,d.size()) == d){can2 = true ;i += d.size() ;}
    }
      if(!can2) {can = false ;break ;}
  }
  if(can) cout << "YES" << endl ;
  else cout << "NO" << endl ;
}

Measured memory_bytes: 512