akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i, a, b) for (int i = a; i < b; i++)
#define VREP(it, v) for (vector<int>::iterator it = v.begin(); it != v.end(); it++)
typedef pair<ll,ll> pi;
typedef vector<ll> vi;

template <typename T>
using pbds_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

template <typename K, typename V>
using pbds_map = tree<K, V, less<K>, rb_tree_tag, tree_order_statistics_node_update>;
string s;
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	ll tot = 0;
	REP(i, 0, (int)s.length()){
		tot += (int)s[i] - 48;
		tot %= 9;
	}
	if (tot == 0){
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}
}

//cout.flush()
//cout << fixed << setprecision(9) << x << endl;

Measured memory_bytes: 3712
#pragma GCC optimize ("Ofast")
#include<bits/stdc++.h>
using namespace std;
inline void rd(char &c){
  int i;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c = i;
}
inline int rd(char c[]){
  int i;
  int sz = 0;
  for(;;){
    i = getchar_unlocked();
    if(i!=' '&&i!='\n'&&i!='\r'&&i!='\t'&&i!=EOF){
      break;
    }
  }
  c[sz++] = i;
  for(;;){
    i = getchar_unlocked();
    if(i==' '||i=='\n'||i=='\r'||i=='\t'||i==EOF){
      break;
    }
    c[sz++] = i;
  }
  c[sz]='\0';
  return sz;
}
inline void wt_L(char a){
  putchar_unlocked(a);
}
inline void wt_L(const char c[]){
  int i=0;
  for(i=0;c[i]!='\0';i++){
    putchar_unlocked(c[i]);
  }
}
char S[102];
int N;
int main(){
  int i;
  N = rd(S);
  for(i=(0);i<(N);i++){
    S[i] = 'x';
  }
  wt_L(S);
  wt_L('\n');
  return 0;
}
// cLay varsion 20200119-1

// --- original code ---
// char S[102]; int N;
// {
//   rd(S@N);
//   rep(i,N) S[i] = 'x';
//   wt(S);
// }


Measured memory_bytes: 256
// ProblemURL : https://atcoder.jp/contests/abc091/tasks/abc091_a
// ---------------------------------------------
package main

import "fmt"

func main() {
	var a, b, c int
	fmt.Scan(&a, &b, &c)
	if a+b >= c {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

int main(){
    int n,ai;
    cin>>n;
    ll sum=0;
    rep(i,n){
        cin>>ai;
        sum+=ai-1;
    }
    cout<<sum<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
#define MAX 2000000
#define INFTY (1<<30)

int H, A[MAX+1];

void maxHeapify(int i) {
	int l, r, largest;
	l = 2 * i;
	r = 2 * i + 1;
	
// 左の子、自分、右の子で値が最大のノードを選ぶ
	if ( l <= H && A[l] > A[i] ) largest = l;
	else largest = i;
	if ( l <= H && A[r] > A[largest] ) largest = r;
	
	if ( largest != i ){
		swap(A[i], A[largest]);
		maxHeapify(largest);
	}
}

	
	int extract(){
		int maxv;
		if(H < 1)return -INFTY;
		maxv = A[1];
		A[1] = A[H--];
		maxHeapify(1);
		return maxv;
	}
	
	void increaseKey(int i, int key){
		if(key < A[i])return;
		A[i] = key;
		while (i>1 && A[i/2] < A[i]){
			swap(A[i], A[i/2]);
			i = i/2;
		}
	}
	
	void insert(int key){
		H++;
		A[H] = -INFTY;
		increaseKey(H, key);
	}
	
	int main(){
		int key;
		char com[10];
		
		while(1){
			scanf("%s",com);
			if(com[0]=='e' && com[1] == 'n' )break;
			if(com[0]=='i'){
				scanf("%d", &key);
				insert(key);
			}else{
				printf("%d\n",extract());
			}
		}
		return 0;
	}


Measured memory_bytes: 6596
#include <iostream>
using namespace std;
int main(void){
    int h,w,c[10][10],a[200][200];
    cin >> h >> w;
    for(int i = 0;i < 10;i++){
        for(int j = 0;j < 10;j++){
            cin >> c[i][j];
        }
    }
    for(int k = 0;k < 10;k++){
        for(int i = 0;i < 10;i++){
            for(int j = 0;j < 10;j++){
                if(c[i][j] > c[i][k] + c[k][j]) c[i][j] = (c[i][k] + c[k][j]);
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < h;i++){
        for(int j = 0;j < w;j++){
            cin >> a[i][j];
            if(a[i][j] != -1) ans += c[a[i][j]][1];
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60;

int main(){
	for(int i = 0; i < 3; ++i){
		for(int j = 0; j < 3 ; ++j){
			char a; cin >> a;
			if( i == j ) cout << a;
		}
	}
}


Measured memory_bytes: 256
import sys
N = int(input())
A = [int(i) for i in input().split()]
if not 1 in A:
    print(-1)
    sys.exit()
tmp = 1
cnt = 0

for i in range(N):
    if tmp != A[i]:
        cnt += 1
    else:
        tmp += 1
print(cnt)

Measured memory_bytes: 24744
import collections
n = int(input())
s_list = []
for _ in range(n):
    i = input()
    s_list.append(i)
c = collections.Counter(s_list)

values, counts = zip(*c.most_common())
index = 0
for i in range(len(counts)-1):
    if counts[i] == counts[i+1]:
        index += 1
    else:
        break
        
ans_list = []
for j in range(index+1):
    ans_list.append(values[j])
ans_list.sort()
for ans in ans_list:
    print(ans)

Measured memory_bytes: 125136
use std::cmp::Ord;
use std::io::prelude::*;
use std::io::stdin;
use std::str::FromStr;

fn main() {
    let n: usize = read();
    let m: usize = read();
    let mut x: Vec<i32> = (0..m).map(|_| read()).collect();

    if n >= m {
        println!("0");
        return;
    }

    x.sort();
    let mut dis = Vec::new();
    for i in 0..m - 1 {
        dis.push((x[i] - x[i + 1]).abs());
    }
    dis.sort();
    let ans: i32 = dis.iter().take(m - n).sum();
    println!("{}", ans);
}

#[inline]
#[allow(dead_code)]
fn chmin<T: Ord + Copy>(a: T, b: &mut T) -> bool {
    if a < *b {
        *b = a;
        true
    } else {
        false
    }
}

#[inline]
#[allow(dead_code)]
fn chmax<T: Ord + Copy>(a: T, b: &mut T) -> bool {
    if a > *b {
        *b = a;
        true
    } else {
        false
    }
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|b| b.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}


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

int N;
vector<int> a,b;

// target is k-th bit (0<=k<=28)
//  if a_i>=2^k (carry_up)
//   2^k+2^(k+1)-a_i <= b_j < 2^(k+1)
//   0 <= b_j < 2^(k+1)-a_i
//  else
//   2^k-a_i <= b_j < 2^(k+1)-a_i

int main(){
    int i,j,k,ans,m,cnt;
    int bekihigh,bekilow;
    
    cin >> N;
    a.resize(N);
    b.resize(N);
    
    for(i=0;i<N;i++){
        cin >> a[i];
    }
    for(i=0;i<N;i++){
        cin >> b[i];
    }
    cnt=0;
    ans=0;
    
    for(k=28;k>=0;k--){
        bekihigh=1<<(k+1);
        bekilow=1<<k;
        
        for(i=0;i<N;i++){
            a[i]%=bekihigh;
            b[i]%=bekihigh;
        }

        sort(b.begin(),b.end());
        cnt=0;
        
        for(i=0;i<N;i++){
            if(a[i]<=bekilow){
                cnt+=lower_bound(b.begin(),b.end(),bekihigh-a[i])-lower_bound(b.begin(),b.end(),bekilow-a[i]);
            }
            else{
                cnt+=lower_bound(b.begin(),b.end(),bekihigh-a[i])-b.begin();
                cnt+=lower_bound(b.begin(),b.end(),bekihigh)-lower_bound(b.begin(),b.end(),bekihigh+bekilow-a[i]);
            }
            
        }
        if(cnt%2){
            ans|=1<<k;
        }
    }
    printf("%d\n",ans);
    
    return 0;
}

Measured memory_bytes: 1792
d, g = map(int, input().split())
pc = [list(map(int, input().split())) for i in range(d)]
ans = []
def dfs(i, sum, count, residue):
  if i == d:
    if sum < g:
      use = max(residue)
      n = min(pc[use - 1][0], -(-(g - sum)//(use*100)))
      count += n
      sum +=  n*use*100
    if sum >= g:
      ans.append(count)
  else:
    dfs(i + 1, sum, count, residue)
    dfs(i + 1, sum + pc[i][0]*(i + 1)*100 + pc[i][1], count + pc[i][0], residue - {i+1})

dfs(0, 0, 0, set(range(1, d+1)))
print(min(ans))

Measured memory_bytes: 3064
// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

const ll inf = 5e15;

int main() {
    string N;
    cin >> N;
    reverse(ALL(N));
    N += '0';
    VV<PLL> val(10);
    for (ll i = 0; i < 10; i++) for (ll j = 0; j < 10; j++) {
        ll diff = i - j;
        if (diff < 0) diff += 10;
        val[diff].emplace_back(i, j);
    }

    ll ok = 0, ng = inf;
    for (char c : N) {
        ll n = c - '0';
        ll nok = inf, nng = inf;
        for (PLL p : val[n]) {
            ll a, b;
            tie(a, b) = p;

            if (b <= a) chmin(nok, ok + a + b);
            else chmin(nng, ok + a + b);
        }
        for (PLL p : val[(n + 1) % 10]) {
            ll a, b;
            tie(a, b) = p;
            if (b < a) {
                chmin(nok, ng + a + b);
            } else {
                chmin(nng, ng + a + b);
            }
        }
        ok = nok;
        ng = nng;
    }
    cout << ok << endl;
    return 0;
}


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

int main(){
int n,t,a,h,ans=1;
double g=0.006,hoge,foo;
cin >> n;
cin >> t >> a;
for(int i=1;i<=n;i++){
cin >> h;
hoge=t-h*g;
if(i==1){
if(hoge>=a){
foo=hoge-a;
}else{
foo=a-hoge;
}
}else{
if(hoge>a){
hoge=hoge-a;
if(hoge<foo){
foo=hoge;
ans=i;
}
}else{
hoge=a-hoge;
if(hoge<foo){
foo=hoge;
ans=i;
}
}
}
}
cout << ans << '\n';
return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);

		int n = sc.nextInt();

		int[] a = new int[n+1];
		for ( int i=0; i<n; i++ ) {
			a[i] = sc.nextInt();
		}
		a[n] = 0;

		long m = 1000L;	// money
		long s = 0L;	// stock
		for ( int i=0; i<n; i++ ) {
			// sell
			m += s*(long)a[i];
			s = 0L;
			if ( a[i]<a[i+1] ) {
				// buy
				s += m/(long)a[i];
				m = m%(long)a[i];
			}
		}
		System.out.println(m);
	}
}

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

int main() {
  int N;
  cin >> N;
  vector<int> D(101);
  
  for (int i = 0; i < N; i++) {
    int d;
    cin >> d;
    D.at(d) = 1;
  }
  
  int l = 0;
  for (int i = 0; i < D.size(); i++) l += D.at(i);
  cout << l << endl;
}


Measured memory_bytes: 256
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
        this.IslandCount = inpt[0];
        int shipCount = inpt[1];
        for (int i = 0; i < shipCount; i++) {
            inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();
            inpt.ToList().ForEach(a=>{
                if(!Ship.ContainsKey(a)) {
                    Ship.Add(a, new Dictionary<int, bool>());
                }
            });
            Ship[inpt[0]][inpt[1]] = true;
            Ship[inpt[1]][inpt[0]] = true;
        }
        string ans = "IMPOSSIBLE";
        if(CanReach(1, 2)) {
            ans = "POSSIBLE";
        }
        Console.WriteLine(ans);
    }

    private bool CanReach(int idx, int remain) {
        if(!this.Ship.ContainsKey(idx)) {
            return false;
        }
        if(remain == 0) {
            if(idx == IslandCount) {
                return true;
            }
            return false;
        }
        foreach(int next in Ship[idx].Keys) {
            if(next == 1) {
                continue;
            }
            if(CanReach(next, remain-1)) {
                return true;
            }
        }
        return false;
    }

    private int IslandCount = 0;
    private Dictionary<int, Dictionary<int, bool>> Ship = new Dictionary<int, Dictionary<int, bool>>();

    public class Reader
	{
		private static StringReader sr;
		public static bool IsDebug = false;
		public static string ReadLine()
		{
			if (IsDebug)
			{
				if (sr == null)
				{
					sr = new StringReader(InputText.Trim());
				}
				return sr.ReadLine();
			}
			else
			{
				return Console.ReadLine();
			}
		}
		private static string InputText = @"

4 3
1 2
2 3
3 4


";
	}

	public static void Main(string[] args)
	{
#if DEBUG
		Reader.IsDebug = true;
#endif
		Program prg = new Program();
		prg.Proc();
	}
}

Measured memory_bytes: 79500
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define MOD 1000000007

int n;
string s;
int a[30];
LL ans;

int main()
{
  
  cin>>n;
  cin>>s;
  for(int i=0;i<s.size();i++)
    a[s[i]-'a']++;
  ans=1;
  for(int i=0;i<=26;i++)
    ans=ans*(a[i]+1)%MOD;
  cout<<(ans-1+MOD)%MOD<<'\n';
  return 0;
}

Measured memory_bytes: 512
#include<vector>
#include<map>
#include<algorithm>
#include<set>
#include<iostream>
#include<string>
#include<set>
#include<queue>
#include<random>

using namespace std;

/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> st;*/

#pragma GCC optimize("Ofast")
#pragma GCC optimize("fast-math")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")

#define pb push_back
#define ld long double
#define int long long

mt19937 rnd(51);

int32_t main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int a, b, c, k;
	cin >> a >> b >> c >> k;
	int ans = 0;
	ans += min(a, k);
	k -= min(a, k);
	k -= b;
	ans -= max(0ll, min(k, c));
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
#include<cstdio>
#include<cstdlib>
using namespace std;

#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592

const double EPS = 1e-10;

using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;


int main(){
    int N; cin >> N;
    vector<int> s(N);
    rep(i,N) cin >> s[i];
    ll ans = -LINF;
    repr(i,1,N){
        ll now = 0;
        set<int> st;
        ll x = 0;
        while(x*i < N){
            int A = N-1-x*i;
            if(A <= i) break;
            if(A == x*i) break;
            if(st.find(x*i) != st.end() || st.find(A) != st.end()) break;
            st.insert(x*i);
            st.insert(A);
            now += s[x*i];
            now += s[A];
            ans = max(ans,now);
            x++;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 7424
n,x=map(int, input().split())
L=list(map(int, input().split()))

bound=1
d=0
for i in range(n):
    d+=L[i]
    if d<=x:
        bound+=1
    else:
        break
if bound<n+1:
    print(bound)
else:
    print(n+1)

Measured memory_bytes: 3060
#include <cstdio>
#include <deque>
using namespace std;

typedef long long i64;

i64 n;
int sz;
deque<int> a, b;

void build(i64 n) {
	if (n == 0) return;

	if (n % 2 == 1) {
		build(n / 2);
		++sz;
		a.push_back(sz);
		b.push_back(sz);
	} else {
		build(n - 1);
		++sz;
		a.push_back(sz);
		b.push_front(sz);
	}
}

int main() {
	scanf("%lld", &n);
	build(n);
	printf("%d\n", 2 * (int) a.size());

	for (int i : a) printf("%d ", i);
	for (int i : b) printf("%d ", i);
	puts("");
	return 0;
}

Measured memory_bytes: 256
from collections import deque

K = int(input())
L = deque()
for i in range(9):
    L.append((i+1))

for i in range(K):
    ans = L.popleft()
    if ans % 10:
        L.append(10*ans+ans%10-1)
    L.append(10*ans+ans%10)
    if ans % 10-9:
        L.append(10*ans+ans%10+1)

print(ans)

Measured memory_bytes: 74864
#include <bits/stdc++.h>
using namespace std;
int main(){
long long a,b,c,d,e,f,g=0; cin>>a>>b>>c;
long long counter=0;
while((a%2==0&&b%2==0)&&(b%2==0&&c%2==0)){
d=a/2+b/2;
e=a/2+c/2;
f=b/2+c/2;
a=d;
b=e;
c=f;
counter++;
if((a==b&&b==c)){
g++;
break;}}
if(g==1){
cout<<-1<<endl;}
else
cout<<counter<<endl;}


Measured memory_bytes: 256
N = int(input())
T,A = map(int,input().split())
H = list(map(int,input().split()))
ans = 0
min_height = 10**18
for i in range(N):
  if abs(A - T + H[i]*0.006) < min_height:
    ans = i+1
    min_height = abs(A - T + H[i]*0.006)
print(ans)

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

using namespace std;

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

    return 0;
}

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

int main(){
  string str;
  cin >> str;
  int n = str.length();
  vector<int> vec(n, 0);
  char firstSpell = str[0];
  int firstCount = 1;
  int firstR;
  if(firstSpell == 'L'){
    for(int i=1; i<n; i++){
      if(str[i] == 'R'){
        firstR = i;
        vec[0] = firstCount;
        break;
      }else{
        firstCount++;
      }
    }
    vec[0] = n;
  }else{
    firstR = 0;
  }
  char lastSpell = str[n-1];
  int lastCount = 1;
  int lastL;
  if(lastSpell == 'R'){
    for(int i=n-2; i>=0; i--){
      if(str[i] == 'L'){
        lastL = i;
        vec[n-1] = lastCount;
        break;
      }else{
        lastCount++;
      }
    }
    vec[n-1] = n;
  }else{
    lastL = n-1;
  }
  //ここまで下準備
  int i = firstR;
  char currentSpell = 'R';
  int r = 0;
  int rpos;
  int l = 0;
  while(i<=lastL){
    if(str[i] == currentSpell){
      if(currentSpell == 'R') r++;
      else l++;
      i++;
    }else{
      if(currentSpell == 'R'){
        rpos = i-1;
        currentSpell = 'L';
        l++;
      }else{
        if((r+l) % 2 == 0){
          vec[rpos] = (r+l) / 2;
          vec[rpos+1] = (r+l) / 2;
        }else{
          if(l % 2 == 1){
            vec[rpos] = (r+l-1) / 2;
            vec[rpos+1] = (r+l+1) / 2;
          }else{
            vec[rpos] = (r+l+1) / 2;
            vec[rpos+1] = (r+l-1) / 2;
          }
        }
        currentSpell = 'R';
        r = 1;
        l = 0;
      }
      i++;
    }
  }
  if((r+l) % 2 == 0){
    vec[rpos] = (r+l) / 2;
    vec[rpos+1] = (r+l) / 2;
  }else{
    if(l % 2 == 1){
      vec[rpos] = (r+l-1) / 2;
      vec[rpos+1] = (r+l+1) / 2;
    }else{
      vec[rpos] = (r+l+1) / 2;
      vec[rpos+1] = (r+l-1) / 2;
    }
  }
  for(int i=0; i<n; i++){
    cout << vec[i] << " ";
  }
  return 0;
}
          
        
      
  
  
      

Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
#define rep(i,m,n) for(int i=m;i<n;i++)

int main() {
  int n, a;
  vector<int> d;

  cin >> n;
  rep(i,0,n){ cin >> a; d.push_back(a); }

  sort(d.begin(),d.end());
  cout << d[n/2] - d[n/2-1] << endl;
  
  return 0;
}


Measured memory_bytes: 892
N,K = map(int,input().split())
if N==2:
    if K==0:
        print(1)
        print(1,2)
    elif K==1:
        print(-1)
elif N==3:
    if K==0:
        print(3)
        print(1,2)
        print(2,3)
        print(1,3)
    elif K==1:
        print(2)
        print(1,2)
        print(1,3)
    elif K>=2:
        print(-1)
elif N==4:
    if K==0:
        print(6)
        print(1,2)
        print(1,3)
        print(1,4)
        print(2,3)
        print(2,4)
        print(3,4)
    elif K==1:
        print(5)
        print(1,3)
        print(1,4)
        print(2,3)
        print(2,4)
        print(3,4)
    elif K==2:
        print(4)
        print(1,3)
        print(1,4)
        print(2,4)
        print(3,4)
    elif K>=3:
        print(-1)
else:
    if K>((N-1)*(N-2))//2:
        print(-1)
    else:
        A = [(i,j) for i in range(1,N) for j in range(i+1,N+1)]
        i = 2
        j = 3
        cnt = 0
        while cnt<K:
            if (i,j) in A:
                A.remove((i,j))
            j += 1
            if j>N:
                i += 1
                j = i+1
            cnt += 1
        print((N*(N-1))//2-K)
        for a in A:
            print(a[0],a[1])

Measured memory_bytes: 74596
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define FORR(i,a,b) for (int i=(a);i>=(b);i--)
#define pb push_back
#define pcnt __builtin_popcount
#define show(x) cout<<#x<<" = "<<x<<endl;
#define maxs(x,y) x = max(x,y)
#define mins(x,y) x = min(x,y)
#define fi first
#define se second
#define rng(a) (a.begin()),(a.end())
#define each(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();it++)
#define sz(x) (int)(x).size()
#define mp make_pair

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef set<int> si;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<pll> vpll;
typedef set<ll> sl;
typedef __int128_t lll;
typedef pair<lll,lll> plll;
typedef vector<lll> vlll;
template<typename T>string join(vector<T>&v)
{stringstream s;FOR(i,0,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename A, size_t N, typename T>void Fill(A (&array)[N], const T&v)
{fill((T*)array,(T*)(array+N),v);}
template<typename T> T gcd(T a,T b){if(a>b)swap(a,b);for(;a>0;b%=a,swap(a,b));return b;}
ll modpow(lll a,lll n,ll m){if(a==0)return a;lll p=1;for(;n>0;n/=2,a=a*a%m)if(n&1)p=p*a%m;return(ll)p;}
void dout(double d){printf("%.12f\n",d);}

const int iinf = 1e9;
const ll linf = 1e18;
const int mod = 1e9+7;
const double pi = acos(-1);
const double eps = 1e-10;
ll n, m;
main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> n >> m;
  if(n > m) swap(n, m);
  ll ans;
  if(n == 1){
    if(m==1){
      ans = 1;
    }else{
      ans = m - 2;
    }
  }else{
    ans = (n-2)*(m-2);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

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

    void compute() {
        Scanner sc = new Scanner(System.in);
        long N = sc.nextLong();
        int min = 50;
        for (int i = 1; i <= Math.sqrt(N); i++) {
            if (N % i != 0) {
                continue;
            }
            long cur = N / i;
            int j;
            for (j = 0; cur != 0; cur /= 10, j++) {
            }
            min = j;
        }
        System.out.println(min);
    }
}


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

#define rep(i, n) for(long long i=0;i<(long long)(n);i++)
#define rep2(i, s, n) for(long long i=(s);i<(long long)(n);i++)
#define repi(i, n) for(int i=0;i<(int)(n);i++)
#define rep2i(i, s, n) for(int i=(s);i<(int)(n);i++)
#define all(v) v.begin(), v.end()

#define deg2rad(deg) (((deg)/360)*2*M_PI)
#define rad2deg(rad) (((rad)/2/M_PI)*360)

using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;

const ll INF = (1LL<<60);
const int INFi = (1<<29);

/*素数判定*/
bool is_prime(ll n){
    if(n==1) return false;
    for(ll i=2;i*i<=n;i++){
        if(n%i==0) return false;
    }
    return true;
}

/*約数列挙*/
vll enum_divisors(ll n){
    vll l;
    for(ll i=1;i*i<=n;i++){
        if(n%i==0){
            l.push_back(i);
            if(n/i != i) l.push_back(n/i);
        }
    }
   sort(all(l));
   return l;
}

/*素因数分解*/
vector<P> prime_factorize(ll n){
    vector<P> l;
    for(ll i=2;i*i<=n;i++){
        if(n%i!=0) continue;
        ll e = 0;
        while(n%i==0){
            e++;
            n /= i;
        }
        l.push_back({i, e});
    }
    if(n!=1) l.push_back({n, 1});
    return l;
}

int main(){

    ll n; cin >> n;
    map<string, ll> mp;
    string in;
    rep(i, n){
        cin >> in;
        mp[in]++;
    }

    vector<string> s = {"AC", "WA", "TLE", "RE"};
    rep(i, 4){
        cout << s[i] << " x " << mp[s[i]] << endl;
    }

    return 0;
}

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

int main(){
	string s;
	cin>>s;
	
	map<char,int> mp;
	for(int i=0;i<s.size();i++){
		mp[s[i]]++;
	}
	
	if(max(mp['a'],max(mp['b'],mp['c']))-min(mp['a'],min(mp['b'],mp['c']))<=1){
		cout<<"YES"<<endl;
	}else{
		cout<<"NO"<<endl;
	}
}

Measured memory_bytes: 512
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	const inputLines = input.split("\n");
	const line0 = inputLines[0];
	const line0vars = line0.split(" ");
	const line1 = inputLines[1];
	const line1vars = line1.split(" ");

	const n = parseInt(line0vars[0], 10);
	// const b = parseInt(line0vars[1], 10);
	const a = [];
	const result = [];
	var sum = 0;
	line1vars.forEach(e => {
		const a2 = parseInt(e, 10);
		sum = sum^a2;
		a.push(a2);
	});

	a.forEach(a2 => {
		result.push(a2^sum);
	});

	console.log(result.join(" "));
	
	// const d = parseInt(line1vars[1], 10);

	// tmp = input[1].split(" ");
	// //文字列から10進数に変換するときはparseIntを使います
	// var a = parseInt(input[0], 10);
	// var b = parseInt(tmp[0], 10);
	// var c = parseInt(tmp[1], 10);
	// var s = input[2];

	// let a, b, c, d;
	// a = 26, b = 5, c = 7, d = 22;

	// let a2 = b ^ c ^ d;
	// let all = 20^11^9^24;

	// console.log({
	// 	a2: a2,
	// 	all: all,
	// 	a3: all^a2
	// });

	//出力
	// console.log('%d %s',a+b+c,s);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

// node index.js
// 1
// 2 3
// test
// (Ctrl + D)


Measured memory_bytes: 70740
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int g_bm = 1000000007;

#define _LL long long

int modl(_LL a)
{
    a %= g_bm;
    if( a < 0 ) a += g_bm * ( 1 - (a + 1) / g_bm );
    return a;
}

int modadd(_LL a, _LL b)
{
    return modl(a + b);
}

int modminus(_LL a, _LL b)
{
    return modl(a - b);
}

int modmul(_LL a, _LL b)
{
    return modl(a * b);    
}

int modpow(_LL a, _LL b)
{
    int prebit = modl(a);
    int ans = 1;
    for( int bit = 0; (long unsigned int) b >= (1UL << bit); bit++ )
    {
        if( bit > 0 ) prebit = modmul(prebit, prebit);
        if( b & (1UL << bit) ) ans = modmul(ans, prebit);
    }
    return ans;
}

int modcalcsub(_LL a, _LL b, char c)
{
    switch(c)
    {
        case '+':
            return modadd(a, b);
        case '-':
            return modminus(a, b);
        case '*':
            return modmul(a, b);
    }
    return 0;
}

int modsublevel(char c)
{
    switch(c)
    {
        case '+':
        case '-':
            return 0;
        case '*':
            return 1;
    }
    return 0;
}

int modinv(_LL a) 
{
    _LL b = g_bm, u = 1, v = 0;
    while (b) 
    {
        _LL t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    return modl(u);
}

int modcalc(_LL a1, char c1, _LL a2, char c2 = 0, _LL a3 = 0, char c3 = 0, _LL a4 = 0, char c4 = 0, _LL a5 = 0, char c5 = 0, _LL a6 = 0, char c6 = 0, _LL a7 = 0, char c7 = 0)
{
    char c[8] = {c1, c2, c3, c4, c5, c6, c7, '0'};
    _LL a[8] = {a1, a2, a3, a4, a5, a6, a7, 0};
    int ans[4];
    char prec[4];
    int level = 0;
    int index = 0;
    ans[0] = 0;
    prec[0] = '+';
    // 3 + 4 * 8 + 3
    while( prec[level] != '\0' )
    {
        int nlevel = modsublevel(c[index]);
        while( level < nlevel )
        {
            ans[level + 1] = 0;
            prec[level + 1] = '+';
            level++;
        }        
        ans[level] = modcalcsub( ans[level], a[index], prec[level]);
        while( nlevel < level )
        {
            ans[level - 1] = modcalcsub( ans[level - 1], ans[level], prec[level - 1]);
            level--;
        }
        prec[level] = c[index++];
    }
    return ans[0];
}

int dp[4096][4096];

int main()
{
    g_bm = 998244353;
    int a, b, c, d;
    cin >> a >> b >> c >> d;

    int x, y;
    dp[a][b] = 1;
    x = a;
    for( y = b + 1; y <= d; y++) dp[x][y] = modcalc(x, '*', dp[x][y-1]);
    y = b;
    for( x = a + 1; x <= c; x++) dp[x][y] = modcalc(y, '*', dp[x - 1][y]);

    for( x = a + 1; x <= c; x++)
    {
        for( y = b + 1; y <= d; y++ )
        {
            dp[x][y] = modcalc(x, '*', dp[x][y - 1], '+', y, '*', dp[x-1][y], '-', (x - 1)*(y - 1), '*', dp[x-1][y-1]);
        }
    }
    cout << dp[c][d] << endl;
}

Measured memory_bytes: 51596
#include <bits/stdc++.h>
#define ull unsigned long long
#define ll long long
#define endl '\n'
#define pb push_back
#define mod 1000000007
#define mp make_pair
#define pi acos(-1)
#define line cout<<"----------------------------"<<endl
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL)
#define filein freopen("input.txt","r",stdin)
#define fileout freopen("output.txt","w",stdout)
using namespace std;
vector<ll >v;
int d;
ll dp[10009][2][105][2];
ll call(ll ind, bool check,ll sum,bool suru)
{
    if(ind==-1) return sum==0 and suru;
    ll cnt=0;
    ll limit=check? (v[ind]):9;
    ll &ret=dp[ind][check][sum][suru];
    if(ret!=-1 and !check) return ret;
    for(ll i=0;i<=limit;i++)
    {
        bool ck=(i==v[ind])? check:0;
        cnt+=call(ind-1,ck,(sum+i)%d,suru|i);
        cnt%=mod  ;
    }
    if(!check) ret=cnt; ///is used so that we can call this function without memset for another query
    return cnt;
}
ll  get(string x)
{
    for(int i=x.size()-1;i>=0;i--) v.pb(x[i]-'0');

    return call((int)v.size()-1,1,0,0);
}
int  main()
{
    memset(dp,-1,sizeof dp);
    string a;
    cin>>a>>d;
    cout<<get(a)<<endl;
}


Measured memory_bytes: 34304
#include <bits/stdc++.h>
#include<vector>
#include<set>
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test int t; cin>>t; while(t-->0)
#define pb push_back
#define pp pop_back
#define mk make_pair
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
#define ll long long
#define debug(i,x) cout<<"Case #"<<i<<": "<<x<<"\n"
#define debug1(i,x,y) cout<<"Case #"<<i<<": "<<x<<" "<<y<<"\n"
#define mx 1000000000
#define pi pair<int,int>
#define pl pair<long long,long long>
#define fi first
#define se second
using namespace std;
int main(){
    boost
  int n,k;
  cin>>n>>k;
  ll a[n];
  fo(i,n) cin>>a[i];
  ll dp[n];
  dp[0]=0;
  fo1(i,n-1){
    dp[i]=mx;
    for(int j=max(0,i-k);j<i;j++){
      dp[i]=min(dp[i],dp[j]+abs(a[i]-a[j]));
    }
  }
  cout<<dp[n-1];
}

Measured memory_bytes: 5208
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <bits/stdc++.h>

using namespace std;

bool cmp(const pair<long long,long long> &a,const pair<long long,long long> &b)
{
    return ((a.first+a.second)<(b.first+b.second));
}

bool cmp2(const pair<long long,long long> &a,const pair<long long,long long> &b)
{
    return ((a.first-a.second)<(b.first-b.second));
}

bool cmp3(const pair<long long,long long> &a,const pair<long long,long long> &b)
{
    return ((a.second-a.first)<(b.second-b.first));
}

int main()
{
    long long n,i,ans=0,x,y;
    cin>>n;
    std::vector<pair<long long,long long>> v;
    for(i=0;i<n;i++)
    {
        cin>>x>>y;
        v.push_back({x,y});
    }
    sort(v.begin(),v.end(),cmp);
    ans=max(ans,abs(v[n-1].first-v[0].first)+abs(v[n-1].second-v[0].second));
    sort(v.begin(),v.end(),cmp2);
    ans=max(ans,abs(v[n-1].first-v[0].first)+abs(v[n-1].second-v[0].second));
    sort(v.begin(),v.end(),cmp3);
    ans=max(ans,abs(v[n-1].first-v[0].first)+abs(v[n-1].second-v[0].second));
    cout<<ans;
    return 0;
}

Measured memory_bytes: 7460
#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(N: int, S: str):
    if N%2 == 1:
        print(NO)
        return 
    else:
        if S[:N//2]==S[N//2:]:
            print(YES)
        else:
            print(NO)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    solve(N, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3064
#include<iostream>
#include<bits/stdc++.h>
#include<vector>
#include<math.h>

using namespace std;

int main()
{
   int n, days, x, total = 0;

   cin >> n >> days >> x;

   vector<int> cc;

   for(int i = 0; i < n; i++)
   {
      int x;
      cin >> x;
      cc.push_back(x);
   } 

   for(int i = 0; i < n; i++)
   {
      int d = 1, count = 1;
      d += cc[i];
      while(d<=days)
      {
         count++;
         d+=cc[i];
      }

      total += count;
   } 

   cout << total + x;
}

Measured memory_bytes: 3572
/*
Though leaves are many , the root is one.
Through all the lying days of my youth
I swayed my leaves and flowers in the sun.
Now I may wither into the truth.
	  	  	- William Butler Yeats
*/
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
//#pragma GCC target("avx,tune=native")
#include<bits/stdc++.h>
#define int long long
#pragma comment("-Wl,--stack=1024000000")
//#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
const int inf=0x3f3f3f3f;
const double eps=1e-6;
const int mod=998244353;
typedef long long ll;
#ifndef LOCAL
#define cerr if(0)cout
#define eprintf(...) 0
#else
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#endif
inline string getstr(string &s,int l,int r){string ret="";for(int i=l;i<=r;i++)ret.push_back(s[i]);return ret;}
int modpow(int x,int y,int md=mod){int ret=1;do{if(y&1)ret=(ll)ret*x%md;x=(ll)x*x%md;}while(y>>=1);return ret;}
inline int Rand(){return rand()*32768+rand();}
int n,m;
int fact[1000005],inv[1000005];
int C(int nn,int mm){
	return fact[nn]*inv[mm]%mod*inv[nn-mm]%mod;
}
signed main(){
	cin>>n>>m;
	fact[0]=1;
	for(int i=1;i<=1e6;i++)fact[i]=fact[i-1]*i%mod;
	inv[1000000]=modpow(fact[1000000],mod-2);
	for(int i=1e6-1;i>=0;i--)inv[i]=inv[i+1]*(i+1)%mod;
	if(n>m)swap(n,m); 
	const int inv2=modpow(2,mod-2);
	int result=C(n+m,n)*m%mod;
	for(int i=1;i<=n;i++){
		int ways=C(i+i,i)*C(n-i+m-i,n-i)%mod;
		result+=ways*inv2%mod;
		result%=mod;
	}
	cout<<result*modpow(C(n+m,n),mod-2)%mod<<endl;
	return 0;
}

Measured memory_bytes: 19108
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		
		int n = stdIn.nextInt(); //n人の学生
		int m = stdIn.nextInt(); //m個のチェックポイント
		
		int[] x = new int[n]; //x座標
		int[] y = new int[n]; //y座標
		
		for(int i = 0; i < n; i++) {
			x[i] = stdIn.nextInt();
			y[i] = stdIn.nextInt();
		}
		
		int[] c = new int[m];
		int[] d = new int[m];
		
		for(int i = 0; i < m; i++) {
			c[i] = stdIn.nextInt();
			d[i] = stdIn.nextInt();
		}
		
		
		for(int i = 0; i < n; i++) {
			int min = Integer.MAX_VALUE; 
			int checkpoint = 0;
			
			for(int j = 0; j < m; j++) {
				
				int dis = Math.abs(x[i]-c[j])+Math.abs(y[i]-d[j]);
				
				if(dis < min) {
					min = dis;
					checkpoint = j+1;
				}
				
			}
			System.out.println(checkpoint);
			
		}
		
	}

}


Measured memory_bytes: 23252
#include <stdio.h>
 
int main (void) {
    char s[10];
    scanf("%s", s);

    int cnt = 0;

    for (int i = 0; i < 4; i++) {
        if (s[i] == s[i+1]) {
            cnt++;
        }
    }

    if (0 < cnt) printf("Bad");
    else {
        printf("Good");
    }
    
    return 0;
}

Measured memory_bytes: 128
N = int(input())
A = [int(_) for _ in input().split()]
A.sort()
mod = 7 + 10**9
Appropriate = True
ans = 1

if N % 2 == 0: #報告値はすべて奇数かつ1~N-1まで2回ずつ出る必要がある
    i = 0
    while i < N:
        if A[i] != i+1 or A[i+1] != i+1:
            Appropriate = False
            break
        else:
            ans *= 2
            ans %= mod
            i+=2
else: #報告値はすべて偶数で0が1回、2~N-1が2回ずつ出る必要がある
    i = 1
    if A[0] != 0 or A.count(0) > 2:
        Appropriate = False
    else:
        while i < N:
            if A[i] != i+1 or A[i+1] != i+1:
                Appropriate = False
                break
            else:
                ans *= 2
                ans %= mod
                i += 2

print(ans if Appropriate else 0)


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


int main(){
	ll h,w;
	cin>>h>>w;
	if(h==1||w==1)cout<<1<<endl;
	else if(h%2==1&&w%2==1){
		cout<<(h*w+1)/2<<endl;
	}else{
		cout<<(h*w)/2<<endl;
	}
	return 0;
}




Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mxn= 5e5+5;
#define mod 1000000007
#define endl '\n'
void rishabh(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}
int main(){
    int a,c,b,d;
    cin>>a>>b>>c>>d;
    int hor=(a-c);
    int ver=(b-d);
    cout<<c+ver<<' '<<d-hor<<' '<<a+ver<<' '<<b-hor;
}



Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
const int mxn(1e1 + 10), mxm(4e5 + 10);
const long long modl(1e9 + 7);
int nm, n, m, p, t, k, ans, l, r;
int a[mxn], b[mxn], h[mxn];
int main() {
  ios_base::sync_with_stdio(false);
//  freopen("in.txt", "r", stdin);///////////////////////////
//  cin >> nm;
//  string s;
  while (cin >> n) {
    while (n--) {
      cin >> p >> t;
      if (p == t) ++m;
      else m = 0;
      if (m == 3) {
        cout << "Yes";
        return 0;
      }
    }
    cout << "No";
//    cout << ans;
    cout << endl;
  }
  return 0;
}
////////////////////////////////////////////////////////////////////////////////


Measured memory_bytes: 3648
#include<iomanip>
#include <string>
#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include <stdio.h>
#include <numeric>
#include<math.h>
#include <ctype.h>
#include <algorithm> // sort
#include <map> // pair
using namespace std;
#define nin(n) int n; cin >> n;
#define kin(k) int k; cin >> k;
int main() {
  int n,m;
  cin >> n >> m;
  cout << pow(2,m)*(1900*m+100*(n-m)) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int, int>;

int main() {
    int N, K; cin >> N >> K;
    priority_queue<Pair> sushi; // (おいしさ, ネタ)
    priority_queue<Pair, vector<Pair>, greater<Pair>> que;
    for(int i = 0; i < N; ++i) {
        int t, d; cin >> t >> d; t--;
        sushi.emplace(d, t);
    }

    int cnt = 0;
    int64_t ans = 0, x = 0, sum = 0;
    map<int, int> ma;

    // まず、おいしさが大きい順に K 個選ぶ
    // その後、種類数が増加する場合のみを考える
    while(!sushi.empty()) {
        int d, t; tie(d, t) = sushi.top(); sushi.pop(); // 追加候補
        if(que.size() + cnt < K) {
            if(ma[t]++ == 0) x++, cnt++; // 1 個目(必ず選ぶ)
            else que.emplace(d, t); // 2 個目以降
            sum += d;
        } else {
            if(que.empty()) break;
            int cd, ct; tie(cd, ct) = que.top(); // 取り除く候補
            if(ma[t]) continue;
            que.pop();
            sum -= cd;
            ma[t]++, x++, cnt++;
            sum += d;
        }
        ans = max(ans, sum + x * x);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 4340
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <vector>
#include <map>
#include <cstring>
#include <string>
#include <deque>
#define inf (long long int)(1e19)
#define pb push_back
#define mod 1000000007
#define all(x) x.begin(),x.end()
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef pair<ll,ll> pll;


int main(void){
  ll n,k;
  cin>>n>>k;
  vector<pll> p;
  ll x,y;
  vector<ll> X,Y;
  for(int i=0;i<n;i++){
    cin>>x>>y;
    p.pb(pll(x,y));
    X.pb(x);Y.pb(y);
  }
  ll res=inf;
  sort(X.begin(),X.end());
  sort(Y.begin(),Y.end());
  for(int xi=0;xi<n;xi++){
    for(int xj=0;xj<n;xj++){
      for(int yi=0;yi<n;yi++){
        for(int yj=0;yj<n;yj++){
          ll x1=X[xi], x2=X[xj];
          ll y1=Y[yi], y2=Y[yj];
          int t=0;
          for(int i=0;i<n;i++){
            if(x1<=p[i].first and p[i].first<=x2 and y1<=p[i].second and p[i].second<=y2) t++;
          }
          if(t>=k) res=min(res,(x2-x1)*(y2-y1));
        }
      }
    }
  }
  cout<<res<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <string.h>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <vector>

using namespace std;

const int kMaxV = 10010;

int v, e, source = 0, dfs_clock = 0;
vector<int> g[kMaxV];
int pre[kMaxV] = {0};
int low[kMaxV] = {0};
int parent[kMaxV];
vector<int> is_cut;

void DFS(int u, int father) {
  int child_num = 0;
  ++dfs_clock;
  pre[u] = dfs_clock;
  low[u] = dfs_clock;
  for (int v: g[u]) {
    if (!pre[v]) {
      ++child_num;
      parent[v] = u;
      DFS(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] >= pre[u]) {
        is_cut.push_back(u);
      }
    } else if (v != father) {
      low[u] = min(low[u], pre[v]);
    }
  }
  if (father < 0 && child_num == 1) {
    is_cut.erase(remove(is_cut.begin(), is_cut.end(), source), is_cut.end());
  }
}

void ArticulationVertex() {
  memset(parent, source, sizeof(parent));
  DFS(source, -1);
  sort(is_cut.begin(), is_cut.end());
  is_cut.erase(unique(is_cut.begin(), is_cut.end()), is_cut.end());
}

int main() {
  scanf("%d %d", &v, &e);
  for (int i = 0; i < e; ++i) {
    int s, t;
    scanf("%d %d", &s, &t);
    g[s].push_back(t);
    g[t].push_back(s);
  }

  ArticulationVertex();
  for (auto u: is_cut) {
    printf("%d\n", u);
  }

  return 0;
}



Measured memory_bytes: 4388
#include <bits/stdc++.h>
 
using namespace std;
 
#define lli long long int
#define REP(i,s,l) for(lli i=s;i<l;i++)
#define DEBUG 0
#define INF (1LL<<50)
#define MOD 1000000007

map<lli,lli> makePrimeList2(lli n){
	map<lli,lli> m;
	lli a = 2;
	while(n>=a*a){
		if(n%a==0){
			m[a]++;
			n /= a;
		}
		else a++;
	}
	m[n]++;
	return m;
}

map<lli,lli> makePrimeList3(lli n){
	map<lli,lli> rtn;

	for(lli i=1;i<=n;i++){
		map<lli,lli> primeList = makePrimeList2(i);
		for(auto e:primeList){
			lli num = e.first;
			lli sum = e.second;
			rtn[num] += sum;
		}
	}
	return rtn;
}

signed main(){

	lli n;
	cin>>n;

	map<lli,lli> primeList = makePrimeList3(n);

	/*約数の数は素因数分解した数の+1を選択して75になればOK*/

	/*2の素数の数1,2,3,4,5,6..*/
	/*3の素数の数1,2,3,4,5,6..*/
	/*これを何個ずつか覚えて全探索していく*/
	/*75は5*5*3なので*/
	/*1. 75のみの数*/
	/*2. 3*25の場合*/
	/*3. 5*15の場合*/
	/*4. 3*5*5の場合*/
	/*これを数え上げる*/

	lli cnt=0;

	for(auto e:primeList)primeList[e.first]++;

	if(DEBUG){
		for(auto e:primeList){
			cout<<"i="<<e.first<<" primeList[i]="<<primeList[e.first]<<endl;
		
		}
	}
	
	/*#1*/
	for(auto e:primeList)if(e.second>=75)cnt++;
	//#2
	{
		lli cnt25=0,cnt3=0;
		for(auto e:primeList){
			if(e.second>=25)cnt25++;
			if(e.second>=3)cnt3++;
		}
		cnt += cnt25*(cnt3-1);
		if(DEBUG)cout<<cnt<<endl;
	}
	//#3
	{
		lli cnt5=0,cnt15=0;
		for(auto e:primeList){
			if(e.second>=15)cnt15++;
			if(e.second>=5)cnt5++;
		}
		cnt+=cnt15*(cnt5-1);
		if(DEBUG)cout<<cnt<<endl;
	}

	//#4
	{
		lli cnt5=0,cnt3=0;
		for(auto e:primeList){
			if(e.second>=5)cnt5++;
			if(e.second>=3)cnt3++;
		}
		cnt += cnt5*(cnt5-1)*(cnt3-2)/2;
		if(DEBUG)cout<<cnt<<endl;
	}

	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 256
def main():
    n, m = map(int, input().split())
    g = [[] for i in range(n)]
    for i in range(m):
        l, r, d = map(int, input().split())
        g[l - 1].append((r - 1, d))
        g[r - 1].append((l - 1, -d))
    dis = [0] * n
    visited = [False] * n
    stack = list(range(n))
    while len(stack):
        v = stack[-1]
        stack.pop()
        if visited[v]:
            continue
        visited[v] = True
        for u, d in g[v]:
            if not visited[u]:
                dis[u] = dis[v] + d
                stack.append(u)
    for v in range(n):
        for u, d in g[v]:
            if dis[v] + d != dis[u]:
                print('No')
                return
    print('Yes')


if __name__ == '__main__':
    main()


Measured memory_bytes: 87388
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define PI acos(-1)
#define Mod (int)1000000007
#define INFTY (int)INT_MAX
#define Rep(i, n) for (int i = 0; i < (int)(n); i++)
#define BitRep(i, n) for (int i = 0; i < (int)(1 << n); i++)
#define All(vec) vec.begin(), vec.end()
#define Part(vec, b, e) vec.begin() + b, vec.begin() + e
#define Sum(vec) accumulate(vec.begin(), vec.end(), 0)
#define Sort(vec) sort(vec.begin(), vec.end())
#define Reverse(vec) reverse(vec.begin(), vec.end())
#define Count(vec, x) count(vec.begin(), vec.end(), x)
#define Next_permutation(vec) next_permutation(vec.begin(), vec.end())
#define Find(vec, s) vec.find(s) != vec.end()
#define Set_union(A, B, res) set_union(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_intersection(A, B, res) set_intersection(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_difference(A, B, res) set_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));
#define Set_symmetric_difference(A, B, res) set_symmetric_difference(A.begin(), A.end(), B.begin(), B.end(), inserter(res, res.end()));

int main() {
	int N;
	cin >> N;
	vector<int> L(N);
	Rep(i, N) cin >> L[i];
	Sort(L);
	int ans = 0;
	for (int i = 0; i < N - 2; i++) {
		for (int j = i + 1; j < N - 1; j++) {
			int tmp = L[i] + L[j];
			for (int k = j + 1; k < N && tmp > L[k]; k++) ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

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

#include <math.h>
#include <stdlib.h>


#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

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 = 1001001001;
// long long max => LLONG_MAX

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    
    int n; cin >> n;
    vector<double> x(n);
    vector<double> y(n);
    for(int i = 0; i < n; i++) cin >> x[i] >> y[i];

    double sum = 0;
    for(int i = 0; i < n-1; i++){
        for(int j = i+1; j < n; j++){
            double dist2 = (x[i]-x[j]) * (x[i]-x[j]) + (y[i]-y[j]) * (y[i]-y[j]);
            sum +=  sqrt(dist2);
        }
    }

    double ans = sum * 2 / n;

    printf("%.10f\n", ans);
    return 0;
}


Measured memory_bytes: 256