akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
long long N, K, X[100009], Y[100009], ux[100009], uy[100009], uz[100009], cx, cy; string S;
map<pair<long long, long long>, vector<long long>>T; map<pair<long long, long long>, bool>M;
pair<long long, long long>exchange(long long px, long long py, long long &ps) {
	ps = (px + 1000000000LL * cx) / cx - 1000000000LL;
	long long PX = px - ps*cx;
	long long PY = py - ps*cy;
	return make_pair(PX, PY);
}
int main() {
	cin >> N >> K >> S;
	for (int i = 0; i < N; i++) {
		if (S[i] == 'N')cx--; if (S[i] == 'S')cx++;
		if (S[i] == 'E')cy++; if (S[i] == 'W')cy--;
		X[i + 1] = cx; Y[i + 1] = cy;
	}
	if (cx == 0 && cy == 0) {
		K = 1; cx = 1; cy = 1;
	}
	if (cx == 0) {
		for (int i = 0; i <= N; i++)swap(X[i], Y[i]); swap(cx, cy);
	}
	if (cx < 0) {
		for (int i = 0; i <= N; i++)X[i] *= -1; cx *= -1;
	}
	if (cy < 0) {
		for (int i = 0; i <= N; i++)Y[i] *= -1; cy *= -1;
	}
	for (int i = 0; i <= N; i++) {
		long long V = 0;
		pair<long long, long long> uu = exchange(X[i], Y[i], V);
		ux[i] = uu.first; uy[i] = uu.second; uz[i] = V;
		T[make_pair(ux[i], uy[i])].push_back(V);
	}
	long long ans = 0;
	for (int i = 0; i < N; i++) {
		if (M[make_pair(ux[i], uy[i])] == true)continue;
		vector<long long>A[4]; long long D = 0, DE = 0;
		A[0] = T[exchange(ux[i], uy[i], D)];
		A[1] = T[exchange(ux[i] + 1, uy[i], DE)]; if (D != DE) { for (int i = 0; i < A[1].size(); i++) { A[1][i]--; } }
		A[2] = T[exchange(ux[i], uy[i] + 1, DE)]; if (D != DE) { for (int i = 0; i < A[2].size(); i++) { A[2][i]--; } }
		A[3] = T[exchange(ux[i] + 1, uy[i] + 1, DE)]; if (D != DE) { for (int i = 0; i < A[3].size(); i++) { A[3][i]--; } }
		vector<long long>E;
		for (int j = 0; j < 4; j++) { for (int k = 0; k < A[j].size(); k++) { E.push_back(A[j][k]); E.push_back(A[j][k] + K); } }
		sort(E.begin(), E.end()); E.erase(unique(E.begin(), E.end()), E.end());
		vector<int>ES(E.size() + 1, 0);
		for (int j = 0; j < 4; j++) {
			vector<int>ER(E.size() + 1, 0);
			for (int k = 0; k < A[j].size(); k++) {
				int pos1 = lower_bound(E.begin(), E.end(), A[j][k]) - E.begin();
				int pos2 = lower_bound(E.begin(), E.end(), A[j][k] + K) - E.begin();
				ER[pos1]++; ER[pos2]--;
			}
			for (int j = 1; j < E.size() + 1; j++)ER[j] += ER[j - 1];
			for (int j = 0; j < E.size() + 1; j++) { if (ER[j] >= 1)ES[j] += 1; }
		}
		long long res = 0;
		for (int j = 0; j < E.size(); j++) {
			if (ES[j] == 4)res += (E[j + 1] - E[j]);
		}
		ans += res;
		M[make_pair(ux[i], uy[i])] = true;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 31844
#include <cstdio>
#include <cstring>

using namespace std;

int main()
{
	char s[50];
	
	while (scanf("%s", s), s[0] != '#'){
		
		int len = strlen(s);
		int cnt = 0;
		bool first = true;
		bool key;
		
		for (int i = 0; i < len; i++){
			
			if (first){
				if ('h' <= s[i] && s[i] <= 'p' || s[i] == 'u' || s[i] == 'y'){
					key = true;
				}
				else {
					key = false;
				}
				first = false;
			}
			else if ('h' <= s[i] && s[i] <= 'p' || s[i] == 'u' || s[i] == 'y'){
				if(key);
				else cnt++;
				key = true;
			}
			else {
				if(!key);
				else cnt++;
				key = false;
			}
		}
		
		printf("%d\n", cnt);
	}
	
	return (0);
}

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

typedef long long int ll;

int main(){
 ll N;
 cin >> N;
 ll ans = 0;
 vector<string> S(N);
 ll M=0,A=0,R=0,C=0,H=0;
 for(ll i = 0;i < N;i++){
    cin >> S[i];
    if(S[i][0] == 'M')M++;
    if(S[i][0] == 'A')A++;
    if(S[i][0] == 'R')R++;
    if(S[i][0] == 'C')C++;
    if(S[i][0] == 'H')H++;
 }
 ans += M*A*R;
 ans += M*A*C;
 ans += M*A*H;
 ans += M*R*C;
 ans += M*R*H;
 ans += M*C*H;
 ans += A*C*H;
 ans += A*C*R;
 ans += R*C*H;
 ans += H*A*R;
 cout << ans << endl;
}

Measured memory_bytes: 6144
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val
using namespace std;
using namespace __gnu_pbds;

#define sp << " " <<
#define mod 1000000007
#define PI 3.14159265358979323
#define y second
#define x first
#define pb push_back
#define mp make_pair
#define sz(a) a.size()
#define pqueue priority_queue< ll >
//#define pdqueue priority_queue< ll,vector<ll> ,greater< ll > >
#define codejamDebug(x) cout<<"Case #"<<x<<": ";
#define debug(x) cout<<#x<<" :"<<x<<endl;
#define rep(i,n) for(long long i=0;i<n;i++)
#define f(i,a,b) for(long long i = a; i < b; i++)
#define fd(i,a,b) for(long long i = a; i >=b; i--)
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
typedef long long int           ll;
typedef long double             ld;
typedef unsigned long long int ull;
typedef vector <int>            vi;
typedef vector <ll>            vll;
typedef pair <int, int>        pii;
typedef pair <ll, ll>          pll;
typedef vector < pii >        vpii;
typedef vector < pll >        vpll;
typedef vector <string>         vs;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

//Handle:cyber_rajat
vector<int> adj[100005];
vector<int> ad[100005];
ll dpup[100005]={0};//ways to color ith node black in downwards direction
ll dpdown[100005]={0};//ways to color ith node black in upwards direction
int n,m;
ll pre[100005],suf[100005];

void dfs1(int curr, int par)
{	
	dpdown[curr]=1;
	for(auto x:adj[curr])
	{
		if(x==par)continue;
		dfs1(x,curr);
		ad[curr].pb(x);
		dpdown[curr]=(dpdown[curr]*((dpdown[x]+1)%m))%m;
	}
}

void dfs2(int curr)
{
	int len=ad[curr].size();
	pre[0]=1;
	suf[len+1]=1;
	for(int i=0; i<len; i++)
	{
		int x=ad[curr][i];
		pre[i+1]=(pre[i]*((dpdown[x]+1)%m))%m;
	}
	for(int i=len-1; i>=0; i--)
	{
		int x=ad[curr][i];
		suf[i+1]=(suf[i+2]*((dpdown[x]+1)%m))%m;
	}
	for(int i=0; i<len; i++)
	{
		int x=ad[curr][i];
		dpup[x]=(pre[i]*suf[i+2])%m;
		dpup[x]=(dpup[x]*((dpup[curr]+1)%m))%m;
	}
	for(auto x:ad[curr])
	{
		dfs2(x);
	}
}

int main(int argc, char const *argv[])
{
	sync;
	cin>>n>>m;
	rep(i,n-1)
	{
		int a,b;
		cin>>a>>b;
		a--,b--;
		adj[a].pb(b);
		adj[b].pb(a);
	}
	dfs1(0,-1);
	dfs2(0);
	rep(i,n)cout<<(dpdown[i]*((dpup[i]+1)%m))%m<<endl;
	return 0;
}


Measured memory_bytes: 18944
#include <iostream>
using namespace std;
int main(void) {
  string o, e;
  cin >> o >> e;
  for (int i = 0; i < o.size() + e.size(); i++) {
    if (i % 2 == 0) {
      cout << o[i / 2];
    } else {
      cout << e[i / 2];
    }
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    char c[2][3];
    rep(i,2){
        rep(j,3){
            cin >>c[i][j];
        }
    }
    string ans="YES";
    rep(i,3){
        if(c[0][i]!=c[1][2-i]) ans="NO";
    }
    cout << ans << endl;



}


Measured memory_bytes: 256
import bisect
import sys
input = sys.stdin.readline


def main():
    N = int(input())
    L = list(map(int, input().split()))
    L.sort()

    cnt = 0
    for i in range(N-2):
        for j in range(i+1, N-1):
            a = L[i]
            b = L[j]
            r = bisect.bisect_left(L, b+a, lo=j+1)
            l = bisect.bisect_right(L, b-a, lo=j+1)
            cnt += r - l
    
    print(cnt)


if __name__ == '__main__':
    main()

Measured memory_bytes: 46092
h, w, k = map(int, input().split())
l = []
ans = 0

for i in range(h):
    l.append(input())


for ik in range(1<<h):
    for jk in range(1<<w):
        cnt = 0
        for i in range(h):
            for j in range(w):
                if ik>>i&1:
                    continue
                if jk>>j&1:
                    continue
                if l[i][j] == "#":
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)


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

int main() {
int ans=0,i,n,k,x;
cin>>n>>k;
vector<int>v;
for(i=0;i<n;i++){
    cin>>x;
    v.push_back(x);
}
sort(v.begin(),v.end());
for(i=0;i<k;i++)ans+=v[i];
cout<<ans;
	return 0;
}


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

const int MAXN = 2e5 + 5;

int n, k, a[MAXN], ans;
map<int,int> occ;

int main(){
	scanf("%d %d", &n, &k);
	for(int i = 0; i < n; ++i){
		scanf("%d", &a[i]);
		occ[a[i]]++;
	}
	vector<int> s = {};
	for(auto i : occ){
		s.push_back(i.second);
	}
	sort(s.begin(), s.end());
	if(s.size() > k){
		for(int i = 0; i < s.size()-k; ++i){
			ans += s[i];
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 11516
#include <stdio.h>

int main () {
	int N, X;
	scanf ("%d %d", &N, &X);
	int num = 1, d = 0;;
	for (int i=0; i<N; i++) {
		int L;
		scanf ("%d", &L);
		d += L;
		if (d<=X) num++;
	}
	printf ("%d\n", num);
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>

int main(void){
    char x[200020];
    scanf("%s",x);
    int counts=0,ans=strlen(x);
    for (int i=0; i<strlen(x); i++){
        if(x[i]=='T' && counts>0){
            counts--;
            ans-=2;
        }
        if(x[i]=='S'){
            counts++;
        }
    }
    printf("%d\n",ans);
	return 0 ;
}

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

int a[12][12];

int main() {
  int n, m, x;
  int ans=0;
  cin >> n >> m >> x;
  vector<int> c(n);
  for(int i=0; i<n; i++){
    cin >> c[i];
    ans += c[i];
    for(int j=0; j<m; j++) cin >> a[i][j];
  }

  for(int j=0; j<m; j++){
    int sum=0;
    for(int i=0; i<n; i++){
      sum+=a[i][j];
    }
    if(sum < x) {
      cout << -1 << endl;
      return 0;
    }
  }

  for(int i=0; i<pow(2,n); i++){
    // iを2進数として見れば、各々の桁がboolとして使える
    bitset<12> tmp(i);
    vector<int> skills(m,0);
    int sum=0;
    bool isAchieve = true;
    for(int j=0; j<n; j++){
        if(tmp.test(j)) {
          sum+=c[j];
          for(int k=0; k<m; k++) skills[k]+=a[j][k];
        }
    }
    for(auto v:skills) {
      if(v<x) {
        isAchieve=false;
        continue;
      }
    }
    if(isAchieve) ans = min(ans,sum);
  }
  cout << ans << endl;
}


Measured memory_bytes: 4048
def f(n):
    res = set()
    for i in range(2, int(n ** 0.5)):
        if n % i: continue
        while not n % i: n //= i
        res.add(i)
    return res | {n}

a, b = map(int,input().split())
print(len(f(a) & f(b) | {1}))


Measured memory_bytes: 3060
# coding: utf-8
# Your code here!

n,m = map(int,input().split())
a = [-1 for i in range(n)]
flag = 1
for i in range(m):
    b,c = map(int,input().split())
    b -= 1
    if a[b] != -1 and a[b] != c:
        flag = 0
        print("-1")
        break
    else:
        a[b] = c

if flag == 1:
    if a[0] == 0:
        if n == 1:
            print(0)
        else:
            print(-1)
    else:
        if a[0] == -1:
            if n == 1:
                a[0] = 0
            else:
                a[0] = 1
        ans = 0
        for i in range(n):
            if a[i] != -1:
                ans += a[i] * (10**(n-1-i))
        print(ans)

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner scan = new Scanner(System.in);
        int N = Integer.parseInt(scan.next());
        int T = Integer.parseInt(scan.next());
        int A = Integer.parseInt(scan.next());
        int H;
        int temp;
        int res = 0;
        int cc = 1000000000;

        int i =0;
        for(i = 1; i <= N; i++){

            H = Integer.parseInt(scan.next());
            temp = T*1000 - H * 6 - A*1000;
            if(temp < 0 ) temp = -temp;
            if(temp < cc){
                cc = temp;
                res = i;
            }
        }

        System.out.println(res);
    }
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}

ll f(int N, int K, int a) {
  if (a == 0)
    return N/K;
  else
    return (N/K) + ((N%K)>=a ? 1 : 0);
}

int main2() {
  int N = nextInt();
  int K = nextInt();
  ll ans = 0;
  for (int a = 0; a < K; a++) {
    int b = (K - a) % K;
    int c = (K - a) % K;
    if ((b + c) % K == 0) {
      ans += f(N,K,a) * f(N,K,b) * f(N,K,c);
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	string s; cin >> s;
	auto pass = [&](string &s, vector<int> &f) {
		int n = s.length();
		f.resize(n + 1, 0);
		f[1] = 0;
		for (int j = 0, i = 1; i < n; i++) {
			while (j && s[i] != s[j]) j = f[j];
			j += s[i] == s[j];
			f[i + 1] = j;
		}
	};
	vector<int> f, g;
	pass(s, f);
	reverse(s.begin(), s.end());
	pass(s, g);
	reverse(s.begin(), s.end());
	int all_same = true;
	int n = s.length();
	for (int i = 0; i < n; i++) {
		if (s[i] != s[0]) {
			all_same = false;
			break;
		}
	}
	if (all_same) {
		return cout << n << '\n' << 1 << '\n', 0;
	}
	if (f[n] == 0 || n % (n - f[n]) != 0) {
		return cout << 1 << '\n' << 1 << '\n', 0;
	}
	cout << 2 << '\n';
	int ans = 0;
	for (int i = 1; i <= n - 1; i++) {
		{
			int p = i - f[i];
			if (p < i && i % p == 0) continue;
		}
		{
			int q = n - i - g[n - i];
			if (q < n - i && (n - i) % q == 0) continue;
			ans++;
		}
	}
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 4764
package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)
	m := make([]string, n)
	for i := 0; i < n; i++ {
		fmt.Scan(&m[i])
	}
	fmt.Println(len(removeDuplicate1(m)))
}

func removeDuplicate1(args []string) []string {
	results := make([]string, 0, len(args))
	encountered := map[string]bool{}
	for i := 0; i < len(args); i++ {
		if !encountered[args[i]] {
			encountered[args[i]] = true
			results = append(results, args[i])
		}
	}
	return results
}


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


int main() {
  
  int count;
  cin >> count ;

  bool isY = false;
  for(int i =0; i < count; i++){
    char c;
    cin >> c;
    if(c == 'Y'){
      isY = true;
      break;
    }
  }

  cout << (isY? "Four": "Three") <<endl;
}

Measured memory_bytes: 256
{-# LANGUAGE BangPatterns #-}

module Main
  ( main
  )
where
 
import           Control.Applicative
import           Control.Monad
import           Data.Bits
import qualified Data.ByteString.Char8         as BS
import           Data.Char
import           Data.List
import           Data.Maybe
import qualified Data.Vector                   as V
 
parse = fst . fromJust
parseInt = parse . BS.readInt
parseInteger = parse . BS.readInteger
readInt = parseInt <$> BS.getLine
readInteger = parseInteger <$> BS.getLine
readIntList = map parseInt . BS.words <$> BS.getLine
 
main = do
  [n, u, v] <- readIntList
  arr       <- concat <$> replicateM
    (n - 1)
    ((\[a, b] -> [(a - 1, b - 1), (b - 1, a - 1)]) <$> readIntList)
  let
    graph    = createUnweightedGraphFromList arr
    dist1    = treeDepthFirstSearch (u - 1) graph
    dist2    = treeDepthFirstSearch (v - 1) graph
    farthest = maximum . map snd . filter (\(a, b) -> a < b) $ zip dist1 dist2
  print $ farthest - 1
 
type Vertex = Int
type Cost = Int
type Capacity = Int
 
data Edge = Edge { from :: !Vertex, to :: !Vertex, cost :: !Cost, cap :: !Capacity } deriving (Eq, Ord, Show)
newUnweightedEdge (!from, !to) = Edge { from = from, to = to, cost = 1, cap = 0 }
createUnweightedEdgeVectorFromList :: [(Vertex, Vertex)] -> V.Vector Edge
createUnweightedEdgeVectorFromList = V.fromList . map newUnweightedEdge
 
type Graph = V.Vector (V.Vector Edge)
createUnweightedGraphFromList :: [(Vertex, Vertex)] -> Graph
createUnweightedGraphFromList =
  V.fromList
    . map createUnweightedEdgeVectorFromList
    . groupBy (\a b -> fst a == fst b)
    . sort
 
treeDepthFirstSearch :: Vertex -> Graph -> [Cost]
treeDepthFirstSearch src =
  map snd . sort . updateTreeDepthFirstSearch [(src, 0, src, 0)] []
 
updateTreeDepthFirstSearch
  :: [(Vertex, Int, Vertex, Cost)]
  -> [(Vertex, Cost)]
  -> Graph
  -> [(Vertex, Cost)]
updateTreeDepthFirstSearch (!(v, i, p, c) : xs) !visited !g =
  let edge  = (g V.! v) V.!? i
      stack = case edge of
        Nothing -> xs
        Just e | to e == p -> (v, i + 1, p, c) : xs
               | otherwise -> (to e, 0, v, c + cost e) : (v, i + 1, p, c) : xs
      newVisited = if i == 0 then (v, c) : visited else visited
  in  updateTreeDepthFirstSearch stack newVisited g
updateTreeDepthFirstSearch [] visited _ = visited

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

int main(int argc, char const *argv[]) {
  int a,b;
  cin>>a>>b;
  int c,d;
  c=a%2;
  d=b%2;
  if(c*d==1){
    cout<<"Odd"<<endl;
  }
  else{
    cout<<"Even"<<endl;
  }
  return 0;
}

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

typedef long long ll;
typedef pair<int, int> P;
#define MOD 1000000007
#define INF (1 << 30)
#define REP(i, m, n) for(int i = (int)m; i < (int)n; ++i)
#define rep(i, n) REP(i, 0, n)


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

    int n; cin >> n;
    vector<int> x(n);
    rep(i, n) cin >> x[i];
    int m; cin >> m;
    rep(i, m) {
        int a; cin >> a;
        a--;
        if(x[a] == 2019) continue;
        if(x[a]+1 == x[a+1]) continue;
        x[a]++;
    }
    rep(i, n) cout << x[i] << '\n';
    return 0;
}


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

using namespace std;
using ll = long long;
constexpr int mod = 1e9+7;
constexpr int md = mod;
constexpr int MOD = mod;
constexpr ll inf = 1e9+5;
const int MAX=510000;
int main(){
    ios::sync_with_stdio(false);
	cin.tie(0);
    int n;
    cin>>n;
    int sum = 0;
    vector<int> x(n);
    for(auto & a : x) cin>>a;
    vector<int> y(n);
    for(auto & a : y) cin>>a;
    
    for(int i=0;i<n;++i){
        sum += max(0,x[i]-y[i]);
    }
    cout << sum << endl;
    return 0;
}



Measured memory_bytes: 256
# coding: utf-8
import math


def main():
    li = sorted([int(input()) for _ in range(5)],
                key=lambda i: i % 10 if i % 10 > 0 else 10,
                reverse=True)
    s = 0
    for i in li[:-1]:
        s += math.ceil(i/10) * 10
    print(s + li[-1])


main()

Measured memory_bytes: 3060
"use strict";
function Main(input) {
    let cin = new Inputer(input);
    let N = cin.getInt(), K = cin.getInt();
    if (K % 2 == 1) {
        let ans = 0;
        for (let n = 1; n <= N; n++) {
            if (n % K == 0) ans++;
        }
        console.log(ans * ans * ans);
    } else {
        const k2 = Math.floor(K / 2);
        let a0 = 0, a2k = 0;
        for (let n = 1; n <= N; n++) {
            const modK = n % K;
            if (modK == 0) a0++;
            if (modK == k2) a2k++;
        }
        let ans = a0 * a0 * a0 + a2k * a2k * a2k;
        console.log(ans);
    }
}
class Inputer{constructor(t){this.cnt=0,this.items=t.split(/\n|\s/)}getInt(){return this.items[this.cnt++]-0}getIntArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getInt();return r}getStr(){return this.items[this.cnt++]}getStrArray(t){let r=new Array(t);for(let e=0;e<t;e++)r[e]=this.getStr();return r}}
if (typeof window == "undefined") Main(require("fs").readFileSync("/dev/stdin", "utf8"));

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


using namespace std;

using ll   = long long;
using ii   = pair < int , int >;
using i3   = pair < int , ii >;
using li   = pair < ll , int >;
using lii  = pair <  ll,  ii >;
using vi   = vector < int >;
using vl   = vector < ll >;
using vli  = vector < li >;
using vii  = vector < ii >;
using vi3  = vector < i3 >;
using vlii = vector < lii >;

const int N = 2e5 + 5;
const ll INF = 1e17;
const double eps = 1e-12 , PI = acos(-1);

int n , m;

void solve(int cs){
    scanf("%d %d" , &n , &m);


    priority_queue < ll > pq;
    for(int i = 1 ; i <= n ; i ++){
        ll x;
        scanf("%lld" , &x);
        pq.push(x);
    }


    while( m -- ){
        if(pq.empty())break;
        ll x = pq.top();
        pq.pop();

        x /= 2;
        if(x > 0)pq.push(x);
    }

    ll ans = 0;
    while( !pq.empty() ){
        ll x = pq.top();
        ans += x;
        pq.pop();
    }

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

main(){
    int t = 1;
    //scanf("%d" , &t);

    for(int cs = 1 ; t -- ; cs ++){
        solve(cs);
    }

    return 0;
}



Measured memory_bytes: 1400
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <iomanip>
#include <queue>
#include <stack>
#include <deque>
#include <utility>
#include <functional>
#define rep(i,n) for(int i=0;i<n;++i)
#define FOR(i,s) for(int i=s;i>=0;--i)

using ll = long long;
using namespace std;

const ll INF = 1010101010;
const ll MOD = 1000000007;

int main() {
	ll n, m, ans = 0, A[10101];
	cin >> n >>m;
	cout << n * m - (n + m - 1) << endl;
	return 0;
}

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

template<int MOD> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % MOD) {
        if (val < 0) val += MOD;
    }
    constexpr int getmod() { return MOD; }
    constexpr Fp operator - () const noexcept {
        return val ? MOD - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= MOD) val -= MOD;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % MOD;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % MOD;
        if (val < 0) val += MOD;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<MOD>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<MOD> modpow(const Fp<MOD> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
};


const int MOD = 1000000007;
using mint = Fp<MOD>;


int modpow(int a,int x){
  if(a<0)a+=MOD;
  int ans=1;
  while(x>0){
    if(x&1) ans=ans*a%MOD;
      a=a*a%MOD;
      x>>=1;
  }
  return ans;
}
int gyaku(int n){
    return modpow(n,MOD-2);
}

//素因数分解でそれぞれの素数がいくつ出てきたかを保存するmap
auto pfactor(int n){
  map<int,int> res;
  int t=sqrt(n);
  for(int i=2;i<=t;i++){
    for(;n%i==0;n/=i)res[i]++;
  }
  if(n>1)res[n]++;
  return res;
}
vector<int>kai(0);
void kaizyou(vector<int>&kai){
    rep(i,kai.size()){
        kai[i+1]=kai[i]*(i+1)%MOD;
      }
  }
int comb(int a,int b){
  return (kai[a]*gyaku(kai[a-b]))%MOD*gyaku(kai[b])%MOD;
}
////////////////////////////////////////////////////////////////////////
signed main() {
  int x,k,d;
  cin>>x>>k>>d;
  x=abs(x);
  if((x-d)/d+1>k){
    cout<<x-k*d<<endl;
    exit(0);
  }
  int p,m,tom;
  p=x-x/d*d;
  m=p-d;
  tom=(x-m)/d;

  if(tom%2==k%2)cout<<abs(m)<<endl;
  else cout<<p<<endl;


  }


Measured memory_bytes: 3600
#include <bits/stdc++.h> 
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vl;
typedef pair<ll,ll> pll;
#define MOD 1000000007
#define INF 1000000000
#define mp make_pair
#define pb push_back
#define ss second
#define ff first
#define endl '\n'
#define pl cout<<endl;
#define tc int t;cin>>t;while(t--)
#define get cin>>
#define geta ll a[n];for (int i = 0; i < n; ++i){cin>>a[i];}
#define puta for (int i = 0; i < n; ++i){cout<<a[i];}
#define put cout<<
ll maxi=LLONG_MIN;
ll mini=LLONG_MAX;
void fast() { ios_base::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL); }
ll dp[3005][3005];
int main() 
{
    fast();
    memset(dp,0,sizeof(dp));
    int n;
	cin>>n;
	vector<ll> a(n+1);
	for(int i=1;i<=n;++i)
	{
	cin>>a[i];
	}
	for(int i=n;i>=1;--i) 
	{
	dp[i][i] = a[i];
	for(int j=i+1;j<=n;++j)
	{
	dp[i][j] = max(a[j]-dp[i][j-1],a[i]-dp[i+1][j]);
	}
	}
	cout<<dp[1][n];
	return 0;
}
// dp1[i][j] =maximum score the first one to make
//  	the move can obtain by using a[i] to a[j]
// dp2[i][j] =maximum score the 2nd one to make
//  	the move can obtain by using a[i] to a[j]

// dp1[i][i] for all i from 1 to n is a[i]
// dp2[i][i] = 0

// dp1[i][j]=max(a[i]+dp2[i+1][j],a[j]+dp2[i][j-1])
// if(a[i]+dp2[i+1][j]>a[j]+dp2[i][j-1])
// {
// 	dp2[i][j]=dp1[i+1][j];
// }
// else
// {
// 	dp2[i][j]=dp1[i][j-1];
// }

// What if dp1[i+1][j]>a[i]+dp2[i+1][j] and a[i]+dp2[i+1][j]>a[j]+dp2[i][j-1] 
// 	and a[j]+dp2[i][j-1]>dp1[i][j-1]

Measured memory_bytes: 70784
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define RI(X) scanf("%d", &(X))
#define RII(X, Y) scanf("%d%d", &(X), &(Y))
#define RIII(X, Y, Z) scanf("%d%d%d", &(X), &(Y), &(Z))
#define DRI(X) int (X); scanf("%d", &X)
#define DRII(X, Y) int X, Y; scanf("%d%d", &X, &Y)
#define DRIII(X, Y, Z) int X, Y, Z; scanf("%d%d%d", &X, &Y, &Z)
#define RS(X) scanf("%s", (X))
#define CASET int ___T, case_n = 1; scanf("%d ", &___T); while (___T-- > 0)
#define MP make_pair
#define PB push_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define PII pair<int,int>
#define VI vector<int>
#define VL vector<long long>
#define VPII vector<pair<int,int> >
#define PLL pair<long long,long long>
#define VPLL vector<pair<long long,long long> >
#define F first
#define S second
typedef long long LL;
using namespace std;
const int MOD = 1e9+7;
const int SIZE = 1e6+10;
VI e[SIZE];
int d[2][SIZE];
void dfs(int x,int lt,int v[]){
    REP(i,SZ(e[x])){
        int y=e[x][i];
        if(y==lt)continue;
        v[y]=v[x]+1;
        dfs(y,x,v);
    }
}
int main(){
    DRI(N);
    REPP(i,1,N){
        DRII(x,y);
        e[x].PB(y);
        e[y].PB(x);
    }
    dfs(1,1,d[0]);
    dfs(N,N,d[1]);
    int r=0;
    REPP(i,1,N+1){
        if(d[0][i]<=d[1][i])r++;
        else r--;
    }
    puts(r>0?"Fennec":"Snuke");
    return 0;
}


Measured memory_bytes: 40832
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
#include <cstdint>
using namespace std;
using LL = long long;

int N;
int A[1234][1234];
namespace std {
	template <>
	struct hash<pair<int, int>> {
		size_t operator()(const pair<int, int>& hoge) const {
			size_t seed = 0;
			auto n_hash = hash<int>()(hoge.first);
			auto d_hash = hash<double>()(hoge.second);

			seed ^= n_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
			seed ^= d_hash + 0x9e3779b9 + (seed << 6) + (seed >> 2);
			return seed;
		}
	};
}
int main() {
	cin >> N;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < N - 1; ++j) {
			cin >> A[i][j];
			--A[i][j];
		}
	}
	unordered_map<pair<int, int>, int>M;
	set<pair<int, pair<int, int>>>S;
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < i; ++j) {
			S.insert({ 0,{j,i} });
			M[{j, i}] = 0;
		}
	}
	auto w = [&](int i, int j) {
		return (i < j) ? pair<int, int>(i, j) : pair<int, int>(j, i);
	};
	vector<int>upd;
	for (int i = 0; i < N; ++i)upd.push_back(i);
	vector<int>mark(N, 0);
	int ans = 0;
	for (;;) {
		bool br = true;
		for (int i : upd) {
			if (mark[i] != N - 1) {
				br = false;
				int j = A[i][mark[i]];
				S.erase(S.find({ M[w(i,j)] ,w(i, j) }));
				M[w(i, j)]--;
				S.insert({ M[w(i,j)], w(i,j) });
			}
		}
		if (br)
			break;
		upd.clear();
		ans++;
		while (!S.empty()) {
			auto big = *S.begin();
			if (big.first > -2) {
				break;
			}
			mark[big.second.first]++;
			if (mark[big.second.first] < N - 1)upd.push_back(big.second.first);
			upd.push_back(big.second.second);
			if (mark[big.second.second] < N - 1)mark[big.second.second]++;
			S.erase(S.begin());
		}
	}
	for (int i = 0; i < N; ++i) {
		if (mark[i] != N - 1) {
			ans = -1;
		}
	}
	cout << ans << endl;
	return 0;
}


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

int main() {
int A,B,C,M,a,b,X,Y;
  cin>>A>>B>>C;
  M=max(max(A,B),C);
  a=min(min(A,B),C);
  b=A+B+C-M-a;
  X=M-a;
  Y=M-b;
  if(X%2==Y%2){
    cout<<(X+Y)/2<<endl;
  }
    else{
      cout<<(X+Y)/2+2<<endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#define pb push_back
#define mod 1000000007
using namespace std;
typedef long long int ll;

int main(void){
  int n;
  vector<int> a;
  int t;
  cin>>n;
  map<int,int> mp;
  for(int i=0;i<n;i++){
    cin>>t;
    if(mp.find(t)==mp.end()) mp[t]=1;
    else mp[t]=mp[t]+1;
  }
  int res=0;
  for(auto x : mp){
    if(x.first!=x.second) {
      if(x.second>x.first) res+=(x.second-x.first);
      else res+=x.second;
    }
  }
  cout<<res<<endl;
  return 0;
}


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

using namespace std;

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

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

}

Measured memory_bytes: 384
#include <iostream>
using namespace std;
int main()
{

ios_base::sync_with_stdio(0);
cin.tie(0);
    int a ;
    cin >> a ;
    bool flag = false;
    for(int i = 1 ;i < 10 ; i++ )
    {
        if(a % i == 0 && a/i < 10){
        flag = true;
        break;
        }
    }
    cout << (flag  ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define MAX_V 300
#define INF 1e9
using namespace std;

struct edge{int to, cap,cost,rev;};
int V;
vector<edge> G[MAX_V];
int dist[MAX_V];
int prevv[MAX_V],preve[MAX_V];

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

int min_cost_flow(int s,int t,int f){
  int res=0;
  while(f>0){
    fill(dist,dist+V,INF);
    dist[s]=0;
    bool update = true;
    while(update){
      update = false;
      for(int v=0; v<V ;v++){
	if(dist[v]==INF) continue;
	for(int i=0; i<G[v].size(); i++){
	  edge &e = G[v][i];
	  if(e.cap > 0 && dist[e.to] > dist[v]+e.cost) {
	    dist[e.to] = dist[v] + e.cost;
	    prevv[e.to] = v;
	    preve[e.to] = i;
	    update = true;
	  }
	}
      }
    }
    if(dist[t]==INF) return -1;

    int d = f;
    for(int v=t; v!=s; v=prevv[v])d=min(d,G[prevv[v]][preve[v]].cap);
    f -= d;
    res += d*dist[t];
    for(int v=t; v!=s; v=prevv[v]){
      edge &e = G[prevv[v]][preve[v]];
      e.cap -= d;
      G[v][e.rev].cap += d;
    }
  }
  return res;
}

int can[MAX_V][MAX_V];
int Biparite_Matching(int N,int K){
   int s = N+K, t = s+1;
   for(int i=0; i<N; i++) add_edge(s,i,1,0);
   for(int i=0; i<K; i++) add_edge(N+i,t,1,0);

   for(int i=0;i<N;i++)
     for(int j=0;j<K;j++)add_edge(i, N+j , 1, can[i][j]);
   V=N+K+2;
  return min_cost_flow(s,t,N);
}

int main(){
  int n;
  cin>>n;
  int W[101][101],E[101][101];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++) cin>>W[i][j];
  
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++) cin>>E[i][j];
  
  string mp[101];
  for(int i=0;i<n;i++)cin>>mp[i];
  
  int sumW[101]={},sumH[101]={},sum=0;
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      if(mp[i][j]=='o'){
	sumW[i]+=E[i][j];
	sumH[j]+=E[i][j];
	sum+=E[i][j];
      }
  
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)can[i][j]=mp[i][j]=='o'? -E[i][j]:W[i][j];

  cout<<sum+Biparite_Matching(n,n)<<endl;
  int cnt=0;
  ostringstream ans[10001],tmp;
  
  for(int i=0;i<n;i++)
    for(int j=0;j<G[i].size();j++) {
      int h=i,w=G[i][j].to-n,cap=G[i][j].cap;
      if(cap<=0&&mp[h][w]=='.')ans[cnt++]<<h+1<<" "<<w+1<<" write";
      if(cap> 0&&mp[h][w]=='o')ans[cnt++]<<h+1<<" "<<w+1<<" erase";
    }
  cout<<cnt<<endl;
  for(int i=0;i<cnt;i++)cout<<ans[i].str()<<endl;  
  return 0;
}

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

public class Main {
	void run() {
		int[] need = new int[] {1, 4, 7, 9};
		int[] a = new int[need.length];
		for (int i = 0; i < a.length; i++) {
			a[i] = in.nextInt();
		}
		Arrays.sort(a);
		System.out.println(Arrays.equals(a, need) ? "YES" : "NO");
	}

	static MyScanner in;
	static PrintWriter out;

	public static void main(String[] args) throws IOException {
		boolean stdStreams = true;
		String fileName = Main.class.getSimpleName().replaceFirst("_.*", "").toLowerCase();
		String inputFileName = fileName + ".in";
		String outputFileName = fileName + ".out";
		
		Locale.setDefault(Locale.US);
		BufferedReader br;
		if (stdStreams) {
			br = new BufferedReader(new InputStreamReader(System.in));
			out = new PrintWriter(System.out);
		} else {
			br = new BufferedReader(new FileReader(inputFileName));
			out = new PrintWriter(outputFileName);
		}
		in = new MyScanner(br);
		int tests = 1;//in.nextInt();
		for (int test = 0; test < tests; test++) {
			//out.print("Case #" + (test + 1) + ": ");
			new Main().run();
		}
		br.close();
		out.close();
	}
	
	static class MyScanner {
		BufferedReader br;
		StringTokenizer st;

		MyScanner(BufferedReader br) {
			this.br = br;
		}
		
		void findToken() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		
		String next() {
			findToken();
			return st.nextToken();
		}
		
		int nextInt() {
			return Integer.parseInt(next());
		}
		
		long nextLong() {
			return Long.parseLong(next());
		}
		
		double nextDouble() {
			return Double.parseDouble(next());
		}
	}
}


Measured memory_bytes: 21716
#### import ####
import sys
import math
from collections import defaultdict

#### 設定 ####
sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

#### 定数 ####
mod = 10**9 + 7

#### 読み込み ####
def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

A,B,T = II()

print(int((T+0.5)//A) * B)

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

#define ll long long
#define mod 998244353
const int N=200010;
int a[200010],vis[N];
void upd(int x,int val)
{
  while(x<N) vis[x]=(vis[x]+val)%mod,x+=(x&-x);
  
}
int qry(int x)
{
  if(x<0) return 0;
  int r=0;
  while(x) r=(r+vis[x])%mod,x-=(x&-x);
  return r;
}
ll pwr(ll a,ll b)
{
  ll r=1;
  while(b)
  {
    if(b%2) r=r*a%mod;
    b/=2;
    a=a*a%mod;
  }
  return r;
  
}
int main()
{
  int n,m,k;
  cin>>n>>m>>k;
  a[0]=1;
  for(int i=1;i<=n;i++)
    a[i]=1ll*i*a[i-1]%mod;
  ll res=1ll*m*pwr(m-1,n-1)%mod;
  for(int i=1;i<=k;i++)
  {
    ll r=1ll*a[n-1]*pwr(a[i],mod-2)%mod*pwr(a[n-i-1],mod-2)%mod;
    r=m*r%mod*pwr(m-1,n-i-1)%mod;
    //cout<<res<<" "<<r<<"\n";
    res=(res+r)%mod;
  }
  /*for(int i=n;i>=0;i-=2)
  {
    if((n-i)/2>k) break;
    int j=(n-i)/2+i;
    if(j)
    {
      int p=(n-i)/2;
      ll r=1ll*a[p+i]*pwr(a[p],mod-2)%mod*pwr(a[i],mod-2)%mod;
      res=(res+r*m%mod*pwr(m-1,j-1)%mod)%mod;
    }
    //cout<<res<<"\n";
  }
  */
  cout<<res;
  
  
 return 0; 
}

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

int c[3];

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

	for (int i = 0; i < 3; i++) {
		c[s[i] - 'a']++;
	}

	bool flag = true;
	for (int i = 0; i < 3; i++) {
		if (c[i] == 0) {
			flag = false;
		}
	}


	//for (int i = 0; i < 3; i++)cout << c[i] << endl;

	if (flag) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main(void){
	char S[100],T[100],S1[100],t;
	int i,j,l;
	gets(S);
	gets(T);
	l=strlen(S);
	for(i=0;i<l;i++)
	{
	   	for(j=0;j<l-1;j++)
		   {
		      S1[j+1]=S[j];
		   }
	          S1[0]=S[l-1];
	    for(j=0;j<l;j++)
		   {
		      S[j]=S1[j];
		   }
	    for(j=0;j<l;j++)
		   {
		      if(S[j]!=T[j])
		         break;
		   } 
		if(j==l)
		   break;       
	}
	if(i!=l)
	   printf("Yes");
	else
	   printf("No");
}

Measured memory_bytes: 256
s = gets().chomp
keyence_string = "keyence"

def continuously_matched_index(s1, s2)
  for i in 0..(s1.size - 1) do
    if(s1[i] != s2[i]) then
      return (i - 1)
    end
  end

  return (s1.size - 1)
end

first_continuously_matched_index = continuously_matched_index(keyence_string, s)
if first_continuously_matched_index == 6 then
  puts "YES"
else
  rest_of_keyence_string = keyence_string.slice((first_continuously_matched_index + 1)..6)
  if s.reverse.start_with?(rest_of_keyence_string.reverse) then
    puts "YES"
  else
   puts "NO"
  end
end

# chomp忘れててハマっていた...


Measured memory_bytes: 1788
num_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
K = int(input())

print(num_list[K - 1])

Measured memory_bytes: 2940
import sys
from collections import deque

def solve():
    input = sys.stdin.readline
    N = int(input())
    point = dict()
    for _ in range(N):
        s = input().strip("\n")
        if s in point: point[s] += 1
        else: point[s] = 1
    M = int(input())
    for _ in range(M):
        s = input().strip("\n")
        if s in point: point[s] -= 1
        else: point[s] = -1
    
    Ans = 0
    for key in point:
        Ans = max(Ans, point[key])
    print(Ans)


    return 0

if __name__ == "__main__":
    solve()

Measured memory_bytes: 3316
// I am Varun Das from Jadavpur University
#include <bits/stdc++.h>
#define mod 1000000007
#define ll long long
#define INF 1e9+5
#define loop(i,a,b) for(int i=a;i<b;i++)
using namespace std;

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//cout<<fixed<<setprecision(12);
int n,k;
cin>>n>>k;
vector<int>v(n);
for(int& x : v) cin>>x;
vector<int>dp(n,INF);
dp[0]=0;
for(int i=0;i<n;i++){
    for(int j=i+1;j<=i+k;j++){
        if(j < n){
            dp[j]=min(dp[j],dp[i]+abs(v[i]-v[j]));
        }
    }
}
cout<<dp[n-1];

	return 0;
}

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

#define yes cout << "APPROVED" << endl
#define no cout << "DENIED" << endl

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

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

    for(i = 0; i < n; i++)
    {
        if(arr[i] % 2 == 0)
        {
            if(arr[i] % 3 == 0 || arr[i] % 5 == 0)
            {
                continue;
            }
            else
            {
                no;
                return 0;
            }
        }
    }

    yes;

    return 0;
}


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

int main() {

  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n);
  for(int i = 0; i < n; i++) { cin >> a.at(i); }
  for(int i = 0; i < n; i++) { cin >> b.at(i); }
  for(int i = 0; i < n; i++) { cin >> c.at(i); }

  int ans = 0;
  for(int i = 0; i < n; i++) {
    int tmp = a.at(i);
    ans = ans + b.at(a.at(i)-1);
    if(i >= 1 && a.at(i) == a.at(i-1)+ 1 ) {
      ans = ans + c.at(a.at(i-1)-1);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
	int a,b,c,x,y,i,ans;
	int pt[10];
	scanf("%d %d %d %d %d",&a,&b,&c,&x,&y);
	pt[0]=a*x+b*y;
	if(x<y){
		pt[1]=2*c*x+(y-x)*b;
		pt[2]=2*c*y;
	}else{
		pt[1]=2*c*y+(x-y)*a;
		pt[2]=2*c*x;
	}
	ans=pt[0];
	for(i=0;i<3;i++){
		if(ans>pt[i]){
			ans=pt[i];
		}
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;

using namespace std;

int main(){
    ll a,b;cin>>a>>b;
    cout<<a+b/2<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <cstdio>
#include <string.h>
#include <cstring>
using namespace std;

int w,h;
int land[50][50];
int isLands;
int d1[] = {0,0,-1,1,-1,1,-1,1};
int d2[] = {-1,1,0,0,1,1,-1,-1};

void dfs(int i, int j,int h, int w){
    
    if(i >= h || j >= w) return;
    if(i < 0 || j < 0) return;
    if(land[i][j] == 0) return;
    if(land[i][j] == 1) {
        land[i][j] = 0;
        for(int k = 0; k < 8; k++){
            dfs(i + d1[k], j + d2[k], h , w);
        }
    }

}

int main() {
    while(true){
        cin >> w >> h;
        if(w == 0 || h == 0) break;
        isLands = 0;
        for(int i = 0;i < h; i++){
            for(int j = 0; j< w; j++){
                cin >> land[i][j];
            }
        }
        for(int i = 0;i < h; i++){
            for(int j = 0; j< w; j++){
                if(land[i][j] == 1){
                    isLands++;
                    dfs(i,j,h,w);
                }
            }
        }
        cout << isLands << endl;
    }
    return 0;
}




Measured memory_bytes: 3148
package main

import (
    "bufio"
    "os"
    "strconv"
    "fmt"
    "math"
)
const INF = 10000000000000000
var sc = bufio.NewScanner(os.Stdin)

func readInt() int {
    sc.Scan()
    n, _ := strconv.Atoi(sc.Text())
    return n
}

func min(a, b int) int {
    return int(math.Min(float64(a), float64(b)))
}

func main() {
    sc.Split(bufio.ScanWords)
    n := readInt()
    var edges [300][300]int
    var dist [300][300]int
    for i := 0; i < n; i++ {
        for j := 0; j < n; j++ {
            edges[i][j] = readInt()
            dist[i][j] = INF
        }
    }
    for k := 0; k < n; k++ {
        for i := 0; i < n; i++ {
            for j := 0; j < n; j++ {
                dist[i][j] = min(dist[i][j], edges[i][k] + edges[k][j])
            }
        }
    }
    ans := 0
    invalid := false
    for i := 0; i < n; i++ {
        for j := i + 1; j < n; j++ {
            minCost := INF
            for k := 0; k < n; k++ {
                if i == k || j == k {
                    continue
                }
                minCost = min(minCost, dist[i][k] + dist[k][j])
            }
            if edges[i][j] > minCost {
                invalid = true
            } else if edges[i][j] < minCost {
                ans += edges[i][j]
            }
        }
    }
    if invalid {
        fmt.Println(-1)
    } else {
        fmt.Println(ans)
    }
}

Measured memory_bytes: 3456
from _collections import deque


def parser():
    while 1:
        data = list(input().split(' '))
        for number in data:
            if len(number) > 0:
                yield (number)


input_parser = parser()


def gw():
    global input_parser
    return next(input_parser)


def gi():
    data = gw()
    return int(data)


MOD = int(1e9 + 7)

import numpy
import scipy
from collections import deque
#https://atcoder.jp/contests/abc138/tasks/abc138_d
#D - Ki
"""
need to consider the case that ticket is not enough to lower everything
"""
N = gi()
A = [0] * (N + 5)
bs = [0] * (N + 5)
for i in range(1, N + 1):
    A[i] = gi()

ans = []
for i in range(N, 0, -1):
    tc = 0
    mul = 1
    while mul * i <= N:
        tc += bs[mul * i]
        mul += 1
    if (tc % 2 != A[i]):
        bs[i] = 1
        ans.append(i)

print(len(ans))
for v in ans:
    print("%d " % (v), end="")


Measured memory_bytes: 22624
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<iterator>
#include<complex>
#include<stack>
#include "stdio.h"
using namespace std;

#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)

using ll = long long;
using Pii = pair<int, int>;

const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9+7;

int dy[] = { 0, 0, 1, -1, 0 };
int dx[] = { 1, -1, 0, 0, 0 };

using MIte = multimap<ll, ll, greater<ll> >::iterator;

vector<vector<int> > vvEdge;
vector<vector<int> > vvEdge2;
vector<int> vDist;
int N, M;

void bfs(int i, int& n, vector<int>& vv) {
	vv.clear();
	n = inf;

	queue<int> q;
	q.push(i);
	vDist[i] = 0;
	vector<int> vRoute(N);
	while (!q.empty()) {
		int now = q.front();
		q.pop();
		for (int a : vvEdge[now]) {
			if (vDist[a] == -1) {
				vDist[a] = vDist[now] + 1;
				q.push(a);
				vRoute[a] = now;
			}
		}
	}

	for (int a : vvEdge2[i]) {
		if (vDist[a] != -1) {
			int vtx = a;
			vector<int> route;
			route.push_back(a);
			while (1) {
				int vtx2 = vRoute[vtx];
				route.push_back(vtx2);
				vtx = vtx2;
				if (vtx == i) {
					break;
				}
			}

			if (n > route.size()) {
				vv = route;
				n = route.size();
			}
		}
	}

	if (vv.empty()) {
		n = inf;
	}

	return;

}


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

	// long long?
//	int N, M;
	cin >> N >> M;

	vvEdge.resize(N);
	vvEdge2.resize(N);
	rep(i, M) {
		int a, b;
		cin >> a >> b;
		a--;
		b--;
		vvEdge[a].push_back(b);
		vvEdge2[b].push_back(a);
	}

	int n = inf;
	vector<int> vv;
	rep(i, N) {
		vector<int> vvtmp;
		int ntmp = inf;
		vDist = vector<int>(N, -1);
		bfs(i, ntmp, vvtmp);
		if (ntmp != inf) {
			if (n > ntmp) {
				n = ntmp;
				vv = vvtmp;
			}
		}
	}

	if (n != inf) {
		cout << n << endl;
		for (int e : vv) {
			cout << e + 1 << endl;
		}
	}
	else {
		cout << "-1" << endl;
	}

	return 0;
}

Measured memory_bytes: 384