akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i=s;i<n;i++)
#define repe(i,s,n)for(ll i=s;i<=n;i++)
#define rep_r(i,s,n)for(ll i=n-1;i>=s;i--)

#define repe_r(i,s,n)for(ll i=s;i<=n;i++)
static const ll MOD = 1e9 + 7;
static const ll MAX_L = 1e9 + 7;

bool p[26] = {};
int main() {
	string s; cin >> s;
	rep(i, 0, s.size()) {
		p[s[i] - 'a'] = true;
	}
	ll minV = MAX_L;
	rep(i, 0, 26) {
		if (p[i]) {
			char c = i + 'a';
			string t = s;

			ll cnt = 0;
			while (1) {
				bool same = true;
				rep(i, 0, t.size())same &= (c == t[i]);
				if (same)break;

				string r = t;
				rep(i, 0, t.size()) {
					if (c == t[i]) {
						if (i >= 1) {
							r[i - 1] = t[i];
						}
					}
				}
				t = r.substr(0, r.size() - 1);
				cnt++;

				//cout << t << endl;
			}

			minV = min(cnt, minV);
		}
	}
	if (minV == MAX_L)cout << 0 << endl;
	else cout << minV << endl;

	return 0;
}

Measured memory_bytes: 256
Row = [[int(i) for i in input().split()] for j in range(3)]
Hole = [[False,False,False] for i in range(3)]
#Column = [[Row[x][y] for x in range(3)] for y in range(3)]
N=int(input())
B = [int(input()) for n in range(N)]
for b in B:
    for r,row in enumerate(Row):
        for c,num in enumerate(row):
            if num==b:
                Hole[r][c] = True


Column = [[Hole[x][y] for x in range(3)] for y in range(3)]
Naname = [[Hole[x][x] for x in range(3)],[Hole[y][2-y] for y in range(3)]]
for c in Column:
    if all(c):print("Yes");exit()
for c in Hole:
    if all(c):print("Yes");exit()
for c in Naname:
    if all(c):print("Yes");exit()
print("No")

Measured memory_bytes: 38384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define INF 1e9
typedef long long ll;
using namespace std;

int main() {
    int a,b,c; cin >> a >> b >> c;
    if(b>c){
        swap(b,c);
    }
    if(a+b>=c){
        cout << 0 << endl;
    }else{
        cout << c-a-b << endl;
    }

    return 0;
}

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

using namespace std;

int n;

set <string> s;

void rec (int pos = 1, string str = "") {
    if (pos == 4) {
        s.insert (str);
        return;
    }
    for (int i = 1;i <= n;i ++) {
        string to = str;
        to += char (i + 48);
        rec (pos + 1, to);
    }
}

int main () {
    cin >> n;
    rec ();
    cout << s.size ();
}


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

using namespace std;

int main() {
    string s;
    cin >> s;

    long long res = 0;
    for (int i = 0, l = 0; i < static_cast<int>(s.size()); i++) {
        if (s[i] == 'W') {
            res += i - l;
            l++;
        }
    }

    cout << res << endl;
}


Measured memory_bytes: 640
import java.io.*;
class Main {
    public static void main(String[] args) throws IOException {
    	int tmp = 0;
        BufferedReader r =
            new BufferedReader(new InputStreamReader(System.in), 1);
        int S = Integer.parseInt(r.readLine());
        int s = S%60;
        tmp = S/60;
        int m = tmp%60;
        tmp = tmp/60;
        int h = tmp%60;
        System.out.println(h + ":" + m + ":" + s);
    }
}

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

int main()
{
	ios::sync_with_stdio(0);
	long long a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 1)puts("IMPOSSIBLE");
	else cout << (a + b) / 2 << endl; 
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(){
  char c1[10];
  char c2[10];

  scanf("%s", c1);
  scanf("%s", c2);

  if(c1[0] == c2[2] && c1[1] == c2[1] && c1[2] == c2[0]){
    printf("YES\n");
  }else{
    printf("NO\n");
  }
  
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb emplace_back
#define mt make_tuple
#define gcd __gcd
#define bitcount(x)  __builtin_popcount(x)
#define bitcountll(x)  __builtin_popcountll(x)
#define PI 3.141592653589
// Input
#define in(a) scanf("%d",&a)
#define in2(a,b) scanf("%d%d",&a,&b)
#define in3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define llin(a) cin >> a
#define inl(a) scanf("%lld",&a)
#define read(v,i,n) for(i=0;i<n;i++)in(v[i])
#define twod(mat,i,j,n,m) rep(i,n){rep(j,m)in(mat[i][j]);}
#define sc(ch) scanf("%c",&ch)
#define sstr(str) scanf("%s",str)
// Output
#define pr(a) printf("%d ",a)
#define pr2(a,b) printf("%d %d\n",a,b)
#define pr3(a,b,c) printf("%d %d %d\n",a,b,c)
#define out(a) printf("%d\n",a)
#define outl(a) printf("%lld\n",a)
#define llpr(a) cout << a << " "
#define llout(a) cout << a << "\n"
#define yes printf("YES\n")
#define no printf("NO\n")
#define lin printf("\n")
// Iterator
#define lp(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) for(i=0;i<n;i++)
#define all(vec) vec.begin(),vec.end()
#define lower(v,k) lower_bound(v.begin(),v.end(),k)-v.begin()
#define upper(v,k) upper_bound(v.begin(),v.end(),k)-v.begin()
#define tf(mytuple) get<0>(mytuple)
#define ts(mytuple) get<1>(mytuple)
#define tt(mytuple) get<2>(mytuple)
// Debug
#define dbg(v,i,n) for(i=0;i<n;i++)pr(v[i]); lin
#define what(x) cerr << #x << " : " << x << "\n"
#define ck printf("continue\n")
#define debug(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args)
{
	cerr << *it << " = " << a << "\n";
	err(++it, args...);
}
// Data Type
#define ll long long int
#define ii pair<int,int>
#define pli pair<ll,int>
#define triple tuple<int,int,int>
#define vi vector<int>
#define vii vector<pair<int,int> >
#define vvi vector<vector<int> >
#define viii vector<pair<pair<int,int>,int> >
#define vvii vector<vector<pair<int,int> > >
#define M 1000000007
#define N 100005  //check the limits, man
int main()
{
    int i,n,p;
    in(n);
    vi v(n);
    read(v,i,n);
    p=1;
    rep(i,n)
    {
        if(v[i]==p)
            p++;
    }
    p--;
    if(p==0)
        out(-1);
    else
        out(n-p);
}




Measured memory_bytes: 1024
from collections import deque
import sys
N,M=map(int,input().split())
table=[[] for i in range(N)]
ans=[]
for i in range(M):
    a,b,c=map(int,input().split())
    table[a-1].append((b-1,c))
    table[b-1].append((a-1,c))
    ans.append((a-1,b-1,c))
h=deque()
inf=-10**13
h.append(0)
flag=True
visit=[(inf,0)]*N
visit[0]=(0,0)
tree=[]
while h:
    x=h.popleft()
    for y,d in table[x]:
        if visit[y][0]!=inf and visit[y][1]==visit[x][1]:
            flag =False
            tree.append((x,y,d))
        elif visit[y][0]!=inf:
            if (visit[x][0]+visit[y][0])!=d:
                print(0)
                sys.exit()
        if visit[y][0]==inf:
            t=(visit[x][1]+1)%2
            visit[y]=(d-visit[x][0],t)
            h.append(y)
if flag:
    mi=-inf
    ma=-inf
    for i in range(N):
        if visit[i][1]==0:
            mi=min(mi,visit[i][0])
        else:
            ma=min(ma,visit[i][0])
    print(max(0,ma+mi-1))
    sys.exit()
a,b,c=tree[0]
s=visit[a][1]
t=visit[a][0]+visit[b][0]
w=(c-t)//2
for i in range(N):
    if visit[i][1]==s:
        x=visit[i][0]
        visit[i]=(x+w,s)
    else:
        x=visit[i][0]
        visit[i]=(x-w,(s+1)%2)
for x,y,d in ans:
    if (visit[x][0]+visit[y][0])!=d:
        print(0)
        sys.exit()
for i in range(N):
    if visit[i][0]<=0:
        print(0)
        sys.exit()
print(1)

Measured memory_bytes: 63564
import sys
readline = sys.stdin.buffer.readline
def even(n): return 1 if n%2==0 else 0
from decimal import *
getcontext().prec = 20 #小数点何桁か
a,b = readline().rstrip().decode('utf-8').split()
a = Decimal(a)
b = Decimal(b)
c = Decimal(a*b)
print(int(c))


Measured memory_bytes: 71380
#include <vector>
#include <iostream>
#include <cmath>
#include <map>
#include <algorithm>
#include <fstream>
#include <unistd.h>
#include <string>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<vector<string>> vvs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
const int INF = 1001001001;
const ll LINF = 1e18;
const ll mod = 1e9 + 7;

template <typename T>
T gcd(T a, T b) {
    if(a < b) gcd(b, a);
    T r;
    while((r=a%b)) {
        a = b; b = r;
    }
    return b;
}

char c[55][55];
ll H, W;

int main() {
    cin >> H >> W;
    for(int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j ++) {
            cin >> c[i][j];
        }
    }
    
    ll count = 0;
    for(int i = 1; i <= H; i++){
        for (int j = 1; j <= W; j ++) {
            if(c[i][j] == '#' && (c[i-1][j] != '#' && c[i+1][j] != '#' && c[i][j-1] != '#' && c[i][j+1] != '#')){
                count++;
            }
        }
    }
    
    cout << (count == 0 ? "Yes" : "No") << endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<stdio.h>
#include<stdlib.h>
#include <algorithm>
#include <set>
#include<math.h>
#include<cmath>
#include<vector>
#include<map>
#include<random>
using namespace std;

int main(){
    int n;cin >> n;
    int l[n];
    int t = 0;
    int tmp = 0;
    int id = 0;
    for(int i = 0;i < n;i++){
        cin >> l[i];
        if(tmp < l[i]){
            tmp = l[i];
            id = i;
        }
    }
    for(int i = 0;i < n;i++){
        if(i == id)continue;
        t += l[i];
    }

    if(tmp < t){
        cout << "Yes" << endl;
    }else{cout << "No" << endl;}

}

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

using namespace std;

//#define FILE_IO

typedef long long LL;

const int mod = 1e9 + 7;
const int base = 31;

int N;
char s[200005];
int f[35];

LL ans;

int main()
{
    #ifdef FILE_IO
    freopen("1.in", "r", stdin);
    freopen("1.out", "w", stdout);
    #endif

    scanf("%s", s + 1);
    N = strlen(s + 1);

    ans = 1LL * N * (N + 1) / 2LL;
    LL sol = 0;
    for(int i = 1; i <= N; i++)
    {
        f[ s[i] - 'a' ]++;
        ans -= f[ s[i] - 'a' ];
    }
    ans++;

    cout << ans;

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		char[] v = sc.next().toCharArray();
		for (int i = 0; i < v.length; ++i) {
			v[i] = (char) ((v[i] - 'A' + 23) % 26 + 'A');
		}
		System.out.println(String.valueOf(v));
	}
}

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

int	main() {
	int	h,n;
  	cin >> h >> n;
  	vector<int> skills(n);
  	for (int i=0;i<n;i++) cin >> skills.at(i);
  	int	total = 0;
  	for (int i=0;i<n;i++) total += skills.at(i);
  	if (h > total) cout << "No" << endl;
  	else cout << "Yes" << endl;
}

Measured memory_bytes: 640
import java.util.HashMap;
    import java.util.Scanner;
    public class Main {
    	public static void main(String[] args) {
    		Scanner sc = new Scanner(System.in);
    		int N = sc.nextInt();
    		HashMap<String,String> map = new HashMap<>();
    		for(int i = 1;i<=N;i++) {
    			map.put(sc.next(),String.valueOf(i));
    		}
    		for(int j = 1;j<=N;j++) {
    			System.out.print(map.get(String.valueOf(j))+" ");
    		}
    	}
    }

Measured memory_bytes: 80540
import java.util.Scanner;

public class Main{
	int nx;
	int ny;
	int[] dx = {0,-1,0,1};
	int[] dy = {1,0,-1,0};
	char[][] map;
	boolean flagW ;
	boolean flagB ;
	int res = 0;


	void dfs(int y, int x){
		int sx;
		int sy;
		map[y][x] = 'X';

		for(int i=0; i<4; i++){
			sy = y + dy[i];
			sx = x + dx[i];
			if(sx < 0 || sy <0 || sx >= nx || sy >= ny) continue;

			if(map[sy][sx] == '.'){
				res++;
				dfs(sy,sx);
			}
			else if(map[sy][sx] == 'W')
				flagW = true;

			else if(map[sy][sx] == 'B')
				flagB = true;
		}

	}


	void run(){
		Scanner sc = new Scanner(System.in);


		while (true) {
			nx = sc.nextInt();
			ny = sc.nextInt();
			String p = sc.nextLine();

			int cntW = 0;
			int cntB = 0;
			map = new char[ny][];

			if(nx == 0 && ny == 0) break;


			for (int i = 0; i < ny; i++) {
				String s = sc.nextLine();
				map[i] = s.toCharArray();
			}



			for (int i = 0; i < ny; i++) {
				for (int j = 0; j < nx; j++) {
					if (map[i][j] != '.')
						continue;

					flagW = false;
					flagB = false;
					res = 1;

					dfs(i, j);

					if (flagW && !flagB)
						cntW += res;
					if (flagB && !flagW)
						cntB += res;

				}
			}

			System.out.println(cntB + " " + cntW);
		}

	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 31964
#include<iostream>
using namespace std;
 
int main()
{
    // get two integer
    int a,b;
    cin >> a>>b;

    // output
if(a%3==0||b%3==0||(a+b)%3==0)
    cout <<  "Possible" <<endl;
else
    cout <<  "Impossible"<<endl ;
    return 0;
}

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

int main(int , char **)
{
#ifdef LOCAL_DEBUG
	struct stat sb;
	ifstream in("/dev/shm/input.txt");
	if (stat("/dev/shm/input.txt",&sb)==0){ cin.rdbuf(in.rdbuf()); }
#endif

	char a[10]={};
	cin >> a;
	int ans=0;
	for(int i=0;i<6;i++){
		if (a[i]=='1'){ans++;}
	}

	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 256
// 範囲

#include <iostream>
using namespace std;

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

    cin >> a >> b >> c;

    if (((a < b) && (a < c)) && (b < c))
        cout << "Yes\n";
    else
        cout << "No\n";
    return 0;
}


Measured memory_bytes: 3092
#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int u, v; ll w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int pow_mod(ll x, ll n, int m) {
	ll res = 1;
	for (; n > 0; n >>= 1) {
		if (n & 1) res = (res * x) % m;
		x = (x * x) % m;
	}
	return res;
}

struct union_find {
	vector<int> v;
	union_find(int n) : v(n, -1) {}
	int find(int x) { return (v[x] < 0) ? x : (v[x] = find(v[x])); }
	void unite(int x, int y) {
		x = find(x); y = find(y);
		if (x != y) {
			if (-v[x] < -v[y]) swap(x, y);
			v[x] += v[y]; v[y] = x;
		}
	}
	bool same(int x, int y) { return find(x) == find(y); }
	int size(int x) { return -v[find(x)]; }
};

int main() {
	for (;;) {
		int N, M; cin >> N >> M;
		if (N == 0) break;
		union_find uf(N);
		int k = N;
		while (M--) {
			int a, b; cin >> a >> b;
			a--; b--;
			if (uf.same(a, b)) continue;
			uf.unite(a, b);
			k--;
		}
		if (k == N) cout << pow_mod(2, N, MOD) << endl;
		else cout << (pow_mod(2, k, MOD) + 1) % MOD << endl;
	}
}

Measured memory_bytes: 1588
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    ll d;
    cin >> n >> d;
    vector<ll> x(n),y(n);
    rep(i,n) cin >> x[i] >> y[i];
    ll ans = 0;
    rep(i,n){
        if(x[i]*x[i] + y[i]*y[i] <= d*d){
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6372
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

fn main() {
	let mut stdin = String::new();
    std::io::Read::read_to_string(
    	&mut std::io::stdin(),
        &mut stdin).unwrap();
	let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
    	($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let mut k = get!(usize);
    let mut xs = vec![];
    let mut ys = vec![];
    for _ in 0..n {
    	let x = get!();
        if x < 0 {
	        xs.push(x);
        } else if x > 0 {
        	ys.push(x);
        } else {
        	k -= 1;
        }
    }
    if k == 0 {
    	println!("0");
        return;
    }
    xs.reverse();
    if xs.len() == 0 {
    	println!("{}", ys[k - 1].abs());
        return;
    }
    if ys.len() == 0 {
    	println!("{}", xs[k - 1].abs());
        return;
    }
    let mut ans = std::i64::MAX;
    if k <= xs.len() {
    	ans = std::cmp::min(ans, xs[k - 1].abs());
    }
    if k <= ys.len() {
    	ans = std::cmp::min(ans, ys[k - 1].abs());
    }
    for i in 0..n {
    	let j = k - (i + 1) - 1;
        if i >= xs.len() || j >= ys.len() {
        	continue;
        }
        let tmp = xs[i].abs() * 2 + ys[j].abs();
        let tmp2 = xs[i].abs() + ys[j].abs() * 2;
        ans = std::cmp::min(ans, std::cmp::min(tmp, tmp2));
    }
    println!("{}", ans);
}

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

int main(){
    int n,k,a,b;
    set<int> s;
    cin>>n>>k;
    for(int i=0;i<k;i++){
        cin>>a;
        for(int j=0;j<a;j++){
            cin>>b;
            s.insert(b);
        }
    }
    cout<<n-(int)s.size()<<endl;
    return 0;
}

Measured memory_bytes: 3604
m,n = map(int,input().split())

cnt = 0
for i in range(1,m+1):
    for j in range(10,n+1):
        num = 1
        d = str(j)
        l = len(d)
        
        for k in range(l):
            if int(d[k]) < 2:
                num =1
                break
            else:
                num *=int(d[k])
        if num == i and num !=1:
            cnt +=1
print(cnt)

Measured memory_bytes: 9200
#include <bits/stdc++.h>
using namespace std;
using lint     = long long;
const lint inf = 1LL << 60;
const lint mod = 1000000007;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int a, b;
    cin >> a >> b;
    cout << max(0, a - 2 * b) << "\n";
    return 0;
}

Measured memory_bytes: 256
x= int(input())
if x < 600:
    print(8)
elif x< 800:
    print(7)
elif x<1000:
    print(6)
elif x<1200:
    print(5)
elif x<1400:
    print(4)
elif x<1600:
    print(3)
elif x<1800:
    print(2)
else:
    print(1)     

Measured memory_bytes: 9172
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define fi first
#define se second 
#define pb push_back
#define all(x) (x).begin() , (x).end()
#define rep(i,a,b) for( ll i = a ; i < b ; i+=1 )
#define pp pair<ll,ll> 
#define sz(v) (ll)(v.size())
#define hell (ll)1000000007
#define slld(x) scanf("%lld",&x)
ll t = 1 ;
vector<ll> adj[205] ;
void solve() 
{
    ll n , m , ans = -1 ;
    cin >> n ;
    string s ; 
    vector<pp > edges ;
    rep( i , 1 , n + 1 ){
        cin >> s ;
        rep( j , 0 , n ){
            if(s[j]=='1'){
                m++;
                edges.pb({i,j+1});
                adj[i].pb(j+1);
                adj[j+1].pb(i);
            }
        }
    }
    m/=2;
    rep( i , 1 , n + 1 ){
        vector<ll> dist(n+5,hell) , cnt(n+5,0) , vis(n+5,0) ;
        ll mx = 0 ;
        queue<ll> q ;
        q.push(i);
        vis[i]=1;
        dist[i]=0;
        bool f = true ; 
        while(!q.empty()){
            ll x = q.front() ;
			//cout << x << " -> " ; 
            cnt[dist[x]]++;
            q.pop() ;
            for(auto u : adj[x] ){
                if(vis[u]==0){
                    vis[u]=1;
                    dist[u]=dist[x]+1;
                    mx = max(mx,dist[u]+1);
                    q.push(u);
                }
            }
        }
        //cout << '\n' ;
        //ll edge = 0 ;
        if(mx<=2){
			rep(j,1,n+1)if(dist[j]==hell)f=false;
			/*rep(j,0,mx){
				cout << "j : " << j << "-> cnt : " << j << " ," ;
				//cout << '\n' ;
			}
			cout << "\n" ;*/
            for(auto u : edges )
			{
				if(abs(dist[u.fi]-dist[u.se])!=1)f = false;
			}
            if( f ){
                ans = max(ans,mx);
            }
        }
        else{
			//cout << "mx : " << mx << "\n" ;
			f = true ;
            rep(j,0,mx+1){
                bool ff = true ;
                if(dist[j]==2){
                    for(auto u : adj[j] )if(dist[u]!=1)ff = false ;
                    if(ff)dist[j]=0;
                }
            }
            vector<ll> cnt1(n+5,0);
            rep(j,1,n+1){
				//cout << dist[j] << " " ;
                if(dist[j]==hell)f=false;
                else{
                    cnt1[dist[j]]++;
                }
            }
            //cout << "\n" ;
            if(f){
                for(auto u : edges )
				{
					if(abs(dist[u.fi]-dist[u.se])!=1)f = false;
				}
				if(f)ans=max(ans,mx);
            }
        }
    }
    cout << ans << "\n" ;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
//    cin >> t ;
    while(t--){
        solve();
    }
    return 0 ;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
#include <limits>
#include <math.h>
#include <cmath>
#include <cctype>
#include <cstdio>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pll = pair<ll, ll> ;
using vs = vector<string>;
using vb = vector<bool>;
using vll = vector<long long>;
using vvll = vector<vector<long long >>;
#define PI  3.1415926535
#define rep(i, k, n) for(ll i = k; i < n; i++)

int main(){
  ll n, m;
  cin >> n >> m;
  
  vll height (n+1);
  rep(i, 1, n+1){
    cin >> height[i];
  }
  
  vector<vector<pll>> connect (n+1,vector<pll>(0));
  rep(i, 0, m){
    ll a, b; cin >> a >> b;
    connect[a].emplace_back(pll(height[b],b));
    connect[b].emplace_back(pll(height[a],a));
  }
  
  ll ans = 0;
  rep(i, 1, n+1){
    sort(connect[i].begin(),connect[i].end());
    reverse(connect[i].begin(),connect[i].end());
    
    if(connect[i].size() == 0){ans++; continue;}
    else{
      if(height[i] > connect[i][0].first){ans++; continue;}
    }
  }
  
  cout << ans << endl;
    
}






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

using namespace std;

const int N = 2e5 + 10;

int n, k, m;
bool flag[N];
int wa[N];

int  main()
{
	int x;
	scanf("%d%d", &n, &m);
	char op[4];
	int ac = 0, waa = 0;
	for (int i = 1; i <= m; i ++)
	{
		scanf("%d%s", &x, op);
		if(flag[x]) continue;
		if(op[0] == 'W')
		{
			if(!flag[x])
			 wa[x] ++;
		}
		else
		{
			if(!flag[x]) 
			{
				ac ++;
				flag[x] = true;
				waa += wa[x];
			}
		}
	}
//	if(ac == 0) wa = 0;
	cout << ac << " " << waa << endl;
 } 

Measured memory_bytes: 768
import copy
S = input()
# S="R"*(10**5-1)+"L"

pairs = []
index = 0
R_ren = []
L_ren = []
start = 0
tugi_L_sagasu = True
while True:
    if tugi_L_sagasu:
        index = S.find("L", start)
        R_ren.append((start, index-1))
        start = index
        tugi_L_sagasu = False
    else:
        index = S.find("R", start)
        L_ren.append((start, index-1))
        start = index
        tugi_L_sagasu = True

    if index == -1:
        break

# print(R_ren)
# print(L_ren)

ans = [0]*len(S)
for a, b in R_ren:
    if b == -2:
        b = len(S)-1
    people = b - a+1
    ans[b+1] += people//2
    ans[b] += people-people//2

for a, b in L_ren:
    if b == -2:
        b = len(S) - 1
    people = b - a+1
    ans[a] += people-people//2
    ans[a-1] += people//2

strans=""
# print(ans)
for s in ans:
    strans += str(s) + " "

print(strans[:-1])


Measured memory_bytes: 18792
import java.util.Scanner;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a[] = new int[n];
		
		for(int i=0;i<n;i++){
			a[i] = sc.nextInt();
		}
		
		for(int j=n-1;j>0;j--){
			System.out.printf(a[j]+" ");
		}
		System.out.println(a[0]);
		
	}

}




Measured memory_bytes: 26332
#include <stdio.h>

int main(int argc, const char * argv[]) {
    int x, y, z, tmp;
    
    scanf("%d %d %d" , &x, &y, &z);
    if (x>y) {
        tmp=x;
        x=y;
        y=tmp;
    }
    if (y>z) {
        tmp=y;
        y=z;
        z=tmp;
    }
    if (x>y) {
        tmp=x;
        x=y;
        y=tmp;
    }

    printf("%d %d %d\n",x, y, z);
    return 0;
    
}



Measured memory_bytes: 2100
#include<bits/stdc++.h>
#define rep(i, l, r) for(int i = (l), i##end = (r);i <= i##end;++i)
using std::cin; using std::cout;
const int maxn = 200200;
typedef long long ll;
const int mod = 1e9 + 7;
inline ll pow(ll a,int b,int ans = 1) {
	for(;b;b >>= 1,a = a * a % mod) if(b & 1)
		ans = ans * a % mod;
	return ans;
}
inline ll inverse(int x){ return pow(x, mod - 2); }
int n, fa[maxn];
int h[maxn], nxt[maxn];
inline void link(int f,int x) {
	nxt[x] = h[f], h[f] = x;
}
int st[20][maxn], dfn[maxn], size[maxn], dep[maxn], tot;
inline int cmp(int x,int y){ return dfn[x] < dfn[y]; } 
inline int min(int x,int y){ return dfn[x] < dfn[y] ? x : y; }
std::vector<int> v[maxn];
inline void dfs0(int x,int f = 0) {
	dep[x] = dep[f] + 1, v[dep[x]].push_back(x);
	st[0][tot] = f, dfn[x] = ++tot, size[x] = 1;
	for(int i = h[x];i;i = nxt[i]) {
		dfs0(i, x), size[x] += size[i];
	}
}
inline int lca(int x,int y) {
	if(dfn[x] > dfn[y]) std::swap(x, y);
	const int lg = std::__lg(dfn[y] - dfn[x]);
	return x == y ? x : min(st[lg][dfn[x]], st[lg][dfn[y] - (1 << lg)]);
}
namespace vt {
	int h[maxn], nxt[maxn];
	int dp[maxn][2];
	inline void link(int f,int x) { nxt[x] = h[f], h[f] = x; }
	inline void dfs0(int x) {
		if(h[x]) {
			for(int i = h[x];i;i = nxt[i]) dfs0(i);
			static int st[maxn]; int top = 0;
			for(int&i = h[x], m = 1;i;i = nxt[i]) {
				st[++top] = i;
				dp[i][1] = (ll) dp[i][1] * m % mod;
				m = (ll) m * dp[i][0] % mod;
			}
			dp[x][1] = 0;
			for(int i = top, m = 1;i >= 1;--i) dp[x][1] = (dp[x][1] + (ll) dp[st[i]][1] * m) % mod, m = (ll) m * dp[st[i]][0] % mod;
			dp[x][0] = mod + 1 - dp[x][1];
		} else dp[x][0] = dp[x][1] = mod + 1 >> 1;
	}
}
int main() {
	std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	cin >> n, ++n;
	rep(i, 2, n) {
		cin >> fa[i], ++ fa[i];
		link(fa[i], i);
	}
	dfs0(1);
	for(int i = 1;i < 20;++i) for(int j = 1;j + (1 << i) - 1 < n;++j)
		st[i][j] = min(st[i - 1][j], st[i - 1][j + (1 << i - 1)]);
	int ans = 0;
	for(int i = 1;v[i].size();++i) {
		std::vector<int> & v = ::v[i];
		for(int j = 1, s = v.size();j < s;++j) v.push_back(lca(v[j - 1], v[j]));
		sort(v.begin(), v.end(), cmp), v.erase(unique(v.begin(), v.end()), v.end());
		static int st[maxn]; int top = 0;
		for(int i : v) {
			for(;top && dfn[i] >= dfn[st[top]] + size[st[top]];)--top;
			if(top) vt::link(st[top], i);
			st[++top] = i;
		}
		vt::dfs0(v.front());
		ans = (ans + vt::dp[v.front()][1]) % mod;
	}
	cout << ans * pow(2, n) % mod << '\n';
}


Measured memory_bytes: 37504
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MOD 1000000007
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

    vector<int> res;
    rep(i,n){
        int pivot=-1;
        for(int j=(int)a.size()-1;j>=0;j--){
            if(a[j]==j){
                pivot=j;
                break;
            }
        }
        if(pivot==-1){
            cout<<-1<<endl;
            return 0;
        }

        res.push_back(pivot+1);
        a.erase(a.begin()+pivot);
    }

    reverse(all(res));
    rep(i,n) cout<<res[i]<<endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<map>
#include<iomanip>
#include<tuple>
#include<bitset>


using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define printfloat(x) cout << fixed << setprecision(7) << (x) << endl;
#define printbit(x) cout << bitset<15>(x) << endl;
using ll = long long int;



long double pi = 3.14159265359;

int n,a;
int ans;

int main(){
    cin >> n;
    rep(i,n){
        cin >> a;
        if(a%2 == 1 && (i+1)%2 == 1) ans ++;
    }
    cout << ans << endl;


return 0;
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n)-1; i >= 0; i--)
constexpr char newl = '\n';

constexpr int MaxN = 1 << 17;
int k, n, q;

struct node {
  bool flip = 0;
  int rot = 0;
};

node op(node x, node y) {
  if (y.flip) x.rot = -x.rot;
  return node { x.flip ^ y.flip, (x.rot + y.rot) % k };
}

node dat[MaxN*2] = {};

int main() {
  cin.tie(nullptr); ios_base::sync_with_stdio(false);
  cin >> k >> n >> q;
  rep(i, n) {
    int a; cin >> a;
    dat[i+MaxN] = node { a == 0, a % k };
  }
  for (int i = MaxN-1; i; i--) dat[i] = op(dat[i<<1], dat[i<<1|1]);
  rep(_, q) {
    int l, r; cin >> l >> r;
    l--; r--;
    swap(dat[l+MaxN], dat[r+MaxN]);
    for (int t : (int[]){l+MaxN, r+MaxN}) {
      for (t >>= 1; t; t >>= 1) dat[t] = op(dat[t<<1], dat[t<<1|1]);
    }
    if (dat[1].flip) {
      cout << (-dat[1].rot - k) % k - 1 << newl;
    } else {
      cout << (-dat[1].rot + k) % k + 1 << newl;
    }
  }
}


Measured memory_bytes: 5012
import java.util.Scanner;

public class Main {
	long[] cache = new long[2001];
	long[] anss = new long[4001];
	Scanner sc = new Scanner(System.in);

	void init() {
		for (int i = 0; i < 1001; i++) {
			for (int j = 0; j < 1001; j++) {
				cache[i + j]++;
			}
		}

		for (int i = 0; i < 2001; i++) {
			for (int j = 0; j < 2001; j++) {
				anss[i + j] += cache[i] * cache[j];
			}
		}

	}

	void run() {
		init();
		while (sc.hasNext()) {
			int n = sc.nextInt();
			System.out.println(anss[n]);
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

}

Measured memory_bytes: 20584
#include<bits/stdc++.h>
/* #define int long long */
/* #define double long double */
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
#define MOD 1000000007
using namespace std;
using ll = long long;
typedef vector<int> vi;
typedef pair<int, int> P;
#define rrep(i,a,b) for(int i=a;i>=b;i--)

signed main(){
    int n, k;
    cin >> n >> k;
    vi a(n);
    rep(i, n) cin >> a[i];

    rep(i, n-k){
        if(a[i] < a[i+k]){
            cout << "Yes" << endl;
        }else{
            cout << "No" << endl;
        }
    }
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

ll n,m,q;
vl a,b;

int main(){
	cin>>n>>m>>q;
	a=vl(n+2);
	b=vl(m+2);
	a[0]=b[0]=-INF;
	a[n+1]=b[m+1]=INF;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=m;i++) cin>>b[i];
	for(int i=0;i<q;i++){
		ll x;
		cin>>x;
		ll I=lower_bound(a.begin(),a.end(),x)-a.begin();
		ll J=lower_bound(b.begin(),b.end(),x)-b.begin();
		ll A=a[I-1],B=a[I];
		ll C=b[J-1],D=b[J];
		ll res=min(x-A+min(abs(A-C),abs(A-D)),B-x+min(abs(B-C),abs(B-D)));
		swap(A,C);swap(B,D);
		cout<<min({res,x-A+min(abs(A-C),abs(A-D)),B-x+min(abs(B-C),abs(B-D))})<<endl;
	}
}

Measured memory_bytes: 2944
#include <stdio.h>
#define N 8
#define NOT_FREE 1
#define FREE -1

int col[N];
int row[N];
int dpos[2*N-1];
int dneg[2*N-1];
int board[N][N];

void putQueen(int i);
void printboard(void);
void initialize(void);

int main()
{
  int k,i,j,u,v;

  initialize();

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      board[i][j] = 0;
    }
  }


  scanf("%d",&k);
  for(i = 0;i < k;i++){
    scanf("%d %d",&u,&v);
    board[u][v] = 1;
  }

  putQueen(0);

  return 0;
}

void putQueen(int i)
{
  int u,j;
  
  if(i == N){
    printboard();
    return ;
  }

  for(j = 0;j < N;j++){
    if(col[j] == NOT_FREE || dpos[i+j] == NOT_FREE || dneg[i-j+N-1] == NOT_FREE){
      continue;
    }
    row[i] = j;
    col[j] = dpos[i+j] = dneg[i-j+N-1] = NOT_FREE;
    putQueen(i+1);

    col[j] = dpos[i+j] = dneg[i-j+N-1] = FREE;
  }
}

void printboard(void)
{
  int i,j;

  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(board[i][j]){
	if(row[i] != j) return ;
      }
    }
  }
  for(i = 0;i < N;i++){
    for(j = 0;j < N;j++){
      if(row[i] == j) printf("Q");
      else printf(".");
    }
    printf("\n");
  }
}

void initialize(void)
{
  int i;
  for(i = 0;i < N;i++){
    row[i] = FREE;
    col[i] = FREE;
  }
  for(i = 0;i < 2*N-1;i++){
    dpos[i] = FREE;
    dneg[i] = FREE;
  }
}
    

  



Measured memory_bytes: 2112
#include<cstdio>
#include<algorithm>
using namespace std;
int main(void)
{
	int a,s,d[4],f,g,h,i,j,kai,high,low;
	while(1){
		scanf("%d",&a);
		if(a==0000){
			break;
		}
		kai=0;
		s=a;
		h=s;
		while(1){

			if(h==6174){
				printf("%d\n",kai);
				break;
			}
			for(i=0;i<4;i++){
				d[i]=s%10;
				s=s/10;
			}
			if(d[0]==d[1]&&d[1]==d[2]&&d[2]==d[3]){
				printf("NA\n");
				break;
			}
			sort(d,d+4);
			for(i=0;i<4;i++)
			//	printf("%d  ",d[i]);
			high=d[3]*1000+d[2]*100+d[1]*10+d[0];
			 low=d[0]*1000+d[1]*100+d[2]*10+d[3];
			h=high-low;
			kai++;
			s=h;
		}
	}
	return 0;
}

Measured memory_bytes: 1056
import java.io.BufferedReader;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
import java.util.ArrayList;

public class Main {

  public static void main(String[] args) throws IOException {
	  Scanner in = new Scanner(System.in);
	  int k = in.nextInt();
	  in.nextLine();
	  String s = in.nextLine();
	  if(s.length()>k) {
		  s=s.substring(0,k);
		  s+="...";
	  }
	  System.out.println(s);
      
  }
}

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

struct Tscore {
    int t_id;
    int AC_num;
    int penalty;
    int WA_num[11];

    Tscore(int id) {
        t_id = id;
        AC_num = 0;
        penalty = 0;
        for (int i = 0; i < 11; i++) WA_num[i] = 0;
    }

    bool operator < (const Tscore& right) const {
        if (AC_num == right.AC_num) {
            if (penalty == right.penalty) {
                return t_id < right.t_id; // ???????????????????°??????????
            }
            return penalty < right.penalty; // ??????????????£????°??????????
        }

        return AC_num > right.AC_num; // ??£?§£??°????????????
    }
};

int main(void) {

    int T, P, R;
    while (cin >> T >> P >> R, T||P||R) {
        vector<Tscore> teams;
        for (int i = 0; i < T; i++) {
            teams.push_back(Tscore(i+1));
        }
        int tID, pID, time;
        string message;
        for (int i = 0; i < R; i++) {
            cin >> tID >> pID >> time >> message;
            if (message == "CORRECT") {
                teams[tID-1].AC_num++;
                teams[tID-1].penalty += teams[tID-1].WA_num[pID]*1200 + time;
            } else {
                teams[tID-1].WA_num[pID]++;
            }
        }

        sort(teams.begin(), teams.end());
        for (int i = 0; i < T; i++) {
            cout << teams[i].t_id << " " << teams[i].AC_num << " " << teams[i].penalty << endl;
        }
    }

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  for(int i = 0; i < n; i++){
    int b;
    cin >> b;
    if(b % 2 == 0){
      if(!(b % 3 == 0 || b % 5 == 0)){
        cout << "DENIED" << endl;
        return 0;
      }
    }
  }
  cout << "APPROVED" << endl;
  return 0;
}


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

int main()
{
	long long n,N,h,k1,k2,w;
	bool m = false;
	cin >> N;
	for(n = 1;n <= 3500;n++)
	{
		for(h = 1;h <= 3500;h++)
		{
			k1 = N * h * n;
			k2 = 4 * h * n - N * n - N * h;
			if(k2 > 0 && k1 % k2 == 0)
			{
			    w = k1 / k2;
			    cout << n << " " << h << " " << w << endl;
				m = true;
				break;
			}
		}
		if(m)
		    break;
	}
	return 0;
}

Measured memory_bytes: 256
// https://atcoder.jp/contests/abc168/tasks/abc168_a
#include <iostream>
#include <cstdio>
#include <string>

using namespace std;

unsigned int N;

void solve() {
  string ans = "hon";
  unsigned int digit = N % 10;
  if (digit == 3)
    ans = "bon";
  if((digit >= 0 && digit <=1) || digit == 6 || digit == 8 )
    ans = "pon";
  cout << ans << endl;
}

void input() {
  scanf("%d", &N);
}

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


Measured memory_bytes: 3692
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define endl "\n"
#define ll long long
#define sz(s) (int)(s.size())
#define INF 0x3f3f3f3f3f3f3f3fLL
#define all(v) v.begin(),v.end()
#define watch(x) cout<<(#x)<<" = "<<x<<endl
const int dr[] { -1, -1, 0, 1, 1, 1, 0, -1 };
const int dc[] { 0, 1, 1, 1, 0, -1, -1, -1 };
#if __cplusplus >= 201402L
template<typename T>
vector<T> create(size_t n) {
	return vector<T>(n);
}
template<typename T, typename ... Args>
auto create(size_t n, Args ... args) {
	return vector<decltype(create<T>(args...))>(n, create<T>(args...));
}
#endif
void run() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifdef EZZAT
	freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
#else
#endif
}
struct edge {
	int from, to;
	ll a, b;
};

struct state {
	int cur;
	ll silver, time;
	int buyIdx;
	state(int cur, ll silver, ll time) :
			cur(cur), silver(silver), time(time) {
	}
	bool operator<(const state &o) const {
		return time > o.time;
	}
};

const int N = 51, MAX = 51 * 51;
vector<edge> adj[N];
pair<ll, ll> cost[N];
ll dis[N][MAX + 1];
int s;
void dijkstra() {
	memset(dis, INF, sizeof(dis));
	priority_queue<state> q;
	q.push(state(1, s, 0));
	dis[1][s] = 0;
	while (sz(q)) {
		int cur = q.top().cur;
		ll silver = q.top().silver;
		ll time = q.top().time;
		int buyIdx = q.top().buyIdx;
		q.pop();
		if (dis[cur][silver] < time)
			continue;
		ll nxtTime = (time + cost[cur].second);
		ll nxtSilver = min(1LL * MAX, silver + cost[cur].first);
		if (dis[cur][nxtSilver] > nxtTime) {
			dis[cur][nxtSilver] = nxtTime;
			q.push(state(cur, nxtSilver, nxtTime));
		}
		for (auto ch : adj[cur]) {
			ll nxtTime = (time + ch.b);
			ll nxtSilver = (silver - ch.a);
			if (nxtSilver < 0)
				continue;
			if (dis[ch.to][nxtSilver] > nxtTime) {
				dis[ch.to][nxtSilver] = nxtTime;
				q.push(state(ch.to, nxtSilver, nxtTime));
			}
		}
	}
}
int main() {
	run();
	int n, m;
	cin >> n >> m >> s;
	s = min(s, MAX);
	while (m--) {
		edge e;
		cin >> e.from >> e.to >> e.a >> e.b;
		adj[e.from].push_back(e);
		swap(e.from, e.to);
		adj[e.from].push_back(e);
	}
	for (int i = 1; i <= n; i++)
		cin >> cost[i].first >> cost[i].second;
	dijkstra();
	for (int i = 2; i <= n; i++) {
		ll mn = INF;
		for (int si = 0; si <= MAX; si++)
			mn = min(mn, dis[i][si]);
		cout << mn << "\n";
	}
}


Measured memory_bytes: 8360
#include <string.h> 
#include <iostream> 
using namespace std; 
  
int main() 
{ 
    int k=0;
    string s = "";
    cin>>k;
    cin>>s;
    int l=s.length();
    if(l>k){
     string r = s.substr(0,k);
     r.append("...");
     cout<<r;
    }
    else
      cout<<s;
    
  
    return 0; 
} 


Measured memory_bytes: 3588
#include <iostream>
#include <cstdio>

using namespace std;

int main() {
		int N, K;
		cin >> N >> K;
		
		double ans = 0;
		for (int i = 1; i <= N; i++) {
				double  x = 1;
				int t = i;
				while (t < K) {
						t *= 2;
						x *= 0.5;
				}
				ans += (x / N);
		}

		printf("%.012f\n", ans);
		return 0;
}


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

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end()
#define sz(v) (int)v.size()

#define MOO(i, a, b) for (int i=a; i<b; i++)
#define M00(i, a) for (int i=0; i<a; i++)
#define MOOd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define M00d(i,a) for (int i = (a)-1; i >= 0; i--)

#define FAST ios::sync_with_stdio(0); cin.tie(0);
#define finish(x) return cout << x << '\n', 0;
#define dbg(x) cerr << ">>> " << #x << " = " << x << "\n";
#define _<< " _ " <<

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef pair<ld,ld> pd;
typedef vector<ll,ll> vll;
typedef pair<ll,ll> pll;

const ll MOD = 1e9 + 7;
ll DP[1000][1000];

int main() { FAST
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	int h, w;
	cin >> h >> w;
	DP[0][0] = 1;
	vector<string> arr;
	M00(i, h) {
		string s;
		cin >> s;
		arr.pb(s);
	}
	M00(i, h) {
		M00(j, w) {
			if(arr[i][j] == '#') continue;
			if(i != 0)
			DP[i][j] += DP[i-1][j];
			if(j != 0)
			DP[i][j] += DP[i][j-1];
			DP[i][j] %= MOD;
		}
	}
	cout << DP[h-1][w-1] << endl;
}


Measured memory_bytes: 9088
#include <iostream>
#include <string>
using namespace std;
int main(){
    string b;
    cin >> b;
    if(b=="A")cout << "T" << endl;
    else if(b=="T")cout << "A" << endl;
    else if(b=="C")cout << "G" << endl;
    else cout << "C" << endl;

}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG

#include<bits/stdc++.h>
#define PI 3.14159265359
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const int INF= 1e9+5;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>>vvi;

int main(){
  ll n;
  cin>>n;
  vector<ll>a(n);
  for(int i=0;i<n;i++)cin>>a[i];
  ll ans=0;
  for(int i=0;i<n;i++){
    if(a[i]%2==1)continue;
    while(a[i]%2==0){
      a[i]/=2;
      ans++;
    }
  }
  cout<<ans<<endl;
}
        

Measured memory_bytes: 384
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <math.h>
#include <cstdlib>
#define rep(i,n) for(int i = 0;i<(n);i++);
using namespace std;
using ld = long double;
using ll = long long;
const ll INF = 100100100100100;


int main() {
	ll N, Q;//nagasa N situmonn Q
	cin >> N >> Q;
	string S;
	cin >> S;
	vector<vector<ll>> num(Q, vector<ll>(2));
	vector<ll> ans(N+1);
	ans[0] = 0;
	for (int i = 0; i < Q; i++) {
		cin >> num[i][0] >> num[i][1];
	}
	for (int i = 0; i < N; i++) {
		if (S[i] == 'A' && S[i + 1] == 'C') {
			ans[i + 1] = ans[i] + 1;
		}
		else ans[i + 1] = ans[i];
	}
	for (int i = 0; i < Q; i++) {
		cout << ans[num[i][1]-1] - ans[num[i][0]-1] << endl;
	}
}

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

typedef long long LL;

#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(x) (x).begin(),(x).end()
const int IINF = 1e9;
const LL LINF = 1e18;
const LL MOD = 1e9+7;

int main() {
    LL N;
    map<char, LL> dic;
    cin >> N >> dic['A'] >> dic['B'] >> dic['C'];
    LL s = dic['A'] + dic['B'] + dic['C'];
    vector<string> query(N);
    vector<string> res(N, "");

    REP(i, N) {
        cin >> query[i];
    }

    bool yn = true;

    REP(i, N) {
        char x, y;
        tie(x, y) = tie(query[i][0], query[i][1]);
        if(dic[x] == 0 && dic[y] == 0) {
            yn = false;
            break;
        }
        if(dic[x]*dic[y] == 0 && 0 < dic[x]) {
            dic[x]--;
            dic[y]++;
            res[i] = y;
            continue;
        }
        if(dic[x]*dic[y] == 0 && 0 < dic[y]) {
            dic[x]++;
            dic[y]--;
            res[i] = x;
            continue;
        }
        if(s == 2 && dic[x] == dic[y] && i < N - 1) {
            auto n = query[i + 1];
            if(n.find(x) != string::npos) {
                dic[x]++;
                dic[y]--;
                res[i] = x;
                continue;
            }
            if(n.find(y) != string::npos) {
                dic[x]--;
                dic[y]++;
                res[i] = y;
                continue;
            }
        }
        if(dic[x] <= dic[y]) {
            dic[x]++;
            dic[y]--;
            res[i] = x;
            continue;
        }
        if(dic[y] < dic[x]) {
            dic[x]--;
            dic[y]++;
            res[i] = y;
            continue;
        }
    }

    assert((dic[query[0][0]] == 0 && dic[query[0][1]] == 0) || s < 2 || (2 <= s && yn));

    if(yn) {
        cout << "Yes" << endl;
        REP(i, N) {
            cout << res[i] << endl;
        }
    }else{
        cout << "No" << endl;
    }
    return 0;
}


Measured memory_bytes: 9612
using System;

class Program
{
    static void Main(string[] args)
    {
        var n = int.Parse(Console.ReadLine());
        var d = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

        var x = new int[n + 1];
        for (int i = 1; i <= n; i++)
            x[i] = gcd(x[i - 1], d[i - 1]);

        var y = new int[n + 1];
        for (int i = n - 1; 0 <= i; i--)
            y[i] = gcd(y[i + 1], d[i]);

        var ans = 0;
        for (int i = 0; i < n; i++)
            ans = Math.Max(ans, gcd(x[i], y[i + 1]));

        Console.WriteLine(ans);
    }

    static int gcd(int x, int y)
    {
        return x == 0 ? y : gcd(y % x, x);
    }
}


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

using namespace std;

int dist(int a, int b){
  return pow(a-b, 2);
}

int main(){
  int n;
  cin >> n;
  vector<int> x(n);
  vector<int> ans;
  for(int i=0;i<n;i++){
    cin >> x.at(i);
  }
  for(int i=1;i<=100;i++){
    int sum=0;
    for(auto p : x){
      sum += dist(i, p);
      // cout << i << " " << dist(i, p) << endl;
    }
    ans.push_back(sum);
  }
  sort(ans.begin(), ans.end());
  cout << ans.at(0) << endl;
  return 0;
}


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

using namespace std;
using ll = long long;

const ll MOD = 1000000007;

int N;
vector<int> path[21];
ll dp[21][1 << 21];
bool visited[21][1 << 21];

ll rec(int i, int S) {
    if (i == N) return 1;
    if (visited[i][S]) return dp[i][S];

    visited[i][S] = true;
    for (int j : path[i]) {
        if ((S >> j) & 1) continue;
        dp[i][S] += rec(i + 1, S | (1 << j));
        dp[i][S] %= MOD;
    }

    return dp[i][S];
}

int main() {
    cin >> N;

    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N; ++j) {
            int a;
            cin >> a;
            if (a == 1) path[i].push_back(j);
        }
    }

    cout << rec(0, 0) << endl;
    return 0;
}


Measured memory_bytes: 350464
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  for(int i=0;i<3;i++){
    if(s.at(i)=='1'){
      s.at(i)='9';
    }
    else if(s.at(i)=='9'){
      s.at(i)='1';
    }
  }
  cout<<s<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
	int n,x=0,i;
	char s[100000];
	scanf("%d %s", &n, s);
	for(i=0; i<n-1; i++)
	{
		if(s[i]=='O'&&s[i+1]=='X')
		{
			x++;
			i++;
		}
		else if(s[i]=='X'&&s[i+1]=='O')
		{
			x++;
			i++;
		}
	}
	printf("%d\n", x);
	
	return 0;
}


Measured memory_bytes: 2104
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

double w, h, x, y;
double s;




int main() {
	cin >> w >> h >> x >> y;
	s = w * h / 2;
	cout << setprecision(9) << s << endl;
	if (x == w / 2 && y == h / 2) cout << 1 << endl;
	else cout << 0 << endl;
	
	return 0;
}

Measured memory_bytes: 256