akhauriyash/Code-Regression huggingface dataset:
#include        "algorithm"
#include        "iostream"
#include        "numeric"
#include        "iomanip"
#include        "cstring"
#include        "math.h"
#include        "bitset"
#include        "string"
#include        "vector"
#include        "ctime"
#include        "queue"
#include        "stack"
#include        "map"
#include        "set"

#include        "ext/pb_ds/assoc_container.hpp" // Common file
#include        "ext/pb_ds/tree_policy.hpp" // Including tree_order_statistics_node_update
#include        "ext/pb_ds/detail/standard_policies.hpp"

using namespace std;
using namespace __gnu_pbds;


#define          f first
#define          lgn 25
#define          endl '\n'
#define          sc second
#define          N (int)2e5+5
#define          pb push_back
#define          mod 1000000007
#define          ld long double
#define          vi vector<int>
#define          eb emplace_back
#define          vpii vector<pii>
#define          mii map<int,int>
#define          int long long 
#define          pii pair<int,int>
#define          pq priority_queue
#define          BLOCK (int)sqrt(N)
#define          test(x) while(x--)
#define          all(x) begin(x),end(x)
#define          allr(x) rbegin(x),rend(x)
#define          fo(i,a,n) for(int i=a;i<n;i++)
#define          rfo(i,n,a) for(int i=n;i>=a;i--)
#define          FAST ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define          time() cerr << "Time : " << (double)clock() / (double)CLOCKS_PER_SEC << "s\n"
#define          PI acos(-1.0)
#define 		 bug(...)       __f (#__VA_ARGS__, __VA_ARGS__)

typedef tree< int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update > 
OS ;

template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

inline void INP()
{
	#ifndef ONLINE_JUDGE
	    freopen("input.txt","r",stdin);   
	    freopen("output.txt","w",stdout);
	#endif 
}

const int inf = 0x3f3f3f3f;
const int INF = 0x3f3f3f3f3f3f3f3f;

int n,m,k;
string s;
vi adj[N];
int vis[N],par[N],a[N];

void go()
{
	cin >> n;

	queue<string> q;

	if( n <= 10 )
	{
		cout << n << endl;
		return;
	}

	for( char i = '1'; i <= '9'; i++)
	{
		string now = "";
		now += i;
		q.push(now);
	}

	int cn = n - 9;

	while(cn > 0)
	{
		if( cn == 0 ) 
		{
			break;
		}
		string now = q.front();
		q.pop();

		int last = now.back() - '0';

		fo(i,0,10)
		{
			if( abs(last - i) <= 1 )
			{
				string xx = now + (char)(i + '0');
				q.push( xx );
				cn--;

				if( cn == 0 ) 
				{
					cout << q.back() << endl;
					return;
				}
			}
		}
	}

	cout << q.back() << endl;
}

int32_t main()
{
	//INP(); 
	FAST;     
	int t=1; 
	// cin>>t;
	test(t) go();
}

 

Measured memory_bytes: 10240
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include<math.h>
#define rep(a) for(int i=0;i<a;i++)
#define nrep(a,b) for(int i=a;i<b;i++)
#define mrep(a) for(int i=a;i>=0;i--)
#define ll long long
#define INF 11451419191810

using namespace std;
int main(){

	ll n; cin >> n;
	vector<ll> a(n);
	rep(n) cin >> a[i];
	ll count = 0;
	bool zouka = true;
	bool tyukan = true;
	rep(n-1){
		if (tyukan){
			//std::cout << "i=" << i << endl;
			if (a[i] < a[i + 1]){
				tyukan = false;
				zouka = true;
				count++;
			}
			else if(a[i] > a[i + 1]){
				tyukan = false;
				zouka = false;
				count++;
			}
		}
		else{
			if (zouka){
				if (a[i] > a[i + 1]) tyukan = true;
			}
			else{
				if (a[i] < a[i + 1]) tyukan = true;
			}
		}
	}if (tyukan) count++;
	std::cout << count << endl;

	return 0;
}

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

int main(){
    vector<int> vec(5);
    
    for (int i = 0; i < 5; i++){
        cin >> vec.at(i);
    }

    for (int i = 0; i < 5; i++){   
        if(vec.at(i)==0){
            cout << i+1 << endl;
        } 
    }
}

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

int D;
int C[26];
int S[365][26];

int64_t evaluate(const vector<int> &T) {
  int64_t res = 0;
  vector<int> last(26);
  for (int i = 0; i < T.size(); ++i) {
    res += S[i][T[i] - 1];
    last[T[i] - 1] = i + 1;
    for (int j = 0; j < 26; ++j) {
      res -= C[j] * (i + 1 - last[j]);
    }
  }
  return res;
}

int64_t evaluate_avg(const vector<int> &T) {
  int64_t res = 0;
  vector<int> last(26);
  for (int i = 0; i < T.size(); ++i) {
    res += S[i][T[i] - 1];
    last[T[i] - 1] = i + 1;
    for (int j = 0; j < 26; ++j) {
      res -= C[j] * (i + 1 - last[j]);
    }
  }
  for (int i = T.size(); i < min((int) T.size() + 13, D); ++i) {
    for (int j = 0; j < 26; ++j) {
      res -= C[j] * (i + 1 - last[j]);
    }
  }
  return res;
}

int main() {
  cin >> D;
  for (int i = 0; i < 26; ++i) cin >> C[i];
  for (int i = 0; i < D; ++i) for (int j = 0; j < 26; ++j) cin >> S[i][j];

  vector<vector<int>> cands;
  cands.push_back(vector<int>());
  for (int _ = 0; _ < D; ++_) {
    vector<int> nscores;
    vector<vector<int>> ncands;
    for (auto cand : cands) {
      vector<pair<int64_t, int>> inc;
      for (int n = 1; n <= 26; ++n) {
        cand.push_back(n);
        inc.emplace_back(evaluate_avg(cand), n);
        cand.pop_back();
      }
      sort(inc.begin(), inc.end(), greater<pair<int64_t, int>>());
      for (int i = 0; i < 4; ++i) {
        cand.push_back(inc[i].second);
        nscores.push_back(inc[i].first);
        ncands.push_back(cand);
        cand.pop_back();
      }
    }
    vector<int> ord(nscores.size());
    iota(ord.begin(), ord.end(), 0);
    sort(ord.begin(), ord.end(), [&](int i, int j) { return nscores[i] > nscores[j]; });
    cands.clear();
    for (int i = 0; i < min((int) nscores.size(), 5); ++i) {
      cands.push_back(ncands[ord[i]]);
    }
  }

  for (int i = 0; i < D; ++i) cout << cands[0][i] << endl;

  return 0;
}



Measured memory_bytes: 3968
#include <iostream>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <math.h>
#include <string.h>
#include <iomanip>
#include <numeric>
#include <cstdlib>
#include <cstdint>
#include <cmath>
#include <functional>
#include <limits>

using namespace std;

using ll = long long;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vll = vector<vl>;
using vpll = vector<pll>;

void debug_out() { cout << endl; }
 
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cout << "debug: "; debug_out(__VA_ARGS__)
#else
#define debug(...) 
#endif

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define Rep(i, n) for (long long i = 0; i< (long long)(n); i++)
#define RRep(i,n) for (long long i = ((long long)(n)-1); i>=0; i--)
#define all(v) (v).begin(),(v).end()

struct Edge{
    int to;
    int weight;
    Edge(int t, int w) : to(t), weight(w){ }
};

struct edge{
    int from;
    int to;
    int weight;
    edge(int f,int t,int w) : from(f), to(t), weight(w){ }
};


using Graph = vector<vector<Edge>>;
using graph = vector<vector<int>>;
using edges = vector<edge>;

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

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

template <class T>
T gcd(T a, T b){
    if( b==0 ) return a;
    return gcd(b, a%b);
}

template <class T>
T lcm(T a, T b){
    return (a*b)/gcd(a,b);
}

bool isPalindrome(string s){
    string t = s;
    reverse(all(t));
    return s==t;
}

constexpr int INF = 1e9+7;

vector<int> dx = {-1,0,1,0};
vector<int> dy = {0,-1,0,1};

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll x;
    cin >> x;
    ll a = x/500;
    x %=500;
    a *= 1000;
    a += (x/5)*5;
    cout << a << endl;
}

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

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(int i = 0; i < n; i++)
#define Rep(i, n) for(int i = 1; i < n; i++)
#define In(vec) rep(i, n) cin>>vec[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vd = vector<double>;
using vvi = vector<vector<int>>;
using vii = vector<pair<int, int>>;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

constexpr auto MAX = 100010;

// ────────────────────────────────────────────────────

int main() {
	int n; cin >> n;
	vi h(n);
	rep(i, n) cin >> h[i];

	int ans = 0, num = 0;

	for (int i = n - 1; i >= 1; --i) {
		if (h[i - 1] >= h[i]) num++;
		else num = 0;
		ans = max(ans, num);
	}
	ANS(ans);
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int n,a[100005],ma;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",&a[i]);
		ma=max(a[i],ma);
		if(ma-a[i]>1){
			puts("No");
			return 0;
		}
	}
	puts("Yes");
}

Measured memory_bytes: 640
X, Y, Z, K  = map(int, input().split())
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))

l = []
for a in A:
    for b in B:
        l.append(a+b)
l = sorted(l, reverse = True)[:K]

ans = []
for c in C:
    for k in l:
        ans.append(c + k)
        
ans = sorted(ans, reverse = True)
print(*ans[:K], sep="\n")

Measured memory_bytes: 221412
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

n=I()
lis=LI()
U,V=0,0
u=ceil(sum(lis)/n)
v=int(sum(lis)/n)
for i in range(n):
    U+=(lis[i]-u)**2
    V+=(lis[i]-v)**2
print(min(U,V))

Measured memory_bytes: 3316
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
half_a=[ai//2 for ai in a]
# print(half_a)
lcm=half_a[0]
for i in range(n-1):
    a,b=lcm,half_a[i+1]
    lcm=a*b//math.gcd(a,b)
# print(lcm)
pow_cnt=0
tmp=half_a[0]
while tmp%2==0:
    pow_cnt+=1
    tmp=tmp//2
flag=True
for ai in half_a[1:]:
    if ai%(2**pow_cnt)!=0:
        flag=False
        break
    elif  ai%(2**(pow_cnt+1))==0:
        flag=False
        break
if flag:
    print(math.ceil(m//lcm/2))
else:
    print(0)

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

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

template<class T> using v = std::vector<T>;
template<class T> using vv = v<v<T>>;

const int mod = 1000000007;
//const int mod = 998244353;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint operator-() const { return mint(-x);}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
    mint operator+(const mint a) const { return mint(*this) += a;}
    mint operator-(const mint a) const { return mint(*this) -= a;}
    mint operator*(const mint a) const { return mint(*this) *= a;}
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t>>1);
        a *= a;
        if (t&1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const { return pow(mod-2);}
    mint& operator/=(const mint a) { return *this *= a.inv();}
    mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

// combination mod prime
// https://www.youtube.com/watch?v=8uowVvQ_-Mo&feature=youtu.be&t=1619
struct combination {
    vector<mint> fact, ifact;
    combination(int n):fact(n+1),ifact(n+1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
    }
    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]*ifact[n-k];
    }
};


int N;
int x[10], y[10];

double dist(int i, int j) {
    double dx = x[i] - x[j];
    double dy = y[i] - y[j];
    return pow(dx * dx + dy * dy, 0.5);
}

void solve() {
    cin >> N;
    for(int i = 1; i <= N; i++) cin >> x[i] >> y[i];
    double ans = 0.0;
    for(int i = 1; i <= N; i++) {
        for(int j = i + 1; j <= N; j++) ans += dist(i, j) * 2 / N;
    }
    cout << fixed << setprecision(10) << ans << endl;
    return;
}

int main() {
    solve();
    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 x = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		sc.close();
		
		int xa = Math.abs(x-a);
		int xb = Math.abs(x-b);
		
		if(xa<xb) {
			System.out.println("A");
		}else {
			System.out.println("B");
		}

	}

}


Measured memory_bytes: 35776
s = input()
n = int(len(s))

def ispalindrome(str): return 1 if str == str[::-1] else 0

if ispalindrome(s)==1:
    if ispalindrome(s[:(n-1)//2])==1:
        if ispalindrome(s[(n+2)//2:])==1:
            print("Yes")
            exit()
print("No")

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

int main(){
    string s;
    cin >> s;
    if(s[0] == s[1] && s[0] == s[2] && s[1] == s[2] ){
        cout << "No" << endl;
    }else{
        cout << "Yes" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/env python3
def main():
    a, b, c, d = map(int, input().split())

    ans = -10 ** 20
    for x in [a, b]:
        for y in [c, d]:
            ans = max(ans, x * y)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 9156
#include<set>
#include<map>
#include<cmath>
#include<ctime>
#include<queue>
#include<cstdio>
#include<string>
#include<vector>
#include<cstdlib>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define pb push_back
#define lowbit(x) x&(-x)
#define PII  pair<int, int> 
#define all(x) x.begin(), x.end()
#define FAST ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 7;
const int maxn = (int)1e6 + 5;
using namespace std;

int main()
{
	string s; cin >> s;
	ll k; cin >> k;
	int pos = -1;
	for(int i = 0; i < s.size(); i++){
		if(s[i] > '1') { pos = i; break;}
	}
	pos++;
	if(pos == 0 || k < pos)  puts("1");
	else printf("%c\n", s[pos-1]);
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>

int main() {
  char s[210000];
  int ap, zp;
  int ans = -1;
  int ssize;
  
  scanf("%s", s);
  ssize = strlen(s);
  for(ap = 0; s[ap] != 'A'; ap++) ;
  for(zp = ssize; s[zp] != 'Z'; zp--) ;
  
  printf("%d\n", zp - ap + 1);
  
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define forn(i, n) for (ll i = 0; i < (n); i++)
#define fori(i, b, e) for (ll i = (b); i < (e); i++)
#define forr(i, b, e) for (ll i = (b); i >= (e); i--)
#define allele(v) v.begin(), v.end()
#define fi first
#define se second
#define Mat vector<vector<ll>>
#define Arr vector<ll>
#define Matd vector<vector<ld>>
#define Arrd vector<ld>

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n;
    cin >> n;
    Arr a(n);
    forn(i, n) cin >> a[i];
    Arr b = a;
    sort(allele(b));
    ll cnt = 0;
    forn(i, n) if(a[i] != b[i]) cnt++;
    cout << (cnt <= 2 ? "YES" : "NO");
    return 0;
}

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

int main() {
    int n,k;
    long long sum=0;
    vector<int>h;
    
    cin>>n>>k;
    
    for(int i=0;i<n;i++)
    {
        int hi;
        cin>>hi;
        h.push_back(hi);
    }
    
    sort(h.begin(),h.end());
    
    if(n<=k) cout<<0;
    else{
        for(int i=0;i<n-k;i++)
        {
            sum+=h[i];
        }
        cout<<sum;
    }
    
	return 0;
}

Measured memory_bytes: 1400
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c> {i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifndef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni( != ) cerr << boolalpha << i;
	ris;
} eni( == ) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()
#define prec fixed << setprecision(12)
#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 test int t; cin >> t; while (t--)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve() {
	string s;
	cin >> s;
	string a = s.substr(0, 2);
	string b = s.substr(2, 4);
	debug() << imie(a) << imie(b);
	if (a >= "01" && a <= "12" && b >= "01" && b <= "12")
		cout << "AMBIGUOUS";
	else if (a >= "01" && a <= "12")
		cout << "MMYY";
	else if (b >= "01" && b <= "12")
		cout << "YYMM";
	else
		cout << "NA";
}

int32_t main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// test
	solve();
	return 0;
}

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

int main() {
  int a,b,c;
  cin >> a >> b >> c;

  int ans;
  if (a == b && b == c) {
    ans = 1;
  } else if(a==b || b==c ||a==c) {
    ans = 2;
  } else {
    ans = 3;
  }

    cout << ans << endl;


  return 0;
}


Measured memory_bytes: 256
Option Infer On
Imports System.Collections.Generic
Imports System.Console

Module Program
    Sub Main()
        Dim N As Integer = NextInt()
        Dim M As Integer = NextInt()
        Dim dic = New Dictionary(Of Integer, Integer)

        For i = 1 To N
            dic(i) = 0
        Next

        For i = 1 To M
            Dim a = NextInt()
            Dim b = NextInt()

            dic(a) = dic(a) + 1
            dic(b) = dic(b) + 1
        Next

        For i = 1 To N
            WriteLine(dic(i))
        Next
    End Sub

    Function NextInt() As Integer
        Return CInt(NextString())
    End Function

    Function NextString() As String
        Dim result As New List(Of Char)
        Do
            Dim tmp = Read()
            If tmp < 0 Then Exit Do
            Dim nextChar = Chr(tmp)

            If Not Char.IsWhiteSpace(nextChar) Then
                result.Add(nextChar)
            ElseIf nextChar <> vbCr Then
                Exit Do
            End If
        Loop
        Return New String(result.ToArray())
    End Function

End Module


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    string st;

    ll n , k;

    ll a , b , c;




    cin >> n >> k;

    cin >> a >> b >> c;


    cin >> st;


    ll count = k;

    for(int i=k; i<n; i++)
    {
        if(st[i]==st[i-k])
        {
            st[i] = 'a';
        }

    }

    for(int i=0; i<n; i++)
    {
        if(st[i] != 'a')
        {
            if(st[i]=='r')
                st[i] = 'p';
            else if(st[i]=='s')
                st[i] = 'r';
            else if(st[i]=='p')
                st[i] = 's';
        }
    }

   // cout << st << endl;



    ll sum = 0;



    for(int i=0; i<n  ; i++)
    {
        if(st[i]=='r')
            sum += a;
        else if(st[i]=='s')
            sum += b;
        else if(st[i]=='p')
            sum += c;
    }


    cout << sum << endl;





    return 0;
}



Measured memory_bytes: 512
#include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define rep(i, n) for(int i = 0; i < n; i++)
#define ALL(x) (x).begin(), (x).end()  //昇順
#define RALL(x) (x).rbegin(), (x).rend() // 降順
const long long mod = 1e9+7;
typedef priority_queue<int> PQ;
typedef vector<long long> Vl;
typedef vector<int> VI;  // VI a(n);
typedef vector<string> VS;  
typedef vector<char> VC; 
typedef vector<VS> VSS;
typedef vector<VC> VCC;    
typedef vector<VI> VVI;   // VVI a(n,vector<int>(m)) n * m 
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef map<int, int> MP;   //MP a;
typedef vector<pair<int, int> > PS;
typedef long long ll;  //ll とdoubleは違う
template <class T>  // chmax(max, a);
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T> //chmin(min,a)
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
template<typename T>   // operator << (cout,a);
ostream& operator << (ostream& os, vector<T>& v) {
    os << "{";
    rep(i, (int)v.size()) { os << v[i] << (i < v.size() - 1 ? ", " : ""); }
    os << "}";
    return os;
}

int main(){
    int c,d=0,x=0,n,r=0,g,m,p,h,k,w,max=-10000000,min=1000000000,ans=0,sum=0;
    string s;
    bool f=true;
    cin >> h >> w;
    VCC a(h,vector<char>(w));

    rep(i,h){
        rep(j,w){
            cin >> a[i][j];
        }
    }
    
    while(x<=h-1){
        sum = 0;
        rep(j,w){
            if(a[d][j]=='.')
                sum++;
        }
        if(sum == w){
            g++;
            for(int k=d; k<h-1;k++){
                rep(j,w){
                    a[k][j] = a[k+1][j];
                }
            }
        }
        else{
            d++;
        }
        x++;
    } 

    x=0;
    d=0;
    
    while(x<=w-1){
        sum = 0;
        rep(i,h-g){
            if(a[i][d]=='.')
                sum++;
        }
        if(sum == h-g){
            r++;
            for(int k=d; k<w-1;k++){
                rep(i,h-g){
                    a[i][k] = a[i][k+1];
                }
            }
        }
        else{
            d++;
        }
        x++;
    }

    rep(i,h-g){
        rep(j,w-r){
            if(j==w-1-r)
                cout << a[i][j] <<endl;
            else
                cout << a[i][j];
        }
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAXN 4000007
#define ll long long
#define mo 19930726
using namespace std;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
ll a[MAXN],sum[MAXN],n,m,ans;
map<ll,ll> mp;
int main()
{
	cin>>n>>m;
	for(re int i=1;i<=n;i++){
		cin>>a[i];
		sum[i]=(sum[i-1]+a[i])%m;
	}
	for(re int i=1;i<=n+1;i++){
		ans+=mp[sum[i]];
		mp[sum[i]]++;
	}
	cout<<ans;
}

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

using namespace std;
using ll = long long;

//container util
#define SORT(c) sort((c).begin(),(c).end())

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

const int INF = 1e9;

int main(void){

	int N; cin >> N;
	vector<int> X(N);

	REP(i,N) cin >> X[i];

	int ans = INF;
	REP(i, 100){
		int sum = 0;
		REP(j,N) sum += pow(i - X[j], 2);
		ans = min(ans, sum);
	}

	cout << ans << endl;


	return 0;

}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn=105;
int main(){
	int n,x,a[maxn];
	cin>>n>>x;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int minn=INT_MAX,le=x;
	for(int i=0;i<n;i++){
		if(a[i]<minn) minn=a[i];
		le-=a[i];
	}
	int ans=le/minn+n;
	cout<<ans<<endl;
	return 0;
}

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


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

const int oo = 1e9 + 7;
const int mod = 1e9 + 7;

int main (){
    int n, i, m;
    string s;
    cin >> n >> m >> s;
    i = n;

    vector<int>ans(n+1, 0);

    if (s[0] == '1' || s[n] == '1') {
        cout << "-1" << endl;
        return 0;
    }

    while (i > 0){
        int next = max(i-m, 0);
        while (next < i and s[next] == '1') next++;
        if (next == i) {
            cout << "-1" << endl;
            return 0;
        }
        else {
            ans[next] = 1;
            i = next;
        }
    }
    ans[n] = 1;
    ans[0] = 0;
    int last = 0;
    for (int i=0; i<n+1; i++){
        if (ans[i] == 1) {
            cout << i - last << " ";
            last = i;
        }
    }

    cout << endl;
    return 0;
}

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

#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

//#define int int64_t
//int a[N+2];

int32_t  main(){
	IOS;
  string s;cin>>s;
  int n=s.size();
  int ans=0;
  for(int i=0;i<n;++i){
    for(int j=i;j<n;++j){
      int cnt=0;
      for(int k=i;k<=j;++k){
        if(s[k]=='A' || s[k]=='T' || s[k]=='G' || s[k]=='C')cnt++;
        else {cnt=0;break;}
      }
      ans=max(ans,cnt);
    
    }
  }
  cout<<ans<<endl;

  return 0;
}



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

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;

  //         a ------ b
  // c --- d
  //      c --- d
  //          c --- d
  //               c --- d
  //                    c --- d
  //      c ------------- d

  int lower = max(a, c);
  int upper = min(b, d);

  cout << max(0, upper - lower) << endl;
  return 0;
}


Measured memory_bytes: 3588
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;
typedef long double ld;
//typedef pair<int,int> P;
double const PI=3.141592653589793;
int const INF=1001001001;
ll const LINF=1001001001001001001;
ll const MOD=1000000007;

int N;
int a[100001];

int main(){
    cin>>N;
    repn(i,N) cin>>a[i];

    int ans=0;
    repn(i,N){
        if(i==a[a[i]]) ans++;
    }
    ans/=2;

    cout<<ans<<endl;
}

Measured memory_bytes: 3948
#include <stdio.h>

int main(void)
{
	int x,y;
	while(1){
		scanf("%d %d",&x,&y);
		if(x==0 && y==0)
		 break;
		if(x<y)
		printf("%d %d\n",x,y);
		
		else
		printf("%d %d\n",y,x);
		
	}
	return 0;
}

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

template<typename T>
inline bool chmax(T& a, const T& b) {
    if (a < b){
        a = b;
        return true;
    }
    return false;
}

template<typename T>
inline bool chmin(T& a, const T& b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

/**
 * @brief 多次元 vector の作成
 * @author えびちゃん
 */
namespace detail {
    template<typename T, int N>
    auto make_vec(vector<int>& sizes, T const& x) {
        if constexpr (N == 1) {
            return vector(sizes[0], x);
        } else {
            int size = sizes[N-1];
            sizes.pop_back();
            return vector(size, make_vec<T, N-1>(sizes, x));
        }
    }
}
template<typename T, int N>
auto make_vec(int const(&sizes)[N], T const& x = T()) {
    vector<int> s(N);
    for (int i = 0; i < N; ++i) s[i] = sizes[N-i-1];
    return detail::make_vec<T, N>(s, x);
}

__attribute__((constructor))
void fast_io() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

struct Sieve {
    int n;
    vector<int> f, primes;
    Sieve(int n=1) : n(n), f(n+1) {
        f[0] = f[1] = -1;
        for (long long i = 2; i <= n; ++i) {
            if (f[i]) continue;
            primes.push_back(i);
            f[i] = i;
            for (long long j = i*i; j <= n; j += i) {
                if (!f[j]) f[j] = i;
            }
        }
    }
    bool isPrime(int x) { return f[x] == x;}
    vector<int> factorList(int x) {
        vector<int> res;
        while (x != 1) {
            res.push_back(f[x]);
            x /= f[x];
        }
        return res;
    }
    vector<pair<int, int>> factor(int x) {
        vector<int> fl = factorList(x);
        if (fl.size() == 0) return {};
        vector<pair<int, int>> res(1, pair<int, int>(fl[0], 0));
        for (int p : fl) {
            if (res.back().first == p) {
                res.back().second++;
            } else {
                res.emplace_back(p, 1);
            }
        }
        return res;
    }
} sieve(1e6);

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];

    bool pairwise = true;
    map<int, int> mp;
    int num = n;
    vector<vector<pair<int, int>>> fs(n);
    rep(i, n) {
        fs[i] = sieve.factor(a[i]);
        rep(j, fs[i].size()) {
            if (mp.count(fs[i][j].first)) pairwise = false;
            else mp[fs[i][j].first] = num++;
        }
    }
    if (pairwise) {
        cout << "pairwise coprime\n";
        return 0;
    }
    vector<int> cnt(num);
    rep(i, n) {
        rep(j, fs[i].size()) {
            cnt[mp[fs[i][j].first]]++;
        }
    }

    rep(i, num) {
        if (cnt[i] == n) {
            cout << "not coprime\n";
            return 0;
        }
    }
    cout << "setwise coprime\n";
}


Measured memory_bytes: 113548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
  ll n, k;
  cin >> n >> k;
  vector<ll> arr(n, INT_MAX);
  vector<ll> dp(n, INT_MAX);
  for (int i = 0; i < n; i++)
    cin >> arr[i];
  dp[0] = 0;
  dp[1] = abs(arr[1] - arr[0]);
  for (int i = 2; i < n; i++) {
    for (int j = 0; j < k; j++) {
      if (i - j - 1 < 0) {
        continue;
      }
      dp[i] = min(dp[i], abs(arr[i] - arr[i - j - 1]) + dp[i - j - 1]);
    }
  }
  cout << dp[n - 1] << endl;
}


Measured memory_bytes: 4800
#include <iostream>
using namespace std;
#include <set>
int main(){
    int N,i;
    string S;
    set<string> record;
    cin >> N;
    for(i=0;i<N;i++){
        cin >> S;
        //cout << "get " + S + '\n';
        record.insert(S);
    }
    cout << record.size();
    return 0;
}


Measured memory_bytes: 19136
n = int(input())
w = [int(item) for item in input().split()]
total = sum(w)
s1 = 0
s2 = total
ans = abs(s2 - s1)
for item in w:
    s1 += item
    s2 -= item
    ans = min(ans, abs(s2-s1))
print(ans)

Measured memory_bytes: 3060
//線分状の格子点の数

#include <iostream>
#include <vector>
#include <utility>
#include <climits>
#include <random>
#include <queue>
#include <iomanip>
#include <algorithm>
#include <complex>
#include <string>

using namespace std;

int main(){
    int n, count=0;
    string s;
    cin >> n;
    cin >> s;
    int pos = s.find("ABC");
    while(pos != string::npos){
        pos = s.find("ABC", pos + 3);
        count++;
    }
    cout << count << endl;
    return 0;
}

Measured memory_bytes: 3624
#include <cstdio>
#include <cstring>

const int MAXN = 2e5 + 5;
char S[MAXN];

int main() {
	scanf("%s", S + 1);
	int len = strlen(S + 1), pre = 0;
	for (int i = 1; i <= len; i++) {
		pre += S[i] - '0';
		pre %= 9;
	}
	if (pre == 0) printf("Yes");
	else printf("No");
	return 0;
}


Measured memory_bytes: 1840
#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main(){
  double N,x,y;cin>>N;
  vector<pair<double,double>>s(N);
  for(int i=0;i<N;i++){
    cin>>x>>y;
    s.at(i)=make_pair(x,y);
  }
  int c=0;
  double l=0;
  sort(s.begin(),s.end());
  do{
    c++;
    for(int i=1;i<N;i++)l+=sqrt((s.at(i).first-s.at(i-1).first)*(s.at(i).first-s.at(i-1).first)+(s.at(i).second-s.at(i-1).second)*(s.at(i).second-s.at(i-1).second));
  }while(next_permutation(s.begin(),s.end()));
  printf("%lf",l/c);
}

Measured memory_bytes: 384
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>
#include <random>
#include <ctime>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

int main() {
  int a, b;
  cin >> a >> b;
  if (a <= 8 && b <= 8) {
    cout << "Yay!" << endl;
  } else {
    cout << ":(" << endl;
  }
  return 0;
}


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

#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n) REP(i,0,n)

char c2i(char c){return c-'0';}

const string key[10] = {
  "",
  ".,!? ",
  "abc",
  "def",
  "ghi",
  "jkl",
  "mno",
  "pqrs",
  "tuv",
  "wxyz"
};

void solve() {
  string s; cin>>s;
  
  int now = 0, count = 0;
  rep(i,s.size()) {
    if (s[i] == '0') {
      if (count == 0) continue;
      count--;
      count %= key[now].size();
      cout<<key[now][count];
      now = count = 0;
    } else {
      if (now == 0) {
        now = c2i(s[i]);
      }
      count++;
    }
  }
  cout<<endl;
}

int main (int argc, char const* argv[]) {
  int n; cin>>n;
  rep(i,n) solve();  
  return 0;
}

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

int main(){
  int A, B;
  cin >> A >> B;
  int res = 1;
  if (B == 1) {
    res = 0;
  }
  for (size_t i = 1; B > A+(A-1)*(i-1); i++) {
    res++;
  }
    cout << res << '\n';
}


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

int main(){
    int n;
    string s;
    cin>>n>>s;
    int res=0;
    for(int l=0;l<n;l++){
        int cnt=0;
        for(int i=0;i+l<n;i++){
            if(s[i]==s[i+l])cnt++;
            else cnt=0;
            res=max(res,min(l,cnt));
        }
    }
    cout<<res<<endl;
}


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

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> ord(m, {0, 0});
    rep(i, m) cin >> ord[i].first >> ord[i].second;

    map<int, vector<int>> list;
    for (auto p : ord)
        list[p.first].push_back(p.second);

    map<pair<int, int>, string> id;
    for (auto p : list) {
        sort(p.second.begin(), p.second.end());
        rep(i, p.second.size()) {
            stringstream ss;
            ss << setw(6) << setfill('0') << p.first << setw(6) << setfill('0') << i + 1;
            id[{p.first, p.second[i]}] = ss.str();
        }
    }

    for(auto p : ord) {
        cout << id[p] << endl;
    }
}


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

typedef long long ll;
typedef vector<int> vint;
typedef vector<vector<int>> vvint;

#define rep(i,n) for(ll i=0;i<n;i++)

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

  ll ans = 1;

  ll now = 1;
  while(now <= n){
    now *= k;
    ans++;
  }
  cout<<ans-1<<endl;

}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		int w = sc.nextInt();
		String ini ="";
		for(int i = 0; i < S.length(); i+=w) {
			ini += S.substring(i, i + 1);
		}
		System.out.println(ini);
		}

}


Measured memory_bytes: 22996
#include<stdio.h>
int main()
{
int a,b,c,d,e;
  scanf("%d %d",&a,&b);
c=a+b;
d=a-b;
e=a*b;
  if(b>0){if(c>e) printf("%d",c);
          else printf("%d",e);
          }
  else{if(d>e) printf("%d",d);
       else printf("%d",e);
      }
return 0;
}

Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  x, y = map(int, input().split())
  x = x - 1
  y = y - 1
  p = (300000, 200000, 100000, 0)
  v = 0

  v += p[min(x, len(p) - 1)]
  v += p[min(y, len(p) - 1)]

  if x + y == 0:
    v += 400000

  print(v)


if __name__ == '__main__':
  main()


Measured memory_bytes: 38384
#include <stdio.h>

int main() {
    
    int a[1000];
    int n, i, v, j;
    
    scanf("%d", &n);
    
    
    for (i = 0; i < n; ++i){
        scanf("%d", &a[i]);
    }
    
    for (j = 0; j < n; ++j){
        printf("%d",a[j]);
        if (j != n-1) {
            putchar(' ');
        }
        else{
            putchar('\n');
        }
    }

    
    for (i = 1; i < n; ++i){
        v = a[i];
        j = i - 1;
        while(j >= 0 && a[j] > v){
            a[j+1] = a[j];
            j--;
        }
        a[j+1] = v;
        
        for (j = 0; j < n; ++j){
            printf("%d",a[j]);
            if (j != n-1) {
                putchar(' ');
            }
            else{
                putchar('\n');
            }
        }
    }
    
}

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

using namespace std;

int n, m, k, ans;
map<int, int> mx, my;
map<int, vector<int>> xx, yy;
set<pair<int, int>> s;

int main() {
	scanf("%d%d%d", &n, &m, &k);
	while (k--) {
		int ta, tb;
		scanf("%d%d", &ta, &tb);
		mx[ta]++;
		my[tb]++;
		s.insert({ta, tb});
	}
	for (auto& i : mx)
		xx[i.second].push_back(i.first);
	for (auto& i : my)
		yy[i.second].push_back(i.first);
	ans = xx.rbegin()->first + yy.rbegin()->first;
	for (int i : xx.rbegin()->second)
		for (int j : yy.rbegin()->second)
			if (!s.count({i, j})) {
				printf("%d\n", ans);
				return 0;
			}
	printf("%d\n", ans - 1);
}

Measured memory_bytes: 49688
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    string S;
    cin >> S;
 
    bool check = false;
    int i;
    for(i = 2; i < S.size()-1; i++) {
        
        if(S[0]=='A'&&S[i]=='C'){
             check=true;
             break;
       }
    }
    int j;
    for(j = 1; j < i; j++) {
        if(isupper(S[j])){
            check=false;
        }
    }
    for(int k = i+1; k < S.size(); k++) {
        if(isupper(S[k])){
            check=false;
        }
    }

    
	
    cout << (check?"AC":"WA") << endl;

	return 0;
}

Measured memory_bytes: 256
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

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

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

#define CLR(a) memset((a), 0 ,sizeof(a))

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


int main(void){
  int K, T;
  cin >> K >> T;
  vector<pair<int, int> > a;
  pair<int, int> p;
  int last;
  int ans = 0;

  REP(i, T){
    int temp;
    cin >> temp;
    p.first = temp;
    p.second = i;
    a.PB(p);
  }
  if(T == 1){
    cout << a[0].first-1 << endl;
    return 0;
  }

  REP(i, T) a[i].first *= -1;
  SORT(a);
  REP(i, T) a[i].first *= -1;

  last = -1;

  while(a[0].first != 0){
    if(last != a[0].second){
      a[0].first--;
      last = a[0].second;
    }
    else{
      if(a[1].first != 0){
        a[1].first--;
        last = a[1].second;
      }
      else{
        a[0].first--;
        last = a[0].second;
        ans++;
      }
    }
    REP(i, T) a[i].first *= -1;
    SORT(a);
    REP(i, T) a[i].first *= -1;
  }

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repI(i, d, n) for (int i = (d); i < (n); ++i)
#define reps1(i, n) for (int i = 1; i < (n); ++i)
using namespace std;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using M = map<int, int>;
using Ml = map<ll, ll>;
ll const INF = 1ll<<61;
double pi = 3.141592653589793238;

int main() {
  ll a, b;
  string s;
  cin >> a >> b >> s;

  rep(i, a) {
    ll isnumber = false;
    rep(j, 10) {
      if(s[i] == '0' + j) isnumber = true;
    }
    if (!isnumber) {
      cout << "No" << endl;
      return 0;
    }
  }

  if (s[a] != '-' ) {
    cout << "No" << endl;
    return 0;
  }

  repI(i, a+1, a+b+1) {
    ll isnumber = false;
    rep(j, 10) {
      if(s[i] == '0' + j) isnumber = true;
    }
    if (!isnumber) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 3548
using System;

namespace ConsoleApplication3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int W = int.Parse(input[0]); 
            int H = int.Parse(input[1]); 
            int x = int.Parse(input[2]); 
            int y = int.Parse(input[3]);
            int r = int.Parse(input[4]);

            if (calc(W, H, x, y, r))
            {
                Console.WriteLine("Yes");
            }else
            {
                Console.WriteLine("No");
            }
        }
        
        static private bool calc (int W, int H, int x, int y, int r)
        {
            if ((x + r <= W && x - r >= 0) && (y + r <= H && y - r >= 0))
            {
                return true;
            }
            return false;
        }
    }
}

Measured memory_bytes: 8860
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstdlib>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <vector>
#define DEBUG 1
constexpr int kMod = 1000000007;
typedef long long LL;

int main() {
  int N, K; std::cin >> N >> K;
  int max = 0;
  for (int i = N - 2; i >= 1; --i) max += i;

  int diff = max - K;
  if (diff<0) {
    std::cout << -1 << std::endl;
    return 0;
  }

  std::cout << diff + (N - 1) << std::endl;
  for (int i = 2; i <= N; ++i) {
    std::cout << 1 << " " << i << std::endl;
  }

  int M = N - 1;
  for (int i = 2; i < N; ++i) {
    for (int j = i + 1; j <= N; ++j) {
      if (M == diff + N - 1) break;
      std::cout << i << " " << j << std::endl;
      ++M;
    }
  }
}


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

int main() {
        double x1, y1, x2, y2;
        double result, temp;
        cin >> x1 >> y1 >> x2 >> y2;
        temp = pow(x1 - x2, 2) + pow(y1 - y2, 2);
        result = sqrt(temp);
        cout << fixed;
        cout << result << endl;
        return 0;
}

Measured memory_bytes: 3244