akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <algorithm>
using namespace std;
//using namespace atcoder;
const int Mod = 1000000007;
class mll {
public:
	long long x;
	mll(long long x = 0) : x((x% Mod + Mod) % Mod) {};
	void operator - () {
		x = (-x % Mod + Mod) % Mod;
	}
	void operator += (const mll& a) {
		if ((x += a.x) >= Mod) x -= Mod;
	}
	void operator ++ () {
		*this += 1;
	}
	void operator ++(int) {
		operator++();
	}
	void operator -= (const mll& a) {
		if ((x += Mod - a.x) >= Mod) x -= Mod;
	}
	void operator *= (const mll& a) {
		(x *= a.x) %= Mod;
	}
	void operator /= (const mll& a) {
		mll b = a.inv();
		(x *= b.x) %= Mod;
	}
	mll operator + (const mll& a) const {
		mll ans = *this;
		ans += a;
		return ans;
	}
	mll operator - (const mll& a) const {
		mll ans = *this;
		ans -= a;
		return ans;
	}
	mll operator * (const mll& a) const {
		mll ans = *this;
		ans *= a;
		return ans;
	}
	bool operator < (const mll& a) {
		return this->x < a.x;
	}
	void pow(long long n) {
		long long xx = x;
		x = 1;
		while (n > 0) {
			if (n & 1) x = x * xx % Mod;
			xx = xx * xx % Mod;
			n >>= 1;
		}
	}
	mll inv() const {
		long long a = x, b = Mod, u = 1, v = 0;
		while (b) {
			long long t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		u %= Mod;
		if (u < 0) u += Mod;
		a = u;
		return mll(a);
	}

};
int main() {
	long long N;
	cin >> N;
	mll a = 10;
	a.pow(N);
	mll b = 9;
	b.pow(N);
	b *= 2;
	mll c = 8;
	c.pow(N);
	mll ans = a - b + c;
	cout << ans.x << endl;
	// 2*(10^N-9^N) - (10^N-8^N)
}


Measured memory_bytes: 3632
#include<bits/stdc++.h>
#define inf 0x7fffffff
#define eps 1e-4
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const double pi = acos(-1);
inline ll read(){
    ll x = 0, f = 1;
    char ch = getchar();
    while(ch > '9' || ch < '0') {if(ch == '-') f = -1;ch = getchar();}
    while(ch >= '0' && ch <= '9'){x = x *10 + ch -'0';ch = getchar();}
    return x * f;
}

ll n,k;
ll a[200005];
int main(){
    int i,j;
    //freopen("a.out","r",stdin);
    //freopen("a.ans","w",stdout);
    n=read();
    for(i=1;i<=n;i++) a[i]=read();
    ll now=1000,mx=1000;
    for(i=2;i<=n;i++){
    	if(a[i]>a[i-1]){
    		ll x=now/a[i-1];
    		now-=x*a[i-1];
    		now+=x*a[i];
    		mx=max(mx,now);
    	}
    }
    cout<<mx;
    return 0;
}
/*
6
8 4
8 -4
5 5
5 -5
1 3
1 -3
*/

Measured memory_bytes: 3636
import scala.io.StdIn._

object Main extends App {
  val n = readInt()
  val a = readLine().split(" ").map(_.toInt).toSeq

  def maxDiff(list: Seq[Int], max: Int): Int = {
    if (list.length > 2) {
      val i = (0 until list.length - 1).maxBy(i => (list(0) - list(i + 1)).abs)
      maxDiff(list.tail, math.max((list(0) - list(i + 1)).abs, max))
    } else
      math.max((list(0) - list(1)).abs, max)
  }

  println(maxDiff(a, 0))
}


Measured memory_bytes: 54892
#include<iostream>
#include<cstdio>
#include <stdio.h>
#include<algorithm>
#include<cstring>
#include <string>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<map>
#include<vector>
#include<bits/stdc++.h>
#include <set>
#define ll   long long
#define IO ios::sync_with_stdio(false);cin.tie();cout.tie(0)
#define inf 0x3f3f3f
#define pi 3.1415926535898
using namespace std;
const int mod=1e9+7;
const int N=1e6+10;
ll dp[3][N];
ll power(ll a,ll b)
{
    return b?power(a*a%mod,b/2)*(b%2?a:1)%mod:1;
}
ll C(ll n,ll k)
{
    ll x=1,y=1;
    for(ll i=1; i<=k; i++)
    {
        x=x*(n-i+1)%mod;
        y=y*i%mod;
    }
    return x*power(y,mod-2)%mod;
}
int main()
{
    ll x,y;
    cin>>x>>y;
    if((x+y)%3!=0)
    {
        printf("0");
        exit(0);
    }
    if(2*x-y>=0)
    {
        printf("%lld\n",C((x+y)/3,(2*x-y)/3));
    }
    else if(2*y-x>=0)
    {
        printf("%lld\n",C((x+y)/3,(2*y-x)/3));
    }
    return 0;
}


Measured memory_bytes: 3676
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.complex;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

const long p = 1_000_000_000 + 7;

bool test(long h, long w, long[] c) {
    if(h % 2 == 0 && w % 2 == 0) {
        return c.all!(a => a % 4 == 0);
    }
    if(h % 2 == 1 && w % 2 == 1) {
        if(c.count!(a => a % 2 == 1) != 1) {
            return false;
        }
        foreach(i; iota(26)) {
            if(c[i] % 2 == 1) {
                c[i] -= 1;
            }
        }
        long l;
        foreach(i; iota(26)) {
            l += c[i] / 4;
        }
        return l * 4 >= (w-1) * (h-1);
    }
    if(c.any!(a => a % 2 == 1)) {
        return false;
    }
    long l;
    foreach(i; iota(26)) {
        l += c[i] / 4;
    }
    return l * 4 >= ((w/2)*2) * ((h/2)*2);
}

void main(){
    long h, w;
    readlnTo(h, w);
    long[] c = new long[](26);
    foreach(i; iota(h)) {
        auto l = readln().chomp();
        foreach(li; l) {
            c[li-'a']++;
        }
    }
    writeln(test(h, w, c) ? "Yes": "No");
}



Measured memory_bytes: 256
N = int(input())
A = [int(_) for _ in input().split()]

def solve(N, A):
    s = 0
    result = 1
    for i in range(N-1):
        r = A[i+1] - A[i]
        if r * s < 0:
            result += 1
            s = 0
        elif r != 0:
            s = r
    return result

print(solve(N, A))


Measured memory_bytes: 14252
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    double students[1000] = {0},sum,m,div;
 
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        div = sum = 0;
        for(int i = 0; i < n; i++){
            scanf("%lf",&students[i]);
            sum += students[i];
        }
        m = sum/n;
        for(int i = 0; i < n;i++){
            div += (students[i] - m)*(students[i] - m);
            students[i] = 0;
        }
        printf("%.8lf\n",sqrt(div/n));
    }
}


Measured memory_bytes: 2612
import std.stdio;
import std.string;
import std.range;
import std.conv;

void main()
{
	auto S = readln.chomp;
    switch(S) {
    	case "abc", "acb", "bac", "bca", "cab", "cba":
    		"Yes".writeln;
    		break;
    	default:
    		"No".writeln;
    		break;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long   // <-----!!!!!!!!!!!!!!!!!!!

#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n)-1;i>=0;i--)
#define rrep2(i,a,b) for (int i=(a)-1;i>=b;i--)
#define chmin(a,b) (a)=min((a),(b));
#define chmax(a,b) (a)=max((a),(b));
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define printV(v) cout<<(#v)<<":";for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;
#define printVS(vs) cout<<(#vs)<<":"<<endl;for(auto(s):(vs)){cout<<(s)<< endl;}
#define printVV(vv) cout<<(#vv)<<":"<<endl;for(auto(v):(vv)){for(auto(x):(v)){cout<<" "<<(x);}cout<<endl;}
#define printP(p) cout<<(#p)<<(p).first<<" "<<(p).second<<endl;
#define printVP(vp) cout<<(#vp)<<":"<<endl;for(auto(p):(vp)){cout<<(p).first<<" "<<(p).second<<endl;}

inline void output(){ cerr << endl; }
template<typename First, typename... Rest>
inline void output(const First& first, const Rest&... rest) {
    cerr << first << " "; output(rest...);
}

using ll = long long;
using Pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
const int inf = 2e9;
const int mod = 1e9 + 7;

// how many chars match between suffix of s and prefix of t?
int match(string s, string t) {
    for (int k = min(s.size(), t.size()); k >= 0; k--) {
        if (s.substr((int)s.size() - k) == t.substr(0, k)) {
            return k;
        }
    }
}

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

    int n;
    while (cin >> n, n) {
        vector<string> s(n);
        rep(i, n) cin >> s[i];

        vector<bool> alive(n, true);

        rep(i, n) {
            rep(j, n) {
                if (i == j) continue;
                if (s[i].find(s[j]) != string::npos) {
                    alive[j] = false;
                }
            }
        }

        {
            vector<string> t;
            rep(i, n) {
                if (alive[i]) {
                    t.emplace_back(s[i]);
                }
            }
            s = t;
            n = s.size();
        }

        vvi cost(n, vi(n));
        rep(i, n) {
            rep(j, n) {
                if (i == j) continue;
                cost[i][j] = s[j].size() - match(s[i], s[j]);
            }
        }

        vvi dp(1 << n, vi(n, inf));
        rep(i, n) {
            dp[1 << i][i] = s[i].size();
        }

        rep(i, 1 << n) {
            rep(j, n) { // used before
                if (!((i >> j) & 1)) continue;
                rep(k, n) { // will use
                    if ((i >> k) & 1) continue;
                    chmin(dp[i | (1 << k)][k], dp[i][j] + cost[j][k]);
                }
            }
        }

        cout << *min_element(all(dp.back())) << endl;
    }

}

Measured memory_bytes: 5280
#include<bits/stdc++.h>
#define ALL(c) (c).begin(),(c).end()
#define EACH(i,c) for(auto i=(c).begin();i!=(c).end();++i)
using namespace std;
#define int long long

const long long MOD = 998244353;

int dp[4010][4010];

int func(int n, int m) {
    return dp[n + m - 1][m - 1];
}

int powmod(int a, int k) {
    int res = 1;
    while(k > 0) {
        if(k & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        k >>= 1;
    }
    return res;
}

void solve(long long K, long long N){
    dp[0][0] = 1;
    for(int i = 1; i <= 4000; ++i) {
        dp[i][0] = 1;
        for(int j = 1; j <= i; ++j) {
            dp[i][j] = (dp[i - 1][j - 1] + dp[i - 1][j]) % MOD;
        }
    }

    for(int k = 2; k <= 2 * K; ++k) {
        int t = (k - 1) / 2 - max(0LL, k - K - 1);
        int res = 0;
        for(int i = 0; i <= t; ++i) {
            int a = (powmod(2, i) * dp[t][i]) % MOD;
            if (k % 2 == 1) {
                res = (res + a * func(N - i, K - 2 * t + i) % MOD) % MOD;
            } else {
                cerr << N - i <<  N - 2 * t - 1 + i << endl;
                res = (res + a * func(N - i, K - 2 * t - 1 + i) % MOD) % MOD;
                res = (res + a * func(N - i - 1, K - 2 * t - 1 + i) % MOD) % MOD;
            }
        }
        cout << res << endl;
    }
}

signed main(){
	ios::sync_with_stdio(false);
    long long K;
    scanf("%lld",&K);
    long long N;
    scanf("%lld",&N);
    solve(K, N);
    return 0;
}

Measured memory_bytes: 123904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mp make_pair
#define pb push_back
#define ff first
#define ss second
#define ip pair<ll,ll>
// const ll INF = 1000000000000000000;
const ll MOD = 1000000007;

struct matrix{
	ll n;
	vector<vector<ll> > a;

	matrix(int k){
		n=k;
		a.resize(n);
		for(int i=0;i<n;i++)
			a[i].resize(n);
	}
};

ll modmul(ll a, ll b){
	return a*b%MOD;
}

matrix mult(matrix m1, matrix m2){
	int n = m1.n;
	matrix res(n);
	for(int i=0;i<n;i++){
		for(int j=0;j<n;j++){
			res.a[i][j] = 0;
			for(int k=0;k<n;k++){
				res.a[i][j] += modmul(m1.a[i][k],m2.a[k][j]);
				if(res.a[i][j] >= MOD)
					res.a[i][j] -= MOD;
			}
		}
	}

	return res;
}

matrix modexp(matrix m, ll n){
	if(n == 1)
		return m;
	matrix p = modexp(m,n/2);
	p = mult(p,p);
	if(n&1)
		p = mult(p,m);
	return p;
}

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

	int n;
	ll k;
	cin>>n>>k;
	matrix m(n);
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			cin>>m.a[i][j];

	matrix res = modexp(m, k);
	ll ans = 0;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
			ans = (ans+res.a[i][j])%MOD;
	cout<<ans<<endl;
}


Measured memory_bytes: 1664
void main(){
  import std.stdio, std.string, std.conv, std.algorithm;
  
  long a, b, c, d, e, f;
  rd(a, b, c, d, e, f);

  /*
  100b/(a+b) < 100b'/(a'+b')
  
  100b*(a'+b') < 100b'*(a+b)
  */
  long mx_w=100*a, mx_s;
  for(long w1=100*a; w1<=f; w1+=100*a){
    for(long w2=0; w2<=f; w2+=100*b){
      for(long s1=0; s1<=f; s1+=c){
        for(long s2=0; s2<=f; s2+=d){
          // cap?
          if(w1+w2+s1+s2 > f) continue;

          // dissolved?
          if(e*(w1+w2)/100 < s1+s2) continue;

          if(mx_s*((w1+w2)+(s1+s2)) < (s1+s2)*(mx_w+mx_s)){
            mx_w=w1+w2; mx_s=s1+s2;
          }
        }
      }
    }
  }

  writeln(mx_w+mx_s, " ", mx_s);

}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}

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

using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define debug(x) cout << #x << ": " << x << endl
#define out(x) cout << x << endl
//#define int long long int
const int MOD = 1000000007;
const ll LINF = (ll)1e18 - 1;
const int INF = 1e9 - 1;
const double EPS = 0.000000001;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

void print(const vector<int> &v) {
  for(auto x : v) {
    cout << x << " ";
  }
  cout << endl;
}

signed main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  VI a(n);
  rep(i, n) cin >> a[i];
  ll ans = 0;
  rep(i, n) {
    ans += a[i] - 1;
  }
  out(ans);
  return 0;
}


Measured memory_bytes: 256
// Optimise
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

// #define MULTI_TEST
#ifdef LOCAL
#define db(...) ZZ(#__VA_ARGS__, __VA_ARGS__);
#define pc(...) PC(#__VA_ARGS__, __VA_ARGS__);
template <typename T, typename U>
ostream &operator<<(ostream &out, const pair<T, U> &p)
{
    out << '[' << p.first << ", " << p.second << ']';
    return out;
}
template <typename Arg>
void PC(const char *name, Arg &&arg)
{
    while (*name == ',' || *name == ' ')
        name++;
    std::cerr << name << " { ";
    for (const auto &v : arg)
        cerr << v << ' ';
    cerr << " }\n";
}
template <typename Arg1, typename... Args>
void PC(const char *names, Arg1 &&arg1, Args &&... args)
{
    while (*names == ',' || *names == ' ')
        names++;
    const char *comma = strchr(names, ',');
    std::cerr.write(names, comma - names) << " { ";
    for (const auto &v : arg1)
        cerr << v << ' ';
    cerr << " }\n";
    PC(comma, args...);
}
template <typename Arg1>
void ZZ(const char *name, Arg1 &&arg1)
{
    std::cerr << name << " = " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void ZZ(const char *names, Arg1 &&arg1, Args &&... args)
{
    const char *comma = strchr(names + 1, ',');
    std::cerr.write(names, comma - names) << " = " << arg1;
    ZZ(comma, args...);
}
#else
#define db(...)
#define pc(...)
#endif

using ll = long long;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define f first
#define s second
#define pb push_back
#define all(v) v.begin(), v.end()
auto TimeStart = chrono::steady_clock::now();
auto seed = TimeStart.time_since_epoch().count();
std::mt19937 rng(seed);
template <typename T>
using Random = std::uniform_int_distribution<T>;

const int NAX = 2e5 + 5, MOD = 1000000007;
vector<int> adj[NAX];

int dfs(int node)
{
    if (adj[node].size() == 0)
        return 0;
    vector<int> temp;
    for (auto child : adj[node])
        temp.pb(dfs(child));
    sort(all(temp));
    reverse(all(temp));
    for (int i = 0; i < temp.size(); ++i)
        temp[i] = temp[i] + i + 1;
    return *max_element(all(temp));
}

void solveCase(int caseNo)
{
    int n, x;
    cin >> n;
    for (int i = 2; i <= n; ++i)
    {
        cin >> x;
        adj[x].pb(i);
    }
    cout << dfs(1) << '\n';
}

int main()
{
#ifndef LOCAL
    ios_base::sync_with_stdio(0);
    cin.tie(0);
#endif
    int t = 1;
#ifdef MULTI_TEST
    cin >> t;
#endif
    for (int i = 1; i <= t; ++i)
    {
        solveCase(i);
#ifdef TIME
        cerr << "Case #" << i << ": Time " << chrono::duration<double>(chrono::steady_clock::now() - TimeStart).count() << " s.\n";
        TimeStart = chrono::steady_clock::now();
#endif
    }
    return 0;
}


Measured memory_bytes: 15872
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Math;

namespace A_ABC163
{
    class MainClass
    {

        static int[] s;

        public static void Main(string[] args)
        {
            s = Array.ConvertAll(ReadLine().Split().ToArray(), int.Parse);
            double men = 2 * s[0] *PI;
            WriteLine(men);
        }
    }
}


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

const int MAX = 100005;
const int nil = -1;

struct Node{ int p, l, r; }; // 親と一番左の子供と一番右の兄弟

Node T[MAX];
int n, D[MAX]; // D[i] := iの深さ

//　節点uについて出力する
void print(int u){
    int i, c;

    printf("node %d: parent = %d, depth = %d, ", u, T[u].p, D[u]);
    if(T[u].p == nil) printf("root, ");
    else if(T[u].l == nil) printf("leaf, ");
    else printf("internal node, ");

    printf("[");
    // for( 初期化; 継続条件; 次のループに入る時の処理)
    for(i=0, c=T[u].l; c!=nil; i++, c=T[c].r){
        if(i>0) printf(", ");
        cout << c; 
    }
    printf("]");
    cout << endl;
}

// 再帰的に深さを求める
void rec(int u, int p){
    D[u] = p;
    if(T[u].r != nil) rec(T[u].r, p);
    if(T[u].l != nil) rec(T[u].l, p+1);
}

int main(){

    cin >> n;
    for(int i=0; i<n; ++i) T[i].p = T[i].l = T[i].r = nil;

    int l;
    for(int i=0; i<n; ++i){
        int id, k;
        scanf("%d %d", &id, &k);
        for(int j=0; j<k; ++j){
            int c;
            scanf("%d", &c);
            if(j == 0) T[id].l = c;
            else T[l].r = c;
            l = c;
            T[c].p = id;
        }
    }

    int root;
    for(int i=0; i<n; ++i) if(T[i].p == nil) root = i;
    
    rec(root, 0);

    for(int i=0; i<n; ++i) print(i);

    return 0;
}


Measured memory_bytes: 7904
#include<stdio.h>
int main()
{
  int i,x,y;
  int tmp;
  for(i=1;1;i++){
    scanf("%d %d",&x, &y);
    if(x==0 && y==0)break;
    
    if(x > y){
    	tmp = x;
    	x = y;
    	y = tmp;
    }
    printf("%d %d\n",x ,y);
    }
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
using namespace std;
 
#define maxn -20000000000 //negative value to break code and force you to put right constraint
#define mod 1073741824
#define md(x) (x) % mod;
#define sc scanf
#define pr printf
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ps push
#define prt(x) cout << (#x) << " is " << (x) << endl
#define EPS 1e-9
#define INF 100000000000
#define INFd 1e9
typedef unsigned long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<double> vd;
vector<ll> res(100005,0),deg(100005,0);
ll ans=0;
vector<pair<ll,ll> > adj[100005];
vector<bool> vis(100005,false);
void dfs(ll s,ll cnt)
{
	vis[s]=true;
	for(ll i=0;i<adj[s].size();i++)
	{
		ii x=adj[s][i];
		if(!vis[x.fi])
			{
				cnt=(cnt+1)%ans;
				res[x.se]=cnt;
				dfs(x.fi,cnt);
			
			}
	}
}

int main()
{		
	ll n;
	cin>>n;
	for(ll i=0;i<n-1;i++)
	{	
		ll x,y;
		cin>>x>>y;
		deg[x]++;deg[y]++;
		adj[x].pb({y,i});
		adj[y].pb({x,i});
	}
	ans=*max_element(deg.begin(),deg.end());
	for(ll i=1;i<=n;i++)
	{
		if(!vis[i])
			dfs(i,0);
	}
	cout<<ans<<endl;
	for(ll i=0;i<n-1;i++)
	{
		cout<<res[i]+1<<endl;
	}
	
}

Measured memory_bytes: 9984
package main

import "fmt"

func main() {
	var a [3][3]int
	var d [3][3]int
	for i := 0; i < 3; i++ {
		for j := 0; j < 3; j++ {
			fmt.Scan(&a[i][j])
		}
	}
	var n int
	fmt.Scan(&n)
	for i := 0; i < n; i++ {
		var v int
		fmt.Scan(&v)
		for i := 0; i < 3; i++ {
			for j := 0; j < 3; j++ {
				if a[i][j] == v {
					d[i][j] = 1
				}
			}
		}
	}
	ok := false
	var cnt int
	for i := 0; i < 3; i++ {
		cnt = 0
		for j := 0; j < 3; j++ { // 横一列揃っているかチェック
			cnt += d[i][j]
		}
		if cnt == 3 {
			ok = true
		}
	}
	for i := 0; i < 3; i++ {
		cnt = 0
		for j := 0; j < 3; j++ { // 縦一列揃っているかチェック
			cnt += d[j][i]
		}
		if cnt == 3 {
			ok = true
		}
	}
	cnt = 0
	for j := 0; j < 3; j++ {
		cnt += d[j][j] // 斜めビンゴチェック - 左上から右下
	}
	if cnt == 3 {
		ok = true
	}
	cnt = 0
	for j := 0; j < 3; j++ {
		cnt += d[j][2-j] // 斜めビンゴチェック - 右上から左下
	}
	if cnt == 3 {
		ok = true
	}
	if ok {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


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

using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
constexpr ll TEN(int n) { return (n==0) ? 1 : 10*TEN(n-1); }
template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;

using D = double;
const D PI = acos(D(-1)), EPS = 1e-8;

int sgn(D a) { return (abs(a) <= EPS) ? 0 : (a < 0 ? -1 : 1); }
int sgn(D a, D b) { return sgn(a-b); }

struct Pt2 {
    D x, y;
    Pt2() {}
    Pt2(D _x, D _y) : x(_x), y(_y) {}
    Pt2 operator+(const Pt2 &r) const { return Pt2(x+r.x, y+r.y); }
    Pt2 operator-(const Pt2 &r) const { return Pt2(x-r.x, y-r.y); }
    Pt2 operator*(const Pt2 &r) const { return Pt2(x*r.x-y*r.y, x*r.y+y*r.x); }

    Pt2 operator*(const D &r) const { return Pt2(x*r, y*r); }
    bool operator<(const Pt2 &r) const { return 2*sgn(x, r.x)+sgn(y, r.y)<0; }

    D norm() const { return x*x + y*y; }
    D abs() const { return sqrt(norm()); }
    D rabs() const { return max(std::abs(x), std::abs(y)); }
    D arg() const { return atan2(y, x); }
    static Pt2 polar(D le, D th) { return Pt2(le*cos(th), le*sin(th)); }
};
ostream& operator<<(ostream& os, const Pt2 &p) {
    return os << "(" << p.x << ", " << p.y << ")";
}
using P = Pt2;

struct L {
    P s, t;
    L() {}
    L(P _s, P _t) : s(_s), t(_t) {}
    P vec() const { return t-s; }
};

D cross(P a, P b) { return a.x*b.y - a.y*b.x; }

int sgncrs(P a, P b) {
    D cr = cross(a, b);
    if (abs(cr) <= (a.rabs() + b.rabs()) * EPS) return 0;
    return (cr < 0) ? -1 : 1;
}

int crossLL(const L &l, const L &m, P &r) {
    D cr1 = cross(l.vec(), m.vec()), cr2 = cross(l.vec(), l.t - m.s);
    if (sgncrs(l.vec(), m.vec()) == 0) {
        r = l.s;
        if (sgncrs(l.vec(), l.t - m.s)) return 0;
        return -1;
    }
    r = m.s + m.vec() * (cr2 / cr1);
    return 1;
}

using Pol = V<P>;

// pol must be convex
D diameter(const Pol &p) {
    int n = int(p.size());
    int x = 0, y = 0;
    for (int i = 1; i < n; i++) {
        if (p[i] < p[x]) x = i;
        if (p[y] < p[i]) y = i;
    }
    D ans = 0;
    int sx = x, sy = y;
    while (sx != y || sy != x) {
        ans = max(ans, (p[x]-p[y]).abs());
        int nx = (x+1 < n) ? x+1 : 0, ny = (y+1 < n) ? y+1 : 0;
        if (cross(p[nx] - p[x], p[ny] - p[y]) < 0) x = nx;
        else y = ny;
    }
    return ans;
}

int main(void) {
    cout << setprecision(20) << fixed;
    int n;
    cin >> n;
    Pol p(n);
    for (int i = 0; i < n; i++) {
        D x, y;
        cin >> x >> y;
        p[i] = P(x, y);
    }
    cout << diameter(p) << endl;
    return 0;
}



Measured memory_bytes: 4092
// In the name of god
#include <bits/stdc++.h>
#pragma GCC optimize("02")
using namespace std;
using ll =long long ;
const ll maxn=1e5+5,inf=1e18+5;
ll n,x;
int main(){
	ios::sync_with_stdio(false) , cin.tie(0) , cout.tie(0);
	cin>>n;
	for(ll i=-2000;i<2001;i++){
		for(ll j=-2000;j<2001;j++){
			x=(i*i*i*i*i)-(j*j*j*j*j);
			if(x==n){
				cout<<i<<' '<<j;
				return 0;
			}
		}
	}
}


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define ll long long 
#define mod 1000000007
using namespace std;
ll dp[10001][101][2];
ll solve(int i,string &s,int m,int d,bool tight)
{
    if(i==s.length())
    {
        if(m==0)
            {
                
                return 1;
            }
        return 0;
    }
    if(dp[i][m][tight]!=-1)
        return dp[i][m][tight];

    int en = (tight)?(s[i]-'0'):9;
    ll ans = 0;
    for(int j=0;j<=en;j++)
    {
        int newm = (m+j)%d;
       
        ans = (ans+solve(i+1,s,newm,d,tight&(j==en)))%mod;
     
    }

    return dp[i][m][tight] = ans;
}
int main()
{
    string k;
    cin>>k;

    memset(dp,-1,sizeof dp);

    int d;
    cin>>d;

    cout<<(mod+-1+solve(0,k,0,d,true))%mod;

    return 0;
}

Measured memory_bytes: 20380
#include <stdio.h>

int main(void)
{
	int ball[10], poleA, poleB, i, n, flag;
	
	scanf("%d", &n);
	for (; n > 0 ; n--) {
		poleA = 0; poleB = 0; flag = 0;
		scanf("%d %d %d %d %d %d %d %d %d %d",
			  &ball[0], &ball[1], &ball[2], &ball[3], &ball[4], &ball[5], &ball[6], &ball[7], &ball[8], &ball[9]);
		for (i = 0; i < 10; i++) {
			if (ball[i] > poleA)
				poleA = ball[i];
			else if (ball[i] > poleB)
				poleB = ball[i];
			else {
				printf("NO\n");
				flag = 1;
				break;
			}
		}
		if (flag != 1)
			printf("YES\n");
	}	
	return 0;
}

Measured memory_bytes: 0
from collections import defaultdict

def main():
    d = defaultdict(int)
    d2 = defaultdict(int)

    N = int(input())
    A = list(map(int, input().split()))

    for i in range(N):
        d[i + 1 + A[i]] += 1
        d2[max(0, (i + 1) - A[i])] += 1

    ans = 0

    for k,v in d.items():
        if k == 0:continue
        ans += v * d2[k]

    print(ans)

if __name__ == '__main__':
    main()

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


int c(int n) {
  int res = n;
  for(int six=0;six<=n;six++) {
    int count = 0;
    int temp = six;
    for(int i=0;temp>0;i++) {
      int p = pow(6, i);
      int cnt = ((int) (six / p)) % 6;
      temp -= cnt * p;
      count += cnt;
    }
    //cout << six << " -> " << count << endl;
    int nine = n - six;
    temp = nine;
    for(int i=0;temp>0;i++) {
      int p = pow(9, i);
      int cnt = ((int) (nine / p)) % 9;
      temp -= cnt * p;
      count += cnt;
    }
    res = min(count, res);
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  cout << c(n);
}

Measured memory_bytes: 4012
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>


using ull = unsigned long long;
using ll = long long;

using namespace std;



int main() {
   
	ll a;
	int b, c;
	scanf("%lld %d.%d", &a, &b, &c);
	b = 100 * b + c;
	ll s = a * b / 100;
	printf("%lld\n", s);

	
}

Measured memory_bytes: 3236
#include<bits/stdc++.h>
using namespace std;
using LL = int64_t;
const int maxn=1e5+5;
char ans[10];
char cnt[10];
int flag=0;
void dfs(int sum,int num) {
    if(flag==1) return ;
    if(num==3&&sum==7) {flag=1;return ;}
    if(num==3) return ;
    cnt[num]='+';
    dfs(sum+ans[num+1]-'0',num+1);
    if(flag==1) return ;
    cnt[num]='-';
    dfs(sum-(ans[num+1]-'0'),num+1);
    if(flag==1) return ;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin>>ans;
    dfs(ans[0]-'0',0);
    cout<<ans[0]<<cnt[0]<<ans[1]<<cnt[1]<<ans[2]<<cnt[2]<<ans[3]<<"=7\n";
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(final String[] args) {
        final Scanner sc = new Scanner(System.in);
        int N = 0;
        N = sc.nextInt();
        Set<String> tempSet = new HashSet<String>();
        
        for(int i=0;i<N;i++){
            tempSet.add(sc.next());
        }
    System.out.println(tempSet.size()); 
}
}

Measured memory_bytes: 72148
#include <bits/stdc++.h>
#define rep(i, a, b) for (int i = a; i < (b); i++)
#define rrep(i, a, b) for (int i = a; i >= (b); i--)
#define all(x) (x).begin(), (x).end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
template <class T>
inline bool chmin(T& a, T b) {
   if (a > b) {
      a = b;
      return true;
   }
   return false;
}
template <class T>
inline bool chmax(T& a, T b) {
   if (a < b) {
      a = b;
      return true;
   }
   return false;
}
void hr() {
   cerr << "--------------" << endl;
}
const int INF = 1001001001;
const int MOD = 1000000007;

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

   int k, x;
   cin >> k >> x;
   int l = max(-1000000, x - k + 1);
   int r = min(1000000, x + k - 1);
   rep(i, l, r + 1) { printf("%d%c", i, i != r + 1 ? ' ' : '\n'); }
   return 0;
}

Measured memory_bytes: 256
class KeySeq:

    def __init__(self):
        self.seq = []

    def _add_char(self, ch):
        if ch in ['0', '1']:
            self.seq.append(ch)

    def _backspace(self):
        self.seq = self.seq[:len(self.seq)-1]

    def apply(self, ch):
        if ch == 'B':
            self._backspace()
        else:
            self._add_char(ch)

    def __str__(self):
        return ''.join(self.seq)

keyseq = KeySeq()
s = input()
for ch in list(s):
    keyseq.apply(ch)

print(keyseq)


Measured memory_bytes: 3060
#include<stdio.h>
#define N 100000

int a[N];

int bin_search(int start,int last,int key){
	int mid=(last-start)/2+start;
	
	if(start > last)return 0;
	
	if(a[mid]==key)return 1;
	
	if(key > a[mid])return bin_search(mid+1,last,key);
	else return bin_search(0,mid-1,key);
	
}



int main(){
	int n,q,i,x;
	
	scanf("%d",&n);
	for(i=0;i<n;i++)scanf("%d",&a[i]);
	
	scanf("%d",&q);
	for(i=0;i<q;i++){
		scanf("%d",&x);
		printf("%d\n",bin_search(0,n-1,x));
	}
	
	return 0;
	
}


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

const int INF = 1 << 29;

int main() {
    int N, W, v[100], w[100];
    cin >> N >> W;
    for (int j = 0; j < N; ++j) {
        cin >> v[j] >> w[j];
    }

    int dp[10001];
    fill(dp, dp+W+1, -INF);
    dp[0] = 0;

    for (int j = 0; j < N; ++j) {
        for (int k = W; k >= w[j]; --k) {
            if (dp[k - w[j]] != INF) {
                dp[k] = max(dp[k], dp[k - w[j]] + v[j]);
            }
        }
    }

    int ans = -INF;
    for (int j = 0; j <= W; ++j) {
        ans = max(ans, dp[j]);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3148
import java.util.*;

public class Main{
    public static void main(String[] args){
        Scanner scan = new java.util.Scanner(System.in);
        int n = scan.nextInt();
        int[] p = new int[n];
        int a = 0;
        for(int i = 0; i < n; i++){
            p[i] = scan.nextInt();
        }
        for(int i = 1; i < n - 1; i++){
            if(p[i - 1] < p[i] && p[i] < p[i + 1] || p[i - 1] > p[i] && p[i] > p[i + 1]){
                a++;
            }
        }
        System.out.println(a);
    }
}

Measured memory_bytes: 23124
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]

def c(x,y):
    if y < x:
        x,y = y,x
    return x*n+y

e = [[] for i in range(n**2)]
count = [0]*(n**2)
for i in range(n):
    for j in range(n-2):
        y = c(i,a[i][j]-1)
        z = c(i,a[i][j+1]-1)
        count[z] += 1
        e[y].append(z)

q = []

for i in range(n-1):
    for j in range(i+1,n):
        x = c(i,j)
        if count[x] == 0:
            q.append(x)
ans = 0

while q:
    
    ans += 1
    old = q
    q = []
    for nowq in old:
        for nex in e[nowq]:
            count[nex] -= 1
            
            if count[nex] == 0:
                q.append(nex)
if sum(count) > 0:
    print(-1)
else:    
    print(ans)





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

const int MAX_N = 51;
int mp[MAX_N][MAX_N];
ll X[MAX_N], Y[MAX_N];
pair<ll, ll> dot[MAX_N];
int N, K;

int minmp(int i, int j) {
    if(i >= 0 && j >= 0) return mp[i][j];
    else return 0;
}

int main()
{
    cin >> N >> K;
    for(int i = 0; i < N; ++i) 
        cin >> dot[i].first >> dot[i].second;
    
    map<ll, int> x_index, y_index;
    sort(dot, dot + N);
    
    for(int i = 0; i < N; ++i) {
        X[i] = dot[i].first;
        x_index[dot[i].first] = i;
    }
    sort(dot, dot + N, 
        [](pair<ll, ll> &x, pair<ll, ll> &y){ return x.second < y.second; });
    
    for(int i = 0; i < N; ++i) {
        Y[i] = dot[i].second;
        y_index[dot[i].second] = i;
    }
    /*
    for(int i = 0; i < N; ++i) {
        cout << X[i] << " ";
    }
    cout << endl;
    for(int i = 0; i < N; ++i) {
        cout << Y[i] << " ";
    }
    cout << endl;
    */
    for(int i = 0; i < N; ++i) {
        ll x = dot[i].first, y = dot[i].second;
        int nx = x_index[x], ny = y_index[y];
        ++mp[nx][ny];
    }

    /*
    cout << endl;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cout << mp[i][j] << " ";
        }
        cout << endl;
    }
    */

    //2次元累積和
    for(int i = 0; i < N; ++i) {
        for(int j = 1; j < N; ++j) 
            mp[i][j] += mp[i][j-1];
    }
    for(int i = 1; i < N; ++i) {
        for(int j = 0; j < N; ++j) 
            mp[i][j] += mp[i-1][j];
    }

    /*
    cout << endl;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            cout << mp[i][j] << " ";
        }
        cout << endl;
    }
    */

    ll res = LLONG_MAX;
    for(int i = 0; i < N; ++i) {
        for(int j = 0; j < N; ++j) {
            for(int k = i + 1; k < N; ++k) {
                for(int l = j + 1; l < N; ++l) {
                    /*
                    int num = minmp(k, l) 
                                - minmp(i-1, l)
                                - minmp(k, j-1);
                                + minmp(i-1, j-1);
                    if(num >= K) {
                        
                        cout << i << " " << j << endl;
                        cout << k << " " << l << endl;
                        cout << endl;
                        
                        ll S = 1LL * (X[k] - X[i]) * (Y[l] - Y[j]);
                        res = min(res, S);
                    }
                    */

                    int num = 0;
                    ll lx = X[i], rx = X[k];
                    ll by = Y[j], uy = Y[l];
                    
                    for(int m = 0; m < N; ++m) {
                        if(lx <= dot[m].first && dot[m].first <= rx
                            && by <= dot[m].second && dot[m].second <= uy)
                                ++num;
                    }
                    if(num >= K) res = min(res, (rx - lx)*(uy - by));
                }
            }
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<set>
#define int long long
#define N 100010
#define ll long long
using namespace std;
ll f[N],l[N],r[N];
int k;
struct ODT{
	#define it set<node>::iterator
	struct node{
		int r;
		mutable int v;
		node(int R=0,int V=0):r(R),v(V){}
		bool operator< (const node &a)const{return r<a.r;}
	};
	set<node>s;
	it split(int v)
	{
		it u=s.lower_bound(node(v));
		if(u->r==v) return u;
		else return s.insert(node(v,u->v)).first;
	}
	void change(int l,int r,int v)
	{
		if(l>r) return;
		it lt=split(l-1),rt=split(r);
		rt->v=v;
		++lt;
		s.erase(lt,rt);
	}
	ll answer(int v)
	{
    	it u=s.lower_bound(node(v));
    	if(u->v) return f[u->v]+(v-r[u->v]+k)%k;
    	else return 0;
	}
}o;
ll num[N],b[N],ans=1000000000000000ll;
signed main()
{
	int n;
	scanf("%lld%lld",&n,&k);
	o.s.insert(ODT::node(-1));
	o.s.insert(ODT::node(k-1));
	for(int i=1;i<=n;i++) scanf("%lld%lld",&num[i],&b[i]),num[i]+=num[i-1];
	for(int i=1;i<=n;i++)
	if(b[i]==1)
	{
		if(2*(num[i]-num[i-1])>k){puts("-1");return 0;}
		l[i]=(-2*num[i-1]%k+k)%k;
		r[i]=(-2*num[i]%k+k)%k;
		f[i]=o.answer(r[i]);
        if(l[i]>r[i]) o.change(r[i]+1,l[i]-1,i);
        else
		{
			o.change(0,l[i]-1,i);
			o.change(r[i]+1,k-1,i);
		}
	}
	for(int i=1;i<=n;i++)
	if(b[i]) ans=min(ans,o.answer(l[i]));
	printf("%lld",ans+2*num[n]);
	return 0;
}


Measured memory_bytes: 16512
#include<iostream>
#include<algorithm>

using namespace std;
using ll = long long;

int cnt_digits(ll N) {
	int digits = 0;

	while (N > 0) {
		N /= 10;
		digits++;
	}
	return digits;
}

int main(void) {
	ll N;
	cin >> N;

	int ans = cnt_digits(N);

	for (ll A = 1LL; A * A <= N; ++A) {
		if (N % A != 0) continue;
		const ll B = N / A;

		const int cur = max(cnt_digits(A), cnt_digits(B));

		if (ans > cur) {
			ans = cur;
		}
	}
	cout << ans << endl;
	return 0;

}


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

#define infi            5e9
#define infl            5e18
#define MX              100005
#define pi              2*acos(0.0)
#define ll              long long int
#define rr              read()
#define ff              first
#define ss              second
#define pb              push_back
#define pii             pair<int,int>
#define ms(a,b)         memset(a, b, sizeof(a))
#define loop(i,n)       for(register int i=0;i<n;i++)
#define pool(i,n)       for(register int i=n-1;i>=0;i--)
#define loop1(i,n)      for(register int i=1;i<=n;i++)
#define pool1(i,n)      for(register int i=n;i>0;i--)

using namespace std;

inline ll read(){char c=getchar();ll num,sign=1;for(;c<'0'||c>'9';c=getchar())if(c=='-')sign=-1;for(num=0;c>='0'&&c<='9';){c-='0';num=num*10+c;c=getchar();}return num*sign;}
inline ll pw(ll b, ll p){ll ans=1;while(p>0){if(p&1)ans*=b;p>>=1;b*=b;}return ans;}
inline bool isPrime(ll n){if(n==1)return false;if(n==2)return true;if(!(n%2))return false;for(ll i=3;i<=sqrt(n);i+=2)if(!(n%i))return false;return true;}
inline ll gcd(ll a, ll b){if(a==0)return b;return gcd(b%a,a);}

// //*************************************  Bitmask Opereations  **********************************//
// int Set(int N,int pos){return N=N | (1<<pos);}
// int reset(int N,int pos){return N= N & ~(1<<pos);}
// bool check(int N,int pos){return (bool)(N & (1<<pos));}
// //********************************************************************************************//


int main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    //#ifdef rid.dle//freopen("in.txt", "r", stdin);//#endif
    //freopen("in.txt", "r", stdin);

    int n=rr;
    int ar[120];

    int mini=1000,maxi=-1000;
    loop(i,n){
        ar[i]=rr;
        mini = min(mini,ar[i]);
        maxi = max(maxi,ar[i]);
    }

    int sum=infi;
    for(int i=mini;i<=maxi;i++){
        int cnt=0;
        loop(j,n){
            cnt += pw(abs(i-ar[j]),2);
        }
        sum = min(sum,cnt);
    }
    cout << sum << endl;
    
    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){
        cout << "Yes" << endl;
    }else if(a==c && a!=b){
        cout << "Yes" << endl;
    }else if(b==c && a!=b){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
string s[1000];
int depth[1000];
int cnt[10001];
bool f[10001];

bool saiki(int de,int index,int n)
{
	for(int i=index+1;i<n;i++)
	{
		if(depth[i]==de)
			return true;
		if(depth[i]<de)
			return false;
	}
	return false;
}

int main()
{
	while(1)
	{
		fill(cnt,cnt+10001,0);
		fill(f,f+10001,false);
		int n;
		cin>>n;
		if(n==0)
			break;
		for(int i=0;i<n;i++)
			cin>>s[i];
		
		for(int i=0;i<n;i++)
		{
			int c=0;
			while(s[i][c]=='.')
				c++;
			depth[i]=c;
			cnt[c]++;
		}

		for(int i=1;i<n;i++)
		{
			for(int j=0;j<depth[i]-1;j++)
			{
				if(f[j+1])
					s[i][j]='|';
				else
					s[i][j]=' ';
			}
			s[i][depth[i]-1]='+';
			cnt[depth[i]]--;
			if(cnt[depth[i]]>0)
				f[depth[i]]=saiki(depth[i],i,n);
			if(cnt[depth[i]]==0)
				f[depth[i]]=false;
		}

		for(int i=0;i<n;i++)
			cout<<s[i]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3928
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s;
  	cin >> s;
  	bool flag1 = false, flag2 = false;
  	for(int i = 0; i < s.size(); i++){
    	if(!flag1 && s[i] == 'C') flag1 = true;
      	if(flag1 && s[i] == 'F') flag2 = true;
    }
  	if(flag2) cout << "Yes" << endl;
  	else cout << "No" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt() - 1;
		String s = sc.next();
		char[] ca = s.toCharArray();
		switch (ca[k]){
			case 'A':
				ca[k] = 'a';
				break;
			case 'B':
				ca[k] = 'b';
				break;
			case 'C':
				ca[k] = 'c';
		}
		String ans = new String(ca);
		System.out.println(ans);
	}
}


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

void push(int *top, int *s,int x){
  (*top)++;
  s[(*top)] = x;
}
int pop(int *top,int *s){
  (*top)--;
  return s[(*top)+1];
}

int main(){
  char c[100];
  int top=0,stack[200];
  int a,b;
  int i;
  
  for(i=0;scanf("%s",c)!=EOF;i++){
    if(c[0]=='+'){
      a = pop(&top,stack);
      b = pop(&top,stack);
      push(&top,stack,b+a);
    }
    else if(c[0]=='-'){
      a = pop(&top,stack);
      b = pop(&top,stack);
      push(&top,stack,b-a);
    }
    else if(c[0]=='*'){
      a = pop(&top,stack);
      b = pop(&top,stack);
      push(&top,stack,b*a);
    }
    else push(&top,stack,atoi(c));
  }
  printf("%d\n",pop(&top,stack));
  
  return 0;
}




Measured memory_bytes: 2144
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,x[100005],y[100005],t[100005];
    cin>>n;
    for(int i=0;i<n;i++){
        cin>>t[i]>>x[i]>>y[i];
    }
    for(int i=0;i<n;i++){
    	if(x[i]+y[i]>t[i]||(t[i]-x[i]-y[i])%2!=0){
            cout<<"No";
            return 0;   
        }
	}
        
        cout<<"Yes";
        return 0;
}

Measured memory_bytes: 1408
#include<algorithm>
#include<cstdio>
#define N 100005
using namespace std;
int a[N],b[N],c[N],d[N],e[N],g[N],f[N],m,n;long long h[N],x;
inline bool cmp(int u,int v){return g[a[u]]==g[a[v]]?a[u]<a[v]:g[a[u]]<g[a[v]];}
int find(int u)
{
	if(!f[u])return u;
	int v=find(f[u]);
	return e[u]=max(e[u],e[f[u]]),f[u]=v;
}
int main()
{
	scanf("%d%d",&n,&m),x=0x7fffffffffffffffll;
	for(int i=1;i<=n;i++)scanf("%d%lld",g+i,h+i),g[i]=g[i]<h[i]?0:g[i]-h[i];
	for(int i=1;i<=m;i++)scanf("%d%d",a+i,b+i),c[i]=i,g[a[i]]<g[b[i]]||g[a[i]]==g[b[i]]&&a[i]<b[i]?a[i]^=b[i]^=a[i]^=b[i]:0;
	sort(c+1,c+m+1,cmp);
	for(int i=1,u;i<=m;i++)if(a[c[i]]!=(u=find(b[c[i]])))e[u]=max((long long)e[u],g[a[c[i]]]-h[u]),f[u]=a[c[i]],h[a[c[i]]]+=h[u];
	for(int i=1,u;i<=n;i++)u=find(i),x=min(x,max(g[i],e[i])+h[u]);
	return 0*printf("%lld\n",x);
}

Measured memory_bytes: 3328
# pdf
from heapq import *

n, m = map(int, input().split())
hp = []
for _ in range(n):
    a, b = map(int, input().split())
    heappush(hp, [a, b])
ans = 0
mx = b
ch = []
a, b = heappop(hp)
flag = 1
for i in range(1, m + 1):
    while a <= i:
        if flag:
            heappush(ch, -b)
            flag = 0
        if not hp:break
        a, b = heappop(hp)
        flag = 1
    if ch:
        ans -= heappop(ch)
print(ans)


Measured memory_bytes: 20100
#include <stack>
#include <queue>
#include <cstdio>
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
 
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,n0,n) for(int i=n0;i<n;i++)
#define Com(i,j,n) for(int i=0;i<n-1;i++)for(int j=i+1;j<n;j++)
#define INF (1<<29)

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int l;
char a[10086000],b[10086000];
int main(void)
{
    cin>>a;
    l=strlen(a);
    l--;
    for(int i=0;a[i]!='\0';i++)
	{
        if(a[i]=='b') b[l]='d';
        if(a[i]=='d') b[l]='b';
        if(a[i]=='p') b[l]='q';
        if(a[i]=='q') b[l]='p';
        l--;
    }
    if(!strcmp(a,b)) printf("Yes\n");
	else printf("No\n");
}

Measured memory_bytes: 2432
#include <stdio.h>


int main()
{
	long long int a;
	scanf("%lld",&a);
	long long int b = 100;
	for(int i=1;;i++)
	{
		b += (b/100);
		if(b>=a)
		{
			printf("%d",i);
			return 0;
		}
	}
}

Measured memory_bytes: 1732
using System;
using System.Linq;
using System.Collections.Generic;

namespace Atcoder
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var inputs = Enumerable.Range(0, 2)
                .Select(_ => Console.ReadLine())
                .ToArray();

            var memberCount = int.Parse(inputs[0]);

            var hoge = inputs[1].Split(' ').Select(x => int.Parse(x)).ToArray();
            var day = hoge[0];
            var remain = hoge[1];

            var consumes = Enumerable.Range(0, memberCount)
                .Select(_ => Console.ReadLine())
                .Select(x => int.Parse(x))
                .ToArray();



            var tabeta = 0;
            for (var i = 0; i < memberCount; i++)
            {
                var sugita = 0;
                while (sugita < day)
                {
                    sugita += consumes[i];
                    tabeta++;
                }
            }

            Console.WriteLine(remain + tabeta);
        }
    }
}


Measured memory_bytes: 13396
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define repi(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,a) repi(i,0,a)
#define repd(i,a,b) for(int i=(a);i>=(b);i--)
#define repit(i,a) for(__typeof((a).begin()) i=(a).begin();i!=(a).end();i++)

#define all(u) (u).begin(),(u).end()
#define rall(u) (u).rbegin(),(u).rend()
#define UNIQUE(u) (u).erase(unique(all(u)),(u).end())

#define pb push_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define PI acos(-1.0)

using namespace std;

typedef long long ll;
typedef vector<int> vi;
vi prm, sm;
bool isp[300010] = {1, 1};
int N;

const int M = 300010;

void gen(){
    for (int i = 1; 7 * i < M; ++i) {
        int p = 7 * i - 1;
        if (!isp[p]) {
            for (int j = p + p; j < M; j += p) {
                isp[j] = 1;
            }
        }
        p = 7 * i + 1;
        if (!isp[p]) {
            for (int j = p + p; j < M; j += p) {
                isp[j] = 1;
            }
        }
    }
/*
    repi(i,2,300010)if(i%7==1 or i%7==6) sm.pb(i);
    rep(i,sm.size()){
        bool ok = 1;
        rep(j,i) if(sm[i]%sm[j]==0){
            ok = 0;
            break;
        }
        isp[i] = ok;
        if(ok) prm.pb(i);
    }
*/
}

void solve(){
    vector<int> ans;
    for (int i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            if (i % 7 == 1 or i % 7 == 6) {
                if (not isp[i]) ans.pb(i);
            }
            if (i * i == N) break;
            if (N/i % 7 == 1 or N/i % 7 == 6) {
                if (not isp[N/i]) ans.pb(N/i);
            }
        }
    }
    sort(all(ans));
    rep(i, int(ans.size())) {
        cout << ' ' << ans[i];
    }
    cout << endl;
}

int main()
{
    gen();
    while(cin >> N, N!=1){
        cout << N << ":";
        solve();
    }
    return 0;
}

Measured memory_bytes: 1508