akhauriyash/Code-Regression huggingface dataset:
package main

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

func nextInt(scanner *bufio.Scanner) int {
	scanner.Scan()
	num, _ := strconv.Atoi(scanner.Text())
	return num
}

func scanIntArray() []int {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	n := nextInt(sc)
	result := []int{}
	for i := 0; i < n; i++ {
		result = append(result, nextInt(sc))
	}

	return result
}

func main() {
	input := scanIntArray()

	// make sorted array
	sortedArray := make([]int, len(input))
	copy(sortedArray, input)
	sort.Slice(sortedArray, func(i, j int) bool { return i < j })
	sort.Sort(sort.IntSlice(sortedArray))

	// counted idx array
	finishes := make([]bool, len(input))

	// minimum value in array
	minOfAll := sortedArray[0]

	total := 0

	for i := 0; i < len(input)-1; i++ {
		if finishes[i] {
			continue
		}

		if input[i] == sortedArray[i] {
			finishes[i] = true
			// already sorted
			continue
		}

		now := input[i]
		// total of values in block
		counta := 0
		// number of values in block
		num := 0
		// minimum number in block
		minOfBlock := math.MaxInt64

		for {
			idx := findIndexInSorted(now, sortedArray)

			// if true, this block is already proccessed
			if finishes[idx] {
				r1 := counta + minOfBlock + (num+1)*minOfAll
				r2 := counta + (num-2)*minOfBlock
				if r1 > r2 {
					total += r2
				} else {
					total += r1
				}
				break
			}

			if now < minOfBlock {
				minOfBlock = now
			}

			next := input[idx]
			counta += now
			num++
			finishes[idx] = true
			now = next
		}
	}

	fmt.Println(total)

}

func findIndexInSorted(val int, sorted []int) int {
	for i, v := range sorted {
		if val == v {
			return i
		}
	}

	return -1
}



Measured memory_bytes: 1160
#include <iostream>
#include <string.h>
#include <algorithm>
#include <cstring>
#include <math.h>
#define ll long long
ll gcd(ll a,ll b){
    ll s=1,c;
    while(a&&b){
        if((~a&1)&&(~b&1))
            a>>=1,b>>=1,s<<=1;
        else if(~a&1)a>>=1;
        else if(~b&1)b>>=1;
        else if(a>b)a=a-b;
        else c=b-a,b=a,a=c;
    }
    if(!a)return b*s;
    if(!b)return a*s;
}
using namespace std;
int main(){
	ll n;
	cin>>n;
	int i=0;
	int a[1000];
	while(n){
		int k=n%26;
		a[i]=k;
		if(k==0)
		n=n-1;
		n=n/26;
		i++;
	}
	for(int j=i-1;j>=0;j--){
		char ch='a'+a[j]-1;
		if(a[j]==0)
		cout<<'z';
		else
		cout<<ch;
}
	return 0;
}

Measured memory_bytes: 3628
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000


int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N; cin >> N;
    int K; cin >> K;
    int digit = 0;
    while(N > 0) {
        digit++;
        N /= K;
    }
    cout << digit << endl;
    return 0;
}


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

int main(){
  string s;
  int l;
  cin >> s;
  l = s.size();
  int m = 1000;
  for (int i = 0;i < l-2;i++){
    m = min(m,abs((s[i]-'0')*100+(s[i+1]-'0')*10+(s[i+2]-'0')-753));
  }
  cout << m << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>

#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) obj.begin,obj.end()
#define SORT(list) sort(ALL(list));
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    int v;
   vector <int> even(100005,0),odd(100005,0);


    REP(i,n){
        cin >> v;
        if(i%2==1){
            odd.at(v)++;
        }
        else{
            even.at(v)++;   
        }
    }
    int mode_odd,mode_even;
    mode_odd = max_element(odd.begin(),odd.end())-odd.begin();
    mode_even = max_element(even.begin(),even.end())-even.begin();

    sort(odd.begin(),odd.end());
    reverse(odd.begin(),odd.end());
    sort(even.begin(),even.end());
    reverse(even.begin(),even.end());

    if(mode_odd != mode_even){
        cout<< n-even.at(0) -odd.at(0) << endl;
    }
    else{
        cout << min(n-odd.at(0) -even.at(1),n-odd.at(1)-even.at(0)) << endl;
    }

    return 0;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <bits/stdc++.h>
#include<iostream>
#include<string>
using namespace std;
#define rep(i, n) for (int i = 0; i <(int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
int main(){
int a[3][3];
vector<vector<int>> ok(3,vector<int>(3,0));
rep(i,3){
    rep(j,3){
        cin>>a[i][j];
    }
}
int n;cin>>n;
int b[n];
rep(i,n)cin>>b[i];
rep(i,3){
    rep(j,3){
       rep(k,n){
           if(b[k]==a[i][j])ok[i][j]=1;
       }
   }
}
bool ans=false;
    if(ok[0][0]&&ok[0][1]&&ok[0][2])ans=true;
    if(ok[0][1]&&ok[1][1]&&ok[2][1])ans=true;
    if(ok[0][2]&&ok[1][2]&&ok[2][2])ans=true;
    if(ok[1][1]&&ok[1][0]&&ok[1][2])ans=true;
    if(ok[2][0]&&ok[2][1]&&ok[2][2])ans=true;
    if(ok[0][0]&&ok[1][0]&&ok[2][0])ans=true;
    if(ok[0][0]&&ok[1][1]&&ok[2][2])ans=true;
    if(ok[0][2]&&ok[1][1]&&ok[2][0])ans=true;
if(ans)cout<<"Yes"<<endl;
else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

#define rep(i, a, b) for (auto i = (a); i < (b); ++i)
#define per(i, a, b) for (auto i = (b) - 1; i >= (a); --i)
#define trav(x, v) for (auto &x : v)

#define sz(x) int((x).size())
#define eb(x...) emplace_back(x)
#define ff first
#define ss second

using ll = int64_t;

const int M = 1e9 + 7;

template<class T> bool ckmin(T& a, const T& b) { return a > b ? a = b, 1 : 0; }
template<class T> bool ckmax(T& a, const T& b) { return a < b ? a = b, 1 : 0; }

const int B = 21;
int dp[1 << B];

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

	int n; cin >> n;
	int a[n][n]; rep(i, 0, n) rep(j, 0, n) cin >> a[i][j];
	dp[0] = 1;
	rep(S, 0, 1 << n) {
		int i = __builtin_popcount(S);
		rep(j, 0, n)
			if ((~S & 1 << j) && a[i][j])
				(dp[S | 1 << j] += dp[S])	%= M;
	}
	cout << dp[(1 << n) - 1];
}

Measured memory_bytes: 8448
#include<bits/stdc++.h>
#define rep(i,n,m) for(int i = (n); i <(m); i++)
#define rrep(i,n,m) for(int i = (n) - 1; i >=(m); i--)
#define pvec(vec) {for (auto v: vec) cout << v << ' '; cout << endl;}
#define pivec(vec) {rep(i, 0, vec.size()) cout << i << ':' << vec[i] << ' '; cout << endl;}

using namespace std;
using ll = long long;

int main()
{
    int H, W, M;
    cin >> H >> W >> M;

    vector<pair<int, int>> tgts(M);
    unordered_map<int, int> y_cnt;
    unordered_map<int, int> x_cnt;
    rep(i, 0, M)
    {
        int h, w;
        cin >> h >> w;

        tgts.emplace_back(h, w);
        ++y_cnt[h];
        ++x_cnt[w];
    }

    // get maximum count
    int y_cnt_max = 0;
    int x_cnt_max = 0;
    for (auto item: y_cnt) y_cnt_max = max(y_cnt_max, item.second);
    for (auto item: x_cnt) x_cnt_max = max(x_cnt_max, item.second);

    // get max lines
    unordered_set<int> max_ys, max_xs;
    for (auto item: y_cnt) if (item.second == y_cnt_max) max_ys.insert(item.first);
    for (auto item: x_cnt) if (item.second == x_cnt_max) max_xs.insert(item.first);

    ll remain = (ll) max_ys.size() * max_xs.size();
    for (auto tgt: tgts)
    {
        if (max_ys.count(tgt.first)==0) continue;
        if (max_xs.count(tgt.second)==0) continue;
        --remain;
    }

    ll ans = y_cnt_max + x_cnt_max;
    if (remain == 0) --ans;

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



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

int main()
{
    int a,b;
    cin>>a>>b;
    if(a+b==3)
    {
        cout<<3<<endl;
    }
    else if(a+b==4)
    {
        cout<<2<<endl;
    }
    else
    {
        cout<<1<<endl;
    }
    
    return 0;
}

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

struct query{
	ll left;
	ll right;
	ll index;
};

ll arr[500001];
query Q[500001];

ll blk=1000;	//Block-size=sqrt(n)=sqrt(30000).we precompute it so to prevent runtime error.
ll frequency[500001];	//array to keep the frquency of the elements.
ll answer[500001];	//array to store the answers for all the given queries.
ll cnt=0;	//tells the distinct-elements for each query.
 
//we compare according to the left-range of the query.(in ascending order) 
bool compare(query a,query b){
	if(a.left/blk != b.left/blk)
		return (a.left/blk < b.left/blk);
	else
		return (a.right < b.right);
}
 
void add(ll pos){
	frequency[arr[pos]]++;
	if(frequency[arr[pos]]==1)
	cnt++;
}
 
void remove(ll pos){
	frequency[arr[pos]]--;
	if(frequency[arr[pos]]==0)
	cnt--;
}
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	ll n{0};
	ll q{0};
	cin>>n>>q;
	for(ll i=0;i<n;i++)
		cin>>arr[i];
	
	
	for(ll i=0;i<q;i++){
		cin>>Q[i].left>>Q[i].right;
		Q[i].index=i;
		Q[i].left--; 
		Q[i].right--;
	}
	
	sort(Q,Q+q,compare); //sorting the queries so we can reduce the movement of the global-left and global-right pointers.
	
	ll glo_left=0; //global-left pointer which point where the previous query started
	ll	glo_right=-1; //global-right pointer which point where the previous query ended
	for(ll i=0;i<q;i++){
		ll cur_left=Q[i].left; //current query left
		ll cur_right=Q[i].right; //current query right
		
		//to expand the previous range for the current range
		while(glo_left>cur_left){
			glo_left--;
			add(glo_left);
		}
		
		while(glo_right<cur_right){
			glo_right++;
			add(glo_right);
		}
	
 		
 		//to compress the previous range for the current range 
		while(glo_left<cur_left){
			remove(glo_left);
			glo_left++;
		}
 
		while(glo_right>cur_right){
			remove(glo_right);
			glo_right--;
		}
 
		answer[Q[i].index]=cnt;

	}
	
	for(ll i=0;i<q;i++)
		cout<<answer[i]<<endl;
}

Measured memory_bytes: 27232
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;

static class MainClass
{
    public static void Main(string[] args)
    {
        var nm = Console.ReadLine().SplittedStringToInt32List();
        var n = nm[0];
        var m = nm[1];

        var cm = Console.ReadLine().SplittedStringToInt32List();
        var dp = new int[m + 1, n + 1];
        for (int i = 0; i < m+1; i++)
        {
            for (int j = 0; j < n+1; j++)
            {
                dp[i, j] = INF;
            }
        }
        dp[0, 0] = 0;
        for (int i = 0; i < m; i++)
        {
            for (int j = 0; j <= n; j++)
            {
                if (j - cm[i] >= 0)
                    dp[i + 1, j] = Math.Min(dp[i, j], dp[i + 1, j - cm[i]] + 1);
                else
                    dp[i + 1, j] = dp[i, j];
            }
        }
        Console.WriteLine(dp[m,n]);
        Console.ReadLine();
    }
    

    #region ライブラリ
    public static long ToInt64(this string str) => long.Parse(str);
    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    public const int INF = int.MaxValue / 2;
    public const long LONGINF = long.MaxValue / 2;
    #endregion
}



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

// why am I so weak

const int MOD = 1e9 + 7;

int n, m;
int fact[100055];

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

	fact[0] = 1;

	for (int i = 1; i <= (int)1e5; i++) {
		fact[i] = (1ll * i * fact[i - 1]) % MOD;
	}

	if (abs(n - m) > 1) {
		puts("0");
		return 0;
	}

	if (n == m) {
		printf("%lld\n", 2ll * fact[n] * fact[m] % MOD);
	} else {
		printf("%lld\n", 1ll * fact[n] * fact[m] % MOD);
	}

	return 0;
}


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

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  int l=0,r=0;
  l=a+b;
  r=c+d;
  if(l==r){cout<<"Balanced";}
  else if(l<r){cout <<"Right";}
  else{cout <<"Left";}
  return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

void  test_case()
{
int l,r,d,cnt=0;;
cin>>l>>r>>d;
for(int i=l;i<=r;++i)
{
if(i%d==0)
{
cnt++;
}
}
cout<<cnt<<"\n";
}
int main()
{
int tc=1;
//cin>>tc;
while(tc--)
{
test_case();
}
return 0;
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
#define rep(i,a,n) for (int i = a; i < n; i++)
#define per(i,n,a) for (int i = n - 1; i >= a; i--)
using namespace std;

int main() {
    int n;
    cin >> n;
    set<int> s;
    rep(i, 0, n) {
        int d;
        cin >> d;
        s.insert(d);
    }
    cout << s.size() << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	string s;
	cin>>s;
	if(n<3200)
		cout<<"red"<<endl;
	else cout<<s<<endl;
	// if()
	// vector<int> a(n);
	// for(int i = 0 ; i < n; i++)
	// {
	// 	cin>>a[i];
	// }
}

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

#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define eb emplace_back
#define rep(i, a, b) for (long i = (a); i <= (b); ++i)
#define per(i, a, b) for (long i = (a); i >= (b); --i)
#define mmst(v) memset(v, 0, sizeof(v))

const long kMax2 = 109;
const long kMax3 = 1009;
const long kMax4 = 10009;
const long kMax5 = 100009;
const long kMax6 = 1000009;
const long kInfI = 0x3F3F3F3F;
const float kInfF = 1e15;

const long kMAX = 1000000000;

using namespace std;
using ll = long long;

inline int readInt() {
  char c = getchar();
  while(!isdigit(c) && c != '-') c = getchar();
  int sigma = 1;
  if (c == '-') {
    sigma = -1;
    c = getchar();
  }
  int x = 0;
  while (isdigit(c)) {
    x = x * 10 + c - '0';
    c = getchar();
  }
  return x * sigma;
}

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

  ll ans = 0;
  vector<ll> al;
  vector<string> sl;
  string s;

  int m, d;
  cin >> m >> d;
  rep(i, 1, m) {
    rep(j, 2, i / 2) {
      if (j * 10 + i / j > d) break;
      if (j >= 10 || i / j >= 10) continue;
      if (j * (i / j) != i) continue;
      ++ans;
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
import math
N = int(input())

n1 = N / 1.08

if math.floor(math.floor(n1)*1.08) == N:
    print(math.floor(n1))
elif math.floor(math.floor(n1 + 1)*1.08) == N:
    print(math.floor(n1 + 1))
else:
    print(":(")


Measured memory_bytes: 3060
#include <cstdio>
#include <algorithm>
#include <numeric>

int r[100000];

int main()
{
  int b[100000];
  int n, m;
  scanf("%d%d", &n, &m);
  std::fill(b, b + n, 1);
  r[0] = 1;
  for (int i = 0; i < m; ++i)
  {
    int x, y;
    scanf("%d%d", &x, &y);
    --x, --y;
    if (r[x])
    {
      r[y] |= 1;
      if (b[x] == 1) r[x] = 0;
    }
    --b[x];
    ++b[y];
  }
  printf("%d\n", std::accumulate(r, r + n, 0));
  return 0;
}

Measured memory_bytes: 896
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;


public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N;
		N = sc.nextInt();
		Integer a[] = new Integer[N];
		for (int i = 0; i < N; ++i) {
			a[i] = sc.nextInt();
		}
		Arrays.sort(a, Comparator.reverseOrder());

		int sum = 0;

		for(int i = 0; i < N; ++i) {
			if(i%2 == 0) sum += a[i];
			else sum -= a[i];
		}
		System.out.println(sum);
	}
}


Measured memory_bytes: 21972
#include <iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
using namespace std;
int main (void) {
    int n,l;
    cin >> n >> l;
    vector<string>  str(n);
    for(int i=0;i<n;i++)    cin >> str[i];
    sort(str.begin(),str.end());
    for(int i=0;i<n;i++)    cout << str[i];
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define MSET(x,y) memset(x,y,sizeof(x))
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 100005
#define ll long long
#define ld long double
#define INF 1e18
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
using namespace std;
ll MOD = 1000000007;
string yes = "Yes\n";
string no = "No\n";

int32_t main() {
  fastio;
  #ifndef ONLINE_JUDGE
  freopen("i.txt", "r", stdin);
  freopen("o.txt", "w", stdout);
  #endif
  ll n,d,ans=0;
  cin>>n>>d;
  for(ll i=0;i<n;i++) {
    ll x,y;
    cin>>x>>y;
    if((x*x+y*y)<=d*d) ans++;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3656
N = int(input())
TA = [list(map(int,input().split())) for _ in range(N)]
t_an = TA[0][0]
a_an = TA[0][1]
for i in range(1,N):
    t = t_an / TA[i][0]
    a = a_an / TA[i][1]
    if t <= 1 and a <= 1:
        t_an = TA[i][0]
        a_an = TA[i][1]
    else:
        if t_an % TA[i][0] == 0:
            t = t_an // TA[i][0]
        else:
            t = t_an // TA[i][0] + 1
        if a_an % TA[i][1] == 0:
            a = a_an // TA[i][1]
        else:
            a = a_an // TA[i][1] + 1
        s = max(t,a)
        t_an = TA[i][0] * s
        a_an = TA[i][1] * s
print(t_an+a_an)


Measured memory_bytes: 3188
#include <iostream>
#include <cstring>
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

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

	int a[6];
	memset(a,0,sizeof(a));
	
	rep(i,n)
	{
		double t;
		cin >> t;

		if(t < 165.0) a[0]++;
		else if(t < 170.0) a[1]++;
		else if(t < 175.0) a[2]++;
		else if(t < 180.0) a[3]++;
		else if(t < 185.0) a[4]++;
		else a[5]++;
	}

	rep(i,6)
	{
		cout << i+1 << ":";
		rep(j,a[i])
		{
			cout << "*";
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define 	pb 				push_back
#define 	MOD 			1000000007
#define 	pp 				pop_back
#define 	MAXN   			1000001
#define 	mp 				make_pair
#define 	endl 			'\n'
#define 	ff 				first
#define 	ss 				second
#define 	mapcl 			map<char,ll>
#define 	mapll 			map<ll,ll>
#define 	pll 			pair<ll,ll>
#define 	cmp 			complex<double>
#define 	pi 				3.141592653589793238462643383279502884197169399375105820974944592307816406286 
#define 	inf 			1000
#define 	vll 			vector<ll>
#define 	all(v) 			v.begin(),v.end()
#define 	fr(i,z,n) 		for(ll i=z;i<n;i++)
#define 	sqrt 			sqrtl
#define 	cbrt 			cbrtl
#define		ll 				long long
#define 	ld 				long double
bool 		coll(pll p1,pll p2,pll p3)		{if((p3.ss-p2.ss)*(p2.ff-p1.ff)==(p2.ss-p1.ss)*(p3.ff-p2.ff))return true;else return false;}
void		print(auto x)					{cout<<x<<endl;}
void 		pv(vector<auto> v)				{for(ll i=0;i<(ll)v.size();i++)cout<<v[i]<<" ";cout<<endl;}
void 		pvsl(vector<auto> v)			{for(ll i=0;i<(ll)v.size();i++)cout<<v[i]<<" ";}
void 		in(vector<auto> &v, ll n)		{v.resize(n);for(ll i=0;i<n;i++)cin>>v[i];}
void 		sortv(vector<auto> &v)			{sort(v.begin(),v.end());}
void 		fast()							{ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
ll maxi(ll a, ll b){ 
	if (a > b)
		return a;
	return b;
}
ll mini(ll a, ll b){
	if (a > b)
		return b;
	return a;
}
int main(){
	ll n, tmp, ans=0, mina;
	cin >> n;
	for (ll i=0;i<n;i++){
		cin >> tmp;
		if (i == 0){
			mina = tmp;
			ans++;
			continue;
		}
		if (tmp <= mina){
			mina = tmp;
			ans++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
nk = gets.split.map(&:to_i)
s = gets.chomp
s_run = []
l = s.length
count = 0
c_max = 0
c_flag = 0

# for i in 0 .. l - 1
#   if s[i] == "1" && c_flag == nk[1] - 1
#     count += 1
#     if count > c_max
#       c_max = count
#     end
#     count = 1
#     c_flag = 0
#   elsif s[i] == "1"
#     count += 1
#     c_flag += 1
#   elsif s[i] == "0"
#     count += 1
#   end
# end

s_run_index = 0

if s[0] == "0"
  s_run[0] = [1,0]
  s_run_index = 1
  for i in 0 .. l - 1
    if i == 0
      count += 1
    else
    if s[i] == "0" && s[i - 1] == "1"
      s_run[s_run_index] = [1,count]
      s_run_index += 1
      count = 0
    end
    if s[i] == "1" && s[i - 1] == "0"
      s_run[s_run_index] = [0,count]
      s_run_index += 1
      count = 0
    end
    if i == l - 1
      s_run[s_run_index] = [s[i].to_i, count + 1]
    end
    count += 1
  end
  end
else
  for i in 0 .. l - 1
    if i == 0
      count += 1
    else
    if s[i] == "0" && s[i - 1] == "1"
      s_run[s_run_index] = [1,count]
      s_run_index += 1
      count = 0
    end
    if s[i] == "1" && s[i - 1] == "0"
      s_run[s_run_index] = [0,count]
      s_run_index += 1
      count = 0
    end
    if i == l - 1
      s_run[s_run_index] = [s[i].to_i, count + 1]
    end
    count += 1
  end
  end
end

s_run[s_run.length] = [1,0]

sum_max = 0
# puts s_run

if s_run.length < 2 * nk[1] + 1
  sum_max = s.length
else

for i in 0 .. 2 * nk[1]
  sum_max += s_run[i][1]
  sum = sum_max
end
# puts sum

i = 2 * nk[1] + 1
while i < s_run.length - 1
  sum = sum - s_run[i - (2 * nk[1] + 1)][1] - s_run[i - (2*nk[1])][1] + s_run[i][1] + s_run[i+1][1]
  if sum > sum_max
    sum_max = sum
  end
  i += 2
end
end

# for i in 2 * nk[1] + 1 .. (s_run.length - 1) - (2 *nk[1] + 1)
#   sum = sum - s_run[i - (2 * nk[1] + 1)][1] - s_run[i - (2*nk[1])][1] + s_run[i][1] + s_run[i+1][1]
#   if sum > sum_max
#     print i," ", sum
#     sum_max = sum
#   end
#   puts sum_max
# end
# end



puts sum_max


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

int main() {
  int n;
  cin >> n;
  int S[10010];
  for (int i = 0; i < n; i++) cin >> S[i];

  int q;
  cin >> q;
  
  int C = 0;
  for (int i = 0; i < q; i++) {
    int T;
    cin >> T;
    for (int j = 0; j < n; j++) {
      if (S[j] == T) {
        C++;
        break;
      }
    }
  }

  cout << C << endl;

  return 0;
}


Measured memory_bytes: 3132
#include <cstdio>
#include <cstring>
#include <cctype>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#define REP(i, n) for(int i = 0; i < (int)(n); ++i)

using namespace std;

char buf[100];

bool isOK(void) {
  if(buf[0] != 'A') return false;
  int n = strlen(buf);
  int cntC = 0;
  int idxC = -1;
  for(int i = 2; i < n-1; ++i) {
    if(buf[i] == 'C') {
      cntC++;
      idxC = i;
    }
  }
  if(cntC != 1) return false;
  REP(i, n) {
    if(i == 0 || i == idxC) {
      continue;
    }
    if(isupper(buf[i])) return false;
  }
  return true;
}

int main(void) {
  cin >> buf;
  puts(isOK() ? "AC" : "WA");
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iostream>
#define REP(i,n) for(int i=0;i<n;++i)
using namespace std;
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (a + b + c >= 22) {
    cout << "bust";
  } else {
    cout << "win";
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define all(a) (a).begin(), (a).end()
#define sz(a) (int) (a).size()
#define x first
#define y second

mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

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

    int n, k;
    cin >> n >> k;
    int ans = n;
    map<int, int> mp;
    for (int i = 0; i < k; i++) {
        int d;
        cin >> d;
        for (int j = 0; j < d; j++)  {
            int x;
            cin >> x;
            mp[x]++;
            if (mp[x] == 1)ans--;
        }
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 3652
import java.util.*;
     
    public class Main {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);
            int n = sc.nextInt();
            int[] a = new int[n];
            int m = 0;
            long ans = 0;
            for (int i = 0; i < n; i++) {
                a[i] = sc.nextInt();
            }
            for (int i = 0; i < n; i++) {
                a[i] -= i + 1;
            }
            Arrays.sort(a);
            if (a.length % 2 == 1)
                m = a[n / 2];
            else
                m = (a[n / 2] + a[n / 2 - 1]) / 2;
            for (int i = 0; i < n; i++) {
                ans += Math.abs(a[i] - m);
            }
            System.out.println(ans);
        }
    }

Measured memory_bytes: 87676
#include <bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
using ll = long long;
using ld = long double;
template<class T> bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

int main(){
  ios_base::sync_with_stdio(false);cin.tie(0);
  int N,M,S;
  cin >> N >> M >> S;
  chmin(S,2499);
  vector<vector<pair<int,ll>>> graph(N*2500);
  for(int i=0;i<M;i++){
    int u,v,a,b;
    cin >> u >> v >> a >> b;
    u--;
    v--;
    for(int j=0;j<2500;j++){
      if(j-a>=0)  graph.at(u*2500+j).pb(mp(v*2500+j-a,b));
      if(j-a>=0)  graph.at(v*2500+j).pb(mp(u*2500+j-a,b));
    }
  }
  for(int i=0;i<N;i++){
    int c,d;
    cin >> c >> d;
    chmin(c,2499);
    for(int j=0;j<2500;j++){
      if(j+c<2500)  graph.at(i*2500+j).pb(mp(i*2500+j+c,d));
    }
  }

  priority_queue<pair<ll,int>,vector<pair<ll,int>>,greater<pair<ll,int>>> pq;
  pq.push(mp(0,0*2500+S));
  vector<ll> mi_cost(N*2500,1e18);
  while(!pq.empty()){
    ll cost=pq.top().fi;
    int now=pq.top().se;
    pq.pop();
    if(cost>mi_cost.at(now)) continue;
    mi_cost.at(now)=cost;
    for(int i=0;i<sz(graph.at(now));i++){
      int to=graph.at(now).at(i).fi;
      ll to_cost=graph.at(now).at(i).se;
      if(mi_cost.at(to)<=to_cost+cost)  continue;
      mi_cost.at(to)=to_cost+cost;
      pq.push(mp(to_cost+cost,to));
    }
  }
  for(int i=1;i<N;i++){
    ll ans=1e18;
    for(int j=0;j<2500;j++){
      chmin(ans,mi_cost.at(i*2500+j));
    }
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 23736
#include <iostream>
#include <cstring>
#include <map>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <set>
#include <vector>
#include <queue>
#include <list>
#include <numeric>
#include <stdio.h>
#include <string>
#include <cstdlib>
#include <math.h>
#include <stack>
#include <climits>
#include <bitset>

using namespace std;
typedef long long ll;

ll gcd(ll x, ll y) {
  ll tmp = 0;
  if (x < y){
    tmp=x;
    x=y;
    y=tmp;
  }
  while (y > 0) {
    ll r = x % y;
    x = y;
    y = r;
  }
  return x;
}


//for(int i = ; i < ; i++){}

int main(){
  int n,k;
  cin>>n>>k;
  int x[n];
  int ans=0;
  for(int i = 0; i < n; i++){
    cin>>x[i];
    ans+=min(2*x[i],2*abs(k-x[i]));
  }
  cout<<ans<<endl;

  return 0;
}




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

#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
     char c;
     cin >> c;
     cout << (char)(c+1)<< endl;
}

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

int main(){
	int a, b;
	cin >> a >> b;
	a %= 3;
	b %= 3;
	if (a == 0 || b == 0 || a + b == 3)
	{
		cout << "Possible" << endl;
	}else{
		cout << "Impossible" << endl;
	}
}

Measured memory_bytes: 256
#pragma region
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <set>
#include <list>
#include <iomanip>
#include <cstdint>
#include <cstdlib>

using namespace std;
typedef long long ll;
//#define rep(i, s, e) for (int(i) = (s); (i) < (e); ++(i))
#define rep(i, e) for (int(i) = 0; (i) < (e); ++(i))
#define rrep(i, s) for (int(i) = (s) - 1; (i) >= 0; --(i))
#define all(x) x.begin(),x.end()
#pragma endregion


int main()
{
	int n; cin >> n;
	ll x; cin >> x;
	vector<ll> p(52), l(52);
	p[0] = l[0] = 1;
	rep(i, 51)
	{
		p[i + 1] = 2 * p[i] + 1;
		l[i + 1] = 2 * l[i] + 3;
	}
	int now = n - 1;
	ll res = 0;
	while (now >= 0)
	{
		if (l[now] + 2 <= x)
		{
			res += p[now] + 1;
			x -= l[now] + 2;
		}
		else if (x > 0)--x;
		--now;
	}
	if (x)++res;
	cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int a,b;
  int x,y;
  scanf("%d%d",&x,&y);
  if(x < y){
    b=x;
    x=y;
    y=b;
  }
  while(y){
    a=x%y;
    x=y;
    y=a;
  }
  printf("%d\n",x);
  return 0;
}



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

int main() {
  int N;
  cin >> N;
  
  int th=N/1000, hu=N%1000/100, te=N%100/10, on=N%10;
  if(th == hu && hu == te){
    cout <<"Yes" <<endl;
  }
  else if( hu == te && te == on){
    cout <<"Yes" <<endl;
  }
  else{
    cout <<"No" << endl;
  }
  //cout <<th <<hu <<te <<on <<endl;
}

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

int main(){
    int n;
    cin >> n;
    int temp = 1;
    for(int i = 0; i < n; i++){
        int a;
        cin >> a;
        if(a % 2 == 0){
            temp *= 2;
        }
    }
    cout << pow(3, n) - temp << endl;
    return 0;
}

Measured memory_bytes: 4112
// The very basic /////////////////////////////////////////////////////////////
#include <bits/stdc++.h>
using namespace std;
#define ALL_H 1

// Print elements of containers using << operator /////////////////////////////
// pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  return s << "(" << p.first << ", " << p.second << ")";}
// vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  for (auto &elem : v) {
    s << elem;
    if (&elem != &v.back()) s << " ";
  }
  return s;
}
// 2 dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  for (auto &elem : vv) {
    s << elem;
    if (&elem != &vv.back()) s << endl;
  }
  return s;
}
// map
template<typename T1, typename T2> ostream& operator<<(ostream& s, const map<T1, T2>& m) {
  s << "{" << endl;
  for (auto &elem: m) {
    s << " " << elem.first << " : " << elem.second << endl;
  }
  s << "}";
  return s;
}
//set
template<typename T> ostream& operator<<(ostream& s, const set<T>& m) {
  s << "{ ";
  for (auto &elem: m) {
    s << elem << " ";
  }
  s << "}";
  return s;
}

// Convenient macros //////////////////////////////////////////////////////////

// types
#define ll long long
#define ld long double

#define Pi pair<int, int>
#define Graph vector<vector<int>>
#define WeightGraph vector<vector<Pi>>

// other
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

#define MOD 1000000007
#define INF LLONG_MAX/100

// update max or min //////////////////////////////////////////////////////////

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

// gcd
int gcd(int a,int b){return b?gcd(b,a%b):a;}

// direction
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};


// Debug it by D(x) ///////////////////////////////////////////////////////////
#define DEBUG 1
#if DEBUG
#define D(x) x
#else
#define D(x)
#endif

///////////////////////////////////////////////////////////////////////////////
//                             Start Coding Here                             //
///////////////////////////////////////////////////////////////////////////////
// Find the first digit 
int fid(int n) 
{ 
    // Remove last digit from number 
    // till only one digit is left 
    while (n >= 10)  
        n /= 10; 
      
    // return the first digit 
    return n; 
} 
  
// Find the last digit 
int lad(int n) 
{ 
    // return the last digit 
    return (n % 10); 
} 

signed main() {
  int N; cin >> N;
  auto id = [&](int i, int j) {
              return i * 9 + j;
            };
  map<int, int> T;
  for (int n = 1; n <= N; n++) {
    int x = fid(n), y = lad(n);
    if (y == 0) continue;
    T[id(x, y)]++;
  }
  int ans = 0;
  for (int i = 1 ; i <= 9; ++i) {
    for (int j = 1; j <= 9; ++j) {
      ans += T[id(i,j)] * T[id(j, i)];
    }
  }

  cout << ans  << endl;

}


Measured memory_bytes: 256
def solve():
    from functools import lru_cache

    mod = 10 ** 9 + 7

    def is_ok(last4: str) -> bool:
        if 'AGC' in last4:
            return False
        for j in range(3):
            t = list(last4)
            t[j], t[j + 1] = t[j + 1], t[j]
            if 'AGC' in ''.join(t):
                return False
        return True

    @lru_cache(maxsize=None)
    def dfs(curr: int = 0, last3: str = 'XXX'):
        ret = 0
        if curr == n:
            return 1
        for c in 'ACGT':
            last4 = last3 + c
            if is_ok(last4):
                ret += dfs(curr + 1, last4[1:])
        return ret % mod

    n = int(input())
    print(dfs())


solve()


Measured memory_bytes: 5580
#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()

template<typename T>
constexpr T inf = static_cast<T>(pow(10, static_cast<int>(log10(numeric_limits<T>::max())))) + 7;
constexpr llong mod = 998244353;

llong pow_mod(llong n, llong m) {
  if (m == 0) return 1;
  if (m == 1) return n;

  llong ret = pow_mod(n, m/2);
  ret = ret * ret % mod;
  if (m&1) {
    ret = ret * n % mod;
  }
  return ret;
}

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

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

  vector<llong> dp(S + 1);
  for (int i = 0; i < N; ++i) {
    vector<llong> now(S + 1);
    for (int j = S; j >= 0; --j) {
      now[j] = dp[j] * 2;
      if (j >= A[i]) {
        now[j] += dp[j - A[i]];
      }
      now[j] %= mod;
    }
    if (A[i] <= S) {
      now[A[i]] += pow_mod(2, i);
    }
    swap(dp, now);
  }

  cout << dp[S] << endl;

  return 0;
}


Measured memory_bytes: 3676
#include <iostream>
#include <algorithm>
#include <map>
#include <string>
#include <cmath>

#define mod 1000000007

using namespace std;
 
int main(void){
	
	int N;
	
	cin >> N;
	
	for(int i=0; 4*i<=N; i++){
		for(int j=0; 7*j<=N; j++){
			if(4*i+7*j == N){
				cout << "Yes";
				return 0;
			}
		}
	}
	
	cout << "No";
	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
#define ll long long
 
int n,T;
 
int main(){
    //freopen("in.txt","r",stdin);
    scanf("%d%d",&n,&T);
    int start=0;
    int pushed;
    ll res=0;
    for(int i=1;i<=n;i++){
        scanf("%d",&pushed);
        res+=min((ll)T,(ll)pushed-(ll)start);
        start=pushed;
    }
    res+=T;
    cout<<res<<endl;
    return 0;
}

Measured memory_bytes: 256
def main():
    import sys
    #input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque
    #from collections import defaultdict
    from itertools import combinations, permutations
    #from itertools import accumulate, product
    from bisect import bisect_left,bisect_right
    from math import floor, ceil
    #from operator import itemgetter

    #mod = 1000000007

    al = 'abcdefghijklmnopqrstuvwxyz' #26
    s = input()
    for i in al:
        if not i in s:
            print(i)
            exit()
    print('None')


if __name__ == '__main__':
    main()

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

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

using namespace std;

using LL = long long int;
using LD = long double;

using pii = pair<int, int>;
using pll = pair<LL, LL>;
using pdd = pair<double, double>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vl = vector<LL>;
using vvl = vector<vl>;
using vvvl = vector<vvl>;
using vd = vector<double>;
using vvd = vector<vd>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vb>;

const int INF = (1 << 30) - 1;
const LL INF64 = ((LL)1 << 62) - 1;
const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
LL gcd(LL x, LL y) { return y ? gcd(y, x % y) : x; }

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

	int h, w;
	cin >> h >> w;

	for (int i = 0; i < w+2; i++) cout << "#";
	cout << endl;
	for (int i = 0; i < h; i++) {
		string a;
		cin >> a;
		cout << "#" + a +"#" << endl;
	}

	for (int i = 0; i < w+2; i++) cout << "#";
	cout << endl;
	return 0;
}

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

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

int main(){
    ll x;
    cin>>x;
    int count=0;
    ll a=100;
    while(a<x){
        a*=1.01;
        count++;
    }
    cout<<count;
    return 0;
}

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

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

    int n = k.length();
    vector<vector<long long int>> dp(n+1, vector<long long int>(d));// dp[i][j] = #(i digits, dsum % d == j)
    dp[0][0] = 1;
    for(int i=0; i<n; i++){
        for(int j=0; j<d; j++){
            for(int l=0; l<10; l++){// top digit
                dp[i+1][j] += dp[i][((j-l)%d+d)%d];
                dp[i+1][j] %= MOD;
            }
        }
    }
    /*
    for(int i=0; i<=n; i++){
        for(int j=0; j<d; j++){
            cout << "dp[" << i << "][" << j << "] = " << dp[i][j] << endl;
        }
    }
    */

    long long int ans = 0;
    int total = 0;
    for(int i=0; i<n; i++){
        int cd = k[i] - '0';// 0 ~ 9
        for(int j=0; j<cd; j++){
            ans += dp[n-1-i][(-(total+j)%d+d)%d];
            //cout << "dp[" << n-1-i << "][" << ((-(total+j)%d+d)%d) << "] = " << dp[n-1-i][(-(total+j)%d+d)%d] << endl;
            ans %= MOD;
        }
        total += cd;
    }
    ans -= 1;// since 0 is counted
    if(total % d == 0) ans += 1;
    ans = (ans % MOD + MOD) % MOD;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8448
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0

for i in range(n):
    s = str(input())
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1

print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))

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

namespace ABC
{
    class MPCO2020B
    {
        const string FILE = "/tmp/data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            var Ia = RIa(3);
            var K = RI();

            int n = 0;
            while (Ia[0] >= Ia[1])
            {
                Ia[1] *= 2;
                ++n;
            }
            while (Ia[1] >= Ia[2])
            {
                Ia[2] *= 2;
                ++n;
            }
            string result = (n <= K) ? "Yes" : "No";
            Console.WriteLine(result);


#if DEBUG
            Console.WriteLine("*** end ***");
            Console.SetIn(Console.In);
            Console.ReadKey();
            Console.WriteLine();
#endif
        }

        static int RI()
        {
            return int.Parse(Console.ReadLine());
        }

        static int[] RIa(int n)
        {
            string[] sa = Console.ReadLine().Split(' ');
            int[] la = new int[n];
            for (int i = 0; i < n; ++i)
            {
                la[i] = int.Parse(sa[i]);
            }
            return la;
        }
    }
}


Measured memory_bytes: 27436
#include <bits/stdc++.h> //C++の標準ライブラリを一行で一括でインクルードする
#include <math.h> //数学関数と数学定数を利用する
#define rep(i,n) for (int i = 0; i < (n); i++)
#define PI 3.141592653589793
using namespace std;
typedef long long ll;
template<class T> void chmax(T &a,T b) { if (a<b) a=b;}
template<class T> void chmin(T &a,T b) { if (a>b) a=b;}
int gcd(int a, int b){//ユークリッドの互除法
  if (a < b) gcd(b,a); //aの方がbよりでかいのが前提
  if (b == 0) return a; //aをbで割り切れたらreturn
  else gcd(b, a % b);
}
const int INF = 1<<30;
const int MOD = 1000000007;
int dx[4] = {0,0,-1,1};
int dy[4] = {-1,1,0,0};

int main(){
  int n;
  string s,t,ans; cin >> n >> s >> t;
  rep(i,n){
    ans.push_back(s[i]);
    ans.push_back(t[i]);
  }
  
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iterator>

int main(){
  int N;
  std::cin >> N;
  std::vector<long long> A(N+1);
  std::vector<long long> B(N);
  for(int i = 0 ; i < N + 1 ; i++){
    std::cin >> A[i];
  }
  for(int i = 0 ; i < N ; i++){
    std::cin >> B[i];
  }


  long long kill = 0;

  for(int i = 0 ; i < N ; i++){
    if(A[i] >= B[i]){
      kill += B[i];
    }else{
      kill += A[i];
      if(A[i+1] - (B[i] - A[i]) >= 0){
	kill += B[i] - A[i];
	A[i + 1] = A[i+1] - (B[i] - A[i]);
      }else{
	kill += A[i+1];
	A[i+1] = 0;
      }
    }
  }
  std::cout << kill << std::endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define INF 1000000000
 
// 🔴
 
// O(ElogE)
 
// pq<pair> はfirstが大きい順に出てくるのですか？
// s:= 開始ノード  v:= 頂点数  adjlist:= 隣接リスト (first:= コスト   second:= 行先)
vector<int> dijk(int s, int v, vector<vector<pair<int, int> > > adjlist){
     
    priority_queue <pair<int, int> > wait;
    vector<int> result(v, INF);
 
    //スタート地点を追加
    result[s] = 0;
    wait.push(make_pair(0, s));
 
    //ダイクストラ本体
    while(!wait.empty()){    //waitが空になるまで
 
        int nowpoint = wait.top().second;
        int nowcost = -wait.top().first;
        wait.pop();
 
        if(result[nowpoint] < nowcost) continue;
 
 
        //今いる頂点と隣接しているすべての頂点をなめる
        for(int i = 0; i < adjlist[nowpoint].size(); i++){
 
            int nextpoint = adjlist[nowpoint][i].second;
            int nextcost = nowcost + adjlist[nowpoint][i].first;
            //現時点より安く到達できそうであれば、結果を更新して優先度付きキューに格納
            if(result[nextpoint] > nextcost){
                result[nextpoint] = nextcost;
                wait.push(make_pair(-nextcost, nextpoint));
            }
        }
    }
     
    return result;         //結果列を返す
}
 
int main(){
 
    int V, E, S; cin >> V >> E >> S;     // V:= 頂点の数    E:= 辺の数    S:= スタートノード
    vector<vector<pair<int, int> > > adjlist(V);      //first := コスト　second := 行先
 
    //入力
    for(int i = 0; i < E; i++){
        int a, b, c; cin >> a >> b >> c;           // a ,b 間に コスト c の辺がある
        adjlist[a].push_back(make_pair(c, b));
        //adjlist[b].push_back(make_pair(c, a));      
    }
 
    vector<int> result(V);
    result = dijk(S, V, adjlist);
    //cout << result[G] << endl;
 
    for(int i = 0; i < V; i++){
        if(result[i] == INF) cout << "INF" << endl;
        else cout << result[i] << endl;
    }
    return 0;
}


Measured memory_bytes: 20516
import java.util.Scanner;
public class Main{
    int x;
    int y=0;
    
    public void solve(){
        Scanner sc = new Scanner(System.in);
        x=sc.nextInt();
        y=x*x*x;
        System.out.println(y);
    }
    
    public static void main(String[] args){
        Main obj = new Main();
        obj.solve();
    }
}

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

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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

template<typename T>
void print1(T begin, T end) {
  while (begin != end) {
    cout << (*begin) << " ";
    *begin++;
  }
  cout << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
  for (int i = 0; i < height; i++) {
    for (int j = 0; j < width; j++) {
      cout << " " << Array[i][j];
    }
    cout << endl;
  }
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  std::cerr << head << " ";
  print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
  int val = ((a % mod) + (b % mod)) % mod;
  if (val < 0) { val += mod; }
  a = val;
}

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

int N, A;
vector<int> x;
int dp[55][55][2555]; // dp[インデックス][枚数][合計] = 総数

signed main() {
  cin >> N >> A;
  x.resize(N);
  for (int i = 0; i < N; i++) {
    cin >> x[i];
  }

  dp[0][0][0] = 1;
  for (int idx = 0; idx < N; idx++) {
    for (int mai = 0; mai < N; mai++) {
      for (int sum = 0; sum < 2555; sum++) {
        // 選ぶ
        dp[idx + 1][mai + 1][sum + x[idx]] += dp[idx][mai][sum];
        // 選ばない
        dp[idx + 1][mai][sum] += dp[idx][mai][sum];
      }
    }
  }

  int ans = 0;
  for (int mai = 1; mai <= N; mai++) {
    for (int sum = 1; sum < 2555; sum++) {
      if (sum == mai * A) {
        ans += dp[N][mai][sum];
      }
    }
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 56448
//大文字->小文字 tolower(),逆はtoupper()
//int a = stoi(c); 文字列をintへ
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

// Nの桁数
ll dig(ll N) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= 10;
	}
	return dig;
}
// x,yの最大公約数
ll gcd(ll x, ll y) {
	ll r;
	while (x%y) {
		r = x % y;
		x = y;
		y = r;
	}
	return y;
}

int main() {
	int N, K; cin >> N >> K;
	if (N%K == 0)cout << 0 << endl;
	else cout << 1 << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<algorithm>

using namespace std;

int main(){
	int n,m;
	char bef[201];
	char aft[201];
	while(scanf("%d",&n)){
		if(n==0)
		break;
		string s;
		cin.ignore();
		for(int i=0;i<n;i++){
			getline(cin,s);
			bef[i] = s[0];
			aft[i] = s[2];
		}
		scanf("%d",&m);
		char temp;
		int ch=0;
		cin.ignore();
		for(int i=0;i<m;i++){
			getline(cin,s);
			temp = s[0];
			for(int j=0;j<n;j++){
				if(temp==bef[j]){
					printf("%c",aft[j]);
					ch=1;
					break;
				}
			}
			if(ch==0)
			printf("%c",temp);
			ch=0;
		}
		printf("\n");
	}
}

Measured memory_bytes: 3220
#include<iostream>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<cmath>
#include<queue>
#include<stack>
#include<functional>
using namespace std;

int main(){
    char latte[10][11];
	while(cin>>latte[9]){
		for(int i=0;i<10;i++) latte[9][i]-='0';
		for(int i=8;i>=0;i--)for(int j=0;j<=i;j++)
			latte[i][j]=(latte[i+1][j]+latte[i+1][j+1])%10;
		printf("%d\n",latte[0][0]);
	}
    return 0;
}

Measured memory_bytes: 1124