akhauriyash/Code-Regression huggingface dataset:
/*-- ILSH  --*/
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef long double ld;
#define pb push_back 
#define pop pop_back
#define mp make_pair
#define vii vector < ll >
#define vll vector < ll > 
#define dt cout<<"HERE\n";
#define pii pair < ll , ll >
#define pll pair < ll , ll >
#define vpi vector < pii >
#define vpl vector < pll >
#define fi first
#define se second 
#define sz size 
#define len length 
const ll inf=1e18+1e17;
const ll mod =1e9+7;
//const ll mod = 998244353;

ll modInverse(ll a,ll m){ll m0=m;ll y=0,x=1;if(m == 1)return 0;while(a> 1){ll q=a/m;ll t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0)x+=m0;return x;}  
ll powm(ll a,ll b){a=a%mod;ll res=1;while(b){if(b&1)res=(res*a)%mod;a=	(a*a)%mod;b>>=1;}return (res%mod);}
const int N = 2e5 + 5 ;


void solve(){
	ll n;
	cin>>n;
	string s="";
	n--;
	while ( n>=0){
		int cc=n%26;
		s+=( ( char) ( cc+'a'));
		n=n/26;
		n--;
	}
	reverse( s.begin(),s.end());
	cout<<s<<'\n';
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie( NULL);
	cout.tie(NULL);
//	/*
	#ifndef ONLINE_JUDGE
		freopen ("INPUT.txt" , "r" , stdin);
		freopen ("OUTPUT.txt", "w" , stdout);
	#endif
// */
	ll t=1;
	//cin>>t;
	for ( ll i=1;i<=t;i++){
		//cout<<"Case #"<<i<<": ";
    	solve();
    }
}

Measured memory_bytes: 3628
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n,k = inpl()
xary = []; yary = []
a = []
for i in range(n):
    x,y = inpl()
    xary.append(x)
    yary.append(y)
    a.append((x,y))
xary.sort(); yary.sort()
res = INF
for xi in range(n-1):
    for xj in range(xi+1,n):
        for yi in range(n-1):
            for yj in range(yi+1,n):
                cnt = 0
                l = xary[xi]; r = xary[xj]
                d = yary[yi]; u = yary[yj]
                # print(l,r,d,u)
                for i in range(n):
                    x,y = a[i]
                    if l<=x<=r and d<=y<=u:
                        cnt += 1
                if cnt >= k:
                    res = min(res, (r-l)*(u-d))
print(res)


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

 

#define pb push_back

#define mp make_pair

#define fs first

#define sc second

#define rep(i, from, to) for (int i = from; i < (to); ++i)

#define all(x) x.begin(), x.end()

#define sz(x) (int) (x).size()

#define FOR(i, to) for (int i = 0; i < (to); ++i)

 

using namespace std;

typedef long long ll;

typedef vector<int> vi;

typedef pair<int,int> pii;

typedef pair<double,double> pdd;

typedef vector<ll> vll;

typedef vector<pair<int,int>> vpi;

typedef pair<ll,ll> pll;

typedef vector<string> vs;

#define MOD 998244353

#define mod 998244353

#define INF 1000000000LL * 100000000LL

#define Nmax 2020200

int N, T, M, K, Q;



bitset<Nmax> B1,B2;

int A[2020];
ll sm = 0;

int main() {

  cin.sync_with_stdio(false);

  cin >> N;

  FOR(i, N) {

    cin >> A[i];
    sm += A[i];

  }
  double v = sm / 2.0;
  B1[0] = 1;
  FOR(i, N) {
    bitset<Nmax> B2;
    B1 = B1 | (B1 << A[i]);
  }
  int ret = 0;
  for(int i=0;i<=sm;++i) {
   //cout << B1[i] << endl;
    if(B1[i] && i >= v) {
      ret = i;
      break;
    }
  }
  cout << ret << endl;

  

}

 

Measured memory_bytes: 1280
#include<iostream>   //AA06( 05/ 07/ 20) If u see my code, Have a Good Day! (^_^)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
#define endl "\n"


using namespace std;

int main()
{
    fastio;

    int N, p = 0, q = 0, r = 0, s = 0;

    string A;

    cin >> N;

    while(N--) {

        cin >> A;

        if(A == "AC")
            p++;

        else if(A == "WA")
            q++;

        else if(A == "TLE")
            r++;

        else
            s++;

    }

    cout << "AC x " << p << endl;
    cout << "WA x " << q << endl;
    cout << "TLE x " << r << endl;
    cout << "RE x " << s << endl;

    return 0;
}



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

int main()
{
    vector<int> vi(28);
    for(int i = 0; i < 28; i++) 
        cin >> vi[i];
    
    sort(vi.begin(), vi.end());
    for(int i = 1; i <= 30; i++) 
        if(find(vi.begin(), vi.end(), i) == vi.end())
            cout << i << endl;


}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin>>n;
  vector<int> a(n);
  for(int i=0;i<n;i++){
    cin>>a[i];
  }
  int mina=a[0];
  int maxa=-2000000000;
  for(int i=1;i<n;i++){
    maxa=max(maxa,a[i]-mina);
    mina=min(mina,a[i]);
  
  }
  cout<<maxa<<endl;
}


Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <algorithm>
#include <queue>
#include <stack>

using namespace std;
typedef long long int ll;

int main(int argc, char const *argv[])
{
    ll n;
    string s;
    cin >> n;
    cin >> s;
    
    ll l = 0, r = 0;
    vector<ll> vl(n), vr(n);

    for(ll i = 0; i < n; i++)
    {
        if(s[i] == 'W') l++;
        vl[i] = l;
    }
    for(ll i = n - 1; i >= 0; i--)
    {
        if(s[i] == 'E') r++;
        vr[i] = r;
    }

    ll _min = 3000000;
    for(ll i = 0; i < n; i++)
    {
        if(i == 0)
            _min = min(_min, vr[i + 1]);
        else if(i == n - 1)
            _min = min(_min, vl[i - 1]);
        else
            _min = min(_min, vl[i - 1] + vr[i + 1]);
    }

    cout << _min << endl;    
}

Measured memory_bytes: 5380
#include <stdio.h>
#include <stdlib.h>

int checkSequenceNum(const void *n1, const void *n2)
{
    if (*(long *)n1 == *(long *)n2)
    {
        return 0;
    }
    else if (*(long *)n1 > *(long *)n2)
    {
        return -1;
    }
    else
    {
        return 1;
    }
}

int main(void)
{

    char c_checkFlag = 0;
    long l_inputSequenceCount;

    // 入力値の取得
    scanf("%ld", &l_inputSequenceCount);
    long l_inputSequence[l_inputSequenceCount];
    for (int index = 0; index < l_inputSequenceCount; index++)
    {
        scanf("%ld", &l_inputSequence[index]);
    }

    // ソートする
    qsort(l_inputSequence, l_inputSequenceCount, sizeof(long), checkSequenceNum);

    // 判定する
    for (int index = 0; index < l_inputSequenceCount; index++)
    {
        if (l_inputSequence[index] == l_inputSequence[index + 1])
        {
            c_checkFlag = 1;
            break;
        }
    }

    // 出力する
    if (c_checkFlag == 1)
    {
        printf("NO");
    }
    else
    {
        printf("YES");
    }

    return 0;

}

Measured memory_bytes: 3324
#include <iostream>
#include <unordered_map>
#include <vector>
#include <set>
#include <string.h>
#include <algorithm>
#define mod 1000000007
#define inf 1LL<<61
#define ll long long
#define pr pair<int,int>
#define all vec.begin(),vec.end()
#define rep(i,a,b) for (int i = a; i < b; i++)
#define fi first
#define se second
#define pushb push_back
#define makep make_pair

using namespace std;

int main(){
	string a;
	cin >> a;
	int ans;
	for(int i = a.size() - 2; i >= 2; i -=2){
		ans = (i/2) * 2;
		for(int j = 0; j < i / 2; j++){
			if(a[j] != a[j + i / 2]){
				ans = 0;
			}
		}
		if(ans == (i/2) * 2){
			cout << ans;
			return 0;
		}
	}
	return 0;
}



Measured memory_bytes: 3572
n = int(input())


def dfs(n, s, idx):
    l = len(s)
    if n == l:
        print(s)
        return
    alpha = "abcdefghijklmnopqrstuvwxyz"
    i = 0
    while i < idx + 1:
        if i == idx:
            dfs(n, s + alpha[i], idx + 1)
        else:
            dfs(n, s + alpha[i], idx)
        i += 1


dfs(n, "", 0)



Measured memory_bytes: 77084
k = int(input())
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14,
     1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(a[k-1])

Measured memory_bytes: 38256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        if(s == 1 || s == 2) {
            System.out.println(4);
            return;
        }
        int ans = 1;
        while(true) {
            if(s == 1) {
                ans++;
                break;
            }
            if(s % 2 == 0) {
                s /= 2;
            } else {
                s = s * 3 + 1;
            }
            ans++;
        }
        System.out.println(ans);
    }
}

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

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

void Main()
{
	int a, b, k;
  	cin >> a >> b >> k;
	int g = gcd(a,b);
  	// g の k 番目に大きい約数を答える
  	int i = g;
  	while(k>1){
      	i--;
      	if(g%i==0) {
          	k--;
        }
    }
  	cout << i << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#define NMAX 100005

using namespace std;

int n, s, a[NMAX], b[NMAX], sum;
int main() {
	cin >> n >> s;
	for (int i = 1; i <= n; i++) {
		cin >> a[i] >> b[i];
		sum += b[i];
	}
	sort(a + 1, a + n + 1);
	sort(b + 1, b + n + 1);
	if (s >= sum) {
		int ans = n + (s - sum) / a[n] + ((s - sum) % a[n] != 0);
		sum = 0;
		int i = n;
		while (i) {
			sum += b[i];
			ans = min(ans, n - i + 1 + (s - sum) / a[n] + ((s - sum) % a[n] != 0));
			i--;
		}
		cout << ans;
	}
	else {
		int ans = 0, i = n;
		while (b[i] >= a[n] && s > 0) {
			s -= b[i];
			i--;
			ans++;
		}
		if (s > 0) {
			ans += s / a[n];
			if (s%a[n]) {
				ans++;
			}
		}
		cout << ans;
	}
	system("pause");
}

Measured memory_bytes: 1272
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String args[]) throws IOException {
		FastScanner fs = new FastScanner();
		int a = fs.nextInt();
		int b = fs.nextInt();
		int c = fs.nextInt();

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


	}
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }
    public double nextDouble() { return Double.parseDouble(next());}
}

Measured memory_bytes: 22484
def main():
    X, K, D = map(int, input().split())
    X = abs(X)
    if K % 2 == 1:
        X = abs(X - D)
        K -= 1
    div = X // (D*2)
    ans = min(X - min(div, K//2) * (D*2),
              abs(X - min(div+1, K//2) * (D*2)))
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 61836
#include <iostream>

using namespace std;

int main() {
	int r, c, i, j, sum, sum2 = 0;
	int a[100][100];
	cin >> r >> c;
	for (i = 0; i < r; i++) {
		for (j = 0; j < c; j++) {
			cin >> a[i][j];
		}
	}
	for (i = 0; i < r; i++) {
		sum = 0;
		for (j = 0; j < c; j++) {
			sum += a[i][j];
			cout << a[i][j] << " ";
		}
		cout << sum << endl;
	}
	for (i = 0; i < c; i++) {
		sum = 0;
		for (j = 0; j < r; j++) {
			sum += a[j][i];
			sum2 += a[j][i];
		}
		cout << sum << " ";
	}
	cout << sum2 << endl;

	
	return 0;
}


Measured memory_bytes: 3120
#include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>

using namespace std;

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

#define ri(a) scanf("%d", &a)
#define rii(a,b) scanf("%d %d", &a, &b)
#define riii(a,b,c) scanf("%d %d %d", &a, &b, &c)
#define rl(a) scanf("%lld", &a)
#define rll(a,b) scanf("%lld %lld", &a, &b)
#define FOR(i,n,m) for(int i=n; i<m; i++)
#define ROF(i,n,m) for(int i=n; i>m; i--)
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define F first
#define S second

const int INF = 0x3f3f3f3f;
const ll LLINF = 1e18;
const int maxN = 1e5; // CAMBIAR ESTE

// GJNM
char s[20], t[20];

int main(){
	scanf("%s",s);
	scanf("%s",t);
	int n = strlen(s), m = strlen(t);
	if ( m<=n || m!=n+1){
		printf("No\n");
		return 0;
	}
	FOR(i,0,n){
		if ( s[i] != t[i] ){
			printf("No\n");
			return 0;
		}
	}
	printf("Yes\n");
	return 0;
}

Measured memory_bytes: 3688
#include <stdio.h>

int main(void)
{
  int a, b, c, d, e, f = 0;
  scanf("%d %d %d\n", &a, &b, &c);

  for(d = a;d <= b;d++)
 {
   e = c % d;

  if(e == 0)
     f = f + 1;
  else
     f = f;
  }

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

return 0;
}

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

bool isPrime(int n) {
  if (n == 1) return false;
  
  bool res = true;
  
  for (int i = 2; i * i <= n; i++) {
    if (n % i == 0) {
      res = false;
      break;
    }
  }
  
  return res;
}

int main() {
  int Q;
  cin >> Q;
  
  
  vector<int> a(100010, 0);
  
  for (int i = 1; i < 100000; i += 2) {
    if (isPrime(i) && isPrime((i+1)/2)) {
      a[i] = 1;
    }
  }
  
  // 累積和
  vector<int> sum(100001, 0);
  for (int i = 0; i < 100000; i++) {
    sum[i+1] = sum[i] + a[i];
  }
  
  
  for (int i = 0; i < Q; i++) {
    int l, r;
    cin >> l >> r;
    
    cout << sum[r+1] - sum[l] << endl;
  }
}

Measured memory_bytes: 3960
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <list>
#include <algorithm>
#include <cmath>
#include <queue>
#include <iterator>
#include <functional>
#include <numeric>
using namespace std;

#define ll long long
#define forn(i,n)for(i=0;i<n;i++)
#define forc(i,c,n)for(i=c;i<=n;i++)
typedef list<ll> LST;
typedef vector<ll> VEC;
typedef map<ll, ll> MAP;

int main() {
	ifstream fin("Text.txt");
	int i, j, q;
	ll n, m, k;
	ll a, b, c, d;
	ll x, y, z;
	ll cdir,h,w;
	cin >> m;
	forc(h, 1, 3500) {
		forc(w, 1, 3500) {
			a = m*h*w;
			b = 4 * h*w - m*(h + w);
			if (b) {
				c = a%b;
				if (c == 0 && a / b > 0 && a / b <= 3500) {
					n = a / b;
					cout << h << " " << n << " " << w << endl;
					return 0;
				}
			}
		}
	}
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;

#define FOR(i,a,b) for (ll i = a; i < b; ++i)
#define FORR(i,a,b) for (ll i = b - 1; i >= a; --i)
#define REP(i,n) FOR(i,0,n)
#define REPR(i,n) FORR(i,0,n)

int main() {
	ll X;
	cin >> X;

	FOR(d, 1, 240) {
		for (ll A = -118; A < 120; ++A) {
			ll B = A - d;
			if ((A * A * A * A * A - B * B * B * B * B) == X) {
				cout << A << " " << B << endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3608
import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.List;
import java.util.Scanner;

public class Main
    {
        public static void main (String[] args)
            {
                Scanner scanner = new Scanner(System.in);
                List<Integer> list = new ArrayList<Integer>();

                try
                    {
                        while (scanner.hasNextInt())
                            {
                                int tmp = scanner.nextInt();

                                if (tmp != 0)
                                    {
                                        list.add(tmp);
                                    }
                                else
                                    {
                                        break;
                                    }
                            }

                        for (int i = 0; i < list.size(); i++)
                            {
                                System.out.println("Case " + (i + 1) + ": " + list.get(i));
                            }
                    }
                catch (InputMismatchException e)
                    {
                        System.out.println("整数を入力してください");
                        e.printStackTrace();
                    }
            }
    }

Measured memory_bytes: 41216
#include <iostream>
//#include <queue>
//#include <vector>
#include <map>
//#include <algorithm>
using namespace std;
int N,M,A[1000007];
//vector<int> l;
map<int,int> m;
//priority_queue<int> q;
int main(void){
    cin >> N >> M;
    long long allsum=0,count=0;
    for(int i=0; i<N; i++){
        cin >> A[i];
        allsum += A[i];
        int k = A[i];
        while(k>0){
            m[k-k/2]= ((m.find(k-k/2)==m.end())? 0: m[k-k/2]) + 1;
            //l.push_back(k-k/2);
            //q.push(k-k/2);
            count++;
            k = k/2;
        }
    }
    //sort(l.begin(), l.end(), greater<int>());
    long long sum=0, c=0;
    //for(int i=0; i<M&&i<count; i++){
    //    sum += l[i];
    for(auto itr=m.rbegin(); itr!=m.rend(); itr++){
        int key=itr->first, value=itr->second;
        if(c+value>M){
            sum += key*(M-c);
            break;
        }else{
            sum += 1L*key*value;
            c += value;
        }
    //for(int i=0; i<M && i<count; i++){
    //    sum += q.top(); q.pop();
    }
    cout << allsum-sum << "\n";
}

Measured memory_bytes: 54144
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.PrintWriter;
import java.util.Scanner;

public class Main {

    private static long n;

    public static void main(String[] args) throws Exception {
        try (BufferedInputStream in = new BufferedInputStream(System.in);
             PrintWriter out = new PrintWriter(new BufferedOutputStream(System.out))) {

            Scanner sc = new Scanner(in);

            // 18:24-

            int n = sc.nextInt();
            int m = sc.nextInt();
            int lm = -1;
            int rm = Integer.MAX_VALUE;
            
            for (int i = 0; i < m; i++) {
                lm = Math.max(lm, sc.nextInt());
                rm = Math.min(rm, sc.nextInt());
            }

            out.println(lm > rm ? 0 : rm - lm + 1);
        }
    }
}


Measured memory_bytes: 67400
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n, i;
  cin >> n >> i;
  int ans = n - i + 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
#define NL            "\n"
#define _SAD()        ios::sync_with_stdio(0),cin.tie(0), cout.tie(0);
#define SZ(s)         s.size()
#define SRT(x,y)      sort(x,x+y)
#define REV(a,b)      reverse(a,a+b)
#define VSRT(x)       sort(x.begin(),x.end())
#define VREV(x)       reverse(x.begin(),x.end())
int main()
{
    _SAD()
    int n,m;
    cin>>n>>m;
    int a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    int cnt=0;
    while(m+cnt*(m-1)<n)
    {
        cnt++;
    }
    cout<<cnt+1<<NL;
    return 0;
}



Measured memory_bytes: 640
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(input())
def inpl(): return list(map(int, input().split()))
def inpl_str(): return list(input().split())


while True:
    N = inp()
    if N == 0:
        break
    else:
        tt = [[' ']*1100 for _ in range(N)]
        LL = [0]*N
        SS = ['']*N
        bL = 1000

        for i in range(N):
            S = input()
            L = S.count('.')
            LL[i] = L
            SS[i] = S[L:]
            tt[i][L] = '+'
            if L < bL:
                for j in reversed(range(i)):
                    if LL[j] == L:
                        break
                    else:
                        tt[j][L] = '|'
            bL = L

        print(SS[0])
        for i in range(1,N):
            tmp = ''
            for j in range(1,1100):
                if tt[i][j]!='+':
                    tmp = tmp + tt[i][j]
                else:
                    tmp = tmp + '+' + SS[i]
                    break
            print(tmp)



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

int main(){
    int n;
    cin>>n;
    vector<vector<int>> v(n,vector<int>(30));
    for(int i=0;i<n;i++){
        string s;
        cin>>s;
        for(char c : s) v[i][c-'a']++;
    }
    string ans="";
    for(char c='a';c<='z';c++){
        int r=1e9;
        for(int i=0;i<n;i++){
            r=min(r,v[i][c-'a']);
        }
        for(int i=0;i<r;i++) ans+=c;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3600
#include <stdio.h>

int main(void) {
  int N;
  scanf("%d", &N);
  int array[N];
  for (int i = 0; i < N; i++) {
    scanf("%d", &array[i]);
  }
  int max=0, max_i;
  for (int j = 0; j < N; j++) {  //最大値探索
    if (*(array+j)>max) {
      max = *(array+j);
      max_i = j;
    }
  }

  for (int i = 0; i < N; i++) {
    if (i!=max_i) {
      printf("%d\n", max);
    } else {
      int max2=0;
      for (int j = 0; j < N; j++) {
        if (j != i) {
          if (*(array+j)>max2) {
            max2 = *(array+j);
          }
        }
      }
      printf("%d\n", max2);
    }
  }

  return 0;
}


Measured memory_bytes: 2304
#include <cstdio>
#include <cstring>
#include <cmath>
#include <utility>
#include <iostream>
#include <functional>
#include <bitset>
#include <algorithm>
#include <vector>
#include <forward_list>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <tuple>
#include <numeric>
#define rep(i, s, g) for ((i) = (s); (i) < (g); ++(i))
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
const ll MOD = 1e9 + 7;
const ll INF = (1ll << 60);

int main(void)
{
    int n, k;

    cin >> n >> k;

    set<ll> s;

    for (int i = 0; i < k; i++)
    {
        int d;
        cin >> d;

        for (int j = 0; j < d; j++)
        {
            int a;
            cin >> a;
            s.insert(a);
        }
    }

    cout << n - s.size() << endl;
}


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

static const int N = 100;

int main() {
	int n, p[N + 1], m[N + 1][N + 1];
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> p[i - 1] >> p[i];
	}

	for (int i = 1; i <= n; i++)m[i][i] = 0;
	for (int l = 2; l <= n; l++) {
		for(int i=1;i<=n-l+1;i++){
		int j = i + l - 1;
		m[i][j] = (1 << 21);
		for (int k = i; k <= j - 1; k++) {
			m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
			}
		}
	}

	cout <<  m[1][n] << endl;

	return 0;
}

Measured memory_bytes: 3108
#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000000+7;

bool isPrime(long long n) {
  for (int i=2; i<=sqrt(n); i++) {
    if (n%i == 0) return false;
  }
  return true;
}

int main() {
  int x;
  cin >> x;
  
  long long num=x;
  while (true) {
    if (isPrime(num)) {
      cout << num << endl;
      return 0;
    }
    num++;
  }
}


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

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	int x = 1;
	bool ok = false;
	for (int i = 0; i < n; i++) {
		if (a[i] == x) {
			x++;
			ok = true;
		}
	}
	if (ok) {
		cout << n - x + 1 << '\n';
	} else {
		cout << "-1\n";
	}
	return 0;
}


Measured memory_bytes: 1024
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [A, B, C, D] = input[0].map(Number);

  return Math.ceil(A / D) >= Math.ceil(C / B) ? "Yes" : "No";
};

console.log(main(read()));


Measured memory_bytes: 29600
import java.util.Scanner;

public class Main{
	public static void main(String[] args){
		Scanner scan = null;
		try{
			scan = new Scanner(System.in);
			while(true){
				int a = scan.nextInt();
				char op = scan.next().charAt(0);
				int b = scan.nextInt();
				if( op == '?')break;
				switch(op){
				case '+':
					System.out.println(a + b);
					break;
				case '-':
					System.out.println(a - b);
					break;
				case '*':
					System.out.println(a *b);
					break;
				case '/':
					System.out.println(a /b);
					break;
				}
			}
		}finally{
			if(scan != null)scan.close();
		}
	}
}

Measured memory_bytes: 18248
#include <cstdio>
#include <algorithm>
#include <functional>
#define LL long long
using namespace std;

const int MAXN = 100005;
int a[MAXN*3];

int main()
{
	int n;
	scanf("%d", &n);
	for (register int i = 0; i < 3*n; i++)
		scanf("%d", &a[i]);
	sort(a, a + 3*n, greater<int>());
	LL tot = 0;
	for (register int i = 1; i < 2*n; i += 2)
		tot += (LL)a[i];	
	printf("%lld", tot);
	return 0;
}

Measured memory_bytes: 1280
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")
 
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
 
#define X first
#define Y second
 
//#include <boost/unordered_map.hpp>
//using namespace boost;
 
/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/
 
using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;
//using i128 = __int128_t;
//using u128 = __uint128_t;
//using i128 = i64;
//using u128 = u64;
 
ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}
 
ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

ll gcd(ll a, ll b)
{
	return b ? gcd(b, a%b) : a;
}
 
template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}
 
template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

template<class T>
void print(const T &a)
{
	for (auto x : a) printf("%d ", x); puts("");
}

const int MAXN = 500010;
//const int MAXM = 100010;
const int MAXK = 30;
//const i64 INF = 1000000000000000000LL;
const int INF = 1000000000;
//const int MOD = 998244353;
const int B = 31;
const int MOD = 998244353;
//const int INV2 = (MOD+1)/2;
const ld pi = 3.1415926535897932384626433;

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

#define rep(i,a,b) for (int i = (a), I = (b); i <= I; ++ i)

int days[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

bool leap(int y)
{
	return y%4 == 0 && y%100 != 0 || y%400 == 0;
}

int n, m;
int a[MAXN];
vector<int> v[MAXN];

void solve()
{
	cin >> n;
	string s;
	cin >> s;
	int ret = 0;
	
	for (int i = 0; i < n; ++ i)
	{
		if (i && s[i] == s[i-1]) continue;
		ret ++;
	}
	
	cout << ret << endl;
}

int main()
{
	
	int T;
	T = 1;
	//scanf("%d", &T);
	while (T --)
	solve();
	
	return 0;
}


Measured memory_bytes: 12800
import math
D, G = map(int, input().split())

PC = []
for _ in range(D):
    p, c = map(int, input().split())
    PC.append([p, c])

ans = 10 ** 9

#全部解く・解かないが2のD乗通りになる
for i in range(2 ** D):
    score = 0
    time = 0
    maxj = -1
    #全部解く場合
    for j in range(D):
    #jケタ落としていき、jケタめ == 1であれば、つまりj番目の問題セットを全部解いていれば
        if ((i >> j) & 1):
            score += (j + 1) * PC[j][0] * 100 + PC[j][1]
            time += PC[j][0]
        #全てを解かなかった問題セットのうち最も大きいj
        ##全て解かない問題セットは1つでよく、最大の素点のもの=一番大きいjでよい
        else:
            maxj = max(maxj,j)
    #全てを全部解いた場合
    if maxj == -1:
      ans = min(ans, time)
    #jケタめを全て使わずにG以上のスコアとなった場合
    elif score + (maxj + 1) * (PC[maxj][0] - 1) * 100 >= G:
        #必要な最小問題数を小数点切り上げで求める
        ##残りが500点であったとき、300点問題なら2問、200点問題なら3問解けばよい
        time += max(0, math.ceil((G - score) / (maxj + 1) / 100))
        #最小のものを更新していく
        ans = min(ans, time)

print(ans)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
int main () {
  int L, R, D;
  cin >> L >> R >> D;
  int ans = 0;
  for(int i = L; i <= R; i++) {
    if(i % D == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}

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

using namespace std;
using ll = long long;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define ALL(x) (x).begin(),(x).end()

#define READ(x) (cin >> (x))

#define WRITE_N(x) (cout << (x) << endl)
#define WRITE(x) (cout << (x))

int main() {
    // get values from input
    double L;
    READ(L);

    // main procedure
    double V = pow(L, 3) / 27;

    // output
    printf("%.16f", V);

    return 0;
}


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

#define yes "yes"
#define Yes "Yes"
#define no "no"
#define No "No"

namespace mydef
{
  void say(string some){
    cout << some << "\n";
  }
} // namespace mydef
using namespace mydef;
using P = pair<int,int>;
typedef long long ll;
const int INF = 1001001001;
const long double PI=3.14159265358979323846;

//ここから書く

const int M = 1001001;

signed main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  
  int n, count;
  count = 0;
  cin >> n;

  int max = sqrt(n);
  int ans;

  Rep(i, 1, n){
    count = 0;
    Rep(j,1,max){
      Rep(k, j, max){
        Rep(l, k, max){
          ans = (j+k+l)*(j+k+l)-(j*k+k*l+l*j);
          if(ans == i){
            if(j == k && j ==l){
              count += 1;
            }
            else if(j != k && k != l && l != j)
            {
              count += 6;
            }
            else
            {
              count += 3;
            }

          }
        }
      }
    }
    cout << count << "\n";
  }

  return 0;
}




Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std;
const int mod = 1000000007;
long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}
long long bai(long long a, long long b) {
    long long ans = 1;
    for (long long i = b; i <= a; i++)
    {
        ans *= i;
        ans %= mod;
    }
    return ans;
}

using ll = long long int;
ll count_prs = 0;
ll PowMod_RepeatSquaring(ll N, ll P, ll M) {
    ++count_prs;
    if (P == 0) return 1;
    if (P % 2 == 0) {
        ll t = PowMod_RepeatSquaring(N, P / 2, M);
        return t * t % M;
    }
    return N * PowMod_RepeatSquaring(N, P - 1, M);
}
int main() {
	long long n,a,b,ans=1;
	cin >> n >> a >> b;
    ans = PowMod_RepeatSquaring(2, n, mod);
    ans -= (bai(n, max(n - a + 1, a + 1)) % mod * modinv(bai(min(a, n - a), 1), mod) % mod)%mod;
    ans -= (bai(n, max(n - b + 1, b + 1)) % mod * modinv(bai(min(b, n - b), 1), mod) % mod)%mod;
    //cout << bai(n, max(n - b + 1, b + 1)) % mod * modinv(bai(min(b, n - b), 1), mod) % mod;
    ans--;
    while(ans<=0)ans += mod;
   
    cout << ans%mod;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll  long long int
#define fr(i,n) for(ll i=0; i<n; i++)
#define fre(i,n) for(ll i=1; i<=n; i++)
#define pb push_back
#define mp(i,j) make_pair(i,j)
#define fi first
#define se second
#define pii pair<ll,ll>
#define ve vector
#define piii pair<ll, pii>
#define FAST ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
using namespace std;

int main()
{  
    FAST;
    
    string s,t;
    cin>>s>>t;

    ll n = s.length(), m = t.length();

    ll dp[n+1][m+1];
    memset(dp, 0, sizeof(dp));
   
    for(int i=1; i<=n; i++){
        for(int j=1; j<=m; j++){
            if(s[i-1]==t[j-1]) dp[i][j] = 1+dp[i-1][j-1];
            else dp[i][j] = max(dp[i][j-1], dp[i-1][j] );
        }
    }

    // for(int i=1; i<=n; i++){
    //     for(int j=1; j<=m; j++)
    //         cout<<dp[i][j]<<" ";
    //     cout<<endl;
    // }

    ll x=n, y=m;
    string ans = "";

    while(x>0 && y>0){
        if(s[x-1]==t[y-1]) ans+= s[x-1], x-=1, y-=1;
        else if(dp[x][y-1]<dp[x-1][y]) x-=1;
        else y -=1;
    }

    reverse(ans.begin(), ans.end());
    cout<<ans<<endl;
}

Measured memory_bytes: 70656
fun main() {
	val n = readInt()
	val p = readInts().map { it - 1 }
	val dist = List(n) { x -> IntArray(n) { y -> sequenceOf(x, y, n - 1 - x, n - 1 - y).min()!! + 1 } }
	val on = List(n) { x -> BooleanArray(n) { true } }
	var ans = 0
	val stack = IntArray(n * n)
	for (r in p) {
		val rx = r / n
		val ry = r % n
		ans += dist[rx][ry] - 1
		on[rx][ry] = false
		dist[rx][ry]--
		stack[0] = r
		var stackSize = 1
		while (stackSize > 0) {
			val xy = stack[--stackSize]
			val x = xy / n
			val y = xy % n
			val distHere = dist[x][y]
			for (d in DX.indices) {
				val xx = x + DX[d]
				val yy = y + DY[d]
				val onNei = on.getOrNull(xx)?.getOrNull(yy) ?: continue
				val distNei = dist[xx][yy]
				val distNew = distHere + if (onNei) 1 else 0
				if (distNew < distNei) {
					dist[xx][yy]--
					stack[stackSize++] = xx * n + yy
				}
			}
		}
	}
	println(ans)
}

val DX = intArrayOf(1, 0, -1, 0)
val DY = intArrayOf(0, 1, 0, -1)

private fun readLn() = readLine()!!
private fun readInt() = readLn().toInt()
private fun readStrings() = readLn().split(" ")
private fun readInts() = readStrings().map { it.toInt() }


Measured memory_bytes: 79760
#pragma GCC optimize "-O3"
#pragma GCC target ("avx")
#define _USE_MATH_DEFINES
#include<bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define pi pair<int,int>
#define vp vector<pair<int,int>>
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define fi first
#define se second
#define MEMSET(a) memset(a,0,sizeof(a))
#define inf (1ll<<60)
#define SORT(v) sort(all(v))
#define RSORT(v) sort(all(v),greater<int>())
#define SPEED ios::sync_with_stdio(false);cin.tie(0);cout<<fixed<<setprecision(12)
#define erase(i) erase(i, 1)
signed gcd(int a, int b){return b?gcd(b,a%b):a;}
signed lcm(int a, int b){return a*b/gcd(a,b);}
template<typename T> void remove(std::vector<T>& vector, unsigned int index){vector.erase(vector.begin() + index);}
//priority_queue<int, vi, greater<int> > que;//昇順

using namespace std;

const int mod=1e9+7;

int kumiawase(int n)
{
    return n*(n-1)/2;
}

signed main(){
    SPEED;
    int n;
    cin >> n;
    vector<string> str(n);
    rep(i,n)cin >> str[i];
    rep(i,n)SORT(str[i]);
    SORT(str);

    int ans = 0;
    string now = str[0];
    int renzoku = 1;
    for(int i = 1; i < n; ++i)
    {
        if(now == str[i])++renzoku;
        else
        {
            ans += kumiawase(renzoku);
            now = str[i];
            renzoku = 1;
        }
    }
    ans += kumiawase(renzoku);

    cout << ans << endl;
}


Measured memory_bytes: 5760
a, v = gets.split.map(&:to_i)
b, w = gets.split.map(&:to_i)
t = gets.to_i

#d = a + v * t
#e = b + w * t
#f = []
#f << d
#f << e
#j =f.max
#puts j == d ? "YES": "NO"


if (a - b).abs <= (v - w) * t

  puts "YES"
else
  puts "NO"
end 

Measured memory_bytes: 14380
#pragma GCC optimize("Ofast")
#include "bits/stdc++.h"

using namespace std;

typedef long int li;
typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> pt;

#define fi first
#define se second
#define lson (p<<1)+1
#define rson (p<<1)+2
#define dump(x) cout << #x << " = " << x << endl
#define comb(x) ((x * (x + 1)) >> 1)
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

ll a, b;

int main () {
    fastIO
    cin >> a >> b;
    cout << max((ll)0, a - 2*b);


}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Fri Jun 12 20:20:11 2020

@author: NEC-PCuser
"""


N = int(input())

i = 1
li = []
while (N >= (i * (i + 1)) // 2):
    li.append(i)
    i += 1
    

value = (i - 1) * i // 2

index = len(li) - 1
for i in range(value, N):
    li[index] += 1
    index -= 1

for i in li:
    print(i)

Measured memory_bytes: 3572
#include <stdio.h>
using namespace std;

int main(){
    int H,W;
    while(true){
        scanf("%d %d",&H,&W);
        if(H==0||W==0)break;
        for(int h=1;h<=H;h++){
            printf("#");
            for(int w=1;w<=W-2;w++){
                if(h==1||h==H){
                    printf("#");
                }else{
                    printf(".");
                }
            }
            printf("#\n");
        }
        printf("\n");
    }
}


Measured memory_bytes: 2492
#include <cstdio>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
inline int gcd(int x, int y)
{
	if (!x || !y)
		return x | y;
	while (y)
	{
		int r = x % y;
		x = y;
		y = r;
	}
	return x;
}
int eu[100005], ev[100005], ew[100005], fa[300005];
bool can[1000005][2];
int getfa(int u) { return u == fa[u] ? u : fa[u] = getfa(fa[u]); }
inline void unite(int u, int v) { fa[getfa(u)] = getfa(v); }
inline int get_idx(int u, int x, int y) { return u * 6 + x % 3 * 2 + y; }
int main()
{
	// freopen("AGC031-F.in", "r", stdin);
	int n, m, q, MOD, g = 0;
	scanf("%d%d%d%d", &n, &m, &q, &MOD);
	for (int i = 0; i < m; i++)
	{
		scanf("%d%d%d", eu + i, ev + i, ew + i);
		g = gcd(g, my_abs(ew[i] - ew[0]));
	}
	if (!g)
		g = MOD;
	MOD = gcd(MOD, g * 3);
	int z = ew[0] % (g * 3);
	for (int i = 0, a = z; i < MOD * 2; i++)
	{
		can[a][i & 1] = true;
		a = a * 2 % MOD;
	}
	for (int i = 0; i < n * 6; i++)
		fa[i] = i;
	for (int i = 0; i < m; i++)
	{
		auto add = [&] (int u, int v, int w)
		{
			for (int x = 0; x < 3; x++)
			{
				unite(get_idx(u, x, 0), get_idx(v, x * 2 + w, 1));
				unite(get_idx(u, x, 1), get_idx(v, x * 2 + w, 0));
			}
		};
		int u = eu[i] - 1, v = ev[i] - 1, w = (ew[i] - z + 3 * g) / g % 3;
		add(u, v, w);
		add(v, u, w);
	}
	while (q--)
	{
		int u, v, r;
		scanf("%d%d%d", &u, &v, &r);
		u--;
		v--;
		bool ans = false;
		for (int x = 0; x < 3; x++)
		{
			for (int y = 0; y < 2; y++)
			{
				if (getfa(get_idx(v, 0, 0)) != getfa(get_idx(u, x, y)))
					continue;
				int diff = (r + z - x * g + 3 * g + 3 * MOD) % MOD;
				ans |= can[diff][y];
			}
		}
		puts(ans ? "YES" : "NO");
	}
	return 0;
}


Measured memory_bytes: 4480
import java.util.Scanner;

public class Main{
  public static void main(String[] args){
    Scanner scan = new Scanner(System.in);
    int s = scan.nextInt();
    int w = scan.nextInt();
    if(s <= w){
      System.out.println("unsafe");
    }else{
      System.out.println("safe");
    }
  }
}

Measured memory_bytes: 35788
#include <bits/stdc++.h>
using namespace std;
 
int main () {
  int64_t N, K;
  cin >> N >> K;
  vector<int> p(N);
  vector<double> memo(N + 1);
  memo.at(0) = 0;
  for (int64_t i = 0; i < N; i++) {
    cin >> p.at(i);
    memo.at(i + 1) = (memo.at(i) + ((p.at(i) + 1) / 2.0));
  }
  double ans = 0;
  for (int64_t i = 0; i <= N - K; i++) {
    double M = (memo.at(i + K) - memo.at(i));
    ans = max(M, ans);
  }
  cout << fixed << setprecision(16);
  cout << ans << endl;
}
    

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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

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

int main() {
  set<llong> s;
  for (int i = 0; i < 3; ++i) {
    int in;
    cin >> in;
    s.insert(in);
  }

  if (s.size() == 2) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define f first
#define s second
#define mp make_pair
#define ll long long

void reverse(string str) 
{ 
   for (int i=str.length()-1; i>=0; i--) 
      cout << str[i];  
} 

void test(int k) {
	int i,j,l,n,m;
	k--;
	string s="1";
	while(k--) {
		j = 0;
		while(j<s.size()-1) {
			if(s[j]<=s[j+1] && s[j]!='9') {
				s[j] = s[j]+1;
				for(l=j-1;l>=0;l--)
					if(s[l+1]=='0')
						s[l]='0';
					else
						s[l] = s[l+1]-1;
				break;
			}
			j++;
		}
		if(j==s.size()-1) {
			if(s[j]=='9') {
				s += '1';
				for(l=0;l<s.size()-1;l++)
					s[l] = '0';
			}
			else {
				s[j] = s[j]+1;
				j--;
				while(j>=0) {
					if(s[j+1]=='0')
						s[j] = '0';
					else
						s[j] = s[j+1]-1;
					j--;
				}
			}
		}
	}
	reverse(s);
	cout<<endl;
}


int main() {
	int i;
	cin>>i;
		test(i);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
     int n;
     cin>>n;
     if(n>=400&&n<=599) cout<<"8"<<endl;
     if(n>=600&&n<=799) cout<<"7"<<endl;
     if(n>=800&&n<=999) cout<<"6"<<endl;
     if(n>=1000&&n<=1199) cout<<"5"<<endl;
     if(n>=1200&&n<=1399) cout<<"4"<<endl;
     if(n>=1400&&n<=1599) cout<<"3"<<endl;
     if(n>=1600&&n<=1799) cout<<"2"<<endl;
     if(n>=1800&&n<=1999) cout<<"1"<<endl;
     return 0;
}


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

int main() {
    ll K;
    cin >> K;

    bool b = true;
    ll i = 0,n = 7;
    if(K % 10 == 1||K % 10 == 3||K % 10 == 7||K % 10 == 9){
        while(b){
            if(n % K == 0){
                cout << i + 1 << endl;
                b = false;
                break;
            };
            n = n % K * 10 + 7 ;
            i ++;
        }
    }
    else {
        cout << -1 <<  endl;
    } //Kの一の位が偶数か5のとき割り切れない
}

Measured memory_bytes: 3600
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
#define rep(i,s,e) for(i64 (i) = (s);(i) < (e);(i)++)
#define all(x) x.begin(),x.end()
#define STRINGIFY(n) #n
#define TOSTRING(n) STRINGIFY(n)
#define PREFIX "#" TOSTRING(__LINE__) "| "
#define debug(x) \
{ \
  std::cout << PREFIX << #x << " = " << x << std::endl; \
}

std::ostream& output_indent(std::ostream& os, int ind) {
  for(int i = 0; i < ind; i++) os << " ";
  return os;
}

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p);
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v);

template<class S, class T> std::ostream& operator<<(std::ostream& os, const std::pair<S, T>& p) {
  return (os << "(" << p.first << ", " << p.second << ")");
}
template<class T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& v) {
  os << "[";
  for(int i = 0;i < v.size();i++) os << v[i] << ", ";
  return (os << "]");
}

template<class T>
static inline std::vector<T> ndvec(size_t&& n, T val) { return std::vector<T>(n, std::forward<T>(val)); }
template<class... Tail>
static inline auto ndvec(size_t&& n, Tail&&... tail) {
  return std::vector<decltype(ndvec(std::forward<Tail>(tail)...))>(n, ndvec(std::forward<Tail>(tail)...));
}
template<class Cond> struct chain {
  Cond cond; chain(Cond cond) : cond(cond) {}
  template<class T> bool operator()(T& a, const T& b) const { if(cond(a, b)) { a = b; return true; } return false; }
};
template<class Cond> chain<Cond> make_chain(Cond cond) { return chain<Cond>(cond); }

int main() {
  i64 x;
  cin >> x;
  cout << 10 - x / 200 << endl;
}


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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
  }
  
  sort(A.begin(), A.end());
  reverse(A.begin(), A.end());
  int sum = accumulate(A.begin(), A.end(), 0);
  
  bool ans = true;
  for (int i = 0; i < M; i++) {
    if (A.at(i) < (sum / 4.0 / M)) {
      ans = false;
      break;
    }
  }
  if (ans) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define sz(v) (int) v.size()
#define pr(v) For(i, 0, sz(v)) {cout<<v[i]<<" ";} cout<<endl;
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, st, en) for(ll i=st; i<en; i++)
#define tr(x) for(auto it=x.begin(); it!=x.end(); it++)
#define fast std::ios::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define ll long long
#define int long long
#define mp make_pair
#define F first
#define S second
typedef pair<int, int> pii;
#define MOD 1000000007
#define INF 1000000000000000007
#define MAXN 200005

// it's swapnil07 ;)


signed main(){
    fast
    #ifdef SWAPNIL07
        freopen("/home/swapnil/Desktop/c++/input.txt","r",stdin);
        freopen("/home/swapnil/Desktop/c++/output.txt","w",stdout);
    #endif
    int h, w, a, b; cin>>h>>w>>a>>b;
    string s = "";
    For(i, 0, a){
        s.pb('1');
    }
    For(i, a, w){
        s.pb('0');
    }
    For(i, 0, b){
        cout<<s<<"\n";
    }
    For(i, 0, s.length()){
        if(s[i]=='0')
            s[i]='1';
        else
            s[i]='0';
    }
    For(i, b, h){
        cout<<s<<"\n";
    }
    return 0;
}

Measured memory_bytes: 1280
#[allow(unused_imports)]
use std::cmp::{max, min};

#[allow(unused_imports)]
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};

#[allow(non_snake_case)]
#[allow(unused)]
fn main() {
    input! {
        X:i64,
        K:i64,
        D:i64,
    }

    let X = X.abs();

    let num = X / D;
    if num >= K {
        println!("{}", X - D * K);
        return;
    }

    println!("{}", if (K - num) % 2 == 0 { X % D } else { D - X % D });
}


Measured memory_bytes: 2116