akhauriyash/Code-Regression huggingface dataset:
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func rScan() []rune {
	return []rune(Scan())
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func mod(x, d int) int {
	x %= d
	if x < 0 {
		x += d
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := -int(1e+18)
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := int(1e+18)
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}
func bPrint(f bool, x string, y string) {
	if f {
		fmt.Println(x)
	} else {
		fmt.Println(y)
	}
}
func iSSPrint(x []int) {
	fmt.Println(strings.Trim(fmt.Sprint(x), "[]"))
}

var lp1 int = 1000000007
var lp2 int = 998244353

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, lp1)
	sc.Split(bufio.ScanWords)
	n, m := iScan(), iScan()
	uf := newUnionFind(n)
	for i := 0; i < m; i++ {
		uf.unite(iScan()-1, iScan()-1)
	}
	fmt.Println(len(uf.groups()) - 1)
}

type UnionFind struct {
	n   int
	par []int
}

func newUnionFind(n int) *UnionFind {
	uf := new(UnionFind)
	uf.n = n
	uf.par = make([]int, n)
	for i, _ := range uf.par {
		uf.par[i] = -1
	}
	return uf
}
func (uf UnionFind) root(x int) int {
	if uf.par[x] < 0 {
		return x
	}
	uf.par[x] = uf.root(uf.par[x])
	return uf.par[x]
}
func (uf UnionFind) unite(x, y int) {
	rx, ry := uf.root(x), uf.root(y)
	if rx != ry {
		if uf.size(rx) > uf.size(ry) {
			rx, ry = ry, rx
		}
		uf.par[ry] += uf.par[rx]
		uf.par[rx] = ry
	}
}
func (uf UnionFind) same(x, y int) bool {
	return uf.root(x) == uf.root(y)
}
func (uf UnionFind) size(x int) int {
	return -uf.par[uf.root(x)]
}
func (uf UnionFind) groups() [][]int {
	rootBuf, groupSize := make([]int, uf.n), make([]int, uf.n)
	for i := 0; i < uf.n; i++ {
		rootBuf[i] = uf.root(i)
		groupSize[rootBuf[i]]++
	}
	res := make([][]int, uf.n)
	for i := 0; i < uf.n; i++ {
		res[i] = make([]int, 0, groupSize[i])
	}
	for i := 0; i < uf.n; i++ {
		res[rootBuf[i]] = append(res[rootBuf[i]], i)
	}
	result := make([][]int, 0, uf.n)
	for i := 0; i < uf.n; i++ {
		if len(res[i]) != 0 {
			r := make([]int, len(res[i]))
			copy(r, res[i])
			result = append(result, r)
		}
	}
	return result
}


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

int main() {
  int N;
  cin >> N;
  string s;
  for (int i=0; i < N; i++) {
    cin >> s;
    if (s == "Y") {
      cout << "Four" << endl;
      break;
    }
    else if (i == N - 1 ) {
      cout << "Three" << endl;
    }
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main() {
  int n, a, b, c, d;
  scanf("%d %d %d %d %d", &n, &a, &b, &c, &d);
  a--;
  b--;
  c--;
  d--;
  char s[200000 + 2] = {'\0'};
  scanf("%s", s);
  int i;
  int ans = 1;
  if(c < d) {
    for(i = a; i < d; i++) {
      if(s[i] == '#' && s[i + 1] == '#') {
        ans = 0;
        break;
      }
    }
  } else {
    int cango = 0;
    for(i = b; i <= d; i++) {
      if(s[i] == '.' && s[i - 1] == '.' && s[i + 1] == '.') {
        cango = 1;
        break;
      }
    }
    for(i = 0; i < n - 1; i++) {
      if(s[i] == '#' && s[i + 1] == '#') {
        ans = 0;
        break;
      }
    }
    ans *= cango;
  }
  if(ans == 1) printf("Yes\n");
  else         printf("No\n");
  return 0;
}

Measured memory_bytes: 384
n = int(raw_input())
S = [0 for i in range(13)]
H = [0 for i in range(13)]
C = [0 for i in range(13)]
D = [0 for i in range(13)]

for i in range(n):
    card = str(raw_input())
    if card[0] == 'S':
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                S[j] = 1
    elif card[0] == 'H':
        card.replace("H ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                H[j] = 1
    elif card[0] == 'C':
        card.replace("C ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                C[j] = 1
    elif card[0] == 'D':
        card.replace("D ", "")
        for j in range(13):
            if str(j+1) == card[2:len(card)]:
                D[j] = 1
                
for i in range(13):
    if S[i] == 0:
        print "S %d" % (i+1)
for i in range(13):
    if H[i] == 0:
        print "H %d" % (i+1)
for i in range(13):
    if C[i] == 0:
        print "C %d" % (i+1)
for i in range(13):
    if D[i] == 0:
        print "D %d" % (i+1)

Measured memory_bytes: 6484
#include<bits/stdc++.h>
using namespace std;
 
/// ----------------------------- (Debug) ------------------------------
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; }; sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0); sim > char dud(...);
struct debug {
#ifndef ONLINE_JUDGE
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i));}
sim, class b dor(pair < b, c > d) {ris << "(" << d.first << ", " << d.second << ")";}
sim dor(rge<c> d) {*this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]";}
#else
sim dor(const c&) { ris; }
#endif
};
vector<char*> tokenizer(const char* args) {
  char *token = new char[111]; strcpy(token, args); token = strtok(token, ", ");
  vector<char*> v({token});
  while(token = strtok(NULL,", ")) v.push_back(token);
  return reverse(v.begin(), v.end()), v;
}
void debugg(vector<char*> args) { cerr << "\b\b "; }
template <typename Head, typename... Tail>
void debugg(vector<char*> args, Head H, Tail... T) {
  debug() << " [" << args.back() << ": " << H << "] ";
  args.pop_back(); debugg(args, T...);
}
#define harg(...) #__VA_ARGS__
#ifndef ONLINE_JUDGE
#define dbg(...) { debugg(tokenizer(harg(__VA_ARGS__, \b\t-->Line)), __VA_ARGS__, __LINE__); cerr << endl;}
#else
#define dbg(...) { }
#endif
/// -----------------------------------------------------------------------

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector<pi> vpi; 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)    
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define REP(i,a,b) for(i=a;i<=b;i++)
#define RAP(i,a,b) for(i=a;i>=b;i--)
#define spa <<" "<<
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)x.size()
ll mod=1e9+7;
const int MX=0x3f3f3f3f;

int main() {
    IOS;
    int q;
    cin>>q;
    while(q--){
    	ll a,b;
    	cin>>a>>b;
   		if(a<b)	swap(a,b);
    	if(a==b||a+1==b){
      		cout<<a*2-2<<"\n";
      		continue;
    	}
      	ll p=a*b;
     	ll k=pow(p,0.5);
      	if(k*k==p) k--;
    	if(k*(k+1)>=p)	cout<<2*k-2<<"\n";
      	else cout<<2*k-1<<"\n";   
    }
   	return 0;   
} 

Measured memory_bytes: 4024
#include <bits/stdc++.h>
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) FOR(i, 0, n)
#define ll long long
using namespace std;

const ll P = 1000000007;
int gcd(int a, int b) { return b != 0 ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

int main()
{
  cout << fixed << setprecision(10);
  int A,B,C;
  cin >> A >> B >> C;
  
  int D = 0;
  int cnt = 0;
  rep(i,1000)
  {
    if(A==B&&B==C) break;
    if(abs(A-B)>1||abs(B-C)>1||abs(C-A)>1)
    {
      if(A<=B&&A<=C) A += 2;
      else if(B<=A&&B<=C) B += 2;
      else C += 2;
      cnt ++;
    }
    else
    {
      vector<int> vec(3);
      vec = {A,B,C};
      sort(ALL(vec));
      if(vec[0]==vec[1])
      {
        cnt += 1;
        break;
      }
      else
      {
        cnt += 2;
        break;
      }
    }
  }
  cout << cnt << endl;
  return 0;
}


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

namespace AtCoder {
    class Program {
        static void Main(string[] args) {

            var arr1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var N = arr1[0];
            var T = arr1[1];
            var list = new List<int>();
            for (int i = 0; i < N; i++) {
                var arr = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
                var c = arr[0];
                var t = arr[1];
                if (t <= T)
                    list.Add(c);
            }

            if(list.Count() != 0) {
                Console.WriteLine(list.Min());
            } else {
                Console.WriteLine("TLE");
            }
        }
    }
}

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

using namespace std;

const long long INF = 1000000000;

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

    vector<vector<long long>> A(N, vector<long long>(N));
    vector<vector<long long>> B(N, vector<long long>(N));
    bool flag = true;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            cin >> A[i][j];
            B[i][j] = A[i][j];
        }
    }

    for(int k = 0; k < N; k++) {
        for(int i = 0; i < N; i++) {
            for(int j = 0; j < N; j++) {
                B[i][j] = min(B[i][j], B[i][k] + B[k][j]);
            }
        }
    }

    long long answer = 0;

    for(int i = 0; i < N; i++) {
        for(int j = 0; j < N; j++) {
            flag = true;
            for(int k = 0; k < N; k++) {
                if(A[i][j] != B[i][j]) {
                    cout << "-1" << endl;
                    return 0;
                }

                if(i == k || j == k) {
                    continue;
                }

                if(A[i][j] == B[i][k] + B[k][j]) {
                    flag = false;
                    break;
                }

            }
            if(flag == true) {
                answer += A[i][j];    
            }
        }
    }

    answer /= 2;

    cout << answer << endl;     
	return 0;
}

Measured memory_bytes: 5036
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
using namespace std;
typedef long long ll;
const int mod = 1000000007;
const int mod2 = 998244353;

int main() {
  double w, h, x, y;
  cin >> w >> h >> x >> y;
  cout << w*h/2 << endl;
  if (x == w-x && y == h-y) cout << 1 << endl;
  else cout << 0 << endl;
}

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

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    int n,l;cin>>n>>l;
    string arr[n];
    for (int i=0;i<n;i++)cin>>arr[i];
    sort(arr,arr+n);
    for (int i=0;i<n;i++){
        cout<<arr[i];
    }cout<<endl;
    return 0;

}

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

#define LL long long
#define LD long double
#define Mod 1000000007
#define L_Mod 17100000013

const double eps = 1e-9;
const int INF = 0x3f3f3f3f;
const double PI = 3.1415926535;

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

#define ree(a,n) memset(a,n,sizeof(a));

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define red(i,l,u) for(int (i)=(int)(l);(i)>=(int)(u);--(i))

int main()
{
    int n,m;
    cin>>n>>m;
    if(n==m)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}


























Measured memory_bytes: 256
from __future__ import print_function

import sys
input = sys.stdin.readline

def eprint(*args, **kwargs):
    print(*args, file=sys.stderr, **kwargs)
    return

# import math
# import string
# import fractions
# from fractions import Fraction
# from fractions import gcd

# def lcm(n,m):
#     return int(n*m/gcd(n,m))

# import re
# import array
# import copy
# import functools
# import operator

# import collections
# import itertools
# import bisect
# import heapq


# from heapq import heappush
# from heapq import heappop
# from heapq import heappushpop
# from heapq import heapify
# from heapq import heapreplace

# from queue import PriorityQueue as pq

# def reduce(p, q):
#     common = fractions.gcd(p, q)
#     return (p//common , q//common )
# # from itertools import accumulate
# # from collections import deque

# from operator import mul
# from functools import reduce

# def combinations_count(n, r):
#     r = min(r, n - r)
#     numer = reduce(mul, range(n, n - r, -1), 1)
#     denom = reduce(mul, range(1, r + 1), 1)
#     return numer // denom

# import random



def main():
    n = int(input().strip())
    l = list(map(int, input().strip().split()))

    cnt=0
    j=1
    for i in range(n):
        if l[i]==j:
            j+=1
            cnt+=1
            pass
        else:
            pass
    if cnt==0:
        print(-1)
    else:
        print(n-cnt)
    return

if __name__ == '__main__':
    main()


Measured memory_bytes: 71324
/*input
3
2 4 3
*/
/**
    Author: Kristopher Paul
    Date Created: 23-11-2019
    Contest Name:
                _/    _/   _/_/_/_/   _/   _/_/_/_/
               _/  _/     _/    _/   _/   _/
              _/_/       _/_/_/_/   _/   _/_/_/_/
             _/  _/     _/  _/     _/         _/
            _/    _/   _/    _/   _/   _/_/_/_/
**/
#include<bits/stdc++.h>
#include<stdio.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define ll long long
#define int ll
#define pb push_back
#define INF 1e18
#define MOD 1000000007
//#define MOD 998244353
#define mp make_pair
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define REP(i,n) for (int i = 0; i < n; i++)
#define FOR(i,a,b) for (int i = a; i < b; i++)
#define REPD(i,n) for (int i = n-1; i >= 0; i--)
#define FORD(i,a,b) for (int i = a; i >= b; i--)
#define remax(a,b) a = max(a,b)
#define remin(a,b) a = min(a,b)
#define umap unordered_map
#define pii pair<int,int>
#define F first
#define S second
#define mii map<int,int>
#define vi vector<int>
#define vvi vector<vi>
#define itr :: iterator it
#define all(v) v.begin(),v.end()
#define WL(t) while(t--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) ((a)*(b))/gcd((a),(b))
#define out(x) cout << #x << " is " << x << endl
#define FastIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
//using namespace __gnu_pbds;

//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // set
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> pbds; // multiset

int ModExp(int x,int y,int m){
    int res = 1;
    x = x % m;
    while (y > 0)
    {
        if (y & 1)
            res = (res*x) % m;

        y = y>>1;
        x = (x*x) % m;
    }
    return res;
}

void solve(){
    int n;
    cin >> n;
    int arr[n];
    int s = 0;
    FOR(i,0,n){
        cin >> arr[i];
        s += arr[i];
    }
    int cur = 0;
    int ans = s;
    FOR(i,0,n-1){
        cur += arr[i];
        int b = s-cur;
        remin(ans,abs(b-cur));
    }
    cout << ans << endl;
}

signed main(){
    FastIO;
    int t = 1;
//    cin >> t;
    WL(t){
        solve();
    }
}


Measured memory_bytes: 1792
/*
ID: anonymo14
TASK: wormhole
LANG: C++                 
*/
#include<bits/stdc++.h>

using namespace std;

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

#define F first
#define S second
#define PU push
#define PUF push_front
#define PUB push_back
#define PO pop
#define POF pop_front
#define POB pop_back

#define REP(i,a,b) for(int i=a; i<=b; i++)

#define MOD 1000000007

void solve(int test_case) {
	int a,b;
	cin>>a>>b;
	if(a-2*b>0)cout<<a-2*b;
	else cout<<0;
}

int main() {
	
	////// FILE BASED IO////
	//freopen("wormhole.in", "r", stdin);
	//freopen("wormhole.out", "w", stdout);
	///////////////
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	int t=1;
	//cin>>t;
	REP(i,1,t) {
		solve(i);
	}
	return 0;
}	


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

#define f(a, n) for (int a = 0; a<n; a++)
#define F(a, n) for (int a = 1; a<= n; a++)

int digitsum(int x){
	if (x<10) return x;
	return x%10 + digitsum (x/10);
}
int n, ans=31337;
int main() {
	cin>>n;
	F(i, n/2) ans = min (ans, digitsum(i) + digitsum(n-i));
	cout<<ans<<endl;
}

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

int main()
{
	int  n, m, i, sum;
		cin >> n >> m;
		sum = 0;
	vector<int> a(m);
	vector<int> b(m);
	
	for (i = 0; i < m ; i++)
	{
		cin >> a.at(i);
		cin >> b.at(i);
	}
	for (i = 0; i < n ; i++)
	{
		for (int z = 0; z < m; z++)
		{
			if (a.at(z) == i + 1 || b.at(z) == i + 1)
				sum ++;
		}
		
		cout << sum << endl;
		sum = 0;
	}
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int n = in.nextInt(), a = in.nextInt();
			int[] x = in.nextIntArray(n);
			Arrays.sort(x);

			long[][][] dp = new long[n+1][n+1][2501];
			dp[0][0][0] = 1;

			for (int i = 1; i <= n; i++) {
				for (int j = 0; j <= n; j++) {
					for (int k = 0; k <= 2500; k++) {
						if (k-x[i-1] >= 0 && j > 0) {
							dp[i][j][k] += dp[i-1][j][k];
							dp[i][j][k] += dp[i-1][j-1][k-x[i-1]];
						} else {
							dp[i][j][k] += dp[i-1][j][k];
						}
					}
				}
			}

			long ans = 0;
			for (int k = 1; k <= n; k++) {
				ans += dp[n][k][k*a];
			}
			out.println(ans);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}


Measured memory_bytes: 85004
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const int MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
int main() {
  cin.tie(0);
  cout << fixed << setprecision(10);
  int n; cin >> n;
  vector<P> a(n);
  for(int i=0;i<n;++i) {
    int tmp; cin >> tmp;
    a[i] = {tmp, i+1};
  }
  sort(a.begin(), a.end());
  for(int i=0;i<n;++i) {
    cout << a[i].second;
    if(i == n-1) cout << endl;
    cout << " ";
  }
}


Measured memory_bytes: 1664
n=int(input())
l=sorted(list(map(int,input().split())),reverse=True)
count=0
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1,n):
      if l[i]<l[j]+l[k] and l[i]!=l[j]!=l[k]:
        count+=1
print(count)

Measured memory_bytes: 71952
//#include <bits/stdc++.h>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <fstream>
#include <string.h>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <queue>
#include <math.h>
#include <assert.h>
#define ff first
#define ss second
#define ll long long
#define mod 998244353
using namespace std;
ll n, a[100009], b[100009], c[100009];
ll dp[100009][3];
int main () {
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++) {
        cin>>a[i]>>b[i]>>c[i];
        dp[i][0] = max(dp[i - 1][1], dp[i - 1][2]) + a[i];
        dp[i][1] = max(dp[i - 1][0], dp[i - 1][2]) + b[i];
        dp[i][2] = max(dp[i - 1][1], dp[i - 1][0]) + c[i];
    }
    cout<<max(max(dp[n][0], dp[n][1]), dp[n][2]);
}
/*
 2
 ((
 )))(
 */


Measured memory_bytes: 4992
#include <iostream>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <stack>
#include <complex>
#include <stdlib.h>
#include <stdio.h>
#include <functional>
#include <cfloat>

#define Rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define Sort(a) sort(a.begin(), a.end())
#define Reverse(a) reverse(a.begin(), a.end())

#define eb emplace_back
#define dbg(x) cout<<#x" = "<<((x))<<endl
#define fs first
#define sc second
     
using namespace std;
     
     
typedef long long ll;
typedef pair<ll, ll> P;
     
     
int main(){
  ll N;

  cin >> N;

#ifdef DEBUG
  cout << "N=" << N << endl;
#endif

  if(N % 2 == 0){
    cout << (N-2)*N/2 << endl;
    for(int i = 1; i <= N; ++i){
      for(int j = i + 1; j <= N; ++j){
	if(i + j == N + 1) continue;
	else {
	  cout << i << " " << j << endl;
	}
      }
    }
  } else {
    cout << (N - 1) + (N-3)*(N-1)/2 << endl;
    for(int i = 1; i < N; ++i){
      for(int j = i + 1; j < N; ++j){
	if(i + j == N) continue;
	else {
	  cout << i << " " << j << endl;
	}
      }
    }
    for(int i = 1; i < N; ++i){
      cout << N << " " << i << endl;
    }
  }
  
  return 0;
}


Measured memory_bytes: 256
d[1<<19];m[1<<20];i;e;Q;main(N){for(;i<*d+2;d[i++]=e)m[i]=Q=i>scanf("%d",&e)?2*Q>e?abs(Q-e):Q:i?e:0;for(;--i;N+=d[i+1]<2*N?d[i+1]:0)m[*d+i]=m[i]<N;for(;~scanf("%d",&e);)i++&&puts(m[*d+e]?"NO":"YES");}

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1L << 30
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int N, K;
vector<long> a(100000, 0);
vector<long> dp(100000, INF);


long rec(int i){
	if (i == 0) return 0;
	if (dp[i] < INF) return dp[i];
	long res = INF;
	int index = 1;
	while ((i - index)>-1 && index <= K){
		chmin(res, rec(i-index) + abs(a.at(i) - a.at(i-index)));
		index++;
	}
	return dp.at(i) = res;
}

int main(){
	cin >> N >> K;
	rep(i, N) cin >> a.at(i);
	cout << rec(N-1) << endl;

	return 0;
}

Measured memory_bytes: 9600
#include <iostream>
#include <vector>
using namespace std;
int main(void) {
	int n, k;
	cin >> n >> k;
	vector<int> A(n);
	for (int i = 0; i < n; ++i) cin >> A[i];
	int cnt = 0;
	for (int i = 0; i < n; i = i + (k - 1)) {
		++cnt;
		if (i + (k - 1) == n - 1) break;
	}
	cout << cnt << endl;
	return 0;
}

Measured memory_bytes: 640
N = int(input())
ans = ''
for i in range(1, 99):
    if N <= 26 ** i:
        N -= 1
        for j in range(i):
            ans += chr(ord('a') + N % 26)
            N //= 26
        break
    else:
        N -= 26 ** i
print(ans[::-1])

Measured memory_bytes: 9004
package main

import "fmt"

func main() {
	var k, s int
	fmt.Scan(&k, &s)

	cnt := 0
	for x := 0; x <= k; x++ {
		for y := 0; y <= k; y++ {
			if z := s - x - y; 0 <= z && z <= k {
				cnt++
			}
		}
	}

	fmt.Println(cnt)
}


Measured memory_bytes: 512
//#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>

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;

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

	int N;
	cin >> N;
	if (N % 2 == 0)
	{
		cout << fixed << setprecision(10) << 0.5 << endl;
	}
	else
	{
		cout << fixed << setprecision(10) << (double)(N / 2 + 1) / N << endl;
	}

	return 0;
}

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

int main(){

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  string ans = "Balanced";
  if(a+b > c+d) ans = "Left";
  else if (a+b < c+d) ans = "Right";

  cout << ans << endl;

}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <memory>
#include <complex>
#include <numeric>
#include <cstdio>
#include <iomanip>

#define REP(i,m,n) for(int i=int(m);i<int(n);i++)
#define RREP(i,m,n) for(int i=int(n)-1;i>=int(m);--i)
#define EACH(i,c) for (auto &(i): c)
#define all(c) begin(c),end(c)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort(begin(c),end(c))
#define pb emplace_back
#define MP make_pair
#define SZ(a) int((a).size())

#ifdef LOCAL
#define DEBUG(s) cout << (s) << endl
#define dump(x)  cerr << #x << " = " << (x) << endl
#define BR cout << endl;
#else
#define DEBUG(s) do{}while(0)
#define dump(x) do{}while(0)
#define BR 
#endif
using namespace std;

using UI = unsigned int;
using UL = unsigned long;
using LL = long long int;
using ULL = unsigned long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VLL = vector<LL>;
using VS = vector<string>;
using PII = pair<int,int>;
using VP = vector<PII>;

//struct edge {int from, to, cost;};

constexpr double EPS = 1e-10;
constexpr double PI  = acos(-1.0);
//constexpr int INF = INT_MAX;

template<class T> inline T sqr(T x) {return x*x;}

void solve() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,0,n) cin >> a[i];
    REP(i,0,n) a[i] -= i;
    LL l = -1000000-1, r = 1000000000+1, m;
    REP(i,0,100) {
        m = (l + r) / 2;
        LL sum = 0, suml = 0, sumr = 0;
        REP(i,0,n) sum += abs(a[i] - m);
        REP(i,0,n) suml += abs(a[i] - l);
        REP(i,0,n) sumr += abs(a[i] - r);
        //cout << suml << " " << sum << " " << sumr << endl;
        //cout << l << " " << m << " " << r << endl;
        /*
        if (suml == sum && sum < sumr) {
            r = m;
            m = (l + r) / 2;
        } else if (sumr == sum &&) {
        } else 
        */
        if (suml >= sum && sumr >= sum) {
            l = (l + m) / 2 - 100;
            r = (r + m) / 2 + 100;
        } else if (suml < sum) {
            r = m;
            m = l;
            l = m - (r - m)-100;
        } else if (sumr < sum) {
            l = m;
            m = r;
            r = m + (m - l)+100;
        }
        //if (r - l < 100 && suml >= sum && sumr >= sum) break;
        r = min(r, LL(1000000000+1));
        l = max(l, LL(-1000000-1));
        if (l > r) i = 0;
    }
    LL ans = -1;
    REP(j,l,r+1) {
        LL sum = 0;
        REP(i,0,n) sum += abs(a[i] - j);
        if (ans == -1) ans = sum;
        ans = min(ans,sum);
    }
    cout << ans << endl;
    /*
    cout << l << " " << m << " " << r << endl;
    LL sum = 0, suml = 0, sumr = 0;
    REP(i,0,n) sum += abs(a[i] - m);
    REP(i,0,n) suml += abs(a[i] - l);
    REP(i,0,n) sumr += abs(a[i] - r);
    cout << min({sum, suml, sumr}) << endl;
    */
}

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

Measured memory_bytes: 1024
#include<iostream>

using namespace std;

int main() {
    string s;
    cin >> s;
    int n = s.size();
    int ans = 0;
    for( int i=0 ; i< n/2; i++){
        if( s[i] != s[ n-i-1] ) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string>
#include<iostream>
#include<cctype>
#include<cstdio>
#include<vector>
#include<stack>
#include<queue>
#include <algorithm>
#include<math.h>
#include<set>
#include<map>
#include <sstream>
#include<iomanip>
#include <ctype.h>

//#include<bits/stdc++.h>


using namespace std;



int main() {

	long long int a, b, c;
	cin >> a >> b >> c;
	int ans = -1;
	for (int i = 0; i < 100000005; i++) {
		if (a % 2 || b % 2 || c % 2) {
			ans = i; 
			break;
		}
		if (a == b&&a == c)break;
		ans++;
		long long int t = b/2+c/2;
		long long int x = a,y=a;
		a = t;

		t = x / 2 + c / 2;
		x = b;
		b = t;

		c = x / 2 + y / 2;



	}
	//cout << a << b << c << endl;
	cout << ans << endl;
	return 0;

}




Measured memory_bytes: 256
rect = 0
rhombus = 0
while gets
  (a, b, c) = $_.split(",").map{|v| v.to_i}
  if a == b
    rhombus += 1
  end
  if a**2 + b**2 == c**2
    rect += 1
  end
end

puts rect, rhombus

Measured memory_bytes: 6100
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
#include <complex>
#include <bitset>
#include <fstream>
#include <unordered_map>
#include <unordered_set>
#include <numeric>

using namespace std;

#define ws ws_____________________
#define y1 y1_____________________
#define y0 y0_____________________
#define left left_________________
#define right right_______________
#define next next_________________
#define prev prev_________________
#define hash hash_________________

#define pb push_back
#define fst first
#define snd second
#define mp make_pair 
#define sz(C) ((int) (C).size())
#define forn(i, n) for (int i = 0; i < (int) n; ++i)
#define ford(i, n) for (int i = ((int) n) - 1; i >= 0; --i)
#define all(C) begin(C), end(C)

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vii;
typedef long double ld;
typedef complex<double> cd;

#define FILE_NAME "a"

const int MAXN = 500 + 10;

int n;
int x[MAXN];
int a[MAXN * MAXN];

bool read() {
	if  (scanf("%d", &n) < 1) {
		return 0;
	}
	forn(i, n) {
		scanf("%d", &x[i]);
		--x[i];
	}
	memset (a, -1, sizeof a);
	forn(i, n) {
		a[x[i]] = i;
	}
	return 1;
}

int ans[MAXN * MAXN];
int was[MAXN];

bool solve() {
	memcpy(ans, a, sizeof a);

	int i = 0;
	int j = 0;
	while (j < n * n && a[j] == -1) {
		++j;
	}
	assert(j < n * n);

	vi order;
	while (i < n * n && j < n * n) {
		int num = a[j];
		order.pb(num);

		int ready = 0;
		while (ready < num && i < n * n) {
			if  (ans[i] == -1) {
				ans[i] = num;
				++ready;
			}
			++i;
		}

		if (ready < num) {
			return 0;
		}

		++j;
		while (j < n * n && a[j] == -1) {
			++j;
		}
	}

	j = 0;
	i = 0;
	while (i < n * n && j < sz(order)) {
		int num = order[j];
		++j;
		int cnt = n - num - 1;

		int ready = 0;
		while (i < n * n && ready < cnt) {
			if  (ans[i] == -1) {
				ans[i] = num;
				++ready;
			}
			++i;
		}

		if (ready < cnt) {
			return 0;
		}
	}

	memset (was, 0, sizeof was);
	forn(i, n * n) {
		if  (ans[i] == was[ans[i]]) {
			if  (i != x[ans[i]]) {
				return 0;
			}
		}
		++was[ans[i]];
	}

	puts("Yes");
	forn(i, n * n) {
		printf("%d ", ans[i] + 1);
	}
	puts("");
	return 1;
}

int main() {
#ifdef LOCAL
	freopen(FILE_NAME ".in", "r", stdin);
	// freopen(FILE_NAME ".out", "w", stdout);
#endif

	while (read()) {
		if  (!solve()) {
			puts("No");
		}
	}

#ifdef LOCAL
	cerr.precision(5);
	cerr << "Time: " << fixed << (double) clock() / CLOCKS_PER_SEC << endl;
#endif
	return 0;
}


Measured memory_bytes: 3200
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <deque>
#include <numeric>
#include <sstream>
#include <iomanip>
#define ALL(X) X.begin(), X.end()
using lint = long long;
template <typename T>
void print_container(std::vector<T> vec)
{
    for (auto iter = vec.begin(); iter != vec.end(); ++iter)
    {
        std::cout << *iter << " ";
    }
    std::cout << std::endl;
}

int main()
{

    lint n;
    scanf("%lld", &n);

    std::string s;
    std::cin >> s;

    std::vector<std::vector<lint>> ch_num(26, std::vector<lint>(n + 1, 0));
    std::vector<lint> sv(n + 1, 0);

    for (int i = 0; i < n; ++i)
    {
        char cur = s[i];
        lint cur_num = (lint)(cur - 'a');
        sv[i + 1] = cur_num;

        for (int j = 0; j < 26; ++j)
        {
            if (j == cur_num)
            {
                ch_num[j][i + 1] = ch_num[j][i] + 1;
            }
            else
            {
                ch_num[j][i + 1] = ch_num[j][i];
            }
        }
    }

    lint q;
    scanf("%lld", &q);

    std::vector<std::tuple<lint, lint, lint>> queries;
    std::vector<lint> alp_num(26, 0);
    std::vector<lint> ans;

    for (int i = 0; i < q; ++i)
    {
        lint t;
        scanf("%lld", &t);

        if (t == 1)
        {
            lint iq;
            char cq;
            scanf("%lld", &iq);
            scanf(" %c", &cq);

            lint rep = sv[iq];
            queries.emplace_back(iq, rep, -1);
            sv[iq] = (lint)(cq - 'a');
            queries.emplace_back(iq, (lint)(cq - 'a'), 1);
        }
        else
        {
            lint l, r;
            scanf("%lld", &l);
            scanf("%lld", &r);

            for (int j = 0; j < 26; ++j)
            {
                alp_num[j] = ch_num[j][r] - ch_num[j][l - 1];
            }

            for (auto qu : queries)
            {
                lint place = std::get<0>(qu);
                lint al = std::get<1>(qu);
                lint pm = std::get<2>(qu);
                if (l <= place && place <= r)
                {
                    alp_num[al] += pm;
                }
            }

            lint anse = 0;
            for (int k = 0; k < 26; ++k)
            {
                if (alp_num[k] > 0)
                {
                    anse++;
                }
            }
            ans.push_back(anse);
        }
    }

    for (auto num : ans)
    {
        std::cout << num << "\n";
    }

    return 0;
}


Measured memory_bytes: 108724
#include <bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
const int maxn=1e5+10;
int k;
priority_queue<pii,vector<pii>,greater<pii> >Q;
int dis[maxn];
int main(){
    scanf("%d",&k);
    for (int i=0;i<k;i++) dis[i]=INT_MAX;
    for (int i=1;i<=9;i++){
        if (dis[i%k]==INT_MAX){
            dis[i%k]=i;
            Q.push(make_pair(dis[i%k],i));
        }
    }
    while (!Q.empty()){
        auto x=Q.top();Q.pop();
        if (x.first==dis[x.second]){
            for (int i=0;i<10;i++){
                int r=(x.second*10+i)%k;
                if (x.first+i<dis[r]){
                    dis[r]=x.first+i;
                    Q.push(make_pair(dis[r],r));
                }
            }
        }
    }
    printf("%d\n",dis[0]);
    return 0;
}


Measured memory_bytes: 2804
from sys import stdin
import math
a, b, x = [int(x) for x in stdin.readline().rstrip().split()]
if b*a*a/2 > x:
    temp1 = 2*x/(a*b**2)
    print(90-math.degrees(math.atan(temp1)))
else:
    temp = (2*b*a*a-2*x)/(a**3)
    print(math.degrees(math.atan(temp)))

Measured memory_bytes: 3572
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N;
	cin >> N;

	vector<long double> p(N);
	for (Int i = 0; i < N; i++) {
		cin >> p[i];
	}

	vector<vector<long double>> dp(N + 1, vector<long double>(N + 1));
	dp[0][0] = 1;

	for (Int i = 0; i < N; i++) {
		for (Int j = 0; j <= i; j++) {
			dp[i + 1][j + 1] += dp[i][j] * p[i];
			dp[i + 1][j] += dp[i][j] * (1 - p[i]);
		}
	}

	long double ans = 0;
	for (Int i = (N + 1) / 2; i <= N; i++) {
		ans += dp[N][i];
	}

	printf("%.10Lf\n", ans);

}


Measured memory_bytes: 141056
my ($n) = split(/\s+/, <>);
my (@a) = (0, split(/\s+/, <>));

#my $num = 0;
#for my $i (1..$n) {
#    for my $j (($i+1)..$n) {
#	$num++ if ($j-$i == $a[$i]+$a[$j]);
#    }
#}
#print $num, "\n";

#my $time = time();
my %b = ();

for (1..$n) {
    my $tmp = $a[$_] - $_;
    $b{$tmp}++;
}

my $num = 0;
for my $i (1..$n) {
    my $tmp = -$a[$i]-$i;
    $num += $b{$tmp};
}
print $num, "\n";
#print time()-$time, " sec\n";


Measured memory_bytes: 54696
from collections import defaultdict
N,Q = map(int,input().split())
d = defaultdict(list)

for _ in range(N-1):
    a,b = map(int,input().split())
    d[a].append(b)
    d[b].append(a)

c = defaultdict(int)

for _ in range(Q):
    p,x = map(int,input().split())
    c[p] += x

ans = [0 for i in range(N)]
que = [(1,0,-1)]
while len(que)>0:
    tmp = []
    for v,x,par in que:
        x += c[v]
        ans[v-1] = str(x)
        for w in d[v]:
            if w != par:
                tmp.append((w,x,v))
    que = tmp

print(*ans)


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

S = [""] * N
P = [0] * N

for i in range(N):
    S[i], P[i] = input().split()
    P[i] = int(P[i])


new_S = sorted(S)

same_v = []
same_i = []
for i, name in enumerate(new_S):
    for k in range(N):
        if new_S[i] == S[k]:
            same_v.append(P[k])
            same_i.append(k)
    x = same_i[same_v.index(max(same_v))]
    print(x + 1)
    same_v = []
    same_i = []
    P[x] = -1

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

num_set = []
seven_count = 0

while seven_count * 7 <= N:
    total = 7 * seven_count
    while total <= N:
        num_set.append(total)
        total += 4
    seven_count += 1

num_set = set(num_set)

if N in num_set:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3060
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public long N;
        public long[] C, S;
        int D = 50;
        public List<int> ret;
        public void Run()
        {
            N = Input.ReadLong();
            ret = new List<int>();
            C = new long[D];
            S = new long[D];
          
            // 
            long c = 1;
            for (int i = 0; i < D; i++)
            {
                C[i] = c;
                c *= -2;
            }

            // 正負の１つ下までの累積和
            for (int i = 0; i < D; i++)
            {
                if (i <= 1) S[i] = 0;
                else S[i] = S[i-2] + C[i-2];
            }

            // 上から桁を確定していく
            for (int i = D - 1; i >= 0; i--)
            {
                if (N > 0)
                {
                    if (C[i] < 0 || N <= S[i])
                        ret.Add(0);
                    else
                    {
                        ret.Add(1);
                        N -= C[i];
                    }
                }
                else if (N < 0)
                {
                    if (C[i] > 0 || N >= S[i])
                        ret.Add(0);
                    else
                    {
                        ret.Add(1);
                        N -= C[i];
                    }
                }
                else
                {
                    ret.Add(0);
                }
            }

            ret = ret.SkipWhile(e => e == 0).ToList();
            // ret.Reverse();
            if (ret.Count == 0) ret.Add(0);
            Console.WriteLine(string.Join("", ret));

        }
    }

    // libs ----------
    

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

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

int mode(vector<int> vec, int howmany_[2], int mode_[2]) {
	sort(vec.begin(), vec.end());
	int cnt = 1;
	int howmany = 0;
	int howmany2 = 0;
	int mode, mode2 = -1;
	for (int i = 1;i < vec.size();i++) {
		if (vec[i - 1] == vec[i]) {
			cnt++;
		}
		else {
			cnt = 1;
		}
		if (howmany < cnt) {
			howmany = cnt;
			mode = vec[i];
		}
		else if (howmany == cnt) {
			howmany2 = cnt;
			mode2 = vec[i];
		}
		else if (howmany2 < cnt) {
			howmany2 = cnt;
			mode2 = vec[i];
		}
	}
	howmany_[0] = howmany;
	howmany_[1] = howmany2;
	mode_[0] = mode;
	mode_[1] = mode2;
	return 0;
}

int main() {
	int n;
	int input;
	cin >> n;
	vector <vector <int>> a;
	a = vector<vector<int>>(2, vector<int>(n / 2, 0));
	for (int i = 0;i < n;i++) {
		if (i % 2 == 0) {
			cin >> a[0][i / 2];
		}
		else {
			cin >> a[1][i / 2];
		}
	}
	int howmanyx[2], howmanyy[2], modex[2], modey[2];
	mode(a[0], howmanyx, modex);
	mode(a[1], howmanyy, modey);
	if (modex[0] != modey[0]) {
		cout << n - howmanyx[0] - howmanyy[0] << endl;
	}
	else if (howmanyx[1] > howmanyy[1]) {
		cout << n - howmanyx[1] - howmanyy[0] << endl;
	}
	else {
		cout << n - howmanyx[0] - howmanyy[1] << endl;
	}
	return 0;
}

Measured memory_bytes: 828
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<cstdlib>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;

struct Rob
{
	int l,r;
} rob[100010];
int ans,n;

template<typename int_t>
void readx(int_t &x)
{
	x=0; int_t k=1; char ch=0;
	while (ch<'0' || ch>'9') { ch=getchar(); if (ch=='-') k=-1; }
	while (ch>='0' && ch<='9') { x=x*10+ch-'0'; ch=getchar(); }
	x*=k;
}

bool cmp(Rob a, Rob b)
{
	if (a.r == b.r) return a.l<b.l;
	return a.r<b.r; 
}

int main()
{
	readx(n); int xi,li;
	for (int i=1;i<=n;i++)
	{
		readx(xi); readx(li);
		rob[i].l=xi-li;
		rob[i].r=xi+li; 
	}
	sort(rob+1,rob+n+1,cmp);
	
	int nowr=-2*1e9; ans=0;
	for (int i=1;i<=n;i++)
	{
		if (rob[i].l>=nowr)
		{
			nowr=rob[i].r;
			ans++;
		}
	}
	
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 4520
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        // 整数の入力
        String[] arr = sc.nextLine().split(" ");
        BigDecimal a = new BigDecimal(arr[0]);
        BigDecimal b = new BigDecimal(arr[1]);
        BigDecimal ans = a.multiply(b);
        System.out.println(ans.setScale(0, RoundingMode.DOWN));
    }
}

Measured memory_bytes: 36060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n,k,q;
    cin>>n>>k>>q;
    int cnt[n]={};
    for(int i=0;i<q;i++){
        int a;
        cin>>a;
        cnt[a-1]++;
    }
    for(int i=0;i<n;i++){
        if(k-q+cnt[i]>0)cout<<"Yes"<<endl;
        else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define faster  ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define pb push_back
const double PI = acos(-1.0);
using namespace std;

int main()
{
    faster

    ll n,x;
    cin>>n>>x;

    if(n*500>=x)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;




    return 0;
}


Measured memory_bytes: 256
//g++  7.4.0

#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
  	ios_base::sync_with_stdio(false);
  	cin.tie(NULL);
    
    ll N; cin>>N;
    ll ver = 0;
    ll edg = 0;
    
    for(ll i=1;i<=N;++i)
        ver += (i * (N - i + 1LL));
    
    for(ll i=0;i<(N - 1);++i)
    {
        ll u,v; cin>>u>>v;
        
        if(u > v)
            swap(u,v);
        
        edg += (u * (N - v + 1LL));
    }
    
    cout<<(ver - edg)<<endl;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
struct E{int x,y,c;};
signed main(){
  int w,h,ans=0;
  char ma[55][55];
  cin>>h>>w;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++){
      cin>>ma[i][j];
      if(ma[i][j]=='.')ans++;
    }
  int used[55][55]={};
  queue<E> q;
  q.push((E){0,0,0});
  int f=0;
  while(!q.empty()){
    int x=q.front().x;
    int y=q.front().y;
    int c=q.front().c;
    q.pop();
    if(x==h-1&&y==w-1){
      f=1;
      ans-=c;
      break;
    }
    if(x<0||y<0||x==h||y==w)continue;
    if(used[x][y]||ma[x][y]=='#')continue;
    used[x][y]=1;
    q.push((E){x+1,y,c+1});
    q.push((E){x-1,y,c+1});
    q.push((E){x,y+1,c+1});
    q.push((E){x,y-1,c+1});
  }
  if(f)cout<<ans-1<<endl;
  else cout<<-1<<endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <numeric>
#define REP(i, s, n) for (int i = s; i < n; ++i)
#define rep(i, n) REP(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define SORT_INV(c) sort((c).begin(), (c).end(), greater<int>())
#define IINF INT_MAX
#define LLINF LLONG_MAX
#define DEBUG true
#define LL long long
#define Dev 1000000007

// sort(a.begin(), a.end(), std::greater<int>());
using namespace std;

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

Measured memory_bytes: 256