akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,m,s,t;
template<typename T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
//template<typename T> using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
int vis[100000];
void dijk(int s,vector<vector<pair<int,int>>> &E,vector<ll> &D){
    for(int i=0;i<n;i++){
        D[i]=1LL<<60;
        vis[i]=0;
    }
    min_priority_queue<pair<ll,int>> que;
    D[s]=0;
    que.push({0,s});
    while(!que.empty()){
        auto p=que.top();
        que.pop();
        ll cnt=p.first;
        int lo=p.second;
        if(vis[lo])continue;
        vis[lo]=1;
        for(auto x:E[lo]){
            ll cnt2=cnt+x.second;
            int to=x.first;
            if(D[to]>cnt2){
                D[to]=cnt2;
                que.push({D[to],to});
            }
        }
    }
}
ll dp[100000];
int main(void){
    // Your code here!
    cin>>n>>m>>s>>t;
    s--,t--;
    vector<vector<pair<int,int>>> EA(n);
    vector<vector<pair<int,int>>> EB(n);
    vector<ll> DA(n),DB(n);
    for(int i=0;i<m;i++){
        int u,v,a,b;
        cin>>u>>v>>a>>b;
        u--,v--;
        EA[u].push_back({v,a});
        EA[v].push_back({u,a});
        EB[u].push_back({v,b});
        EB[v].push_back({u,b});
    }
    dijk(s,EA,DA);
    dijk(t,EB,DB);
    for(int i=0;i<n;i++){
        dp[i]=DA[i]+DB[i];
    }
    //cout<<DA[0]<<DB[0]<<endl;
    for(int i=n-2;i>=0;i--){
        dp[i]=min(dp[i],dp[i+1]);
    }
    for(int i=0;i<n;i++){
        cout<<1000000000000000LL-dp[i]<<endl;
    }
}


Measured memory_bytes: 16636
/*!enjoy karo yaar!*/

//CF,CC,AtC,SPOJ: hp1999
//HE: hemant269
//HR: hemant2132

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

#define     int             long long int
#define     fast()          ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define     all(x)          begin(x),end(x)
#define     rz(x)           resize(x)
#define     asn(x,y)        assign(x,y)
#define     mem(a,b)        memset(a,b,sizeof(a))
#define     sz(x)           ((int)(x.size()))
#define     eb              emplace_back
#define     pb              push_back
#define     pf              push_front
#define     pob             pop_back
#define     pof             pop_front
#define     ins             insert
#define     vi              vector<int>
#define     pii             pair<int,int>
#define     mii             map<int,int>
#define     F               first
#define     S               second
#define     makep           make_pair
#define     maket           make_tuple
#define     remax(a,b)      a=max(a,b)
#define     remin(a,b)      a=min(a,b)
#define     bitcount(x)     __builtin_popcountll(x)
#define     iceil(n,x)      (((n)+(x)-1)/(x))
#define     gcd(a,b)        (__gcd((a),(b)))
#define     lcm(a,b)        ((a)*((b)/gcd((a),(b))))
#define     dbug(x)         cout<<#x<<": "<<(x)<<"\n"
#define     flush           fflush(stdout)
#define     show(x)         for(auto zz:x)cout<<zz<<" ";cout<<"\n";
#define     show2(x)        for(auto zz:x)cout<<zz.F<<" "<<zz.S<<"\n";

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;

const ld pi=acos(-1);
const ll inf=1e18,M=1e9+7;
const int N=1;

void solve()
{
    int n,k;
    cin>>n>>k;

    vi v(n);
    for(int i=0;i<n;++i)
        cin>>v[i];

    if(k==0)
    {
        cout<<accumulate(all(v),0ll);
        return;
    }

    int lim=log2(k);

    int x=0;
    int cnt,val;
    for(int i=lim;i>=0;--i)
    {
        val=1ll<<i;
        cnt=0;

        if(x+val>k)
            continue;

        for(int j=0;j<n;++j)
        {
            if(!(v[j]&(val)))
                ++cnt;
        }

        if(cnt>n-cnt)
            x^=val;
    }

    //cout<<x<<"\n";

    int ans=0;
    for(int i=0;i<n;++i)
        ans+=(v[i]^x);

    cout<<ans;
}

int32_t main()
{
    fast();

    int t=1;
    //cin>>t;
    for(int z=1;z<=t;++z)
    {
        solve();
        //cout<<"\n";
    }

    return 0;
}



Measured memory_bytes: 1024
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long LL;
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
int dp[22][12][160];
void mainmain(){
	reep(i,1,22){
		reep(k,1,160){
			if(k<=i){
				dp[i][1][k]=1;
			}
			else break;
		}
	}
	reep(i,1,22){
		reep(j,2,12){
			if(i<j) break;
			reep(k,1,160){
				rep(l,i){
					if(k-l<0) break;
					dp[i][j][k]+=dp[l][j-1][k-l-1];
				}
			}
		}
	}
	int a,b,c;
	while(cin>>a>>b>>c,a||b||c){
		cout<<dp[a][b][c]<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

Measured memory_bytes: 1312
//Shift only

#include<bits/stdc++.h>
#define ll long long 
using namespace std;
 
int main(){
    int A,B,C,X,c,Ans=0;
    cin >> A >> B >> C >> X;
    c = 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==c)Ans++;
            }
        }
    }
    cout << Ans << endl;    
    return 0;
}


Measured memory_bytes: 256
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}
fn main() {
    input! {
        a: u64,
        b: u64,
        c: u64,
    }
    if gcd(gcd(a, b), c) == gcd(a,b) {
        println!("YES");
    } else {
        println!("NO");
    }
}

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

using namespace std;

void set_level(int room_l, int room_r, int level, vector<vector<int>>& a){
  if(room_r - room_l == 1) return;
  
  int room_m = (room_l + room_r) >> 1;
  for(int i = room_l; i < room_m; i++){
    for(int j = room_m; j < room_r; j++){
      a[i][j] = a[j][i] = level;
    }
  }
  
  ++level;
  set_level(room_l, room_m, level, a);
  set_level(room_m, room_r, level, a);
}

int main(){
  int N;
  cin >> N;
  
  vector<vector<int>> a(N, vector<int>(N, 0));
  
  set_level(0, N, 1, a);
  
  for(int i = 0; i < N - 1; i++){
    for(int j = i + 1; j < N - 1; j++){
      cout << a[i][j] << ' ';
    }
    cout << a[i][N - 1] << endl;
  }
  
  return 0;
}

Measured memory_bytes: 4524
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;
list<long long int> Prime(int M) {
	list<long long int>P;
	P.push_back(2);
	P.push_back(3);
	for (int i = 5; i <= M; i += 6) {
		bool flag = true;
		for (auto j : P) {
			if (i%j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i);
		flag = true;
		for (auto j : P) {
			if ((i + 2) % j == 0) {
				flag = false;
				break;
			}
		}
		if (flag)P.push_back(i + 2);
	}
	return P;
}
long long int power(long long int x, long long int n, long long int M) {
	long long int tmp = 1;

	if (n > 0) {
		tmp = power(x, n / 2, M);
		if (n % 2 == 0) tmp = (tmp*tmp) % M;
		else tmp = (((tmp*tmp) % M)*x) % M;
	}
	return tmp;
}

long long int N, M, K, Q, W, H;
long long int ans;
long long int pas[100001];


int main() {
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if (s.size() == 1) {
		cout << "0\n";
		return 0;
	}
	bool flag = true;
	for (int i = 1; i < s.size(); i++) {
		if (s[0] != s[i]) {
			flag = false;
		}
	}
	ans = 1000;
	if (flag) {
		cout << "0\n";
		return 0;
	}
	for (char i = 'a'; i <= 'z'; i++) {
		string t = s;
		int box = 0;
		while (1) {
			for (int j = 0; j < s.size() - box; j++) {
				if (t[j + 1] == i)t[j] = i;
			}
			box++;
			flag = true;
			for (int j = 0; j < s.size() - box; j++) {
				if (i != t[j]) {
					flag = false;
				}
			}
			if (flag) {
				ans = min((int)ans, box);
				break;
			}
		}
		//cout << i << " " << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  long long int n,k;
  cin>>n>>k;
  long long int min;
  min=n;long long int x=abs(n-(n/k)*k);
  long long int y=abs(x-k);
  if(x<y)
  {cout<<x;}
  else{cout<<y;}
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		long[] h = new long[N];
		for (int i = 0; i < h.length; i++) {
			h[i] = sc.nextLong();
		}
		sc.close();
		for (int i = 0; i < h.length - 1; i++) {
			if (h[i] > h[i + 1])
				h[i]--;
			else if (i != 0 && (h[i] - h[i - 1]) >= 1)
				h[i]--;
		}
		for (int i = 0; i < h.length - 1; i++) {
			if (h[i] > h[i + 1]) {
				System.out.println("No");
				return;
			}
		}
		System.out.println("Yes");
	}
}

Measured memory_bytes: 52548
for e in iter(input,'0'):
    a=list({tuple(map(int, input().split())) for i in range(int(e))})
    s,t=a[0]
    b={tuple(map(int, input().split())) for i in range(int(input()))}
    for x,y in b:
        flag = True
        for u,v in a[1:]:
            if (x + u - s, y + v - t) not in b:
                flag = False
                break

        if flag == True:
            print(x - s, y - t)
            break


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

#define rep(i, a) for (int i = 0; i < (a); ++i)
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define FORV(a, A) for (auto &a : A)

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

void Main() {
  int n;
  cin >> n;
  vector<P> A[n];
  rep(i, n) {
    int a;
    cin >> a;
    rep(j, a) {
      int x, y;
      cin >> x >> y;
      x--;
      A[i].emplace_back(x, y);
    }
  }
  int ans = 0;
  rep(s, 1<<n) {
    int score = 0;
    vector<int> sh(n, 0);
    rep(i, n) {
      if ((s>>i) & 1) {
        sh[i] = 1;
        score++;
      }
    }
    int flag = 1;
    rep(i, n) {
      if (!sh[i]) continue;
      for(auto a : A[i]) {
        int v = a.first;
        if (sh[v] != a.second) {
          flag = 0;
          break;
        }
      }
    }
    if (flag) {
      ans = max(score, ans);
    }
  }
  cout << ans << endl;
}

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
package main

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

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

	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	a := make([]int, n)
	for i := range a {
		sc.Scan()
		a[i], _ = strconv.Atoi(sc.Text())
	}
	sc.Scan()
	q, _ = strconv.Atoi(sc.Text())

	ans := 0
	for i := 0; i < q; i++ {
		sc.Scan()
		t, _ := strconv.Atoi(sc.Text())
		ok := false
		for _, e := range a {
			if e == t {
				ok = true
				break
			}
		}
		if ok {
			ans++
		}
	}
	fmt.Println(ans)
}



Measured memory_bytes: 1232
import Control.Monad
import Data.List
import qualified Data.ByteString.Char8 as BS

main=do
    [n,t]<-map read.words<$>getLine::IO[Int]
    print =<< fst.foldl (f t) (0,0).unfoldr (BS.readInt.BS.dropWhile(==' '))<$>BS.getLine

f::Int->(Int,Int)->Int->(Int,Int)
f t (c,s) x
    | s<x  = (c+t,x+t)
    | True = (c+x+t-s, x+t)


Measured memory_bytes: 28028
s = gets.chomp
q = gets.to_i
ir = false
tl = []
hd = []
q.times {
  q = gets.chomp.split(" ")
  if q[0] == "1"
    ir = !ir
  else
    if q[1] == "1"
      if ir == false
        hd << q[2]
      else
        tl << q[2]
      end
    else
      if ir == false
        tl << q[2]
      else
        hd << q[2]
      end
    end
  end
}

s = hd.join("").reverse + s + tl.join("")
puts ir == false ? s : s.reverse


Measured memory_bytes: 17404
#include<bits/stdc++.h>
using namespace std;
#define M 10007
int main(void) {
	int n;
	cin >> n;
	char s[n + 1];
	cin >> s;
	int a[n];
	for(int i = 0; i < n; i++){
		if(s[i] == 'J') a[i] = 2;
		if(s[i] == 'O') a[i] = 1;
		if(s[i] == 'I') a[i] = 0;
	}
	int dp[n + 1][8];
	fill(dp[0], dp[n + 1], 0);
	for(int i = 1; i < 8; i++) if((i >> 2 & 1) && (i >> a[0] & 1)) dp[0][i] = 1;
	for(int i = 0; i < n - 1; i++){
		for(int j = 1; j < 8; j++){
			if(dp[i][j] > 0){
				for(int k = 1; k < 8; k++){
					if((k >> a[i+1] & 1) && (j & k))
						dp[i + 1][k] = (dp[i + 1][k] + dp[i][j]) % M;
				}
			}
		}
	}
	int sum = 0;
	for(int i = 1; i < 8; i++) sum += dp[n - 1][i];
	sum %= M;
	cout << sum <<endl;
	return 0;
}


Measured memory_bytes: 3148
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    int odd_cnt = 0;
    for( int i = 0; i < n; ++i ) {
        int a;
        cin >> a;
        if( a % 2 ) ++odd_cnt;

    }
    if( odd_cnt % 2 ) cout << "NO";
    else cout << "YES";
    cout << endl;
    return 0;
}



Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) {
		
		int i, a = 0, w = 0, t = 0, r = 0;
		Scanner myScanner = new Scanner(System.in);
		List <String> array = new ArrayList<>();
		
		i = myScanner.nextInt();
		while(i >= 0) {
			array.add(myScanner.nextLine());
			i --;
		}
		
		Collections.sort(array);
		
		for(int j = 0; j < array.size(); j ++) {
			if(array.get(j).equals("AC"))
				a ++;
			else if(array.get(j).equals("RE"))
				r ++;
			else if(array.get(j).equals("TLE"))
				t ++;
			else if(array.get(j).equals("WA"))
				w ++;
		}
		System.out.println("AC x " + a);
		System.out.println("WA x " + w);
		System.out.println("TLE x " + t);
		System.out.println("RE x " + r);
		
		myScanner.close();
	}
}


Measured memory_bytes: 65460
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
using ll=long long;
static const ll mod = 1e9 + 7;
static  ll INF = 1e9;
using namespace std;

//ワーシャルフロイド法
int d[105][105];int n;

void warshall_floyd(){
	for(int k=0;k<n;++k){
		for(int i=0;i<n;++i){
			for(int j=0;j<n;++j)d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
		}
	}
}

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


Measured memory_bytes: 256
use std::io::*;
use std::str::FromStr;

fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn switch_number(n1: &mut i32, n2: &mut i32) {
    let tmp = *n1;
    *n1 = *n2;
    *n2 = tmp;
}

fn main() {
    let mut n: i128 = read();
    let mut k: i128 = read();

    let t1 = n % k;
    let t2 = (t1 - k).abs();

    if t1 > t2 {
        println!("{}", t2)
    } else {
        println!("{}", t1)
    }
}


Measured memory_bytes: 2132
#include <iostream>
#include <algorithm>
#include <functional>
#include <string>
#include <vector>
#include <utility>
using namespace std;
#define MAXSIZE 200
#define MAXL 100
typedef long long int lli;

int main(){
    int a, b, t;
    cin >> a >> b >> t;
    double cur_time = 0.0;
    int ans = 0;
    while(cur_time + (double)a < (double)t + 0.5){
        ans += b;
        cur_time += (double)a;
        //cout << "cur_time = " << cur_time << endl;
        //cout << "ans = " << ans << endl;
    }
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/




int N, A[2][101], dp[2][101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(y, 0, 2) rep(x, 0, N) cin >> A[y][x];

    dp[0][0] = A[0][0];
    rep(y, 0, 2) rep(x, 0, N) {
        if (x) chmax(dp[y][x], dp[y][x - 1] + A[y][x]);
        if (y) chmax(dp[y][x], dp[y - 1][x] + A[y][x]);
    }

    cout << dp[1][N - 1] << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n)  for(int i=0;i<(n);++i)
#define ALL(x) (x).begin(),(x).end()
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main() {
  typedef long long ll;
  int A, B, K;
  cin >> A >> B >> K;
  
  int count = 0;
  int i = gcd(A, B);
  while (count < K) {
    if (A % i == 0 && B % i == 0) {
      count++;
    }
    i--;
  }
  cout << i + 1 << endl;
}


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

#define fo(i,s,t) for(int i = s; i <= t; ++ i)
#define fd(i,s,t) for(int i = s; i >= t; -- i)
#define go(i,s) for(int i = head[s]; i; i = e[i].next)
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
typedef long long ll;
typedef unsigned long long ull;
typedef double db;

const int maxn = 100050;

int n, m, a[maxn], b[maxn], c[maxn], d[maxn];

int main()
{
	cin >> n >> m;
	fo(i,1,n) cin >> a[i] >> b[i];
	fo(i,1,m) cin >> c[i] >> d[i];
	fo(i,1,n) 
	{
		int cur = 1<<30, t = 0, res;
		fo(j,1,m)
		{
			t = abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(cur > t) res = j, cur = t;
		}
		printf("%d\n",res);
	}
	return 0;
}

Measured memory_bytes: 256
import sys
s=0
i=0
for e in sys.stdin:
    ex,ey=map(float,e[:-1].split(","))
    if i==0:x0,y0=ex,ey
    elif i==1:x1,y1=ex-x0,ey-y0
    else: 
        x2,y2=ex-x0,ey-y0
        s+=abs(x1*y2-x2*y1)
        x1,y1=x2,y2
    i+=1
print s/2

Measured memory_bytes: 4232
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <utility>
#include <vector>
typedef unsigned int U;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
using std::cin; using std::cout;
using std::endl; using std::cerr;
using std::bitset; using std::map;
using std::queue; using std::priority_queue;
using std::set; using std::string;
using std::vector;
using std::pair; using std::make_pair;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef pair<ULL, ULL> puu;
#ifdef DEBUG
#define pass cerr << "[" << __FUNCTION__ << "] : line = " << __LINE__ << endl;
#define display(x) cerr << #x << " = " << x << endl;
#define displaya(a, st, n) { cerr << #a << " = {"; \
      for(int qwq = (st); qwq <= (n); ++qwq) cerr << a[qwq] << (qwq == (n) ? '}' : ',') << (qwq == (n) ? '\n' : ' '); }
#define displayv(a) display(a, 0, (int)(a.size()-1))
#include <ctime>
class MyTimer {
  clock_t st;
public:
  MyTimer() { cerr << std::fixed << std::setprecision(0); reset(); }
  ~MyTimer() { report(); }
  void reset() { st = clock_t(); }
  void report() {  cerr << "Time consumed: " << (clock() - st) * 1e3 / CLOCKS_PER_SEC << "ms" << endl; }
} myTimer;
#else
#define pass ;
#define display(x) ;
#define displaya(a, st, n) {}
#define displayv(a) {}
class MyTimer {
public: void reset() {} void report() {}
} myTimer;
#endif

template<typename T1, typename T2>
inline bool chmin(T1 &a, const T2 &b) { return a > b ? a = b, true : false; }
template<typename T1, typename T2>
inline bool chmax(T1 &a, const T2 &b) { return a < b ? a = b, true : false; }
#ifdef QUICK_READ
char pool[1<<15|1],*it=pool+32768;
#define getchar() (it>=pool+32768?(pool[fread(pool,sizeof(char),1<<15,stdin)]=EOF,*((it=pool)++)):*(it++))
#endif
inline int readint() {
  int a = 0; char c = getchar(), p = 0;
  while(isspace(c)) c = getchar();
  if(c == '-') p = 1, c = getchar();
  while(isdigit(c)) a = a*10 + c - '0', c = getchar();
  return p ? -a : a;
}
inline LL readLL() {
  LL a = 0; char c = getchar(), p = 0;
  while(isspace(c)) c = getchar();
  if(c == '-') p = 1, c = getchar();
  while(isdigit(c)) a = a*10 + c - '0', c = getchar();
  return p ? -a : a;
}

const int maxN = 100000 + 233;
const int maxA = 1000000000 + 233;
int n, len, q, x[maxN], f[20][maxN];

int main() {
  n = readint();
  for(int i = 1; i <= n; ++i) x[i] = readint();
  len = readint();
  f[0][n] = n;
  for(int i = n - 1; i >= 1; --i) {
    for(f[0][i] = f[0][i + 1]; x[f[0][i]] - x[i] > len; --f[0][i]);
  }
  for(int k = 1; k < 20; ++k)
    for(int i = 1; i <= n; ++i)
      f[k][i] = f[k - 1][f[k - 1][i]];
  q = readint();
  while(q--) {
    int x = readint(), y = readint();
    if(x > y) std::swap(x, y);
    if(x == y) {
    	printf("0\n"); continue;
		}
    int ans = 0;
    for(int i = 19; i >= 0; --i) {
      if(f[i][x] < y) x = f[i][x], ans += (1 << i);
    }
    assert(f[0][x] >= y);
    ++ans;
    printf("%d\n", ans);
  }
  return 0;
}

Measured memory_bytes: 9088
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
int n;
bool used[100];
bool notused[100];
vector<int> G[100];
int dfs(int x, int cnt) {
    int res=cnt;
    used[x]=true;
    notused[x]=false;
    for (int i=0; i<G[x].size(); i++) {
        int y=G[x][i];
        if (used[y]) continue;
        res=max(res,dfs(y,cnt+1));
    }
    used[x]=false;
    return res;
}
int main() {
    while (scanf("%d",&n)) {
        if (!n) break;
        memset(used, 0, sizeof(used));
        memset(notused, 0, sizeof(notused));
        for (int i=0; i<100; i++) G[i].clear();
        for (int i=0; i<n; i++) {
            int a, b; scanf("%d%d",&a,&b);
            G[a-1].push_back(b-1);
            G[b-1].push_back(a-1);
            notused[a-1]=notused[b-1]=true;
        }
        int res=0;
        for (int j=1;;j++) {
            for (int i=0; i<100; i++) {
                if (G[i].size()!=j) continue;
                res=max(res,dfs(i,1));
            }
            bool isbreak=true;
            for (int i=0; i<100; i++) {
                if (notused[i]) {
                    isbreak=false;
                    break;
                }
            }
            if (isbreak) break;
        }
        printf("%d\n",res);
    }
}

Measured memory_bytes: 820
#include<iostream>
#include<cstdio>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<map>
#include<numeric>
#include<stack>
#include<queue>
#include<functional>
#include<cassert>
#include<set>
#include<numeric>
#define rep(a,b) for(ll a=0;a<b;++a)
#define REP(a,b,c,d) for(ll a=b;a<c;a+=d)
#define yes cout<<"Yes"<<endl
#define no cout<<"No"<<endl
#define mod 1000000007
using namespace std;
using ll = long long;
using p_i = pair<int, int>;
int main() {
	int H, W, h, w; cin >> H >> W >> h >> w;
	cout << H * W - h * W - (w * H - w * h) << endl;
	cin >> H;
}

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

int main() {
vector<long long> sets(200010,0);
vector<long long> cats(200010,0);
long long N;
cin>>N;
for(long long i=0; i<N; i++){
    long long a;
    cin>>a;
    a--;
    cats[i]=a;
    sets[a]+=1;
    
}
long long sum=0;
for(long long i=0; i<N; i++){
    sum+=(sets[i]*(sets[i]-1))/2;
}

for(long long i=0; i<N; i++){
    if(sets[cats[i]]!=0){
    sum-=(sets[cats[i]]-1);
 cout<<sum<<endl;
 sum+=(sets[cats[i]]-1);
}
}
}


Measured memory_bytes: 5760
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl 	"\n"

typedef vector< ll > 	vi;
typedef vector< vi > 	vvi;
typedef pair< ll,ll > 	ii;
#define pb 		push_back
#define all(c) 		(c).begin(),(c).end()
#define tr(c,i) 	for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) 	((c).find(x) != (c).end())

#define MOD 	1000000007
#define INF 	(int)1e9
#define MEM(a, b) memset(a, (b), sizeof(a))

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

	ll n,x;
	cin>>n;
	vi v;
	for(ll i=0; i<n; i++)
	{
		cin>>x; v.pb(x);
	}

	if(is_sorted(all(v)))
		{ cout<<"Yes"; return 0;}
	bool flag=true;
	for(ll i=n-1; i>0; i--)
	{
		if(v[i] < v[i-1] )
			v[i-1]--;
	}

	//for(ll i=0; i<n; i++)
	//	cout<<v[i]<<" ";

	if(is_sorted(all(v)))
		{ cout<<"Yes"; return 0; }
	else cout<<"No";

	return 0;
	
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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 (a>b) { a=b; return 1; } return 0; }

#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin>>N;
    vi S(N);
    rep(i,N) cin>>S[i];
    int M; cin>>M;
    vi T(N);
    rep(i,M) cin>>T[i];
    sort(all(S));
    int ans=0;
    rep(i,M){
        if (binary_search(all(S),T[i])) ans++;
    }
    cout<<ans<<"\n";
    return 0;
}



Measured memory_bytes: 3540
use std::io::prelude::*;

fn input<T>() -> T
where
    T: std::str::FromStr,
{
    let stdin = std::io::stdin();
    let token: String = stdin
        .lock()
        .bytes()
        .map(|c| c.unwrap() as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().unwrap()
}

fn main() {
    let n: usize = input();
    let k: usize = input();

    let m = (n - 1) * (n - 2) / 2;
    if k > m {
        println!("-1");
        return;
    }

    let mut v = vec![];
    for i in 2..n + 1 {
        v.push((1, i));
    }

    let mut k = m - k;
    for i in 2..n {
        for j in i + 1..n + 1 {
            if k <= 0 {
                break;
            }
            v.push((i, j));
            k -= 1;
        }
        if k <= 0 {
            break;
        }
    }

    println!("{}", v.len());
    for (u, v) in v {
        println!("{} {}", u, v);
    }
}


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

int main() {
    while (1) {
        int a, b, c, N;
        cin >> a >> b >> c;
        if (a == 0 && b == 0 && c == 0) break;

        int data[1002][5], cmp[303];
        for (int i = 1; i <= a + b + c; i++) {
            cmp[i] = 2;
        }
        cin >> N;
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < 4; j++) {
                cin >> data[i][j];
            }
            if (data[i][3] == 1) {
                for (int k = 0; k < 3; k++) {
                    cmp[data[i][k]] = 1;
                }
            }
        }
        for (int i = 0; i < N; i++) {
            if (data[i][3] == 0) {
                int cnt = 0;
                for (int j = 0; j < 3; j++) {
                    if (cmp[data[i][j]] == 1) cnt++;
                }
                if (cnt == 2) {
                    for (int j = 0; j < 3; j++) {
                        if (cmp[data[i][j]] != 1) cmp[data[i][j]] = 0;
                    }
                }
            }
        }
        for (int i = 1; i <= a + b + c; i++) {
            cout << cmp[i] << endl;
        }
    }
    return 0;
}

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

int sum=0;
void gcd(int a,int b,int c){
    int x=min(min(a,b),c);
        for(int y=x;y>0;y--){
            if(a%y==0 && b%y==0 && c%y==0){
                sum=sum+y;
                break;
            }
        }
    }

int main (){
    int K;
    cin >> K;
    for(int i=1;i<=K;i++){
        for(int j=1;j<=K;j++){
            for(int k=1;k<=K;k++){
                gcd(i,j,k);
            }
        }
    }
    cout << sum <<endl;
}

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

//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int MOD = 1000000007;

// grid
//--------------------------------------------
VL dx = {0, 1, 0, -1};
VL dy = {1, 0, -1, 0};
VL dx2 = {-1, 0, 1, -1, 1, -1, 0, 1};
VL dy2 = {-1, -1, -1, 0, 0, 1, 1, 1};

//debug
//--------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//IO accelerate
//--------------------------------------------
struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

//template
//--------------------------------------------
template<typename T>
istream& operator >>(istream& is, vector<T>& vec) {
  for(T& x: vec) is >> x;
  return is;
}
template<typename T>
ostream& operator <<(ostream& os, const vector<T>& vec) {
  for(int i=0; i<vec.size(); i++){
    os << vec[i] << ( i+1 == vec.size() ? "" : "\t" );
  }
  return os;
}
template<typename T>
ostream& operator <<(ostream& s, const vector<vector<T>>& vv) {
	for (int i = 0; i < vv.size(); ++i) {
		s << vv[i] << endl;
	}
	return s;
}

//main code

int main(int argc, char const* argv[])
{
	int k,t;
	cin >> k >> t;
	VL a(t);
	cin >> a;
	sort(RALL(a));
	int amax = a[0];
	int other = 0;
	for (int i = 1; i < t; i++) {
		other += a[i];
	}
	cout << max(0,amax - other - 1) << endl;

	return 0;
}


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

int main(){
	long long n,a,b;
	cin >> n >> a >> b;
	long long r = n - 2;
	long long mini = a + b + a * r;
	long long maxi = a + b + b * r;
	if(a > b)cout << 0 << endl;
	else if(a == b && n == 1)cout << 1 << endl;
	else if(n < 2)cout << 0 << endl;
	else cout << maxi - mini + 1 << endl;
	return 0;
}

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

int main() {
    int     a,b,h,c,i,j,k,n,m,x,y,ans = 0;
    string  str;

    cin >> h >> a;

    ans = ( h + a - 1 ) /a;

    cout << ans << endl;


}


Measured memory_bytes: 256
#include<stdio.h>

void trace(int array[],int N){
    int i;
    for(i=0; i<N; i++){
        if(i>0) printf(" ");
        printf("%d", array[i]);
    }
    printf("\n");
}

void insertionSort(int array[], int N){
    int j, i, v;
    for(i=1; i<N; i++){
        v = array[i];
        j = i - 1;
        while(j>=0 && array[j]>v){
            array[j + 1] = array[j];
            j--;
        }
        array[j+1]=v;
        trace(array,N);
    }
}

int main(){

    int i,N,j;
    int array[100]={};
    scanf("%d", &N);
    for(i=0; i <= N-1; i++) scanf("%d", &array[i]);

    trace(array,N);
    insertionSort(array,N);

    return 0;
}


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

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> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll INF =1LL << 62;
const int inf =1 << 29;

int n,k,t,u,v,l;

int d[210];

int main(void){
	cin >> n >> k >> t >> u >> v >> l;
	rep(i,n) cin >> d[i];d[n]=l;
	double ans=0.0,res=0.0,num=0;
	rep(i,n+1){
		double dist=d[i];
		if(i-1>=0) dist-=d[i-1];
		while(dist>0.0){
			if(res>0.0){
				ans+=min(dist/v,res);
				double ndist=dist-min(dist,res*v);
				double nres=res-min(dist/v,res);
				dist=ndist,res=nres;
			}
			if(num>0&&res==0.0) res=t,num--;
			if(res==0.0) ans+=1.0*dist/u,dist=0.0;
		}
		if(num==k)
			res=t;
		else
			num++;
	}
	cout.precision(10);
	cout << fixed << ans << endl;
	return 0;
}

Measured memory_bytes: 1236
s = int(input())
def f(n):
    if n % 2 == 0:
        return n // 2
    else:
        return 3*n + 1
A = [s]
i = 2
while True:
    ai = f(A[-1])
    if ai in A:
        print(i)
        break
    A.append(ai)
    i += 1

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int ans = 0;
  int cnt = 0;
  for(int i=0; i<n; i++){
    if(s[i]=='I'){
      cnt++;
      ans = max(ans, cnt);
    }else{
      cnt--;
    }
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<queue>
#include<string>
#include<algorithm>
#include<map>
#include<cstring>
#include<string.h>
using namespace std;
int main()
{
	string str;
	cin>>str;
	for(int i=0;i<str.size()-1&&str.size()>0;i++)
	{
		if(str[i]=='S'&&str[i+1]=='T')
		{
			//cout<<str.size()<<" "<<i<<endl;
			str.erase(i,2);	
			if(i!=0)
			{
				i=i-2;
			}
			if(i==0)
			{
				i--;
			}
		}
	}
	cout<<str.size()<<endl;
	return 0;
} 

Measured memory_bytes: 640
# coding: utf-8
# Your code here!

import sys
sys.setrecursionlimit(10**6)
readline = sys.stdin.readline

n,m = [int(i) for i in readline().split()]

ALL = 1<<n
dp = [10**9]*ALL
dp[0] = 0
for i in range(m):
    ndp = dp[:]
    a,b = [int(i) for i in readline().split()]
    c = [int(i)-1 for i in readline().split()]
    
    C = 0
    for i in c:
        C |= 1<<i
    
    for S in range(ALL):
        ndp[S|C] = min(ndp[S|C], dp[S] + a)
    
    dp = ndp

#    print(dp)


if dp[-1] == 10**9: print(-1)
else: print(dp[-1])
    
        
        






Measured memory_bytes: 44124
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n, c, k;
    cin >> n >> c >> k;
    vector<int> a;
    for(int i = 0; i < n; i++) {int b; cin >> b; a.push_back(b);}
    sort(a.begin(), a.end(), greater<int>());
    int cnt = 0, time;
    for(int i = 0; i < n;){
        time = a[i];
        cnt++;
        int pass = 0;
        while(true){
            if(i >= n) break;
            i++;
            pass++;
            if(!(pass < c && time - a[i] <= k)) break;
        }
    }
    cout << cnt << endl;
}


Measured memory_bytes: 892
function main()
    N,K = reads(Int,Int)
    a = readvec(Int,N)
    next = zeros(Int, N)
    for j in 1:K
        next .= 0
        for i in 1:N
            l = max(1, i-a[i])
            r = min(N, i+a[i])
            next[l] += 1
            r != N && (next[r+1] -= 1)
        end
        for i in 2:N
            next[i] += next[i-1]
        end
        a == next && break
        a .= next
    end
    for i in 1:N
        if i == N
            println(a[i])
            return
        end
        print(a[i]," ")
    end
end

import Base.parse
import Base.StringVector

parse(::Type{String},  str::AbstractString) = str
isdelim(x::UInt8, xs::Set{UInt8}) = x in xs
const delimset = Set([0x0a, 0x20])

function myreaduntil(s::IO, delims::Set{UInt8})::Vector{UInt8}
    out = StringVector(0)
    c::UInt8 = 0x00
    while !eof(s)
        c = read(s, UInt8)
        !isdelim(c, delims) && break
    end
    push!(out, c)
    eof(s) && return out
    while !eof(s)
        c = read(s, UInt8)
        isdelim(c, delims) && break
        push!(out, c)
    end
    return out
end

function readword(io::IO = stdin, delims = delimset)::String
    word = myreaduntil(io, delims)
    i = length(word)
    if i == 0 || word[i] != 0x0a
        return String(word)
    elseif i < 2 || word[i-1] != 0x0d
        return String(resize!(word,i-1))
    else
        return String(resize!(word,i-2))
    end
end

pread(ty) = parse(ty, readword())

reads(tys...)::Tuple{tys...} = Tuple{tys...}(pread(ty) for ty in tys)

function readvec(tys::Tuple , len::Signed)::Tuple{map(x -> Vector{x},tys)...}
    rv = Tuple{map(x -> Vector{x},tys)...}(Vector{ty}(undef,len) for ty in tys)
    for i in 1:len
        for j in 1:length(tys)
            @inbounds rv[j][i] = pread(tys[j])
        end
    end
    rv
end

readvec(ty::Type, len::Signed)::Vector{ty} = @inbounds ty[pread(ty) for i in 1:len]

function readmat(ty::Type, s...)::Matrix{ty}
    v = Matrix{ty}(undef, s...)
    @inbounds for i in 1:s[1]
        v[i,:] = readvec(ty, s[2])
    end
    v
end

main()


Measured memory_bytes: 239692
import sys

def main():
    N = int(input())
    A = list(map(int, input().split()))

    lis=[]
    for i in range(N):
        lis.append([A[i], i+1])

    lis.sort()
    for li in lis:
        print(li[1], end=" ")

    print()

main()

Measured memory_bytes: 21364
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;

#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define pll pair<ll,ll> 
#define vpll vector<pll>
#define all(X) X.begin(),X.end()
#define endl "\n"
int dp[100050][3],abc[100050][3];
int main()
{
    int n;
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>abc[i][0]>>abc[i][1]>>abc[i][2];
    }
    dp[0][0]=abc[0][0];
    dp[0][1]=abc[0][1];
    dp[0][2]=abc[0][2];
    for(int i=1;i<n;i++)
    {
        dp[i][0] = max(dp[i-1][1],dp[i-1][2])+abc[i][0];
        dp[i][1] = max(dp[i-1][0],dp[i-1][2])+abc[i][1];
        dp[i][2] = max(dp[i-1][1],dp[i-1][0])+abc[i][2];
    }
    cout<<max(max(dp[n-1][0],dp[n-1][1]),dp[n-1][2])<<"\n";
}


Measured memory_bytes: 2560
parseInt(x::String) = parse(Int, x)
parseInt(x::SubString{String}) = parse(Int, x)
parseInt(x::Char) = parse(Int, x)
parseInt(x::Float64) = trunc(Int, x)
parseFloat(x::String) = parse(Float64, x)
parseFloat(x::Int) = trunc(Float64, x)
parseFloat(x::SubString{String}) = parse(Float64, x)
parseFloat(x::Char) = parse(Float64, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    x,y=parseMap(split(readline()))
    a=[[1,3,5,7,8,10,12],[4,6,9,11],[2]]
    ans="No"
    for i in 1:3
        if ((x in a[i]) && (y in a[i]))
            ans="Yes"
        end
    end
    println(ans)
end
main()

Measured memory_bytes: 168760
N, M = map(int, input().split())
A = [input() for _ in range(N)]
B = [input() for _ in range(M)]

exist = False
for i in range(N-M+1):
    for j in range(N-M+1):
        match = True
        for k in range(M):
            for l in range(M):
                if A[i+k][j+l] != B[k][l]:
                    match = False
        if match:
            exist = True
if exist:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  string S; cin>>S;
  ll K; cin>>K;
  ll ichi_num=0;
  for(int i=0;i<S.length();i++){
    if(S[i]=='1') ichi_num++;
    else break;
  }
  if(K<=ichi_num) cout<<'1'<<endl;
  else cout<<S[ichi_num]<<endl;
  return 0;
}

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

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

constexpr llong mod = 1e9+7;
constexpr llong inf = mod * mod;

int main() {
  llong N, K;
  vector<llong> A;

  cin >> N >> K;
  A.resize(N);
  for (auto &in: A) {
    cin >> in;
  }

  llong ok = inf, ng = 0;
  while (abs(ok - ng) > 1) {
    llong mid = (ok + ng) >> 1;
    llong res = 0;
    for (auto a: A) {
      res += a / mid + (a % mid == 0 ? -1: 0);
    }

    (res <= K ? ok: ng) = mid;
  }

  cout << ok << endl;

  return 0;
}

Measured memory_bytes: 4840
program ccc
implicit none

integer(8) :: n, k, i, res
integer(8),allocatable,dimension(:) :: h

read*, n, k
allocate(h(n))
read*, h

call heapsort(n,h)

res = 0
do i = 1, n-k
res = res + h(i)
end do

print*, res

end program

subroutine heapsort(n,array)
  implicit none
  integer(8),intent(in) :: n
  integer(8),intent(inout) :: array(1:n)
 
  integer(8) ::i,k,j,l
  integer(8) :: t
 
  if(n.le.0)then
     write(6,*)"Error, at heapsort"; stop
  endif
  if(n.eq.1)return

  l=n/2+1
  k=n
  do while(k.ne.1)
     if(l.gt.1)then
        l=l-1
        t=array(L)
     else
        t=array(k)
        array(k)=array(1)
        k=k-1
        if(k.eq.1) then
           array(1)=t
           exit
        endif
     endif
     i=l
     j=l+l
     do while(j.le.k)
        if(j.lt.k)then
           if(array(j).lt.array(j+1))j=j+1
        endif
        if (t.lt.array(j))then
           array(i)=array(j)
           i=j
           j=j+j
        else
           j=k+1
        endif
     enddo
     array(i)=t
  enddo

  return
end subroutine heapsort

Measured memory_bytes: 2304
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  ll N = 0,K = 0,Q = 0,M = 0;
  cin >> N >> K >> Q;
  vector<ll>count(N);
  rep(i,Q){
    cin >> M;
    count[M - 1]++;
  }
  rep(i,N){
    if(count[i] + K - Q > 0){
      cout << "Yes" << endl;
    }
    else{
      cout << "No" << endl;
    }
  }
}
    

Measured memory_bytes: 1408
use proconio::{input, fastout};
use num::BigInt;

#[fastout]
fn main() {
    input! {
        a: i64,
        mut b: String,
    }

    b.retain(|c| c != '.');

    let num = b.parse::<i64>().unwrap();
    let mut mul = a * num;

    mul /= 100;

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

Measured memory_bytes: 2172
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

	ll m = n % 10;
	if (m == 3)
	{
		println("bon");
	}
	else if	(m == 0 || m == 1 ||m == 6 || m == 8)
	{
		println("pon");
	}
	else
	{
		println("hon");
	}
}


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



int main() {
  int k;
  cin >> k;
  string s;
  cin >> s;
  vector<char> t={};
  if(s.size()<=k){
    cout << s << endl;
    return 0;
  }
  else {
    rep(i,k){
      t.push_back(s[i]);
    }
  }
  rep(i,k){
    cout << t[i];
  }
  cout << "..." << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
using VecP = vector<P>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); ++(i))
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); --(i))
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	string s;
	cin >> s;
	ll len = s.length();
	Vec a(len);
	rep(i, len) a[i] = s[i]-'0';

	ll ans = LINF, cnt = 0, n = 0;
	rep(i, len){
		if(n != a[i]) cnt++;
		n = !n;
	}
	ans = min(ans, cnt);
	cnt = 0, n = 1;
	rep(i, len){
		if(n != a[i]) cnt++;
		n = !n;
	}
	ans = min(ans, cnt);
	co(ans);

	return 0;
}


Measured memory_bytes: 1280