akhauriyash/Code-Regression huggingface dataset:
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String ss=sc.nextLine();
		String ts=sc.nextLine();
char s[]=ss.toCharArray();
int sint[]=new int[s.length];
ArrayList<Character> sch = new ArrayList<Character>();


char t[]=ts.toCharArray();
int tint[]=new int[t.length];
ArrayList<Character> tch = new ArrayList<Character>();


int cou=0;


for(int i=0;i<s.length;i++){
if(sch.indexOf(s[i])==-1){
	sch.add(s[i]);
	sint[i]=cou;
	cou++;
}else{
	sint[i]=sch.indexOf(s[i]);
}

}
cou=0;

for(int i=0;i<s.length;i++){
if(tch.indexOf(t[i])==-1){
	tch.add(t[i]);
	tint[i]=cou;
	cou++;
}else{
	tint[i]=tch.indexOf(t[i]);
}

}


if(Arrays.equals(sint,tint)){
	System.out.println("Yes");
}else{System.out.println("No");}

	}
	static void show(int x[]){
		for(int i=0;i<x.length;i++){
			System.out.print(x[i]+" ");
		}
		System.out.println();
	}


}

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

int main(){
    int A1, A2, A3;
    cin>>A1>>A2>>A3;
    int sum = A1+A2+A3;
    if(sum>=22) cout<<"bust"<<endl;
    else cout<<"win"<<endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int m,n;
int ar[200],car[200];
int i,j;
int mode;

int main(){
	scanf("%d",&n);
	for(i=0;i<n*2;i++)ar[i]=i;
	scanf("%d",&m);
	for(i=0;i<m;i++){
		scanf("%d",&mode);
		for(j=0;j<n*2;j++)car[j]=ar[j];
		if(mode==0){
			for(j=0;j<n;j++){
				ar[j*2]=car[j];
			}
			for(j=n;j<n*2;j++){
				ar[(j-n)*2+1]=car[j];
			}
		}
		else{
			for(j=0;j<n*2;j++){
				if(j<mode)ar[n*2-mode+j]=car[j];
				else ar[j-mode]=car[j];
			}
		}
	}
	for(i=0;i<n*2;i++)printf("%d\n",ar[i]+1);
	return 0;
}

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

int main() {
	char s[101];
	scanf("%s", s);

	int len = strlen(s);

	int count = 0;

	if (len % 2 == 0) {
		for (int i = 0; i < len / 2; i++) {
			if (s[i] != s[len - 1 - i]) {
				count++;
			}
		}
	}
	else {
		for (int i = 0; i < (len - 1) / 2; i++) {
			if (s[i] != s[len - 1 - i]) {
				count++;
			}
		}
	}
	printf("%d", count);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
 
int main()
{
  string s;
  bool result = true;
  
  cin >> s;
  for (char st : s)
      if (st != s[0]) { result = false; break; }
      
  if (result) cout << "No" << endl;
  else cout << "Yes" << endl;
 
  return 0;
}

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

int main(){
int n,m;
cin >>n >>m;
vector<int>ans(m);
for(int i=0;i<n;i++){
    int k;
    cin >>k;
    for(int j=0;j<k;j++){
        int z;
        cin >>z;
        ans.at(z-1)++;
    }
}
int ansa =0;
for(int i=0;i<m;i++){
    if(ans.at(i)==n)ansa++;
}
cout <<ansa <<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
int main(){
  int N; cin >> N;
  vector<int> t(N+1);
  vector<int> x(N+1);
  vector<int> y(N+1);
  t.at(0) = x.at(0) = y.at(0) = 0;
  for(int i = 1; i <= N; i++) cin >> t.at(i) >> x.at(i) >> y.at(i);
  bool travel = true;
  rep(i, N){
    int tdef = abs(t.at(i+1)-t.at(i));
    int xdef = abs(x.at(i+1)-x.at(i));
    int ydef = abs(y.at(i+1)-y.at(i));
    if(!(tdef >= xdef + ydef && (tdef%2) == ((xdef%2)+(ydef%2))%2)){
      travel = false;
      break;
    }
  }
  if(travel){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    '''
    RL...LL 0
    RL...RR 0
    RL...RL 0

    RL...LR +2
    LR...RL +2

    RL      +1

    13 3
    LRRLRLRRLRLLR
    '''
    N, K = read_ints()
    S = input()
    score = 0
    for i in range(N-1):
        if S[i] == S[i+1]:
            score += 1
    return min(score+2*K, N-1)


if __name__ == '__main__':
    print(solve())


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

using namespace std;

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		map<string, int> cnt;
		for (int i = 0; i < n; i++) {
			string s;
			cin >> s;
			cnt[s]++;
		}
		vector<string> ss({"AC", "WA", "TLE", "RE"});
		for (auto s : ss) {
			cout << s << " x " << cnt[s] << "\n";
		}

		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 3652
//Robs Code
/***********HEADER***************/
#include <iostream>
#include <bitset>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <string>
#include <algorithm>
#include <list>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <set>
#include <queue>
#include <map>
/***********MACROS***************/
#define int long long int
#define fri(l,k) for (i=l;i<=k;i++)
#define frj(l,k) for (j=l;j>=k;j--)
#define fij(a,b,l,k) for(i=a;i<=b;i++) for(j=l;j<=k;j++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define endl "\n"
#define pb push_back
#define _1 first
#define _2 second
#define pii pair<int,int>
using namespace std;
int n,m,i,j,l,k,x,y,a,b,cnt[3],sum[3];
/***********MAIN**************/
signed main(){
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
	cin>>n>>m;
	if(n == m){
		cout<<"Yes";
	}else{
		cout<<"No";
	}
	return 0;
}
//.........

Measured memory_bytes: 256
from collections import deque
n=int(input())

A=list(map(int,input().split()))

x=[]

for i in range(n//2,n):
    if A[i]==1:
        x.append(i+1)

x=deque(x)



for i in reversed(range(0,n//2)):
    A[i]=A[i]*2-sum(A[i::i+1])
    A[i]%=2
    if A[i]==1:
        x.appendleft(i+1)
        
print(len(x))
if len(x)!=0:
    print(*x)

Measured memory_bytes: 13336
// http://yumai6.hatenablog.com/entry/2015/12/21/222930

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < (n);i++)
#define REPR(i, n) for(int i = (n);i >= 0;i--)
#define FOR(i, m, n) for(int i = (m);i < (n);i++)
#define FORR(i, m, n) for(int i = (m);i >= (n);i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

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

//---------------------------------------------------------------
// ２つの数字が交互にでるように修正する回数
//---------------------------------------------------------------

int N;
map<int, int> D1;
map<int, int> D2;

signed main(){
	cin >> N;
	int d;
	REP(i, N) {
		scanf("%d",&d);
		if((i % 2) == 0)	D1[d] += 1;
		else				D2[d] += 1;
	}
	
	int d1[2][2] = { {-1, 0}, {-1, 0} };
	for(auto itr = D1.begin(); itr != D1.end(); ++itr) {
		if(itr->second > d1[0][1]) {
			d1[1][0] = d1[0][0];
			d1[1][1] = d1[0][1];
			d1[0][0] = itr->first;
			d1[0][1] = itr->second;
		} else if(itr->second > d1[1][1]) {
			d1[1][0] = itr->first;
			d1[1][1] = itr->second;
		}
	}

	int d2[2][2] = { {-1, 0}, {-1, 0} };
	for(auto itr = D2.begin(); itr != D2.end(); ++itr) {
		if(itr->second > d2[0][1]) {
			d2[1][0] = d2[0][0];
			d2[1][1] = d2[0][1];
			d2[0][0] = itr->first;
			d2[0][1] = itr->second;
		} else if(itr->second > d2[1][1]) {
			d2[1][0] = itr->first;
			d2[1][1] = itr->second;
		}
	}
	int ans;
	if(d1[0][0] != d2[0][0]) {
		ans = N - d1[0][1] - d2[0][1];
	} else if((d1[0][1] + d2[1][1]) >= (d1[1][1] + d2[0][1])) {
		ans = N - d1[0][1] - d2[1][1];
	} else {
		ans = N - d1[1][1] - d2[0][1];
	}
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4992
x,y = map(int,input().split())
if 2 in [x,y]:
  print('No')
elif (x in [4,6,9,11] and y in [4,6,9,11]) or (x not in [4,6,9,11] and y not in [4,6,9,11]):
  print('Yes')
else:
  print('No')

Measured memory_bytes: 3060
N = int(input())
def divisor_all(n): # 約数全列挙
    import math as ma
    l = [1,n]
    for i in range(2,int(ma.sqrt(n))+1):
        if n % i == 0:
            l.append(i)
            l.append(n//i)
    l.sort()
    return l
ans = float('inf')
m = divisor_all(N)
for i in m:
    j = N // i
    ans = min(ans,max(len(str(i)),len(str(j))))
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;
#define rep(i, n) for (int i = 0; i < ((int)(n)); i++) // 0-indexed昇順

ll manha(pair<ll, ll> a, pair<ll, ll> b)
{
  return abs(a.first - b.first) + abs(a.second - b.second);
}

int main()
{
  ll N, M;
  cin >> N >> M;
  vector<pair<ll, ll>> A(N);
  vector<pair<ll, ll>> B(M);
  rep(i, N)
  {
    ll a, b;
    cin >> a >> b;
    A.at(i) = make_pair(a, b);
  }
  rep(i, M)
  {
    ll a, b;
    cin >> a >> b;
    B.at(i) = make_pair(a, b);
  }
  rep(i, N)
  {
    ll mi = 1LL << 60;
    ll pos = 0;
    rep(j, M)
    {
      ll r = manha(A.at(i), B.at(j));
      if (mi > r) {
        mi = r;
        pos = j;
      }
    }
    cout << pos + 1 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
#define Priq priority_queue<int,vi,greater<int>>
#define pb push_back
#define mp make_pair
#define INF (1ll<<60)
signed main(){
  int H; cin>>H;
  int ans=0,sum=1;
  while(H>1){
    ans+=sum;
    H/=2;
    sum*=2;
  }
  ans+=sum;
  cout<<ans<<endl;
  }



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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i+=2)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VC vector<char>
#define FOREACH(x,a) for(auto& (x) : (a) )
using namespace std;

int main() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	int x = c - a, y = d - b;
	cout << c - y << ' ' << d + x << ' ' << a - y << ' ' << b + x << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long n, k;
vector<long long> a;


long long f(long long x){
    long long res = 0;
    for(int i=0;i<n-1;i++){
        //cerr << res << " " << a[i] << endl;
        if(a[i] < 0){
            if(a[i]*a[i+1] < x) continue;
            int ok = i+1, ng = n;
            while(ok + 1 < ng){
                int mid = (ok + ng) / 2;
                if(a[i]*a[mid] >= x) ok = mid;
                else ng = mid;
            }
            //cerr << ok << " " << ng << endl;
            res += ok - i;
        }else if(a[i] == 0){
            if(x <= 0) res += n-i-1;
        }else{
            if(a[i]*a[n-1] < x) continue;
            int ok = n-1, ng = i;
            while(ng + 1 < ok){
                int mid = (ok + ng) / 2;
                if(a[i]*a[mid] >= x) ok = mid;
                else ng = mid;
            }
            res += n - ok;
        }
    }
    return res;
}

int main(void){
    cin >> n >> k;
    a.assign(n, 0);
    for(int i=0;i<n;i++) cin >> a[i];
    sort(a.begin(), a.end());
    long long ok = -1e18, ng = 1e18;
    while(ok + 1 < ng){
        long long mid = (ok + ng) / 2;
        if(n*(n-1)/2 - f(mid) < k) ok = mid;
        else ng = mid;
    }
    cout << ok << endl;

}


Measured memory_bytes: 1792
#include <stdio.h>

typedef struct { char suit, value; } Card;

void bubble(Card A[], int N) {
  int i,j;
  Card t;
  for(i = 0; i<N; i++) {
    for(j = N-1; j >= i; j--) {
      if(A[j].value < A[j-1].value) {
        t = A[j]; A[j] = A[j-1]; A[j-1] = t;
      }
    }
  }
}

void selection(Card A[], int N) {
  int i,j,minj;
  Card t;
  for(i=0;i<N;i++) {
    minj = i;
    for(j=i; j<N; j++) {
      if(A[j].value < A[minj].value) minj = j;
    }
    t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}

void print(Card A[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(i>0) printf(" ");
      printf("%c%d",A[i].suit,A[i].value);
  }
  printf("\n");
}

int isStable(Card C1[], Card C2[], int N) {
  int i;
  for(i=0; i<N; i++) {
    if(C1[i].suit != C2[i].suit) return 0;
  }
  return 1;
}

void str2Card(Card *t,char str[]) {
    t->suit  = str[0];
    t->value = str[1] - '0';
}

int main(void) {
  Card C1[100], C2[100];
  int N,i;
  char str[3];

  scanf("%d",&N);
  for(i=0;i<N; i++) {
    scanf("%s",str);
    str2Card(&C1[i],str);
  }

  for(i=0; i<N; i++) C2[i] = C1[i];

  bubble(C1,N);
  selection(C2,N);

  print(C1,N);
  printf("Stable\n");
  print(C2,N);
  if(isStable(C1,C2,N)) {
    printf("Stable\n");
  } else {
    printf("Not stable\n");
  }

  return 0;
}



Measured memory_bytes: 2104
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;cin >> n;
  vector<pair<int,int>> c(100001),d(100001);
  for(int i=1;i<100001;i++){
    c[i]={0,i};
    d[i]={0,i};
  }
  for(int i=0;i<n;i++){
    int a;cin >> a;
    if(i%2==0){
      c[a].first++;
    }
    else{
      d[a].first++;
    }
  }
  sort(c.begin(),c.end(),greater<pair<int,int>>());
  sort(d.begin(),d.end(),greater<pair<int,int>>());
  if(c[0].second==d[0].second){
    cout << n-max(c[0].first+d[1].first,c[1].first+d[0].first) << endl;
  }
  else{
    cout << n-c[0].first-d[0].first << endl;
  }
}


Measured memory_bytes: 1792
import java.util.*;

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

        if(A==B){
            System.out.println("Yes");
        }else{
            System.out.println("No");
        }
   }

}



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

int main() {
  char c;
  cin >> c;
  
  if ( c =='a' || c == 'i' || c == 'u' || c== 'e' 
      || c ==  'o' ){
  cout << "vowel" << endl;
  }
  else {
  cout << "consonant" << endl;
  }
}
  

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <cstring>
#include <cctype>
#include <complex>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
using namespace std;
const int dx[]={1,0,-1,0,1,-1,-1,1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
const int INF = 1<<30;
const int EPS = 1e-15;
#define PB push_back
#define fi first
#define se second
#define ll long long
#define reps(i,j,k) for(int i = (j); i < (k); i++)
#define rep(i,j) reps(i,0,j)
#define MOD 1000000007
typedef pair<int,int> Pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int > Pii;
int main(){
	while(true){
		string str;
		getline(cin,str);
		if(str.size() == 1 && str == ".")break;
		stack<char> state;
		bool flg = true;
		rep(i,str.size()){
			if(str[i] == '(' || str[i] == '['){
				state.push(str[i]);
			}
			else if(str[i] == ')'){
				if(state.size()==0 || state.top() != '('){
					flg =  false;
					break;
				}
				else{
					state.pop();
				}
			}
			else if(str[i] == ']'){
				if(state.size()==0 || state.top() != '['){
					flg =  false;
					break;
				}
				else{
					state.pop();
				}
			}
		}
		if(state.size() != 0)flg = false;
		flg ? puts("yes") : puts("no");
	}
	return 0;
}

Measured memory_bytes: 1176
#include <bits/stdc++.h>
using namespace std;
int h;
int w;
int main(){
	bool flag = false;
	cin>>h>>w;
	vector<vector<char>> arr(h, vector<char>(w));
	vector<vector<char>> test(h, vector<char>(w, 'b'));
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			cin>>arr.at(i).at(j);
		}
	}
	for(int i = 0; i < h; i++){
		for(int j = 0; j < w; j++){
			flag = false;
			if(arr.at(i).at(j) != '.'){
				flag = true;
				break;
			}
		}
		if(!flag){
			for(int k = 0; k < w; k++){
				test.at(i).at(k) = 'w';
			}
		}
	}
	for(int i = 0; i < w; i++){
		for(int j = 0; j < h; j++){
			flag = false;
			if(arr.at(j).at(i) != '.'){
				flag = true;
				break;
			}
		}
		if(!flag){
			for(int k = 0; k < h; k++){
				test.at(k).at(i) = 'w';
			}
		}
	}
	int count = 0;
	for(int i = 0; i < h; i++){
		count = 0;
		for(int j = 0; j < w; j++){
			flag = true;
			if(test.at(i).at(j) == 'w'){
				flag = false;
				continue;
			}
			count++;
			cout<<arr.at(i).at(j);
		}
		if(count > 0)cout<<endl;
	}
	if(!flag)cout<<endl;
}

Measured memory_bytes: 3608
n,m = map(int,input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]

for i in range(n-m+1):
    for j in range(n-m+1):
        t = 1
        for k in range(m):
            for l in range(m):
                if a[i+k][j+l] != b[k][l]:
                    t = 0
        if t == 1:
            print('Yes')
            exit(0)

print('No')

Measured memory_bytes: 9148
import Control.Monad
import qualified Data.ByteString.Char8 as BS
import Data.Char
import Data.List
import qualified Data.Set as S

toInts :: IO [Int]
toInts = unfoldr (BS.readInt . BS.dropWhile isSpace) <$> BS.getLine

able_dist :: S.Set Int
able_dist = S.fromList [i ^ 2 | i <- [0 .. 130]]

is_good :: Int -> Bool
is_good x = S.member x able_dist

dist_2 :: [Int] -> [Int] -> Int
dist_2 xs ys = sum [(x - y) ^ 2 | (x, y) <- zip xs ys]

solver :: [[Int]] -> Int
solver lss =
  let n = length lss
   in let m = length $ filter is_good [dist_2 a b | a <- lss, b <- lss]
       in div (m - n) 2

main :: IO ()
main = do
  n:d:[] <- toInts
  dat <- forM [1 .. n] (\_ -> toInts)
  print $ solver dat


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

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

    long long ac = a * c;
    long long ad = a * d;
    long long bc = b * c;
    long long bd = b * d;
    cout << max({ac, ad, bc, bd}) << endl;
    return 0;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

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


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
 
using namespace std;
 
#define PB push_back
#define MP make_pairA
#define REP(i,n) for(int i=0;i<(n);i++)
int main()
{
    int n;
    cin>>n;
    if(n%2==0)cout<<n<<endl;
    else cout<<n*2<<endl;
}


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

char a[100], b[100];

int main() {
    scanf("%s", a);
    scanf("%s", b);
    int len = strlen(a);
    for (int i = 0; i < len; i++) {
        if (a[i] != b[i]) {
            printf("No\n");
            return 0;
        }
    }
    printf("Yes\n");
    return 0;
}

Measured memory_bytes: 3128
#include<stdio.h>
int main()
{
    int a11,a12,a13,a21,a22,a23,a31,a32,a33,n;
    scanf("%d%d%d%d%d%d%d%d%d",&a11,&a12,&a13,&a21,&a22,&a23,&a31,&a32,&a33);
    scanf("%d",&n);
    int m,i;
    for(i=0;i<n;i++)
    {
        scanf("%d",&m);
        if(m==a11)
        {
            a11=0;
        }
        if(m==a12)
        {
            a12=0;
        }
        if(m==a13)
        {
            a13=0;
        }
        if(m==a21)
        {
            a21=0;
        }
        if(m==a22)
        {
            a22=0;
        }
        if(m==a23)
        {
            a23=0;
        }
        if(m==a31)
        {
            a31=0;
        }
        if(m==a32)
        {
            a32=0;
        }
        if(m==a33)
        {
            a33=0;
        }
    }
    if((a11==0 && a22==0 && a33==0) || (a13==0 && a22==0 && a31==0) || (a11==0 && a12 ==0 && a13==0) || (a21==0 && a22 ==0 && a23==0) || (a31==0 && a32 ==0 && a33==0) || (a11==0 && a21==0 && a31==0)|| (a12==0 && a22==0 && a32==0)|| (a13==0 && a23==0 && a33==0))
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 128
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        BigDecimal a = new BigDecimal(sc.next());
        BigDecimal b = new BigDecimal(sc.next());
        BigDecimal result = a.multiply(b);
        System.out.println(result.setScale(0, RoundingMode.FLOOR));
    }
}


Measured memory_bytes: 35956
n = int(input())
money = []
unit = []
for i in range(n):
    m, u = input().split()
    money.append(float(m))
    unit.append(u)

total = 0.0
for m, u in zip(money, unit):
    if u == 'JPY':
        total += m
    else:
        total += 380000.0*m
print(total)

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


    ll k,b,m,q;
    long long int c,d,t,i,j,a,f,n;
    vector<ll> v,s;
    map<char,ll> ma,sa;
    string st,et;
    cin>>st;
    f = 0;
    for(i=0; i<st.size(); i++)
    {
        if(ma[st[i]]==0)
        {
            ma[st[i]]++;
        }
        else
        {
            f = 1;
            break;
        }
    }
    if(f==0)
    {
        cout<<"yes"<<endl;
    }
    else {cout<<"no"<<endl;}

}


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

int main(){
  int n;
  cin >> n;
  vector<int> l(n);
  for(int i=0;i<n;i++){
    cin >> l.at(i);
  }
  sort(l.begin(),l.end());
  reverse(l.begin(),l.end());
  long long int ans=0;
  for(int j=0;j<n-2;j++){
    for(int k=j+1;k<n-1;k++){
      for(int m=k+1;m<n;m++){
        if(l.at(j)<l.at(k)+l.at(m)){
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

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

using namespace std;
int main() {
#ifndef ONLINE_JUDGE

	freopen("input1.txt", "r", stdin);
	freopen("output1.txt", "w", stdout);

#endif
	int k;
	string s;
	cin >> k;
	cin >> s;
	int len = s.length();
	if (len <= k)
		cout << s;
	else
	{
		s.resize(k);
		string b = "...";

		cout << s + b;
	}



}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
int main() {
    // ifstream in("data1.txt");
    // cin.rdbuf(in.rdbuf());
    int N;
    cin >> N;
    vector<int> v(N);
    int ans = 0;
    rep(i, N) cin >> v[i];
    sort(v.begin(), v.end());
    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            for(int k = j + 1; k < N; k++) {
                if(v[i] < v[j] + v[k] && v[j] < v[k] + v[i] &&
                   v[k] < v[i] + v[j]) {
                    ans++;
                } else {
                    break;
                }
            }
        }
    }
    // cout << ans << endl;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using vec = vector<ll>;
using vect = vector<double>;
using Graph = vector<vector<ll>>;
#define loop(i, n) for (ll i = 0; i < n; i++)
#define Loop(i, m, n) for (ll i = m; i < n; i++)
#define pool(i, n) for (ll i = n; i >= 0; i--)
#define Pool(i, m, n) for (ll i = n; i >= m; i--)
#define mod 1000000007ll
#define flagcount __builtin_popcount
#define flag(x) (1 << x)
#define flagadd(bit, x) bit |= flag(x)
#define flagpop(bit, x) bit &= ~flag(x)
#define flagon(bit, i) bit &flag(i)
#define flagoff(bit, i) !(bit & (1 << i))
#define all(v) v.begin(), v.end()
#define low2way(v, x) lower_bound(all(v), x)
#define high2way(v, x) upper_bound(all(v), x)
#define idx_lower(v, x) (distance(v.begin(), low2way(v, x)))  //配列vでx未満の要素数を返す
#define idx_upper(v, x) (distance(v.begin(), high2way(v, x))) //配列vでx以下の要素数を返す
#define idx_lower2(v, x) (v.size() - idx_lower(v, x))         //配列vでx以上の要素数を返す
#define idx_upper2(v, x) (v.size() - idx_upper(v, x))         //配列vでxより大きい要素の数を返す
#define putout(a) cout << a << endl
#define Gput(a, b) G[a].push_back(b)
#define Sum(v) accumulate(all(v), 0ll)
#define gcd(x, y) __gcd(x, y)
ll ctoi(char c)
{
    if (c >= '0' && c <= '9')
    {
        return c - '0';
    }
    return 0;
}
template <typename T>
T lcm(T x, T y)
{
    T z = gcd(x, y);
    return x * y / z;
}
template <typename T>
bool primejudge(T n)
{
    if (n < 2)
        return false;
    else if (n == 2)
        return true;
    else if (n % 2 == 0)
        return false;
    double sqrtn = sqrt(n);
    for (T i = 3; i < sqrtn + 1; i++)
    {
        if (n % i == 0)
        {
            return false;
        }
        i++;
    }
    return true;
}
//場合によって使い分ける
//const ll dx[4]={1,0,-1,0};
//const ll dy[4]={0,1,0,-1};
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
//2次元配列の宣言
//vector<vector<ll>> field(h, vector<ll>(w));

int main()
{
    cout << fixed << setprecision(30);
    string s, t;
    cin >> s >> t;
    ll n = s.size();
    bool check = true;
    loop(i, n) if (s[i] != t[i]) check = false;
    if (check)
        putout("Yes");
    else
        putout("No");
    return 0;
}


Measured memory_bytes: 3596
#include<iostream>
using namespace std;
int DP[100100];
int H[100100];
int main()
{
  int N;
  cin>>N;
  for(int i=1;i<=N;i++)
    cin>>H[i];
  DP[0]=99999999;
  for(int i=2;i<=N;i++)
    DP[i]=min(DP[i-1]+abs(H[i]-H[i-1]),DP[i-2]+abs(H[i]-H[i-2]));
  cout<<DP[N];
  return 0;
}

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

int main()
{
  int N,L;
  cin >> N >> L;
  vector<string> s(N);
  for(int i=0;i<N;i++){
    cin >> s[i];
  }
  sort(s.begin(),s.end());
  
  for(int i=0;i<N;i++){
    cout << s[i];
  }
  cout<<endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define M 1000000007
#define INF ((1LL<<62LL) - 1)

int gcd(int a, int b){
    return (b==0)?a : gcd(b, a%b);
}

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

    int n; cin >> n;
    int a[n];
    for(int i=0;i<n;i++) cin >> a[i];

    set<int> s;
    bool flag = true;

    for(int i=0;i<n;i++){
        int x = a[i];
        for(int j = 2;j*j<=x;j++){
            if(x%j == 0){
                if(s.find(j) != s.end()){
                    flag = false;
                    break;
                }
                s.insert(j);
                while (x%j==0){
                    x/=j;
                }
            }
        }
        if(x> 1){
            if(s.find(x) != s.end()){
                flag = false;
                break;
            }
            s.insert(x);
        }
        if(!flag) break;
    }

    if(flag){
        cout << "pairwise coprime\n";
        return 0;
    }

    int gg = 0LL;
    for(int i=0;i<n;i++){
        gg = gcd(gg, a[i]);
    }

    if(gg == 1LL) cout << "setwise coprime\n";
    else cout << "not coprime\n";


}


Measured memory_bytes: 11460
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
#define stop(x) {cout<<x<<endl;exit(0);}
#define all(x) x.begin(),x.end()
#define szz(s) int(s.size())
#define endl '\n'
int dx[] = { 0, 0, 1, -1, 1, -1, 1, -1 };
int dy[] = { 1, -1, 0, 0, -1, 1, 1, -1 };
typedef long long ll;
using namespace std;

void file() {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
    if (freopen("input.txt", "r", stdin));
    if (freopen("output.txt", "w", stdout));
#endif
}


int main() {
    //file();

    int ar[] = { 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 };
    int k;
    cin >> k;
    cout << ar[k - 1] << endl;

    
}			

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

int N;
char c[200005];

signed main(){
  
  cin >> N;
  
  for(int i=0;i<N;i++) cin >> c[i];
  
  int L = 0, R = N - 1;
  int ans = 0;
  
  while( L < R ){
    
    if( c[L] == 'W' && c[R] == 'R' ){
      L++;
      R--;
      ans++;
    }
    else if( c[L] == 'W' ) R--;
    else if( c[R] == 'R' ) L++;
    else L++, R--;    
    
  }

  cout << ans << endl;
  
  return 0;
}


Measured memory_bytes: 3728
#include <stdio.h>
#include <string.h>
#define LEN 100005

typedef struct pp
{
    char name[100];
    int t;
} P;

P Q[LEN + 1];
int head, tail, n;

void enqueue(P x)
{
    Q[tail] = x;
    tail = (tail + 1) % LEN;
}

P dequeue()
{
    P x = Q[head];
    head = (head + 1) % LEN;
    return x;
}
int min(int a, int b) { return a < b ? a : b; }

int main()
{
    int elaps = 0, c;
    int i, q;
    P u;
    scanf("%d %d", &n, &q);

    for (i = 1; i <= n; i++)
    {
        scanf("%s", Q[i].name);
        scanf("%d", &Q[i].t);
    }
    head = 1;
    tail = n + 1;

    while (head != tail)
    {
        u = dequeue();
        c = min(q, u.t);
        u.t -= c;
        elaps += c;
        if (u.t > 0)
            enqueue(u);
        else
            printf("%s %d\n", u.name, elaps);
    }

    return 0;
}


Measured memory_bytes: 11852
input = readlines()

n = input.shift.chomp.to_i
list = input.shift.chomp.split('').map{|x| x.to_s}

w_list = []
w_min = nil
r_list = []
r_max = nil

list.each_with_index do |l, i|
  w_list.push(i) if l == 'W'
  r_list.push(i) if l == 'R'
end

if w_list.length == 0 || r_list.length == 0
  puts 0
  exit
end

cnt = 0
(0..list.length - 1).each do |ci|
  w_target = w_list[ci]
  r_target = r_list[r_list.length - 1 - ci]
  if w_target.nil? || r_target.nil?
    puts cnt
    exit #####
  end
  if w_target > r_target
    puts cnt
    break
  end
  cnt += 1
end


Measured memory_bytes: 34180
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define int long long
#define w(t) int t;cin>>t;while(t--)
#define pb push_back
#define mk make_pair
#define ascSort(v) sort(v.begin(), v.end())
#define descSort(v) sort(v.begin(), v.end(), greater<int>())
#define ff first
#define ss second
#define pi pair<int,int>
#define vi vector<int>
//#define umapi umapi
const int mod=1e9+7;
const int m=998244353;
using namespace std;
using namespace __gnu_pbds;

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>PBDS;

void FIO(){
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
	#endif
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
}



int32_t main(){
	
	//FIO();
	
		int n;cin>>n;
		vi a(n);
		for(int i=0; i<n; i++)
			cin>>a[i];
		vi pref(n+1);
		pref[n]=0;
		for(int i=n-1; i>=0; i--)
			pref[i]=(pref[i+1]+a[i])%mod;
		

		int ans=0;
		for(int i=0; i<n; i++){
			ans+=(a[i]*pref[i+1])%mod;
			ans%=mod;
		}
		cout<<ans<<"\n";
		
	
	

	return 0;
		
}


	
			
	


Measured memory_bytes: 6432
#include<bits/stdc++.h>
using namespace std;
#define light ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define cases() ll t;cin>>t;while(t--)
#define all(c) c.begin(),c.end()
#define PI 3.14159265358979323846
const ll MAX = 1e2+5;
const ll INF = 1e18;
const ll MOD = 1e9+7;

int main()
{
    int n,i,j,k,l,p,q;
    cin >> n;
    l = 0;
    for(i=0;i<n;i++)
    {
        cin >> p >> q;
        if(p==q)
            l++;
        else
            l = 0;
        if(l==3)
        {
            cout << "Yes";
            return 0;
        }
    }
    cout << "No";
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>

int main(void) {
    int n, *r, i = 0, min = INT_MAX, result = INT_MIN;
    scanf("%d", &n);
    r = malloc(sizeof(int) * n);
    while (i < n) {
        scanf("%d", &r[i]);
        i++;
    }
    min = r[0];
    for (i = 1; i < n; i++) {
        if (r[i] - min > result) {
            result = r[i] - min;
        }
        if (r[i] < min)
            min = r[i];
    }

    printf("%d\n", result);
}



Measured memory_bytes: 2512
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <iostream>
#include <sstream>
#include <climits>
#include <cfloat>

typedef long long ll;

using namespace std;


int main()
{
	char* rank[] = { "AAA", "AA", "A", "B", "C", "D", "E", "NA" };
	double fif[] = { 35.5, 37.5, 40, 43, 50, 55, 70, 1e10 };
	double th[] = { 71, 77, 83, 89, 105, 116, 148, 1e10 };
	double a, b;
	while (scanf("%lf %lf", &a, &b) != EOF)
	{
		int i;
		for (i = 0; a >= fif[i] || b >= th[i]; ++i)
			;
		puts(rank[i]);
	}

	return 0;
}

Measured memory_bytes: 0
import java.util.Scanner;

public class Main {
  public static void main (String[] args) {
    Scanner in = new Scanner(System.in);

    while (in.hasNext()) {
      int N = in.nextInt();
      int L = in.nextInt();
      int[] appleTaste = new int[N];
      int totalTaste = 0;
      
      for (int i = 0; i < appleTaste.length; ++i) {
        appleTaste[i] = L + i; // L + (i + 1) - i
        totalTaste += appleTaste[i];
      }

      int closestTaste = -100000000;
      for (int i = 0; i < appleTaste.length; ++i) {
        int tasteWithoutCurrent = totalTaste - appleTaste[i];
         
        if (Math.abs(totalTaste - tasteWithoutCurrent) < Math.abs(totalTaste - closestTaste)) {
          closestTaste = tasteWithoutCurrent;
        }
      }

      System.out.println(closestTaste);
    }
  }
}

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

#define  fastIO  ios_base::sync_with_stdio(0); cin.tie(0);
#define  int long long int 
#define  endl '\n'

void solveTestCase()
{
	
	char ch;
	cin >> ch;

	if(ch >= 'A' and ch <= 'Z')
		cout << "A";
	else 
		cout << "a";

}

int32_t main()
{

	fastIO

	solveTestCase();

	return 0;

}

Measured memory_bytes: 3624
/**
  * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0002
  * Digit Number
  */
object Main {
  def main(args: Array[String]): Unit = {
    Iterator.continually(io.StdIn.readLine()).takeWhile(_ != null).map(_.split(" +").map(_.toInt))
      .map { case Array(a, b) => (a + b).toString.length }
      .foreach(println)
  }
}

Measured memory_bytes: 44156
//#pragma GCC optimize("Ofast")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=1e6+5,M=2e6+5,MOD=1e9+7,OO=1e9;


int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	//file();

	int sx,sy,tx,ty;

	cin>>sx>>sy>>tx>>ty;

	string ans = string(ty-sy,'U') + string(tx-sx,'R') + string(ty-sy,'D')+string(tx-sx,'L')+
		     string(1,'L')+string(ty-sy+1,'U')+string(tx-sx+1,'R') + string(1,'D')+
		     string(1,'R')+string(ty-sy+1,'D')+string(tx-sx+1,'L')+string(1,'U');

	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;

int main()
{
  ll H,W,D;
  cin >> H >> W >> D;
  vector<vector<ll>> A(H,vector<ll>(W));
  REP(i, H){
    REP(j, W){
      cin >> A.at(i).at(j);
      A.at(i).at(j)--;
    }
  }
  
  ll Q;
  cin >> Q;
  vector<P> B(Q);
  REP(i,Q){
    cin >> B[i].first >> B[i].second;
    B[i].first--;
    B[i].second--;
  }
  
  vector<P> number(H*W);
  REP(i,H){
    REP(j,W){
      number[A.at(i).at(j)]=make_pair(i,j);
    }
  }

  vector<ll> costlist(H*W);
  REP(i,D){
    ll cnt = 0;
    for(ll j=i;j+D<H*W;j+=D){
      ll y = number[j].first;
      ll x = number[j].second;
      ll ny = number[j+D].first;
      ll nx = number[j+D].second;
      cnt+=abs(x-nx)+abs(y-ny);
      costlist[j+D]=cnt;
    }
  }

  REP(i,Q){
    cout << costlist[B[i].second]-costlist[B[i].first] << endl;
  }
}

Measured memory_bytes: 6164
#include<bits/stdc++.h>
using namespace std;
typedef long long  ll ;
typedef double db;
const double pi = acos(-1) ;
#define pb         push_back
#define forab(i,a,b)       for(int i=(a);i<=(b);i++)
#define CIN	ios_base::sync_with_stdio(0); cin.tie(0)
#define pcase(z,x)     printf("Case %ld: %lld\n",z,x)
#define nw				"\n"


int main(void)
{
	CIN;
	ll tc,l,k,sum=0,x=0,y,z=0,m=1,n=0,ans=0;
	cin>>n;
	int arr[n];
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	sort(arr,arr+n);
	for(ll i=--n;i>=0;i-=2)
	{
		sum+=arr[i];
		
	}
	for(ll j=--n;j>=0;j-=2)
	{
		
		ans+=arr[j];
	}
	cout<<(int)abs(sum-ans)<<nw;

}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define mp				make_pair
#define pb				push_back
#define all(a)			(a).begin(), (a).end()
#define sz(a)			a.size()
#define md(a, b)		((a) % b + b) % b
#define mod(a)			md(a, MOD)
#define srt(a)			sort(all(a))
#define mem(a, h)		memset(a, (h), sizeof(a))
#define f 				first
#define s 				second
#define forn(i, n)			for(int i = 0; i < n; i++)
#define fore(i, b, e)	for(int i = b; i < e; i++)
#define forg(i, b, e, m)	for(int i = b; i < e; i+=m)
//int in(){int r=0,c;for(c=getchar();c<=32;c=getchar());if(c=='-') return -in();for(;c>32;r=(r<<1)+(r<<3)+c-'0',c=getchar());return r;}

using namespace std;
//using namespace __gnu_pbds;

typedef long long 		ll;
typedef long double ld;	
typedef unsigned long long 		ull;
typedef pair<int, int>  ii;
typedef vector<int>     vi;
typedef vector<ii>      vii;
typedef vector<ll>      vll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//find_by_order kth largest  order_of_key <
const int tam = 100010;
const int MOD = 1000000007;
const int MOD1 = 998244353;
const double EPS = 1e-9;
const double PI = acos(-1); 
int main()
{
	ios::sync_with_stdio(0); cin.tie(0);
	//freopen("asd.txt", "r", stdin);
	//freopen("qwe.txt", "w", stdout);
	int a, b, c;
	cin>>a>>b>>c;
	cout<<b / c - (a - 1) / c<<'\n';
	return 0;
}

// read the question correctly (is y a vowel? what are the exact constraints?)
// look out for SPECIAL CASES (n=1?) and overflow (ll vs int?) ARRAY OUT OF BOUNDSS2				

Measured memory_bytes: 3620
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

// Sort
type Val struct {
	id, num int
}
type ByNum []Val

func (a ByNum) Len() int           { return len(a) }
func (a ByNum) Less(i, j int) bool { return a[i].num < a[j].num }
func (a ByNum) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	N, K := sc.nextInt(), sc.nextInt()
	ans := 0
	if K%2 != 0 {
		count := 0
		for i := 1; i <= N; i++ {
			if i%K == 0 {
				count++
			}
		}
		ans = pow(count, 3)
	} else {
		count := 0
		count2 := 0
		for i := 1; i <= N; i++ {
			if i%K == 0 {
				count++
			} else if i%K == K/2 {
				count2++
			}
		}
		ans = pow(count, 3) + pow(count2, 3)
	}

	fmt.Fprintln(wtr, ans)
	wtr.Flush()
}


Measured memory_bytes: 640
import math

def GoodDist():
    N, D = map(int, input().split())
    X = []
    for _ in range(N):
        X.append(list(map(int, input().split())))
    cnt = 0
    for i in range(N - 1):
        for j in range(i + 1, N):
            dist = 0
            lst = [X[i][k] - X[j][k] for k in range(D)]
            for n in lst:
                dist += n ** 2
            if math.sqrt(dist) == int(math.sqrt(dist)):
                cnt += 1
    print(cnt)

GoodDist()


Measured memory_bytes: 3064
/*ॐ नमो भगवते वासुदेवाय नमः*/
#include<bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define allrev(x) (x).rbegin(), (x).rend()
#define pb push_back
#define pf push_front
#define fori(i, a, n) for(int i = a; i < n; ++i)
#define MAX(x) (*max_element(all(x)))
#define MIN(x) (*min_element(all(x)))
#define sortarr(a, n) sort(a, a + n)
#define sortvec(V) sort(all(V))

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

typedef unordered_map<int, int, custom_hash> u_map;
typedef unordered_set<int, int, custom_hash> u_set;
typedef vector<int> V;
typedef pair<int , int> pairi;
typedef set<int> seti;
typedef priority_queue<int> p_queue;
typedef deque<int> deqi;

const int MOD = 1e9+7;
const int INF = 1e9+8;
const double pi = 3.14159265359;

int binpow(int a, int b, int m) {
    a %= m;
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    int n, k;
    cin >> n >> k;
    int ans = (log10(n)/log10(k) + 1) ;
    cout << ans << endl;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    solve();
    cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n ";
}

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

int main() {
  int h, w;
  cin >> h >> w;
  vector<string> a(h);
  for (int i = 0; i < h; i++)
    cin >> a[i];

  queue<pair<int, int>> q;
  queue<int> q2;

  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) {
      if (a[i][j] == '#') {
        q.push(make_pair(i, j));
        q2.push(0);
      }
    }
  }

  int mx  = 0;
  int cnt = 0;

  while (!q.empty()) {
    pair<int, int> p = q.front();
    q.pop();
    cnt = q2.front();
    q2.pop();

    int x = p.first;
    int y = p.second;

    if (cnt != 0 && a[x][y] == '#') continue;
    mx      = max(mx, cnt);
    a[x][y] = '#';
    cnt++;

    if (x != 0 && a[x - 1][y] == '.') {
      q.push(make_pair(x - 1, y));
      q2.push(cnt);
    }
    if (x != h - 1 && a[x + 1][y] == '.') {
      q.push(make_pair(x + 1, y));
      q2.push(cnt);
    }
    if (y != 0 && a[x][y - 1] == '.') {
      q.push(make_pair(x, y - 1));
      q2.push(cnt);
    }
    if (y != w - 1 && a[x][y + 1] == '.') {
      q.push(make_pair(x, y + 1));
      q2.push(cnt);
    }
  }
  cout << mx << endl;
}


Measured memory_bytes: 13584
/*****************************************************

@author: blue_is_love
Compiled On: 25th May 2019

*****************************************************/

#include<bits/stdc++.h>
#define MAX 9223372036854775807
#define endl "\n"
#define ll long long
#define int long long
#define pb push_back
#define pf push_front
#define ppf pop_front
#define mp make_pair
#define ip pair<int, int>

#define loop(i,n) for(int i=0;i<n;i++)
#define fast ios::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL)
using namespace std;

const ll MOD = 1e9+7;
const ll SZ = 107;
const ll N = 2e3+7;

int pow(int x, int y)
{
    ll r = 1LL;
    while(y)
    {
        if(y&1)
            r = (r * x);
        y >>= 1;
        x = (x * x);
    }
    return r;
}

bool comp(pair<pair<string, int>, int> x, pair<pair<string, int>, int> y)
{
    if(x.first.first == y.first.first)
        return x.first.second > y.first.second;
    return x.first.first < y.first.first;
}

void solve()
{
	int n; cin>>n;
    vector<pair<pair<string, int>, int>> v;
    for(int i=0;i<n;i++)
    {
        string s; int p;
        cin>>s>>p;
        v.pb(mp(mp(s, p), i+1));
    }
    sort(v.begin(), v.end(), comp);
    for(auto i: v)
        cout<<i.second<<endl;
}


signed main()
{

    int t=1;
    // cin >>t;
    while(t--){
        solve();
    }
    return 0;
}

/*****************************


****************************/

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

int main()
{
  int a;
  for (int i = 0; i < 5; ++i)
  {
    cin>>a;
    if(a==0)
    {
      cout<<i+1<<endl;
      return 0;
    }
  }
}

Measured memory_bytes: 3628
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

int main() {
    ll n;
    cin >> n;
    
    vector<vector<P>> G(n);
    rep(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(make_pair(b, 1));
        G[b].pb(make_pair(a, 1));
    }
    
    vl dist1(n, -1);  // dist1[v] : 頂点vの頂点0からの距離
    queue<ll> Q1;
    dist1[0] = 0;
    Q1.push(0);
    while(!Q1.empty()) {
        ll v = Q1.front();
        Q1.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist1[u] != -1) {
                continue;
            }
            dist1[u] = dist1[v] + cost;
            Q1.push(u);
        }
    }

    vl dist2(n, -1);  // dist2[v] : 頂点vの頂点n-1からの距離
    queue<ll> Q2;
    dist2[n-1] = 0;
    Q2.push(n-1);
    while(!Q2.empty()) {
        ll v = Q2.front();
        Q2.pop();
        for(auto p : G[v]) {
            ll u = p.first;
            ll cost = p.second; 
            if(dist2[u] != -1) {
                continue;
            }
            dist2[u] = dist2[v] + cost;
            Q2.push(u);
        }
    }
    
    ll x = 0, y = 0;
    rep(v, n) {
        if(dist1[v] <= dist2[v]) {
            x++;
        }
        else {
            y++;
        }
    }

    if(x > y) {
        out("Fennec");
    }
    else {
        out("Snuke");
    }
    
    re0;
}

Measured memory_bytes: 9216