akhauriyash/Code-Regression huggingface dataset:
import java.util.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int K=sc.nextInt(),S=sc.nextInt();
	    int ans = 0;
	    
	    for(int x=0;x<=K;x++){ //0が最小値、Kが最大値なのでK回繰り返しを行う
	        for(int y=0;y<=K;y++){
	            int z = S-x-y;
	            if(z>=0 && z<=K){
	                ans = ans+1;
	            }
	        }
	    }
	   System.out.println(ans);
	}
}

Measured memory_bytes: 21844
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		@SuppressWarnings("resource")
		Scanner scanner = new Scanner(System.in);
		String s = scanner.next();

		switch (s) {
		case "SUN":
			System.out.println("7");
			break;

		case "MON":
			System.out.println("6");
			break;

		case "TUE":
			System.out.println("5");
			break;

		case "WED":
			System.out.println("4");
			break;

		case "THU":
			System.out.println("3");
			break;

		case "FRI":
			System.out.println("2");
			break;

		case "SAT":
			System.out.println("1");
			break;
		}
	}

}


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

int main() {
  double sum = 0;
  int n;
  cin >> n;
  rep(i, n) {
    double x;
    cin >> x;
    string S;
    cin >> S;
    if (S == "BTC") sum += x*380000.0;
    else sum += x;
  }
  cout << sum << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
template<typename S, typename T> ostream& operator<<(ostream &os, const pair<S, T> &p){ cout << "[" << p.first << ", " << p.second << "]"; return os; }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define Return(expr) { Cout(expr); return 0; }
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)

// constexpr int MOD = 1e9+7;

ll modPow(ll N, ll P, ll M){
    if(P==0) return 1;
    if(P%2==0){
        ll t = modPow(N, P/2, M);
        return t*t % M;
    }
    return N * modPow(N, P-1, M) % M;
}

int main(void){
    Cin(string, s);
    int n = s.size();
    vc<int> a(2019);

    int d = 0;
    a[d] ++;
    for(int i = n-1, p = 0; i >= 0; i --, p ++){
        d = ((s[i] - '0') * modPow(10, p, 2019) + d) % 2019;
        a[d] ++;
    }
    ll ans = 0;
    For(i, 2019) ans += (ll) a[i] * (a[i] - 1) / 2;
    Cout(ans);
}


Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <algorithm>
#include <stdio.h>

using namespace std;

int main()
{
    int x, y, z;
    cin >> x >> y >> z;
    if (x == y)
        cout << z;
    else if (x == z)
        cout << y;
    else
        cout << x;
}


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
 
public class Main{
  	public static void main(String[] args) /*throws IOException*/{
      	Scanner scan=new Scanner(System.in);
      	int N=scan.nextInt();
      	scan.close();
      	long ans=(long)N*(N-1);
      	ans>>=1;
      	System.out.println(ans);
    }
}

Measured memory_bytes: 21844
//selection sort
#include <iostream>
#include <algorithm>
#include <cstring>
#define max_n 101 
using namespace std;

int selectionSort(int* a, int n)
{
	int ans = 0, ind_min;
	
	for(int i = 0; i < n - 1; ++i)
	{
		ind_min = i;
		for(int j = i; j < n; ++j)
		{
			if(a[j] < a[ind_min])
				ind_min = j;	
		}	
	
	swap(a[i], a[ind_min]);
	if(ind_min != i)        //Èç¹û×îÐ¡ÏÂ±êÓÐ±ä»¯ËµÃ÷²úÉúÁËÊµ¼ÊµÄ½»»»£¬¼ÆÊýÆ÷+1 
		ans++;
	}	
	
	return ans;
}

int main(void)
{
	int a[max_n], n, res;
	
	cin >> n;
	for(int i = 0; i < n; ++i)
		cin >> a[i];
	res = selectionSort(a, n);
	for(int i = 0; i < n; ++i)
	{
		if(i > 0)
			cout << " ";
		cout << a[i];
	}
	cout << endl;
	cout << res << endl;	
}


Measured memory_bytes: 3116
#include    <bits/stdc++.h>
#define fo(i,a,b) for(int i=(a);i<=(b);++i)
#define fd(i,a,b) for(int i=(a);i>=(b);--i)
#define rep(i,a,b)  for(int i=(a);i<(b);++i)
#define fi  first
#define se  second
#define LL  unsigned long long
#define uint unsigned int
#define pb  push_back
#define eb  emplace_back
#define bit(s,i) ((s >> i) & 1)
#define off(s,i) (s & (~ (1 << i)))
#define ii pair <int , int>
#define iii1 pair <ii , int>
#define iii2 pair <int , ii>
#define TASK "Or Plus Max"
using   namespace   std;
const long long inf = 0x3f3f3f3f3f3f3f3f;
const int oo = 0x3f;
int n , a[270010] , res[270010];
ii f[270010];
///--------------------------
void readf() {
    cin >> n;
    for (int i = 0 ; i < (1 << n) ; ++i) cin >> a[i];
}
///--------------------------
void solve() {
    for (int i = 0 ; i < (1 << n) ; ++i) {
        f[i].fi = a[i];
        f[i].se = 0;
    }
    for (int j = 0 ; j < n ; ++j)
    for (int i = 1 ; i < (1 << n) ; ++i)
    if (i != off(i,j)) {
        if (f[i].fi < f[off(i,j)].fi) {
            f[i].se = max({f[i].se , f[i].fi , f[off(i,j)].se});
            f[i].fi = f[off(i,j)].fi;
        } else f[i].se = max(f[i].se , f[off(i,j)].fi);
    }
    for (int i = 1 ; i < (1 << n) ; ++i) res[i] = max(res[i-1] , f[i].fi + f[i].se);
    for (int i = 1 ; i < (1 << n) ; ++i) cout << res[i] << '\n';
}
///--------------------------
int main() {
   ios::sync_with_stdio(0);
   cin.tie(0);cout.tie(0);
   readf();
   solve();
}



Measured memory_bytes: 7688
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<double> VL;
typedef vector<string> VS;
typedef vector<PLL> VP;
typedef vector<ll> VLL;
const static int INF = 1000000000;
const static int MOD = 1000000007;
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    int N;
    string S,T;
    cin >> S >> T;
    VI A(N);
    rep(i,S.size()){
        if(S[i]!=T[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}


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

int main() {
  int N;
  cin >> N;
  int d[N];
  set<int> dd;
  for(int i=0;i<N;i++){
    cin >> d[i];
    dd.insert(d[i]);
  }
  cout << dd.size() <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(int i=(n);i<(k);i++)
#define rALL(a)  (a).rbegin(),(a).rend()
ll ans=0;
void Main(){
    ll x;cin>>x;
    ll y;cin>>y;
    ll a;cin>>a;
    ll b;cin>>b;
    ll c;cin>>c;
    vector<ll> p(a);
    For(i,0,a) cin>>p[i];
    vector<ll> q(b);
    For(i,0,b) cin>>q[i];
    vector<ll> r(c);
    For(i,0,c) cin>>r[i];
    sort(rALL(p));
    sort(rALL(q));
    For(i,0,x) r.push_back(p[i]);
    For(i,0,y) r.push_back(q[i]);
    sort(rALL(r));
    For(i,0,x+y) ans+=r[i];
    cout<<ans<<endl;
  
}
int main(){
    Main();
    /*
    東方風神録は神が出てくるので当然神ゲー
    */
    return 0;
}

Measured memory_bytes: 6256
#include<iostream>
#include <cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  int H, N; cin >> H >> N; int dp[H+1]; int a[N], b[N];
  rep(i, N){
    cin >> a[i] >> b[i];
  }
  rep(i, H+1){
    dp[i]=inf;
  }
  dp[0]=0;
  rep(i, H+1){
    rep(j, N){
      dp[min(i+a[j], H)] = min(dp[min(i+a[j], H)], dp[i]+b[j]);
    }
  }
  cout << dp[H] << endl;
}

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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	const int mod=1e9+7;
	auto add = [&mod](int a, int b) -> int {a += b; return a >= mod? a - mod: a;};
	auto sub = [&mod](int a, int b) -> int {a -= b; return a < 0? a + mod: a;};
	auto mul = [&mod](int a, int b) -> int {return 1LL * a * b % mod;};
	auto qpow = [&](int64_t t,int64_t p) -> int {
		int64_t ans = 1;
		while (p) {
			if(p & 1) ans = ans * t %mod;
			t = t * t % mod;
			p >>=1;
		}
		return ans;
 	};
	int n, a, b, c;
	cin >> n >> a >> b >> c;
	vector<int> pre(2 * n + 1), inv(2 * n + 1);
	pre[0] = 1;
	inv[0] = 1;
	for(int i = 1; i <= 2 * n; ++i) {
		pre[i] = mul(pre[i - 1], i);
		inv[i] = qpow(pre[i], mod-2);
	}
	auto C = [&](int n, int m) {
		return mul(pre[n], mul(inv[m], inv[n-m]));
	};
	int ans = 0;
	int inv100 = qpow(100, mod - 2);
	a = mul(a, inv100);
	b = mul(b, inv100);
	c = mul(c, inv100);
	int tmp = qpow(sub(1, c), mod - 2);
	for (int i = 0; i < n; ++i) {
		int tt = mul(C(i + n - 1, n - 1), qpow(b, i));
		tt = mul(tt, qpow(a, n));
		tt = mul(tt, n + i);
		ans = add(ans, mul(tt, qpow(tmp, n + i + 1)));
	}
	for (int i = 0; i < n; ++i) {
		int tt = mul(C(i + n - 1, n - 1), qpow(a, i));
		tt = mul(tt, qpow(b, n));
		tt = mul(tt, n + i);
		ans = add(ans, mul(tt, qpow(tmp, n + i + 1)));
	}
	cout << ans <<endl;
	return 0;
}

Measured memory_bytes: 1792
import math
N, M = map(int, input().split())
MOD = 10 ** 9 + 7

def factoring(k): #kを因数分解し、素因数とその個数を辞書に入れて返す。
    dic = dict()
    n = int(math.sqrt(k))+2
    for i in range(2, n):
        count = 0
        while k%i == 0:
            count += 1
            k = k//i
        if count != 0:
            dic[i] = count
    if k != 1:
        dic[k] = 1
    return dic

def conbination(n, r): #nCrを求める
    # nCr = n! //(r! * (n-r)!)
    import math
    return (math.factorial(n) //(math.factorial(r) * math.factorial(n-r)))%MOD
dic = factoring(M)
ans = 1
for i in dic:
    ans = (ans * conbination(dic[i]+N-1, dic[i]))%MOD
print (ans)

    



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

using namespace std;
using ll = long long;
using ull = unsigned long long;

constexpr ll LLINF {1001002003004005006};//ll = 9*LLINF
constexpr int INTINF {1000000000};//int = 2*INTINF

#define  rep(i,n)   for(int i = 0; i < (n); ++i)
#define rrep(i,n)   for(int i = 1; i <= (n); ++i)
#define drep(i,n)   for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for(int i = s; i < t;  ++i)

template<typename T>
void maxs(T& x, T&& y) {
  x=std::max(x,y);
}
template<typename T>
void maxs(T& x, T& y) {
  x=std::max(x,y);
}

template<typename T>
void mins(T& x, T&& y) {
  x=std::min(x,y);
}
template<typename T>
void mins(T& x, T& y) {
  x=std::min(x,y);
}

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

  int K;
  string S;
  cin >> K >> S;
  if (S.size() <= K) {
    cout << S << '\n';
  } else {
    rep(i, K) {
      cout << S[i];
    }
    cout << "...\n";
  }
}


Measured memory_bytes: 3648
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        String T = sc.next();
        StringBuffer s = new StringBuffer();
        for(int i = 0;i<N;i++){
            s.append(S.charAt(i));
            s.append(T.charAt(i));
        }
        System.out.println(s);
    }
}


Measured memory_bytes: 22868
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <map>
using namespace std;

int main()
{
    long int N, M;
    cin >> N >> M;
    vector<pair<long int, long int> > pairs(N);
    for(int i=0; i<N; i++){
        long int a, b;
        cin >> a >> b;
        pairs[i]=make_pair(a,b);
    }
    sort(pairs.begin(), pairs.end());
    long int sum=0;
    long int ans=0;
    int counter=0;
    while(sum!=M){
        if(pairs[counter].second+sum<=M){
            ans=ans+pairs[counter].second*pairs[counter].first;
            sum+=pairs[counter].second;
        }else{
            ans=ans+pairs[counter].first*(M-sum);
            break;
        }
        counter++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 1792
#include <stdio.h>

int main(void)
{
	int h, w, i, d;
	char str[101][101];
	scanf("%d %d", &h, &w);
	for(i = 0; i < h; i++){
		d = scanf("%s", str[i]);
	}

	for(i = 0; i < w+2; i++)
		printf("#");
		
	printf("\n");

	for(i = 0; i < h; i++){
		printf("#");
		printf("%s", str[i]);
		printf("#");
		printf("\n");
	}

	for(i = 0; i < w+2; i++)
		printf("#");

	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <math.h>
using namespace std;

class person{
	int point = 0;
public:
  	int disp();
  	void win();
  	void draw();
};

int person::disp(){
	return point;
}

void person::win(){
	point += 3;
}

void person::draw(){
	point += 1;
}

int main(){
	int n;
  	person taro, hanako;
	string t, h;
  	cin >> n;
  	for (int i = 0; i< n; i++){
    	cin >> t >> h;
      	if (t > h) taro.win();
        else if (t < h) hanako.win();
        else taro.draw(), hanako.draw();
    }
    cout << taro.disp() << " " << hanako.disp() << endl;
    return 0;
}



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

int main() {
  int n, m, c;
  cin >> n >> m >> c;
  
  int i, j;
  vector<int> b(m);
  for(i = 0; i < m; i++){
    cin >> b.at(i);
  }
  vector<vector<int>> a(n, vector<int>(m));
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      cin >> a.at(i).at(j);
    }
  }
  
  int keep = 0, ans = 0;
  for(i = 0; i < n; i++){
    for(j = 0; j < m; j++){
      keep += a.at(i).at(j) * b.at(j);
    }
    if(keep > -c) ans++;
    keep = 0;
  }
  
  cout << ans << endl;
}

Measured memory_bytes: 256
X = int(input())
if 400 <= X <= 599:
    print('8')
elif 600 <= X <= 799:
    print('7')
elif 800 <= X <= 999:
    print('6')
elif 1000 <= X <= 1199:
    print('5')
elif 1200 <= X <= 1399:
    print('4')
elif 1400 <= X <= 1599:
    print('3')
elif 1600 <= X <= 1799:
    print('2')
elif 1800 <= X <= 1999:
    print('1')
else:
    exit(0)


Measured memory_bytes: 9184
#include<bits/stdc++.h>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
 
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define mod 1000000007
#define inf 1e18+42
#define endl "\n"

#define out1(a) cout<<#a<<" "<<a<<endl
#define out2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<endl
#define out3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<endl

#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>=b;i--)
#define fori(it,A) for(auto it=A.begin();it!=A.end();it++)

#define ft first
#define sd second
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define zero(x) memset(x,0,sizeof(x));
 
using namespace std;

int binpow(int a, int b) {
    int res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}

//START OF CODE ->->->->->->->

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

    vector<int> a(n);

    rep(i,0,a.size())
    {
        cin>>a[i];
    }

    // long double ans = 0;
    long double v = 0;

    rep(i,0,a.size())
    {
        v += (1/(float)a[i]);
    }

    cout<<setprecision(20)<<1/(float)v<<endl;
}

//END OF CODE ->->->->->->->->

signed main()
{
    fast;
    int t = 1;
    // cin>>t;

    while(t--)
    {
        solve();
    }
    return 0;
}



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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()

const int MX = 100010;

int N, Q;
ll q[MX];
ll ans[MX];

int main() {
	scanf("%d %d", &N, &Q);
	rep(i, Q) scanf("%lld", &q[i]);

	vector<ll> vec = {N};
	rep(i, Q) {
		while (vec.size() && vec.back() >= q[i]) {
			vec.pop_back();
		}
		vec.push_back(q[i]);
	}

	vector<ll> num(vec.size());
	num.back() = 1LL;

	for (int i = (int)vec.size() - 1; i >= 0; --i) {
		ll cur = vec[i];
		int p = i;

		while (true) {
			auto it = upper_bound(vec.begin(), vec.begin() + p, cur);
			if (it == vec.begin()) break;
			--it;
			int np = it - vec.begin();
			num[np] += num[i] * (cur / *it);
			cur %= *it;
			p = np;
		}
		if (cur) {
			ans[0] += num[i];
			ans[cur] -= num[i];
		}
	}

	rep(i, MX) {
		if (i) {
			ans[i] += ans[i-1];
		}
	}
	
	rep(i, N) printf("%lld\n", ans[i]);
		
	return 0;
}

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

int main(void){
    vector<vector<int>> a(3, vector<int>(3));
    rep(i, 3){
        rep(j, 3){
            cin >> a.at(i).at(j);
        }
    }
    int n;
    cin >> n;
    vector<int> b(n);
    rep(i, n){
        cin >> b.at(i);
    }
    vector<vector<bool>> flag(3, vector<bool>(3));
    int count_w = 0, count_h = 0;
    string ans = "No";
    rep(i, 3){
        rep(j, 3){
            rep(k, n){
                if(b.at(k) == a.at(i).at(j)){
                    flag.at(i).at(j) = true;
                }
            }
            if(flag.at(i).at(j)) count_w++;
        }
        if(count_w == 3) ans = "Yes";
        count_w = 0;
    }
    
    rep(j, 3){
        rep(i, 3){
            if(flag.at(i).at(j)) count_h++;
        }
        if(count_h == 3) ans = "Yes";
        count_h = 0;
    }
    if(flag.at(0).at(0)&&flag.at(1).at(1)&&flag.at(2).at(2)) ans = "Yes";
    
    if(flag.at(0).at(2)&&flag.at(1).at(1)&&flag.at(2).at(0)) ans = "Yes";
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import collections
from sys import stdin
data = stdin.readlines()

n = int(data[0].split()[0])
a = [int(s) for s in data[1].split()]
q = int(data[2].split()[0])

sum = sum(a)

l = []
for i in range(q):
    l.append(int(data[i+3].split()[0]))
    l.append(int(data[i+3].split()[1]))

d = collections.Counter(a)

for i in range(q):
    sum += (l[2*i+1]-l[2*i]) * d[l[2*i]]
    d[l[2*i+1]] += d[l[2*i]]
    d[l[2*i]] = 0
    print(sum)

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

typedef long long ll;


#define all(c) (c).begin(),(c).end()
#define loop(s) for(int i = 0; s > i; i++)
#define rep(i,q) for(int i = 0; (q) > i; i++)
#define repp(i,a,q) for(int i = a; q > i; i++)
#define pb push_back
#define MAX 1000000000
#define mod 1000000007
/*
確認ポイント
to_string() はC++11以降の実装;
length(),size()に括弧をつけ忘れてないか;
大文字小文字間違えてないか
*/
int main() { 
    int N,M,X,Y;
    cin >> N >> M >> X >> Y;
    vector<int> x;
    int tm;
    loop(N){
      cin >> tm;
      x.pb(tm);
    }
    vector<int> y;
    loop(M){
      cin >> tm;
      y.pb(tm);
    }
    sort(all(x));sort(all(y));
    int Z = X+1;
    bool ok = false;
    repp(i,Z,Y+1){
      if(i > x[N-1] && i <= y[0]){
        ok = true;
        break;
      }
    }
    cout << (ok ? "No War" : "War") << endl;
} 

Measured memory_bytes: 256
/*
T M Hridoy KUET CSE 15
*/
#include<bits/stdc++.h>

using namespace std;

#define print printf("==================\n");
typedef    long long ll;
typedef pair<ll,ll   > payar;
typedef   unsigned long long ull;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define min3(a,b,c) min(a,min(b,c));
#define max3(a,b,c) max(a,max(b,c));
#define readf                freopen("in.txt", "r", stdin);
#define writef               freopen("out.txt", "w", stdout);

priority_queue<int, vector<int>,  greater<int> > pq; ///accending
vector< pair<int,payar  > > vpp;
vector< pair<int,  pair<int,payar  > > > own;
vector < payar >  vp;
#define pi acos(-1.0);
#define EPS 1e-9
#define  mod   1000000007
#define  mod2  998244353
#define all(x) x.begin(),x.end()
#define endl "\n"
const int N=2e5+5;


int a[N];
const int M = 998244353;

int main()
{
    IOS;
    int t ;
    ll n , m ;
    cin>>n>>m;
    ll an=0;
    an = n*(n-1)/2;
    an += m*(m-1)/2;
cout<<an<<endl;




    return 0;
}


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

using namespace std;

int main()
{
	char b;
	cin >> b;

	if (b == 'A') {
		cout << "T" << endl;
	}
	else if (b == 'T') {
		cout << "A" << endl;
	}
	else if (b == 'G') {
		cout << "C" << endl;
	}
	else if (b == 'C') {
		cout << "G" << endl;
	}
}

Measured memory_bytes: 3596
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func main() {
	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)

	N := nextInt()
	div_count := make([]int, N)
	for i := 1; i < N; i++ {
		for j := i; j < N; j += i {
			div_count[j]++
		}
	}
	total := 0
	for i := 1; i < N; i++ {
		total += div_count[i]
	}
	fmt.Println(total)
}


Measured memory_bytes: 9932
#include <bits/stdc++.h>
using namespace std;
 
int main(void){
 
  int N;
  cin >> N;
  int a,b,c;
  a = N/100;
  b = (N/10)%10;
  c = N%10;
  if(a==7||b==7||c==7){
      
      cout << "Yes" << endl;
      
  }else{
      
      cout << "No" << endl;
      
  }
  
}

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

using namespace std;

int main(){
	while(1){
	string str;
	cin>>str;
	if(str=="0"){
	break;
	}

	int sum=0;
	for(int i=0;i<(int)str.size();i++){
	 sum+=str[i]-'0';
	}
	cout<<sum<<endl;
	}
	}


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

int main(){
    int N;
    cin >> N;
    int X[N];
    for(int i = 0; i < N; i++)cin >> X[i];

    int ans = 2147483647;
    int sum = 0;

    for(int i = 1; i <= 100; i++, sum = 0){
        for(int j = 0; j < N; j++){
            sum += (i-X[j])*(i-X[j]);
        }
        if(sum < ans){
            ans = sum;
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}

int main(){
  ll i=0,j,N,M;
  ll cost[10]={0,2,5,5,4,5,6,3,7,6};
  cin>>N>>M;
  vec use(M);
  rep(i,M){
    cin>>use[i];
  }
  map<ll,ll> dp;
  For(i,-10,N)dp[i]=-inf;
  dp[0]=0;
  rep(i,N){
    rep(j,M){
      dp[i+cost[use[j]]]=max(dp[i+cost[use[j]]],dp[i]+1);
    }
  }
  i=N;
  vrsort(use);
  while(i>0){
    rep(j,M){
      if(dp[i]-1==dp[i-cost[use[j]]]){
        cout<<use[j];
        i-=cost[use[j]];
        break;
      }
    }
  }
  cout<<endl;
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
const int N=100000;
const int C=31;
const int T=100001;
ll n,c,t,cha[C][2*T],s,ans,co,w;
 
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ans = 0;
	CLR(cha);
	cin >> n >> co;
	FOR(i,0,n){
		cin >> s >> t >> c;
		for(ll i=2*s-1;i<2*t;i++){
			cha[c][i] = 1;
		}
	}
 
	FOR(i,0,200001){
		w=0;
		FOR(j,0,co+1){
			if(cha[j][i])w++;
		}
		ans = max(ans,w);
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 48640
#include <iostream>
#include <limits>

using namespace std;

int main()
{
	int N;
	cin >> N;
	long long a = 0;
	long long b = 0;
	for (int i = 0; i < N; ++i) {
		int T, A;
		cin >> T >> A;
		if (a == 0 && b == 0) {
			a = T;
			b = A;
		}
		else {
			long long l = 1;
			long long u = numeric_limits<long long>::max() - 1;
			while (l < u) {
				long long c = (l + u) / 2;
				if ((T + A) > numeric_limits<long long>::max() / c) {
					u = c;
				}
				else if (c * T >= a && c * A >= b) {
					u = c;
				}
				else {
					l = c + 1;
				}
			}
			a = l * T;
			b = l * A;
		}
	}
	cout << a + b << endl;
}


Measured memory_bytes: 256
//入力マクロここから
//https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

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

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

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

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

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

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

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
//　入力マクロここまで



fn main() {
    input! {
        h: usize,
        w: usize,
        g: [chars;h],
    }

    let mut hs = vec![false;h];
    let mut ws = vec![false;w];

    'outer1 :for i in 0..w {
        for j in 0..h {
            if g[j][i] == '#' {
                continue 'outer1;
            }
        }
        ws[i] = true;
    }

    'outer2 :for i in 0..h {
        for j in 0..w {
            if g[i][j] == '#' {
                continue 'outer2;
            }
        }
        hs[i] = true;
    }

    for i in 0..h {
        if hs[i] {
            continue;
        }
        for j in 0..w {
            if ws[j] {
                continue;
            }
            print!("{}",g[i][j]);
        }
        println!();
    }
    
}

Measured memory_bytes: 4352
using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] In = Console.ReadLine().Split(' ');
            int[] A = new int[n];
            for(int i=0; i < n; i++)
            {
                A[i] = int.Parse(In[i]);
            }
            int cnt = 0;
            for (int i = 0; i < n; i = i + 2)
            {
                if (A[i] % 2 == 1) cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define FORR(x, arr) for (auto& x : arr)
#define ITR(x, c) for (__typeof(c.begin()) x = c.begin(); x != c.end(); x++)
#define ALL(a) (a.begin()), (a.end())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
//-------------------------------------------------------

string s1, s2;
int dp[1145][1145];

int rec(int i, int j) {
    // cout << i << " " << j << endl;
    if (i > s1.size() || j > s2.size()) {
        return 1 << 20;
    }
    if (j == 0) {
        return i;
    }
    if (i == 0) {
        return j;
    }

    if (dp[i][j] >= 0) {
        return dp[i][j];
    } else {
        int x = 1 << 20;
        if (s1[i - 1] == s2[j - 1]) {
            x = min(x, rec(i - 1, j - 1));
        }
        x = min(x, rec(i - 1, j) + 1);
        x = min(x, rec(i, j - 1) + 1);
        x = min(x, rec(i - 1, j - 1) + 1);

        dp[i][j] = x;
        return x;
    }
}

void solve() {
    cin >> s1 >> s2;
    fill(dp[0], dp[1145], 1 << 20);
    REP(i, 1145) dp[i][0] = i;
    REP(i, 1145) dp[0][i] = i;
    // dp[0][0] = 0;

    FOR(i, 1, s1.size() + 1) {
        FOR(j, 1, s2.size() + 1) {
            if (s1[i - 1] == s2[j - 1]) {
                dp[i][j] = dp[i - 1][j - 1];
            }

            dp[i][j] = min(dp[i][j], dp[i - 1][j] + 1);
            dp[i][j] = min(dp[i][j], dp[i][j - 1] + 1);
            dp[i][j] = min(dp[i][j], dp[i - 1][j - 1] + 1);
        }
    }
    cout << dp[s1.size()][s2.size()] << endl;
    /*
    REP(i, 7) {
        REP(j, 7) { cout << dp[i][j] << "\t"; }
        cout << endl;
    }
    */
}

int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    solve();
    return 0;
}



Measured memory_bytes: 8360
#include <bits/stdc++.h>
using namespace std;
int INF = 10000000;
int main(){
  int N, M, s, t;
  cin >> N >> M >> s >> t;
  s--;
  t--;
  vector<vector<int>> E(N);
  for (int i = 0; i < M; i++){
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    E[x].push_back(y);
    E[y].push_back(x);
  }
  vector<int> d1(N, INF);
  d1[s] = 0;
  queue<int> Q1;
  Q1.push(s);
  while (!Q1.empty()){
    int v = Q1.front();
    Q1.pop();
    for (int w : E[v]){
      if (d1[w] == INF){
        d1[w] = d1[v] + 1;
        Q1.push(w);
      }
    }
  }
  vector<int> d2(N, INF);
  d2[t] = 0;
  queue<int> Q2;
  Q2.push(t);
  while (!Q2.empty()){
    int v = Q2.front();
    Q2.pop();
    for (int w : E[v]){
      if (d2[w] == INF){
        d2[w] = d2[v] + 1;
        Q2.push(w);
      }
    }
  }
  int d = d1[t];
  vector<int> cnt1(N, 0);
  for (int i = 0; i < N; i++){
    if (d1[i] != INF){
      cnt1[d1[i]]++;
    }
  }
  vector<int> cnt2(N, 0);
  for (int i = 0; i < N; i++){
    if (d2[i] != INF){
      cnt2[d2[i]]++;
    }
  }
  long long ans = 0;
  for (int i = 0; i <= d - 2; i++){
    ans += (long long) cnt1[i] * cnt2[d - 2 - i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 10952
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn gcd(a: usize, b: usize) -> usize {
    if a == usize::default() {
        b
    } else {
        gcd(b % a, a)
    }
}

fn solve() {
    let (n,k) = get!(isize, isize);
    let a = get!([isize]);

    let g = a.iter().fold(0, |g, &e| gcd(g,e as usize)) as isize;
    if a.iter().all(|&e| e<k) {
        println!("IMPOSSIBLE");
        return;
    }
    for e in a {
        if (e-k)%g == 0 || e == k {
            println!("POSSIBLE");
            return;
        }
    }
    println!("IMPOSSIBLE");
}


Measured memory_bytes: 10620
n = int(input())
l = list(map(int,input().split()))
count = 0
for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if l[i] != l[j] and l[j] != l[k] and l[i] != l[k]:
                if abs(l[i] - l[j]) < l[k] and l[k] < l[i] + l[j]:
                    count += 1
                else:
                    continue
            else:
                continue
print(count)

Measured memory_bytes: 9208
#include <cmath>
#include <functional>
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <list>
#include <time.h>
#include <math.h>
#include <random>
#include <deque>
#include <queue>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>
#include <sstream>
#include <chrono>
#include <cstring>

using namespace std;

#define LOCAL // sumbit source code
#define all(a) begin(a), end(a)
#define printv_(v)            \
    for (auto row : v)        \
    {                         \
        for (auto d : v)      \
        {                     \
            cout << d << " "; \
        }                     \
        cout << endl;         \
    }
#define MOD 1000000007
#define fi first
#define se second
#define PII pair<int, int>
typedef vector<int> VI;
typedef long long ll;

ll quick_pow(ll a, ll b)
{
    ll res = 1;
    while (b)
    {
        if (b & 1)
        {
            res = a * res;
        }
        a = a * a;
        b >>= 1;
    }
    return res;
}

ll gcd(ll a, ll b)
{
    a = abs(a), b = abs(b);
    while (b != 0)
    {
        a %= b;
        swap(a, b);
    }
    return a;
}
// TO-DO

// contest required
#ifdef LOCAL

void solve()
{
    int a;
    cin >> a;
    cout << a + a*a + a*a*a;
}

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

#endif


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

using namespace std;
typedef long long ll;

int main(void)
{

   ll n;
   cin >> n;
   ll x = 0, y = 0;
   for (int i = 1; i <= sqrt(n); i++)
   {
      if (n % i == 0)
      {
         x = i, y = n / i;
      }
   }
   if (x != 0 && y != 0)
   {
      ll sum = (x - 1) + (y - 1);
      cout << sum << endl;
   }
   else
      cout << n - 1 << endl;
   return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<string>
#include<set>
#include<cmath>
#include<tuple>
#include<utility>
#include<functional>
#include<algorithm>

#define LL long long

using namespace std;

string s;

int main() {
	cin>>s;
	cout<<((s[2]==s[3]&&s[4]==s[5])?"Yes":"No")<<endl;

	return 0;
}



Measured memory_bytes: 256
g=1
y=0
a=int(input())
b=list(input().split())
h=int(b[0])
for i in range(1,a):
  if int(b[i-1])<=int(b[i]) and h<=int(b[i]) and y<=int(b[i]):
    y=int(b[i])
    g+=1
print(g)

Measured memory_bytes: 3060
#include<iostream>
using namespace std;
int a[102],n,key;
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)
	cin>>a[i];
	for(int i=0;i<n-1;i++)
		cout<<a[i]<<" ";
		cout<<a[n-1]<<endl;
	for(int i=1;i<n;i++)
	{
		int j=i-1; 
		key=a[i];
		while(j>=0&&a[j]>key)
		{
		a[j+1]=a[j];
		j--;
		}
		a[j+1]=key;
		for(int i=0;i<n-1;i++)
		cout<<a[i]<<" ";
		cout<<a[n-1]<<endl;
		
	}	
	return 0;
}


Measured memory_bytes: 3120
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
using namespace std;

int main() {

    string line;

    while(getline(cin, line)) {
        stack<double> stk;
        while(line != "") {

            double a, b;

            string sp;
            if (line.find(" ") != -1) {
                sp = line.substr(0, line.find(" "));
                line = line.substr(line.find(" ") + 1);
            } else {
                sp = line;
                line = "";
            }

            if (sp == "+") {
                a = stk.top();
                stk.pop();
                b = stk.top();
                stk.pop();
                stk.push(a + b);
            } else if (sp == "-") {
                a = stk.top();
                stk.pop();
                b = stk.top();
                stk.pop();
                stk.push(b - a);
            } else if (sp == "*") {
                a = stk.top();
                stk.pop();
                b = stk.top();
                stk.pop();
                stk.push(a * b);
            } else if (sp == "/") {
                a = stk.top();
                stk.pop();
                b = stk.top();
                stk.pop();
                stk.push(b / a);
            } else {
                stk.push((double)atoi(sp.c_str()));
            }
        }

        printf("%.6f", stk.top());
        cout << endl;

    }

     
    return 0;
}

Measured memory_bytes: 0
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using System.Text;

public class Program
{

    public void Proc()
    {
        int[] inpt = Reader.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

        int left = inpt[0];
        int right = inpt[1];

        bool isValid = this.IsValid(Reader.ReadLine(), left, right);
        string ans = isValid ? "Yes" : "No";
        Console.WriteLine(ans);


    }
    private bool IsValid(String inpt, int left, int right) {
        if(inpt.Length != left+right+1) {
            return false;
        }
        for (int i = 0; i < inpt.Length; i++) {
            if(i==left) {
                if(inpt[i] != '-') {
                    return false;
                }
            } else {
                if(inpt[i]<'0' || inpt[i]>'9') {
                    return false;
                }
            }
        }
        return true;
    }


    public class Reader
    {
        private static StringReader sr;
        public static bool IsDebug = false;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (sr == null)
                {
                    sr = new StringReader(InputText.Trim());
                }
                return sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }
        private static string InputText = @"


3 4
269-6650





";
    }

    public static void Main(string[] args)
    {
#if DEBUG
        Reader.IsDebug = true;
#endif
        Program prg = new Program();
        prg.Proc();
    }
}


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

using namespace std;

int main() {
    int r, d;
    cin >> r >> d;
    vector<int> x(20);
    cin >> x[0];
    for(int i = 0; i < 10; i++) {
        x[i + 1] = r * x[i] - d;
        cout << x[i + 1] << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector> 
#include <algorithm>
#include<iomanip>
#include<math.h>
#include<string>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
using namespace std;

int main() {
    int K;
    char szBuf[200] ={ NULL
    }, Buf[200] = { NULL };
    cin >> K;
    cin >> szBuf;
    if (szBuf[K] != NULL) {

        Buf[K] = '.';
        Buf[K+1] = '.';
        Buf[K+2] = '.';
    }
    for (int x = 0; x < K; x++) {
        Buf[x] = szBuf[x];
    }

    cout << Buf << endl;
    return 0;
}

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

using namespace std;

const int MAX_N = 101;
const int MAX_K = 100001;

int N, K;
int a[MAX_N];
bool dp[MAX_K];

int main() {
  scanf("%d %d", &N, &K);
  for(int i = 0; i < N; ++i) scanf("%d", &a[i]);
  for(int i = 1; i <= K; ++i) {
    for(int j = 0; j < N; ++j) {
      if(i < a[j]) break;
      dp[i] = dp[i] || !dp[i - a[j]];
    }
  }
  if(dp[K]) printf("First\n");
  else printf("Second\n");
  return 0;
}

Measured memory_bytes: 3884
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    string s, t;
    cin >> s >> t;
    ll res = 0;
    REP(i, 3){
        if(s[i] == t[i]) res++;
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        //入力準備
        Scanner sc = new Scanner(System.in);
        //配列の準備
        int[] arr = new int[3];
        
        //配列にデータを入れる
        for(int i = 0; i < arr.length; i++ ){
            arr[i] = sc.nextInt();
            //System.out.println(arr[i]);
        }
        
        //並び替え
        Arrays.sort(arr);
        
        //出力
        //for(int i = 0; i < arr.length; i++)
        System.out.println(arr[0] + " " + arr[1] + " " + arr[2]);
    }
}


Measured memory_bytes: 26160
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>

using namespace std;
//using namespace __gnu_pbds;

#define ll  long long
#define PR  pair<int, int>

const int N = 3e5 + 5;
const int MOD = 1e9 + 7;
const long long INF = 5e18;
const double PI = 2 * acos(0.0);
//template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

ll A, B, C, D;
map<ll, ll> dp;
vector<ll> coin, cost;

ll solve(ll n) {
    if (n == 0) {
        return 0;
    }
    if (n == 1) {
        return D;
    }
    if (dp.find(n) != dp.end()) {
        return dp[n];
    }
    ll tmpCost = INF;
    if (D < INF / n) {
        tmpCost = min(tmpCost, D * n);
    }
    for (int i = 0; i < 3; i++) {
        if (n % coin[i]) {
            ll div = n / coin[i];
            ll addKoro = (n % coin[i]) * D;
            ll subKoro = (((div + 1) * coin[i]) - n) * D;
//            cout << n << ": " << addKoro << " " << div << " coin: " << coin[i] << endl;
//            cout << n << ": " << subKoro << " " << div + 1 << endl << endl;
            tmpCost = min(tmpCost, solve(n / coin[i]) + cost[i] + addKoro);
            tmpCost = min(tmpCost, solve(div + 1) + cost[i] + subKoro);
        } else {
            tmpCost = min(tmpCost, solve(n / coin[i]) + cost[i]);
        }
    }
    return dp[n] = tmpCost;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t;
    cin >> t;
    while (t--) {
        ll n;
        cin >> n >> A >> B >> C >> D;
        coin = {2, 3, 5};
        cost = {A, B, C};
        cout << solve(n) << '\n';
        dp.clear();
        coin.clear();
        cost.clear();
    }
    return 0;
}


Measured memory_bytes: 4436