akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  string s;
  cin >> s;
  if (s == "Sunny") cout << "Cloudy" << endl;
  if (s == "Cloudy") cout << "Rainy" << endl;
  if (s == "Rainy") cout << "Sunny" << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl; 
#define INF 1000000000
#define mod 1000000007
using ll=long long;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
#define int ll

ll n,k,sum;
vector<ll> a;

bool f(int idx){
    bool dp[5001]={};
    dp[0]=true;
    rep(i,n){
        if(i==idx) continue;
        for(int j=5000;j>=0;j--){
            if(dp[j] and j+a[i]<=5000){
                dp[j+a[i]]=true;
            }
        }
    }
    bool f=true;
    for(int i=k-1;i>=0;i--)if(dp[i]){
        if(i+a[idx]>=k) f=false;
    }
    
    // cout<<idx<<" "<<a[idx]<<" : "<<f<<endl;
    // rep(i,8)cout<<i<<" : "<<dp[i]<<endl;
    return f;
}

int ans=-1;
void solve(int l,int r){
    if(l>r) return ;
    int mid=(l+r)/2;
    if(f(mid)){
        chmax(ans,mid);
        solve(mid+1,r);
    }else{
        solve(l,mid-1);
    }
}

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

    cin>>n>>k;
    a.resize(n);
    rep(i,n){
        cin>>a[i];
        sum+=a[i];
    }
    sort(ALL(a));
    if(sum<k){
        cout<<n<<endl;
        return 0;
    }
    solve(0,n-1);
    cout<<ans+1<<endl;
    return 0;
}


Measured memory_bytes: 384
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include<stack>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) for(auto r:v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define pc() pop_back()
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
using namespace std;
#define ll long long
#define endl '\n'
#define st stack<int>
#define vi vector<int>
#define vb vector<bool>
#define pii pair<int,int>
#define mod 1000000007
#define ss second
#define ff first> 
#define vpii vector<pii>
#define vvi vector<vi>
#define vs vector<string>
#define mii map<int,int>

int power(int a, int b) {
    int res = 1;
    while (b != 0) {
        if (b & 1) {
            res *= a;
        }
        a = (a * a);
        b = (b / 2);
    }
    return res;
}
template<typename T, typename U> inline void amin(T& x, U y) { if (y < x) x = y; }
template<typename T, typename U> inline void amax(T& x, U y) {
    if (x < y) x = y;
}
bool comp(int n) {
    vi v(4);
    int i = 0;
    while (n) {
        v[i] = n % 10;
        n /= 10;
        i++;


    }
    set<int> s(all(v));
    if (s.size() != 4) return false;
    else return true;
}
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, k;
    cin >> n >> k;
    vvi v(n, vi(2));
    rep(i, n) {
        rep(j, 2) cin >> v[i][j];
    }
    
    vector<vector<ll>> dp(n, vector<ll>(k + 1, 0));
    sort(all(v));
    

    reu(i, v[0][0], k + 1) dp[0][i] = v[0][1];
    reu(i, 1, n) {
        rep(j, k + 1) {
            if (j < v[i][0]) dp[i][j] = max(dp[i-1][j],dp[i][j]);
            //else if (j>v[0][0]&&j < v[i][1]) dp[i][j] = v[i - 1][j];
            else(dp[i][j] = max(dp[i-1][j], v[i][1]+ dp[i - 1][j - v[i][0]]));


        }
    }
    
    
    cout << dp[n - 1][k] << endl;
}

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

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

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

ll h, w, n, s_r, s_c, sl, sr, sd, su, tl, tr, td, tu;
string s, t;

int main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    cin >> h >> w >> n >> s_r >> s_c >> s >> t;
    s = " " + s, t = " " + t;
    for (int i = 1; i <= n; i++){
        if (s[i] == 'U') su++;
        else if (s[i] == 'D') sd++;
        else if (s[i] == 'L') sl++;
        else if (s[i] == 'R') sr++;
        if (s_r + (sd - tu) > h || s_c + (sr - tl) > w){
            //cout << s_r + (sd - tu) << " " << s_c + (sr - tl) << endl;
            //cout << endl << "loai 1 " << i << endl;
            cout << "NO";
            return 0;
        }
        else if (s_r - (su - td) <= 0 || s_c - (sl - tr) <= 0){
            //cout << s_r - (su - td) << " " << s_c - (sl - tr) << endl;
            //cout << endl << "loai 2 " << i << endl;
            cout << "NO";
            return 0;
        }
        if (t[i] == 'U'){
            tu++;
            if (s_r - (tu - sd) <= 0) tu--;
        }
        else if (t[i] == 'D'){
            td++;
            if (s_r + (td - su) > h) td--;
        } 
        else if (t[i] == 'L'){
            tl++;
            if (s_c - (tl - sr) <= 0) tl--;
        } 
        else if (t[i] == 'R'){
            tr++;
            if (s_c + (tr - sl) > w) tr--;
        } 
    }
    cout << "YES";
    return 0;
}

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

// macro
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define all(v) v.begin(), v.end()

// code starts
int main()
{
  int n;
  cin >> n;
  ll ans = 0;
  ll i;
  for(i=1;i*i<=n;i++)
  {
    ll to = n/i;
    ans += (to*(to+1)-i*(i-1))*i-i*i;
  }
  cout << ans << "\n";
}



Measured memory_bytes: 3596
import java.io.File;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Deque;
import java.util.Scanner;

/*
 * メモ
 * Scanner:nextは空白か改行までの単語
 * String[][] c = new String[h][w];
 * TemplateMain,"template_input.txt"
 * 0.5 == 1.0/2
 * Integer.valueOf(char)はダメ、(String)
 */

public class Main {
	
	public static void printlnYN(boolean b){
		System.out.println(b?"Yes":"No");
	}

	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner sc = new Scanner(file);
		
		Scanner sc = new Scanner(System.in);
 
    	int H = sc.nextInt();
    	int W = sc.nextInt();
    	int sy = 0;
    	int sx = 0;
    	int gy = H-1;
    	int gx = W-1;
    	String[][] map = new String[H][W];
    	boolean[][] check = new boolean[H][W];
    	int siros = 0;
    	for(int i = 0; i < H; i++){
    		String line = sc.next();
    		for(int j = 0; j < W; j++){
    			map[i][j] = String.valueOf(line.charAt(j));
    			if(map[i][j].equals(".")) siros++;
    			check[i][j] = false;
    		}
    	}
    	
    	Deque que = new ArrayDeque<int[]>();
    	int[] start = {sy, sx, 0};
    	que.addLast(start);
    	
    	int ans = -1;
    	
    	while(true){
    		int[] p = (int[])que.pollFirst();
    		if(p == null) break;
    		
    		int y = p[0];
    		int x = p[1];
    		int count = p[2];
    		
    		if(y == gy && x == gx){
    			ans = count;
    			break;
    		}
    		
    		if(y-1 >= 0 && map[y-1][x].equals(".") && !check[y-1][x]){
    			check[y-1][x] = true;
    			int[] next = {y-1, x, count+1};
    			que.addLast(next);
    		}
    		
    		if(y+1 < H && map[y+1][x].equals(".") && !check[y+1][x]){
    			check[y+1][x] = true;
    			int[] next = {y+1, x, count+1};
    			que.addLast(next);
    		}
    		
    		if(x-1 >= 0 && map[y][x-1].equals(".") && !check[y][x-1]){
    			check[y][x-1] = true;
    			int[] next = {y, x-1, count+1};
    			que.addLast(next);
    		}
    		
    		if(x+1 < W && map[y][x+1].equals(".") && !check[y][x+1]){
    			check[y][x+1] = true;
    			int[] next = {y, x+1, count+1};
    			que.addLast(next);
    		}
    	}
    	
    	if(ans == -1) System.out.println(-1);
    	else System.out.println((siros-ans-1));
    	
    	
	}
}

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


int main(){
    int n,m,a,b;
    cin >> n >> m;
    int cnt = 0;
  	int mi = 1e9;
  	int ma = -1;
    for (int i = 0; i < m; ++i)
    {
        cin >> a >> b;;
		ma = max(ma,a);
      	mi = min(mi,b);
    }
	
        cout << (mi>=ma? mi - ma + 1:0) << endl;
    
}



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

#define int long long

using namespace std;

int n;
priority_queue<int, vector<int>, greater<int>> pq;
signed main(){
    cin >> n;
    for(int i = 1; i <= 9; ++i){
        pq.push(i);
    }
    int cnt = 0, ans = 0;
    while(cnt < n){
        int cur = pq.top();
        // cout << cur << " ";
        pq.pop();
        if(cur%10 != 0){
            pq.push(cur * 10 + cur%10 - 1);
        }
        if(cur%10 != 9){
            pq.push(cur * 10 + cur%10 + 1);            
        }
        pq.push(cur * 10 + cur%10);
        ans = cur;
        cnt++;
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 2420
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, x;
    cin >> N >> x;
    int a[110];
    rep(i, N) cin >> a[i];
    sort(a, a + N);
    int ans = 0;
    rep(i, N - 1) {
        if (x - a[i] >= 0) {
            x -= a[i];
            ans++;
        }
    }
    if (x == a[N - 1]) ans++;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void) {

	int N;
	int A[200000];
	int result[200000];

	// 社員数を入力
	scanf("%d", &N);

	// resultを初期化
	for (int i = 1; i <= N; i++) {
		result[i] = 0;
	}


	// Aの値を配列に入力
	for (int i = 1; i < N; i++) {
		scanf("%d", &A[i]);

	}

	for (int i = 1; i < N; i++) {
		result[A[i]]++;
	}


	//　直属の部下の人数を改行区切りで出力
	for (int i = 1; i <= N; i++) {
		printf("%d\n", result[i]);
	}

	return 0;
}

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

int main(){
    int H, W, D;
    cin >> H >> W >> D;
    vector<vector<int>> A;
    A = vector<vector<int>>(H+1, vector<int>(W+1,0));
    vector<pair<int,int>> P(H*W+1);
    for(int i=1; i<=H; i++) for(int j=1; j<=W; j++){
        cin >> A[i][j];
        P[A[i][j]].first = i;
        P[A[i][j]].second = j;
    }

    vector<int> mp(H*W+1);
    for(int i=1; i<=H*W; i++){
        if(i-D<1) mp[i] = 0;
        else{
            int xn, yn, xp, yp;
            xn = P[i].first;  yn = P[i].second;
            xp = P[i-D].first;  yp = P[i-D].second;
            mp[i] = mp[i-D] + abs(xn-xp) + abs(yn-yp);
        }
    }

    int Q; cin >> Q;
    while(Q>0){
        int L, R;  cin >> L >> R;
        cout << mp[R] - mp[L] << endl;
        Q--;
    }
}


Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
int main()
{
  ll N;cin >> N;
  vector<ll>A(N);
  ll sum=0;
  rep(i,N){
     ll a;cin >> a;
     sum+=a;
     A[i]=a;
  }
  ll ad=N*(N+1)/2;
  if(sum%ad!=0){
     cout << "NO" << endl;
     return 0;
  }
  ll op=sum/ad;
  ll k=0;
  rep(i,N){
     ll cur=op-(A[(i+1)%N]-A[i]);
     if(cur<0||cur%N!=0){
        cout << "NO" << endl;
        return 0;
     }
     k+=cur/N;
  }
  if(op==k){
     cout << "YES" << endl;
  }
  else{
     cout << "NO" << endl;
  }

  return 0;
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;
using ll = long long;
using ld = long double;

#define ALL(x) begin(x), end(x)
#define REP(i, n) for (size_t i = 0, i##_len = (n); i < i##_len; ++i)

void solve(ll N) {
  cout << (N < 1000 ? "ABC" : "ABD") << endl;
}

int main() {
  ll N;
  cin >> N;
  solve(N);
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstddef>
#include<queue>
#include<math.h>
#include<iomanip>
using namespace std;

int main()
{
    int n, ans = 0;
    cin >> n;
    ans = n % 1000;
    if(ans != 0)ans = 1000 - ans;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3632
order = (2..13).to_a << 1
a, b = gets.split.map(&:to_i)
id_a = order.index(a)
id_b = order.index(b)

if id_a > id_b
  puts 'Alice'
elsif id_a == id_b
  puts 'Draw'
else
  puts 'Bob'
end


Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimization ("Ofast")
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,n) for(int i=1;i<n;i++)
#define all(v) v.begin(),v.end()
#define P pair<int,int>
#define siz(s) (int)s.size()

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;
}
template<class T> inline int getidx(vector<T> &v, T a) {
	return lower_bound(all(v), a) - v.begin();
}

constexpr int mod=1e9+7;
constexpr int inf=3e18;


signed main(){
	cin.tie(0);ios::sync_with_stdio(false);
	double n;cin>>n;
	printf("%.12lf\n",n*2*3.14159265);
}


Measured memory_bytes: 3804
# D - Sum of Divisors
N = int(input())

# 1と自分自身はかならず約数になるので、計算から除外
f = [2] * (N + 1)

for i in range(2, N//2 + 1):
	j = 2
	
	while True:
		if i * j <= N:
			f[i*j] += 1
			j += 1
		else:
			break

ans = 1

for i in range(2, N + 1):
	ans += f[i] * i

print(ans)


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

#define int long long

const int maxn = 1e4 + 5, mod = 1e9 + 7;
int a[maxn];
map <int, int> M;

int Po(int A, int B) {
	if (!B)
		return 1;
	int Y = Po(A, B / 2);
	Y *= Y;
	Y %= mod;
	if (B % 2)
		return Y * A % mod;
	return Y;
}

int32_t main() {
	int n;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		int T = a[i];
		for (int j = 2; j * j <= T; j++) {
			int q = 0;
			while (T % j == 0) {
				q++;
				T /= j;
			}
			if (q)
				M[j] = max(M[j], q);
		}
		if (T)
			M[T] = max(M[T], 1ll);
	}
	int Pi = 1;
	for (auto P: M) {
		Pi *= Po(P.first, P.second);
		Pi %= mod;
	}
	int ans = 0;
	for (int i = 0; i < n; i++) {
		ans += Pi * Po(a[i], mod - 2) % mod;
		ans %= mod;
	}
	cout << ans;
}


Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
 
int main()
	{
	int N;
  	int K;
  	int d;
  	cin >> N >> K;
  	int sunuke[N];
  	int motinusi;
  	int count=0;
  	for(int i=0;i<N;i++)
    {
    sunuke[i]=0;
    }
  
  	for(int i=0;i<K;i++)
    	{
      	cin >> d;
      	for(int j=0;j<d;j++)
        	{
          	cin >> motinusi;
          	sunuke[motinusi-1]=1;
        	}
    	}
	for(int i=0;i<N;i++)
    {
    if(sunuke[i]==0){count++;}
    }
  	cout << count <<endl;
	}

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

int main()
{
  long n,k;

  cin >> n >> k;

  n=n%k;

  while(true){
    long be_n=n;
    n=abs(n-k);

    if(be_n<=n){
      n=be_n;
      break;
    }
  }
  
  cout << n << endl;

  return 0;
}

Measured memory_bytes: 3608
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <numeric>

using namespace std;

int main()
{
	int r;
	cin >> r;
	if (r < 1200) {
		cout << "ABC" << endl;
	}
	else if (r < 2800) {
		cout << "ARC" << endl;
	}
	else {
		cout << "AGC" << endl;
	}
	return 0;
}


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

long long a[1005];
long long b[1005];
long long c[1005];

set<vector<long long>> st;
priority_queue<pair<long long, vector<long long>>> pq;

int main()
{
    long long x, y, z, k;
    cin >> x >> y >> z >> k;
    for(long long i = 0; i < x; ++i){
        cin >> a[i];
    }
    for(long long i = 0; i < y; ++i){
        cin >> b[i];
    }
    for(long long i = 0; i < z; ++i){
        cin >> c[i];
    }

    sort(a, a + x);
    reverse(a, a + x);
    sort(b, b + y);
    reverse(b, b + y);
    sort(c, c + z);
    reverse(c, c + z);

    st.insert(vector<long long>({0, 0, 0}));
    pq.push({a[0] + b[0] + c[0], vector<long long>({0, 0, 0})});
    for(long long i = 0; i < k; ++i){
        pair<long long, vector<long long>> res = pq.top();pq.pop();
        cout << res.first << "\n";

        long long n1 = 0, n2 = 0, n3 = 0;

        if(res.second[0] < x - 1){
            n1 = res.first - a[res.second[0]] + a[res.second[0] + 1];
        }
        if(res.second[1] < y - 1){
            n2 = res.first - b[res.second[1]] + b[res.second[1] + 1];
        }
        if(res.second[2] < z - 1){
            n3 = res.first - c[res.second[2]] + c[res.second[2] + 1];
        }

        if(n1 != 0 && !st.count(vector<long long>({res.second[0] + 1, res.second[1], res.second[2]}))){
            pq.push({n1, vector<long long>({res.second[0] + 1, res.second[1], res.second[2]})});
            st.insert(vector<long long>({res.second[0] + 1, res.second[1], res.second[2]}));
        }
        if(n2 != 0 && !st.count(vector<long long>({res.second[0], res.second[1] + 1, res.second[2]}))){
            pq.push({n2, vector<long long>({res.second[0], res.second[1] + 1, res.second[2]})});
            st.insert(vector<long long>({res.second[0], res.second[1] + 1, res.second[2]}));
        }
        if(n3 != 0 && !st.count(vector<long long>({res.second[0], res.second[1], res.second[2] + 1}))){
            pq.push({n3, vector<long long>({res.second[0], res.second[1], res.second[2] + 1})});
            st.insert(vector<long long>({res.second[0], res.second[1], res.second[2] + 1}));
        }
    }

    return 0;
}


Measured memory_bytes: 1280
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;
using LLONG = long long;
const LLONG MOD = 1000000007;

int main()
{
    int N, M; cin >> N >> M;
    int twoEven = max(0, N * (N - 1) / 2);
    int twoOdd = max(0, M * (M - 1) / 2);
    cout << twoEven + twoOdd << '\n';
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,x,y) for(int i=x;i<y;i++)
#define range(a) a.begin(),a.end()
#define print(A,n) rep(i,0,n){cout<<(i ? " ":"")<<A[i];}cout<<endl;
#define pprint(A,m,n) rep(j,0,m){print(A[j],n);}
const long mod=1e9+7;
const int size=2e5;
const int INF=1e9;
int main(){
	int N;cin>>N;
	int H[N];cin>>H[0];
	int temp=0;int ans=0;
	rep(i,1,N){
		cin>>H[i];
		if(H[i-1]>=H[i]) temp++;
		else{ ans=max(ans,temp);temp=0; }
	}cout<<max(ans,temp)<<endl;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define INF 100000000
#define rep(i,a,b) for(int (i)=a;(i)<(int)(b);(i)++)


int main(){
    int K,N;
    cin >> K >> N;
    vector<int> A(N,0);
    vector<int> dif(N,0);
    rep(i,0,N) cin >> A[i];
    dif[0] = A[0]+(K-A[N-1]);
    rep(i,1,N) dif[i] = A[i]-A[i-1];
    auto iter = max_element(dif.begin(),dif.end());
    cout << accumulate(dif.begin(),dif.end(),0)- *iter << endl;
}

Measured memory_bytes: 1792
#include <stdio.h>

int main() {
    int A,B,K,I;
    int ans[100];
    int ansnum = 0;
    scanf("%d%d%d",&A,&B,&K);
    if (A<B) {
        I = A;
    }else if(A>B){
        I = B;
    }else if(A==B){
        I = A;
    }
    
    for (int r = 1; I>=r; r++) {
        if((A%r== 0) && (B%r== 0)){
            ans[ansnum] = r;
           ansnum++;
        }
    }
    
    printf("%d",ans[ansnum-K]);
    return 0;
}

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

using namespace std;

int main() {
    int n;
    int tmp, ans = 0;
    string s, x, y;

    cin >> n >> s;

    for (int i = 1; i < s.size(); i++) {
        x = s.substr(0, i);
        y = s.substr(i, s.size()-i);
        tmp = 0;

        for (int j = 0; j < 26; j++) {
            if (x.find('a'+j) < s.size() && y.find('a'+j) < s.size()) {
                tmp++;
            }
        }

        ans = max(ans, tmp);
    }

    cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
H = [int(i) for i in input().split()]
high_score = 0
current_score = 0

for i in range(N - 1):
  if H[i] >= H[i+1]:
    current_score += 1
  else:
    if high_score < current_score:
      high_score = current_score
    current_score = 0

if high_score < current_score:
  high_score = current_score

print(high_score)

Measured memory_bytes: 14252
#include <iostream>
using namespace std;
int main(void){
    int x,y;
    cin >>x >>y;
    int a[]={0,2,0,1,0,1,0,0,1,0,1,0};
    
    if(a[x-1]==a[y-1]) cout <<"Yes";
    else cout <<"No";
    
    return 0;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for(int i=a; i<b; i++)
typedef pair<int, int> pii;
typedef vector<pii> vpii;
#define PB push_back
#define MP make_pair

#define V 41
#define E 412
#define L 500
vpii g[V]; //graph
char u[E][10]; //edge string
int ulen[E]; //edge string length
bool used[L][V];
char dp[L][V][L];
priority_queue<pii, vpii, greater<pii>> que; 

int main(){
	int n,m,s,t;
	while(scanf("%d%d%d%d", &n, &m, &s, &t), n){
		// clear graph
		for(vpii &es:g) es.clear();
		// load
		REP(i, m){
			int x, y; scanf("%d%d", &x, &y);
			g[x].PB(MP(y, i));
			scanf("%s", u[i]);
			ulen[i]=strlen(u[i]);
		}
		// reset dp table & closed
		REP(i, L) REP(j, V) used[i][j]=false;
		REP(i, L) REP(j, V) REP(k, L) dp[i][j][k]=0;
		que.push(MP(0, s));

		while(que.size()){
			int nowl = que.top().first, nowv = que.top().second; que.pop();
			if(used[nowl][nowv]) continue;
			used[nowl][nowv]=true;
			// printf("que: %d %d\n", nowl, nowv);
			for(pii &e:g[nowv]){
				int tov=e.first, ei = e.second;
				int el = ulen[ei], tol = nowl + el;
				if(tol >= L) continue;
				int cmp = 0; // old - new > 0 => old > new, vice versa
				if(!dp[tol][tov][0]) cmp=1; // not initialized yet
				if(!cmp){
					REP(i, nowl){
						if(dp[tol][tov][i]>dp[nowl][nowv][i]) cmp=1;
						if(dp[tol][tov][i]<dp[nowl][nowv][i]) cmp=-1;
						// if(!cmp) printf("at %d\n", i);
						if(cmp) break;
					}
				}
				if(!cmp){
					REP(i, el){
						if(dp[tol][tov][nowl+i]>u[ei][i]) cmp=1;
						if(dp[tol][tov][nowl+i]<u[ei][i]) cmp=-1;
						// if(!cmp) printf("at %d\n", nowl+i);
						if(cmp) break;
					}
				}
				// printf("\"%s\" %c \"%s+%s\"\n", dp[tol][tov], cmp>0?'>':cmp<0?'<':'=', dp[nowl][nowv], u[ei]);
				if(cmp > 0){ // when new string is smaller
					que.push(MP(tol, tov));
					// copy string
					REP(i, nowl) dp[tol][tov][i]=dp[nowl][nowv][i];
					REP(i, el) dp[tol][tov][nowl+i]=u[ei][i];
				}
			}
			// printf("result: %s\n", dp[nowl][nowv]);
		}

		int a=1;
		FOR(i, 2, L){
			if(dp[i][t][0]){
				if(!dp[a][t][0] || strcmp(dp[a][t], dp[i][t])>0){
					a=i;
				}
			}
		}
		if(a>240 || !dp[a][t][0]) printf("NO\n");
		else printf("%s\n", dp[a][t]);
	}
}



Measured memory_bytes: 13168
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = Integer.parseInt(scan.next());
        String s = scan.next();
        scan.close();

        String[] str = s.split("");

        // 累積和
        int[] rR = new int[n + 1];
        int[] gG = new int[n + 1];
        int[] bB = new int[n + 1];
        for (int i = 1; i <= n; i++) {
            if (str[i - 1].equals("R")) {
                rR[i] = rR[i - 1] + 1;
                gG[i] = gG[i - 1];
                bB[i] = bB[i - 1];
            } else if (str[i - 1].equals("G")) {
                rR[i] = rR[i - 1];
                gG[i] = gG[i - 1] + 1;
                bB[i] = bB[i - 1];
            } else {
                rR[i] = rR[i - 1];
                gG[i] = gG[i - 1];
                bB[i] = bB[i - 1] + 1;
            }
        }

        long count = 0;
        for (int i = 0; i < n; i++) {
            String a = str[i];
            for (int j = i + 1; j < n; j++) {
                String b = str[j];
                if (a.equals(b)) {
                    continue;
                }

                String c;
                if (a.equals("R") && b.equals("G")) {
                    c = "B";
                } else if (b.equals("R") && a.equals("G")) {
                    c = "B";
                } else if (a.equals("R") && b.equals("B")) {
                    c = "G";
                } else if (b.equals("R") && a.equals("B")) {
                    c = "G";
                } else {
                    c = "R";
                }

                if (c.equals("R")) {
                    count += rR[n] - rR[j + 1];
                    if (2 * j - i < n && str[2 * j - i].equals("R")) {
                        count--;
                    }
                } else if (c.equals("G")) {
                    count += gG[n] - gG[j + 1];
                    if (2 * j - i < n && str[2 * j - i].equals("G")) {
                        count--;
                    }
                } else {
                    count += bB[n] - bB[j + 1];
                    if (2 * j - i < n && str[2 * j - i].equals("B")) {
                        count--;
                    }
                }

            }
        }

        System.out.println(count);
    }

}


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


int main()
{
	string s;
	cin >> s;
	int l, r;
	l = s.find('C');
	r = s.rfind('F');
	if (l == -1 || r == -1 || l > r) {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")

#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()

using ll = long long;
using ull = unsigned long long;
using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    cout << a*b << endl;
    return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <tuple>
#include <bitset>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
struct Class {
	int length, satisfaction;
};
std::vector<int> cal_max_schedule(const int sec, const std::vector<std::vector<Class>>& classes, std::vector<std::vector<int>>memo) {
	if (sec == classes.size()) return std::vector<int>(classes.size() + 1, 0);
	if (!memo[sec].empty()) return memo[sec];
	memo[sec] = cal_max_schedule(sec + 1, classes, memo);
	for (const auto& c : classes[sec]) {
		auto next = cal_max_schedule(sec + c.length, classes, memo);
		for (auto i = 1; i < next.size(); ++i) {
			memo[sec][i] = std::max(memo[sec][i], next[i - 1] + c.satisfaction);
		}
	}
	return memo[sec];
}
std::vector<int> cal_one_day_schedule(const std::vector<std::vector<Class>>& classes) {
	return cal_max_schedule(0, classes, std::vector<std::vector<int>>(classes.size()));
}
int main() {
	int n, m, l; std::cin >> n >> m >> l;
	std::vector<std::vector<std::vector<Class>>> classes(5, std::vector<std::vector<Class>>(n));
	for (auto i = 0; i < m; ++i) {
		int d, a; std::cin >> d >> a;
		Class c; std::cin >> c.length >> c.satisfaction;
		classes[d][a - 1].push_back(c);
	}
	std::vector<int> max(l + 1, 0);
	for (const auto& c : classes) {
		auto m = cal_one_day_schedule(c);
		for (int i = l; i >= 0; --i) {
			for (auto j = 0; j < m.size() && i + j < max.size(); ++j) {
				max[i + j] = std::max(max[i + j], max[i] + m[j]);
			}
		}
	}
	std::cout << *std::max_element(max.begin(), max.end()) << std::endl;
}


Measured memory_bytes: 3180
def Printer(K, X):
    start = X - K+1
    ans = ''
    for start in range(start, X + K):
        ans += str(start) + ' '

    print (ans)

def main():
    inp = input()
    inp = inp.split()
    K = int(inp[0])
    X = int(inp[1])
    Printer(K, X)



if __name__ == "__main__":
    main()


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

#define int long long
#define INF ((int)1e18)
#define MOD ((int)(1e9) + 7)


signed main(){
  int a, b, d;
  while(true){
    pair<int,int> ans;
    ans.first = ans.second = INF;
    
    cin>>a>>b>>d;

    if(!a&&!b&&!d) break;

    for(int i = 0; i <= 50000; i++){
      int e, f;
      if((d + b*i)%a == 0){
	if((d + b*i)/a + i < ans.first + ans.second){
	  ans.first = (d + b*i)/a ;
	  ans.second = i;
	} else if ((d + b*i)/a + i == ans.first + ans.second){
	  if((d + b*i) + i*b < ans.first*a + ans.second*b){
	    ans.first = (d + b*i)/a ;
	    ans.second = i;
	  }
	}
      }
      if((d - b*i)%a == 0){
	if(abs(d - b*i)/a + i < ans.first + ans.second){
	  ans.first = abs(d - b*i)/a ;
	  ans.second = i;
	} else if (abs(d - b*i)/a + i == ans.first + ans.second){
	  if(abs(d - b*i) + i*b < ans.first*a + ans.second*b){
	    ans.first = abs(d - b*i)/a ;
	    ans.second = i;
	  }
	}
      }
    }

    cout<<ans.first<<" "<<ans.second<<endl;
  }
}


Measured memory_bytes: 3104
#include <bits/stdc++.h>
using namespace std;
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return 1;
    }
    return 0;
}
void debug() { cerr << "\n"; }
template <class T> void debug(const T &x) { cerr << x << "\n"; }
template <class T, class... Args> void debug(const T &x, const Args &... args) {
    cerr << x << " ";
    debug(args...);
}
template <class T> void debugVector(const vector<T> &v) {
    for(const T &x : v) {
        cerr << x << " ";
    }
    cerr << "\n";
}
using ll = long long;

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
const double EPS = 1e-7;
const int INF = 1 << 30;
const ll LLINF = 1LL << 60;
const double PI = acos(-1);
constexpr int MOD = 1000000007;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};

//-------------------------------------

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, a, b;
    cin >> n >> a >> b;
    double ans = 0.0;
    vector<ll> v(n);
    for(int i = 0; i < n; i++) {
        cin >> v[i];
    }
    sort(RALL(v));
    for(int i = 0; i < a; i++) {
        ans += v[i];
    }
    ans /= a;
    vector<vector<ll>> dp(60, vector<ll>(60, 0));
    {
        for(int i = 0; i < 60; i++) {
            dp[i][0] = dp[i][i] = 1;
        }
        for(int i = 2; i < 60; i++) {
            for(int j = 1; j < i; j++) {
                dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
            }
        }
    }
    int N = count(ALL(v), v[a - 1]);
    ll cnt = 0;
    if(v[0] == v[a - 1]) {
        for(int i = a; i <= b; i++) {
            cnt += dp[N][i];
        }
    } else {
        int cnt2 = 0;
        for(int i = 0; i < a; i++) {
            cnt2 += (v[i] == v[a - 1]);
        }
        cnt += dp[N][cnt2];
    }
    cout << fixed << setprecision(15);
    cout << ans << endl;
    cout << cnt << endl;
}

Measured memory_bytes: 3776
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define all(x) x.begin(), x.end()
typedef pair<int,int> pii;
typedef pair <long long,long long> pll;
typedef long long ll; 
typedef long double ld; 
const ll mod = 1e9+7;
int solve(vector <int> &v , int n ,  int k)
{
	vector <vector <ll> > dp(n+2, vector <ll> (k+2, 0));
	for(int j = 0; j <= k; j++)
		dp[1][j] = ( j > v[1]) ? 0 : 1 ;

	for(int i = 2; i <= n ; i++)
	{	for(int j = 0; j<= k ; j++)
		{	if(j == 0)
				dp[i][j] = dp[i-1][j];
			else
				dp[i][j] = (mod + dp[i][j-1] + dp[i-1][j] - ((j-v[i]-1 >= 0) ? dp[i-1][j-v[i]-1] : 0)) % mod;
		}
	}
	return dp[n][k];
}
int main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n,k; cin >> n >> k;
	vector <int> v(n+1);
	for(int i = 1; i < n+1 ;i++)
		cin >> v[i];
	cout<<solve(v , n , k);
	return 0;
}


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

using namespace std;

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

#define pb push_back
#define mp make_pair

ll a[4];
ll n;

int main()
{
    ios_base::sync_with_stdio(0);
    cin >> a[0] >> a[1] >> a[2] >> a[3];
    cin >> n;
    n *= 4;
    ll mincost = 1000000000000000000;
    for(int i = 0; i < 16; i++){
        vector<int> cur;
        for(int j = 0; j < 4; j++){
            if(i & (1 << j)) cur.pb(j);
        }
        reverse(cur.begin(), cur.end());
        ll t = n;
        ll cost = 0;
        for(auto u: cur){
            cost += (t / (1 << u)) * a[u];
            t %= (1 << u);
        }
        if(t == 0) mincost = min(mincost, cost);
    }
    cout << mincost << endl;
    return 0;
}


Measured memory_bytes: 256
from bisect import bisect_left
n, Q = list(map(int, input().split()))
stx = [list(map(int, input().split())) for i in range(n)]
q = [int(input()) for i in range(Q)]
stx.sort(key=lambda x: x[2])
ans = [-1 for i in range(Q)]
skip = [-1 for i in range(Q)]

for (s, t, x) in stx:
  begin = bisect_left(q, s-x)
  end = bisect_left(q, t-x)
  while begin<end:
    if skip[begin]==-1:
      ans[begin] = x
      skip[begin] = end
      begin += 1
    else:
      begin = skip[begin]
for e in ans:
  print(e)

Measured memory_bytes: 74252
#include<iostream>
using namespace std;
int main(){
	int x,a,b;
	cin>>x>>a>>b;
	int c=b-a;
	if(c<=0){
		cout<<"delicious"<<endl;
	}else if(c<=x){
		cout<<"safe"<<endl;
	}else{
		cout<<"dangerous"<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

using namespace std;

int main()
{
    int X;
    cin >> X;
    int max = 1;
    for (int b = 2; b <= X; ++b)
    {
        for (int p = 2;; ++p)
        {
            int tmp = pow(b, p);
            if (tmp > X)
            {
                break;
            }
            if (tmp > max)
            {
                max = tmp;
            }
        }
    }
    cout << max << endl;

    return 0;
}

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

typedef long long LL;

int main() {
    int N, K;
    cin >> N >> K;
    vector<LL> pos_c, neg_c;
    LL c;
    for (LL i = 0; i < N; i++)
    {
        cin >> c;
        if (c > 0)
            pos_c.push_back(c);
        else if (c < 0)
            neg_c.push_back(abs(c));
        else
            K--;
    }

    int s_pos_c = pos_c.size();
    int s_neg_c = neg_c.size();
    LL cost = 1e9;
    sort(neg_c.begin(), neg_c.end());
    if (K == 0)
        cost = 0;
    else if (K == 1)
        if (s_pos_c == 0) cost = neg_c[0];
        else cost = pos_c[0];
    else if (s_pos_c > 0 and s_neg_c > 0) {

        for (LL i = max(0, K - s_neg_c - 1); i < s_pos_c; i++)
            cost = min(cost, pos_c[i] + 2 * neg_c[K - i - 2]);

        for (LL i = max(0, K - s_pos_c - 1); i < s_neg_c; i++)
            cost = min(cost, neg_c[i] + 2 * pos_c[K - i - 2]);

    }
    else if (s_pos_c > 0)
        cost = pos_c[K - 1];
    else
        cost = neg_c[K - 1];

    cout << cost;

    return 0;
}

Measured memory_bytes: 1656
#include <iostream>
#include <iosfwd>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cassert>
#include <cctype>
#include <climits>
#include <vector>
#include <bitset>
#include <set>
#include <queue>
#include <math.h>
#include <stack>
#include <map>
#include <deque>
#include <string>
#include <list>
#include <iterator>
#include <sstream>
#include <complex>
#include <fstream>
#include <functional>
#include <numeric>
#include <utility>
#include <algorithm>
#include <assert.h>
#include <unordered_map>
#pragma GCC optimize ("-O3")
using namespace std;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL);
#define tolower(s) transform(s.begin(),s.end(),s.begin(),::tolower);
#define toupper(s) transform(s.begin(),s.end(),s.begin(),::toupper);
#define ll long long int
ll max(ll a, ll b) {  return a > b ? a : b; }
ll gcd(ll a, ll b) { if (a == 0) return b; return b == 0 ? a : gcd(b, a % b);}
#define case(i) cout<<"Case #"<<i<<": ";
#define debug(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) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) { cerr << "[ " << *it << " = " << a << " ]"; err(++it, args...); }
#define pii pair <ll , ll >
#define pb push_back
#define PRECISION 10
const ll inf = 1e16;
const int MAXN = 100001;
const int LOGN = 22;
const int MAXBIT = 61;
const int DIGITSIZE = 19;
ll mod = 1e9 + 7;
ll MOD = 998244353;
int x4[] = {1, -1, 0, 0};
int y4[] = {0, 0, 1, -1};
bool take_test_cases = false;
bool print_case_no = false;

void getac(int T) {
    int n,k;
    cin>>n>>k;
    int arr[n+1];
    memset(arr,0,sizeof(arr));
    for(int i=0;i<k;i++){
        int d;
        cin>>d;
        for(int j=0;j<d;j++){
            int x;
            cin>>x;
            arr[x]++;
        }
    }
    int ans=0;
    for(int i=1;i<=n;i++){
        if(arr[i]==0){
            ans++;
        }
    }
    cout<<ans;
}
int  main()
{

    fastio;
    int t = 1;
    if (take_test_cases) cin >> t;
    int t_t = 1;
    while (t--) {
        if (print_case_no)
        case (t_t);
        getac(t_t);
        t_t++;
    }
    return 0;
}

Measured memory_bytes: 3652
#include<iostream>
using namespace std;
short a,b,c,d=0,e[101]={0},f[101]={0};
int main(){
	cin>>a;
	for(short i=0;i<a;i++){
		cin>>e[i];
	}
	for(short i=0;i<a;i++){
		if(e[i+1]==e[i]&&e[i+1]==e[i+2]){
			e[i+1]=0;
			d++;
		}
		if(e[i+1]==e[i]&&e[i+1]!=e[i+2]){
			e[i]=0;
			d++;
		}		
	}
	cout<<d<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public	static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int taro = 0;
		int hanako = 0;
		for(int i = 0; i < n; i++) {
			String t = sc.next();
			String h = sc.next();
			int x = t.compareTo(h);
			if(x > 0) {
				taro += 3;
			}else if(x < 0) {
				hanako += 3;
			}else if(x == 0) {
				taro += 1;
				hanako  += 1;
			}
			
		}
		System.out.println(taro + " " + hanako);
	}
}



Measured memory_bytes: 29812
var input = function(){
  return input= require('fs').readFileSync('/dev/stdin', 'utf8').split(" ").map(Number);
  };

var out = function(x)
{
  console.log(x);
  return x;
}

var range = function(a,b)
{
  var array = [];
  for (var i = a; i <= b; i++) {
    array[i] = i;
  }
  return array;
}

var calc = function(x)
{
  var counter=0;

  range(x[0],x[1]).forEach(function(element)
  {
    if ((x[2] % element) == 0 )
    {
      counter = counter+1;
    }
  });
  out(counter);
};

calc(input());

Measured memory_bytes: 9356
// Undone
using System;
using System.Linq;
using System.Collections.Generic;
using System.Collections;
public class Program {
  public static void Main() {
    int X = ReadInt();
    if (X == 7 || X == 5 || X == 3) {
      Console.WriteLine("YES");
    } else {
      Console.WriteLine("NO");
    }
  }

  private static int ReadInt() { return int.Parse(Console.ReadLine()); }
  private static double ReadDouble() { return double.Parse(Console.ReadLine()); }
  private static long ReadLong() { return long.Parse(Console.ReadLine()); }
  private static char ReadChar() { return Console.ReadLine()[0]; }
  private static string[] ReadStringArray() { return Console.ReadLine().Split(' '); }
  private static int[] ReadIntArray() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
  private static double[] ReadDoubleArray() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
  private static long[] ReadLongArray() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
  private static char[] ReadCharArray() { return Console.ReadLine().ToArray(); }
}


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

class Hello
{
    public static void Main()
    {
        var s = Console.ReadLine();
        if(s.Length<=3)
        {
            Console.WriteLine("No");
            return;
        }
        Console.WriteLine(s.Substring(0, 4) == "YAKI" ? "Yes" : "No");
    }

}


Measured memory_bytes: 11092
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
  int n,m;
  string a="";
  string b="";
  string temp;

  cin >> n;
  temp="";
  for (int i = 0; i < n; i++){
    cin >> temp;
    a = a + temp;
  }

  cin >> m;
  temp="";
  for (int i = 0; i < m; i++){
    cin >> temp;
    b = b + temp;
  }

  //cout << a << endl;
  //cout << b << endl;

  if( lexicographical_compare(a.c_str(), a.c_str()+a.size(), b.c_str(), b.c_str()+b.size())){
    cout << "1" << endl;
  }else{
    cout << "0" << endl;
  }

  return 0;
}



Measured memory_bytes: 3208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    REP(i, n) cin >> a[i];
    vector<ll> col(n);
    vector<ll> ans(m, 1000000000);
    vector<vector<PII>> g(n);
    queue<ll> que;
    REP(i, m) {
        ll u, v;
        cin >> u >> v;
        u--, v--;
        g[u].push_back({v, i});
        g[v].push_back({u, i});
        if(a[u] == a[v]) {
            if(col[u] == 0 && col[v] == 0) {
                col[u] = -1;
                col[v] = 1;
                que.push(u);
                que.push(v);
                ans[i] = a[u];
            } else if(col[u] == 0) {
                col[u] = -col[v];
                que.push(u);
                ans[i] = a[u];
            } else if(col[v] == 0) {
                col[v] = -col[u];
                que.push(v);
                ans[i] = a[u];
            } else {
                ans[i] = a[u];
            }
        }
    }

    while(que.size()) {
        ll v = que.front(); que.pop();
        for(auto to: g[v]) {
            if(col[to.first] != 0) continue;
            if(a[to.first] < a[v]) continue;
            col[to.first] = -col[v];
            ans[to.second] = a[to.first];
            que.push(to.first);
        }
    }

    bool flag = true;
    REP(i, n) {
        if(col[i] == 0) flag = false;
    }

    if(!flag) cout << -1 << endl;
    else {
        REP(i, n) cout << (col[i]==-1?'W':'B');
        cout << "\n";
        REP(i, m) cout << ans[i] << "\n";
        cout << flush;
    }

    return 0;
}

Measured memory_bytes: 18176
mod stdin_reader {
  use std::io::stdin;
  use std::io::Read;

  pub struct StdinReader {
    pub buf: Vec<String>,
    pub cursor: usize,
  }

  pub fn new() -> StdinReader {
    StdinReader::new()
  }

  impl StdinReader {
    pub fn new() -> Self {
      let mut s = String::new();
      let stdin = stdin();
      stdin.lock().read_to_string(&mut s).unwrap();
      let buf = s.split_whitespace().map(|s| s.to_string()).collect();
      return StdinReader { buf: buf, cursor: 0 }
    }

    pub fn read_all(&self) -> Vec<String> {
      return self.buf.clone()
    }

    pub fn next(&mut self) -> Option<String> {
      let val = self.buf.get(self.cursor).cloned();
      self.cursor += 1;
      return val
    }

    pub fn as_i64(&mut self) -> Option<i64> {
      self.next().and_then(|s| s.parse::<i64>().ok())
    }

    pub fn as_f64(&mut self) -> Option<f64> {
      self.next().and_then(|s| s.parse::<f64>().ok())
    }

    pub fn as_usize(&mut self) -> Option<usize> {
      self.next().and_then(|s| s.parse::<usize>().ok())
    }
  }
}

mod utils {
  pub fn is_int(n: f64) -> bool {
    let trunc = (n.trunc() as i64) as f64;
    return (n - trunc) < 0.0001
  }
}

fn main() {
  // stdout
  use std::io::{stdout, Write, BufWriter};
  let stdout = stdout();
  let mut writer = BufWriter::new(stdout.lock());

  // stdin
  let mut reader = stdin_reader::new();

  let r = reader.as_i64().unwrap();
  println!("{}", 3 * r * r);
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i=(b) - 1;i>=(a);i--)
#define REP(i,n) for(int i=0;i<(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)

#define PB push_back
#define INF (1<<29)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define CLR(a) memset(a,0,sizeof(a))
#define fr first
#define sc second
const int dx[] = {-1,0,0,1},dy[] = {0,1,-1,0};

typedef long long int ll;

using namespace std;
double x[3],y[3];

void split(string s){
    vector<double> d;
    s += ",";
    int pos = -1;
    REP(i,s.size()){
	if(s[i] == ','){
	    d.PB(stod(s.substr(pos+1,i-pos-1)));
	    pos = i;
	}
    }
    REP(i,3){
	x[i] = d[2*i];
	y[i] = d[2*i+1];
    }
}

int main(){
    while(true){
	string s;
	cin >> s;
	if(cin.eof()) break;
	
	split(s);
	double xq,yq;
	xq = x[2] - x[0];
	yq = y[2] - y[0];
	/*
	printf("x[2] = %lf y[2] = %lf\n",x[2],y[2]);
	printf("x[1] = %lf y[1] = %lf\n",x[1],y[1]);
	printf("x[0] = %lf y[0] = %lf\n",x[0],y[0]);
	printf("xq = %lf yq = %lf\n",xq,yq);
	*/
	if(x[0]!=x[1]){
	    double angle = 0;
	    angle = atan( (y[1]-y[0])/(x[1]-x[0]) );
	    double txq,tyq;
	    txq = xq;
	    tyq = yq;
	    xq = txq * cos( -1*angle ) - tyq * sin( -1*angle);
	    yq = txq * sin( -1*angle ) + tyq * cos( -1*angle);
	    
	    yq *= -1.0;

	    txq = xq;
	    tyq = yq;
	    xq = txq * cos( angle ) - tyq * sin( angle);
	    yq = txq * sin( angle ) + tyq * cos( angle);
	    
	    xq += x[0];
	    yq += y[0];
	}else{
	    xq *= -1;
	    xq += x[0];
	    yq += y[0];
	}

	printf("%lf %lf\n",xq,yq);
    }
    return 0;
}

Measured memory_bytes: 3560
from collections import deque
N, M, *L = map(int, open(0).read().split())
dic = [[] for i in range(N+1)]
llog = set()
rlog = set()
for l,r,d in zip(*[iter(L)]*3):
  dic[l].append((r,d))
  llog.add(l)
  rlog.add(r)
log = llog.difference(rlog)
q = deque(log)
dist = [-1]*(N+1)
for c in log:
  dist[c] = 0
while q:
  v = q.popleft()
  flag = False
  for u,d in dic[v]:
    if dist[u]==-1:
      dist[u] = dist[v]+d
      q.append(u)
    elif dist[u]!=dist[v]+d:
      print('No')
      flag = True
      break
  if flag:
    break
else:
  U = llog.union(rlog)
  for c in U:
    if dist[c]==-1:
      print('No')
      break
  else:
    print('Yes')

Measured memory_bytes: 70028
import java.util.Arrays;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
	static Map<Integer, Integer> map = new LinkedHashMap<>();

	@SuppressWarnings("resource")
	public static void main(String args[]) {
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();
		String t = scanner.next();
		char s1[]=new char[s.length()];
		char t1[]=new char[t.length()];
		
		for(int i=0;i<s.length();i++) {
			s1[i]=s.charAt(i);
		}
		Arrays.sort(s1);
		
		for(int i=0;i<t.length();i++) {
			t1[i]=t.charAt(i);
		}
		Arrays.sort(t1);
		
		
		int cnt=0;
		for(int i=0;i<Math.min(s.length(), t.length());i++) {
			if(s1[i]<t1[t.length()-1-i]) {
				System.out.println("Yes");
				return;
			}else if(s1[i]==t1[t.length()-1-i]) {
				cnt++;
			}else {
				System.out.println("No");
				return;
			}
		}
		if(cnt==Math.min(s.length(), t.length())&&s.length()<t.length()) {
			System.out.println("Yes");
			return;
		}
		if(cnt==Math.min(s.length(), t.length())&&s.length()>=t.length()) {
			System.out.println("No");
			return;
		}
		
		System.out.println("Yes");

	}

}

Measured memory_bytes: 23252