akhauriyash/Code-Regression huggingface dataset:
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <functional>
#include <utility>
#include <tuple>
#include <cctype>
#include <bitset>
#include <complex>
#include <cmath>
#include <array>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define eb emplace_back
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pint;
typedef pair<ll,ll> pll;
typedef tuple<int,int,int> tint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<ull> vull;
typedef vector<pint> vpint;
int dx[8]={0,0,-1,1,1,1,-1,-1};
int dy[8]={-1,1,0,0,1,-1,1,-1};
const int SIZE=200050;
//ここまでテンプレ
const int alpha=26;
int main(){
	int N,M,X,Y;
	cin>>N>>M>>X>>Y;
	vint A,B;
	for(int i=0;i<N;i++){
		int a;
		cin>>a;
		A.pb(a);
	}
	for(int i=0;i<M;i++){
		int b;
		cin>>b;
		B.pb(b);
	}
	for(int Z=-100;Z<=100;Z++){
		bool flag=0;
		if(Z<=X || Y<Z)
			flag=1;
		for(int i:A)
			if(Z<=i)
				flag=1;
		for(int i:B)
			if(i<Z)
				flag=1;
		if(flag)
			continue;
		cout<<"No War"<<endl;
		return 0;
	}
	cout<<"War"<<endl;
	return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
  #pragma GCC target("avx,avx2,fma")
  #include <bits/stdc++.h>
  using namespace std;
  //---------------------------------//
  void __print(int x) {cerr << x;}
  void __print(long x) {cerr << x;}
  void __print(long long x) {cerr << x;}
  void __print(unsigned x) {cerr << x;}
  void __print(unsigned long x) {cerr << x;}
  void __print(unsigned long long x) {cerr << x;}
  void __print(float x) {cerr << x;}
  void __print(double x) {cerr << x;}
  void __print(long double x) {cerr << x;}
  void __print(char x) {cerr << '\'' << x << '\'';}
  void __print(const char *x) {cerr << '\"' << x << '\"';}
  void __print(const string &x) {cerr << '\"' << x << '\"';}
  void __print(bool x) {cerr << (x ? "true" : "false");}

  template<typename T, typename V>
  void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
  template<typename T>
  void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
  void _print() {cerr << "]\n";}
  template <typename T, typename... V>
  void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
  #ifndef ONLINE_JUDGE
  #define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
  #else
  #define deb(x...)
  #endif
 //------------------------------//

  typedef long long int ll;
  typedef pair<int,int> pi;
  typedef pair<ll,ll> pll;
  typedef vector<int> vi;
  typedef vector<ll> vll;
  typedef vector<pi> vpi;
  typedef vector<pll> vpll;

  #define  ff           first
  #define  ss           second
  #define  pb           push_back
  #define  IOS          ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
  #define  all(x)       (x).begin(), (x).end()
  #define  ps(x,y)      fixed<<setprecision(y)<<x
  #define  rep(i,a,b)   for(ll i=a ; i<b ; ++i)

  const ll MOD = 1e9 + 7;
  const ll INF = 1e18;
  const ll maxn = 1e6 + 4;


  void solve(){
     int n;
     cin >> n;
     ll res1 = 1;
     ll res2 = 1;
     ll res3=1;
     for(int i=1;i<=n;i++){
       res1 = (res1*8LL)%MOD;
       res2 = (res2*10LL)%MOD;
       res3 = (res3*9LL)%MOD;
     }
     cout << ((res2 -res3- res3 + res1)%MOD+MOD)%MOD;
  }

  int main(){
    IOS
    	solve();
    //cerr <<endl <<"[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
  }

// integer overflow

Measured memory_bytes: 3640
#include <stdio.h>
#include <math.h>
using namespace std;

struct Point{ double x,y; };

void koch(int n, Point a, Point b){
  if(n==0) return;

  Point s,t,u;
  double th = M_PI * 60.0/180.0;

  s.x = (2.0*a.x + 1.0*b.x)/3.0;
  s.y = (2.0*a.y + 1.0*b.y)/3.0;
  t.x = (1.0*a.x + 2.0*b.x)/3.0;
  t.y = (1.0*a.y + 2.0*b.y)/3.0;
  u.x = (t.x - s.x)*cos(th) - (t.y - s.y)*sin(th) + s.x;
  u.y = (t.x - s.x)*sin(th) + (t.y - s.y)*cos(th) + s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n", s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n", u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n", t.x,t.y);
  koch(n-1,t,b);
}

int main() {
  Point a,b;
  int n;

  scanf("%d",&n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  
  return 0;
}

Measured memory_bytes: 1068
/* --- author: dxm --- */
#include<bits/stdc++.h>
using namespace std;

#define INF 1e9
#define Inf 1e18
#define rep(i,n) for(int (i)=0;(i)<n;i++)
#define REP(i,n) for(int (i)=1;(i)<=n;i++)
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
typedef long long ll;
inline void Fail(){printf("0");exit(0);}
inline void debug(int x){cerr<<"debug: "<<x<<"\n";}
inline void debug(int n,int x[]){cerr<<"debug "<<"\n";rep(i,n)cerr<<x[i]<<" ";cerr<<"\n";}
inline void debug(string x){cerr<<"debug: "<<x<<"\n";}

const int maxn=45;
const int mod=1e9+7;
inline void Add(int &a,int b){a+=b;if(a>=mod)a-=mod;}
inline void Minus(int &a,int b){a-=b;if(a<0)a+=mod;}
int n,x,y,z,l,r;
vector<string>a,b,c,all;
int ans=1;

class node{
public:
	bool acc;
	int dp[maxn];
	node *nxt[11],*fail;
	node(){
		REP(i,10)nxt[i]=NULL;
		rep(i,n+1)dp[i]=0;
		acc=false;
	}
}*root;
node* q[1000010]; 

void dfs(string cur,vector<string>&S,int lft){
	if(!lft){
		S.pb(cur);
		return;
	}
	REP(i,10){
		if(i>lft)continue;
		dfs(cur+(char)(i+'0'),S,lft-i);
	}
}

void Insert(node *&cur,string s,int pos){
	if(!cur)cur=new node;
	if(pos==s.size()){
		cur->acc=true;
		return;
	}
	Insert(cur->nxt[s[pos]-'0'],s,pos+1);
}

void Build(){
	root->fail=NULL;
	q[r++]=root;
	while(l<r){
		node *cur=q[l++];
		REP(i,10){
			if(cur->nxt[i]==NULL)continue;
			node *f=cur->fail;
			while(f&&f->nxt[i]==NULL)f=f->fail;
			if(!f)cur->nxt[i]->fail=root;
			else cur->nxt[i]->fail=f->nxt[i];
			q[r++]=cur->nxt[i];
		}
	}
}

void process(){
	Build();
	root->dp[0]=1;
	rep(j,n){
		rep(i,r){
			node *cur=q[i];
			int tmp=cur->dp[j];
			if(!tmp)continue; 
//			cout<<tmp<<endl;
			REP(k,10){
				node *f=cur;
				bool ok=true;
				while(f){
					if(f->nxt[k]&&f->nxt[k]->acc)ok=false;
					f=f->fail;
				}
				if(!ok)continue;
				f=cur;
				while(f){
					if(f->nxt[k]){
						Add(f->nxt[k]->dp[j+1],tmp);
						break;
					}
					f=f->fail;
				}
				if(!f)Add(root->dp[j+1],tmp);
			}
		}
	}
	rep(i,r){
		Minus(ans,q[i]->dp[n]);
//		if(q[i]->dp[n])cout<<q[i]->dp[n]<<endl;
	}
}

int main(){
	scanf("%d%d%d%d",&n,&x,&y,&z);
	rep(i,n)ans=10LL*ans%mod;
	dfs("",a,x);
	dfs("",b,y);
	dfs("",c,z);
	rep(i,a.size())rep(j,b.size())rep(k,c.size()){
		string cur=a[i]+b[j]+c[k];
//		cout<<cur<<endl;
		all.pb(cur);
		Insert(root,cur,0);
	}
	process();
	printf("%d",ans);
	return 0;
}

/*
Input:
-----------------
Output:
*/

Measured memory_bytes: 11136
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;


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

	auto result = 0ll;
	for (auto i = 0; i < N - 1; ++i)
	{
		for (auto j = i + 1; j < N; ++j)
		{
			auto a = L[i];
			auto b = L[j];

			if (a + b <= L[0])
			{
				continue;
			}
			auto it1 = lower_bound(L.begin(), L.end(), a + b);
			auto index1 = it1 - L.begin();

			if (b - a >= L[N - 1])
			{
				continue;
			}
			auto it2 = upper_bound(L.begin(), L.end(), b - a);
			auto index2 = it2 - L.begin();

			if (index2 < index1)
			{
				result += index1 - index2;
				if (i >= index2 && i < index1)
				{
					--result;
				}
				if (j >= index2 && j < index1)
				{
					--result;
				}
			}
		}
	}

	cout << result / 3 << endl;

	return 0;
}

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

using namespace std;

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

    string s;
    cin >> s;
    if (s[0] != s[1] && s[1] != s[2] && s[2] != s[3])
        cout << "Good\n";
    else
        cout << "Bad\n";

    return 0;
}


Measured memory_bytes: 256
n = list(input())
hon = {
    2:'hon',
    4:'hon',
    5:'hon',
    7:'hon',
    9:'hon',
    0:'pon',
    1:'pon',
    6:'pon',
    8:'pon',
    3:'bon',
}

kazu = int(n[-1])

print(hon[kazu])

Measured memory_bytes: 9136
// 2020/09/01 Tazoe

#include <iostream>
using namespace std;

int main()
{
	int D, T, S;
	cin >> D >> T >> S;

	if(D<=T*S){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 3628
n, m = map(int, input().split())
B = [list(map(int, input().split())) for i in range(n)]
A = [int(input()) for i in range(m)]

for i in range(n) :
    ans = 0
    for j in range(m) :
        ans += A[j] * B[i][j]
    print(ans)


Measured memory_bytes: 6016
S = (input())
L1 = int((S[0:2]))
L2 = int(S[2:4])

if L1 == 0:
    if L2 > 12:
        ans = 'NA'
    elif L2 == 0:
        ans ='NA'
    else:
        ans ='YYMM'
elif L1 > 12:
    if L2 > 12:
        ans = 'NA'
    elif L2 == 0:
        ans ='NA'
    else :
        ans ='YYMM'
else:
    if L2 > 12 or L2 == 0:
        ans = 'MMYY'
    else:
        ans = 'AMBIGUOUS'
        
print(ans)



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

typedef long long ll;

int main(){
    ll A,B;
    cin>>A>>B;
    int guki=0;//guki==1なら奇数
    ll amari=0;
    //int zerotwo=0;
    if(A%2==1){
        guki=1;
    }
    if(guki==1){
        amari=B-A;
        ll memory=0;
        memory=amari%4;
        for(ll i=0;i<memory;i++){
            A=A^(B-i);
        }
        cout<<A<<endl;
    }
    if(guki==0){
        amari=B-A+1;
        ll C=0;
        ll memory=0;
        memory=amari%4;
        for(ll i=0;i<memory;i++){
            C=C^(B-i);
        }
        cout<<C<<endl;
    }
    /*if(amari%4==2){
        zerotwo=2;
    }
    else{
        zerotwo=0;
    }
    if(guki==1){
        if(zerotwo==0){
            cout<<A<<endl;
        }
        else{
            ll C=0;
            C=A^B;
            C=C^(B-1);
            cout<<C<<endl;
        }
    }
    else{
        if(zerotwo==0){
            cout<<0<<endl;
        }
        if(zerotwo==2){
            ll C=0;
            C=(B-1)^B;
            cout<<C<<endl;
        }
    }
    cout<<guki<<zerotwo<<endl;
    */
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define endl '\n'
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
//const int mod=1e9+7;
const int mod=998244353;
const double eps = 1e-10;
const double pi=acos(-1.0);
const int maxn=1e6+10;
const ll inf=0x3f3f3f3f;
const int dir[4][2]={{0,1},{1,0},{0,-1},{-1,0}};


int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);cout.tie(0);
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    queue<ll> q;
    int n;
    cin>>n;
    int num=0;
    ll ans;
    map<ll,int> m;
	for(int i=1;i<=9;i++) q.push(i);
	while(!q.empty()){
		ll p=q.front();
		q.pop();
        num++;
		if(num==n){ans=p;break;}
		int f=p%10;
		if(f==0){
			if(!m[p*10])q.push(p*10),m[p*10]=1;
			if(!m[p*10+1])q.push(p*10+1),m[p*10+1]=1;
		}
		else if(f==9){
            if(!m[p*10+8])q.push(p*10+8),m[p*10+8]=1;
            if(!m[p*10+9])q.push(p*10+9),m[p*10+9]=1;
		}
		else{
			if(!m[p*10+f-1])q.push(p*10+f-1),m[p*10+f-1]=1;
			if(!m[p*10+f])q.push(p*10+f),m[p*10+f]=1;
			if(!m[p*10+f+1])q.push(p*10+f+1),m[p*10+f+1]=1;
		}
	}
	cout<<ans;
    return 0;
}


Measured memory_bytes: 19968
import java.io.*;
import java.util.Scanner;


public class Main {

	private static Scanner sc;
	private static Printer pr;

	private static void solve() {
		int n = sc.nextInt();

		int[] p = new int[n];
		for (int i = 0; i < n; i++) {
			p[i] = sc.nextInt();
		}

		int ans = 0;
		for (int i = 1; i < n - 1; i++) {
			if (p[i - 1] > p[i] && p[i] > p[i + 1]) {
				ans++;
			} else if (p[i - 1] < p[i] && p[i] < p[i + 1]) {
				ans++;
			}
		}
		
		pr.println(ans);
	}

	// ---------------------------------------------------
	public static void main(String[] args) {
		sc = new Scanner(System.in);
		pr = new Printer(System.out);
			
		solve();
			
		pr.close();
		sc.close();
	}

	static class Printer extends PrintWriter {
		Printer(OutputStream out) {
			super(out);
		}
	}
}


Measured memory_bytes: 23124
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector> 
#include<limits>
#include<numeric>
#include<type_traits>
#include<math.h>
#include<fstream>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
#define out(str) cout << str << endl
#define ALL(a) (a).begin(),(a).end()
#define INF (1<<29)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int N;
string S;

int main(){
    cin>>N>>S;
    if(S.length()%2==1){
        out("No");
    }
    else{
        int N = S.length()/2;
        rep(i,N){
            if(S[i]!=S[i+N]){
                out("No");
                return 0;
            }
        }
        out("Yes");
    }
    
    
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main{
    public static void main(String[] Args) throws IOException{
        final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        final int n = Integer.parseInt(br.readLine());
        final int f[] = new int[45];
        f[0] = f[1] = 1;
        for(int i = 2; i<=n; i++)
            f[i] = f[i-1]+f[i-2];
        System.out.println(f[n]);
    }
}

Measured memory_bytes: 24292
import java.text.DecimalFormat;
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = Integer.parseInt(sc.next());
        int b = Integer.parseInt(sc.next());
        DecimalFormat df = new DecimalFormat(".00000000");
        int d = a / b;
        int r = a % b;
        double ad = a;
        double bd = b;
        double f = ad / bd;
        System.out.print(d + " ");
        System.out.print(r + " ");
        System.out.println(df.format(f));
    }
}


Measured memory_bytes: 26328
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)

	s1 := strings.Replace(s, "eraser", "", -1)
	s2 := strings.Replace(s1, "erase", "", -1)
	s3 := strings.Replace(s2, "dreamer", "", -1)
	s4 := strings.Replace(s3, "dream", "", -1)

	// fmt.Println(s4)

	if s4 == "" {
		fmt.Println("YES")
		return
	}
	fmt.Println("NO")
}


Measured memory_bytes: 1664
import java.util.*;
import java.io.*;
public class Main{
    public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter ou = new PrintWriter(System.out);
		String s = sc.next();
		sc.close();
		int a = 0;
		for(int i = 0 ; i < s.length() ; i++){
			if(s.charAt(i) == '0')a++;
		}
		ou.print(2 * Math.min(a , s.length() - a) + "\n");
		ou.flush();
    }
}

Measured memory_bytes: 42120
#include<iostream>
using namespace std;
struct s {
	int inn;
	bool o;
};
int main(){
	s ar[100];
	int t, n, s, f, a, x;
	for (int i = 0;; i++){
		a = 0;
		cin >> t;
		if (t == 0){
			x = i;
			break;
		}
		cin >> n;
		for (int i = 0; i < n; i++){
			cin >> s >> f;
			a += (f - s);
		}
		if (a < t){
			ar[i].inn = t - a;
			ar[i].o = true;
		}
		else { 
			ar[i].o = false;
		}
	}
	for (int i = 0; i < x; i++){
		if (ar[i].o == false){
			cout << "OK";
		}
		else cout << ar[i].inn;
		cout << endl;
	}
	char c;
	cin >> c;
}

Measured memory_bytes: 3108
def resolve():
    INF = 10 ** 18
    N, M, L = map(int, input().split())
    G = [[INF] * N for _ in range(N)]
    for _ in range(M):
        a, b, c = map(int, input().split())
        a -= 1
        b -= 1
        G[a][b] = G[b][a] = c

    for k in range(N):
        for i in range(N):
            for j in range(N):
                G[i][j] = min(G[i][j], G[i][k] + G[k][j])

    Cost = [[INF] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if G[i][j] <= L:
                Cost[i][j] = 1

    for k in range(N):
        for i in range(N):
            for j in range(N):
                Cost[i][j] = min(Cost[i][j], Cost[i][k] + Cost[k][j])

    Q = int(input())
    for _ in range(Q):
        a, b = map(lambda x: int(x) - 1, input().split())
        if Cost[a][b] == INF:
            print(-1)
        else:
            print(Cost[a][b] - 1)


if __name__ == "__main__":
    resolve()


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

using namespace std;

class KuraInfo{
public:
	int num;
	int dist;
	int weight;
};

typedef pair<double,vector<int> > P;
P dp[(1<<15)][15];
int dp2[(1<<15)];

int n;
KuraInfo kuras[15];
const int INF=100000000;


P dfs(const int s,const int d,const double sumWeight,const int depth){
	if(s==0)
		return P(0,vector<int>());
	double minCost=INF;
	vector<int> rv;
	if(d==-1){
		for(int i = 0; i < n; i++){
			if(((s>>i)&1)){
				P ret = dfs((s&~(1<<i)),i,sumWeight+kuras[i].weight,depth+1);
				if(minCost>ret.first){
//					dp2[s]=i;
					ret.second.push_back(i);
					rv=ret.second;
					minCost=min(minCost,ret.first);
				}
			}
		}
	}
	else{
		if(dp[s][d].first!=INF)
			return dp[s][d];
		for(int i = 0; i < n; i++){
			if(((s>>i)&1)){
				P ret = dfs((s&~(1<<i)),i,sumWeight+kuras[i].weight,depth+1);
				ret.first+= ((double)abs(kuras[i].dist-kuras[d].dist))
					/(((double)2000)/(70+sumWeight));
				if(minCost>ret.first){
//					dp2[s]=i;
					ret.second.push_back(i);
					rv=ret.second;
					minCost=min(minCost,ret.first);
				}
			}
		}

	}
	dp[s][d]=P(minCost,rv);
	return dp[s][d];
}

int main(){

//	while(cin>>n){
	cin>>n;
	for(int i = 0; i < n; i++){
		cin>>kuras[i].num>>kuras[i].dist>>kuras[i].weight;
		kuras[i].weight*=20;
	}
	for(int i = 0; i < (1<<15); i++){
		fill(dp[i],dp[i]+15,P(INF,vector<int>()));
	}
	fill(dp2,dp2+(1<<15),INF);
	
	vector<int> v=dfs((1<<n)-1,-1,0,0).second;
	reverse(v.begin(),v.end());
	for(int i = 0; i < v.size(); i++){
		cout<<kuras[v[i]].num;
		if(i==v.size()-1)
			cout<<endl;
		else
			cout<<" ";
	}
		
		//int s = (1<<n)-1;
		//while(1){
		//	cout<<kuras[dp2[s]].num;
		//	s=(s&~(1<<dp2[s]));
		//	if(s==0){
		//		cout<<endl;
		//		break;
		//	}
		//	else
		//		cout<<" ";
		//}
//	}

	return 0;
}

Measured memory_bytes: 0
//Garden.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();

        System.out.println((a-1)*(b-1));
        sc.close();
    }
}

Measured memory_bytes: 25684
def resolve():
    N = int(input())
    ans = 0
    for i in range(N):
        x, u = input().split()
        x = float(x)
        if u == "JPY":
            ans += x
        else:
            ans += x*380000
    print(ans)

if '__main__' == __name__:
    resolve()

Measured memory_bytes: 61956
#pragma comment(linker, "/stack:200000000")
        #pragma GCC optimize ("Ofast")
        #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
        #include <iostream>
        #include <iomanip>
        #include <sstream>
        #include <cstring>
        #include <vector>
        #include <deque>
        #include <queue>
        #include <set>
        #include <map>
        #include <valarray>
        #include <iterator>
        #include <functional>
        #include <limits>
        #include <algorithm>
        #include <numeric>
        #include <cmath>
        #include <cassert>
        #include <unordered_map>
        #include <unordered_set>
        #include <stack>
        using namespace std;
        #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
         #define trace(x) cerr << #x << ": " << x << " " << endl;
     
        typedef int64_t ll;
     
        #define endl '\n'
        #define int ll
        ll mod=998244353;
        ll mod1=1e9+5;
        ll power(ll a,ll b)
        {
            if(b==0) return 1;
            else if(b%2==0)
                return power((((a%mod)*(a%mod))%mod),b/2)%mod;
            else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
        }
        vector<pair<int,int>> v[100001];
     int32_t main()
        {
            IOS
        
        
        int n;
        cin>>n;
        set<pair<int,int>>s;
        for(int i=1;i<n;++i)
        {
            int a=i,b=n-i;
            if(a==b)
                continue;
            if(a>b)
                swap(a,b);
            s.insert({a,b});
        }
        cout<<(int)s.size();



        }

Measured memory_bytes: 33920
#include<bits/stdc++.h>
using namespace std;
#define int long long
int n,k,a[505],M[1000005],sum;
bool cmp(int a,int b){
	return M[a]<M[b];
}
bool chk(int x){			
	for(int i=1;i<=n;++i)M[a[i]]=a[i]%x;
	sort(a+1,a+1+n,cmp);
	int pre=0,suf=0;
	for(int i=1;i<=n;++i)suf+=(x-M[a[i]]);
	for(int i=1;i<=n;++i){
		pre+=M[a[i]];suf-=(x-M[a[i]]);
		if(pre==suf) {return pre<=k;}
	}
	return 0;
}
signed main(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<=n;++i){
		scanf("%lld",&a[i]);
		sum+=a[i];
	}
	int ans=0;
	for(int i=1;i*i<=sum;++i){
		if(sum%i==0){
			int a=sum/i;
			if(chk(a)){printf("%lld\n",a);return 0;}
			if(chk(i))ans=i;
		}
	}
	printf("%lld\n",ans);
	return 0;
} 


Measured memory_bytes: 5120
/*why so serious?*/
#include<bits/stdc++.h>
using namespace std;
#define   int      long long
#define   fast()   ios_base::sync_with_stdio(0);cin.tie(0)
#define   all(x)   x.begin(),x.end()
#define   pb       push_back
#define   F        first
#define   S        second

int32_t main()
{int n,h,w,m;
 cin>>n>>m>>h>>w;
 cout<<(n-h)*(m-w);
 return 0;
}






Measured memory_bytes: 256
X = int(input())

rtn = 0 
if X == 1:
    print(X)
else:
    for i in range(2,X//2):
        j = 2 
        while(True):
            tmp = i ** j
            if(tmp > X): 
                break 
            elif(tmp > rtn):
                rtn = tmp 
            j+=1
    print(rtn)

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

typedef long long ll;
ll N;
vector<ll> A;
ll XorAll;
ll Bonus;

int main() {
  cin >> N;
  for (ll i = 0; i < N; ++i) {
    ll a;
    cin >> a;
    A.push_back(a);
    XorAll ^= a;
  }
  for (ll i = 0; i < N; ++i) {
    A[i] &= ~XorAll;
  }
  A.push_back(0);
  ++N;
  ll cnt = 0;
  ll bit = 1ll << 60;
  while (true) {
    sort(A.begin() + cnt, A.end(), greater<ll>());
    if (A[cnt] == 0) break;
    while ((bit & A[cnt]) == 0) bit /= 2;
    for (ll i = cnt + 1; i < N; ++i) {
      if (bit & A[i]) A[i] ^= A[cnt];
    }
    ++cnt;
  }
  ll Bonus = 0;
  for (ll i = 0; i < cnt; ++i) {
    if ((Bonus ^ A[i]) > Bonus) Bonus ^= A[i];
  }
  cout << Bonus * 2 + XorAll << endl;
}


Measured memory_bytes: 1400
s=input()
n=len(s)
if n%2==1:
    print("No")
    exit()
for i in range(n-1):
    if s[i]=="h":
        if s[i+1]!="i":
            print("No")
            exit()
    elif s[i]=="i":
        if s[i+1]!="h":
            print("No")
            exit()
    else:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 61756
#include <vector>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;

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

    int a, b, c;
    cin >> a >> b >> c;
    int cnt = min(c, a - b);
    c -= cnt;
    cout << c << "\n";

    return 0;
}

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

int n, a[3], l[8];
vector<int> ss[3];
int ans = 1e9;

void subset(int m) {
    if(m == -1) {
        if(ss[2].empty() || ss[1].empty() || ss[0].empty()) return;
        int can = 0;
        for(int i = 0; i < 3; ++i) {
            int sum = 0;
            for(auto x : ss[i]) sum += x;

            can += (ss[i].size() - 1) * 10 + abs(sum - a[i]);
        }
        ans = min(ans, can);
    } else {
        subset(m - 1);
        for(int i = 0; i < 3; ++i) {
            ss[i].push_back(l[m]);
            subset(m - 1);
            ss[i].pop_back();
        }
    }
}


int main() {
    ios::sync_with_stdio(0); cin.tie(0);
    cin >> n;
    for(int i = 0; i < 3; ++i) cin >> a[i];
    for(int i = 0; i < n; ++i) cin >> l[i];

    subset(n - 1);
    cout << ans << endl;
}

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

// int/long:		-2,147,483,648 - 2,147,483,648 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

#define	INF (1<<29)
//536,870,912

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

#define	MOD 1000000007

int	main() {
	string S;
	cin >>S;
	int i;
	if (S=="SUN")
		i=7;
	else if (S=="MON")
		i=6;
	else if (S=="TUE")
		i=5;
	else if (S=="WED")
		i=4;
	else if (S=="THU")
		i=3;
	else if (S=="FRI")
		i=2;
	else
		i=1;
	cout <<i <<endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.Arrays;
import java.util.Scanner;



public class Main{

	public static void main(String[] args){

		@SuppressWarnings("resource")
		Scanner sc = new Scanner(System.in);
		int i = Integer.parseInt(sc.nextLine());
		int[] values = new int[3];

		for(int j=0;j<i;j++)
		{
			String[] s = sc.nextLine().split("[\\s]+");
			values[0] = Integer.parseInt(s[0]);
			values[1] = Integer.parseInt(s[1]);
			values[2] = Integer.parseInt(s[2]);
			Arrays.sort(values);
			if(values[0]*values[0] + values[1]*values[1] == values[2]*values[2]){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
}

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

typedef long long ll;

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

    vector<vector<int> > MAP(n, vector<int>(n, 0));
    rep(i, m)
    {
        int L, R;
        cin >> L >> R;
        L--; R--;
        MAP[L][R]++;
    }

    //累積和
    vector<vector<int> > S(n+1, vector<int>(n+1, 0));
    rep(i, n)rep(j, n)
    {
        S[i+1][j+1] = S[i+1][j] + S[i][j+1] - S[i][j] + MAP[i][j];
    }
    vector<int> a(q), b(q);
    rep(i, q)
    {
        cin >> a[i] >> b[i];
    }
    rep(i, q){
        int ans = S[b[i]][b[i]] - S[b[i]][a[i]-1] - S[a[i]-1][b[i]] + S[a[i]-1][a[i]-1];
        cout << ans << endl;
    }
    return 0;
}



Measured memory_bytes: 3712
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

int main() {
  ll n;
  cin >> n;
  string s;
  cin >> s;
  ll ans = 0;
  REP(i, n - 1) {
    vector<bool> seen(26, false), seen2(26, false);
    REP(j, i + 1) { seen[s[j] - 'a'] = true; }
    FOR(j, i + 1, n) { seen2[s[j] - 'a'] = true; }
    ll t = 0;
    REP(j, 26) {
      if (seen[j] && seen2[j]) {
        t++;
      }
    }
    ans = max(ans, t);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Split(bufio.ScanWords)
	n := readInt()
	k := readInt()
	s := read()
	r := ""
	for i := 0; i < n; i++ {
		if i == k-1 {
			r += strings.ToLower(s[i:i+1])
		} else {
			r += s[i:i+1]
		}
	}
	fmt.Println(r)
}

func read() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	i, e := strconv.Atoi(read())
	if e != nil {
		panic(e)
	}
	return i
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
#include<cstdlib>
#include<cmath>
using namespace std;
int main(){
  int A; int B; cin>>A>>B;
  if(B<10)
  B+=A*10;
  else if(B!=100)
  B+=A*100;
  else B+=A*1000;
  int S=0;
  for(int i=0; i<B; i++){
    if(B%(i+1)==0)
      S++;
    else continue;
  }
  if(S%2==1)
  cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  }


Measured memory_bytes: 3568
o = list(str(input()))
e = list(str(input()))
i = 1
while len(o)>0 or len(e)>0:
  if i%2==1:
    print(o[0],end="")
    o = o[1:]
  else:
    print(e[0],end="")
    e = e[1:]
  i+=1
print()



Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define INF 2000000000
using namespace std;
typedef long long ll;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while(c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while(c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
int n, k, p[200005];
double sum[200005];
void init(){
    n = read(), k = read();
    for (int i = 1; i <= n; ++i)    
        p[i] = read();
    sum[0] = 0;
    for (int i = 1; i <= n; ++i){
        double tt = 0.5 * (p[i] + 1);
        sum[i] = sum[i - 1] + tt;
    }
}
void solve(){
    double ans = 0;
    for (int i = k; i <= n; ++i)
        ans = max(ans, sum[i] - sum[i - k]);
    printf("%.7lf\n", ans);
}
int main(){
    init();
    solve();
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);
#define FO cout.tie(NULL);
#define FI cin.tie(NULL);
#define IN cin>>
#define OUT cout<<
#define loop(i,a,n) for(int i=a; i<n; i++)
#define rloop(i,a,n) for(int i=a; i>=n; i--)
#define endl "\n";
#define pb push_back
#define mp make_pair
#define set_bits(a) __builtin_popcountll(a)
#define ll long long int
#define ld long double
#define vll vector<long long int>
#define pll pair<long long int, long long int>
#define mod 1000000000
#define M 998244353
ll gcd(ll a, ll b)
{
    return (b?gcd(b,a%b):a);
}
ll P(ll B, ll power, ll modulo)
{
    ll ans=1LL;
    while(power>0LL)
    {
        if(power%2LL==1LL)
        {
            ans=(ans*B)%modulo;
        }
        B=(B*B)%modulo;
        power/=2LL;
    }
    return ans;
}
bool isPrime(ll n)
{
    if(n<=1LL)
    {
        return false;
    }
    if(n<=3LL)
    {
        return true;
    }
    if(n%2==0LL || n%3==0LL)
    {
        return false;
    }
    for(ll i=5LL; (i*i)<=n; i+=6LL)
    {
        if(n%i==0LL || n%(i+2LL)==0LL)
        {
            return false;
        }
    }
    return true;
}
using namespace std;
bool sortbysec(const pair<pair<int,int>,int> &a, const pair<pair<int,int>,int> &b)
{
    return (a.first.second<b.first.second);
}
bool sortbysecll(const pll &a, const pll &b)
{
    return (a.second<b.second);
}
ll modinv(ll x, ll y, ll modulo)
{
    return ((x%modulo)*(P(y,modulo-2LL,modulo)%modulo))%modulo;
}
void vok()
{
    FAST
    FO
    FI
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt","r",stdin);
    //     freopen("output.txt","w",stdout);
    // #endif
}
int main()
{
    vok();
    int n,m;
    IN n>>m;
    vector<int> a(m);
    int sum=0;
    loop(i,0,m)
    {
        IN a[i];
        sum+=a[i];
    }
    if(sum>n)
    {
        OUT -1<<endl
    }
    else
    {
        OUT n-sum<<endl
    }
    return 0;
}

Measured memory_bytes: 3656
#include <stdio.h>          // printf(), scanf()

int
main(int argc, char** argv)
{
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);

	int x, y, z;
	if (a < b)
	{
		if (b < c)    /* (a < b && b < c) ? */
			x = a, y = b, z = c;

		else /* (c <= b) */
		{
			if (a < c) /* (a < c && c <= b) ? */
				x = a, y = c, z = b;

			else       /* (c <= a && a < b) ? */
				x = c, y = a, z = b;
		}
	}
	else /* (b <= a) */
	{
		if (a < c)    /* (b <= a && a < c) ? */
			x = b, y = a, z = c;

		else /* (c <= a) */
		{
			if (b < c) /* (b < c && c <= a) ? */
				x = b, y = c, z = a;

			else       /* (c <= b && b <= a) ? */
				x = c, y = b, z = a;
		}
	}

	printf("%d %d %d\n", x, y, z);
	return 0;
}

Measured memory_bytes: 596
#include <iostream>

using namespace std;

const int MAX_N = 1e5 + 5;

int gcd (int p, int q) {
  if (q == 0) return p;
  return gcd(q, p % q);
}

int n;
int arr [MAX_N];

bool wins () {
  int codd = 0;

  for (int i = 0; i < n; i++) {
    codd += arr[i] % 2;
  }

  if (n % 2 == 0 && codd % 2 == 1) return true;
  if (n % 2 == 1 && codd % 2 == 0) return true;
  if (n % 2 == 0 && codd % 2 == 0) return false;
  
  if (codd >= 3) return false;
  if (n == 1 && arr[0] == 1) return false;

  for (int i = 0; i < n; i++) {
    if (arr[i] % 2 == 1) {
      if (arr[i] == 1) return false;
      arr[i]--;
    }
  }

  int gc = 0;
  for (int i = 0; i < n; i++) {
    gc = gcd(gc, arr[i]);
  }
  
  for (int i = 0; i < n; i++) {
    arr[i] /= gc;
  }
  return !wins();
}

int main () {
  cin >> n;

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

  if (wins()) {
    cout << "First" << '\n';
  } else {
    cout << "Second" << '\n';
  }
}


Measured memory_bytes: 3992
import java.util.*;
public class Main {
	public static void main(String[] args) {
		Scanner in=new Scanner(System.in);
		int n=in.nextInt();
		int K=in.nextInt();
		boolean[] dp=new boolean[K+1];
		int[] a=new int[n];
		for (int i=0;i<n;++i)
			a[i]=in.nextInt();
		for (int i=0;i<=K;++i) {
			boolean flag=false;
			for (int j=0;j<n;++j) {
				if (a[j]>i) continue;
				if (!dp[i-a[j]]) {
					flag=true;
					break;
				}
			}
			dp[i]=flag;
		}
		if (dp[K]) System.out.println("First");
		else System.out.println("Second");
	}
}

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

const int N = 2e5+10;
int p[N], s[N];

int find(int x){
	return x == p[x] ? x : p[x] = find(p[x]);
}

int main(){
	int n, m;
	scanf("%d%d", &n, &m);
	int u, v;
	for(int i = 1; i <= n; i++){
		p[i] = i;
		s[i] = 1;
	}
	int res = 0;
	for(int i = 0; i < m; i++){
		scanf("%d%d", &u, &v);
		int ur = find(u);
		int vr = find(v);
		if(ur != vr){
			if(ur < vr) swap(ur, vr);
			s[vr] += s[ur];
			p[ur] = vr;
			res = max(res, s[vr]);
		}
	}
	cout << max(res, 1) << endl;
}


Measured memory_bytes: 5280
N=int(input())
s=[]
cnt=[0 for i in range(4)]
for i in range(N):
    s.append(input())

for i in range(N):
    if s[i]=="AC":
        cnt[0]+=1
    elif s[i]=="WA":
        cnt[1]+=1
    elif s[i]=="TLE":
        cnt[2]+=1
    elif s[i]=="RE":
        cnt[3]+=1

print("AC x {}".format(cnt[0]))
print("WA x {}".format(cnt[1]))
print("TLE x {}".format(cnt[2]))
print("RE x {}".format(cnt[3]))

Measured memory_bytes: 16196
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    string A, B;
    cin >> A >> B;
    int num = stoi(A + B);
    REP(i, 1, 1000) {
        if(i * i == num) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<cstring>
#include<cmath>
#include<ctime>
#include<algorithm>
#include<utility>
#include<stack>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 0x3f3f3f3f
#define LL long long
const int MOD = 1E9+7;
const int N = 1000+5;
const int dx[] = {-1,1,0,0,-1,-1,1,1};
const int dy[] = {0,0,-1,1,-1,1,-1,1};
using namespace std;
 
int main() {
    int A,B,C,D,E,F;
    scanf("%d%d%d%d%d%d",&A,&B,&C,&D,&E,&F);
 
    int sugarWater=-1,sugar=1;
    for(int i=0;i*100*A<=F;i++){//水A
        int waterA=i*100*A;
        for(int j=0;j*100*B<=F-waterA;j++){//水B
            int waterB=j*100*B;
            for(int k=0;k*C<=F-waterA-waterB;k++){//糖C
                int sugarC=k*C;
                for(int t=0;t*D<=F-waterA-waterB-sugarC;t++){//糖D
                    int sugarD=t*D;
                    int sugarSum=sugarC+sugarD;//糖质量
                    int tot=waterA+waterB+sugarSum;//当前质量
                    int real=A*E*i+B*E*j;//当前可放的糖
                    if(real<sugarSum||tot>F)
                        continue;
                    if(tot!=0&&sugarSum*1.0/tot>sugar*1.0/sugarWater){
                        sugar=sugarSum;
                        sugarWater=tot;
                    }
                }
            }
        }
    }
    printf("%d %d\n",sugarWater,sugar);
 
    return 0;
}


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

using namespace std;


void solve() {
    int K, N; cin >> K >> N;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];
    
    vector<int> d(N+1);
    for (int i = 1; i < N; i++) {
        d[i] = A[i] - A[i-1];
    }
    d[N] = K - (A[N-1] - A[0]);

    sort(d.begin(), d.end());

    int ans = K - d[N];

    cout << ans << endl;
}


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

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main(){
	//int team[3]={0};
	int Q;
	int T[3];
	cin>>Q;
	for(int i=0;i<Q;i++){
		int team=0;
		for(int j=0;j<3;j++){
			cin>>T[j];
		}
		while(1){
			if(T[0]>0&&T[1]>0&&T[2]>0){
				for(int j=0;j<3;j++){
					T[j]--;
				}
				team++;
			}
			else if(T[0]>1&&T[1]>0){
				T[0]-=2;
				T[1]--;
				team++;
			}
			else if(T[0]>2){
				T[0]-=3;
				team++;
			}
			else break;
		}
		cout<<team<<endl;
	}
	return 0;
}
		

Measured memory_bytes: 3068
use std::io::prelude::*;

fn input<T: std::str::FromStr>() -> T {
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

#[allow(dead_code)]
fn with_stdout_lock<F: FnOnce(std::io::BufWriter<std::io::StdoutLock>)>(f: F) {
    let out = std::io::stdout();
    let w = std::io::BufWriter::new(out.lock());
    f(w);
}

#[allow(unused_macros)]
macro_rules! debug {
    ($var:expr) => {
        match &$var { v => eprintln!(concat!(stringify!($var), "={:?}"), v) }
    };
    ($var:expr, $($vars:expr),*) => {
        match &$var { v => eprint!(concat!(stringify!($var), "={:?} "), v) }
        debug!($($vars),*);
    };
}

fn main() {
    let n: i64 = input();
    let k: i64 = input();

    if k & 1 == 0 {
        let m1 = n / k;
        let m2 = n / k + if n % k >= k / 2 { 1 } else { 0 };
        println!("{}", m1 * m1 * m1 + m2 * m2 * m2);
    } else {
        let m = n / k;
        println!("{}", m * m * m);
    }
}


Measured memory_bytes: 4352
// #pragma GCC target("avx")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
// #define BEGIN_STACK_EXTEND(size) void * stack_extend_memory_ = malloc(size);void * stack_extend_origin_memory_;char * stack_extend_dummy_memory_ = (char*)alloca((1+(int)(((long long)stack_extend_memory_)&127))*16);*stack_extend_dummy_memory_ = 0;asm volatile("mov %%rsp, %%rbx\nmov %%rax, %%rsp":"=b"(stack_extend_origin_memory_):"a"((char*)stack_extend_memory_+(size)-1024));
// #define END_STACK_EXTEND asm volatile("mov %%rax, %%rsp"::"a"(stack_extend_origin_memory_));free(stack_extend_memory_);

#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
#include<unordered_set>
#include<unordered_map>
#include<complex>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-11;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 11100000;
const int UF_SIZE = 3100000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	inline long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	long long pw_mod(long long a,long long b,long long M){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%M;
			a=a*a%M;
			b/=2;
		}
		return ret;
	}
	int pw_mod_int(int a,int b,int M){
		if(a<0)return 0;
		if(b<0)return 0;
		int ret=1;
		while(b){
			if(b%2)ret=(long long)ret*a%M;
			a=(long long)a*a%M;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
	int UF[UF_SIZE];
	void init_UF(int n){
		for(int i=0;i<n;i++)UF[i]=-1;
	}
	int FIND(int a){
		if(UF[a]<0)return a;
		return UF[a]=FIND(UF[a]);
	}
	void UNION(int a,int b){
		a=FIND(a);b=FIND(b);if(a==b)return;
		if(UF[a]>UF[b])swap(a,b);
		UF[a]+=UF[b];UF[b]=a;
	}
}
// ここから編集しろ

int main(){
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	printf("%d\n",b/c-(a-1)/c);
}

Measured memory_bytes: 1680
using System;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var l1 = ReadIntArray();
        var hp = l1[0];
        var sp_types = l1[1]; 
        var sp_damage_list = ReadIntArray();

        var damage_total = sp_damage_list.OrderByDescending(_ => _).Take(sp_types).Sum();
        Console.WriteLine(hp > damage_total ? "No" : "Yes");
    }

    static string[] ReadStringArray()
    {
        var input = Console.ReadLine();
        return input.Split(' ');
    }

    static int[] ReadIntArray()
    {
        var inpArray = ReadStringArray();
        return inpArray.Select(_ => int.Parse(_)).ToArray();
    }
}

Measured memory_bytes: 21472
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <algorithm>
#include <queue>
#include <cmath>
#include <iomanip>
#include <cstdlib>
// #include <fstream>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

const long long mod = 1e9 + 7;
const int INF32 = INT32_MAX;

bool is_palindrome(std::string s)
{
    std::string t(s.rbegin(), s.rend());
    return s == t;
}

int main()
{
    std::string s, sr;
    std::cin >> s;
    const int n = s.length();
    if(is_palindrome(s) && is_palindrome(s.substr(0, (n-1)/2)) && is_palindrome(s.substr((n+1)/2)))
        std::cout << "Yes\n";
    else std::cout << "No\n";

    return 0;
}


Measured memory_bytes: 256
#! /usr/bin/env python
# -*- coding: utf-8 -*-

import os
import sys
import itertools
import math
from collections import Counter, defaultdict

class Main(object):
    
    def __init__(self):
        pass

    def solve(self):
        '''
        insert your code
        '''
        while True:
            n = input()
            if n == 0:
                break
            f = raw_input().split()
            state = 0
            prev = 0
            ans = 0
            for move in f:
                # print state, prev, ans
                if state == 0:
                    if prev == 3:
                        ans += 1
                        prev = 0
                    if move == 'lu':
                        state = 1
                    elif move == 'ru':
                        state = 2
                elif state == 1:
                    if move == 'ld':
                        state = 0
                    elif move == 'ru':
                        state = 3
                elif state == 2:
                    if move == 'lu':
                        state = 3
                    elif move == 'rd':
                        state = 0
                else:
                    if prev == 0:
                        ans += 1
                        prev = 3
                    if move == 'ld':
                        state = 2
                    elif move == 'rd':
                        state = 1
            if (state == 0 and prev == 3) or (state == 3 and prev == 0):
                ans += 1            
            print ans
        return None

if __name__ == '__main__':
    m = Main()
    m.solve()

Measured memory_bytes: 4688
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {  
    int a, b;
    cin >> a >> b;
    cout << (a + b) % 24<< endl;
}




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

int main(){
    string s;
    cin>>s;
    bool can_make=true;
    int ind=0;
    while(can_make&&ind<s.size()-1){
        if(s.substr(ind,5)=="dream"){
            ind+=5;
            if(s.substr(ind,2)=="er"&&s.substr(ind,5)!="erase"){
                ind+=2;
            }
        }else if(s.substr(ind,5)=="erase"){
            ind+=5;
            if(s.substr(ind,1)=="r"){
                ind+=1;
            }
        }else{
            can_make=false;
        }
    }
    if(can_make){
        cout<<"YES"<<endl;
    }else{
        cout<<"NO"<<endl;
    }
    return 0;
}

Measured memory_bytes: 3712
using System;
using System.Collections.Generic;
using System.Linq;


namespace ABC121C
{
    class MainClass
    {
        static long[] s;
        public static void Main(string[] args)
        {

            s = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);
            var ablst = new List< long[] > ();
            for(int i = 0; i < s[0]; i++)
            {
                long[] ab = new long[2];
                ab = Array.ConvertAll(Console.ReadLine().Split().ToArray(), long.Parse);
                ablst.Add(ab);

            }

            ablst.Sort(delegate (long[] x, long[] y) { return x[0].CompareTo(y[0]); });
            long restitem = s[1];
            long ans = 0;
            for(int i = 0; i < s[0]; i++)
            {
                if (ablst[i][1] >= restitem)
                {
                    ans += ablst[i][0] * restitem;
                    break;
                }
                else
                {
                    restitem -= ablst[i][1];
                    ans += ablst[i][0] * ablst[i][1];
                }
            }
            Console.WriteLine(ans);

        }
    }
}


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

void solve() {
  long n, m, a;
  cin >> n >> m;
  priority_queue<int> q;
  rep(i,n) {
    cin >> a;
    q.push(a);
  }
  rep(i,m) {
    int gotA = q.top();
    q.pop();
    q.push(gotA/2);
  }
  long long ans = 0;
  while (!q.empty()) {
    ans += q.top();
    q.pop();
  }

  cout << ans << endl;

}

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


Measured memory_bytes: 892