akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define V(u) (u.x>=0?(u.y>=0?1:4):(u.y>=0?2:3))
using namespace std;
struct point{
	double x,y;
}p[110];
int n,a[110],b[110];
double tx,ty,ans;
bool cmp(point x,point y){
	if(V(x)!=V(y))return V(x)<V(y);
	return x.x*y.y-x.y*y.x>0;
}
void Work(int t){
	if(t==1)for(int i=1;i<=n;++i)p[i].x=a[i],p[i].y=b[i];
	else if(t==2)for(int i=1;i<=n;++i)p[i].x=-b[i],p[i].y=a[i];
	else if(t==3)for(int i=1;i<=n;++i)p[i].x=-a[i],p[i].y=-b[i];
	else for(int i=1;i<=n;++i)p[i].x=b[i],p[i].y=-a[i];
	sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;++i){
		tx=ty=0;
		for(int j=i;j<=n;++j)tx+=p[j].x,ty+=p[j].y,ans=max(ans,sqrt(tx*tx+ty*ty));
	}
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)scanf("%d%d",&a[i],&b[i]);
	Work(1),Work(2),Work(3),Work(4);
	printf("%.12lf",ans);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define REPP(i,n) for(int i=1;i<=n;i++)
const double PI = acos(-1);
const double EPS = 1e-15;
long long INF=(long long)1E17;
#define i_7 (long long)(1E9+7)
long mod(long a){
    long long c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}

using namespace std;
bool prime_(int n){
  if(n==1){
    return false;
  }else if(n==2){
    return true;
  }else{
    for(int i=2;i<=sqrt(n);i++){
      if(n%i==0){
        return false;
      }
    }
    return true;
  }
}

long long gcd_(long long a, long long b){
  if(a<b){
    swap(a,b);
  }
  if(a%b==0){
    return b;
  }else{
    return gcd_(b,a%b);
  }
}
 
long long lcm_(long long x, long long y){
  return (x/gcd_(x,y))*y;
}
 
class UnionFind {
    public:
    //各頂点の親の番号を格納する。その頂点自身が親だった場合は-(その集合のサイズ)を入れる。
    vector<int> Parent;
    
    //クラスを作るときは、Parentの値を全て-1にする。
    //以下のようにすると全てバラバラの頂点として解釈できる。
    UnionFind(int N) {
        Parent = vector<int>(N, -1);
    }
    
    //Aがどのグループに属しているか調べる
    int root(int A) {
        if (Parent[A] < 0) return A;
        return Parent[A] = root(Parent[A]);
    }
    
    //自分のいるグループの頂点数を調べる
    int size(int A) {
        return -Parent[root(A)];//先祖をrootで取っておきたい。
    }
    
    //AとBをくっ付ける
    bool connect(int A, int B) {
        //AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
        A = root(A);
        B = root(B);
        if (A == B) {
            //すでにくっついてるからくっ付けない
            return false;
        }
        
        //大きい方(A)に小さいほう(B)をくっ付けたい
        //大小が逆だったらAとBをひっくり返す。
        if (size(A) < size(B)) swap(A, B);
        
        //Aのサイズを更新する
        Parent[A] += Parent[B];
        //Bの親をAに変更する
        Parent[B] = A;
        
        return true;
    }
};

int main(){
  
  double x[3],y[3];
  REP(i,3){
    cin>>x[i]>>y[i];
  }
  
  double a,b,c;//三角形の三辺の長さ
  a = hypot(x[0]-x[1],y[0]-y[1]);
  b = hypot(x[1]-x[2],y[1]-y[2]);
  c = hypot(x[2]-x[0],y[2]-y[0]);
  
  double s = (a+b+c)/2;
  double area = sqrt(s*(s-a)*(s-b)*(s-c));//三角形の面積
  double r = area/s;//内接円の半径
  
  double l = max(a, max(b,c));//最長の辺の長さ
  double ans;
  ans = l*r/(2.0*r+l);
  
  cout << fixed << setprecision(10) << ans << endl;
  
  return 0;
}


Measured memory_bytes: 256
#ifdef LOCAL111
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

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

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

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int n, d;
	while(cin >> n >> d) {
		auto x = make_v<int>(n, d);
		REP(i, n) REP(j, d) {
			cin >> x[i][j];
		}
		int ans = 0;
		REP(i, n) REP(j, i) {
			int t = 0;
			REP(k, d) {
				t += (x[i][k] - x[j][k]) * (x[i][k] - x[j][k]);
			}
			bool f = false;
			REP(a, t + 1) {
				if(a * a == t) {
					f = true;
				}
			}
			ans += f;
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#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 RI(i,n) FOR(i,1,(n))
#define REP(i,n) FOR(i,0,(n)-1)
#define mini(a,b) a=min(a,b)
#define maxi(a,b) a=max(a,b)
#define mp make_pair
#define pb push_back
#define st first
#define nd second
#define sz(w) (int) w.size()
typedef vector<int> vi;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
const int inf = 1e9 + 5;
const int nax = 1005;

char sl[nax][nax];

int main() {
	int h, w;
	scanf("%d%d", &h, &w);
	REP(i, h) scanf("%s", sl[i]);
	REP(rep, 2) {
		REP(y, h) {
			REP(x, w) {
				if(y == 0) {
					if(rep == 0) printf("#");
					else printf(".");
				}
				else if(y == h - 1) {
					if(rep == 0) printf(".");
					else printf("#");
				}
				else if(sl[y][x] == '#') printf("#");
				else if(x % 2 == rep) printf("#");
				else printf(".");
			}
			puts("");
		}
		if(rep == 0) puts("");
	}
	return 0;
}


Measured memory_bytes: 1280
# 入力を整数に変換して受け取る
def II(): return int(sys.stdin.readline())

def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())

# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]


import sys
l = II()
print(l*l*l/27)

Measured memory_bytes: 3060
import re

def readline():
    return raw_input()

def split8by10(str):
    str = str.rjust(80,'0')
    ss = []
    for s in range(0,len(str),8):
        ss.append(int(str[s:s+8]))
    return ss

def add8by10(a,b):
    c = [0 for i in range(0,10)]
    p = 10**8
    for i in reversed(range(0,10)):
        c[i] += a[i] + b[i]
        if c[i] >= p:
            if i > 0:
                c[i-1] += c[i] // p
            else:
                return None
        c[i] = c[i] % p
    return c

n = int(readline())
for i in range(0,n):
    a = readline()
    b = readline()
    if len(a) > 80 or len(b) > 80:
        print "overflow"
        continue
    a = split8by10(a)
    b = split8by10(b)
    c = add8by10(a,b)
    if c is None:
        print "overflow"
    else:
        print re.sub('^0{,79}',"","".join(map(lambda x:str(x).rjust(8,'0'),c)))

Measured memory_bytes: 4276
/*
读题不规范，爆零两行泪。
数据不清空，爆零两行泪。
多测不读完，爆零两行泪。
边界不特判，爆零两行泪。
贪心不证明，爆零两行泪。
D P 顺序错，爆零两行泪。
大小少等号，爆零两行泪。
变量不统一，爆零两行泪。
越界不判断，爆零两行泪。
调试不注释，爆零两行泪。
溢出不 l l，爆零两行泪。
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int mod=1000000007,inf=0x3f3f3f3f3f3f3f3f;
const int N=100000;
int n,a,b;
int s[N+1];
int Sum[N+1][2];
int dp[N+1][2];
int lft[N+1][2];
int sum(int l,int r,bool tp){
	if(l>r)return 0;
	return (Sum[r][tp]-Sum[l-1][tp])%mod;
}
signed main(){
	cin>>n>>a>>b;
	for(int i=1;i<=n;i++)scanf("%lld",s+i);
	for(int i=1,ie;i<=n;i=ie+1){
		ie=i;while(ie+1<=n&&s[ie+1]-s[ie]>=a)ie++;
		for(int j=i;j<=ie;j++)lft[j][0]=i;
	}
	for(int i=1,ie;i<=n;i=ie+1){
		ie=i;while(ie+1<=n&&s[ie+1]-s[ie]>=b)ie++;
		for(int j=i;j<=ie;j++)lft[j][1]=i;
	}
	dp[0][0]=dp[0][1]=Sum[0][0]=Sum[0][1]=1;
	int las0=0,las1=0;
	s[0]=-inf,s[n+1]=inf;
	for(int i=1;i<=n;i++){
		while(las0+1<i&&s[las0+1]<=s[i+1]-a)las0++;
		while(las1+1<i&&s[las1+1]<=s[i+1]-b)las1++;
		dp[i][0]=sum(lft[i][0]-1,las1,1);
		dp[i][1]=sum(lft[i][1]-1,las0,0);
		Sum[i][0]=(Sum[i-1][0]+dp[i][0])%mod;
		Sum[i][1]=(Sum[i-1][1]+dp[i][1])%mod;
	}
	cout<<(dp[n][0]+dp[n][1]+10*mod)%mod;
	return 0;
}

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

using pii = pair<int, int>;
using ll  = long long;
#define rep(i, j) for (int i = 0; i < (int)(j); i++)
#define repeat(i, j, k) for (int i = (j); i < (int)(k); i++)
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " : " << x << endl

template <class T>
bool set_min(T &a, const T &b) {
    return a > b ? a = b, true : false;
}

template <class T>
bool set_max(T &a, const T &b) {
    return a < b ? a = b, true : false;
}
// vector
template <class T>
istream &operator>>(istream &is, vector<T> &v) {
    for (T &a : v) is >> a;
    return is;
}
template <class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
    for (const T &t : v) os << "\t" << t;
    return os << endl;
}
// pair
template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &v) {
    return os << "<" << v.first << ", " << v.second << ">";
}

const int INF = 1 << 30;
const ll INFL = 1LL << 60;

int main() {
    ll N, K;
    cin >> N >> K;
    vector<int> A(N);
    cin >> A;
    debug(K);
    rep(i, N) A[i]--;
    vector<int> arr;
    vector<int> visited(N);
    int now = 0;
    while (true) {
        if (visited[now]) break;
        visited[now] = true;
        arr.push_back(now);
        now = A[now];
    }
    if (arr.size() > K) {
        cout << arr[K] + 1 << endl;
        return 0;
    }
    int start = 0;
    for (int i = 0; i < arr.size(); i++)
        if (now == arr[i]) {
            start = i;
            break;
        }
    int len = arr.size() - start;
    K -= start;
    K = K % len;
    cout << arr[start + K] + 1 << endl;

    return 0;
}


Measured memory_bytes: 5888
#include<stdio.h>
int main(void){
  int A,B;
  scanf("%d %d",&A,&B);
  if(A+B < A-B){
    if(A-B < A*B){
      printf("%d\n",A*B);
    }else{
      printf("%d\n",A-B);
    }
  }else{
    if(A+B > A*B){
      printf("%d\n",A+B);
    }else{
      printf("%d\n",A*B);
    }
  }
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
#define debug(x) cerr<<#x<<' '<<x<<'\n'
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
const int maxn=1e5+10;
const int mod=1e9+7;
const int inf=0x3f3f3f3f;
int main()
{
    ios::sync_with_stdio(false);cin.tie(0);
    int n;
    string a;
    cin>>n;
    cin>>a;
    int len=a.size(),ans=0; 
    rep(i,0,len-1) {
        if(a[i]=='A') {
            if(i+1<len&&a[i+1]=='B'&&i+2<len&&a[i+2]=='C') ans++;
        }
    }
    cout<<ans<<'\n';
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>

typedef long long ll;
int main()
{
	int n,x;
	std::cin >> n >> x;
	std::vector<int> v(n);
	for (int i = 0; i < n; i++) {
		std::cin >> v[i];
	}

	ll d = 0;
	int out = 1;

	for (auto i = 0u; i < v.size(); i++) {
		d += v[i];
		out++;

		if (d > x) {
			out--;
			std::cout << out;
			return 0;
		}
	}

	std::cout << out;
	return 0;
}

Measured memory_bytes: 888
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
#define INF 1000000009
typedef long long ll;
using namespace std;
ll ans = 0;
ll N, M;

int main() {
	ll A, B;
	cin >> A >> B;
	cout << A * B - A - B + 1 << endl;
	cin >> ans;
	return 0;
}

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

int main()
{
  int A, B, K;
  cin >> A >> B >> K;
  if(A+K>=B-K+1){
    for(int i=A; i<=B; i++) cout << i << endl;
  }
  else {
    for(int i=A; i<A+K; i++) cout << i << endl;
    for(int i=B-K+1; i<=B; i++) cout << i << endl;
  }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <functional>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>

using namespace std;

int n,m,dx[]={-1,1,0,0},dy[]={0,0,-1,1};
char a[1002][1002];
bool v[1002][1002];

void dfs(int x,int y,char c)
{
	if(v[x][y])return;
	if(a[x][y]!=c)return;
	v[x][y]=1;
	for(int i=0;i<4;++i)
	{
		dfs(x+dx[i],y+dy[i],c);
	}
}
int main()
{
	while(1)
	{
		scanf("%d%d",&n,&m);getchar();
		if(n==0&&m==0)break;
		for(int i=1;i<=n;++i)
		{
			for(int j=1;j<=m;++j)
			{
				scanf("%c",&a[i][j]);
			}
			getchar();
		}
		int cnt=0;
		for(int i=1;i<=n;++i)
		{
			for(int j=1;j<=m;++j)
			{
				if(!v[i][j])
				{
					++cnt;
					dfs(i,j,a[i][j]);
				}
			}
		}
		printf("%d\n",cnt);
		for(int i=1;i<=n;++i)
		{
			for(int j=1;j<=m;++j)
			{
				v[i][j]=0;
				a[i][j]=0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3760
fun main(args: Array<String>) {
    val (n, m) = readLine()!!.split(" ").map { it.toInt() }

    val a = arrayListOf<ArrayList<Int>>()
    val b = arrayListOf<Int>()
    val ans = arrayListOf<Int>()

    for (i in 0 until n) {
        a.add(ArrayList())
        val list = readLine()!!.split(" ").map { it.toInt() }
        list.forEach { t ->
            a[i].add(t)
        }
    }

    for (i in 0 until m) {
        b.add(readLine()!!.toInt())
    }

    for (i in 0 until n) {
        ans.add(0)
        for (j in 0 until m) {
            ans[i] += a[i][j] * b[j]
        }
    }
    println(ans.joinToString("\n"))
}


Measured memory_bytes: 35656
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
A = []
B = []
a = 0
for k in range(X + 1, Y, 1):
    A.append(k)
for i in range(len(A)):
    if max(x) < int(A[i]):
        B.append(A[i])
for j in range(len(B)):
    if min(y) >= int(B[j]):
        a += 1
    else:
        a += 0
if a == 0:
    print("War")
else:
    print("No War")

Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <map>
#include <cmath>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0; i<(n);i++)
typedef long long ll;

int main(){
    int a, b; cin >> a >> b;
    cout << 6 - (a+b) << endl;
    return 0;
}


Measured memory_bytes: 256
N, H = map(int, input().split())
a = [0] * N
b = [0] * N
for i in range(N):
    a[i], b[i] = map(int, input().split())
b.sort(reverse=True)
max_a = max(a)
count = 0
while H > 0:
    if count >= N or b[count] <= max_a:
        if H % max_a == 0:
            count += H // max_a
        else:
            count += (H // max_a)+1
        break
    H -= b[count]
    count += 1
print(count)


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

namespace Atcoder
{
    public class Program
    {
        static void Main(string[] args)
        {
            var r = ReadSplit();
            var H = r[0].ToInt();
            var A = r[1].ToInt();
            int i = 0;
            int sum = 0;
            while (H > sum)
            {
                i++;
                sum += A;
            }
            Write(i);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
            Read();
        }
    }
}


public static class Extentions
{
    public static int ToInt(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static decimal ToDecimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double ToDouble(this object obj)
    {
        return double.Parse(obj.ToString());
    }
}



Measured memory_bytes: 11220
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        List<Long> transportTimeList = new ArrayList<>();

        for (int i = 0; i < 5; i ++){
            transportTimeList.add(sc.nextLong());
        }

        Collections.sort(transportTimeList);
        long weakestWay = transportTimeList.get(0);

        long longestTimeToTransport = getLongestTime(n, weakestWay);
        long minimumTime = 5L;
        long answer = minimumTime + longestTimeToTransport -1L;

        System.out.println(answer);
    }

    private static long getLongestTime(long n, long weakestWay){
        if (n % weakestWay == 0){
            return n / weakestWay;
        }else {
            return n / weakestWay + 1L;
        }
    }

}

Measured memory_bytes: 22612
import java.util.*;

public class Main {
    public static int bubble_sort(int[] dat) {
	int num = 0;
	for(int i = 0; i < dat.length; ++i) {
	    for(int j = 1; j < dat.length-i; ++j) {
		if(dat[j-1] > dat[j]) {
		    ++num;
		    int t = dat[j-1];
		    dat[j-1] = dat[j];
		    dat[j] = t;
		}
	    }
	}
	return num;
    }

    public static void main(String[] args) {
	Scanner s = new Scanner(System.in);
	while(s.hasNext()) {
	    int n = s.nextInt();
	    if(n == 0) break;
	    int[] dat = new int[n];
	    for(int i = 0; i < n; ++i) {
		dat[i] = s.nextInt();
	    }
	    System.out.println(bubble_sort(dat));
	}
    }
}

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

int main(){
    int x;
    cin >> x;
    int result = 0;
    int tmp = 0;

    tmp = x / 500;
    x -= 500 * tmp;
    result += tmp * 1000;

    tmp  = x / 5;
    result += tmp * 5;

    cout << result << endl;
}

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

typedef long long ll;

int main(){
    ll n,sum=0,L=1,R=0;
    ll tmp,x;
    cin>>n;
    while (L<=n){
        tmp=n/L;
        R=min(n/tmp,n);
        x=n/tmp-1LL;
        if (x>=L && x<=R && n%x==tmp){
            sum+=x;
        }
        L=R+1;
    }
    cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define pli pair<ll,int>
#define pll pair<ll,ll>
#define mp make_pair
using namespace std;
const unsigned ll l=1000000007;
const int MAX_=2000;

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

  pair<int, int> p[n];

  for(int i=0; i<n; i++)
  {
    int num;
    cin >> num;

    p[i] = {num,i+1};
  }

  sort(p,p+n);

  for(int i=0; i<n; i++)
  {
    cout << p[i].second << " ";
  }
  return 0;
}


Measured memory_bytes: 1536
import java.util.Scanner;

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

		// 花の数
		int N = sc.nextInt();

		// 一つ手前の花の高さ
		int prev = 0;
		
		// 水やり回数
		int cnt = 0;
		
		// 花の高さの入力
		for (int i = 0; i < N; i++) {
			int h = sc.nextInt();
			if (h < prev)
				cnt += prev - h;
			prev = h;
		}
		cnt+=prev;
		
		System.out.println(cnt);
	}

}


Measured memory_bytes: 25300
#include <bits/stdc++.h>
#define re runtime_error
using namespace std;

int cal(int a, char op, int b) {
	switch (op) {
		case '+': return a + b;
		case '-': return a - b;
		case '*': return a * b;
		case '/': {
			if (b == 0) throw re("You can't divide by 0");
			else return a / b;
		}
		default: throw re("No such operator");
	}
}

int main() {
	int a, b; char op;
	cin >> a >> op >> b;
	cout << cal(a, op, b) << '\n';
}


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

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;
    int arr[n];
    for(int i=0;i<n;i++)    cin>>arr[i];
    int prev=arr[0];
    int ans=0;
    int dp[n+1];
    dp[0]=0;
    dp[1]=abs(arr[1]-arr[0]);
    for(int i=2;i<=n;i++){
        dp[i]=dp[i-1]+abs(arr[i]-arr[i-1]);
        for(int j=i-1;j>=max(0,i-k);j--){
        dp[i]=min(dp[i],dp[j]+abs(arr[i]-arr[j]));
        }
    }
    cout<<dp[n-1]<<endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;

typedef long long ll;
#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////


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

Measured memory_bytes: 3628
#include<stdio.h>
int main()
{
    int a,b,c,e,f;
    char d[1000][1000];
    scanf("%d%d",&a,&b);
    getchar();
    for(c=0;c<a;c++)
    {
        gets(d[c]);
    }
    for(e=0;e<b+1;e++)
        printf("#");
    printf("#\n");
    for(f=0;f<a;f++)
    {
        printf("#");
        printf("%s",d[f]);
        printf("#\n");
    }
    for(e=0;e<b+1;e++)
    printf("#");
    printf("#\n");
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#include <chrono>
#include <random>
#include <cstdio>
#define ll long long int
#define endl '\n'
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define pll pair<ll, ll>
#define pint pair<int, int>
#define S second
#define F first
#define all(c) (c).begin(),(c).end()
using namespace std;
const int N=500001;
ll gcd(ll a, ll b) { if (a == 0) return b; return gcd(b % a, a); } 
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
#define pi 3.14159265358979323846264338
using namespace std; 
ll max(ll a, ll b){ if(a>b)return a;return b;}
ll min(ll a, ll b){ if(a < b) return a;return b;}
ll inf = 100000000000000000;

void solve() 
{
    int x;
    cin>>x;

    if(x>=30)
    {
        cout<<"Yes"<<endl;
    } 
    else
    {
        cout<<"No"<<endl;
    }
}

int main()
{
    #ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int T=1;
    // cin>>T;
    int t=0;
    while(t++<T)

    {
        // cout<<"Case #"<<t<<":"<<' ';
        solve();
        // cout<<'\n';
    }

    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}


Measured memory_bytes: 3796
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;

set<vector<int> > sv;
// vv[k] := 3個以上の合計が10になる饅頭の組合せ
vector<vector<int> > vv;
// v_sum[k] := vv[k]の合計
int v_sum[40] = {0};
// memo[k] := k 番目の組合せで饅頭が作れない
bool memo[40];

// v := 饅頭の集合, sum := v[0] + v[1] + ... + v[v.size()-1] (合計)
void f(vector<int> v, int sum = 0){
	if( sum == 10 ){
		if( 3 <= v.size() ){ 
			sort(v.begin(), v.end());
			sv.insert(v);
		}
	}else if( sum < 10 ){
		for(int i = 9; i >= 1 ; i-- ){
			v.push_back(i);
			f(v, sum + i);
			v.pop_back();
		}
	}
}

// 3個以上で10になる饅頭の組合せを事前に列挙しておく
void init(){
	vector<int> v;
	f(v);
	for(set<vector<int> >::iterator it = sv.begin() ; it != sv.end() ; ++it ){
		vv.push_back(*it);
	}
	for(int i = 0 ; i < vv.size() ; i++ ){
		int sum = 0;
		for(int j = 0 ; j < vv[i].size() ; j++ ){
			sum += vv[i][j];
		}
		v_sum[i] = sum;
	}
}

// v[k](k番目の合計が10になる組合せ)が使えるかどうかを返す
bool check(int k, vector<int> s){
	for(int i = 0 ; i < vv[k].size() ; i++ ){
		int e = vv[k][i];
		if( s[e] == 0 ){
			return false;
		}else{
			s[e]--;
		}
	}
	return true;
}

// v[k](k番目の合計が10になる組合せ)を使う
void used(int k, vector<int> &s){
	for(int i = 0 ; i < vv[k].size() ; i++ ){
		int e = vv[k][i];
		if( s[e] ) s[e]--;
	}
}

int foo;

set<vector<int> > mm;

// DFS
void dfs(int &res, int cnt, int sum, vector<int> &s){
	// 解の更新
	res = max(res, cnt);
	
	if( mm.count(s) ) return;
	
	//if( foo < 100000 ){
		mm.insert(s);
	//}
	
	foo++;
	//if( 7500000 < foo ) return;
	
	if( sum < 10 ) return;
	// もう解が更新できない時点で探索打ち切る
	if( cnt + sum / 10 <= res ) return;
	
	for(int i = 0 ; i < vv.size() ; i++ ){
		if( memo[i] ) continue;
		
		if( check(i, s) ){
			vector<int> s_ = s;
			used(i, s_);
			dfs(res, cnt + 1, sum - v_sum[i], s_);
		}
	}
}

int solve(vector<int> &s){
	foo = 0;
	int sum = 0, res = 0;
	for(int i = 0 ; i < vv.size() ; i++ ){
		if( !check(i, s) ){
			memo[i] = true;
		}
	}
	
	mm.clear();
	for(int i = 1 ; i <= 9 ; i++ ) sum += i * s[i];
	dfs(res, 0, sum, s);
	return res;
}

int main(){
	// 3個以上で10になる饅頭の組合せを事前に列挙しておく
	init();
	
	int n;
	while( cin >> n, n ){
		
		// s[k] := 重さkの饅頭の個数
		vector<int> s(12, 0);
		fill(memo, memo + 40, false);
		
		for(int i=0 ; i < n ; i++ ){
			int e;
			cin >> e;
			s[e]++;
		}
		
		int ans = 0;
		// 2個で10になる組合せは貪欲に使う
		for(int i = 1 ; i <= 4 ; i++ ){
			int j = 10 - i;
			int k = min(s[i], s[j]);
			s[i] -= k;
			s[j] -= k;
			ans += k;
		}
		ans += s[5]/2;
		s[5] %= 2;
		// 3個以上で10になる組合せを探索する
		ans += solve(s);
		// 出力
		cout << ans << endl;
	}	
}

Measured memory_bytes: 1456
#include<cstdio>
#include<iostream>
#include<cstring>
#define in inline
#define re register
using namespace std;
in int read(){
	re int t=0;
	re char v=getchar();
	while(v<'0'||v>'9')v=getchar();
	while(v>='0'&&v<='9'){
		t=(t<<3)+(t<<1)+(v^48);
		v=getchar();
	}
	return t;
}
int un[22][22],kd[22][22],n,t,cnt[22],cnt1[22],tr[22],ut[22],ans;
inline void dfs(re int x,re int y){
	if(x==t+1){
		if(y>ans)ans=y;
		return;
	}
	if(!tr[x])++ut[x],dfs(x+1,y),--ut[x];
	if(!ut[x]){
		++tr[x];
		for(re int i=1;i<=cnt[x];++i){
			if(ut[kd[x][i]]){--tr[x];return;
			}
		}
		for(re int i=1;i<=cnt1[x];++i){
			if(tr[un[x][i]]){--tr[x];return;
			}
		}
		for(re int i=1;i<=cnt[x];++i)++tr[kd[x][i]];
		for(re int i=1;i<=cnt1[x];++i)++ut[un[x][i]];
		dfs(x+1,y+1);
		for(re int i=1;i<=cnt[x];++i)--tr[kd[x][i]];
		for(re int i=1;i<=cnt1[x];++i)--ut[un[x][i]];
		--tr[x];
	}
	
}
int main(){
	t=read();
	for(re int i=1;i<=t;++i){
		n=read();
		for(re int j=1;j<=n;++j){
			int x=read(),y=read();
			if(y==1)kd[i][++cnt[i]]=x;
			else un[i][++cnt1[i]]=x;
		}
	}
	dfs(1,0);
	cout<<ans;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iomanip>
#include <time.h>
#include <math.h>
#include <iostream>
#include <algorithm>
#include <string.h>
#include <queue>
#include <vector>
#define mod 1000000007
#define ll long long
#define pi acos(-1)
using namespace std;

int main(){
	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin>>a>>b>>c>>d;
	while(1){
		c-=b;
		if(c<=0){
			cout<<"Yes";
			break;
		}
		a-=d;
		if(a<=0){
			cout<<"No";
			break;
		}
	}
		
	return 0;
}

Measured memory_bytes: 3612
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <utility>
#include <queue>
#include <set>
#include <map>
#include <deque>
#include <iomanip>
#include <cstdio>
#include <stack>
#include <numeric>

using namespace std;
typedef  long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
#define  MP make_pair
#define  PB push_back
#define inf  1000000007
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n)cin >> a[i];
    vector<int> ans;
    bool flag = 0;
    for(int i=0;i<n;i++){
        int k = -1;
        for(int j=0;j<a.size();j++){
            if(a[j]==j+1){
                k = j;      
            }
        }
        if(k==-1){
            flag = 1;break;
        }else{
            ans.push_back(k+1);
            a.erase(a.begin()+k);
        }
    }
    if(flag){
        cout << -1 << endl;
    }else{
        reverse(ans.begin(),ans.end());
        rep(i,n)cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 888
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <cassert>
#include <iostream>
#include <cctype>
#include <sstream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <set>
#include <stack>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <iterator>
#include <bitset>
#include <complex>
#include <fstream>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef pair<int, int> pint;
#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++)
template<class T> T RoundOff(T a){ return int(a+.5-(a<0)); }
template<class T, class C> void chmax(T& a, C b){ if(a < b) a = b; }
template<class T, class C> void chmin(T& a, C b){ if(b < a) a = b; }
template<class T, class C> pair<T, C> mp(T a, C b){ return make_pair(a, b); }

int count(string v)
{
	int res = 0;
	int sub = 0;
	
	rep(i, v.size())
	{
		if(v[i] == '0' || i + 1 == v.size())
		{
			chmax(res, sub + (v[i] == '1'));
			sub = 0;
		}
		else
		{
			sub++;
		}
	}
	
	return res;
}

int line(vector<string> v, int len)
{
	int n = v.size();
	int x = len - 1, y = 0;
	int res = 0;
	
	// ツ右ツ湘」ツつゥツづァツ湘」ツ板シツ閉ェ
	string s;
	rep(i, len)
	{
		s.push_back(v[y][x]);
		x--;
		y++;
	}
	
	chmax(res, count(s));
	s.clear();
	
	// ツ右ツ湘」ツつゥツづァツ可コツ板シツ閉ェ
	x = n - 1;
	y = n - len;
	rep(i, len)
	{
		s.push_back(v[y][x]);
		x--;
		y++;
	}
	
	chmax(res, count(s));
	s.clear();
	
	// ツ債カツ湘」ツつゥツづァツ湘」ツ板シツ閉ェ
	x = n - len;
	y = 0;
	rep(i, len)
	{
		s.push_back(v[y][x]);
		x++;
		y++;
	}
	
	chmax(res, count(s));
	s.clear();
	
	// ツ債カツ湘」ツつゥツづァツ可コツ板シツ閉ェ
	x = 0;
	y = n - len;
	rep(i, len)
	{
		s.push_back(v[y][x]);
		x++;
		y++;
	}
	
	chmax(res, count(s));
	
	return res;	
}
int main()
{
    int n;
	while(cin >> n && n)
	{
		int res = 0;
		vector<string> v(n);
		rep(i, n) cin >> v[i];
		
		
		rep(i, n)
		{
			chmax(res, count(v[i]));
			
			string s;
			rep(j, n) s.push_back(v[j][i]);
			
			chmax(res, count(s));
		}
		
		for(int i = n; 0 < i; i--)
			chmax(res, line(v, i));
		
		cout << res << endl;
	}
}

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

const long long mod=1e9+7;
 
long long zzs(long long a,long long b) 
{
    long long sq=1;
    while(b)
	{
        if(b&1) 
            sq=sq*a%mod;
        a=a*a%mod;
        b>>=1;
    }
    return sq;
}
int main() 
{
    long long n;
    cin>>n; 
    cout<<((zzs(10ll,n)-2*zzs(9ll,n)+zzs(8ll,n))%mod+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 3644
#17:01
n = int(input())
a = list(map(int,input().split()))
minus = 0
b = []
for i in range(n):
  if a[i] < 0:
    minus += 1
  b.append(abs(a[i]))
b.sort()
print(sum(b) - 2 * (minus%2) * b[0])

Measured memory_bytes: 14284
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define ll int64_t
#define _GLIBCXX_DEBUG
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
//約数列挙(√N)
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
//素因数分解(√N)
map< int64_t, int > prime_factor(int64_t n) {
  map< int64_t, int > ret;
  for(int64_t i = 2; i * i <= n; i++) {
    while(n % i == 0) {
      ret[i]++;
      n /= i;
    }
  }
  if(n != 1) ret[n] = 1;
  return ret;
}
//素数テーブル(NloglogN)
vector< bool > prime_table(int n) {
  vector< bool > prime(n + 1, true);
  if(n >= 0) prime[0] = false;
  if(n >= 1) prime[1] = false;
  for(int i = 2; i * i <= n; i++) {
    if(!prime[i]) continue;
    for(int j = i + i; j <= n; j += i) {
      prime[j] = false;
    }
  }
  return prime;
}
//二項係数(K)
template< typename T >
T binomial(int64_t N, int64_t K) {
  if(K < 0 || N < K) return 0;
  T ret = 1;
  for(T i = 1; i <= K; ++i) {
    ret *= N--;
    ret /= i;
  }
  return ret;
}
//二項係数テーブル(N^2)
template< typename T >
vector< vector< T > > binomial_table(int N) {
  vector< vector< T > > mat(N + 1, vector< T >(N + 1));
  for(int i = 0; i <= N; i++) {
    for(int j = 0; j <= i; j++) {
      if(j == 0 || j == i) mat[i][j] = 1;
      else mat[i][j] = mat[i - 1][j - 1] + mat[i - 1][j];
    }
  }
  return mat;
}
int main(){
  auto v=prime_table(100000);
  vector<int> like2017(100003,0);
  rep(i,100001){
    if(i%2==0)continue;
    if(v.at(i)&&v.at((i+1)/2))like2017.at(i)=1;
  }
  vector<int> ruiseki(100003,0);
  rep(i,100001)
    ruiseki.at(i+1)=ruiseki.at(i)+like2017.at(i);
  int q;
  cin >> q;
  rep(i,q){
    int l,r;
    cin >> l >> r;
    cout << ruiseki.at(r+1)-ruiseki.at(l) << endl;
  }
}


Measured memory_bytes: 1408
N = int(input())
n3 = N//3
n5 = N//5
n15 = N//15
sum = N*(N+1)//2 - 3 * n3 *(n3+1)//2 - 5 * n5*(n5+1)//2 + 15 * n15*(n15+1)//2
print(sum)

Measured memory_bytes: 9172
#include<stdio.h>
#include<iostream>
#include<vector>

using namespace std;

int main(){
  int n;
  cin>>n;
  vector<string> s(n);
  vector<int> t(n);
  for(int i=0;i<n;i++){
    cin>>s[i]>>t[i];
  }
  string x;
  cin>>x;
  
  int pos=0;
  while(true){
    if(s[pos]==x){
      pos++;
      break;
    }
    pos++;
  }
  
  int ans=0;
  for(int i=pos;i<n;i++){
    ans+=t[i];
  }
  
  cout << ans;
  
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define EPS (1e-10)
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

signed main(){
	string s;
	int w;cin>>s>>w;
	string t;
	for(int i=0;i<s.size();i+=w){
		t+=s[i];
	}
	cout<<t<<endl;
}

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

int main(void){
	int a,b,c,ans=1000000;
	scanf("%d %d %d",&a,&b,&c);
	if(abs(a-b) + abs(a-c) < ans) ans=abs(a-b) + abs(a-c);
	if(abs(b-c) + abs(b-a) < ans) ans=abs(b-c) + abs(b-a);
	if(abs(c-a) + abs(c-b) < ans) ans=abs(c-a) + abs(c-b);
	printf("%d",ans);
	return 0;
}

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

int main(){
    int N,K;
    cin >> N >> K;
    if(K == 1){
        cout << 0 << "\n";
        return 0;
    }
    cout << N - K << "\n";
    return 0;
} 


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<math.h>
#include<queue>
#include<deque>
#include<stack>
#include<cstdio>
#include<utility>
#include<set>
#include<list>
#include<cmath>
#include<stdio.h>
#include<string.h>
#include<iomanip>
#include<cstdio>
#include<cstdlib>
#include<cstring>
using namespace std;
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define REP(i, n) FOR(i, 0, n - 1)
#define NREP(i, n) FOR(i, 1, n)
using ll = long long;
using pii = pair<int, int>;
using piii = pair<pii, pii>;
const ll dx[4] = { -1, 0, 0, 1 };
const ll dy[4] = { 0, -1, 1, 0 };
const ll INF = 1e9 + 7;
const ll inf = 1LL << 50;
int gcd(int x, int y) {
	if (x < y)swap(x, y);
	if (y == 0)return x;
	return gcd(y, x%y);
}
void mul(ll a, ll b) {
	a = a * b % INF;
}
struct Accelerate_Cin {
	Accelerate_Cin() {
		cin.tie(0);
		ios::sync_with_stdio(0);
		cout << fixed << setprecision(20);
	};
};
///////////////////////////////////////


int main() {
	ll N; cin >> N;
	ll d[51];
	int key[13];
	for (int i = 0; i < 13; ++i) {
		key[i] = 0;
	}
	key[0] = 1;
	REP(i, N) {
		cin >> d[i];
		if (d[i] == 0 || d[i] == 12) {
			key[d[i]]++;
		}
		else {
			if (d[i] < 12) {
				key[d[i]]++;
			}
			else {
				key[24 - d[i]]++;
			}
		}
	}
	for (int i = 0; i <= 12; ++i) {
		if (i == 0||i==12) {
			if (key[i] >= 2) {
				cout << 0 << endl;
				return 0;
			}
		}
		else {
			if (key[i] >= 3) {
				cout << 0 << endl;
				return 0;
			}
		}
	}
	int ans = 0;
	vector<int>v;
	int visited[13];
	for (int i = 0; i < 13; ++i)visited[i] = 0;
	for (int i = 1; i < 12; ++i) {
		if (key[i] == 1) {
			v.push_back(i);
			visited[i] = 2;
		}
		else if (key[i] == 2)visited[i] = 0;
		else visited[i] = 1;
	}
	int m = v.size();
	for (int i = 0; i < (1 << m); ++i) {
		vector<int>V;
		for (int j = 0; j < m; ++j) {
			if (i&(1 << j)) {
				V.push_back(v[j]);
			}
			else {
				V.push_back(24 - v[j]);
			}
		}
		for (int j = 1; j < 12; ++j) {
			if (visited[j] == 2)continue;
			if (visited[j] == 0) {
				V.push_back(j);
				V.push_back(24 - j);
			}
		}
		if (key[12])V.push_back(12);
		V.push_back(0);
		sort(V.begin(), V.end());
		int sum = 1e9;
		for (int j = 0; j < V.size() - 1; ++j) {
			sum = min(sum, V[j + 1] - V[j]);
		}
		sum = min(sum, 24 - V[V.size() - 1]);
		ans = max(ans, sum);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{

   ll n,k;
   cin>>n>>k;
   vector<ll> health;
   ll temp;
   for(ll i=0;i<n;i++){
    cin>>temp;
    health.push_back(temp);

       }
       sort(health.begin(),health.end(),greater<ll>());
       ll sum=0;
     for(ll i=k;i<n;i++){
        sum+=health[i];
     }
     cout<<sum;

    return 0;
}


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

using namespace std;

#define REP(i,n)	for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPS(i,s,n)	for(int i=(s), i##_len=(n); i<i##_len; ++i)

#define ALL(obj)	(obj).begin(),(obj).end()

typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int 			ll;

typedef pair<int,int>			P;

#define LINF		((ll)1 << 63 -1)
#define INF 		2000000007
#define MINF		-2000000007
#define MAX 		100005

const int MOD = 1e9+7;
// テンプレ終了
//====================================================================//

int N;

vector<vector<int>> edge(MAX);
int match[MAX];
bool used[MAX];

bool dfs(int v){
	used[v] = true;
	for(int itr : edge[v]){
		int w = match[itr];
		if(w < 0 || !used[w] && dfs(w)){
			match[v] = itr;
			match[itr] = v;
			return true;
		}
	}
	return false;
}

int bipartite_matching(){
	int res = 0;
	memset(match, -1, sizeof(match));
	REP(v,N){
		if(match[v] < 0){
			memset(used,0,sizeof(used));
			if(dfs(v)) res++;
		}
	}
	return res;
}

//
int main(){
	//int N;
	cin>>N;
	vector<P> red(N),blue(N);

	REP(i,N){
		int a,b;
		cin>>a>>b;
		red[i] = P(a,b);
	}
	REP(i,N){
		int c,d;
		cin>>c>>d;
		blue[i] = P(c,d);
	}
	

	REP(r,N){
		REP(b,N){
			if(red[r].first < blue[b].first && red[r].second < blue[b].second){
				edge[r].push_back(b+N);
				edge[b+N].push_back(r);
			}
		}
	}

	cout << bipartite_matching() << endl;

	return 0;
}




Measured memory_bytes: 3072
<?php /*atcoder.php*/

$at = new Atcoder();
$at->main();
unset($at);

class Atcoder{
	private function lineIn(){
		$buf = fgets(STDIN);
		return $this->killNewLine($buf);
	}
	private function killNewLine($buf = null){
		$buf = str_replace("\r\n", "", $buf);
		$buf = str_replace("\n", "", $buf);
		$buf = str_replace("\r", "", $buf);
		return $buf;
	}

	public function main(){
		$s = $this->lineIn();
		
		$buf = 0;
		$bufa = array();
		$csa = array();

		for($i = 0; $i < 10; $i++){
			if(!array_key_exists($i, str_split($s))){break; };
			if("A" == $s[$i] ||
			   "C" == $s[$i] ||
			   "G" == $s[$i] ||
			   "T" == $s[$i] ){
			   $bufa[] = true;
			   }else{
			   $bufa[] = false;
			   }
		}

		foreach($bufa as $v){
			if($v){
				$buf++;
			}else{
				$buf = 0;
			}
			$csa[] = $buf;
		}
		unset($v);

		rsort($csa);

		echo $csa[0] . "\n";

	}
}
?>


Measured memory_bytes: 4728
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
static const double EPS = 1e-8;
static const int INF = (int)1e8;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) for (int i=0; i<(int)(n); ++i)
string migis = "yuiophjklnm";
bool finds(char c){
  REP(i,migis.size())if(migis[i]==c)return true;
  return false;
}

int main(void){
  string input;
  while(cin>>input){
    int ans = 0;
    if(input=="#") break;
    int b = finds(input[0]);
    for(int i=1; i<input.size();i++){
      if(b!=finds(input[i]))ans++;
      b = finds(input[i]);
    }
    cout<<ans<<endl;
  }
  return 0;
}

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



int main() {
    ll a, b, c, d;
    cin>>a>>b>>c>>d;
 
    ll cn = b / c - (a - 1) / c;
    ll dn = b / d - (a - 1) / d;
    ll g = __gcd(c, d);
    ll l = c / g * d;
    ll ln = b / l - (a - 1) / l;
    cout<<(b - a + 1) - (cn + dn - ln)<<endl;
}

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

int main(){
  int N, count=0;
  vector<int> d(N);
  
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> d.at(i);
  }
  
  sort(d.begin(), d.end());
  reverse(d.begin(), d.end());
  d.push_back(-1);
  for (int j=0; j<N; j++) {
    count++;
    if (d.at(j) == d.at(j+1)) count--;
  }
  cout << count << endl;
}

Measured memory_bytes: 35072
s = int(input())
a = [s]
t = 0

while True:
    if a[t] % 2 == 0:
        tmp = a[t] // 2
    else:
        tmp = 3 * a[t] + 1
    
    if tmp in a:
        break
    else:
        a.append(tmp)
        t += 1

print(t+2)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
typedef long long llong;

int main(){
    llong a, b, k;
    cin >> a >> b >> k;
    llong res_a, res_b;
    if(a >= k){
        res_a = a - k;
        res_b = b;
    } else {
        res_a = 0;
        res_b = b - k + a;
        if(res_b < 0) res_b = 0;
    }
    cout << res_a << " " << res_b << endl;
}

Measured memory_bytes: 256
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <stdio.h>
#include <bits/stdc++.h>

using namespace std;

#include <x86intrin.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(x) x.begin(), x.end()

#define mp make_pair
#define in insert
#define er erase
#define con continue
#define pb push_back
#define sc scanf
#define pr printf
#define ub upper_bound
#define lb lower_bound
#define s second
#define f first
#define int long long

const long long infl = 1e18; 
const int N = 3e5 + 300, N2 = 2e3, inf = 1e9 + 200;

set <int> S;
vector <int> g;
int n, m, k, ans;
int a[N], b[N];
string ss;

void add(int x){
	ans -= b[x] * (b[x] - 1) / 2;
	b[x]++;
	ans += b[x] * (b[x] - 1) / 2;
}

void del(int x){
	ans -= b[x] * (b[x] - 1) / 2;
	b[x]--;
	ans += b[x] * (b[x] - 1) / 2;
}

main (){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n; i++){
		cin >> a[i];
		add(a[i]);
	}
	for (int i = 0; i < n; i++){
		del(a[i]);
		cout << ans << endl;
		add(a[i]);
	}
	return 0;
}












Measured memory_bytes: 5248
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int goat = 3;
		int a = scan.nextInt();
		int b = scan.nextInt();
		String message = "Possible";
		if(a % goat == 0) {
		} else if(b % goat == 0) {
		} else if((a + b) % goat == 0) {
		} else {
			message = "Impossible";
		}
		System.out.println(message);
	}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	if(n % 1000 == 0){
		cout << 0;
	}
	else{
		for(int i = 1; i < 10001; i++){
			if((i + n) % 1000 == 0){
				cout << i;
				break;
			}
		}
	}
}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{

   int n,m;
   cin>>n>>m;
   int l[m],r[m];
   for(int i=0;i<m;i++)
    cin>>l[i]>>r[i];
   int mn=*max_element(l,l+m);
   int mx=*min_element(r,r+m);
   if(mx>=mn)
    cout<<mx-mn+1<<endl;
   else
    cout<<0<<endl;

}





Measured memory_bytes: 4316
import math

n = int(input())
csf = [list(map(int,input().split())) for _ in range(n-1)]

for i in range(n):
    res = 0
    for t in range(i,n-1):
        c,s,f = csf[t]
        if res<=s:
            res = s + c
        else:
            s += f*math.ceil((res-s)/f)
            res = s + c
        #print(i,res)
    print(res)


Measured memory_bytes: 3188
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	set := make(map[string]int)
	for i := 0; i < n; i++ {
		var s string
		fmt.Scan(&s)
		set[s] = 1
	}
	fmt.Println(len(set))
}


Measured memory_bytes: 23700
#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 main(){
	ll n;
	cin >> n;
	
	vector<ll> a;
	for(ll i=1; i*i<=n; i++){
		if(n%i==0){
			a.push_back(i);
			a.push_back(n/i);
		}
	}
	
	int sz = (int)a.size();
	cout << max((int)log10(a[sz-1]), (int)log10(a[sz-2]))+1 << endl;
	
	return 0;
}

Measured memory_bytes: 3808
#include<bits/stdc++.h>
using namespace std;
int main(){int n,k;
cin>>n>>k;
vector<int> vec(n);
for(int i=0;i<n;i++){
  cin>>vec.at(i);
}
sort(vec.begin(), vec.end());
int s=0;
for(int i=0;i<k;i++){
  s+=vec.at(i);
}
cout<<s<<endl;
}

Measured memory_bytes: 3632
#include <iostream>

using namespace std;

int main(void)
{
    int L = 0;
//    double L = 0;

    cin >> L;

//    L = (double)in_L;

//    cout << L * L * L / 27 << endl;
    printf("%.12f\n", (double)L * L * L / 27);  // .NNfで小数点以下NN桁まで考慮する  
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>

using namespace std;
typedef long long int ll;


int main(int argc, char const *argv[])
{
    string o, e;
    cin >> o >> e;

    for (ll i = 0; i < e.size(); i++)
    {
        cout << o[i] << e[i];
    }
    if (o.size() > e.size())
        cout << o[o.size() - 1];
    cout << endl;
}

Measured memory_bytes: 256