akhauriyash/Code-Regression huggingface dataset:
//c++ テンプレ
#include<bits/stdc++.h>
using namespace std;

typedef long long llint;
typedef long double ld;

#define inf 1e18
#define mod 1000000007
#define sort(v) sort(v.begin(),v.end())
#define reverse(v) reverse(v.begin(),v.end())

priority_queue<llint,vector<llint>,greater<llint> > que;
priority_queue<llint> Que;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }


void solve(){
    int n;
    cin >> n;
    vector<llint>a(n);
    for(int i=0;i<n;i++)cin >> a[i];
    sort(a);
    reverse(a);
    llint ans=0;
    for(int i=1;i<n;i++){
        ans+=a[i/2];
    }
    cout << ans << endl;


}

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




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

int main() {
  vector<char> s(4);
  int a, b, c, d;
  scanf("%c", &s.at(0)); scanf("%c", &s.at(1)); scanf("%c", &s.at(2)); scanf("%c", &s.at(3)); 
  a = s.at(0) - '0'; b = s.at(1) - '0'; c = s.at(2) - '0'; d = s.at(3) - '0'; 
  if (a-b-c-d == 7)  printf("%d-%d-%d-%d=7\n", a, b, c, d);
  else if (a-b-c+d == 7)  printf("%d-%d-%d+%d=7\n", a, b, c, d);
  else if (a-b+c-d == 7)  printf("%d-%d+%d-%d=7\n", a, b, c, d);
  else if (a-b+c+d == 7)  printf("%d-%d+%d+%d=7\n", a, b, c, d);
  else if (a+b-c-d == 7)  printf("%d+%d-%d-%d=7\n", a, b, c, d);
  else if (a+b-c+d == 7)  printf("%d+%d-%d+%d=7\n", a, b, c, d);
  else if (a+b+c-d == 7)  printf("%d+%d+%d-%d=7\n", a, b, c, d);
  else if (a+b+c+d == 7)  printf("%d+%d+%d+%d=7\n", a, b, c, d);
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
int main()
{
	string s;
	while(1)
	{
		getline(cin,s);
		if(cin.eof())break;
		int slidenum=0,len = s.size();
		string ss = s;
		rep(i,26)
		{
			rep(j,len)
			{
				if(s[j]>='a' && s[j]<='z'){ss[j] = ((s[j] - 'a' + i) % 26) +'a';}
			}
			int index[3];
			index[0] = ss.find("this");
			index[1] = ss.find("that");
			index[2] = ss.find("the");
			
			if(index[0]!=string::npos || index[1]!=string::npos || index[2]!=string::npos)break;
		}
		cout << ss<<endl;
	}

	return 0;
}

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

int main(){
	for ( int leftIdx = 1; leftIdx <= 9; ++leftIdx ) {
		for ( int rightIdx = 1; rightIdx <= 9; ++rightIdx ) {
			printf( "%dx%d=%d\n", leftIdx, rightIdx, leftIdx * rightIdx );
		}
	}
	return 0;
}

Measured memory_bytes: 1096
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
typedef long long ll;
int main()
{
  ll n,a,b;cin >> n >> a >> b;
  ll res = (n/(a+b))*a + min(n%(a+b),a);
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
#include <map>
#include <set>
#include <bitset>
#include <stack>
//#include <atcoder/dsu>
//#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
//using namespace atcoder;
#define urept(soeji, start, n) for (int soeji = start; soeji < n; soeji++)
#define drept(soeji, start, n) for (int soeji = start; soeji > n; soeji--)

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

lli gcd2(lli x, lli y)
{
    lli t;
    while (y != 0)
        t = x % y, x = y, y = t;
    return (x);
}

lli lcm2(lli x, lli y)
{
    lli xy = x * y;
    if (xy < 0)
        xy = -xy;
    return (xy / gcd2(x, y));
}
lli m = 1e9 + 7;
int main(void)
{
    int N, K;
    cin >> N >> K;
    lli ans = K;
    for (int i = 0; i < N - 1; i++)
    {
        ans *= (K - 1);
    }
    cout << ans << endl;
    return 0;
}


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

int sumofdigits(int x) {
  int sum = 0;
  while (x > 0) {
    sum += x % 10;
    x /= 10;
  }
  return sum;
}

void PrintMap(std::map<int, int>& m) {
  for (auto iter: m) {
    std::cout << iter.first << " => " << iter.second << "\n";
  }
}

signed main() {
  std::vector<std::vector<int>> c(3, std::vector<int>(3));
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
       std::cin >> c.at(i).at(j);
    }
  }
  std::string yes = "Yes\n";
  std::string no = "No\n";
  
  int diff0, diff1, diff2;
  for (int i = 0; i < 3 - 1; i++) {
    diff0 = c.at(i).at(0) - c.at(i+1).at(0);
    diff1 = c.at(i).at(1) - c.at(i+1).at(1);
    diff2 = c.at(i).at(2) - c.at(i+1).at(2);
    if (diff0 != diff1 || diff1 != diff2) {
      std::cout << no;
      return 0;
    }
  }
  for (int i = 0; i < 3 - 1; i++) {
    diff0 = c.at(0).at(i) - c.at(0).at(i+1);
    diff1 = c.at(1).at(i) - c.at(1).at(i+1);
    diff2 = c.at(2).at(i) - c.at(2).at(i+1);
    if (diff0 != diff1 || diff1 != diff2) {
      std::cout << no;
      return 0;
    }
  }
  std::cout << yes;
  
  return 0;
}

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

int main(){
	int N,X;
	cin>>N>>X;
	
	int m[N];
	for(int i=0;i<N;i++)
		cin>>m[i];
	
	sort(m,m+N);
	for(int i=0;i<N;i++){
		X-=m[i];
	}
	cout<<N+X/m[0]<<endl;
	return 0;
}

Measured memory_bytes: 256
h,w=map(int, input().split())
mat = []
mat.append(["."]*(w+2))
for i in range(h):
  mat.append(["."]+list(input())+["."])
mat.append(["."]*(w+2))
for y in range(1, h+1):
  for x in range(1, w+1):
    if mat[y][x] != "#":
      c = 0
      if mat[y-1][x-1] == "#":
        c += 1
      if mat[y-1][x] == "#":
        c += 1       
      if mat[y-1][x+1] == "#":
        c += 1      
      if mat[y][x-1] == "#":
        c += 1
      if mat[y][x+1] == "#":
        c += 1
      if mat[y+1][x-1] == "#":
        c += 1        
      if mat[y+1][x] == "#":
        c += 1        
      if mat[y+1][x+1] == "#":
        c += 1
      mat[y][x] = str(c)

for y in range(1, h+1):
  print("".join(mat[y][1:w+1]))
        


Measured memory_bytes: 67592
#include "bits/stdc++.h"

#define ed cout<<"\n";
#define speed ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long 
#define ffor(i,a,b) for(ll i=(ll)(a);i<(ll)(b);++i)
#define rep(i, n) ffor(i,0,n)
#define All(obj) (obj).begin(),(obj).end()
#define INF ((ll)1e9+7)
#define c(a) cout<<a<<"\n";
using namespace std;
const int N = 100005;



int main() {
	speed;
	cout << fixed << setprecision(6);
	string s, t;
	cin >> s >> t;
	int ans = 0;
	rep(i, 3) {
		if (s.at(i) == t.at(i))ans++;
	}
	c(ans);
	ed;
	return 0;
}


Measured memory_bytes: 256
import math

n = int(input())

l = list(range(2,n+1))

ans = n

def isprime(i,k):
    
    if i == 2:
        return True
    
    elif i % 2 == 0:
        return False
    
    else:
        m = math.floor(math.sqrt(k)) + 1
        for n in range(3, m, 2):
            if i % n == 0:
                return False
        
        return True

while True:
    if isprime(ans,n):
        break
    
    ans += 1

print(ans)
    

Measured memory_bytes: 6900
#include <stack>
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <limits>
using namespace std;
int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int mod = 1000000000 + 7;
vector<int> v;
class Calc
{
    // 宣言
    long long a;

    public:
        // 素因数分解
        void decompositPrime(long long a);
};

/*
 * 素因数分解
 */
void Calc::decompositPrime(long long n)
{
    // 割る数の初期値
    a = 2;
    // √n ≧ a ( n ≧ a * a ) の間ループ処理
    while (n >= a * a) {
        // a で割り切れたら、a は素因数
        // そして、割られる数を a で割る
        // a で割り切れなかったら、 a を 1 増加させる
        if (n % a == 0) {
            //printf("%d * ", a);
             v.push_back(a);
            n /= a;
        } else {
            a++;
        }
    }
    // 最後に残った n は素因数
    v.push_back(n);
    //printf("%d\n", n);
}

int main(){
    //std::stack<int> stack;
    int n;
    cin >> n;
    long ans = 0;
    vector<int> a(n+1);
    for(int i = 0; i < n; i++){
        cin >> a[i] >> a[i+1];
    }
    long mat[n+1][n+1];
    for(int i = 1; i <= n; i++){
        mat[i][i] = 0;
    }
    for(int L = 2; L <= n; L++){
        for(int i = 1; i <= n-L+1; i++){
            int j = i+L-1;
            mat[i][j] = numeric_limits<long>::max();
            for(int k = i; k < j; k++){
                mat[i][j] = min(mat[i][j], mat[i][k] + mat[k+1][j] + a[i-1]*a[k]*a[j]);
            }
        }
    }
    cout << mat[1][n] << endl;
    return 0;
}






Measured memory_bytes: 3180
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {

        Scanner sc = new Scanner(System.in);
        int sx = sc.nextInt();
        int sy = sc.nextInt();
        int tx = sc.nextInt();
        int ty = sc.nextInt();
        
        int gapx = tx -sx;
        int gapy = ty -sy;
        
        ArrayList<Character> list = new ArrayList<Character>();
        
      	//1週目
        for(int i = 0; i < gapy; i++){
            list.add('U');
        }
        for(int i = 0; i < gapx; i++){
            list.add('R');
        }
        for(int i = 0; i < gapy; i++){
            list.add('D');
        }
        for(int i = 0; i < gapx; i++){
            list.add('L');
        }

        //2週目 
            list.add('L');
        for(int i = 0; i < gapy+1; i++){
            list.add('U');
        }
        for(int i = 0; i < gapx+1; i++){
            list.add('R');

        }
            list.add('D');
            list.add('R');
        for(int i = 0; i < gapy+1; i++){
            list.add('D');
        }
        for(int i = 0; i < gapx+1; i++){
            list.add('L');
        }
            list.add('U');

        //answer
        for(Character route: list){
            System.out.print(route);
        }
    }
}


Measured memory_bytes: 26872
N = int(input())
A = list(map(int, input().split()))
A = [0] + A + [0]
default_cost = 0
for i in range(N+1):
    default_cost += (abs(A[i+1]-A[i]))

for i in range(1, N+1):
    cost = default_cost - abs(A[i+1]-A[i]) - abs(A[i]-A[i-1]) \
        + abs(A[i+1]-A[i-1])
    print(cost)


Measured memory_bytes: 14048
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define test() ull t;cin>>t;while(t--)
#define pb push_back
#define mkp make_pair
#define nl cout<<endl
#define MOD 1000000007
#define loop(i,start,end) for(ull i=start;i<end;i++)
#define N 100001
#define all(v) v.begin(),v.end()
#define oa(a,n) for(int i=0;i<n;i++)cout<<a[i]<<" ";nl
#define ov(a) for(int i=0;i<a.size();i++)cout<<a[i]<<" ";nl
int main() 
{
    fastio();

  ll n;cin>>n;
  vector<ll>v(n);
  loop(i,0,n)cin>>v[i];
  int f = 0;
  loop(i,0,n)if(v[i]!=(i+1))f++;
  if(f<=2)cout<<"YES";
  else cout<<"NO";

  return 0;
}

Measured memory_bytes: 256
package main

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

var sc = bufio.NewScanner(os.Stdin)

func main() {
	// Code for C - Build Stairs
	var N int
	fmt.Scanf("%d", &N)

	sc.Split(bufio.ScanWords)
	H := make([]int, N)
	for i := 0; i < N; i++ {
		H[i] = nextInt()
	}

	var temp int = H[N-1]
	var ans int
	var flag int
	for i := N - 2; 0 <= i; i-- {
		A := temp - H[i]

		if A == -1 {
			ans++
		} else if A < -1 {
			flag++
		} else {
			temp = H[i]
		}
	}
	if flag == 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 4276
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<numeric>
#include<string>
using namespace std;

long gcd(long x, long y) { if (x > y) { return gcd(y, x); } long r; while (y != 0) { r = x % y; x = y; y = r; }return x; }
long lcm(long x, long y) { return(x / gcd(x, y)) * y; }
void indexsort(long* first, long* last, long* func) { sort(first, last, [&](long a, long b) {return func[a] < func[b]; }); }
//--------------------

int main() {
	 
	long H, W; cin >> H >> W;
	string res = "Impossible";
	long mycount = 0;

	char A[10][10]; for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) cin >> A[i][j];

	for (int i = 0; i < H; ++i) for (int j = 0; j < W; ++j) if (A[i][j] == '#') mycount++;

	if (mycount == H + W - 1) res = "Possible";

	cout << res << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cmath>
#include <set>
using namespace std;
main(){
	int n,i,j,a,b;
	double r,x,y;
	set<pair<int,int> >s;
	for(scanf("%d%lf",&n,&r);n--;){
		scanf("%lf%lf",&x,&y),a=x/r,b=y/r;
		for(i=-1;i<=1;i++)for(j=-1;j<=1;j++)if(s.find(make_pair(a+i,b+j))!=s.end())goto next;
		s.insert(make_pair(a,b));
		next:;
	}
	printf("%d\n",s.size());
}

Measured memory_bytes: 8588
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
            // 入力
            string[] sS = Console.ReadLine().Trim().Split(' ');
            int iX = int.Parse(sS[0]);

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();

            // 解析
            List<int> lstBek = new List<int>() { 8, 16, 27, 32, 64, 81, 125, 128, 216, 243, 256, 343, 512, 625, 729, 1000, };
            int iOut = 0;
            for (int i = 0; i < iX; i++)
            {
                int iY = iX - i;
                if (Math.Sqrt(iY) % 1 == 0) { iOut = iY; break; }
                if (lstBek.Contains(iY)) { iOut = iY; break; }
                //string sOut = "";
                //sOut += "n=" + (iX - i).ToString("000") + " Sq=" + Math.Sqrt(iX - i).ToString() + " Rm" + (Math.Sqrt(iX - i) % 1).ToString() + ((Math.Sqrt(iX - i) % 1 == 0) ? " ○" : "");
                //Console.WriteLine("{0}", sOut.ToString().Trim());
            }

            // 出力
            Console.WriteLine("{0}", iOut.ToString().Trim());

            sw.Stop();
#if DEBUG
            Console.WriteLine();
            Console.WriteLine("{0}", sw.Elapsed.ToString());
            Console.WriteLine("続行するには何かキーを押してください．．．");
            Console.ReadKey();
#endif
    }

}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> vec(3);
  for(int i=0;i<3;i++){
    cin >> vec.at(i);
  }

  if(vec.at(0)==5){
    if(vec.at(1)==5){
      if(vec.at(2)==7){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
    }
    else if(vec.at(1)==7){
      if(vec.at(2)==5){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
    }
    else{
      cout << "NO" << endl;
    }
  }
  else if(vec.at(0)==7){
    if(vec.at(1)==5){
      if(vec.at(2)==5){
        cout << "YES" << endl;
      }
      else{
        cout << "NO" << endl;
      }
    }
    else{
      cout << "NO" << endl;
    }
  }
  else{
    cout << "NO" << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<=(b);++i)
#define mem(a,x) memset(a,x,sizeof(a))
#define pb push_back
#define pi pair<int, int>
#define mk make_pair
using namespace std;
typedef long long ll;
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
int main()
{
	ll n,r;
	cin>>n>>r;
	n=min(10ll,n);
	ll ans=r+100*(10-n);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int main()
{ 
	char S[15],SUN, MON, TUE, WED, THU, FRI ,SAT;
	scanf("%s",S);
	if(strcmp(S,"SUN")==0)
	{ 
		printf("7");
	}
    else if(strcmp(S,"MON")==0)
	{
		printf("6");
	}
	 else if(strcmp(S,"TUE")==0)
	{
		printf("5");
	}
	  else if(strcmp(S,"WED")==0)
	{
		printf("4");
	}
	   else if(strcmp(S,"THU")==0)
	{
		printf("3");
	}
	    else if(strcmp(S,"FRI")==0)
	{
		printf("2");
	}

	else
	{
       printf("1");
	}
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long a,b,c,d=0,e,f,g,h,i,j,k,l,m,n,x,y,z;
    cin>>a;
    char ch,dh;
    cin>>ch;

    for(i=1;i<a;i++)
    {

    cin>>dh;
    if(dh!=ch)
    {
        d++;
        ch=dh;
    }

    }
    cout<<d+1<<endl;







}


Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
#define INF 1001001001
#define LLINF 1001001001001001001
#define MOD 1000000007
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; }
#define ALL(v) v.begin(), v.end()
typedef long long ll;



int main(){
    int n;cin>>n;
    if(n%10==9 or n/10==9)cout <<"Yes" << endl;
    else cout << "No" << endl;
    return 0;
}





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

const int N = 2e5 + 10, M = 2e6 + 10;

char str[M];
int L[N], R[N];

namespace Trie
{
	int ch[M][26], sz;
	int val[M];

	void insert(char *str, int len)
	{
		int u = 0;
		for (int i = 0; i < len; i++)
		{
			int c = str[i] - 'a';
			if (!ch[u][c]) ch[u][c] = ++sz;
			u = ch[u][c];
		}
		val[u]++;
	}
}

int n;

int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		scanf("%s", str + R[i-1] + 1);
		int len = strlen(str + R[i-1] + 1);
		L[i] = R[i-1] + 1;
		R[i] = L[i] + len - 1;
		reverse(str + L[i], str + R[i] + 1);
		Trie::insert(str + L[i], len);
	}
	
	LL Ans = 0;
	for (int i = 1; i <= n; i++)
	{
		static int cnt[27];
		memset(cnt, 0, sizeof(cnt));
		for (int j = L[i]; j <= R[i]; j++) cnt[str[j] - 'a']++;
		int u = 0;
		for (int j = L[i]; j <= R[i]; j++)
		{
			for (int k = 0; k < 26; k++)
				if (cnt[k] && Trie::ch[u][k])
					Ans += Trie::val[Trie::ch[u][k]];
			cnt[str[j] - 'a']--;
			u = Trie::ch[u][str[j] - 'a'];
		}
	}
	cout << Ans - n << endl;
	
	return 0;
}
/*
3
abcxyx
cyx
abc
1
*/
/*
6
b
a
abc
c
d
ab
5
*/

Measured memory_bytes: 109212
//{{{
#include <bits/stdc++.h>
using namespace std;
#define repX(a,b,c,x,...) x
#define repN(a) repX a
#define rep(...) repN((__VA_ARGS__,rep3,rep2,loop))(__VA_ARGS__)
#define rrep(...) repN((__VA_ARGS__,rrep3,rrep2))(__VA_ARGS__)
#define loop(n) rep2(i_,n)
#define rep2(i,n) rep3(i,0,n)
#define rep3(i,begin,end) for(int i=(int)(begin),i##_end=(int)(end);i<i##_end;++i)
#define rrep2(i,n) rrep3(i,n,0)
#define rrep3(i,begin,end) for(int i=(int)(begin-1),i##_end=(int)(end);i>=i##_end;--i)
#define foreach(x,a) for(auto&x:a)
using ll=long long;
const ll mod=(ll)1e9+7;
//}}}

int main(){
  int N;
  cin >> N;
  vector<int> v(N);
  vector<int> c(N);
  rep(i, N) cin >> v[i];
  rep(i, N) cin >> c[i];
  int ans = 0;
  rep(i, N){
    ans += max(v[i] - c[i], 0);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,s[100000],q,t,c,l,m,r,i,j;
main(){
  cin.sync_with_stdio(false);
  for(cin>>n;i<n;cin>>s[i++]);
  for(cin>>q;j++<q;){
    l=0,r=n,cin>>t;
    while(m=(l+r)/2,l<r){
      t-s[m]||(l=r,c++);
      if(t<s[m])r=m;
      t<s[m]&&(r=m);
      t>s[m]&&(l=m+1);
    }
  }
  cout<<c<<endl;
}

Measured memory_bytes: 3408
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int main() {
  ll a, b, c;
  scanf("%lld %lld %lld", &a, &b, &c);
  if(a & 1 && b & 1 && c & 1)
    printf("%lld\n", min(a * b, min(b * c, c * a)));
  else
    printf("0\n");
}

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

typedef long long ll;
const int N = 200005;

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	string s,t;
	cin>>s>>t;
	
	int ans = s.size();
	for(int i=0;i<(int)s.size()-(int)t.size()+1;i++){
		int cnt = 0;
		for(int j=i;j<i+(int)t.size();j++){
			if(s[j] == t[j-i])cnt++;
		}
		ans = min(ans,(int)t.size() - cnt);
	}
	cout<<ans;
	
	return 0;
}


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

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

using ll = long long;

int main(){
  int n;
  cin>>n;
  int free;
  vector<int> a(n),rate(8);
  rep(i,n){
    int tmp = 0;
    cin >> tmp;
    if(tmp>=3200)free++;
    else if(tmp>=2800)rate.at(7)++;
    else if(tmp>=2400)rate.at(6)++;
    else if(tmp>=2000)rate.at(5)++;
    else if(tmp>=1600)rate.at(4)++;
    else if(tmp>=1200)rate.at(3)++;
    else if(tmp>=800)rate.at(2)++;
    else if(tmp>=400)rate.at(1)++;
    else rate.at(0)++;
  }
  int ans = 0;
  for(auto i : rate){
    if(i!=0)ans++;
  }
  
  cout<<max(ans,1)<<" "<<ans+free<<endl;
  return 0;
}


Measured memory_bytes: 256
import sys
from bisect import *
from collections import *
from copy import deepcopy
from datetime import *
from heapq import *
from itertools import *
# from math import *
from operator import *
from pprint import *

sys.setrecursionlimit(10**8)

input = sys.stdin.readline

def main():
    """ main """
    N = int(input())
    ans = 0
    for i in range(N):
        num,st = input().rstrip().split(' ')
        num = float(num)
        if st == 'JPY':
            ans += num
        else:
            ans += num*380000
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3952
import java.util.*;
public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int P[] = new int[N];
		int c[] = new int[N];
		for(int i = 0; i < N; i++) {
			P[i] = sc.nextInt() - 1;
			c[P[i]] = i;
		}
		
		int ans_temp = 1;
		int pre = -1;
		int temp = 0;
		for(int i = 0; i < N; i++) {
			if(c[i] < pre) {
				ans_temp = Math.max(ans_temp, temp);
				temp = 1;
				pre = c[i];
			} else {
				temp++;
				pre = c[i];
			}
		}
		ans_temp = Math.max(ans_temp, temp);
		System.out.println(N - ans_temp);
	}
}


Measured memory_bytes: 87968
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define repo(i,n) for(int i = 1; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define np next_permutation
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
//#define num 1000000007
#define pi acos(-1.0)
//cout << fixed << setprecision (20);   小数点以下2０桁まで
//intの最大値2147483647 ≒ 2×10^9
//long longの最大値9223372036854775807 ≒ 9×10^18
//'0'+=16;        で大文字に
//'大文字'+=32;    で小文字に
//s[i]-'0'でchar文字→int数に;
//string s = to_string(int数);
//int n = stoi(string文字列)
//実行時間制約2秒では２×10^8回くらいまで計算できる



int main() {
  int a,b,c,d;
  cin >> a>>b>>c>>d;
  
  cout << max(0,min(b,d)-max(a,c)) << endl;
  
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <numeric>
#include <queue>
#include <string>
#include <utility>
#include <vector>

using namespace std;
#define ALL(a) (a).begin(), (a).end()
#define REP(i, n) for (size_t i = 0; i < (n); i++)
#define nvec(T, v, n) vector<T> v(n); REP(i, n) {cin>>(v)[i];}
#define npairs(T1, T2, v, n) vector<pair<T1, T2>> v(n); REP(i, n){cin>>v[i].first>>v[i].second;}
#define ntuples(T1, T2, T3, v, n) vector<tuple<T1, T2, T3>> v(n); REP(i, n){cin>>get<0>(v[i])>>get<1>(v[i])>>get<2>(v[i]);}
#define vec2d(T, v, m, n) vector<vector<T>> (v)(m, vector<T>(n))
#define nvec2d(T, v, m, n) vec2d(T, v, m, n); REP(j, m){REP(i, n) {cin>>(v[j])[i];}}

#define min_index(v) size_t( min_element(all(v)) - (v).begin() )
#define max_index(v) size_t( max_element(all(v)) - (v).begin() )
#define min_e(v) *min_element(ALL(v))
#define max_e(v) *max_element(ALL(v))

#define count_le(v, a) size_t( upper_bound(ALL(v), a) - (v).begin() )
#define count_lt(v, a) size_t( lower_bound(ALL(v), a) - (v).begin() )
#define count_ge(v, a) size_t( (v).end() - lower_bound(ALL(v), a) )
#define count_gt(v, a) size_t( (v).end() - upper_bound(ALL(v), a) )

#define order(neq_sl) [](const auto s, const auto l){return neq_sl;}
#define make_lr(v,type,l,r) vector<type> l(n+1),r(n+1);FOR(i,n){l[i+1]=l[i]+v[i];r[i+1]=r[i]+v[n-1-i];}

#define acm accumulate
#define SUM(v) accumulate(ALL(v), 0l)
#define SORT(v) sort(ALL(v))

#define pos position<int>
#define at_(p) at(p.x).at(p.y)

#define GCD(v) gcd(ALL(v), 0l)

template <typename T>
T gcd(T a, T b) {
    if (a > b) swap(a, b);
    if (a == 0) return b;
    return gcd(b%a, a);
}
template <typename InputItr, typename T>
T gcd(InputItr first, InputItr last, T init) {
    for (; first != last; ++first) init = gcd(init, *first);
    return init;
}

template <typename T>
using vec =vector<T>;

template <typename T>
using vvec =vector<vector<T>>;



int main(){
  int k,a,b;
  cin>>k>>a>>b;
  if(a/k==b/k&&a%k!=0){
    cout<<"NG";
  }else{
    cout<<"OK";
  }
}



/* きょむ〜 */


Measured memory_bytes: 3636
#include<iostream>
#include<vector>
using namespace std;
int modpow(int a, int b, int mod) {
  int ret = 1;
  while (b > 0) {
    if (b & 1)  ret = 1LL * ret * a % mod;
    b >>= 1;
    a = 1LL * a * a % mod;
  }
  return ret;
}
int main() {
  int n, a, b;
  cin >> n >> a >> b;
  
  const int mod = 1e9 + 7;
  vector<int> fac(1e6), inv(1e6), finv(1e6);
  fac[0] = fac[1] = inv[1] = finv[0] = finv[1] = 1;
  for (int i = 2; i < 1e6; i++){
    fac[i] = 1LL * fac[i - 1]  * i % mod;
    inv[i] = mod - 1LL * (mod / i) * inv[mod % i] % mod;
    finv[i]= 1LL * finv[i - 1] * inv[i] % mod;
  }
  auto comb = [&](int n, int k) -> int {
    if (n < 0 || k < 0 || n < k) return 0;
    int ret = 1;
    for (int i = 0; i < k; i++) ret = 1LL * ret * (n - i) % mod * inv[i + 1] % mod;
    return ret;
  };
  int ans = modpow(2, n, mod);
  ((ans -= comb(n, a)) += mod) %= mod;
  ((ans -= comb(n, b)) += mod) %= mod;
  cout << ans - 1 << endl;
}

Measured memory_bytes: 12032
/**
 * 	matrix chain multiplication
 * 	f(n,m) = multiply Mn*M(n+1)*...*M(m-1)*M(m)
 * 	f(n,n) = 1
 * 	r(n)=c(n-1)
 * 	f(n,n+1) = C(n) * R(n) * C(n+1) = c(n) * c(n-1) * c(n+1)
 * 	f(n,k,m) = f(n,k)*f(k+1,m)*C(n)*r(n)*c(k)
 * 	f(n,m) = min(f(n,k,m)
 */

#include <iostream>
#include <cmath>
#include <climits>

using namespace std;

int r[100] = {0};
int a[100][100] = {0};

int f(int n, int m);
int f(int n, int k, int m);


int f(int n, int k, int m)
{
	return f(n,k) + f(k+1,m) + (r[n] * r[k+1] * r[m+1]);
}

int f(int n, int m)
{
	if (n==m) return 0;
	int & ra = a[n][m];
	if (ra) return ra;
	ra = INT_MAX;
	for (int k=n;k<m;k++)
	{
		int ans = f(n,k,m);
		if (ans < ra) ra = ans;
	}
	return ra;
}

int main()
{
	int rr = 0;
	int cc = 0;
	int n = 0;
	cin >> n;
	for (int i=0;i<n;i++)
	{
		cin >> rr >> cc;
		r[i]=rr;
		r[i+1]=cc;
	}
	for (int i=0;i<n-1;i++)
	{
		a[i][i+1] = r[i] * r[i+1] * r[i+2];
	}
	int ans = f(0,n-1);
	cout << ans << endl;
}

Measured memory_bytes: 3104
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n,m;
int cnt[30];
void work(){
	memset(cnt,0,sizeof(cnt));
	scanf("%d%d",&n,&m);
  int N=n*m;
  char ch;
  for(int i=1;i<=N;++i){
    while(ch=getchar(),ch>'z'||ch<'a');
    cnt[ch-'a']++;
  }
  if(n%2==0&&m%2==0){
    bool flag=true;
    for(int i=0;i<26;++i)if(cnt[i]%4!=0)flag=false;
    printf("%s\n",flag?"Yes":"No");
  }else if(n%2==0||m%2==0){
    if(m%2==0)swap(n,m);
    //n even m odd
    //    4*((m-1)*n/4),2*(n/2)
    bool flag=true;
    for(int i=0;i<26;++i){
      if(cnt[i]&1)flag=false;
    }
    //    2*((m-1)*n/4),1*(n/2)
    for(int i=0;i<26;++i)cnt[i]/=2;
    int cnt2=0,cnt1=0;
    for(int i=0;i<26;++i)cnt2+=cnt[i]/2,cnt1+=cnt[i]&1;
    if(cnt1>n/2/*||(cnt1&1)!=((n/2)&1)*/)flag=false;
    printf("%s\n",flag?"Yes":"No");
  }else{
    //n odd m odd
    // 4*[(n-1)*(m-1)/4] 2*[(n-1)/2 +(m-1)/2] 1*1
    int cnt1=0;
    for(int i=0;i<26;++i){
      if(cnt[i]&1)cnt1++;
    }
    bool flag=true;
    if(cnt1!=1){
      flag=false;
    }else{
      for(int i=0;i<26;++i){
				cnt[i]/=2;
      }//2*[(n-1)*(m-1)/4] 1*[(n-1)/2 +(m-1)/2]
      cnt1=0;
      for(int i=0;i<26;++i){
				if(cnt[i]&1)cnt1++;
      }
      if(cnt1>(n-1)/2+(m-1)/2||((cnt1&1)!=(((n-1)/2 +(m-1)/2)&1)))flag=false;
    }
    printf("%s\n",flag?"Yes":"No");
  }
}
int main(){
	int T=1;
	while(T--){
  	work();
	}
  return 0;
}

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

  int N , M ;
  string S ;
  cin >> N >> M ;
  cin >> S ;
  if(S.at(N)=='-'){
    rep(i,N+M){
      if( i == N ) continue ;
      else{
        if(S.at(i)!='-') continue ;
        else{
          cout << "No" << endl;
          return 0 ;
        }
      }
      
    }
  cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  }

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
template<class T> inline bool chmax(T& a, T b) { if(a < b){ a=b; return 1; } return 0;}
template<class T> inline bool chmin(T& a, T b) { if(a > b){ a=b; return 1; } return 0;}

int main(){
	int h,w,a,b;
	cin >> h >> w >> a >> b;
	
	vector<vector<int>> ans(h,vector<int>(w,0));
	
	REP(i,h){
		REP(j,a){
			ans[i][j] = 1- ans[i][j];
		}
	}
	
	REP(i,b){
		REP(j,w){
			ans[i][j] = 1- ans[i][j];
		}
	}
	
	REP(i,h){
		REP(j,w) cout << ans[i][j];
		cout << endl;
	}
	
	return 0;
}

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

int main() {
string s;
cin >> s;
if(s[0]==s[1]&&s[1]==s[2]&&s[2]==s[3]){cout << "No";
return 0;}
if((s[0]==s[1]&&s[2]==s[3])||(s[0]==s[2]&&s[1]==s[3])||(s[0]==s[3]&&s[1]==s[2])){cout << "Yes";}
else cout << "No";
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
#include<string>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<vector>
#include<queue>
#include<map>
using namespace std;
#define pi acos(-1.0)
#define maxd 1000000007
typedef long long ll;
string s,t="keyence";

int read()
{
	int x=0,f=1;char ch=getchar();
	while ((ch<'0') || (ch>'9')) {if (ch=='-') f=-1;ch=getchar();}
	while ((ch>='0') && (ch<='9')) {x=x*10+(ch-'0');ch=getchar();}
	return x*f;
}

int main()
{
	cin >> s;
	int n=s.size(),i,j,k;
	if (s==t) {cout << "YES" << endl;return 0;}
	for (i=0;i<n;i++)
	{
		for (j=i;j<n;j++)
		{
			string now="";
			for (k=0;k<n;k++)
			{
				if ((k<i) || (k>j))
				{
					char ch=s[k];now=now+ch;
				}
			}
			if (now==t) {cout << "YES";return 0;}
		}
	}
	cout << "NO";
	return 0;
}
	


Measured memory_bytes: 256
//#pragma GCC optimize("O2")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define pb push_back
using namespace std;
using ll = long long;
using vi = vector<ll>;
const int maxn = 2e5 + 555;
using ld = long double;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n, m;
	vector<vi> g;
	cin >> n >> m;
	g.resize(n+1);
	for(int f, t, i = 0; i < m; i++) {
		cin >> f >> t;
		g[f].pb(t);
		g[t].pb(f);
	}
	queue<int> a;
	vi d(n+1, n+100);
	d[1] = 0;
	a.push(1);
	while(!a.empty()&&d[a.front()]<3) {
		int u = a.front();
//		cout << u << " " << d[u] << "\n";
		if(u==n) {
			cout << "POSSIBLE";
			return 0;
		}
		a.pop();
		for(auto i : g[u]) {
			if(d[i]!=n+100) continue;
			d[i] = d[u]+1;
			a.push(i);
		}
	}
	cout << "IMPOSSIBLE";
}


Measured memory_bytes: 14696
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
#define mp make_pair
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60) - 1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;
using Ki = vector<vector<int>>;
using Vi = vector<int>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------

    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    ll ans=0;
    rep(i,n) cin>>v[i];
    for(int i=0;i<=min(k,n);i++){
        for(int j=0;j+i<=min(k,n);j++){
            
            //cout<<i<<" "<<j<<" ";
            ll memo=0;
            vector<int> x(0);
            for(int l=0;l<i;l++){
                x.pb(v[l]);
                memo+=v[l];
            }
            for(int l=0;l<j;l++){
                x.pb(v[n-l-1]);
                memo+=v[n-l-1];
            }
            sort(all(x));
            for(int l=0;l<min((ll)(x.size()),k-(i+j));l++){
                if(x[l]<0){
                    memo-=x[l];
                }
                
            }
            //cout<<memo<<endl;
            ans=max(ans,memo);
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <cstdio>
#include <cstdlib>

#define STEP_MAX 1000000

using namespace std;

int main () {
  cin.tie(0);
  
  int H, W;
  cin >> H >> W;
  char map[H][W];
  int whites = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      cin >> map[i][j];
      if (map[i][j] == '.') whites++;
    }
  }
  int steps[H][W];  
  fill(steps[0], steps[H], STEP_MAX);
  queue< pair<int, int> > q;
  pair<int, int> p = make_pair(0, 0);
  q.push(p);
  
  steps[0][0] = 0;
  int step = 0;
  while(!q.empty()) {
    pair<int, int> c = q.front();
    q.pop();
    
    if (c.first == W-1 && c.second == H-1) break;
    
    int sx[] = {-1, 0, 0, 1};
    int sy[] = {0, -1, 1, 0};
    
    step = steps[c.second][c.first];
    
    for (int i = 0; i < 4; i++) {
      int nx = c.first + sx[i];
      int ny = c.second + sy[i];
      if (nx >= 0 && nx < W && ny >= 0 && ny < H) {
        if (map[ny][nx] == '.' && steps[ny][nx] == STEP_MAX) {
          pair<int, int> np = make_pair(nx, ny);
          q.push(np);
          steps[ny][nx] = step + 1;
        }
      }
    }
  }
  
  if (steps[H-1][W-1] != STEP_MAX) {
    cout << (whites - steps[H-1][W-1] - 1) << "\n";
  } else {
    cout << "-1\n";
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

int main() {
  string s;
  cin >> s;
  for(int i = 0; i<s.size(); i++) {
    if(s[i] == ',') cout << " " << flush;
    else cout << s[i] << flush;
  }
  cout << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
#include<string>
#include<utility>
#include<algorithm>
#include<vector>
#include<math.h>
#include<bits/stdc++.h>
#include<stdio.h>

int main(){
 int X;
 int Y;
 cin >> X >> Y;
 int num=0;
    if(X==1){
        num+=300000;
    }
    if(X==2){
        num+=200000;
    }
    if(X==3){
        num+=100000;
    }
    if(Y==1){
        num+=300000;
    }
    if(Y==2){
        num+=200000;
    }
    if(Y==3){
        num+=100000;
    }
    if(Y==1 && X==1){
        num+=400000;
    }
    cout << num;
}

Measured memory_bytes: 256
# ABC112B - Time Limit Exceeded
def main():
    N, T, *CT = map(int, open(0).read().split())
    cand = {c for c, t in zip(*[iter(CT)] * 2) if t <= T}
    flg = cand
    print(min(cand) if flg else "TLE")


if __name__ == "__main__":
    main()

Measured memory_bytes: 2940
#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 equals(a, b) (fabs((a) - (b)) < EPS)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
const ll mod = 1000000007;
//const ll mod = 998244353;
const int inf = 1e9 + 10;
const ll INF = 1e18;
const ld EPS = 1e-10;
const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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 (a>b) { a=b; return 1; } return 0; }



int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(25);

  int n;
  cin >> n;
  vector<vector<int>> ab(n, vector<int>(2));
  rep(i, n) cin >> ab[i][0];
  rep(i, n) cin >> ab[i][1];

  vector<vector<int>> dp((1 << n), vector<int>(51, inf));
  dp[0][0] = 0;
  rep(S, (1 << n)) {
    rep(maxv, 51) {
      if (dp[S][maxv] == inf) continue;
      int idx = 0;
      rep(i, n) if (S >> i & 1) idx++;
      rep(i, n) {
        if (S >> i & 1) continue;
        int p = abs(i - idx) % 2;
        int res = ab[i][p];
        if (res < maxv) continue;
        int cnt = 0;
        rep(j, i) {
          if (!(S >> j & 1)) cnt++;
        }
        chmin(dp[S | (1 << i)][res], dp[S][maxv] + cnt);
      }
    }
  }
  int ans = inf;
  rep(j, 51) chmin(ans, dp[(1 << n) - 1][j]);
  if (ans == inf) ans = -1;
  cout << ans << '\n';









  
  return 0;
}

Measured memory_bytes: 63872
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a[14] = {0,14,2,3,4,5,6,7,8,9,10,11,12,13};
  int x,y;cin >> x >> y;
  if(a[x]==a[y]){
    cout << "Draw" << endl;
    return 0;
  }
  cout << (a[x]>=a[y]?"Alice":"Bob") << endl;
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define MOD 998244353
#define N 200005
int n, k;
vector<pair<int, int>> d;
long dp[N], sumdp[N];
int dcnt = 0;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cin >> n >> k;
	d.reserve(k + 1);
	for (int i = 0; i < k; i++) {
		int s, e;
		cin >> s >> e;
		d.push_back({s, e});
	}
	dp[1] = 1;
	sumdp[1] = 1;
	for (int i = 2; i <= n; i++) {
		for (const auto& sect : d) {
			if (sect.first > i)	continue;
			int ubound= i - sect.first;
			int lbound = max(i - sect.second, 1);
			dp[i] = (dp[i] + MOD + sumdp[ubound] - sumdp[lbound - 1]) % MOD;
		}
		sumdp[i] = (sumdp[i - 1] + dp[i]) % MOD;
	}
	cout << dp[n] << '\n';

	return 0;
}


Measured memory_bytes: 6780
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <iomanip>
#include <map>
#include <set>
#include <cmath>
#include <cstdio>
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
#define All(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
    int N;cin >> N;
    vector<int> A(N);
    rep(i,N)cin>> A[i];
    vector<int> cnt(100010);
    int max_i=0;
    rep(i,N){
        cnt[A[i]]++;
        max_i=max(max_i,A[i]);
    }
    int res = 0,rest=0;
    rep(i,max_i+1){
        if(cnt[i]>=1)res++;
        if(cnt[i]>=2)rest+=cnt[i]-1;
    }
    if(rest%2)res--;
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <numeric>
#include <cmath>
#include <iomanip>
#include <deque>
#include <bitset>
#include <unordered_set>
#include <unordered_map>
#define ll              long long
#define PII             pair<int, int>
#define rep(i,a,b)      for(int  i=a;i<=b;i++)
#define dec(i,a,b)      for(int  i=a;i>=b;i--)
using namespace std;
int dir[4][2] = { { 0,1 } ,{ 0,-1 },{ 1,0 },{ -1,0 } };
const long long INF = 0x7f7f7f7f7f7f7f7f;
const int inf = 0x3f3f3f3f;
const double pi = 3.14159265358979323846;
const double eps = 1e-6;
const int mod =1e9+7;
const int N = 1e5+5;
//if(x<0 || x>=r || y<0 || y>=c)

inline ll read()
{
	ll x = 0; bool f = true; char c = getchar();
	while (c < '0' || c > '9') { if (c == '-') f = false; c = getchar(); }
	while (c >= '0' && c <= '9') x = (x << 1) + (x << 3) + (c ^ 48), c = getchar();
	return f ? x : -x;
}
ll gcd(ll m, ll n)
{
	return n == 0 ? m : gcd(n, m % n);
}
ll lcm(ll m, ll n)
{
	return m * n / gcd(m, n);
}
bool prime(int x) {
    if (x < 2) return false;
    for (int i = 2; i * i <= x; ++i) {
        if (x % i == 0) return false;
    }
    return true;
}
ll qpow(ll m, ll k, ll mod)
{
    ll res = 1, t = m;
    while (k)
    {
        if (k & 1)
            res = res * t % mod;
        t = t * t % mod;
        k >>= 1;
    }
    return res;
}      

int main()
{
    ll n,w;
    cin >> n >> w;
    vector<pair<ll, ll>> a(n + 1);
    vector<vector<ll>> dp(n + 1,vector<ll>(N));
    rep(i, 1, n)
    {
        cin >> a[i].first>>a[i].second;
    }
    rep(i, 1, 1e5)
    {
        dp[0][i] = inf;
    }
    rep(i, 1, n)
    {
        rep(j, 1, 1e5)
        {
            if ( j >=a[i].second)
                dp[i][j] = min(dp[i - 1][j],dp[i - 1][j-a[i].second] + a[i].first);
            else
                dp[i][j] = dp[i - 1][j];
        }
    }
    ll res = 0;
    dec(i,1e5,0)
    {
        if (dp[n][i] <= w)
        {
            res = i;
            break;
        }
    }
    cout << res << endl;
    return 0;
}



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

using namespace std;

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
#endif // ONPC
    int n;
    string s, t;
    cin >> n >> s >> t;
    for (int i = n; i >= 0; i--)
    {
        if (s.substr(n - i) == t.substr(0, i))
        {
            cout << 2 * n - i << '\n';
            return 0;
        }
    }
}


Measured memory_bytes: 256
//start of jonathanirvings' template v3.0.3 (BETA)

#include <bits/stdc++.h>
using namespace std;

typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
typedef pair<string,string> pss;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef vector<LL> vl;
typedef vector<vl> vvl;

double EPS = 1e-9;
int INF = 1000000005;
long long INFF = 1000000000000000005LL;
double PI = acos(-1);
int dirx[8] = {-1,0,0,1,-1,-1,1,1};
int diry[8] = {0,1,-1,0,-1,1,-1,1};

#ifdef TESTING
  #define DEBUG fprintf(stderr,"====TESTING====\n")
  #define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
  #define debug(...) fprintf(stderr, __VA_ARGS__)
#else
  #define DEBUG 
  #define VALUE(x)
  #define debug(...)
#endif

#define FOR(a,b,c) for (int (a)=(b);(a)<(c);++(a))
#define FORN(a,b,c) for (int (a)=(b);(a)<=(c);++(a))
#define FORD(a,b,c) for (int (a)=(b);(a)>=(c);--(a))
#define FORSQ(a,b,c) for (int (a)=(b);(a)*(a)<=(c);++(a))
#define FORC(a,b,c) for (char (a)=(b);(a)<=(c);++(a))
#define FOREACH(a,b) for (auto &(a) : (b))
#define REP(i,n) FOR(i,0,n)
#define REPN(i,n) FORN(i,1,n)
#define MAX(a,b) a = max(a,b)
#define MIN(a,b) a = min(a,b)
#define SQR(x) ((LL)(x) * (x))
#define RESET(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(),v.end()
#define ALLA(arr,sz) arr,arr+sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr,sz) sort(ALLA(arr,sz))
#define REVERSEA(arr,sz) reverse(ALLA(arr,sz))
#define PERMUTE next_permutation
#define TC(t) while(t--)

inline string IntToString(LL a){
  char x[100];
  sprintf(x,"%lld",a); string s = x;
  return s;
}

inline LL StringToInt(string a){
  char x[100]; LL res;
  strcpy(x,a.c_str()); sscanf(x,"%lld",&res);
  return res;
}

inline string GetString(void){
  char x[1000005];
  scanf("%s",x); string s = x;
  return s;
}

inline string uppercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'a' && s[i] <= 'z') s[i] = s[i] - 'a' + 'A';
  return s;
}

inline string lowercase(string s){
  int n = SIZE(s); 
  REP(i,n) if (s[i] >= 'A' && s[i] <= 'Z') s[i] = s[i] - 'A' + 'a';
  return s;
}

inline void OPEN (string s) {
  #ifndef TESTING
  freopen ((s + ".in").c_str (), "r", stdin);
  freopen ((s + ".out").c_str (), "w", stdout);
  #endif
}

//end of jonathanirvings' template v3.0.3 (BETA)

int n;
int data[300005];

int main()
{
  scanf("%d",&n);
  REP(i,3*n) scanf("%d",&data[i]);
  SORTA(data,3*n);
  REVERSEA(data,3*n);
  LL risan = 0;
  REP(i,n) risan += data[2*i+1];
  printf("%lld\n",risan);
  return 0;
}










Measured memory_bytes: 1536
#include <cstdio>
#include <iostream>
#include <vector>
#include <set>
#include <cstring>
#include <string>
#include <map>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <bitset>
#include <queue>
#include <sstream>
using namespace std;
#define mp make_pair
#define pb push_back
#define re return
#define fi first
#define se second
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef vector<string> vs;
typedef vector<vi> vvi;
int num[20],cnt,n;
int d[]={3,5,7,11,13,17,19};
int main() {
	cin>>n;
	for(int i=1;i<=n;i++){
		int nm=i,ncnt=1;
		memset(num,0,sizeof(num));
		for(int j=0;j<7;j++){
			int nncnt=0;
			while(nm%d[j]==0){
				nncnt++;
				nm/=d[j];
		    }
			ncnt*=(nncnt+1);
		}
		if(ncnt!=8|| i%2==0);
		else cnt++;
	}
	cout<<cnt<<endl;
    return 0;
}


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

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


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

typedef long long LL;
typedef pair<int, int> PII;
typedef vector<int> VI;
#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define RFOR(i, b, a) for(int i = (b) - 1; i >= (a); --i)
#define ITER(it, a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define ALL(a) a.begin(), a.end()
#define SZ(a) (int)((a).size())
#define FILL(a, value) memset(a, value, sizeof(a))
#define debug(a) cerr << #a << " = " << a << endl;

const double PI = acos(-1.0);
const LL INF = 1e9;
const LL LINF = INF * INF;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const int N = 1 << 18;
int n, k;
int a[N];
LL s[N];
int val[N];

int main()
{
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	//freopen("In.txt", "r", stdin);
	//freopen("Out.txt", "w", stdout);

	cin >> n >> k;
	FOR(i, 1, n + 1)
	{
		cin >> a[i];
		s[i] = s[i - 1] + a[i];
	}
	
	FOR(i, 1, n + 1) val[i] = ((s[i] - i) % k + k) % k;
	
	LL ans = 0;
	map<int, VI> mp;
	mp[0].PB(0);
	FOR(i, 1, n + 1)
	{
		VI& vec = mp[val[i]];
		auto it = lower_bound(ALL(vec), i - k + 1) - vec.begin();
		ans += SZ(vec) - it;
	//	cout << i << ' ' << SZ(vec) - it << endl;
		mp[val[i]].PB(i);
	}
	
	cout << ans << endl;	
	cerr << "Time elapsed: " << clock() / (double)CLOCKS_PER_SEC << endl;
	return 0;
}


Measured memory_bytes: 25984