akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int main()
{
    priority_queue <int, vector<int>, greater <int> > a;
    int v,e,r;
    cin >> v >> e >> r;
    vector < pair<int,int> > data[v];
    vector < pair<int,int> > :: iterator it,ip;
    bool mar[v];
    int dis[v],i,j;
    for(int i=0;i<v;i++)
    {
        dis[i]=INT_MAX;
        mar[i]=0;
    }
    dis[r]=0;
    mar[r]=1;
    for(int i=0;i<e;i++)
    {
        int f,g,h;
        cin >> f >> g >> h;
        data[f].push_back( make_pair(g,h));
    }
    a.push(r);
    for(;!a.empty();)
    {
        int p=a.top();
        a.pop();
        for(int i=0;i<data[p].size();i++)
        {
            if(dis[p]+data[p][i].second < dis[data[p][i].first])
            {
                dis[data[p][i].first]=dis[p]+data[p][i].second;
                mar[data[p][i].first]=1;
                a.push(data[p][i].first);
            }
        }
    }
    for(int i=0;i<v;i++)
    {
        if(dis[i]==INT_MAX)
            cout << "INF" << endl;
        else
            cout << dis[i] << endl;
    }
        
}



Measured memory_bytes: 16308
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
#define rep(i, n) for(ll i = 0;i < n;i++)
template<class T, class U> void cmax(T& a, U b) { if (a<b) a = b; }
template<class T, class U> void cmin(T& a, U b) { if (a>b) a = b; }

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

  string s;
  cin >> s;
  string f = "FESTIVAL";
  cout << s.substr(0, s.size()-f.size()) << endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<ctime>
#include<cctype>
#include<climits>
#include<iostream>
#include<string>
#include<vector>
#include<map>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<memory>
#include<functional>

#define rep(i, n) REP(i, 0, n)
#define REP(i, a, n) for(int i = a ; i < (int)n ; i++)
#define ALL(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define eps 1e-14
#define INF 1e9
#define m0(x) memset(x, 0, sizeof(x))

using namespace std;

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

int gcd(int a,int b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

signed main(){
  int N;
  int _max, _min, a;
  cin >> N;
  _max = -1; _min = INF;
  rep(i,N){
    cin >> a;
    _max = max(a, _max);
    _min = min(a, _min);
  }

  cout << _max - _min << endl;
}


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



void solve(){
    int a,b;
    cin >> a >> b;
    int count=0;
    int tap=1;
    while(tap<b){
        tap--;
        tap += a;
        count++;
    }
    cout << count << endl;
}

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


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cstdlib>
#define llong long long
#define For(i,a,b) for(int i=(a);i<(b);i++)
#define Rep(i,n) for(int i=0;i<(n);i++)
using namespace std;


int main(){
  int N; cin >> N;
  char A[N];
  Rep(i, N){
    cin >> A[i];
  }
  bool ans = false;
  Rep(i, N){
    if (A[i] == 'Y'){
      ans = true;
    }
  }
  if (ans) cout << "Four" << endl;
  else cout << "Three" << endl;
  return 0;
}

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

int main()
{
	long long n,m;
	double sum=0;
	int s=0;
	cin>>n>>m;
	int a[n];
	for (int i=0; i<n; i++)
	{
		cin>>a[i];
		sum+=a[i];
	}
	double M=sum/(4*m);
	for (int j=0; j<n; j++)
	{
		if (a[j]>=M)
		{
			s++;
		}
	}
	if (s>=m)
	{
		cout<<"Yes";
	}
	else
	  cout<<"No";
	return 0;
}

Measured memory_bytes: 256
//
// Created by yamunaku on 2020/05/16.
//

#include <bits/stdc++.h>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repl(i, l, r) for(int i = (l); i < (r); i++)
#define per(i, n) for(int i = ((n)-1); i >= 0; i--)
#define perl(i, l, r) for(int i = ((r)-1); i >= (l); i--)
#define all(x) (x).begin(),(x).end()
#define MOD9 998244353
#define MOD1 1000000007
#define IINF 1000000000
#define LINF 1000000000000000000
#define SP <<" "<<
#define CYES cout<<"Yes"<<endl
#define CNO cout<<"No"<<endl
#define CFS cin.tie(0);ios::sync_with_stdio(false)
#define CST(x) cout<<fixed<<setprecision(x)

using ll = long long;
using ld = long double;
using vi = vector<int>;
using mti = vector<vector<int>>;
using vl = vector<ll>;
using mtl = vector<vector<ll>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
template<typename T>
using heap = priority_queue<T, vector<T>, function<bool(const T, const T)>>;

int main() {
    //CFS;
    int n, q;
    cin >> n >> q;
    fenwick_tree<ll> bit(n);
    rep(i,n) {
        int x;
        cin >> x;
        bit.add(i, x);
    }
    rep(i, q) {
        int c, a, b;
        cin >> c >> a >> b;
        if (c == 0) {
            bit.add(a, b);
        } else {
            cout << bit.sum(a, b) << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 8220
#include <iostream>
#include <stdlib.h>

#define MAX 2000000

using namespace std;

void printArray(int Array[],int n){

  int i;
  for(i = 0;i < n-1;i++){
    cout << Array[i] << ' ';
  }
  cout << Array[n-1] << endl;
}

void CountingSort(int A[],int B[],int n,int k){

  int i;
  int *C;

  C = (int*)malloc(sizeof(int)*(k+1));

  for(i = 0;i <= k;i++){
    C[i] = 0;
  }
  for(i = 0;i < n;i++){
    C[A[i]]++;
  }
  for(i = 1;i <= k;i++){
    C[i] += C[i-1];
  }
  for(i = n-1;i >= 0;i--){
    B[C[A[i]]-1] = A[i];
    C[A[i]]--;
  }

  free(C);
}


int main(){

  int i;
  int n;
  int k = 0;
  int *A;
  int *B;

  A = (int*)malloc(sizeof(int)*MAX);
  B = (int*)malloc(sizeof(int)*MAX);

  cin >> n;

  for(i = 0;i < n;i++){
    cin >> A[i];
    if(A[i] > k){
      k = A[i];
    }
  }

  CountingSort(A,B,n,k);

  printArray(B,n);

  return 0;
}

Measured memory_bytes: 16864
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
 
int main(){
  lint N,ans;
  cin>>N;

  lint s=(lint)sqrt(N);

    for(lint t=s;1LL<=t;t--){
      if(N%t==0){
        ans=N/t;
        break;
      }
    }
 
  int cont=0;
  while(ans!=0){
    ans=ans/10LL;
    cont++;
  }
 
  cout<<cont<<"\n";
  return 0;
}

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 INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
    int n,m;
    cin>>n>>m;
    vector<vector<ll>> v(m+1);
    rep(i,n){
        ll a,b;
        cin>>a>>b;
        if(a>m) continue;
        v[a].push_back(b);
    }
    ll ans=0;
    priority_queue<ll> q;
    for(ll i=1;i<=m;i++){
        for(int j=0;j<v[i].size();j++){
            q.push(v[i][j]);
        }
        if(q.empty()) continue;
        ans+=q.top();
        q.pop();
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 5632
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace std;
using namespace __gnu_pbds;

typedef vector <int> vi;
typedef vector <long long> vl;
typedef pair <int, int> pii;
typedef pair <long long, long long> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

#define ll long long
#define pb push_back   
#define all(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define FORR(i, a, b) for (int i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second

ll modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

ll fpow(ll a, ll n)
{
    ll ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);   string s;
    cin >> s;
    int mini = INT_MAX;
    int n = s.length();
    FOR(i,0,n-2)
    {
    	string a = "";
    	FOR(j,0,3)
    		a += s[i+j];
    	int z = stoi(a);
    	mini = min(abs(z-753),mini);
    }
    cout << mini << endl;
    return 0;
}

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

#define rep(i, a, b) for (ll i = (a); i < (b); i++)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

struct block {
    // 出発時刻が時刻[t s)に含まれるなら、xで終了
    ll s, t, x;
};

vector<block> v;
set<PLL> s; // {出発時刻, id}

signed main() {
    ll N,Q;
    cin>>N>>Q;
    rep(i,0,N) {
        ll s,t,x;
        cin>>s>>t>>x;
        s-=x;
        t-=x;
        v.push_back({s,t,x});
    }
    rep(i,0,Q){
        ll d;
        cin>>d;
        s.insert({d,i});
    }
    sort(begin(v), end(v), [](const block &a, const block &b) {
            return a.x < b.x;});
    vector<ll> ans(Q, -1);
    for (auto b : v) {
        // cout<<"b.x="<<b.x<<endl;
        for (auto it = s.lower_bound({b.s, -100}); it != s.end() && it->first < b.t; ) {
            // cout<<"id="<<it->second<<endl;
            ans[it->second] = b.x;
            s.erase(it++);
        }
    }
    for (auto x: ans){
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 21228
import java.util.Scanner;
class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        long l = stdIn.nextInt();
        long r = stdIn.nextInt();
    
        long min = 2018;
        for(long i = l;i < l + 2019 && i < r;i++) {
            for(long j = r;j > r - 2019 && j > i;j--) {
                if((i*j)%2019 < min){
                    min = (i*j)%2019;
                }
            }
        }

        System.out.println(min);
        
        
    }
}



Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> l_l;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
const int INF=1001001000;
const int mINF=-1001001000;
const ll LINF=1010010010010010000;
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;
}
//グリッド：（典型）dp,dfs,bfs,最短経路,その他
int main(){
    int n;cin >> n;
    vl a(n);
    rep(i,n) cin >> a[i];
    sort(a.begin(),a.end());
    ll ans1,ans2;
    {
        ans1=0;
        vl kei;
        kei.push_back(-1);
        if(n%2==0){
            for(int i=1;i<n-1;i++){
                if(i%2==1) kei.push_back(2);
                else kei.push_back(-2);
            }
            kei.push_back(1);
        }
        else{
            for(int i=1;i<n-1;i++){
                if(i%2==1) kei.push_back(2);
                else kei.push_back(-2);
            }
            kei.push_back(-1);
        }
        sort(kei.begin(),kei.end());
        rep(i,n){
            ans1+=kei[i]*a[i];
        }
    }
    {
        ans2=0;
        vl kei;
        kei.push_back(1);
        if(n%2==0){
            for(int i=1;i<n-1;i++){
                if(i%2==1) kei.push_back(-2);
                else kei.push_back(2);
            }
            kei.push_back(-1);
        }
        else{
            for(int i=1;i<n-1;i++){
                if(i%2==1) kei.push_back(-2);
                else kei.push_back(2);
            }
            kei.push_back(1);
        }
        sort(kei.begin(),kei.end());
        rep(i,n){
            ans2+=kei[i]*a[i];
        }
    }
    if(ans1>ans2){
        cout << ans1 << endl;
    }
    else cout << ans2 << endl;
    return 0;
}

Measured memory_bytes: 2788
#include <bits/stdc++.h>
using ll = long long;
#define FOR(i, k, n) for(ll i = (k); i < (n); i++)
#define FORe(i, k, n) for(ll i = (k); i <= (n); i++)
#define FORr(i, k, n) for(ll i = (k)-1; i > (n); i--)
#define FORre(i, k, n) for(ll i = (k)-1; i >= (n); i--)
#define REP(i, n) FOR(i, 0, n)
#define REPr(i, n) FORre(i, n, 0)
#define ALL(x) (x).begin(), (x).end()
#define ALLr(x) (x).rbegin(), (x).rend()
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;

const int INF = 1001001001;

int main(void){
  ll n;
  cin >> n;
  vector<ll> a(n);
  map<ll, ll> mp;
  REP(i, n){
    cin >> a[i];
    mp[a[i]]++;
  }
  ll ans = 0;
  for(auto p : mp){
    ans += p.second*(p.second-1)/2;
  }
  REP(i, n){
    ll m = mp[a[i]];
    cout << ans-m*(m-1)/2+(m-1)*(m-2)/2 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 11008
/* cerberus97 - Hanit Banga */

#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>

using namespace std;

#define pb push_back
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)

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

const int N = 1e5 + 10;

int main() {
	fast_cin();
	int n, k;
	cin >> n >> k;
	// if (k % 2 == 0) {
	// 	k /= 2;
	// }
	ll c1 = 0, c2 = 0;
	for (int i = 1; i <= n; ++i) {
		if (i % k == 0) {
			++c1;
		} else if (k % 2 == 0 and i % (k / 2) == 0) {
			++c2;
		}
	}
	cout << c1 * c1 * c1 + c2 * c2 * c2 << endl;
}

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

using namespace std;

int main(void) {
    long n;
    cin >> n;
    vector<long> a(n), b(n);
    for(auto &x: a) cin >> x, x*=2;
    b[0] = a[0];
    for(int i=1; i<n; i++)
        b[i] = b[i-1] + a[i];

    long r = 1e18;
    long l = b[n-1];
    for(int i=0; i<n-1; i++) {
        long x = min(b[i], l-b[i]);
        long t = l-2*x;
        if(t%2) t++;
        r = min(t, r);
    }
    cout << r/2 << endl;
}


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

bool m;

void cp(int a[9],int b[9]){
	for(int i=0;i<9;i++) a[i] = b[i];
}

void func(int s,int k,int b[9]){
	if(m) return;
	else if(s==4){
		bool c = false;
		for(int i=0;i<9;i++) if(b[i]==2) c = true;
		if(c) m = true;
	}
	else if(s<k){
		for(int i=0;i<9;i++){
			int a[9];
			cp(a,b);
			if(a[i]<3) continue;
			a[i] -= 3;
			func(s+1,k,a);
		}
	}
	else{
		for(int i=0;i<7;i++){
			int a[9];
			cp(a,b);
			if(a[i]*a[i+1]*a[i+2]==0) continue;
			a[i]--;
			a[i+1]--;
			a[i+2]--;
			func(s+1,k,a);
		}
	}
}

int main(){
	int a[14];
	bool s;
	while(scanf("%1d",&a[0])!=EOF){
		s = true;
		for(int i=1;i<13;i++) scanf("%1d",&a[i]);
		for(int i=1;i<10;i++){
			a[13] = i;
			int b[9] = {0,0,0,0,0,0,0,0,0};
			for(int j=0;j<14;j++) b[a[j]-1]++;
			bool h = false;
			for(int j=0;j<9;j++) if(b[j]>4) h = true;
			if(h) continue;
			m = false;
			for(int j=0;j<=4;j++) func(0,j,b);
			if(m){
				if(s){
					s = false;
					cout << i;
				}
				else cout << " " << i;
			}
		}
		if(s) cout << 0;
		cout << endl;
	}
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << (x) << endl
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> V;

int main() {
  ll h, w;
  cin >> h >> w;
  if (h%3 == 0 || w%3 == 0) dump(0);
  else {
    ll res = 1000000;
    for (int i = 1; i <= h/2; i++) {
      int x = (h-i)/2;
      int y = (h-i) - (h-i)/2;
      res = min(res, max(i*w, max(x*w, y*w))-min(i*w, min(x*w, y*w)));
    }
    for (int i = 1; i <= h/2; i++) {
      int x = w/2;
      int y = w-w/2;
      res = min(res, max(i*w, max(x*(h-i), y*(h-i)))-min(i*w, min(x*(h-i), y*(h-i))));
    }
    for (int i = 1; i <= w/2; i++) {
      int x = (w-i)/2;
      int y = (w-i) - (w-i)/2;
      res = min(res, max(i*h, max(x*h, y*h))-min(i*h, min(x*h, y*h)));
    }
    for (int i = 1; i <= w/2; i++) {
      int x = h/2;
      int y = h-h/2;
      res = min(res, max(i*h, max(x*(w-i), y*(w-i)))-min(i*h, min(x*(w-i), y*(w-i))));
    }
    dump(res);
  }
  return 0;
}


Measured memory_bytes: 256
import collections
import sys

input = sys.stdin.readline

class common_function():
    """
        1. よく使いそうで予め用意してあるものをまとめた
        2. よく使いそうな関数群をまとめた
    """
    def nCk(self, n:int, k:int):
        """
            mod を使用しない combination nCk を求めるメソッド
            1回 の nCk を求めるのに O(k) かかる.
        """
        k = min(k, n-k)
        numer = 1
        for i in range(n, n-k, -1):
            numer *= i
        denom = 1
        for i in range(k, 1, -1):
            denom *= i
        return numer // denom

def main():
    common = common_function()
    N = int(input())
    slist = []
    tlist = []
    for _ in range(N):
        s = list(input()[:-1])
        s.sort()
        slist.append(s)
    slist.sort()
    cnt = 1; tlist.append(cnt)
    for i in range(N-1):
        if slist[i] == slist[i+1]:
            tlist.append(cnt)
        else:
            cnt += 1
            tlist.append(cnt)
    tlistcount = list(collections.Counter(tlist).items())
    tlistcount.sort(key=lambda x: x[1], reverse=True)
    ans = 0
    for t0, t1 in tlistcount:
        if t1 == 1:
            break
        ans += common.nCk(t1, 2)
    print(ans)

if __name__ == "__main__":
    main()


Measured memory_bytes: 40360
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) throws Exception {
        long max = 1000000000;
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int n = sc.nextInt();
        long[] dp = new long[h+1];
        Arrays.fill(dp,max);
        dp[0] = 0;
        for(int i = 0; i < n; i++){
            int a = sc.nextInt();
            long b = sc.nextInt();
            for(int j = 0; j < h; j++){
                if(dp[j] >= max)continue;
                int index = Math.min(h,j+a);
                dp[index] = Math.min(dp[j]+b,dp[index]);
            }
        }
        System.out.println(dp[h]);
    }
}

class FastScanner {
    private BufferedReader reader = null;
    private StringTokenizer tokenizer = null;
    
    public FastScanner(InputStream in) {
        reader = new BufferedReader(new InputStreamReader(in));
        tokenizer = null;
    }

    public String next() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                tokenizer = new StringTokenizer(reader.readLine());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return tokenizer.nextToken();
    }

    public String nextLine() {
        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
            try {
                return reader.readLine();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
            return tokenizer.nextToken("\n");
    }

    public long nextLong() {
        return Long.parseLong(next());
    }
    
    public int nextInt() {
        return Integer.parseInt(next());
    }
    public double nextDouble() {
         return Double.parseDouble(next());
    }

    public int[] nextIntArray(int n) {
        int[] a = new int[n];
        for (int i = 0; i < n; i++) a[i] = nextInt();
        return a;
    }

    public long[] nextLongArray(int n) {
        long[] a = new long[n];
        for (int i = 0; i < n; i++) a[i] = nextLong();
        return a;
    } 
}

Measured memory_bytes: 26936
#include "bits/stdc++.h"
using namespace std;
int main(){
  long long n, p;
  cin >> n >> p;
  long long g = 1;
  for(int e = 2; e <= 1000000; e++){
    int c = 0;
    while(p%e == 0){
      p /= e;
      c++;
      if(c == n){
        g *= e;
        c = 0;
      }
    }
  }
  if(p != 1 && n == 1) g *= p;
  cout << g << endl;
  return 0;
}


Measured memory_bytes: 256
# from pprint import pprint
# import math
# import collections

# n = int(input())
s = input()
# s = 'keyxxxxxxxxxxence'
# n, k = map(int, input().split(' '))
# a = list(map(int, input().split(' ')))

K = 'keyence'

for i in range(len(s)):
    for j in range(len(s)):
        s1 = s[0:i]
        s2 = s[i:i + j]
        s3 = s[i + j:]

        # print(s1,s2,s3)
        if s1 == K or s2 == K or s3 == K or s1 + s2 == K or s1 + s3 == K or s2 + s3 == K:
            print('YES')
            exit()

print('NO')


Measured memory_bytes: 9068
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#define ll long long
#define N 100005
#define inf 0x3f3f3f3f
using namespace std;
ll sum,a[N],t,tmp,n;
int main() {
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        sum+=a[i];
        t+=i;
    }
    if(sum%t)cout<<"NO";
    else{  

    	
        tmp=a[1];
        for(int i=1;i<n;i++)a[i]=a[i+1]-a[i];
        a[n]=tmp-a[n];
        ll d=sum/t,ok=1;
        for(int i=1;i<=n&&ok;i++){
            a[i]-=d;
            if(a[i]%n||a[i]>0)ok=0;
        }
        if(ok)cout<<"YES";
        else cout<<"NO";
    }
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int M1, D1, M2, D2;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> M1 >> D1 >> M2 >> D2;
	if (M1 < M2) cout << 1 << endl;
	else cout << 0 << endl;
}







Measured memory_bytes: 256
import java.io.File;
import java.io.IOException;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		//File file = new File("input.txt");
		//Scanner in = new Scanner(file);
		
		Scanner in = new Scanner(System.in);
		
		int n = in.nextInt();
		long[] a = new long[n];
		long sum = 0;
		
		for(int i = 0; i < n; i++) {
			a[i] = in.nextInt();
            sum += a[i];
		}
        long x = a[0];
        long y = sum - a[0];
        //System.out.println(x + " " + y);
        long min = Math.abs(x - y);
		
		for(int i = 1; i < n-1; i++) {
			x += a[i];
			y -= a[i];
			//System.out.println(x + " " + y);
            if(Math.abs(x - y) < min) min = Math.abs(x - y);
		}
		
		System.out.println(min);
	}
}


Measured memory_bytes: 81496
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;

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

	cin >> X >> Y;

	long long ans = 1;
	long long v = X;
	while(true){
		v *= 2;
		if(v > Y){ break; }
		ans++;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <string>
#include <stack>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cmath>
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

using namespace std;
typedef long long int ll;
ll dp[50][51][2501];	// i番目以降で構成される配列で、j個の数字を使って、kという数字を作る場合の数
int numList[50];

void init(){
	for(int i = 0; i < 50; i++){
		for(int j = 0; j < 51; j++){
			for(int k = 0; k < 2501; k++)dp[i][j][k] = -1;
		}
	}
}

ll dfs(int target,int n,int startIndex,int N){	// n 個の数を使って targetを作る場合の数を返す
	if(startIndex == N) return 0;
	if(n == 0) return 0;
	if(target <= 0) return 0;
	if(dp[startIndex][n][target] != -1) return dp[startIndex][n][target];
	if(n == 1){
		int count = 0;
		for(int i = startIndex; i < N; i++){
			if( numList[i] == target) count++;
		}
		dp[startIndex][n][target] = count;
		return count;
	}
	
	if( numList[startIndex] > target){
		dp[startIndex][n][target] = 0;
		return 0;
	}
	ll ans = 0;
	//numList[startIndex] を使う場合と使わない場合の二通りの和を返す
	int a = numList[startIndex];
	ans += dfs(target,n,startIndex + 1,N); //使わない場合
	ans += dfs(target-a,n-1,startIndex+1,N);
	dp[startIndex][n][target] = ans;
	return ans;
}

int main()
{
	init();
	ll N,A;
	cin>>N>>A;
	rep(i,N) cin>>numList[i];
	sort(numList,numList+N);
	ll ans = 0;
	for(int i = 1 ; i <= N; i++){
		ans += dfs(A*i,i,0,N);
	}
	cout<<ans<<endl;
	return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll,ll> ii;
typedef pair<string,ll> si;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<si> vsi;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vsi> vvsi;

bool a[100005];
ll dp[100005],n,m;

ll mod = (int)pow(10,9)+7;
ll dop(int pos)
{
	ll cont = 0;
	if(!a[pos]) return 0;
	if(pos<=0) 
		return 1;
	if(dp[pos]!=-1)
		return dp[pos];
	ll ans = (dop(pos-1))%mod+dop(pos-2)%mod;
	return dp[pos] = ans%mod;
	
}

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
 	cout.tie(NULL);
 	memset(a, 1, sizeof a);
 	memset(dp,-1, sizeof dp);
 	int j;
 	cin>>n>>m;
 	for(int i = 0 ; i < m ; i++)
 	{
 			cin>>j;
 			a[j] = 0;
 	}
 	
 	cout<<dop(n)<<endl;
	return 0;
}

Measured memory_bytes: 4224
#include<bits/stdc++.h>
using namespace std;
int main()
{
 int n,k;
 cin>>n>>k;
 int arr[n],count=0;;
 for(int i=0;i<n;i++)
 {
     cin>>arr[i];
     if(arr[i]>=k)
        count++;
 }
 cout<<count<<endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<V>;
using VVV = vector<VV>;
using VL = vector<ll>;
using VVL = vector<VL>;
using VVVL = vector<VVL>;
template<class T> using VE = vector<T>;
template<class T> using P = pair<T, T>;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define REP(i,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
int main() {
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n + x - 1) / x * t << endl;
	return 0;
}

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int h, w;
  cin >> h >> w;
  
  vector<vector<int>> a(h, vector<int>(w));
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cin >> a.at(i).at(j);
    }
  }
  
  vector<pair<int, int>> x, y;
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w - 1; j++){
      if(a.at(i).at(j) % 2 == 1){
        x.push_back(make_pair(i + 1, j + 1));
        y.push_back(make_pair(i + 1, j + 2));
        a.at(i).at(j)--;
        a.at(i).at(j + 1)++;
      }
    }
  }
  
  for(int i = 0; i < h - 1; i++){
    if(a.at(i).at(w - 1) % 2 == 1){
      x.push_back(make_pair(i + 1, w));
      y.push_back(make_pair(i + 2, w));
      a.at(i).at(w - 1)--;
      a.at(i + 1).at(w - 1)++;
    }
  }
  
  cout << x.size() << '\n';
  for(int i = 0; i < x.size(); i++){
    cout << x.at(i).first << " " << x.at(i).second << " " << y.at(i).first << " " << y.at(i).second << '\n';
  }
}

Measured memory_bytes: 5356
#include <numeric>
#include<iostream>
#include<set>
#include <bitset>
#include<queue>
#include<vector>
#include<map>
#include<stack>
#include <cstdio>
#include<algorithm>
#include <sstream>
#include<string>
#include<string.h>
#include <cmath>
#include <iomanip>
#include <string>
#include<list>
using namespace std;
#define int long long
#define inf  1000000007
#define rep(i,j,n) for(int i=j;i<n;i++)
typedef pair<int,int>  P;
double pi = 3.141592653589793;
//使うやつはここから下に置こうな
signed main(){
    int n;cin>>n;
    int dp[114514]={};
    rep(i,0,114514)dp[i]=inf;
    dp[0]=0;
    dp[1]=1;
    rep(i,2,n+1){
        int c=1;
        while(i-c>=0){
            dp[i]=min(dp[i],dp[i-c]+1);
            c*=6;
        }
        c=1;
        while((i-c)>=0){
            dp[i]=min(dp[i],dp[i-c]+1);
            c*=9;
        }
    }
    cout<<dp[n]<<endl;
    return 0;
}

Measured memory_bytes: 1152
def make_divisors(n):
    ans=0
    for i in range(1,int(n**0.5)+1):
        if n%i==0:
            if i>2:
                if n//i < i-1:
                    ans+=i-1
            if i!=n//i:
                if i < n//i-1:
                    ans+=n//i-1
    return ans

n=int(input())
print(make_divisors(n))

Measured memory_bytes: 3060
#include <cstdio>
#include <cstring>
#include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <stack>
using namespace std;
const int MaxN = 1000;
const int xx[] = {0, 0, 0, -1, 1};  //15-16行：15与16行定义坐标。作用：在第36与37行,将nxt的x和y坐标向前后左右移动。
const int yy[] = {0, 1, -1, 0, 0};  //理解：当读入这2个数组时，i都相同，所以就相当于对x和y执行了(x+0,y+0),(x+0,y+1),(x+0,y-1),(x-1,y+0),(x+1,y+0)

struct Point{                       //定义结构体， 该结构体含有3个变量，x和y可以理解为坐标,t是原点到该位置所移动的步数。
	int x, y, v;
};

Point que[MaxN * MaxN + 5];     //定义Point型变量结构que,该变量为 队列（重点重点重点）定义的长度为题目中矩阵的元素个数MaxN行MaxN列(+5防止溢出)。
Point S, T;                     //定义Point型变量结构S,T。 S：起点。T：终点。
char a[MaxN +5][MaxN + 5];      //定义二维数组 ，用来表示地图。
bool vis[MaxN + 5][MaxN + 5];   //定义二维数组，用来标记地图中每个元素是否被访问过。
int n, m, ans,tnt;                  //地图n行，m列。ans：统计最短路径的步数。

void Bfs(){
	int head = 1, tail = 0;     //定义队列的头指针(head)和尾指针(tail).用来标记当前队列元素状况，以及判定队列是否为空，应不应该结束运行。
	que[++tail] = S;            //接上-tail小于head 并且++tail：读入起点坐标，并将尾指针后移一位。当tail=head时，标识当前队列只存在一个元素。
	vis[S.x][S.y] = true;       //将起点标记，以免后面重新搜索到改点。
	Point now, nxt;             //定义2个Point型变量结构。now:表示当前所在位置及步数。nxt:表示下一次移动的位置及步数。
	while(head <= tail){        //如果队列不为空，则执行while循环。  head=tail:只有一个元素。head<tail:队列有tail-head+1个元素。
		now = que[head]; head++;     //读入队列当前第一个坐标。并且head后移：将当前now表示的坐标移出队列，因为该坐标不等于答案并且已经完成作用。
		for(int i = 1; i <= 4; i++){ //35-37行：将当前位置的前后左右搜索一遍。进行38-45行的处理。
			nxt.x = now.x + xx[i];
			nxt.y = now.y + yy[i];
			if(nxt.x < 1 || nxt.x > n || nxt.y < 1 || nxt.y > m) continue;  //判断当前位置的前后左右是否超出地图边界。超出就跳过，进行下一次循环
			if(vis[nxt.x][nxt.y] || a[nxt.x][nxt.y] == '#') continue;       //判断当前位置是否被搜索过(vis标记)，已及当前位置是不是墙，能不能走。
			nxt.v = now.v + 1;                    //如果前面条件均满足，则将该位置的步数记录(到达该位置的步数等于上一个点的步数加一)
			que[++tail] = nxt;                    //尾指针后移，并将该位置进入队列。准备之后对该位置的周围进行搜索。
			vis[nxt.x][nxt.y] = true;             //标记该位置，表示已经搜索过，之后不再进行搜索。
			if(nxt.x == T.x && nxt.y == T.y){     //判断该位置是否为终点。
				ans = nxt.v;                      //由于该题只要最少步数，故只统计到终点所需要的步数。
				return;							  //因为找到了答案了，故结束当前函数。
			}
		}
	}
}

int main()
{
	scanf("%d %d", &n, &m);                              //读入地图长宽
//	for(int i = 1; i <= n; i++) scanf("%s", a[i] + 1);	 //读入地图元素
/*	for(int i = 1; i <= n; i++){                         //55-59行：遍历地图，找到起点和终点。用S和T标记。
		for(int j = 1; j <= m; j++){                     
			if(a[i][j] == 'S') S.x = i, S.y = j;
			else if(a[i][j] == 'T') T.x = i, T.y = j;
		}
	}
*/
	for(int i = 1 ; i<= n ; i++){
		for(int j = 1 ; j<= m;j++){
			cin >> a[i][j];
			if(a[i][j] == '#'){
				tnt++;
			}
		}
	}
	S.x = 1;
	S.y = 1;
	T.x = n;
	T.y = m;

	Bfs();       
	if(ans == 0)
	{
		cout << -1 << endl;
		return 0;
	}
	else
	{//执行bfs搜索
	ans++;
	cout << (n * m - ans -tnt) << endl;
	}
    return 0;                                            //程序终于结束啦。。。。。。。。。。。。。哈哈哈哈哈哈哈
}


Measured memory_bytes: 384
#include<stdio.h>
void swapSort(int *x,int *y){
  int temp;
  temp = *x;
  *x =*y;
  *y = temp;
}
int bubbleSort(int A[], int N){
  int i,j;
  static int count =0;
  for(i=0;i<N-1;i++){
    for(j=N-1;j>=i+1;j--){
      if(A[j]<A[j-1]){
	swapSort(&A[j],&A[j-1]);
	count=count+1;
      }
    }
  }
  for(i=0;i<N;i++){
    if(i>0)printf(" ");
    printf("%d",A[i]);
  }
  printf("\n%d\n",count);
}

int main(){
  int A[100],N,i;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&A[i]);
  }
  bubbleSort(A,N);
  return 0;
}



Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
const ll mod=1000000007;
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
// head

namespace linear_seq {
    const int N=10010;
    ll res[N],base[N],_c[N],_md[N];

    vector<int> Md;
    void mul(ll *a,ll *b,int k) {
        rep(i,0,k+k) _c[i]=0;
        rep(i,0,k) if (a[i]) rep(j,0,k) _c[i+j]=(_c[i+j]+a[i]*b[j])%mod;
        for (int i=k+k-1;i>=k;i--) if (_c[i])
            rep(j,0,SZ(Md)) _c[i-k+Md[j]]=(_c[i-k+Md[j]]-_c[i]*_md[Md[j]])%mod;
        rep(i,0,k) a[i]=_c[i];
    }
    int solve(ll n,VI a,VI b) { // a 系数 b 初值 b[n+1]=a[0]*b[n]+...
//        printf("%d\n",SZ(b));
        ll ans=0,pnt=0;
        int k=SZ(a);
        assert(SZ(a)==SZ(b));
        rep(i,0,k) _md[k-1-i]=-a[i];_md[k]=1;
        Md.clear();
        rep(i,0,k) if (_md[i]!=0) Md.push_back(i);
        rep(i,0,k) res[i]=base[i]=0;
        res[0]=1;
        while ((1ll<<pnt)<=n) pnt++;
        for (int p=pnt;p>=0;p--) {
            mul(res,res,k);
            if ((n>>p)&1) {
                for (int i=k-1;i>=0;i--) res[i+1]=res[i];res[0]=0;
                rep(j,0,SZ(Md)) res[Md[j]]=(res[Md[j]]-res[k]*_md[Md[j]])%mod;
            }
        }
        rep(i,0,k) ans=(ans+res[i]*b[i])%mod;
        if (ans<0) ans+=mod;
        return ans;
    }
    VI BM(VI s) {
        VI C(1,1),B(1,1);
        int L=0,m=1,b=1;
        rep(n,0,SZ(s)) {
            ll d=0;
            rep(i,0,L+1) d=(d+(ll)C[i]*s[n-i])%mod;
            if (d==0) ++m;
            else if (2*L<=n) {
                VI T=C;
                ll c=mod-d*powmod(b,mod-2)%mod;
                while (SZ(C)<SZ(B)+m) C.pb(0);
                rep(i,0,SZ(B)) C[i+m]=(C[i+m]+c*B[i])%mod;
                L=n+1-L; B=T; b=d; m=1;
            } else {
                ll c=mod-d*powmod(b,mod-2)%mod;
                while (SZ(C)<SZ(B)+m) C.pb(0);
                rep(i,0,SZ(B)) C[i+m]=(C[i+m]+c*B[i])%mod;
                ++m;
            }
        }
        return C;
    }
    int gao(VI a,ll n) {
        VI c=BM(a);
        c.erase(c.begin());
        rep(i,0,SZ(c)) c[i]=(mod-c[i])%mod;
        return solve(n,c,VI(a.begin(),a.begin()+SZ(c)));
    }
};

int main() {
    int T;
    scanf("%d",&T);
    while(T--)
    {
        int n;
        scanf("%d",&n);
        printf("%d\n",linear_seq::gao(VI
{0,0,0,0,1,11,71,341,1346,4598,14038,39138,101193,245443,563447,1232837,2585672,5222552,10198232,19316488,35588718,63933498,112225058,192839398,324900532,537499132,874246012,399637805,207858088,434820093,274485959,780358,996765147,793168065,118878018,966647141,677996797,52230779,485540255,147468710,203524158,94513877,885277100,697944950,247718575,502478077,491383141,292066399,231133366,338549256},n-1));
    }
    return 0;
}


Measured memory_bytes: 3744
if __name__ == '__main__':
    import sys
    input = sys.stdin.readline

    n = int(input())

    A = [None] + list(map(int, input().split()))
    B = [None]*(n+1)

    C = [0]*10001

    k = 10000

    for j in range(n):
        C[A[j+1]] += 1

    for i in range(1, k+1):
        C[i] += C[i-1]


    for j in range(1, n+1):
        B[C[A[j]]] = A[j]
        C[A[j]] -= 1

    print(' '.join(map(str, B[1:])))



Measured memory_bytes: 248416
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,tmp=1,nx=2;
  string ans;
  cin >> n;
  while(n!=0){
    if(n%nx!=0){
      n-=tmp;
      ans+='1';
    }else{
      ans+='0';
    }
    nx*=2;
    tmp*=-2;
  }
  for(int i=ans.size()-1;i>=0;i--){
    cout << ans[i];
  }
  if(ans.size()==0){
    cout << "0";
  }
  cout << endl;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#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()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

struct edge {
    int to;
    ll cost;
    edge(int t, ll c) : to(t), cost(c) {}
};

using pil = pair<int, ll>;
void dijkstra(int s, vector<ll> &d, vector<vector<edge>> &G) {
    priority_queue<pil, vector<pil>, greater<pil>> que;
    fill(All(d), LINF);
    d[s] = 0;
    que.push(make_pair(0, s));

    while(!que.empty()) {
        pil p = que.top();
        que.pop();
        int v = p.second;
        if(d[v] < p.first)
            continue;
        for(auto e : G[v]) {
            if(d[e.to] > d[v] + e.cost) {
                d[e.to] = d[v] + e.cost;
                que.push(make_pair(d[e.to], e.to));
            }
        }
    }
}

int main() {
    int N, M, s, t;
    cin >> N >> M >> s >> t;
    s--, t--;
    vector<vector<edge>> G(N), G2(N);
    rep(i, M) {
        int u, v;
        ll a, b;
        cin >> u >> v >> a >> b;
        u--, v--;
        G[u].pb(edge(v, a));
        G[v].pb(edge(u, a));
        G2[u].pb(edge(v, b));
        G2[v].pb(edge(u, b));
    }
    vector<ll> dist(N), dist2(N);

    dijkstra(s, dist, G);
    dijkstra(t, dist2, G2);
    vector<ll> res(N);
    ll tmp = 0;
    for(int i = N - 1; i >= 0; i--) {
        tmp = max(tmp, (ll)1e15 - dist[i] - dist2[i]);
        res[i] = tmp;
    }
    rep(i, N) { cout << res[i] << endl; }
    return 0;
}

Measured memory_bytes: 22700
c = [list(map(int, input().split())) for i in range(3)]
combos = []
count = 0
for a in range(101):
  b1, b2, b3 = c[0][0] - a, c[0][1] - a, c[0][2] - a
  if b1 >= 0 and b2 >= 0 and b3 >= 0:
    combos.append([b1, b2, b3])

for combo in combos:
  b1, b2, b3 = combo
  count = 0
  for i in range(3):
    for a in range(101):
      if c[i][0] == a + b1 and c[i][1] == a + b2 and c[i][2] == a + b3:
        count += 1
        break
  if count == 3:
    break

if count == 3:
  print('Yes')
else:
  print('No')

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

int main() {
  string s;
  cin >> s;

  for (int i=0; i<s.size(); i++) {
    s.at(i) = 'x';
  }
  for (int i=0; i<s.size(); i++) {
    cout << s.at(i); 
  }
  cout << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,_7,_8,NAME,...) NAME
#define pr(...) cerr<< GET_MACRO(__VA_ARGS__,pr8,pr7,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__) <<endl
#define pr1(a) (#a)<<"="<<(a)<<" "
#define pr2(a,b) pr1(a)<<pr1(b)
#define pr3(a,b,c) pr1(a)<<pr2(b,c)
#define pr4(a,b,c,d) pr1(a)<<pr3(b,c,d)
#define pr5(a,b,c,d,e) pr1(a)<<pr4(b,c,d,e)
#define pr6(a,b,c,d,e,f) pr1(a)<<pr5(b,c,d,e,f)
#define pr7(a,b,c,d,e,f,g) pr1(a)<<pr6(b,c,d,e,f,g)
#define pr8(a,b,c,d,e,f,g,h) pr1(a)<<pr7(b,c,d,e,f,g,h)
#define prArr(a) {cerr<<(#a)<<"={";int i=0;for(auto t:(a))cerr<<(i++?", ":"")<<t;cerr<<"}"<<endl;}
using namespace std;
using Int = long long;
using _int = int;
using ll = long long;
using Double = long double;
const Int INF = (1LL<<60)+1e9; // ~ 1.15 * 1e18
const Int mod = (1e9)+7;
const Double EPS = 1e-8;
const Double PI = 6.0 * asin((Double)0.5);
using P = pair<Int,Int>;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
template<class T1, class T2> ostream& operator<<(ostream& o,pair<T1,T2> p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T1, class T2, class T3> ostream& operator<<(ostream& o,tuple<T1,T2,T3> t){
  return o<<"("<<get<0>(t)<<","<<get<1>(t)<<","<<get<2>(t)<<")";}
template<class T1, class T2> istream& operator>>(istream& i,pair<T1,T2> &p){return i>>p.first>>p.second;}
template<class T> ostream& operator<<(ostream& o,vector<T> a){Int i=0;for(T t:a)o<<(i++?" ":"")<<t;return o;}
template<class T> istream& operator>>(istream& i,vector<T> &a){for(T &t:a)i>>t;return i;}





signed main(){
  srand((unsigned)time(NULL));
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  while(1){
    int n;
    cin>>n;
    if(n == 0) break;
    int m;
    cin>>m;

    vector<vector<int> > mat(n, vector<int>(n,0));
    for(int i=0;i<n;i++) mat[i][i] = -1;
    
    for(int i=0;i<m;i++){
      int x,y;
      cin>>x>>y; x--, y--;
      mat[x][y] = 1;
      mat[y][x] = -1;
    }
    
    //for(int i=0;i<n;i++) pr(mat[i]);

    function<int(int,int,vector<int>&)> dfs= [&](int y,int x, vector<int> &cnt){
      if(x >= n) x = 0, y++;
      if(y >= n) return 1;
      if(y == x) return dfs(y, x+1, cnt);
      if(mat[y][x] != 0) {
	int num = mat[y][x] == 1? 1:0;
	if(y < x){
	  cnt[y] += num;
	  cnt[x] += !num;
	}
	int res = (cnt[x] <= (n-1)/2 && cnt[y]<=(n-1)/2)? dfs(y, x+1, cnt):0;
	if(y < x){
	  cnt[y] -= num;
	  cnt[x] -= !num;
	}
	return res;
      }

      int res = 0;
      for(int num=0;num<2;num++){
	if(y < x){
	  cnt[y] += num;
	  cnt[x] += !num;
	  mat[y][x] = num == 1? 1:-1;
	  mat[x][y] = num == 1? -1:1;
	}
	res += (cnt[x] <= (n-1) /2 && cnt[y]<=(n-1)/2)? dfs(y, x+1, cnt):0;
	if(y < x){
	  cnt[y] -= num;
	  cnt[x] -= !num;
	  mat[y][x] = 0;
	  mat[x][y] = 0;
	}
      }
      return res;
    };

    vector<int> cnt(n, 0);
    int ans = dfs(0, 0, cnt);
    cout<<ans<<endl;
    
  }
  return 0;
}



Measured memory_bytes: 3132
import heapq
N, C, *STC = [int(_) for _ in open(0).read().split()]
STC = [(s, t, c) for s, t, c in zip(STC[::3], STC[1::3], STC[2::3])]
STC.sort()
#もしcを映しているテレビがあるならこれにしてしまうのが最適
#cを映しているテレビがないならすでに終わっているテレビのどれかを選ぶ
#どのテレビもすでに映しているなら新しいテレビを追加する

class SegmentTree():
    def __init__(self, array, f, ti):
        """
        Parameters
        ----------
        array : list
            to construct segment tree from
        f : func
            binary operation of the monoid
        ti : 
            identity element of the monoid
        """
        self.f = f
        self.ti = ti
        self.n = n = 2**(len(array).bit_length())
        self.dat = dat = [ti] * n + array + [ti] * (n - len(array))
        for i in range(n - 1, 0, -1):  # build
            dat[i] = f(dat[i << 1], dat[i << 1 | 1])

    def update(self, p, v):  # set value at position p (0-indexed)
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = v
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def operate_right(self, p, v):  # apply operator from the right side
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = f(dat[p], v)
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def operate_left(self, p, v):  # apply operator from the left side
        f, n, dat = self.f, self.n, self.dat
        p += n
        dat[p] = f(v, dat[p])
        while p > 1:
            p >>= 1
            dat[p] = f(dat[p << 1], dat[p << 1 | 1])

    def query(self, l, r):  # result on interval [l, r) (0-indexed)
        f, ti, n, dat = self.f, self.ti, self.n, self.dat
        vl = vr = ti
        l += n
        r += n
        while l < r:
            if l & 1:
                vl = f(vl, dat[l])
                l += 1
            if r & 1:
                r -= 1
                vr = f(dat[r], vr)
            l >>= 1
            r >>= 1
        return f(vl, vr)

ti = (10 ** 10, -10 ** 10)
st = SegmentTree([(10 ** 10, i) for i in range(C + 1)], min, ti)
ans = 0
for s, t, c in STC:
    if st.query(c, c + 1)[0] == 10 ** 10:
        t2, c2 = st.query(1, C + 1)
        if t2 < s:
            st.update(c2, (10 ** 10, c2))
        else:
            ans += 1
    st.update(c, (t, c))
print(ans)


Measured memory_bytes: 39176
#include <iostream>
#include <string>
#include <list>

int main (){
    std::string s;
    std::cin >> s;
    const int n = s.length();
    int num = 0;
    for (int i=0; i<n/2; i++) {
        if (s[i]!=s[n-1-i]) { num = num+1; }
    }
    std::cout << num << std::endl;
  
  return 0;
}


Measured memory_bytes: 256
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        For i As Integer = N To Integer.MaxValue
            If Judge(i) Then
                WriteLine(i)
                Exit For
            End If
        Next
    End Sub

    Function Judge(n As Integer) As Boolean
        Dim i, j As Integer
        Do While n <> 0
            If i = 0 Then
                j = n Mod 10
            Else
                If n Mod 10 <> j Then Return False
            End If
            n \= 10
            i += 1
        Loop
        Return True
    End Function

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp As Integer = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar As Char = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


Measured memory_bytes: 20432
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <queue>
#include <math.h>
#include <bitset>
#define INF 100000000000
#define ll long long
using namespace std;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2

    UnionFind(ll N) : par(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main(){
    ll n,k; cin>>n>>k;
    UnionFind tree(n+1);
    for(ll i=0; i<k; i++){
        ll a,b; cin>>a>>b;
        tree.unite(a,b);
    }
    
    map<ll,ll> mp;
    for(ll i=1; i<=n; i++) mp[tree.root(i)]++;
    
    ll max=0;
    for(auto it=mp.begin(); it!=mp.end(); it++) if(it->second>max) max=it->second;
    
    cout<<max<<endl;
}

Measured memory_bytes: 17140
#include<stdio.h>
int main()
{
char a;
char b;
char c;
char d='R';

scanf("%c%c%c",&a,&b,&c);

if(b==d){printf("%c%c%c",a,'B',c);
}else{printf("%c%c%c",a,d,c);}

return 0;
}


Measured memory_bytes: 2084