akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <sstream>
#include <iterator>
#include <string>
#include <vector>
#include <array>
#include <algorithm>
#include <list>
#include <cmath>
#include <numeric>

#define YESNO(x) x ? printf("YES") : printf("NO")
#define YesNo(x) x ? printf("Yes") : printf("No")
#define scani(x) scanf("%d", &x)
#define scanll(x) scanf("%lld", &x)
#define printi(x) printf("%d", x)
#define printll(x) printf("%lld", x)

using namespace std;

long long GCD(long long x, long long y) {
	return y ? GCD(y, x % y) : x;
}

long long LCM(long long x, long long y) {
	return x * y / GCD(x, y);
}

double sqdist(int x1, int y1, int x2, int y2) {
	return pow(x1 - x2, 2) + pow(y1 - y2, 2);
}

double dist(int x1, int y1, int x2, int y2) {
	return sqrt(sqdist(x1, y1, x2, y2));
}

int A() {
	int ans = 0;
	int a, b, c;

	scani(a);
	scani(b);
	scani(c);

	printi(c);
	printf(" ");
	printi(a);
	printf(" ");
	printi(b);



	return 0;
}


int Main() {
	int ans = 0;
	int n, m;

	scani(n);
	scani(m);

	vector<int> a(n, 1);
	for (auto& x : a) {
		scani(x);
	}

	int select = 0;
	int sum = accumulate(a.begin(), a.end(), 0);
	sort(a.begin(), a.end(), greater<>());
	for (int i = 0; i < m; i++) {
		if ((double)sum / 4 / m <= a[i]) {
			select++;
		}
	}

	YesNo(select == m);

	return 0;
}

int C() {
	long long n, k;

	scanll(n);
	scanll(k);

	long long now = n;
	long long old = pow(10, 18) + 1;
	long long ans = now;
	if (n >= k) {
		ans = n % k;
		now = ans;
	}
	while (now < old) {
		old = now;
		now = abs(now - k);
		ans = min(ans, now);
	}

	printll(ans);

	return 0;
}

int D() {
	long long ans = 0;
	int k;

	printll(ans);

	return 0;
}

int main()
{
	Main();
	return 0;
}


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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<ll> vl;
typedef vector<pair<int, int>> vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

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

	vi h(n);
	rep(i, n) cin >> h[i];

	vl dp(n + 1, INF);
	dp[0] = 0;

	for (int i = 1; i < n; ++i) {
		if (i != 1) {
			chmin(dp[i], dp[i - 2] + abs(h[i] - h[i- 2]));
		}

		chmin(dp[i], dp[i - 1] + abs(h[i] - h[i - 1]));
	}
	cout << dp[n - 1] << endl;
}

Measured memory_bytes: 1536
using System;
using System.Linq;

namespace ABC081
{
    class B
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            int[] A = new int[N];
            for (int i = 0; i < N; i++)
            {
                A[i] = int.Parse(input[i]);
            }

            int count = 0;
            while (true)
            {
                for (int j = 0; j < N; j++)
                {
                    if (A[j] % 2 != 0) { Console.WriteLine(count); return; }
                    A[j] = A[j] / 2;
                }
                count++;
            }
        }
    }
}


Measured memory_bytes: 13124
#include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> P;
int INF = 1e9+7;
int mod = 1e9+7;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
int dp[4005][4005];
signed main() {
    string S,T;
    cin >> S >> T;
    for(int i = 0; i < S.size(); i++) {
        for(int j = 0; j < T.size(); j++) {
            if(S[i] == T[j]) {
                dp[i+1][j+1] = max(dp[i+1][j+1],dp[i][j]+1);
            }
            dp[i+1][j+1] = max({dp[i+1][j+1],dp[i+1][j],dp[i][j+1]});
        }
    }
    string R = "";
    int i = S.size(),j = T.size();
    while(i > 0 && j > 0) {
        if(dp[i][j] == dp[i-1][j]) i--;
        else if(dp[i][j] == dp[i][j-1]) j--;
        else {
            R+=S[i-1];
            i--;j--;
        }
    }
    reverse(R.begin(),R.end());
    cout << R << endl;
}


Measured memory_bytes: 85916
#pragma comment (linker, "/STACK:526000000")
#define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()
unsigned long xor128() {
    static unsigned long x = 123456789, y = 362436069, z = 521288629, w = 88675123;
    unsigned long t = (x^(x << 11));
    x = y; y = z; z = w;
    return (w = (w^(w >> 19))^(t^(t >> 8)));
}
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(100);
}

void solve() {
    int h;
    cin >> h;
    int n;
    cin >> n;
    REP(i, n) {
        int a;
        cin >> a;
        h -= a;
    }
    if (h <= 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
}

int main() {
    init();
    solve();
}

Measured memory_bytes: 256
N = int(input())
S = input()
lb, ub = 0, N
while ub - lb > 1:
    m = (lb + ub) // 2
    ok = False
    dic = {}
    for i in range(N-m+1):
        s = S[i:i+m]
        if s not in dic:
            dic[s] = i
        elif dic[s] + m <= i:
            ok = True
            break
    if ok:
        lb = m
    else:
        ub = m
print(lb)

Measured memory_bytes: 170504
N,M = map(int,(input().split()))
X = list(map(int,(input().split())))
if N >= M:
    print(0)
else:
    X.sort()
    gap = []
    for i in range(1,M):
        gap.append(X[i]-X[i-1])
    s = X[M-1] - X[0]
    gap.sort(reverse=True)
    print(s-sum(gap[0:N-1]))

Measured memory_bytes: 57384
line = gets.chomp.split(" ").map(&:to_i)
n = line[0]
k = line[1]

number_total = Array.new(n + 1, 0)
used_number_sum = 0

gets.chomp.split(" ").map(&:to_i).each do |i|
    if number_total[i] == 0
        used_number_sum += 1
    end
    number_total[i] += 1
end
number_total.delete(0)

number_total.sort!

total = 0
for i in 0..(number_total.length - k - 1)
    total += number_total[i]
end

puts total


Measured memory_bytes: 19568
#include <iostream>
#include <numeric>
#include <cstring>
#include <cmath>
#include <vector>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <iterator>
#include <stack>
#include <string.h>
#include <cstdlib>
#include <queue>
#include <list>
#include <string>
#include <iterator>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < (n); i++) 
using namespace std;

int main() {
    long long int a,x;
    cin >> x >> a;
    if (x < a) {
        cout << 0 << endl;
    } else {
        cout << 10 << endl;
    }
    return 0;
}

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

typedef long long ll;
using namespace std;

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

	string s; cin >> s;
	if(s.size() == 3){reverse(s.begin(),s.end()); cout << s << endl;}
	else cout << s << endl;

	return 0;

}


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

typedef long long ll;

int main() {
    string S, A = "NWSE", ans = "Yes\n";
    cin >> S;
    int N = S.size();
    vector<int> B(4, 0);
    rep(i, N) {
        rep(j, 4) {
            if (S[i] == A[j]) B[j]++;
        }
    }
    rep(i, 4) {
        if (B[i] > 0 && B[(i + 2) % 4] == 0) ans = "No\n";
    }
    cout << ans;
}

Measured memory_bytes: 256
import sys
n = int(input())
start = int(n//1.1)
lis = []
for i in range(start,n+1):
    lis.append(i)
new_lis = []
for l in lis:
    new_lis.append(int(l*1.08))
if n in new_lis:
    for li in lis:
        if int(li*1.08) == n:
            print(li)
            sys.exit()
else:
    print(":(")

Measured memory_bytes: 3316
function main(input) {
  input=input.trim();
  const a = parseInt(input.split(" ")[0], 10);
  const b = parseInt(input.split(" ")[1], 10);
  if(a*b%2==0){
    console.log("Even");
  }else{
    console.log("Odd");
  }

}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 9420
N = int(input())
ans = 0
arr = [[0] * 10 for _ in range(10)]
for i in range(1,N+1):
    tmp = str(i)
    arr[int(tmp[0])][int(tmp[-1])] += 1
for i in range(1,N+1):
    tmp = str(i)
    ans += arr[int(tmp[-1])][int(tmp[0])]
print(ans)

Measured memory_bytes: 3064
N=int(input())
l=[int(x) for x in input().rstrip().split()]
now=[]
n=[]
cnt=0
for i in range(1,N-1):
  if l[i-1]<l[i] and l[i]<l[i+1]:
    cnt+=1
  elif l[i+1]<l[i] and l[i]<l[i-1]:
    cnt+=1

print(cnt)




Measured memory_bytes: 3060
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
int main(void)
{
    int N,R;
    scanf("%d %d",&N,&R);

    int sum = R+100*(10-N);
    if (N<10)printf("%d",sum);
    else printf("%d",R);


    return EXIT_SUCCESS;
}



Measured memory_bytes: 128
#写経
#https://atcoder.jp/contests/m-solutions2020/submissions/15437687

import sys
import numpy as np
 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
 
def f(X1, Y1, X2, Y2):
    # x1,y1 から y が増える側に移動 vs x2,y2 から y が減る側に移動
    ret = 10**18
    key1 = (X1 << 32) + Y1
    key2 = (X2 << 32) + Y2
    ind = key1.argsort()
    X1, Y1, key1 = X1[ind], Y1[ind], key1[ind]      # X，Yの大きさ順
    ind = key2.argsort()
    X2, Y2, key2 = X2[ind], Y2[ind], key2[ind]
    js = np.searchsorted(key2, key1)                # key2にkey1を挿入する場合のインデックス
    for i in range(len(key1)):
        j = js[i]
        if j == len(key2):
            continue
        if X1[i] != X2[j]:
            continue
        ret = min(ret, Y2[j] - Y1[i])
    return ret
 
N = int(readline())
X = []
Y = []
U = []
for _ in range(N):
    x, y, u = readline().split()
    X.append(int(x))
    Y.append(int(y))
    U.append(u)
 
X = np.array(X, np.int64)
Y = np.array(Y, np.int64)
U = np.array(U, 'S1')       # 長さ1のstrを保存
 
i_u = U == b'U'             # [True False False]など該当する部分のみTrueになる
i_r = U == b'R'
i_d = U == b'D'
i_l = U == b'L'
 
Xu, Yu = X[i_u], Y[i_u]     # Upのみ反映される
Xr, Yr = X[i_r], Y[i_r]
Xd, Yd = X[i_d], Y[i_d]
Xl, Yl = X[i_l], Y[i_l]
 
def resolve():
    INF = 10**18
    ans = INF
    ans = min(ans, f(Xu, Yu, Xd, Yd))  # 上、下
    ans = min(ans, f(Yr, Xr, Yl, Xl))  # 右、左
    ans = min(ans, f(Xr + Yr, Xr - Yr, Xu + Yu, Xu - Yu))  # 右、上
    ans = min(ans, f(Xu - Yu, Xu + Yu, Xl - Yl, Xl + Yl))  # 上、左
    ans = min(ans, f(Xr - Yr, Xr + Yr, Xd - Yd, Xd + Yd))  # 右、下
    ans = min(ans, f(Xd + Yd, Xd - Yd, Xl + Yl, Xl - Yl))  # 下、左
    print('SAFE' if ans == INF else 5 * ans)
resolve()

Measured memory_bytes: 45640
#include <algorithm>
#include <cmath>
#include <complex>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <tuple>
#include <vector>
using namespace std;
using ll = int64_t;
#define rep(i, j, n) for (int i = j; i < (int)n; ++i)

[[maybe_unused]] constexpr ll MOD = 1000000007;
[[maybe_unused]] constexpr int INF = 0x3f3f3f3f;
[[maybe_unused]] constexpr ll INFL = 0x3f3f3f3f3f3f3f3fLL;

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

  vector<pair<int, int>> b;
  rep(i, 0, n) {
    cin >> a;
    b.emplace_back(a, i);
  }
  sort(b.begin(), b.end());

  set<int> st;
  st.insert(-1);
  st.insert(n);

  ll ans = 0;
  rep(i, 0, n) {
    auto [val, pos] = b[i];
    st.insert(pos);
    auto itr = st.find(pos);
    ll left = *--itr;
    ll right = *++++itr;
    ans += val * (right - pos) * (pos - left);
  }
  cout << ans << '\n';

  return 0;
}

Measured memory_bytes: 14324
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

const ll mod = 1000000007;

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


Measured memory_bytes: 3912
#include <stdio.h>

int main() {
    int n;
    int vetor[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
    scanf("%d", &n);
    printf("%d", vetor[n-1]);
    

    return 0;
}


Measured memory_bytes: 128
N=int(input())

S=list(map(int,input().split()))

div1=0
div2=0
div4=0
lenS=len(S)

for i in range(N):
    if S[i]%4==0:
        div4+=1
    elif S[i]%2==0:
        div2+=1
    else:
        div1+=1

if lenS%2==0:

    if div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()
else:
    
    if (div4*2+1)>=lenS:
        print("Yes")
        exit()
    elif div4*2+div2>=lenS:
        print("Yes")
        exit()
    else:
        print("No")
        exit()




Measured memory_bytes: 14252
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> P;
typedef pair<int, double> Pid;
typedef pair<double, int> Pdi;
typedef pair<ll, int> Pl;
typedef pair<int, pair<int, int>> PP;
const double PI = 3.1415926535897932;   // acos(-1)
const double EPS = 1e-15;
const int INF = 1001001001;
const int mod = 1e+9 + 7;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define chadd(x, y) x = (x + y) % mod

int n, m;
struct edge{
    int a, b, c;
    edge() = default;
    edge(int a, int b, int c) : a(a), b(b), c(c) {}
};
vector<edge> es;
vector<vector<int>> dist(105, vector<int>(105, INF));

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

    cin >> n >> m;
    es.resize(m);
    for(int i = 0; i < m; ++i){
        int a, b, c;
        cin >> a >> b >> c;
        --a, --b;
        dist[a][b] = c;
        dist[b][a] = c;
        es[i] = edge(a, b, c);
    }
    for(int i = 0; i < n; ++i)  dist[i][i] = 0;
    
    for(int k = 0; k < n; ++k){
        for(int i = 0; i < n; ++i){
            for(int j = 0; j < n; ++j){
                chmin(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }

    int res = 0;
    for(int i = 0; i < m; ++i){
        bool flag = false;
        int a = es[i].a, b = es[i].b, cost = es[i].c;
        for(int j = 0; j < n; ++j){
            for(int k = 0; k < n; ++k){
                if(j == k)  continue;

                if(dist[j][k] == dist[j][a] + cost + dist[b][k]){
                    flag = true;
                    break;
                }
                if(dist[j][k] == dist[j][b] + cost + dist[a][k]){
                    flag = true;
                    break;
                }
            }
            if(flag)    break;
        }
        if(!flag)    ++res;
    }
    cout << res << endl;
}

Measured memory_bytes: 384
import sys
from collections import Counter
sys.setrecursionlimit(10**6)
n=int(input())
a=[int(i) for i in input().split()]
b=[]
for i in range(n):
 b.append(a[i])
 b.append(a[i]+1)
 b.append(a[i]-1)
c = Counter(b).most_common(1)
print(c[0][1])

Measured memory_bytes: 27360
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.math.*;

public class Main {

    private static Scanner sc;

    public static void main(final String[] args) {
        final Main instance = new Main();
        sc = instance.new Scanner();
        instance.solve();
    }

    private class Scanner {
        String[] s;
        int i;
        BufferedReader br;
        String regex = " ";

        public Scanner() {
            s = new String[0];
            i = 0;
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        @Override
        protected void finalize() throws Throwable {
            try {
                super.finalize();
            } finally {
                destruction();
            }
        }

        private void destruction() throws IOException {
            if (br != null)
                br.close();
        }

        public String next() throws IOException {
            if (i < s.length)
                return s[i++];
            String st = br.readLine();
            while (st == "")
                st = br.readLine();
            s = st.split(regex, 0);
            i = 0;
            return s[i++];
        }

        public int nextInt() throws NumberFormatException, IOException {
            return Integer.parseInt(next());
        }

        public Long nextLong() throws NumberFormatException, IOException {
            return Long.parseLong(next());
        }

        public Double nextDouble() throws NumberFormatException, IOException {
            return Double.parseDouble(next());
        }
    }

    private void solve() {
        try {
            long a;
            a = sc.nextLong();
            long aa = a;

            long[] insu = new long[1000];
            long[] insuCount = new long[1000];
            int idx = 0;
            for (long i = 2; i * i <= aa; i++) {
                while (a % i == 0) {
                    a /= i;
                    insu[idx] = i;
                    insuCount[idx]++;

                }
                if (insu[idx] == i)
                    idx++;
            }
            int count = 0;
            if (a != 1) {
                count++;
            }
            for (int i = 0; i < idx; i++) {
                for (int j = 1; j <= insuCount[i]; j++) {
                    insuCount[i] -= j;
                    count++;
                }
            }
            System.out.println(count);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}


Measured memory_bytes: 32720
#include <bits/stdc++.h>
using namespace std;
int jump(int *h,int i,int n,int *dp){
	if(i>=n-1)return dp[i] = 0;
	if(i == n-2)return dp[i] = abs(h[n-1] - h[i]);
	if(dp[i]!= -1)return dp[i];
	return dp[i] = min(abs(h[i+1] - h[i]) + jump(h,i+1,n,dp),abs(h[i+2] - h[i]) + jump(h,i+2,n,dp));
}
int main() {
	// your code goes here
	int n;
	cin>>n;
	int *h = new int[n];
	int *dp = new int[n];
	for(int i = 0;i<n;i++)
		cin>>h[i];
	for(int i = 0;i<n;i++)
		dp[i] = -1;
	cout<<jump(h,0,n,dp)<<endl;
	return 0;
}

Measured memory_bytes: 8276
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val s = readLine()!!.toCharArray()
    var result = 1
    var pre = s[0]
    for (i in 1 until s.size) {
        if (s[i] != pre) {
            result += 1
            pre = s[i]
        }
    }
    println(result)
}

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

namespace ConsoleApp1
{
    class Program
    {
  
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            int[] TA = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int T = TA[0];
            int A = TA[1];
            int[] H = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            //List<int> intlist = new List<int>();
            int ind = 0;
            double val = int.MaxValue;
            for(int i = 0; i < N; i++)
            {
                if(Math.Abs((A - (T - H[i] * 0.006))) < val)
                {
                    val = Math.Abs((A - (T - H[i] * 0.006)));
                    ind = i + 1;
                }
                //intlist.Add(Math.Abs((int)(A - (T - H[i] * 0.006))));
            }
            //Console.WriteLine(intlist.IndexOf(intlist.Min()) + 1);
            Console.WriteLine(ind);
        }
    }
}




//int n = int.Parse(Console.ReadLine());
//int[] N = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

Measured memory_bytes: 13340
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<tuple>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
signed main(){
  ll n,ch,idx,tch,tst,tet;
  vector<P> tv;
  vector<tuple<ll,ll,ll>> stc;
  cin >> n >> ch;
  ll s[n],t[n],c[n];
  for(int i=0;i<n;i++){
    cin >> s[i] >> t[i]>>c[i];
    stc.push_back(make_tuple(s[i],t[i],c[i]));
  }
  sort(stc.begin(),stc.end());
  for(int i=0;i<n;i++){
    idx = -1;
    tst = get<0>(stc[i]);
    tet = get<1>(stc[i]);
    tch = get<2>(stc[i]);
    for(int j=0;j<tv.size();j++){
      if(tch==tv[j].second){
        if(tst>=tv[j].first){
          idx = j;
          break;
        }
      }else{
        if(tst>tv[j].first){
          idx = j;
          break;
        }
      }
    }
    if(idx!=-1){
      tv[idx].first = tet;
      tv[idx].second = tch;
    }else{
      tv.push_back(P(tet,tch));
    }
  }
  cout << tv.size()<<endl;
}


Measured memory_bytes: 6516
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  double s = (double) W * H / 2.0;
  if (W % 2 == 1 || H % 2 == 1) {
    printf("%f %d", s, 0);
    return 0;
  }
  if ((H / 2 == x && W / 2 == y) || (H / 2 == y && W / 2 == x)) {
    printf("%f %d", s, 1);
  } else {
     printf("%f %d", s, 0);
  }

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>

using namespace std;

// (K - 1) * x + 1 >= N
// x >= (N - 1) / (K - 1)
int main()
{
  int N, K;
  cin >> N >> K;
  vector<int> v(N);
  for (int i = 0; i < N; ++i) {
    cin >> v[i];
  }
  int x = 1;
  while ((K - 1) * x + 1 < N) {
    x += 1;
  }
  cout << x << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <cstdlib>
#include <string>
#include <math.h>
#include <map>
#include <set>
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define INF 1145141919
typedef long long int ll;
using namespace std;

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

    int ans=0;

    FOR(i,1,k){
        if(i%2!=0){
            ans+=k/2-i/2;
        }else if(i%2==0 and k%2==0){
            ans+=k/2-i/2;
        }else{
            ans+=k/2-i/2+1;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 5e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
// 1~1e5までの値について素数:自身の値, 合成数:最小の素因数 の配列を返す
constexpr int PSIZE = 1e5 + 1;
struct eratosthenes_sieve{
    int Primes[PSIZE];
    bool isPrime[PSIZE];
    constexpr eratosthenes_sieve(): Primes(), isPrime(){
        iota(Primes, Primes + PSIZE, 0);
        fill(isPrime, isPrime + PSIZE, 0);
        for (int i = 2; i < PSIZE; i++){
            if (Primes[i] != i) continue;
            for (int s = i * 2; s < PSIZE; s += i){
                Primes[s] = i;
            }
            isPrime[i] = true;
        }
    }
    
    // 数値vの素因数の配列を取得
    vector<int> get_pfactor(int v){
        vector<int> res;
        int p = Primes[v];
        while(v > 1){
            while (Primes[v] == p) v /= Primes[v];
            res.emplace_back(p);
            p = Primes[v];
        }
        reverse(res.begin(), res.end());
        return res;
    }

    // 数値vの素因数分解を取得
    map<int, int> get_factrization(int v){
        map<int, int> mp;
        while(v>1){
            mp[Primes[v]]++;
            v /= Primes[v];
        }
        return mp;
    }
};
using ES = struct eratosthenes_sieve;

ll od[PSIZE];
int main() {
    init();
    ll Q;
    cin >> Q;
    ES es;
    repe(x,3,PSIZE){
        od[x] = es.isPrime[x] and es.isPrime[(x + 1) / 2];
        od[x] += od[x - 1];
    }

    rep(i,Q){
        ll l, r;
        cin >> l >> r;
        cout << od[r] - od[l - 1] << '\n';
    }
}

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

#define INF 1000000007
#define LINF 1000000000000000007

using namespace std;

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


int n, h, a[100000], b[100000];

int main(){
	cin >> n >> h;
	int A = 0;
	for(int i = 0; i < n; i++){
		cin >> a[i] >> b[i];
		A = max(A, a[i]);
	}
	
	int cnt = 0;
	sort(b,b+n);
	for(int i = n-1; i >= 0; i--){
		if(b[i] <= A) break;
		cnt++;
		h -= b[i];
		if(h <= 0) break;
	}
	if(h <= 0) cout << cnt << endl;
	else if(h%A == 0) cout << cnt + h/A << endl;
	else cout << cnt + h / A + 1 << endl;
	
	return 0;
}

Measured memory_bytes: 1024
#![allow(unused_imports)]
#![allow(unused_variables)]

use itertools::Itertools;
use proconio::marker::*;
use proconio::*;

#[fastout]
fn main() {
    input! {
        n: i64, k: i64,
    }
    // annotate for rust-analyzer
    let n: i64 = n;
    let k: i64 = k;

    let md = n % k;
    let ans = if (md - k).abs() < md {
        (md - k).abs()
    } else {
        md
    };

    println!("{}", ans);
}


Measured memory_bytes: 2204
#include <cstdio>
#include <cstring>
#define MAXN 30
#define MAXS 1050000

const int P=1000000007;

int n,m,q,maxs;
int f[2][MAXS];
int limit[MAXN][MAXN];
int trans[MAXN][MAXS];

void init(){
	for(int i=0;i<n;i++){
		int mask=(maxs-1)^((1<<i)-1);
		for(int j=0;j<maxs;j++){
			int j2=j&mask;
			trans[i][j]=(j^(j2&(-j2)))|(1<<i);
		}
	}
}

int main(){
	scanf("%d%d%d",&n,&m,&q);
	n--;
	maxs=1<<n;
	init();
	memset(limit,-1,sizeof limit);
	while(q--){
		int u,v,w;
		scanf("%d%d%d",&u,&v,&w);
		limit[u][v-1]=w;
	}
	int now=0;
	f[0][0]=1;
	for(int i=1;i<=m;i++){
		for(int j=0;j<n;j++){
			int l=1<<j;
			int nxt=now^1;
			memset(f[nxt],0,sizeof f[nxt]);
			if(limit[i][j]!=1){
				for(int k=0;k<maxs;k++)
					if(!(k&l))
						f[nxt][k]=f[now][k];
			}
			if(limit[i][j]!=0){
				for(int k=0;k<maxs;k++)
					f[nxt][trans[j][k]]=(f[nxt][trans[j][k]]+f[now][k])%P;
			}
			now=nxt;
		}
	}
	int ans=0;
	for(int i=0;i<maxs;i++)
		ans=(ans+f[now][i])%P;
	printf("%d\n",ans);
}


Measured memory_bytes: 86400
n, q = gets.strip.split.map(&:to_i)
s = gets.strip.split('').map(&:to_s)
data = q.times.map { gets.strip.split.map(&:to_i) }

c = []
c[0] = 0
# ACが揃うCの所に１をもつ配列を用意
(1..n-1).each do |i|
  if s.slice(i-1..i).join('') == 'AC'
    c[i] = 1
  else
    c[i] = 0
  end
end

# cの累積和の配列を生成
n_r = []
n_r[0] = 0
(2..n+1).each do |i|
  n_r[i-1] = n_r[i-2] + c[i-2]
end

(0..q-1).each do |i|
  # puts '--------'
  # puts "#{data[i][0]} to #{data[i][1]}"
  puts (n_r[data[i][1]] - n_r[data[i][0]]).to_s
end

Measured memory_bytes: 37356
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>

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

int main(){
  int n;
  cin >> n;
  vector<int> s(n);
  int ans = 0;
  rep(i,n){
    cin >> s[i];
  }
  rep1(i,n){
    if((s[i]<s[i+1])&&(s[i-1]<s[i]))ans++;
    else if((s[i]>s[i+1])&&(s[i-1]>s[i]))ans++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
import math 

N = int(input())
lst =[]
#N = a*bとする。　ここで、a<=bが成り立つ。
#√a　の全探索
length= math.ceil(math.sqrt(N))
for i in range(length):
    if(N %(i+1) == 0):
        lst.append(i+1)
a = max(lst)
b = round(N/a)
ans = a+b -2
print(ans)

Measured memory_bytes: 3064
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;

#define debug(...) fprintf(stderr, __VA_ARGS__)
#define int long long int
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
typedef pair<int, int> pii;
typedef long long ll;
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;

int board[12][12], mo[12];
signed main() {
    int N, M; cin >> N >> M;
    for(int i=0; i<M; i++) {
        int K; cin >> K;
        for(int j=0; j<K; j++) {
            int id; cin >> id; id--;
            board[i][id] = true;
        }
    }
    for(int i=0; i<M; i++) {
        cin >> mo[i];
    }

    int ans = 0;
    for(int bit=0; bit<(1<<N); bit++) {
        int sum = 0;
        for(int i=0; i<M; i++) {
            int cnt = 0;
            for(int j=0; j<N; j++) {
                if(!board[i][j]) continue;
                cnt += (bit >> j & 1);
            }
            cnt %= 2;
            if(mo[i] == cnt) sum++;
        }
        if(sum == M) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int a,b,c;
    cin>>a>>b>>c;
    if(a<b){
        if(b<c){
            cout<<"Yes"<<endl;
        }else{
            cout<<"No"<<endl;
        }
    }else{
        cout<<"No"<<endl;
    }
    return 0;
}


Measured memory_bytes: 3116
n=int(input())
s=input()
ans=0
for i in range(10):
    for j in range(10):
        for k in range(10):
            x=s.find(str(i))
            y=s.find(str(j),x+1)
            z=s.find(str(k),y+1)
            if(x!=-1 and y!=-1 and z!=-1):
                ans+=1
print(ans)

Measured memory_bytes: 3060
n = int(input())
A = list(map(int, input().split()))
INF = 10**18
dp_use = [-INF] * 5
dp_not_use = [-INF] * 5
dp_not_use[0] = 0
 
for a in A:
    tmp_use = [-INF] * 5
    tmp_not_use = [-INF] * 5
    for current_dif in range(-3,2):
        if current_dif-1 >= -3:
            tmp_use[current_dif] = dp_not_use[current_dif - 1] + a
        if current_dif+1 < 2:
            tmp_not_use[current_dif] = max(dp_use[current_dif+1], dp_not_use[current_dif+1])
    dp_use = tmp_use
    dp_not_use = tmp_not_use
dif = n//2 - (n-n//2)
print(max(dp_use[dif], dp_not_use[dif]))

Measured memory_bytes: 105432
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

int main() {
	int n;
	cin >> n;
	int cnt = 0;
	for (int i = 1; i <= n - 1; i++) {
		int m = n - i;
		for (int j = 1; j * j <= m; j++) {
			if (m % j == 0) {
				if (j * j == m) cnt++;
				else cnt += 2;
			}
		}
	}
	cout << cnt << endl;
}
	

Measured memory_bytes: 3668
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Diagnostics;

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;
    Func cin2;
    void calc()
    {
        cin = new Scanner();
        cin2 = new Func();
        double N=cin.nextDouble();
        double tax=1.08;
        int n=(int)(N/tax);
        string wrong=":(";
        bool ans=false;
        int a=0;
        for(int i=-1;i<2;i++)
        {
            if((int)((double)(n+i)*1.08)==(int)N){ans=true;a=n+i;}
        }
        if(ans)Console.WriteLine(a);
        else Console.WriteLine(wrong);
        
    }
}



class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Answer
{
    public void Int2DArrayAns(int[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
    public void Char2DArrayAns(char[,]x,char c)
    {
        for(int i=0;i<x.GetLength(0);i++)
        {
            for(int j=0;j<x.GetLength(1)-1;j++)
            {
                Console.Write(x[i,j]);
                Console.Write(c);
            }
            Console.WriteLine(x[i,x.GetLength(1)-1]);
        }
    }
}

class Func
{
    public long GCDLong(long a, long b)
    {
        while(a!=0)
        {
          long t=a;
          a=b%a;
          b= t;
        }
      
        return b;        
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
int n,m,a[84][84];
bool ans[84][84][25601];
int main(){
	cin>>n>>m;
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++) cin>>a[i][j];
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){
		int x;cin>>x;a[i][j]-=x;
	}
	ans[1][1][a[1][1]+12800]=ans[1][1][12800-a[1][1]]=1;
	for (int i=1;i<=n;i++) for (int j=1;j<=m;j++){
		if (i==1 && j==1) continue;
		for (int k=0;k<25601;k++){
			int r=k-a[i][j];
			if (r<0 || r>25600);
			else{
				if (i!=1) ans[i][j][k]|=ans[i-1][j][r];
				if (j!=1) ans[i][j][k]|=ans[i][j-1][r];
			}
			r=k+a[i][j];
			if (r<0 || r>25600);
			else{
				if (i!=1) ans[i][j][k]|=ans[i-1][j][r];
				if (j!=1) ans[i][j][k]|=ans[i][j-1][r];
			}
		}
	}
	int res=1e9;
	for (int i=0;i<25601;i++)
		if (ans[n][m][i])
			res=min(res,abs(i-12800));
	cout<<res;
}

Measured memory_bytes: 170240
// LightOj Pass : qavajxyq

#include <bits/stdc++.h>
#define deb(x)     cerr << (#x) << " : " << x << "\n"
#define ll long long int
#define ld long double
using namespace std;
const ll MOD = 1e9 + 7 ;
const ll INF = 1e18;

ll powmod(ll a, ll b, ll mod = MOD){
	ll res = 1ll;
	b %= (mod - 1ll), a %= mod;
	while(b){
		if(b%2 == 1)	res = (res * a) % mod;
		a = (a * a) % mod;
		b /= 2;
	}
	return res;
}
	int cnt[100010];
bool comp(int a, int b){
	return cnt[a] > cnt[b];
}

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

	int n;
	cin >> n;
	
	memset(cnt, 0, sizeof(cnt));
	int a[n];
	for(int i = 0; i < n; i++)	cin >> a[i];

	for(int i = 0; i < n; i += 2){
		cnt[a[i]]++;
	}

	int N = 100001;
	int arr[N+10], brr[N+10];
	for(int i = 0; i <= N; i++)	arr[i] = i, brr[i] = i;
	sort(arr, arr + N, comp);
	int cnt1[3] = {cnt[arr[0]], cnt[arr[1]], cnt[arr[2]]};

	memset(cnt, 0, sizeof(cnt));
	for(int i = 1; i < n; i+=2)	cnt[a[i]]++;

	sort(brr, brr + N, comp);
	int cnt2[3] = {cnt[brr[0]], cnt[brr[1]], cnt[arr[2]]};

	int ans = 1e9;
	int odd = (n + 1) / 2, eve = n / 2;
	for(int i = 0; i < 3; i++){
		for(int j = 0; j < 3; j++){
			if(arr[i] != brr[j]){
				// cout << cnt1[i] << " " << cnt2[j] << "\n";
				ans = min(ans, odd + eve - cnt1[i] - cnt2[j]);
			}
		}
	}

	cout << ans;
}

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

int main(){
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  
  int count = 0;
  for (int i=0; i<a+1; i++){
    for (int j=0; j<b+1; j++){
      for (int k=0; k<c+1; k++){
  		if (500*i+100*j+50*k==x){
          count++;
        }
      }
  	}
  }
  
  cout << count << endl;
  
}

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

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

using ll = long long;
using lb = long double;
using P = pair<ll,ll>;
using graph = vector<vector<ll>>;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll INF = 1LL<<60;
const ll mod = 1000000007LL;

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

template <typename T>
struct RMQ {//遅延評価
    const T INF = numeric_limits<T>::max();
    int n;
    vector<T> dat, lazy;
    RMQ(int n_) : n(), dat(n_ * 4, INF), lazy(n_ * 4, INF) {
        int x = 1;
        while (n_ > x) x *= 2;
        n = x;
    }
 
    /* lazy eval */
    void eval(int k) {
        if (lazy[k] == INF) return;  
        if (k < n - 1) {
            lazy[k * 2 + 1] = lazy[k];
            lazy[k * 2 + 2] = lazy[k];
        }
        dat[k] = lazy[k];
        lazy[k] = INF;
    }
 
    void update(int a, int b, T x, int k, int l, int r) {
        eval(k);
        if (a <= l && r <= b) {
            lazy[k] = x;
            eval(k);
        } else if (a < r && l < b) {                     // 一部区間が被る時
            update(a, b, x, k * 2 + 1, l, (l + r) / 2);  // 左の子
            update(a, b, x, k * 2 + 2, (l + r) / 2, r);  // 右の子
            dat[k] = min(dat[k * 2 + 1], dat[k * 2 + 2]);
        }
    }
    void update(int a, int b, T x) { update(a, b, x, 0, 0, n); }
 
    T query_sub(int a, int b, int k, int l, int r) {
        eval(k);
        if (r <= a || b <= l) { 
            return INF;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {  // 一部区間が被る時
            T vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            T vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return min(vl, vr);
        }
    }
    T query(int a, int b) { return query_sub(a, b, 0, 0, n); }
};

int main(){
    ll N,Q;
    cin>>N>>Q;
    ll ans = (N-2)*(N-2);
    ll left = N-1, under = N-1;
    RMQ<ll> tate(N),yoko(N);
  tate.update(0,N,N-1);
  yoko.update(0,N,N-1);
    rep(i,Q){
        ll q,x;
        cin>>q>>x;
        x--;
        if(q == 1){
            if(chmin(left,x)){
                tate.update(0,under,x);
            }
            ans -= yoko.query(x,x+1)-1;
        }
        if(q == 2){
            if(chmin(under,x)){
                yoko.update(0,left,x);
            }
            ans -= tate.query(x,x+1)-1;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;

int main() {
    ll S,x1,x2,y1,y2;
    cin>>S;
    x1=1e9;
    y2=min((S+1)/x1+1,1000000000ll); y1 = 1ll*x1*y2-S;
    cout<<x1<<" "<<y1<<" 1"<<" "<<y2<<" 0 0";
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <cassert>
#include <string>
#include <cstring>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <vector>
#include <tuple>

using namespace std;
mt19937_64 rng(58);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    vector<vector<int>> road(n, vector<int>());
    for (int i = 0; i < m; i++) {
        int a, b;
        cin >> a >> b;
        a--; b--;
        road[a].push_back(b);
        road[b].push_back(a);
    }

    int ans = 0;
    for (int i = 0; i < n; i++) {
        bool good = true;
        for (auto n : road[i]) {
            if (h[i] <= h[n]) {
                good = false;
                break;
            }
        }
        if (good) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 8424
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    int answer = 0;
    int[] array_a = new int[n];
    int[] array_b = new int[n];
    for(int i = 0; i < n; i++){
      array_a[i] = sc.nextInt();
      array_b[i] = sc.nextInt();
    }
    Arrays.sort(array_a);
    Arrays.sort(array_b);
    if(n % 2 == 1){
      answer = array_b[(n - 1) / 2] - array_a[(n - 1) / 2] + 1;
    } else {
      answer = (array_b[(n / 2)] + array_b[(n / 2) - 1]) - (array_a[(n / 2)] + array_a[(n / 2) - 1]) + 1;
    }
    System.out.println(answer);
  }
}

Measured memory_bytes: 61932
#include<iostream>
#include<string>
#include<math.h>
#include<vector>

using namespace std;
int main() {
	string str;
	int count=0;

	cin >> str;
	for (int i = 0; i < 3; i++)
	{
		if (str[i]=='1')
		{
			count++;
		}

	}

	cout << count << endl;

	return 0;

}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define mod 1000000007
#define all(c) begin(c),end(c)
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }
using ll = long long;
using vi = vector<int>; using vs = vector<string>;
int dd[] = { 0, 1, 0, -1, 0 }; //→↓←↑

void solve()
{
	int A, B, X;
	cin >> A >> B >> X;
	if (X <= A + B && A <= X)
	{
		cout << "YES" << endl;
	}
	else
	{
		cout << "NO" << endl;
	}
}

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

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Main main = new Main();
        main.solve();
    }
    public void solve() {
        Scanner scan = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
        int N = scan.nextInt();
        HashMap<String, Integer> map = new HashMap<>();
        String[] list = new String[N];
        for (int i = 0; i < N; i++) {
            String s = scan.next();
            int t = scan.nextInt();
            list[i] = s;
            map.put(s, t);
        }
        String X = scan.next();
        int turn = 0;
        for (int i = 0; i < N; i++) {
            if (list[i].equals(X)) {
                turn = i;
                break;
            }
        }
        long answer = 0;
        for (int i = turn+1; i < N; i++) {
            answer += map.get(list[i]);
        }
        System.out.println(answer);
    }
}


Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
using namespace std;
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; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; } 
int main(){
  vector<int>dp(1000000,INF);
  int n,k;
  cin >> n >> k;
  vector<int>a(n);
  rep0(i,n)cin >> a[i];
  dp[0] = 0;
  dp[1] = abs(a[0] - a[1]);
  REP(i,2,n){
    rep1(j,k+1){
      if(j > i)continue;
      dp[i] = min(dp[i],(dp[i - j] + abs(a[i - j] - a[i])));
    }
  }
  cout << dp[n-1] << endl;
  return 0;
}

Measured memory_bytes: 4608
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < int(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30)-1;
const long long LINF = (1LL<<62)-1;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

class UnionFind {
  vector<int> par, sz;
public:
  UnionFind(int n) {
    par.resize(n);
    for (int i = 0; i < n; i++)
      par[i] = i;
    sz.resize(n, 1);
  }
  int root(int x) {
    if (par[x] == x)
      return x;
    return par[x] = root(par[x]);
  }
  bool same(int x, int y) {
    return root(x) == root(y);
  }
  int size(int x) {
    return sz[root(x)];
  }
  bool unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y)
      return false;
    if (sz[x] >= sz[y]) {
      sz[x] += sz[y];
      par[y] = x;
    } else {
      sz[y] += sz[x];
      par[x] = y;
    }
    return true;
  }
};

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<vector<bool>> graph(n, vector<bool>(n, true));
  rep(i, n) graph[i][i] = false;
  rep(i, m) {
    int a, b;
    cin >> a >> b;
    --a, --b;
    graph[a][b] = graph[b][a] = false;
  }
  UnionFind uf(n*2);
  rep(i, n) rep(j, i) {
    if (graph[j][i]) {
      uf.unite(j, i+n);
      uf.unite(j+n, i);
    }
  }
  rep(i, n) {
    if (uf.same(i, i+n)) {
      cout << -1 << endl;
      return 0;
    }
  }
  vector<pair<int, int>> bip;
  vector<int> node(n, -1);
  rep(i, n) {
    if (node[i] >= 0)
      continue;
    int even = 1, odd = 0;
    queue<int> que;
    que.push(i);
    node[i] = 0;
    while (!que.empty()) {
      int now = que.front();
      que.pop();
      rep(next, n) {
        if (graph[now][next] && node[next] < 0) {
          node[next] = node[now]+1;
          que.push(next);
          if (node[next]%2)
            odd++;
          else
            even++;
        }
      }
    }
    bip.emplace_back(even, odd);
  }
  vector<vector<bool>> dp(bip.size()+1, vector<bool>(n+1, false));
  dp[0][0] = true;
  for (int i = 1; i <= bip.size(); i++) {
    rep(j, n+1) {
      if (j-bip[i-1].first >= 0 && dp[i-1][j-bip[i-1].first])
        dp[i][j] = true;
      if (j-bip[i-1].second >= 0 && dp[i-1][j-bip[i-1].second])
        dp[i][j] = true;
    }
  }
  int ans = INF;
  rep(i, n+1) {
    if (dp[bip.size()][i])
      chmin(ans, i*(i-1)/2+(n-i)*(n-i-1)/2);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3760