akhauriyash/Code-Regression huggingface dataset:
module ArrayL = ArrayLabels
module ListL = ListLabels

let dbg = Printf.printf "[debug]%s"

let max_num = 100_000_000_000

let id = fun x -> x
let tuple2 x y = (x,y)
let tuple3 x y z = (x,y,z)
let succ x = x + 1

let pred x = x - 1

let (++) n m =
  let rec aux i =
    if i = m then [m]
    else i :: aux (i+1) in
  if n > m then [] else aux n

let (++^) n m = n ++ (m-1)

let scan fmt f = Scanf.sscanf (read_line ()) fmt f

let scan_lines n fmt f =
  List.map (fun _ -> scan fmt f) (0++^n)

let scan_matrix n m e conv =
  let arr = Array.make_matrix n m e in
  Array.iteri (fun i line ->
      let s = Scanf.Scanning.from_string @@ read_line () in
      Array.iteri (fun j _ ->
          arr.(i).(j) <- Scanf.bscanf s " %s" conv;
        ) line) arr; arr

let between n x m = n <= x && x < m

let string_to_list s =
  List.map (String.get s) (0 ++^ String.length s)

let (v, e) = scan "%d %d" tuple2

let dp =
  let mat = Array.make_matrix v v max_num in
  let lines = scan_lines e "%d %d %d" tuple3 in
  ListL.iter (0++^v) ~f:(fun i ->
      mat.(i).(i) <- 0);
  ListL.iter lines ~f:(fun (s,t,d) ->
      mat.(s).(t) <- d);
  mat

let () =
  ListL.iter (0++^v) ~f:(fun k ->
      ListL.iter (0++^v) ~f:(fun i->
          ListL.iter (0++^v) ~f:(fun j->
              if dp.(i).(k) <> max_num && dp.(k).(j) <> max_num then
                dp.(i).(j) <- min dp.(i).(j) (dp.(i).(k) + dp.(k).(j))
            )
        )
    );
  if List.exists ((>) 0) @@ ListL.map (0 ++^ v) ~f:(fun i-> dp.(i).(i)) then
    Printf.printf "NEGATIVE CYCLE\n"
  else
    ListL.iter (0 ++^ v) ~f:(fun i ->
        ListL.iter (0 ++^ v) ~f:(fun j ->
            if j <> 0 then Printf.printf " ";
            Printf.printf "%s" @@
            if dp.(i).(j) <> max_num then Printf.sprintf "%d" dp.(i).(j)
            else "INF"
          );
        Printf.printf "\n")



Measured memory_bytes: 5632
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <fstream>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <stack>
#include <vector>
#include <set>
#include <tuple>
#include <utility>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
const int INF = 1000000000;
const int MOD = 1000000007;
int main(){
	ll a,b,x;
	cin >> a >> b >> x;
	if(a == 0){
		cout << b / x + 1 << endl;
	}
	else{
		cout << b / x - (a-1) / x << endl;
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int p, a[10];
int main(){
	for(int i=1; i<=5; i++){
		cin>> a[i];
		if(a[i] == 0){
			p = i;
			break;
		}
	}
	cout<< p;
	return 0;
}

Measured memory_bytes: 3640
#include <stdio.h>
#include <string.h>
int main()
{    
    int a, b; 
    char x[11], y[11], s[11];
    scanf("%s %s", &x, &y); 
    scanf("%d %d", &a, &b);
    scanf("%s", &s);
    if(!strcmp(s, x)) printf("%d %d", a-1,b);
    else printf("%d %d", a,b-1);

    return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
const int maxn = 1010, mod = 1e9 + 7;
int n;
bool isprime[maxn];
vector<int> v;
int main() {
	cin>>n;
	for(int i = 2; i <= n; i++) {
		if(!isprime[i]) {
			v.push_back(i);
			for(int j = i + i; j <= n; j += i) {
				isprime[j] = true; 
			}
		}
	}
	long long ans = 1ll;
	for(int i = 0; i < v.size(); i++) {
		int nn = n;
		long long cnt = 0ll;
		while(nn) {
			nn /= v[i];
			cnt += (long long)nn;
		}
		cnt++;
		ans = (ans * cnt) % (long long)mod;
	}
	cout<<ans<<endl;
	return 0;
}
/*
3
Output:4

6
Output:30

1000
Output:972926972
*/

Measured memory_bytes: 256
def main():
    n=int(input())
    h=list(map(int,input().split()))
    dp=[None]*n

    dp[0]=0
    dp[1]=abs(h[1]-h[0])
    for i in range(2,n):
        temp2=dp[i-2]+abs(h[i]-h[i-2])
        temp1=dp[i-1]+abs(h[i]-h[i-1])
        dp[i]=min(temp1,temp2)
    print(dp[n-1])

if __name__=='__main__':
    main()


Measured memory_bytes: 52208
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, int>;
using vpii = vector<pair<int, int>>;
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define rep1(i, n) for (int i = 1; i < (int)n; i++)
const ll mod = 1e9 + 7;
const ll inf = 1e12;
const double pi = 3.141592;
const int di[4] = {1, 0, -1, 0};
const int dj[4] = {0, 1, 0, -1};

struct UnionFind
{
    vector<int> par;

    UnionFind(int N) : par(N)
    {
        for (int i = 0; i < N; i++)
        {
            par[i] = i;
        }
    }

    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }

    void unite(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        if (rx == ry)
            return;
        par[rx] = ry;
    }

    bool same(int x, int y)
    {
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }
};

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int n, m;
    cin >> n >> m;
    UnionFind u(n+1);
    int cnt = 0;
    rep(i, m)
    {
        int x, y, z;
        cin >> x >> y >> z;
        if(u.same(x,y))
            continue;
        u.unite(x, y);
        ++cnt;
    }
    cout << n - cnt << "\n";
    return 0;
}

Measured memory_bytes: 640
#include <stdio.h>

int main(void){
  char one[4];
  char two[4];
  char three[4];
  char ans[4] = {'\0'};
  scanf("%3s", one);
  scanf("%3s", two);
  scanf("%3s", three);
  ans[0] = one[0];
  ans[1] = two[1];
  ans[2] = three[2];
  printf("%s\n", ans);
  return 0;
}

Measured memory_bytes: 128
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
public static void main(String[] args) throws IOException {

BufferedReader br =new BufferedReader (new InputStreamReader (System.in));

String line = br.readLine( );
String[] list = line.split(" ");
int a = Integer.parseInt(list[0]);
int b = Integer.parseInt(list[1]);

int x=a+b;
if(x>=24){
x=x-24;
}
System. out. println(x);
}}

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

int main() {
  int N, T;
  cin >> N >> T;
  vector<pair<int, int>> ct(N);
  int c, t;
  for (int i = 0; i < N; i++) {
    cin >> c >> t;
    ct[i] = make_pair(c, t);
  }


  int min_cost = 1<<19;
  bool flag = false;
  for (int i = 0; i < N; i++) {
    if (ct[i].second <= T) {
      min_cost = min(min_cost, ct[i].first);
      flag = true;
    }
  }
  if (flag) cout << min_cost << endl;
  else cout << "TLE" << endl;
  return 0;
}

Measured memory_bytes: 256
from collections import defaultdict, deque

v, n = map(int, input().split())
n += v -1
es = [[int(x) for x in input().split()] for _ in range(n)]

outs = defaultdict(list)
ins = defaultdict(int)
for v1, v2 in es:
    outs[v1].append(v2)
    ins[v2] += 1

q = deque(v1 for v1 in range(v) if ins[v1] == 0)
res = []
f = [0]*(v+1)
while q:
    v1 = q.popleft()
    res.append(v1)
    for v2 in outs[v1]:
        ins[v2] -= 1
        if ins[v2] == 0:
            q.append(v2)
            f[v2] = v1
for t in f[1:]:
    print(t)

Measured memory_bytes: 49324
<?php
// C
fscanf(STDIN, '%d %d %d', $n, $m, $q);
for ($i  = 0; $i < $q; $i++) fscanf(STDIN, '%d %d %d %d', $a[], $b[], $c[], $d[]);
func();
echo max($scores);

function func($a = [])
{
    global $n, $m, $scores;

    if (count($a) === $n) {
        $scores[] = calcScore($a);
        return;
    }

    $s = count($a) > 0 ? $a[count($a) - 1] : 1;
    for ($i = $s; $i <= $m; $i++) {
        func(array_merge($a, [$i]));
    }
}

function calcScore($arr)
{
    global $q, $a, $b, $c, $d;
    $sum = 0;
    for ($i = 0; $i < $q; $i++) {
        $sum += $arr[$b[$i] - 1] - $arr[$a[$i] - 1] === $c[$i] ? $d[$i] : 0;
    }
    return $sum;
}

Measured memory_bytes: 21176
#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>

int main(void) {
    int N;
    long long L[100];
    int num = 0;

    scanf("%d", &N);
    for(int i = 0; i < N; i++) {
        scanf("%lld", &L[i]);
    }

    for(int i = 0; i < N; i++) {
        for(int j = i + 1; j < N; j++) {
            for(int k = j + 1; k < N; k++) {
                if( (L[i] != L[j]) && (L[j] != L[k]) && (L[k] != L[i]) ) {
                    int max = L[i];
                    if(max < L[j]) {
                        max = L[j];
                    }
                    if(max < L[k]) {
                        max = L[k];
                    }

                    if( (L[i] + L[j] + L[k] - max) > max ) {
                        num++;
                    }
                }
            }
        }
    }

    printf("%d\n", num);

    return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
#include <algorithm>
#include <math.h>
using namespace std;
int main()
{

    int a,b,c,x,y,sum=0;
    scanf("%d%d%d%d%d",&a,&b,&c,&x,&y);
    if(a+b<2*c)
    {
        printf("%d\n",a*x+b*y);
    }
    else
    {
        if(x<=y)
        {
            sum=2*x*c;
            if(2*c<b)
                sum=sum+2*abs(y-x)*c;
            else
                sum=sum+(y-x)*b;
        }
        else
        {
            sum=2*y*c;
            if(2*abs(y-x)*c<(x-y)*a)
                sum=sum+2*abs(x-y)*c;
            else
                sum=sum+(x-y)*a;
        }

     printf("%d",sum);
    }

    return 0;
}


Measured memory_bytes: 256
<?php
  $n = trim(fgets(STDIN));
  $p_li = explode(" ",trim(fgets(STDIN)));
  $q_li = explode(" ",trim(fgets(STDIN)));
  $p = ''; $q = '';
  for($i=0; $i<$n; $i++){
      $p .= $p_li[$i];
      $q .= $q_li[$i];
  }
  
  function dfs($input, $kumi=''){
      $pad = [];
      if(count($input)==0){
          return [$kumi];
      }
      foreach($input as $key => $data){
          $k = $kumi;
          $k = $kumi.($data);
          $_input = $input;
          unset($_input[$key]);
          $pad =  array_merge($pad,dfs($_input, $k));
      }
      
      return $pad;
  }
  $pattern = dfs(range(1,$n),"",[]);
  rsort($pattern);
  for($i=0; $i<count($pattern); $i++){
      if($pattern[$i] == $p){
          $pp = $i;
      }
      if($pattern[$i] == $q){
          $qq = $i;
      }
  }
  echo abs($pp-$qq);
  
  

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n,k;
	cin>>n>>k;

	k = ((n-1)/k + 1)*k;

	cout<<min(n%k,abs(n-k)%k)<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
using namespace std;
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N; cin >> N;
  LL sum = 0;
  LL v = 1e18;
  bool same = true;
  for (int i = 0; i < N; ++i) {
    LL A, B; cin >> A >> B;
    sum += A;
    if (A != B) same = false;
    if (A > B) v = min(v, B);
  }
  if (same) cout << 0 << endl;
  else cout << sum - v << endl;
}


Measured memory_bytes: 3604
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <inttypes.h>

int main(void){
	int t,x;
	float ans;

	scanf("%d %d",&t,&x);
	ans=(float)t/x;
	printf("%f",ans);

	return 0;
}


Measured memory_bytes: 128
import java.util.Scanner;

/**
 * Created by enpingkuang on 2020/9/13 8:06 下午
 */
public class Main {
    private static long MOD = 1000000007;
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        if(n == 1){
            System.out.println(0);
            return;
        }
        long ans = 2;
        long a = 17;
        long b = 17;
        long c = 64;
        for(int i = 3;i<=n;i++){
            ans = (10*ans + a + b)%MOD;
            a = (9*a + c)%MOD;
            b = (9*b + c)%MOD;
            c = (8*c)%MOD;
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 35796
import sys
sys.setrecursionlimit(10**6) #再帰関数の上限
import math
#import queue
from copy import copy, deepcopy
from operator import itemgetter

import bisect#2分探索
#bisect_left(l,x), bisect(l,x)
from collections import deque 
#deque(l), pop(), append(x), popleft(), appendleft(x)
##listでqueの代用をするとO(N)の計算量がかかってしまうので注意
#dequeを使うときはpython3を使う、pypyはダメ
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#q=heapq.heapify(l),heappush(q,a),heappop(q)

def input(): return sys.stdin.readline()[:-1]
def printl(li): print(*li, sep="\n")
def argsort(s): return sorted(range(len(s)), key=lambda k: s[k])

#mod = 10**9+7

#N = int(input())
N, P = map(int, input().split())
S=input()
#L = [int(input()) for i in range(N)]
#A = list(map(int, input().split()))
#S = [inputl() for i in range(H)]
#q = queue.Queue() #q.put(i) #q.get() 
#q = queue.LifoQueue() #q.put(i) #q.get() 

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b=copy.deepcopy(a)  #2次元配列はこうコピーする
#w.sort(key=itemgetter(1),reversed=True)  #二個目の要素で降順並び替え

#素数リスト
# n = 100
# primes = set(range(2, n+1))
# for i in range(2, int(n**0.5+1)):
#     primes.difference_update(range(i*2, n+1, i))
# primes=list(primes)

#bisect.bisect_left(a, 4)#aはソート済みである必要あり。aの中から4未満の位置を返す。rightだと以下
#bisect.insort_left(a, 4)#挿入
if P!=2 and P!=5:
    pc=[0]*P
    pc[0]=1
    count=0
    ans=0
    for i in range(1,N+1):
        count+=int(S[N-i])*pow(10,(i-1),P)
        count%=P
        ans+=pc[count]
        pc[count]+=1

    print(ans)
else:
    ans=0
    for i in range(1,N+1):
        if int(S[N-i])%P==0:
            ans+=N-i+1
    print(ans)


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

#include <cstdlib>  // abs() for integer 絶対値求めやつ

#include <cmath>    // abs() for float, and fabs()

#include <algorithm>
#include <vector>
#include <string>
#define rep(i,n) for(int i = 0; i< (n);i++)

#define SORT(a) sort((a).begin(),(a).end());

#define che(a,string) cout<<string<<":"<<(a)<<endl;

#define ch(a,string) cout<<string<<":"<<(a)<<" ";

using namespace std;

typedef pair<int,int> p;

int main(){
	int n; cin>>n;
	int m = n;
	vector<int> A(10,0);//kakui wo irete iku
  int i = 0;
  while(n>0){
	  A[i]=n%10;
	  n/=10;
	  i++;
	 // ch(A[i],"A[i]");
	  //ch(i,'i');
	}
	int sum = 0;
	rep(k,10){
		sum+=A[k];
		//che(sum,"sum");

		}
	  if(m%sum==0){
		  cout<<"Yes"<<endl;
		}
		else {
			cout<<"No"<<endl;
		  }
}

Measured memory_bytes: 256
import java.util.*

fun main(args: Array<String>) {
	val scan = Scanner(System.`in`)
	val a = scan.nextInt()
	val b = scan.nextInt()
	println(if (a > b) {
		"a > b"
	} else if (a < b) {
		"a < b"
	} else if (a == b) {
		"a == b"
	} else {})
}


Measured memory_bytes: 25540
N = int(input())
A = list(map(int, input().split()))

B = [(1000, 0)]

for (i, a) in enumerate(A):
    C = []
    for b1, b2 in B:
        C.append((b1, b2))
        if b1 >= a: C.append((b1 % a, b2 + b1 // a))
        if b2: C.append((b1 + b2 * a, 0))
    C.sort(reverse = True)

    max_rest_A = 0
    if i < N - 1: max_rest_A = max(A[i + 1:])
    
    price = 0
    temp = (0 , 0)
    for c1, c2 in C:
        if price < c1 + c2 * max_rest_A:
            price = c1 + c2 * max_rest_A
            temp = (c1, c2)
    B = [C[0], temp]

answer = 1000
for b1, b2 in B:
    if answer < b1:
        answer = b1
print(answer)

Measured memory_bytes: 62984
import std.algorithm;
import std.range;
import std.stdio;
import std.math;
import std.array;
import std.string;
import std.conv;
 
/// 数列の読み込み
auto readNums(T = int)() {
	return readln().chomp.split.map!(to!T).array;
}
 
/// 数の読み込み
auto readNum(T = int)() {
	return readNums!T.front;
}
 
/// 指定行数読み込み
auto readRows(size_t rows) {
	return generate(() => readln().chomp).take(rows).array;
}
 
/// 範囲の計算
auto range(T)(T a, T b, T c, T d) {
    auto start = max(a, c);
    auto end = max(b, d);
    return (start < end) ? tuple(start, end) : tuple(cast(T) 0, cast(T) 0);
}
 
auto maxElement(R)(R r) {
    return r.reduce!((a, b) => max(a, b));
}
 
auto minElement(R)(R r) {
    return r.reduce!((a, b) => min(a, b));
}
 
void main() {
	const nums = readNums!(long);
	writefln("%s", (nums[1] == 100 ? 101 : nums[1]) * 100 ^^ nums[0]);
}

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

using namespace std;

int main(){
    int n;
    cin >> n;
    for(int i = 0;i <n;i++){
        int x; cin >> x;
        if( x%2 == 0){
            if(x%3 > 0 && x%5 >0){
                puts("DENIED");
                return 0;
            }
        }
    }
    puts("APPROVED");
}

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

signed main(){

  int n,T; cin >> n >> T;
  int ans = 1e9;
  for(int i = 0; i < n; i++){
    int c,t; cin >> c >> t;
    if(t <= T) ans = min(ans,c);
  }
  if(ans == 1e9) cout << "TLE" << endl;
  else cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

constexpr double EPS = 1e-7;
constexpr int INF = 1e9;
#define PI (acos(-1))

constexpr int MOD = 1e9 + 7;

template <typename T>
ll slice_sum(const std::vector<T> &v, size_t from, size_t to) {
	return std::accumulate(std::next(v.cbegin(), from), std::next(v.cbegin(), to), T{});
}

int main(int argc, char const *argv[]) {
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);

	int N, K;
	cin >> N >> K;
	vector<ll> H(N);
	for (int i = 0; i < N; i++) {
		cin >> H[i];
	}
	if (N <= K) {
		cout << 0 << endl;
		return 0;
	}
	sort(H.begin(), H.end());

	ll ans = slice_sum(H, 0, N - K);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
 
int main(){
  string a, b;
  cin >> a >> b;
  if(a.at(0)==b.at(2)&&a.at(1)==b.at(1)&&a.at(2)==b.at(0)){cout<< "YES" <<endl;}
  //else if(a==c){cout<< b <<endl;}
  else{cout << "NO" << endl;}
 
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<stack>
#include<vector>
#include<list>
#include<math.h>
using namespace std;

#define ll long long
#define vecint vector<int>
#define listint list<int>

#define REP(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) REP(i,0,n)
#define print(a) cout << a << endl


int main(){
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  if(A*B>=C*D){
    print(A*B);
  }else{
    print(C*D);
  }
  return 0;
}


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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> P;
#define INF 10000000000000
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i, n) for(ll i = 1; i < (ll)(n); i++)
#define repN_1(i, n) for(ll i = 0; i < (ll)(n - 1); i++)
#define repM(i, n) for(ll i = (ll)(n - 1); i >= 0; i--)
#define repM1(i, n) for(ll i = (ll)(n - 1); i > 0; 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 main()
{
	cout << fixed << setprecision(18);

	ll n, m;
	cin >> n;
	m = 0;

	vector<ll> a(n + 1), b(n + 1, 0);

	rep1(i, n +1)
		cin >> a[i];

	ll count = 0;

	repM1(i, n + 1) {
		ll j = 2;
		ll c = 0;
		while (i * j <= n) {
			c += b[i * j];
			j++;
		}

		if (c % 2 != a[i]) {
			b[i] = 1;
			count++;
		}
	}

	cout << count << endl;
	rep1(i, n + 1) {
		if (b[i] == 1)
			cout << i << " ";
	}
	cout << endl;

	return 0;
}

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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

int n,x,a[101];

void nhap()
{
    scanf("%d %d",&x,&n);
    for (int i=1;i<=n;++i)
    {
        scanf("%d",&a[i]);
    }
}

void process()
{
    int vt=0;
    while (1)
    {
        bool ok=0;
        for (int i=1;i<=n;++i)
        {
            if (x-vt==a[i])
            {
                ok=1;
                break;
            }
        }
        if (!ok)
        {
            cout<<x-vt;
            return;
        }
        ok=0;
        for (int i=1;i<=n;++i)
        {
            if (x+vt==a[i])
            {
                ok=1;
                break;
            }
        }
        if (!ok)
        {
            cout<<x+vt;
            return;
        }
        vt++;
    }
}

int main()
{
    nhap();
    process();
    return 0;
}


Measured memory_bytes: 3740
#include<iostream>
#include<cmath>
#include<string>
using namespace std;
    

int main(void){
    int  a,b;
    int c=0,s=0;

    cin>>a>>b;
    //c=b/(a-1);
    while(s+1<b){
        s+=(a-1);
        c++;
    }
    cout<<c;
    return 0;
}

Measured memory_bytes: 256
package main

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

const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		sc.Split(bufio.ScanWords)
		return sc
	}()
)

func main() {
	N := getInt()
	P := make([]int, N)
	Q := make([]int, N)

	for i := 0; i < N; i++ {
		P[i] = getInt()
	}

	for i := 0; i < N; i++ {
		Q[i] = getInt()
	}

	pStock := make(map[int]interface{})
	for i := 0; i < N; i++ {
		pStock[i+1] = true
	}

	pNum := 0
	for i := 0; i < N; i++ {
		delete(pStock, P[i])
		cnt := 0
		for k := range pStock {
			if k < P[i] {
				cnt++
			}
		}
		pNum += calc(N - (i+1)) * cnt
	}

	qStock := make(map[int]interface{})
	for i := 0; i < N; i++ {
		qStock[i+1] = true
	}

	qNum := 0
	for i := 0; i < N; i++ {
		delete(qStock, Q[i])
		cnt := 0
		for k := range qStock {
			if k < Q[i] {
				cnt++
			}
		}
		qNum += calc(N - (i+1)) * cnt
	}

	fmt.Println(abs(pNum - qNum))
}

func calc(n int) int {
	value := 1
	for i := 1; i <= n; i++ {
		value *= i
	}
	return value
}

type Graph struct {
	n     int
	edges [][]int
}

func NewGraph(n int) *Graph {
	g := &Graph{
		n:     n,
		edges: make([][]int, n),
	}
	return g
}

func (g *Graph) AddEdge(u, v int) {
	g.edges[v] = append(g.edges[v], u)
	g.edges[u] = append(g.edges[u], v)
}

func dfs(c int, edges [][]int, visited map[int]struct{}) {
	visited[c] = struct{}{}

	for _, v := range edges[c] {
		_, flag := visited[v]
		if flag {
			continue
		}
		dfs(v, edges, visited)
	}
}

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func powMod(n, p int) int {
	if p == 0 {
		return 1
	} else if p%2 == 0 {
		t := powMod(n, p/2)
		return calcMod(t * t)
	} else {
		return n * powMod(n, p-1)
	}
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray)-1])
}

func calcMod(x int) int {
	return x % mod
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}


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

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

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n + 5), ans(n + 5);
  for (int i = 2; i <= n; ++i) cin >> a[i], ans[a[i]]++;
  for (int i = 1; i <= n; ++i) cout << ans[i] << endl;
  return 0;
}


Measured memory_bytes: 6340
#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
#define P pair<int,int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define endl '\n'
#define int long long

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

    if(n % 2 == 0) cout << n / 2 << endl;
    else cout << n / 2 + 1 << endl;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fastcin {\
    cin.tie(0);\
    ios::sync_with_stdio(false);\
}
#define rep(i, a, b) for(int i = a; i < b; i++)
#define rrep(i, a, b) for(int i = a; i >= b; i--)
#define fore(i, a) for(auto &i:a)
#define print(x) cout << x << "\n"
#define SORT(a, n) sort(a, a+n);
#define REVERSE(a,n) reverse(a,a+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VREVERSE(v) reverse(v.begin(), v.end());
#define MOD 1000000007
#define yes "YES"
#define no "NO"
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;

int main() {
    fastcin;
    string s;
    cin >> s;
    int ans = 0;
    rep(i, 0, 4) {
        if(s[i]=='+') {
            ans++;
        } else ans--;
    }
    print(ans);
    return 0;
}

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

int main() {
  ll n, m;
  cin >> n >> m;
  vector <ll> v(n);
  ll res = 0;
  rep(i, n) {
    cin >> v.at(i);
    m -= v.at(i);
    res++;
  }
  sort(v.begin(), v.end());
  while (m >= v.at(0)) {
    res++;
    m -= v.at(0);
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]

fn main() {
    // let s = std::io::stdin();
    // let mut sc = Scanner { stdin: s.lock() };
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let D:usize = sc.read();
    let C:Vec<i64> = sc.vec(26);
    let S: Vec<Vec<i64>> = (0..D).map(|_| sc.vec(26)).collect();
    let mut past: Vec<i64> = (0..26).map(|_| -1).collect();
    let mut ANS:Vec<usize> = Vec::new();
    let mut point:i64 = 0;
    for i in 0..D{
        let mut m:i64 = -1000000000;
        let mut ind:usize = 0;
        for j in 0..26{
            let mut temp_point:i64 = point+S[i][j];
            for k in 0..26{
                if k == j{
                    continue
                }
                temp_point -= C[k]*((i as i64)-past[k]);
            }
            if m < temp_point{
                ind = j;
                m = temp_point;
            }
        }
        ANS.push(ind);
        point = m;
        past[ind] = i as i64;
    }
    let deadline = D;
    for i in 0..deadline{
        let oldest:usize = ANS[i];
        for j in 0..26{
            if j == oldest {
                continue
            }
            let old = ANS[i];
            ANS[i] = j;
            let temp_point = check_point(D,&S,&ANS,&C);
            if point < temp_point{
                // println!("!!!!!! {} < {}",point, temp_point);
                point = temp_point;
            }else{
                ANS[i] = old;
            }
        }
    }
    
    for i in 0..D{
        println!("{}", ANS[i]+1);
    }
    // for i in 0..D{
    //     ans += S[i][T[i]-1];
    //     past[T[i]-1] = i as i64;
    //     for j in 0..26{
    //         ans -= C[j]*((i as i64)-past[j]);
    //     }
    //     println!("{}", ans);
    // }
}

fn check_point(D:usize, S:&Vec<Vec<i64>>, T:&Vec<usize>,C:&Vec<i64>) -> i64{
    let mut ans:i64 = 0;
    let mut past: Vec<i64> = (0..26).map(|_| -1).collect();
    for i in 0..D{
        ans += S[i][T[i]];
        past[T[i]] = i as i64;
        for j in 0..26{
            ans -= C[j]*((i as i64)-past[j]);
        }
    }
    ans
}

struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);


impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> Self {
        Self(r, std::io::BufWriter::new(w))
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
        .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
}





Measured memory_bytes: 2292
A,B=map(int,input().split())

ansA=A*(100/8)#この数か、この数よりでかI数となる
if ansA==int(ansA):#小数点以下０なら
    ansA=int(ansA)
else:
    ansA=int(ansA)+1


ansB=B*10#この数か、この数よりでかい数となる

if ansA>=ansB:
    ans=ansA
else:
    ans=ansB

if int(ans*(8/100))==A and int(ans*(10/100))==B:
    print(ans)
else:
    print(-1)

Measured memory_bytes: 3064
#include<cstdio>
#define re register
using namespace std;
int n,a,b,c,d;
signed main(){
b=1;
scanf("%d",&n);
while(n--){
	scanf("%d",&a);
	if(a!=b)++c;
	else ++b;
}
if(b>1)
printf("%d",c);
else puts("-1");
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)?"YES":"NO")
//ll n,m;
//ld ;
string s;
// char c;

int main() {
  cin >> s;
  yorn(s[2]==s[3]&&s[4]==s[5]);
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#pragma comment(linker, "/stack:200000000")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef string str;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector <pii> vpii;
typedef vector <pll> vpll;
typedef map <str,int> mapsi;
typedef map <str,int> :: iterator mapsitr;
typedef map <int , int> mint;
typedef map <ll , ll> mll;
typedef set <int> si;
typedef set <ll> sll;
typedef si :: iterator sitr;
typedef si :: reverse_iterator rsitr;
typedef sll :: iterator sltr;
typedef sll :: reverse_iterator rsltr;
#define mset multiset
 
typedef mset <int> msi;
typedef mset <ll> msll;
typedef msi :: iterator msitr;
typedef msi :: reverse_iterator msritr;
typedef msll :: iterator msltr;
typedef msll :: reverse_iterator mslritr;
 
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define fs first.second
#define ss second.second
#define ff first.first
#define sf second.first
#define newl '\n'
 
char to_upper (char x){
    if( 97 <= int(x) && int(x) <= 122)return char(x-32);
    else if( 65 <= int(x) && int(x) <= 90)return x;
}
char to_lower (char x){
    if( 97 <= int(x) && int(x) <= 122)return x;
    else if( 65 <= int(x) && int(x) <= 90)return char(x+32);
}
int numerize (char x){
    if(48 <= int(x) && int(x) <= 57)return int(x-'0');
    else if( 97 <= int(x) && int(x) <= 122)return int(x-96);
    else if( 65 <= int(x) && int(x) <= 90)return int(x-64);
}
bool isect (int l1, int r1, int l2, int r2){
    pii p1,p2;
    p1 = mp(l1,r1); p2 = mp(l2,r2);
    if(p1>p2)swap(p1,p2);
    if(p2.fi <= p1.se)return true;
    else return false;
}
ll quickpow (ll num1, ll num2, ll MOD){
    if(num2==0)return 1;
    else if(num2==1)return num1;
    else{
        ll temp = quickpow (num1,num2/2,MOD); ll res = ((temp%MOD) * (temp%MOD))%MOD;
        if(num2%2==1) res = ((res%MOD)*(num1%MOD))%MOD; return res;
    }
}
ll invmod (ll num, ll MOD){return quickpow (num,MOD-2,MOD);}
ll gcd (ll num1, ll num2){
    if(num1 < num2) swap(num1,num2); ll num3 = num1 % num2 ;
    while(num3 > 0){ num1 = num2; num2 = num3; num3 = num1 % num2;}
    return num2;
}
ll lcm (ll num1 , ll num2){return (ll) (num1/__gcd(num1,num2))*num2;}
// end of Template
ll T,n,t[200010],ans;
int main(){
 
//    freopen("input.txt", "r", stdin);
//    freopen("output.txt", "w", stdout);
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
  
  	cin>>n>>T;
  	ans = T;
  	for(int i=1;i<=n;i++){
  		cin>>t[i];
  		if(i-1){
  			ll d = t[i]-t[i-1];
  			d = min(d,T);
  			ans += d;
		}
	  }
	cout<<ans<<newl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int main(){
  	ios::sync_with_stdio(false);
  	cin.tie(NULL);
    int n,t,a,index,i,temp;
    float min,curr;
    cin >> n >> t >> a;
    cin >> temp;
    index = 1;
    min = abs(a-t+0.006*temp);
    for(i=2;i<=n;i++){
        cin >> temp;
        curr = abs(a-t+0.006*temp);
        if(curr<min){
            min = curr;
            index = i;
        }
    }
    cout << index;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define DEBUG(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x));
#define RSORT(x) sort(RALL(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int inf = 1<<30;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

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

  string ans = "";
  while(N != 0) {
    int r = N%2;
    if(r<0) r += 2;

    N = (N-r)/(-2);
    ans = to_string(r)+ ans;
  }
  if(ans == "") ans = "0";

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

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

using namespace std;

int main() {
  int N, M, C; cin >> N >> M >> C;
  vector<int> B(M);
  for(int i = 0; i < M; i++) {
    cin >> B[i];
  }

  int ansCnt = 0;
  for(int i = 0; i < N; i++) {
    long long multiABi = 0;

    for(int j = 0; j < M; j++) {
      int Aij; cin >> Aij;
      multiABi += Aij * B[j];
    }
    if(multiABi + C > 0) ansCnt++;
  }
  cout << ansCnt << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
  ll ans=0;
  string s,t;
  cin>>s>>t;
  for(int i=0;i<s.size();i++) ans+=(s[i]!=t[i]);
  cout<<ans;
  return 0;
}

Measured memory_bytes: 3916
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<=n;i++)
#define pb push_back
#define mp make_pair
#define se second
#define fi first
typedef double db;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int maxn = 500005;
const ll mod = 1000000007;
const ll inf = 0x7f7f7f7f;
//int edgenum, head[maxn], vet[maxn*2], nxt[maxn * 2], wt[maxn * 2];
//void add(int u,int v){edgenum++;vet[edgenum]=v;nxt[edgenum]=head[u];head[u]=edgenum;}
//void add(int u,int v,int w){edgenum++;vet[edgenum]=v;nxt[edgenum]=head[u];head[u]=edgenum;wt[edgenum]=w;}
//ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
/********HEAD********/
int main() {
	int n, k[500005];
	memset(k, 0, sizeof(k));
	cin >> n;
	int x;
	for(int i = 1; i < n; i ++) cin >> x, k[x] ++;
	for(int i = 1; i <= n; i ++) cout << k[i] << endl;
	return 0;
}

Measured memory_bytes: 5548
#include <bits/stdc++.h>
#define rep(i,n) for(long long int i = 0; i < n; i++)
#define print(n) std::cout << n << std::endl
#define _print(n) std::cout << n
using namespace std;
const int N = 1000000;

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

    vector<int> a(n);
    rep(i, n) cin >> a[i];

    int diff_max = 0;
    rep(i, n)rep(j, n)if(abs(a[i] - a[j]) > diff_max)diff_max = abs(a[i] - a[j]);

    print(diff_max);
}


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

bool isBalance(string str){
	stack<char> st;
	map<char, char> m;
	m[')']='('; m[']']='[';
	for(int i=0;i<str.size();i++){
		if(str[i]=='(' || str[i]=='['){
			st.push(str[i]);
		}else if(str[i]==')' || str[i]==']'){
			if(st.size() > 0 && m[str[i]]==st.top()){
				st.pop();
			}else return false;
		}
	}
	return !(st.size() > 0);
}

int main(){
	string str;
	while(getline(cin,str)){
		if(str==".") break;
		if(isBalance(str)) cout << "yes" << endl;
		else cout << "no" << endl;
	}
	return 0;
}

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

#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>
#include<unordered_set>
#include<bitset>
#include<complex>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

//typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector< vector<int> > mat;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD =  (int)1e9 + 7;
const double EPS = 1e-9;

int N, M;
string A[60], B[60];

signed main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	cin >> N >> M;
	rep(i, 0, N)
	{
		cin >> A[i];
	}
	rep(i, 0, M)
	{
		cin >> B[i];
	}

	bool ans = false;
	rep(i, 0, N - M + 1)rep(j, 0, N - M + 1)
	{
		bool ok = true;
		rep(y, 0, M)rep(x, 0, M)
		{
			if (A[i + y][j + x] != B[y][x])
			{
				ok = false;
			}
		}
		if (ok)ans = true;
	}

	if (ans)
	{
		cout << "Yes" << endl;
	}
	else
	{
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, x, n) for(long i = x; i < n; i++)
#define erep(i, x, n) for(long i = x; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define show(ans)  cout << ans << endl;



int main() {long N;
cin >> N;
vector<long> a(N); vector<long> b(N); vector<long> c(N);
rep(i, 0, N) cin >> a[i];
rep(i, 0, N) cin >> b[i];
rep(i, 0, N) cin >> c[i];
sort(all(a)); sort(all(b)); sort(all(c));
long ans = 0;
rep(i, 0, N){
    long x = lower_bound(all(a), b[i]) - a.begin();
    long y = upper_bound(all(c), b[i]) - c.begin();
    y = N-y;
    ans += x*y;
}
show(ans);




  return 0;
 
}



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

int main(void) {
    int n;
    cin >> n;
    vector<pair<int, int>> a(n + 1);
    for (int i = 1; i <= n; i++) {
        int x;
        cin >> x;
        a.at(i) = make_pair(x, i);
    }
    sort(a.begin(), a.end());
    for (int i = 1; i <= n; i++) {
        cout << a.at(i).second;
        if (i < n) cout << " ";
    }
    return 0;
}

Measured memory_bytes: 3960
import java.util.*;

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

        int a = sc.nextInt();
        int b = sc.nextInt();
        int sum = 0;
        if (a > b) {
            sum = sum + a;
            a--;
        } else {
            sum = sum + b;
            b--;
        }

        if (a > b) {
            sum = sum + a;
            a--;
        } else {
            sum = sum + b;
            b--;
        }

        System.out.println(sum);
    }
}


Measured memory_bytes: 23508
#include<bits/stdc++.h>
using namespace std;
 
int main(){
    int L,R,d;
    cin >> L >> R >> d;
    
    int count = 0;
    for(int i = L;i <= R;i++){
        if(i%d==0)
        count++;
    }
    cout << count << endl;
}

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

int main() {
  int n, k;
  cin >> n >> k;
  long long int total = 0;
  for(int i=k+1;i<=n;i++) {
    total += (n / i) * (i - k);
    if(n % i != 0 && n % i >= k) {
      if(k != 0) total += (n % i) - k + 1;
      else total += (n % i) - k;
    }
  }

  cout << total << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,a) for(int i=0;i<(a);i++)
const ll MOD=1000000007;

int main(){
  int n,d,x; cin>>n>>d>>x;
  int a[n];
  rep(i,n) cin>>a[i];
  int ans=x;
  rep(i,n){
    int day=1+a[i];
    ans++;
    while(day<=d){
      ans++;
      day+=a[i];
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

int main() {
    int A, B;
    cin >> A >> B;

    int count = 0;
    for (int i = A; i <= B; i++) {
        int piece_5 = i / 10000;
        int piece_1 = i % 10;
        if (piece_5 != piece_1) {
            continue;
        }
        int piece_4 = (i % 10000) / 1000;
        int piece_2 = (i % 100) / 10;
        if (piece_4 != piece_2) {
            continue;
        }
        count++;
    }
    cout << count << endl;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
#print(cmb(10,2))
counter = 0
mod = 10**9 + 7
for x in range(k, n+1):
    num = (x * n) - (x * (x - 1)) + 1
    counter += num
    counter %= mod
else:
    counter += 1
    counter %= mod
print(counter)

Measured memory_bytes: 63356
#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
const int MAXN = 1e5 + 11;

vector<int> g[MAXN];

void add_self(int &a, int b)
{
    a += b;
    if (a >= mod)
        a -= mod;
}

int mult(int a, int b)
{
    return (ll)a * b % mod;
}

pair<int, int> dfs(int u, int p)
{
    int allwhite = 1; //this means vertex u can be painted black
    int anyblack = 0; //this means atleast one vertex is black
    for (int v : g[u])
    {
        if (v == p)
            continue;
        pair<int, int> res = dfs(v, u);
        //number of ways to paint the subtree rooted from v if v is white
        anyblack = (mult(allwhite, res.first) + mult(anyblack, res.first + res.second)) % mod;
        //
        allwhite = mult(allwhite, res.second);
    }
    return {allwhite, (allwhite + anyblack) % mod};
}

int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n - 1; i++)
    {
        int a, b;
        scanf("%d%d", &a, &b);
        g[a].push_back(b);
        g[b].push_back(a);
    }

    pair<int, int> p = dfs(1, 1);
    int ans = (p.first + p.second) % mod;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 12672
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner scan = new Scanner(System.in);
        int A = scan.nextInt();
        int B = scan.nextInt();
        int C = scan.nextInt();
        
        if(A <= C && B >= C) {
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}


Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    int W, a, b;
    cin >> W >> a >> b;
   
    if(b <= a+W && a <= b+W){
        cout << 0 << endl;
    }else if(a <= b+W && b <= a+W){
        cout << 0 << endl;
    }else if(a+W < b){
        cout << b - (a+W) << endl;
    }else{
        cout << a - (b+W) << endl;
    }

}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
  int n;cin>>n;
  int a=n/1000;n%=1000;
  int b=n/100;n%=100;
  int c=n/10;n%=10;
  int d=n;
  if(a==b&&b==c){
    cout<<"Yes"<<endl;
  }
  else if(b==c&&c==d){
    cout<<"Yes"<<endl;
  }
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<iomanip>
#include<set>
#include<queue>

using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int> a(n);
	vector<int> b(n);
	for(int i=0;i<n;i++)
	{
		cin >> a[i];
		b[i]=a[i];
	}
	sort(b.begin(),b.end());
	int cnt=0;
	for(int i=0;i<n;i++)
	{
		if(a[i]!=b[i])cnt++;
	}

	cout << (cnt>2 ? "NO":"YES") << endl;
}


Measured memory_bytes: 256
def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    H, N = read_ints()
    if sum(read_ints()) >= H:
        return 'Yes'
    return 'No'


if __name__ == '__main__':
    print(solve())


Measured memory_bytes: 83440
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Practice
{
    class Program
    {
        static void Main(string[] args)
        {
            SolveA();
            //SolveB();
            //SolveC();
            //SolveD();
        }
        private const long MOD = 1000000007;
        private struct Data
        {
            public int idx;
            public int year;
        }
        static void SolveA()
        {
            var nm = ReadAndParseIntArr();
            int n = nm[0];
            int m = nm[1];
            int[] p = new int[m];
            int[] y = new int[m];
            for(int i=0;i<m;++i)
            {
                var tmp = ReadAndParseIntArr();
                p[i] = tmp[0];
                y[i] = tmp[1];
            }

            var hash = new Dictionary<int, List<Data>>();// key 県id、value yearの配列

            long[] ids = new long[m];
            for(int i=0;i<m;++i)
            {
                if(!hash.ContainsKey(p[i]))
                {
                    hash[p[i]] = new List<Data>();
                }

                var list = hash[p[i]];
                list.Add(new Data() { idx = i, year = y[i] });
            }

            foreach(var pair in hash)
            {
                pair.Value.Sort((a,b)=>a.year.CompareTo(b.year));
            }

            foreach(var pair in hash)
            {
                long ken = pair.Key;
                var datas = pair.Value;
                for(int i=0;i<datas.Count;++i)
                {
                    Data data = datas[i];
                    long id = ken * 1000000 + i + 1;

                    ids[data.idx] = id;
                }
            }
            foreach(long id in ids)
            {
                Console.WriteLine(id.ToString("D12"));
            }
        }
        
        
        #region よく使う便利関数
        private static bool isPrime(long x)
        {
            if( x == 2) { return true; }
            if( x < 2 || x % 2 == 0) { return false; }
            long i = 3;
            while( i * i <= x)
            {
                if( x % i == 0) { return false; }
                i = i + 2;
            }
            return true;
        }
        private static long lcm(long x, long y)
        {
            return x / gcd(x, y) * y;
        }
        private static long gcd(long x, long y)
        {
            return y > 0 ? gcd(y, x % y) : x;
        }

        private static int ReadAndParseInt()
        {
            return int.Parse(Console.ReadLine());
        }
        private static int[] ReadAndParseIntArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
        }
        private static long ReadAndParseLong()
        {
            return long.Parse(Console.ReadLine());
        }
        private static long[] ReadAndParseLongArr()
        {
            return Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);
        }
        #endregion
    }
}

Measured memory_bytes: 39164