akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>

using namespace std;

int lcs(string s1, string s2) {
    int c[1005][1005];
    int m = s1.length();
    int n = s2.length();
    s1 = " " + s1;
    s2 = " " + s2;
    int max1=0;
    for (int i = 0; i <= m; i++) {
        c[i][0] = 0;
    }
    for (int i = 0; i <= n; i++) {
        c[0][i] = 0;
    }
    for (int i = 1; i <= m; i++) {
        for (int j = 1; j <= n; j++) {
            if(s1[i]==s2[j]){
                c[i][j]=c[i-1][j-1]+1;
            }else{
                c[i][j]=max(c[i-1][j],c[i][j-1]);
            }
            max1=max(max1,c[i][j]);
        }
    }
    return max1;
}

int main() {
    int q;
    cin >> q;
    string s1, s2;
    for (int k = 0; k < q; k++) {
        cin >> s1;
        cin >> s2;
        cout<<lcs(s1,s2)<<endl;
    }

    return 0;
}

Measured memory_bytes: 7092
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <math.h> // sqrt
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
using namespace std;
using ll = long long;
using vi = vector<int>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
using pii = pair<int, int>;
using psi = pair<string, int>;

int main() {
    ll a, b;
    cin >> a >> b;
    if (a > 0) {
        cout << "Positive" << endl;
        return 0;
    }
    if (b < 0) {
        ll num = b - a;
        if (num % 2 == 0) {
            cout << "Negative" << endl;
        }
        else {
            cout << "Positive" << endl;
        }
        return 0;
    }
    cout << "Zero" << endl;
}

Measured memory_bytes: 3636
#include <iostream>
using namespace std;
#define MAX 2000000000
int dp[100000];
int main(){
  int N,K;cin>>N>>K;
  int A[N];
  for(int i = 0; N > i; i++){
    cin>>A[i];
  }
  for(int i = 0; N > i; i++){
    dp[i] = MAX;
  }
  dp[0] = 0;
  for(int i = 0; N > i; i++){
    for(int j = 0; min(K+i+1,N) > i+j+1; j++){
      dp[i+j+1] = min(dp[i+j+1],dp[i]+abs(A[i+j+1]-A[i]));
      //cout << i << " " << j << " " << i+j+1 << endl;
    }
  }
  cout << dp[N-1] << endl;
}

Measured memory_bytes: 1024
fun main(args: Array<String>) {
  val (n, k) = readLine()!!.split(" ").map { it.toInt() }
  if (k % 2 == 0) {
    val a = 1L * n / k
    val b = 1L * n / (k / 2) - a
    println(a * a * a + b * b * b)
  } else {
    val a = 1L * n / k
    println(a * a * a)
  }
}


Measured memory_bytes: 37828
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>

using namespace std;

int main(){
    int N;
    cin >> N;
    int A[2][N];
    for(int i = 0; i < 2; i++){
        for (int j = 0; j < N; j++){
            cin >> A[i][j];
        }
    }
    int c[N];
    int up = 0;
    int down = 0;
    for (int a = 0; a < N; a++){
        up = 0;
        down = 0;
        for(int i = 0; i <= a; i++){
            up += A[0][i];
        }
        for(int j = a; j < N; j++){
            down += A[1][j];
        }
        c[a] = (up+down);
    }
    sort(c,c+N,greater<int>());

    cout << c[0] << endl;

    return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.lang.*;

class Main
{
	public static void main (String[] args) throws java.lang.Exception
	{
    	Scanner in = new Scanner(System.in);
		
		try {
			while(in.hasNextDouble()) {
				// ax + by = c
				double a = in.nextDouble();
				double b = in.nextDouble();
				double c = in.nextDouble();
				// dx + ey = f
				double d = in.nextDouble();
				double e = in.nextDouble();
				double f = in.nextDouble();
				
    			double x = (c * e - b * f) / (a * e - b * d);
				double y = (a * f - c * d) / (a * e - b * d);
			
				if(x == 0.000) {
					x = 0.000;
				}
				if(y == 0.000) {
					y = 0.000;
				}
				
				System.out.printf(String.format("%.3f %.3f\n", x, y));
			}
		} catch(IllegalStateException ie) {
			// 入力失敗
			System.exit(0);
		}
	}
}

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

int main(void){
	double x;

	while(cin>>x){
		double sum = x;
		for(int i=0;i<9;i++){
			if(i % 2 == 0) x *= 2;
			else x /= 3;
			sum += x;
		}

		printf("%.8lf\n",sum);
	}

	return 0;
}

Measured memory_bytes: 0
#pragma GCC optimize(2)
#include<bits/stdc++.h>
#define ll long long
#define maxn 1000005
#define inf 1e9
#define eps 1e-10
using namespace std;

inline int read()
{
	int x=0,w=1; char c=getchar();
	while(c<'0'||c>'9') {if(c=='-') w=-1; c=getchar();}
	while(c<='9'&&c>='0') {x=(x<<1)+(x<<3)+c-'0'; c=getchar();}
	return w==1?x:-x;
}

int a[maxn];
double c[maxn],pre[maxn],ans;

int main()
{
	int n=read(),k=read();
	for(int i=1;i<=n;i++) a[i]=read(),c[i]=(1+(double)a[i])/2,pre[i]=pre[i-1]+c[i];
	for(int i=k;i<=n;i++) ans=max(ans,pre[i]-pre[i-k]);
	printf("%.8lf",ans);
	return 0;
}

Measured memory_bytes: 9984
import sys
sys.setrecursionlimit(1000000)
input = sys.stdin.readline
from bisect import *
from collections import *
from heapq import *
INF = 500000
mod = 10**9+7

A, B = map(int, input().split())
s1, s2 = set(), set()
for i in range(10000):
    if int(i*0.08) == A:
        s1.add(i)
    if int(i*0.10) == B:
        s2.add(i)
s = s1 & s2
if len(s) == 0:
    print(-1)
else:
    print(min(s))


Measured memory_bytes: 38768
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int compare_int(const void *a, const void *b)
{
//    return *(int*)a - *(int*)b;
    return *(long long*)a - *(long long*)b;
}
//  qsort(A, b, sizeof(int), compare_int);

long long  factorial(long long n) {
    if (n > 0) {
        return n * factorial(n - 1);
    } else {
        return 1;
    }
}

int main()
{
  int a ,b, c, d, e, X, Y;
  //long long  a, b, c, d, e, X, Y;
  //  double  c;
//  int  A[200003]={};
  long long  A[100003]={};
//  long long  B[100003]={};
  int  C[100003][11]={};

  int  flg=0;

//  long long  a, b, c, d, X, Y;
  char s[101][101]={};
  char t[101]={};
//  int N, M;
//  int A[1000000001]={};
//  long long  C[101]={};
  int i,j,k;
  long long p,q;
//  int flag=0;
//  int tmp=0;
  char tmp[101]={};
  long long min=10000000000;
//  long long min=100000001;
  int len=0;
  int l=0;
  int r=1000001;
  int cnt=0;
  int num=0;
  int num1=0;
  int num2=0;
  long long ans=1;
  int max=0;
  int addr=0;
  int ptn=0;
//  bool on_off[100]={};
  
//  char alp[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};

  //  a=0;
//  scanf("%lld %lld", &a, &b);
//  scanf("%d%d", &a,&c);
//  cnt = strlen(t);
// printf("%d\n",a);
  scanf("%s", &t);
  
//  for(i=0;i<2;i++){
//    if(t[0])
//  }
  if((t[0]==t[1])&&(t[0]==t[2])&&(t[0]==t[3]))  printf("No\n");
  else if((t[0]==t[1])&&(t[2]==t[3]))  printf("Yes\n");
  else if((t[0]==t[2])&&(t[1]==t[3]))  printf("Yes\n");
  else if((t[0]==t[3])&&(t[1]==t[2]))  printf("Yes\n");
  else printf("No\n");
  

    
//    printf("%s %d %d\n", s[i],C[i][0],C[i][1]);
   // printf("%d\n", C[i][1]);
/*  for(i=0;i<addr;i++){
//  scanf("%lld%lld", &B[0][i],&B[1][i]);
//    ans=ans+A[i];
    printf("%lld ", A[i]);
  }
*/
//    printf("%d ", cnt);
   
//  ans=a*3;
//  ans=(ans+b)/2;
//  printf("%d\n", ans);

  
//  printf("%lf\n",ans);
  //  //  if(flag==0)   printf("TLE\n");
//    if(max < cnt - max)  printf("Yes\n");
//    else  printf("No\n");
  
return 0;
}


Measured memory_bytes: 128
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <functional>
#include <iterator>
#include <limits>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstdint>
#include <cassert>

using namespace std;

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


void read_problem(vector<int>& ws)
{
    int n;
    scanf("%d\n", &n);

    ws.reserve(n);
    REP(i, n) {
        int w;
        scanf("%d", &w);
        ws.emplace_back(w);
    }
}

vector<int> get_ranks(const vector<int>& ws)
{
    vector<int> ranks(10000+1, -1);

    vector<int> bin(10000+1);
    for(int e : ws) {
        bin[e] = 1;
    }
    int rnk = 0;
    for(int i = 0; i <= 10000; ++i) {
        if(bin[i]) {
            ranks[i] = rnk++;
        }
    }

    return ranks;
}

int loop_cost(const vector<int>& loop, int min_global)
{
    int m = loop.size();
    int min_local = *min_element(loop.begin(), loop.end());

    int cost1 = accumulate(loop.begin(), loop.end(), 0) + (m-2)*min_local;
    int cost2 = accumulate(loop.begin(), loop.end(), 0) - min_local + min_global + (m-2)*min_global + 2*(min_local + min_global);

    return min(cost1, cost2);
}

int solve(const vector<int>& ws)
{
    int n = ws.size();

    vector<int> ranks = get_ranks(ws);
#if 0
    REP(i, ranks.size()) {
        if(ranks[i] >= 0)
            printf("%d %d\n", i, ranks[i]);
    }
#endif

    int min_global = *min_element(ws.begin(), ws.end());

    int cost = 0;
    vector<int> visited(n);
    REP(i, n) {
        if(visited[i]) continue;        // ????????????
        if(i == ranks[ws[i]]) continue; // ??¢?????£?????????????????????

        vector<int> loop;
        for(int j = i; ; ) {
            int e = ws[j];
            visited[j] = 1;
            loop.emplace_back(e);

            j = ranks[e];
            if(j == i) { // ???????????????
#if 0
                REP(k, loop.size()) {
                    printf("%d ", loop[k]);
                }
                puts("");
#endif
                cost += loop_cost(loop, min_global);
                break;
            }
        }
    }

    return cost;
}

int main()
{
    vector<int> ws;
    read_problem(ws);
    int n = ws.size();
#if 0
    REP(i, n) {
        printf("%d ", ws[i]);
    }
#endif

    int cost = solve(ws);
    printf("%d\n", cost);

    return 0;
}

Measured memory_bytes: 2836
#include <stdio.h>
#include <utility>
using namespace std;

int SelectionSort(int* temp, int size){

    int swaps = 0;

    for(int i = 0; i < size; i++){
            int mini = i;
        for(int j = i; j < size; j++){
            if(temp[j] < temp[mini]){
                mini = j;
            }
        }
        if(i != mini){
            swap(temp[i], temp[mini]);
            swaps++;
        }
    }
    return swaps;
}

int main(){
    int n;
    int *temp;
    int ans;
    
    scanf("%d",&n);
    
    temp = new int[n];
    
    for(int i = 0; i < n; i++){
        scanf("%d",temp + i);
    }
    
    ans = SelectionSort(temp, n);

    for(int i = 0; i < n; i++){
        printf("%d",temp[i]);
        if(i < n -1){
            printf(" ");
            
        }if(i == n - 1){
            printf("\n");
        }
    }
    printf("%d\n", ans);
    
    delete[] temp;

    return 0;
}



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

#define rng(i, a, b) for (int i = int(a); i < int(b); i++)
#define rep(i, b) rng(i, 0, b)
#define gnr(i, a, b) for (int i = int(b) - 1; i >= int(a); i--)
#define per(i, b) gnr(i, 0, b)

using namespace std;

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a.at(i);
  sort(a.begin(), a.end());
  vector<ll> sum(n);
  rep(i, n) {
    ll aa = (ll) a.at(i);
    if (i == 0) {
      sum.at(i) = aa;
    } else {
      sum.at(i) = sum.at(i - 1) + aa;
    }
  }
  int cur = -1;
  rep(i, n) {
    if (i == n - 1) {
      break;
    }
    if (sum.at(i) * 2 < a.at(i + 1)) {
      cur = i;
    }
  }
  int res = n - (cur + 1);
  cout << res << endl;
  return 0;
}


Measured memory_bytes: 4576
import java.util.*;
public class Main{
	public static void main(String[] args){
    	Scanner sc = new Scanner(System.in);
      int n = sc.nextInt();
      int[] a = new int[n];
      int k = 1;
      for(int i = 0;i < n;i++){
        a[i]=sc.nextInt();
        if(a[i]%2==0)k*=2;
      }
      System.out.println((int)Math.pow(3,n)-k);
    }
}

Measured memory_bytes: 21716
package main

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

const (
	initialBufSize = 100000
	maxBufSize     = 10000000
)

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

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

func nextInt() int {
	i, _ := strconv.Atoi(next())
	return i
}

func puts(a ...interface{}) {
	fmt.Fprintln(wt, a...)
}

func popcount(x int) int {
	res := 0
	for x > 0 {
		res += (x & 1)
		x >>= 1
	}
	return res
}

func main() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, initialBufSize), maxBufSize)
	defer wt.Flush()

	n, x := nextInt(), next()

	f := make([]int, 200001)
	for i := 1; i <= 200000; i++ {
		p := popcount(i)
		f[i] = f[i%p] + 1
	}
	pc := 0
	for i := range x {
		if x[i] == '1' {
			pc++
		}
	}
	if pc == 0 {
		for i := 0; i < n; i++ {
			puts(1)
		}
		return
	} else if pc == 1 {
		for i := 0; i < n; i++ {
			if x[i] == '1' {
				puts(0)
			} else if i == n-1 || x[n-1] == '1' {
				puts(2)
			} else {
				puts(1)
			}
		}
		return
	}

	// r[i]: 2^(n-1-i)を[pc-1, pc+1]で割ったあまり
	r := make([][2]int, n)
	// xr: xを[pc-1, pc+1]で割ったあまり
	xr := [2]int{}
	pow0, pow1 := 1, 1
	for i := n - 1; i >= 0; i-- {
		r[i][0], r[i][1] = pow0, pow1
		if x[i] == '1' {
			xr[0] += r[i][0]
			xr[0] %= pc - 1
			xr[1] += r[i][1]
			xr[1] %= pc + 1
		}
		pow0 *= 2
		pow0 %= pc - 1
		pow1 *= 2
		pow1 %= pc + 1
	}

	for i := 0; i < n; i++ {
		var xi int
		if x[i] == '0' {
			// 0 -> 1
			xi = (xr[1] + r[i][1]) % (pc + 1)
		} else {
			// 1 -> 0
			xi = (xr[0] - r[i][0] + pc - 1) % (pc - 1)
		}
		ans := 1 + f[xi]
		puts(ans)
	}
}


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

using namespace std;

int main(){
	int A;
	int B;
	int K;

	cin >> A >> B >> K;

	for (int k=0; k<K; k++){
		if (k % 2 == 0){
			if (A % 2 == 1){
				A = A - 1;
			}
			B += A/2;
			A /= 2;
		}
		else{
			if (B % 2 == 1){
				B = B - 1;
			}
			A += B/2;
			B /= 2;
		}
	}

	cout << A << " " << B << endl;
}

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

#define ll long long int
#define pii pair<int,int>

const ll sz=3010;
ll dp[sz][sz][4];
ll R,C;
ll ara[sz][sz];

ll cholo(ll r,ll c, ll rem)
{

    ll &ret=dp[r][c][rem];
    if(~ret) return ret;

    ll mx=0;
    if(rem>0) mx=ara[r][c];

    if(r+1<=R){
        if(rem>0) mx=max(mx, ara[r][c]+cholo(r+1,c,3));
        else mx=max(mx, cholo(r+1,c,3));
    }
    if(c+1<=C){
        if(rem>0) mx=max(mx, ara[r][c]+cholo(r,c+1,rem-1));
        mx=max(mx, cholo(r,c+1,rem));
    }

    return (ret = mx);
}

int main()
{
    ll n,m,i,j,k,x;

    cin>>R>>C>>k;

    for(i=1;i<=k;i++){
        cin>>n>>m>>x;
        ara[n][m]=x;
    }

    memset(dp,-1,sizeof dp);
    ll ans=cholo(1,1,3);
    cout<<ans<<'\n';
}


Measured memory_bytes: 357628
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    final BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    final String LINE_SPR = System.getProperty("line.separator");
    final int BIG_MOD = 1000000007;

    void run() throws Exception {
        while(true) {
            int n = ni();
            if(n == 0)
                return;

            int suma = 0, sumb = 0;
            for(int i = 0; i < n; i++) {
                String[] nums = ns().split(" ");
                int a = Integer.parseInt(nums[0]);
                int b = Integer.parseInt(nums[1]);
                if(a > b) {
                    suma += a + b;
                } else if(a < b) {
                    sumb += a + b;
                } else {
                    suma += a;
                    sumb += b;
                }
            }

            System.out.println(suma + " " + sumb);
        }
    }


    /*
     * Templates
     */
    void dumpObjArr(Object[] arr, int n) {
        for(int i = 0; i < n; i++) {
            System.out.print(arr[i]);
            if(i < n - 1)
                System.out.print(" ");
        }
        System.out.println("");
    }

    void dumpObjArr2(Object[][] arr, int m, int n) {
        for(int j = 0; j < m; j++) 
            dumpObjArr(arr[j], n);
    }

    int ni() throws Exception {
        return Integer.parseInt(br.readLine().trim());
    }

    long nl() throws Exception {
        return Long.parseLong(br.readLine().trim());
    }

    String ns() throws Exception {
        return br.readLine();
    }

    boolean isPrime(int n) {
        for(int i=2;i<n;i++) {
            if(n%i==0)
                return false;
        }
        return true;
    }

    int getPrime(int n) {
        List<Integer> primes = new ArrayList<Integer>();
        primes.add(2);
        int count = 1;

        int x = 1;
        while(primes.size() < n) {
            x+=2;
            int m = (int)Math.sqrt(x);
            for(int p : primes) {
                if(p > m) {
                    primes.add(x);
                    break;
                }

                if(x % p == 0) 
                    break;
            }
        }

        return primes.get(primes.size() - 1);
    }

    void gcjPrint(String str, int t) {
        System.out.println("Case #" + t + ": " + str);
    }

    public static void main(String[] args) throws Exception {
        new Main().run();
    }
}

Measured memory_bytes: 39244
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<queue>
#include<stack>
#include<list>

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    ll n;
    cin>>n;
    vector<ll> yakusu(n+1,2);
    yakusu[1] = 1;

    for(ll i=2;i<=n/2;i++){
        for(ll j=2;i*j<=n;j++){
            yakusu[i*j]++;
        }
    }

    ll ans = 0;
    for(ll i=1;i<=n;i++){
        ans += i*yakusu[i];
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 81376
import java.util.*;

import sun.font.TrueTypeFont;

import static java.lang.System.out;

public class Main{
   public static Scanner sc = new Scanner(System.in);
   public static void main(String args[]){
      int N = sc.nextInt();
      int sum = 0;
      while(N > 0) {
        sum += N % 10;
        N /= 10;
      }
      if (sum == 1){
        sum*= 10;
      }
      out.println(sum);
   }
}

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

using namespace std;

typedef unsigned int UI;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int,int> pii;
typedef pair<LL, LL> pll;

#define mp make_pair
#define pb push_back
#define fir first
#define sec second

#define fo0(i,a,b) for(int i=(a);i<(b);i++)
#define fo1(i,a,b) for(int i=(a);i<=(b);i++)
#define fd0(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define fd1(i,a,b) for(int i=(a);i>=(b);i--)
#define mset(a,b) memset(a,(b),sizeof(a))
#define mcpy(a,b) memcpy(a,b,sizeof(a))

#define max(a,b) (a > b ? a : b)
#define min(a,b) (a < b ? a : b)
#define abs(a) (a < 0 ? -a : a)
#define fabs(a) (a < 0 ? -a : 0)

template<typename T> inline void in(T &x){x=0;int fl=1;char ch=getchar();while(ch<'0'||ch>'9')
{if(ch=='-')fl=-1;ch=getchar();}while(ch>='0'&&ch<='9'){x=(x<<1)+(x<<3)+ch-'0';ch=getchar();}x*=fl;}
template<typename T> void out(T x){if(x<0){putchar('-');x=-x;}if(x/10)out(x/10);putchar(x%10+'0');}
template<typename T> inline void outln(T x){out(x);putchar(10);}
template<typename T> inline void outsp(T x){out(x);putchar(' ');}
template<typename T> inline T gcd(T a, T b){T t;if(a>b){while(b){
t=b;b=a%b;a=t;}return a;}else{while(a){t=a;a=b%a;b=t;}return b;}}
template<typename T> inline T lcm(T a, T b){return a/gcd(a,b)*b;}

int a, b;

int main(){
	in(a); in(b);
	if((a & 1) == 0)	puts("No");
	else if((b & 1) == 0)	puts("No");
	else	puts("Yes");
	return 0;
}

Measured memory_bytes: 256
// C - Poll
// mapはデフォルトでソートされているので辞書順出力に最適。
// 文字列をkeyに出現回数を計測し、最も多い文字列を出力。
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 0;
  string t;
  cin >> n;
  vs s(n);
  map<string, lli> vs;
  rep(i, 0, n)
  {
    cin >> s[i];
    vs[s[i]]++;
  }
  for (auto x : vs)
  {
    lli num = x.second;
    ans = max(ans, num);
  }
  for (auto x : vs)
  {
    lli num = x.second;
    if (num == ans)
    {
      cout << x.first << endl;
    }
  }
}

Measured memory_bytes: 25472
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int b_search(vector<int> &a, int n, int t, char ch)
{
	int low = 0, high = n;
	if(ch =='>')
	while(low<high)
	{
		int mid = low + (high - low )/2;
		if(a[mid]>t)
			high = mid;
		else low = mid+1;
	}
	else
		while(low<high)
		{
			int mid = low +(high-low)/2;
			if(a[mid]>=t)
				high = mid;
			else
				low = mid+1;
		}
	return low;

}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	vector<int> u(n),m(n),l(n);
	for(int i = 0; i<n; i++) cin>>u[i];
	for(int i = 0; i<n; i++) cin>>m[i];
	for(int i = 0; i<n; i++) cin>>l[i];
	sort(u.begin(),u.end());
	sort(l.begin(),l.end());
	ll ans = 0;
	for(int i = 0; i<n; i++)
	{
		ll y = b_search(u,n,m[i],'<');
		ll t = n-b_search(l,n,m[i],'>');
		ans += y*t;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1536
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#define INF 1000000009
#define LINF 1000000000000000009
#define all(a) a.begin(),a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
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; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }

ll mod = 1000000007;

ll fac[1000010];

ll modinv(ll a) {
	ll b = mod, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= mod;
	if (u < 0) u += mod;
	return u;
}

void modfac() {
	fac[0] = 1;
	for (ll i = 1; i < 1000010; i++) {
		fac[i] = (fac[i - 1] * i) % mod;
	}
}

ll modperm(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	else return (fac[n] * modinv(fac[n - k])) % mod;
}

ll modcomb(ll n, ll k) {
	if (n < 0 || k < 0 || n < k) return 0;
	else return ((fac[n] * modinv(fac[k])) % mod*modinv(fac[n - k])) % mod;
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<int> a(m);
	vector<string> s(m);
	for (int i = 0; i < m; i++) cin >> a[i] >> s[i];
	int ans = 0; int wa = 0;
	vector<bool> ok(100010);
	vector<int> cnt(100010);
	for (int i = 0; i < m; i++) {
		if (s[i] == "AC") {
			if (!ok[a[i]]) {
				wa += cnt[a[i]];
				ans++;
			}
			ok[a[i]] = true;
		}
		else {
			cnt[a[i]]++;
		}
	}
	cout << ans << ' ' << wa << endl;
}

Measured memory_bytes: 6528
#include <iostream>
#include <string>
#include <algorithm>
#include <stdlib.h>
#include <iomanip>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
//typedef long long unsigned int ll;
typedef long long ll;
typedef pair<ll, ll> edge;
typedef tuple<ll, ll, ll> tp;
 
int main() {
  ll h, w;
  cin >> h >> w;
  string S[h];
  for(int i=0; i<h; i++) cin >> S[i];
  //cout << S[0][0] << endl;
  
  int R[h][w];
  int L[h][w];
  int U[h][w];
  int D[h][w];
  for (int i=0;i<h;i++){
    if (S[i][w-1] == '.') R[i][w-1] = 1;
    else R[i][w-1] = 0;
    if (S[i][0] == '.') L[i][0] = 1;
    else L[i][0] = 0;
  }
  for (int i=0;i<w;i++){
    if (S[h-1][i] == '.') D[h-1][i] = 1;
    else D[h-1][i] = 0;
    if (S[0][i] == '.') U[0][i] = 1;
    else U[0][i] = 0;
  }
  
  for (int i=1;i<w;i++){
    for (int j=0;j<h;j++){
      if (S[j][w-1-i] == '.') R[j][w-1-i] = R[j][w-i] + 1;
      else R[j][w-1-i] = 0;
      if (S[j][i] == '.') L[j][i] = L[j][i-1] + 1;
      else L[j][i] = 0;
    }
  }
  for (int i=1;i<h;i++){
    for (int j=0;j<w;j++){
      if (S[h-1-i][j] == '.') D[h-1-i][j] = D[h-i][j] + 1;
      else D[h-1-i][j] = 0;
      if (S[i][j] == '.') U[i][j] = U[i-1][j] + 1;
      else U[i][j] = 0;
    }
  }
  
  int ans = 0;
  for (int i=0;i<h;i++){
    for (int j=0;j<w;j++){
      ans = max(ans, R[i][j] + L[i][j] + U[i][j] + D[i][j]);
    }
  }
  cout << ans - 3 << endl;
  
}

Measured memory_bytes: 66816
n = int(input())
l_d = {}
max_n = 0
max_w = []
for i in range(n):
    n = str(input())
    if n in l_d:
        l_d[n] += 1
        if l_d[n] > max_n:
            max_w = []
            max_w.append(n)
            max_n = l_d[n]
        elif l_d[n] == max_n:
            max_w.append(n)
    else:
        l_d[n] = 1
        if max_n <= 1:
            max_w.append(n)
            
max_w.sort()
for j in max_w:
    print(j)

Measured memory_bytes: 96984
#include <bits/stdc++.h>
using namespace std;
int main(){
    for(int i=0;i<3000;i++){
        int a,b,mi,ma;
        cin >> a >> b;
        
        if(a+b==0){
            i += 10000;
        }
        else{
            cout << min(a,b) << " " << max(a,b) << endl;
        }
    }
}


Measured memory_bytes: 3068
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>
#include<limits.h>
#include<float.h>
#include<list>
#include <array>
#include <complex>
#include<stdio.h>
#include<string.h>
#include <bitset>
// #include<assert.h>
#include<random>
using namespace std;
#define int long long

#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807LL
#define I64_MAX2 1223372036854775807LL
#define INF I64_MAX2
// #define MOD 1000000007
#define MOD 998244353 
#define MEM_SIZE 10000
#define DEBUG_OUT true
#define ALL(x) (x).begin(), (x).end()

template<typename T> void DEBUG(T e){if(DEBUG_OUT == false)return; std::cout << e <<" ";}
template<typename T> void DEBUG(const std::vector<T>& v){if(DEBUG_OUT == false)return;for(const auto& e : v){std::cout<< e << " "; } std::cout << std::endl;}
template<typename T> void DEBUG(const std::vector<std::vector<T> >& vv){if(DEBUG_OUT == false)return;for(const auto& v : vv){ DEBUG(v); } }
template<class T,class... Ts> void DEBUG(T d, Ts... e){if(DEBUG_OUT == false)return;DEBUG(d);DEBUG(e...);}
template <class T> void corner(bool flg, T hoge) {if (flg) {cout << hoge << endl; abort();}}
template< typename T1, typename T2 > inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template< typename T1, typename T2 > inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }


void solve2(void)
{
    int N;cin>>N;
    vector<int> vec (N,0);
    for (int i = 0; i < N; i++)
    {
       cin>>vec[i];
    }
    string str; cin>>str;
    vector<int> v2;
    for (int i = N-1; i >= 0; i--)
    {
      int V = vec[i];
      for (auto &&x : v2)
      {
          chmin(V,V^x);
      }
      if(V)
      {
        if(str[i] =='1')
        {
          cout<<1<<endl;
          return;
        }
        v2.push_back(V);
      }
    }
    cout<<0<<endl;
}

void solve(void)
{ 

  int Q; cin>>Q; 
  for (int q = 0; q < Q; q++)
  {
    solve2();
  }
  
  return;
}
int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  std::cout << std::fixed;
  std::cout << std::setprecision(11);
  solve();

  return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
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; }
const ll MOD = 1e9+7;

ll V[110];
ll SL[110];
ll SR[110];
int main(){
    int N, K;
    cin >> N >> K;
    REP(i,N){
        ll v;
        cin >> v;
        V[i] = v;
    }

    for(int i = 0; i < N; i++){
        SL[i] = V[i];
        if(i == 0) continue;
        SL[i] += SL[i-1];
    }

    for(int i = N-1; i >= 0; i--){
        SR[i] = V[i];
        if(i == N-1) continue;
        SR[i] += SR[i+1];
    }

    ll ans = 0;
    for(int k = 0; k <= K; k++){
        for(int left = 0; left <= k; left++){
            int rem = K - k;
            int right = k - left;
            if(right > N) continue;
            if(left > N) continue;
            if(left + right > N) continue;
            
            //right = N - right + 1;
            ll sr = 0;
            ll sl = 0;
            //if(right > 0) {
            //    sr = SR[N - right];
            //}
            //if(left > 0){
            //    sl = SL[left-1];
            //}

            priority_queue<ll, vector<ll>, greater<ll> > que;
            for(int i = 0; i < left; i++){
                ll v = V[i];
                sl += v;
                //printf("v:%d\n", v);
                if(v < 0) que.push(v);
            }
            for(int i = N-1; i >= N-right; i--){
                ll v = V[i];
                sr += v;
                //printf("v:%d\n", v);
                if(v < 0) que.push(v);
            }

            ll tmp = sl + sr;
            while(1){
                if(que.empty() || rem == 0){
                    break;
                }
                ll v = que.top();
                que.pop();
                tmp += -v;
                rem--;
            }
            //printf("k=%d, left=%d, right=%d, sl=%lld, sr=%lld, rem=%d, tmp=%lld\n", k, left, right,sl, sr,K-k, tmp);
            chmax(ans, tmp);
        }
    }

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


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

using namespace std;

using ll = long long;

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

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

    vector<pair<int, int>> op;

    int min_idx = -1, max_idx = -1;
    for (int i = 0; i < n; ++i) {
        if (min_idx == -1 || a[i] < a[min_idx]) min_idx = i;
        if (max_idx == -1 || a[i] > a[max_idx]) max_idx = i;
    }

    if (abs(a[min_idx]) <= abs(a[max_idx])) {
        for (int i = 0; i < n; ++i)
            if (i != max_idx) op.emplace_back(make_pair(max_idx, i));
        op.emplace_back(make_pair(max_idx, max_idx));
        for (int i = 0; i + 1 < n; ++i)
            op.emplace_back(make_pair(i, i + 1));
    }
    else {
        for (int i = 0; i < n; ++i)
            if (i != min_idx) op.emplace_back(make_pair(min_idx, i));
        op.emplace_back(make_pair(min_idx, min_idx));
        for (int i = n - 1; 0 < i; --i)
            op.emplace_back(make_pair(i, i - 1));
    }

    cout << op.size() << '\n';
    for (const auto &it: op)
        cout << it.first + 1 << ' ' << it.second + 1 << '\n';

    return 0;
}


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

const int N=1e5 +3;
int a[N];
map<int, int> mp;

int main(){

    int a, b, c, d, ans=0;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    if(a<=c){
        if(b<=c){
            ans=0;
        }
        else if(b>c&&b<=d){
            ans=b-c;
        }
        else if(b>c&&b>d){
            ans=d-c;
        }
    }
    else{
        if(d<=a){
            ans=0;
        }
        else if(d>a&&d<=b){
            ans=d-a;
        }
        else if(d>a&&d>b){
            ans=b-a;
        }
    }

    printf("%d", ans);


    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
      	//データ取り込み
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
      	if(N==1){
        	System.out.println("Hello World");
        }else if(N==2){
        	int A = sc.nextInt();
          	int B = sc.nextInt();
          	System.out.println(A+B);
        }
    }
}

Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define COUT(x) cout<<(x)<<endl
typedef long long ll;
template<class T> inline void chmax(T& a, T b) {
  if (a < b) a = b;
}

template<class T> inline void chmin(T& a, T b) {
  if (a > b) a = b;
}
const int MOD = 1000000007;
const long long INF = 1LL << 60;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  
  int a,b,c,k;
  cin >> a >> b >> c >> k;
  
  long long sum = 0;
  for (int i = 0; i < a; ++i) {
    sum++;
    k--;
    if (k == 0) {
      COUT(sum);
      return 0;
    }
  }
  for (int i = 0; i < b; ++i) {
    k--;
    if (k == 0) {
      COUT(sum);
      return 0;
    }
  }
  for (int i = 0; i < c; ++i) {
    sum--;
    k--;
    if (k == 0) {
      COUT(sum);
      return 0;
    }
  }
  COUT(sum);
  return 0;
}

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

int main() {
  long long int N, A, B;
  cin >> N >> A >> B;
  if(A==0) {
    cout << 0 << endl;
    return 0;
  }
  long long int C = (A+B);
  long long int ans = A*(N/C);
  if((N%C)>A) ans += A;
  else ans += (N%C);
  cout << ans << endl;
}


Measured memory_bytes: 256
n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [None] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [False] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] is None:
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")

Measured memory_bytes: 82848
#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main(){
	
	int n, ans = 0;
	cin >> n;

	for (int i = 0; i < n + 1; i++){
		if (i*i <= n){
			ans = i*i;
		}
		else{ break; }
	}
	cout << ans << endl;

	system("pause");
	return 0;
}

Measured memory_bytes: 504
def m():
    n = int(input())
    a = set()
    for i in range(100):
        tmp = 9 ** i
        if tmp > 100000:
            break
        a.add(tmp)
    for i in range(100):
        tmp = 6 ** i
        if tmp > 100000:
            break
        a.add(tmp)
    l = list(a)
    l.sort()
    dp = [0] * (n+1)
    dp[0] = 0
    for i in range(1,n+1):
        b = []
        for j in l:
            if j > i:
                break
            b.append(1 + dp[i-j])
        dp[i] = min(b)
    return dp[n]

print(m())

Measured memory_bytes: 3828
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<string>
#include<string.h>
#include<algorithm>
using namespace std;
#define ll long long
const int maxn = 2e5+10;
int n,m;
ll ans;
ll a[maxn];
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++) scanf("%lld",&a[i]);
	sort(a+1,a+1+n);
    n=n-m;
    for(int i=1;i<=n;i++) ans+=a[i];
    printf("%lld",ans);
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i = 0; i<n; i++)
int main()
{
	ll N;
	cin >> N;
	ll mod = 1000000007;
	ll a10,a8,a9;
	a10 = 1;
	a8 = 1;
	a9 = 1;
	for(int i = 0; i<N; i++){
		a10 = (a10*10)%mod;
		a9 = (a9*9)%mod;
		a8 = (a8*8)%mod;
/*		 while(mod < a10)
			 a10 = a10 - mod;
		while(mod < a9)
			a9 = a9 - mod;
		while(mod < a8)
			a8 = a8 - mod;	*/
	}


	ll ans = a10 + a8 - 2*a9;
	// cout << a10 << " " << a9 << " " << a8 << "\n";

	while(ans<0){
		ans = ans + mod;
	}

	cout << ans;
	cin >> N;
	
	return 0;	
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i = a; i < (b); ++i)
#define rrep(i,a,b) for(int i = b; i --> (a);)
#define all(v) v.begin(),v.end()
#define trav(x,v) for(auto &x : v)
#define sz(v) (int)(v).size()
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pii;

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	
	string s;
	cin >> s;
	int n = sz(s);
	rep(i,0,n-1) if(s[i]=='A' && s[i+1]=='C'){
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

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

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

        int N = scanner.nextInt();
        ArrayList<Integer> ary = new ArrayList<>();
        for (int i=0; i<N; i++){
            ary.add(scanner.nextInt());
        }
        int cnt = 0;
        for(int idx=0; idx<N; idx++){
            if(idx+1!=ary.get(idx)){
                cnt++;
            }
        }
        if(cnt==0|cnt==2){
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }

    }
}

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

int main()
{
    ll N,M;
    cin >> N >> M;

    ll timeSum = 1900 * M + 100 * (N-M);
    ll reversePropability = pow(2,M);

    cout << timeSum * reversePropability << endl;

    return 0;

}

Measured memory_bytes: 256
using System;

namespace C_sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split();

            var a = int.Parse(line[0]);
            var b = int.Parse(line[1]);
            var c = int.Parse(line[2]);

            if (a < b && b < c)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}



Measured memory_bytes: 15964
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <cstdio>
#include <cstring>
using namespace std;

int main()
{
    string s;
    cin >> s;
    cout << s.substr(0, 4) << " " << s.substr(4) << endl;
    return 0;
}

Measured memory_bytes: 892
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<-1<<endl;return 0
//ios::sync_with_stdio(false);
//<< setprecision(5)
const int mod=1000000007;
const llint big=4e18+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
int main(void){
	ios::sync_with_stdio(false);
	llint i,j,n,K,ans=big;cin>>n>>K;
	vector<llint>xset(n);
	vector<llint>yset(n);
	vector<pair<llint,llint>>pot(n);
	for(i=0;i<n;i++){
		llint x,y;cin>>x>>y;
		xset[i]=x;
		yset[i]=y;
		pot[i]=mp(x,y);
	}
	sort(xset.begin(),xset.end());
	sort(yset.begin(),yset.end());
	for(i=0;i<n;i++){
		for(j=0;j<n;j++){
			//開始点
			for(int a=i+1;a<n;a++){
				for(int b=j+1;b<n;b++){
					//終了店
					if(ans<=(xset[a]-xset[i])*(yset[b]-yset[j])){break;}
					int kazu=0;
					for(int q=0;q<n;q++){
						if(pot[q].fir<xset[i]){continue;}
						if(pot[q].fir>xset[a]){continue;}
						if(pot[q].sec<yset[j]){continue;}
						if(pot[q].sec>yset[b]){continue;}
						kazu++;
					}
					if(kazu>=K){ans=(xset[a]-xset[i])*(yset[b]-yset[j]);}
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 888
from copy import deepcopy
# 多次元配列を作成する
def make_multi_list(initial, degree):
    ans = [initial for _ in range(degree[-1])]
    for d in reversed(degree[:-1]):
        ans = [deepcopy(ans) for _ in range(d)]
    return ans

S = input().strip()
N = len(S)
MOD = 10**9+7
dp = make_multi_list(0, [N+1, 13])
dp[0][0] = 1

for i in range(N):
    c = S[i]
    ni = i + 1
    for j in range(13):
        if c == '?':
            for k in range(10):
                nj = (j * 10 + k) % 13
                dp[ni][nj] += dp[i][j]
                dp[ni][nj] %= MOD
        else:
            n = int(c)
            nj = (j * 10 + n) % 13
            dp[ni][nj] += dp[i][j]
            dp[ni][nj] %= MOD

print(dp[N][5] % MOD)


Measured memory_bytes: 74968
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
  ll gcd(ll a, ll b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}

ll lcm(ll a, ll b)
{
   return a / gcd(a, b)*b;
}
int main(){
  ll a,b,c=1;
  cin>>a;
  rep(i,a){
    cin>>b;
    c=lcm(b,c);
  }
  cout<<c;
  }


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

int N;
int A[100010];

int main ()
{
  cin >> N;
  for (int i = 0; i < N; i++) {
	cin >> A[i + 1];
  }
  int cur = 1;
  for (int i = 0; i < N; i++) {
  	cur = A[cur];
    if (cur == 2) {
      cout << i + 1 << endl;
      return 0;
    }
  }
  cout << -1 << endl;
  return 0;
}


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

const int N = 1000005, mod = 998244353;
typedef long long LL;

int n, k, factor[N], ifactor[N], ans;

int pow(int x, int y, int ans = 1) {
	for (; y; y >>= 1, x = (LL) x * x % mod)
		if (y & 1) ans = (LL) ans * x % mod;
	return ans;
}
void init(int n) {
	factor[0] = 1;
	for (int i = 1; i <= n; ++i) factor[i] = (LL) factor[i - 1] * i % mod;
	ifactor[n] = pow(factor[n], mod - 2);
	for (int i = n; i; --i) ifactor[i - 1] = (LL) ifactor[i] * i % mod;
}
int C(int x, int y) { return x < 0 || y < 0 ? 0 : (LL) factor[x + y] * ifactor[x] % mod * ifactor[y] % mod; }
int solve(int R, int B, int t) { return t <= 0 || B - R >= t ? 0 : (C(R, B) - C(R + t, B - t) + mod) % mod; }
void solve(int R, int B) {
	ans = (ans + (R == B ? solve(R, B - 1, B - n + 1) : solve(R, B, R - n + 1))) % mod;
}
int main() {
	std::ios::sync_with_stdio(0), std::cin.tie(0);
	std::cin >> n >> k, init(1000000);
	for (int R = k, B = 0; R >= B; --R, ++B) solve(R, B);
	std::cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 8064
#include "bits/stdc++.h"
#ifndef err
#define err(...)(void)0
#endif
using namespace std;
using ll = long long;
using ull = decltype(1ull);
template<class T>int size(T&&a) { return a.size(); }
#define REP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.first,_l##t=a.second;t<_l##t;t++)
#define RREP(t,a)for(typename make_signed<decltype(a.second)>::type t=a.second-1,_l##t=a.first;t>=_l##t;t--)
template<class B>pair<int, B>make_pair(B b) { return{ 0,b }; }
#define rep(t,...)REP(t,make_pair(__VA_ARGS__))
#define rrep(t,...)RREP(t,make_pair(__VA_ARGS__))
#define all(a)begin(a),end(a)
#define rall(a)a.rbegin(),a.rend()

void Calc();
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0); cin.exceptions(istream::failbit | istream::badbit);
  cout << fixed << setprecision(15); Calc(); cout.flush(); return 0;
}
template<class A>void amax(A&a, A b) { a = max(a, b); }
template<class A>void amin(A&a, A b) { a = min(a, b); }
struct Scanner {
  template<class A = string>A Next() { A a; cin >> a; return a; }
  template<class A = int>vector<A>Array(int n) { vector<A>a(n); for (A&i : a) cin >> i; return a; }
  string Line() { string s; getline(cin, s); return s; }
  template<class A>Scanner&operator,(A&a) { a = Next<A>(); return *this; }
  template<class A>operator A() { return Next<A>(); }
}in;

/*---------------------------------------------------------------------*/

void Calc() {

  int n = in;
  string s = in;
  string t = in;

  rep(i, n) {
    if (-1 != s.find(t.substr(0, n - i), i)) {
      cout << (n * 2 - (n - i)) << endl;
      return;
    }
  }
  cout << (n * 2) << endl;

}


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

using namespace std;

typedef long long ll;

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

	ll n, k;
	cin >> n >> k;

	ll ans = 1;
	ll t = 1;
	while(t * k <= n){
		t *= k;
		ans++;
	}

	cout << ans << endl;

}


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

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

# print(A)
# print(B)

# print(A * B)

# 条件を満たすような C が存在するなら Yes、そうでないなら No を出力せよ。

if (A * B) % 2 != 0:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 2940