akhauriyash/Code-Regression huggingface dataset:
import sys
from collections import defaultdict

# ----------

sys.setrecursionlimit(10 ** 7)
INF = float("inf")
MOD = 10 ** 9 + 7


def combination(n, k):
    if k > n - k:
        return combination(n, n - k)
    return fact[n] * ifact[k] * ifact[n - k]


def permitation(n, k):
    # nPk = nCk * k!
    res = combination(n, k) * fact[k]
    return res % MOD


N, K = map(int, input().split())
to = defaultdict(list)
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

# nまでの階乗を前処理
n = 200005
fact = defaultdict(int)
fact[0] = 1
for i in range(1, n + 1):
    fact[i] = fact[i - 1] * i
    fact[i] %= MOD
# nまでの階乗の逆元を前処理
ifact = defaultdict(int)
ifact[n] = pow(fact[n], MOD - 2, MOD)
for i in reversed(range(1, n + 1)):
    ifact[i - 1] = ifact[i] * i
    ifact[i - 1] %= MOD


def dfs(v, p=-1):
    global ans
    for u in to[v]:
        if u == p:
            continue
        dfs(u, v)
    if p == -1:
        nk = K
        c = len(to[v]) + 1
    else:
        nk = K - 2
        c = len(to[v]) - 1
    ans *= permitation(nk, c)
    ans %= MOD


ans = 1
dfs(0)
print(ans)


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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())

void printYes(){
	cout<<"Yay!"<<endl;
}
void printNo(){
	cout<<":("<<endl;
}

signed main(){

	string d[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};

	string s;

	cin>>s;
	REP(i,0,7){
		if(d[i]==s){
			cout<<7-(i)<<endl;
		}
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <iomanip>
#include <functional>
#include "math.h"
#include <set>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define VI vector<int>
#define debug(x) cout<<#x<<": "<<x<<endl
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define MB 1000000007
#define NB 1000000000
#define N5 100007
#define ll long long int
int A,B;
string S,T,U;
ll w[N5],v[N5],dp[101][N5];

int main()
{

	cin >>S;
	REP(i,S.length()){
		cout << "x";
	}


}





Measured memory_bytes: 256
import java.util.*;
import java.util.ArrayDeque;
import java.util.Queue;
import java.math.RoundingMode;
import java.math.BigDecimal;



public class Main{
	 public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
	   	int n = sc.nextInt();
	   	double ans = 2*n*Math.PI;
	   	System.out.println(ans);
	}
}

Measured memory_bytes: 36028
#include <iostream>
#include <string>
using namespace std;
int main(void){
  string s;
  cin >> s;
  
  bool code = true;
  
  for(int i=0;i<3;i++){
    if(s[i] == s[i + 1])
      code = false;
  }
  
  if(code)
    cout << "Good" << endl;
  else
    cout << "Bad" << endl;
  
  return 0;
}


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int main()
{
  string s1, s2;
  cin >> s1 >> s2;
  int dp[s1.size() + 10][s2.size() + 10];
  for (int i = 0; i < s1.size() + 10; i++)
  {
    for (int j = 0; j < s2.size() + 10; j++)
    {
      dp[i][j] = 0;
    }
  }
  for (int i = 1; i <= s1.size(); i++)
    dp[i][0] = i;
  for (int j = 1; j <= s2.size(); j++)
    dp[0][j] = j;

  for (int i = 1; i <= s1.size(); i++)
  {
    for (int j = 1; j <= s2.size(); j++)
    {
      // s1[i]を削除するかs1[i + 1]にs2[j]と同じ文字を挿入するか
      int m = min(dp[i - 1][j] + 1, dp[i][j - 1] + 1);
      if (s1[i - 1] == s2[j - 1])
      {
        // 最後の文字が同じだから最後の文字がなくても編集距離は同じ
        m = min(m, dp[i - 1][j - 1]);
        dp[i][j] = m;
      }
      else
      {
        // 最後の文字を置換する
        m = min(m, dp[i - 1][j - 1] + 1);
        dp[i][j] = m;
      }
    }
  }
  cout << dp[s1.size()][s2.size()] << endl;
  return 0;
}


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

int main(){
	int n, i;
	cin >> n;
	int a[n];
	for (i = 0; i < n; i++) cin >> a[i];
	sort(a, a + n);
	//cout << a[0] << endl;
	cout << a[n / 2] - a[n / 2 - 1] << endl;
	return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>


using namespace std;

int main(void){
    int n;
    cin >> n;
    vector<int> x,y;
    int box;
    for(int i=0;i<n;i++){
        cin >> box;
        x.push_back(box);
    }
    y.resize(x.size());
    copy(x.begin(),x.end(),y.begin());
    sort(x.begin(),x.end());
    int mid = n/2;
    for(int i=0;i<n;i++){
        if(y[i] < x[mid]){
            cout << x[mid] << endl;
        }else{
            cout << x[mid-1] << endl;
        }
    }
    return 0;
}

Measured memory_bytes: 3828
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ld long double
#define ull unsigned long long int
#define ll long long int
#define SPEED ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define mod 1000000007ll
#define rep(i,L,R) for(ll i=L;i<R;i++)
#define f(n) rep(i,0,n)
#define DEBUG
#ifdef DEBUG
#define deb2(args...) {dbg,args; cerr<<endl;}
#else
#define deb2(args...)
#endif
struct debb{template<typename T> debb& operator,(const T &v){cerr<<v<<" ";return *this;}}dbg;
#define deb1(args...) do {cerr << #args << " : "; dbg,args; cerr << "\n";} while(0)
#define printa(a,L,R) rep(i,L,R) cout << a[i] <<' ';cout<<"\n";
typedef tree<ll,null_type,less_equal<ll>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
template<typename T>T gcd(T a,T b){if(b==0)return a;else return gcd(b,a%b);}
template<typename T>T lcm(T a,T b){return a/gcd(a,b)*b;}
ll power(ll x,ll y,ll p){ll res=1;x=x%p;while(y>0){if(y&1)res=((res%p)*(x%p))%p;y=y>>1;x=(x*x)%p;}return res;}
ll pow1(ll x,ll y){ll res=1;while(y>0){if(y&1)res=(res*x);y=y>>1;x=x*x;}return res;}
const ll INF = 1e18l+10,N = 2e5+10,MAX = 5000000;
#define sq(X) ((X)*(X))
#define PI 3.141592653589

int main()
{
    ld r;
    cin>>r;
    cout<<2*PI*r<<"\n";
}

Measured memory_bytes: 3776
#include<iostream>
#include<algorithm>
using namespace std;
int N_MAX=100;
int main()
{
  int n,i,j,k,res=0;
  int s[N_MAX];
  cin >> n;
  for(i=0;i<n;i++)
    cin >> s[i];
  sort(s,s+n);
  for(i=0;i<n-2;i++)
    for(j=i+1;j<n-1;j++)
      for(k=j+1;k<n;k++)
        if(s[i]!=s[j]&&s[j]!=s[k]&&s[i]+s[j]>s[k])
          res++;
  cout << res << endl;
  return 0;
}

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

using i64 = long long;

const i64 mod = 1e9+7;

i64 mpow(i64 a, i64 b) {
  if (b == 0) return 1;
  if (b % 2) return a * mpow(a, b-1) % mod;

  i64 ret = mpow(a, b/2);
  return ret * ret % mod;
}

int main() {
  i64 N, M;
  cin >> N >> M;
  vector<i64> step(N+1, 0);
  for (int i = 0; i < M; i++) {
    int a;
    cin >> a;
    step[a] = 1;
  }
  vector<i64> dp(N+1, 0);
  dp[0] = 1;

  for (int i = 0; i < N; i++) {
    if (i + 1 <= N && not step[i + 1]) {
      dp[i + 1] = (dp[i + 1] + dp[i]) % mod;
    }
    if (i + 2 <= N && not step[i + 2]) {
      dp[i + 2] = (dp[i + 2] + dp[i]) % mod;
    }
  }
  cout << dp[N] << endl;
}


Measured memory_bytes: 4800
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
typedef long long ll;

int main() {
    
    string s,t;
    cin >> s >> t;
    int n=s.size();
    
    vector<int> st(26,-1);
    vector<int> en(26,-1);
    rep(i,n) {
        int a=s[i]-'a';
        int b=t[i]-'a';
        if(st[a]!=-1||en[b]!=-1) {
            if(st[a]!=b||en[b]!=a) {
                cout<<"No"<<endl;
                return 0;
            }
        }
        else {
            st[a]=b;
            en[b]=a;
        }  
    }

    cout<<"Yes"<<endl;

 return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vii = vector<vi>;

int main() {
    int N;
    cin >> N;
    vector<string> S(N);
    for(int i = 0; i < N; i++) {
        cin >> S[i];
    }
    map<string, int> count;
    for(string x : S) {
        if(count.count(x)) {
            count.at(x)++;
        }
        else {
            count[x] = 1;
        }
    }
    int ans = count.size();
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 25176
#include <stdio.h>
long d[26]={},m=1e9+7,i,n,a=1;int main(){scanf("%d\n",&n);for(i=0;i<n;++i)d[getchar()-'a']++;for(i=0;i<26;++i)a=(a*(d[i]+1))%m;printf("%d\n",a-1);}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define l long
#define pb push_back
#define mp make_pair
#define mt make_tuple
ll M = 998244353;

int main() {
	// your code goes here
	//ifstream cin("input.txt");
	//ofstream cout("output.txt");
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
	
	ll a,b,c; cin>>a>>b>>c;
	ll u = a*a + b*b + c*c;
	ll v = 2*(a*b + b*c + a*c);
	if( u > v && c > a+b ) cout<<"Yes";
	else cout<<"No";
	
	return 0;
}


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

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define sf scanf
#define pf printf
#define pb push_back
#define mp make_pair
#define PI ( acos(-1.0) )
#define IN freopen("dichromatic.in","r",stdin)
#define OUT freopen("dichromatic.out","w",stdout)
#define FOR(i,a,b) for(i=a ; i<=b ; i++)
#define DBG pf("Hi\n")
#define INF 1000000000
#define i64 long long int
#define eps (1e-8)
#define xx first
#define yy second
#define sq(x)  ((x)*(x))

using namespace __gnu_pbds;
using namespace std ;

#define maxn 200005
#define mod 1000000007LL

typedef  long long int T ;

const int N = 100000 ;

int bigMod(int a, int n, int m)
{
    if(n==0 ) return 1 ;
    int r = bigMod(a,n/2,m) ;
    r = (1LL*r*r)%m ;
    if(n&1) r = (1LL*r*a)%m ;
    return r ;
}


int fact[maxn] , invFact[maxn] ;
int dp[maxn] , cnt[maxn] ;
int a[maxn] ;

int C(int n, int r)
{
    if( n<0 || r <0 || n<r ) return 0 ;
    return (1LL*fact[n]*((1LL*invFact[r]*invFact[n-r])%mod))%mod ;
}

int allB[maxn] , allW[maxn] ;

int main()
{
    fact[0] =1 ;
    for(int i=1 ; i<=2*N ; i++) fact[i] = (1LL*fact[i-1]*i)%mod ;
    invFact[2*N] = bigMod(fact[2*N],mod-2,mod) ;
    for(int i=2*N -1 ; i>=0 ; i--) invFact[i] = (1LL*invFact[i+1]*(i+1))%mod ;

    int b , w ;

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

    int inv2 = bigMod(2,mod-2,mod) ;

    for(int i=1 ; i<=b+w ; i++)
    {
        int ans = allW[i-1] + (1LL*(1-allB[i-1]-allW[i-1])*inv2)%mod ;
        ans = (ans%mod + mod)%mod ;
        printf("%d\n",ans) ;


        int p2 = bigMod( bigMod(2LL,i,mod)  , mod-2 , mod);
        allB[i] = (1LL*p2*C(i-1,b-1))%mod ;
        allB[i] = (allB[i-1]+allB[i])%mod ;

        allW[i] = (1LL*p2*C(i-1,w-1))%mod ;
        allW[i] = (allW[i-1]+allW[i])%mod ;
    }

    return 0 ;
}


Measured memory_bytes: 7168
object Main extends App {
  import scala.io.StdIn._

  val num = readLine.trim.split(' ').map(_.toInt)
  println((1 to 9).permutations.map(_.toArray).count{
    p ⇒ num.indices.forall(i ⇒ num(i) == -1 || num(i) == p(i)) && canMake(p)
  })

  def canMake(array: Array[Int]): Boolean = {
    array(0) + 10 * array(1) + array(2) + 100 * array(3) + 10 * array(4) + array(5) == 100 * array(6) + 10 * array(7) + array(8)
  }
}


Measured memory_bytes: 240512
#include<stdio.h>
#define INF 1000000
int graph[101][101],n,c,d;

void warshall_floyd(void){
  int i,j;
  for(i=1;i<=n;i++)
    for(j=1;j<=n;j++)
      graph[i][j]=graph[j][i]=min(graph[i][j],graph[i][c]+graph[c][d]+graph[d][j]);
}

int min(int x,int y){
  return (x<y)?x:y;
}

int main(void){
  int k,i,j,x,e,a,b;

  while(scanf("%d %d",&n,&k),n,k){

    for(i=0;i<=n;i++)
      for(j=0;j<=n;j++)
	graph[i][j]=(i==j?0:INF);

    for(i=0;i<k;i++){

      if(scanf("%d",&x),x){
	scanf("%d %d %d",&c,&d,&e);

	if(graph[c][d]>e){
	graph[c][d]=graph[d][c]=e;
	warshall_floyd();
	}
      }else{
	scanf("%d %d",&a,&b);
	if(graph[a][b]<INF)printf("%d\n",graph[a][b]);
	else printf("-1\n");
      }
    }
  }
  return 0;
}

Measured memory_bytes: 0
N = int(input())
a,b,c = [0]*N,[0]*N,[0]*N
for i in range(N):
    a[i],b[i],c[i] = map(int,input().split(" "))

dp = [ [0,0,0] for _ in range(N) ]
dp[0][0] = a[0]
dp[0][1] = b[0]
dp[0][2] = c[0]

for i in range(1,N):
    dp[i][0] = max(dp[i-1][1],dp[i-1][2])+a[i]
    dp[i][1] = max(dp[i-1][0],dp[i-1][2])+b[i]
    dp[i][2] = max(dp[i-1][0],dp[i-1][1])+c[i]

print(max(dp[-1]))
        



Measured memory_bytes: 64216
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int a=sc.nextInt();
		int b=sc.nextInt();

		System.out.print(a/b+" "+a%b+" ");
		System.out.printf("%.5f", (double)a/b);
		System.out.println();

	}

}



Measured memory_bytes: 26616
#include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <deque>
#include <queue>

using namespace std;
typedef long long ll;

int main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    
    for(int i = 0; i < s.size(); i++){
        if('Z'-s[i] < N){
            cout << (char)('A'+(N-'Z'+s[i]-1));
        } else cout << (char)(s[i]+N);
    }
    cout << endl;
}



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

int main() {
  ll n, m;
  cin >> n >> m;
  string s, t;
  cin >> s >> t;

  ll l = lcm(n, m);
  bool ok = true;
  rep(i, 0, min(n, m) + 1) ok &= s[(l / m * i) % n] == t[(l / n * i) % m];
  cout << (ok ? l : -1) << '\n';
  return 0;
}

Measured memory_bytes: 3664
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>
#include <string>

using namespace std;

int main() {
    int n, m;
    cin >> n >> m;
    vector< vector<int> > jobs(m+1);
    priority_queue<int> que;
    
    for (int i=0; i<n; i++) {
        int a, b;
        cin >> a >> b;
        if (a > m) continue;
        jobs[a].push_back(b);
    }

    int ans = 0;
    for (int i=1; i<=m; i++) {
        for (auto j : jobs[i]) {
            que.push(j);
        }
        if (!que.empty()) {
            ans += que.top();
            que.pop();
        }
    }

    cout << ans << endl;
}


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

#define INF 1e9

int dp[1010][5000];

int make_bitmask(const vector<int>& c) {
	int mask = 0;
	for (int i = 0; i < (int)c.size(); ++i) {
		mask |= (1 << c[i]);
	}
	return mask;
}

int main(int argc, char const *argv[])
{
	int n, m; cin >> n >> m;
	vector<int> a(m), b(m);
	vector<vector<int>> c(m);
	rep(i, m) {
		cin >> a[i] >> b[i];
		rep(j, b[i]) {
			int d; cin >> d;
			d--;
			c[i].emplace_back(d);
		}
	}
	rep(i, 1010) rep(j, 5000) dp[i][j] = INF;
	// rep(i, 1010) dp[i][0] = 0;
	dp[0][0] = 0;
	rep(i, m) {
		int mask = make_bitmask(c[i]);
		rep(j, 5000) {
			if (dp[i][j] == INF)
				continue;
			// printf("i %d j %d mask %d\n", i, j, mask);
			if (j == (j | mask)) {
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			} else {
				// select
				dp[i + 1][j | mask] = min(dp[i + 1][j | mask], dp[i][j] + a[i]);
				// not select
				dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			}
		}
	}
	printf("%d\n", dp[m][(1 << n) - 1] != INF ?
				   dp[m][(1 << n) - 1] : -1);
	return 0;
}


Measured memory_bytes: 20096
import sys

def conv(s):
    patterns = [["A", "1"], ["C", "2"], ["G", "3"], ["T", "4"]]
    for i, j in patterns:
        s = s.replace(i, j)
    return int(s)

MAX_PAT = pow(4,12)

def h1(val):
    return val % MAX_PAT
    
def h2(val):
    return 1 + val % (MAX_PAT-1)

def h(val, i):
    return (h1(val) + i*h2(val)) % MAX_PAT

def insert(val, arr):
    i = 0
    while True:
        idx = h(val, i)
        if arr[idx] == "NIL":
            arr[idx] = val
            return idx
        else:
            i += 1

def find(val, arr):
    i = 0
    while True:
        idx = h(val, i)
        if arr[idx] == val:
            return True
        elif (arr[idx]=="NIL")|(i>=MAX_PAT):
            return False
        else:
            i += 1
    return

dictionary = ["NIL" for i in range(MAX_PAT)]
n = int(input())
for i in range(n):
    cmd, val = sys.stdin.readline().split()
#    cmd, val = input().split()
    val = conv(val)
    if cmd == "insert":
        if not find(val, dictionary):
            insert(val, dictionary)
    if cmd == "find":
        if find(val, dictionary):
            print("yes")
        else:
            print("no")



Measured memory_bytes: 147696
//by yjz
#include<bits/stdc++.h>
using namespace std;
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
#define bged(v) (v).begin(),(v).end()
typedef long long ll;
const int Imx=2147483647;
const int mod=1000000007;
const ll Lbig=2e18;
//My own input/output stream
#define geti(x) x=getnum()
#define getii(x,y) geti(x),geti(y)
#define getiii(x,y,z) getii(x,y),geti(z)
#define puti(x) putnum(x),putsp()
#define putii(x,y) puti(x),putnum(y),putsp()
#define putiii(x,y,z) putii(x,y),putnum(z),putsp()
#define putsi(x) putnum(x),putendl()
#define putsii(x,y) puti(x),putnum(y),putendl()
#define putsiii(x,y,z) putii(x,y),putnum(z),putendl()
inline ll getnum()
{
	register ll r=0;register bool ng=0;register char c;c=getchar();
	while(c!='-'&&(c<'0'||c>'9'))c=getchar();
	if(c=='-')ng=1,c=getchar();
	while(c>='0'&&c<='9')r=r*10+c-'0',c=getchar();
	if(ng)r=-r;return r;
}
template <class T> inline void putnum(T x)
{
	if(x<0)putchar('-'),x=-x;
	register short a[20]={},sz=0;
	while(x>0)a[sz++]=x%10,x/=10;
	if(sz==0)putchar('0');
	for(int i=sz-1;i>=0;i--)putchar('0'+a[i]);
}
inline void putsp(){putchar(' ');}
inline void putendl(){putchar('\n');}
inline char mygetchar(){register char c=getchar();while(c==' '||c=='\n')c=getchar();return c;}
ll n,a,b,c,d;
int main()
{
	cin>>n>>a>>b>>c>>d;
	n--;
	for(int i=-n;i<=n;i++)
	{
		vector<ll> v;
		v.PB(a+(i*c)-(n-i)*c);
		v.PB(a+(i*c)-(n-i)*d);
		v.PB(a+(i*d)-(n-i)*c);
		v.PB(a+(i*d)-(n-i)*d);
		sort(v.begin(),v.end());
		if(v[0]<=b&&b<=v[3])
		{
			puts("YES");
			return 0;
		}
	}
	puts("NO");
	return 0;
}

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

int main()
{
    string s; cin >> s;
    int max_len = 0;
    int len = 0;
    char temp;

    for (int i = 0; i < (int)(s.length()); i++) {
        temp = (char)s[i];
        len += 1;

        if (!(temp == 'A' || temp == 'C' || temp == 'G' || temp == 'T')) len = 0;

        if (max_len < len) max_len = len;
    }

    cout << max_len << endl;
    return 0;
}


Measured memory_bytes: 256
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int n , k ;
    cin >> n >> k ;
    vector<int> a(n , 0);
    rep(i , n) cin >> a[i];
    rep(i , k){
        vector<int> tmp(n , 0);
        rep(i , n){
            tmp[max(0ll , i - a[i])]++; 
            if(i + a[i] + 1 < n ) tmp[i + a[i] + 1]--;
        }
        rep(i , n) if(i) tmp[i] += tmp[i-1];
        bool f = true ;
        rep(i , n) f &= (tmp[i] == a[i]);
        if(f){
            rep(i , n) cout << tmp[i] << ' ' ;
            return;
        }
        tmp.swap(a);
    }
    rep(i , n) cout << a[i] << ' ' ;
            
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


Measured memory_bytes: 6368
//
//  main.cpp
//  E
//
//  Created by 曾憲揚 on 2020/9/11.
//  Copyright © 2020 曾憲揚. All rights reserved.
//

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

typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define fr first
#define sc second

const int N=12+1;
const int M=1e3+5;
int cost[M];
int kes[M];

const int INF = 1e9;
int dp[5000];

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    
    int n, m; cin>>n>>m;
    for(int i=0; i<m; i++){
        int b;
        cin>>cost[i]>>b;
        for(int j=0; j<b; j++){
            int c; cin>>c;
            kes[i]^=(1<<(c-1));
        }
    }
    
    for(int i=0; i<5000; i++)
        dp[i]=INF;
    
    dp[0]=0;
    for(int i=0; i<(1<<n); i++){
        for(int j=0; j<m; j++){
            int to=i|kes[j];
            dp[to]=min(dp[to], dp[i]+cost[j]);
        }
    }
    
    if(dp[(1<<n)-1]!=INF){
        cout<<dp[(1<<n)-1]<<endl;
    }
    else cout<<"-1\n";
    
    return 0;
}



Measured memory_bytes: 3676
#define _USE_MATH_DEFINES
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>

using namespace std;

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

int main(){
	ll p,q;
	while(~scanf("%lld %lld",&p,&q)){
		string ans="";
		map<ll,int> remain;
		int idx=-1;

		remain[p%q] = 0;
		p*=10;
		for(int i=1;i<100;i++){
			if(p%q==0){
				ans+=(char)(p/q+'0');
				break;
			}
			else{
				ans+=(char)(p/q+'0');
				if(remain.find(p%q) != remain.end()){		
					idx = remain[p%q];
					break;
				}
				
				remain[p%q]=i;			

				p=(p%q)*10;
			}
		}

		cout << ans << endl;
		if(idx==-1) continue;
		for(int i=0;i<ans.size();i++){
			printf("%s%s", i>=idx ? "^" : " ", i==ans.size()-1 ? "\n" : "");
		}
	}
}

Measured memory_bytes: 0
# input
N = int(input())
V = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]

# process
profits = []
for x in range(N):
    if V[x] > C[x]:
        profits.append(V[x] - C[x])
totalProfits = sum(profits)

# output
print(totalProfits)

Measured memory_bytes: 3064
use proconio::{input, marker::Chars};
use std::collections::VecDeque;
fn main() {
    input! {
        h: usize,
        w: usize,
        ch: usize,
        cw: usize,
        dh: usize,
        dw: usize,
        s: [Chars; h],
    }
    let mut costs = vec![vec![std::usize::MAX; w]; h];
    let mut queue = VecDeque::new();
    queue.push_front(((ch - 1, cw - 1), 0));
    costs[ch - 1][cw - 1] = 0;
    loop {
        if let Some(((hs, ws), cost)) = queue.pop_front() {
            if hs == dh - 1 && ws == dw - 1 {
                println!("{}", cost);
                break;
            }
            // left
            if ws > 0 && s[hs][ws - 1] == '.' && costs[hs][ws - 1] > cost {
                queue.push_front(((hs, ws - 1), cost));
                costs[hs][ws - 1] = cost;
            }
            // up
            if hs > 0 && s[hs - 1][ws] == '.' && costs[hs - 1][ws] > cost {
                queue.push_front(((hs - 1, ws), cost));
                costs[hs - 1][ws] = cost;
            }
            // right
            if ws < w - 1 && s[hs][ws + 1] == '.' && costs[hs][ws + 1] > cost {
                queue.push_front(((hs, ws + 1), cost));
                costs[hs][ws + 1] = cost;
            }
            // down
            if hs < h - 1 && s[hs + 1][ws] == '.' && costs[hs + 1][ws] > cost {
                queue.push_front(((hs + 1, ws), cost));
                costs[hs + 1][ws] = cost;
            }

            for i in 0..5 {
                for j in 0..5 {
                    if hs + i < 2
                        || ws + j < 2
                        || hs + i >= h + 2
                        || ws + j >= w + 2
                        || s[hs + i - 2][ws + j - 2] == '#'
                    {
                        continue;
                    }
                    if costs[hs + i - 2][ws + j - 2] > cost + 1 {
                        queue.push_back(((hs + i - 2, ws + j - 2), cost + 1));
                        costs[hs + i - 2][ws + j - 2] = cost + 1;
                    }
                }
            }
        } else {
            println!("-1");
            break;
        }
    }
}


Measured memory_bytes: 15276
#include<iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
#define EPS (1e-15)
#define equals(a,b) (fabs((a)-(b))<EPS)
#define COUNTER_CLOCKWISE 1
#define CLOCKWISE -1
#define ONLINE_BACK 2
#define ONLINE_FRONT -2
#define ON_SEGMENT 0


struct Segment;
class Point;
typedef Point Vector;
typedef Segment Line;

class Point {
public:
	double x, y;
	Point() {}
	Point(double xx, double yy) {
		x = xx;
		y = yy;
	}
	Point operator + (Point& p) { return Point(x + p.x, y + p.y); }
	Point operator - (Point& p) { return Point(x - p.x, y - p.y); }
	Point operator * (double k) { return Point(x * k, y * k); }
	Point operator / (double k) { return Point(x / k, y / k); }

	double norm() { return x * x + y * y; }
	double abs() { return sqrt(norm()); }
	double dot(Point p) { return x * p.x + y * p.y; }
	double cross(Point& p) { return x * p.y - y * p.x; }
	double distance(Point& p) { return (*this - p).abs(); }

	bool operator == (const Point& p) const {
		return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
	}

	void input() {
		cin >> x >> y;
	}
};

class Segment {
public:
	Point p1, p2;
	void input() {
		p1.input();
		p2.input();
	}
};

double distance(Point p, Line s) {
	Vector a = s.p2 - s.p1;
	Vector b = p - s.p1;
	return a.cross(b) / a.abs();
}

double distanceS(Point p, Segment s) {
	Vector p1p = p - s.p1;
	Vector p2p = p - s.p2;
	Vector p1p2 = s.p2 - s.p1;
	Vector p2p1 = s.p1 - s.p2;
	if (p1p.dot(p1p2) < 0) {
		return p1p.abs();
	}
	else if (p2p.dot(p2p1) < 0) {
		return p2p.abs();
	}
	else {
		return distance(p, s);
	}
}

Point project(Point p, Segment s) {
	Vector hepo = p - s.p1;
	Vector base = s.p2 - s.p1;
	Vector t = base * (hepo.dot(base) / base.norm());
	return s.p1 + t;
}

int ccw(Point p0, Point p1, Point p) {
	Vector p0p1 = p1 - p0;
	Vector p0p;
	p0p = p - p0;
	if (p0p1.cross(p0p) > EPS) {
		return COUNTER_CLOCKWISE;
	}
	else if (p0p1.cross(p0p) < -EPS) {
		return CLOCKWISE;
	}
	else if (p0p1.dot(p0p) < -EPS) {
		return ONLINE_BACK;
	}
	else if (p0p1.norm() < p0p.norm()) {
		return ONLINE_FRONT;
	}
	else {
		return ON_SEGMENT;
	}
}

bool intersection(Segment s1,Segment s2) {
	Point p0 = s1.p1;
	Point p1 = s1.p2;
	Point p2 = s2.p1;
	Point p3 = s2.p2;
	return ccw(p0, p1, p2) * ccw(p0, p1, p3) <= 0 &&
		ccw(p2, p3, p0) * ccw(p2, p3, p1) <= 0;
}


int main() {
	Segment s1,s2;
	int q;
	cin >> q;
	while (q--) {
		s1.input();
		s2.input();
		if (intersection(s1,s2)) {
			cout << 1 << endl;
		}
		else {
			cout << 0 << endl;
		}
	}
}


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

namespace abc065_a
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = Console.ReadLine().Split().Select(int.Parse).ToArray();
            if (x[1] >= x[2]) Console.WriteLine("delicious");
            else Console.WriteLine(x[2] - x[1] > x[0] ? "dangerous" : "safe");
        }
    }
}

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

#define MAX 5005

int dp[MAX][MAX], lim, n;
string s;

int solve(int l1, int l2) {
    if (l1 > lim) return 0;
    if (l2 >= n) return 0;

    if (dp[l1][l2] != -1) return dp[l1][l2];

    if (s[l1] != s[l2]) {
        dp[l1][l2] = 0;
        return 0;
    }

    int ret = 0;
    ret = 1 + solve(l1 + 1, l2 + 1);
    return dp[l1][l2] = ret;
}


int main() {
    memset(dp, -1, sizeof(dp));

    cin >> n;
    cin >> s; 

    int ans = 0;

    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            lim = j - 1;
            ans = max(ans, solve(i, j));
        }
    }

    cout << ans;
    return 0;
}


Measured memory_bytes: 98176
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
#define ALL(obj) (obj).begin(), (obj).end()
long long INF = (long long)1E17;
#define i_7 (long long)(1E9+7)
//#define i_7 998'244'353
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

//typedef long long ll;
long long po(long a, long b){
    if(b==0){
        return 1;
    }
    
    long long z = po(a,b/2);
    z = mod(z*z);
    if(b%2!=0){
        z = mod(a*z);
    }
    return z;
}

//配列のSIZEは問題ごとに定義する必要がある。
const int SIZE = 1000;
long long inv[SIZE+1];//各iの逆元を格納する配列。
long long kai[SIZE+1];//i!のmodを格納する配列。
long long invkai[SIZE+1];//各i!の逆元を格納する配列。
const int MOD=i_7;
void invinit(){//上の配列を初期化する関数。
    inv[1]=1;
    for(int i=2;i<=SIZE;i++){
        inv[i] = MOD - ((MOD/i)*inv[MOD%i])%MOD;
    }
    
    kai[0]=invkai[0]=1;
    for(int i=1;i<=SIZE;i++){
        kai[i]=(kai[i-1]*i)%MOD;
        invkai[i]=(invkai[i-1]*inv[i])%MOD;
    }
}

long long comb(long long a, long long b){
    if(b<0 || a<b){
        return 0;
    }
    return mod(kai[a]*mod(invkai[b]*invkai[a-b]));
}

int main(){
  invinit();
  using namespace std;
  int n;
  cin>>n;
  long long a[n];
  REP(i, n) cin>>a[i];
  
  long long s = 0;
  REP(i, n) s += a[i];
  s = mod(s);
  long long ans = mod(s * s);
  REP(i, n){
    ans -= mod(a[i] * a[i]);
    ans = mod(ans);
  }
  ans *= inv[2];
  ans = mod(ans);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 5204
#include<bits/stdc++.h>
using namespace std;
int n;
long long a[100005];
int main()
{
    cin>>n;
    a[0]=2;
    a[1]=1;
    for(int i=2;i<n+1;i++)
    {
        a[i]=a[i-1]+a[i-2];
    }
    cout<<a[n];
    
    
    return 0;
}

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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define show(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define show(x)
#endif

typedef long long int ll;
typedef pair<int,int> pii;
template<typename T> using vec=std::vector<T>;

const int inf=1<<30;
const long long int infll=1LL<<62;
const double eps=1e-9;
const int dx[]={1,0,-1,0},dy[]={0,1,0,-1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

class union_find{
	private:
	vector<int> parent,rank;
	int size;
	public:
    int cnt;

    union_find()=default;
    union_find(int n){ init(n); }

    void init(int n){
		size=n;
		cnt=n;
		parent.resize(size);
		rank.resize(size);
		for(int i=0; i<size; ++i){
			parent[i]=i;
			rank[i]=0;
		}
	}

	int find(int x){
		if(parent[x]==x) return x;
		else return parent[x]=find(parent[x]);
	}

	void unite(int x,int y){
		x=find(x);
		y=find(y);
		if(x==y) return;
		if(rank[x]<rank[y]){
			parent[x]=y;
		} else {
			parent[y]=x;
			if(rank[x]==rank[y]) ++rank[x];
		}
		--cnt;
	}

	bool is_same(int x,int y){
		return find(x)==find(y);
	}
};

void solve(){
    int n;
    cin >> n;
    union_find uf(n);
    int  q;
    cin >> q;
    rep(i,0,q){
        int com,x,y;
        cin >> com >> x >> y;
        if(com==0) uf.unite(x,y);
        if(com==1){
            if(uf.is_same(x,y)) cout << 1 << endl;
            else cout << 0 << endl;
        }
    }
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}

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

constexpr int inf = 0x3f3f3f3f;
constexpr ll linf = 0x3f3f3f3f3f3f3f3fLL;

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

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

    int h, w; cin >> h >> w;
    vector<string> a(h);
    for (int i = 0; i < h; i++) cin >> a[i];

    queue<tuple<int, int, int>> q;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (a[i][j] == '#') q.emplace(i, j, 0);
        }
    }
    int ans = 0;
    while (!q.empty()) {
        int y, x, d;
        tie(y, x, d) = q.front(); q.pop();

        ans = d;

        for (int dir = 0; dir < 4; dir++) {
            int ny = y + dy[dir], nx = x + dx[dir];
            if (ny < 0 || ny >= h) continue;
            if (nx < 0 || nx >= w) continue;
            if (a[ny][nx] == '#') continue;
            a[ny][nx] = '#';
            q.emplace(ny, nx, d + 1);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 13456
#include <stdio.h>

int main(){
  int max, ans, a, b, tmp;
  scanf("%d %d %d", &a, &b, &max);
  if(max < a){
    tmp = max;
    max = a;
    a = tmp;
  }
  if(max < b){
    tmp = max;
    max = b;
    b = tmp;
  }
  ans = max*10+a+b;
  printf("%d\n", ans);
  return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void){
  int array[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};
  int K;

  scanf("%d",&K);
  printf("%d",array[K-1]);

  return 0;
}

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

int main()
{
    int A,B,C,D ;
    cin >>A >> B >> C >>D ;
    int winner = 0 ;
    while(1)
    {
        C -= B ;
        if(C<=0)
        {
            winner = 1 ;
            break ;
        }

        A-= D ;
        if(A<=0)
        {
            winner = 2 ;
            break ;
        }

    }
    if(winner==1)
    {
        cout << "Yes" << endl ;
    }
    else
    {
        cout << "No" << endl ;
    }
    
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1000010;
const int inf=0x3f3f3f3f;
ll n;
ll dp[maxn];
ll a[maxn];
ll k;
int main()
{
    cin>>n>>k;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
    }
    dp[1]=0;
    dp[0]=0;
    for(int i=2;i<=n;i++)
    {
        dp[i]=inf;
    }
    for(int i=2;i<=n;i++)
    {
        for(int j=i-1;j>=max(1ll,i-k);j--)
        {
            dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
        }
    }
    cout<<dp[n];
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
 
using namespace std;
 
 
int main(){
  int a,b,c;
  cin >> a >> b >> c;
 
  if(((a<c)&&(c<b))||((b<c)&&(c<a))){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#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 FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(),(x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size()) //sizeをsize_tからllに直しておく
#define MAX(x) *max_element(ALL(x)) //最大値を求める
#define MIN(x) *min_element(ALL(x)) //最小値を求める
#define D()
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define F first //pairの一つ目の要素
#define S second //pairの二つ目の要素

void printVector(const std::vector<double>& vec) {
    for (double value : vec) {
		std::cout << value << " ";
    }
	std::cout << std::endl;
}

int main(){
	ll a,b,c,k;
	ll ans;
	std::cin >> a >> b >> c >> k;
	if(a>=k) ans = k;
	else if (a+b>=k) ans=a;
	else ans = a-(k-(a+b));
	std::cout << ans << std::endl;
	return 0;
}


Measured memory_bytes: 3636
n = int(input())
for i in range(3, n + 1):
    if i % 3 == 0 or i % 10 == 3:
        print('', i, end='')
    else:
        j = i
        while True:
            j = j // 10
            if j == 0:
                break
            if j % 10 == 3:
                print('', i, end='')
                break
print()


Measured memory_bytes: 6168
// clang-format off
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using G = vector<vector<ll>>;
#define G(i, j) i, vector<ll>(j)
#define Gv(i, j, k) i, vector<ll>(j, k)
#define rep(i,n) for(ll i=0, i##_len=(n); i<i##_len; ++i)
#define rep1(i,n) for(ll i=1, i##_len=(n); i<=i##_len; ++i)
#define rrep(i,n) for(ll i=n-1; i>=0; --i)
#define rrep1(i,n) for(ll i=n; i>0; --i)
#define all(x) (x).begin(),(x).end()
#define SORT(x) sort(all(x))
#define SORT_DESC(x) sort((x).rbegin(),(x).rend())
#define pb push_back
#define mp make_pair
#define coutl cout<<fixed<<setprecision(10)
#define ANS(ans) cout<<ans<<endl
#define END(ans) ANS(ans); return
const ll LINF = (1LL << 62) - 1;
const int INF = (1 << 30) - 1;
template<class T>inline bool chmax(T &a, const T &b){if (a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T &a, const T &b){if (b<a){a=b;return 1;}return 0;}
const string YES = "YES";
const string NO = "NO";
// clang-format on

void solve(long long A, long long V, long long B, long long W, long long T) {
  if (A == B) {
    END(YES);
  }
  if (W >= V) {
    END(NO);
  }
  ll t = ceil(abs((long double)(B - A) / (W - V)));
  ANS((t <= T ? YES : NO));
}

// clang-format off
int main() {
  long long A;
  scanf("%lld",&A);
  long long V;
  scanf("%lld",&V);
  long long B;
  scanf("%lld",&B);
  long long W;
  scanf("%lld",&W);
  long long T;
  scanf("%lld",&T);
  solve(A, V, B, W, T);
  return 0;
}


Measured memory_bytes: 3776
use proconio::{input, fastout};

#[fastout]
fn main() {
    input!{
        n: String
    }

    let end = n.chars().nth(n.len() - 1).unwrap();
    let result = match end {
        '2'|'4'|'5'|'7'|'9'  => "hon".to_string(),
        '0'|'1'|'6'|'8' => "pon".to_string(),
        '3' => "bon".to_string(),
        _ => "".to_string(),
    };
    println!("{}", result);
}


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

using namespace std;

const int N = 2e3 + 3, OO = 0x3f3f3f3f;

int n, x, y;

vector<int> adj[N];

int dis[N], freq[N];

void BFS(int src)
{
	memset(dis, OO, sizeof dis);
	dis[src] = 0;
	queue<int> q;
	q.push(src);
	while(!q.empty())
	{
		int u = q.front();
		q.pop();
		for(int i : adj[u])
		{
			if(dis[i] == OO)
			{
				dis[i] = dis[u] + 1;
				q.push(i);
			}
		}
	}
}
int main()
{
	scanf("%d %d %d", &n, &x, &y);
	adj[x].push_back(y);
	adj[y].push_back(x);
	for(int i = 1 ; i < n; ++i)
	{
		adj[i].push_back(i + 1);
		adj[i + 1].push_back(i);
	}
	for(int i = 1 ; i < n; ++i)
	{
		BFS(i);
		for(int j = i ; j <= n; ++j)
		{
			freq[dis[j]]++;
		}
	}
	for(int i = 1 ; i < n; ++i)
		printf("%d\n", freq[i]);
	return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

using namespace std;

#define all(x) (x).begin(), (x).end()

#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#define idbg(x) #x " = " << x
#include "pretty_print.h"
#else
#define dbg(x)
#define idbg(x) ""
#endif

#ifdef _WIN32
#  define LLD "%I64d"
#else
#  define LLD "%lld"
#endif

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

template <typename T> T sqr(T x) { return x * x; }
template <typename T> T abs(T x) { return x < 0? -x : x; }
template <typename T> T gcd(T a, T b) { return b? gcd(b, a % b) : a; }
template <typename T> bool chmin(T &x, const T& y) { if (x > y) { x = y; return true; } return false; }
template <typename T> bool chmax(T &x, const T& y) { if (x < y) { x = y; return true; } return false; }


int main(int /* argc */, char** /* argv */)
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    #ifdef LOCAL
    assert(freopen("inp", "r", stdin));
    assert(freopen("out", "w", stdout));
    #endif

    int a, b;
    while (cin >> a >> b) {
        int n = 1;
        for (;; n += 1) {
            int x = n * 8 / 100;
            int y = n * 10 / 100;
            if (x == a && y == b) {
                break;
            }
            if (x > a || y > b) {
                n = -1;
                break;
            }
        }
        cout << n << endl;
    }

    cerr << "Time execute: " << clock() / (double)CLOCKS_PER_SEC << " sec" << endl;
    return 0;
}


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

using namespace std;

int main() {

   string s;
   int pos[26] = {
       0, 0, 0, 0, 0, 0,
       0, 1, 1, 1, 1, 1,
       1, 1, 1, 1, 0, 0,
       0, 0, 1, 0, 0, 0,
       1, 0
    };

   while(cin >> s, s != "#") {

        int cnt = 0;
        int lr = pos[s[0] - 'a'];

        for(int i = 1; i < s.size(); ++i) {

            if(pos[s[i] - 'a'] != lr) {
               ++cnt;
            }
            lr = pos[s[i] - 'a'];

        }

        cout << cnt << endl;

   }

}

Measured memory_bytes: 1184
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <stdio.h>
using namespace std;
#define int long long
int MOD = 1000000007;
signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N;
	cin >> N;
	vector<pair<int, int> > A(N);
	for (int i = 0; i < N; i++) {
		cin >> A[i].second >> A[i].first;
	}
	sort(A.begin(), A.end());

	string res = "Yes";
	int cur = 0;
	for (int i = 0; i < N; i++) {
		cur += A[i].second;
		if (cur > A[i].first) {
			res = "No";
		}
	}

	cout << res << endl;
}

Measured memory_bytes: 3456
import java.util.Scanner;

public class Main {
    public static void debug(String str){
        boolean debug = false;
        if(debug != true){
            return;
        }
        System.out.println(str);
    }
    public static void main(String[] args) {

        int X;
        int A;

        try (Scanner sc = new Scanner(System.in)) {
            X = sc.nextInt();
            A = sc.nextInt();
        }

        if(X < A){
            System.out.println(0);
        }else{
            System.out.println(10);
        }


    }


}


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

class Program
{
    static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var str = Console.ReadLine().Split();
        var T = int.Parse(str[0]);
        var A = int.Parse(str[1]);
        var H = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
        var H2 = new double[N];
        for (int i=0; i<N; i++)
        {
            H2[i] = Math.Abs(A - (T - H[i]*0.006));
        }
        
        Console.WriteLine( Array.IndexOf(H2, H2.Min()) +1 );
    }
}


Measured memory_bytes: 13452
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		String S = sc.next();
		int length = S.length();
		int[] ans = new int[length];
		int count = 1;
		int lastL = 0;
		boolean rtrue = true;
		for (int i = 1; i < length; i++) {
			if (S.charAt(i) == 'R') {
				count++;
				rtrue = true;
			} else {
				if (rtrue) {
					ans[i-1] += (count + 1) / 2;
					ans[i] += count / 2 + 1;
					lastL = i;
					count = 0;
				} else {
					if((i - lastL) % 2 == 1) {
						ans[lastL-1]++;
					} else {
						ans[lastL]++;
					}
				}
				rtrue = false;
			}
		}
		for (int i = 0; i < length; i++) {
			System.out.print(ans[i] + " ");
		}
	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() {
        if (hasNextByte())
            return buffer[ptr++];
        else
            return -1;
    }

    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }

    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr]))
            ptr++;
        return hasNextByte();
    }

    public String next() {
        if (!hasNext())
            throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext())
            throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
            throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


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

int main(){
  string S;
  cin >> S;
  bool flag = true;
  for(int i = 0; i < S.size(); ++i){
    if(i % 2 == 0){
      if(S[i] == 'L') flag = false;
    }else{
      if(S[i] == 'R') flag = false;
    }
  }
  if(flag){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
#include<cstdlib>
#include<ctime>
#include<vector>
#include<map>
using namespace std;

int main(){
//srandom((unsigned long)time(NULL));

int n;
string s;
cin>>n>>s;
int mx=0;
int x=0;

for(int i=0;i<n;i++){
    switch(s[i]){
        case 'I':x+=1;
                mx=max(mx,x);
                break;
        case 'D':x-=1;
                break;
        default:return 0;
    }
}

cout<<mx<<endl;

return 0;
}

Measured memory_bytes: 256