akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {
    public static final int MOD = 1_000_000_007;
    public static final String KEYENCE = "keyence";

    /**
     * @param args
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        boolean ans = solve(S);

        System.out.println(ans ? "YES" : "NO");
    }

    private static boolean solve(String S) {
        if (S.startsWith(KEYENCE) || S.endsWith(KEYENCE)) return true;

        for (int i=1; i<KEYENCE.length(); i++) {
            if (S.startsWith(KEYENCE.substring(0, i)) && S.endsWith(KEYENCE.substring(i))) return true;
        }

        return false;
    }

}


Measured memory_bytes: 25044
fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    let mut v2 = Vec::new();
    for _ in 0..n {
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).ok();
        let v = s.trim().split_whitespace()
            .map(|e| e.parse().ok().unwrap()).collect();
        v2.push(v);
    }
    v2
}
fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

fn main(){
    let stdin = read_vec::<isize>();
    let (a, b, c)=(stdin[0], stdin[1], stdin[2]);

    let result = c-(a-b);
    
let answer = if result>=0 { result }else{ 0};

    println!("{:?}", answer);
}

Measured memory_bytes: 4352
N=int(input())
r=[0]*10000
for i in range(1,100):
    for j in range(1,100):
        for k in range(1,100):
            v = i*i + j*j + k*k + i*j + i*k + k*j
            if v <= 10000:
                r[v-1] += 1
for i in range(N):
    print(r[i])

Measured memory_bytes: 9216
#include <iostream>
using namespace std;
int main(void){
    // Here your code !
    int i=0;
    int n = 1, x = 1;
    cin >> n >> x;
    while ( n || x ){
        i=0;
        for (int j=2;j<n;j++){
            for (int k=1;k<j;k++) {
                for (int l=0;l<k;l++) {
                    if ( j+k+l+3 == x ) {
                        i++;
                    }
                }
            }
        }
        cout << i << endl;
        cin >> n >> x;
    }
}

Measured memory_bytes: 3044
int main(void) {
    int A, B, C, D;
    scanf("%d", &A);
    scanf("%d", &B);
    scanf("%d", &C);
    scanf("%d", &D);

    while(1){
        C = C - B;
        if(C<=0){
            printf("Yes");
            break;
        }
        A = A - D;
        if(A<=0){
            printf("No");
            break;
        }
    }
}

Measured memory_bytes: 1708
#include<iostream>
#include<string>

using namespace std;

int main()
{int N,M,X,Y; cin >> N >> M >> X >> Y;
 
 int max_x = X; int min_y = Y;
 for(int i = 0; i < N; i++){
   int x; cin >> x; max_x = max(max_x,x);}
 for(int j = 0; j < M; j++){
   int y; cin >> y; min_y = min(min_y,y);}
 
 if( max_x < min_y){cout << "No War" <<endl;}
 else{cout << "War" << endl;}
 
 return 0;
}
     
   

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>

int main(){
    int N, M;
    int i, j, k;
    int div, sqrM;
    int ans;

    scanf("%d %d", &N, &M);
    div = M/N;
    sqrM =(int)sqrt(M);

    i=1;

    while(i<=sqrM){
        if(M%i == 0 && M/i <= div){
            if(ans < M/i){
                ans = M/i;
            }
        }else if(M%i == 0 && i<= div){
            if(ans < i){
                ans = i;
            }
        }
        i++;
    }
    printf("%d", ans);

    return 0;

}

Measured memory_bytes: 128
#include <iostream>
#include <queue>
#include <utility>
#include <string>
using namespace std;

#define fi first
#define se second

int main() {
	int n;
	bool flag = false;

	while(cin >> n, n) {
		priority_queue<pair<pair<int,int>,string> > q;
		if(flag) {
			cout << endl;
		}
		for(int i = 0; i < n; i++) {
			pair<pair<int,int>, string> tmp;
			int win, lose, draw;
			string team;
			cin >> team >> win >> lose >> draw;
			
			tmp.fi.fi = win * 3 + draw;
			tmp.fi.se = n - i;
			tmp.se = team;

			q.push(tmp);
		}

		while(!q.empty()) {
			pair<pair<int,int>, string> tmp;
			tmp = q.top(); q.pop();
			cout << tmp.se << "," << tmp.fi.fi << endl;
		}
		flag = true;
	}

	return 0;
}

Measured memory_bytes: 1220
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define rfor(i, a, b) for(int i = a; i < (int)b; i++)
#define all(ary) (ary).begin(), (ary).end()
#define debug(x) cerr << #x << ": " << x << '\n'
const int INF = 100100100;
const int MOD = 1000000007;
using namespace std;
using vec = vector<int>;
using ll = long long;
template <class T = int> T in(){ T x; cin >> x; return (x);}
const int dy[4] = {-1, 0, 0, 1};
const int dx[4] = {0, -1, 1, 0};

// ll x;
int n, m;
// vec A()

int main(int argc, char *argv[]){
    // cin >> x;
    // ll res = 0;
    // ll score = 0;
    // bool flag = true;
    // res = x / 11 * 2;
    // if(x % 11 >= 1 && x % 11 <= 6) res++;
    // else if(x % 11 > 6) res += 2;
    // cout << res << endl;
    // return 0;
    cin >> n >> m;
    vec A(m), B(m);
    int a, b;
    map<int, int> mp;
    string res = "IMPOSSIBLE";
    set<pair<int, int>> pairs;
    rep(i, m){
        cin >> a >> b;
        // mp[a] = b;
        // mp.insert(map<int,int>::value_type(a, b));
        // if()
        // pairs[i] = make_pair(a, b);
        pairs.insert({a, b});
    }
    rfor(i, 2, n){
        if(pairs.count({1, i}) && pairs.count({i, n})){
            res = "POSSIBLE";
            break;
        }
    }
    // sort(all(A)); sort(all(B), greater<int>());
    // if(B[0] == N && A[0] == 1){
    //     rep(i, m)
    // }
    // sort(all(pairs));
    // // cout << "" << endl;
    // for(auto it : pairs){
    //     if(it.first == 1){
    //         for(auto it2 : pairs){
    //             if(it.second == it2.first && it2.second == n){
    //                 res ="POSSIBLE";
    //                 goto RES;
    //             }
    //         }
    //     }else
    //         break;
    //     // cout << it.first << " " << it.second << endl;
    // }
// RES:
    cout << res << endl;
    return 0;
}

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

int main(){
  string S; cin >> S;
  
  map<char,int> mp;
  for(int i = 0; i < S.size(); i++){
      mp[S.at(i)]++;
  }
  
  bool OK = true;
  if(mp.size() != 2) OK = false;
  for(auto it:mp){
      if(it.second > 2) OK = false;
  }
  
  if(OK) cout << "Yes" << endl;
  else cout << "No" << endl;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define inf 100000
int main(){
    int n, x, y;
    cin >> n >> x >> y;
    vector<vector<int> > dist(n, vector<int> (n, 0));
    x--;
    y--;
    for(int i=0; i<n; i++)
        dist[i][i] = 0;
    for(int i=x; i<=y; i++){
        for(int j=x; j<=y; j++)
            dist[i][j] = min(abs(j-i), y-x+1-abs(j-i));
    }
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(i<x){
                if(j<x)
                    dist[i][j] = j-i;
                else if(j<=y)
                    dist[i][j] = x - i + dist[x][j];
                else
                    dist[i][j] = x -i + dist[x][y] + j - y;
            }
            else if(i>=x && j<=y)
                continue;
            else if(i>=x && i<=y && j>y)
                dist[i][j] = dist[i][y] + j - y;
            else if(i>y)
                dist[i][j] = j-i;
        }
    }
    // cout << "hello\n";
    // for(int i=0; i<n; i++){
    // 	for(int j=0; j<n; j++)
    // 		cout << dist[i][j] << ' ';
	// 	cout << endl;
    // }
    vector<int> res(n);
    for(int i=0; i<n; i++){
        for(int j=i; j<n; j++)
            res[dist[i][j]]++;
    }
    for(int i=1; i<n; i++)
        cout << res[i] << endl;
    return 0;
}

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

struct edge{
    int to,weight;
    edge(int to,int weight):to(to),weight(weight){}
};
using Graph = vector<vector<int>> ;
using GraphEdge = vector<vector<int>> ;

long long modinv(long long a, long long m=MOD) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
    /*MODの割り算の際に
    a/＝b;
    を
    a *= modinv(b,MOD);
    とする。
        */
}
int main(){
    string s,t;cin >> s >> t;
    int sl = s.length();
    int tl = t.length();
    int same = 0;
    int ma = 0;
    rep(i,sl-tl+1){
        for(int j=0;j<tl;j++){
            if(s[i+j] == t[j])same++;
            ma = max(ma,same);
        }
        same = 0;
    }
    cout << tl - ma << endl;
    return 0;
}

Measured memory_bytes: 3528
#include<iostream>
using namespace std;
int main()
{
  int n;
  cin>>n;
  int arr[n];
  for(int i=0;i<n;i++)
    cin >> arr[i];
  int cnt = 0;
  for(int i=1;i<n-1;i++)
  {
    if(arr[i]!=max(arr[i-1],max(arr[i],arr[i+1]))&&arr[i]!=min(arr[i-1],min(arr[i],arr[i+1])))
      cnt++;
  }
  cout << cnt;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;

void dfs(int v, int par, VVI &g, int d, VI &minDegAt, VI &maxDegAt) {
    if (SIZE(maxDegAt) == d) {
        minDegAt.pb(INF);
        maxDegAt.pb(0);
    }
    
    int deg = SIZE(g[v]) - (par != -1);

    minDegAt[d] = min(minDegAt[d], deg);
    maxDegAt[d] = max(maxDegAt[d], deg);
    
    for (int u : g[v]) if (u != par) {
        dfs(u, v, g, d + 1, minDegAt, maxDegAt);
    }
}

pll solve(int root, int n, VP &edges) {
    VVI g(n);
    for (auto &e : edges) {
        int u, v;
        tie(u, v) = e;
 
        g[u].pb(v);
        g[v].pb(u);
    }
    
    VI minDegAt, maxDegAt;
    dfs(root, -1, g, 0, minDegAt, maxDegAt);
    
    ll depth = SIZE(maxDegAt);
    ll leaves = 1;
    
    minDegAt.pop_back();
    maxDegAt.pop_back();
    
    FORDE(i,maxDegAt) {
        leaves *= maxDegAt[i];
    }
    
    return {depth, leaves};
}

/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int n;
    cin >> n;
    
    VP edges;
    FOR(_,1,n-1) {
        int u, v;
        cin >> u >> v; u--; v--;
        
        edges.pb({u, v});
    }
    
    pll ans = {n + 1, n};
    
    FOR(i,0,n-1) {
        ans = min(ans, solve(i, n, edges));        
    }
    
    FOR(i,0,n-2) {
        VP newEdges = edges;
        
        int u, v;
        tie(u, v) = edges[i];
        
        newEdges.erase(newEdges.begin() + i);
        newEdges.pb({u, n});
        newEdges.pb({v, n});
        
        auto e = solve(n, n + 1, newEdges);
        e.st--;
        
        ans = min(ans, e);
    }

    cout << ans.st << ' ' << ans.nd;

    return 0;
}

/*************************************************************************/


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

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int mod = (int)1e9 + 7;
void dbg(){ cerr << "\n"; }  
template <typename T,typename ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }



int main()
{
	
	//cin.tie(0); ios_base::sync_with_stdio(false);
	const int dr[]={0,1,0,-1,0};
	int h,w;
	cin >> h >>w;;
	
	vector<string> ba(h);
	rep(i,h) cin >> ba[i];

	bool ok = true;
	rep(i,h) rep(j,w) if(ba[i][j]=='#'){
		bool sw = false;
		rep(k,4){
			int ty= i + dr[k], tx = j+dr[k+1];
			if(ty>=0 && ty<h && tx>=0 && tx<w){
				if(ba[ty][tx] == ba[i][j]) sw = true;
			}
		}
		//printf("%d:%d:%d  ",i,j,sw);
		if( !sw) ok = false;
	}
	
	cout << (ok? "Yes":"No")  <<"\n";
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <numeric>
#include <algorithm>
#include <iomanip>
#include <queue>
#include <limits>
using namespace std;
#define MOD 1000000007
#define INF 1000000009
#define ll long long
#define rep(i_, start, end) for(ll i_=(ll)start; i_<(ll)end; i_++)
#define print(a) cout << a << endl;
#define printarray(a, len) rep(ii,0,len) cout << a[ii] << " ";
#define printarray2(aa, len) rep(ij,0,len) printarray(aa[ij], aa[ij].size()); print("");

int main(){
  ll n, ans=0;
  cin >> n;
  ll a[100001][3];
  ll dp[100001][3] = {};
  rep(i, 0, n) cin >> a[i][0] >> a[i][1] >> a[i][2];
  rep(i, 0, n){
    rep(j, 0, 3){
      rep(ki, 0, 3){
        if (ki != j) dp[i+1][j] = max(dp[i+1][j], dp[i][ki] + a[i][j]);
      }
    }
  }
  rep(i, 0, 3){
    ans = max(ans, dp[n][i]);
  }
  print(ans);
  
  return 0;
}

Measured memory_bytes: 4992
#include "bits/stdc++.h"
using namespace std;

int main() {
  int N; cin >> N;
  int A[100] = { 0 };

  for(int i = 1; i <= 9; ++i) {
    for(int j = 1; j <= 9; ++j) A[i*j] = 1;
  }

  if(A[N] == 1) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a) for(int i = 0; i < a; i++)
#define all(v) v.begin(), v.end()
#define dcout cout << fixed << setprecision(15)
#define arep(i, a) for(auto i : a)
#define F first
#define S second
#define VE vector<int>
#define pb(x) push_back(x)
#define MOD 1000000007
#define INF 10000000000
#define int long long
#define KETA(n) floor(log10(n) + 1)
using namespace std;
signed main() {
    int k;
    cin >> k;
    if(k % 2 == 0)
        cout << (k / 2) * (k / 2);
    else
        cout << (k / 2) * (k / 2 + 1);
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner s = new Scanner(System.in);
        String[] in = s.nextLine().split(" ");
        int a = Integer.parseInt(in[0]);
        int b = Integer.parseInt(in[1]);
        if(a <= 5){
            System.out.println(0);
        }else if(a <= 12){
            System.out.println(b/2);
        }else{
            System.out.println(b);
        }
    }
}

Measured memory_bytes: 21844
// Hint: Don't look, No need, Let'em Play.

#pragma optimize("O2")
#include <bits/stdc++.h>
#include "bits/stdc++.h"

using namespace std;

#define int long long
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#ifndef bhupixb
    #define var(...)
    #define stl(...)
#endif

void solve() {
   int n, x;
   cin >> x >> n;
   map<int,int> mp;
   for (int i = 0; i < n; ++i) {
    int num;
    cin >> num;
    mp[num]++;
   }
   vector<pair<int,int>> v;
   for (int i = -1000; i <= 1000; ++i) {
    if (!mp.count(i)) {
        v.push_back({abs(i - x), i});
    }
   }
   sort(v.begin(), v.end());
   cout << v[0].second << '\n';
}

signed main() {
    fast;
    int t = 1; //cin >> t;
    while (t--) {
        solve();
    }


  return 0;
}

Measured memory_bytes: 3688
/*  
   |\_/|
   |* *|
   \_+_/
          */
#include<bits/stdc++.h>

#define endl '\n'

using namespace std;

int main(){

  double N;

  cin>>N;
  
  int cnt=(int)N;

  int minn=10000;
  
  for(int i=1;i<=sqrt(N);i++){

    if(ceil(N/i)==floor(N/i)){

      int cnt=int(N/i);

      int temp=0;
      
      while(cnt){

	cnt/=10;

	temp++;

      }

      cnt=i;

      int temp1=0;
      
      while(cnt){

	cnt/=10;

	temp1++;

      }

      minn=min(minn,max(temp,temp1));
      
    }
  }

  cout<<minn<<endl;
  
return 0;

}


Measured memory_bytes: 384
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;

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

        String line;
        while (!(line = br.readLine()).equals("0")) {
            int n = Integer.parseInt(line);
            int[] min = new int[n];
            for (int i = 0; i < n; i++) {
                min[i] = Integer.parseInt(br.readLine());
            }
            Arrays.sort(min);
            long sum = 0;
            long t = 0;
            for (int i = 0; i < n; i++) {
                sum += t;
                t += min[i];
            }
            System.out.println(sum);
        }
    }
}


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

#define IOS cin.tie(0);ios::sync_with_stdio(false)

#define ll      long long
#define Fi      first
#define Se      second
#define Pb      push_back
#define vi      vector<int>
#define vs      vector<string>
#define vp      vector<pair<int,int>>
#define vvi     vector<vector<int>>
#define vvp     vector<vector<pair<int,int>>>
using Graph  =  vector<vector<int>>; //Caution!! Segmentation Fault!! Don't forget to add +1!

#define sz(x) (int)x.size()
#define all(v) v.begin(),v.end()
#define output_s(s) printf("%s\n",(s).c_str())

#define rep(i,n)        for(int i=0;i<(int)(n);i++)
#define Rep(i,n,m)      for(int i=(int)(n);i<(int)(m);i++)
#define RepS(i,n,m)     for(int i=(int)(n);i<=(int)(m);i++)
#define RRepS(i,n,m)    for(int i=(int)(n);i>=(int)(m);i--)
#define SRepS(i,n,m)     for(int i=(int)(n);i*i<=(int)(m);i++)
#define RepA(x)         for(auto &item:(x))

void CINT(){} //@shibh308's template
template<class Head,class... Tail> void CINT(Head&& head,Tail&&... tail){cin>>head; CINT(move(tail)...);}    
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define VCIN(x) for(auto &item:x) cin>>item

void OUT(){}
template<class Head,class...Tail> void OUT(Head&& head,Tail&&...tail){cout<<head<<(sizeof...(tail)?' ':'\n'); OUT(move(tail)...);}
#define COUT(...) OUT(__VA_ARGS__)

template<typename TypeInt>TypeInt GCD(TypeInt a,TypeInt b){return a%b==0?b:GCD(b,a%b);} //最大公約数
template<typename TypeInt>TypeInt LCM(TypeInt a,TypeInt b){return a*b/GCD(a,b);} //最小公倍数
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}
template<class T>bool comp(T a,T b){return abs(a)<abs(b);} //比較関数

void YES(bool f){printf(f?"YES\n":"NO\n");}
void Yes(bool f){printf(f?"Yes\n":"No\n");}
void Possible(bool f){printf(f?"Possible\n":"Impossible\n");}
void POSSIBLE(bool f){printf(f?"POSSIBLE\n":"IMPOSSIBLE\n");}

//----------------------library------------------------//

//const int dx[4]={1,0,-1,0};
//const int dy[4]={0,1,0,-1};
const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};
const int NMAX = 200;
const int INF = 1e9;
const int MOD = 1e9+7;
bool flag;

//----------------------Global-------------------------//

signed main(){
    CIN(N);
    vi a(N);VCIN(a);
    int ans=INF;
    RepS(i,-100,100){
        int sum=0;
        rep(j,N)sum+=(a[j]-i)*(a[j]-i);
        chmin(ans,sum);
    }
    printf("%d\n",ans);

    return 0;
}


Measured memory_bytes: 256
<?php
  list($n, $q) = explode(" ", trim(fgets(STDIN)));
  list($s) = explode(" ", trim(fgets(STDIN)));
 
  $count = [];
  $count[0] = 0;
  for($i=1; $i<$n; $i++){
    $count[$i]=$count[$i-1];
    if($s[$i-1].$s[$i] == 'AC'){
      $count[$i]=$count[$i-1]+1;
    }
  }

  for($i=0; $i<$q;$i++){
    list($l, $r) = explode(" ", trim(fgets(STDIN)));
    echo ($count[$r-1]-$count[$l-1]).PHP_EOL;
  }

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

typedef vector<int> vi;

int main()
{
	int n, i;
	bool isPossible = true;
	scanf("%d", &n);
	vi nums(n);
	for (i = 0; i < n; i++) {
		scanf("%d", &nums[i]);
		if (i == 0 or nums[i] - 1 >= nums[i - 1])
			nums[i]--;
		if (i > 0 and nums[i] < nums[i - 1])
			isPossible = false;
	}
	if (isPossible)
		printf("Yes\n");
	else
		printf("No\n");
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define boost ios::sync_with_stdio(false);cin.tie(nullptr)
#define pi pair<int,int>
#define ff first
#define ss second
#define int long long
	

int32_t main(){
	boost;
	int n,k;
	cin>>n>>k;
	int l = (n - 2);
	int r = (n-1)*(n-2)/2;
	vector<pi>ans;
	for(int i=2;i<=n;i++)
		ans.push_back({1,i});
	for(int i=2;i<=n && r>k;i++){
		for(int j=i+1;j<=n && r > k;j++){
			ans.push_back({i,j});
			r--;
		}
	}
	if(r != k){
		cout<<-1<<endl;
		return 0;
	}
	cout<<ans.size()<<endl;
	for(auto p:ans){
		cout<<p.ff<<" "<<p.ss<<endl;
	}
}



Measured memory_bytes: 3752
#include<bits/stdc++.h>
#define lk (k<<1)
#define rk (k<<|1)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int inf=0x3f3f3f3f;
const int N=1e2+10;
int a[110];
int main()
{
    int n;
    scanf("%d",&n);
    for(int i=1;i<=n;i++){
        scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    if(n<3) printf("0\n");
    else {
        int ans=0;
        for(int i=1;i<=n-2;i++)
        for(int j=i+1;j<=n-1;j++){
            if(a[i]==a[j]) continue;
            for(int k=j+1;k<=n;k++){
                if(a[k]==a[j]) continue;
                if(a[i]+a[j]>a[k]) ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}


Measured memory_bytes: 3824
#include <stdio.h>

int main () {
    char S[5];
    scanf("%s", S);

    if ((S[0] == S[1] && S[2] == S[3] && S[0] != S[2]) ||
        (S[0] == S[2] && S[1] == S[3] && S[0] != S[1]) ||
        (S[0] == S[3] && S[1] == S[2] && S[0] != S[1])) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef complex<double> comp;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
ll a[110];

const int MAX = 200;
struct edge {
    int to;
    ll cap;
    int rev;
};

vector<edge> G[MAX];
int level[MAX];
int iter[MAX];

void add_edge(int from, int to, ll cap) {
    G[from].push_back((edge){to, cap, (int)G[to].size()});
    G[to].push_back((edge){from, 0, (int)G[from].size()-1});
}

void bfs(int s) {
    memset(level, -1, sizeof(level));
    queue<int> que;
    level[s] = 0;
    que.push(s);
    while (!que.empty()) {
        int v = que.front(); que.pop();
        for (int i = 0; i < G[v].size(); i++) {
            edge &e = G[v][i];
            if (e.cap > 0 and level[e.to] < 0) {
                level[e.to] = level[v] + 1;
                que.push(e.to);
            }
        }
    }
}
ll dfs(int v, int t, ll f) {
    if (v == t) return f;
    for (int &i = iter[v]; i < G[v].size(); i++) {
        edge &e = G[v][i];
        if (e.cap > 0 and level[v] < level[e.to]) {
            ll d = dfs(e.to, t, min(f, e.cap));
            if (d > 0) {
                e.cap -= d;
                G[e.to][e.rev].cap += d;
                return d;
            }
        }
    }
    return 0;
}

ll dinic(int s, int t) {
    ll flow = 0;
    while (true) {
        bfs(s);
        if (level[t] < 0) return flow;
        memset(iter, 0, sizeof(iter));
        ll f;
        while ((f = dfs(s, t, inf)) > 0) {
            flow += f;
        }
    }
}

ll solve() {
    ll res = 0;
    int s = n + 1, t = n + 2;
    for (int i = 1; i <= n; i++) {
        if (a[i] >= 0) {
            res += a[i];
            add_edge(i, t, a[i]);
        } else {
            add_edge(s, i, -a[i]);
        }
        for (int j = i+i; j <= n; j += i)
            add_edge(i, j, (ll)1e15);
    }
    return res - dinic(s, t);
}

void input() {
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
}

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

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 256
N = int(input())
count = {}
for i in range(N):
    s = input()
    count.setdefault(s, 0)
    count[s] += 1
p = max(count.values())
ans = []
for k in count.keys():
    if count[k] == p:
        ans.append(k)
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 32096
#include<stdio.h>
#include<math.h>
#define min(a,b) (a) < (b) ? (a) : (b)
#define INF 9999999

int all(int e){
	int x,y,p,q,minm=INF;
	for(y=(int)sqrt(e);y>=0;y--){
		p=y*y;
		for(x=(int)pow(e,5.0/12.0);x>=0;x--){
			q=x*x*x+p;
			if(q>e)continue;
			minm=min(minm,x+y+(e-q));
		}
	}
	return minm;
}

int main(){
	int e,i,j,cnt=0;
	while((scanf("%d",&e))!=-1){
		if(e==0)break;
		printf("%d\n",all(e));
	}
	return 0;
}

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

n,q=map(int,input().split())
ab=[[int(i) for i in input().split()] for j in range(n-1)]
px=[[int(i) for i in input().split()] for j in range(q)]

graph=[[] for i in range(n+1)]
for a,b in ab:
    graph[a].append(b)
    graph[b].append(a)
    
value=[0]*(n+1)

for p,x in px:
    value[p]+=x
    
q=[(0,1)]
while q:
    parent,child = q.pop()
    value[child]+=value[parent]
    for i in graph[child]:
        if i==parent:
            continue
        q.append((child,i))
ans=' '.join(map(str,value[1:]))
print(ans)
    

Measured memory_bytes: 124240
// parameter "input" gets all data
function Main(input) {
	// the first line is assigned to input[0], the second line is assigned to input[1] similarly.
	input = input.split("\n");
	let n = input[0].split(" ")[0];
	let k = input[0].split(" ")[1];
	let arr = input[1].split(" ").map(el => parseInt(el));
	arr.sort((a,b)=>{
    a = parseInt(a);
    b = parseInt(b);
      if(a<b)
        return -1;
      return 1;
    });
  	let ans = 0;
	for(let i=0;i<Math.min(arr.length,k);i++)
		ans+=arr[i];
  	
  	console.log(ans);
}
// Don't edit this line!
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29532
#include <bits/stdc++.h>
#define ALL(obj) begin(obj), end(obj)
#define debug(x) cerr << #x << ": " << x << '\n'
using namespace std;
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

using ll = long long;
using ull = unsigned long long;
const int INF = 1e9;
const int MOD = 1e9 + 7;

int main() {
    int a, b;
    cin >> a >> b;
    cout << (a + b) % 24 << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){
    cin >> first;
    IN(rest...);
    return;
}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr int IOS_PREC = 15;
    static constexpr bool AUTOFLUSH = false;

    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(IOS_PREC);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;


#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.second < b.second; }


int main() {
    SS(int,n,m)
    vector<int> s(m);
    vector<char >c(m);

    rep(i,m)cin>>s[i]>>c[i]; //左からs桁目がc
    if(n==1){
        for(int i=0;i<10;i++){
            string ans=to_string(i);
            bool flag=true;
            rep(j,m){
                if(ans[s[j]-1]!=c[j])flag=false;
            }
            if(flag==true){
                p(i);
                return 0;
            }
        }
    }
    if(n>1){
    for(int i=pow(10,n-1);i<pow(10,n);i++){
        debug(i);
        string ans=to_string(i);
        bool flag=true;
        rep(j,m){
            if(ans[s[j]-1]!=c[j])flag=false;
        }
        if(flag==true){
            p(i);
            return 0;
        }

    }
    }
    p(-1);
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Runtime.ExceptionServices;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var S = Read();
            var T = Read();
            var Ans = int.MaxValue;

            for (int i = 0; i <= S.Length - T.Length; i++)
            {
                var st = S.Substring(i, T.Length);
                var needchange = 0;
                for (int j = 0; j < T.Length; j++)
                {
                    if (st[j] != T[j])
                    {
                        needchange++;
                    }
                }
                Ans = Min(Ans, needchange);
            }
            WriteLine(Ans);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}


Measured memory_bytes: 26380
#include<bits/stdc++.h>
#include<iostream>
#include<typeinfo>
#define ll  long long 
#define ull unsigned long long 
#define ld  long double
#define pb  push_back
#define eb  emplace_back
#define pf  push_front
#define mp  make_pair
#define all(v)  v.begin(),v.end()
#define BP(n)  __builtin_popcount(n)
#define bs(v,x)  binary_search(all(v),x)
#define lb(v,x) lower_bound(all(v),x) //first equal to or lower than element
#define ub(v,x) upper_bound(all(v),x) //first greater than element
#define rep(i,n)  for(i=0;i<n;i++)
#define rep1(j,n)  for (j=i+1;j<n;j++)
#define Unique(v)  vector<int>::iterator it; sort(all(v)); it= unique(all(v)); v.resize(distance(v.begin(),it))
#define M  1000000007
#define PI  acos(-1.0)
#define fastio  ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL)
using namespace std;
void input(vector<int>& v,int n){ int i,io; rep(i,n) { cin>>io; v.pb(io);} }
void output(vector<int> v) { int i; rep(i,v.size()) cout<<v.at(i); }
map<int,int>  frequency(vector<int> v){ int i; map<int,int> m; rep (i,v.size()) {  if (m.find(v[i])==m.end()) m.insert({v.at(i),1}); else m[v.at(i)]++; } return m; }
bool perfsq(ll n){ return (ceil(sqrt(n))==floor(sqrt(n))); }
bool ispower2(int n) { if (n&(n-1)==0) return true; else return false; }
bool binary_pred(int a,int b){ return a==b; }
int string_to_int(string s) { stringstream geek(s); ll x = 0; geek >> x; return x; }
int digcount(ll n) { return (floor(log10(n)) + 1); }
bool isprime(ll n) {
    if (n <= 1)
        return false;
    for (ll i = 2; i*i <= n; i++) {
        if (n % i == 0)
            return false;
    }
    return true;
}
vector<ll> get_factors(ll n) {
    vector<ll> ans;
    for (ll i=2;i*i<=n;i++) {
        if (n % i == 0) {
            ans.pb(i);
            if (n/i != i)
                ans.pb(n/i);
        }
    }
    if (n != 1) {
        ans.pb(1);
        ans.pb(n);
    }
    else 
        ans.pb(1); 
    sort(all(ans));
    return ans;
}

void getans() {
    string s;
    cin >> s;
    if (s.back() == 's')
        s.append("es");
    else
        s.pb('s');
    cout<<s<<endl;
}
int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
        freopen("error.txt", "w", stderr);
    #endif
    int T = 1;
    //cin >> T;
    while (T--) 
        getans();
}
// Check for corner cases
// Check for special case like n = 0 or n = INT_MAX
// Check for Buffer Overflow or use of unsigned variable if any
// Check if problem can be solved mathematically

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m;
	scanf("%d%d",&n,&m);
	if(n+m==15)
		printf("+");
	else if(n*m==15)
		printf("*");
	else
		printf("x");
	return 0;
}

Measured memory_bytes: 256
//B - Tap Dance
#include <stdio.h>
#include <string.h>

int main(void){
    char s[100];
    int i;
    scanf("%s", s);
    int length = strlen(s);
    for(i=0; i<length; i++){
        //奇数文字目
        if(i%2==0 && s[i] == 'L'){
            printf("No\n");
            return 0;
        }
        //偶数文字目
        if(i%2==1 && s[i] == 'R'){
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}


Measured memory_bytes: 128
def main():
    height, width = map(int, input().split())
    grid = []
    initial_white = 0
    for _ in range(height):
        g = input()
        initial_white += g.count(".")
        grid.append(list(g))
    count = [[0 for _ in range(width)] for _ in range(height)]
    next_search = [(0, 0)]
    grid[0][0] = "#"
    while not next_search == []:
        now = next_search.pop(0)
        for d in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
            next_index = (now[0] + d[0], now[1] + d[1])
            if next_index[0] < 0 or height <= next_index[0] or next_index[1] < 0 or width <= next_index[1]:
                continue
            elif grid[next_index[0]][next_index[1]] == ".":
                grid[next_index[0]][next_index[1]] = "#"
                count[next_index[0]][next_index[1]] = count[now[0]][now[1]] + 1
                next_search.append(next_index)
    print(initial_white - count[-1][-1] - 1 if count[-1][-1] > 0 else -1)


if __name__ == '__main__':
    main()



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

#define LL long long
#define int long long
#define PB push_back
#define N 500001
#define LG 22
#define MXQ 200001
#define M 1000000007
#define LB lower_bound
#define UB upper_bound
#define MP make_pair
#define LD double
#define F first
#define S second
#define ll long long
#define inf LLONG_MAX
#define endl "\n"

int32_t main()
{
    LL i,j,lt,d,z,v,c,r,l,q,x,y,m,n,x1,y1,t1,k;
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    n=s.length();
    // cout<<s<<" "<<n<<endl;
    x=0;
    y=0;
    for(i=0;i<n;i++)
    {
        z=s[i]-'0';
        // cout<<(i%2)<<endl;
        x+=(z!=(i%2));
        y+=(z!=(1^(i%2)));
    }
    // cout<<x<<" "<<y<<endl;
    cout<<min(x,y);
}       

Measured memory_bytes: 512
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n; cin >> n;
  vector<ll> a(n);
  REP(i,n) cin >> a[i];
  sort(ALL(a));
  ll ans = 1;
  ll base = 1e18;
  if(a[0]==0){
    cout << 0 << endl;
    return 0;
  }
  REP(i,n){
    if(ans > base/a[i]){
      cout << -1 << endl;
      return 0;
    }
    ans *= a[i];
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3988
#/usr/bin/python

def solve():
    n = int(input())
    s = [input() for i in range(n)]
    ans = ''
    for v in ['AC', 'WA', 'TLE', 'RE']:
        ans += "{0} x {1}\n".format(v, s.count(v))
    return ans

print(solve())


Measured memory_bytes: 16280
#include <bits/stdc++.h>
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
#include <ios>
#include <iomanip>
#include <algorithm>
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP2(i, m, n) for (int i = (m); i < (int)(n); ++i)
#define REPR(i, n) for (int i = (n)-1; i >= 0; --i)
#define REPR2(i, m, n) for (int i = (n)-1; i >= (m); --i)
#define REPx(x, a) for(auto x : a)
#define ALL(a) a.begin(), a.end()
#define SORT(a) sort(ALL(a))
#define SORTR(a) sort(ALL(a), greater<int>())
#define REVERSE(a) reverse(ALL(a))
#define bit_search(bit, n) REP(bit, 1<<(n))
#define bit_check(bit, i) (bit>>(i)) & 1
#define setpre(n) fixed << setprecision((n))
#define UNIQUE(a) do {SORT(a); (a).erase(unique(ALL(a)), (a).end());} while(0)
#define MAX(a) *max_element(ALL(a))
#define MIN(a) *min_element(ALL(a))
#define bisect_left(a, x) lower_bound(ALL(a), (x)) - a.begin()
#define bisect_right(a, x) upper_bound(ALL(a), (x)) - a.begin()
#define INPUT(a) REP(i, a.size()) cin >> a[i];
#define INPUTP(a) REP(i, a.size()) cin >> a[i].first >> a[i].second;
#define ENDL cout << endl;
using namespace std;
using LL = long long;
using LD = long double;
using PII = pair<int, int>;
using VPII = vector<PII>;
using PLL = pair<LL, LL>;
using VPLL = vector<PLL>;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VVLL = vector<VLL>;
using VC = vector<char>;
using VS = vector<string>;
using VB = vector<bool>;
using VD = vector<double>;
const LL INF = 1e18;
const LL MOD = 1e9 + 7;

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

void END(){cout << "Yes" << endl; exit(0);}

int main()
{
 cin.tie(0);
 ios::sync_with_stdio(false);
 int r;
 cin >> r;
 cout << r * r << endl;

 return 0;
}

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

int main() {
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    ll sum = a + b;
    ll ans = 0;
    if(c - sum <= 1) {
        ans += (b+c);
    } else {
        ans += (sum+1+b);
    }
    printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 256
def swap(l, i, j):
    tmp = l[i]
    l[i] = l[j]
    l[j] = tmp
    return l

def selection_sort(l):
    cnt = 0
    for i in range(len(l)):
        minj = i
        for j in range(i + 1, len(l)):
            if l[j] < l[minj]:
                minj = j
        if i != minj:
            swap(l, i, minj)
            cnt += 1
    return l, cnt

if __name__ == '__main__':
    N = int(input())
    l = list(map(int, input().split()))

    sl, cnt = selection_sort(l)
    print(' '.join(map(str, sl)))
    print(cnt)



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
int main(){
  ll n,m;
  cin>>n>>m;
  vll a(n),b(n),c(m),d(m);
  for (ll i=0;i<n;i++) cin>>a[i]>>b[i];
  for (ll i=0;i<m;i++) cin>>c[i]>>d[i];
  ll min,index;
  for (ll i=0;i<n;i++) {
    min=1000000000;
    for (ll j=0;j<m;j++) {
      if (min>abs(a[i]-c[j])+abs(b[i]-d[j])) {
        min=abs(a[i]-c[j])+abs(b[i]-d[j]);
        index=j+1;
      }
    }
    cout<<index<<endl;
  }
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#define N 1000

int LCS(char X[], char Y[]){
  int m, n, max, i, j;
  int c[N+1][N+1];

  m = strlen(X);
  n = strlen(Y);
  max = 0;

  X[m+2] = '\0';
  for( i = m+1 ; i > 0 ; i-- ){
    X[i] = X[i-1];
  }
  X[0] = ' ';

  Y[n+2] = '\0';
  for( i = n+1 ; i > 0 ; i-- ){
    Y[i] = Y[i-1];
  }
  Y[0] = ' ';

  for( i = 0 ; i <= m ; i++ ) c[i][0] = 0;
  for( j = 0 ; j <= n ; j++ ) c[0][j] = 0;


  for( i = 1 ; i <= m ; i++ ){
    for( j = 1 ; j <= n ; j++ ){
      if( X[i] == Y[j] ) c[i][j] = c[i-1][j-1] + 1;
      else {
        c[i][j] = fmax(c[i-1][j], c[i][j-1]);
      }
      max = fmax(max, c[i][j]);
    }
  }
  return max;
}

int main(){
  char str1[N], str2[N];
  int n, i;

  scanf("%d",&n);

  for( i = 0 ; i < n ; i++ ){
    scanf("%s%s",str1,str2);
    printf("%d\n",LCS(str1,str2));
  }
  return 0;
}



Measured memory_bytes: 5676
n = int(input())
lst = []
for i in range(n):
    lst.append(input())

unilen = len(list(set(lst)))
if unilen != len(lst):
    print("No")
    exit()


for i in range(1, n):
    if lst[i-1][-1] == lst[i][0]:
        pass
    else:
        print("No")
        exit()

print("Yes")
    

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

int main(){
    string S;
    cin >> S;
    int N = S.size();
    
    int ans = 0;

    // 直前が1文字だったかのフラグ
    bool one = false;
    // 今から見るインデックス
    int pt = 0;
    
    while(pt < N){
        // 残り2文字でその2文字が同じなら特別ルール適用
        if(pt == N-2 && S[pt] == S[pt+1]){
            ans++;
            break;
        }
        // 1文字で取れないなら2文字、取れるなら1文字で取る
        if(one && S[pt] == S[pt-1]){
            ans++;
            pt += 2;
            one = false;
        }else{
            ans++;
            pt++;
            one = true;
        }
    }
    
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 640
using namespace std;
#define _CRT_SECURE_NO_WARNINGS
#pragma target("avx")
#pragma optimize("O3")
#pragma optimize("unroll-loops")
#include<iostream>
#include<algorithm>
#include<ctime>
#include<vector>
#include<string>
#include<cmath>
#include<map>
#include<iomanip>
#include<numeric>
#include<queue>
#include<deque>
#include<cfloat>
#include<functional>
#include<tuple>
#include<math.h>
#include<bitset>
#include<stack>
#include<set>
#include<random>
#include<stdlib.h>
#define rip(i,n) for(ll i=0;i<n;i++)
#define Rip(i,n) for(ll i=1;i<n;i++)
#define all(V) V.begin(),V.end()
#define ll long long
#define ld long double
#define MOD 998244353
#define mod MOD
#define sec setprecision
constexpr double eps = 1e-9;
constexpr double PI = 3.141592653589793238462643383279;
ll gcd(ll a, ll b) {
	if (a % b == 0)	return(b);
	else return(gcd(b, a % b));
}
ll lcm(ll a, ll b)
{
	return a * b / gcd(a, b);
}
int ketasuu(ll h) {
	if (h < 0)return(-(ketasuu(-h)));
	else if (h < 10)return(1);
	else return(1 + ketasuu(h / 10));
}
const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];
void cominit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (ll i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}
vector<ll> soinnsuubunnkai(ll n) {
	vector<ll>a;
	while (n % 2 == 0) {
		a.push_back(2);
		n /= 2;
	}
	ll f = 3;
	while (f * f <= n) {
		if (n % f == 0) {
			a.push_back(f);
			n /= f;
		}
		else f += 2;
	}
	if (n != 1)
		a.push_back(n);
	return(a);
}
// 二項係数計算
long long com(ll n, ll k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}
ll pow(ll a, ll b) {
	a = a % mod;
	if (b == 0)return(1);
	else if (b % 2 == 0)return(pow((a * a) % mod, b / 2));
	else return(a * (pow(a, b - 1)));
}
void solve() {
	int a, b,c;
	cin >> a >> b>>c;
	a -= b;
	cout << max(0, c - a) << endl;
}
int main() {
	solve();
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main() {
 
    /**
     * Escreva a sua solução aqui
     * Code your solution here
     * Escriba su solución aquí
     */
     int N,H,M,S;
    scanf("%d",&N);
    H = N/3600;
    M = (N-H*3600)/60;
    S = N-H*3600-M*60;
    printf("%d:%d:%d\n",H,M,S);
 
    return 0;
}


Measured memory_bytes: 2112
#include<stdio.h>
#include<algorithm>
using namespace std;
long long dist[40];
int main(){
	long long a,b,c,d,e,f;
	scanf("%lld%lld%lld%lld%lld%lld",&a,&b,&c,&d,&e,&f);
	if(c==1&&d==1){
		long long v=b%(e+f);
		long long g=b/(e+f);
		long long ret=v+max(0LL,g-a)*(e+f);
		g++;
		v=e+f-v;
		ret=min(ret,v+max(0LL,g-a)*(e+f));
		printf("%lld\n",ret);
		
		return 0;
	}
	int sz=0;
	for(int i=0;i<a;i++){
		long long L=e;
		long long R=f;
		long long Q=b;
		for(int j=0;j<i;j++)Q/=max(c,d);
		if(Q==0)break;
		for(int j=0;j<i;j++)L*=c;
		for(int j=0;j<i;j++)R*=d;
		long long t=L+R;
		if(t>b*2)break;
		dist[sz++]=t;
	//	printf("%lld ",dist[sz-1]);
	}
	if(d==1){
		swap(c,d);
		swap(e,f);
	}
	if(c==1){
		long long ret=b;
		for(int i=0;i<sz;i++)dist[i]-=e;
		for(int i=1;i<=sz;i++){
			long long tmp=b-(long long)i*e;
			if(tmp<0)break;
			int rem=i;
			for(int j=sz-1;j>=0;j--){
				if(tmp>=dist[j]){
					rem--;
					tmp-=dist[j];
				}else{
					long long cost=dist[j]-tmp;
					if(rem-1<=j){
						for(int k=0;k<rem-1;k++){
							cost+=dist[k];
						}
				//		printf("%d %d: %lld\n",i,j,cost);
						ret=min(ret,cost);
					}
				}
				if(rem==0)break;
			}
			
			if(rem==0)ret=min(ret,tmp);
			//printf("%d: %lld\n",i,ret);
		}
		printf("%lld\n",ret);
		return 0;
	}
	long long ret=b;
	long long tmp=b;
	for(int i=sz-1;i>=0;i--){
		if(tmp>=dist[i])tmp-=dist[i];
		else ret=min(ret,dist[i]-tmp);
		ret=min(ret,tmp);
	}
	printf("%lld\n",ret);
}
//11 12 14 18

Measured memory_bytes: 1024
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[][] x = new int[n][n];
        int[][] y = new int[n][n];
        
        for (int i = 0; i < n; i++) {
            int a = sc.nextInt();
            for (int j = 0; j < a; j++) {
                x[i][j] = sc.nextInt() - 1;
                y[i][j] = sc.nextInt();
            }
            x[i][a] = 999;
            y[i][a] = 999;
        }
        
        int combinationCount = (int)Math.pow(2, n);
        int max = 0;
        for (int i = 0; i < combinationCount; i++) {
            boolean ng = false;
            int count = 0;
            String binaryNumber = Integer.toBinaryString(i);
            while (binaryNumber.length() < n) {
                binaryNumber = "0" + binaryNumber;
            }
            
            for (int j = 0; j < n; j++) {
                int num = Integer.valueOf(String.valueOf(binaryNumber.charAt(j)));
                
                if (num == 1) {
                    for (int k = 0; k < n; k++) {
                        if (x[j][k] == 999) break;
                        
                        if (y[j][k] != Integer.valueOf(String.valueOf(binaryNumber.charAt(x[j][k])))) {
                            ng = true;
                        }
                    }
                }
            }
            
            if (!ng) {
                for (int j = 0; j < n; j++) {
                    if (Integer.valueOf(String.valueOf(binaryNumber.charAt(j))) == 1) {
                        count++;
                    }
                }
                
                max = Math.max(max, count);
            }
        }
        
        System.out.println(max);
    }
}


Measured memory_bytes: 62040