akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using P = pair<ll, ll>;

// chmin, chmax関数
template<typename T, typename U, typename Comp=less<>>
bool chmax(T& xmax, const U& x, Comp comp={}) {
    if(comp(xmax, x)) {
        xmax = x;
        return true;
    }
    return false;
}
template<typename T, typename U, typename Comp=less<>>
bool chmin(T& xmin, const U& x, Comp comp={}) {
    if(comp(x, xmin)) {
        xmin = x;
        return true;
    }
    return false;
}

// Yes-Noを出力する問題で楽をする
void Ans(bool f){
    if(f) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main(){
    ll h,w,m; cin >> h >> w >> m;
    VL th(h,0), tw(w,0);
    VL sh(m), sw(m);

    rep(i,m){
        cin >> sh[i] >> sw[i];
        sh[i]--; sw[i]--;
        th[sh[i]]++; tw[sw[i]]++;
    }

    ll hmax=0, wmax=0;
    VL Hs, Ws;
    rep(i,h){
        if(th[i] > hmax){
            hmax = th[i];
            Hs = {i};
        }else if(th[i] == hmax){
            Hs.push_back(i);
        }else{
            continue;
        }
    }
    rep(i,w){
        if(tw[i] > wmax){
            wmax = tw[i];
            Ws = {i};
        }else if(tw[i] == wmax){
            Ws.push_back(i);
        }else{
            continue;
        }
    }

    ll ans = hmax + wmax;
    ll poss = (ll)Hs.size() * (ll)Ws.size();
    sort(Hs.begin(), Hs.end());
    sort(Ws.begin(), Ws.end());

    rep(i,m){
        if(binary_search(Hs.begin(), Hs.end(), sh[i])){
            if(binary_search(Ws.begin(), Ws.end(), sw[i])){
                poss--;
            }
        }
    }

    if(poss <= 0) ans--;
    
    cout << ans << endl;

    return 0;
}

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

#define endl '\n'

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

    long long n,k; cin >> n >> k;
    long long ans = 0;
    for (long long i=k; i<=n+1; i++){
        long long low = i*(i-1)/2, high;
        high = n*(n+1)/2 - (n-i)*(n-i+1)/2;
        ans = (ans + (high - low + 1)) % 1000000007LL;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3608
package main

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

const (
	bufsiz = 1024 * 1024
)

func main() {
	writer := newWriter(os.Stdout)
	defer writer.Flush()

	sc := newScanner(os.Stdin)
	n := sc.scanInt()
	m := sc.scanInt()
	places := make([]int, m)

	for i := 0; i < m; i++ {
		places[i] = sc.scanInt()
	}

	sort.Ints(places)

	distances := make([]int, m-1)

	var vPrev int

	for i, v := range places {
		if i == 0 {
			vPrev = v
			continue
		}
		distances[i-1] = abs(v - vPrev)
		vPrev = v
	}

	sort.Ints(distances)

	result := 0

	for i := 0; i < m-n; i++ {
		result += distances[i]
	}

	writer.println(result)
}

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

func mapContains(m map[int]int, sum int) map[int]int {
	for key, value := range m {
		if value == sum {
			delete(m, key)
		}
	}

	return m
}

// contains returns:
// if s contains e, true. / if s not contains e, false.
func sliceContains(s []int, e int) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}

type scanner struct {
	*bufio.Scanner
}

func newScanner(r io.Reader) *scanner {
	s := bufio.NewScanner(r)
	s.Split(bufio.ScanWords)
	return &scanner{s}
}

func (s *scanner) scanStr() string {
	s.Buffer(make([]byte, bufsiz), bufsiz)
	if !s.Scan() {
		panic("scan failed")
	}
	return s.Text()
}

func (s *scanner) scanInt() int {
	if !s.Scan() {
		panic("scan failed")
	}
	i, err := strconv.Atoi(s.Text())
	if err != nil {
		panic(err)
	}
	return i
}

func (s *scanner) scanFloat() float64 {
	if !s.Scan() {
		panic("scan failed")
	}
	i, err := strconv.ParseFloat(s.Text(), 5)
	if err != nil {
		panic(err)
	}
	return i
}

type writer struct {
	*bufio.Writer
}

func newWriter(wr io.Writer) *writer {
	w := bufio.NewWriter(wr)
	return &writer{w}
}

func (w *writer) printf(f string, args ...interface{}) (int, error) {
	return fmt.Fprintf(w, f, args...)
}

func (w *writer) println(args ...interface{}) (int, error) {
	return fmt.Fprintln(w, args...)
}


Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
using namespace std;
typedef long long Int;
typedef pair<Int,Int> P;
Int s[55]={0};
Int memo[55];
void set_size(Int n){
  for(Int i=0;i<n;i++){
    s[i+1]=s[i]*(Int)2+(Int)3;
    memo[i]=0;
  }
}
Int get_ba(Int n,Int k){
  if(n==0) return 1;
  if(memo[n]!=0&&k==s[n]) return memo[n];
  Int mid=(s[n]+1)/2;
  Int ret=0;
  if(mid>k&&k>1) ret=get_ba(n-1,k-1);
  if(mid==k) ret=get_ba(n-1,mid-2)+(Int)1;
  if(mid<k) ret=get_ba(n-1,mid-2)+(Int)1+get_ba(n-1,min(k,s[n]-1)-mid);
  if(k==s[n]) memo[n]=ret;
  return ret;
}
int main(){
  Int n,x;
  cin>>n>>x;
  s[0]=1;
  set_size(n);
  cout<<get_ba(n,x)<<endl;
}


Measured memory_bytes: 256
#include<cstdio>
#include<algorithm>
using namespace std;
int main(){
    int n,m,d[200001],t[200000],j=0,i,flag=1;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        scanf("%d",&d[i]);
    }
    scanf("%d",&m);
    for(int i=0;i<m;i++){
        scanf("%d",&t[i]);
    }
    sort(d,d+n);
    sort(t,t+m);
    d[n]=t[m-1]+1;
    i=0;
    while(i<m){
        if(t[i]==d[j]){
            i++;
            j++;
        }
        else if(t[i]>d[j]){
            j++;
        }
        else{
            flag=0;
            break;
        }
    }
    if(flag){
        printf("YES\n");
    }
    else{
        printf("NO\n");
    }
}

Measured memory_bytes: 1664
use std::io;

fn main() {
    let mut input = String::new();

    io::stdin().read_line(&mut input).unwrap();

    let input = input.trim();
    let mut s = vec!();

    for c in input.chars() {
        s.push(c);
    }

    s.sort();

    let res = if s[0] == s[1] && s[1] != s[2] && s[2] == s[3] {
        "Yes"
    } else {
        "No"
    };

    println!("{}", res);
}


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

//for
#define REP(i,n) for(int i=0,i##_len=(int)(n);i<i##_len;i++)
#define REPS(i,n) for(int i=1,i##_len=(int)(n);i<=i##_len;i++)
#define RREP(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define RREPS(i,n) for(int i=(int)(n);i>0;i--)

//printf
#define PRINTD(d) printf("%d\n",(d))
#define PRINTS(s) printf("%s\n",(s))

//memset
#define m0(s) memset(s,0,sizeof(s))
#define ml(s) memset(s,63,sizeof(s))
#define fill(s,c) memset(s,c,sizeof(s))

typedef long long ll;


int main() {
	int N;
	int C[500], S[500], F[500];
	int t[500];
	scanf("%d", &N);
	REP(i, N-1) {
		scanf("%d %d %d", &C[i], &S[i], &F[i]);
	}
	t[N-1] = 0;
	REP(i, N-1) {
		t[i] = S[i]+C[i];
		for (int j = i+1; j < N - 1; j++) {
			if (t[i] < S[j]) {
				t[i] = S[j] + C[j];
			}
			else {
				t[i] += (F[j]-(t[i] % F[j]))%F[j]+C[j];
			}
		}
	}
	REP(i, N) {
		PRINTD(t[i]);
	}
}

Measured memory_bytes: 128
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int cnt = 0;
        int n = sc.nextInt();
        long S[] = new long[n];
        for(int i = 0 ; i < n ; i++)
            S[i] = sc.nextLong();
        int q = sc.nextInt();
        long T[] = new long[q];
        for(int i = 0 ; i < q ; i++)
            T[i] = sc.nextLong();
        for(int i = 0 ; i < q ; i++){
            int start = 0;
            int end = n-1;
            while(true){
                if(S[start] == T[i] || S[end] == T[i]){
                    cnt++;
                    break;
                }
                int c = (start + end) / 2;
                if(S[c] == T[i]){
                     cnt++;
                     break;
                }
                else if(S[c] < T[i])
                    start = c;
                else
                    end = c;
                if(end - start == 1)
                    break;
            }
        }
        System.out.println(cnt);
    }
}


Measured memory_bytes: 80740
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;
int X,Y,A,B,C;
vector<int> p,q,r;

int main()
{
  int i;
  int pi, qi, ri;
  int ai;
  long long int sum=0;
  
  cin >> X >> Y >> A  >> B >> C;

  p.resize(A);
  for (i=0; i<A; i++) {
    cin >> p[i];
  }
  sort(p.begin(), p.end(), greater<int>());
  q.resize(B);
  for (i=0; i<B; i++) {
    cin >> q[i];
  }
  sort(q.begin(), q.end(), greater<int>());
  r.resize(C);
  for (i=0; i<C; i++) {
    cin >> r[i];
  }
  sort(r.begin(), r.end(), greater<int>());

  /*
  for (i=0; i<A; i++) {
    printf("p[%d] = %d\n", i, p[i]);
  }
  for (i=0; i<B; i++) {
    printf("q[%d] = %d\n", i, q[i]);
  }
  for (i=0; i<C; i++) {
    printf("r[%d] = %d\n", i, r[i]);
  }
    */

  for (pi=X-1, qi = Y-1, ri = 0; ;) {
    if (pi<0 && qi<0) break;
    if (pi >= 0 && (qi < 0 || p[pi] < q[qi])) {
      if (p[pi] < r[ri]) {
        p[pi] = r[ri];
        ri++;
        if (ri>=C) break;
        pi--;
      } else {
        break;
      }
    } else if (qi >= 0) {
      if (q[qi] < r[ri]) {
        q[qi] = r[ri];
        ri++;
        if (ri>=C) break;
        qi--;
      } else {
        break;
      }
    }
  }
  for (pi=X-1; pi >= 0; pi--) {
    sum += p[pi];
  }
  for (qi=Y-1; qi >= 0; qi--) {
    sum += q[qi];
  }

  printf("%lld\n", sum);

  return 0;
}


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

#define ll long long
const int mod = 1e9+7;
ll power(ll a,ll b){
    ll res=1;
    while(b){
        if(b&1)res=res*b%mod;
        b>>=1;
        a=a*a%mod;

    }
    return res;
}
int main(){
    string s[11]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
    string in;
    cin>>in;
    int i;
    for(i=0;i<7;i++)if(in==s[i])break;
    cout<<7-i;



}


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

int main() {
 
   
        long long n,i,j,k,sum=0,count=0,ans=0;
        cin>>n>>k;
        j=__gcd(n,k);
        cout<<(n*k)/j;
        
       

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
#include <map>
#include <iomanip>
#include <cstdlib>
#include <climits>
#include <set>
using namespace std;

//関数getinputdata宣言
vector<vector<string>> getinputdata();
vector<vector<int>> getinputdata2();
vector<vector<double>> getinputdata3();

void abc130_a(vector<vector<int>> v) {

    int x = v[0][0];
    int a = v[0][1];

    cout <<(x<a ? 0 :10)<<endl; 

}

int main() {

    //    vector<vector < string>> vec_arr_result;
    vector<vector<int>> vec_arr_result;
    vec_arr_result = getinputdata2();

    abc130_a(vec_arr_result);

    return 0;
}

//関数getinputdata実装

vector<vector<double>> getinputdata3() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<double>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<double> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atof(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;
}

//関数getinputdata実装

vector<vector<int>> getinputdata2() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector<int>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<int> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(atoi(ret.c_str()));
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;


}

//関数getinputdata実装

vector<vector < string >> getinputdata() {

    string str;
    string ret;
    stringstream ss;
    vector<string> v1;
    vector<vector < string>> vec_arr;

    //標準入力から入力がある間ループ処理でvector配列にデータ格納
    while (getline(cin, str)) {

        v1.push_back(str);

    }

    //stringstreamを利用してvector配列v1をスペースで分解処理
    for (string s : v1) {

        vector<string> array_data;
        ss << s;

        while (!ss.eof()) {

            ss >> ret;

            array_data.push_back(ret);
        }

        //vector配列に追加
        vec_arr.push_back(array_data);

        //バッファクリア
        ss.str("");
        //ストリームクリア
        ss.clear(stringstream::goodbit);

    }

    return vec_arr;

}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define inf 1e9
#define mod 1000000007
#define ff first
#define ss second

bool check(string s, int n)
{
	int cnt = 0;
	for (int i = 0; i < n; i++)
	{
		if (cnt == 0 and s[i] == 'R')
		{
			continue;
		}
		else if (cnt == 0 and s[i] == 'W')
		{
			cnt = 1;
		}
		else if (cnt == 1 and s[i] == 'R')
		{
			cnt++;
		}
	}
	return (cnt <= 1);
}

void solve()
{
	int n;
	cin >> n;
	string s1;
	cin >> s1;

	int ans = 0;
	int r = 0, w = 0;
	for (auto i : s1)
	{
		if (i == 'R')
			r++;
		else
			w++;
	}
	if (check(s1, n))
	{
		cout << "0";
		return;
	}
	ans = min(r, w);
	int cnt = 0;
	int i = 0, j = n - 1;
	if (r == 0 or w == 0)
	{
		cout << ans;
		return;
	}

	while (i < j)
	{
		while (i < n and s1[i] != 'W')
			i++;
		if (i == n)
			break;
		while (j >= 0 and s1[j] != 'R')
			j--;
		if (j < 0)
			break;
		if (i >= j)
			break;
		// cout << i << " " << j << '\n';
		s1[i] = 'R';
		s1[j] = 'W';
		i++;
		j--;
		cnt++;
	}
	ans = min(ans, cnt);
	cout << ans;

}


signed main()
{
	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	solve();
	return 0;
}


Measured memory_bytes: 3824
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=1000000007;
	static void Main(){
		Sc sc=new Sc();
		int[] s=sc.Ia,a=sc.Ia2;
		long[] dp=new long[s[1]+1];
		long ans=0,m=1;
		Array.Sort(a,(u,v)=>v-u);
		for(int i = 2;i<=s[0];i++) {m=(m*i)%mod;}
		dp[s[1]]=m;
		for(int i = s[1],j=0;i>=0;i--) {
			while(a[j]!=0&&a[j]>i){j++;}
			if(a[j]==0){ans=(ans+dp[i]*i)%mod;}
			else if(dp[i]!=0){
				int z=(int)Mi(s[0]-j);
				for(int k = j;k<s[0];k++) {dp[i%a[k]]=(dp[i%a[k]]+dp[i]*z)%mod;}
			}
		}
		Console.WriteLine(ans);
	}
	static long Mi(long a){
		long b=mod,u=1,v=0;
		while(b>0){
			long t=a/b;
			a-=t*b;a^=b;b^=a;a^=b;
			u-=t*v;u^=v;v^=u;u^=v;
		}
		u%=mod;
		if(u<0){u+=mod;}
		return u%mod;
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll((Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

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

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

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

using namespace std;

bool isACGT(char a) {
  return a == 'A' || a == 'C' || a == 'G' || a == 'T';
}

int main() {
  string S;
  
  cin >> S;
  
  int ans = -1;
  int left = 0;
  for (int i = 0; i < S.length(); i++) {
    if (!isACGT(S[i])) {
      left = i + 1;
    }
    
    ans = max(ans, i - left + 1);
  }
  
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <queue>

using namespace std;

const int nmax = 1e9 + 7;
typedef long long ll;

int main(){
  int N; cin >> N;

  vector < vector<int> > graph(N);
  for (int i = 0; i < N - 1; i++){
    int A, B; cin >> A >> B;
    A--; B--;
    graph[A].push_back(B);
    graph[B].push_back(A);
  }

  vector <int> D1j(N), DNj(N);

  queue <int> que;
  que.push(0);
  vector <bool> C1(N), C2(N);
  C1[0] = true; C2[N - 1] = true;

  while (!que.empty()){
    int start = que.front(); que.pop();
    for (int i = 0; i < graph[start].size(); i++){
      int next = graph[start][i];
      if (C1[next] == false){
        que.push(next);
        C1[next] = true;
        D1j[next] = D1j[start] + 1;
      }
    }
  }
  
  que.push(N - 1);
  while (!que.empty()){
    int start = que.front(); que.pop();
    for (int i = 0; i < graph[start].size(); i++){
      int next = graph[start][i];
      if (C2[next] == false){
        que.push(next);
        C2[next] = true;
        DNj[next] = DNj[start] + 1;
      }
    }
  }
  
  int Fennec = 0, Snuke = 0;
  for (int i = 0; i < N; i++){
    if (D1j[i] <= DNj[i]){
      Fennec ++;
    }else{
      Snuke++;
    }
  }
  
  if (Fennec > Snuke) cout << "Fennec" << endl;
  else cout << "Snuke" << endl;
  
  

  return 0;
}


Measured memory_bytes: 6528
import java.util.*;

public class Main{
    void solve(){
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        for(int i = 0; i < s.length(); i++){
            if(i % 2 == 0 && (s.charAt(i) != 'R' && s.charAt(i) != 'U' && s.charAt(i) != 'D')){
                System.out.println("No");
                return;
            }
            if(i % 2 != 0 && (s.charAt(i) != 'L' && s.charAt(i) != 'U' && s.charAt(i) != 'D')){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }

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


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

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    long long num,sum=0;
    cin >> num;
    //vector<long long> list;
    for (int i=1; i<=num; i++) {
        if (i%3!=0 && i%5!=0) {
            sum+=i;
        }}
    cout << sum;
}

Measured memory_bytes: 3596
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

N, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(N)]

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a - A) + abs(b - B) + abs(c - C) - 30 if min(a, b, c) > 0 else INF
    res = dfs(cur + 1, a, b, c)
    res = min(res, dfs(cur + 1, a + l[cur], b, c) + 10)
    res = min(res, dfs(cur + 1, a, b + l[cur], c) + 10)
    res = min(res, dfs(cur + 1, a, b, c + l[cur]) + 10)
    return res
print(dfs(0, 0, 0, 0))

Measured memory_bytes: 9444
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll INF= 1e18L+5;

int main() {
	ll n,w;
	cin >> n>>w;
	ll wt[n],val[n];
	ll sum = 0;
	for(ll i=0; i<n; i++){
		cin >> wt[i]>>val[i];
		sum += val[i];
	}
	vector<ll> dp(sum+1,INF);
	dp[0]=0;
	for(ll i=0; i<n; i++){
		for(ll j=sum-val[i]; j>=0; j--){
			dp[j+val[i]]= min(dp[j+val[i]],dp[j]+wt[i]);
		}
	}
	ll ans = 0;
	for(ll i=0; i<=sum; i++)
		if(dp[i]<=w)
			ans = max(ans,i);
	cout<<ans<<endl;
		// cout<<dp[i]<<" ";
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 #define ll long long
int main()
{
    int t;
    cin>>t;
    vector<ll>v,v1;
    for(int i=0;i<t;i++){
            ll x,y;
            cin>>x>>y;
            v.push_back(x+y);
            v1.push_back(x-y);
    }
    ll mx=*max_element(v.begin(),v.end())-*min_element(v.begin(),v.end());
    ll mn=*max_element(v1.begin(),v1.end())-*min_element(v1.begin(),v1.end());
    cout<<max(mx,mn);
    return 0;
}


Measured memory_bytes: 6616
#include<iostream>
#include<stdlib.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
  int n,r;
  
  cin>>n>>r;
  
  if(n<=10)
  {
    r=r+100*(10-n);
    cout<<r<<endl;
  }
  else
  {
    cout<<r<<endl;
  }

  return 0;
}



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

#define REP(i, s,  n) for(int i = s;i < (n);i++)
#define VSORT(v) sort(v.begin(), v.end());
#define int64 long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;

typedef pair<int, int> P;
typedef pair<int, P> PP;

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

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

int N, K;
int h[100000];

signed main(){
	cin >> N >> K;
	REP(i, 0, N)	scanf("%d", &h[i]);
	sort(h, h + N);
	int ans = INF;
	REP(i, 0, N - K + 1) {
//	    cout << "ans = " << ans << endl;
		ans = min(ans, h[i + K - 1] - h[i]);
//		cout << "ans = " << ans << "  (h[" << (i + K - 1) << "]=" <<  h[i + K - 1] << ") - (h[" << i << "]=" << h[i] << ")  --> " << (h[i + K - 1] - h[i]) << endl;
	}
	cout << ans << endl;
	
	return 0;
}


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

namespace ABC172_D
{
    using static Ex;
    public class D
    {
        public static void Main(string[] args)
        {
            var n = ReadLong;
            var arr = new long[n + 1];

            for (long i = 2; i <= n; i++)
            {
                for (long j = 1; (j * i) <= n; j++)
                {
                    arr[j * i]++;
                }
            }

            long ans = 0;
            for (long i = 1; i <= n; i++)
            {
                ans += i * (arr[i] + 1);
            }
            ans.Cw();
        }
    }

    public static class Ex
    {
        public static void Cw(this object s) { Console.WriteLine(s); }



        public static bool Mins<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
        public static bool Maxs<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
        public static void Swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
        public static void Swap<T>(List<T> list, int i, int j) { T tmp = list[j]; list[j] = list[i]; list[i] = tmp; }

        public static long Lcm(int x, int y) { return x / Gcd(x, y) * y; }
        public static long Gcd(long m, long n) { if (n == 0) return m; return Gcd(n, m % n); }
        public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.Ordinal); return s.ToList(); }
        public static void yesno(this bool b) { (b ? "yes" : "no").Cw(); }
        public static void YesNo(this bool b) { (b ? "Yes" : "No").Cw(); }
        public static void YESNO(this bool b) { (b ? "YES" : "NO").Cw(); }

        public static string Read { get { return Console.ReadLine().Trim(); } }
        public static int ReadInt { get { return int.Parse(Read); } }
        public static long ReadLong { get { return long.Parse(Read); } }
        public static double ReadDouble { get { return double.Parse(Read); } }
        public static string[] ReadArray() { return Read.Split(' '); }
        public static int[] ReadIntArray() { return Read.Split(' ').Select(int.Parse).ToArray(); }
        public static long[] ReadLongArray() { return Read.Split(' ').Select(long.Parse).ToArray(); }
        public static string[] ReadArray(long N) { var v = new string[N]; for (long i = 0; i < N; ++i) v[i] = Read; return v; }
        public static int[] ReadIntArray(long N) { var v = new int[N]; for (long i = 0; i < N; ++i) v[i] = ReadInt; return v; }
        public static long[] ReadLongArray(long N) { var v = new long[N]; for (long i = 0; i < N; ++i) v[i] = ReadLong; return v; }

        public static (T, T) ToTpl2<T>(this T[] v) { return (v[0], v[1]); }
        public static (T, T, T) ToTpl3<T>(this T[] v) { return (v[0], v[1], v[2]); }
        public static (T, T, T, T) ToTpl4<T>(this T[] v) { return (v[0], v[1], v[2], v[3]); }
        public static (T, T, T, T, T) ToTpl5<T>(this T[] v) { return (v[0], v[1], v[2], v[3], v[4]); }
    }
}


Measured memory_bytes: 105728
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <stack>
#include <queue>

typedef unsigned long long ULLONG;
typedef long long LLONG;
static const LLONG MOD_NUM = 1000000007;

template<class _T> static void getval(_T& a) {
	std::cin >> a;
}
template<class _T> static void getval(_T& a, _T& b) {
	std::cin >> a >> b;
}
template<class _T> static void getval(_T& a, _T& b, _T& c) {
	std::cin >> a >> b >> c;
}
template <class _T> static _T tp_abs(_T a) {
	if (a < (_T)0) {
		a *= (_T)-1;
	}
	return a;
}
template <class _T> static void tp_swap(_T& right, _T& left) {
	//	usage:  tp_swap<type name>(a, b);
	_T tmp = right;
	right = left;
	left = tmp;
}

static void exec();

int main()
{
	exec();
	fflush(stdout);
	return 0;
}

static void exec()
{
	int N;
	getval(N);

	std::vector<LLONG> divisor(N + 1, 0);
	for (int k = 1; k <= N; k++) {
		for (int m = k; m <= N; m += k) {
			divisor[m]++;
		}
	}
	LLONG ans = 0;
	for (int k = 1; k <= N; k++) {
		ans += k * divisor[k];
	}
	printf("%lld\n", ans);
}


Measured memory_bytes: 81328
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

ll rec(ll n, ll x){
  if(n==0) return 1;
  ll len = pow(2,n+2) - 3;
  ll pty = pow(2,n+1) - 1;
  if(x==1) return 0;
  else if(x<=(len+1)/2-1) return rec(n-1,x-1);
  else if(x==(len+1)/2) return (pty-1)/2 + 1;
  else if(x<=len-1) return (pty-1)/2 + 1 + rec(n-1, x-(pow(2,n+1)-3)-2);
  else return pty;
}

int main() {
  ll n,x; cin >> n >> x;
  cout << rec(n,x) << endl;
}



Measured memory_bytes: 256
function Main(input) {
  input = input.split('\n');
  tmp = input[0].split(' ');
  var a = parseInt(tmp[0], 10);
  var b = parseInt(tmp[1], 10);
  var result;
  if (a <= b * 2) {
    result = 0;
  } else {
    result = a - b * 2;
  }
  console.log(result);
}

Main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 21064
uses math;
var i,d,n,j:double;
begin
    read(d);
    read(n);
    if n=100 then n:=101;
    if (d=0) then begin
        j:=n;
        end else begin
        //i:=power(100,d);
        //j:=i * n;
        if (d=1) then j:=100*n;
        if (d=2) then j:=10000*n;
        
        end;
    
    writeln(trunc(j));
end.

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

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String S = in.readLine();
		int N = S.length();
		char[] s = new char[N];
		boolean wrongS = false;

		for (int i = 0; i < N; i++) {
			s[i] = S.charAt(i);
		}

		for (int i = 0; i < (N - 1)/2; i++) {
			if (s[i] != s[N-1 - i]) {
				wrongS = true;
				break;
			}
		}

		if (wrongS) {
			System.out.println("No");
			return;
		}

		for (int i = 0; i < (N + 1) / 4; i++) {
			if (s[i] != s[N/2 -1 - i]) {
				wrongS = true;
				break;
			}

		}

		if (wrongS) {
			System.out.println("No");
			return;
		}
		System.out.println("Yes");

	}

}


Measured memory_bytes: 21204
#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 1000000007ll
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;

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

    priority_queue<PI> pq;
    rin{
        pq.push({b[i], i});
    }

    li res = 0;
    while (!pq.empty()) {
        li now = pq.top().S;
        li now_cost = pq.top().F;
        pq.pop();
        if (b[now] == a[now]) {
            continue;
        }
        if (b[now] < now_cost) {
            continue;
        }
        li next = (now + 1) % n;
        li prev = (now + n - 1) % n;
        li new_cost = b[now] - b[next] - b[prev];
        li top2 = pq.top().F;
        li diff = b[now] - max(a[now], a[now]);
        li cnt = diff / (b[next] + b[prev]);
        cnt = max(cnt, 1ll);
        res += cnt;
        //dump(b, n);
        //p2(now, cnt);
        b[now] = b[now] - (b[next] + b[prev]) * cnt;
        if (b[now] < a[now]) {
            puts("-1");
            return 0;
        }
        pq.push({ b[now], now});
    }
    cout << res << endl;


    return 0;
}


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

public class Main {

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

  public void run() {

    try(BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {

      int n = Integer.parseInt(br.readLine());
      Card[] cards = new Card[n];
      char suit;
      int  value;

      for ( int i=0; i<n; i++ ) {
        suit = (char)br.read(); br.skip(1);
        value = Integer.parseInt(br.readLine());
        cards[i] = new Card(suit, value, i);
      }

      quickSortOfCards(cards, 0, n-1);
      dispCardArray(cards);
    }
    catch(IOException e) {
      System.out.println("IOException!");
    }
  }

  public void quickSortOfCards(Card[] card, int p, int r) {

    if( p < r) {
      int q = partitionOfCards(card, p, r);
      quickSortOfCards(card, p, q-1);
      quickSortOfCards(card, q+1, r);
    }
  }

  public int partitionOfCards(Card[] card, int p, int r) {

    int x = card[r].value;
    int i = p-1;
    Card t;

    for(int j=p; j<r; j++) {
      if(card[j].value <= x) {
        t = card[++i]; card[i] = card[j]; card[j] = t;
      }
    }
    t = card[i+1]; card[i+1] = card[r]; card[r] = t;

    return i+1;
  }

public void dispCardArray(Card[] target) {
  StringBuilder s = new StringBuilder();
  int l=target.length;
  boolean isStable = true;
  String sortState = "Stable";

  s.append(target[0]).append("\n");
  for (int i=1; i<l; i++) {
    s.append(target[i]).append("\n");
    if(isStable && target[i-1].value == target[i].value 
      && target[i-1].storedNo > target[i].storedNo) {
      sortState = "Not stable";
      isStable = false;
    }
  }

  System.out.println(sortState);
  System.out.print(s);
  }
}

class Card {
  char suit;
  int value;
  int storedNo;

  public Card( char suit, int value, int storedNo ) {
    this.suit  = suit;
    this.value = value;
    this.storedNo = storedNo;
  }
  public Card( Card card ) {
    this(card.suit, card.value, card.storedNo);
  }

  @Override
  public String toString() {
    return suit + " " + String.valueOf(value);
  }
}


Measured memory_bytes: 65272
#include<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
inline void solve(void){
  int N,R;in(N,R);
  if(N>=10)out(R);
  else out(R+100*(10-N));
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}


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

using namespace std;


int n;
vector<int> x(30),y(30),r(30),c(30);

bool intersect(int idx,int jdx){
    return (x[idx]-x[jdx])*(x[idx]-x[jdx])+(y[idx]-y[jdx])*(y[idx]-y[jdx])<(r[idx]+r[jdx])*(r[idx]+r[jdx]);
}

void dfs(int st, map<int,int> &visited,vector<bool> &dp){
    dp[st]=true;
    visited[st]++;
    vector<int> cand;
    for(int i=0;i<n;i++){
        if((st>>i)&1) cand.push_back(i);
    }
    vector<bool> rm(n,true);
    for(int i=0;i<(int)cand.size();i++){
        for(int j=0;j<i;j++){
            if(intersect(cand[i],cand[j])) rm[cand[i]]=false;
        }
    }
    for(int i=0;i<(int)cand.size();i++){
        for(int j=i+1;j<(int)cand.size();j++){
            int idx=cand[i],jdx=cand[j];
            if(!rm[idx] || !rm[jdx]) continue;
            if(c[idx] != c[jdx]) continue;
            int next=st;
            next &= ~(1<<idx);
            next &= ~(1<<jdx);
            if(visited[next]) continue;
            //cout<<"next = "<<next<<endl;
            dfs(next,visited,dp);
        }
    }
    return ;
}

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

    while(cin>>n,n){
        for(int i=0;i<n;i++){
            cin>>x[i]>>y[i]>>r[i]>>c[i];
        }
        vector<bool> dp(1<<n,false);
        map<int,int> visited;
        dfs((1<<n)-1,visited,dp);
        int res=0;
        for(int i=0;i<(1<<n);i++){
            if(!dp[i]) continue;
            res=max(res, __builtin_popcount(i ^ ((1<<n)-1)));
            //cout<<i<<endl;
        }
        cout<<res<<endl;
    }
}


Measured memory_bytes: 54212
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=100005;
int n,K,Q,a[MAXN];
int main()
{
	n=read();K=read();Q=read();
	for(int i=1;i<=Q;i++)a[read()]++;
	for(int i=1;i<=n;i++)
	{
		if(K-(Q-a[i])<=0)puts("No");
		else puts("Yes");
	}return 0;
}


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

int power(int a,int b) {
	long long int mul=1;
	while(b>0) {mul*=a; b--;}
	return mul;
}

int main() {
	int n,a,d=0,sum=0; cin>>n;
	a=n;
	while(a>0) { a/=10; d++; }
	if(d%2==0) { d--;
		while(d>0) { sum+=9*(power(10,d-1)); d-=2; }
	} 
	else {
		sum+=n-(power(10,d-1))+1;
		d-=2;
		while(d>0) { sum+=9*(power(10,d-1)); d-=2; }
	}
	cout<<sum<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
    using namespace std;
     
    int main() {
      char A, B, C, D, F, E;
      int x = 0;
      cin >> A >> B >> C >> D >> E >> F;
      
     if (A == D) {x++;}
     if (B == E) {x++;}
     if (C == F) {x++;}
      
      cout << x << endl;

    }

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main (){
    long int N;
    double x;
    long int y;
    long int ans = 10000000000000;
    cin >> N;
    x = sqrt(N*1.0);
    y = x;
    for (int a = 1; a < y+1; a++){

        if (N % a == 0 &&ans > N / a + a)
        {
            ans = N / a + a;
        }
    }
    cout << ans-2 << endl;
}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<climits>
#include<numeric>
#include<cmath>
#include<cstring>
#include<deque>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define VSORT(v) sort(v.begin(), v.end());
#define VE vector<int>
#define VEP vector<pair<int,int>>
#define llong long long
#define pb(a) push_back(a)
using namespace std;
int main() {
	int a,b;
	cin >> a >> b;
	if (a < b) {
		cout << 0 << endl;
	}
	else {
		cout << 10 << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long a[500005],now;
long long ans;
int main(){
    string s1;
    cin>>s1;
    queue<int> q;
    int len=s1.length();
    for(int i=1;i<=len;i++){
        if(s1[i-1]=='<'&&s1[i-2]=='>') q.push(i);
    }
    if(s1[0]=='<') q.push(1);
    if(s1[len-1]=='>') q.push(len+1);
    while(!q.empty()){
        int nn=q.front();
        q.pop();
        int l=nn-1,r=nn;
        while(l>=0&&s1[l-1]=='>'){
            
            a[l]=max(a[l],a[l+1]+1LL);
            l--;
        }
        while(r<=len&&s1[r-1]=='<'){
            a[r+1]=max(a[r+1],a[r]+1LL);
            r++;
        }
    }
    for(int i=1;i<=len+1;i++)
    ans+=a[i];
    cout<<ans;
}

Measured memory_bytes: 5124
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <queue>
#include <tuple>
#include <numeric>
#include <functional>
#include <map>

template <class Weight>
struct edge {
  using value_type = Weight;
  size_t src, dst;
  value_type cost;
  edge(size_t src, size_t dst, value_type cost = 1): src(src), dst(dst), cost(cost) {}
};

template <class Weight>
struct graph: public std::vector<std::vector<edge<Weight>>> {
  using value_type = Weight;
  graph(size_t n): std::vector<std::vector<edge<value_type>>>(n) {}

  void connect_with(size_t src, size_t dst, value_type cost = 1) {
    (*this)[src].emplace_back(src, dst, cost);
    (*this)[dst].emplace_back(dst, src, cost);
  }
};

template <class Tp>
constexpr Tp inf = Tp(1) << (8*sizeof(Tp)-3);

template <class Tp, class Compare>
using priority_queue = std::priority_queue<Tp, std::vector<Tp>, Compare>;

template <class Weight>
std::vector<Weight> shortest(const graph<Weight>& g, size_t s) {
  std::vector<Weight> res(g.size(), inf<Weight>);
  priority_queue<std::pair<Weight, size_t>, std::greater<>> q;
  res[0] = 0;
  q.emplace(0, s);
  while (!q.empty()) {
    Weight w;
    size_t v;
    std::tie(w, v) = q.top();
    q.pop();
    if (w > res[v]) continue;

    for (const auto& e: g[v]) {
      if (res[e.dst] > w + e.cost) {
        res[e.dst] = w + e.cost;
        q.emplace(res[e.dst], e.dst);
      }
    }
  }
  return res;
}

int main() {
  size_t N;
  scanf("%zu", &N);

  std::vector<std::vector<int>> c(N, std::vector<int>(N));
  for (auto& ci: c)
    for (auto& cij: ci)
      scanf("%d", &cij);

  std::vector<size_t> ind(N);
  std::iota(ind.begin(), ind.end(), 0);

  std::map<std::vector<size_t>, size_t> enc;
  {
    size_t i = 0;
    do {
      enc[ind] = i++;
    } while (std::next_permutation(ind.begin(), ind.end()));
  }

  graph<int> g(enc.size());

  do {
    size_t s = enc[ind];
    for (size_t i = 0; i < N; ++i) {
      for (size_t j = 0; j < i; ++j) {
        size_t u = ind[i];
        size_t v = ind[j];
        int cost = c[u][v];

        std::swap(ind[u], ind[v]);
        size_t t = enc[ind];
        std::swap(ind[u], ind[v]);
        g.connect_with(s, t, cost);
      }
    }
  } while (std::next_permutation(ind.begin(), ind.end()));

  auto res = shortest(g, 0);
  printf("%d\n", *std::max_element(res.begin(), res.end()));
}



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

void sort(vector<int>& a) {
}

int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N) cin >> a.at(i);

  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());

  int alice = 0;
  int bob = 0;
  rep(i, N) {
    if (i % 2 == 0) {
      alice += a.at(i);
    } else {
      bob += a.at(i);
    }
  }
  cout << alice - bob << endl;
}


Measured memory_bytes: 256
#  --*-coding:utf-8-*--

import math

def f(m, k):
    if k > m:
        return 0

    return math.factorial(m)//(math.factorial(m-k)*math.factorial(k))*(9**k)


def g(N, k, i):
    if k == 0:
        return 1
        
    M = len(N)-i

    if M < k:
        return 0

    n = int(N[i])

    s = 0

    if n > 0:
        s += f(M-1, k) + (n-1)*f(M-1, k-1) + g(N, k-1, i+1)
    else:
        s += g(N, k, i+1)

    return s


N = input()
K = int(input())
print(g(N, K, 0))


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<string>
#include<cmath>
#include<vector>
#include<functional>
#include<stack>

using namespace std;

int main() {
	int n, m, A[100][100], B[100], C[100]{0};
	cin >> n >> m;
	for (int i = 0; i < n; i++)
		for (int j = 0; j < m; j++)cin >> A[i][j];
	for (int i = 0; i < m; i++)cin >> B[i];
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++)C[i] += A[i][j] * B[j];
		cout << C[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3076
#include <iostream>


const int SMAX = 20000;

void input_data(int *src, int *n_src, int *dst, int *n_dst)
{
  std::cin >> *n_src;
  for (int i =0; i < *n_src; i++)
    std::cin >> src[i];

  std::cin >> *n_dst;
  for (int i=0; i<*n_dst; i++)
    std::cin >> dst[i];

  return;
}

//line search
//配列を探索　見つかったらindex, 見つからなかったら-1を返す。
int line_search(int n_src, int *src, int dst)
{
  int index = -1;
  for(int i=0; i<n_src; i++)
  {
    if(src[i] == dst)
    {
      index = i;
      break;
    }
  }
  return index;
}
int main()
{
  int n_src, src[SMAX];
  int n_dst, dst[SMAX];

  input_data(src, &n_src, dst, &n_dst);

  //dstの配列を一個ずつsrc内に無いか、を確認する
  bool flag[n_dst];
  for (int i=0; i<n_dst; i++)
  {
    flag[i] = false;
    if (line_search(n_src, src, dst[i]) != -1) flag[i] = true;
  }
  
  int count=0;
  for (int i=0; i<n_dst; i++)
    if (flag[i]) count++;
  std::cout << count <<std::endl;
}




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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#ifdef _DEBUG_
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl
#else
#define dump(val)
#endif

using namespace std;

typedef long long int ll;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N);
    REP(i, 0, N) {
        cin >> A[i];
    }
    ll ans = 0;
    for (int i = 60; i >= 0; i--) {
        int cnt = 0;
        REP(j, 0, N) {
            cnt += ((A[j] >> i) & 1);
        }
        if (2 * cnt < N) {
            ans += (1LL << i);
            if (K < ans) {
                ans -= (1LL << i);
            }
        }
    }

    ll f = 0;
    REP(i, 0, N) {
        f += (ans ^ A[i]);
    }

    cout << f << endl;

    return 0;
}


Measured memory_bytes: 1024