akhauriyash/Code-Regression huggingface dataset:
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

template<class T> using vec = vector<T>;
template<class T> using vvec = vector<vector<T>>;
using ll = long long;
using ld = long double;

#define REPi(i, s, e) for(int i = (s); i < (e); ++i)
#define REPll(i, s, e) for(ll i = (s); i < (e); ++i)

ll gcd(ll a, ll b)
{
	return b != 0 ? gcd(b, a % b) : a;
}

int main()
{
	cin.tie(0);

	int r; cin >> r;
	cout << r * r * 3 << endl;

	return 0;
}

Measured memory_bytes: 256
card = list()

for c in ('S','H','C','D'):
    for i in range(1,14):
        x = c +' '+ str(i)
        card.append(x)


n = int(input())
card2 = list()

for i in range(n):
    a,b =  input().split()
    x = a + ' '+str(b)
    card2.append(x)

noneCard = list()
for i in (card):
    if(i not in card2):
        noneCard.append(i)


for i in range(len(card)-n):
    x = noneCard[i]
    print(x)



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

typedef long long ll;

int main()
{
    vector<vector<int>> a(3,vector<int>(3));
    int i,j;
    for(i = 0;i < 3;++i){
        for(j = 0;j < 3;++j){
            cin >> a.at(i).at(j);
        }
    }

    int n;
    cin >> n;
    vector<int> b(n);
    for(i = 0;i < n;++i){
        cin >> b.at(i);
    }
    int k;
    vector<vector<bool>> temp(3,vector<bool>(3,false));
    for(i = 0;i < n;++i){
        for(j = 0;j < 3;++j){
            for(k = 0;k < 3;++k){
                if(a.at(j).at(k) == b.at(i)){
                    temp.at(j).at(k) = true;
                }
            }
        }
    }

    bool flag = false;

    for(i = 0;i < 3;++i){
        if(temp.at(i).at(0) && temp.at(i).at(1) && temp.at(i).at(2)){
            flag = true;
        }
    }

    for(i = 0;i < 3;++i){
        if(temp.at(0).at(i) && temp.at(1).at(i) && temp.at(2).at(i)){
            flag = true;
        }
    }

    if(temp.at(0).at(0) && temp.at(1).at(1) && temp.at(2).at(2)){
        flag = true;
    }

    if(temp.at(0).at(2) && temp.at(1).at(1) && temp.at(2).at(0)){
        flag = true;
    }
    
    if(flag){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;

class Main{

	public static void main(String[] args) throws IOException{

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int alpha_num = 26;
		int[] num = new int[alpha_num];
		String input = "";

		for(int i = 0; i < alpha_num; i++){
			num[i] = 0;
		}

		while((input = br.readLine()) != null){

			input = input.toLowerCase();

			for(int i = 0; i < input.length(); i++){

				char c = input.charAt(i);

				if(Character.isLetter(c)){
					num[c - 'a']++;
				}

			}

		}

		for(char i = 'a'; i <= 'z'; i++){
			System.out.println(i + " : " + num[i - 'a']);
		}

	}
}

Measured memory_bytes: 24072
A, B, C = map(int, input().split())
count = 0
ABC = []
while True:
    if A % 2 ==0 and B % 2 == 0 and C % 2 == 0:
        nA = B/2 + C/2
        nB = A/2 + C/2
        nC = A/2 + B/2
        A, B, C = nA, nB, nC
        count += 1
        if [A, B, C] in ABC:
            count = -1
            break
        ABC.append([A, B, C])
    else:
        break
print(count)

Measured memory_bytes: 9256
#include<bits/stdc++.h>
#define fr(i,x,y) for(int i=x;i<=y;++i)
#define rf(i,x,y) for(int i=x;i>=y;--i)
#define LL long long
using namespace std;
const int N=1e5+10;
struct data{
	int nt,to;
}a[N<<1];
map<LL,int>ys;
int cnt=0,head[N],sz[N];
LL d[N],dis[N];

template <class T>
void read(T &x){
	char ch=getchar();x=0;
	for(;ch<'0'||ch>'9';ch=getchar()) ;
	for(;ch>='0'&&ch<='9';ch=getchar()) x=(x<<1)+(x<<3)+(ch^48);
}

void add(int x,int y){
	a[++cnt].to=y,a[cnt].nt=head[x],head[x]=cnt;
	a[++cnt].to=x,a[cnt].nt=head[y],head[y]=cnt;
}

void fail(){
	printf("-1\n");
	exit(0);
}

void dfs(int u,int fa){
	for(int i=head[u];i;i=a[i].nt){
		if(a[i].to==fa) continue;
		dis[a[i].to]=dis[u]+1;
		dfs(a[i].to,u);
	}
}

int main(){
	int n;read(n);
	fr(i,1,n) read(d[i]),ys[d[i]]=i;
	sort(d+1,d+1+n);
	fr(i,1,n) sz[i]=1;
	rf(i,n,2){
		int u=ys[d[i]];
		int gg=n-2*sz[u];
		if(gg<0) fail();
		LL pos=d[i]-gg;
		if(!ys.count(pos)) fail();
		sz[ys[pos]]+=sz[u];
		add(ys[pos],u);
	}
	dfs(ys[d[1]],0);
	fr(i,1,n) d[1]-=dis[i];
	if(d[1]) fail();
	fr(u,1,n){
		for(int i=head[u];i;i=a[i].nt){
			if(i&1) printf("%d %d\n",a[i].to,u);
		}
	}
	return 0;
}

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

using ll = long long;

ll N;

ll digit(ll x) {
   ll ret = 0;
   while (x > 0) {
      ret++;
      x /= 10;
   }
   return ret;
}

ll F(ll A, ll B) {
   return max(digit(A), digit(B));
}

int main() {
   cin >> N;
   ll ans = 1e18;
   for (ll i = 1; i*i <= N; i++) {
      if (N % i == 0) {
         ans = min(ans, F(i, N/i));
      }
   }
   cout << ans << endl;

   return 0;
}

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

int n,k;
int arr[100005];
int dp[100005];
long long int min(long long int a,long long int b)
{
	if(a<b)return a;
	return b;
}
long long int cost(int x)
{
	if(x>=n)return 0;
	if(dp[x] != -1)return dp[x];
	if(x == n-1)return abs(arr[x+1]-arr[x]);
	for(int i=x+1;i<=x+k;i++)if(i<=n)dp[i] = cost(i);

	long long int ans = INT_MAX;
	for(int i=x+1;i<=x+k;i++)if(i<=n)ans = min(ans, abs(arr[i]-arr[x])+dp[i]);
	dp[x] = ans;
	return dp[x];
} 

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	cin>>n>>k;
	for(int i=1;i<=n;i++)cin>>arr[i];
	for(int i=0;i<100005;i++)dp[i] = -1;
	cout<<cost(1)<<endl;
	return 0;
}

Measured memory_bytes: 5760
#include<cstdio>
#include<iostream>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
using namespace std;
char a[100010];
int main()
{
    scanf("%s",a);
    int l=strlen(a);
    if(a[0]==a[l-1])
    {
    	if(l%2==1)
    		printf("Second");
    	else
    		printf("First");
    }
    else
    {
    	if(l%2==0)
    		printf("Second");
    	else
    		printf("First");
    }
    return 0;
}


Measured memory_bytes: 384
/*  Don’t Quit
    
    When things go wrong as they sometimes will;
        When the road you’re trudging seems all uphill;
            When the funds are low, and the debts are high;
                And you want to smile, but you have to sigh;
                    When care is pressing you down a bit
                        Rest if you must, but don’t you quit.
*/
#include <bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(0)
#define pb push_back
//#define mp make_pair
#define f first
#define s second
#define all(a) a.begin(),a.end()
#define int long long
const int MOD=1e9+7;
const int N=2e5+5;
int power(int a,int b)
{
    int ans=1;
    while(b)
    {
        if(b&1)
            ans=(ans*a)%MOD;
        b/=2;
        a=(a*a)%MOD;
    }
    return ans;
}
int32_t main()
{
    IOS;
    string s;
    cin>>s;
    if(s.size()<3)
    {
        cout<<"0"<<endl;
        return 0;
    }
    int ans=0;
    int count=0;
    for(int i=0;i<s.size();i++)
    {
        if(s[i]=='A')
        {
            count++;
        } 
        else if(s[i]=='B'&&s[i+1]=='C'&&i+1<s.size())
        {
            ans+=count;
            i++;
        }
        else
        {
            count=0;
        }
    }
    cout<<ans<<endl;






}

Measured memory_bytes: 720
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define inf 1072114514
#define llinf 1145141919810364364
#define mod 1000000007

int max(int a,int b){if(a>b){return a;}return b;}
int min(int a,int b){if(a<b){return a;}return b;}
int zt(int a,int b){return max(a,b)-min(a,b);}
int round(int a,int b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
int ceil(int a,int b){if(a%b==0){return a/b;}return (a/b)+1;}
int gcd(int a,int b){int c;while(b!=0){c=a%b;a=b;b=c;}return a;}
int lcm(int a,int b){int c=gcd(a,b);a/=c;return a*b;}
int nCr(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
int fact(int a){int i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
int pow(int a,int b){int i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
long long llmax(long long a,long long b){if(a>b){return a;}return b;}
long long llmin(long long a,long long b){if(a<b){return a;}return b;}
long long llzt(long long a,long long b){return llmax(a,b)-llmin(a,b);}
long long llround(long long a,long long b){if((a%b)*2 >= b){return (a/b)+1;}return a/b;}
long long llceil(long long a,long long b){if(a%b==0){return a/b;}return (a/b)+1;}
long long llgcd(long long a,long long b){long long c;while(b!=0){c=a%b;a=b;b=c;}return a;}
long long lllcm(long long a,long long b){long long c=llgcd(a,b);a/=c;return a*b;}
long long llnCr(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=(a+1-i);r/=i;}return r;}
long long llfact(long long a){long long i,r=1;for(i=1;i<=a;i++){r*=i;}return r;}
long long llpow(long long a,long long b){long long i,r=1;for(i=1;i<=b;i++){r*=a;}return r;}
double dbmax(double a,double b){if(a>b){return a;}return b;}
double dbmin(double a,double b){if(a<b){return a;}return b;}
double dbzt(double a,double b){return dbmax(a,b)-dbmin(a,b);}
int sortfncsj(const void *a,const void *b){if(*(int *)a>*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int sortfnckj(const void *a,const void *b){if(*(int *)a<*(int *)b){return 1;}if(*(int *)a==*(int *)b){return 0;}return -1;}
int llsortfncsj(const void *a,const void *b){if(*(long long *)a>*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int llsortfnckj(const void *a,const void *b){if(*(long long *)a<*(long long *)b){return 1;}if(*(long long *)a==*(long long *)b){return 0;}return -1;}
int dbsortfncsj(const void *a,const void *b){if(*(double *)a>*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}
int dbsortfnckj(const void *a,const void *b){if(*(double *)a<*(double *)b){return 1;}if(*(double *)a==*(double *)b){return 0;}return -1;}

int main(void){
    int i,a,b,k;
    scanf("%d%d%d",&a,&b,&k);
    for(i=a;i<a+k;i++){if(b<i){continue;}printf("%d\n",i);}
    for(i=b-k+1;i<=b;i++){if(i<a || i<a+k){continue;}printf("%d\n",i);}
    return 0;
}

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


int main(int argc, char const *argv[])
{
    string s;
    cin>>s;
    int l=s.length();
    char f=s[0];
    char e=s[l-1];
    cout<<f<<l-2<<e<<endl;

    return 0;
}

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

using namespace std;
using ll = long long;
using vl = vector<ll>;
using pll = pair<ll, ll>;

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

template <class T1, class T2>
inline bool chmax(T1 &a, const T2 &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T1, class T2>
inline bool chmin(T1 &a, const T2 &b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

constexpr ll INF = 0x3f3f3f3f3f3f3f3fLL;
constexpr ll mod = 1000000007;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> H(N);
    for (ll i = 0; i < N; ++i) {
        cin >> H[i];
    }

    vector<vector<ll>> edge(N);
    for (ll i = 0; i < M; ++i) {
        ll a, b;
        cin >> a >> b;
        --a;
        --b;
        edge[a].emplace_back(b);
        edge[b].emplace_back(a);
    }

    ll ans = 0;
    for (ll i = 0; i < N; ++i) {
        bool is_good = true;
        for (auto e : edge[i]) {
            if (H[e] >= H[i]) {
                is_good = false;
                break;
            }
        }
        if (is_good) ++ans;
    }
    cout << ans << endl;
}

Measured memory_bytes: 9796
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;


/**
 * ABC155
 */
public class Main {

	public static void main(String[] args) throws Exception {
		Main main = new Main();

		try (Scanner scan = new Scanner(System.in)) {
			main.poll(scan);
		}
	}

	private void poll(Scanner scan) {
		int n = scan.nextInt();
		HashMap<String, Integer> counts = IntStream.range(0, n)
			.mapToObj(i -> scan.next())
			.collect(Collectors.toMap(i -> i, i -> 1, (v1, v2) -> v1 + v2, () -> new HashMap<>()));

		int max = counts.entrySet().stream().mapToInt(i2 -> i2.getValue()).max().getAsInt();

		counts.entrySet().stream()
			.filter(i -> i.getValue() >= max)
			.sorted(Comparator.comparing(i -> i.getKey()))
			.map(i -> i.getKey())
			.forEachOrdered(System.out::println);
	}

	@SuppressWarnings("unused")
	private void paperPlease(Scanner scan) {
		int n = scan.nextInt();
		System.out.println(IntStream.range(0, n)
			.map(i -> scan.nextInt())
			.allMatch(i -> i % 2 != 0 || i % 3 == 0 || i % 5 == 0) ? "APPROVED" : "DENIED");
	}

	@SuppressWarnings("unused")
	private void poor(Scanner scan) {
		int a = scan.nextInt();
		int b = scan.nextInt();
		int c = scan.nextInt();

		if (a == b) {
			if (b == c){
				System.out.println("No");
			} else {
				System.out.println("Yes");
			}
		} else if (a == c) {
			System.out.println("Yes");
		} else if (b == c) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}

	@SuppressWarnings("unused")
	private static class Pair<T1, T2> {

		private T1 left;
		private T2 right;

		public Pair(T1 left, T2 right) {
			this.left = left;
			this.right = right;
		}

		public T1 left() {
			return left;
		}

		public T2 right() {
			return right;
		}
	}


	@SuppressWarnings("unused")
	private static class UnionFindTree {
		private List<Integer> parents;

		public static UnionFindTree initialize(int n) {
			return new UnionFindTree(n);
		}

		public UnionFindTree(int n) {
			parents = IntStream.range(0, n).boxed().collect(Collectors.toCollection(() -> new ArrayList<>()));
		}

		public int find(int index) {
			if (index == parents.get(index)) {
				return index;
			}
			// 自分の親の親は自分の親とできるため経路圧縮
			parents.set(index, find(parents.get(index)));
			return parents.get(index);
		}

		public void union(int x, int y) {
			int xParent = find(x);
			int yParent = find(y);
			parents.set(yParent, xParent);
		}

		public long size() {
			return parents.stream().map(i -> find(i)).distinct().count();
		}
	}

}


Measured memory_bytes: 87788
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef long long ll;
ll INF = 1001001001;
int main() {
  int N, M; cin >> N >> M;
  
  ll li=-INF; ll ri=INF;
  rep(i, M) {
    int L, R; cin >> L >> R;
    chmax(li, (ll)L);
    chmin(ri, (ll)R);
}       
  cout << max(ri - li +1, 0ll) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <sstream>
#include <algorithm>
#include <math.h>
#include <map>
#include<functional>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <typeinfo>
#define PI 3.14159265359
#define INF 99999999;
#define rep(i, n) for(int i=0; i<n; i++)
#define REP(n) rep(i, n)
#define EPS 1e-10
typedef long long ll;
using namespace std;



/*
class Target
{
public:
	vector <string> draw(int n)
	{

	}
};
*/



int main()
{
	int a, b;
	
	REP(7)
	{
		cin >> a >> b;
		cout << a - b << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
long long n,m,sum,a[13];
long long dfs(long long x,long long sum,long long zlyakcsp) {
	if(x==1) {
		return 2*sum+zlyakcsp+a[x]+zlyakcsp*10+a[x];
	}
	return dfs(x-1,sum,zlyakcsp*10+a[x])+dfs(x-1,sum+zlyakcsp,a[x]);
}
int main() {
	cin>>n;
	while(n!=0) {
		sum++,a[sum]=n%10,n/=10;
	}
	cout<<dfs(sum,0,0)/2;
	return 0;
}

Measured memory_bytes: 256
def resolve():
    n = int(input())
    flag = False
    count = 0
    for i in range(n):
        d = list(map(int, input().split()))
        if d[0] == d[1]:
            count += 1
        else:
            count = 0
        if count == 3:
            flag = True
            break
    print('Yes' if flag else 'No')


if 'unittest' not in globals():
    resolve()


Measured memory_bytes: 62392
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <set>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

int main() {
  int n;
  cin >> n;
  vector<long long> a(n), b(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  long long ans = 0, sum = 0;
  for (int i = 0; i < n; i++)
    sum += a[i];
  bool c = true;
  for (int i = 0; i < n; i++)
    if (a[i] != b[i])
      c = false;
  if (c) {
    cout << 0 << endl;
    return 0;
  }
  long long d = 1000000001;
  for (int i = 0; i < n; i++) {
    if (a[i] > b[i])
      d = min(d, b[i]);
  }
  cout << sum - d << endl;
  return 0;
}


Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include<numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

struct UnionFind{
	vector<int> p;
	UnionFind(int n){
		p.resize(n, -1);
	}

	int find(int x){
		if(p[x] == -1)return x;
		else return p[x] = find(p[x]);
	}

	void unite(int x, int y){
		x = find(x);
		y = find(y);
		if(x == y)return;
		p[x] = y;
	}
};

int main(){
  int n, m;
  cin >> n >> m;
  vector<int> p(n);
  UnionFind uf(n);
  for(int i = 0; i < n; ++i){
  	cin >> p[i];
  	--p[i];
  }
  for(int i = 0; i < m; ++i){
  	int x, y;
  	cin >> x >> y;
  	--x;
  	--y;
  	uf.unite(x, y);
  }

  int cnt = 0;
  for(int i = 0; i < n; ++i){
  	if(uf.find(p[i]) == uf.find(i))++cnt;
  }

  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#define MOD 1000000007
#define INF 1 << 30

using namespace std;
typedef long long ll;

int main(void) {
	int num, i, ans = 1;
	string s;
	cin >> num >> s;
	for (i = 0; i < num - 1; i++) {
		if (s[i] != s[i + 1])
			ans++;
	}
	cout << ans << "\n";
	return 0;
}

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

#define cn count
#define pb push_back
#define in insert
#define fs first
#define sc second
#define sz size
#define len length
#define forn(i, n) for (ll i = 0; i < (ll) (n); ++i)
#define forni(i, n) for (ll i = 1; i < (ll) (n); ++i)
#define IO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)

using namespace std;
using ll = long long;
const ll inf = 1e9+7; 
const double PI =  3.141592653589793;

int main(){
	IO;
	ll n,a;
	cin>>n;
	bool ans = true;
	while(n--){
		cin>>a;
		if(a%2==0 &&(a%3!=0 && a%5!=0))ans = false;
	}
	cout<<(ans ? "APPROVED" : "DENIED")<<'\n';
	return 0;
}


// _   .-')                .-. .-')                 .-')                                               
//( '.( OO )_              \  ( OO )               ( OO ).                                             
// ,--.   ,--.).-'),-----. ,--. ,--.  .-'),-----. (_)---\_) ,--. ,--.     .-----.  ,-.-')  .-'),-----. 
// |   `.'   |( OO'  .-.  '|  .'   / ( OO'  .-.  '/    _ |  |  | |  |    '  .--./  |  |OO)( OO'  .-.  '
// |         |/   |  | |  ||      /, /   |  | |  |\  :` `.  |  | | .-')  |  |('-.  |  |  \/   |  | |  |
// |  |'.'|  |\_) |  |\|  ||     ' _)\_) |  |\|  | '..`''.) |  |_|( OO )/_) |OO  ) |  |(_/\_) |  |\|  |
// |  |   |  |  \ |  | |  ||  .   \    \ |  | |  |.-._)   \ |  | | `-' /||  |`-'| ,|  |_.'  \ |  | |  |
// |  |   |  |   `'  '-'  '|  |\   \    `'  '-'  '\       /('  '-'(_.-'(_'  '--'\(_|  |      `'  '-'  '
// """    """     """""""" """  """"      """""""  """""""  """"""""      """"""   """         """""""
 


Measured memory_bytes: 3660
#!/usr/bin/python3
# coding: utf-8

# 整数 > 整数型
def I(): return int(input())

# 整数列 '1 2 3 4' > 整数型リスト
def IsIl(): return list(map(lambda x: int(x), input().split()))

# 改行挟む整数列　'1/n 2/n 3/n' > 整数型りすと
def InIl(n): return [input() for i in range(n)]

# 整数列 '1 2' > 整数型タプル
def IsIt(): return map(lambda x: int(x), input().split())

# 改行挟む整数列　'1\n 2\n 3\n' > 整数型たぷる
def InIl(n): return map(input() for i in range(n))

# 文字列 'abcd' > 文字型リスト
def SsSl(): return list(map(lambda x: x, input()))

# 整数 '1234' > 整数型リスト

# 文字列 'aba' > 辞書（文字型:個数）{'a':2,'b':1}
def SSd():
    from collections import defaultdict
    A = input() # [int(i) for i in input().split()]
    dd=defaultdict(int)
    for a in A:
        dd[a]+=1
    return dd

import math

a,b,x=IsIt()

L_max = a*a*b
if L_max / 2 < x:
    c = (L_max - x)/a/a*2
    print(math.degrees(math.atan(c/a)))
else:
    c = x/a/b*2
    print(math.degrees(math.atan(b/c)))


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long LL;
struct X{
	int s;
	int t;
	int c;
	bool bSet;
	X(int _s,int _t,int _c){
		s=_s;
		t=_t;
		c=_c;
		bSet=false;
	}
	bool operator<(const X &x){
		if (s<x.s){
			return true;
		}else if (s==x.s){
			if (t<x.t){
				return true;
			}else if (t==x.t){
				if (c<x.c){
					return true;
				}
			}
		}
		return false;
	}

};
int main(int argc, char* argv[])
{
	int N,C;
	cin>>N>>C;
	int i,j;
	vector<X> Film;
	int s,t,c;
	for (i=0;i<N;i++){
		cin>>s>>t>>c;
		X x(s,t,c);
		Film.push_back(x);
	}
	sort(Film.begin(),Film.end());
	int aw=0;
	i=0;
	size_t FilmSize=Film.size();
	while(true){
		if (Film[i].bSet){
			i++;
			continue;
		}
		Film[i].bSet=true;
		t=Film[i].t;
		c=Film[i].c;
		for (j=i+1;j<FilmSize;j++){
			if (Film[j].bSet){
				continue;
			}
			if (t<=Film[j].s){
				if (c==Film[j].c){
					Film[j].bSet=true;
					t=Film[j].t;
					c=Film[j].c;
				}else{
					if (t+0.5<=Film[j].s){
						Film[j].bSet=true;
						t=Film[j].t;
						c=Film[j].c;
					}
				}
			}
		}
		aw++;
		bool bOK=true;
		for (int k=0;k<FilmSize;k++){
			if (!Film[k].bSet){
				bOK=false;
				break;
			}
		}
		if (bOK){
			cout<<aw<<endl;
			return 0;
		}
	}
	return 0;
}

Measured memory_bytes: 2420
#include <stdio.h>

int main()
{
  long long int n, i, min, max, sum = 0;
  int a[10000];

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d",&a[i]);
  }

  min = a[0];
  max = a[0];
  for (i = 0; i < n; i++) {
    if (min > a[i]) {
      min = a[i];
    }
    if (max < a[i]) {
      max = a[i];
    }
    sum += a[i];
  }

  printf("%d %d %lld\n", min, max, sum);

  return 0;
}

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

using namespace std;

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

typedef long long i64;
typedef pair<i64, i64> pii;

constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

signed main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  int q;
  cin >> q;
  int order;
  int d, x, p;
  deque<int> deq;

  rep(i, q) {
    cin >> order;

    if (!order) {
      cin >> d >> x;
      if (!d) deq.push_front(x);
      else deq.push_back(x);
    }

    else if (order == 1) {
      cin >> p;
      cout << deq.at(p) << "\n";
    }

    else {
      cin >> d;
      if (!d) deq.pop_front();
      else deq.pop_back();
    }
  }

  return 0;
}


Measured memory_bytes: 4628
S = input()
A = list(set(S))
minv = len(S) // 2
for a in A:
	maxv = 0
	v = 0
	for c in S:
		if a == c:
			v = 0
		else:
			v += 1
			maxv = max(maxv, v)
	minv = min(minv, maxv)
print(minv)

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


#define long long long int

using namespace std;

typedef vector<vector<int>> vvi;
typedef vector<int> vi;
typedef pair<int, int> pi;


int main() {

    int n;
    cin >> n;
    vector<pair<int, string>> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v[i].second >> v[i].first;
    }
    string s;
    cin >> s;
    long res = 0;
    int index = 0;
    while (index < n && v[index++].second != s);
    while (index < n) {
        res += v[index++].first;
    }

    cout << res;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long 
using namespace std;
signed main()
{
	
    long long a,b;        
    int i,gs=0;
    int p[100];
    scanf("%lld%lld",&a,&b);
	long long n;
	n=__gcd(a,b);
    
    for(i=2;i*i<=n;i++)  
    {
        if(n%i==0)       
        {
            p[gs++]=i;
            while(n%i==0)  
                n/=i;
        }
       }
    
    if(n>1)               
    {
        p[gs++]=n;
    }
    
    gs++;
    printf("%d",gs);
    
    return 0;
}

Measured memory_bytes: 256
from collections import defaultdict

graph = defaultdict(int)
N, K =list(map(int, input().split())) 
arr = list(map(int, input().split()))
for i, v in enumerate(arr):
    graph[i+1] = v

if graph[1] == 1:
    print(1)
    exit()

cnt = 1
cur = graph[1]
# cnt2node -> cnt2node
# node2cnt
cnt2node, node2cnt = defaultdict(int), defaultdict(int)
cnt2node[0], cnt2node[1] = 1, cur
node2cnt[1], node2cnt[cur] = 0, 1
while True:
    cur = graph[cur]
    cnt += 1
    if cur in node2cnt:
        break
    else:
        cnt2node[cnt] = cur
        node2cnt[cur] = cnt
        
first = node2cnt[cur]
if K <= first:
    print(cnt2node[K])
else:
    mod = (K - first) % (cnt - first)
    print(cnt2node[first + mod])



Measured memory_bytes: 66896
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<numeric>

typedef long long LL;

using namespace std;

LL gcd(LL a, LL b) {
	LL r;
	while ((r = a % b) != 0) {
		a = b;
		b = r;
	}
	return b;
}
LL lcm(LL a, LL b) {
	return (a / gcd(a, b) * b);
}

int main(void) {
	string a, b;
	cin >> a >> b;
	if (a.size() > b.size()) {
		cout << "GREATER";
	}
	else if (a.size() < b.size()) {
		cout << "LESS";
	}
	else {
		if (a > b) {
			cout << "GREATER";
		}
		else if (a < b) {
			cout << "LESS";
		}
		else {
			cout << "EQUAL";
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < (int)b; i++)
#define all(v) v.begin(), v.end()
const int MOD = 1e9 + 7;
const int INF = 1e9;
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

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


Measured memory_bytes: 256
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[] index = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            index[i] = a[i];
        }
        Arrays.sort(a);

        int c1 = a[n/2-1];
        int c2 = a[n/2];

        for (int i = 0; i < n; i++) {
            if (index[i] > c1) {
                System.out.println(c1);
            } else {
                System.out.println(c2);
            }
        }
    }
}


Measured memory_bytes: 94244
#include <iostream>
#include <string>
#include <stdio.h>
#include <cmath>
#include <cfloat>
#include <algorithm>
#include <numeric>
#include <vector>
#include <iterator>
#include <set>
using namespace std;

const double PI=acos(-1);

int main(){
    int n, cnt = 0, t = 1, a;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> a;
        if(a == t) t++;
        else cnt++;
    }
    if(cnt == n) cout << "-1" << endl;
    else cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <math.h>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
typedef pair<int, int> P;
#define INF LLONG_MAX/3
#define inf INT_MAX/3
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / gcd(a, b)*b;
}
bool prime(int p) {
	for (int i = 2;i <= sqrt(p);i++) {
		if (p%i == 0)return false;
	}
	return true;
}
int modpow(int a, int b) {
	if (b == 0)return 1;
	if (b == 1)return a % MOD;
	if (b % 2)return modpow(a, b - 1)*a%MOD;
	else return modpow(a, b / 2)*modpow(a, b / 2) % MOD;
}
int comb(int a, int b) {
	if (b == 0 || a == b)return 1;
	if (b == 1)return a % MOD;
	return (comb(a - 1, b - 1) + comb(a - 1, b)) % MOD;
}
// Library End !
int n, ans = 0;
pair<int, int>red[114];
pair<int, int>blue[114];
bool a[114];
int main() {
	cin >> n;
	rep(i, n)cin >> red[i].first >> red[i].second;
	rep(i, n)cin >> blue[i].first >> blue[i].second;
	sort(blue, blue + n);
	rep(i, n)a[i] = true;
	rep(i, n) {
		int p = -114514;
		int ma = -114514;
		rep(j, n) {
			if (red[j].first < blue[i].first&&red[j].second < blue[i].second&&ma <= red[j].second&&a[j] == true) {
				p = j;
				ma = red[j].second;
			}
		}
		if (p != -114514) {
			a[p] = false;
			ans++;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
using namespace std;

const long M = 1046527;
string H[M];

long getKey(string str){
	long sum = 0, p = 1, digit = 0;
	for (long i = 0; i < str.size(); i++){
		if (str[i] == 'A') digit = 1;
		else if (str[i] == 'C') digit = 2;
		else if (str[i] == 'G') digit = 3;
		else if (str[i] == 'T') digit = 4;
		else digit = 0;
		sum += p * digit;
		p *= 5;
	}
	return sum;
}

long h1(long key){return key % M;}
long h2(long key){return 1 + (key % (M - 1));}

long find(string str){
	long key = getKey(str);
	for (long i = 0; ; i++){
		long h = (h1(key) + i * h2(key)) % M;
		if (H[h] == str) return 1;
		else if (H[h].size() == 0) return 0;
	}
	return 0;
}

long insert(string str){
	long key = getKey(str);
	for (long i = 0; ; i++){
		long h = (h1(key) + i * h2(key)) % M;
		if (H[h] == str) return 1;
		else if (H[h].size() == 0){
			H[h] = str;
			return 0;
		}
	}
}

int main(){
	long n;
	string str, com;
	cin >> n;
	for (long i = 0; i < n; i++){
		cin >> com >> str;
		if (com[0] == 'i') insert(str);
		else {
			if (find(str)) cout << "yes" << endl;
			else cout << "no" << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 25872
#include<stdio.h>
#include<string.h>
int main()
{
	int tc;
	scanf("%d",&tc);
	int wa,tle,ac,re;
	wa = tle = ac = re = 0;
	char input[5];
	for(int i = 0;i<tc;i++)
	{
		scanf("%s",input);
		if(strcmp(input,"WA") == 0)
		{
			wa++;
		}
		else if(strcmp(input,"AC") == 0)
		{
			ac++;
		}
		else if(strcmp(input,"RE") == 0)
		{
			re++;
		}
		else if(strcmp(input,"TLE") == 0)
		{
			tle++;
		}
	}	
	printf("AC x %d\n",ac);
	printf("WA x %d\n",wa);
	printf("TLE x %d\n",tle);
	printf("RE x %d\n",re);
}

Measured memory_bytes: 2104
#include<iostream>
#include<stdlib.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
using namespace std;

int main()
{
  int n,l;
  
  cin>>n>>l;
  
  vector<string> s(n);
  
  for(int i=0;i<n;i++)
  {
    cin>>s[i];
  }
  
  sort(s.begin(),s.end());
  
  for(int j=0;j<n;j++)
  {
	cout<<s[j];
  }
  
  cout<<endl;
  
  return 0;
}

Measured memory_bytes: 256
n = int(input())
a = list(int(x) for x in input().split())

tmp = []
for _a in a:
  if _a % 2 == 0:
    tmp.append(_a)

tmp2 = []
for t in tmp:
  if t % 3 == 0 or t % 5 == 0:
    tmp2.append(True)
  else:
    tmp2.append(False)

if False in tmp2:
  print('DENIED')
else:
  print('APPROVED')




Measured memory_bytes: 38256
#include <stdio.h>
int main(void){
    int i,j,H,W;
    while(scanf("%d %d\n",&H,&W),H>0&&W>0){
        for(i=0;i<H;i++){
            for(j=0;j<W;j++){
                putchar(i==0||j==0||i==H-1||j==W-1?'#':'.');
            }
            putchar('\n');
        }
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2136
// https://beta.atcoder.jp/contests/abc072

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

int main() {
    string s;
    cin >> s;
    string ans;
    for (int i = 0; i < s.length(); i += 2) ans += s[i];
    cout << ans << endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for(int i = 0; i < n; i++)
#define MOD 1000000007
typedef long long ll;

int main() {
    ll n;
    cin >> n;
    ll a = 0;
    for(ll i = 1; i*i <= n; i++){
        if(n % i == 0){
            a = i;
        }
    }
    ll b = n / a;
    //cout << b << endl;
    ll ans = log(b) / log(10) + 1;
    cout << ans << endl;
}


Measured memory_bytes: 512
/*
ID: sabertooth
LANG:C++11
TASK: hamming
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<string>v;
bool visited[50][50];
int row,col;
int ax[]= {-1,1,0,0};
int ay[]= {0,0,-1,1};
bool cang(int x,int y)
{
    return x<row and x>-1 and y<col and y>-1 and !visited[x][y];
}
bool dfs(int x,int y)
{
    bool t=0;
    visited[x][y]=1;
    for(int i=0; i<4; i++)
    {
        int px=x+ax[i];
        int py=y+ay[i];
        if(cang(px,py) and v[px][py]=='#')
        {
            t=1;
            dfs(px,py);
        }
    }
    return t;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin>>row>>col;
    string s;
    for(int i=0; i<row; i++)
    {
        cin>>s;
        v.push_back(s);
    }
    bool ans=1;
    for(int i=0; i<row and ans; i++)
    {
        for(int j=0; j<col; j++)
        {
            if(!visited[i][j] and v[i][j]=='#')
            {
                ans=dfs(i,j);
                if(ans==0)
                    break;
            }
        }
    }
    if(ans)
        puts("Yes");
    else
        puts("No");
}


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

using namespace std; 

string s , t ;

vector< vector<int> >ch(27) ;


int main()
{
	ios_base::sync_with_stdio(0) ;
	cin.tie(0) ;
	cin>>s>>t ;
	int n = s.size() ;
	for(int i = 0 ; i < s.size() ; ++i)
		ch[(s[i]-'a')].push_back(i) ;
	for(int i = 0 ; i < t.size() ; ++i)
	{
		if(ch[(t[i] - 'a')].size() == 0)
			return cout<<-1<<"\n" , 0 ;
	}
	long long used = 0, prv = -1 ;
	for(int i = 0 ; i < t.size() ; ++i)
	{
			int idx = upper_bound(ch[(t[i] - 'a')].begin(), ch[(t[i] - 'a')].end(),  prv) - ch[(t[i] - 'a')].begin() ;
			if(idx == ch[(t[i] - 'a')].size())
				used += (n - prv), used += ch[(t[i] - 'a')][0] , prv = ch[(t[i] - 'a')][0];
			else
			{
				used += ch[(t[i] - 'a')][idx] - prv ;
				prv = ch[(t[i] - 'a')][idx] ;
			}
	}
	return cout<<used<<"\n" , 0 ;
}

Measured memory_bytes: 1228
//Multipleof2andN.java
import java.util.Scanner;
class Main
{
	public static void main(String args[])
	{
		Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if(n%2==0){
            System.out.println(n);
        }
        else{
            System.out.println(2*n);
        }
        sc.close();
    }
}

Measured memory_bytes: 22996
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
#define ar array


int main()
{
	//#ifndef ONLINE_JUDGE
		//freopen("input.txt","r",stdin);
		//freopen("output.txt","w",stdout);
	//#endif
	
	//int t;
	//cin>>t;
	//while(t--)
	{
		int n;
		cin>>n;
		int a[n];
		for(int i=0;i<n;i++)
		{
			cin>>a[i];
		}
		int dp[n];
		memset(dp,0x3f,sizeof(dp));
		dp[0]=0;
		for(int i=1;i<n;i++)
		{
			if(i-1>=0)
			{
				dp[i]=min(dp[i],dp[i-1]+abs(a[i]-a[i-1]));
			}
			if(i-2>=0)
			{
				dp[i]=min(dp[i],dp[i-2]+abs(a[i]-a[i-2]));
			}
		}
		cout<<dp[n-1]<<'\n';
		 
	}
		
}


Measured memory_bytes: 4376
n, m, c = map(int, input().split())
b = [int(i) for i in input().split()]
a = []
counter = 0

for i in range(n):
    a.append([int(j) for j in input().split()])

for i in range(n):
    sum = c
    for j in range(m):
        sum += a[i][j] * b[j]

    if sum > 0:
        counter += 1

print(counter)


Measured memory_bytes: 3060
N, M, Q = map(int, input().split())
LR = [list(map(int, input().split())) for _ in range(M)]
PQ = [list(map(int, input().split())) for _ in range(Q)]

#X[l][r]はlからrをちょうど走る電車の数
X = [[0 for _ in range(N+1)] for _ in range(N+1)]
for l, r in LR:
    X[l][r] += 1
cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i in range(1, N+1):
    for j in range(1, N+1):
        cum[i][j] = cum[i][j-1] + X[i][j]

for p, q in PQ:
    ans = 0
    for i in range(p, q+1):
        ans += cum[i][q] - cum[i][p-1]
    print(ans)

Measured memory_bytes: 116440
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <vector>
#include <cmath>

using namespace std;

void agc_a_bbq_easy(void) {
	int n;
	cin >> n;
	vector<int>l(n * 2);
	for (int i = 0; i < n * 2; i++) {
		cin >> l[i];
	}
	sort(l.begin(), l.end());
	int sum = 0;
	for (int i = 0; i < n * 2; i += 2) {
		sum += l[i];
	}
	cout << sum << endl;
}

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

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
int main(void){
    char a,b,out='H';
    int ans=1;
    cin>>a>>b;
    if(a=='D') ans=ans*(-1);
    if(b=='D') ans=ans*(-1);
    if(ans!=1) out='D';
    cout<<out<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORR(i, m, n) for (int i = m; i >= n; i--)
#define INF 1e9;
using namespace std;
typedef long long ll;
int main() {
  ll A, B, C, D;
  string S;
  cin >> S;

  A = S[0] - '0';
  B = S[1] - '0';
  C = S[2] - '0';
  D = S[3] - '0';

  if (A + B + C + D == 7) {
    cout << A << "+" << B << "+" << C << "+" << D << "=7";
    return 0;
  }
  if (A + B - C + D == 7) {
    cout << A << "+" << B << "-" << C << "+" << D << "=7";
    return 0;
  }
  if (A + B - C - D == 7) {
    cout << A << "+" << B << "-" << C << "-" << D << "=7";
    return 0;
  }
  if (A + B + C - D == 7) {
    cout << A << "+" << B << "+" << C << "-" << D << "=7";
    return 0;
  }
  if (A - B + C + D == 7) {
    cout << A << "-" << B << "+" << C << "+" << D << "=7";
    return 0;
  }
  if (A - B - C + D == 7) {
    cout << A << "-" << B << "-" << C << "+" << D << "=7";
    return 0;
  }
  if (A - B + C - D == 7) {
    cout << A << "-" << B << "+" << C << "-" << D << "=7";
    return 0;
  }
  if (A - B - C - D == 7) {
    cout << A << "-" << B << "-" << C << "-" << D << "=7";
    return 0;
  }
  return 0;
}

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

int main() {
    ll n, k, t[MAX_N], d[MAX_N], ans = 0;
    cin >> n >> k;
    REP(i,n){
        cin >> t[i];
    }
    REP(i,n-1){
        d[i] = t[i+1] - t[i];
    }
    sort(d,d+n-1);
    REP(i,n-k){
        ans += d[i];
    }
    cout << ans+k << endl;
    return 0;
}



Measured memory_bytes: 4712
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;

int main(){

    int N;
    cin >> N;
    int B = N + (N%2==0?1:0);
    int cnt = 0;
    for(int i = 1; i <= N; i++){
        int p = B - i;
        for(int j = i+1; j <= N; j++){
            if(j == p)continue;
            cnt++;
        }
    }
    cout << cnt << endl;
    for(int i = 1; i <= N; i++){
        int p = B - i;
        for(int j = i+1; j <= N; j++){
            if(j == p)continue;
            cout << i << " " << j << endl;
        }
    }

    return 0;
}

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

int main() {
  int n; cin >> n;
  map<ll, int> m;
  ll s = 0;
  m[0] = 1;
  ll res = 0;
  while (n--) {
    int x; cin >> x;
    res += m[s+=x]++;
  }
  cout << res << endl;
}


Measured memory_bytes: 12800
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXSIZE = 1e2+7;
int num[MAXSIZE];
int n;
void print(){
	for(int i = 0; i < n; i++){
		if(i)printf(" ");
		printf("%d",num[i]);
	}
	printf("\n");
}
void insertSort(){
	print();
	for(int i = 1; i < n; i++){
		int key = num[i];
		int j = i-1;
		while(j >= 0 && num[j] > key){
			num[j+1] = num[j];
			j--;
		}
		num[j+1] = key;
		print();
	}
}

int main(){
	while(~scanf("%d",&n)){
		for(int i = 0;i < n; i++){
			scanf("%d",&num[i]);
		}
		insertSort();
	}
	return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long; using pint = pair<int, int>; using pll = pair<ll, ll>;
template<typename T> auto compare = [](T x, T y) -> bool{return (x < y);};
const int MOD = 1000000007;

int N;
vector<int> adj[100010];
vector<int> path;
bool visited[100010];
int color[100010];

bool find_path(int index){
    if(visited[index]) return false;
    if(index == 0){
        path.push_back(0);
        return true;
    }
    visited[index] = true;
    bool ret = false;
    for(int next : adj[index]){
        if(find_path(next)){
            ret = true;
            path.push_back(index);
        }
    }
    return ret;
}

signed main(){
    cin >> N;
    int a, b;
    REP(i, N - 1){
        cin >> a >> b;
        a--; b--;
        adj[a].push_back(b);
        adj[b].push_back(a);
    }
    find_path(N - 1);
    int L = path.size();
    queue<int> fen, snu;
    REP(i, (L + 1) / 2) color[path[i]] = 1;
    FOR(i, (L + 1) / 2, L) color[path[i]] = -1; 
    REP(i, (L + 1) / 2) for(int next: adj[path[i]]) if(color[next] == 0) fen.push(next);
    FOR(i, (L + 1) / 2, L) for(int next: adj[path[i]]) if(color[next] == 0) snu.push(next);
    int i = L % 2;
    while(true){
        if(i % 2 == 0 && fen.empty()){
            PRINT("Snuke");
            return 0;
        }else if(i % 2 == 1 && snu.empty()){
            PRINT("Fennec");
            return 0;
        }
        int index;
        if(i % 2 == 0){
            index = fen.front();
            fen.pop();
            color[index] = 1;
            for(int next : adj[index]){
                if(color[next] == 0) fen.push(next);
            }
        }else{
            index = snu.front();
            snu.pop();
            color[index] = -1;
            for(int next : adj[index]){
                if(color[next] == 0) snu.push(next);
            }
        }
        i++;
    }
    return 0;
}

Measured memory_bytes: 12920
#include<bits/stdc++.h>
#define watch(x) cout << (#x) << " is " << (x) << endl
typedef long long ll;
using namespace std;
int static fast = [](){
  ios::sync_with_stdio(false);
  cin.tie(0); cout.tie(0); return 0;
}();
// freopen("input.txt", "r", stdin);

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



Measured memory_bytes: 256
import java.util.*;
import java.util.Map.Entry;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        int[] digit = new int[N];
        long sum = 0L;
        for (int i=0;i<N;i++) {
            digit[i] = (int)S.charAt(i)-48;
            sum += digit[i];
        }

        long up = 1+(10-digit[N-1]);
        long down = digit[N-1];

        long[][] dp = new long[N][2]; // dp[i][0]->up, dp[i][1]->down
        dp[N-1][0] = up;
        dp[N-1][1] = down;

        for (int i=N-1;i>0;i--) {
            dp[i-1][0] = Math.min(dp[i][1]+(10-digit[i-1])+1, dp[i][0]+(9-digit[i-1]));
            dp[i-1][1] = Math.min(dp[i][1]+digit[i-1], dp[i][0]+digit[i-1]);
        }
        System.out.println(Math.min(dp[0][0], dp[0][1]));
        // System.out.println(Arrays.toString(digit));

        // long ans = sum;
        // long give = sum;
        // long take = 0;
        // boolean flag = false;
        // for (int i=N-1;i>=0;i--) {
        //     give -= digit[i];
        //     if (flag==false && digit[i]!=0) {
        //         flag=true;
        //         give++;
        //         take++;
        //     }
        //     if (flag) {
        //         take += 9-digit[i];
        //     }
        //     ans = Math.min(ans, give+take);
        //     System.out.println("give, take: "+give+" "+take);
        // }
        // System.out.println(ans);
    }
}

Measured memory_bytes: 69944
#include <stdio.h>
int train[1000];
int a,b,c,top = 0;


void push(int x) {
  top++;
 train[top] = x;  

}


int pop() {
  top--;
  return train[top+1];

}


int main() {

  while(scanf("%d",&a) != EOF) {

   
    if(a  == 0) {
      b = pop();
      printf("%d\n",b);
    } else push(a);
  }

  return 0;

}

Measured memory_bytes: 604
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define pai 3.14159265358979323846
const int INF = 1001001001;
typedef long long ll;
int A[3][3], N;
bool punched[3][3];
bool ok[3][3];
int a[3][3],n;
using Graph = vector<vector<int>>;
vector<vector<int>> field;
vector<bool> seen;



int main() {
  int n;
  cin >> n;
  if (n%2==0) cout << n/2 << endl;
  else cout << n/2+1 << endl;
}



Measured memory_bytes: 256
using System;

class Program
{
	static void Main(string[] args)
	{
		string strInput = Console.ReadLine(); ;
		char alpha = strInput[0];

		if(char.IsUpper(alpha) == true)
        {
			Console.WriteLine("A");
        }
        else
        {
			Console.WriteLine("a");
		}

		return;
	}
}

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

int main() {
    ll a, b, n;
    cin >> a >> b >> n;
    if (n >= b) n = b - 1;
    cout << (a * n) / b + a * (n / b);
    return 0;
}

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

#define ld long double
#define ll long long int
#define ull unsigned long long int

using namespace std;

int main() {
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    long long ans;
    if (k % 2 == 0) {
        ans = a - b;
    } else {
        ans = b - a;
    }
    if (ans > 1000000000000000000) {
        cout << "Unfair" << endl;
        return 0;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
x, k, d = gets.split.map(&:to_i)
# スタートが負の場合でも正の時と同様に考えてOK
x = x.abs
# 絶対値が変わらなくなるまでに必要な移動回数(t)とその時のx座標(m)
t, m = x.divmod(d)
if t >= k
  # x座標が0まで到達しない場合はより0に近い値を出力
  puts (x-k*d).abs
elsif (k-t).even?
  # t回目から偶数回移動する場合はmで止まる
  puts m
else
  # t回目から奇数回移動する場合はmの反対側で止まる
  puts (m-d).abs
end


Measured memory_bytes: 14368
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
int n;
int a[maxx];

int main() {
	cin >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + n + 1);
	int ans = a[1];
	for(int i = 1; i <= n; i++) a[i] %= ans;
	sort(a + 1, a + n + 1);
	for(int i = 2; i <= n; i++) {
		if(!a[i]) continue;
		if(ans == 1) break;
		while(a[i]) {
			int p = a[i] % ans;
			int q = ans - p;
			if(p == 1 || q == 1) {
				puts("1");
				return 0;
			}
			if(p == q) ans = p;
			else {
				ans = min(ans, abs(p - q));
			}
			a[i] %= ans;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
from collections import deque

N, x = map(int, input().split())

if x == 1 or x == 2*N-1:
    print("No")
elif N == 2:
    print("Yes")
    print(1)
    print(2)
    print(3)
elif x == 2:
    print("Yes")
    q = deque([4, 1, 2, 3, 5])
    high = 6
    while len(q) < 2 * N - 1:
        q.append(high)
        high += 1
        q.appendleft(high)
        high += 1  
        
    print(*list(q), sep = '\n')
elif x == 2 * N - 2:
    print("Yes")
    q = deque([2*N-4, 2*N-1, 2*N-2, 2*N-3, 2*N-5])
    low = 2*N-6
    while len(q) < 2 * N - 1:
        q.append(low)
        low -= 1
        q.appendleft(low)
        low -= 1  
    
    print(*list(q), sep = '\n')
else:
    print("Yes")
    q = deque([x])
    low = 1
    high = 2 * N - 1
    while low <= x - 2 and high >= x + 2:
        q.append(low)
        low += 1
        q.appendleft(high)
        high -= 1
        q.appendleft(low)
        low += 1
        q.append(high)
        high -= 1
    while low <= x - 2:
        q.append(low)
        low += 1
        q.appendleft(low)
        low += 1
    while high >= x + 2:
        q.append(high)
        high -= 1
        q.appendleft(high)
        high -= 1
    
    if low == x - 1 and high == x + 1:
        q.appendleft(low)
        q.append(high)

    print(*list(q), sep = '\n')
        

Measured memory_bytes: 20448