akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main(){
  
  int a,b;
  cin >> a >> b;
  
  if( a+b >= 10 ){
    
    cout << "error" << endl;
    
  }
  
  else{
    
    cout << a+b << endl;
    
  }
  
}

Measured memory_bytes: 3600
#include <stdio.h>

int main()
{
	int n,k;
	char c[11];
	scanf("%d",&n);
	scanf("%s",&c);
	scanf("%d",&k);
	for(int i = 0;i < n;i++){
		if(c[i] != c[k - 1]) printf("*");
		else printf("%c",c[i]);
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vector<ll>> mat;
ll mod=pow(10,9)+7;

//累乗(aのk乗)
ll matpow(ll a,int k){
    ll dp=1,mt=a;
    while(k>0){
        if(k & 1)dp=(dp*mt)%mod;
        mt=(mt*mt)%mod;
        k/=2;
    }
    return dp;
}

int main(){
    int n,a,b;cin>>n>>a>>b;
    int i=1;
    ll A=1,B=1,N_A=1,N_B=1;
    while(i<=a){
        A=(A*i)%mod;
        N_A=(N_A*(n-a+i))%mod;
        i++;
    }
    i=1;
    while(i<=b){
        B=(B*i)%mod;
        N_B=(N_B*(n-b+i))%mod;
        i++;
    }
    cout<<(matpow(2,n)-1-((N_A*matpow(A,mod-2))%mod+(N_B*matpow(B,mod-2))%mod)%mod+mod)%mod<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<algorithm>
#include<iostream>
using namespace std;
int num = 0;
int uclide(int x,int y) {
	if (y == 0) return x;
	else {
		num = x;
		x = y;
		y = num%y;
		uclide(x, y);
	}
}
int main() {
	int x, y;
	int a = 0;
	cin >> x;
	cin >> y;
	if (x < y) {
		num = x;
		x = y;
		y = num;
	}
	a = uclide(x, y);
	cout << a << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>

using namespace std;

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

    int ans = 0;
    int mn = n;
    for (int i=1; i<=n; i++) {
        if (mp[i] <= mn) {
            ans++;
            mn = mp[i];
        }
    }
    cout << ans << endl;
}


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

#define FOR(i,b,e) for(int i=(b); i <= (e); ++i)
#define FORD(i,b,e) for(int i=(b); i >= (e); --i)
#define SIZE(c) (int) (c).size()
#define FORE(i,c) FOR(i,0,SIZE(c)-1)
#define FORDE(i,c) FORD(i,SIZE(c)-1,0)

#define pb push_back
#define mp make_pair
#define st first
#define nd second


using namespace std;

typedef long long ll;
typedef pair <int,int> pii;
typedef pair <ll,ll> pll;

typedef vector <int> VI;
typedef vector <bool> VB;
typedef vector <pii> VP;
typedef vector <ll> VL;
typedef vector <pll> VPL;

typedef vector <VI> VVI;
typedef vector <VL> VVL;
typedef vector <VB> VVB;
typedef vector <VP> VVP;

const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000000000000001LL;


/*************************************************************************/

int main() {
    ios_base::sync_with_stdio(0);
    
    int H, W, h, w;
    cin >> H >> W >> h >> w;
    
    if (H % h == 0 && W % w == 0) {
        cout << "No\n";
        return 0;
    }
    
    bool flip = false;
    if (W % w == 0) {
        flip = true;
        
        swap(H, W);
        swap(h, w);
    }
    
    int C = 1000000000;
    
    VVI tab(H, VI(W, 0));
    FOR(i,0,H-1) FOR(j,0,W-1) {
        if (j % w == 0) {
            tab[i][j] = C-1;
        } else if (j % w == w-1) {
            tab[i][j] = -C;
        }
    }
    
    ll sum = 0;
    FOR(i,0,H-1) FOR(j,0,W-1) {
        sum += tab[i][j];
    }
    
    if (sum > 0) {
        if (flip) {
            VVI tmp(W, VI(H));
            
            FOR(i,0,H-1) FOR(j,0,W-1) {
                tmp[j][i] = tab[i][j];
            }
            
            swap(H, W);
            tab = tmp;
        }
    
        cout << "Yes\n";
        FOR(i,0,H-1) FOR(j,0,W-1) {
            cout << tab[i][j] << " \n"[j == W-1];
        }
    } else {
        cout << "No\n";
    }

    return 0;
}

/*************************************************************************/


Measured memory_bytes: 4124
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#define re register
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define MAXN 50001
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(arr) memset(arr, 0, sizeof(arr))
const int inf = 0x3f3f3f3f;
int n,m,b;
int a[50001];
int main() 
{
	cin>>n;
	while(n){
		m+=n%10;
		n/=10;
	}
	if(m==1)
		m=10;
	cout<<m;
    return 0;
}

Measured memory_bytes: 256
import java.io.*;
       
public class Main{
    public static void main(String[] args) throws Exception{
        int x, ans;
  
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        x = Integer.parseInt(br.readLine());
 
        ans = x*x*x;
        System.out.println(ans);              
    }
}

Measured memory_bytes: 24116
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using static MyIO;


public class D
{
	public static readonly int offset = 8000;

	public static void Main()
	{
		string s = GetString() + "T";
		int x = GetInt();
		int y = GetInt();

		List<int> numX = new List<int>(8192);
		List<int> numY = new List<int>(8192);

		int num = 0;
		int turn = 0;
		for(int i = 0; i < s.Length; i++)
		{
			if(s[i] == 'F')
			{
				num++;
				continue;
			}

			if(turn == 0)
				numX.Add(num);
			else
				numY.Add(num);

			turn ^= 1;
			num = 0;
		}

		bool[,] dpx = new bool[numX.Count + 1, 16384];
		dpx[1, offset + numX[0]] = true;
		for(int i = 1; i < numX.Count; i++)
		{
			for(int j = 0; j <= 16000; j++)
			{
				if(j - numX[i] >= 0)
					if(dpx[i, j - numX[i]])
						dpx[i + 1, j] = true;
				
				if(j + numX[i] <= 16000)
					if(dpx[i, j + numX[i]])
						dpx[i + 1, j] = true;
			}
		}

		bool[,] dpy = new bool[numY.Count + 1, 16384];
		dpy[0, offset] = true;
		for(int i = 0; i < numY.Count; i++)
		{
			for(int j = 0; j <= 16000; j++)
			{
				if(j - numY[i] >= 0)
					if(dpy[i, j - numY[i]])
						dpy[i + 1, j] = true;
				
				if(j + numY[i] <= 16000)
					if(dpy[i, j + numY[i]])
						dpy[i + 1, j] = true;
			}
		}
		
		Console.WriteLine(
			(dpx[numX.Count, x + offset] && dpy[numY.Count, y + offset]) ? 
				"Yes" : "No");
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}

Measured memory_bytes: 134488
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a,b,c,d;
	while(scanf("%d%d%d%d",&a,&b,&c,&d)!=EOF)
	{
		if(a*b>=c*d)
		printf("%d\n",a*b);
		else
		printf("%d\n",c*d);
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    bool prime[100001];
    prime[0]=prime[1]=0;
    for(int i=2;i<100001;i++){
        prime[i]=1;
    }
    for(int i=2;i<100001;i++){
        if(prime[i]){
            for(int j=i*2;j<100001;j+=i){
                prime[j]=0;
            }
        }
    }
    vector<ll> v;
    v.pb(0);
    for(int i=3;i<100001;i++){
        if(prime[i]&&prime[(i+1)/2])v.pb(i);
    }
    vector<ll> ans;
    v.pb(1000000);
    ll q,x,y;
    cin>>q;
    for(int i=0;i<q;i++){
        cin>>x>>y;
        ans.pb(upper_bound(be(v),y)-lower_bound(be(v),x));
    }
    for(int i=0;i<q;i++){
        cout << ans[i]<<endl;
    }
    return 0;
}




Measured memory_bytes: 1652
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define PI acos(-1.0)
typedef long long ll;
const int INF=0x3f3f3f3f;
int d[8][2]={-1,0,0,-1,0,1,1,0,1,1,-1,-1,-1,1,1,-1};
int n,m,k;
char s[10];
ll a[1005];
int main()
{
    scanf("%d",&n);
    for(int i=3;i>=0;i--)
    {
        a[i]=n%10;
        n/=10;
    }
    if(a[0]+a[1]+a[2]+a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]-a[1]+a[2]+a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]+a[1]-a[2]+a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]+a[1]+a[2]-a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]-a[1]-a[2]+a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"+"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]-a[1]+a[2]-a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"+"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]+a[1]-a[2]-a[3]==7)
    {
        cout<<a[0]<<"+"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
        return 0;
    }
    if(a[0]-a[1]-a[2]-a[3]==7)
    {
        cout<<a[0]<<"-"<<a[1]<<"-"<<a[2]<<"-"<<a[3]<<"=7"<<endl;
        return 0;
    }
    return 0;
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.IO;
using System.Text;
using System.Diagnostics;

class Program
{
    static void Main()
    {
        int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        int n = nm[0];
        int m = nm[1];
        int[][] ab = Enumerable.Repeat(0, m).Select(_ => Console.ReadLine().Split(' ').Select(int.Parse).ToArray()).ToArray();
        List<Tuple<int, int>> d = new List<Tuple<int, int>>();

        for (int i = 0; i < m; i++)
        {
            d.Add(new Tuple<int, int>(ab[i][0], ab[i][1]));
        }

        d.Sort((a, b) => (a.Item2 != b.Item2) ? (a.Item2 - b.Item2) : (a.Item1 - b.Item1));

        int ans = 0;
        int destroy = 0;

        for(int i = 0; i < m; i++)
        {
            if(destroy <= d[i].Item1)
            {
                destroy = d[i].Item2;
                ans++;
            }
        }

        Console.WriteLine(ans);
    }
}

Measured memory_bytes: 29876
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

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

// 無限大の値
const ll  lINF = 1LL << 60;
const int iINF = 1 << 29;

int main(void){
  ll a,b,x;
  cin >> a >> b >> x;
  
  ll ans;
  if(a==0) ans = b/x + 1;
  else ans = b/x - (a-1)/x;
  cout << ans << endl;
  return 0;
} 

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define DBG(v) cerr << #v << " = " << (v) << endl;

bool M(string s) {
	const int x = stoi(s);
	return 1 <= x && x <= 12;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);

	string s;
	cin >> s;

	bool m1 = M(s.substr(0, 2));
	bool m2 = M(s.substr(2, 2));

	if(m1 && m2)
		cout << "AMBIGUOUS";
	else if(m1)
		cout << "MMYY";
	else if(m2)
		cout << "YYMM";
	else
		cout<<"NA";
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void solve () {
  long long x, y;
  int ans = 1;
  cin >> x >> y;
  while (x * 2 <= y) {
    x *= 2;
    ++ans;
  }
  cout << ans << endl;
}
int main () {
  cin.tie(0);
  ios::sync_with_stdio(false);
  solve();
}

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

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

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define rep(i,n) rep2(i,0,n)
#define rep2(i,m,n) for(int i=m;i<(n);i++)
#define ALL(c) (c).begin(),(c).end()
#define dump(x) cout << #x << " = " << (x) << endl

const ll MOD = 998244353;
const int MN = 100010;

ll mod_pow(ll x, ll k) {
	ll res = 1;
	for (; k; x = x * x % MOD, k /= 2) {
		if (k & 1) {
			res = res * x % MOD;
		}
	}
	return res;
}

int N, M;

map<pii, int> pts;

ll dp[MN][2];

int main() {
	cin >> N >> M;
	ll free = (ll)(N - 3) * (N - 2) / 2;

	rep(i, M) {
		int a, b, c;
		cin >> a >> b >> c;
		--a; --b;
		pts[mp(a, b)] = c;

		if (abs(a - b) >= 3) {
			if (pts.count(mp(b, a))) {
				if (pts[mp(b, a)] != c) {
					puts("0");
					return 0;
				}
			} else {
				--free;
			}
		}
	}

	ll coef = mod_pow(2, free);

	if (pts.count(mp(0, 0))) {
		dp[0][pts[mp(0, 0)]] = 1;
	} else {
		dp[0][0] = dp[0][1] = 1;
	}

	for (int i = 1; i < N; ++i) {
		int b = -1;
		if (pts.count(mp(i, i))) {
			b = (pts[mp(i, i)] ^ 1);
		}

		int sa = 0;
		int c = 0;

		if (pts.count(mp(i-1, i))) {
			c++;
			sa += pts[mp(i-1, i)];
		}

		if (pts.count(mp(i, i-1))) {
			c++;
			sa += pts[mp(i, i-1)];
		}

		int c2 = 0;
		int s2 = 0;

		if (i < N-1) {
			if (pts.count(mp(i-1, i+1))) {
				c2++;
				s2 += pts[mp(i-1, i+1)];
			}
			if (pts.count(mp(i+1, i-1))) {
				c2++;
				s2 += pts[mp(i+1, i-1)];
			}			
		}

		rep(j, 2) {
			if (dp[i-1][j] == 0) continue;
			rep(k, 2) if (k != b) {
				if (c == 2 && (sa + j + k) % 2 != 0) {
					continue;
				}
				if (i < N && c2 == 2 && (s2 + k) % 2 != 0) {
					continue;
				}

				ll p = 1;
				if (i < N-1) {
					if (c2 == 0) {
						p *= 2;
					}
				}

				if (c == 0) {
					p *= 2;
				}

				dp[i][k] += dp[i-1][j] * p;
				if (dp[i][k] >= MOD) dp[i][k] %= MOD;
			}
		}
	}

	ll ret = (dp[N-1][0] + dp[N-1][1]) % MOD;
	ret = ret * coef % MOD;
	cout << ret << endl;

	return 0;
} 

Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define dbg(x...) do{cout << "\033[32;1m" << #x << "->" ; err(x);} while(0)
void err(){cout << "\033[39;0m" << endl;}
template<template<typename...> class T,typename t,typename... A>
void err(T<t> a,A... x){for (auto v:a) cout << v << ' '; err(x...);}
template<typename T,typename... A>
void err(T a,A... x){cout << a << ' '; err(x...);}
#else
#define dbg(...)
#endif
typedef long long ll;
typedef pair<ll,ll> pi;
typedef vector<ll> vi;
template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;
template<class T> void mkuni(vector<T>&v)
{
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
}
template<class T>
void print(T x,int suc=1)
{
    cout<<x;
    if(suc==1) cout<<'\n';
    else cout<<' ';
}
template<class T>
void print(const vector<T>&v,int suc=1)
{
    for(int i=0;i<v.size();i++)
        print(v[i],i==(int)(v.size())-1?suc:2);
}
const int maxn=1e5+7;
ll dp[maxn][3];
int a[maxn];
string op[maxn];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		if(i!=n) cin>>op[i];
	}
	memset(dp,-0x3f,sizeof(dp));
	dp[1][0]=a[1];
	for(int i=2;i<=n;i++)
	{
		if(op[i-1][0]=='-')
		{
			for(int j=0;j<3;j++)
			{
				if(j&1)
					dp[i][j]=dp[i-1][j]+a[i];
				else dp[i][j]=dp[i-1][j]-a[i];
				if(j)
					dp[i][j]=max(dp[i][j],dp[i-1][j-1]+(j-1==1?1:-1)*a[i]);
			}
		}
		else{
			for(int j=0;j<3;j++)
			{
				if(j&1)
					dp[i][j]=dp[i-1][j]-a[i];
				else dp[i][j]=dp[i-1][j]+a[i];
				if(j)
					dp[i][j-1]=max(dp[i][j-1],dp[i-1][j]+(j==1?-1:1)*a[i]);
			}
		}
		//dbg(i,dp[i][0],dp[i][1],dp[i][2]);
	}
	cout<<max({dp[n][0],dp[n][1],dp[n][2]})<<endl;
}

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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
typedef vector<ll> vll;

#define PI (2*acos(0.0))
#define eps 1e-9
#define pb push_back
#define endl "\n"
#define watch(x) cout << (#x) << " is " << (x) << endl;
#define show(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi] << " "; cout << endl;
#define showpair(v) for(int fi = 0; fi < v.size(); fi++) cout << v[fi].first << " " << v[fi].second << endl;
#define ff first
#define ss second
#define fu cout << "lol" << endl;
#define precision(n) cout << fixed << setprecision(n);
#define lb lower_bound
#define up upper_bound
#define vscan for(i = 0;i<n;i++){cin>>in; v.pb(in);}
#define all(a) a.begin(), a.end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define mem(a,val) memset(a,val,sizeof(a))
#define loop(i,n) for(i = 0; i < n; i++)
#define TC ull T; cin>>T; while(T--)
#define IN(x) {scanf("%d",&x);}
#define LL(x) {scanf("%lld",&x);}
#define CC(x) {scanf("%c",&x);}
#define pfl(x) printf("%d\n",x)
#define pfll(x) printf("%lld\n",x)
#define newl puts("")
#define space printf(" ")
#define MOD 1000000007
#define speed ios_base::sync_with_stdio(false); cin.tie(NULL);


int main()
{
    int i = 0, j = 0, cs = 0, in;
    ll x, k, d; cin>>x>>k>>d;
    ll y = min(k, abs(x)/d);
    if(x >= 0){
        x -= y*d;
        if((k-y) & 1) x -= d;
    }
    else{
        x += y*d;
        if((k-y) & 1) x += d;
    }
    cout << abs(x) << endl;
    return 0;
}


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

typedef pair<int, int> P;
typedef vector<int> V;
const int MAX_SIZE = 50;
const int MAX_TASK_SIZE = 1000;

vector<P> dfs(char f[MAX_SIZE][MAX_SIZE], P src, P des, int R, int C) {
  vector<P> v;
  if (src == des) {
    v.push_back(des);
    return v;
  }
  f[src.first][src.second] = '@';
  int dr[] = {-1, 1, 0, 0};
  int dc[] = {0, 0, -1, 1};
  for (int k = 0; k < 4; ++k) {
    int i = src.first  + dr[k];
    int j = src.second + dc[k];
    if (i + 1 && j + 1 && i < R && j < C && f[i][j] == '.') {
      v = dfs(f, P(i, j), des, R, C);
      if (v.size()) {
        v.insert(v.begin(), src);
        break;
      }
    }
  }
  f[src.first][src.second] = '.';
  return v;
}

int calc(int R, int C, int M, char f[][MAX_SIZE], int costs[][MAX_SIZE][MAX_SIZE], P tasks[]) {
  map<P, V> m;
  int t = 0;
  m.insert(pair<P, V>(tasks[0], V(1, t++)));
  for (int i = 0; i < M - 1; ++i) {
    vector<P> v = dfs(f, tasks[i], tasks[i + 1], R, C);
    for (vector<P>::iterator vit = ++v.begin(); vit != v.end(); ++vit) {
      map<P, V>::iterator it = m.find(*vit);
      if (it == m.end()) {
        m.insert(pair<P, V>(*vit, V(1, t++)));
      } else {
        it->second.push_back(t++);
      }
    }
  }
  int a = 0;
  for (map<P, V>::iterator it = m.begin(); it != m.end(); ++it) {
    int i = it->first.first, j = it->first.second;
    V v = it->second;
    int l = v.size();
    for (int k = 0; k < l; ++k) {
      int c = costs[1][i][j] + costs[2][i][j];
      if (k < l - 1) {
        a += min(c, (v[k + 1] - v[k]) * costs[0][i][j]);
      } else {
        a += c;
      }
    }
  }
  return a;
}

int main() {
  int n;
  int R, C, M;
  char f[MAX_SIZE][MAX_SIZE];
  int costs[3][MAX_SIZE][MAX_SIZE];
  P tasks[MAX_TASK_SIZE];
  char s[MAX_SIZE + 1];
  cin >> R >> C >> M;
  for (int i = 0; i < R; ++i) {
    cin >> s;
    for (int j = 0; j < C; ++j) {
      f[i][j] = s[j];
    }
  }
  for (int k = 0; k < 3; ++k) {
    for (int i = 0; i < R; ++i) {
      for (int j = 0; j < C; ++j) {
        cin >> n;
        costs[k][i][j] = n;
      }
    }
  }
  for (int i = 0; i < M; ++i) {
    int r, c;
    cin >> r >> c;
    tasks[i] = P(r, c);
  }
  cout << calc(R, C, M, f, costs, tasks) << endl;
}

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

using ll = long long;

constexpr ll MOD = 1e9+7;
constexpr ll INF = 1ll<<60;

#define FOR(i,a,b) for (ll i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()

int main(int argc, char **argv)
{
	ll k; cin >> k;
	string s; cin >> s;

	if (s.size() <= k)
	{
		std::cout << s << std::endl;
	}
	else
		std::cout << s.substr(0, k) << "..." << std::endl;
}

Measured memory_bytes: 3596
#include <stdio.h>
int main(void)
{
      int W, H, x, y, r;
      scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);
      if(x-r>=0 && y-r>=0 && x+r<=W && y+r<=H)
         puts("Yes");
      else
         puts("No");
      return 0;
}


Measured memory_bytes: 2108
#include <iostream>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <bitset>
#include <queue>
#include <stack>
#include <deque>
#include <complex>
#include <iomanip>
#include <stdio.h>
#include <string.h>
#include <random>
#include <functional>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define int long long
const int N = 500000;
const long long MOD = 1e9 + 7;

int n, k;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> k;
    if (n >= 10)
    {
        cout << k;
    }
    else
    {
        cout << k + (10 - n) * 100;
    }
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES

#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>

using namespace std;

int label[6];

struct Dice
{
	void create()
	{
		for (int i = 0; i < 6; i++)
		{
			cin >> label[i];
		}
	}

	void roll(string s)
	{
		int buf[6];
		for (int i = 0; i < 6; i++)
		{
			buf[i] = label[i];
		}

		if (s == "E")
		{
			label[0] = buf[3];
			label[2] = buf[0];
			label[3] = buf[5];
			label[5] = buf[2];
		}
		else if (s == "N")
		{
			label[0] = buf[1];
			label[1] = buf[5];
			label[4] = buf[0];
			label[5] = buf[4];
		}
		else if (s == "S")
		{
			label[0] = buf[4];
			label[1] = buf[0];
			label[4] = buf[5];
			label[5] = buf[1];
		}
		else if (s == "W")
		{
			label[0] = buf[2];
			label[2] = buf[5];
			label[3] = buf[0];
			label[5] = buf[3];
		}
	}
};

int main()
{
	Dice dice;
	dice.create();

	int n;
	cin >> n;

	for (int i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;

		string ls[] = { "E", "N", "S", "W" };
		for (;;)
		{
			dice.roll(ls[rand()%4]);

			if (a == label[0] && b == label[1])
			{
				break;
			}
		}
		cout << label[2] << endl;
	}
}


Measured memory_bytes: 3148
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<queue>
#include<stack>
#include<cmath>	

using namespace std;

int main() {
	int N;
	int D;
	cin >> N >> D;
	int i = 2 * D + 1;
	if (N % i == 0) {
		cout << N / i << endl;
	}
	else {
		cout << N / i + 1 << endl;
	}
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef short int si;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

#define st first
#define nd second
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REV(a) reverse(a.begin(),a.end())
#define SORT(a) sort(a.begin(),a.end())
#define inf (int)1e9
#define linf (ll)1e18

ll x,y;

int main() {
		ios::sync_with_stdio(false);
		cin>>x>>y;
		ll ans=0;
		while(x<=y){
				ans++;
				x*=2;
		}
		cout<<ans<<endl;






		return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader
import kotlin.math.max

fun main() {
    val br = System.`in`.bufferedReader()
    val n = br.readInt()
    val a = LongArray(n) { br.readInt().toLong() }
    var curMoney = 1000L
    var curStocks = 0L
    var lastPrice = 200L
    var boughtPrice = 0L

    for (x in 0 until n) {
        val price = a[x]
        if (curStocks == 0L) {
            if (price > lastPrice) {
                curStocks = curMoney / lastPrice
                curMoney -= lastPrice * curStocks
                boughtPrice = lastPrice
            }
        } else if (price < lastPrice) {
            curMoney += curStocks * lastPrice
            curStocks = 0
        }
        lastPrice = price

    }
    if (curStocks != 0L) {
        curMoney += curStocks * max(boughtPrice, lastPrice)
    }
    print(curMoney)
}


private const val SPACE_INT = ' '.toInt()
private const val ZERO_INT = '0'.toInt()
private const val NL_INT = '\n'.toInt()

private fun BufferedReader.readInt(): Int {
    var ret = read()
    while (ret <= SPACE_INT) {
        ret = read()
    }
    val neg = ret == '-'.toInt()
    if (neg) {
        ret = read()
    }
    ret -= ZERO_INT
    var read = read()
    while (read >= ZERO_INT) {
        ret *= 10
        ret += read - ZERO_INT
        read = read()
    }

    while (read <= SPACE_INT && read != -1 && read != NL_INT) {
        mark(1)
        read = read()
    }
    if (read > SPACE_INT) {
        reset()
    }
    return if (neg) -ret else ret
}

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

const unsigned M = 2;

int main()
{
  unsigned N = 0;
  std::cin >> N;
  
  std::vector<std::vector<unsigned>> A(2);
  for (unsigned m = 0; m < M; ++m) {
    A[m] = std::vector<unsigned>(N);
    for (unsigned n = 0; n < N; ++n) {
      std::cin >> A[m][n];
    }
  }
  
  std::vector<unsigned> B(N + 1, 0), C(N + 1, 0);
  for (unsigned n = 0; n < N; ++n) {
    B[n + 1] = B[n] + A[0][n];
  }
  for (long n = N; n > 0; --n) {
    C[n - 1] = C[n] + A[1][n - 1];
  }
  
  unsigned max = 0;
  for (unsigned n = 0; n < N; ++n) {
    max = std::max(max, B[n + 1] + C[n]);
  }
  std::cout << max << std::endl;
  
  return 0;
}

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

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

const double PI = acos(-1);
const int inf = 2e9;
const ll INF = 2e18;
const ll MOD = 1e9+7;

#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
#define REP(i,n) for (int i = 0; i<n; i++)
#define ALL(a) begin(a), end(a)

int main (void) {
    int N;
    cin>>N;
    vector<int> V(N),C(N);
    REP(i,N) cin>>V[i];
    REP(i,N) cin>>C[i];
    int ans = 0;
    REP(i,N) {
        if (V[i]-C[i] > 0) ans += V[i] - C[i];
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
    char N[5];
    cin >> N;
    
    if (N[0] == N[1] && N[1] == N[2]) cout << "Yes\n";
    else if (N[1] == N[2] && N[2] == N[3])  cout << "Yes\n";
    else cout << "No\n";

    return 0;
}


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

using namespace std ;

#define int unsigned long long
#define Mod 1000000007

int n , mul[1000] ;
int ans , a[1000000] ;
int M[1000][3] ;

signed main()
{
    scanf("%llu" , &n ) ; mul[0] = 1 ;
    for(int i = 1 ; i <= 63 ; i++ ) mul[i] = mul[i - 1] * 2 % Mod ;
    for(int i = 1 ; i <= n ; i++ ) scanf("%llu" , &a[i] ) ;
    for(int i = n ; i >= 1 ; i-- ){
        for(int j = 0 ; j <= 61 ; j++ ){
            if( ( a[i] >> j ) & 1 ) ( ans += M[j][0] * mul[j] % Mod ) %= Mod ;
            else ( ans += M[j][1] * mul[j] % Mod ) %= Mod ;
            M[j][(a[i]>>j)&1]++ ;
        }
    }
    cout << ans % Mod <<endl ;
    return 0 ;
}

Measured memory_bytes: 4352
#include<iostream>
using namespace std;
 
int main()
{
	long a,b;
	int i,p=0;
	long num[200000] = { 0 };
	long nun[200000] = { 0 };
 
	cin >> a >> b;
 
	for (i = 0; i < a; i++) {
		cin >> num[i] >> nun[i];
	} 
	
	for (i = 0; i < a; i++) {
		if (num[i] * num[i] + nun[i] * nun[i] <= b*b) {
			p++;
		}
	}
    
	cout << p;
	
	return 0;
}

Measured memory_bytes: 6324
#include<iostream>
#include<string>
#include<vector>
#include <cmath>


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

using namespace std;

int main(){
    long long r,D,x;
    cin >> r >> D >> x;
    rep(i,10){
        x = r * x -D;
        cout << x << endl;
    }
}


Measured memory_bytes: 256
import itertools
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]

l = 0
c = 0
for v in itertools.permutations(xy): #順列をすべて列挙
    for i in range(len(v)-1):
        l += ((v[i][0] - v[i+1][0]) **2 + (v[i][1] - v[i+1][1])**2)**0.5 
    c += 1
print(l/c)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#define hhh cerr<<"hhh"<<endl
#define see(x) cerr<<(#x)<<'='<<(x)<<endl
using namespace std;
typedef long long ll;
typedef pair<int,int> pr;
inline int read() {int x=0,f=1;char c=getchar();while(c!='-'&&(c<'0'||c>'9'))c=getchar();if(c=='-')f=-1,c=getchar();while(c>='0'&&c<='9')x=x*10+c-'0',c=getchar();return f*x;}

const int maxn = 3e5+7;
const int inf = 0x3f3f3f3f;
const int mod = 1e9+7;



int main() {
    double L; cin>>L;
    printf("%.10f\n", pow(L/3,3));
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>

using namespace std;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define omajinai ios::sync_with_stdio(false);cin.tie(0)
#define rep(i,x) for(int i=0;i<(int)(x);++i)
#define rep1(i,x) for(int i=1;i<=(int)(x);++i)

using ll=long long;
using ld=long double;
using vi=vector<int>;
using vvi=vector<vi>;
using pii=pair<int, int>;
using vpii=vector<pii>;

template<class T,class U>ostream&operator<<(ostream&os,const pair<T,U>p){os<<"("<<p.fst<<", "<<p.scd<<")";return os;}
template<class T>ostream&operator<<(ostream&os,const vector<T>v){rep(i,v.size()){if(i)os<<", ";os<<v[i];}return os;}
template<typename T>T&max(T&a,T&b){if(a>=b)return a;return b;}
template<typename T>T&min(T&a,T&b){if(a < b)return a;return b;}
template<typename T>bool chmax(T&a,T b){if(a < b){a=b;return true;}return false;}
template<typename T>bool chmin(T&a,T b){if(a > b){a=b;return true;}return false;}

constexpr int inf = 1e9;
constexpr ll linf = 3e18;
constexpr double eps = 1e-9;
const int mod = 1e9 + 7;

int dp[105][105][256];
ll fact[105];

int main()
{
    fact[0] = 1;
    for (int i = 1; i <= 100; ++i) {
        fact[i] = i * fact[i - 1];
        fact[i] %= mod;
    }

    int n, k; cin >> n >> k;

    vi a(n);

    rep(i, n) cin >> a[i];

    dp[0][0][0] = 1;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j <= i; ++j) {
            for (int k = 0; k <= 255; ++k) {
                (dp[i + 1][j + 1][k ^ a[i]] += dp[i][j][k]) %= mod;
                (dp[i + 1][j][k] += dp[i][j][k]) %= mod;
            }
        }
    }

    int ans = 0;

    rep(i, n + 1) {
        ans += (dp[n][i][k] * fact[i]) % mod;
        ans %= mod;
    }

    cout << ans << endl;
}


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

using namespace std;

int main() {
    int H, W;
    cin >> H >> W;
    int N;
    cin >> N;
    vector<int> col(N+1, 0);
    for(int n=1; n<=N; n++) {
        cin >> col[n];
    }
    vector<vector<int> > vec(H, vector<int>(W, 0));
    int curh=0, curw=0, cnt=0, curcol=1, dir=0;
    int dh[4]={0, 1, 0, -1};
    int dw[4]={1, 0, -1, 0};
    for(int i=0; i<H*W; i++) {
        if(cnt<col[curcol]) {
            vec[curh][curw]=curcol;
            cnt++;
        } else {
            cnt=1;
            curcol++;
            vec[curh][curw]=curcol;
        }
        if(dh[dir]+curh<0 || dh[dir]+curh>=H || dw[dir]+curw<0 || dw[dir]+curw>=W) {
            dir++;
            dir %= 4;
        }
        if(dh[dir]+curh<0 || dh[dir]+curh>=H || dw[dir]+curw<0 || dw[dir]+curw>=W) {
            break;
        }
        if(vec[dh[dir]+curh][dw[dir]+curw]!=0) {
            dir++;
            dir %= 4;
        }
        if(dh[dir]+curh<0 || dh[dir]+curh>=H || dw[dir]+curw<0 || dw[dir]+curw>=W) {
            break;
        }
        curh += dh[dir];
        curw += dw[dir];
    }
    for(int h=0; h<H; h++) {
        for(int w=0; w<W; w++) {
            cout << vec[h][w] << " ";
        }
        cout << endl;
    }
    

    return 0;
    
}

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

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main()
{
	COMinit();
	ll n,k;
	cin >> n >> k;
	ll ans = 1;
	for(int i = 1;i<min(n,k+1);i++)
	{
		ll now = COM(n,i)*COM(n-1,i);
		now %= MOD;
		ans = (ans + now) %MOD;
	}
	cout << ans << endl;
}


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

typedef long long ll;

ll a[105];
int dp[100005];

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n, k;
	cin >> n >> k;
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	sort(a, a + n);
	dp[0] = 0;
	for(int i = 1; i <= k; i++){
		int flag = 0;
		for(int j = 0; j < n; j++){
			if(i < a[j]) break;
			if(dp[i - a[j]] == 0) flag = 1;	
		}
		dp[i] = flag;
	}
	if(dp[k] == 0) cout << "Second\n";
	else cout << "First\n";
	return 0;
}

Measured memory_bytes: 640
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
=begin
Volume0-0021

Parallelism
=end
require 'bigdecimal'

def para?(x1,y1,x2,y2,x3,y3,x4,y4)
  if x1==x2 and x3==x4 then
    return true
  elsif x1==x2 or x3==x4 then
    return false
  else
    return (y2-y1)/(x2-x1) == (y4-y3)/(x4-x3)
  end
end

n=STDIN.gets.to_i
0.upto(n-1){|i|
  x1,y1,x2,y2,x3,y3,x4,y4 = STDIN.gets.chomp.split.map{|x| BigDecimal.new(x)}
  puts para?(x1,y1,x2,y2,x3,y3,x4,y4) ? "YES" : "NO"
}

Measured memory_bytes: 8792
#include<stdio.h>

int main(void)
{
  int A, B, C, D, i;
  
  scanf("%d%d%d%d",&A,&B,&C,&D);
  for(i=0; i<=100; i++){
    C=C-B;
    if(C<=0)break;
    A=A-D;
    if(A<=0)break;
  }
  if(A>C) printf("Yes\n");
  else    printf("No\n");
  
  return 0;
}

Measured memory_bytes: 1620
#include<bits/stdc++.h>
using namespace std;
///Welcome to Nasif's Code
#define bug printf("bug\n");
#define bug2(var) cout<<#var<<" "<<var<<endl;
#define co(q) cout<<q<<endl;
#define all(q) (q).begin(),(q).end()
typedef long long int ll;
typedef unsigned long long int ull;
const int MOD = (int)1e9+7;
const int MAX = 1e6;
#define pi acos(-1)
#define inf 1000000000000000LL
#define FastRead    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll n,dp[MAX][2],m;
ll mark[MAX];
ll recur(int pos,int last)
{
   // cout<<pos<<" "<<last<<endl;
    if(mark[pos] || pos>n)
        return 0;

    if(pos==n)
        return 1;
    ll &ret=dp[pos][last];
    if(~ret)
        return ret;
    ret=0;
    ret+=recur(pos+1,1);
    ret%=MOD;
    ret+=recur(pos+2,2);
    ret%=MOD;
    return ret;
}
int main()
{
    FastRead
    //freopen("output.txt", "w", stdout);
    cin>>n>>m;
    for(int i=0; i<m; i++)
    {
        int a;
        cin>>a;
        mark[a]=1;
    }
    memset(dp,-1,sizeof(dp));
    cout<<recur(0,0)<<endl;

    return 0;
}


Measured memory_bytes: 24460
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n; i++) cin >> a[i];

  int s = 0;
  for (int i = 0; i < n; i++) s += a[i];
  sort(a.begin(), a.end(), greater<int>());

  if (s > a[m-1] * m * 4) cout << "No" << endl;
  else cout << "Yes" << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define c1 s[i]
#define c2 s[i + d]
#define c3 s[i + d + d]
using ll = long long;
using namespace std;
int main() {
	int n; cin >> n;
	string s; cin >> s;
	int a[3] = {};
	for (char c : s) {
		if (c == 'R') ++a[0];
		else if (c == 'G') ++a[1];
		else ++a[2];
	}
	ll ans = 1LL * a[0] * a[1] * a[2];
	for (int i = 0; i < n - 2; i++) {
		for (int d = 1; i + d + d < n; d++) {
			if (c1 != c2 and c1 != c3 and c2 != c3)
				--ans;
		}
	}
	cout << ans;
}

Measured memory_bytes: 3608
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()

n = ni()
_anum = 0
b_num = 0
banum = 0
ct = 0
for i in range(n):
    st = input()
    ct += st.count('AB')
    if st.startswith('B'):
        if st.endswith('A'):
            banum += 1
        else:
            b_num += 1
    else:
        if st.endswith("A"):
            _anum += 1
if banum > 0:
    if _anum > 0 and b_num > 0:
        print(ct + min(_anum - 1, b_num - 1) + (banum + 1))
    elif _anum == 0 and b_num == 0:
        print(ct + banum - 1)
    else:
        print(ct + banum)
else:
    print(ct + min(_anum, b_num))



Measured memory_bytes: 3064
#include <algorithm>
#include <boost/multiprecision/cpp_int.hpp>
#include <cmath>
#include <deque>
#include <iostream>
#include <queue>
#include <string>
#include <vector>

using namespace std;
using ll = long long;
namespace mp = boost::multiprecision;
using mpint = mp::cpp_int;  // 多倍長整数（任意精度）





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

  cout << a * b << endl;

  return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>


int main(void){


int a,b,c,n,x;


n=0;


x=0;


scanf("%d %d %d",&a,&b,&c);


if(a>=1&&a<=10000&&b>=1&&b<=10000&&c>=1&&c<=10000){


for(a;a<=b;a++){


if(c%a==0){


x=x+1;


}


}


}


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


return 0;


}

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

int x, y;
string board[110];
bool goodx[110], goody[110];

int main(){
  cin >> x >> y;
  for(int i = 0; i < x; i++){
    cin >> board[i];
  }
  for(int i = 0; i < x; i++){
    for(int j = 0; j < y; j++){
      if(board[i][j] == '#'){
        goodx[i] = true;
        goody[j] = true;
      } 
    }
  }
  for(int i = 0; i < x; i++){
    if(goodx[i]){
      for(int j = 0; j < y; j++){
        if(goody[j]){
          cout << board[i][j];
        }
      }
      cout << endl;
    }
  }
  return 0;
}

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


int main() {
  string N;
  cin >> N;
  
  int c = N[N.size() - 1] - '0';
  if (c == 3) {
    cout << "bon" << endl;
  } else if (c == 0 || c == 1 || c == 6 || c == 8){
    cout << "pon" << endl;
  } else {
    cout << "hon" << endl;
  }
  return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef pair<pii,pii> P;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(ll i=m;i<n;i++)
#define rrep(i,n,m) for(ll i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
#define umh unordered_map<ll,ll,custom_hash>
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll lcm(ll a,ll b){
    ll c=gcd(a,b);
    return a*b/c;
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
    now%=md;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll n,k;cin>>n>>k;
    ll sum=beki(k,n,mod);
    ll ans=0;
    
    rep(i,2,k+1){
        ll cnt=beki(k/i,n,mod);
        ll used[k/i+1];
        fill(used,used+k/i+1,1);
        rep(j,2,k/i+1){
            ll ka=-used[j];
            (cnt+=ka*beki(k/(i*j),n,mod)+mod)%=mod;
            for(ll l=j;l<=k/i;l+=j)used[l]+=ka;
        }
        //cout<<cnt<<endl;
        (sum+=-cnt+mod)%=mod;
        (ans+=cnt*i)%=mod;
    }
    (ans+=sum)%=mod;
    cout<<ans<<endl;
}


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

int main(){

    
    int n;
    cin >> n;

    for(int i = 1; i <= 9; ++i){
        for(int j = i; j <= 9; ++j){
            if(j*i == n){
            cout << "Yes" << endl;
            return 0;
            }
        }
    }

    cout << "No" << endl;

}

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

int main()
{
    int n, k;
    cin >> n >> k;
    vector<int> l(n);
    rep(i, n) cin >> l[i];
    sort(l.begin(), l.end());
    reverse(l.begin(), l.end());
    int num = 0;
    rep(i, k) num += l[i];
    cout << num << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef pair<int,int> P;
const int    INF=(int)1e9;
const int    MOD=(int)1e9+7;
const double EPS=(double)1e-10;
struct Accelerate_Cin{
    Accelerate_Cin(){
        cin.tie(0); ios::sync_with_stdio(0);cout<<fixed<<setprecision(20);
    };
};

int  N,K;
int  board[2010][2010];

signed main(){
  cin>>N>>K;

  int sum=0,white=0;
  for(int t=1;t<=N;t++){
    int x,y;char c;cin>>x>>y>>c;
    x%=2*K,y%=2*K;
    if(c=='B') board[x+1][y+1]++,sum++;
    if(c=='W') board[x+1][y+1]--,sum--,white++;
  }

  for(int i=1;i<=2*K;i++){
    for(int j=1;j<=2*K;j++){
      board[i][j]+=board[i][j-1];
    }
  }

  for(int j=1;j<=2*K;j++){
    for(int i=1;i<=2*K;i++){
      board[i][j]+=board[i-1][j];
    }
  }

  int mx=-INF;
  for(int i=0;i<=K;i++){
    for(int j=0;j<=K;j++){
      int a,b,c,d,e;
      a=board[i][j];
      b=board[i+K][j+K]-board[i+K][j]-board[i][j+K]+board[i][j];
      c=board[i][2*K]-board[i][j+K];
      d=board[2*K][j]-board[i+K][j];
      e=board[2*K][2*K]-board[2*K][j+K]-board[i+K][2*K]+board[i+K][j+K];
      int temp=a+b+c+d+e;
      mx=max(mx,max(temp,sum-temp));
    }
  }
  mx+=white;
  cout<<mx<<"\n";
  return 0;
}


Measured memory_bytes: 16000
#include <iostream>
#include <stdio.h>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <iomanip>

#define ll long long
#define ld long double
#define ull unsigned long long
#define endl "\n"
#define MohamedMotaz ios::sync_with_stdio(0); cin.tie(0); ios_base::sync_with_stdio(0);
#define f(a, b, c) for(int a = b; a < c; a++)
using namespace std;


//ll fact[1000001]; ll inv[1000001];
//ll primes[100007];
//ll arr[1000007];
//ll modPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//
//	ll halfpow = modPower(b, p / 2);
//	ll toReturn = (halfpow * halfpow) % mod;
//	if (p % 2)
//		toReturn = (toReturn * b) % mod;
//
//	return toReturn;
//}
//
//ll fastPower(ll b, ll p) {
//	if (p == 0)
//		return 1;
//	ll ans = fastPower(b, p / 2);
//	ans = (ans * ans);
//	if (p % 2 != 0)
//		ans = (ans * b);
//	return ans;
//}
//ll GcdRecursive(ll a, ll b) {
//	if (b == 0) return a;
//	return GcdRecursive(b, a % b);
//}
//ll modLCM(ll a, ll b) {
//	ll val = GcdRecursive(a, b);
//	ll tmp = ((a % mod) * (b % mod)) % mod;
//	ll finalVal = ((tmp % mod) * (arr[val] % mod)) % mod;
//	return finalVal;
//
//}
//ll LCM(ll a, ll b) {
//	return (a * b) / GcdRecursive(a, b);
//}
//void move1step(ll& a, ll& b, ll q) { // a and b by reference
//	ll c = a - q * b;
//	a = b;
//	b = c;
//}
//ll GcdIterative(ll a, ll b) {
//	while (b) move1step(a, b, a / b);
//	return a;
//}
//
//void pre(ll n) {
//
//	fact[0] = 1;
//	inv[0] = 1;
//
//	for (ll i = 1; i <= n; i++) {
//		fact[i] = (i * fact[i - 1]) % mod;
//		inv[i] = modPower(fact[i], mod - 2);
//		arr[i] = modPower(i, mod - 2);
//	}
//}
//
//ll npr(ll n, ll r) {
//	return ((fact[n] * inv[n - r]) % mod);
//}
//
//ll ncr(ll n, ll r) {
//	return ((((fact[n] * inv[n - r]) % mod) * inv[r]) % mod);
//}
//
//void sieve(ll val) {
//	memset(primes, 1, sizeof primes);
//	primes[0] = primes[1] = false;
//	for (int i = 2; i <= val; i++) {
//		if (primes[i]) {
//			for (int j = i * i; j <= val; j += i) {
//				primes[j] = 0;
//			}
//		}
//	}
//
//}

const ll mod = 1e9 + 7;
const ll N = 1e5 + 7;
const ll INF = 1e9 + 5;

ll n, a ,b , c;



int main()
{
    MohamedMotaz;
    cin >> n;
    ll dp[n][3];// = {};
    f(i,0,n){
        cin >> a >> b >> c;
        if (i == 0){
            dp[0][0] = a, dp[0][1] = b, dp[0][2] = c;
            continue;
        }
        dp[i][0] = a + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b + max(dp[i - 1][2], dp[i - 1][0]);
        dp[i][2] = c + max(dp[i - 1][1], dp[i - 1][0]);
    }
    cout << max({dp[n-1][0], dp[n - 1][1], dp[n - 1][2]});
}



Measured memory_bytes: 2560
fn main() {
    let mut s = String::new();
    let mut t = String::new();

    std::io::stdin().read_line(&mut s).unwrap();
    std::io::stdin().read_line(&mut t).unwrap();

    let mut result = 0;

    for i in 0..s.len() {
        if s.as_bytes()[i] != t.as_bytes()[i] {
            result = result + 1;
        }
    }
    println!("{}", result);
}


Measured memory_bytes: 2560
import heapq
n , m = map(int, input().split())
ab=[[] for i in range(10**5)]

for i in range(n):
    a , b = map(int, input().split())
    ab[a-1].append(b*(-1))

que=[]
ans = 0
for i in range(m):
    for b in ab[i]:
        heapq.heappush(que,b)
    if que:
        ans+=heapq.heappop(que)
print(ans*(-1))


Measured memory_bytes: 22244
import sys
from collections import defaultdict
from heapq import heappop, heappush
n = int(sys.stdin.readline().split()[0])
A = defaultdict(list)
ans = []
for query in sys.stdin:
    if query[0] == '0':
        t, x = query[2:].split()
        heappush(A[t], -int(x))
    elif query[0] == '1':
        if A[query[2:-1]]:
            ans.append(f'{-A[query[2:-1]][0]}' + '\n')
    else:
        if A[query[2:-1]]:
            heappop(A[query[2:-1]])
sys.stdout.writelines(ans)


Measured memory_bytes: 16104
# 2019/08/12

s=input()
if s=='zyxwvutsrqponmlkjihgfedcba':
    print(-1)
    exit()

st=set(s)

if len(s)<26:
    for i in range(97,97+26+1):
        if chr(i) in st:continue
        print(s+chr(i))
        exit()

s=list(s)
res=[s.pop()]

def solve(s):
    for _ in range(len(s)):
        tmp=s.pop()
        if tmp>res[-1]:
            res.append(tmp)
            res.sort()
        else:            
            for e in res:
                if e<tmp:continue
                s.append(e)
                return s

print(''.join(solve(s)))

Measured memory_bytes: 3064