akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define REP(i,m,n) for(int i=(m);i<(n);i++)
#define rep(i,n) REP(i,0,n)
#define pb push_back
#define all(a) a.begin(),a.end()
#define rall(c) (c).rbegin(),(c).rend()
#define mp make_pair
#define endl '\n'
typedef long long ll;
typedef pair<ll,ll> pll;
typedef long double ld;
const ll inf=998244353;
const ll mod=998244353;
signed main(){
    ll n,k;cin>>n>>k;
    vector<ll>p(n);
    rep(i,n){
        cin>>p[i];
    }
    sort(all(p));
    ll cnt=0;
    rep(i,k){cnt+=p[i];}
    cout<<cnt<<endl;
}

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

#define REP(i, n ,N) for(int i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;

int main(){
	while(1) {
		int m,nmin, nmax;
		cin >> m >> nmin >> nmax;
		if(m==0 && nmin==0 && nmax==0)break;
		int  max = 0, ans;
		vector<int> member(m + 1);
		REP(i,1,m+1){
			cin >> member[i];
		}

		REP(i, nmin, nmax + 1) {
			if (member[i] - member[i + 1] >= max) {
				max = member[i] - member[i + 1];
				ans = i;
			}
		}
		p(ans);
	}
	return 0;
}


Measured memory_bytes: 3084
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


   class Program
   {
       static void Main(string[] args)
       {
         string[] line = Console.ReadLine().Split(' ');
         long H = long.Parse(line[0]);
         long W = long.Parse(line[1]);
         if(H == 1 || W == 1)
         {
           Console.WriteLine(1);
         }
         else if((H * W) % 2 == 0){
         Console.WriteLine((W * H) / 2);
         }else{
         Console.WriteLine((W * H) / 2 + 1);
         }
       }
   }


Measured memory_bytes: 13140
#include <iostream>
#include <boost/range/irange.hpp> // boost::irange
#include <boost/math/common_factor_rt.hpp> // boost::math::gcd

using namespace std;
using boost::irange;

int main() {
  int n, a, res;
  cin >> n;
  cin >> res;
  for (int i : irange(0, n - 1)) {
      cin >> a;
      res = boost::math::gcd(res, a);
  }

  cout << res << endl;
  return 0;
}


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

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

const ll MOD = 1e9+7;
// const ll MOD = 998244353;
const ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(ll)(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

template<int mod> struct Fp {
    long long val;
    constexpr Fp(long long v = 0) noexcept : val(v % mod) {
        if (val < 0) val += mod;
    }
    constexpr int getmod() { return mod; }
    constexpr Fp operator - () const noexcept {
        return val ? mod - val : 0;
    }
    constexpr Fp operator + (const Fp& r) const noexcept { return Fp(*this) += r; }
    constexpr Fp operator - (const Fp& r) const noexcept { return Fp(*this) -= r; }
    constexpr Fp operator * (const Fp& r) const noexcept { return Fp(*this) *= r; }
    constexpr Fp operator / (const Fp& r) const noexcept { return Fp(*this) /= r; }
    constexpr Fp& operator += (const Fp& r) noexcept {
        val += r.val;
        if (val >= mod) val -= mod;
        return *this;
    }
    constexpr Fp& operator -= (const Fp& r) noexcept {
        val -= r.val;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr Fp& operator *= (const Fp& r) noexcept {
        val = val * r.val % mod;
        return *this;
    }
    constexpr Fp& operator /= (const Fp& r) noexcept {
        long long a = r.val, b = mod, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b; swap(a, b);
            u -= t * v; swap(u, v);
        }
        val = val * u % mod;
        if (val < 0) val += mod;
        return *this;
    }
    constexpr bool operator == (const Fp& r) const noexcept {
        return this->val == r.val;
    }
    constexpr bool operator != (const Fp& r) const noexcept {
        return this->val != r.val;
    }
    friend constexpr ostream& operator << (ostream &os, const Fp<mod>& x) noexcept {
        return os << x.val;
    }
    friend constexpr Fp<mod> modpow(const Fp<mod> &a, long long n) noexcept {
        if (n == 0) return 1;
        auto t = modpow(a, n / 2);
        t = t * t;
        if (n & 1) t = t * a;
        return t;
    }
	friend constexpr Fp<mod> modfac(long long l, long long r) noexcept
	{
		auto res = Fp<mod>(1);
		for (Fp<mod> i = l; i < r; ++i) res *= i;
		return res;
	}
};
using mint = Fp<1000000007>;


int main(int argc, char **argv)
{
	string S; cin >> S;
	ll N = S.size();

	mint res{0};
	ll cnt1{0};
	REP(i, N)
	{
		if (S[i] == '1')
		{
			ll l = N - 1 - i;
			res += modpow(mint(2), cnt1) * modpow(mint(3), l);
			++cnt1;
		}
	}
	res += modpow(mint(2), cnt1);
	std::cout << res << std::endl;
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"sort"
	"strconv"
	"strings"
	"sync"
)

func main() {
	n := ScanInt()
	ss := ScanStringSlice(n)

	m := make(map[string]int)
	for i := 0; i < len(ss); i++ {
		m[ss[i]]++
	}
	P(len(m))


	close(O)
	oWg.Wait()
}

/*********************** I/O ***********************/

var O chan string
var in *bufio.Scanner
var oWg *sync.WaitGroup
var P func(a ...interface{}) (n int, err error)

func init() {
	P = fmt.Println

	in = bufio.NewScanner(os.Stdin)
	in.Buffer(make([]byte, 1024), int(1e+9))
	in.Split(bufio.ScanWords)

	O = make(chan string, 16)
	oWg = &sync.WaitGroup{}
	oWg.Add(1)

	writer := bufio.NewWriter(os.Stdout)
	go func() {
		defer oWg.Done()
		defer writer.Flush()

		for line := range O {
			writer.WriteString(line + "\n")
		}
	}()
}

func ScanWord() string { in.Scan(); return in.Text() }
func ScanInt() int     { i, _ := strconv.Atoi(ScanWord()); return i }
func ScanInt64() int64 { i, _ := strconv.ParseInt(ScanWord(), 10, 64); return i }
func ScanStringSlice(n int) []string {
	s := make([]string, n)
	for i := 0; i < n; i++ {
		s[i] = ScanWord()
	}
	return s
}
func ScanIntSlice(n int) []int {
	arr := make([]int, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt()
	}
	return arr
}
func ScanInt64Slice(n int) []int64 {
	arr := make([]int64, n)
	for i := 0; i < n; i++ {
		arr[i] = ScanInt64()
	}
	return arr
}

/*********************** Utils ***********************/

func S(v interface{}) string { return fmt.Sprintf("%v", v) }
func SArr(a []int) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.Itoa(a[i]) + " ")
	}
	return sb.String()
}
func SArr64(a []int64) string {
	sb := strings.Builder{}
	sb.Grow(len(a) * 9)
	for i := range a {
		sb.WriteString(strconv.FormatInt(a[i], 10) + " ")
	}
	return sb.String()
}
func MnMx(args ...int64) (int64, int64) {
	minVal, maxVal := int64(math.MaxInt64), int64(math.MinInt64)
	for _, v := range args {
		if v < minVal {
			minVal = v
		}
		if v > maxVal {
			maxVal = v
		}
	}
	return minVal, maxVal
}
func Mn(args ...int64) int64 { mn, _ := MnMx(args...); return mn }
func Mx(args ...int64) int64 { _, mx := MnMx(args...); return mx }
func LCM(a, b int64) int64   { return a / GCD(a, b) * b }
func GCD(a, b int64) int64 {
	if a == 0 {
		return b
	}
	return GCD(b%a, a)
}
func sortInt64Slice(a []int64) { sort.Slice(a, func(i, j int) bool { return a[i] < a[j] }) }
func abs(x int64) int64 {
	if x < 0 {
		return -x
	}
	return x
}


Measured memory_bytes: 23848
#include <iostream>
#include <algorithm>

int main()
{
    std::string s;
    int64_t k;
    std::cin >> s >> k;
    int64_t sn = s.length();
    std::string ss = s+s;
    ss.push_back(255);
    int64_t result = 0;
    char prev = ss[0];
    int64_t count = 1;
    for (int i=1;i<ss.length();++i)
    {
        if (ss[i] == prev)
            ++count;
        else
        {
            int64_t num = k;
            if (i-count == 0 || i == ss.length()-1) num = 1;
            else if (i >= s.length()) num = 0;
            if (i-count <= s.length() && i >= s.length()) num = k-1;
            if (i-count == 0 && i == ss.length()-1) num=k;
            result += count/2*num;
            count = 1;
        }
        prev = ss[i];
    }
    result = std::min(result, sn*k/2);
    std::cout << result;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void) {
  int S;
  scanf("%d", &S);
  int HI = S / 100;
  int LO = S % 100;
  //printf("%d %d\n", HI, LO);

  int MMYY = 0;
  int YYMM = 0;
  if(HI <= 12)
    MMYY = 1;
  if(LO <= 12)
    YYMM = 1;
  if(HI == 0)
    MMYY = 0;
  if(LO == 0)
    YYMM = 0;

  if(MMYY == 1 && YYMM == 1)
    printf("AMBIGUOUS\n");
  else if(MMYY == 1 && YYMM == 0)
    printf("MMYY\n");
  else if(MMYY == 0 && YYMM == 1)
    printf("YYMM\n");
  else
    printf("NA\n");

  
  return 0;
}


Measured memory_bytes: 128
use std::io;

fn main() {
	let mut buf = String::new();
	io::stdin().read_line(&mut buf).expect("");
	let mut iter = buf.split_whitespace();
	let n = iter.next().unwrap().parse::<i32>().ok().unwrap();
	let L = iter.next().unwrap().parse::<i32>().ok().unwrap();
	let mut sum = 0;
	if 1 - L <= n && 1 - L >= 1 {
		sum = n*(n+1) / 2 - ( 1 - L ) + (n - 1)*(L - 1);
	}else{
		if L < 0 	{
			sum = n*(n+1) / 2 + (n - 1)*(L - 1) - n;
		}else{
			sum = n*(n+1) / 2 + (n - 1)*(L - 1) - 1;
		}
	}
	println!("{}", sum);
}

Measured memory_bytes: 2112
import sys
from math import ceil, floor, sqrt, sin, cos, pi
from itertools import accumulate, permutations, combinations
from fractions import gcd # 最大公約数
from collections import deque, Counter
from operator import itemgetter
from heapq import heappop,heappush
sys.setrecursionlimit(10**7)
def lcm(x, y): return ((x * y) // gcd(x, y)) # 最小公倍数
# list(map(int, input().split()))
n = int(input())
lin = [0 for i in range(n+1)]
ans = [0 for i in range(n)]
a = list(map(int, input().split()))
for i in range(n):
    lin[i + 1] = lin[i]^a[i]
#print(lin)
ans[n - 1] = lin[n - 1]
sumv = 0
for i in range(n-1, 0, -1):
    sumv ^= a[i]
    ans[i - 1] = lin[i - 1]^sumv
    #print(i, ': ', lin[i], sumv)
for x in ans:
    print(x, '', end='')
print()


Measured memory_bytes: 35908
#include <cstdio>
#include <algorithm>

using LL = long long;

LL ans() {
    int arr[3]; for (int i = 0; i < 3; ++i) scanf("%d", &arr[i]);
    for (int i = 0; i < 3; ++i) if (arr[i]%2==0) return 0;

    LL ans = 1LL<<62;
    for (int i = 0; i < 3; ++i)
        ans = std::min(ans, 1LL * arr[(i+1)%3] * arr[(i+2)%3]);
    return ans;
}

int main() {
    printf("%lld\n", ans());
    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    ll n;
    cin>>n;
    vector<ll> a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    map<ll,ll> firs,sec;
    for(int i=1;i<=n;i++)
    {
        firs[i-a[i]]++;
        sec[i+a[i]]++;
    }
    ll ans=0;
    for(auto p:firs){
        ans+=(p.second*sec[p.first]);
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 39028
n,m=map(int,input().split())
if abs(n-m)>=2:
  print(0)
else:
  a=1
  if n==m:
    for i in range(2,n+1):
      a*=i
      a%=1000000007
    print((a*a*2)%1000000007)
  elif n<m:
    for i in range(2,n+1):
      a*=i
      a%=1000000007
    b=(a*m)%1000000007
    print((a*b)%1000000007)
  else:
    for i in range(2,m+1):
      a*=i
      a%=1000000007
    b=(a*n)%1000000007
    print((a*b)%1000000007)

Measured memory_bytes: 3188
s = list(int(x) for x in input())
n = len(s)
ans = []
#s[0]固定
count = 0
if n >= 3:
  if s[0] == s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] != s[0]:
    count += 1
  elif i%2 == 1 and s[i] == s[0]:
    count += 1
ans.append(count)
#s[0]変更
count = 1
if n >= 3:
  if s[0] != s[1]:
    count += 1
for i in range(2, n):
  if i%2 == 0 and s[i] == s[0]:
    count += 1
  elif i%2 == 1 and s[i] != s[0]:
    count += 1
ans.append(count)

if n == 1:
  print(0)
elif n == 2:
  if s[0] == s[1]:
    print(1)
  else:
    print(0)
else:
  print(min(ans))

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1);
  int64_t sum = 0; //葉の合計
  for (int i = 0; i < n + 1; i++) {
    cin >> a.at(i);
    sum += a.at(i);
  }
  if (n == 0 && a.at(0) == 1)
    cout << 1 << endl;
  
  else if (a.at(0) >= 1) {
    cout << -1 << endl;
  }
  
  
  else {
    int64_t point = 1; //深さ0の頂点の数
    int64_t count = 1; //頂点の合計
    for (int i = 0; i < n; i++) {
      sum -= a.at(i);
      int64_t nleaf = point - a.at(i); //深さiの頂点から葉を引いた数
      
      if (nleaf * 2 < a.at(i + 1)) {
        cout << -1 << endl;
        break;
      }
      
      else {
        count += min(nleaf * 2, sum);
        point = min(nleaf * 2, sum);
      }
    
      if (i == n - 1)
        cout << count << endl;
    }
  }
}

Measured memory_bytes: 3764
def solve():
    N, K = map(int,input().split())
    have = [False] * N
    for i in range(K):
        d = int(input())
        A = list(map(lambda x:int(x)-1, input().split()))
        for a in A:
            have[a] = True
    
    print(N - sum(have))
if __name__ == '__main__':
    solve()

Measured memory_bytes: 9184
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
constexpr ll mod = 1000000007;
constexpr ll INF = 1000000099;
constexpr ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  int s,w;cin>>s>>w;
  if(w>=s)cout<<"unsafe"<<ENDL;
  else cout<<"safe"<<ENDL;
}
//! ( . _ . ) ! 
//CHECK overflow,vector_size,what to output?

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

int main() {
  string s, t;
  cin >> s >> t;
  int cnt = 0;
  rep(i, s.size()) if (s[i] != t[i]) cnt++;
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3916
//#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
//#define int long long
typedef long long ll;
typedef float f80;
//#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(ll a, ll b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

int a[105],b[105];
void solve() {
	int n;
	cin>>n;
	fr(i,1,n)
		cin>>a[i];
	int diam=*max_element(a+1,a+n+1);
	int cntr=0;
	fr(i,1,n)
		b[a[i]]++;
	if(diam&1) {
		if(b[diam/2+1]!=2) {
			cout<<"Impossible"<<endl;
			return;
		}
		fr(i,diam/2+1,diam) {
			if(b[i]<2) {
				cout<<"Impossible"<<endl;
				return;
			}
		}
		fr(i,1,diam/2) {
			if(b[i]) {
				cout<<"Impossible"<<endl;
				return;
			}
		}
	} else {
		if(b[diam/2]!=1) {
			cout<<"Impossible"<<endl;
			return;
		}
		fr(i,diam/2+1,diam) {
			if(b[i]<2) {
				cout<<"Impossible"<<endl;
				return;
			}
		}
		fr(i,1,diam/2-1) {
			if(b[i]) {
				cout<<"Impossible"<<endl;
				return;
			}
		}
	}
	cout<<"Possible"<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	fr(i,1,t)
		solve();
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <vector>
#include <functional>
#include <cstdlib>
#include <map>
#include <set>
#include <iostream>
#include <string>
#include <ctype.h>
#include <climits>
#include <queue>
#include <iomanip>
using namespace std;
typedef long long ll;
#define REP(i, n) for(ll i = 0; i < (ll)(n); ++i)
#define FOR(i, a, b) for(ll i=(a); i < (ll)(b); ++i)
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;}


int n,m;

int main(){
	
	cin >> n >> m;
	vector<pair<int,int>> a(n);
	vector<vector<int>> job(m+1);
	REP(i,n){
		cin >> a[i].first >> a[i].second;
		if(a[i].first <= m) job[a[i].first].push_back(a[i].second);
	}
	
	ll ans=0;
	priority_queue<int> q;
	for(int i=1; i<=m; i++){
		for(auto x:job[i]){
			q.push(x);
		}
		if(!q.empty()){
			ans += q.top();
			q.pop();
		}
	}
	
	cout << ans << endl;
	
	
	return 0;
}

Measured memory_bytes: 9292
use std::collections::*;

fn main()
{
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let ss = s.trim().split_whitespace().collect::<Vec<&str>>();

    let mut map_count = HashMap::with_capacity(ss.len());
    for s in ss {
        *map_count.entry(s).or_insert(0) += 1;
    }

    let max_count = {
        let mut ret = String::new();
        let max_value = map_count.values().max().unwrap();
        for (key, value) in &map_count {
            if value != max_value {
                continue;
            }
            ret = key.to_string();
            break;
        }
        ret
    };

    let max_len = map_count.keys().max_by(|l, r| l.len().cmp(&r.len())).unwrap();
    println!("{} {}", max_count, max_len);
}


Measured memory_bytes: 5032
#include <stdio.h>
int main(void) {
  int a[3],i,j,k;
  scanf("%d%d%d",&a[0],&a[1],&a[2]);
  for(i=0;i<2;i++) {
    for(j=0;j<2;j++) {
      if(a[j]<a[j+1]) {
        k=a[j];
        a[j]=a[j+1];
        a[j+1]=k;
      }
    }
  }
  printf("%d",10*a[0]+a[1]+a[2]);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <bitset>
#include <map>
#include <tuple>
#include <unordered_map>
#include <list>
#include <numeric>
#include <utility>
#include <iterator>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <ctime>
#include <cassert>
#include <random>

#define INF 1000000000
#define LINF 9000000000000000000
#define mod  1000000007

#define rep(i,n) for(int i=0;i<int(n);i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define REP(i,a,b) for(int i=(a);i<int(b);i++)
#define all(x) (x).begin(),x.end()
#define pb push_back
#define mp make_pair

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<long long>vll;
typedef pair<int,int> pi;

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
int ddx[8]={-1,-1,0,1,1,1,0,-1};
int ddy[8]={0,1,1,1,0,-1,-1,-1};
bool debug=false;

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

int main(){
  int N;
  double sum = 0;
  cin >> N;
  vector<int> a(N);
  rep(i, N)cin >> a[i], sum += a[i];
  sum /= N;

  int idx = 0;
  double mini = 10000000;

  rep(i, N){
    if(abs(sum - a[i]) < mini){
      idx = i;
      mini = abs(sum - a[i]);
    }
  }
  cout << idx << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
string res = "";
int main()
{
	long long n; cin >> n;
	while (n)
	{
		n--;
		res.push_back(n % 26 + 'a');
		n /= 26;
	}
	reverse(res.begin(), res.end());
	cout << res << "\n";
	return 0;
}

Measured memory_bytes: 3620
MOD = 10**9+7
n, k = map(int, input().split())
a = list(map(int, input().split()))
dp = [0] * (k + 1)
# dp[i] - the number of ways such that we used i candies so far
dp[0] = 1
for i in range(n):
    fake = [0] * (k + 1)
    for used in range(k, -1, -1):
        tmp = dp[used]
        L = used + 1
        R = used + min(a[i], k - used)
        if L <= R:
            fake[L] = (fake[L] + tmp) % MOD
            if R + 1 <= k:
                fake[R + 1] = (fake[R + 1] - tmp + MOD) % MOD
    prefix_sum = 0
    for j in range(k + 1):
        prefix_sum = (prefix_sum + fake[j]) % MOD
        dp[j] = (dp[j] + prefix_sum) % MOD
print(dp[k])

Measured memory_bytes: 104284
n,m = map(int, input().split())
ac = [0]*n
wa = [0]*n
x=0
y=0
for i in range(m):
    p , s = input().split()
    p = int(p)
    if s=='WA' and ac[p-1]==0:
        wa[p-1]+=1
    elif s=='AC' and ac[p-1]==0:
        ac[p-1]=1
        y+=wa[p-1]
        x+=1
print(x,y)

Measured memory_bytes: 4596
def euclid(a, b):
    big = max(a, b)
    small = min(a, b)
    while True:
        if big % small == 0:
            return small
            break
        
        r = big % small
        big = small
        small = r
        
k = int(input())

cnt = 0
for a in range(1, k - 1):
    for b in range(a + 1, k):
        for c in range(b + 1, k + 1):
            cnt += 6 * euclid(euclid(c, b), a)
            
for a in range(1, k):
    for b in range(a + 1, k + 1):
        cnt += 6 * euclid(a, b)

print(cnt + (k + 1) * k // 2)

Measured memory_bytes: 9132
//vvk
#include "bits/stdc++.h"
#define f first
#define s second
using namespace std;
using ll = long long;
const int N = 1e5 + 1;
const int mod = 1e9 + 7;
ll n , t , x , y , dp[2][N] , w , wt[N] , val[N]; 
int main()
{
 ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
 cin >> n >> w;
 for(int i = 1; i <= n; i++) {
 	cin >> wt[i] >> val[i];
 }
 for(int i = 1; i <= n; i++) {
 	for(int j = 0; j <= w; j++) {
 		if(wt[i] > j) dp[i & 1][j] = dp[(i + 1) & 1][j];
 		else dp[i & 1][j] = max(val[i] + dp[(i + 1) & 1][j - wt[i]] , dp[(i + 1) & 1][j]);
 	}
 }
 cout << dp[n & 1][w];
 return 0;
 }

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

int main(){
    int N;
    cin >> N;
    
    vector<int> A(N-1);
    vector<int> cunt(N, 0);   
    rep(i, N-1) cin >> A[i];

    rep(i, N-1){
        cunt[A[i]-1]++;
    }

    rep(i, N) cout << cunt[i] << endl;
    return 0;
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define rev(i,s,e) for(i64 (i) = (s);(i) --> (e);)
#define all(x) x.begin(),x.end()

int main() {
  i64 N;
  cin >> N;
  vector<double> x(N), y(N);
  rep(i,0,N) cin >> x[i] >> y[i];
  vector<i64> idx(N);
  rep(i,0,N) idx[i] = i;
  double sum = 0;
  i64 cnt = 0;
  do {
    rep(i,0,N - 1) {
      double dx = x[idx[i]] - x[idx[i + 1]];
      double dy = y[idx[i]] - y[idx[i + 1]];
      sum += sqrt(dx * dx + dy * dy);
    }
    cnt++;
  } while(next_permutation(all(idx)));
  cout << fixed << setprecision(10);
  cout << sum / cnt << endl;
}


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

int main()
{
  int n, ans=0, pos=0;
  cin >> n;
  string s; cin >> s;

  while (true) {
    pos = s.find("ABC", pos);
    if (pos == -1) break;
    else {
      ans ++;
      pos+=3;
    }
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <map>
#include <math.h>
#include <string>
typedef long long ll;

using namespace std;

int main(){
    int N;
    ll K;
    cin >> N >> K;
    ll ab[100010] = {0};
    for (int i = 0; i < N; i++){
	ll a, b;
	cin >> a >> b;
	ab[a] += b;
    }

    for (int i = 1; i <= 100000; i++){
	if (ab[i] >= K){
	    cout << i << endl;
	    break;
	} 
	K -= ab[i];
    }

    return 0;
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
mt19937 rnd(1337);
#define rall(x) (x).rbegin(), (x).rend()
#define all(x) (x).begin(), (x).end()
#define pNN pair <Node *, Node *>
#define SZ(x) (int)(x).size()
#define pii pair <int, int>
#define pb push_back
#define rev reverse
#define ins insert
#define ers erase
#define S second
#define F first
const int N = 3e5 + 10, INF = 1e9 + 10;

void solve() {
	string s;
	cin >> s;
	if (s[2] == s[3] && s[4] == s[5]) {
		cout << "Yes";
	} else {
		cout << "No";
	}
}
 
signed main () {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(12);
    #ifdef Solenoid555
        freopen("input.txt", "r", stdin);
    #endif
    solve();
    return 0;
}

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

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

    #define int long long

    using namespace std;

    signed main()
    {
        double x,y=0,z,w,i,j;
        cin>>x>>y;
     

        cout<<x/y<<endl;
        return 0;
    }


Measured memory_bytes: 256
// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
#include<bitset>
#include<cstdlib>
// #include<deque>
// #include<multiset>
// #include<cstring>
// #include<bits/stdc++.h>
// }}}
using namespace std;
using ll = long long;

int f[301][301];
int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n, m;
  cin >> n >> m;
  for(int i = 0; i < m; i++) {
    int a, b;
    cin >> a >> b;
    f[a][b] = 1;
  }
  for(int i = 1; i <= n; i++) f[i][i] = 1;
  for(int k = 1; k <= n; k++) {
    for(int i = 1; i <= n; i++) for(int j = 1; j <= n; j++) {
      f[i][j] |= f[i][k] & f[k][j];
    }
  }
  for(int i = 1; i <= n; i++) {
    vector<int> v;
    for(int j = 1; j <= n; j++) if(f[i][j] and f[j][i]) v.push_back(j);
    for(int k = 0; k < v.size(); k++) cout << v[k] << " \n"[k == v.size() - 1];
  }
  return 0;
}



Measured memory_bytes: 3532
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

template<typename T>
inline bool chmin(T& x, T a) {
	if (x >= a) { x = a; return true; }
	return false;
}

template<typename T>
inline bool chmax(T& x, T a) {
	if (x <= a) { x = a; return true; }
	return false;
}

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

	string s; cin >> s;
	if (s[s.size() - 1] == 's') {
		s += "es";
	}
	else {
		s += "s";
	}

	cout << s << endl;

	return 0;
}

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

#define INF 2147483647
#define LINF 9223372036854775807
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef long double ld;

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

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

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





int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n;

    vector<string> g(n),g2(n);
    rep(i,n)cin>>g[i];


    int add = 0;
    rep(i,n){
        add = i;

        rep(j,n)g2[(j+add)%n]=g[j];
        
        bool f=true;
        rep(p,n){
            rep(q,p){
                if( g2[p][q] != g2[q][p]){
                    f=false;
                    break;
                }
            }
        }
        if(f)ans += n;
    }




    cout<<ans<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 512
void main() {
  problem();
}

void problem() {
  auto R = scan!int;

  void solve() {
    real ans = cast(real)R * PI * 2f;
    writefln("%.10f", ans);
  }

  solve();
}

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

import std.stdio, std.conv, std.array, std.string, std.algorithm, std.container, std.range, core.stdc.stdlib, std.math, std.typecons, std.numeric;
T[][] combinations(T)(T[] s, in int m) {   if (!m) return [[]];   if (s.empty) return [];   return s[1 .. $].combinations(m - 1).map!(x => s[0] ~ x).array ~ s[1 .. $].combinations(m); }
string scan(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T scan(T)(){ return scan.to!T; }
T[] scan(T)(int n){ return n.iota.map!(i => scan!T()).array; }
void deb(T ...)(T t){ debug writeln(t); }
alias Point = Tuple!(long, "x", long, "y");

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


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

#define fs first
#define sc second
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using pii = pair<int, int>;
using vi = vector<int>;
using lint = long long;

const int inf = 1001001001;
const lint linf = 1001001001001001001ll;
const double eps = 1e-9;
const int mod = 1e9 + 7;
const int dx[]{0, 1, 0, -1, -1, -1, 1, 1}, dy[]{1, 0, -1, 0, -1, 1, -1, 1};

template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; } return a > b; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; } return a < b; }
template<typename T> inline void print(const T &x, string s = "\n") { cout << x << s; }
template<typename T> inline void print(const vector<T> &v, string s = " ")
{ if (!v.size()) puts(""); rep(i, v.size()) cout << v[i] << (i + 1 == v.size() ? "\n" : s); }
inline bool inside(int y, int x, int H, int W) { return 0 <= y && y < H && 0 <= x && x < W; }
inline lint in() { lint x; std::cin>>x; return x; }

int n, m;
int a[500][500];
int idx[500];
int cnt[500];
bool used[500];

signed main() {
  cin >> n >> m;
  rep(i, n) rep(j, m) a[i][j] = in() - 1;

  int ans = inf;
  for (int i = 0; i < m; ++i) {
    rep(j, m) cnt[j] = 0;
    rep(j, n) cnt[a[j][idx[j]]]++;

    int beet = 0, use = -1;
    rep(j, m) if (beet < cnt[j]) {
      beet = cnt[j];
      use = j;
    }
    used[use] = true;

    if (i != m - 1) rep(j, n) {
      while (used[a[j][idx[j]]]) idx[j]++;
    }

    chmin(ans, beet);
    // cout << use << endl;
  }

  cout << ans << endl;
}


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

using namespace std;

int main(){
    vector<int> hoge(3);
    for(int i=0;i<3;i++) cin>>hoge[i];
    sort(hoge.begin(),hoge.end());
    
    cout<<hoge[0]+hoge[1]<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)
from sys import stdin

L = [1]
for i in xrange(1, 10001):
    L.append(i + L[-1])

for line in stdin:
    n = int(line)
    print(L[n])

Measured memory_bytes: 4536
#include <stdio.h>
#define H 2000000

int data[H],n;

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

int main(){
  int i;

  scanf("%d",&n);

  for(i=1;i<=n;i++){
    scanf("%d",&data[i]);
  }
  
  for(i=n/2;i>=1;i--){
    maxHeapify(i);
  }
  
  for(i=1;i<=n;i++){
    printf(" %d",data[i]);
  }
  printf("\n");

  return 0;
}

void maxHeapify(int i){
  int l,r,largest;

    l=i*2;
    r=i*2+1;

    if(l<=n && data[l]>data[i]){
      largest=l;
    }else{
      largest=i;
    }
    if(r<=n && data[r]>data[largest]){
      largest=r;
    }

    if(largest != i){
      swap(&data[i],&data[largest]);
       maxHeapify(largest);
    }
  }
      

void swap(int *x,int *y){
  int i;
  i=*x;
  *x=*y;
  *y=i;
}
  

  



Measured memory_bytes: 3756
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<set>
using namespace std;

typedef long long ll;
typedef pair<int,int> P;
#define INF 1000000100
#define rep(i,n) for (int i=0;i<n;i++)

int main(){
    int A,B;
    cin >> A >> B;
    int p=A+B;
    int m=A-B;
    int mul=A*B;
    int ans =0;
    if(p>m) ans=p;
    else ans=m;
    if(ans<mul) ans=mul;
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3096
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e8;

signed main() {
	int N, M;
	cin >> N >> M;
	if (N == 1 && M == 1)cout << 1;
	else if (N == 1 || M == 1)cout << N * M - 2;
	else {
		int kado = 4;
		int hen = M - 2 + M - 2 + N - 2 + N - 2;
		cout << N * M - kado - hen;
	}
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        long A[] =new long[N];
        long count=0;
        
        for(int i=0;i<N;i++){
            A[i]=sc.nextLong();
        }
        
        for(int i=0;i<N-1;i++){
            if(A[i]>A[i+1]){
                count+=A[i]-A[i+1];
                A[i+1]+=A[i]-A[i+1];
            }
        }
        
        System.out.println(count);
    }
}


Measured memory_bytes: 61396
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;

signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int n = s.size();
	VE a(n + 1);
	rep(i, n) {
		if (s[i] == '<')chmax(a[i + 1], a[i] + 1);
	}
	for (int i = n - 1; i >= 0; i--) {
		if (s[i] == '>')chmax(a[i], a[i + 1] + 1);
	}
	int sum = 0;
	rep(i, n + 1) {
		sum += a[i];
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 4764
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
#define ALL(v) v.begin(), v.end()
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define chmax(x, a) x = max(x, a)
#define chmin(x, a) x = min(x, a)

int main() {
    string s, t; cin >> s >> t;
    ll n = s.size();
    s+=s;
    vector<vector<ll>> sd(26);
    rep(i, s.size()) sd[s[i]-'a'].push_back(i);
    if (sd[t[0]-'a'].size() == 0) {
        cout << -1 << endl;
        return 0;
    }
    ll ans = sd[t[0]-'a'][0]+1;
    ll tmp = sd[t[0]-'a'][0];
    rep(i, t.size()-1) {
        if (sd[t[i+1]-'a'].size() == 0) {
            cout << -1 << endl;
            return 0;
        }
        ans += sd[t[i+1]-'a'][upper_bound(ALL(sd[t[i+1]-'a']), tmp) - sd[t[i+1]-'a'].begin()] - tmp;
        tmp = (sd[t[i+1]-'a'][upper_bound(ALL(sd[t[i+1]-'a']), tmp) - sd[t[i+1]-'a'].begin()])%n;
    }
    cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef pair<int,int> P;

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

	int N, C; cin >> N >> C;
	int cnt[100005]; memset(cnt,0,sizeof(cnt));
	vector<P> prog[30];

	for (int i = 0;i < C;i++){
		prog[i].push_back(P(-1,-1));
	}

	for (int i = 0;i < N;i++){
		int s,t,c; cin >> s >> t >> c;
		c--;
		prog[c].push_back(P(s,t));
	}

	for (int i = 0;i < C;i++){
		sort(prog[i].begin(), prog[i].end());
		prog[i].push_back(P(-1,-1));
		for (int j = 1;j < prog[i].size()-1;j++){
			int pt = prog[i][j-1].second;
			int cs = prog[i][j].first;
			int ct = prog[i][j].second;
			int ns = prog[i][j+1].first;
			if(cs == pt && ct == ns) continue;
			else if(cs == pt) cnt[ct+1]--;
			else if(ct == ns) cnt[cs]++;
			else{
				cnt[cs]++; cnt[ct+1]--;
			}
		}
	}

	int sum[100005];
	sum[0] = cnt[0];

	int ans = 0;

	for (int i = 1;i < 100005;i++){
		sum[i] = sum[i-1]+cnt[i];
		ans = max(ans, sum[i]);
	}

	cout << ans << endl;

	return 0;

}


Measured memory_bytes: 2304
mod = 10**9+7
H,W,K = map(int,input().split())
a = [0]*20
a[0]=1
a[1]=1
for i in range(10):
    a[i+2]=a[i+1]+a[i]
dp = [[0]*(W+1) for _ in range(H+1)]
dp[0][0] = 1
for h in range(H):
    for k in range(W):
        dp[h+1][k] += a[k]*a[W-k-1]*dp[h][k]
        dp[h+1][k] += a[k-1]*a[W-k-1]*dp[h][k-1]
        dp[h+1][k] += a[k]*a[W-k-2]*dp[h][k+1]
        dp[h+1][k] %= mod
print(dp[H][K-1])

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

int main() {
  int K;
  string S;
  cin >> K >> S;
  if (S.size() <= K) {
    cout << S << endl;
  } else {
    for (int i = 0; i < K; ++i) {
      cout << S.at(i);
    }
    cout << "...";
  }
  
  return 0;
}


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

using namespace std;

using i64 = long;

const i64 MOD = 1e9 + 7;
const i64 INF = 1e18 + 7;


signed main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(auto& x : a)
        cin >> x;
    i64 ans = 0;
    sort(a.begin(), a.end());
    for(int i = 0; i < n; ++i){
        for(int j = i + 1; j < n; ++j){
            int x = a[i], y = a[j];
            auto it = lower_bound(a.begin(), a.end(), x + y);
            int dist = distance(next(a.begin(), j), it) - 1;
            ans += dist;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
// include
// ----------------------------------------------------------------------------
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#include<math.h>
#include<string.h>
#include<stdbool.h>

// repetition
// ----------------------------------------------------------------------------
#define FOR(i, a, b) for (i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)

// memory clear
// ----------------------------------------------------------------------------
#define CLRNUM(a) memset((a), 0, sizeof(a))
#define CLRBOOL(a, flag) memset((a), flag, sizeof(a))
#define CLRCHAR(a) memset((a), '\0', sizeof(a))

// debug
// ----------------------------------------------------------------------------
#define DEBUGINT(x) printf("%d\n", x);
#define DEBUGFLOAT(x) printf("%f\n", x);
#define DEBUGCHAR(x) printf("%c\n", x);
#define DEBUGSTR(x) printf("%s\n", x);
#define DEBUGFORINT(i, a, b, x) FOR(i, a, b){ printf("%d ", x[i]); }
#define DEBUGFORFLOAT(i, a, b,x ) FOR(i, a, b){ printf("%f ", x[i]); }
#define DEBUGFORCHAR(i, a, b, x) FOR(i, a, b){ printf("%c ", x[i]); }
#define DEBUGREPINT(i, n, x) REP(i, n){ printf("%d ", x[i]); }
#define DEBUGREPFLOAT(i, n, x) REP(i, n){ printf("%f ", x[i]); }
#define DEBUGREPCHAR(i, n, x) REP(i, n){ printf("%c ", x[i]); }

// other
// ----------------------------------------------------------------------------
#define PUTNL printf("\n")

// constant
// ----------------------------------------------------------------------------
#define INF 1000000000

int main(void)
{
    long long int n;
    int list[7];
    int old;
    int i;

    while (1){
        scanf("%lld", &n);

        if (n == 0){
            break;
        }

        CLRNUM(list);

        for (i = 0; i < n; ++i){
            scanf("%d", &old);

            if (old < 10){
                list[0]++;
            }
            else if (old > 9 && old < 20){
                list[1]++;
            }
            else if (old > 19 && old < 30){
                list[2]++;
            }
            else if (old > 29 && old < 40){
                list[3]++;
            }
            else if (old > 39 && old < 50){
                list[4]++;
            }
            else if (old > 49 && old < 60){
                list[5]++;
            }
            else if (old > 59){
                list[6]++;
            }
        }

        for (i = 0; i < 7; ++i){
            printf("%d\n", list[i]);
        }
    }
   
    return 0;
    
}

Measured memory_bytes: 412
var
	N,TX,pre,t,ans,i:Longint;
begin
	read(N,TX);
	for i:=1 to N do begin
		read(t);
		if pre<=t then inc(ans,TX)else inc(ans,t+TX-pre);
		pre:=t+TX;
	end;
	writeln(ans);
end.


Measured memory_bytes: 128
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author hamaron
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <stdio.h>

using namespace std;

class CTraveling {
public:
    void solve(std::istream &in, std::ostream &out) {
        int N, t, x, y;
        in >> N;

        int currentX = 0, currentY = 0, departureTime = 0;
        for (int i = 0; i < N; i++) {
            in >> t >> x >> y;
            int distanceX = abs(currentX - x);
            int distanceY = abs(currentY - y);
            int time = t - departureTime;

            // Impossible to reach the destination
            if (time < distanceX + distanceY) {
                out << "No";
                return;
            }

            if (time == distanceX + distanceY) {
                currentX = x;
                currentY = y;
                departureTime = t;
                continue;
            }

            if ((time - distanceX - distanceY) % 2 == 0) {
                currentX = x;
                currentY = y;
                departureTime = t;
                continue;
            } else {
                out << "No";
                return;
            }
        }

        out << "Yes";
    }
};


int main() {
	CTraveling solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;

using ll = long long;
using Bint = mp::cpp_int;
ll mod = 1000000007;

int main() {
input:
    string s;
    cin >> s;

    rep(i, s.length()) { cout << "x"; }
    cout << endl;

    return 0;
}



Measured memory_bytes: 256
n = int(input())
s = input()
def get_sequence(arr):
  if len(arr) == 0:
    return [], []
  elements = []
  nums = []
  n = 1
  prev = arr[0]
  for c in arr[1:]:
    if c == prev:
      n += 1
    else:
      elements.append(prev)
      nums.append(n)
      prev = c
      n = 1
  elements.append(prev)
  nums.append(n)
  return elements, nums
print(len(get_sequence(s)[0]))

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

using namespace std;

#ifdef DEBUG_MODE
	#define DBG(n) n;
#else
	#define DBG(n) ;
#endif
#define REP(i,n) for(ll (i) = (0);(i) < (n);++i)
#define PB push_back
#define MP make_pair
#define FI first
#define SE second
#define SHOW1d(v,n) {for(int W = 0;W < (n);W++)cerr << v[W] << ' ';cerr << endl << endl;}
#define SHOW2d(v,i,j) {for(int aaa = 0;aaa < i;aaa++){for(int bbb = 0;bbb < j;bbb++)cerr << v[aaa][bbb] << ' ';cerr << endl;}cerr << endl;}
#define ALL(v) v.begin(),v.end()
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL
#define MOD 1000000007

typedef long long ll;
typedef pair<ll,ll> P;

ll dp[111][11];

vector<int> v;

int main(){

	ll h,w,k;cin >> h >> w >> k;
	dp[0][0] = 1;

	REP(i,(1<<(w-1))){
		bool flag = true;
		REP(j,w){
			bool a = false;
			bool b = false;
			if(i & (1 << j))a = true;
			if(i & (1 << (j+1)))b = true;
			if(a & b)flag = false;
		}
		if(flag)v.PB(i);
	}

	REP(i,h){
		REP(j,w){
			REP(k,v.size()){
				if(v[k] & (1 << j)){
					dp[i+1][j+1] += dp[i][j];
					dp[i+1][j+1] %= MOD;
				}
				else if(j > 0 && v[k] & (1 << (j-1))){
					dp[i+1][j-1] += dp[i][j];
					dp[i+1][j-1] %= MOD;
				}
				else {
					dp[i+1][j] += dp[i][j];
					dp[i+1][j] %= MOD;
				}
			}
		}
	}

	cout << dp[h][k-1] << endl;

	return 0;
}


Measured memory_bytes: 256
import numpy as np

N = int(input())
x = []
for i in range(N):
    x.extend(input().split())

a = np.array(x, dtype='int').reshape((N, 2))
s = a[:,0:1] + a[:,1:2]
a = np.hstack((a, s))
a = a[np.argsort(a[:, 2])]
n = np.sum(a[(N + 1)%2::2, 0]) - np.sum(a[N % 2::2, 1])
print(n)

Measured memory_bytes: 42016
import math
a,b,h,m=map(int,input().split())
#毎分5.5度ずつ差が開いていく。
ke=(h*60+m)*5.5/360
ke=(ke-int(ke))*math.pi*2
ans=math.sqrt(a**2+b**2-2*a*b*math.cos(ke))
print(ans)

Measured memory_bytes: 62568