akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <cstring>
using namespace std;
const int MAX = 16;
typedef long long ll;

struct Point{
  int x,y;
};

int main(){
  int tcase,n;
  ll dp[MAX][MAX];
  Point g,ps,pg;

  cin >> tcase;
  while(tcase--){
    memset(dp,0,sizeof(dp));

    cin >> g.x >> g.y;

    bool m[MAX][MAX][MAX][MAX];
    memset(m,false,sizeof(m));

    cin >> n;
    while(n--){
      cin >> ps.x >> ps.y >> pg.x >> pg.y;
      m[ps.y][ps.x][pg.y][pg.x] = true;
      m[pg.y][pg.x][ps.y][ps.x] = true;     
    }

    dp[0][0] = 1;

    for(int i = 0; i <= g.y ; i++){
      for(int j = 0 ; j <= g.x ; j++){
	if(i && !m[i][j][i-1][j]){
	  dp[i][j] += dp[i-1][j];
	}
	if(j && !m[i][j][i][j-1]){
	    dp[i][j] += dp[i][j-1];
	}
      }
    }

    if(!dp[g.y][g.x]){
      cout << "Miserable Hokusai!" << endl;
    }
    else{
      cout << dp[g.y][g.x] << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 1228
#include<stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    int Rt[n];
    for(int i = 0; i < n; i++) {
        scanf("%d", Rt + i);
    }

    int maxValue = Rt[1] - Rt[0];
    int min = Rt[0];

    for(int i = 0; i < n; i++) {
        if(Rt[i] < min) {
            min = Rt[i];
        } else {
            if((Rt[i] - min) > maxValue && i != 0) {
                maxValue = Rt[i] - min;
            }
        }
        
    }


    printf("%d\n", maxValue);

    return 0;
}

Measured memory_bytes: 3440
#include<iostream>
#include <cstring>
#include <vector>
#include <string>
#include <cstdlib>
#include <math.h>
#include <algorithm>

using namespace std;

bool isEven(string s){
  int len = s.length();
  if(len%2==1)return false;
  for(int i=0;i<len/2;i++){
    if(s[i]!=s[i+len/2])return false;
  }
  return true;
}

int main(){
  string s;
  cin >>s;
  string sub;
  int ans=0;
  for(int i=1;i<s.length();i++){
    sub =s.substr(0,s.length()-i);
    ans=i;
    if(isEven(sub))break;
  }
  cout <<sub.length()<<endl;

  return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdbool.h>

int main(void){
  int A,B,C,i;
  bool ok = false;
  scanf("%d%d%d",&A,&B,&C);
  for(i = 1 ; i <= B;i++){
    if(A*i % B == C){
      ok = true;
      break;
    }
  }
  if(ok) puts("YES");
  else puts("NO");
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;

int gcd(int a,int b){
    if(a > b) swap(a,b);
    if(b % a == 0) return a;
    return gcd(a, b%a);
}

bool isPrime(long long n){
    for(long long i=2;i*i<=n;i++){
        if(n%i == 0){
            return 0;
        }
    }
    return 1;
}

int factors(long long n){
    long long m=n;
    cout << n << ':';
    while(n>1){
        for(long long i=2;i*i<=m;i++){
            if(n % i == 0){
                n /= i;
                cout << ' ' << i;
                break;
            }
        }
        if(isPrime(n)){
            cout << ' ' << n;
            break;
        }
    }
    cout << endl;
    return 0;
}

int main() {
    int n;
    cin >> n;
    int a[n];
    int ans=0;
    for(int i=0;i<n;i++){
        cin >> a[i];
        if(isPrime(a[i])) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3148
#include <bits/stdc++.h>
// atoi : atoi(str.c_str())
using namespace std;
using vi = vector<int>;
using vb = vector<bool>;
using vc = vector<char>;
using vs = vector<string>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using pii = pair<int, int>;
#define fix10 cout << fixed << setprecision(10);
#define rep(i,n) for(int i=0; i<(int)(n);i++)

int main(){
  long n,k,q;
  cin >> n >> k >> q;
  vector<long> point(n,k-q);
  rep(i,q){
    long a;
    cin >> a;
    point.at(a-1)++;
  }
  rep(i,n){
    if(point.at(i) > 0) cout << "Yes" << endl;
    else cout << "No" << endl;
  }
}


Measured memory_bytes: 1408
#include <stdio.h>

int main(void)
{
    long N, A, B;
    long ans = 0;
    long amari = 0;
    
    scanf("%ld %ld %ld", &N, &A, &B);
    
    ans = A * (N / (A + B));
    amari = N % (A + B);
    
    if (amari < A) {
        ans += amari;
    } else {
        ans += A;
    }
    
    printf("%ld\n", ans);
    
    return 0;
}


Measured memory_bytes: 128
#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>
#include <numeric>
using namespace std;
#define INF 0x3f3f3f3f
#define INFLL 0x3f3f3f3f3f3f3f3fLL
//#define mod 998244353
#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;
//templete
int main() {
	vector<tuple<string,int,int>> vec;
	int N;
	cin>>N;
	for(int i=0;i<N;i++){
		string S;
		int P;
		cin>>S>>P;
		P*=-1;
		vec.pb(mt(S,P,i+1));
	}
	sort(vec.begin(),vec.end());
	for(int i=0;i<N;i++)
		cout<<get<2>(vec[i])<<endl;
    return 0;
}

Measured memory_bytes: 384
#include <stdio.h>
int main(void){
int a,b;
  scanf("%d",&a);
  scanf("%d",&b);
  if((a+b)>=(a-b)&&(a+b)>=(a*b)){printf("%d",a+b);}
  else if((a*b)>=(a-b)&&(a*b)>=(a+b)){printf("%d",a*b);}
  else if((a-b)>=(a*b)&&(a-b)>=(a+b)){printf("%d",a-b);}
return 0;
}

Measured memory_bytes: 128
package main

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

func solve() {
	n, m := getInt(), getInt()

	ans := (n - 2) * (m - 2)
	if n == 1 || m == 1 {
		if n == m {
			ans = 1
		} else {
			ans = max(n, m) - 2
		}
	}

	fmt.Fprintln(wr, ans)
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

// -----------------------------------------

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

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

func getIntSlice(n int) []int {
	is := make([]int, n)
	for i := range is {
		is[i] = getInt()
	}
	return is
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    int X, Y;
    cin >> X >> Y;
    cout << X + Y / 2 << endl;
}

Measured memory_bytes: 256
import java.io.*;

class Main {
	public static void main(String[] args){
		try{ 
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			String buf = br.readLine();
			
			int n = Integer.parseInt(buf);
			int [][] a = new int [4][13];
			
			for(int i = 0;i < n;i++){
				buf = br.readLine();
				String[] line = buf.split(" ");
				String mark = line[0]; 
				int s = Integer.parseInt(line[1]);
				if(mark.equals("S")){
					a[0][s-1] = 1;
				} else if (mark.equals("H")){
					a[1][s-1] = 1;
				} else if (mark.equals("C")){
					a[2][s-1] = 1;
				} else if (mark.equals("D")){
					a[3][s-1] = 1;
				}
			}
			
			
			for(int i = 0; i< 4;i++){
				for(int j = 0;j<13;j++){
					if(a[i][j] != 1){
						if( i == 0){
							System.out.print("S");
							System.out.println(" "+(j+1));
						}
						if( i == 1){
							System.out.print("H");
							System.out.println(" "+(j+1));
						}
						if( i == 2){
							System.out.print("C");
							System.out.println(" "+(j+1));
						}
						if( i == 3){
							System.out.print("D");
							System.out.println(" "+(j+1));
						}
					}
				}
			}
		} catch(Exception e){
		}
	}
}

Measured memory_bytes: 24280
import scala.io.StdIn._
import Math._

object Main extends App {
  val max = 100100100
  val Array(n, m) = readLine().split(" ").map(_.toInt)
  val dp = Array.fill(1 << n){max}
  dp(0) = 0
  for(_ <- 1 to m) {
    val Array(a, b) = readLine().split(" ").map(_.toInt)
    var c = readLine().split(" ").map(_.toInt).foldLeft(0)(_ | 1 << _ - 1)
    for(i <- (1 << n) - 1 to 0 by -1) {
      val j = i | c
      dp(j) = min(dp(j), dp(i) + a)
    }
  }
  val ans = dp((1 << n) - 1)
  println(if (ans == max) -1 else ans)
}

Measured memory_bytes: 31240
use std::io;

fn main() {
    
    loop {
        let (m, f, r) = input();
        if (m, f, r) == (-1, -1, -1) {
            break;
        }

        if m == -1 || f == -1 || m + f < 30 {
            println!("F");
        } else if m + f >= 80 {
            println!("A");
        } else if m + f >= 65 {
            println!("B");
        } else if m + f >= 50 || r >= 50 {
            println!("C");
        } else {
            println!("D");
        }
    }
}

fn input() -> (i32, i32, i32) {
    let mut s = String::new();
    io::stdin().read_line(&mut s).expect("");
    let mut iter = s.trim().split_whitespace();

    let m: i32 = iter.next().unwrap().parse().unwrap();
    let f: i32 = iter.next().unwrap().parse().unwrap();
    let r: i32 = iter.next().unwrap().parse().unwrap();

    (m, f, r)
}



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

using namespace std;

int main() {
  int n, k;
  cin >> n >> k;
  vector<int> h(n);

  for (int i = 0; i < n; i++) {
    cin >> h[i];
  }
  sort(h.begin(), h.end());

  int ans = 1000000009;
  for (int i = 0; i < n - k + 1; i++) {
    ans = min(ans, h[i + k - 1] - h[i]);
  }

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 640
N,K = map(int,input().split())
*A, = map(lambda x:(int(x)%K-1)%K,input().split())

class cumulative_sum:
    def __init__(self,A):
        N = len(A)
        self.S = [0]*(N+1)
        for i in range(N):
            self.S[i+1] = (self.S[i] + A[i])%K
    def get(self,i,j=None):
        if j==None:j=len(self.S)-1
        if j<=i:return 0
        return (self.S[j]-self.S[i])%K

SumA = cumulative_sum(A)

def binary_search(l,r,func):
    if func(l):return l-1
    if not func(r):return r
    while l+1<r:
        i = (l+r)//2
        if func(i):
            r = i
        else:
            l = i
    return l

def f(j):
    return cnt[s][j] > idx - K

ans = 0
cnt = {}
for idx,s in enumerate(SumA.S):
    if not s in cnt:
        cnt[s] = [-2*K]
    cnt[s].append(idx)
    l = len(cnt[s])
    j = binary_search(0,l-1,f)
    ans += (l-1)-(j+1)
print(ans)

Measured memory_bytes: 121520
#include<iostream>
#include<algorithm>
using namespace std;
 
long long  n, a[200010];

int main() {
	cin >> n;
	long long all = 0;
	for (int i = 0; i < n; i++) {
		cin >> a[i];
		all += a[i];
	}
	long long sunuke = 0;
	long long ans = 10000000000 * 200010;
	for (int i = 0; i < n - 1; i++) {
		sunuke += a[i];
		ans = min(ans, abs((all - sunuke) - sunuke));
	}
	cout << ans << endl;
	return 0;
}

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

int main(){
  int l,r,d;
  cin>>l>>r>>d;
  int ans=0;
  for(int i=l;i<=r;i++){
    if(i%d==0){
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 3604
#include <iostream>

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

using namespace std;

int main(){
	int n, place[200005], p, pre, x;
	long long int k, maxk;
	
	
	maxk = -1;
	k = 1;
	cin >> n;
	REP(i,n){
		cin >> p;
		p--;
		place[p] = i;
	}
	
	//REP(i,n) printf("%d ", place[i]);
	//cout << endl;
	
	REP(i,n-1){
		if (place[i+1]-place[i]>0) k++;
		else{
			if (k>maxk) maxk = k;
			k = 1;
		}
	}
	
	if (k>maxk) maxk = k;
	
	cout << n-maxk << endl;
	
	return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
const ll MOD = 1000000007;
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(2e5 + 5);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define ALL(v) (v).begin(), (v).end()

int main() {
    ll n, k, a[1005]{}, ans=0;
    vector<ll> v;
    cin >> n >> k;
    REP(i,n){
        cin >> a[i+1];
        a[i+1] += a[i];
    }
    REP(i,n){
        for(int j = i+1; j<=n; j++){
            v.push_back(a[j]-a[i]);
        }
    }
    for(int m=45; m>=0; m--){
        int cnt=0;
        vector<ll> tmp;
        for(ll i : v){
            if((i>>m)&1){
                cnt++;
                tmp.push_back(i);
            }
        }
        if(cnt>=k){
            ans += (1LL<<m);
            v = tmp;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 6128
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7


#############
# Main Code #
#############

N, K = getNM()
P = getList()
P.sort()
P = P[:K]
print(sum(P))

Measured memory_bytes: 77972
#include <bits/stdc++.h>
#define ll long long
#define ALL(x) x.begin(),x.end()
#define MOD (1000000000+7)
using namespace std;
#define PI 3.14159265359
#define tMOD 998244353
#define mkpr(x,y) make_pair(x,y)

int main(){
  ll H,A;
  cin>>H>>A;

  ll tmp = H/A;
  if(H%A!=0){
    tmp++;
  }
  cout<<tmp<<endl;
  
}

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

int main()
{
    unsigned long long n;
    cin>>n;
    unsigned long sum=0;
    for(unsigned long long i=1;i<=n;i++)
    {
	if(i%3==0 && i%5==0)
	    {
	    
	    }
	else if(i%3==0)
	    {
	    
	    
	    }
	else if(i%5==0)
	    {
	    
	    
	    }
	else
	{
	    sum+=i;
	}
    }


    cout<<sum;
    
    
    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
#define FAST ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
 
#define MAXX 10005
 
#define PI   3.14159265358979323846264338327950
 
#define F first
#define S second
 
#define ll 	 long long int
 
#define mod  1000000007



int main()
{
	FAST;
	ll n;
	cin >> n;
	ll a[n+3];
	for(ll i = 0; i < n; i ++){
		cin >> a[i];
		
	}
	sort(a, a + n);
	cout << a[n-1] - a[0];
	return 0;
}

Measured memory_bytes: 3644
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin>>n;
	int a[n][3];
	for(int i=0;i<n;i++){
		for(int j=0;j<3;j++){
			cin>>a[i][j];
		}
	}
	int dp[n][3]={0};
	for(int i=0;i<3;i++)
	dp[0][i]=a[0][i];
	for(int i=1;i<n;i++){
		for(int j=0;j<3;j++){
			if(j==0)
			dp[i][j]=(a[i][j]+max(dp[i-1][j+1],dp[i-1][j+2]));
		    if(j==1)
			dp[i][j]=(a[i][j]+max(dp[i-1][j-1],dp[i-1][j+1]));
		    if(j==2)
			dp[i][j]=(a[i][j]+max(dp[i-1][j-1],dp[i-1][j-2]));
		}
	}
	int m=-1;
	for(int i=0;i<3;i++){
		m=max(m,dp[n-1][i]);
	}
	cout<<m<<endl;
}

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

vector<int> A,M,ans;

bool solve(int l, int m) {
    bool ret = false;
    if (m == 0) {
        ret = true;
    } else if (m < 0 || l>=A.size()) {
        ret = false;
    } else {
        int solved = ans[l*2000 + m-1];
        if (solved == 1) {
            ret = true;
        } else if (solved == -1) {
            ret = false;
        } else {
            ret = (solve(l+1, m) || solve(l+1, m-A[l]));
        }
        ans[l*2000 + m-1] = ret ? 1 : -1;
    }

    return ret;
}
int main() {
    int n,q,i,j;
    cin>>n;
    A = vector<int>(n);
    for (i=0;i<n;i++) cin>>A[i];

    cin>>q;
    M = vector<int>(q);
    for (i=0;i<q;i++) cin>>M[i];

    ans = vector<int>(n*2000);
    for (i=0;i<n;i++) {
        for (j=0;j<2000;j++) {
            ans[i*2000+j] = 0;
        }
    }

    for (i=0;i<q;i++) {
        cout<< (solve(0,M[i]) ? "yes" : "no") <<endl;
    }

    return 0;
}


Measured memory_bytes: 3276
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef pair<int,int> P;
P pp[1000001];
int zyun[1000001];
int main(void)
{
	int i,j,cnt,leader,k,rest,wk,sum,mx,ll;
	int n,q,a,x,xx;
	int low,high,mid,l1,h1,m1;
	char buf[10];
	int lea[100],lzyun[100];
	
	scanf("%d %d",&n,&q);
	mx=-1;
	for(i=0;i<n;i++)	{
		scanf("%d",&pp[i].first);
		if(mx<pp[i].first)	mx=pp[i].first;
		pp[i].second=i+1;
	}
	sort(pp,pp+n);
	
	for(i=0;i<n;i++)	{
		zyun[pp[i].second]=i;
	}
	leader=0;
	for(i=0;i<q;i++)	{
		scanf(" %s %d",buf,&a);
//		printf("s=%s a=%d\n",buf,a);
		if(strcmp(buf,"ADD")==0)	{
			lea[leader]=a;
			leader++;
		}
		else if(strcmp(buf,"REMOVE")==0)	{
			for(j=0;j<leader;j++)	{
				if(lea[j]==a)	{
					xx=j;
					break;
				}
			}
			for(j=xx;j<leader-1;j++)	{
				lea[j]=lea[j+1];
			}
			leader--;
		}
	
		else {
			if(leader==0 && n-a==0)	{
				printf("0\n");
			}
			else if(leader==0 && n-a!=0)	{
				printf("NA\n");
			}
			else {
				for(j=0;j<leader;j++)	{
					lzyun[j]=zyun[lea[j]];
				}
				for(j=0;j<leader-1;j++)	{
					for(k=j+1;k<leader;k++)	{
						xx=pp[lzyun[j]].first;
						x=pp[lzyun[k]].first;
						if(xx>x)	{
							wk=lzyun[j];
							lzyun[j]=lzyun[k];
							lzyun[k]=wk;
						}
					}
				}
				for(j=leader-1;j>=0;j--)	{
					while(1)	{
						if(lzyun[j]+1<n && pp[lzyun[j]].first==pp[lzyun[j]+1].first)	lzyun[j]++;
						else break;
					}
				}
//				for(j=0;j<leader;j++)	{
//					printf("zyun=%d\n",lzyun[j]);
//				}
				
				
				
				if(n-(lzyun[leader-1]+1)>a)	{
					printf("NA\n");
				}
				else {
					low=0;
					high=mx+1;
					while(low<=high)	{
						mid=(low+high)/2;
//						printf("low=%d mid=%d high=%d\n",low,mid,high);
						sum=0;
						for(j=0;j<leader;j++)	{
							if(j==0)	{
								l1=0;
							}
							else {
								l1=lzyun[j-1]+1;
							}
							ll=l1;
							h1=lzyun[j];
							wk=pp[lzyun[j]].first;
//							printf("j=%d wk=%d\n",j,wk);
							while(!(l1>h1))	{
								m1=(l1+h1)/2;
//								printf("m1=%d le=%d\n",pp[m1].first,wk);
								if(pp[m1].first>=wk-mid)	{
									h1=m1-1;
								}
								else {
									l1=m1+1;
								}
							}
							
//							printf("l1=%d\n",lzyun[j]-h1);
						
							sum+=lzyun[j]-h1;
						}
//						printf("sum=%d\n",sum);
						if(sum>=n-a)	{
							high=mid-1;
						}
						else {
							low=mid+1;
						}
					}
					printf("%d\n",low);
				}
			}
		}
	}
	return 0;
}


Measured memory_bytes: 12756
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

ll Pow(ll n, ll k) {
	ll ans = 1, a = n % MOD;
	while (k > 0) {
		if (k & 1) {
			ans *= a;
			ans %= MOD;
		}
		a *= a;
		a %= MOD;
		k >>= 1;
	}
	return ans;
}

ll Inverse(ll a) {
	return Pow(a, MOD - 2);
}

ll Combi(ll n, ll k) {
	k = min(k, n - k);
	if (k == 0)
		return 1;
	ll i, ans = 1;
	for (i = 1; i <= k; i++) {
		ans *= n--;
		ans %= MOD;
		ans *= Inverse(i);
		ans %= MOD;
	}
	return ans;
}

int main(void) {
	ll gx, gy, x, y, ans;
	cin >> gx >> gy;
	if ((2 * gx - gy) % 3 != 0 || (2 * gy - gx) % 3 != 0 || 2 * gx - gy < 0 || 2 * gy - gx < 0) {
		printf("0\n");
		return 0;
	}
	x = (2 * gx - gy) / 3;
	y = (2 * gy - gx) / 3;
	ans = Combi(x + y, x);
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 384
// 2019/03/06 Tazoe

#include <iostream>
using namespace std;

void DFS(int M[102][203], int Y, int X)
{
	if(M[Y][X]!=0)
		return;

	M[Y][X] = 2;

	if(Y>0)  DFS(M, Y-1, X);
	if(X>0)  DFS(M, Y, X-1);
	if(Y<101)  DFS(M, Y+1, X);
	if(X<202)  DFS(M, Y, X+1);
}


int main()
{
	int W, H;
	cin >> W >> H;

	int M[102][203] = { {0} };

	for(int y=1; y<=H; y++){
		for(int x=1; x<=W; x++){
			int m;
			cin >> m;

			if(y%2==1){
				M[y][2*x] = M[y][2*x+1] = m;
			}
			else{
				M[y][2*x-1] = M[y][2*x] = m;
			}
		}
	}

	DFS(M, 0, 0);
/*
	for(int y=0; y<=H+1; y++){
		for(int x=0; x<=2*W+2; x++){
			cout << M[y][x];
		}
		cout << endl;
	}
*/
	int cnt = 0;

	for(int y=0; y<=H+1; y++){
		for(int x=0; x<2*W+2; x++){
			if(M[y][x]+M[y][x+1]==3){
				cnt++;
			}
		}
	}

	for(int x=0; x<=2*W+2; x++){
		for(int y=0; y<H+1; y++){
			if(M[y][x]+M[y+1][x]==3){
				cnt++;
			}
		}
	}

	cout << cnt << endl;

	return 0;
}



Measured memory_bytes: 4644
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

constexpr int kMax = 1e5 + 1;
LL dp[kMax][13];

int main() {
  std::string S; std::cin >> S;
  int L = S.length();
  for (int i = 0; i < L - 1; ++i)
    for (int j = 0; j < 13; ++j)
      dp[i][j] = 0;

  if (S[L-1] == '?') {
    for (int j = 0; j < 10; ++j) dp[L-1][j] = 1;
    for (int j = 10; j < 13; ++j) dp[L - 1][j] = 0;
  } else {
    for (int j = 0; j < 13; ++j) dp[L-1][j] = 0;
    int n = S[L-1] - '0';
    dp[L-1][n] = 1;
  }

  int offset = 1;
  for (int pos = L - 2; pos >= 0; --pos) {
    offset = (offset*10)%13;
    if (S[pos] == '?') {
      for (int n = 0; n < 10; ++n) {
        for (int j = 0; j < 13; ++j) {
          int new_index = (n*offset + j)%13;
          dp[pos][new_index] += dp[pos+1][j];
          dp[pos][new_index] %= kMod;
        }
      }
    } else {
      int n = S[pos] - '0';
      for (int j = 0; j < 13; ++j) {
        int new_index = (n*offset + j)%13;
        dp[pos][new_index] += dp[pos+1][j];
        dp[pos][new_index] %= kMod;
      }
    }
  }

#if 0
  std::cout << "\t";
  for (int j = 0; j < 13; ++j) {
      std::cout << j << "\t";
  }
  std::cout << std::endl;
  for (int pos = L - 1; pos >= 0; --pos) {
    std::cout << S[pos] << "\t";
    for (int j = 0; j < 13; ++j) {
      std::cout << dp[pos][j] << "\t";
    }
    std::cout << std::endl;
  }
#endif
  std::cout << dp[0][5] << std::endl;
}


Measured memory_bytes: 10624
#include<cstdio>
#include<string>
#include<cstring>

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

using namespace std;

string solve(const string &s){
	int n=s.length();
	static int dp[2001][2001],from[2001][2001];

	rep(i,n+1) dp[i][0]=dp[0][i]=0, from[i][0]=from[0][i]=-1;

	rep(i,n) rep(j,n) if(i+j<=n) {
		if(s[i]==s[n-j-1]){
			dp[i+1][j+1]=dp[i][j]+1;
			from[i+1][j+1]=2;
		}
		else{
			if(dp[i][j+1]<dp[i+1][j]){
				dp[i+1][j+1]=dp[i+1][j];
				from[i+1][j+1]=1;
			}
			else{
				dp[i+1][j+1]=dp[i][j+1];
				from[i+1][j+1]=0;
			}
		}
	}

	int len=0,i_len[2];
	for(int i=1;i<n;i++){
		int tmp=2*dp[i][n-i];
		if(len<tmp){
			len=tmp;
			i_len[0]=i;
			i_len[1]=n-i;
		}

		tmp=2*dp[i][n-i-1]+1;
		if(len<tmp){
			len=tmp;
			i_len[0]=i;
			i_len[1]=n-i-1;
		}
	}

	int idx=dp[i_len[0]][i_len[1]];
	string ans(idx,'@');
	for(int i=i_len[0],j=i_len[1];~from[i][j];){
		switch(from[i][j]){
			case 0: i--; break;
			case 1: j--; break;
			case 2: i--; j--; idx--; ans[idx]=s[i]; break;
		}
	}
	if(len%2==1) ans+=s[i_len[0]];
	rep(i,len/2) ans+=ans[len/2-i-1];

	return ans;
}

int main(){
	for(char s[2001];~scanf("%s",s);) puts(solve(s).c_str());
	return 0;
}

Measured memory_bytes: 0
/*
                                                                                                                                               
8b        d8                           888888888888                                             88b           d88                  ad88888ba   
 Y8,    ,8P                                 88                                        ,d        888b         d888                 d8"     "8b  
  Y8,  ,8P                                  88                                        88        88`8b       d8'88                 ""      a8P  
   "8aa8"  ,adPPYba,   88       88          88  8b,dPPYba,  88       88  ,adPPYba,  MM88MMM     88 `8b     d8' 88   ,adPPYba,          ,a8P"   
    `88'  a8"     "8a  88       88          88  88P'   "Y8  88       88  I8[    ""    88        88  `8b   d8'  88  a8P_____88         d8"      
     88   8b       d8  88       88          88  88          88       88   `"Y8ba,     88        88   `8b d8'   88  8PP"""""""         ""       
     88   "8a,   ,a8"  "8a,   ,a88          88  88          "8a,   ,a88  aa    ]8I    88,       88    `888'    88  "8b,   ,aa         aa       
     88    `"YbbdP"'    `"YbbdP'Y8          88  88           `"YbbdP'Y8  `"YbbdP"'    "Y888     88     `8'     88   `"Ybbd8"'         88       
                                                                                                                                               
*/
#include <bits/stdc++.h>
using namespace std;

int n, d, a[15][15];
bool square[1010101];

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

	// freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);

	cin >> n >> d;
	for (int i = 1; i <= 1000; i++) {
		square[i * i] = 1;
	}

	int ans = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < d; j++) {
			cin >> a[i][j];
		}

		for (int j = 0; j < i; j++) {
			int sum = 0;
			for (int k = 0; k < d; k++) {
				sum += (a[i][k] - a[j][k]) * (a[i][k] - a[j][k]);
			}

			if (square[sum]) ans++;
		}
	}

	cout << ans << '\n';

	return 0;
} 

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

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

  const int n = s.size();
  const int m = t.size();

  int min = 100100100;
  for (int i = n - m; i >= 0; i--) {
    for (int j = 0; j < m; j++) {
      int sum = j;
      for (int k = j; k < m; k++) {
        if (s.at(i + k) != t.at(k)) {
          sum++;
        }
      }
      if (sum < min) {
        min = sum;
      }
    }
  }

  cout << min << endl;

  return 0;
}

Measured memory_bytes: 3604
import java.util.Scanner;

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


        double maxSum = 0;
        int maxIndex = 0;

        int[] input = new int[size];
        for (int i = 0; i < size; i++) {
            input[i] = scanner.nextInt();
            if (i < selected) {
                maxSum += input[i];
            }
        }

        double currentSum = maxSum;
        for (int i = 0; i < size - selected; i++) {
            currentSum += input[i + selected];
            currentSum -= input[i];
            if (maxSum < currentSum) {
                maxSum = currentSum;
                maxIndex = i + 1;
            }
        }

        double answer = 0;
        for (int i = maxIndex; i < maxIndex + selected; i++) {
            double current = input[i];
            double sum = (current * (current + 1)) / 2 / current;
            answer += sum;
        }
        System.out.println(answer);
    }
}

Measured memory_bytes: 81800
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
using namespace std;
const int mod = 1000000007;
#define ll long long

ll Xor(ll N)
{
	N++;
	if (N == 0) return 0;
	if (N % 2 == 0) {
		if ((N - 1) / 2 % 2 == 0) {
			return 1;
		}
		else {
			return 0;
		}
	}
	else {
		if ((N - 1) / 2 % 2 == 0) {
			return N - 1;
		}
		else {
			return N - 1 ^ 1;
		}
	}
}
int main()
{
	ll A, B;
	cin >> A >> B;
	ll n1 = Xor(A - 1);
	ll n2 = Xor(B);
	ll ans = n1 ^ n2;
	cout << ans << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

def keisan(n):
    s = 1
    cnt = 0
    while n > 0:
        n -= s
        cnt += 1
        s += 1

    if n < 0: return cnt-1
    else: return cnt

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


N = int(input())

if N == 1:
    print(0)
    exit()

F = factorization(N)

ans = 0
for f in F:
    ans += keisan(f[1])

print(ans)




Measured memory_bytes: 9500
#include <bits/stdc++.h>
#define P pair<int,int>
#define All(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
typedef long long ll;
using namespace std;
const int INF = 1e9, MOD = 1e9 + 7;
const ll LINF = 1e18;
int main() {
	long long n, m;
	cin >> n >> m;
	if (abs(n - m) == 0) {
		long long ans1 = 1, ans2 = 1;
		for (long long i = n; i > 0; i--) {
			ans1 *= i;
			ans1 %= MOD;
		}
		for (long long i = m; i > 0; i--) {
			ans2 *= i;
			ans2 %= MOD;
		}
		cout << (2 * (ans1 * ans2) % MOD) % MOD << endl;
	} else if (abs(n - m) == 1) {
		long long ans1 = 1, ans2 = 1;
		for (long long i = n; i > 0; i--) {
			ans1 *= i;
			ans1 %= MOD;
		}
		for (long long i = m; i > 0; i--) {
			ans2 *= i;
			ans2 %= MOD;
		}
		cout << (ans1 * ans2) % MOD << endl;
	} else {
		cout << 0 << endl;
		return 0;
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {

	public void doIt(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		while( n != 0){
			int [] list = new int[30+1];
			list[0] = 1;
			for(int i=0; i <= 30; i++){
				for(int j =1; j <= 3; j++){
					if(i - j >= 0){
						list[i] += list[i-j];
					}
				}
			}
			int result = list[n];
			result = result / 10;
			result = result / 365 + 1;
			System.out.println(result);
			n = sc.nextInt();
		}
		
	}
	public static void main(String[] args) {
		Main obj = new Main();
		obj.doIt();

	}

}

Measured memory_bytes: 12000
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <queue>
#include <vector>

using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <class T>
using vv = vector<vector<T>>;

#define in(v) \
  v;          \
  cin >> v;
// #define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f, c, ...)                                 \
  (([&](decltype((c)) cccc) {                          \
    return (f)(begin(cccc), end(cccc), ##__VA_ARGS__); \
  })(c))
#define _overload3(_1, _2, _3, name, ...) name
#define _rep(i, n) for (int i = 0, _i = (n); i < _i; ++i)
#define repi(i, a, b) for (int i = (a), _i = (b); i < _i; ++i)
#define rep(...) _overload3(__VA_ARGS__, repi, _rep, )(__VA_ARGS__)

#define rrep(i, n) for (int i = (n); i >= 0; --i)
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -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 (b < a) {
    a = b;
    return 1;
  }
  return 0;
}

// debug
template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
  os << "{";
  for (size_t i = 0; i < vec.size(); ++i) os << (i ? ", " : "") << vec[i];
  os << "}";
  return os;
}
ostream& operator<<(ostream& os, const vector<char>& v) {
  for (size_t i = 0; i < v.size(); ++i) os << v[i];
  return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& rhs) {
  os << "(" << rhs.first << ", " << rhs.second << ")";
  return os;
}

#ifdef LOCAL
void debug() { cerr << "\n"; }
template <class First>
void debug(const First& first) {
  cerr << first << "\n";
}
template <class First, class... Rest>
void debug(const First& first, const Rest&... rest) {
  cerr << first << ",";
  debug(rest...);
}
#else
#define debug(...) 42
#endif

int main() {
  int in(N);
  int in(M);
  int sum = 0;
  rep(i, M) {
    int in(a);
    sum += a;
  }
  if (sum > N) cout << "-1\n";
  else
    cout << N - sum << endl;

  return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    for(int i = 0; i < 100000; i++){
        if(i*8/100 == a && i/10== b){
            cout << i << endl;
            return 0;
        }
    } 
    cout << -1 << endl;
    return 0;  
}

Measured memory_bytes: 256
#include <stdio.h>
int fib(int);
int main()
{
  int n,re;
  scanf("%d",&n);
  if(n>=2)
    re=fib(n);
  else re=1;
  printf("%d",re);
  printf("\n");
  return 0;
}
fib(int n)
{
  int A[44],i,re;
  A[0]=1;
  A[1]=1;
  for(i=2;i<=n;i++)
    A[i]=A[i-2]+A[i-1];
  re=A[n];
  return re;
}



Measured memory_bytes: 2108
#include<iostream>
#include<algorithm>
#include<cmath>
#include<map>
#include<stdio.h>
#include<vector>
using namespace std;
#define rep(s,i,n) for(int i=s;i<n;i++)
#define c(n) cout<<n<<endl;
#define ic(n) int n;cin>>n;
#define sc(s) string s;cin>>s;
#define mod 1000000007
#define F first
#define s second
#define int long long		
int a[214514];
int b[214514];
signed main(){
	int g,d,e;
	cin>>g>>d>>e;
	if(d+e-g>0){
		cout<<d+e-g<<endl;
	}
	else{
		cout<<0<<endl;
	}		
}	

Measured memory_bytes: 256
<?php

fscanf(STDIN, "%d %d %d %d", $a, $b, $c, $k);

$xa = min($a, $k);
$k = max(0, $k - $xa);

$xb = min($k, $b);
$k = max(0, $k - $xb);

$xc = $k;

echo $xa * 1 + $xb * 0 + $xc * -1;


Measured memory_bytes: 16156
#include<stdio.h>

int main() {
    int N, i, l, r, d, c = 0;
    i = scanf("%d", &N);
    for (i = 0; i < N; i++) {
        d = scanf("%d %d", &l, &r);
        c += r - l + 1;
    }
    printf("%d\n", c);
}


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

// Function Macros:
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define all(v) (v).begin(), (v).end()
#define setpre(n) cout << fixed << setprecision(n)

// Type / Class / Struct Definitions:
using namespace std;

using ll = long long;
using ull = unsigned long long;

// Constants:
const int INF = (1ll << 30) - 1;  // approx 1.07e9
const ll INFLL = 1ll << 60;       // approx 1.15e18
const int MOD = 1e9 + 7;          // 998244353
const long double EPS = 1.0e-14;

// Global Variables:

// Prototype Declarations:
int gcd(int, int);
template <class T>
inline bool chmin(T&, T);
template <class T>
inline bool chmax(T&, T);

// ================ Main Loop ================
int main() {
    string t;
    cin >> t;

    rep(i, t.size()) {
        if(t[i] == '?') {
            cout << "D";
        } else {
            cout << t[i];
        }
    }
    cout << "\n";
    return 0;
}
// ===========================================

// Functions:
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}

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

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


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

int main(void){

	int n;
	char s[10001];
	int i;
	int l;

	scanf("%d",&n);
	scanf("%s",s);

	l = strlen(s);

	for(i=0;i<l;i++){
		s[i] = s[i] + n;
		if(s[i] > 'Z'){
			s[i] = s[i] -26;
		}
	}

	printf("%s\n",s);


	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <iomanip>
#include <stack>
#include <fstream>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
using namespace std;
typedef int64_t ll;
typedef uint64_t ull;
constexpr uint64_t L1 = 1ull;
constexpr ull bit(int n){ return 1ull << n;}

void solve(istream& cin) {
    ll N, M, R;
    while(cin >> N >> M >> R){
        vector<ll> r;
        for (int i = 0; i < R; ++i) {
            ll tmp;
            cin >> tmp;
            tmp--;
            r.push_back(tmp);
        }
        vector<vector<ll>> P(N, vector<ll>(N, INT32_MAX));
        for (int l = 0; l < N; ++l) {
            P[l][l] = 0;
        }
        for (int i = 0; i < M; ++i) {
            ll a, b, c;
            cin >> a >> b >> c;
            a--;b--;
            P[a][b] = c;
            P[b][a] = c;
        }
        for (int k = 0; k < N; ++k) {
            for (int i = 0; i < N; ++i) {
                for (int j = 0; j < N; ++j) {
                    P[i][j] = min(P[i][j], P[i][k] + P[k][j]);
                }
            }
        }
        ll minid = INT32_MAX;
        sort(r.begin(), r.end());
        do{
            ll d = 0;
            for (int i = 1; i < r.size(); ++i) {
                d += P[r[i]][r[i-1]];
            }
            if(minid > d){
                minid = d;
            }
        }while(next_permutation(r.begin(), r.end()));

        cout << minid << endl;

    }
}

int main(int argc, char *argv[]) {
    string FileName("D1"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    if(sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size()-ExecutionName.size(), ExecutionName.size());
//    cerr << sub << endl;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        solve(cin);
    }
    else {
        string inFile = "sample.txt";
        auto fs = fstream(inFile, fstream::in);
        solve(fs);
    }
}

Measured memory_bytes: 640
S = input()
T = input()
S1 = list(S)
T1 = list(T)
a = 0
b = 0

for i in range(len(S1)-len(T1)+1):
    if i == 0:
        for j in range(len(T1)):
            if S1[j] != T1[j]:
                a = a + 1
    else:
        for j in range(len(T1)):
            if S1[j+i] != T1[j]:
                b = b + 1
        if b < a:
            a = b
    b = 0

print(a)

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

string a[222222];
li n;

inline bool check_axis(li offset) {
    rep(i, n) {
        rep(j, n) {
            li now_x = (i + offset) % n;
            li now_y = j;
            li transposed_x = (j + offset) % n;
            li transposed_y = i;
            if (a[now_y][now_x] != a[transposed_y][transposed_x]) {
                return false;
            }
        }
    }
    return true;
}

int main() {
    cin >> n;
    rin{cin >> a[i];}

    li res = 0;
    rin{
        if (check_axis(i)) {
            res += n;
        }
    }
    cout << res << endl;

    return 0;
}

Measured memory_bytes: 2176
#include <iostream> 
using namespace std; 
int main(){
    string S;
    cin >> S;
    int L = S.size();
    string ans = "AC";
    if(S[0] != 'A'){
ans = "WA"; 
}
    int cnt = 0;
    for(int i = 1; i < L; ++i){
        if(isupper(S[i])){
            if(i == 1 || i == L - 1 || S[i] != 'C'){
ans = "WA"; 
}
++cnt; 
}
    }
    if(cnt != 1){
ans = "WA"; 
}
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <cmath>
#include <map>
#include <string.h>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>

using namespace std;
#define set_precision cout << fixed << setprecision(10)
#define rep(i, a, b) for (int i = a; i < b; i++)
#define repb(i, a, b) for (int i = a; i >= b; i--)
#define vi vector<int>
#define vl vector<long long int>
#define Vi vector<vector<int>>
#define vpi vector<pair<int,int>>
#define seti set<int>
#define setl set<ll>
#define dseti set<int, greater<int>>
#define dsetl set<ll, greater<ll>>
#define mseti multiset<int>
#define msetl multiset<ll>
#define dmseti multiset<int, greater<int>>
#define dmsetl multiset<ll, greater<ll>>
#define sortA(arr) sort(arr.begin(), arr.end())
#define dsortA(arr) sort(arr.begin(), arr.end(), greater<ll>())
#define ssort(arr) stable_sort(arr.begin(), arr.end())
#define nth(v,n) nth_element(v.begin,v.begin+n-1,v.end())
#define dnth(v,n) nth_element(v.begin,v.begin+n-1,v.end(), greater<ll>())
#define init(a)  memset((a),0,sizeof(a))
#define pi pair<int,int>
#define pb push_back
#define pl pair<ll,ll>
#define ll long long
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
long double EPS = 1e-9;

/*struct comp {
  bool operator() (const int& lhs, const int& rhs) const
  {return lhs<rhs;}
};*/

ll cel(ll a,ll b){return((a-1)/b+1);} 
ll gcd(ll a, ll b){
    if (a < b)swap(a, b);
    return (b == 0)? a: gcd(b, a % b);
}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}
ll po(ll x,ll y){
    ll ans=1;
    while(y){
        if(y&1){ans=(ans*x)%mod;}
        y>>=1;x=(x*x)%mod;
    }
    return ans;
}

int main()
{
    FIO;
    ll n,t,x,y;
    cin>>n>>x>>t;
    cout<<(cel(n,x))*t;
    return 0;
}

Measured memory_bytes: 3648
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <math.h>
#include <vector>
#include <stdio.h>
#include <fstream>
#include <iostream>
#include <string.h>
#include <limits.h>
#include <algorithm>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>

#define N 100010
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define inf 1000000007
#define pii pair <int, int>
#define all(x) x.begin(), x.end()
#define FOR(i, x, y) for (int i = x; i <= y; i++)

using namespace std;

int n, m;
int x;

ll sm, ans;

map <int, int> M;

int main()
{
	cin >> n >> m;
	
	M[0]++;
	for (int i = 1; i <= n; i++) {
		cin >> x, sm+=x, sm%=m;
		ans += M[sm];
		M[sm]++;
	}
	
	cout << ans;
}


Measured memory_bytes: 3200
import java.util.Scanner;

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

		try (Scanner sc = new Scanner(System.in)) {
		int N = Integer.parseInt(sc.next());
		int A = Integer.parseInt(sc.next());
		int B = Integer.parseInt(sc.next());
		
		System.out.println(Math.min(A * N, B)); 
	} // Scanner Close

	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <functional>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define mk make_pair

template <class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
const ll mod = 1e9 + 7;


void solve()
{
    ll n;
    cin>>n;
    ll ans=1000*(n/500);
    n%=500;
    ans+=(5*(n/5));
    cout<<ans<<endl;
}

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

    // ll t;
    // cin >> t;

    // while (t--)
    // {
    //     solve();
    // }
    solve();
    return 0;
}

Measured memory_bytes: 256
# https://atcoder.jp/contests/abc101/tasks/arc099_a
# C - Minimization
import math
N, K = list(map(int, input().split()))
a_list = list(map(int, input().split()))

min_x = min(a_list)
min_x_i_list = [i for i, a in enumerate(a_list) if a == min_x]

c = 0

# 最初のi
start_x_i = min_x_i_list[0]
# 最初に左側を、できるだけ無駄がでないようにして埋める
if start_x_i + 1 < K:
    index = K - 1
    c += 1
else:
    x = math.ceil(start_x_i / (K - 1))
    index = (K - 1) * x
    c += x

while index < N - 1:  # 10 ** 5
    # index < j <= index + Kの範囲にmin_xがいるか
    next_min_list = [y for y in min_x_i_list if (index < y) and y <= (index + K)]
    if next_min_list:
        index += K
        c += 1
    else:
        index += K - 1
        c += 1

print(c)

Measured memory_bytes: 13812
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;

int main(){
    string s;
    cin >> s;
    int ans = 700;
    for(int i = 0; i < s.size(); i++){
        if(s[i] == 'o'){
            ans += 100;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.util.*;
import java.math.*;
class Main
{ 
	public static int M = 1000000007;
    public static void main(String[] args)throws IOException
    {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        PrintWriter out = new PrintWriter(System.out);
        String s = br.readLine();
        int sum=0;
        for(int i=0;i<s.length();i++)
            sum+=Character.getNumericValue(s.charAt(i));
        if(Integer.parseInt(s)%sum==0)
            out.println("Yes");
        else
            out.println("No");
        out.flush();
    }
    /** Loops
    *	i: for(int i=0;i<n;i++)
    *	j: for(int j=0;j<n;j++)
    *	k: for(int k=0;k<n;k++)

    *	ArrayList<Integer> arr1 = new ArrayList<>();
    
    * 	HashMap
    *	HashMap<Integer, Integer> hm = new HashMap<>();
    * 	for (Map.Entry<String,String> entry : hm.entrySet()) 
    		out.println(entry.getValue());
    
    *	Count frequencies
    	for(int i=0;i<n;i++)
        {
            Integer c = hm.get(Integer.parseInt(s[i]));
            if(c==null)
                hm.put(Integer.parseInt(s[i]),1);
            else
                hm.put(Integer.parseInt(s[i]),++c);
        }
	**/		
    public static long modularExpo(long x,long n,int M)
	{
		long result=1;
		while(n>0)
		{
		    if(n%2==1)
		        result=(result*x)%M;
		    x=(x*x)%M;
		    n=n/2;
		}	
		return result;												
	}
	//FLT, only when a and M are co-prime
	public static long modInverse(int a,int M)
	{
		long g = gcd(a,M);
		if(g!=1)
			return -1;
	    return modularExpo(a,M-2,M);
	}
	public static long gcd(int a, int b) 
	{
	    if(b==0)
	        return a;
	    else
	        return gcd(b, a % b);
	}
}

Measured memory_bytes: 21204
import itertools
n,m,x=map(int, input().split())
a = [list(map(int, input().split())) for l in range(n)]
bit=list(itertools.product([0,1],repeat=n))
M=10**7
for i in range(2**n):
  cnt1=[0]*m
  cnt2=0
  for j in range(n):
    if bit[i][j]==1:
      cnt2+=a[j][0]
      for k in range(m):
        cnt1[k]+=a[j][k+1]
  ans=True
  for j in range(m):
    if cnt1[j]<x:
      ans=False
  if ans:
    M=min(cnt2,M)
if M==10**7:
  print(-1)
else:
  print(M)

Measured memory_bytes: 9580