akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<string>
#include<bitset>
#include<queue>
#include<set>
#include<map>
using namespace std;

#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define ROF(i,b,a) for (int i=(b);i>(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,n-1,-1)

typedef int i32;
typedef long long int i64;
typedef unsigned long long int ui64;
typedef float f32;
typedef double f64;
typedef long double f128;
typedef pair<int,int> Pi;

constexpr int INF = 1e9 + 7;
constexpr int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main() {
    int N; cin>>N;
    map<int,int> A;
    REP(i,N) {
        int tmp;
        cin>>tmp;
        A[tmp]++;
    }
    int ans=0;
    for (auto x: A) {
        if(x.second%2) ans++;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 4864
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define fastcin  ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;

int main(){

	fastcin
	
	ll x;
	cin >> x;	
	
	for(ll i = -200; i<=200; i++){
		for(ll j = -200; j<=200; j++){
			if((i*i*i*i*i)-(j*j*j*j*j) == x){
				cout << i << ' ' << j << endl;
				return 0;
			}	
		}
	}
	
	
	      
	return 0;
}


Measured memory_bytes: 3636
N, K = map(int, input().split())
R = N-K
RR = R-1
mod = 10**9+7

def nCr(n,r):
    K = 1
    for j in range(1,r+1):
        K = K*(n+1-j)//j
    return K

    
for i in range(K):
    ans = (nCr(K-1,i)%mod)*(nCr(N-K+1,i+1)%mod)
    ans = ans%mod
    print(ans)


Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
  cin>>N;
  int ans=0;
    if(N/100==7){
      ans++;}
  if((N-(N/100)*100)/10==7){
    ans++;
  }
  if(N%10==7){
    ans++;
  }
  
  if(ans==0){
    cout<<"No"<<endl;
  }
  else{
    cout<<"Yes"<<endl;
  }
}


Measured memory_bytes: 3592
#include<bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
using namespace __gnu_pbds;
typedef tree<pair<ll,pair<ll,ll> >, null_type, less<pair<ll,pair<ll,ll> > >, rb_tree_tag, tree_order_statistics_node_update>ordered_set;
#define me BOSS
#define bug() cout<<"AIkahne aise"<<endl
#define PI acos(-1)
/* Precode Start Here *\
     Sieve
void sieve()
{
    for(ll i=3; i<=2000; i+=2)
    {
        for(ll j=i*i; j<=4000000; j+=i)
            A[j]=1;
    }
    v.push_back(2);
    for(ll i=3; i<=4000000; i+=2)
        if(A[i]==0)
            v.push_back(i);
}

     Power Function Modulo P

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    long res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}


   factorial

ll fact(ll n)
{
    ll ans=1;
    for(ll i=1;i<=n;i++)
    {
        ans=(ans*i)%mod;
    }
    return ans;
}
     Calculating nCr using Fermats law Theorem

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}


ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (ll i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (ll i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}
     num of divisor and euler totient

ll phi[1000001],mark[1000001],divi[1000001];;
void divisorPhi(ll n)
{
    for(int i=1;i<=n;i++)
        phi[i]=i;
    for(int i=2;i<=n;i++)
    {
        if(!mark[i])
        {
            for(int j=i;j<=n;j+=i)
            {
                mark[j]=1;
                phi[j]*=(1-1/(double)i);
            }
        }
    }
    for(ll i=1;i<=n;i++)
    {
        for(ll j=i;j<=n;j+=i)
            divi[j]++;
    }
}
/* Precode Ends */
#define mod 1000000007
ll A[5000001],B[5000001];
vector<ll>v;
map<ll,ll>myMap;
set<ll>mySet;
vector<pair<ll,ll> >vp;
priority_queue<ll> pq;
priority_queue<ll, vector<ll>, std::greater<ll> > first;
ll po(ll a,ll n)
{
  ll ans=1;
  for(int i=1;i<=n;i++)
       ans*=a;
    return ans;
}

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

 ll s,w;
 cin>>s>>w;
 if(w>=s)
 {
     cout<<"unsafe"<<endl;
 }
 else
 {
     cout<<"safe"<<endl;
 }

return 0;
}



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

int main(){
 	string n,m;
	cin >>n >> m;
	vector<char> x(n.size());
	vector<char> y(m.size());
	for(int i = 0; i < n.size();i++)
      x[i] = n[i];
	for(int i = 0; i < m.size();i++)
      y[i] = m[i];
  	sort(x.begin(),x.end());
  	sort(y.begin(),y.end());
  	reverse(y.begin(), y.end());
  	for(int i = 0; i < min(n.size(),m.size());i++) {
    	if(x[i] <y[i]) {
         	cout << "Yes" << endl; 	
      		return 0;
        } else if(x[i] > y[i]) {
         	cout << "No" << endl;
         	return 0; 
        }
    }
  	if(n.size() < m.size())
	  	cout << "Yes" << endl;
	else 
      	cout << "No" << endl;
}

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

// Order statistics tree (if supported by judge!):
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;

// template<class TK, class TM> using order_tree = tree<TK, TM, less<TK>, rb_tree_tag, tree_order_statistics_node_update>;
// iterator	find_by_order(int r) (zero based)
// int		order_of_key(TK v)
// template<class TV> using order_set = order_tree<TV, null_type>;

#define x first
#define y second
#define rs resize
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define rep(i,a,b) for(auto i=(a);i!=(b); ++i)
#define REP(i,n) rep(i,0,n)
#define all(v) (v).begin(), (v).end()

typedef long long ll;
typedef pair<int, int> ii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<ii> vii;
template<class T> using min_queue = priority_queue<T, vector<T>, greater<T>>;

template<class T1, class T2>
ostream& operator<<(ostream &out, const pair<T1,T2> &a) { return out << '(' << a.x << ", " << a.y << ')'; }
template<class T1, class T2>
istream& operator>>(istream &in, pair<T1,T2> &a) { return in >> a.x >> a.y; }

template<class T> int sz(const vector<T> &v) { return (int) v.size(); }

template<class T> ostream& operator<<(ostream &os, vector<T> v) {
	os << "\n[";
	for(T &x : v) os << x << ',';
	return os << "]\n";
}

const int INF = 2147483647;
const ll LLINF = 9223372036854775807LL;

// lambda-expression: [] (args) -> retType { body }

void run() {
	int n, m;
	cin >> n >> m;
	cout << (n == m ? "Yes" : "No") << endl;
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cerr << boolalpha;
	(cout << fixed).precision(10);

	run();

	return 0;
}


Measured memory_bytes: 256
import java.util.HashMap;
import java.util.Iterator;
import java.util.Scanner;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
    	Scanner sc = new Scanner(System.in);
    	try {
    		int n = sc.nextInt();
    		HashMap<String, Long> histgrams = new HashMap<>();

    		for (int i=0; i<n; i++) {
    			String s = sc.next();
    			HashMap<Character, Long> map = new HashMap<>();
    			for (int j=0; j<s.length(); j++) {
    				Character c = s.charAt(j);
    				if (map.containsKey(c)) {
    					long count = map.get(c);
    					count++;
    					map.put(c,  count);
    				} else {
    					map.put(c, 1L);
    				}
    			}

    			// String mapStr = map.toString();
    			String mapStr = map.entrySet().stream().map(e -> e.getKey() + "=" + e.getValue()).sorted().collect(Collectors.joining(":"));
    			if (histgrams.containsKey(mapStr)) {
    				long count = histgrams.get(mapStr);
    				count++;
    				histgrams.put(mapStr, count);
    			} else {
    				histgrams.put(mapStr, 1L);
    			}
    		}

    		long sum = 0;
    		Iterator<String> it = histgrams.keySet().iterator();
    		while (it.hasNext()) {
    			long count = histgrams.get(it.next());
        		if (count >= 2) {
        			if (count % 2 == 0) {
        				sum += (count / 2) * (count - 1);
        			} else {
        				sum += count * ((count - 1) / 2);
        			}
        		}

    		}

    		System.out.println(sum);
    	} finally {
    		sc.close();
    	}
    }
}





Measured memory_bytes: 152608
x1,y1,x2,y2 = map(int,input().split())

X = x2 - x1
Y = y2 - y1

x3 = x2 - Y
y3 = y2 + X

x4 = x1 - Y 
y4 = y1 + X

print(x3,y3,x4,y4)

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

int main() {
  int time;
  
  // 標準入力から12月30日の時刻を取り込む
  cin >> time;
  
  if ( 1 <= time && 23 >= time ) {
  // 翌年までの時間を計算する。
  // 残り48時間から現在の時刻を引く。
  cout << 48 - time << endl;
  }
}


Measured memory_bytes: 256
n,C,*H=map(int,open(0).read().split());p=[0];P=[0]
for i in range(1,n):
 h=H[i];f=lambda I:p[I]+H[I]*(H[I]-2*h)
 while len(P)>1and f(P[0])>f(P[1]):P.pop(0)
 p+=[f(P[0])+h**2+C];h=0
 while len(P)>1and(H[P[-1]]-H[P[-2]])*(f(P[-1])-f(i))>(H[i]-H[P[-1]])*(f(P[-2])-f(P[-1])):P.pop()
 P+=[i]
print(p[-1])

Measured memory_bytes: 27240
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define rep1(i,n) for(int i=1;i<=(int)n;i++)
#define sp(n) cout << fixed << setprecision(n)
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; }
typedef long long ll;
using namespace std;
int main(void){
    int n;cin>>n;string s;cin>>s;
    int res=0;
    rep(i,s.size()){
        int buf=0;
        string x=s.substr(0,i+1),y=s.substr(i+1,s.size()-i);
        map<char,int> mp1,mp2;
        rep(j,x.size())mp1[x[j]]++;
        rep(j,y.size())mp2[y[j]]++;
        for(auto& p:mp1){
            if(mp2[p.first]!=0)buf++;
        }
        chmax(res,buf);
    }
    cout<<res<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  int k;
  cin >> k;
  vector<LL> a;
  for(int i = 1; i <= 9; ++i) a.push_back(i);
  int I = 0;
  while(a.size() < k) {
    int d = a[I] % 10;
    for(int j = max(0, d - 1); j <= min(d + 1, 9); ++j) {
      a.push_back(a[I] * 10 + j);
    }
    ++I; 
  }
  cout << a[k - 1] << '\n';
}


Measured memory_bytes: 1400
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n, k = map(int, input().split())
    r, s, p = map(int, input().split())
    t = input()
    pre = []

    def win_point(a):
        if a == 'r':
            pre.append('r')
            return p
        elif a == 's':
            pre.append('s')
            return r
        else:
            pre.append('p')
            return s

    ans = 0
    for i, j in enumerate(t):
        if i < k:
            ans += win_point(j)
        elif j != pre[i-k]:
            ans += win_point(j)
        else:
            pre.append('xx')
    print(ans)

if __name__ == '__main__':
    main()


Measured memory_bytes: 4212
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = Integer.parseInt(sc.next());
        HashMap<Integer, Integer> h = new HashMap<>();
        for (int i = 0; i < n; i++) {
            int a = Integer.parseInt(sc.next());
            if (h.containsKey(a)) {
                h.put(a, h.get(a) + 1);
            } else {
                h.put(a, 1);
            }
        }
        sc.close();
        long ans = 0;
        for (int k : h.keySet()) {
            if (h.get(k) > k) {
                ans += h.get(k) - k;
            } else if (h.get(k) < k) {
                ans += h.get(k);
            }
        }
        System.out.println(ans);
    }
}

Measured memory_bytes: 51680
//参考：https://qiita.com/DaikiSuyama/items/9dba963ba74396b9b7fd
//インクルード(アルファベット順)
#include <algorithm>     //sort,二分探索,など
#include <bitset>        //固定長bit集合
#include <cmath>         //pow,logなど
#include <complex>       //複素数
#include <deque>         //両端アクセスのキュー
#include <functional>    //sortのgreater
#include <iomanip>       //setprecision(浮動小数点の出力の誤差)
#include <iostream>      //入出力
#include <iterator>      //集合演算(積集合,和集合,差集合など)
#include <map>           //map(辞書)
#include <numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include <queue>         //キュー
#include <set>           //集合
#include <stack>         //スタック
#include <string>        //文字列
#include <unordered_map> //イテレータあるけど順序保持しないmap
#include <unordered_set> //イテレータあるけど順序保持しないset
#include <utility>       //pair
#include <vector>        //可変長配列

using namespace std;
typedef long long ll;

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = n - 1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
//xにはvectorなどのコンテナ
#define ALL(x) (x).begin(), (x).end() //sortなどの引数を省略したい
#define SIZE(x) ((ll)(x).size())      //sizeをsize_tからllに直しておく
//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007    //10^9+7:合同式の法
#define MAXR 100000       //10^5:配列の最大のrange(素数列挙などで使用)
//略記
#define PB push_back //vectorヘの挿入
#define MP make_pair //pairのコンストラクタ
#define FIR first    //pairの一つ目の要素
#define SEC second   //pairの二つ目の要素

signed main()
{
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll N;
    string S;

    cin >> N;
    cin >> S;

    ll ans = 0;
    FOR(i, 0, N - 3)
    {
        if (S.substr(i, 3) == "ABC")
        {
            ans++;
        }
    }

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


Measured memory_bytes: 3664
package main

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

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	splited := strings.Split(sc.Text(), " ")

	stack := []int{}
	for _, sp := range splited {
		if !isOperator(sp) {
			num, err := strconv.Atoi(sp)
			if err != nil {
				panic(err)
			}
			stack = append(stack, num)
			continue
		}

		sum := calc(sp, stack[len(stack)-2], stack[len(stack)-1])
		stack = stack[:len(stack)-2]
		stack = append(stack, sum)
	}

	fmt.Println(stack[len(stack)-1])
}

func isOperator(s string) bool {
	flg := false

	switch s {
	case "+":
		flg = true
	case "-":
		flg = true
	case "*":
		flg = true
	default:
		flg = false
	}
	return flg
}

func calc(op string, val0, val1 int) int {
	rslt := 0
	switch op {
	case "+":
		rslt = val0 + val1
	case "-":
		rslt = val0 - val1
	case "*":
		rslt = val0 * val1
	default:
		panic("XXX")
	}

	return rslt
}



Measured memory_bytes: 1124
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <climits>
#include <set>
#include <deque>
#include <queue>

#define DEBUG(x) cout << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {

	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";

    return out;

}

int main() {

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

	int n ,m;
	cin >> n >> m;

	priority_queue<double, vector<double> > prices;
	int p;
	for (int i = 0; i < n; ++i) {
		cin >> p;
		prices.push(p);
	}

	while (m) {
		double top = prices.top();
		prices.pop();
		prices.push(top / 2.0);
		--m;
	}

	long long min_price = 0;
	while (!prices.empty()) {
		double top = prices.top();
		min_price += (int) top;
		prices.pop();
	}

	cout << min_price << "\n";

	return 0;

}

Measured memory_bytes: 1400
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long p = 1l;
        for (int i = 0;i < n; i++){
            p = p*(i+1) % 1000000007;
        }
        System.out.println(p);
    }     
}

Measured memory_bytes: 21332
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

w,h,n = inpl()
a = [inpl() for i in range(n)]
sq = [[False] * w for i in range(h)]
for i in a:
    if i[2] == 1:
        for x in range(i[0]):
            for y in range(h):
                sq[y][x] = True
    elif i[2] == 2:
       for x in range(i[0],w):
            for y in range(h):
                sq[y][x] = True
    elif i[2] == 3:
        for y in range(i[1]):
            for x in range(w):
                sq[y][x] = True
    else:
        for y in range(i[1],h):
            for x in range(w):
                sq[y][x] = True
res = 0
for i in range(h):
    res += sq[i].count(False)
print(res)


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

int main() {
	int N, over = 0, sum = 0;
	int ans = 0, move = 0;
	cin >> N;
	for (int i = 1; i <= (N + 2) / 2; i++) {
		sum = (1 + i)*i / 2;
		if (sum > N) {
			over = i;
			break;
		}
		else if (sum == N) {
			ans = i;
			break;
		}
	}
	if (ans != 0) {
		for (int i = 1; i <= ans; i++) {
			cout << i << endl;
		}
	}
	else {
		int remove = sum - N;
		for (int i = 1; i <= over; i++) {
			if (i != remove)cout << i << endl;
		}
	}
	return 0;
}

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

void bubbleSort(int *,int);
void swap(int*,int*);

int main(){
  int i,n,a,*tmp;

  scanf("%d",&n);

  tmp = (int*)malloc(n*sizeof(int));

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

  bubbleSort(tmp,n);
  
  free(tmp);
  return 0;
  
}

void bubbleSort(int *x,int n){
  int i,j,count=0,minj;
  for(i=0;i<n-1;i++){
    minj=i;
    for(j=i;j<n;j++){
      if(x[j] < x[minj]){
	minj=j;
      }
    }
    if(i<minj){
    swap(&x[i],&x[minj]);
    count++;
    }
    
    printf("%d ",x[i]);
  }
  printf("%d\n",x[n-1]);
  printf("%d\n",count);
}

void  swap(int *x, int *y)
{
    int  work;   

    work = *x;   
    *x = *y;     
    *y = work;  
}

Measured memory_bytes: 600
#!/usr/bin/env python
#-*- coding: utf-8 -*-

import sys

if __name__ == '__main__':
    while 1:
        line = raw_input()
        if line == '0 0':
            break
        a, b = map(int, line.split())
        s0 = ''.join('#' if i % 2 == 0 else '.' for i in range(b))
        s1 = ''.join('.' if i % 2 == 0 else '#' for i in range(b))
        for i in range(a):
            if i % 2 == 0:
                print s0
            else:
                print s1
        print



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

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		char[] s = sc.next().toCharArray();
		if(s[0] == s[1] && s[1] == s[2])
			System.out.println("No");
		else
			System.out.println("Yes");

	}

}

Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;

#define N_MAX 100000
#define M_MAX 100000
 
typedef struct {
	int a;
	int b;
} hw;
 
 
const hw vector8[8] = {
	{-1, -1},
	{-1,  0},
	{-1, +1},
	{ 0, -1},
	{ 0, +1},
	{+1, -1},
	{+1,  0},
	{+1, +1}
};
 
ull n, m;
ull h, w;
ull k;
ull va, vb, vc, vd, ve, vf;
// ull a[N_MAX];
// sll a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
char s[N_MAX + 1];
// char t[N_MAX + 1];
// char s[N_MAX][M_MAX + 1];
// hw arr[N_MAX];
// hw brr[M_MAX];
// ull digitdp[102][   2][    2];
//          pos  less  carry
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}
 
ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}
 
// int nextroute(int arr[]){
// 	int i = n - 1;
// 	int j, x;
// 	while (arr[i - 1] > arr[i]) i--;
 
// 	x = n;
// 	for (j = i; j < n; j++) {
// 		if (arr[j] < arr[i - 1]) continue;
// 		if (x == n || arr[x] > arr[j]) x = j;
// 	}
// 	arr[i - 1] ^= arr[x];
// 	arr[x] ^= arr[i - 1];
// 	arr[i - 1] ^= arr[x];
 
// 	qsort(&arr[i], n - i, sizeof(int), comp);
// 	return 0;
// }
 
int nibutan_target(ull target){
	ull maxdist = (target * (target + 1) / 2); // 時刻targetまでに到着できる距離は[-maxdist, maxdist]
	return (n <= maxdist);
}
 
int targetdig(ull x, int index /* 1-indexed */){
	// static...?
	int posmax = digits(x);
	if (posmax < index) return -1;
	while (posmax > index) {
		posmax--;
		x /= 10;
	}
	return x % 10;
}
 
int intcomp(const void *left, const void *right){
	if ((*(int*)left) < (*(int*)right)) {
		return -1;
	} else if ((*(int*)left) > (*(int*)right)) {
		return +1;
	} else {
		return 0;
	}
}
 
int ullcomp(const void *left, const void *right){
	if ((*(ull*)left) < (*(ull*)right)) {
		return -1;
	} else if ((*(ull*)left) > (*(ull*)right)) {
		return +1;
	} else {
		return 0;
	}
}
 
int hwAcomp(const void *left, const void *right){
	return intcomp(&(((hw*)left)->a), &(((hw*)right)->a));
}
 
int hwBcomp(const void *left, const void *right){
	return intcomp(&(((hw*)left)->b), &(((hw*)right)->b));
}
 
int hwABcomp(const void *left, const void *right){
	int x = hwAcomp(left, right);
	if (x) return x;
	return hwBcomp(left, right);
}

ull solve(){
	int i, j;

	s[strlen(s) - 8] = 0;
	puts(s);

	return 0;
}
 
int main(void){
	int i, j;
 
	scanf("%s", s);

	solve();
 
	return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
#include <string.h>
int main()
{
  int H, W;
  int map[52][52];
  char b;
  int ok = 1;
  memset(map,0,sizeof(int)*52*52);
  scanf("%d%d%*c",&H,&W);
  for(int i = 1; i < H+1; i++)
    {
      for (int j = 1; j < W+1; j++)
	{
	  scanf("%c",&b);
	  if(b == '#')
	    {
	      map[i][j] = 1;
	    }
	  else
	    {
	      map[i][j] = 0;
	    }
	}
      scanf("%*c");
    }
  for(int i = 1; i < H+1; i++)
    {
      for(int j = 1; j < W+1; j++)
	{
	  if(map[i][j])
	    {
	      if(!(map[i-1][j] + map[i+1][j] + map[i][j-1] + map[i][j+1]))
		{
		  ok = 0;
		}
	    }
	}
      printf("\n");
    }
  if(ok)
    {
      printf("Yes\n");
    }
  else
    {
      printf("No\n");
    }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
int a,b,x=1,y,n=2,m;
int main()
{
    cin>>a>>b;
    while (n!=(a+1)&&a!=1&&n<13)
    {
        if (n<=b&&n==a)
            x++;
        else if (n!=a)
            x++;
        n++;
    }
    cout<<x;
    return 0;
}



Measured memory_bytes: 384
n, m = map(int, input().split())
ka = [list(map(int, input().split()))[1:] for _ in range(n)]

ans = 0
for i in range(1, m+1):
  cnt = 0
  for j in ka:
    if i in j:
      cnt += 1
  if cnt == n:
    ans += 1
print(ans)
    

Measured memory_bytes: 2940
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

// typedef
typedef long long ll;
typedef unsigned long long ul;

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)
struct _score {
  ll p = 0, r = 0, s = 0;
};
int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  ll n, k, r, s, p;
  cin >> n >> k;
  cin >> r >> s >> p;
  map<char, _score> score;
  score['r'] = {p, 0, 0};
  score['s'] = {0, r, 0};
  score['p'] = {0, 0, s};
  vector<vector<char>> a(k, vector<char>(0));
  rep(i, n) {
    char temp;
    cin >> temp;
    a[i % k].push_back(temp);
  }
  ll res = 0;
  rep(i, k) {
    ll rr = 0, ss = 0, pp = 0;
    ll nrr, nss, npp;
    for (char j : a[i]) {
      nrr = max(ss + score[j].r, pp + score[j].r);
      npp = max(rr + score[j].p, ss + score[j].p);
      nss = max(pp + score[j].s, rr + score[j].s);
      rr = nrr;
      pp = npp;
      ss = nss;
    }
    res += max(rr, max(pp, ss));
  }
  cout << res << endl;

  return 0;
}


Measured memory_bytes: 5120
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<bool> vb;
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define sq(x) ((x)*(x))
#define fo(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<n;i++)
#define Fo(i,n) for(int i=1;i<=n;i++)
#define all(x) x.begin(),x.end()
#define allr(x) x.rbegin(),x.rend()
#define deb(x) cout<<#x<<"="<<x<<"\n"
#define deb2(x,y) cout<<#x<<"="<<x<<" "<<#y<<"="<<y<<"\n"
#define fi first
#define se second
const double pi = 3.14159265358979323846;
#define uni(c) (c).resize(unique(all(c))-(c).begin())
#define fast ios_base::sync_with_stdio(0);cin.tie(NULL)
//pair <int, int> w[4] = {mp(-1, 0), mp(0, -1), mp(1, 0), mp(0, 1)};   // for matrix movement:
void cp()
{
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif // ONLINE_JUDGE
}
void solve()
{
    string s, t; cin >> s >> t;
    ll ans = 0;
    for (int i = 0; i <= s.size() - t.size(); i++)
    {
        ll c = 0;
        for (int j = 0; j < t.size(); j++)
        {
            if (s[i + j] == t[j])
                c++;
        }
        ans = max(ans, c);
    }
    cout << t.size() - ans;
}
int main()
{
    fast;
    //cp();
    ll t = 1;
    //cin >> t;
    while (t--)
        solve();


    return 0;
}

Measured memory_bytes: 3632
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readC(T...)(size_t n,ref T t){foreach(ref v;t)v=new typeof(v)(n);foreach(i;0..n){auto r=rdsp;foreach(ref v;t)pick(r,v[i]);}}

void main()
{
  int n, t; readV(n, t);
  int[] w, v; readC(n, w, v);

  auto s = v.sum;
  auto dp = new long[][](n+1, s+1);
  foreach (ref dpi; dp) dpi[] = 10L^^18;
  dp[0][0] = 0;

  foreach (i; 0..n)
    foreach (j; 0..s+1) {
      dp[i+1][j] = dp[i][j];
      if (j >= v[i])
        dp[i+1][j] = min(dp[i+1][j], dp[i][j-v[i]] + w[i]);
    }

  foreach_reverse (i; 0..s+1)
    if (dp[$-1][i] <= t) {
      writeln(i);
      return;
    }
}


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

int main() {
    int n;
    cin >> n;
    long long ar[n];
    long long ans[n];
    
    
    for (int i=0;i<n;i++){
        cin >> ar[i];
        ans[i]=0;
    }
    
    ans[0]=0;
    ans[1]=abs(ar[1]-ar[0]);
    
    for (int i=2;i<n;i++){
        ans[i]=min(ans[i-1]+abs(ar[i]-ar[i-1]),ans[i-2]+abs(ar[i]-ar[i-2]));
    }
    
   // cout << 1;
    cout << ans[n-1] << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n;
  cin>>n;
  long freq[n+1];
  int arr[n+1];
  for(int i=1;i<=n;i++)
    freq[i]=0;
  for(int i=1;i<=n;i++)
  {
    int x;
    cin>>x;
    arr[i]=x;
    freq[x]++;
  }
  long sum=0;
  for(int i=1;i<=n;i++)
  {
    if(freq[i]<2)
      continue;
    sum+=(freq[i]*(freq[i]-1))/2;
  }
  for(int i=1;i<=n;i++)
  {
    if(freq[arr[i]]<2)
      cout<<sum<<endl;
    else
    {
      long ans=sum-(freq[arr[i]]*(freq[arr[i]]-1))/2+((freq[arr[i]]-1)*(freq[arr[i]]-2))/2;
      cout<<ans<<endl;
    }
  }
  return 0;
}

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

main() {
    int A,B; cin >> A >> B;
    if(A<=8 && B<=8)cout << "Yay!" << endl;
    else cout << ":(" << endl;

    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef string str;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;

#define X first
#define Y second
#define PB push_back
#define For(i,a,b) for (int i=a;i<b;i++)
#define Ford(i,a,b) for (int i=a;i>=b;i--)
#define smax(a,b) a=max(a,b)
#define smin(a,b) a=min(a,b)
#define SZ(a) ((ll)a.size())
#define E(a) cout << #a << ' ' << a << '\n'


const ll M=5e5+5,LG=17,inf=1e18;

ll n;

ll a[M];

int main()
{
	cin >> n;
	if (n==1)
	{
		cout << "YES";
		return 0;
	}
	ll s=0;
	For(i,0,n)
	{
		cin >> a[i];
		s+=a[i];
	}
	ll t=n*(n+1)/2;
	if (s%t)
	{
		cout << "NO";
		return 0;
	}
	t=s/t;
	ll ss=t;
	a[n]=a[0];
	For(i,0,n)
	{
		ll x=a[i]-a[i+1]+t;
		if (x<0 || x%n)
		{
			cout << "NO";
			return 0;
		}
		ss-=x/n;
	}
	cout << (ss==0?"YES":"NO"); 
}


Measured memory_bytes: 1024
def i1():
 return int(input())
def i2():
 return [int(i) for i in input().split()]
n=i1()
a=i2()
for i in range(n):
 a[i]-=i+1
a=sorted(a)
b=n//2
if n%2:
   c=a[b]
   for i in range(n):
     a[i]=abs(a[i]-c)
else:
   b=(a[b]+a[b-1])//2
   for i in range(n):
     a[i]=abs(a[i]-b)
print(sum(a))

Measured memory_bytes: 88404
#include<bits/stdc++.h>
#define del(a,i) memset(a,i,sizeof(a))
#define ll long long
#define inl inline
#define il inl void
#define it inl int
#define ill inl ll
#define re register
#define ri re int
#define rl re ll
#define mid ((l+r)>>1)
#define lowbit(x) (x&(-x))
#define INF 0x3f3f3f3f
using namespace std;
template<class T>il read(T &x){
	int f=1;char k=getchar();x=0;
	for(;k>'9'||k<'0';k=getchar()) if(k=='-') f=-1;
	for(;k>='0'&&k<='9';k=getchar()) x=(x<<3)+(x<<1)+k-'0';
	x*=f;
}
template<class T>il _print(T x){
	if(x/10) _print(x/10);
	putchar(x%10+'0');
}
template<class T>il print(T x){
	if(x<0) putchar('-'),x=-x;
	_print(x);
}
ll mul(ll a,ll b,ll mod){long double c=1.;return (a*b-(ll)(c*a*b/mod)*mod)%mod;}
it qpow(int x,int m,int mod){
	int res=1,bas=x;
	while(m){
		if(m&1) res=(1ll*res*bas)%mod;
		bas=(1ll*bas*bas)%mod,m>>=1;
	}
	return res;
}
const int MAXN = 20;
int n,k,x,y,ans,a[MAXN];
vector<pair<int,int> > G[MAXN];
il chk(){
	int res=0;
	for(ri i=1;i<=n;++i){
		if(!a[i]) continue;
		++res;
		for(ri j=0;j<(int)G[i].size();++j){
			int x=G[i][j].first,y=G[i][j].second;
			if(a[x]!=y) return ;
		}
	}
	ans=max(ans,res);
}
il DFS(int pos){
	if(pos==n+1) return chk(),void();
	a[pos]=0,DFS(pos+1);
	a[pos]=1,DFS(pos+1);
}
int main(){
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	read(n);
	for(ri i=1;i<=n;++i){
		read(k);
		for(ri j=1;j<=k;++j)
			read(x),read(y),G[i].push_back(make_pair(x,y));
	}
	DFS(1);
	print(ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(int I = int(A); I < int(B); ++I)
#define FORR(I,A,B) for(int I = int((B)-1); I >= int(A); --I)
#define TO(x,t,f) ((x)?(t):(f))
#define SORT(x) (sort(x.begin(),x.end())) // 0 2 2 3 4 5 8 9
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v  x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v  x is sorted
#define NUM(x,v) (POSU(x,v)-POSL(x,v))  //x is sorted
#define REV(x) (reverse(x.begin(),x.end())) //reverse
ll gcd(ll a,ll b){if(a<b)swap(a,b);if(a%b==0)return b;return gcd(b,a%b);}
ll lcm(ll a,ll b){ll c=gcd(a,b);return ((a/c)*(b/c)*c);}//saisyo kobaisu
#define NEXTP(x) next_permutation(x.begin(),x.end())
const ll INF=1e18+7;
const ll MOD=1e9+7;
#define pri(a) cout << (a) << endl

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int N,hmax=0;
	cin >> N;
	vector<int> h(N);
	FOR(i,0,N){
		cin>>h[i];
		hmax = max(hmax,h[i]);
	}
	int ans = 0;

	for(int i=1;i<=hmax;i++){
		bool did = false;
		for(int j=0;j<N;j++){
			if( h[j]>0 && (not did)){
				ans++;
				did = true;
			}else if(h[j]==0){
				did = false;
			}
			if(h[j]!=0)h[j]--;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<set>
#define  endl '\n'
#define all(s) s.begin(),s.end()
#define lowbit(x) (x&-x)
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define mem(a,b) memset(a,b,sizeof(a))
#define fi first
#define se second
#define pb push_back
#define PI acos(-1.0)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int mod=1e9+7;
const double eps=1e-8;
const int inf=0x3f3f3f3f;
const int N=2e5+10;
struct node{
	int l,r,val,w;
}p[59];
int n,m,q,ans=0;
int a[11]={1,1,1,1,1,1,1,1,1,1,1};
void dfs(int num,int last)
{	
	if(num==n+1){
		int now=0;
		for(int i=1;i<=q;i++){
			if(a[p[i].r]-a[p[i].l]==p[i].w) now+=p[i].val;
		}
		ans=max(ans,now);
		return;
	}
	for(int i=last;i<=m;i++){
		a[num]=i;
		dfs(num+1,i);
	}
}
int main()
{
	int k;
	scanf("%d%d%d",&n,&m,&q);
	for(int i=1;i<=q;i++){
		scanf("%d%d%d%d",&p[i].l,&p[i].r,&p[i].w,&p[i].val);
	}
	dfs(1,1);
	cout<<ans;
}


Measured memory_bytes: 3256
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const int inf=1e9+7;
const ll INF=1LL<<60 ;
const ll mod=1e9+7 ;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define debug(x)  cerr << #x << " = " << (x) << endl;
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; }
#define int long long

void solve() {
	int n, m; cin >> n >> m;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
	sort(all(a));
	vector<int> sum(n + 1, 0);
	rep(i, n) {
		sum[i + 1] = sum[i] + a[i];
	}
	int ok = 0, ng = inf;
	while(ng - ok > 1) {
		int mid = (ok + ng) / 2;
		int cnt = 0;
		rep(i, n) {
			cnt += (a.end() - lower_bound(all(a), mid - a[i]));
		}
		if(cnt >= m) {
			ok = mid;
		} else {
			ng = mid;
		}
	}
	//cerr << ok << endl;
	int ans = 0;
	int cnt1 = 0;
	rep(i, n) {
		int cnt = (a.end() - lower_bound(all(a), ok - a[i]));
		cnt1 += cnt;
		ans += cnt * a[i] + sum[n] - sum[n - cnt];
	}
	if(cnt1 > m) {
		ans -= ok * (cnt1 - m);
	}
	cout << ans << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Measured memory_bytes: 1792
/*Lucky_Glass*/
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int F[4][2]={0,1,1,2,2,3,0,0};
int main()
{
	char S[10];scanf("%s",S);
	bool d[30]={};
	for(int i=0;i<3;i++)
	{
		if(d[S[i]-'a'])
		{
			puts("No");
			return 0;
		}
		d[S[i]-'a']=true;
	}
	puts("Yes");
	return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    ll n, k;
    cin >> n >> k;
    vector<ll> v[n];

    rep(i, n)
    {
        ll t, d;
        cin >> t >> d;
        t--;
        v[t].push_back(d);
    }

    rep(i, n) sort(ALL(v[i]), greater<ll>());

    vector<ll> y0, y1;
    rep(i, n)
    {
        rep(j, v[i].size())
        {
            if (j == 0)
                y1.push_back(v[i][j]);
            else
                y0.push_back(v[i][j]);
        }
    }

    sort(ALL(y0), greater<ll>());
    sort(ALL(y1), greater<ll>());

    ll ans = 0;

    ll u = min((ll)k - 1, (ll)y0.size());
    rep(i, u) ans += y0[i];

    ll cnt = k - u;
    rep(i, cnt) ans += y1[i];
    ans += (cnt * cnt);
    int j = 1;
    ll sum = ans;
    for (ll i = (ll)cnt; i < min((ll)y1.size(), (ll)k); i++)
    {
        sum = sum - i * i;
        sum -= y0[u - j];
        sum += y1[i];
        sum += (i + 1) * (i + 1);
        j++;
        ans = max(ans, sum);
    }

    OP(ans);
    return 0;
}

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

void hanafudaShuffle(int p, int c, int n, int* cards) {
    int* cutCards = new int [c];
    for (int i = 0; i < c; i++) {
        cutCards[i] = cards[p - 1 + i];
    }
    for (int i = p - 2; i >= 0; i--) {
        cards[c + i] = cards[i];
    }
    for (int i = 0; i < c; i++) {
        cards[i] = cutCards[i];
    }
    delete[] cutCards;
}

int main() {
    while (true) {
        int n, r;
        cin >> n >> r;
        if ((n | r) == 0) {
            break;
        }
        int* cards = new int [n];
        for (int i = 0; i < n; i++) {
            cards[i] = n - i;
        }
        for (int i = 0; i < r; i++) {
            int p, c;
            cin >> p >> c;
            hanafudaShuffle(p, c, n, cards);
        }
        cout << cards[0] << endl;
        delete[] cards;
    }
}

Measured memory_bytes: 0
using System;
using System.IO;

class Solve {
    static void Main(string[] args) {
        var N = int.Parse(Console.ReadLine());
        var answer = N;
        for (int i = 0; i <= N; i++) {
            var result = 0;
            var x = i;
            while (x > 0) {
                result += x % 9;
                x /= 9;
            }
            x = N - i;
            while (x > 0) {
                result += x % 6;
                x /= 6;
            }
            answer = Math.Min(answer, result);
        }
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();
    }
}

Measured memory_bytes: 27388
#include <iostream>
#include <stdio.h>
#include <string>

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

typedef long long ll;

using namespace std;

const int INF = 1e9;
const int MOD = 1e9+7;
const double PI=3.14159265358979323846;

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

  if(s==u) cout << a-1 << " " << b << endl;
  if(t==u) cout << a << " " << b-1 << endl;  
}


Measured memory_bytes: 256
n = gets.to_i
arr = []
n.times do
    arr.push(gets.to_i)
end

cnt = 0
gArr = []
k = 1
while k < n do
    gArr.push(k)
    k = k * 3 + 1
end
gArr.push(1) if gArr.empty?
m = gArr.size
gArr.reverse!

gArr.each do |g|
    for i in g.upto(n - 1) do
        v = arr[i]
        j = i - g
        while j >= 0 && arr[j] > v do
            arr[j + g] = arr[j]
            j = j - g
            cnt += 1
        end
        arr[j + g] = v
    end
end

puts m
puts gArr.join(' ')
puts cnt
puts arr.join("\n")


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

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

    int sum = 1;
    for (int i = 1; i < N + 1; i++) {
        if (i * (i + 1) / 2 >= N) {
            sum = i;
            break;
        }
    }

    vector<int> A;
    A.push_back(sum);
    N -= sum;
    for (int i = sum - 1; i > 0; i--) {
        if (N >= i) {
            A.push_back(i);
            N -= i;
        }
    }

    int j = A.size();
    for (int i = 0; i < j; i++) {
        cout << A[j - i - 1] << endl;
    }

    return 0;
}


Measured memory_bytes: 3652
#!/usr/bin/env python3
# CGL_7_G: Circles - Common Tangent

from math import acos, atan2, cos, hypot, isclose, pi, sin


def tangent_points(circle1, circle2):
    x1, y1, r1 = circle1
    x2, y2, r2 = circle2

    c1c2 = hypot(x2-x1, y2-y1)
    t0 = atan2(y2-y1, x2-x1)
    ps = []

    r1r2 = r1+r2
    if isclose(c1c2, r1r2):
        ps.append((x1 + r1*cos(t0), y1 + r1*sin(t0)))
    elif c1c2 > r1r2:
        t1 = acos(r1r2 / c1c2)
        ps.append((x1 + r1*cos(t0+t1), y1 + r1*sin(t0+t1)))
        ps.append((x1 + r1*cos(t0-t1), y1 + r1*sin(t0-t1)))

    r1r2 = r1-r2
    if isclose(c1c2, abs(r1r2)):
        if r1r2 > 0.0:
            t1 = 0.0
        else:
            t1 = pi
        ps.append((x1 + r1*cos(t0+t1), y1 + r1*sin(t0+t1)))
    elif c1c2 > abs(r1r2):
        if r1r2 > 0.0:
            t1 = acos(r1r2 / c1c2)
        else:
            t1 = pi - acos(-r1r2 / c1c2)
        ps.append((x1 + r1*cos(t0+t1), y1 + r1*sin(t0+t1)))
        ps.append((x1 + r1*cos(t0-t1), y1 + r1*sin(t0-t1)))

    return ps


def run():
    c1 = [int(i) for i in input().split()]
    c2 = [int(i) for i in input().split()]

    ps = tangent_points(c1, c2)

    for p in sorted(ps):
        print("{:.10f} {:.10f}".format(*map(eliminate_minus_zero, p)))


def eliminate_minus_zero(f):
    if isclose(f, 0.0, abs_tol=1e-9):
        return 0.0
    else:
        return f


if __name__ == '__main__':
    run()



Measured memory_bytes: 5800
#include <iostream>
#include <algorithm>
#include <stdio.h>
#include <string>
#include <vector>
#include <map>
#include <math.h>
#include <numeric>
#include <queue>
#include <stack>
#include <utility>
#include <queue>
using namespace std;
typedef long long int lld;
typedef pair<int, int> pii;

const int MAXN = 200002;

int n;
lld M, arr[MAXN], L[MAXN], R[MAXN];

lld _L(int i, int j) {
  if (i > j) return 0;
  if (j >= n) j = n-1;
  if (i <= 0) return L[j];
  return L[j] - L[i-1];
}

lld _R(int i, int j) {
  if (i > j) return 0;
  if (i < 0) i = 0;
  if (j >= n-1) return R[i];
  return R[i] - R[j+1];
}

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> M >> n;
  for (int i = 0; i < n; ++i) 
    cin >> arr[i];

  L[0] = arr[0];
  for(int i = 1; i < n; ++i) 
    L[i] = L[i-1] + (lld) arr[i];
  
  R[n-1] = M-arr[n-1];
  for (int i = n-2; i >= 0; --i)
    R[i] = R[i+1] + (lld) (M - arr[i]);

  lld ans = 0;
  for (int i = 0; i < n; ++i) {
    int mid; lld costo;
    
    // Try to start moving right til ith tree
    mid = (n-1+i) / 2;
    if ((n-i) & 1) {
      costo = _L(i, mid-1) + _L(i, mid) + 2ll*_R(mid+1, n-1);
    } else {
      costo = 2ll*_L(i, mid) + _R(mid+1, n-1) + _R(mid+2, n-1);
    }
    ans = max(ans, costo);

    // Try to start moving left til ith tree
    mid = (i+1) / 2;
    if ((i + 1) & 1) {
      costo = 2ll*_L(0, mid-1) + _R(mid, i) + _R(mid + 1, i);
    } else {
      costo = 2ll*_R(mid, i) + _L(0, mid-2) + _L(0, mid-1);
    }
    ans = max(ans, costo);
  }
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 4992
/*
title:

url:
*/

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <functional>
#include <queue>
#include <limits>
#include <string>
#include <utility>
#include <cstring>
#include <map>
#include <cmath>
#include <iterator>

using namespace std;

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

typedef pair<int, int> pint;
typedef long long ll;

#define int ll

//get vector of prime numbers which is lower than or equal n
vector<int> get_primes(int n)
{
    vector<bool> is_prime(n + 1, true);
    vector<int> res;
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i <= n; i++)
    {
        if (is_prime[i])
        {
            res.push_back(i);
            for (int j = 2 * i; j < is_prime.size(); j = j + i)
            {
                is_prime[j] = false;
            }
        }
    }
    return res;
}

vector<pair<int, int>> factorize(int n)
{
    vector<pair<int, int>> res;
    for (int i = 2; i * i <= n; i++)
    {
        int tmp = 0;
        while (n % i == 0)
        {
            tmp++;
            n /= i;
        }
        res.push_back(make_pair(i, tmp));
    }
    if (n != 1)
    {
        res.push_back(make_pair(n, 1));
    }
    return res;
}

int mpow(int x, int n)
{
    int res = 1;
    while (n != 0)
    {
        if (n & 1)
            res = res * x % INF;
        x = x * x % INF;
        n = n >> 1;
    }
    return res;
}

//mod frac
vector<int> mfrac;
void set_mfrac(int n)
{
    if (mfrac.size() == 0)
    {
        mfrac.push_back(1);
    }
    for (int i = mfrac.size(); i <= n; i++)
    {
        mfrac.push_back((i * mfrac[i - 1]) % INF);
    }
}

//get nCm mod INF
int mcomb(int n, int m)
{
    if (mfrac.size() <= n)
    {
        set_mfrac(n);
    }
    int res = mfrac[n];
    res = res * mpow(mfrac[m], INF - 2) % INF;
    res = res * mpow(mfrac[n - m], INF - 2) % INF;
    return res;
}

signed main()
{
    int N, A, B;
    cin >> N >> A >> B;
    if (N == 1)
        cout << "Hello World" << endl;
    else
        cout << A + B << endl;
}

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

#define rep(i, N) for(ll i = 0;i < N;i++)

typedef long long ll;

const ll mod = 1e9 + 7;

using namespace std;



int main(void) {
	ll N, D; cin >> N >> D;
	ll D2 = D * D;
	vector<pair<ll, ll>> P(N);
	rep(i, N)cin >> P[i].first >> P[i].second;

	ll cnt = 0;
	for (auto pnt : P) {
		if (pnt.first * pnt.first + pnt.second * pnt.second <= D2)cnt++;
	}

	cout << cnt << endl;

	return 0;
}

Measured memory_bytes: 6332