akhauriyash/Code-Regression huggingface dataset:
#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 n, k;
LL ans;
 
int main(){
	in(n); in(k);
	LL t = n / k;
	ans += t * t * t;
	if(!(k&1)){
		if(t * k + k / 2 <= n)	t++;
		ans += t * t * t;
	}
	outln(ans);
	return 0;
}

Measured memory_bytes: 256
n = int(input())
s = input()

alphabets = [chr(i + 97) for i in range(26)]

# forward
l1 = [0] * (n-1)
now = [False] * 26
for i in range(n-1):
    now[ord(s[i]) - 97] = True
    l1[i] = now.copy()

# backward
l2 = [0] * (n-1)
now = [False] * 26
for i in range(n-1, 0, -1):
    now[ord(s[i]) - 97] = True
    l2[i-1] = now.copy()

ans = 0
for i in range(n-1):
    cnt = 0
    for j in range(26):
        if l1[i][j] and l2[i][j]:
            cnt += 1

    if ans < cnt:
        ans = cnt

print(ans)

Measured memory_bytes: 77232
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <functional>
  
#define mp       make_pair
#define pb       push_back
#define all(x)   (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
  
using namespace std;
  
typedef    long long          ll;
typedef    unsigned long long ull;
typedef    vector<bool>       vb;
typedef    vector<int>        vi;
typedef    vector<vb>         vvb;
typedef    vector<vi>         vvi;
typedef    pair<int,int>      pii;
  
const int INF=1<<29;
const double EPS=1e-9;
  
const int dx[]={1,0,-1,0,1,1,-1,-1},dy[]={0,-1,0,1,1,-1,-1,1};
 

int main() {
  string s;
  cin >> s;
  cout << s.substr(0, s.size() - 8) << endl;
  return 0;
}

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

int main(int argc,char** argv)
{
	char a[4];
	scanf("%s",a);
	if(a[0] == a[1] &&  a[1] == a[2] && a[2] == a[3]){
		printf("Yes\n");
	}
	else if(a[0] == a[1] &&  a[1] == a[2]){
		printf("Yes\n");
	}
	else if(a[1] == a[2] && a[2] == a[3]){
		printf("Yes\n");
	}
	else{
		printf("No\n");
	}

	return(0);
}

Measured memory_bytes: 128
/*
    author: Salam_35
    Created at :

*/

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

#define ll long long int
#define pb push_back
#define sc(n) scanf("%d",&n)
#define Max 100005
#define scan(n) scanf("%lld",&n)
#define pi acos(-1.0)
#define _fastio  ios_base:: sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ALL(x) x.begin(),x.end()
#define sci(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define load(array,size)  for(ll i=0 ; i<size ; i++) cin>>array[i] ;
#define load1(array,size)  for(ll i=1 ; i<=size ; i++) cin>>array[i] ;
#define INF	1LL<<19
#define pll pair<ll,ll>
#define mst(arr,value) memset(arr,value,sizeof(arr));
#define tst() int t;cin >> t;while(t--)
#define Mod 100000007
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
void inversemod(ll n, ll mod, ll invmod[],ll MOD){for(int i=2; i<=n; ++i) invmod[i]=MOD-MOD/i*invmod[MOD%i]%MOD;}
//void bigmod( ll a, ll b ,ll mod){ll r = 1;a = a%mod;while(b){if( b%2 ) r = (r*a)%mod;b = b/2;a = (a*a)%mod; }return (ll)r;}

typedef vector<ll>vec;
typedef pair<ll,ll> pii;
typedef map<ll,ll>mpll;
typedef set<ll>seet;

int main()
{
    int arr[3];
    cin >> arr[0]>> arr[1]>>arr[2];
    sort(arr,arr+3);
    cout<<((arr[0]==5 and arr[1]==5 and arr[2]==7)?"YES":"NO");
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }

const int mod=1000000007;
const int INF=1001001001;

int main() {
  string S,T;
  cin>>S>>T;
  int s=S.size(),t=T.size();
  int MIN=INF;
  for(int i=0;i<=s-t;i++){
    int cost=0;
    for(int j=0;j<t;j++){
      if(S[i+j]!=T[j]){cost++;}
    }
    MIN=min(MIN,cost);
  }
  cout<<MIN<<endl;
  return 0;  
}

Measured memory_bytes: 3632
n=int(input())
a1=[int(x) for x in input().split()]
a2=[int(x) for x in input().split()]
max=0
for i in range(1,n+1):
  count=sum(a1[:i])+sum(a2[i-1:])
  if max<count:
    max=count
print(max)

Measured memory_bytes: 3060
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy


def main():
  input()
  values = numpy.array(list(map(int, input().split())))
  values -= numpy.array(list(map(int, input().split())))

  print(sum(values[values > 0]), flush=True)


if __name__ == '__main__':
  main()



Measured memory_bytes: 21388
#include <bits/stdc++.h>
#define lli long long int
using namespace std;

lli C(lli n)
{
	lli ans = n*(n-1)/2;
	return ans;
}
int main(void) {
	lli n;
	cin>>n;
	lli freq[n+1];
	lli arr[n+1];
	bool visited[n+1];
	lli ans = 0;
	for(int i=1;i<=n;i++)
	{
		freq[i] = 0;
		visited[i] = false;
	}
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
		freq[arr[i]]++;
	}
	for(int i=1;i<=n;i++)
	{
		if(!visited[arr[i]])
		{
			ans += C(freq[arr[i]]);
			visited[arr[i]] = true;
		}
	}
	for(int i=1;i<=n;i++)
	{
		cout<<ans + 1 - freq[arr[i]]<<endl;
	}
	return 0;
}

Measured memory_bytes: 5888
dic = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
n = int(input())
for i in range(n):
  dic[input()] += 1
print('AC x ' + str(dic['AC']))
print('WA x ' + str(dic['WA']))
print('TLE x ' + str(dic['TLE']))
print('RE x ' + str(dic['RE']))

Measured memory_bytes: 9196
import java.util.*;
import java.io.*;

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

    void solve(){

        Scanner cin = new Scanner(System.in);
        int MAX = 999999;
        while(true)
        {
            int n = cin.nextInt();
            int m = cin.nextInt();
            if(n==0) return;
            int[] e = new int[m];
            for(int i=0;i<m;i++){
            	e[i] = (cin.nextInt()-1) + (cin.nextInt()-1) * 100 + (cin.nextInt()) * 10000;
            }
            Arrays.sort(e);


            int ret = MAX;

            int precost = -1;

            for(int i=0;i<m;i++){
            	int firstcost = e[i] / 10000;
            	if(firstcost==precost) continue;
            	precost = firstcost;
            	init(n);
            	for(int j=i;j<m;j++){
            		int cost = e[j]/ 10000;
            		int a = e[j]/100 % 100;
            		int b = e[j] % 100;
            		connect(a,b);
            		if(size(0)==n){
            			ret = Math.min(ret, cost - firstcost);
            			break;
            		}
            	}

            	if(size(0)!=n) break;
            }
            if(ret==MAX) System.out.println(-1);
            else System.out.println(ret);
        }
    }

    int[] uni;

    void init(int n){
    	uni = new int[n];
    	for(int i=0;i<n;i++) uni[i] = -1;
    }

    int getuni(int a){
    	if(uni[a]<0) return a;
    	else return uni[a] = getuni(uni[a]);
    }

    void connect(int a, int b){
    	a = getuni(a);
    	b = getuni(b);
    	if(a==b) return;
    	uni[a] += uni[b];
    	uni[b] = a;
    }

    int size(int a){
    	return -uni[getuni(a)];
    }
}

Measured memory_bytes: 13000
using System;
using System.Linq;
    class Program
    {
        static void Main(string[] args)
        {
            var inputABC = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).OrderByDescending(x=>x).ToArray();
            var result = inputABC[0] * 10 + inputABC[1] + inputABC[2];
            Console.WriteLine(result);
        }
    }

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


int main() {
 
  int a,b;
  cin>>a>>b;


  if(a%3==0 || b%3==0 || (a+b)%3==0)
    cout<<"Possible"<<endl;
  else
  {
    cout<<"Impossible"<<endl;
  }
  

	return 0;
}



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

namespace abc151_a
{
    class Program
    {
        static void Main(string[] args)
        {
            char C = Convert.ToChar(Console.ReadLine());
            int ord = Convert.ToInt32(C);
            ord++;
            Console.WriteLine(Convert.ToChar(ord));
        }
    }
}


Measured memory_bytes: 11220
#include <bits/stdc++.h>
#define rep(i, n) for(int i=0; i<(n); i++)
#define itrep(type, it, t) for(type::iterator it=t.begin(); it!=t.end(); it++)
using namespace std;


int main(void) {

    int N, M;
    cin >> N >> M;
    cout << (N == M ? "Yes" : "No");

    return 0;
}

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

typedef long long int ll;
ll MOD = 1000000007;
ll INFL = 1ll << 60;
ll INF = 1 << 28;

// ====================================================================

int main() {
  int h, w, d;
  cin >> h >> w >> d;
  int g[h][w];
  vector<pair<int, int>> v(h * w);
  for (int y = 0; y < h; y++) {
    for (int x = 0; x < w; x++) {
      cin >> g[y][x];
      g[y][x]--;
      v[g[y][x]] = make_pair(y, x);
    }
  }

  vector<int> dist(h * w);  // 距離
  for (int now = d; now < h * w; now++) {
    dist[now] = dist[now - d] + abs(v[now].first - v[now - d].first) + abs(v[now].second - v[now - d].second);
  }

  int q;
  cin >> q;
  for (int que = 0; que < q; que++) {
    int start, goal;
    cin >> start >> goal;
    cout << dist[goal - 1] - dist[start - 1] << endl;
  }
}


Measured memory_bytes: 2560
#![allow(clippy::needless_range_loop)]
#![allow(unused_macros)]
#![allow(dead_code)]

use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;

pub fn bound<F: Fn(isize) -> bool>(min: isize, max: isize, f: F) -> isize {
    let mut ok = min;
    let mut ng = max;
    while (ng - ok).abs() > 1 {
        let mid = (ok + ng) / 2;
        if f(mid) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    ok
}

fn main() {
    input! {
        n: isize,
        k: usize,
        mut a: [isize; n],
    }
    a.sort();
    let ans = bound(1000000000000000000, -1000000000000000001, |border| {
        let cnt: usize = a.iter().map(|x| {
            let index = if *x >= 0 {
                bound(-1, n, |index| a[index as usize] * x <= border)
            } else {
                n - 1 - bound(n, -1, |index| a[index as usize] * x <= border)
            };
            (index + 1) as usize
        }).sum();
        let cnt = cnt - a.iter().filter(|&x| x * x <= border).count();
        let cnt = cnt / 2;
        cnt >= k
    });
    println!("{}", ans);
}

Measured memory_bytes: 6168
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <iostream>
#include <math.h>
#include <assert.h>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <set>

using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
static const double EPS = 1e-9;
static const double PI = acos(-1.0);

#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define FOREQ(i, s, n) for (int i = (s); i <= (int)(n); i++)
#define FORIT(it, c) for (__typeof((c).begin())it = (c).begin(); it != (c).end(); it++)
#define MEMSET(v, h) memset((v), h, sizeof(v))

int n;
ll memo[110][1 << 16];
ll l[110];
int need[110];

ll calc(int depth, int use) {
  if (depth == n) { return 0; }
  if (memo[depth][use] != -1) { return memo[depth][use]; }
  ll ret = 0;
  ret = max(ret, calc(depth + 1, use));
  if ((use & need[depth]) == 0) {
    ret = max(ret, calc(depth + 1, use | need[depth]) + l[depth]);
  }
  return memo[depth][use] = ret;
}

int main() {
  while (scanf("%d", &n), n) {
    MEMSET(memo, -1);
    MEMSET(need, 0);
    REP(i, n) {
      int m;
      scanf("%d %lld", &m, &l[i]);
      REP(j, m) {
        int s, e;
        scanf("%d %d", &s, &e);
        s -= 6; e-= 6;
        FOR(k, s, e) {
          need[i] |= 1 << k;
        }
      }
    }
    printf("%lld\n", calc(0, 0));
  }
}

Measured memory_bytes: 55000
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(ll i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

int main() {
  string s;
  cin >> s;
  map<char, ll> mp;
  rep(i, s.size()) mp[s[i]]++;
  bool ans = true;
  if(mp['N'] > 0 && mp['S'] == 0) ans = false;
  if(mp['S'] > 0 && mp['N'] == 0) ans = false;
  if(mp['W'] > 0 && mp['E'] == 0) ans = false;
  if(mp['E'] > 0 && mp['W'] == 0) ans = false;
  cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3596
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

N, M = map(int, input().split())
Network = UnionFind(N)

for _ in range(M):
    x, y, z = map(int, input().split())
    Network.union(x-1, y-1)

print(Network.group_count())


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

int main() {
    int N,K;
    string S;
    char s;
    cin >>N >>K >>S;
    s = S.at(K-1);
    if(s=='A'){
      s = 'a';
    }
    if(s=='B'){
      s = 'b';
    }
    if(s=='C'){
      s = 'c';
    }
    if(s=='D'){
      s = 'd';
    }
    if(s=='E'){
      s = 'e';
    }
    if(s=='F'){
      s = 'f';
    }
    if(s=='G'){
      s = 'g';
    }
    if(s=='H'){
      s = 'h';
    }
    if(s=='I'){
      s = 'i';
    }
    if(s=='J'){
      s = 'j';
    }
    if(s=='K'){
      s = 'k';
    }
    if(s=='L'){
      s = 'l';
    }
    if(s=='M'){
      s = 'm';
    }
    if(s=='N'){
      s = 'n';
    }
    if(s=='O'){
      s = 'o';
    }
    if(s=='P'){
      s = 'p';
    }
    if(s=='Q'){
      s = 'q';
    }
    if(s=='R'){
      s = 'r';
    }
    if(s=='S'){
      s = 's';
    }
    if(s=='T'){
      s = 't';
    }
    if(s=='U'){
      s = 'u';
    }
    if(s=='V'){
      s = 'v';
    }
    if(s=='W'){
      s = 'w';
    }
    if(s=='X'){
      s = 'x';
    }
    if(s=='Y'){
      s = 'y';
    }
    if(s=='Z'){
      s = 'z';
    }
    S.at(K-1) = s;
    cout << S;
      
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**7)

readline = sys.stdin.buffer.readline
def readstr():return readline().rstrip().decode()
def readstrs():return list(readline().decode().split())
def readint():return int(readline())
def readints():return list(map(int,readline().split()))
def printrows(x):print('\n'.join(map(str,x)))
def printline(x):print(' '.join(map(str,x)))

n = readint()

ans = 0
for a in range(1,n):
    b = n//a
    if a*b==n:
        ans += b-1
    else:
        ans += b

print(ans)
    



Measured memory_bytes: 63420
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
const int INF = 2e9;
const int MOD = 1e9 + 7;

int main() {
   int n;
   cin >> n;
   vector<vector<int>> x(n), y(n);
   rep(i, 0, n) {
      int a;
      cin >> a;
      rep(j, 0, a) {
         int X, Y;
         cin >> X >> Y;
         X--;
         x[i].push_back(X);
         y[i].push_back(Y);
      }
   }
   int ans = 0;
   rep(i, 0, 1 << n) {
      bool isok = true;
      rep(j, 0, n) {
         if (i >> j & 1) {
            rep(k, 0, x[j].size()) {
               if (y[j][k] != ((i >> x[j][k]) & 1)) isok = false;
            }
         }
      }
      if (isok) chmax(ans, __builtin_popcount(i));
   }
   cout << ans << endl;
   return 0;
}

Measured memory_bytes: 256
m = mod = 10 ** 9 + 7

class Combination
  
  attr_accessor :n_max, :mod
  
  def initialize(n_max,mod)
    @n_max, @mod = n_max, mod
    @fact = [1, 1]
    @inv = [0,1]
    @factinv = [1, 1]
    f(2, n_max)
  end
  
  def f(s,t)
    @n_max = t
    s.upto(t) do |i|
      @fact.push( @fact[-1] * i % mod )
      @inv.push( -@inv[mod % i] * (mod / i) % mod )
      @factinv.push( @factinv[-1] * @inv[-1] % mod )
    end
  end
  
  def cmb(n,r,mod)
    return 0 if r < 0 || n < r
    f(n_max+1, n) if n_max < n
    @fact[n] * (@factinv[r] * @factinv[n-r] % mod) % mod
  end
end

ans = 0

n, k = gets.to_s.split.map{|i|i.to_i}
a    = gets.to_s.split.map{|i|i.to_i}.sort

inst = Combination.new(n, m)

(n-k+1).times do |i|
  t = inst.cmb( n-i-1, k-1, mod)
  mi = a[i] * t % m
  ma = a[n-(i+1)] * t % mod
  ans += (ma - mi)
  ans %= m if ans < 0 || m <= ans
end

puts ans

Measured memory_bytes: 16252
#include <iostream>
#include <cstdio>
using namespace std;
typedef long long ll;

ll n, a, b;
int main() {
	ll i, j, k=0, z;
	cin >> n >> a >> b;
	if(n < a+b-1 || n > a*b) return puts("-1")*0;
	for(i=a-1; i>=0; i--) {
		z = min(b, n-i);
		for(j=0; j<z; j++) printf("%lld ", k+z-j);
		k += z;
		n -= z;
	}
	return 0;
}

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

typedef long long ll;
ll m = 1000000007;
ll factorials[2000005];

ll modexp(ll n, ll e){
	if (e==0){
		return 1;
	}
	if (e%2==0){
		ll ans = modexp(n,e/2);
		return (ans*ans)%m;
	} else {
		ll ans = modexp(n,(e-1)/2);
		return (((ans*ans)%m)*n)%m;
	}
}

ll inv(ll n){
	return modexp(n,m-2);
}

ll ncr(ll n, ll r){
	ll ans = factorials[n];
	ans=ans*inv(factorials[r]);
	ans%=m;
	ans=ans*inv(factorials[n-r]);
	ans%=m;
	return ans;
}

int main(){
	ll r1,c1,r2,c2;
	cin>>r1>>c1>>r2>>c2;
	factorials[0]=1;
	for (int i = 1; i<2000005; i++){
		factorials[i]=(factorials[i-1]*i)%m;
	}
	ll ans;
	ans=ncr(r1+c1,r1)+ncr(r2+c2+2,r2+1);
	ans%=m;
	ans-=ncr(r2+c1+1,c1);
	ans+=m;
	ans%=m;
	ans-=ncr(r1+c2+1,r1);
	ans+=m;
	ans%=m;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 15872
#include <stdio.h>

int main(void){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	
	if(n*a < b){
		printf("%d\n",n*a);
	}else{
		printf("%d\n",b);
	}
	
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define F first
#define S second
#define int long long
using namespace std;
//const int t = 1e9+7;
int a[600][600],n;
int make(int i,int j){
    //cout<<
    if(i==j)
        return 0;
    if(j==i+1){
        a[i][i]=a[i+1][i+1]=0;
        a[i][j]=a[j][i]=1;
        return 1;
    }
    int mid=(i+j)/2;
   // cout<<i<<" "<<j<<endl;
    auto t1=make(i,mid);
    auto t2=make(mid+1,j);
    //cout<<i<<"-"<<mid<<" : "<<t1<<endl;

   // cout<<mid+1<<"-"<<j<<" : "<<t2<<endl;
    int t=max(t1,t2)+1;
    for(int ix1=i;ix1<=mid;ix1++)
        for(int ix2=mid+1;ix2<=j;ix2++)
            a[ix1][ix2]=a[ix2][ix1]=t;//,cout<<"HERE"<<endl;

    return t;
}
main(){
    cin>>n;
    make(1,n);
    for(int i=1;i<=n;i++,cout<<endl)
        for(int j=i+1;j<=n;j++)
            cout<<a[i][j]<<" ";
}


Measured memory_bytes: 2816
#include<bits/stdc++.h>
using namespace::std;
typedef long long lint;
typedef long double ldouble;
#define rep(i, n) for(lint i = 0; i < (lint)(n); i++)
#define repi(i,a,b) for(lint i=lint(a);i<lint(b);i++)
#define rep2(i,a,b,c) for(lint i=lint(a);i>lint(b);i+=c)
#define all(x) (x).begin(),(x).end()
#define sl(c) (('a')<=(c)&&(c)<=('z'))
#define ll(c) (('A')<=(c)&&(c)<=('Z'))
#define PI 3.141592653589793
#define cout (cout<<fixed<<setprecision(15))
#define makeupper(t) (transform(all(t),t.begin(),::toupper))
#define makelower(t) (transform(all(t),t.begin(),::tolower))
#define dist(x1,y1,x2,y2) (pow(pow(x2-x1,2)+pow(y2-y1,2),0.5))
#define sum(a) accumulate(all(a),0)
#define NEXT_LINE string junk; getline(cin, junk);
#define output(v,s) do{rep(i,v.size())cout<<(i?s:"")<<v[i];cout<<"\n";}while(0)
inline string replace(string str, string before, std::string after) {
	string::size_type  Pos(str.find(before));
	while (Pos != std::string::npos) {
		str.replace(Pos, before.length(), after);
		Pos = str.find(before, Pos + after.length());
	}
	return str;
}
inline vector<string> split(string &s, string delim) {
	vector<string> elems;
	s=replace(s, "#", "HASH");
	s=replace(s, delim,"#");
	stringstream ss(s);
	string item;
	while (getline(ss, item, '#')) {
		elems.push_back(replace(item, "HASH", "#"));
	}
	return elems;
}
inline vector<int> cross(vector<int> a, vector<int> b) {
    return { a[1] * b[2] - a[2] * b[1],a[2] * b[0] - a[0] * b[2],a[0] * b[1] - a[1] * b[0] };
}
inline int GCD(int a, int b) {
    if (a < b)swap(a, b);
    if (a%b != 0)GCD(b, a%b);
    else return b;
}
inline vector<lint> primeList(lint n) {
    vector<bool> p(n+1);
    vector<lint> list;
    repi(i,1, n+1)p[i] = true;
    repi(i,2,sqrt(n)+1) {
        if (p[i]) {
            repi(j,2,n/i+1) {
                p[i*j] = false;
            }
        }
    }
    repi(i, 2, n+1)if (p[i])list.push_back(i);
    return list;
}
inline bool isPrime(int num){
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;
    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2){
        if (num % i == 0)return false;
    }
    return true;
}
template<typename T>class Stack{
    vector<T> stack;
    public:
        void push(T num) {
            stack.push_back(num);
        }
        T pop() {
            T num = stack[stack.size() - 1];
            stack.erase(stack.end() - 1);
            return num;
        }
};
template<typename T>class Queue{
    deque<T> queue;
    public:
        void push(T num) {
            queue.push_front(num);
        }
		void push_back(T num){
			queue.push_back(num);
		}
        T pop() {
            T num = queue[queue.size()-1];
            queue.pop_back();
            return num;
        }
        bool empty(){
            return queue.empty();
        }
};
lint val(lint x){
    lint val;
    switch(x%4){
        case 0: val=x;break;
        case 1:val=1;break;
        case 2:val=x+1;break;
        case 3:val=0;break;
    }
    return val;
}
int main(){
    lint a,b;
    cin>>a>>b;
    cout<<(val(a-1)^val(b))<<"\n";
}

Measured memory_bytes: 256
n,m=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort()
t=[[0]*2 for i in range(n)]
for i in range(n):
  t[i]=[t[i-1][0]+ab[i][0]*ab[i][1],t[i-1][1]+ab[i][1]]
  if t[i][1]>=m:
    t[i][0]-=ab[i][0]*(t[i][1]-m)
    print(t[i][0])
    break

Measured memory_bytes: 38800
import java.util.Scanner;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

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

        int A = sc.nextInt();
        int B = sc.nextInt();
        int K = sc.nextInt();

        System.out.println(solve(A, B, K));

        sc.close();
    }

    static String solve(int A, int B, int K) {
        return IntStream
                .concat(IntStream.rangeClosed(A, Math.min(B, A + K - 1)),
                        IntStream.rangeClosed(Math.max(A, B - K + 1), B))
                .distinct().sorted().mapToObj(String::valueOf).collect(Collectors.joining("\n"));
    }
}

Measured memory_bytes: 27088
#include <array>
#include <iostream>

using ull = unsigned long long;
using us = unsigned short;
constexpr us n_max = 44;
ull fib(us n);

std::array<int, n_max> memo{};
/* ref: http://nonbiri-tereka.hatenablog.com/entry/2014/07/01/123518 */

int main() {
    int n;
    std::cin >> n;
    std::cout << fib(n) << std::endl;
}

ull fib(us n) {
    if (n <= 1)
        return 1;
    else if (memo[n] != 0)
        return memo[n];
    else {
        memo[n] = fib(n - 1) + fib(n - 2);
        return memo[n];
    }
}


Measured memory_bytes: 3108
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  string a,b;
  cin>>a>>b;
  for(int i=0;i<min(a.length(),b.length());i++){
  	cout<<a[i]<<b[i];
  }
  for(int i=min(a.length(),b.length());i<max(a.length(),b.length());i++){
  	if(a.length()>b.length()){
  		cout<<a[i];
  	}else{
  		cout<<b[i];
  	}
  }
  cout<<endl;
}





Measured memory_bytes: 256
def dfs(m)
  return N if m.size == 1
  h = Hash.new{|h,k|h[k]=0}
  N.times do |i|
    tmp = choose = 300
    m.each do |j|
      next if tmp < @a[i][j]
      tmp = @a[i][j]
      choose = j
    end
    h[choose] += 1
  end
  i = h.max{|l,r|l[1]<=>r[1]}[0]
  [h[i],dfs(m-[i])].min
end

N,M = gets.split.map &:to_i
A = N.times.map{gets.split.map &:to_i}
@a = Array.new(N){Array.new(M){0}}
N.times do |i|
  M.times do |j|
    @a[i][A[i][j]-1] = j
  end
end
p dfs((0...M).to_a)


Measured memory_bytes: 6524
n = int(input())

t = []

for i in range(n) :
    t.append(list(map(int, input().split())))

#print(t)

res = 0

for i in range(len(t)) :
    if i==0 :
        before = [0, 0, 0]
    else :
        before = t[i-1]

    diff = [t[i][0] - before[0], t[i][1] - before[1], t[i][2] - before[2]]
    #print(diff)

    abs_diff_xy = abs(diff[1]) + abs(diff[2])

    #print("diff : " + str(diff))
    #print("abs_diff_xy : " + str(abs_diff_xy))

    if diff[0] % 2 == 0 and abs_diff_xy % 2 == 0 and abs_diff_xy <= diff[0] :
        continue
    elif diff[0] % 2 == 1 and abs_diff_xy % 2 == 1 and abs_diff_xy <= diff[0] :
        continue
    else :
        res=-1
        break

if res==0 :
    print("Yes")
else :
    print("No")

Measured memory_bytes: 27300
#include <cstdio>
#include <algorithm>
using namespace std;

long long a[200005];

long long pfx[200005][2];
int n;

bool stupid(int x, long long cur, int cnt){
    if (x > n){
        return (cur == 295 && cnt == n/2);
    }
    if (stupid(x+2,cur+a[x],cnt+1)){
        printf("%d\n", x);
        return true;
    }
    return stupid(x+1,cur,cnt);
}
int main(){
    // freopen("test.in", "r", stdin);
    scanf("%d", &n);
    long long c = 0;
    long long b = 0;
    long long tot =0;
    for (int i = 1; i <= n; i++){
        
        scanf("%lld", &a[i]);
        if (i % 2 == 0){
            c+= a[i];
            pfx[i][0] = c;
            pfx[i+1][0] = c;
        }
        else{
            b+= a[i];
            pfx[i][1] = b;
            pfx[i+1][1] = b;
        }
        tot += a[i];
    }
    // stupid(1,0,0);
    long long ans = -1e18;
    if (n % 2 == 0){
        ans = max(pfx[n][0],pfx[n][1]);

        for (int i = 2; i < n; i+=2){
            ans = max(ans, pfx[i][1] + pfx[n][0] - pfx[i][0]);
        }
    }
    else{
        ans = pfx[n][0];
        for (int i = 1; i < n; i++){
            if (i % 2 == 0){
                ans = max(ans, pfx[i-1][1] + max(pfx[n][0] - pfx[i+1][0], pfx[n][1] - pfx[i+1][1]));
            }
            else{
                ans = max(ans, max(pfx[i-1][1],pfx[i-1][0])+ pfx[n][1] - pfx[i+1][1]);
            }
        }
        long long imx = pfx[1][1] - pfx[2][0];
        for (int j = 5; j <= n; j+= 2){

            imx = max(imx, pfx[j-4][1] - pfx[j-3][0]);
            ans = max(ans, imx + pfx[n][1] + pfx[j-1][0] - pfx[j][1]);
            
            // for (int i = 2; i <= j-3; i+=2){
            //         ans = max(ans,pfx[i-1][1] + (pfx[j-1][0] - pfx[i][0]) + pfx[n][1] - pfx[j][1]);
            //         // = pfx[i-1][1] - pfx[i][0] + pfx[j-1][0] - pfx[j][1] + pfx[n][1] 
            // }
        }
    }
    printf("%lld\n", ans);



}

Measured memory_bytes: 6412
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k;
  cin>>n>>k;
  vector<int> v1(n),v2(n,INT_MAX);
  v2[0]=0;
  for(int i=0;i<n;i++){
    cin>>v1[i];
  }
  for(int i=1;i<n;i++){
    int count=k;
    int j=i-1;
    while(j>=0&&count!=0){
      v2[i]=min(v2[i],abs(v1[i]-v1[j])+v2[j]);
      j--;
      count--;
    }
  }
  cout<<v2[n-1];
}

Measured memory_bytes: 1024
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//#define BIG 100000
int main(void) {
	int N;
//	int head = 1;
//	int a[BIG];
	int K = 0;
	int x = 0;
	int ans=0;
	int tmp = 0;
	scanf("%d", &N);
	scanf("%d", &K);
	for (int i = 0; i < N; i++) {
		scanf("%d", &x);
		tmp = K - x;
		ans += 2*((x > tmp) ? tmp : x);
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;

int main() {
	int N;
	cin >> N;
	vector<int> C(N + 1);
	for (int i = 0; i < N; i++) {
		int A;
		cin >> A;
		C[A]++;
	}
	vector<int> D(N + 1);
	for (int i = 1; i <= N; i++) {
		D[C[i]]++;
	}
	for (int i = 1; i <= N; i++) D[i] += D[i - 1];
	vector<int> sum(N + 1);
	for (int i = 1; i <= N; i++) {
		sum[i] = sum[i - 1] + (N - D[i - 1]);
	}
	vector<int> ans(N + 1);
	int x = 0;
	for (int k = N; k >= 1; k--) {
		while (x < N) {
			if (sum[x + 1] >= k * (x + 1)) x++;
			else break;
		}
		ans[k] = x;
	}
	for (int i = 1; i <= N; i++) cout << ans[i] << endl;
}

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

int main() {
    int a;
    int b;
    
    cin >> a;
    cin >> b;
    if(a==b){
        cout << "a == b" << endl;
    }else if (a<b){
        cout << "a < b" << endl;
    }else{
        cout << "a > b" << endl;
    }
    return 0;
}


Measured memory_bytes: 3084
import java.util.Scanner;

public class Main {

    private static Scanner scanner = new Scanner(System.in);

    public static void main(String[] args) {


        solve();

    }

    private static void solve() {

        String s = scanner.next();

        int n = s.length();

        boolean result = true;

        for (int i = 0; i < n / 2; i++) {

            if (i < (n / 2) / 2) {
                result &= s.charAt(i) == s.charAt((n - 1) / 2 - i-1);
                int l = i + (n + 3) / 2;
                result &= s.charAt(l) == s.charAt(n - 1 - l);
            }

            result &= s.charAt(i) == s.charAt(n - 1 - i);

        }

        System.out.println(result ? "Yes" : "No");
    }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector<int> A(N);
	for(int i = 0; i < N; i++) cin >> A[i];
	sort(begin(A), end(A));
	cat ans = 0;
	for(int k = 0; k < 2; k++) {
		int p2 = 0, p1 = 0, n2 = 0, n1 = 0;
		for(int i = 0; i < N; i++) {
			if((i+k)%2 == 0) {
				if(i == 0 || i == N-1) p1++;
				else p2++;
			}
			else {
				if(i == 0 || i == N-1) n1++;
				else n2++;
			}
		}
		int l = 0, r = N-1;
		cat cur = 0;
		while(n2 > 0) {
			cur -= 2 * A[l];
			n2--;
			l++;
		}
		while(p2 > 0) {
			cur += 2 * A[r];
			p2--;
			r--;
		}
		while(n1 > 0) {
			cur -= A[l];
			n1--;
			l++;
		}
		while(p1 > 0) {
			cur += A[r];
			p1--;
			r--;
		}
		ans = max(ans, cur);
	}
	cout << ans << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string s,t;
    cin>>s>>t;
    int l1,l2,i,j,coun=0;
    l1=s.size();
    l2=t.size();
    for(i=0,j=0;i<l1,j<l2;i++,j++)
    {
        if(s[i]!=t[i])
        {
            coun++;
        }
    }
    cout<<coun<<endl;
}


Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0; i<(N); i++)
typedef long long ll;
const ll mod=1e9+7;

ll H;
ll X;
ll ans;

int main(){ 

cin.tie(0);
ios::sync_with_stdio(false);

cin>>H;

X=H;

ll n=1;
while(1){
	if(X==1){
		ans+=n;
		X=0;
		break;
	}else{
		ans+=n;
		X=X/2;
		n*=2;
	}
}

cout<<ans<<endl;

}


Measured memory_bytes: 764
#include <stdio.h>

void swap(int *a, int *b) {
  int temp = *a;
  *a = *b;
  *b = temp;
}

int bubbleSort(int A[], int N) {
  int i, j;
  int flag = 1, count = 0;

  for (i = 0; flag; i++) {
    flag = 0;
    for (j = N - 1; j > i; j--) {
      if (A[j-1] > A[j]){
        swap(&A[j-1], &A[j]);
        count++;
        flag = 1;
      }
    }
  }
  return count;
}

int main() {
  int i;
  int N, A[100], count;
  scanf("%d", &N);
  for (i = 0; i < N; i++) scanf("%d", &A[i]);

  count = bubbleSort(A, N);

  for (i = 0; i < N; i++) {
    if(i) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n%d\n", count);

  return 0;
}


Measured memory_bytes: 2100
#include<iostream>
#include<string>

using namespace std;

int main(){
  int n, count = 0;
  cin >> n;
  string str, res = "YES";
  for(int i=0;i<n;i++){
    cin >> str;
    if(str == "A"){
      count++;
    }else{
      count--;
      if(count < 0) res = "NO";
    }
  }
  if(count > 0) res = "NO";
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 3204
ans = 0
ans2 = 0
min3 = 10
for _ in range(5):
    _num = int(input())
    ans += _num // 10 * 10
    if _num % 10 > 0:
        ans2 += 1
        if min3 > _num % 10:
            min3 = _num % 10
if ans2 > 0:
    ans += (ans2 - 1) * 10 + min3 
print(ans)



Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
const int N = 200;
char x;
int d[N];
int n, m;

int main() {
	//freopen("in.txt","r",stdin);
	cin>>n>>m;
	memset(d, 0, sizeof(d));
	
	for(int i=0;i<n;i++)
		for(int j=0;j<m;j++)
			cin>>x, d[x - 'a'] ++;
	//cout<<d[0]<<" "<<d[1]<<endl;
	int cnt1 = 0, cnt2 = 0, cnt4 = 0;
	for(int i=0;i<=25;i++) {
		cnt4 += (d[i] / 4);
		d[i] = d[i] % 4;
		cnt2 += (d[i] / 2);
		d[i] = d[i] % 2;
		cnt1 += d[i];
	}		
	
	int n1 = 0, n2 = 0, n4 = 0;
	if((n % 2) || (m % 2)) {
		if( (n % 2) && (m % 2)) {
			n2 += (m - 1) / 2;
			n2 += (n - 1) / 2;
			n1 = 1;
		}else {
			if(m % 2)swap(n, m);
			n2 += (m / 2);
			n1 = 0;
		}
		n4 = n * m - n2 * 2 - n1;
		n4 = n4 / 4;
		
	}else n4 = n * m / 4;
	
	if(n4 <= cnt4 && n1 == cnt1)puts("Yes");
	else puts("No");
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
    int a,b,c;
    cin>>a>>b>>c;
    cout<<max({a,b,c})-min({a,b,c});
  	return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<bool> flag(N);
  for (int i = 0; i < K; i++) {
    int d;
    cin >> d;
    for (int j = 0; j < d; j++) {
      int A;
      cin >> A;
      flag[A - 1] = true;
    }
  }

  int ans = 0;
  rep(i, N) ans += !flag[i];
  cout << ans << endl;
}

Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=n-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define all(x) (x).begin(),(x).end()
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[8]={1,0,-1,0,1,1,-1,-1};
const ll dx[8]={0,-1,0,1,1,-1,1,-1};
using Graph = vector<vector<int>>;
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}
struct edge{ll to, cost;};
typedef pair<ll,ll> P;
struct graph{
  ll V;
  vector<vector<edge> > G;
  vector<ll> d;

  graph(ll n){
    init(n);
  }

  void init(ll n){
    V = n;
    G.resize(V);
    d.resize(V);
    rep(i,V){
      d[i] = INF;
    }
  }

  void add_edge(ll s, ll t, ll cost){
    edge e;
    e.to = t, e.cost = cost;
    G[s].push_back(e);
  }

  void dijkstra(ll s){
    rep(i,V){
      d[i] = INF;
    }
    d[s] = 0;
    priority_queue<P,vector<P>, greater<P> > que;
    que.push(P(0,s));
    while(!que.empty()){
      P p = que.top(); que.pop();
      ll v = p.second;
      if(d[v]<p.first) continue;
      for(auto e : G[v]){
        if(d[e.to]>d[v]+e.cost){
          d[e.to] = d[v]+e.cost;
          que.push(P(d[e.to],e.to));
        }
      }
    }
  }
};
class UnionFind
{
public:
  int par[100005];
  int depth[100005];
  int nGroup[100005];
 
  UnionFind(int n) {
    init(n);
  }
 
  void init(int n) {
    for(int i=0; i<n; i++) {
      par[i] = i;
      depth[i] = 0;
      nGroup[i] = 1;
    }
  }
 
  int root(int x) {
    if(par[x] == x) {
      return x;
    } else {
      return par[x] = root(par[x]);
    }
  }
 
  bool same(int x, int y) {
    return root(x) == root(y);
  }
 
  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if(x == y) return;
 
    if(depth[x] < depth[y]) {
      par[x] = y;
      nGroup[y] += nGroup[x];
      nGroup[x] = 0;
    } else {
      par[y] = x;
      nGroup[x] += nGroup[y];
      nGroup[y] = 0;
      if(depth[x] == depth[y])
        depth[x]++;
    }
  }
};
const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
ll n; cin>>n;
ll ca = n;
map<ll,ll> a;
rep(i,n){
ll r,l; cin>>r>>l;
if(a[r+l]>=1){
a[r+l]=min(a[r+l],l);
ca--;}
else{
a[r+l]=l;}}
ll k = -INF;
for(auto p : a){
//cout << p.fi << " " << p.se << endl;
if(k>p.fi-2*p.se){
ca--;
continue;}
else{
k = p.fi;
}
}
cout << ca << endl;}


Measured memory_bytes: 9836
#include<bits/stdc++.h>
using namespace std;
int i,j,n,m=999,k,l,t,b,a,c;
string s;
int main()
{
  for(cin>>s;i<s.size()-2;i++){
    a=int(s[i]-48);
    b=int(s[i+1]-48);
    c=int(s[i+2]-48);
    k=abs(753-(100*a+10*b+c));
    m=min(m,k);
  }
  cout<<m;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define elif else if
using namespace std;
int a,b;
signed main(){
	cin>>a>>b;
	if(b%a==0){
		cout<<a+b;
	}else{
		cout<<b-a;
	}
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

long P = 10^^9+7;
long[10^^5*2+50] F, RF;

long pow(long x, long n) {
    long y = 1;
    while (n) {
        if (n%2 == 1) y = (y * x) % P;
        x = x^^2 % P;
        n /= 2;
    }
    return y;
}

long inv(long x)
{
    return pow(x, P-2);
}

/**
  * P を法とする階乗、逆元を予め計算しておく。
  */
void init()
{
    F[0] = F[1] = 1;
    foreach (i, ref x; F[2..$]) x = (F[i+1] * (i+2)) % P;

    {
        RF[$-1] = 1;
        auto x = F[$-1];
        auto k = P-2;
        while (k) {
            if (k%2 == 1) RF[$-1] = (RF[$-1] * x) % P;
            x = x^^2 % P;
            k /= 2;
        }
    }
    foreach_reverse(i, ref x; RF[0..$-1]) x = (RF[i+1] * (i+1)) % P;
}

/** 
  * ある数を法とする条件下で組み合わせを求める関数
  * 法とする数 P はグローバル変数として存在しなければならない
  * Params:
  *     n = 全体の数
  *     k = 選び出す数
  */
long comb(N)(N n, N k)
{
    if (k > n) return 0;
    auto n_b = F[n];    // n!
    auto nk_b = RF[n-k]; // 1 / (n-k)!
    auto k_b = RF[k];    // 1 / k!

    auto nk_b_k_b = (nk_b * k_b) % P; // 1 / (n-k)!k!

    return (n_b * nk_b_k_b) % P;  // n! / (n-k)!k!
}

void main()
{
    init();
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    auto K = nk[1];
    long r = 1;
    foreach (k; 1..min(N, K+1)) {
        auto p = comb(N, N-k);
        (r += p * comb(N-1, N-k-1) % P) %= P;
    }
    writeln(r);
}

Measured memory_bytes: 3452
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int N = sc.nextInt();
      int[] L = new int[N];
      int i=0;
      long count =0;
      for(i=0;i<N;i++){
        L[i]=sc.nextInt();
      }
		Arrays.sort(L);
      int j=0;
      
      for(i=N-1;i>0;i--){
        for(j=0;j<i;j++){
        	for(int k=i-1;L[j]+L[k]>L[i]&&k>j;k--){
          		if(j!=k&&i!=k){
           			count++;
          		}
            }
        }
      }
        
      System.out.println(count);

    }
  
  private static long lcm(long m, long n) {
    return m * n / gcd(m, n);
}
  
  private static long gcd(long m, long n) {
    if(m < n) return gcd(n, m);
    if(n == 0) return m;
    return gcd(n, m % n);
}
}

Measured memory_bytes: 25628
def main():
    N = int(input())
    a_list = list(map(int, input().split(' ')))
    broken_cnt = 0
    remain_max_number = 0
    for a in a_list:
        if a == remain_max_number + 1:
            remain_max_number += 1
        else:
            broken_cnt += 1
    answer = broken_cnt if broken_cnt < N else -1
    print(answer)


if __name__ == '__main__':
    main()

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

# 100-105
# 200-210
# 300-315
# ...
# 1900-1995
# 2000-2100
# 2100-
flag = False

if(X >= 2000):
    flag = True

for i in range(1, 20):
    if(i*100 <= X and X <= i*105):
        flag = True
        break

if(flag):
    print(1)
else:
    print(0)

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<29;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};

string s;

int main(){
	cin>>s;
	int n=s.size(),t=0;
	for(int i=0;i<n/2;i++) if(s[i]!=s[n-i-1]) t++;
	cout<<t<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,l,n,count=0;
    cin>>n;
    string s;
    cin>>s;
    l=s.size();
    for(i=0;i<l-1;i++)
    {
        if(s[i+1]!=s[i])
        count++;
    }
    cout<<count+1;
    return 0;
}

Measured memory_bytes: 512
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int n, k;
    cin >> n >> k;
    vector<int>a(n);
    rep(i,n)cin >> a[i];
    
    int ok = 1e9;
    int ng = 0;
    while(ok - ng > 1){
        int mid = (ok + ng) / 2;
        int cnt = 0;
        rep(i,n){
            cnt += max(0,(a[i] + mid - 1)/mid-1);
        }
        if(cnt <= k)ok = mid;
        else ng = mid;
    }
    cout << ok << endl;
}


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

#define fi first
#define se second
#define be begin
#define en end
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define ALL(a) (a).be() , (a).en()
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)        //repeat n times
#define REP2(i,s,n) for(int (i)=(s);(i)<(n);(i)++)   //repeat from s to n 
#define REPD(i,n) for(int (i)=(n);(i)>=0;(i)--)      //repeat from n to 0
#define REPD2(i,s,e) for(int (i)=(s);(i)>=(e);(i)--) //repeat from s to e
#define RANGE(i,v) for(auto &(i):v)                  //repeat range
#define ASIZE(a) (sizeof(a) / sizeof(a[0]))          //array size

using LL = long long;

template<typename T> using V = vector< T >;
using Vi = V<int>;
using Vll = V<LL>;
using Vs = V<string>;

const int INF = 1999999999;

Vs split_string(const string &s, char delim){
    Vs elements;
    string item;
    for(char ch : s){
        if(ch == delim){
            if(!item.empty()) elements.pb(item);
            item.clear();
        }else{
            item += ch;
        }
    }
    if(!item.empty()) elements.pb(item);
    return elements;
}

Vi incriment_bn4(Vi n){
    REPD(i,n.size()-1){
        if(n[i]+1>=4 && i>0){
            n[i]=0;
        }else{
            n[i]++;
            break;
        }
    }
    return n;
}

int main(){
    int n,a,b,c;
    cin>>n>>a>>b>>c;
    Vi l(n);
    REP(i,n) cin>>l[i];
    
    int min_abc = INF;
    Vi bn4(n);
    REP(i,pow(4,n)){
        int mp_a = 0; int mp_b = 0; int mp_c = 0;
        int la = 0; int lb = 0; int lc = 0;
        REP(j,n){
            switch(bn4[j]){
                case 0:
                    mp_a += (la!=0)?10:0;
                    la += l[j];
                    break;
                case 1:
                    mp_b += (lb!=0)?10:0;
                    lb += l[j];
                    break;
                case 2:
                    mp_c += (lc!=0)?10:0;
                    lc += l[j];
                    break;
            }
        }
        if(la>0 && lb>0 && lc>0){ 
            mp_a += abs(la-a);
            mp_b += abs(lb-b);
            mp_c += abs(lc-c);
            min_abc = min(min_abc,mp_a+mp_b+mp_c);
        }
        bn4 = incriment_bn4(bn4);
    }

    cout<<min_abc<<endl;

    return 0;
}

Measured memory_bytes: 256