akhauriyash/Code-Regression huggingface dataset:
/*=============================================================================================================================/*
                                               Bismillahir Rahmanir Rahim

      _     ____  ___  ____   _   _  _         ___  ____   _         _     __  __
     / \   / ___||_ _|| __ ) | | | || |       |_ _|/ ___| | |       / \   |  \/  |
    / _ \  \___ \ | | |  _ \ | | | || |        | | \___ \ | |      / _ \  | |\/| |
   / ___ \  ___) || | | |_) || |_| || |___     | |  ___) || |___  / ___ \ | |  | |
  /_/   \_\|____/|___||____/  \___/ |_____|   |___||____/ |_____|/_/   \_\|_|  |_|

   _   __           __  __  __
  |_) (_  _  o__   /   (_  |_
  |_)o__)(_  || |  \__ __) |__

    ___                    _   _      _                _ _               __   ___                 _         _        _
   / __|_ _ ___ ___ _ _   | | | |_ _ (_)_ _____ _ _ __(_) |_ _  _   ___ / _| | _ ) __ _ _ _  __ _| |__ _ __| |___ __| |_
  | (_ | '_/ -_) -_) ' \  | |_| | ' \| \ V / -_) '_(_-< |  _| || | / _ \  _| | _ \/ _` | ' \/ _` | / _` / _` / -_|_-< ' \
   \___|_| \___\___|_||_|  \___/|_||_|_|\_/\___|_| /__/_|\__|\_, | \___/_|   |___/\__,_|_||_\__, |_\__,_\__,_\___/__/_||_|
                                                            |__/                           |___/


   FB: https://facebook.com/SIAsibul
   Gmail: asibulislam8@gmail.com

/*=============================================================================================================================*/

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef vector<pii> vii;
typedef vector<pil> vil;
typedef vector<pli> vli;
typedef vector<pll> vll;

#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,n) for(ll i=0;i<(n);i++)
#define f1(i,n) for(ll i=1;i<=(n);i++)
#define f2(i,a,n) for(ll i=(a);i<=(n);i++)
#define fr(i,n,a) for(ll i=(n);i>=(a);i--)
#define rep(i,a,b,c) for(ll i=(a);i!=(b);i+=(c))
#define nl "\n"


const int INF = 1e9 + 5;
const int MXN = 2e5 + 5;
const int MOD = 1e9 + 7;

void solve(){
    ll x, k, d; cin >> x >> k >> d;
    x = abs(x);
    if(x/d >= k) cout << x-k*d << nl;
    else{
        k -= (x/d);
        x %= d;
        if(k&1) cout << abs(x-d) << nl;
        else cout << x << nl;
    }
}



int main(){
    ll t;
    //cin >> t;
    t = 1;
    while(t--){
        solve();
    }
    return 0;
 }


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

int main() {
    int A, B, C, D;

    cin >> A >> B >> C >> D;

    if ( A+ B > C + D) {
        puts("Left");
    } else if ( A + B == C + D ) {
        puts("Balanced");
    } else {
        puts("Right");
    }
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
int main(void)
{
    unsigned long long a, b, x;
    std::cin >> a >> b >> x;

    unsigned long cnt = 0;
    unsigned long adiv = a / x;
    unsigned long bdiv = b / x;
    cnt += bdiv - adiv;
    if ( a % x == 0 ) ++cnt;

    std::cout << cnt << std::endl;

    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
int main()
{
	int x,a,b,c;scanf("%d%d%d%d",&a,&b,&c,&x);
	int ans=0;x/=50;
	for(int i=0;i<=a;i++)
	for(int j=0;j<=b;j++)
	for(int k=0;k<=c;k++)
	if(10*i+2*j+k==x) ans++;
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
int x;
/*
From 400 through 599: 8-kyu
From 600 through 799: 7-kyu
From 800 through 999: 6-kyu
From 1000 through 1199: 5-kyu
From 1200 through 1399: 4-kyu
From 1400 through 1599: 3-kyu
From 1600 through 1799: 2-kyu
From 1800 through 1999: 1-kyu
*/
int main()
{
	cin>>x;
	if(x<=599)
	{
		cout<<8<<endl;
		return 0;
	}
	else if(x<=799)
	{
		cout<<7<<endl;
		return 0;
	}
	else if(x<=999)
	{
		cout<<6<<endl;
		return 0;
	}
	else if(x<=1199)
	{
		cout<<5<<endl;
		return 0;
	}
	else if(x<=1399)
	{
		cout<<4<<endl;
		return 0;
	}
	else if(x<=1599)
	{
		cout<<3<<endl;
		return 0;
	}
	else if(x<=1799)
	{
		cout<<2<<endl;
		return 0;
	}
	else if(x<=1999)
	{
		cout<<1<<endl;
		return 0;
	}
	cout<<endl;
	return 0;
}


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

using namespace std;

#define all(x) x.begin(), x.end()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define reps(i, m, n) for (int i = m; i <= n; ++i)

using i64 = long long;
using pii = pair<i64, i64>;

template<class A, class B>inline bool chmax(A &a, const B &b){return b > a ? a = b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b < a ? a = b,1 : 0;}

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;

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

  int a, b, k;
  cin >> a >> b >> k;

  vector<int> vec;
  for (int i = 1; i <= min(a, b); ++i) {
    if (a % i == 0 && b % i == 0) vec.push_back(i);
  }

  sort(all(vec), greater<>());

  cout << vec[k-1] << "\n";

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <queue>
#include <stack>
using namespace std;
#define rep(i,n) for (int i = 0; i <n; i++) 
 
int main(void){
    int a,b,c;
    std::cin >> a>>b>>c;
    if(a>=b&&a>=c) std::cout << b+c << std::endl;
    else if(b>=c) std::cout << a+c << std::endl;
    else std::cout << b+a << std::endl;
}

Measured memory_bytes: 256
l=[1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
k=int(input())
print(l[k-1])

Measured memory_bytes: 9124
#include <cstdio>
#include <memory.h>
#include <cstring>
#include <vector>
#include <deque>
#include <cstdlib>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cassert>
#include <functional>
#include <iostream>
#include <set>
#include <list>
#include <map>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;

typedef unsigned long long llu;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<int, ll> pil;
typedef pair<string, int> psi;
const ll MOD = 1e9 + 7;
const long double PI = 3.141592653589793238462643383279502884197;

priority_queue<int, vector<int>, greater<int> > pq;
vector<int> v;

int main() {
	ll x, y;
	scanf("%lld %lld", &x, &y);

	int cnt = 0;
	while (x * 2 <= y) {
		x *= 2;
		cnt++;
	}

	printf("%d", cnt + 1);
}

Measured memory_bytes: 256
from heapq import heappush,heappop,heapify
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
import math
import time
import random
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def ItoS(nn):
    return chr(nn+97)
'''
def GI(V,E,DAG=False,index=0):
    g=[[] for i in range(n)]
    for i in range(E):
        inp=LI()
        if index==0:
            inp[0]-=1
            inp[1]-=1
        if len(inp)==2:
            a,b=inp
        elif len(inp)==3:
            a,b,c=inp
            aa=(inp[1:])
            bb=(inp[1:])
        g[a].append(b)
        if g[b].append(a)
        h.append(b)
'''

def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
l_alp=string.ascii_lowercase
u_alp=string.ascii_uppercase
ts=time.time()
sys.setrecursionlimit(10**5)
input=lambda: sys.stdin.readline().rstrip()
 
show_flg=False
show_flg=True

ans=0

n=I()
s=input()
m={}
d1=set()
d2=set()
d3=set()
ans=set()
for i in s:
    
    for a,b in d2:
        ans.add((a,b,i))

    for a,b in d2:
        d3.add((a,b,i))
    for d in d1:
        d2.add((d,i))
    d1.add(i)

print(len(ans))

Measured memory_bytes: 44088
import java.io.InputStream;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) throws Exception {
        solve(System.in, System.out);
    }

    static void solve(InputStream is, PrintStream os) {
        // Your code here!
        Scanner sc = new Scanner(is);
        int N = sc.nextInt();
        int[] A = new int[N];
        HashMap<Integer, Integer> map = new HashMap<>();
        for(int i = 0; i < N; i++) {
            A[i] = sc.nextInt();
            map.put(A[i], map.getOrDefault(A[i], 0) + 1);
        }
        int ans = 0;
        for(Map.Entry<Integer, Integer> e : map.entrySet()) {
            if(e.getValue() > 1) continue;

            int v = e.getKey();
            if(v == 1) {
                ans = 1;
                break;
            }
            boolean isPrime = true;
            for(int i = 2 ; i * i <= v; i++) {
                if(v%i == 0) {
                    if(map.containsKey(i) || map.containsKey(v/i)){
                        isPrime = false;
                        break;
                    }
                }
            }
            if(isPrime && !map.containsKey(1)) ans++;
        }

        os.println(ans);
    }
}

Measured memory_bytes: 64960
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <map>
#define MOD 1000000007LL
using namespace std;

int main(){
	int x;
	cin >> x;
	int d[x];
	for(int i = 0; i < x; i++){
		cin >> d[i];
	}
	sort(d, d + x);
	int ans = 1;
	for(int i = 1; i < x; i++){
		if(d[i] != d[i-1]) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long int_max(long long a, long long b){
	if(a<b)return a;
  else return b;
}
int main(){
	long long n,a,b;cin>>n>>a>>b;
      cout<<(n/(a+b))*a+int_max(a,n%(a+b));
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> P;
typedef tuple<int, int, int> T;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n, q;
vector<ll> a;
ll x[100100];

ll sum[3][100100];

bool check(int k, ll v) {
    if (k == 0) return true;
    ll d0 = abs(v - a[n-k]);
    ll d1 = abs(v - a[n-(k+1)/2]);
    return d0 <= d1;
}

ll calc(ll v) {
    int lb = 0, ub = n+1;
    while (ub - lb > 1) {
        int mid = (lb + ub) / 2;
        if (!check(mid, v)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }
    if (lb % 2 == 1) lb++;
    ll res = sum[2][n] - sum[2][n-lb/2];
    if ((n-lb) % 2 == 1) {
        res += sum[0][n-lb];
    } else {
        res += sum[1][n-lb];
    }
    return res;
}

void solve() {
    sort(ALL(a));
    for (int i = 1; i <= n; i++) {
        if (i % 2 == 1) {
            sum[0][i] = sum[0][i-1] + a[i-1];
            sum[1][i] = sum[1][i-1];
        } else {
            sum[1][i] = sum[1][i-1] + a[i-1];
            sum[0][i] = sum[0][i-1];
        }
        sum[2][i] = sum[2][i-1] + a[i-1];
    }
    
    for (int i = 0; i < q; i++) {
        cout << calc(x[i]) << endl;
    }
}

void input() {
    cin >> n >> q;
    a = vector<ll>(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < q; i++) cin >> x[i];
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    solve();
}


Measured memory_bytes: 6824
package main

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

func main() {
	sc := NewScanner()

	l := sc.ReadInt()
	r := sc.ReadInt()
	d := sc.ReadInt()

	ans := r/d - (l-1)/d

	fmt.Println(ans)
}

// from [my library](https://github.com/ikngtty/go-contestlib)
// -   math/simple

func Abs(x int) int {
	if x >= 0 {
		return x
	}
	return -x
}

func Min(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	min := values[0]
	for _, v := range values {
		if v < min {
			min = v
		}
	}
	return min
}

func Max(values ...int) int {
	if len(values) == 0 {
		panic("no values")
	}

	max := values[0]
	for _, v := range values {
		if v > max {
			max = v
		}
	}
	return max
}

func Pow(base, exponent int) int {
	if exponent < 0 {
		panic(fmt.Sprintf("exponent (%d) should not be a minus", exponent))
	}

	answer := 1
	for i := 0; i < exponent; i++ {
		answer *= base
	}
	return answer
}

func Ceil(divident, dividor int) int {
	if dividor == 0 {
		panic("dividor should not be 0")
	}

	quo := divident / dividor
	rem := divident % dividor

	if rem != 0 {
		if (divident > 0 && dividor > 0) ||
			(divident < 0 && dividor < 0) {
			return quo + 1
		}
	}
	return quo
}

// -   sortutil

func ReverseInts(a []int) {
	sort.Sort(sort.Reverse(sort.IntSlice(a)))
}

func ReverseStrings(a []string) {
	sort.Sort(sort.Reverse(sort.StringSlice(a)))
}

// -   io

type Scanner struct {
	bufScanner *bufio.Scanner
}

func NewScanner() *Scanner {
	bufSc := bufio.NewScanner(os.Stdin)
	bufSc.Split(bufio.ScanWords)
	bufSc.Buffer(nil, 100000000)
	return &Scanner{bufSc}
}

func (sc *Scanner) ReadString() string {
	bufSc := sc.bufScanner
	bufSc.Scan()
	return bufSc.Text()
}

func (sc *Scanner) ReadInt() int {
	bufSc := sc.bufScanner
	bufSc.Scan()
	text := bufSc.Text()

	num, err := strconv.Atoi(text)
	if err != nil {
		panic(err)
	}
	return num
}


Measured memory_bytes: 1772
n, m,k = map(int, input().strip().split())
mod=998244353

def modpow(x, n, m): # pow(x,n,m)
    if n == 0:
        return 1
    res = modpow(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res

# a*a**(p-2)=1 at mod p (Fermat's little theorem)
def modInv(x, m):
    return modpow(x, m-2, m) % m

class modComb:
    def __init__(self,maxN,mod=10**9+7):
        self.maxN=maxN
        self.mod=mod
        self.fac=[None]*(maxN+1) # fac[0]=1, fac[1]=1, fac[2]=2 ... fac[maxN]
        self.ifac=[None]*(maxN+1)
    def calc_fact(self): # make the table
        self.fac[0]=1
        for i in range(1,self.maxN+1):
            self.fac[i] = self.fac[i-1]*i % self.mod
        self.ifac[-1] = modInv(self.fac[-1],self.mod)
        for i in range(self.maxN,0,-1):
            self.ifac[i-1] = self.ifac[i]*i % self.mod
    def modnCr(self,n, r,mod=None):
        if mod is None:
            mod=self.mod
        denom = self.fac[n]
        numer = self.ifac[r] * self.ifac[n-r] % mod
        return  denom * numer % mod

table=modComb(n,mod)
table.calc_fact()
ans=0
for i in range(k+1):
    ans += m % mod * modpow(m-1, n-i-1, mod) % mod * table.modnCr(n-1, i)%mod
    ans%=mod
print(ans)

Measured memory_bytes: 24576
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define Mod 1000000007
#define Max 1000001
#define vt vector<long long>

void func(){
    ll arr[4];
    for(int i=0; i<4; i++){
        cin>>arr[i];
    }
    
    ll val1=arr[0]*arr[2];
    ll val2=arr[0]*arr[3];
    ll val3=arr[1]*arr[2];
    ll val4=arr[1]*arr[3];
    
    cout<<max(val1, max(val2, max(val3, val4)))<<endl;
    
    
}

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

// 
// int t;
// cin >> t;
// for(ll i=1; i<=t; i++)
// {
    func();
//    cout<<endl;
//cout<<func()<<endl;
 
//if(func())
//    cout<<"Yes"<< endl;
//else
//    cout <<"No"<<endl; 
//cout<<"Case"<<" "<<"#"<<i<<":"<<" "<<func()<<endl;
// }
return 0;
}

Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		long[] arr = new long[5];
		String str = "MARCH";
		String remain = "MARCH";
		long ans = 0;
		for (int i = 0; i < N; i++) {
			char ch = reader.next().charAt(0);
			int index = str.indexOf(ch);
			if (index != -1) {
				arr[index]++;
				remain = remain.replace(Character.toString(ch), "");
			}
		}
		int size = str.length() - remain.length();
		if (size < 3) {
			System.out.print(ans);
			return;
		}
		long[] only = new long[size];
		long[] incre = new long[size];
		int count = 0;
		int current = 0;
		while (count < size) {
			if (arr[current] > 0) {
				only[count] = arr[current];
				count++;
			}
			current++;
		}

		incre[size-1] = only[size-1];
		for (int i = size-2; i > 0; i--) {
			incre[i] = incre[i+1] + only[i];
		}
		for (int i = 0; i < size - 2; i++) {
			for (int j = i + 1; j < size - 1; j++) {
				ans += only[i] * only[j] * incre[j+1];
			}
		}
		System.out.print(ans);
		reader.close();
	}
}


Measured memory_bytes: 63172
n = int(input())
a = list(map(int,input().split()))

all_xor = a[0]

for i in range(1,n):
  all_xor = all_xor ^ a[i]
  
ans = [a[i] ^ all_xor for i in range(n)]

for i in range(n):
  print(ans[i],end=' ')

Measured memory_bytes: 107200
//高知能系Vtuberの高井茅乃です。
//Twitter: https://twitter.com/takaichino
//YouTube: https://www.youtube.com/channel/UCTOxnI3eOI_o1HRgzq-LEZw

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

#define INF 1999999999
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define MODA 1000000007 

int main() {
	int ans = 0;
	int tmp;
	int n, k;
	cin >> n >> k;
	bool ch[n+1] = {};
	REP(i, k){
		int d;
		cin >> d;
		REP(j, d){
			cin >> tmp;
			ch[tmp] = true;
		}
	}
	REP1(i, n) if(!ch[i]) ans ++;
	cout << ans << endl;
}

Measured memory_bytes: 3636
#include "bits/stdc++.h"
#define FI first.first
#define SE first.second
#define TH second
#define fi first
#define se second
#define th second

using namespace std;

void debug_out() { cerr << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
 
#ifdef DEBUG
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

class DebugStream {}LOG;
template <typename T>DebugStream &operator<<(DebugStream &s, const T&) { return s; }
#ifdef DEBUG
#define LOG clog
#endif

typedef long long ll;
typedef pair<ll, ll> ii;
typedef long double ld;
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

const int maxN = 1e5 + 9, maxV = 1e6 + 9, MOD = 1e9 + 7, SQ = 335, lg = 20, bs = 29;

ll F(ll x) {
	return x * (x - 1) / 2;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	#ifdef DEBUG
	freopen("input.txt", "r", stdin);
	#endif

	int n;
	cin >> n;
	vector<int> arr(n);
	map<int, int> mp;
	ll pares = 0;
	for(auto& el: arr) {
		cin >> el;
		mp[el]++;
	}
	for(auto el: mp) pares += F(el.se);
	for(auto el: arr) cout << pares - (mp[el] - 1) << '\n';
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()

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

    // start
    string s;
    cin >> s;
    rep(i,19) {
        if (i == 5 || i == 13)
            cout << " ";
        else
            cout << s[i];
    }
    cout << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N):
    print(*A)
    v = A[i]
    j = i-1
    while j >= 0 and A[j] > v:
        A[j+1] = A[j]
        j = j-1
    A[j+1]=v
print(*A)

Measured memory_bytes: 5976
a, b, c = map(int, input().split())

count_5 = 0
count_7 = 0

if a == 5:
    count_5 += 1
elif a == 7:
    count_7 += 1

if b == 5:
    count_5 += 1
elif b == 7:
    count_7 += 1

if c == 5:
    count_5 += 1
elif c == 7:
    count_7 += 1

if count_5 == 2 and count_7 == 1:
    print("YES")
else:
    print("NO")



Measured memory_bytes: 3060
def make_array_for_comb(N, mod=10**9+7):
    fact = [1,1]
    fact_inv = [1,1]
    inv = [0,1]
    for i in range(2, N+1):
        fact.append((fact[-1]*i) % mod)
        # モジュラ逆数の性質
        inv.append((-inv[mod%i] * (mod//i)) % mod)
        fact_inv.append((fact_inv[-1]*inv[i]) % mod)
    return fact, fact_inv

def comb(n, r, mod=10**9+7):
  if (r < 0) or (n < r):
      return 0
  r = min(r, n - r)
  return fact[n] * fact_inv[r] * fact_inv[n-r] % mod

n,k = [int(i) for i in input().split()]
mod = 10**9+7
fact, fact_inv = make_array_for_comb(n,mod)
ans = 0

for i in range(min(n,k+1)):
  ans += (comb(n,i,mod)*comb(n-1,i,mod)%mod)
  ans %= mod
  
print(ans)

Measured memory_bytes: 81008
#include<iostream>
using namespace std;

int main(){
    int m,f,r;
    
    while(1){
        cin >> m >> f >> r;

        if(m == -1 && f == -1 && r == -1) break;
        
        if (m == -1 || f == -1)cout << "F" << endl;
        else if (m + f >= 80) cout << "A" << endl;
        else if (65 <= m + f && m + f < 80)cout << "B" << endl;
        else if (50 <= m + f && m + f < 65 || 30 <= m + f && m + f < 50 && r >= 50)cout << "C" << endl;
        else if (30 <= m + f && m + f < 50)cout << "D" << endl;
        else cout << "F" << endl;
    }   
    return 0;
}


Measured memory_bytes: 3116
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
		Scanner scan = new Scanner(System.in);
		while(scan.hasNext()){
			int n = scan.nextInt();
			int limit = scan.nextInt();
			if(n == 0 && limit == 0){
				break;
			}
			int[] a = new int[n];
			int min = 0;
			int b = 0;
			boolean sw = false;
			int t;
			for(int i = 0;i < n;i++){
				a[i] = scan.nextInt();
				t = a[i] * (limit / a[i]);
				if(i == 0 || min > t){
					min = t;
					b = i;
					sw = false;
				}else if(min == t){
					if(a[b] > a[i]){
						b = i;
					}else if(a[b] == a[i]){
						sw = true;
					}
				}
			}
			System.out.println((sw)?n:b+1);
		}
	}
}

Measured memory_bytes: 27020
#include <bits/stdc++.h>
//#define int long long

using namespace std;
using LL = long long;
using P = pair<int, int>;

#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)

#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()

const int INF = (int)1e9;
const LL INFL = (LL)1e18;
const int MOD = 1e9 + 7;

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

    int n, m;
    cin >> n >> m;

    int num = pow(2, m);
    cout << (1900 * m + (n-m) * 100) * num << endl;
}


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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < n - 2; i++) {
    if (s[i] == 'A' && s[i + 1] == 'B' && s[i + 2] == 'C') {
      ++ans;
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 256
n = int(input())

def isTriangular(n):
    i = 1
    while( (i*(i+1))//2 <= n) :
        if (i*(i+1))//2 == n:
            return True
        i+=1
    return False


def solve(n):
    if not isTriangular(n):
        print("No")
        return
    i = 1
    jump = 2
    ans = [[1],[1]]
    while ans[-1][-1] != n:
        next_ind = list(range(ans[-1][-1]+1, ans[-1][-1]+jump+1))
        for i in range(len(next_ind)):
            ans[i].append(next_ind[i])
        ans.append(next_ind)
        i+=jump
        jump += 1
    print("Yes")
    print(len(ans))
    for x in ans:
        p_str = ""
        p_str += str(len(x))
        for b in x:
            p_str += " " 
            p_str += str(b)
        print(p_str)
solve(n)

    


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

D = [[0, i] for i in range(N + 1)]


for i in range(N):
  a = A[i]
  b = B[i]
  D[a][0] += 1
  D[b][0] += 1

for d in D:
  if d[0] > N:
    print("No")
    exit()

print("Yes")

an = 0
am = 0
bn = 0
bm = 0
D = [1] * N
while an < N and bn < N:
  if A[an] == B[bn]:
    c = A[an]
  else:
    if A[an] > B[bn]:
      bn += 1
    else:
      an += 1
    continue
  am = an
  bm = bn
  while True:
    if am + 1 >= N:
      break
    if A[am + 1] == c:
      am += 1
    else:
      break
  while True:
    if bm + 1 >= N:
      break
    if B[bm + 1] == c:
      bm += 1
    else:
      break
  l = an - bm
  r = am - bn
  if l >= 0:
    for i in range(l, r + 1):
      D[i] = 0
  elif r >= 0:
    for i in range(l + N, N):
      D[i] = 0
    for i in range(r + 1):
      D[i] = 0
  else:
    for i in range(l + N, r + N):
      D[i] = 0
  an = am + 1
  bn = bm + 1

for i in range(N):
  if D[i] == 1:
    s = i
    break
else:
  print("No")
  exit()

Ans = [0] * N
for i in range(N):
  Ans[(i + s) % N] = B[i]

print(" ".join(list(map(str, Ans))))


Measured memory_bytes: 137664
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric>
#include <set>
#include <cstdlib>
#include <queue>
#include <map>

using namespace std;

typedef long long llint;
typedef long double ld;
#define inf 1e18
#define mod 1000000007
priority_queue<llint,vector<llint>,greater<llint>> que;
//priority_queue<llint> q;

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

int n,k;
vector<llint>v;
llint sum[2000005];

void solve(){
  cin >> n >> k;
  for(int i=1;i<=n;i++){
    sum[i]=sum[i-1]+i;
    sum[i]%=mod;
  }
  llint ans=0;
  for(int i=k;i<=n+1;i++){
    ans+=sum[n]-sum[n-i]+mod;
    ans%=mod;
    ans+=mod -sum[i-1]+1;
    ans%=mod;
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 5188
import java.util.*;

class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int H = sc.nextInt();
    int A = sc.nextInt();
    int ans = H / A;
    if((H % A) != 0) {
      ans = ans + 1;
    }

    System.out.println(ans);
  }
}

Measured memory_bytes: 23764
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define max3(a,b,c) max(a,max(b,c))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define min3(a,b,c) min(a,min(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define yes cout<<"YES"<<nl
#define no  cout<<"NO"<<nl
#define nl  '\n'
#define tr ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define tst int t;cin>>t;while(t--)
#define     Max             1000000000000000014
#define     Min             -1000000000000000014
#define     PI              3.1415926535897
#define     Fr               first
#define     Se               second
#define     all(v)          v.begin(),v.end()
#define     mem(a,v)        memset(a,v,sizeof(a))
#define     space            ' '
#define COUT(v) for(auto it:v)cout<<it<<space;cout<<nl;
/*error cheaking method starts from here */
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
cerr << *it << " = " << a << endl;
err(++it, args...);
}
/*error cheaking method ebds here */

#define vi    vector<int>
#define    vl    vector<ll>
#define    si    set<int>
#define    sl    set<ll>
#define    msi    multiset<int>
#define    msl    multiset<ll>
#define    pii    pair<int,int>
#define    pil    pair<int,ll>
#define    pli    pair<ll,int>
#define    pll    pair<ll,ll>
#define    mp    make_pair
#define    pb    push_back
int main()
{
    int x;
    cin>>x;
    if(x==0)
        cout<<1;
    else
        cout<<0;
}


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

using namespace std;
typedef long long ll;

#define rep(i, N) for (int i = 0; i < (int)N; i++)
const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
  int N; cin >> N;
  int A[N]; rep(i,N) cin >> A[i];
  int num[3] = {};
  ll result = 1;
  rep(i,N) {
    int count = 0;
    rep(j,3) if (num[j]==A[i]) count++;
    result *= count; result %= MOD;
    if (num[0]==A[i]) num[0]++;
    else if (num[1]==A[i]) num[1]++;
    else num[2]++;
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
 
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define int long long
#define rep(i,a,b)    for(int i=a;i<b;i++)
#define repn(i,a,b)   for(int i=a;i>=b;i--)
#define F first
#define S second
#define pii pair<int,int>
#define vi vector<int>
#define vii vector<pii>
#define pb push_back
#define mp  make_pair
#define all(v) (v).begin(), (v).end()
#define mod 1000000007
#define inf 1e18

 
using namespace std;
 
int max(int a, int b)
{
    if(a>b) return a;
    else return b;
}
 
int min(int a,int b)
{
    if(a<b) return a;
    else return b;
}
bool isPrime(int n) 
{ 
    // Corner cases 
    if (n <= 1) 
        return false; 
    if (n <= 3) 
        return true; 
  
    // This is checked so that we can skip 
    // middle five numbers in below loop 
    if (n % 2 == 0 || n % 3 == 0) 
        return false; 
  
    for (int i = 5; i * i <= n; i = i + 6) 
        if (n % i == 0 || n % (i + 2) == 0) 
            return false; 
  
    return true; 
} 
signed main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output1.txt", "w", stdout);
    #endif
    
    IOS;
    char c;
    cin>>c;
    if(isupper(c)) cout<<"A"<<endl;
    else cout<<"a"<<endl;
    
}

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

D = []
for i in range(N):
    D.append(list(map(int, input().split())))

ans = False
for i in range(N-2):
    if D[i][0] == D[i][1] and D[i+1][0] == D[i+1][1] and D[i+2][0] == D[i+2][1]:
        ans = True
        break

if ans:
    print('Yes')
else:
    print('No')

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

int main(){
  long long N,C,K;
  cin >> N >> C >> K;
  long long t[N];
  for (int i=0;i<N;i++) t[i]=0;
  for (int i=0;i<N;i++) cin >> t[i];
  sort(t,t+N);
  long long b[100010];
  int num=0;
  b[num]=t[0];
  int nowbus=0;
  for (int i=0;i<N;i++){
    //cout<<i<<" "<<num<<" "<<nowbus<<endl;
    if((t[i]<=b[num]+K)&&(C-nowbus>=1)){
      nowbus++;
    }
    else if(t[i]>b[num]+K){
      nowbus=1;
      num++;
      b[num]=t[i];
    }
    else if(C-nowbus==0){
      nowbus=1;
      num++;
      b[num]=t[i];
    }
  }
  cout<<num+1<<endl;
  return 0;
}

    

Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>
using namespace std;
int n,k;
int abs(int x)
{
	return x>0?x:-x;
} 
int main ()
{
	scanf("%d%d",&n,&k);
	if(abs(n)>=(k*2-1)) printf("YES");
	else printf("NO");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>

using namespace std;

int count_digit(int n) {
  int cnt = 0;
  while (n != 0) {
    n /= 10;
    cnt++;
  }

  return cnt;
}

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

  int digit_cnt = count_digit(n);
  int ans = 0;
  for (int i = 1; i < digit_cnt; i++) {
    if (i % 2 == 1) {
      ans += pow(10, i) - pow(10, i - 1);
    }
  }

  if (digit_cnt % 2 == 1) {
    ans += n - static_cast<int>(pow(10, digit_cnt - 1)) + 1;
  }

  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <string>
#include <vector>
#include <list>
#include <utility>
#include <algorithm>
#include <functional>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <limits>
#include <numeric>

using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> PP;
#define REP(i,a,n) for(int i = (a); i < (int)(n); ++i)
#define REPM(i,n,a) for(int i = ((n) - 1); i >= (a); --i)
#define FLOAT setprecision(16)
#define SPEEDUP {cin.tie(0); ios::sync_with_stdio(false);}
#define INSIDE(i,j,H,W) ((i) >= 0 && (i) < (H) && (j) >= 0 && (j) < (W))
#define YesNo(b) (b ? "Yes" : "No")
#define YESNO(b) (b ? "YES" : "NO")
const int INF = 0x3FFFFFFF;
const LL INFLL = 0x3FFFFFFF3FFFFFFF;
const double INFD = 1.0e+308;
const double EPS = 1.0e-9;

template <class T, class U>
istream& operator>>(istream& ist, pair<T, U>& right) { return ist >> right.first >> right.second; }
template <class T, class U>
ostream& operator<<(ostream& ost, const pair<T, U>& right) { return ost << right.first << ' ' << right.second; }
template <class T, class TCompatible, size_t N>
void Fill(T(&dest)[N], const TCompatible& val) { fill(begin(dest), end(dest), val); }
template <class T, class TCompatible, size_t M, size_t N>
void Fill(T(&dest)[M][N], const TCompatible& val) { for (int i = 0; i < M; ++i) Fill(dest[i], val); }

// all_of
// partial_sum, adjacent_difference

#if _DEBUG
#include "IntMod.h"
#include "Union_Find.h"
#include "Graph.h"
#include "Range.h"
#include "Global.h"
#include "Flow_Solver.h"
#include "Tree.h"
#include "Suffix_Array.h"
#endif

#if 1234567891
#include <array>
#include <unordered_set>
#include <unordered_map>
template<typename T>
using PriorityQ = priority_queue<T, vector<T>, greater<T> >;	// コスト小を優先
#endif

int N,M;
int main() {
	cin >> N >>M;
	cout << 2 * M - N << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#pragma GCC optimize("Ofast")

using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
typedef long long ll;
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REP(i,num,n) for(int i=num, i##_len=(n); i<i##_len; ++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; }
#define print(x) (cout << (x) << endl)
#define pb push_back
#define mp make_pair
#define sz(x) int(x.size())
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
#define fs first
#define sc second
// 多倍長
#include <boost/rational.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using boost::rational;
using boost::multiprecision::cpp_int;

const int INF = 1e9;
const ll LLINF = 1e16;
const ll MOD = 1e9+7;
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};

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

// 指定した文字cが文字列に何文字入ってるか
ll stringcount(string s, char c) {
    return count(s.cbegin(), s.cend(), c);
}


// 割り算の切り上げ処理
template<typename T>
T rp(T a, T b) {
  return (a + b - 1) / b;
}

// 桁和
template<typename T>
T digsum(T n) {
    T res = 0;
    while(n > 0) {
        res += n%10;
        n /= 10;
    }
    return res;
}

// 回文判定
bool kai (string s) {
    string t{s};
    reverse(begin(t), end(t));
    return s == t;
}

using pint = pair<int, int>;
using pll = pair<ll, ll>;


vector<string> split(const string &s, char delim) {
    vector<string> elems;
    string item;
    for (char ch: s) {
        if (ch == delim) {
            if (!item.empty())
                elems.push_back(item);
            item.clear();
        }
        else {
            item += ch;
        }
    }
    if (!item.empty())
        elems.push_back(item);
    return elems;
}


int main(void)
{
    cout.tie(0);
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    ll x;
    cin >> x;
    REP(i, -100, 1001){
        REP(j, -100, 1001){
            ll a = i;
            ll b = j;
            if(a * a * a * a * a - b * b * b * b * b == x){
                print(i);
                print(j);
                return 0;
            }
        }
    }

}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define rrep(i, n, g) for (int i = (n)-1; i >= (g); --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s, t, u;
  int a, b;
  cin >> s >> t >> a >> b >> u;
  if (s == u)
    cout << a - 1 << " " << b << endl;
  else
    cout << a << " " << b - 1 << endl;
}

Measured memory_bytes: 3640
#include <iostream>

using namespace std;

int main(void)
{
	int H, W;

	while(true)
	{
		cin >> H >> W;
		if( (H==0) && (W==0) )
		{
			break;
		}
		else
		{
			for(int i = 0; i < H; i++)
			{
				//frame
				if( (i == 0) || (i == H-1) )
				{
					for(int j = 0; j < W; j++)
					{
						cout << '#';
					}
					cout << endl;
				}
				//Not frame
				else
				{
					cout << '#';
					for(int j = 1; j < W-1; j++)
					{
						cout << '.';
					}
					cout << '#' << endl;
				}
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1152
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner s = new Scanner(System.in);
		
		while(s.hasNext()){
			int vampireNum = s.nextInt();
			int bloodType = s.nextInt();
			
			if(vampireNum == 0 && bloodType == 0){
				break;
			}
				
			int[] stock = new int[bloodType];
			
			for(int i = 0; i < stock.length; i++){
				stock[i] = s.nextInt();
			}
			
			for(int i = 0; i < vampireNum; i++){
				for(int j = 0; j < bloodType; j++){
					stock[j] -= s.nextInt();
				}
			}
			
			boolean result = true;
			for(int i = 0; i < bloodType; i++){
				if(stock[i] < 0)result = false;	
			}
			
			System.out.println(result?"Yes":"No");
					
		}
	}
}

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

using ll = long long;
static const ll MOD = 1e9 + 7;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n;
  cin >> n;
  
  vector<vector<bool>> a(n, vector<bool>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      int x;
      cin >> x;
      a.at(i).at(j) = x;
    }
  }
  
  vector<ll> dp(1 << n);
  dp.at(0) = 1;
  
  for (int bit = 1; bit < (1 << n); bit++) {
    int i = __builtin_popcount(bit);
    for (int j = 0; j < n; j++) {
      if (a.at(i - 1).at(j) && (bit & (1 << j))) {
        dp.at(bit) += dp.at(bit ^ (1 << j));
      }
    }
    dp.at(bit) %= MOD;
  }
  
  cout << dp.back() << '\n';
}

Measured memory_bytes: 16640
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
    long long n,i,s,r,min1,min2;
    cin>>n;
    int a[n];
    for(i=0,s=0;i<n;i++)
    {
        cin>>a[i];
        s+=a[i];
    }
    s=s-a[0];r=a[0];
    min1=llabs(s-r);
    for(i=1;i<n-1;i++)
        {
           r=r+a[i];s=s-a[i];
           min2=llabs(s-r);
           if(min1>min2) min1=min2;
        }
    cout<<min1;
    return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
typedef long long int uli;
const int mx=400+10;
struct pt{
   int x,y;   
   pt(int x,int y):x(x),y(y){};
   pt(){}
   pt operator -(pt a){return pt(x-a.x,y-a.y);}
   int cross(pt a){ return x*a.y-y*a.x; }
   int d2(){ return x*x+y*y;}
   double mod(){ return sqrt(d2()); }
};
pt p[mx];
bool used[mx];
int o[mx];
pt base;

bool cmp(int i,int j){
   int x=(p[i]-base).cross(p[j]-base);
   if(x!=0) return x<0;
   return (p[i]-base).d2()<(p[j]-base).d2();
}
int main(){
   int n;
   while(scanf("%d",&n)==1){
      if(n==0)break;
      for(int i=0;i<n;i++)
         scanf("%d %d",&p[i].x,&p[i].y);
      memset(used,false,sizeof used);
      base.x=base.y=0;
      double ans=0.0;
      for(int i=0;i<n;i++){
         int l=0;
         for(int j=0;j<n;j++)
            if(!used[j])
               o[l++]=j;
         sort(o,o+l,cmp);
         used[o[0]]=true;
         pt a=p[o[0]];
         ans+=(a-base).mod();
         base=a;
      }
      printf("%.1lf\n",ans);
   }
   return 0;
}

Measured memory_bytes: 1240
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,f=0;
  cin>>n;
  vector<int> p(n);
  for(int i=0;i<n;i++){
    cin>>p[i];
    if(p[i]!=i+1){f++;}
  }
  if(f>2){cout<<"NO";}
  else{cout<<"YES";}
}


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

int main() {
    Int n; cin >> n;
    //n--;
    vector<Int> p;
    
    do {
#if 0
        if (n == 26) {
            p.push_back(26);
            break;
        }
#endif
        n--;
        p.push_back(n % 26);
        n /= 26;
    } while (n > 0);

    for (int i = 0; i < (int)p.size(); i++) {
        int k = p.size()-1-i;
        //cout << p[k] << endl;
        //if (p[k] != 0)
        //    cout << (char)(p[k] + 'a'-1);
        //else
            cout << (char)(p[k] + 'a');
    }
    cout << endl;
}
//1000|0000|0000|0001
//1000000000000001

Measured memory_bytes: 3624
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define REVETSE(c) reverse((c).begin(),(c).end())
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define ALL(a)  (a).begin(),(a).end()
// int gcd(int a,int b){return b?gcd(b,a%b):a;}
long long gcd(long long a,long long b){return b?gcd(b,a%b):a;}

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> T maxt(T x,T y) {
    if (x>y) return x;
    else return y;
}
template<class T> T mint(T x,T y) {
    if (x>y) return y;
    else return x;
}
//sort(v.rbegin(), v.rend(), [](auto& x, auto& y){return x[1] < y[1];});
//cout << fixed << setprecision(10) << ans << defaultfloat << endl;
typedef long long ll;
typedef vector<int> Vi;
typedef vector<ll> Vl;
typedef vector<double> Vd;
typedef vector<string> Vs;

long long m = 1e9+7, mod = 1e9+7;
//逆元　a/b の modをとるとき -> a*modinv(b)%mod
long long modinv(long long a, long long m = 1e9+7) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

//約数列挙
vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}


int main() {
  int N;
  ll ans=0;
  cin >> N;
  Vl vl(N,0),av(60,0),v(60,0);
  REP(i,N) {
    cin >> vl[N-1-i];
  }
  REP(i,N) {
    REP(j,60){
      if (i>=1) {
      if ((vl[i] >> j) & 1){
        av[j] += i - v[j];}
      else {
        av[j] += v[j];}
    }
      if ((vl[i] >> j) & 1){
        v[j]++;
      }
    }
  }
  ll p = 1;
  REP(i,60){
    ll now = av[i]*p%mod;
    REP(j,i) now = now*2%mod;
    ans = (ans + now)%mod;
  }
  cout << ans << endl;
}

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

#define ll long long
#define vi vector<int>
#define vl vector<ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
// pll pp; -> (pp.first,pp.second)
// vector<vl> pp(n,vl(2)); sort(pp.begin(),pp.end(),[](vl a,vl b){return a[0]<b[0];});

#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)
#define RREP(i,n) for(ll (i)=(n)-1;(i)>=0;(i)--)
#define FOR(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define FORR(i,a,b) for(ll (i)=(b)-1;(i)>=(a);(i)--)
#define DEBUG(x) cout << #x << ": " << x << endl
#define CHMAX(a,b) a=max((a),(b))
#define CHMIN(a,b) a=min((a),(b))
/*}}}*/
int main() {
  ll L,R,m,ans,Ls,Rs,i,j;
  cin >> L>>R;
  if(R-L>2018){
    cout << 0<< endl;
  }else{
    if(L%2019>R%2019){
      cout << 0<< endl;
    }else{
      m = 2030;
      Ls = L%2019;
      Rs = R%2019;
      for(i=Ls;i<Rs;i++){
        for(j=i+1;j<=Rs;j++){
          m = min(i*j%2019,m);
        }
      }
      cout << m << endl;
    }
  }
  return 0;
}

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

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

    int minv = 0;
    for (int i = 2; i < s.size(); i++) {
        string ss;
        int aaa;
        ss = s.substr(i - 2, 3);
        int s_i = stoi(ss);
        aaa = s_i -753;
        if (aaa < 0)
            aaa = aaa * (-1);
        if (i == 2)
            minv = aaa;
        minv = min(minv, aaa);
    }
    cout << minv << endl;
    return 0;
}

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

int main(void) {
  ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;

  cout << max(0, A - 2 * B) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
 
using namespace __gnu_pbds;
using namespace std;
 
typedef   long long int ll;
typedef unsigned long long int sll;
typedef  double ld;
#define A 1000000007ll
#define B 998244353ll
#define C 1000000000000000000ll
#define FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define mxe(v) *max_element(v.begin(),v.end())
#define mne(v) *min_element(v.begin(),v.end())
#define bs binary_search
#define lb lower_bound
#define ub upper_bound
#define ve vector
#define br break
#define PI 3.1415926535

ll dp[100004];

int main() 
{
    FAST;
    ll n;
    cin>>n;
    ll h[n];
    for(int i=0;i<n;i++)
        cin>>h[i];
    dp[1]=abs(h[1]-h[0]);
    for(int i=2;i<n;i++)
        dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]));
    cout<<dp[n-1];
    return 0;
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define REP(i,n) for(int i=1;i<=n;i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(V) V.begin(), V.end()
#define PB push_back
using namespace std;
typedef long long ll;

int main() {
    string s;
    cin >> s;
    int ans = 0;
    if(s == "RRR") ans = 3; 
    if(s == "RRS") ans = 2;
    if(s == "RSS") ans = 1;
    if(s == "RSR") ans = 1;
    if(s == "SRS") ans = 1;
    if(s == "SRR") ans = 2;
    if(s == "SSR") ans =1;
    if(s == "SSS") ans = 0;
    cout << ans << endl;
}

Measured memory_bytes: 3628