akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>

using namespace std;
typedef long long ll;

int main(){
    int d,g;
    cin>>d>>g;
    g/=100;
    vector<int> p(d),c(d);
    
    for(int i=0;i<d;i++){
        cin>>p[i]>>c[i];
        c[i]/=100;
    }
    int ans=1000000000;
    for(int bit=0;bit<(1<<d);bit++){
        vector<int> allsolve(d);
        int points=0;
        int solvednum=0;
        for(int i=0;i<d;i++){
            if(bit&(1<<i)){
                points+=c[i]+(i+1)*p[i];
                allsolve[i]++;
                solvednum+=p[i];
            }
        }
        if(points>=g){
            ans=min(ans,solvednum);
            continue;
        }
        for(int i=d-1;i>=0;i--){
            if(allsolve[i]>0){
                continue;
            }
            for(int j=0;j<p[i];j++){
                points+=i+1;
                solvednum++;
                if(points>=g){
                    ans=min(ans,solvednum); 
                }
            }            
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3608
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	cin>>s;
	int c=1,k=0;
	for(int i=0;i<2;i++){
		if(s[i]=='R'&&s[i+1]=='R'){
			c++;
		}
		if(s[i]=='S'){
			k++;
		}
	}
	if(s[2]=='S'){
		k++;
	}
	if(k!=3){
		cout<<c;
	}
	else{
		cout<<"0";
	}
	return 0;
	
	
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

int gcd(int a, int b){
    if (b == 0) {
        return a;
    }
    return gcd(b, a%b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}


void solve(){
    ll N, C, K;
    cin >> N >> C >> K;

    vector<ll> T(N);
    for (int i = 0; i < N; i++) {
        cin >> T[i];
    }

    sort(all(T));

    ll ans = 1;
    ll ninzu = 0;
    ll starttime = T[0];
    for (int i = 0; i < N; i++) {
        if (starttime <= T[i] && T[i] <= starttime + K && ninzu < C) {
            ninzu++;
        } else {
            ans++;
            ninzu = 1;
            starttime = T[i];
        }
    }

    cout << ans << endl;


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 1024
//競技プログラミング用のテンプレート
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <stack>

#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repr(i, n) for(int i = n - 1; i >= 0; i--)

using namespace std;
using ll = long long int;
using p = pair<int, int>;
using pl = pair<ll, ll>;
using v = vector<int>;
using vd = vector<double>;
using vs = vector<string>;
using vl = vector<ll>;

int main()
{
  string ns;
  int k;
  cin >> ns >> k;
  int d = ns.size(); 
  vector<vl> dp0(d, vector<ll>(k + 1, 0)); //ピッタリ
  vector<vl> dp1(d, vector<ll>(k + 1, 0)); //未満
  //0桁目
  dp0[0][1] = 1;
  dp1[0][1] = ns[0] - '0' - 1;
  for(int i = 0; i < d - 1; i++)
  { 
    //exact -> exact
    for(int j = 1; j < k + 1; j++)
    {
      if(ns[i + 1] == '0') dp0[i + 1][j] = dp0[i][j];
      if(ns[i + 1] != '0') dp0[i + 1][j] = dp0[i][j - 1];
    }
    //exact -> small
    for(int j = 1; j < k + 1; j++)
    {
      if(dp0[i][j] == 1)
      {
        //i桁目まででj個1以外の数がある
        if(j < k && ns[i + 1] != '0') dp1[i + 1][j + 1] =  dp0[i][j] * (ns[i + 1] - '0' - 1);
        if(ns[i + 1] != '0') dp1[i + 1][j] = dp0[i][j];
      }
    }
    //small -> small
    dp1[i][0] = 1;
    for(int j = 1; j < k + 1; j++)
    {
      dp1[i + 1][j] += dp1[i][j - 1] * 9 + dp1[i][j];
    }
  }  
  cout << dp0[d - 1][k] + dp1[d - 1][k] << endl;
}


Measured memory_bytes: 256
#include"bits/stdc++.h"
#define INFLL        1e18
#define REP(i,n)     for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)    for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)    for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)   for(ll i=(n);i>0;--i)
#define REPC(i,obj)  for(auto i:obj)
#define ALL(obj)     (obj).begin(),(obj).end()
#define SETP(n)      cout<<fixed<<setprecision(n)
#define DELNL        cin.ignore(numeric_limits<streamsize>::max(),'\n')
#define VV(T,h,w)    vector<vector<T>>(h,vector<T>(w))
#define VVI(T,h,w,i) vector<vector<T>>(h,vector<T>(w,i))
using namespace std;
using ll=long long;
using ull=unsigned long long;
template<typename T>using pqg=priority_queue<T,vector<T>,greater<T>>;
template<typename T=ll>inline T in(){T ret;cin>>ret;return ret;}

ll gcd(ll x,ll y)
{
    return y==0?x:gcd(y,x%y);
}
ll lcm(ll x,ll y)
{
    return x/gcd(x,y)*y;
}
int main()
{
    ll n=in();
    ll ans=1;REP(i,n)ans=lcm(ans,in());
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdio>

using namespace std;

int main()
{
	int num, len, ans;
	string sent;

	while(cin >> num)
	{
		if(!num) break;
		ans = 0;
		cin >> len >> sent;

		string comp = "I";
		for(int i = 0; i < num; i++)
		{
			comp += "OI";
		}

		for(int i = 0; i < len; i++)
		{
			if(comp == sent.substr( i, comp.size() ) )
				{
					++ans;
				}
		}
		cout << ans << endl;
	}
}

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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair

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

int main(){
    string s;
    cin>>s;
    int n=(int)s.size();
    ll ans=0;
    for(int mask=0;mask<(1<<(n-1));mask++){
        ll sum=0;
        for(int i=0;i<n;i++){
            sum*=10;
            sum+=s[i]-'0';
            if(mask & (1<<i)){
                ans+=sum;
                sum=0;
            }
        }
        ans+=sum;
    }
    
    cout<<ans<<endl;
    return 0;
}

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

int main() {
    int n, cnt = 0;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
    }


    while (1)
    {
        rep(i,n) {
            if (a[i] % 2 != 0)
            {
                cout << cnt << endl;
                return 0;
            }
            a[i] /= 2;
        }
        cnt++;
    }
    
    cout << cnt << endl;
    return 0;
}

Measured memory_bytes: 256
from collections import deque
H,W = map(int,input().split())
S = [input() for i in range(H)]
ans = 0
flag = [[0]*W for i in range(H)]
for i in range(H*W):
    x,y = i%W,i//W
    if flag[y][x] == 1:
        continue
    flag[y][x] = 1
    bw = [0,0]
    bw[[".","#"].index(S[y][x])]+=1
    queue = deque([[x,y]])
    while queue:
        x,y = queue.popleft()
        for a,b in [[-1,0],[1,0],[0,1],[0,-1]]:
            if 0<=x+a<W and 0<=y+b<H and flag[y+b][x+a] == 0 and S[y][x] != S[y+b][x+a]:
                queue.append([x+a,y+b])
                flag[y+b][x+a] = 1
                bw[[".","#"].index(S[y+b][x+a])]+=1
    ans += bw[0]*bw[1]
print(ans)
                


             


Measured memory_bytes: 4852
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()

DEF_MIN = max(h)-min(h)

for i in range(n-k+1):
    tmp = h[i+k-1]-h[i]
    DEF_MIN = min(DEF_MIN, tmp)

print(DEF_MIN)

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

int main() {
    int N, K;
    cin >> N >> K;
    ll ans = 1e13;
    vector<ll> x(N);
    vector<ll> dist(N);
    for(int i = 0; i < N; ++i) {
        cin >> x[i];
        dist[i] = x[i] - x[0];
        if(i >= K - 1) {
            ll d = dist[i] - dist[i - K + 1] + min(abs(x[i]), abs(x[i - K + 1]));
            ans = min(ans, d);
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <fstream>
#include <set>
#include <stack>
#include <queue>
#include <list>
using namespace std;
typedef long long int64;
typedef vector<int> vec;
typedef vector<int64> vec64;
#define db(x) cout << "> " << #x << ": " << x << "\n";
#define ss cout << " ";
#define ct(x) cout << x;
#define nn cout << "\n";
#define cts(x) cout << x << " ";
#define ctn(x) cout << x << "\n";
#define qr queries();
void solve();
void YN(bool b){if (b){ctn("YES");}else{ctn ("NO");}};
void yn(bool b){if (b){ctn("Yes");}else{ctn ("No");}};
void queries(){int n;cin >> n;while (n--)solve();}
// // // // // // // // // // // // // // // // // // // // // // 
/*                  TEMPLATE - VANILLA                         */
// // // // // // // // // // // // // // // // // // // // // //
int64 q, n;

void solve(){

    return;
}


int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    string s1, s2;
    cin >> s1 >> s2;
    int rs = 0;
    for (int i = 0; i < 3; i++){
        if (s1[i] == s2[i]){
            rs++;
        }
    }
    ctn(rs);
    return 0;
}


Measured memory_bytes: 3164
#include <string>
#include <queue>
#include <stack>
#include <vector>
#include <sstream>
#include <algorithm>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <list>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <climits>
#include <bitset>
#include <functional>
#include <numeric>
#include <ctime>
#include <cassert>
#include <cstring>
#include <fstream>

using namespace std;

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstring>
#include <math.h>
#include <numeric>
#include <queue>
#define rep(i,s,n) for (int i=s;i<n;++i)
#define drep(i,s,n) for (int i=n;i>=s;--i)
#define all(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(),(a).rend()
#define print(x) cout<<(x)<<endl
using namespace std;
typedef long long ll;

int gcd(int a,int b)
{if (a%b == 0) return(b);
 else          return(gcd(b,a%b));}
int lcm(int a,int b)
{return a*b/gcd(a,b);}
void printv(vector<auto> v) {cout<<'[';rep(i,0,v.size()){cout<<v[i]<<',';}cout<<']'<<endl;}
void printvv(vector<vector<auto>> vv)
{
  cout<<'['<<endl;
  rep(q,0,vv.size()){cout<<'[';rep(p,0,vv.at(q).size())cout<<vv.at(q).at(p)<<',';cout <<']'<<endl;}
  cout<<']'<<endl;
}
void solve(); int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}
int step_x[] = {-1,0,0,1};
int step_y[] = {0,-1,1,0};
//------------------------------------------------------------
int n,m,ans=0;
int g[10][10];

void solve() {
  cin>>n>>m;

  rep(i,0,m)
  {
    int a,b;
    cin>>a>>b;
    g[a][b]=g[b][a]=1;
  }

  vector<int> x;

  rep(i,2,n+1) x.push_back(i);

  do
  {
    int flag=1;
    rep(i,0,x.size())
    {
      int y=(i==0?1:x[i-1]);
      if(!g[y][x[i]]) flag=0;
    }
    if(flag) ans++;
  }while(next_permutation(all(x)));
  print(ans);

  return;
}


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

namespace WA048B
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var line = Console.ReadLine();
            var a = line.Split(' ').Select(s => int.Parse(s)).ToArray();

            var list = new List<int>();

            list.AddRange(a);

            list.Sort((b, c) => c - b);

            var A = 0; var B = 0;
            for(var i = 0; i < N; i++)
            {
                if(i % 2 == 0)
                {
                    A += list[i];
                }
                else
                {
                    B += list[i];
                }
            }
            Console.WriteLine($"{A - B}");
        }
    }
}


Measured memory_bytes: 13396
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

long calc(int[] a, int[][] bc) {
    a.sort();
    bc.sort!"a[1] > b[1]";

    long ans = 0;
    int p = 0;
    foreach (x; bc) {
        int b = x[0], c = x[1];
        if (p >= a.length) break;

        for (int i = 0; i < b; i++) {
            if (p >= a.length) break;
            if (a[p] >= c) break; // 書き換えると値が小さくなる

            // a[p + i] を c に置き換える
            ans += c;
            p++;
        }
    }

    for (int i = p; i < a.length; i++) {
        ans += a[i];
    }
    return ans;
}

void main() {
    int n, m; scan(n, m);
    auto a = readints;
    int[][] bc;
    for (int i = 0; i < m; i++) bc ~= readints;

    writeln(calc(a, bc));
}


Measured memory_bytes: 20304
#include <bits/stdc++.h>
using namespace std;
#define ll                      long long
#define pb                      push_back
#define rep(i,a,b,c)            for(ll i=(a);i<=(b);i+=(c))
#define repb(i,a,b,c)           for(ll i=(a);i>=(b);i-=(c))
#define MOD                     1000000007
#define inf                     3e18
#define ld                      long double
#define mp                      make_pair
#define vpll                    vector<pair<ll,ll> >
#define vll                     vector<ll>
#define vld                     vector<ld>
#define vvll                    vector<vector<ll>>
#define vvld                    vector<vector<ld>>
#define pll                     pair<ll,ll>
#define vvpll                   vector<vector<pair<ll,ll>>>
#define pqll                    priority_queue<ll>
#define mll                     map<ll,ll>
#define mlc                     map<ll,char>
#define um                      unordered_map
#define umll                    um<ll,ll>
#define umlc                    um<ll,char>
#define all(x)                  x.begin(),x.end()
#define fi                      first
#define se                      second
#define ln                      cout<<"\n";
#define endl                    "\n"
#define test                    ll T;cin>>T;while(T--)
#define isvowel(a)              (a == 'a' || a == 'e' || a == 'i' || a == 'o' || a == 'u')
#define fastIO                  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define show(w,size)            for(ll i=0;i<size;i++) cout<<w[i]<<" ";
#define prll(a)                 cout<<a<<"\n";
#define mset(dp,no)             memset(dp,no,sizeof(dp))
#define input(a,n)              rep(i,0,n-1,1) cin>>a[i];
#define countbit                __builtin_popcount                                           //Number of setbits in decimal notation
#define lb(v,cur)               lower_bound(all(v),cur)-v.begin()
#define ub(v,cur)               upper_bound(all(v),cur)-v.begin()
#define db(...)                 __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cerr << name << " : " << arg1 <<'\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cout.write(names, comma - names) << " : " << arg1 << " | "; __f(comma + 1, args...);
}
ll pows(ll b,ll e){if(e==0)return 1;else if(e%2==0){ll a=pow(b,e/2);return a*a;}else {ll a=pow(b,e/2);return b*a*a;}}
ll powm(ll x,ll y,ll m){x=x%m;ll res=1;while(y){if(y&1)res=res*x;res%=m;y=y>>1;x=x*x;x%=m;}return res;}
ll modInverse(ll a, ll m=MOD){if(m == 1)return 0;ll m0=m,y=0,x=1;while(a>1){ll q=a/m,t=m;m=a%m,a=t;t=y;y=x-q*y;x=t;}if(x<0) x+=m0;return x;}
int main()
{
fastIO
ll n,m,i,j,k,x,y,z,e,f,p,q,r,l,g,h,w,count1=0,prod=1,a,b,c,d,index,x1,x2,diff,ans=0,sum=0,sum1=0,sum2=0,flag=0,flag1=0,flag2=0;
string s,s1,s2;
ll ar[]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
cin>>k;
k--;
cout<<ar[k];
}


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

using namespace std;


 
int main() {
    int n, sum;
    sum = 0;


    cin >> n;
    vector<int> x(n);
    for (int i = 0; i < n; i++){
        cin >> x.at(i);
    }
    sort(x.begin(), x.end());
    vector<int> s;
    for ( int p = x[0]; p <= x[n-1]; p++){
        for ( int i : x){
            sum += (i - p) * (i - p);
            
            
        }
        s.push_back(sum);
        sum = 0;
    }
    sort(s.begin(), s.end());

    cout << s[0] << endl;
    
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define WHOLE(v) (v).begin(), (v).end()
using i64 = int64_t;
using namespace std;
int main() {
    string S, T;
    cin >> S >> T;
    int N = S.size();
    map<char, char> m;
    for (int j = 0; j < 2; j++) {
        for (int i = 0; i < N; i++) {
            if (!m.count(S[i])) {
                m[S[i]] = T[i];
            } else {
                if (m[S[i]] != T[i]) {
                    cout << "No" << endl;
                    return 0;
                }
            }
        }
        swap(S, T);
        m.clear();
    }
    cout << "Yes" << endl;
    return 0;
}

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

int main() {
  int D; cin >> D;

  vector<int> C(26);
  for (int i = 0; i < 26; i++) cin >> C.at(i);

  vector<vector<int>> S(D, vector<int>(26));
  for (int i = 0; i < D; i++) {
    for (int j = 0; j < 26; j++) cin >> S.at(i).at(j);
  }

  vector<int> L(26);

  for (int d = 0; d < D; d++) {
    int type = 0;
    long long score = 0;

    // d 日目に i を開くとしたとき
    for (int i = 0; i < 26; i++) {
      long long tmp = 0;
      tmp += S.at(d).at(i);
      for (int j = 0; j < 26; j++) {
        if (j == i) continue;
        tmp -= C.at(j) * (d+1 - L.at(i));
      }
      if (tmp > score) {
        score = tmp;
        type = i;
      }
    }

    L.at(type) = d+1;

    cout << type + 1 << endl;
  }
}


Measured memory_bytes: 3680
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int idx = 0;
        for(int i=0;i<5;i++){
            if(sc.nextInt()==0)
                idx = i;
        }
        System.out.println(++idx);
    }

}


Measured memory_bytes: 35740
#include <cstdio>
using namespace std;

const int maxn=2e3+5,pps=1e9+7;

int n,k,ans;
int f[maxn],fac[maxn*maxn],inv[maxn*maxn];

int read() {
	int x=0,f=1;char ch=getchar();
	for(;ch<'0'||ch>'9';ch=getchar())if(ch=='-')f=-1;
	for(;ch>='0'&&ch<='9';ch=getchar())x=x*10+ch-'0';
	return x*f;
}

int quick(int a,int b) {
	int sum=1;
	while(b) {
		if(b&1)sum=1ll*sum*a%pps;
		a=1ll*a*a%pps;b>>=1;
	}
	return sum;
}

void prepare(int N) {
	fac[0]=inv[0]=1;
	for(int i=1;i<=N;i++)
		fac[i]=1ll*fac[i-1]*i%pps;
	inv[N]=quick(fac[N],pps-2);
	for(int i=N-1;i;i--)
		inv[i]=1ll*inv[i+1]*(i+1)%pps;
}

int C(int a,int b) {
	return 1ll*fac[a]*inv[b]%pps*inv[a-b]%pps;
}

int main() {
	n=read(),k=read()-1;
	if(!k) {puts("1");return 0;}
	prepare(n*k+n);f[0]=1;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=i;j++)
			f[j]=(f[j]+1ll*C(n*k+n-i-(j-1)*k-1,k-1)*f[j-1]%pps)%pps;
	ans=1ll*f[n]*fac[n]%pps;
	printf("%d\n",ans);
	return 0;
}


Measured memory_bytes: 31488
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define rrep(i, n) for(int i = n-1; i >= 0; i--)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define lamsort(v,p) sort(v.begin(),v.end(),[](p a, p b){return a.num < b.num;});
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
const long long INF = 1LL<<60;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int benef[105][11];
int shop[105][10];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    int ans = -(1<<30);
    rep(i,n) rep(j,10) cin >> shop[i][j];
    rep(i,n) rep(j,11) cin >> benef[i][j];
    for(int bit = 1; bit<(1<<10); bit++) {
        int cnt = 0;
        rep(i,n) {
            int cnt2 = 0;
            for(int j = 0; j < 10; j++) {
                if((bit>>j&1) && shop[i][j]) cnt2++;
            }
            cnt += benef[i][cnt2];
        }
        ans = max(ans,cnt);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 380
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
using namespace std;

int main() {

	int N;
	cin >> N;

	int num = N % 2;

	double ans = 0.0;
	if (num == 0) {
		ans = 0.50;
	}
	else {
		ans = double(N - 1) / 2.0;
		ans = (ans + 1) / double(N);
	}

	cout << fixed;
	cout << setprecision(10) << ans << endl;

	return  0;
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
#define rep(i,n) for (ll i=0;i<(n);++i)
#define rep2(i,a,b) for (ll i=(a);i<(b);++i)
#define debug(x) cout << #x << '=' << x << endl
#define all(v) (v).begin(),(v).end()
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll INF=1e9;
const ll IINF=1e18;
const double EPS=1e-8;
const double pi=acos(-1);

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;
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,M; cin >> N >> M;
    if (N==M) cout << "Yes" << endl;
    else cout << "No" << endl;
}

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

int main() {
  // 入力
  int N, K;  // N:購入金額, K:嫌いな数字の個数
  cin >> N >> K;
  bool num[10] = {false};
  int tmp;
  for (int i=0; i<K; i++) {
    cin >> tmp;
    num[tmp] = true;
  }

  bool able[100000] = {false};
  string n;
  for (int i=1; i<=100000; i++) {
    n=to_string(i);
    for (int j=0; j<n.size(); j++) {
      tmp = (int)(n[j]-'0');
      if (num[tmp]) able[i] = true;
    }
  }

  int ans;
  for (int i=N; i<=100000; i++) {
    if (!able[i]) {
      ans = i;
      break;
    }
  }

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


Measured memory_bytes: 384
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <random>
#include <cstdio>
#include <cstring>
#include <cmath>

// for i in f..<t { as swift
#define forin(i, f, t) for(auto i = f; i < t; i++)

using namespace std;
using ll = long long;
using XY = pair<int, int>;
//#include<bits/stdc++.h>

int main() {
    ll a, b, k;
    cin >> a >> b >> k;
    
    auto i = a;
    for (; i < min(a + k, b); i++)
    cout << i << endl;
    for (auto j = max(i, b - k + 1); j < b + 1; j++)
    cout << j << endl;
}



Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
#define rep(i,n) for(int i=0;i<n;i++)
int gcd(int a, int b){
    int r=1;
    while(r!=0){
        r=a%b;
        a=b;
        b=r;
    }
    return a;
}
void revStr(char* str){
    int size = strlen(str);
    int i,j;
    char tmp = {0};
    for(i = 0, j = size - 1; i < size / 2; i++, j--){
        tmp = str[i];
        str[i] = str[j];
        str[j] = tmp;
    }return;
}
typedef struct{
    int a,b,c;
}data;

//昇順
int compare_int(const void *a, const void *b)
{
    return *(int*)a - *(int*)b;
}
//構造体降順
int comp( const void *c1, const void *c2 )
{
  data test1 = *(data *)c1;
  data test2 = *(data *)c2;
  int tmp1 = test1.b;   /* b を基準とする */
  int tmp2 = test2.b;
  return tmp2 - tmp1;
}


int kai(int n){
    if(n==0){
        return 1;
    }
    int sum=1;
    for(int i=1;i<=n;i++){
        sum*=i;
    }
    return sum;
}

int main(){
    int N,K;
    scanf("%d%d",&N,&K);
    int price[N];
    rep(i,N){
        scanf("%d",&price[i]);
    }
    qsort(price,N,sizeof(int),compare_int);
    int sum=0;
    rep(i,K){
        sum+=price[i];
    }
    printf("%d",sum);
}



Measured memory_bytes: 1748
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define P pair<int,string>
#define FF first
#define SS second
#define pb push_back
#define f(i,s,n) for(int i=s; i<n; i++)
#define fb(i,s,n) for(int i=s; i>=n; i--)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define M 1000000007

int main()
{
    int n,k;
    cin >> n >> k;
    vector<P>ans(k);
    int c[n+1],ac[n+1];
    memset(c,0,sizeof(c));
    memset(ac,0,sizeof(ac));
    
    f(i,0,k)
    {
        int a;
        string b;
        cin >> a >> b;
        ans[i].FF=a;
        ans[i].SS=b;
    }
    int cnt=0,cnt2=0;
    string s="WA";
    
    f(i,0,k)
    {
        if(ans[i].SS=="AC")
        {
            if(ac[ans[i].FF]==0) cnt2++;
            ac[ans[i].FF]++;
        }
    }
    f(i,0,k)
    {
        if(ac[ans[i].FF]!=0 && ans[i].SS=="WA" && c[ans[i].FF]==0)
            cnt++;
        if(ans[i].SS=="AC")
            c[ans[i].FF]++;
    }
    cout << cnt2 << " " << cnt;
  	return 0;
}

Measured memory_bytes: 8320
n, a, b = gets().split().map{|z| z.to_i}

s = gets()

ac = 0
bc = 0

for i in 0...n
  if ac < a + b && s[i] == 'a'
    puts 'Yes'
    ac += 1
  elsif s[i]=='b' && ac < a + b && bc < b
    puts 'Yes'
    ac += 1
    bc += 1
  else puts 'No' end

end

Measured memory_bytes: 2300
//package com.beginner.b053;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Scanner;

public class Main {

    public static void main(String args[]) throws Exception
    {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        LinkedHashMap<Integer,Integer> map = new LinkedHashMap<>();

        for(int i=0;i<N;i++){
            int key = sc.nextInt();
            if(map.containsKey(key)){
                map.put(key,map.get(key)+1);
            }
            else{
                map.put(key,1);
            }
        }

        int A=0;
        int B=0;
//        Iterator iter = map.keySet().iterator();
//        while (iter.hasNext()) {
//            Object key = iter.next();
//            Integer val = (Integer)map.get(key);
//            if(val%2==0){
//                B++;
//            }
//            else{
//                A++;
//            }
//        }
        for(Integer i : map.keySet()){
            if(map.get(i)%2==0){
                B++;
            }
            else{
                A++;
            }
        }

        int ans = 0;
        if(B%2==0){
            ans = A+B;
        }
        else{
            ans = A+B-1;
        }


        System.out.println(ans);

        sc.close();
    }

}

Measured memory_bytes: 51920
#include <iostream>
#include <vector>
#include <algorithm>
#include <string.h>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <sstream>
#include <iomanip>
#include <time.h>
#include <fstream>

using namespace std;


int main(){
	int N,x;
	int a[100000];
	cin>>N>>x;
	for(int i=0;i<N;i++){
		cin>>a[i];
	}
	long long ans=0;
	if (a[0]>x){
		ans+=a[0]-x;a[0]=x;
	}
	for(int i=1;i<N;i++){
		if (a[i]+a[i-1]>x){
			ans+=a[i]+a[i-1]-x;
			a[i]=x-a[i-1];
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 640
#include <iostream>

#define SIZE 100

int W, H, N;
bool grid[SIZE][SIZE];

void init() {
    for (int h=0; h<H; ++h) {
        for (int w=0; w<W; ++w) {
            grid[h][w] = true;
        }
    }
}

void color(const int &x, const int &y, const int &a) {
    int sx, sy, gx, gy;
    switch(a) {
        case 1:
            sx = 0;   sy = 0;
            gx = x;   gy = H;
            break;
        case 2:
            sx = x;   sy = 0;
            gx = W;   gy = H;
            break;
        case 3:
            sx = 0;   sy = 0;
            gx = W;   gy = y;
            break;
        case 4:
            sx = 0;   sy = y;
            gx = W;   gy = H;
            break;
        default:
            break;
    }
    for (; sy<gy; ++sy) {
        for (int dx=sx; dx<gx; ++dx) {
            grid[sy][dx] = false;
        }
    }
}

int main() {
    int ans=0;
    std::cin >> W >> H >> N;
    init();
    for (int i=0; i<N; ++i) {
        int x, y, a;
        std::cin >> x >> y >> a;
        color(x, y, a);
    }
    for (int h=0; h<H; ++h) {
        for (int w=0; w<W; ++w) {
            if (grid[h][w]) ++ans;
        }
    }
    std::cout << ans << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int c[200002];
void merge(int a,int b,int *s){
  if(a!=b){
    merge(a,(a+b)/2,s);
    merge((a+b)/2+1,b,s);
    int i=a,j=(a+b)/2+1,k;
    for(k=a;k<=b;k++){
      if(i!=(a+b)/2+1 && j!=b+1){
        if(s[i]>s[j]){
          c[k]=s[i];
          i++;
        }
        else{
          c[k]=s[j];
          j++;
        }
      }
      else if(i==(a+b)/2+1){
        c[k]=s[j];
        j++;
      }
      else{
        c[k]=s[i];
        i++;
      }
    }
    for(k=a;k<=b;k++)
      s[k]=c[k];
  }
}

int main(){
  int n,k,i;
  long long int count=0;
  scanf("%d%d",&n,&k);
  int h[n+1];
  for(i=0;i<n;i++)
    scanf("%d",&h[i]);
  merge(0,n-1,h);
  for(i=k;i<n;i++)
    count+=h[i];
  printf("%lld\n",count);
  return 0;
}


Measured memory_bytes: 1664
#include<bits/stdc++.h>
#define PB push_back
#define FO(i,a,b) for (int i = a; i <= b; i++)
#define FOb(i,a,b) for(int i=b;i>=a;i--)
#define vi vector<int>
#define vulli vector<unsigned long long int>
using namespace std;
typedef unsigned long long int ulli;
void solve()
{ 
  string str;
  cin >> str;
  int q,t,f,r=0;
  char c;
  cin >> q;
  while(q--){
    cin >> t;
    if(t==1)
        r++;
   else
   {
       cin >> f;
       cin >> c;
       if(f==1 && r%2==0 || (f==2) && r%2)
           str = c + str;
        else
            str.push_back(c);
   }
 
  }
  if(r%2)
    reverse(str.begin(),str.end());
  cout << str;
}
int main()
{
    std::ios_base::sync_with_stdio(false);
    ulli t=1;
   // cin>>t;   
    while(t--){ solve(); cout<<"\n"; }
    return 0;
}


Measured memory_bytes: 4680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;

int N,M;
vector<string> S,T;

int main(){
  cin>>N>>M;
  S.resize(N);
  T.resize(N);
  rep(i,N) cin>>S[i];
  rep(i,N) cin>>T[i];

  ll ans=0;
  for(int i=0;i<N;i++){
    for(int j=0;j<M;j++){
      if(S[i][j]!=T[i][j]) ans++;
    }
  }

  cout<<ans<<endl;

  return 0;
}



Measured memory_bytes: 11084
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.List;

public class Main {

	public static void main(String[] args) {
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		String buffer;
		boolean first = true;
		int amount = 0;
		List<Integer> list = new ArrayList<Integer>();
		try {
			while ((buffer = reader.readLine())  != null) {
				if (first) {
					first = false;
					amount = Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" ")));
					list = new ArrayList<Integer>();
				}
				else {
					first = true;
					for (int i = 0; i < amount; i++) {
						list.add(Integer.valueOf(buffer.substring(0, buffer.indexOf(" ") == -1 ? buffer.length() : buffer.indexOf(" "))));
						buffer = buffer.substring(buffer.indexOf(" ") + 1);
					}
					for (int i = 0; i < amount; i++) {
						if (i != 0) System.out.print(" ");
						System.out.print(list.get(amount - i - 1));
					}
					System.out.println();
				}
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}
}

Measured memory_bytes: 24316
//
//  main.cpp
//  tpcoder
//
//  Created by Sankalp Bhamare on 29/07/20.
//  Copyright © 2020 sankalp. All rights reserved.
//

#include <iostream>
#include <vector>
#include <math.h>
using namespace std;
long findBase(long n){
    return (floor((log(n * 25.0 + 1) / log(26)) - 1) + 1);
}
long normalize(long n,long base){
    return n  - ( 26 * ((pow(26,base-1)-1)/ 25) );
}

int main(int argc, const char * argv[]) {

    long int n;
    cin >> n;
   
    long base = findBase(n);
    long x = normalize(n,base) - 1;
 
    string res;
    while(x > 0){
        res =  (char) (((x) % 26 ) + 'a') + res;
        x = (x)/26;
    }
    while(res.length() != base){
        res = "a" + res;
    }
    cout << res << endl;
    return 0;

}


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

int main()
{
    int N;
    cin >> N;
    vector<int> a(N);
    for (int i = 0; i < N; i++)
        cin >> a[i];
    int ans = 1001001;
    for (int i = -100; i <= 100; i++)
    {
        int cost = 0;
        for (int j = 0; j < N; j++)
            cost += (a[j] - i) * (a[j] - i);
        ans = min(ans, cost);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a) for(int i=0;i<a;i++)
using namespace std;
int main(){
    string s;
    cin>>s;
    if(s=="a"||s=="i"||s=="u"||s=="e"||s=="o") cout<<"vowel"<<endl;
    else cout<<"consonant"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SC               scanf
#define PF               printf
#define ull              unsigned long long
#define ld               long double
#define D                double
#define F                first
#define S                second
#define pb               push_back
#define pf               push_front
#define MP               make_pair
#define sort_a(a)        sort(a.begin(),a.end());
#define sort_d(a)        sort(a.rbegin(),a.rend());
#define READ(f)          freopen(f, "r", stdin)
#define WRITE(f)         freopen(f, "w", stdout)
#define rev(s)           reverse(s.begin(),s.end())
#define it(it,mp)        for(auto it=mp.begin() ; it!=mp.end() ; it++)
#define IOS              ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define ll long long
typedef pair<int,int>                   PII;
#define ordered_set Tree<PII, null_type,less<PII>, rb_Tree_tag,Tree_order_statistics_node_update>
const int N = 1e5 + 5;
const int inf = 1e9 + 1;
const double eps = 1e-15;
const double EPS = 1e-9;
const double PI = acos(-1.0);
int main()
{
    // IOS
    // READ("0in.txt");
    // WRITE("0out.txt");
    ll d, n ;
    cin >> d >> n ;
    cout<<(ll)pow(100 , d) * (n == 100 ? n + 1 : n) << endl ;


}



Measured memory_bytes: 256
<?php

$a_list = [];
for ($i = 0; $i < 3; ++$i) {
    $a_list[] = explode(' ', trim(fgets(STDIN)));
}

$temp_a_hidarinaname = [];
$temp_a_miginaname = [];
for ($i = 0; $i < 3; ++$i) {
    $temp_a_column = [];
    for ($j = 0; $j < 3; ++$j) {
        $temp_a_column[] = $a_list[$j][$i];

        if ($i === $j) {
            $temp_a_hidarinaname[] = $a_list[$i][$j];
        }

        if ($i + $j === 2) {
            $temp_a_miginaname[] = $a_list[$i][$j];
        }
    }
    $a_list[] = $temp_a_column;
}
$a_list[] = $temp_a_hidarinaname;
$a_list[] = $temp_a_miginaname;

$b_list = [];
list($n) = explode(' ', trim(fgets(STDIN)));
for ($i = 0; $i < $n; ++$i) {
    list($b) = explode(' ', trim(fgets(STDIN)));
    $b_list[] = $b;
}

foreach ($a_list as $a) {
    $res = array_unique(array_merge($a, $b_list));
    if (count($res) === (int)$n) {
        echo 'Yes';
        exit;
    }
}

echo 'No';


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

int ans=-INT_MAX;
int n,a[10];
vector<vector<int>>f,p;

void calc(void){
    bool ok=false;
    rep(i,n)if(a[i]==1)ok=true;
    if(!ok)return;
    int sum=0;
    rep(i,n){
        int cnt=0;
        rep(j,10){
            if(a[j]&f[i][j])cnt++;
        }
        sum+=p[i][cnt];
    }
    ans=max(ans,sum);
    return;
}

void dfs(int x){
    if(x==10){
        calc();
        return;
    }
    a[x]=0,dfs(x+1);
    a[x]=1,dfs(x+1);
}

int main(){
    cin>>n;
    f=vector<vector<int>>(n,vector<int>(10));
    p=vector<vector<int>>(n,vector<int>(11));
    rep(i,n){
        rep(j,10){
            cin>>f[i][j];
        }
    }
    rep(i,n)rep(j,11){
        cin>>p[i][j];
    }
    dfs(0);
    cout<<ans<<endl;
    return 0;
}

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

using ll = long long;

int solve(vector<ll> values)
{
    auto S = *max_element(begin(values), end(values));
    auto small_primes = vector<ll>();
    auto small_prime_limit = static_cast<ll>(cbrt(S)) + 1;
    auto large_prime_squares = map<ll, ll>();
    auto large_prime_limit = static_cast<ll>(sqrt(S)) + 1;
    auto is_prime = vector<bool>(large_prime_limit+1, true);
    for (auto p = 2LL; p <= large_prime_limit; p++) if (is_prime[p])
    {
        if (p <= small_prime_limit) small_primes.push_back(p);
        else large_prime_squares[p*p] = p;
        for (auto k = 2*p; k <= large_prime_limit; k += p)
            is_prime[k] = false;
    }

    auto normalize = [&](ll x)
    {
        for (auto p : small_primes)
        {
            auto cube = p*p*p;
            while (x % cube == 0) x /= cube;
        }
        return x;
    };

    auto counts = map<ll, int>();
    for (auto x : values)
        counts[normalize(x)]++;

    auto dual = [&](ll x)
    {
        auto y = 1LL;
        for (auto p : small_primes)
        {
            if (x % (p*p) == 0) y *= p;
            else if (x % p == 0) y *= p*p;
            while (x % p == 0) x /= p;
            if (y > S) return -1LL;
        }
        if (large_prime_squares.count(x) == 1)
            y *= large_prime_squares[x];
        else
        {
            for (auto i = 0; i < 2; i++)
                if (x > S/y) return -1LL;
                else y *= x;
        }
        return y;
    };

    auto result = 0;
    for (auto kv : counts)
    {
        auto x = kv.first;
        auto y = dual(x);
        if (counts.count(y) == 0) result += counts[x];
        else if (x < y) result += max(counts[x], counts[y]);
    }
    if (counts[1]) result++;
    return result;
}

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

    auto values = vector<ll>(N);
    for (auto& x : values) cin >> x;

    cout << solve(values) << endl;
}


Measured memory_bytes: 8704
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

n,m=[int(i) for i in input().split()]
data=[1]*m

row=[]
col=[]

for i in range(m):
    one,two=[int(i) for i in input().split()]
    n_one=min(one-1,two-1)
    n_two = max(one - 1, two - 1)
    row.append(n_one)
    col.append(n_two)

graph=csr_matrix((data,(row,col)),shape=(n,n))
num,label=connected_components(graph)

count_num=[0]*n
for i in label:
    count_num[i]+=1

print(max(count_num))



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

int main(){
  bool is_prime[1000000];

  is_prime[0]=is_prime[1]=false;
  for(int i=2;i<1000000;i++){
    is_prime[i] = true;
  }

  for(int i=2;i*i<1000000;i++){
    if(is_prime[i]){
      for(int j=i*i;j<1000000;j=j+i){
        is_prime[j] = false;
      }
    }
  }

  int n_prime[1000000];

  int cnt = 0;
  for(int i=0;i<1000000;i++){
    if(is_prime[i]){
      cnt++;
    }
    n_prime[i] = cnt;
  }

  while(true){
    int n;
    cin >> n;

    if(cin.eof())
        break;

    cout << n_prime[n] << endl;
  }

  return 0;
}



Measured memory_bytes: 7964
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner();
		String s = sc.next();
		boolean b = s.charAt(1) == s.charAt(2);
		b &= s.charAt(0) == s.charAt(1)
				|| s.charAt(2) == s.charAt(3);
		System.out.println(b ? "Yes" : "No");
	}
}

class Scanner {
	private BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	private static final int SPACE = (int)' ';
	private static final int LINE_END_0 = 13;
	private static final int LINE_END_1 = 10;
	private static final int BEFORE = -1;
	
	public boolean ready() {
		try {
			return br.ready();
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return false;
	}
	
	public String next(){
		StringBuilder sb = new StringBuilder();
		
		int length = BEFORE;
		readLoop: while(true) {
			try {
				int value = br.read();
				switch(value) {
				case LINE_END_1:
					if(length == BEFORE)
						break;
					
					if((int)sb.charAt(length) == LINE_END_0)
						sb.deleteCharAt(length);
				case SPACE:
					break readLoop;
				}
				sb.append((char)value);
				length++;

			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return sb.toString();
	}
	
	public int nextInt() {
		return Integer.parseInt(next());
	}
	
	public double nextDouble() {
		return Double.parseDouble(next());
	}
	
	public long nextLong() {
		return Long.parseLong(next());
	}
}


Measured memory_bytes: 21204
// Devarshi

/*
We will not return to the countless mistakes of the past
I will not relive the failures of the man I once was

Only through dedication will I destroy all preconception

No longer will I let myself be truly satisfied with the standard
We will not return to the countless mistakes of the past

Only through dedication will I destroy all preconception

Let this be
Be the day
Day of my
My declaration
Let this be the day of my declaration

Join me,
Walk with me

Shatter the bonds that tie us
To what we strive to never be

Join me,
Walk with me
*/
#include<bits/stdc++.h>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define ll long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i,n) for(i=0;i<n;i++)
#define forn(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define for1(i, n) for (ll i = 1; i <= (ll)(n); ++i)
#define ford(i, n) for (ll i = (ll)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (ll i = (ll)(a); i <= (ll)(b); ++i)
#define fora(it,x) for(auto it:x)
#define PI 3.14159265
#define sync ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;

typedef pair<ll, ll> pii;
typedef vector<ll> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn=1000001;


int main(){

int n,m;
cin>>n>>m;

string s[n];

forn(i,n){
cin>>s[i];
}

string t[n];
int idx=0;
forn(i,n){
if(count(all(s[i]),'.')==m) continue;
t[idx]=s[i];
idx++;
}
map<int,int> mm;

forn(i,m){
bool flag=false;
forn(j,idx){
if(t[j][i]=='#'){
    flag=true;
    break;
}
}
if(!flag){
    mm[i]=1;
}
}

forn(i,idx){
forn(j,m){
if(mm[j]) continue;
cout<<t[i][j];
}
cout<<endl;
}

return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main()
{
    char c;
    std::cin >> c;
    switch (c) {
        case 'A':
            std::cout << 'T' << std::endl;
            break;
        case 'C':
            std::cout << 'G' << std::endl;
            break;
        case 'G':
            std::cout << 'C' << std::endl;
            break;
        case 'T':
            std::cout << 'A' << std::endl;
            break;
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <cstddef>
#include <cstdint>
#include <iomanip>
#include <iostream>
#include <map>
#include <set>
#include <vector>

using namespace std;

int main()
{
    int n, k;
    cin >> n >> k;
    vector<double> vs(n);
    for (auto& v : vs)
    {
        cin >> v;
    }

    int max_value = 0;
    int value = 0;
    for (int i = 0; i < k; i++)
    {
        value += vs[i];
    }
    max_value = value;
    for (int i = k; i < n; i++)
    {
        value += vs[i];
        value -= vs[i - k];
        if (max_value < value)
        {
            max_value = value;
        }
    }
    cout << setprecision(15) << (max_value + k) / 2.0 << endl;
}


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

using namespace std;
typedef long long ll;

int main(void)
{
  string S;
  cin >> S;

  ll up = 0;
  ll down = 0;
  ll sum = 0;
  char before = '>';
  for(int i=0;i<S.length();i++){
    if(S[i] == '<'){
      if(before == '>'){
        ll a = max(up,down);
        ll b = min(up,down);
        sum += ( a*(a+1)/2 + b*(b+1)/2 -b );
        up = 0;
        down = 0;
      }
      up++;
    }
    else{
      down++;
    }
    before = S[i];
  }
  
  ll a = max(up,down);
  ll b = min(up,down);
  sum += ( a*(a+1)/2 + b*(b+1)/2 -b );
  
  cout<<sum<<endl;

  return 0;
}

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

using namespace std;
#define int long long
const int MOD = 1000000007;

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

	int N;
	cin >> N;
	string S, T;
	cin >> S >> T;
	string res;
	for (int i = 0; i < N; i++) {
		res.push_back(S[i]);
		res.push_back(T[i]);
	}
	cout << res << endl;
}

Measured memory_bytes: 384
text=input()
string=input()


#common_length[i]は、探索列がstring[i]で探索を終了したときに、
# string[i-common_lneght[i] + 1] 〜string[i]で構成される文字列が、探索価値を持つことを示す


len_string=len(string)
common_length=[0]*len_string
tmp=0
for i in range(1,len_string):
    if(string[i]==string[tmp]):
        if(string[i-1]==string[max([tmp-1,0])]):
            common_length[i-1]=1
        else:
            common_length[i-1]=0
        tmp+=1
    else:
        common_length[i-1]=tmp
        if(string[i]==string[0]):
            tmp=1
        else:
            tmp=0

if(string[-1]==string[tmp-1]):
    common_length[-1]=tmp
common_length[0]=0



tmp=0

for i in range(len(text)):
    if(text[i]!=string[tmp]):
        while(text[i]!=string[tmp] and tmp>0):
            tmp=common_length[max([tmp-1,0])]
        if(text[i]==string[tmp]):
            tmp+=1
    else:
        tmp+=1
        if(tmp==len_string):
            print(i-tmp+1)
            tmp=common_length[-1]


Measured memory_bytes: 5588