akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc=new Scanner(System.in);

	int INF=1<<28;
	double EPS=1e-9;

	void run(){
		int[][] d={
		//
				{0, 6, 13, 18, 23, 43, 58}, //
				{6, 0, 7, 12, 17, 37, 52}, //
				{13, 7, 0, 5, 10, 30, 45}, //
				{18, 12, 5, 0, 5, 25, 40}, //
				{23, 17, 10, 5, 0, 20, 35}, //
				{43, 37, 30, 25, 20, 0, 15}, //
				{58, 52, 45, 40, 35, 15, 0}, //
		};
		int[][] c={
				{0, 300, 500, 600, 700, 1350, 1650},
				{300, 0, 350, 450, 600, 1150, 1500},
				{500, 350, 0, 250, 400, 1000, 1350},
				{600, 450, 250, 0, 250, 850, 1300},
				{700, 600, 400, 250, 0, 600, 1150},
				{1350, 1150, 1000, 850, 600, 0, 500},
				{1650, 1500, 1350, 1300, 1150, 500, 0},};

		for(;;){
			int ic1=sc.nextInt()-1;
			if(ic1==-1){
				break;
			}
			int h1=sc.nextInt();
			int m1=sc.nextInt()+h1*60;
			int ic2=sc.nextInt()-1;
			int h2=sc.nextInt();
			int m2=sc.nextInt()+h2*60;

			int s=17*60+30;
			int g=19*60+30;
			int ans=c[ic1][ic2];
			if((s<=m1&&m1<=g)||(s<=m2&&m2<=g)){
				if(d[ic1][ic2]<=40){
					// ツ板シツ額
					ans=(int)(Math.ceil(ans/2./50.)*50+EPS);
				}
			}
			println(""+ans);
		}
	}

	void debug(Object... os){
		System.err.println(Arrays.deepToString(os));
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

	public static void main(String[] args){
		// System.setOut(new PrintStream(new BufferedOutputStream(System.out)));
		new Main().run();
	}
}

Measured memory_bytes: 12000
#include<iostream>
#include<algorithm>
#include<math.h>
#include<cstdio>
#include<ctype.h>
#include<stdio.h>
#include<set>
#include<vector>
#include<map>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<numeric>
#include<string>
typedef long long ll;
using namespace std;

int main(){
  ll N,K;
  cin>>N;
  cin>>K;
  ll x=1;
  ll cnt=1;
  while(cnt<=N){
    x=min(x+K,2*x);
    ++cnt;
  }
  cout<<x<<endl;
  
}

Measured memory_bytes: 256
#include <stdio.h>
int main(void)
{
  int w, a, b, dif;

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

  if(a <= b)
    dif = b - (a + w);
  else 
    dif = a - (b + w);

  if(dif <= 0)
    dif = 0;

  printf("%d\n", dif);

  return 0;
}


Measured memory_bytes: 128
/*                                  /   \                                                                   (Hello)//JSM//*/      
/*                                 /*****\                                                                              */
/*     Jai Shree Mataji           /       \ |\| |_| $ |-| K                                                            */
#include<vector>
#include<iostream>
#include<algorithm>                
#include<string.h>                 
#include<bits/stdc++.h>            
#include<cstring>                  
#include<map>                     
#include<cmath>                  
#include<set>
using namespace std;            
#define ll long long int        
#define ld long double
#define MOD 1000000007 
#define PI 3.1415926535897932384626433832795                                               
#define YY cout<<"YES"
#define NN cout<<"NO"
#define EE cout<<"\n"
#define ee cout<<"\n"
#define ne cout<<"-1"
#define pb push_back 
#define fi first
#define se second
#define mkp make_pair    
#define mkt make_tuple
#define sall(v ) sort(v.begin(), v.end())      
#define all(v )  v.begin(), v.end()      
#define rall(v )  reverse(v.begin(), v.end())      
#define fo(i , n) for(ll i = 0 ; i < n ; i++)
#define vl vector<ll>
#define vll vector< pair<ll,ll> > 
#define mpl map<ll, ll>
#define pr pair<ll,ll>
#define tpl tuple<ll,ll,ll>
bool sortbysec(const pair<int,int> &a,const pair<int,int> &b) {return (a.second < b.second); }
ll soltn(ll x, ll n) {if(x>=0) return x%n;    else return n+x%n;}
ll pd(ll x,ll y){if(x%y==0) return x/y;else return x/y+1;}
ll coda(ll n,ll d){ll count=0;while(n!=0){if(n%10==d)count++;n/=10;}return count;}
ll pow1(ll n,ll p){if(p==0)return 1;ll x=pow1(n, p/2);x=(x*x)%MOD;if(p%2==0) return x;else return (x*n)%MOD;}
/*vl v[300009];
ll vis[300009];
ll d;
ll ma;
ll ext;
ll up=0;
mpl M;
void dfs(ll node,ll distance)
{
	if(vis[node]==1)
	return;
	if(ma<=distance)
	{
		ma=distance;
		ext=node;
	}
	if(up==1)
	{
		if(distance==ma)
		M[node]=1;
	}
	vis[node]=1;
	for(ll i=0;i<v[node].size();i++)
	{
		ll child=v[node][i];
		dfs(child,distance+1);
	}
}*/
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);	
	  ll t=1;
      
      
//	   cin>>t;
	      while(t--)
{
//jai shree mataji
/*
5
2 1 5 4 3*/
ll n,m,i;
cin>>n;
ll a[n];
fo(i,n)
cin>>a[i];
ll ans=0,c=0;
fo(i,n-1)
{
	if(a[i]<=a[i+1])
	continue;
	else
	{
		ans+=a[i]-a[i+1];
		a[i+1]=a[i];
	}
}
cout<<ans;
ee;
}
return 0;
}














Measured memory_bytes: 5180
import java.util.*;
class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    long n = sc.nextLong(),k = sc.nextLong();
    n = n%k;
    if(n<(double)k/2){
      pl(n+"");
    }else{
      pl((k-n)+"");
    }
  }

  public static void pr(String str){
    System.out.print(str);
  }
  public static void pl(String str){
    System.out.println(str);
  }
}


Measured memory_bytes: 21844
# -*- coding: utf-8 -*-
"""
http://abc070.contest.atcoder.jp/tasks/abc070_b
"""


def solve(A, B, C, D):
    start = max(A, C)
    end = min(B, D)
    duration = end - start
    if duration < 0:
        return 0
    else:
        return duration


def main():
    A, B, C, D = [int(x) for x in input().strip().split(' ')]
    result = solve(A, B, C, D)
    print(result)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#define rep(i,n) for (int i = 0; i < n; i++)
#define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <math.h>
#include <complex>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> p;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;
const ll INF = 1e18;


int main() {
	int n; string s;
	cin >> n >> s;
	int r=0, b=0;
	rep(i, n) {
		if (s[i] == 'R') r++;
		else b++;
	}
	if (r > b) cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define Would
#define you
#define please


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


	int N, L, T;
	cin >> N >> L >> T;
	int X[100000], W[100000];
	vector<int> A[3];
	rep(i, N) {
		cin >> X[i] >> W[i];
		W[i]--;
		if (W[i] == 0) A[0].pb(X[i]);
		else A[1].pb(X[i]);
	}

	int k = W[0];
	int aite = A[k ^ 1].size();

	int kaisuu = 0;
	kaisuu += (T / L) * 2 * aite;
	T = T % L;
	rep(i, aite) {
		int tmp = A[k ^ 1][i];
		if (k == 0) {
			if (X[0] >= tmp) tmp += L;
			while (X[0] + T > tmp - T) {
				kaisuu++;
				tmp += L;
			}
		}
		else {
			if (X[0] <= tmp) tmp -= L;
			while (X[0] - T <= tmp + T) {
				kaisuu++;
				tmp -= L;
			}
		}
	}
	kaisuu %= N;
	
	vector<int> V;
	rep(i, N) {
		if (W[i] == 0) V.pb((X[i] + T) % L);
		else V.pb((X[i] - (T % L) + L) % L);
	}

	sort(V.begin(), V.end());

	if (k == 0) {
		int doko = (X[0] + T) % L;
		int itr = lower_bound(V.begin(), V.end(), doko) - V.begin();

		int kotae[100100];
		int kari = 0;
		for (int i : V) {
			kotae[(kari + N + kaisuu - itr) % N] = i;
			kari++;
		}
		rep(i, N) co(kotae[i]);
	}
	else {
		int doko = (X[0] - (T % L) + L) % L;
		int itr = lower_bound(V.begin(), V.end(), doko) - V.begin();

		int kotae[100100];
		int kari = 0;
		for (int i : V) {
			kotae[(kari + N + N - kaisuu - itr) % N] = i;
			kari++;
		}
		rep(i, N) co(kotae[i]);
	}

	Would you please return 0;
}

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

using namespace std;
int main(){
  long d,g;
   cin >> d >> g;
  
  vector<long> p(d),c(d);
  long res=0;
  for(long i=0;i<d;i++){
    cin >> p[i] >> c[i];
    res+=p[i];
  }

  for(long i=0;i<(1<<d);i++){
    long score=0;
    long num=0;
    long rest=-1;
   for(long j=0;j<d;j++){
     if((i>>j)&1) {
       score+=(p[j]*100*(j+1)+c[j]);
       num+=p[j];
     }
     else{
      rest=j;
     } 
     }
    if(g>score){
      long need=min((g-score-1)/(100*(rest+1))+1,p[rest]);
       score+=100*(rest+1)*need;
       num+=need;
     }
    if(score>=g) res=min(res,num);
  }
  
  
  
cout << res << endl;

}


Measured memory_bytes: 256
N,T=map(int,input().split())
ls=[list(map(int,input().split())) for _ in range(N)]
ans=10**18
for i in ls:
  if i[1] <= T:
    ans = min(ans,i[0])
if ans < 10**18:
  print(ans)
else:
  print('TLE')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
/**
******************* Author:Bisnu sarkar ****************************
**/
/*
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
*/
#define fRead(x)       freopen(x,"r",stdin)
#define fWrite(x)      freopen (x,"w",stdout)
#define ull            unsigned long long
#define ll             long long
#define pii            pair<int,int>
#define sit            set<int> :: iterator
#define vrit           vector<int> :: reverse iterator
#define ff             first
#define ss             second
#define endl           '\n';
#define sz(s)          (int)s.size()
#define all(s)         s.begin(),s.end()
#define IO             ios_base::sync_with_stdio(false),cin.tie(NULL);  
#define what_is(x)     cerr << #x << " is " << x << endl;
///*....Debugger....*///
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl;}
template<typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << ", ";
  err(++it, args...);
}
///*....Input....*///
template <typename T> inline void Int(T &n) {
  n = 0; int f = 1; register int ch = getchar();
  for (; !isdigit(ch); ch = getchar()) if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
 
template <typename T, typename TT> inline void Int(T &n, TT &m) { Int(n); Int(m); }
template <typename T, typename TT, typename TTT> inline void Int(T &n, TT &m, TTT &l) { Int(n, m); Int(l);}
double ind(){double x; scanf("%lf",&x);return x;}

///*....Bitmask....*///
int set_1(int n,int pos){return n = (n | (1<<pos));}
int reset_0(int n,int pos){return n= n & ~(1<<pos);}
bool check_bit(int n,int pos){return n = n & (1<<pos);}

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

///*....Constraints....*///
const int N = (int) 1e6 + 5;
const int M = (int) 1e9 + 7;
const double pi=2* acos(0.0);
const double eps=1e-9;


int main()
{
   string s;
   cin>>s;
   int r=0,ma=0;
   for(int i=0;s[i];++i){
    if(s[i]=='R')++r;
    else{
        r=0;
    }
    ma=max(r,ma);
   }
   printf("%d\n", ma);


    return 0;
}






Measured memory_bytes: 3720
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	int K;
	int X;
	cin >> K;
	cin >> X;

	if (500 * K >= X) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return  0;
}


Measured memory_bytes: 256
N = int(input())
a_list = [int(input()) for _ in range(N)]

count = 0
li = 1
while True:
    li = a_list[li-1]
    count += 1

    if li == 2:
        answer = count
        break

    if count == N:
        answer = -1
        break 

print(answer)

Measured memory_bytes: 13052
using namespace std;
#include<bits/stdc++.h>
#define BEGIN ios_base::sync_with_stdio(0);cin.tie(0);
#define END return EXIT_SUCCESS;
#define FOR(I,A,B) for((I)=(A);(I)<(B);(I)++)
#define REP(I,N) FOR((I),0,(N))
#define UP(I,A,B) for((I)=(A);(I)<=(B);(I)++)
#define DW(I,A,B) for((I)=(A);(I)>=(B);(I)--)
#define IN(P) cin>>(P)
#define IN2(P1,P2) cin>>(P1)>>(P2)
#define IN3(P1,P2,P3) cin>>(P1)>>(P2)>>(P3)
#define INS(I,N,V) REP((I),(N)) cin>>(V[I])
#define INS2(I,N,V1,V2) REP((I),(N)) cin>>(V1[I])>>(V2[I]);
#define INS3(I,N,V1,V2,V3) REP((I),(N)) cin>>(V1[I])>>(V2[I])>>(V3[I]);
#define OUT(P) cout<<(P)<<endl
#define OUT2(P1,P2) cout<<(P1)<<" "<<(P2)<<endl
#define OUT3(P1,P2,P3) cout<<(P1)<<" "<<(P2)<<" "<<(P3)<<endl
#define OUTS(I,N,V) REP((I),(N)) cout<<(V[i])<<endl
#define ALL(C) (C).begin(),(C).end()
#define RALL(C) (C).rbegin(),(C).rend()
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}

string S;
inline void solve(){
  IN(S);
  OUT(count(ALL(S),'1'));
}

int main(int argc,char**argv){
  BEGIN
  solve();
  END
}


Measured memory_bytes: 256
import sys

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


def input():
    return sys.stdin.readline().strip()


def main():
    N = int(input())
    P = [int(input()) for _ in range(N)]

    # dp[i] := i が一番右端に来るときの最大長
    dp = [0] * (N + 1)
    for i in range(N):
        p = P[i]
        dp[p] = dp[p - 1] + 1

    print(N - max(dp))


if __name__ == "__main__":
    main()


Measured memory_bytes: 18944
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
#define pqueue priority_queue
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int N;
vector<vector<int> > edge(100005);
int DP[100005];

int solve(int u, int v) {
  if(DP[u]>-1) return DP[u];
  int ans = 0;
  for(int i=0;i<edge[u].size();++i) {
    if(edge[u][i]==v) continue;
    ans ^= solve(edge[u][i], u)+1;
  }
  return ans;
}

int main() {
  cin>>N;
  int a, b;
  for(int i=0;i<N-1;++i) {
    cin>>a>>b;
    a--;
    b--;
    edge[a].push_back(b);
    edge[b].push_back(a);
  }
  for(int i=0;i<N;++i) DP[i] = -1;
  if(solve(0, -1)==0) cout<<"Bob"<<endl;
  else cout<<"Alice"<<endl;
}



Measured memory_bytes: 13704
use std::io::{self, Stdin};
use std::str::{self, FromStr};
use std::error::Error;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.ne();
    let mut cnt = 0;
    for _ in 0..n {
        let x: i64 = sc.ne();
        if x & 1 == 1 {
            cnt += 1;
        }
    }
    println!("{}",
             match cnt & 1 {
                 1 => "NO",
                 _ => "YES",
             });
}
struct Scanner {
    stdin: Stdin,
    id: usize,
    buf: Vec<u8>,
}

impl Scanner {
    fn new() -> Scanner {
        Scanner {
            stdin: io::stdin(),
            id: 0,
            buf: Vec::new(),
        }
    }
    fn next_line(&mut self) -> Option<String> {
        let mut res = String::new();
        match self.stdin.read_line(&mut res) {
            Ok(0) => return None,
            Ok(_) => Some(res),
            Err(why) => panic!("error in read_line: {}", why.description()),
        }
    }
    fn next<T: FromStr>(&mut self) -> Option<T> {
        while self.buf.len() == 0 {
            self.buf = match self.next_line() {
                Some(r) => {
                    self.id = 0;
                    r.trim().as_bytes().to_owned()
                }
                None => return None,
            };
        }
        let l = self.id;
        assert!(self.buf[l] != b' ');
        let n = self.buf.len();
        let mut r = l;
        while r < n && self.buf[r] != b' ' {
            r += 1;
        }
        let res = match str::from_utf8(&self.buf[l..r]).ok().unwrap().parse::<T>() {
            Ok(s) => Some(s),
            Err(_) => panic!("parse error"),
        };
        while r < n && self.buf[r] == b' ' {
            r += 1;
        }
        if r == n {
            self.buf.clear();
        } else {
            self.id = r;
        }
        res
    }
    fn ne<T: FromStr>(&mut self) -> T {
        self.next::<T>().unwrap()
    }
}


Measured memory_bytes: 2300
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <functional>

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

int main()
{
	ll a,b,c,d,e,f,g;
	scanf("%lld %lld %lld %lld %lld %lld %lld",&a,&b,&c,&d,&e,&f,&g);
	//I : a , J : d , L : e
	ll ret=(a/2)*2LL+(d/2)*2LL+(e/2)*2LL;
	if(a>=1&&d>=1&&e>=1) ret=max(ret,3LL+((a-1)/2)*2LL+((d-1)/2)*2LL+((e-1)/2)*2LL);
	printf("%lld\n",ret+b);
	return 0;
}


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

#define int long long
const double PI = 3.14159265358979323846;
typedef vector<int> vint;
typedef pair<int, int> pint;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

int N;
int D[55];
bool ex[24];

signed main() {
    cin>>N;
    for(int i=0;i<N;i++)cin>>D[i];
    sort(D,D+N);
    ex[0]=true;
    bool r=true;
    for(int i=0;i<N;i++){
        int idx;
        if(r){
            idx=D[i];
        }else{
            idx=(24-D[i])%24;
        }
        if(ex[idx]){
            cout<<0<<endl;
            return 0;
        }
        ex[idx]=true;
        r=!r;
    }
    int ans=114514,last=0;
    for(int i=1;i<48;i++){
        if(ex[i%24]){
            int x=i%24-min(last,i%24);
            last-=min(last,i%24);
            int d=abs(last-x);
            ans=min({ans,d,24-d});
            last=i%24;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)
using namespace std;

int main(void) {
  int a, b, c;
  scanf("%d%d%d", &a, &b, &c);
  printf("%d\n", max(max(a, b), c) - min(min(a, b), c));
  return 0;
}


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

int main() {

	double a, b, x;
	cin >> a >> b >> x;
	x /= a;
	x += x;

	cout << fixed << setprecision(9);

	double PI = acos(-1);

	if (x <= a * b) {
		double f = x / b;
		cout << atan(b / f) * 180 / PI << '\n';
		return 0;
	}

	x -= a * b;
	double f = x / a;
	cout << (atan((b - f) / a)) * 180 / PI << '\n';

	return 0;
}

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

void swap(int &x, int &y);

int main(){
	int a, b, c;
	int tmp;
	cin >> a >> b >> c;
	if (a < b&&a < c){
		cout << a << " ";
		if (b > c)
			swap(b, c);
		cout << b << " " << c << endl;
	}
	else if (b < a&&b < c){
		cout << b << " ";
		if (a > c)
			swap(a, c);
		cout << a << " " << c << endl;
	}
	else{
		cout << c << " ";
		if (a > b)
			swap(a, b);
		cout << a << " " << b << endl;
	}

}

void swap(int &x, int &y){
	int tmp = x;
	x = y;
	y = tmp;
}

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

trait BinarySearch<T> {
    fn lower_bound(&self, x: T) -> usize;
    fn upper_bound(&self, x: T) -> usize;
}

impl<T> BinarySearch<T> for Vec<T>
where T: Ord + PartialOrd + Copy + Clone
{
    fn lower_bound(&self, x: T) -> usize {
        let mut ng = -1i64;
        let mut ok = self.len() as i64;
        while ok - ng > 1 {
            let mid = (ng + ok) / 2;
            if self[mid as usize] >= x  {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ok as usize
    }

    fn upper_bound(&self, x: T) -> usize {
        let mut ng = -1i64;
        let mut ok = self.len() as i64;
        while ok - ng > 1 {
            let mid = (ng + ok) / 2;
            if self[mid as usize] > x  {
                ok = mid;
            } else {
                ng = mid;
            }
        }
        ok as usize
    }
}

#[fastout]
fn main() {
    input! {
        n: usize,
        m: usize,
        k: i64,
        a: [i64; n],
        b: [i64; m],
    }

    let mut cuma: Vec<i64> = vec![0];
    let mut cumb: Vec<i64> = vec![0];
    for i in 0..n {
        cuma.push(*cuma.last().unwrap() + a[i]);
    }
    for i in 0..m {
        cumb.push(*cumb.last().unwrap() + b[i]);
    }

    let mut ans: usize = 0;
    for i in 0..=n {
        if cuma[i] > k {
            break;
        }
        let ub = cumb.upper_bound(k - cuma[i]);
        if i + ub - 1 > ans {
            ans = i + ub - 1;
        }
    }
    println!("{}", ans);
}


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

int main() {

    int N;
    cin >> N;
    vector<int> X(N);
    rep(i, N) cin >> X[i];

    sort(X.begin(), X.end());

    int ans = INF;
    for (int i = X[0]; i <= X[N - 1]; i++) {
        int tmp = 0;
        rep(j, N) {
            tmp += pow(X[j] - i, 2);
        }
        ans = min(ans, tmp);
    }

    cout << ans << endl;

    return 0;
}


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

#define MAX_NODE_ID 31
#define MAX_TICKET_NUM 10
#define MAX_TICKET 256
class Node{
public:
	int id;
	double cost;
	int ticketStatus;
	Node(int i,double c,int t){
		id=i;
		cost=c;
		ticketStatus=t;
	}

	bool operator < (const Node &o) const{
		return cost > o.cost;
	}
};
int table[MAX_NODE_ID][MAX_NODE_ID];
bool visited[MAX_NODE_ID][MAX_TICKET];
int t[10];
double costPos[MAX_NODE_ID][MAX_TICKET];
typedef priority_queue<Node> PQ;
int main(){
	//input
	for(int n,m,p,a,b; cin>>n>>m>>p>>a>>b && n ;){
		int j,k;
		//ツ渉可甘コツ可サ
		for(j=0;j<MAX_NODE_ID;j++)for(k=0;k<MAX_NODE_ID;k++)table[j][k]=0;
		for(j=0;j<MAX_NODE_ID;j++)for(k=0;k<MAX_TICKET;k++){
			visited[j][k]=false;
			costPos[j][k]=0;
		}
		for(j=0; j<n && cin>>t[j] ;j++);

		int x,y,z;
		for(j=0; j<p && cin>>x>>y>>z ;j++){
			table[x][y]=z;
			table[y][x]=z;
		}
		PQ pq;
		pq.push(Node(a,0,0.0));
		while(!pq.empty()){
			int curId=pq.top().id;
			double curCost=pq.top().cost;
			int curTicket=pq.top().ticketStatus;

			if(curId==b){
				break;
			}
			pq.pop();
			if(visited[curId][curTicket]||curTicket==(1<<n)-1){
				continue;
			}

			for(j=1;j<=m;j++){
				if(table[curId][j]==0)continue;
				for(k=0;k<n;k++){
					int _ticket=1<<k;
					if(!(curTicket & _ticket)){
						visited[curId][curTicket]=true;
						double cost=curCost+(double)table[curId][j]/(double)t[k];
						int ticketStatus=curTicket+_ticket;
						if(costPos[curId][ticketStatus] < (double)table[curId][j]/(double)t[k]){
							Node next1(j,cost,ticketStatus);
							pq.push(next1);
						}
					}
				}
			}
		}
		if(pq.top().id==b)printf("%lf\n",pq.top().cost);
		else printf("Impossible\n");
	}
	return 0;
}

Measured memory_bytes: 7908
#include <stdio.h>
#include <math.h>
typedef long long ll;

int main(void) {
  ll n, i;
  scanf("%lld", &n);
  for(i = sqrtl(n); i >= 1; --i) if(!(n % i)) {
    ll t = n / i, ans = 0;
    while(t) ans++, t /= 10;
    printf("%lld", ans);
    return 0;
  }
  return 0;
}

Measured memory_bytes: 128
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val weather = Seq("Sunny", "Cloudy", "Rainy", "Sunny")
    val s = sc.next()
    println(weather(weather.indexOf(s) + 1))
  }
}

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

#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath> 
#include <tuple>

//pair sort firstに揃う

#define int long long
#define double long double
#define Rap(n,i) for(int (i)=0;(i)<(n);(i)++)
#define Pr(n) cout<<n<<endl;
#define PairV vector<pair<int , int> >
#define F first
#define S second
#define Vector1  vector<int>
#define vector2 vector<vector<int> >
#define index(v,x) find((v).begin(), (v).end(), (x))-(v).begin()
#define ctoi(c) (int)(c-'0')
#define incin(n) int (n); cin>>(n);
#define incin2(n,m) int (n),(m); cin >> (n)>>(m);
#define stcin(s) string (s); cin>>(s);
#define all(v) (v).begin() , (v).end()
namespace Mathf
{
    const int INF = 1000000000000;
    const double PI = 3.14159274;
    const double Rad2Deg = 57.29578;
    const double log2(double a,double b);
    const double log2(double a,double b){
        return log(b)/log(a);
    }
} // namespace Mathf

using namespace std;

int MD(pair<int,int> a,pair<int,int> b){//ManhattanDisRance
    return abs(a.first-b.first) + abs(a.second-b.second);
}
int MOD(int a,int b){
    return abs(a%b);
}
template <typename T1,typename T2> bool Comp (pair<T1,T2> a,pair<T1,T2> b){
    if(a.first!=b.first){
        return a.first<b.first;//first昇順
    }
    if(a.second!=b.second){
        return a.second > b.second;//second降順
    }else{
        return  true;
    }
}
signed  main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int a,b,x;
    cin>>a>>b>>x;
    if(a%x==0){
        cout<<b/x-a/x+1<<endl;
    }else{
        cout<<b/x-a/x<<endl;
    }
    return 0;
}
 

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
using namespace std;
int main()
{
    string s;
int l;
    cin>>s;
    l=s.size();
    for(register int i=0;i<l;i++)
    {
        if(s[i]=='C')
        {
            for(register int j=i+1;j<l;j++)
            {
                if(s[j]=='F')
                {
                    cout<<"Yes";
                    return 0;
                }
            }
        }
    }
    cout<<"No";
    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {

    private static BufferedReader br;
    private static StringTokenizer tokenizer;

    private static void solve() throws IOException {
        int aLen = nextInt();
        int bLen = nextInt();
        int M = nextInt();

        int[] arrA = new int[aLen];
        int minA = Integer.MAX_VALUE;
        for (int i = 0; i < aLen; i++) {
            arrA[i] = nextInt();
            minA = Math.min(minA, arrA[i]);
        }

        int[] arrB = new int[bLen];
        int minB = Integer.MAX_VALUE;
        for (int i = 0; i < bLen; i++) {
            arrB[i] = nextInt();
            minB = Math.min(minB, arrB[i]);
        }

        int min = minA + minB;
        for (int i = 0; i < M; i++) {
            int x = nextInt();
            int y = nextInt();
            int c = nextInt();

            min = Math.min(min, arrA[x - 1] + arrB[y - 1] - c);
        }

        System.out.println(min);

    }




    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));
        solve();
    }

    public static String next() throws IOException {
        while (tokenizer == null || !tokenizer.hasMoreTokens()) {
            String line = br.readLine();
            if (line == null)
                throw new IOException();
            tokenizer = new StringTokenizer(line);
        }
        return tokenizer.nextToken();
    }

    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }

    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

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

}

Measured memory_bytes: 51836
#include <bits/stdc++.h>
    #define ll long long
    using namespace std;
    const int N=1000006, INF=1000000009;
    long long a[N], b[N], t[200000], n, u;
     
    void upd(int i){ while(i <= 200002) ++t[i], i+=(i&-i); }    
     
    ll sum(int i){
        int x=0;
       	while(i) x+=t[i], i-=(i&-i); 
        return x;
    }     
            
    int main(){ ios_base::sync_with_stdio(false);
        cin>>n;
        for (int i=1; i<=n; i++)
          	cin>>a[i];
        int l=1, r=1e9;
    	ll x=((ll)n*((ll)n+1ll)/(ll)2+(ll)1)/(ll)2;
        while(l<=r){
           	long long mid=(l+r)/2, ans=0, k=100001;
          	for (int i=0; i<=200002; i++)t[i]=0;
           	upd(k);
        	for (int i=1; i<=n; i++)
         		if(a[i]>mid) ans+=sum(k+1), upd(++k);
          		else 		 ans+=sum(k-1), upd(--k);
         	
           	if(ans>=x)l=mid+1;
           	else	  r=mid-1;
        }
        cout<<r+1;
       	return 0;
    }

Measured memory_bytes: 3840
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=1;i<=(int)(n);i++)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
typedef long long ll;
#define _GLIBCXX_DEBUG
int digisum(int x){
  int sum=0;
  while(x){
    sum+=x%10;
    x/=10;
  }
  return sum;
}
int main(){
  int n,a,b;
  cin>>n>>a>>b;
  int ans=0;
  rep(i,n){
    int sum=digisum(i);
    if(a<=sum && sum<=b){
      ans+=i;
    }
  }
  cout<<ans<<endl;
}

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

int arr[501][3];

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

	for(int i = 0;i < n-1; i++){
		 cin>>arr[i][0]>>arr[i][1]>>arr[i][2];
	}

	for(int i=0;i<n;i++){
		int t = 0;
		for(int j=i;j<n-1;j++){
			if(t<arr[j][1]) t = arr[j][1];
			else if(t%arr[j][2] == 0) ;
			else t=t+arr[j][2]-t%arr[j][2];
			t+=arr[j][0]; 
		}
		cout<<t<<endl;
	}

}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define ALL(a) begin(a),end(a)
#define COUNTOF(a) (sizeof(a)/sizeof(a[0]))
#define SP << " " <<
#define FMT(a) #a<<":"<<a 
#define FMT2(a,b) #a<<":"<<a<<", "<<#b<<":"<<b 
#define FMT3(a,b,c) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c 
#define FMT4(a,b,c,d) #a<<":"<<a<<", "<<#b<<":"<<b<<", "<<#c<<":"<<c<<", "<<#d<<":"<<d 
typedef long long ll;
template<class T> istream& operator >> (istream& s, vector<T>& v) {
  for (T& x: v) s >> x;
  return s;
}
inline void Yes(bool f=true){cout<<(f?"Yes":"No")<<endl;}
inline void YES(bool f=true){cout<<(f?"YES":"NO")<<endl;}
#define ANS(a) cout<<a<<endl

template <typename T> T gcd(T a, T b) {
	if (b == 0) return abs(a);
	T r; while ((r = a % b) != 0) a = b, b = r;
	return abs(b);
}

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

    int A,B,K; cin >>A>>B>>K; //cout << FMT3(A,B,K) << endl;
    int gcd_AB = gcd(A,B);

    int c = 0;
    for (int d = 1; d <= gcd_AB; d++) {
        //cout << FMT3(d, gcd_AB, c) << endl;
        if (gcd_AB % d == 0) {
            if (++c == K) {
                ANS(gcd_AB/d);
                break;
            }
        }
    }
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

template <typename Tp> inline void getint(Tp &num){
	register int ch, neg = 0;
	while(!isdigit(ch = getchar())) if(ch == '-') neg = 1;
	num = ch & 15;
	while(isdigit(ch = getchar())) num = num * 10 + (ch & 15);
	if(neg) num = -num;
}

int N, k;
vector<int> S[450];

int main(){
	getint(N), k = (int)sqrt((N << 3) + 1.0) + 1 >> 1;
	if(k * (k - 1) != N << 1) return puts("No"), 0;
	for(register int i = 1, cur = 0; i <= k; i++)
		for(register int j = i + 1; j <= k; j++)
			S[i].push_back(++cur), S[j].push_back(cur);
	puts("Yes"), printf("%d\n", k);
	for(register int i = 1, siz; i <= k; i++, puts("")){
		printf("%d ", siz = S[i].size());
		for(register int j = 0; j < siz; j++) printf("%d ", S[i][j]);
	}
	return 0;
}

Measured memory_bytes: 2304
import math
class segment_tree:
    
    # self.table is 1-indexed
    # math.log2 not implemented 3.2.3
    def __init__(self, dat, query, default=0):
        self.offset = 2 ** math.ceil(math.log(len(dat), 2))
        self.table = [default] * self.offset + dat + [default] * (self.offset - len(dat))
        self.query = query
        for i in reversed(range(1, self.offset)):
            self.table[i] = self.query((self.table[2 * i], self.table[2 * i + 1]))

    # [l, r] closed-interval
    def find(self, l, r):
        return self.query(self.__range(l,r))

    def __range(self, l, r):
        l += self.offset
        r += self.offset
        while l <= r:
            if l & 1:
                yield self.table[l]
                l += 1
            l >>= 1
            if r & 1 == 0:
                yield self.table[r]
                r -= 1
            r >>= 1
        
    def update(self, i, x, function=lambda a, b:b):
        i += self.offset
        self.table[i] = function(self.table[i], x)
        while 1 < i:
            i >>= 1
            self.table[i] = self.query((self.table[2 * i], self.table[2 * i + 1]))

from sys import stdin
readline = stdin.readline


n, q = map(int, readline().split())

rmq = segment_tree([0] * n, sum, default=0)
from operator import add
function = (lambda x, y:rmq.update(x - 1, y, add), lambda x, y:print(rmq.find(x - 1, y - 1)))
for com, x, y in (map(int, readline().split()) for _ in range(q)):
    function[com](x, y)

Measured memory_bytes: 12020
import java.util.Scanner;

class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		String str = sc.next();
		int q = sc.nextInt();
		
		for (int i = 0; i < q; i++) {
			String com = sc.next();
			int c1 = sc.nextInt();
			int c2 = sc.nextInt();
			
			switch (com) {
				case "print":
					System.out.println(str.substring(c1,c2+1));
					break;
				case "reverse":
					String s = "";
					for (int j = c2; j >= c1; j--)
						s += str.charAt(j);
					str = str.substring(0,c1) + s + str.substring(c2+1);
					break;
				case "replace":
					String p =sc.next();
					str = str.substring(0,c1) + p + str.substring(c2+1);
			}
		}
	}
}


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

int main(){
    int N,ans=1;
    cin >> N;
    string S;
    cin >> S;
    for (int i = 0; i < N-1; i++) {
        if(S[i]!=S[i+1]) ans++;
    }
    cout << ans;
}

Measured memory_bytes: 512
import random


d=int(input())
C=[int(i) for i in input().split()]
s=[[int(i) for i in input().split()] for q in range(d)]

sco=0
L=[0 for i in range(26)]
ans=[]

#calc
for i in range(d):
    mayou=random.choice(range(26))
    est=s[i][mayou]+C[mayou]*(i+1-L[mayou])
    ans.append(mayou)
    L[mayou]=i+1
    #print(mayou+1) #output

sco=est

##以下表示
"""
L=[0 for i in range(26)]
for q in range(d):
    t=ans[q]
    sco+=s[q][t]
    
    
    L[t]=q+1
    for i in range(26):
        if L[i]!=-1:
            sco-=C[i]*(q+1-L[i])
    
    print(sco)
"""


m=1000000

for que in range(m):
    newsco=sco
    dn,q=random.choice(range(1,d)),random.choice(range(1,27))
    dn-=1
    q-=1
    old=ans[dn]
    ans[dn]=q
    now=dn
    cnt=1
    while now!=0 and ans[now]!=old:
        now-=1
        cnt+=1
    now=dn
    while now!=d and ans[now]!=old:
        newsco-=cnt*C[old]
        now+=1
        cnt+=1
    newsco-=s[dn][old]
    newsco+=s[dn][q]
    now=dn
    cnt=1
    while now!=0 and ans[now]!=q:
        now-=1
        cnt+=1
    now=dn
    while now!=d and ans[now]!=q:
        newsco+=cnt*C[q]
        now+=1
        cnt+=1
    #print(newsco)
    if newsco>sco:
        sco=newsco
        #print(newsco)
    else:
        ans[dn]=old

for ele in ans:
    print(ele+1)
    


Measured memory_bytes: 85584
#include <iostream>
#include <string>
#include <cstdlib>
#include <algorithm>

#define int long long

using namespace std;

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

    int a, s;

    cin >> a >> s;

    const int diff = a - s;

    if (std::abs(diff) % 2 == 0)
    {
        cout << abs(diff) / 2 + min(a,s) << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(int argc, char** argv) {
  int rate;
  cin >> rate;

  if (rate < 1200) {
    cout << "ABC";
  } else if (rate < 2800) {
    cout << "ARC";
  } else {
    cout << "AGC";
  }
  return 0;
}

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

signed main() {
  int N;
  cin >> N;
  vector<int> A(N);
  map<int, int> mp;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    mp[A[i]]++;
  }

  int all = 0;
  for (int i = 1; i <= N; i++) {
    all += mp[i] * (mp[i] - 1) / 2;
  }

  for (int i = 0; i < N; i++) {
    cout << all - mp[A[i]] * (mp[A[i]] - 1) / 2 +
                (mp[A[i]] - 1) * (mp[A[i]] - 2) / 2
         << endl;
  }

  return 0;
}

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

using namespace std;

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	int sum = 0;
	long long ans = 0;
	map<int, int> mod;
	mod[0] = 1;
	for (int i = 0; i < n; i++) {
		int x;
		scanf("%d", &x);
		sum = (sum + x) % m;
		if (!mod.count(sum)) {
			mod[sum] = 0;
		}
		ans += mod[sum];
		mod[sum] += 1;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3200
from collections import*
_,s=open(0)
dp=defaultdict(bool)
d1=[str(i)for i in range(10)]
d2=[str(i).zfill(2)for i in range(100)]
for c in s[:-1]:
  for i in d2:
    dp[i+c]|=dp[i]
  for i in d1:
    dp[i+c]|=dp[i]
  dp[c]=True
print(sum(dp[str(i).zfill(3)]for i in range(1000)))

Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
 
const int maxV = 90010;
const int maxN = 3e2+10;
const int inf = 0x3f3f3f3f;
const ll MOD = 1e9+7;
const ll INF = 1000000000000000010LL;
#define X first
#define Y second


int a[maxN][maxN];
int c[maxN][maxN];
int b[maxN];
bool checkx(int x)
{
	if(c[x][1] == c[x][2] && c[x][2] == c[x][3] && c[x][1] == 1) 
		return true;
	else
		return false;
}
bool checky(int y)
{
	return (c[1][y] == c[2][y] && c[2][y] == c[3][y] &&c[1][y] == 1);
}
bool checkxy()
{
	int t1 = c[1][1] + c[2][2] + c[3][3];
	int t2 = c[1][3] + c[2][2] + c[3][1];
	
	if(t1 == 3 || t2 == 3)
		return true;
	else
		return false;
}
int main() {
	int n = 3;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			scanf("%d",&a[i][j]);
		}
	}
	int m;
	scanf("%d",&m);
	unordered_map<int,int> mp;
	for(int i=1;i<=m;i++)
	{
		scanf("%d",&b[i]);
		mp[b[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(mp[a[i][j]] == 1)
			{
				c[i][j] = 1;
			}
		}
	}
	int flag = 0;
	for(int i=1;i<=3;i++)
	{
		if(checkx(i) || checky(i))
			flag = 1;
	}
	if(flag == 0)
	{
		flag = checkxy();
	}
	if(flag)
	{
		puts("Yes");
	}
	else
	{
		puts("No");
	}
	return 0;
}

Measured memory_bytes: 256
N, W = map(int, input().split())
w = []
v = []
for i in range(N):
    wi, vi = map(int, input().split())
    w.append(wi)
    v.append(vi)
ww = [w[0], w[0]+1, w[0]+2, w[0]+3]
d = {}
for i in range(4):
    d[ww[i]] = []
for i in range(N):
    d[w[i]].append(v[i])
for i in range(4):
    d[ww[i]] = sorted(d[ww[i]], reverse=True)
    
ans = 0
for i in range(N+1):
    if len(d[ww[0]]) < i:
        # print('break i: {}'.format(i))
        break
    for j in range(N+1):
        if i + j > N or len(d[ww[1]]) < j:
            # print('break i, j: {}, {}'.format(i, j))
            break
        for k in range(N+1):
            if i + j + k > N or len(d[ww[2]]) < k:
                # print('break i, j, k: {}, {}, {}'.format(i, j, k))
                break
            for l in range(N+1):
                # print(ww[0] * i + ww[1] * j + ww[2] * k + ww[3] * l)

                if i + j + k + l > N or\
                        len(d[ww[3]]) < l or\
                        ww[0] * i + ww[1] * j +\
                        ww[2] * k + ww[3] * l > W:
                    # print('break i, j, k: {}, {}, {}, {}'.format(i, j, k, l))
                    break

                av = sum([d[ww[0]][p] for p in range(i)])
                bv = sum([d[ww[1]][p] for p in range(j)])
                cv = sum([d[ww[2]][p] for p in range(k)])
                dv = sum([d[ww[3]][p] for p in range(l)])
                ans = max(ans, av+bv+cv+dv)
print(ans)




Measured memory_bytes: 3188
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

S = list(input())
c_ok = False
for s in S:
    if s=='C':
        c_ok = True
    if s=='F' and c_ok:
        print('Yes')
        break
else:
    print('No')

Measured memory_bytes: 61292
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=305;
int C[N][N],f[N][N],g[N][N],n,K,mod;

int fix(int x){
	return x>=mod?x-mod:x;
}

int main(){
	read(n),read(K),read(mod);
	C[0][0]=1;
	rep(i,1,n){
		C[i][0]=1;
		rep(j,1,n)C[i][j]=fix(C[i-1][j-1]+C[i-1][j]);
	}
	rep(i,0,K)f[1][i]=1,g[1][i]=K-i+1;
	rep(i,2,n+1)per(j,K,0){
		rep(k,1,i-1)
			f[i][j]=(f[i][j]+(ll)f[i-k][j]*g[k][j+1]%mod*C[i-2][k-1])%mod;
		g[i][j]=fix(g[i][j+1]+f[i][j]);
	}
	cout<<f[n+1][0]<<endl;
	return 0;
}

Measured memory_bytes: 1280
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

	int INF = 1 << 28;
	//long INF = 1L << 62;
	double EPS = 1e-10;

	void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(), m = sc.nextInt();
		P[] ps = new P[m];
		for (int i=0;i<m;i++) {
			ps[i] = new P(i, sc.nextInt() - 1, sc.nextInt() - 1, sc.nextInt());
		}

		sort(ps);
		UF uf = new UF(n);
		int c = 0, cost = 0;
		int[] eid = new int[n-1], ecost = new int[n-1];
		for (P p : ps) if (! uf.same(p.f, p.t)){
			eid[c] = p.id; ecost[c++] = p.c;
			cost += p.c;
			uf.unite(p.f, p.t);
		}
		
//		debug(eid, ecost);
		
		int ansn = 0, ansc = 0;
		for (int i=0;i<n-1;i++) {
			uf = new UF(n);
			c = 0;
			int _cost = 0;
			for (P p : ps) if (! uf.same(p.f, p.t) && p.id != eid[i]){
				_cost += p.c;
				uf.unite(p.f, p.t);
				c++;
			}
//			debug(i, c, _cost);
			if (c == n-1 && _cost == cost) continue;
			ansn++; ansc += ecost[i];
		}
		System.out.println(ansn + " " + ansc);
	}

	class P implements Comparable<P>{
		int id, f, t, c;
		P(int id, int f, int t, int c) {
			this.f = f;this.t  = t;this.c = c;
			this.id = id;
		}
		public int compareTo(P o) {
			// TODO 自動生成されたメソッド・スタブ
			return c - o.c;
		}
		public String toString() {
			return id + " " + f + " " + t + " " + c;
		}
	}

	class UF {
		int[] par, rank;

		public UF(int n) {
			par = new int[n];
			rank = new int[n];
			for(int i=0;i<n;i++) par[i] = i;
		}

		//代表元を求める
		int find(int x) {
			if( par[x] == x ) return x;
			return par[x] = find(par[x]);
		}

		//要素xとyを併合する
		void unite(int x, int y) {
			x = find(x);
			y = find(y);
			if( x == y ) return;

			if( rank[x] < rank[y]  ) par[x] = y;
			else {
				par[y] = x;
				if( rank[x] == rank[y] ) rank[x]++;
			}
		}

		//同一の集合に含まれるか調べる．trueならxとyは同じ集合，falseなら異なる
		boolean same(int x, int y) {
			return find(x) == find(y);
		}
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}

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

Measured memory_bytes: 82844
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <cstdio>
#include <set>
#include <map>
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ll long long

using namespace std;
int fa[100005];
int cnt = 0;
int n;
int finde(int x)
{
	if(x == fa[x]) return x;
	return fa[x] = finde(fa[x]);
}
struct node
{
	int x,y,id;
}p[100005];
struct edge
{
	int to,cost,from;
}e[200005];
bool cmp1(const node &a,const node &b)
{
	return a.x<b.x;
}
bool cmp2(const node &a,const node &b)
{
	return a.y<b.y; 
}
bool cmp(const edge &a,const edge &b)
{
	return a.cost<b.cost;
}
ll kruscal()
{
	ll ans = 0;
	int num = 0;
	for(int i=0;i<cnt && num < n;i++)
	{
		int xx = finde(e[i].from);
		int yy = finde(e[i].to);
		if(xx == yy) continue;
		else
		{
			fa[xx] = yy;
			num++;
			ans += e[i].cost;
		}
	}
	return ans;
}
int main()
{
    IOS
    
    cin>>n;
    fa[n] = n;
    for(int i=0;i<n;i++)
    {
    	cin>>p[i].x>>p[i].y;
    	fa[i] = i;
    	p[i].id = i;
	}
	sort(p,p+n,cmp1);
	for(int i=1;i<n;i++)
	{
		e[cnt].from = p[i-1].id;
		e[cnt].to = p[i].id;
		e[cnt++].cost = p[i].x - p[i-1].x;
	}
	sort(p,p+n,cmp2);
	for(int i=1;i<n;i++)
	{
		e[cnt].from = p[i-1].id;
		e[cnt].to = p[i].id;
		e[cnt++].cost = p[i].y - p[i-1].y;
	}
	sort(e,e+cnt,cmp);
	cout<<kruscal()<<endl;
    return 0;
}


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

int main(){
  int64_t A,B,K;
  cin >>A>>B>>K;
  if (A>=K){
    cout <<A-K<<" "<<B<<endl;
  }
  else if ((A<K)&(A+B>=K)){
    cout <<"0"<<" "<<A+B-K<<endl;
  }
  else {
    cout <<"0"<<" "<<"0"<<endl;
  }
}

    


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

int main() {
	int N;
	set<int> S;

	cin >> N;

	for (int i = 0; i < N; i++) {
		int d;
		cin >> d;
		S.insert(d);
	}
	
	cout << S.size() << endl;

	return 0;
}

Measured memory_bytes: 256