akhauriyash/Code-Regression huggingface dataset:
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <queue>

template<typename T>
class TBinaryHeap
{
    std::vector<T> FArray;
    void BubbleUp(int Index)
    {
        assert(FArray.size() > Index);
        if(Index == 1) return;
        int Parent = Index / 2;
        if(FArray[Index] <= FArray[Parent]){
            return;
        }
        std::swap(FArray[Index], FArray[Parent]);
        BubbleUp(Parent);
    }
    void BubbleDown(int Index)
    {
        assert(FArray.size() > Index);
        int Left  = Index * 2;
        int Right = Left + 1;
        if(Left  >= FArray.size()) return;
        int Target = Right >= FArray.size() ? Left : FArray[Left] > FArray[Right] ? Left : Right;
        if(FArray[Target] > FArray[Index]){
            std::swap(FArray[Index], FArray[Target]);
            BubbleDown(Target);
        }
    }
public:
    TBinaryHeap()
    {
        FArray.reserve(2000000);
        FArray.resize(1); // dummy
    }
    void push(const T& Value)
    {
        FArray.push_back(Value);
        BubbleUp(FArray.size()-1);
    }
    void pop()
    {
        assert(FArray.size() >= 1);
        FArray[1] = FArray.back();
        FArray.pop_back();
        if(FArray.size() == 1) return; // dummy???????????????
        BubbleDown(1);
    }
    const T& top()
    {
        return FArray[1];
    }
};
int main()
{
    char Line[19];
    int Value;

    // std::priority_queue<int> S;
    TBinaryHeap<int> S;
    while(1){
        std::fgets(Line, 19, stdin);
        if(Line[0] == 'i'){
            S.push(std::atoi(&Line[7]));
        }else
        if(Line[1] == 'x'){
            std::printf("%d\n", S.top());
            S.pop();
        }else{
            break;
        }
    }
    return 0;
}

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

char a[101];
int u=0,cvp=0;

int main(){
  cin>>a;
  for(int i=0;a[i];i++)u++;
	for(int i=0;i<u/2;i++)if(a[i]!=a[u-i-1])cvp++;  
  cout<<cvp;
 	return 0; 
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define F first
#define S second
const int mod = 1e9 + 7, A = 4e3 + 2;
int add(ll x, ll y) {return (x + y) % mod;}
int mul(ll x, ll y) {return (x * y) % mod;}
ll fp (ll x, ll y)
{
    if (!y)
        return 1;
    ll acc = fp(x, y / 2);
    acc = mul(acc, acc);
    if (y & 1)
        acc = mul(acc, x);
    return acc;
}
int fact[A], inv[A];
void pre()
{
    fact[0] = inv[0] = 1;
    for (int i = 1; i < A; i++)
    {
        fact[i] = mul(fact[i - 1], i);
        inv[i] = fp(fact[i] , mod - 2);
    }
}
int ncr(int n, int r)
{
    return mul(fact[n], mul(inv[n - r], inv[r]));
}
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int n, k;
    cin >> n >> k;
    pre();
    for (int i = 1; i <= k; i++)
    {
        int ans = 0;
        if (i <= n - k + 1)
        {
            ans = ncr(k - 1, k - i); // blue blocks permuatations
            ans = mul(ans, ncr(n - k + 1, i)); // blue blocks permuatations with red
        }
        cout << ans << '\n';
    }
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<string.h>
#include<vector>
#include <algorithm>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)

using namespace std;
typedef long long ll;
const int MAXN = 100100;

int head, tail;
int T[MAXN];
char P[MAXN][10];

void enque(int t, char *q) {
	T[tail] = t;
	strcpy(P[tail],q);
	if (tail != MAXN-1)tail++;
	else tail = 0;
}

int deque() {
	int ans = T[head];
	if (head != MAXN-1)head++;
	else head = 0;
	return ans;
}


int main() {
	int n, q;
	int num;
	int cnt = 0;

	cin >> n >> q;
	for (int i = 1; i <= n; i++) {
		scanf("%s", P[i]);
		scanf("%d", &T[i]);
	}
	head = 1;
	tail = n + 1;
	while (head != tail) {
		num = deque();
		if (num > q) {
			num -= q;
			cnt += q;
			if (head == 0)enque(num, P[MAXN-1]);
			else enque(num, P[head - 1]);
		}
		else {
			cnt += num;
			if (head == 0)printf("%s %d\n", P[MAXN-1], cnt);
			else printf("%s %d\n", P[head - 1], cnt);
		}
	}
	return 0;
}


Measured memory_bytes: 4492
#include<bits/stdc++.h>
using namespace std;
int main()
{

  while(true)
  {
    int n;
    string s;
    string t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    string ans;
    int k[300]={0};
    cin>>n;
    if(n==0)
    {
      break;
    }
    for(int i=0;i<n;i++)
    {
      cin>>k[i];
    }
    cin>>s;
      int G=s.size();
      for(int i=n;i<G;i++)
      {
        k[i]=k[i-n];
      }

    for(int b=0;b<G;b++)
    {
      for(int i=0;i<52;i++)
      {
        if(s[b]==t[i])
        {
          if(i-k[b]<0)
          {
            ans+=t[52+(i-k[b])];
          }else{
            ans+=t[i-k[b]];
          }
        }
      }
    }
cout<<ans<<endl;
  }
  return 0;
}



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

bool check(int a, int b, int c)
{
    vector<int> tmp(3);
    tmp[0] = a;
    tmp[1] = b;
    tmp[2] = c;
    sort(tmp.begin(), tmp.end());
    if(tmp[1] == b) return true;
    else return false;
}

int main(void)
{
   int n;
   cin >> n;
   vector<int> p(n);
   rep(i, n) cin >> p[i];
   int ans = 0;
   for(int i = 1; i < n - 1; i++)
   {
       if(check(p[i-1], p[i], p[i+1])) ans++;
   }
   cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

int main()
{
  int N;
  std::cin >> N;
  int V[N], C[N];
  for (int i=0; i<N; i++) std::cin >> V[i];
  for (int i=0; i<N; i++) std::cin >> C[i];
  int a = 0;
  for (int i=0; i<N; i++) if (V[i] > C[i]) a += V[i] - C[i];
  std::cout << a;
  return 0;
}


Measured memory_bytes: 256
i=3;main(n,j){scanf("%d",&n);if(n==3)return!printf("2 3 25\n");for(;j=(n-i+1)/2*2,!(0<j&&j<5001&&i<15001);i+=3);for(i=n-j;i--;printf("%d ",2*i+2));for(;j;printf("%d%s",6*j+3,--j?" ":"\n"));return 0;}

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

using namespace std;

char A[] = {'A', 'B','C','D','E','F','G',
            'H','I','J','K','L','M',
                'N','O','P','Q','R','S',
                    'T','U','V','W','X','Y','Z'};

int main() {
    int N;
    string S;
    
    cin >> N >> S;
    
    for (int i = 0; i < S.size(); ++i) {
        int p = S[i] - 'A';
        cout << A[(p + N) % 26];
    }
    
    cout << '\n';
    
    return 0;
}

Measured memory_bytes: 256
// luogu-judger-enable-o2
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#define maxn 200010
using namespace std;
typedef long long ll;
char s[maxn];
ll L,R;
int n,T;
int fail[maxn];
void get_fail()
{
    fail[1]=0;
    for(int i=2;i<=n;i++)
    {
        int j=fail[i-1];
        while(j&&s[j+1]!=s[i])  j=fail[j];
        if(s[j+1]==s[i])  j++;
        fail[i]=j;
    }
    T=n-fail[n];
}
int sum[maxn][30];
ll calc(ll x,int c)
{
    if(x<=n)    return sum[x][c];
    if(x<=2*n)  return sum[n][c]+sum[x-n][c];
    ll f1=sum[n][c],f2=sum[n][c]+sum[T][c],l1=n,l2=n+T;
    while(x>l1+l2)
    {
        ll tmp=f2;
        f2+=f1;f1=tmp;
        tmp=l2;
        l2+=l1;l1=tmp;
    }
    return f2+calc(x-l2,c);
}
int main()
{
    scanf("%s",s+1);
    cin>>L>>R;
    n=strlen(s+1)/2;
    get_fail();
    for(int i=1;i<=n;i++)
    {
        memcpy(sum[i],sum[i-1],sizeof(sum[i-1]));
        sum[i][s[i]-'a']++;
    }
    for(int i=0;i<26;i++)  printf("%lld ",calc(R,i)-calc(L-1,i));
    puts("");
    return 0;
}

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

int main() {
  int n,m;cin>>n>>m;
  
  vector<int> l(m);
  vector<int> r(m);
  rep(i,m) cin>>l[i]>>r[i];
  
  int a = 0;
  int b = 100001;
  
  rep(i,m) {
    a = max(a,l[i]);
  }
  rep(i,m) {
    b = min(b,r[i]);
  }
  
  if (b-a<0) {
    cout<<0<<endl;
  }
  else {
    cout<<b-a+1<<endl;
  }
  
}

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

int main() {
    int N, moveN;
    int f_N = 0;
    cin >> N;
    moveN = N;
    while(moveN != 0){
        f_N += moveN % 10;
        moveN /= 10;
    }
    if(N % f_N == 0){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3644
#require 'prime'
#require 'openssl'
MOD=10**9+7;  cnt=0; sum=0; prev=nil; can=true; h=Hash.new(0)
def gs() gets.chomp end
def gi() gets.chomp.to_i end
def gsmi() gets.chomp.split.map(&:to_i) end

def ar2(s1,s2,de=nil) Array.new(s1){Array.new(s2,de)} end
def ar3(s1,s2,s3,de=nil) Array.new(s1){Array.new(s2){Array.new(s3,de)}} end

def desc(ar) ar.sort!{|x,y| y<=>x} end
def min(a,b) a<=b ? a : b end
def max(a,b) a>=b ? a : b end
def sum(ar) ar.inject(:+).to_i end
def ceil(a,b) (a.to_f/b).ceil end

def C(a,b) b==0||a==b ? 1 : (b=a-b if a/2<b;(a-b+1..a).inject(:*)/(1..b).inject(:*)) end
def rui(ar) s=[0]; ar.size.times{|i| s<<s[-1]+ar[i]}; s end
def rev_rui(ar) s=[0]; ar.size.times.reverse_each{|i| s<<s[-1]+ar[i]}; s end

def puts_yesno(b) puts(b ? 'Yes' : 'No') end
def putsend(s) puts s; exit end
def pu(h) begin; require './../nemi_lib/debug.rb'; puts_val(h); rescue LoadError; end; end
########### ( ˘ω˘ )ｽﾔｧ… ###########
a,b,c,k=gsmi

sum = [a, k].min
k = k - a

if k <= b
  # Bを全部取る前に終了
  putsend(sum)
end
k = k - b

sum = sum + (-1) * k

puts sum

Measured memory_bytes: 14304
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif

  ios_base::sync_with_stdio(false);
  cout.tie(NULL);
  cin.tie(NULL);
  ll n, i, j, ans = 0;
  cin >> n;
  vector<ll>A(n);
  for (i = 1; i < n; i++)
  {
    for (j = i; j < n; j += i)
    {
      A[j]++;
    }
  }
  for (i = 0; i < n; i++)
  {
    ans += A[i];
  }
  cout << ans;
  return (0);
}


Measured memory_bytes: 11056
N = int(input())
S = input()

result = 0
for i in range(10):
  a = S.find(str(i))
  if a == -1:
    continue
  for j in range(10):
    b = S.find(str(j), a + 1)
    if b == -1:
      continue
    for k in range(10):
      if S.find(str(k), b + 1) != -1:
        result += 1
print(result)

Measured memory_bytes: 3064
import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N, V = LI()
    a = LI()
    b = LI()
    c = LI()
    d = LI()

    ab = [i+j for i, j in itertools.product(a, b)]
    cd = [i+j for i, j in itertools.product(c, d)]
    ab.sort()
    cd.sort()

    ans = 0
    for i in ab:
        idx_l = bisect.bisect_left(cd, V - i)
        idx_r = bisect.bisect_right(cd, V - i)
        ans += idx_r - idx_l

    print(ans)

if __name__ == '__main__':
    resolve()



Measured memory_bytes: 102296
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
#define rep2(i,a,b) for (int i=(a);i<(b);++i)
#define rrep(i,n) for (int i=(n)-1;i>=0;--i)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;--i)
#define chmax(a, b) (a = (a) < (b) ? (b) : (a))
#define chmin(a, b) (a = (a) > (b) ? (b) : (a))
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define all(a) begin(a),end(a)
#define ifnot(a) if(not (a))
#define dump(x)  cerr << #x << " = " << (x) << endl
// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 1,0,-1,0 };
int dy[] = { 0,1,0,-1 };
const int INF = 1 << 28;
const ll INFL = (ll)1 << 58;
ll mod = (int)1e9 + 7;
const double eps = 1e-10;
typedef long double Real;
// return -1, 0, 1
int sgn(const Real& r) { return (r > eps) - (r < -eps); }
int sgn(const Real& a, const Real &b) { return sgn(a - b); }

//.....................
const int MAX = (int)2e5 + 5;

int x;

void solve() {
	cin >> x;
	puts(x < 1200 ? "ABC" : "ARC");
}

signed main() {
	int T = 10;
	cout << fixed << setprecision(15);
	rep(i, T) {
		char s[MAX];
		if (scanf("%s", s) == EOF) break;
		int n = strlen(s);
		for (int i = n - 1; i > -1; i--) {
			ungetc(s[i], stdin);
		}
		solve();
	}
	return 0;
}

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

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

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

#define READ(x) (cin >> (x))
#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))
#define WRITE_YESNO(x) (WRITE_N((x) ? "Yes" : "No"))

#define PRECISE_COUT std::cout << std::setprecision(15) << std::fixed

bool xor_logic(bool x, bool y) { return (x && y) || (!x && !y); }

string int_to_basem2(ll n) {
  if (n == 0) {
    return "0";
  }

  string retv = "";
  while (n != 0) {
    ll remain = abs(n) % 2LL;
    char digit = (char)remain + '0';

    retv.insert(retv.begin(), digit);
    n = (n - remain) / (-2LL);
  }

  return retv;
}

int main() {
  // get values from input
  cin.tie(0);
  ios::sync_with_stdio(false);

  ll N;
  cin >> N;

  // main procedure
  string ans = int_to_basem2(N);

  // output
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3624
N = int(input())
S = input()
C = 0
for i in range(10):
	if str(i) in S[:N-2]:
		for j in range(10):
			if str(j) in S[S.find(str(i))+1:N-1]:
				for k in range(10):
					if str(k) in S[S[S.find(str(i))+1:N-1].find(str(j))+S.find(str(i))+2:]:
						C += 1
print(C)

Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){

}
ll n,m,q,i,j,k,result=0,sCount=0,p;
int a[1000],b[1000],c[1000],d[1000],e[1000];
ll find(){
  ll tmp=0;
  rep(i,q){
    if(e[b[i]-1]-e[a[i]-1]==c[i]) tmp+=(ll)d[i];
  }
  /*
  rep(i,n) printf("%d ",e[i]);
  printf("%lld",tmp);
  printf("\n");*/
  return tmp;
}
int main(void){
  initialize();
  scanf("%lld %lld %lld",&n,&m,&q);
  rep(i,q) scanf("%d %d %d %d\n",&a[i],&b[i],&c[i],&d[i]);
  rep(i,n) e[i]=1;
  while(1){
    result=max(result,find());
    for(i=n-1;e[i]==m&&i>=0;i--);
    if(i<0) break;
    else{
      i=n-1;
      while(e[i]==m&&i>=0){
        e[i]=1;
        i--;
      }
      if(i>=0) e[i]++;
      for(j=i+1;j<n;j++) e[j]=e[i];
    }
  }
  printf("%lld",result);
  return 0;
}



Measured memory_bytes: 1728
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast", "unroll-loops")
using namespace std;
#define ll long long
//#define int ll
#define FOR(i,a,b) for (int i = (a); i<(b); i++)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define RREP(i,n) for (int i=(n)-1; i>=0; i--)
#define f first
#define s second
#define pb push_back
#define ALL(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define SQ(x) (x)*(x)
#define pii pair<int, int>
#define endl '\n'
//#define TOAD
#ifdef TOAD
#define bug(x) cerr<<__LINE__<<": "<<#x<<" is "<<x<<endl
#define IOS() 
#else
#define bug(...)
#define IOS() ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#endif
const ll inf = 1ll<<60;
const int iinf=2147483647;
const ll mod = 1e9+7;
const ll nine=1e9;
signed main (){
  IOS();
  ll S; cin>>S;
  ll A=1e9, B, C=1, D;
  D=(nine-(S%nine))%nine;
  B=(S+D)/1e9;
  cout<<0<<' '<<0<<' '<<A<<' '<<C<<' '<<D<<' '<<B<<endl;
}

Measured memory_bytes: 256
import java.util.*;

class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();

        String[] str = S.split("");
        String a = "";
        String b = "";
        for(int i = 0; i < N/2; i++){
            a += str[i];
        }
        for(int i = N/2; i < N; i++){
            b += str[i];
        }

        if(a.equals(b)) System.out.println("Yes");
        else System.out.println("No");
    }
}

Measured memory_bytes: 22612
import math

x=int(input())
ans=1
sa=x-ans
if sa>=3:
    a=math.floor(math.sqrt(x))
    for i in range(2,a+1):
        p=2
        while i**p<=x:
            if x-(i**p)<sa:
                sa=x-(i**p)
                ans=i**p
            p+=1
print(ans)

Measured memory_bytes: 3060
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
import java.util.Map.Entry;

import java.util.PriorityQueue;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;


public class Main {
	
	public static void main(String[] args) throws IOException {	
		try(final Scanner sc = new Scanner(System.in)){
			final String s = sc.next();
			
			System.out.println(s.matches("(hi)+") ? "Yes" : "No");
		}
	}

	public static class Scanner implements Closeable {
		private BufferedReader br;
		private StringTokenizer tok;

		public Scanner(InputStream is) throws IOException {
			br = new BufferedReader(new InputStreamReader(is));
		}

		private void getLine() throws IOException {
			while(!hasNext()){
				tok = new StringTokenizer(br.readLine());
			}
		}

		private boolean hasNext() {
			return tok != null && tok.hasMoreTokens();
		}

		public String next() throws IOException {
			getLine();
			return tok.nextToken();
		}

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

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

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

		public int[] nextIntArray(int n) throws IOException {
			final int[] ret = new int[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextInt();
			}
			return ret;
		}

		public long[] nextLongArray(int n) throws IOException {
			final long[] ret = new long[n];
			for(int i = 0; i < n; i++){
				ret[i] = this.nextLong();
			}
			return ret;
		}

		public void close() throws IOException {
			br.close();
		}
	}
}

Measured memory_bytes: 20692
import sys
input = lambda : sys.stdin.readline().rstrip()
mod = 10**9 + 7

s = input()

if "keyence" in s:
    print("YES")
    sys.exit()

n = len(s)
m = n - 7

for i in range(n):
    s_ = s[:i] + s[i + m:]
    if s_ == "keyence":
        print("YES")
        sys.exit()

print("NO")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()


using namespace std;

const ll N = 3e5;
const ll big = 1e18;
const ll M = 3004;
const ll mod = 1e6;
ll n, m, k;
ll matrix[M][M];
ll dp[M][M][4];

int main() {
	cin >> n >> m >> k;	
	for(int i = 0; i <= n + 1; i++) {
		for(int j = 0; j <= m + 1; j++) {
			for(int k = 0; k < 4; k++)
				dp[i][j][k] = 0;
			matrix[i][j] = 0;
		}
	}
	for(int i = 1, a, b, c; i <= k; i++) {
		cin >> a >> b >> c;
		matrix[a][b] = c;
	}
	for(int i = 1; i <= n; i++) {
		for(int j = 1; j <= m; j++) {
			ll z = max(dp[i][j - 1][0], dp[i - 1][j][0]);
			for(int k = 1; k < 4; k++) {
				z = max(dp[i - 1][j][k], z);
				dp[i][j][k] = max(dp[i][j - 1][k], dp[i][j - 1][k - 1] + matrix[i][j]);
			}
			dp[i][j][1] = max(dp[i][j][1], z + matrix[i][j]);
			dp[i][j][0] = z;
		}
	}
	ll answ = 0;
	for(int h = 0; h < 4; h++) 
		answ = max(answ, dp[n][m][h]);
	cout << answ << '\n';
}

/*

*/



Measured memory_bytes: 355776
n=int(input())
p=list(map(int,input().split()))

ans=0
for i in range(1,n-1):
  if (p[i+1]>p[i] and p[i]>p[i-1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
    ans=ans+1
print(ans)


Measured memory_bytes: 61876
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<deque>
#include<queue>
#include<stack>
#include <ctime>
using namespace std;
#define int long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define dup(x,y) (((x)+(y)-1)/(y))
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
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; }
typedef pair<int, int>P;
const int MOD = 1e9 + 7;
//const int MOD = 998244353;
const int INF = 1e18;
const long double PI = (acos(-1));


signed main() {
	int N, X, T;
	cin >> N >> X >> T;
	int ans = dup(N, X) * T;
	cout << ans;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();

int main() {
    int N;
    ll a, b;
    cin >> N;
    multiset<pair<ll, ll>> tree;
    for(int i = 0; i < N; i++) {
        cin >> a >> b;
        tree.insert({b, a});
    }
    ll cur = 0;
    for(auto& p: tree) {
        cur += p.second;
        // cout << "complete: " << cur << endl;
        if (cur > p.first) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 12800
from collections import deque
import copy

h,w = map(int, input().split())
s = []
for i in range(h):
    s.append(list(input()))


# h x w のマップのリストを整形
t_tmp = []
for i in range(h):
    tmp = []
    for j in range(w):
        tmp.append(s[i][j])
    t_tmp.append(tmp)

minmax = 0
for i in range(h):
    for j in range(w):
        if s[i][j] == '#':
            continue
        
        # 現在地とその距離
        q = deque([(i,j,0)])

        # スタートを設定してsをコピー
        t = copy.deepcopy(t_tmp)
        #print(t)
        t[i][j] = '#'
        while q:
            x,y,c = q.popleft()
            for dx, dy in [(1,0),(0,1),(-1,0),(0,-1)]:
                # 壁を超えるか否か
                nx, ny = x+dx, y+dy
                if 0<=nx<h and 0<=ny<w and t[nx][ny] == '.':
                    t[nx][ny] = '#'
                    q.append((nx,ny,c+1))

        #print(mx)
        minmax = max(minmax,c)

print(minmax)

Measured memory_bytes: 3444
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include<stack>
#include<queue>
#define null NULL
using namespace std;
/** 区间表示：[p->dl,p->dr]
 *  从0开始计数，[0,n-1]
 *  线段树RSQ
 *
 */

struct Node
{
    long long dl,dr,s,delta;
    Node *pl,*pr;
};
int n,q;

void build(Node *&p,int l,int r)
{
    p=(Node *)malloc(sizeof(Node));
    p->dl=l,p->dr=r,p->s=0,p->delta=0;
    p->pl=null,p->pr=null;
    int mid=(l+r)/2;
    if(r>l)
    {
        build(p->pl,l,mid);
        build(p->pr,mid+1,r);
    }
}

void preorder(Node *p)
{
    if(p!=null)
    {
        printf("%lld %lld %lld %lld\n",p->dl,p->dr,p->s,p->delta);
        preorder(p->pl);
        preorder(p->pr);
    }
}
///在其他节点更新和查询的过程中都要向下延迟修改
void pushdown(Node *&p,int delta)
{
    p->pl->s += p->delta;
    p->pr->s += p->delta;
    p->pl->delta += p->delta;
    p->pr->delta += p->delta;
    p->delta=0;
}
///当前区间的更新只更新到某些节点，下边节点的更新需要下次延迟修改
void update(Node *&p,int l,int r,int data)
{
    ///[l,r]必然位于[p->dl,p->dr]子区间
    ///当前节点的所有数据都是正确的！！
    ///延迟修改-lazy-tag技术
    ///此处下行的是之前的数据
    if(p->delta!=0 && p->dr>p->dl)
        pushdown(p,p->delta);

    if(p->dl==l &&p->dr==r)
    {
        p->s += data;
        p->delta=data;
        return ;
    }
    int mid=(p->dl+p->dr)/2;
    if(r<=mid)
        update(p->pl,l,r,data);
    else if(l>mid)
        update(p->pr,l,r,data);
    else
        update(p->pl,l,mid,data),update(p->pr,mid+1,r,data);
    p->s=min(p->pl->s,p->pr->s);
}
///当前节点的所有数据都是正确的！！
///即使不正确，在进入到这个之前也被pushdown过了,，所以一定是正确的
long long query(Node *&p,int l,int r)
{
    ///一个查询区间最终必然被分成若干个小的区间和，最后一个定会完全和区间贴合
    if(p->delta!=0 && p->dr>p->dl)
        pushdown(p,p->delta);

    if(p->dl==l &&p->dr==r)
        return p->s;
    int mid=(p->dl+p->dr)/2;
    ///判断查询区间与当前区间的位置关系
    //全部位于左侧
    if(r<=mid)
        return query(p->pl,l,r);
    //全部位于右侧
    else if(l>mid)
        return query(p->pr,l,r);
    //两个都有
    else
        return min(query(p->pl,l,mid),query(p->pr,mid+1,r));
}

int main()
{
    int i,type,tx,ty,x;
    Node *tree=null;

    scanf("%d%d",&n,&q);
    build(tree,0,n-1);
    for(i=0;i<q;i++)
    {
        scanf("%d",&type);
        if(type==0)
        {
            scanf("%d%d%d",&tx,&ty,&x);
            update(tree,tx,ty,x);
        }else
        {
            scanf("%d%d",&tx,&ty);
            long long ans=query(tree,tx,ty);
            printf("%lld\n",ans);
        }
    }
    return 0;
}



Measured memory_bytes: 15728
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define FOR(i, m, n) for(ll i = m; i < (n); i++)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
using vi = vector<int>;
using vii = vector<vi>;
using pii = pair<int, int>; 
using vl = vector<ll>;
using vll = vector<vl>;
using pll = pair<ll, ll>;

int main() {
    ll N, K;
    cin >> N >> K;
    vl p(N);
    rep(i, N){
        cin >> p[i];
    }
    sort(all(p));
    ll ans = 0;
    rep(i, K){
        ans += p[i];
    }
    cout << ans;
}

Measured memory_bytes: 3668
#include <iostream>
#include <set>
#include <vector>
using namespace std;
typedef pair<int,int> P;
int M,N;
set<int> row[510],col[510];
char C[510][510];
int main(){
    cin >> M >> N;
    for(int i=1;i<=M;i++){
        for(int j=1;j<=N;j++){
            cin >> C[i][j];
            if(C[i][j]!='.'){
                row[i].insert(j);
                col[j].insert(i);
            }
        }
    }
    int ans = 0;
    bool ok = true;
    while(true){
        bool update = false;
        for(int i=1;i<=M;i++){
            for(int j=1;j<=N;j++){
                if(C[i][j]!='.') continue;
                vector<P> v;
                set<int>::iterator rit = row[i].upper_bound(j);
                set<int>::iterator cit = col[j].upper_bound(i);
                if(rit!=row[i].end()) v.push_back({i,*rit});
                if(rit!=row[i].begin()){
                    rit--;
                    v.push_back({i,*rit});
                }
                if(cit!=col[j].end()) v.push_back({*cit,j});
                if(cit!=col[j].begin()){
                    cit--;
                    v.push_back({*cit,j});
                }
                for(auto x:v){
                    for(auto y:v){
                        if(x==y) continue;
                        if(C[x.first][x.second]!='.' && C[x.first][x.second]==C[y.first][y.second]){
                            ans += 2;
                            C[x.first][x.second] = '.';
                            C[y.first][y.second] = '.';
                            row[x.first].erase(x.second);
                            col[x.second].erase(x.first);
                            row[y.first].erase(y.second);
                            col[y.second].erase(y.first);
                            update = true;
                        }
                    }
                }
            }
        }
        if(!update) break;
    }
    cout << ans << endl;
}


Measured memory_bytes: 3412
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<(int)c;i++)
#define print(var) cout<<var<<endl;

const int inf = 1000000000;//10^9


int main(){
vector<int> bingo(9);
vector<int> hit(9);

rep(i,9) cin>>bingo[i];
int N;
cin>>N;

rep(i,N) {
  int num;
  cin>>num;
  rep(j,9){
    if(num==bingo[j]){
      hit[j]=1;
    }
  }
}

if((hit[0]+hit[1]+hit[2]==3)||(hit[3]+hit[4]+hit[5]==3)||(hit[6]+hit[7]+hit[8]==3)||(hit[0]+hit[3]+hit[6]==3)||(hit[1]+hit[4]+hit[7]==3)||(hit[2]+hit[5]+hit[8]==3)||(hit[0]+hit[4]+hit[8]==3)||(hit[2]+hit[4]+hit[6]==3)){
print("Yes");

}else{
  print("No");
}


return 0;
}

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

int main() {
  
  char a;
  char b;
  char c;
  
  cin >> a >> b >> c;
  
  if((a=='A' && b=='A' && c=='A') || (a=='B' && b=='B' && c=='B')){
    
    cout << "No"<< endl;
  
  }
  else { cout << "Yes" << endl;
  }

}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cassert>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
#include <cassert>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
int n,m,L[300005],R[300005];
int seg[(1<<20)+5];
void update(int a,int b,int k,int l,int r,int v){
	if(r<a || b<l) return;
	if(a<=l&&r<=b){
		seg[k]+=v;
		return;
	}
	update(a,b,k*2+1,l,(l+r)/2,v);
	update(a,b,k*2+2,(l+r)/2+1,r,v);
}
vector<int>vec[100005];
int ans[100005];
int query(int a,int k,int l,int r,int sum){
	sum += seg[k]; if(l==r) return sum;
	if(l<=a && a<=(l+r)/2) return query(a,k*2+1,l,(l+r)/2,sum);
	else return query(a,k*2+2,(l+r)/2+1,r,sum);
}
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&L[i],&R[i]);
		vec[R[i]-L[i]+1].pb(i);
		update(L[i],R[i],0,0,(1<<19)-1,1);
	}
	int zan = 0;
	for(int i=m;i>=1;i--){
		ans[i] = zan;
		for(int j=i;j<=m;j+=i){
			ans[i] += query(j,0,0,(1<<19)-1,0);
		}
		for(int j=0;j<vec[i].size();j++){
			zan++;
			int a = vec[i][j];
			update(L[a],R[a],0,0,(1<<19)-1,-1);
		}
	}
	for(int i=1;i<=m;i++) printf("%d\n",ans[i]);
}

Measured memory_bytes: 13184
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

const int NUM_P = 1000000;
vector<int> prime;
bool isPrime[NUM_P];
int N, P;

int make() {
  fill(isPrime, isPrime+NUM_P, true);
  isPrime[0] = isPrime[1] = false;
  for(int i = 2; i < NUM_P; ++i) {
    if(!isPrime[i]) continue;
    prime.push_back(i);
    for(int j = i*2; j < NUM_P; j += i) isPrime[j] = false;
  }
}

int solve() {
  int s = distance(prime.begin(), upper_bound(prime.begin(), prime.end(), N));
  vector<int> v;
  for(int i = 0; i < P; ++i) {
    for(int j = i; j < P; ++j) {
      v.push_back(prime[s+i] + prime[s+j]);
    }
  }
  sort(v.begin(), v.end());
  return v[P-1];
}

int main() {
  make();
  while(cin >> N >> P) {
    if(N == -1 && P == -1) break;
    cout << solve() << endl;
  }
  return 0;
}

Measured memory_bytes: 2320
#include<bits/stdc++.h>
using namespace std;
int main(){
    int h,w,black=0;
    cin>>h>>w;
    vector<vector<char>>s(h,vector<char>(w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>s[i][j];
            if(s[i][j]=='#')black++;
        }
    }
    queue<tuple<int,int,int>>q;
    q.push(make_tuple(0,0,1));
    int check[h][w]={};
    check[0][0]=1;
    while(q.size()){
        int x=get<0>(q.front());
        int y=get<1>(q.front());
        int d=get<2>(q.front());
        q.pop();
        if(x==h-1 && y==w-1){
            cout<<h*w-black-d<<endl;
            return 0;
        }
        if(x && s[x-1][y]=='.' && check[x-1][y]==0){
            q.push(make_tuple(x-1,y,d+1));
            check[x-1][y]=1;
        }
        if(y && s[x][y-1]=='.' && check[x][y-1]==0){
            q.push(make_tuple(x,y-1,d+1));
            check[x][y-1]=1;
        }
        if(x<h-1 && s[x+1][y]=='.' && check[x+1][y]==0){
            q.push(make_tuple(x+1,y,d+1));
            check[x+1][y]=1;
        }
        if(y<w-1 && s[x][y+1]=='.' && check[x][y+1]==0){
            q.push(make_tuple(x,y+1,d+1));
            check[x][y+1]=1;
        }
    }
    cout<<"-1"<<endl;
    return 0;
}

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

int main() {
  int n, h;
  cin >> n >> h;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  int a_mx = *max_element(a.begin(), a.end());
  sort(b.begin(), b.end(), greater<>());
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] < a_mx) {
      break;
    }
    h -= b[i];
    ans++;
    if (h <= 0) {
      cout << ans << endl;
      return 0;
    }
  }
  cout << ans + (h + a_mx - 1) / a_mx << endl;
}


Measured memory_bytes: 4052
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
#define repl(i,n) for (long long i = 0; i < (n); ++i)
#define reppl(i,n,m) for (long long i = m; i < (n); ++i)
using namespace std;
using ll = long long;
const int MOD = 1000000007;

int main(){
    int n, a, b, c, d;
    cin >> n >> a >> b >> c >> d;
    string s;
    cin >> s;
    if (c < d){
        bool t = true;
        repp(i,d-2,a){
            if (s.at(i) == '#' && s.at(i+1) == '#'){
                t = false;
                break;
            }
        }
        if (t){
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    else{
        bool ta = true;
        bool tb = false;
        repp(i,d-2,b){
            if (s.at(i) == '#' && s.at(i+1) == '#'){
                ta = false;
                break;
            }
            if (s.at(i) == '.' && s.at(i+1) == '.' && s.at(i+2) == '.'){
                tb = true;
            }
        }
        if (s.at(b-2) == '.' && s.at(b) == '.') tb = true;
        if (s.at(d-2) == '.' && s.at(d) == '.') tb = true;
        if (s.at(b+1) == '.' && s.at(b) == '.') tb = true;
        if (ta && tb){
            ta = true;
            repp(i,c-2,a){
                if (s.at(i) == '#' && s.at(i+1) == '#'){
                    ta = false;
                    break;
                }
            }
            if (ta){
                cout << "Yes" << endl;
            }
            else {
                cout << "No" << endl;
            }
        }
        else {
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 640
import java.util.*;
import static java.lang.System.*;

class Main {
    public static Scanner sc = new Scanner(in);
    public static Random rand=new Random();

    public void run(){
    	int q=sc.nextInt();

    	long LC=0,RC=0;

    	while(q--!=0){
        	long p=sc.nextLong();
        	char c=sc.next().charAt(0);
        	long n=sc.nextLong();
        	if(c=='(')
        		LC+=n;
        	else
        		RC+=n;

        	ln((LC==RC)?"Yes":"No");
    	}
    }
    public static void main(String[] args) {
        new Main().run();
    }

    public int[] nextIntArray(int n){
        int[] res=new int[n];
        for(int i=0;i<n;i++){
            res[i]=sc.nextInt();
        }
        return res;
    }
    public static void pr(Object o) {
        out.print(o);
    }
    public static void ln(Object o) {
        out.println(o);
    }
    public static void ln() {
        out.println();
    }
}

Measured memory_bytes: 46560
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<ll> >dp(100002,vector<ll>(3,-1));
ll n;
ll solve(vector<vector<ll> >&v,ll i,ll k)
{
    if(i==n-1) return 0;
    if(dp[i][k]!=-1) return dp[i][k];
    if(k==0)
    {
         return dp[i][k]=max(v[i+1][1]+solve(v,i+1,1),v[i+1][2]+solve(v,i+1,2));
    }
    else if(k==1)
    {
         return dp[i][k]=max(v[i+1][0]+solve(v,i+1,0),v[i+1][2]+solve(v,i+1,2));
    }
    else
    {
       return  dp[i][k]=max(v[i+1][0]+solve(v,i+1,0),v[i+1][1]+solve(v,i+1,1));
    }
}
int main()
{
    ll k;
    cin>>n;
    vector<vector<ll> >v(n,vector<ll>(3));
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<3;j++)
        {
            cin>>v[i][j];
        }
    }
    ll ans1=v[0][0]+solve(v,0,0);
    ll ans2=v[0][1]+solve(v,0,1);
    ll ans3=v[0][2]+solve(v,0,2);
    cout<<max({ans1,ans2,ans3});

}


Measured memory_bytes: 20396
n = int(input())
ga, sa, ba = list(map(int, input().split()))
gb, sb, bb = list(map(int, input().split()))

w_ab = []
v_ab = []

if ga < gb:
    w_ab.append(ga)
    v_ab.append(gb)
if sa < sb:
    w_ab.append(sa)
    v_ab.append(sb)
if ba < bb:
    w_ab.append(ba)
    v_ab.append(bb)

num = (n+1)*(len(w_ab)+1)
dp = [0]*num
for i in range(len(w_ab)):
    for j in range(n+1):
        if j < w_ab[i]:
            dp[(i+1)*(n+1) + j] = dp[i*(n+1) + j]
        else:
            dp[(i+1)*(n+1) + j] = max(dp[i*(n+1) + j], dp[(i+1)*(n+1) + j - w_ab[i]] + v_ab[i])
ans = 0
length = len(w_ab)
for j in range(n+1):
    ans = max(ans, dp[length*(n+1) + j] + n-j)
n = ans

w_ab = []
v_ab = []

if ga > gb:
    w_ab.append(gb)
    v_ab.append(ga)
if sa > sb:
    w_ab.append(sb)
    v_ab.append(sa)
if ba > bb:
    w_ab.append(bb)
    v_ab.append(ba)

num = (n+1)*(len(w_ab)+1)
dp = [0]*num
for i in range(len(w_ab)):
    for j in range(n+1):
        if j < w_ab[i]:
            dp[(i+1)*(n+1) + j] = dp[i*(n+1) + j]
        else:
            dp[(i+1)*(n+1) + j] = max(dp[i*(n+1) + j], dp[(i+1)*(n+1) + j - w_ab[i]] + v_ab[i])

length = len(w_ab)
ans = 0
for j in range(n+1):
    ans = max(ans, dp[length*(n+1) + j] + n-j)
print(ans)
  

Measured memory_bytes: 615192
/****************************************************
*   Template for coding contests                    *
*   Author    :    Sanjeev Sharma                   *
*   Email     :    thedevelopersanjeev@gmail.com    *
*****************************************************/
#pragma GCC optimize ("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize("no-stack-protector,fast-math")
#pragma GCC target ("sse4")
#pragma comment(linker, "/stack:200000000")

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

using namespace __gnu_pbds;
using namespace std;

#define deb(x) cout << #x << " is " << x << "\n";
#define int long long
#define mod 1000000007

const double PI = 2 * acos(0.0);
const long long INF = 1e18L + 5;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int32_t main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a, b, c;
	cin >>a >>b >>c;
	cout <<c <<" " <<a <<" " <<b;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int mod=1e9+7;
int f[2][22][600005],n,m,K,S[600005],st[600005],bin[32],nxt[600005][22][2];
void add(int &a,int b){a=a+b>=mod?a+b-mod:a+b;}
int main(){
	scanf("%d%d%d",&n,&m,&K);
	n--;
	bin[0]=1;
	for(int i=1;i<=30;i++) bin[i]=bin[i-1]*2;
	for(int i=0;i<(1<<n);i++){
		int pos[2]={0,0};
		for(int p=n;~p;p--){
			nxt[i][p][0]=pos[0];
			nxt[i][p][1]=pos[1];
			pos[(i>>p-1)&1]=p;
		}
	}
	for(int i=1,a,b,c;i<=K;i++){
		scanf("%d%d%d",&a,&b,&c);
		S[a]|=(1<<b-1);
		if(c) st[a]|=(1<<b-1);
	}
	int pre=0,now=1;
	f[1][0][0]=1;
	for(int i=1;i<=m;i++){
		memset(f[pre],0,sizeof(f[pre]));
		for(int p=0;p<n;p++){
			for(int j=0;j<(1<<n);j++)if(f[now][p][j]){
				int pos=nxt[j][p][0],pp=nxt[j][pos][1];
				add(f[now][p+1][j],f[now][p][j]);
				if(pos==p+1) add(f[now][pos][j^(1<<pos-1)^(pp?(1<<pp-1):0)],f[now][p][j]);
			}
		}
		for(int j=0;j<(1<<n);j++){
			if((j&S[i])!=st[i]){
				f[now][n][j]=0;continue;
			}
			add(f[pre][0][j],f[now][n][j]);
		}
		swap(now,pre);
	}
	int ans=0;
	for(int i=0;i<(1<<n);i++) add(ans,f[now][0][i]);
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 200960
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 10;
const long long inf = 1e15;
const int mod = 1e6;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;
 
void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
 
const long long N = 4000 * 100 + 10;

vector <int> adj[N];
ll dist[2][N];
vector <pii> edge;
ll n, k;

void bfs(int src , int t)
{
	for (int i = 0; i < n; i++)
	{
		dist[t][i] = inf;
	}
	dist[t][src] = 0;
	queue <int> q;
	q.push(src);
	while(!q.empty())
	{
		int v = q.front();
		q.pop();
		for (int i = 0; i < adj[v].size(); i++)
		{
			int u = adj[v][i];
			if(dist[t][u] > dist[t][v] + 1)
			{
				dist[t][u] = dist[t][v] + 1;
				q.push(u);
			}
		}
	}
}
int main()
{
	faster();
	cin >> n >> k;
	for (int i = 0; i < n - 1; i++)
	{
		int v, u;
		cin >> v >> u;
		v--;
		u--;
		adj[v].push_back(u);
		adj[u].push_back(v);
		edge.push_back({u, v});
	}
	ll ans = inf;
	if(k % 2 == 0)
	{
		k /= 2;
		for (int i = 0; i < n; i++)
		{
			bfs(i , 0);
			ll cnt = 0;
			for (int j = 0; j < n; j++)
			{
				if(dist[0][j] > k)
					cnt++;
			}
			ans = min(cnt, ans);
		}
		cout << ans << endl;	
		return 0;
	}
	for (int i = 0; i < edge.size(); i++)
	{
		ll cnt = 0;
		int v = edge[i].first;
		int u = edge[i].second;
		bfs(v, 0);
		bfs(u, 1);
		for (int j = 0; j < n; j++)
		{
			if(max(dist[0][j], dist[1][j]) <= (k - 1) / 2)
			{
				continue;
			}
			else
			{
				if(max(dist[0][j], dist[1][j]) == (k + 1) / 2)
				{
					if(abs(dist[0][j] - dist[1][j]) > 1)
						cnt++;
				}
				else
					cnt++;
			}
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 11904
import scala.io.StdIn.{readLine,readInt}

object Main {
  def cut(c:Array[Int],n:Int,k:Int) = {
    c.slice(k,2*n) ++ c.slice(0,k)
  }

  def rif(c:Array[Int],n:Int) = {
    val a = c.slice(0,n)
    val b = c.slice(n,n+n)
    (0 until 2*n).map{ i=> if(i%2==0) a(i/2) else b((i-1)/2) }.toArray
  }

  def main(args:Array[String]) = {
    val n = readInt
    val m = readInt
    var a = (0 until 2*n).map { i => i+1 }.toArray
    for(i<-0 until m) {
      val k = readInt
      if(k==0) a = rif(a,n)
      else a = cut(a,n,k)
    }
    println(a.mkString("\n"))
  }

}

Measured memory_bytes: 53156
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n, a;
	scanf("%d%d", &n, &a);
	int l = a; //左端のりんごの味はa
	int r = a + n - 1; //右端の味

	int eat; //絶対値が0に一番近いりんごを探す
	if(r <= 0) eat = r; //右端が0以下なら右端
	else if (l >= 0) eat = l; //左端が0以上なら左端
	else eat = 0; //0の場合

	int ans = (r + l) * (r - l + 1) / 2 - eat; //公差1の等差数列なので、((初項+末項)*工数)/2

	printf("%d\n", ans);
	return 0;
}

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

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

  int a[n][m];
  int b[m];
  int c[n];

  //??????A??\???
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      cin >> a[i][j];
    }
  }

  //??????B??\???
  for(int i=0; i<m; i++){
    cin >> b[i];
  }

  //??????C?????????
  for(int i=0; i<n; i++){
    c[i] = 0;
  }

  //???????¨????
  for(int i=0; i<n; i++){
    for(int j=0; j<m; j++){
      c[i] += a[i][j] * b[j];
    }
  }

  //?¨????????????????
  for(int i=0; i<n; i++){
    cout << c[i] << endl;
  }

}

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

using namespace std;

template <class T>
inline T updmax(T &a, T b) { return a = max(a, b); }
template <class T>
inline T updmin(T &a, T b) { return a = min(a, b); }

int main()
{
	int n;
	scanf("%d", &n);
	vector<int> a(n, 0);
	for (int i = 0; i < n; i++)
		scanf("%d", &a[i]);
	vector<long long> s(n + 1, 0);
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
			s[i + 1] = s[i] + a[i];
		else
			s[i + 1] = s[i] - a[i];
	}
	for (int i = 0; i < n; i++)
	{
		if (i % 2 == 0)
			printf("%lld ", s[n] - 2 * s[i]);
		else
			printf("%lld ", -(s[n] - 2 * s[i]));
	}
	printf("\n");
	return 0;
}

Measured memory_bytes: 2432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
typedef long long ll;
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
using namespace std;

int main()
{
	int N;
	int d[110];
	cin >> N;
	for (int i = 0; i < N; i++)
	{
		cin >> d[i];
	}
	int num[110] = {0};
	for (int i = 0; i < N; i++)
	{
		num[d[i]]++;
	}
	int res = 0;
	for (int i = 1; i <= 100; i++)
	{
		if (num[i])
		{
			res++;
		}
	}
	
	
cout << res<<endl;

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define f first
#define s second

using namespace std;

/*int gcd(int a,int b){
	if(b == 0)
		return a;
	return gcd(b,a%b);
}*/

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

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

    
    string s;
    string t;
    cin>>s;
    cin>>t;

    int cnt  =0;
    for(int i =0;i<3;i++){
    	if(s[i] == t[i])
    		cnt++;
    }

    cout<<cnt;

	return 0;
}

Measured memory_bytes: 256
#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>;

const double pi = acos(-1);

int main() {
    double a, b, x;
    cin >> a >> b >> x;
    double vmax = a*a*b;
    double t = 0, ans = 0;
    if (x > vmax/2) {
        t = vmax - x;
        t *= 2;
        t /= a*a*a;
        ans = atan(t);
        ans *= 180;
        ans /= pi;
    }
    else {
        t = a*b*b;
        t /= 2*x;
        ans = atan(t);
        ans *= 180;
        ans /= pi;
    }
    printf("%.10f\n", ans);
    return 0;
}

Measured memory_bytes: 4064
#include<cstdio>
#include<cstring>
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include<string>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<queue>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define LL long long
#define FOR(i,a,b) for (int i=a;i<=b;i++)
#define FORD(i,a,b) for (int i=a;i>=b;i--)
using namespace std;
typedef pair<int,int> pa;
void getint(int &v){
    char ch,fu=0;
    for(ch='*'; (ch<'0'||ch>'9')&&ch!='-'; ch=getchar());
    if(ch=='-') fu=1, ch=getchar();
    for(v=0; ch>='0'&&ch<='9'; ch=getchar()) v=v*10+ch-'0';
    if(fu) v=-v;
}
int n,m,k;
int main(){
	scanf("%d%d%d",&n,&m,&k);
	FOR(x,0,n)
		FOR(y,0,m)
			if (x*m+y*n-x*y*2==k) return puts("Yes"),0;
	puts("No");
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**6)

l, r = map(int, input().split())

MOD = 2019

#n = 2019
#pf = {}
#
#for i in range(2,int(n**0.5)+1):
#    while n % i == 0:
#        pf[i] = pf.get(i,0) + 1
#        n //= i
#if n > 1: pf[n] = 1
#print(pf)
## 2019=3*673

import itertools

l_mod = l%MOD
r_mod = r%MOD

if r-l > 2019:
    ans = 0
else:
    if l_mod <= 3 <= r_mod and l_mod <= 673 <= r_mod:
        ans = 0
    elif l_mod < r_mod:
        li = [i for i in range(l_mod, r_mod+1)]
        ans = 2018
        for v in itertools.combinations(li, 2):
            ans = min(ans, v[0]*v[1]%MOD)        
    else:
        ans = 0

print(ans)

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

int main() {
    string s,ans;
    cin>>s;
    ans="";
    ans="";
    ans+=s[0];
    ans+=to_string(s.length()-2);
    ans+=s[s.length()-1];
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256