akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>   
#define ll long long
#define sz size
#define pb push_back
#define x first
#define y second
#define er erase
#define in insert
#define mp make_pair
#define pi pair
#define int long long    
#define rc(s) return cout<<s,0
using namespace std;


int n,m;
signed main(){ 
    ios_base::sync_with_stdio(0);  cin.tie(); cout.tie();
    cin >> n >> m;
    int x=m/n;
    int ans=0;
    for(int i=x;i>=1;i--){
        if(m%i==0) rc(i);
    }
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(void)
{
  int N;
  int a[101] = {0};
  int player[2] = {0};

  cin >> N;
  for(int i = 0; i < N; i++){
    int tmp;
    cin >> tmp;
    a[tmp]++;
  }
  
  int player_index = 0;
  for(int i = 0; i < N; i++){
    int max_index = 0;
    for(int j = 0; j <= 100; j++){
      if(a[j]){
	max_index = j;
      }
    }
    player[player_index] += max_index;
    a[max_index]--;
    player_index = 1 - player_index;
  }

  cout << (player[0] - player[1]) << endl;
  return 0;
}


Measured memory_bytes: 256
import kotlin.math.absoluteValue

fun main() {
    val (x, k, d) = readLine()!!.trim().split(' ').map(String::toLong)

    val step = x.absoluteValue / d
    val pos = x.absoluteValue % d
    if (step >= k) {
        println(x.absoluteValue - k * d)
    }else {
        val rest = (k - step) % 2
        println(
            if (rest == 0L) pos
            else (pos - d).absoluteValue
        )
    }
}

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

int main() {
	int	N;
	cin >> N;
	map<string, int> m;
	rep(i, N)
	{
		int	a;
		string b;
		cin >> a >> b;
		if (a == 0)
		{
			int c;
			cin >> c;
			m[b] = c;
		}
		else
			cout << m.at(b) << endl;
	}
}



Measured memory_bytes: 27828
#include<iostream>
#include<queue>
#include<cstring>
using namespace std;
int a[1005][1005],n,m;
long long b[1005][1005];
int move[3][5]={0,0,0,0,0,0,1,0,-1,0,0,0,-1,0,1};
struct node{
	int x,y;
}p,f;
queue<node> q;

int main()
{
	char c;
	bool flag;
	int i,j,k,dx,dy;
	long long ans=0;
	cin>>n>>m;
	for(i=1;i<=n;i++)
		for(j=1;j<=m;j++){
			cin>>c;
			if(c=='#'){
				a[i][j]=1;
				p.x=i;p.y=j;
				q.push(p);
			}
			else a[i][j]=0;	
		}
		
	while(!q.empty()){
		f=q.front();
		for(i=1;i<=4;i++){
			dx=move[1][i]+f.x;
			dy=move[2][i]+f.y;
			if(dx>=1 && dx<=n && dy>=1 && dy<=m && !a[dx][dy]){
				a[dx][dy]=1;
				p.x=dx;p.y=dy;
				q.push(p);
				b[dx][dy]=b[f.x][f.y]+1;
			}
		}
		ans=max(ans,b[f.x][f.y]);
		q.pop();
	}
	
	cout<<ans;
	return 0;
 } 

Measured memory_bytes: 17024
#include <bits/stdc++.h>
#include <string.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for(int i = m; i < n; i++) 
#define mod 1000000007
#define pi 3.1415926535
typedef long long ll;

int main(){
    int N,K;
    cin>>N>>K;
    if(K==1){
        cout<<0<<endl;
    }else{
        cout<<N-K<<endl;
    }
    return 0;
}

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

int N;

int main()
{
    cin >> N;
    for (int nnn = 0; nnn < N; nnn++)
    {
        long long a, b;
        cin >> a >> b;
        if (a<b) swap(a, b);

        long long res = 2 * (b - 1);
        
        if (a != b)
        {
            long long sqr = sqrt(a * b);
            if (sqr * sqr == a * b)
            {
                res += (sqr - b) * 2 - 1;;
            }
            else
            {
                res += (sqr - b) * 2 + 1;
                if (sqr * (sqr+1) >= a * b) res--;
            }
        }
        cout << res << endl;
    }
    return 0;
}

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

int main(void){
    string a, b, c;
    cin >> a >> b >> c;
    a.at(0) = a.at(0) + ('A' - 'a');
    b.at(0) = b.at(0) + ('A' - 'a');
    c.at(0) = c.at(0) + ('A' - 'a');
    cout << (char)a.at(0) << (char)b.at(0) << (char)c.at(0) << endl;
}


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_cond=(n);i<i##_cond;i++)
#define FOR(i,a,b) for(int i=(a),i##_cond=(b);i<i##_cond;i++)
#define ROF(i,a,b) for(int i=(a)-1,i##_cond=(b);i>=i##_cond;i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second

typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<ll,ll> pii;

int main(){
  vector<char> s(3); rep(i,3) cin >> s[i];
  sort(all(s));
  if(s[0]=='a' and s[1]=='b' and s[2]=='c') cout << "Yes\n";
  else cout << "No\n";
}

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

int main()
{
  int a, b, c;
  cin >> a >> b >> c;

  if(a == b and b == c){
    if(a%2) cout << 0 << endl; 
    else cout << -1 << endl;
    return 0;
  }

  int ans = 0;
  while(a%2 == 0 and b%2 == 0 and c%2 == 0){
    ans++;
    int na = (b + c) / 2;
    int nb = (a + c) / 2;
    int nc = (a + b) / 2;
    a = na; b = nb; c = nc;
  }

  cout << ans << endl;

  return 0;
}


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


int main(void) {
    int n;
    cin >> n;
    int ans = 0;
    for(int i = 1;i <= n;i++){
        string i_str = to_string(i);
        if( i_str.size() % 2 != 0)ans ++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define hell  1000000007
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pb   push_back


int main()
{
	ios;
	ll x;
	cin>>x;
	for(ll i=-200;i<=200;i++)
	{
		ll add=1,t=5,check=1;
		for(ll cnt=1;cnt<=5;cnt++)add*=i;

		for(ll j=-200;j<=200;j++)
		{
			check=1;
			for(ll cnt=1;cnt<=5;cnt++)check*=j;

			if(add-check==x)
			{
				cout<<i<<' '<<j;
				// cout<<x+check<<' '<<add;
				return 0;
			}
		}
	}
}

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

long long a[100005];
map<int , int> m;

int main()
{
    int n , k;

    cin >> n >> k;

    long long maxi = 0;
    long long gcd = 0;

    for(int i = 1 ; i<=n ; i++)
    {
        cin >> a[i];
        maxi = max(maxi , a[i]);
        gcd = __gcd(gcd , a[i]);
    }
    if(maxi >= k && k%gcd==0)
        cout << "POSSIBLE";
    else
        cout << "IMPOSSIBLE";
    return 0;
}


Measured memory_bytes: 1024
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [input() for _ in range(n)]

n,m = map(int, input().split())
l = [list(map(int,input().split())) for i in range(m)]

# n,mが10^5なのでO(n^2)は間に合わない
"""
ans = 0
for i in range(1,n+1):
    flg = True
    for j in range(m):
        if i < l[j][0] or i > l[j][1]:
            flg = False
    if (flg):
        ans+=1
print(ans)
"""

#lをO(m)で走査して上限、下限をあらかじめ確定しておく
up = 10**5+1
lo = 0

for i in range(m):
    if lo < l[i][0]:
        lo = l[i][0]
    if  up > l[i][1]:
        up = l[i][1]

"""
#わざわざ回す必要がない
ans = 0
for i in range(1,n+1):
    if i >= lo and i <= up:
        ans+=1
"""
if (up - lo >= 0):
    print(up -lo+1)
else:
    print(0)




Measured memory_bytes: 27140
N = int(input())
za = []
for _ in range(N):
    x, y = map(int,input().split())
    za.append((x + y, y - x))
X = max(za, key = lambda x:x[0])[0] - min(za, key = lambda x:x[0])[0]
Y = max(za, key = lambda x:x[1])[1] - min(za, key = lambda x:x[1])[1]
print(max(X, Y))

Measured memory_bytes: 88336
#include<bits/stdc++.h>
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
#define pb push_back
int dy[]={0, 0, 1, -1, 1, 1, -1, -1};
int dx[]={1, -1, 0, 0, 1, -1, -1, 1};

#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 mp make_pair
#define fi first
#define sc second
ll n;
ll a[200000];
ll d[200000];
int main(){
	cin >> n;
	REP(i,n)
		cin >> a[i];

	ll sum = 0;
	REP(i,n) {
		sum += a[i];
	}

	if(sum % (n * (n + 1) / 2) != 0){
		cout << "NO" << endl;
		return 0;
	}

	ll k = sum / (n * (n + 1) / 2);

	REP(i,n) {
		d[i] = a[(i + 1) % n] - a[i];
		d[i] -= k;
	}

	bool f = true;

	REP(i,n) {
		if(d[i] > 0 || d[i] % n != 0) {
			f = false;
		}
	}
	if(f)
		cout << "YES" << endl;
	else 
		cout << "NO" << endl;

	return 0;
}


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

int main(void) {
  int i;
  int N, tmp, alice, bob;
  vector<int> a;
  
  // stdin
  cin >> N;
  for (i=0; i<N; i++) {
    cin >> tmp;
    a.push_back(tmp);
  }
  
  // calculate
  alice = 0;
  bob = 0;
  sort(a.begin(), a.end(), greater<int>());
  for (i=0; i<N; i++) {
    if (i%2==0) {
      alice += a[i];
    }
    else {
      bob += a[i];
    }
  }
  
  // stdout
  cout << alice - bob << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
using namespace std;
int main() {
  
  int N;cin>>N;
  string S;cin>>S;
  
  if(N>=3200){
    cout<<S<<endl;
  }
  else{
    S="red";
    cout<<S<<endl;
  }
}

Measured memory_bytes: 3600
/// kAAzuki Hoshino
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
typedef long long ll;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi;
//#define inf 1000000000
#define mod 1000000007
#define dmp(x) cerr<<"line "<<__LINE__<<" "<<#x<<":"<<x<<endl
#define fs first
#define sc second
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define mt make_tuple
#define IOS ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
    return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
    o<<"{";
    for(const T& v:vc) o<<v<<",";
    o<<"}";
    return o;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int n,m,v,p;
int a[101010];

signed main(){
IOS;
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);

  cin >> n >> m >> v >> p;
  for(int i=1;i<=n;i++){
    cin >> a[i];
  }
  sort(a+1,a+n+1);
  reverse(a+1,a+n+1);
  int cf = a[p];
  int ans = p;
  int sum = 0;
  int idx = n+1;
  for(int i=p+1;i<=n;i++){
    if(a[i]==cf){
      ans++;
    }
    else {
      idx = i;
      break;
    }
  }
  //cout << cf  << endl;
  for(int i=idx;i<=n;i++){
    int rem = (v-p+1 - (n-i) -1);
    //cout << rem << endl;
    if(m+a[i]<cf)break;
    if(rem<=0){
      ans++;
    }
    else {
      if(sum + (a[i]+m-cf)*(i-p) >=rem*m && m+a[i]>=cf ){
        ans++;
      }
    }
    sum+= (cf-a[i]);
  }
  cout << ans << endl;

return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>

using namespace std;

int main(void) {
    int N, K;
    cin >> N >> K;
    int X = (N-1)*(N-2) / 2 - K;
    vector< pair<int,int> > p;
    if(X < 0) {
        cout << -1 << endl;
        return 0;

    } else {
        for(int i=2; i<=N; i++) {
            p.push_back(make_pair(1, i));
        }
        for(int i=2; i<=N; i++) {
            for(int j=i+1; j<=N; j++) {
                if(X != 0) {
                    p.push_back(make_pair(i, j));
                    X--;
                }
            }
        }
    }
    cout << p.size() << endl;
    for(auto &x : p) {
        cout << x.first << " " << x.second << endl;
    }
    return 0;

}

Measured memory_bytes: 384
#include<stdio.h>
int main(){
	int c,temp;
	double w;
	while(scanf("%lf",&w)!=EOF){
		if(w<=48){c=1;}
		else if(48<w&&w<=51){c=2;}
		else if(51<w&&w<=54){c=3;}
		else if(54<w&&w<=57){c=4;}
		else if(57<w&&w<=60){c=5;}
		else if(60<w&&w<=64){c=6;}
		else if(64<w&&w<=69){c=7;}
		else if(69<w&&w<=75){c=8;}
		else if(75<w&&w<=81){c=9;}
		else if(81<w&&w<=91){c=10;}
		else {c=11;}
		switch(c){
			case 1:
				printf("light fly");
				break;
			case 2:
				printf("fly");
				break;
			case 3:
				printf("bantam");
				break;
			case 4:
				printf("feather");
				break;
			case 5:
				printf("light");
				break;
			case 6:
				printf("light welter");
				break;
			case 7:
				printf("welter");
				break;
			case 8:
				printf("light middle");
				break;
			case 9:
				printf("middle");
				break;
			case 10:
				printf("light heavy");
				break;
			case 11:
				printf("heavy");
				break;
			default :
				break;
		}
		printf("\n");
	}
	return 0;
}

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

int main(){
	int n,g,k=0;
	cin >> n >> g;
	int d[n];
	int min = 1001;
	for(int i=0;i<n;i++){
		cin >> d[i];
		g -= d[i];
		k++;
		if(min > d[i]){
			min = d[i];
		}
	}
	k += g/min;
	cout << k << endl;


	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define S set<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    LL from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
//スタート点,頂点数、辺を渡して、最短経路の配列を返す
std::vector<LL> dijkstra(LL s,LL N,vector<Edge> E){
    std::vector<LL> ans(N,LINF);
    std::vector<std::vector<Edge>> Edges(N);
    FOREACH(e,E){
        Edges.at(e.from).push_back(e);
    }
    priority_queue<P, std::vector<P>, greater<P>> que;
    ans.at(s)= 0;
    que.push(make_pair(0,s));
    while(!que.empty()){
        P p = que.top();que.pop();
        if(ans.at(p.second) < p.first)continue;
        for(int i = 0;i < Edges.at(p.second).size();i++){
            if(ans.at(p.second) + Edges.at(p.second).at(i).value < ans.at(Edges.at(p.second).at(i).to)){
                ans.at(Edges.at(p.second).at(i).to) = ans.at(p.second) + Edges.at(p.second).at(i).value;
                que.push(make_pair(ans.at(Edges.at(p.second).at(i).to),Edges.at(p.second).at(i).to));
            }
        }
    }
    return ans;
}
int main(){
    LCIN(N);LCIN(m);LCIN(s);LCIN(t);
    V<Edge> Edges1,Edges2;
    REP(w,m){
        CIN(a);CIN(b);
        CIN(c);
        CIN(d);
        Edge e(a,b,c);
        Edge q(b,a,c);
        Edges1.pb(e);
        Edges1.pb(q);
        e.value=d;
        Edges2.pb(e);
        q.value=d;
        Edges2.pb(q);
    }
    V<LL> dis1 = dijkstra(s,N+1,Edges1);
    V<LL> dis2 = dijkstra(t,N+1,Edges2);

    LL money = 1;
    REP(a,15){
        money*=10;
    }
    LL kiroku[1000000];
    REP(a,N+1){
        kiroku[a] = dis1.at(a)+dis2.at(a);
    }
    LL ruiseki[1000100];
    ruiseki[N]=0;
    for(int a = N-2;a >= -1;a--){
        ruiseki[a+1]=max(ruiseki[a+2],money-kiroku[a+2]);
    }
    for(int a = 0;a < N;a++){
        LL ans =  ruiseki[a];
        COUT(ans);
    }
    return 0;
}


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

int main()
{
  int p[20];
  int n, cnt = 0;

  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> p[i];
  }

  for(int i = 1; i < n - 1; i++){
    if((p[i] > p[i - 1] && p[i + 1] > p[i]) || p[i] < p[i - 1] && p[i + 1] < p[i])
      cnt++;
  }

  cout << cnt << endl;
  return 0;
}


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

long long a, b, n, N, T, A;
int main() {
    cin >> N;
    a = 1, b = 1;
    rep(i, 0, N) {
        cin >> T >> A;
        n = max((a + T - 1) / T, (b + A - 1) / A);
        a = T * n;
        b = A * n;
    }
    cout << a + b << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std; 
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair <int,int> PII;
typedef pair <int,string> PIS;
typedef vector <int> vec;
#define endl '\n'
#define pi 3.141592653589793
#define fori(z,n) for(int i=z;i<n;i++)
#define forii(z,n) for(int i=z;i<=n;i++)
int main() 
{ 
    /* std::ios::sync_with_stdio(false); */
    /* cin.tie(NULL); */
    /* cout.tie(NULL); */
    string str;
    cin>>str;
    map <char, bool> m;
    int c=0;
    for(int i=0;i<4;i++)
    {
        if(m[str[i]]==false)
        {
            c++;
        }
        m[str[i]]=true;
    }
    if(c==2)
    {
        cout<<"Yes";
    }
    else {
        cout<<"No";
    }
    cerr<<"Time elapsed"<<1.0*clock()/CLOCKS_PER_SEC<<"s\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
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;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

signed main() {
    string s;
    cin>>s;
    cout<<((s.substr(0,4)=="YAKI")?"Yes":"No")<<endl;
    return 0;
}


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

using namespace std;

vector<vector<pair<int, int>>> graph;
vector<bool> vis;
vector<int> value;

bool dfs(int u, int val) {
	vis[u] = true;
	value[u] = val;
	for (auto &ed: graph[u]) {
		int v, w;
		tie(v, w) = ed;
		if (vis[v]) {
			if (value[v] != value[u] + w) {
				return false;
			}
		} else {
			if (!dfs(v, value[u] + w)) {
				return false;
			}
		}
	}
	return true;
}

int main() {
	int n, m;
	scanf("%d %d", &n, &m);
	graph.assign(n, {});
	vis.resize(n);
	value.resize(n);
	for (int i = 0; i < m; i++) {
		int l, r, d;
		scanf("%d %d %d", &l, &r, &d);
		l--, r--;
		graph[l].push_back({r, d});
		graph[r].push_back({l, -d});
	}
	bool ans = true;
	for (int i = 0; i < n; i++) {
		if (!vis[i] and !dfs(i, 0)) {
			ans = false;
		}
	}
	printf("%s\n", ans ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 12032
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
const ll LL_MAX=LLONG_MAX;

struct In{
    template<typename T>
    operator T(){
        T x;
        cin >> x;
        return x;
    }
};
In in;

template <typename T,typename U>
void forin(T* x,U n){
    for (U i=0;i<n;i++) cin >> x[i];
}

template <typename T>
int div1(T x) {
    return x%1000000007;
}

template <typename T>
void out(T x){
    cout << x << endl;
}

template <typename T>
T gcd(T x,T y){
    if (y == 0) return x;
    return gcd(y,x%y);
}

template <typename T>
T lcm(T x,T y){
    return x*y/gcd(x,y);
}

int main(){
    int n=in,m=in,sum=0;
    vector <int> a(n);
    for (int i=0;i<n;i++) {
        a[i]=in;
        sum+=a[i];
    }
    sort(a.begin(),a.end());
    if (a[n-m]*4*m<sum) out("No");
    else out("Yes");
}

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

int main(){
    string s, t;
    cin >> s >> t;
    int slen = s.length(), tlen = t.length();
    for(int i = 0; i <= slen-tlen; i++){
        bool valid = true;
        for(int j = 0; valid && j < tlen; j++){
            valid &= (s[i+j] == t[j] || t[j] == '_');
        }
        if(valid){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3244
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val table = primeTable(55555)
    val n = readInteger()
    val ans = mutableListOf<Int>()
    for (i in table.indices) {
        if (table[i] && i % 5 == 1) {
            ans += i
        }

        if (ans.size == n) {
            break
        }
    }
    out.println(ans.joinToString(" "))
}

/** O(nlog(logn)) // n * n <= Int.MAX_VALUE, n <= 10^6 */
fun primeTable(n: Int): BooleanArray {
    val table = BooleanArray(n + 1) { true }
    if (n >= 0) table[0] = false
    if (n >= 1) table[1] = false
    var i = 2
    while (i * i <= n) {
        if (table[i]) {
            for (j in (i + i)..n step i) { table[j] = false }
        }
        i++
    }
    return table
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 37908
#include<iostream>
#include<cstdio>
#include<cstring>
char s[4];
int vis[4];
using namespace std;
int main()
{
	cin>>s;
	for(int i=0;i<3;i++)
	{
		vis[s[i]]++;
	}
	if(vis['a']==0||vis['b']==0||vis['c']==0) printf("No");
	else printf("Yes"); 
	return 0;
}

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

int main(){
	int x=0,y=0;
	int n;
	scanf("%d",&n);
	int t1=0,t2;
	for(register int i=1;i<=n;i++){
		int m,n;
		scanf("%d%d%d",&t2,&m,&n);
		if((abs(m-x)+abs(n-y)>t2-t1)||(((t2-t1-(abs(m-x)+abs(n-y)))%2)==1)){
			printf("No");
			return 0;
		}
		x=m;
		y=n;
		t1=t2;
	}
	printf("Yes");
	return 0;
}

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

// graph by adjacency list
template <typename T>
struct Edge {
  int src, dst;
  T weight;
  Edge(const int src, const int dst, const T weight)
      : src(src), dst(dst), weight(weight) {}
  Edge(const int dst, const T weight) : src(-1), dst(dst), weight(weight) {}
  bool operator<(const Edge<T> &e) const { return weight > e.weight; }
};

template <typename T>
struct Graph {
  int V;
  std::vector<std::vector<Edge<T>>> E;
  Graph(const int V) : V(V) { E.resize(V); }
  void add_edge(const int src, const int dst, const T weight) {
    E[src].emplace_back(src, dst, weight);
  }
};

template <typename T>
struct ShortestPath {
  Graph<T> g;
  T inf;
  std::vector<T> dist;
  std::vector<int> prev;
  bool has_negative_cycle;

  ShortestPath(const Graph<T> g, const T inf = 1 << 30)
      : g(g), inf(inf), dist(g.V), prev(g.V) {}

  void run(int start) {
    std::fill(dist.begin(), dist.end(), inf);
    dist[start] = 0;
    prev[start] = -1;
    has_negative_cycle = false;
    for (int cnt = 0; cnt < g.V; cnt++) {
      bool update = false;
      for (int i = 0; i < g.V; i++) {
        for (Edge<T> e : g.E[i]) {
          if (dist[i] != inf && dist[i] + e.weight < dist[e.dst]) {
            dist[e.dst] = dist[i] + e.weight;
            prev[e.dst] = i;
            update = true;
            if (cnt == g.V - 1) has_negative_cycle = true;
          }
        }
      }
      if (!update) break;
    }
  }

  std::vector<int> build_path(const int goal) const {
    std::vector<int> path;
    for (int v = goal; v != -1; v = prev[v]) {
      path.emplace_back(v);
    }
    std::reverse(path.begin(), path.end());
    return path;
  }
};

void aoj() {
  // https://onlinejudge.u-aizu.ac.jp/courses/library/5/GRL/all/GRL_1_B
  int V, E, r;
  std::cin >> V >> E >> r;
  Graph<int> g(V);
  for (int i = 0; i < E; i++) {
    int s, t, d;
    std::cin >> s >> t >> d;
    g.add_edge(s, t, d);
  }
  ShortestPath<int> sp(g);
  sp.run(r);
  if (sp.has_negative_cycle) {
    std::cout << "NEGATIVE CYCLE" << std::endl;
  } else {
    for (int i = 0; i < g.V; i++) {
      if (sp.dist[i] == sp.inf) {
        std::cout << "INF" << std::endl;
      } else {
        std::cout << sp.dist[i] << std::endl;
      }
    }
  }
}

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

  aoj();
  return 0;
}



Measured memory_bytes: 3320
#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() {

    string s;
    cin >> s;
    int a = (s[0] - '0')*10 + (s[1] - '0');
    int b = (s[2] - '0')*10 + (s[3] - '0');
    if (1 <= a && a <= 12 && 1 <= b && b <= 12) {
        cout << "AMBIGUOUS" << endl;
    } else if (1 <= a && a <= 12) {
        cout << "MMYY" << endl;
    } else if (1 <= b && b <= 12) {
        cout << "YYMM" << endl;
    } else {
        cout << "NA" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
typedef long double ld;
signed main(){
  ld n=0,m=0,co=0,ans=0;
  ld d=0;
  cin >>n>>m;
  vector<int>aa(n);
  REP(i,n){
    cin >>aa[i];
   co+=aa[i];
  }
  SORT(aa);
  REVE(aa);
  d=co/(4*m);
  REP(i,n){
   if(aa[i]>=d){
   ans++;
     if(ans>=m){
     cout << "Yes";
       return 0;
     }
   }
  }
  cout <<"No";
}


Measured memory_bytes: 256
s = list(map(int, list(input())))

acc = [0]*(len(s)+1)
digit = 1

for i in reversed(range(0, len(s))):
    si = s[i] * digit % 2019
    acc[i] = (acc[i+1] + si) % 2019
    digit *= 10
    digit %= 2019

cnt = [0]*2019
ans = 0
for i in range(0, len(s)+1):
    ans += cnt[acc[i]]
    cnt[acc[i]] += 1

print(ans)

Measured memory_bytes: 88328
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll H;
    cin >> H;
    ll ans = 0;
    ll add = 1;
    int cnt = 1;
    while (1) {
        if (H == 0) break;
        H = H / 2;
        ans += add;
        add = (1LL << cnt);
        cnt++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <algorithm>
#include <set>
#include <queue>
#include <tuple>
#include <functional>
#include <cstring>

#define PI 3.14159265359
#define INF 1e9
#define LINF 1e18
#define IMOD 1000000007 
#define irep(i,n) for(int  i = 0; i < n; i++)
#define irep2(i,a,n) for(int i = a; i < n; i++)
#define lrep(i,n) for(long long  i = 0; i < n; i++)
#define lrep2(i,a,n) for(long long i = a; i < n; i++)

typedef long long ll;
typedef std::vector<int> v_int;
typedef std::vector<std::vector<int> > v2_int;
typedef std::vector<ll> v_ll;
typedef std::vector<std::vector<ll> > v2_ll;
typedef std::vector<std::string> v_string;
typedef std::vector<std::vector<std::string> > v2_string;
typedef std::pair<ll, ll> pll;

using namespace std;

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

    ll ans = 0;
    
    ll CCtoS = m / 2;
    
    if(n <= CCtoS) {
        ans = n;
        m -= n * 2; 
        ans += m / 4;
    } else {
        ans = CCtoS;
    }
    
    cout << ans; 
    return 0;
}


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

int main(void) {
	int x,h;
	double s;
	double th;
	while(1) {
		scanf("%d",&x);
		scanf("%d",&h);
		if(x==0 && h==0)break;
		th=sqrt(h*h+((double)x/2)*((double)x/2));
		s=th*(double)x*4.0/2.0+(double)x*(double)x;
		printf("%f\n",s);
	}
	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

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

const int MOD=1000000007;
int INF=100100100;

signed main(){
  int n;cin>>n;
  int ans=0;
  for(int i=1;i*i<=n;i++){
    if(n%i!=0)continue;
    int m=n/i-1;
    if(m>INF|| m*m+m>n){
      ans+=m;
      //cout<<m<<endl;
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rg register
#define il inline
#define int long long
using namespace std;
typedef long long ll;
const int mod=1e9+7,O=200010;
il int gi(){
	rg int o=0,fl=1;char ch=getchar();
	while(!isdigit(ch)&&ch!='-')ch=getchar();
	if(ch=='-')fl=-1,ch=getchar();
	while(isdigit(ch))o=o*10+ch-'0',ch=getchar();
	return fl*o;
}
int h,w,a,b,fac[O],inv[O],ans;
il ll C(int n,int m){return 1ll*fac[n]*inv[m]%mod*inv[n-m]%mod;}
signed main(){
	fac[0]=inv[0]=inv[1]=fac[1]=1;
	for(int i=2;i<O;++i)fac[i]=1ll*fac[i-1]*i%mod,inv[i]=1ll*(mod-mod/i)*inv[mod%i]%mod;
	for(int i=2;i<O;++i)inv[i]=1ll*inv[i-1]*inv[i]%mod;
	scanf("%lld%lld%lld%lld",&h,&w,&a,&b);
	for(int i=1;i<=h-a;++i)
		(ans+=C(i+b-2,i-1)*C(h-i+w-b-1,h-i)%mod)%=mod;
	printf("%lld\n",ans);
	return 0;
}
//(1,1)->(i,b)*(i,b)->(n,m)


Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cassert>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define rep(i,n) FOR(i,0,n)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define vint vector<int>
#define vdouble vector<double>
#define vstring vector<string>
using namespace std;

#include<map>
#include<set>
#include<queue>

typedef long long ll;
typedef unsigned long long ull;

const int MAX_N = 1000000;

ll a1, a2;
ll MOD = 1000000000 + 7;
int main() {
    cin >> a1 >> a2;

    if (a1 < a2) swap(a1, a2);
    if (a1 - a2 > 1) {
        cout << 0 << endl;
        return 0;
    }

    ll ret = 1;
    if (a1 == a2) ret *= 2;
    while(true){
        if(a1 == 0) break;
        ret *= a1;
        ret %= MOD;
        a1--;
        if(a2 == 0) break;
        ret *= a2;
        ret %= MOD;
        a2--;
    }

	cout << ret << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <climits>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 qvya13579
#define y1 qvyb24680
#define j0 qvja13579
#define j1 qvjb24680
#define next qvne13579xt
#define prev qvpr13579ev
#define INF 1000000007
#define PI acos(-1.0)
#define endl "\n"
#define IOS cin.tie(0);ios::sync_with_stdio(false)
#define MP_ make_pair
#define PB_ push_back
#define FIR first
#define SEC second
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZ(x) ((int)(x).size())
typedef long long int lli;
using namespace std;
int ctoi(char c){if(c>='0' and c<='9'){return (int)(c-'0');}return -1;}



int main()
{
  //IOS; /* making cin faster */
  vector<int> a(3);

  
  REP(i,3)
    {
      cin >> a[i];
      
    }


  int mx = a[0];
  int sm = 0;
  
  
  REP(i,3)
    {
      if( a[i] > mx )
	{
	  mx = a[i];
	  
	}
      sm += a[i];
      
    }

  cout << ( 9 * mx + sm ) << endl;
  

  
  

  

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//#include <math.h>
#include <algorithm>
#include <vector>

typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))

using namespace std;

#define MOD 1000000007


int main(int argc, char* argv[])
{
    long n, m;
    scanf("%ld %ld", &n, &m );

    vector<long> a(n);
    vector<long> b(m);

    long i;
    for(i=0; i<n; i++) {
        scanf("%ld", &(a[i]));
    }
    for(i=0; i<m; i++) {
        scanf("%ld", &(b[i]));
    }

    sort(a.begin(), a.end());
    for(i=0; i<n-1; i++) {
        if(a[i]==a[i+1]) {
            printf("0\n");
            return 0;
        }
    }

    sort(b.begin(), b.end());
    for(i=0; i<m-1; i++) {
        if(b[i]==b[i+1]) {
            printf("0\n");
            return 0;
        }
    }

    ll ans = 1;
    for(i=n*m; i>=1; i--) {
        auto ita = lower_bound(a.begin(), a.end(), i);
        auto itb = lower_bound(b.begin(), b.end(), i);
        if((*ita)==i && (*itb)==i) {
            ;
        }
        else if ((*ita)==i) {
            ans = ans * (b.end()-itb) %MOD;
        }
        else if ((*itb)==i) {
            ans = ans * (a.end()-ita) %MOD;
        }
        else {
            ans = ans * ((a.end()-ita) * (b.end()-itb) -(n*m-i)) %MOD;
        }
    }

    printf("%lld\n", ans);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 1000000007
#define mod 1000000007
//#pragma GCC optimize(2)
//#define int long long
using namespace std;
template <typename T> void read(T &x){
	x=0;char ch=getchar();int fh=1;
	while (ch<'0'||ch>'9'){if (ch=='-')fh=-1;ch=getchar();}
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();
	x*=fh;
}
template <typename T> void write(T x) {
	if (x<0) x=-x,putchar('-');
	if (x>9) write(x/10);
	putchar(x%10+'0');
}
template <typename T> void writeln(T x) {
	write(x);
	puts("");
}
signed main()
{
	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int x;
	cin>>x;
	int a=x/500,b=(x-a*500)/5;
	cout<<a*1000+b*5<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>

int main(){
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  int N,H;
  std::cin >> N >> H;
  std::vector<int> a(N),b(N);
  std::cin >> a[0] >> b[0];
  int max_a=a[0],times=0;

  for(int i=1;i<N;i++){
    std::cin >> a[i] >> b[i];
    if(max_a < a[i]){
      max_a=a[i];
    }
  }
  std::sort(b.begin(),b.end(),std::greater<int>());
  for(int i=0;i<N;i++){
    if(max_a < b[i]){
      H-=b[i];
      times++;
        if(H<=0){
          std::cout << times << std::endl;
          return 0;
        }
    }
  }
  if(H<=0){
    std::cout << times << std::endl;
    return 0;
  }
  times+=(H+max_a-1)/max_a;
  std::cout << times << std::endl;
}

Measured memory_bytes: 1024
//stl
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <vector>

//std
#include <cmath>
#include <cstdio>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
#define ls(o) ((o)<<1  )
#define rs(o) ((o)<<1|1)

//macro
typedef long long LL;
using namespace  std;
const int MAX_N = 7 + 20000;
//-----------------------------------------------------
int n;
int p[MAX_N];
int a[MAX_N];
int b[MAX_N];
//-----------------------------------------------------
int  main()
{

	//freopen( "xx.in"  , "r" , stdin  );
	//freopen( "xx.out" , "w" , stdout );

	//--0 init
	
	//--1 read
	int n; scanf("%d",&n);
	for (int i=1; i<=n; i++) scanf("%d",&p[i]);
	
	//--2 work
	for (int i=1; i<=n; i++) {
		a[i]=i*20001;
		b[i]=(n+1-i)*20001;
	}
	for (int i=1; i<=n; i++) {
		a[p[i]]+=i;
		b[p[i]]+=i;
	}
	
	//--3 print
	for (int i=1; i<=n; i++) {
		printf("%d",a[i]);
		if (i<n) printf(" ");
	}
	printf("\n");
	for (int i=1; i<=n; i++) {
		printf("%d",b[i]);
		if (i<n) printf(" ");
	}
	

}









Measured memory_bytes: 896
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int minus = 0;
    bool zero = false;
    ll sum = 0, miabs = 1e18;
    rep(i,n){
        ll a;
        cin >> a;
        if(a > 0){
            chmin(miabs, a);
            sum += a;
        }
        else if(a == 0) zero = true;
        else{
            ++minus;
            if(-a < miabs) chmin(miabs, -a);
            sum -= a;
        }
    }
    if(zero || minus%2 == 0) cout << sum << endl;
    else cout << sum - miabs * 2 << endl;
    return 0;
}


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

#define f first
#define s second
#define pb push_back
#define ppb pop_back
#define mp make_pair

using namespace std;

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

const int N = 1e5 + 123, inf = 1e9 + 123, mod = 1e9 + 7;
const ll INF = 1e18;

int dp[N], a[N];

int main() {
	cin.tie(0);
	cout.tie(0);
	ios_base::sync_with_stdio(0);
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}             
	for (int i = 2; i <= n; i++) {
		dp[i] = inf;
	}
	dp[1] = 0;
	for (int i = 2; i <= n; i++) {
		for (int j = 1; j <= min(i - 1, k); j++) {
			dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
		}
	}                                                
	cout << dp[n];
	return 0;       	
}                               

Measured memory_bytes: 1024
'''
研究室PCでの解答
解説AC
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)
mod = 10**9+7

def main():
    r1,c1,r2,c2 = map(int,ipt().split())
    #nCrをmodで割った余りを求める。Nに最大値を入れて使用。
    N = r2+c2+2
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    def cmb(n,r,mod=(10**9+7)):
        if r<0 or r>n :
            return 0
        r = min(r,n-r)
        return g1[n]*g2[r]*g2[n-r]%mod
    for i in range(2,N+1):
        g1.append((g1[-1]*i)%mod)
        inverse.append((-inverse[mod % i]*(mod//i))%mod)
        g2.append((g2[-1]*inverse[-1])%mod)

    print((cmb(r2+c2+2,r2+1)+cmb(r1+c1,r1)-cmb(r2+c1+1,r2+1)-cmb(r1+c2+1,r1))%mod)

    return None

if __name__ == '__main__':
    main()


Measured memory_bytes: 246920
#include<iostream> 
#include<cstdio> 
#include<cstring> 
#define inf 2147483647
using namespace std; 
struct edge{ 
    int to,cap,rev,next;  
}G[1000001]; 
int k=0,h[1000001]; 
int lv[1000001],iter[1000001],head=0,tail=0,q[1000001],n,m,p;  
void ae(int from,int to,int cap) 
{ 
    G[++k].next=h[from];h[from]=k;  
    G[k].to=to;G[k].cap=cap;G[k].rev=k+1; 
    G[++k].next=h[to];h[to]=k;  
    G[k].to=from;G[k].cap=0;G[k].rev=k-1; 
}  
void bfs(int s) 
{ 
    head=tail=0; 
    q[tail++]=s;lv[s]=1; 
    while(head!=tail) 
    { 
        int u=q[head]; 
        for(int i=h[u];i;i=G[i].next) 
        { 
            if(!lv[G[i].to]&&G[i].cap) 
            { 
                lv[G[i].to]=lv[u]+1; 
                q[tail++]=G[i].to; 
            } 
        } 
        head++; 
    } 
} 
int dfs(int u,int t,int f){ 
    if(u==t)return f; 
    for(int &i=iter[u];i;i=G[i].next){ 
        if(lv[G[i].to]==lv[u]+1&&G[i].cap){ 
            int d=dfs(G[i].to,t,min(f,G[i].cap)); 
            if(d){ 
                G[i].cap-=d;G[G[i].rev].cap+=d;
				return d; 
            } 
        } 
    } 
    return 0; 
} 
int max_flow(int s,int t) 
{ 
    int flow=0; 
    while(1){    
        for(int i=0;i<=p+1;i++)iter[i]=h[i]; 
        memset(lv,0,sizeof(lv)); 
        bfs(s); 
        if(lv[t]==0)return flow; 
        int d=dfs(s,t,inf); 
        while(d>0){flow+=d;d=dfs(s,t,inf);} 
    } 
} 
int S=0;
int I[101][101],O[101][101],R[101],C[101];
char M[101][101];
int sx,sy,ex,ey;
int main() 
{ 
    scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%s",M[i]+1);
		for(int j=1;j<=m;j++){
			if(M[i][j]=='o') I[i][j]=++p,O[i][j]=++p;
		}
	}
	for(int i=1;i<=n;i++) R[i]=++p;
	for(int i=1;i<=m;i++) C[i]=++p;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=m;j++){
			if(M[i][j]=='o'){
				ae(I[i][j],O[i][j],1);
				ae(R[i],I[i][j],inf);
				ae(C[j],I[i][j],inf);
				ae(O[i][j],R[i],inf);
				ae(O[i][j],C[j],inf);
			}
			else if(M[i][j]=='S'){
				sx=i,sy=j;
				ae(S,R[i],inf);
				ae(S,C[j],inf);
			}
			else if(M[i][j]=='T'){
				ex=i,ey=j;
				ae(R[i],p+1,inf);
				ae(C[j],p+1,inf);
			}	
		}
	}
	if(sx==ex||sy==ey) return !puts("-1");
	int ans=max_flow(S,p+1);
	printf("%d",ans); 
    return 0; 
}

Measured memory_bytes: 12672
fun main() = Thread(null, ::abc172b, "(^o^)", 128 * 1024 * 1024).apply { start() }.join()

@OptIn(ExperimentalStdlibApi::class)
fun abc172b() {
    val s = readLine()!!
    val t = readLine()!!

    val answer = s.zip(t).count { it.first != it.second }

    println(answer)
}


Measured memory_bytes: 48028
#include <iostream>
#include<cstdlib>
#include<queue>
#include<set>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<stack>
#include<map>
#include<deque>
#include<cstdio>
#include<cstdio>
#include<time.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define pd(a,n) for(int i=0;i<n;i++)cout<<a[i]<<((i==n-1)?"\n":" ")
#define pdd(a,n,m)for(int i=0;i<m;i++)pd(a,m)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int n;

ll ans;
ll table[100];
int main(){
  cin>>n;
  for(int i=1;i<=n;i++){
    int a,b;
    int now=i;
    a=now%10;
    while(now/10>0)now/=10;
    b=now;
    table[a*10+b]++;
  }
  for(int i=1;i<=n;i++){
    int a,b;
    int now=i;
    a=now%10;
    while(now/10>0)now/=10;
    b=now;
    ans+=table[b*10+a];
  }
  cout<<ans<<endl;
  return 0;
}


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

using namespace std;

int trace(int a[], int n){
    for(int i = 0; i < n; i++){
        if(i > 0){ 
            cout << " ";/* 隣接する要素の間に一つの空白を出力 */
        }
        cout << a[i];
    }
  	cout << "\n";
}

/* 挿入ソート (0オリジン配列) */
int insertionSort(int a[], int n){
  	int j;
    int v;
    for(int i = 1; i < n; i++){
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v){ 
            a[j + 1] = a[j];
            j--;
        }
        a[j + 1] = v;
        trace(a, n);
    }
}

int main(){
    int n;
    int a[100];
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    trace(a, n);
    insertionSort(a, n);
}


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

#define rep(a,b) for(int a = 0;a < b;a++)
#define REP(i, x, n) for(int i = x; i < n; i++)
#define P(a) cout << a << endl
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define ssort(v) sort(v.begin(),v.end())
#define rev(v) reverse(v.begin(),v.end())
#define vP(v) for(int i = 0;i < v.size();i++){cout << v[i];if(i != v.size()-1)cout << endl;}
#define vcin(v,n) rep(i,n){int a;cin >> a;v.pb(a);}

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
int dx[] = { 1, -1 , 0 , 0 };
int dy[] = { 0,  0,  1, -1 };
ll MOD = 1000000007;

void solve(){
	char a;
	cin >> a;
	if(a == 'a' or a == 'e' or a == 'i' or a == 'o' or a == 'u' ) P("vowel");
	else P("consonant");
}

int main() {
    solve();
    return 0;
}


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

using namespace std;

#define YES cout << "YES" << endl;
#define NO  cout << "NO"  << endl;
#define Yes cout << "Yes" << endl;
#define No  cout << "No"  << endl;
 
#define INF INT_MAX
#define MOD 1000000007
#define PI  acos(-1)

using ll  = long long;
using ull = unsigned long long;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rrep(i, n) for (ll i = (n)-1; i >= 0; i--)

int main(int argc, char *argv[])
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll N, A, B;
    cin >> N >> A >> B;

    ll ans = (B-A)*(N-2)+1;
    if (ans > 0) {
        cout << ans << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-
a,b = map(int,input().split())
S = str(input())
ans = str(S[a])
l = len(S)
c = 0
wr = 0
while c < l:
    if c == a:
        if "-" != ans:
            wr = 1
            break
        else:
            c += 1
    else:
        if "-" == str(S[c]):
            wr = 1
            break
        else:
            c += 1
if wr == 1:
    print("No")
else:
    print("Yes") 



Measured memory_bytes: 3064
while 1:
    h,w=map(int,input().split())
    if h==0 and w==0: 
        break
    for y in range(h): 
        if y == 0 or y == h-1:
            print('#'*w)
        else: 
            print('#','.'*(w-2),'#',sep='')
    print('')



Measured memory_bytes: 5628
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"sort"
	"strconv"
	"strings"
)

var (
	reader io.Reader = os.Stdin
	writer io.Writer = os.Stdout
)

func main() {
	reader = os.Stdin
	writer = os.Stdout
	run()
}

func run() {
	nums := readIntsFromStdin()[0]
	sort.Ints(nums)

	fmt.Fprintln(writer, intsToString(nums))
}

// intsToString converts []int into a single string
func intsToString(nums []int) string {
	strs := make([]string, len(nums))

	for i, num := range nums {
		strs[i] = strconv.Itoa(num)
	}

	return strings.Join(strs, " ")
}

// ReadInts parses lines of inputs into 2D int array.
func readIntsFromStdin() [][]int {
	out := [][]int{}
	scanner := bufio.NewScanner(reader)

	for scanner.Scan() {
		var ints []int

		for _, s := range strings.Split(scanner.Text(), " ") {
			i, err := strconv.Atoi(s)

			if err != nil {
				fmt.Fprintln(os.Stderr, "Failed to parse string into int.", err)
				os.Exit(1)
			}

			ints = append(ints, i)
		}

		out = append(out, ints)
	}

	return out
}



Measured memory_bytes: 1108