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

using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
typedef tuple<int, int, int> t;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 1000000007

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;

int main(){
  int H, W;
  cin >> H >> W;
  bool passed[H][W];
  char S[H][W];
  rep(h, H) rep(w, W) cin >> S[h][w];

  ll ans = 0;
  rep(sh, H) rep(sw, W){
    if(S[sh][sw] == '#') continue;
    rep(h, H) rep(w, W) passed[h][w] = false;
    queue<t> que;
    que.push(t(sh, sw, 0));
    passed[sh][sw] = true;
    while(!que.empty()){
      int h, w, d;
      tie(h, w, d) = que.front();
      que.pop();
      if(h+1 < H && !passed[h+1][w] && S[h+1][w] == '.'){
        passed[h+1][w] = true;
        que.push(t(h+1, w, d+1));
        if(ans < d + 1) ans = d + 1;
      }
      if(h-1 >= 0 && !passed[h-1][w] && S[h-1][w] == '.'){
        passed[h-1][w] = true;
        que.push(t(h-1, w, d+1));
        if(ans < d + 1) ans = d + 1;
      }
      if(w+1 < W && !passed[h][w+1] && S[h][w+1] == '.'){
        passed[h][w+1] = true;
        que.push(t(h, w+1, d+1));
        if(ans < d + 1) ans = d + 1;
      }
      if(w-1 >= 0 && !passed[h][w-1] && S[h][w-1] == '.'){
        passed[h][w-1] = true;
        que.push(t(h, w-1, d+1));
        if(ans < d + 1) ans = d + 1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}


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

int main() {
  int A,B,ans=1; cin >> A >> B;
  if(B==1) cout << 0 << endl;
  else if(A>=B) cout << 1 << endl;
  else{
    int sum = A*ans;
    while(sum < B) {
      ans++;
      sum += (A-1);
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 3612
#include<cstdio>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;
void solve()
{
    ll n,ans = 0;
    cin>>n;
    for(ll i = 1 ; i <= n ; i++)
    {
        if(i % 15 == 0||i % 5 == 0 || i % 3 == 0)continue;
        ans += i;
    }
    cout<<ans<<endl;
}
int main()
{

    //int t;
   // cin>>t;
   // while(t--)
        solve();
    return 0;
}



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

struct eratosthenes
{
    int n;
    vector<int> f;
    vector<P> primes;

    eratosthenes(int n) : f(n + 1)
    {
        ll i, j;
        f[0] = f[1] = -1;
        for (i = 2; i <= n; i++)
        {
            if (!f[i])
            {
                f[i] = i;
                primes.push_back(P(i, 0));
                for (j = i * i; j <= n; j += i)
                {
                    if (!f[j])
                    {
                        f[j] = i;
                    }
                }
            }
        }
    }

    set<int> genosis(int x)
    {
        set<int> g;

        while (x != 1)
        {
            g.insert(f[x]);
            x /= f[x];
        }

        return g;
    }

    // vector<P> genosiscount(int x)
    // {
    //     vector<P> gc;
    //     vector<int> g = genosis(x);

    //     if (g.empty() == 1)
    //     {
    //         return {};
    //     }

    //     gc.push_back(P(f[x], 0));

    //     for (auto &i : g)
    //     {
    //         if (gc.back().first == i)
    //         {
    //             gc.back().second++;
    //         }
    //         else
    //         {
    //             gc.push_back(P(i, 1));
    //         }
    //     }

    //     return gc;
    // }
};

int main(void)
{
    int n;
    cin >> n;

    eratosthenes e(1000010);

    map<ll, ll> m;

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

        for (auto &&i : e.genosis(a))
        {
            m[i]++;
        }
    }

    bool flag = true;

    for (auto &&i : m)
    {
        if (i.second == n)
        {
            cout << "not coprime" << endl;
            return 0;
        }

        if (i.second > 1)
        {
            flag = false;
        }
    }

    if (flag)
    {
        cout << "pairwise coprime" << endl;
    }
    else
    {
        cout << "setwise coprime" << endl;
    }
}


Measured memory_bytes: 13212
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	s := Scan()
	ans := make([]int, len(s))
	r := 0
	for i := 0; i < len(s); i++ {
		if string(s[i]) == "R" {
			r++
		} else {
			ans[i-1] += r - r/2
			ans[i] += r / 2
			r = 0
		}
	}
	r = 0
	for i := len(s) - 1; i >= 0; i-- {
		if string(s[i]) == "L" {
			r++
		} else {
			ans[i+1] += r - r/2
			ans[i] += r / 2
			r = 0
		}
	}
	fmt.Println(strings.Trim(fmt.Sprint(ans), "[]"))
}


Measured memory_bytes: 5368
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<complex>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cassert>
using namespace std;

#define rep(i,n) for(int i=0;i<(int)n;i++)
#define fr(i,c) for(__typeof(c.begin()) i=c.begin();i!=c.end();i++)
#define pb push_back
#define mp make_pair
#define all(c) c.begin(),c.end()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl

typedef vector<int> vi;
typedef pair<int,int> pi;
typedef long long ll;
const int inf=(int)1e9;
const double EPS=1e-9, INF=1e12;

inline void takemax(int &a,int b){if(a==-inf||a<b)a=b;}

int n,f,x[8][8];
int dp1[1<<16][8],dp2[1<<16][8];
int rec(int b1,int b2,int last,int pt,int turn,int a,int b){
	if(turn==2*n+1){
		if(pt==0)return inf/2;
		if(pt>0)return inf-turn;
		return turn;
	}
	if(turn%2==1){
		if(pt+dp1[b1<<n|b2][last]<0)return turn;
		rep(i,n)if(!(b1&1<<i)){
			a=max(a,rec(b1|1<<i,b2,i,pt+(turn>1?x[i][last]:0),turn+1,a,b));
			if(a>=b)return b;
		}
		return a;
	}
	else{
		if(pt-dp2[b1<<n|b2][last]>0)return inf-turn;
		rep(i,n)if(!(b2&1<<i)){
			b=min(b,rec(b1,b2|1<<i,i,pt-x[last][i],turn+1,a,b));
			if(a>=b)return a;
		}
		return b;
	}
}


int main(){
	cin>>n>>f;
	rep(i,n)rep(j,n)cin>>x[i][j];
	rep(i,1<<2*n)rep(j,n)dp1[i][j]=dp2[i][j]=-inf;
	rep(j,n)dp1[(1<<2*n)-1][j]=dp2[(1<<2*n)-1][j]=0;
	
	for(int i=(1<<2*n)-1;i>=0;i--){
		int cnt=__builtin_popcount(i);
		if(cnt%2==0){
			rep(j,n)rep(k,n)if(!(i&1<<k+n))
			takemax(dp1[i][j],dp1[i^1<<k+n][k]+(cnt?x[k][j]:0)),
			takemax(dp2[i][j],dp2[i^1<<k+n][k]-(cnt?x[k][j]:0));
		}
		else{
			rep(j,n)rep(k,n)if(!(i&1<<k))
			takemax(dp1[i][j],dp1[i^1<<k][k]-x[j][k]),
			takemax(dp2[i][j],dp2[i^1<<k][k]+x[j][k]);
		}
	}
	
	int ans=rec(0,0,0,f,1,-inf,inf);
	if(ans==inf/2)cout<<"Draw\n"<<n*2<<endl;
	else if(ans>inf/2)cout<<"First\n"<<inf-ans<<endl;
	else cout<<"Second\n"<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
using ll = int64_t;
using ull = uint64_t;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    if (!(cin >> N)) { return; }
    ll M;
    cin >> M;
    vector<vector<ll>> AtoB(N);
    vector<int> come(N, 0);
    for (int i = 1; i < N + M; ++i) {
        ll ta, tb;
        cin >> ta >> tb;
        ta--; tb--;
        AtoB[ta].push_back(tb);
        come[tb]++;
    } // end i
    ll root;
    for (int i = 0; i < N; ++i) {
        if(come[i] == 0) root = i;
    } // end i

    vector<int> par(N, 0);
    queue<pair<ll, ll>> q;
    q.push({root, 0});
    while(!q.empty()){
        ll K = q.front().first;
        ll dep = q.front().second;
        q.pop();
        if(come[K] > 1){
            come[K]--;
            continue;
        }
        par[K] = dep;
        for (auto &&toB : AtoB[K]) {
            q.push({toB, K+1});
        } // end toB
    }
    for (int i = 0; i < N; ++i) {
        cout << par[i] << endl;
    } // end i
}

int main(int argc, char *argv[]) {
    string FileName("D"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    // /home/USER/.../MEPH_X -> MEPH_X
    if (sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size() - ExecutionName.size(), ExecutionName.size());

    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while (cin) { solve(cin); }
    } else {
        cerr << sub << " test" << endl;
        string inFile = FileName + ".txt";
        auto fs = fstream(inFile, fstream::in);
        while (fs) { solve(fs); }
    }
}


Measured memory_bytes: 7040
import java.util.*;
import java.io.*;
import static java.util.Arrays.*;
import static java.util.Collections.*;
import static java.lang.Math.*;

public class Main {

  static final int N = 100000;
  static final int Q = 50000;
  static int n, q;
  static int s[], t[];

  public static int binary_search(int x) {
    int l = 0;
    int r = n;
    int m;
    while (r-l > 0) {
      m = (l+r)/2;
      if (s[m] == x)
      return m;
      else if (s[m] < x) 
        l = m + 1;
      else
        r = m;
    }
    return -1;
  }

  public static void main(String[] args) {
    int i;
    Scanner sc = new Scanner(System.in); 
    n = Integer.parseInt(sc.next());
    s = new int[n];
    for (i=0; i<n; i++)
      s[i] = Integer.parseInt(sc.next());

    q = Integer.parseInt(sc.next());
    t = new int[q];
    for (i=0; i<q; i++)
      t[i] = Integer.parseInt(sc.next());

    int res = 0;
    for (i=0; i<q; i++)
      if (binary_search(t[i]) != -1)
        res++;

    System.out.println(res);
  }
}

Measured memory_bytes: 68112
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int h, w;
    cin >> h >> w;
    vector< string > s(h);
    for (int i = 0; i < h; i++) {
        cin >> s[i];
    }
    vector< vector< int > > numH(h, vector< int >(w, 0));
    for (int i = 0; i < h; i++) {

        //累積和っぽく加算
        numH[i][0] = (s[i][0] == '#' ? 0 : 1);
        for (int j = 1; j < w; j++) {
            if (s[i][j] == '#') {
                numH[i][j] = 0;
            } else {
                numH[i][j] = numH[i][j - 1] + 1;
            }
        }
        //その区間の最大値に置き換え
        for (int j = w - 2; j >= 0; j--) {
            if (numH[i][j + 1] != 0 && numH[i][j] != 0) {
                numH[i][j] = numH[i][j + 1];
            }
        }
    }
    // cout << endl;
    // for (int i = 0; i < h; i++) {
    //     for (int j = 0; j < w; j++) {
    //         cout << numH[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    vector< vector< int > > numW(h, vector< int >(w, 0));
    for (int i = 0; i < w; i++) {

        //累積和っぽく加算
        numW[0][i] = (s[0][i] == '#' ? 0 : 1);
        for (int j = 1; j < h; j++) {
            if (s[j][i] == '#') {
                numW[j][i] = 0;
            } else {
                numW[j][i] = numW[j - 1][i] + 1;
            }
        }
        //その区間の最大値に置き換え
        for (int j = h - 2; j >= 0; j--) {
            if (numW[j][i] != 0 && numW[j + 1][i] != 0) {
                numW[j][i] = numW[j + 1][i];
            }
        }
    }

    // cout << endl;
    // for (int i = 0; i < h; i++) {
    //     for (int j = 0; j < w; j++) {
    //         cout << numW[i][j] << " ";
    //     }
    //     cout << endl;
    // }

    int ans = 0;
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            ans = max(ans, numH[i][j] + numW[i][j] - 1);
            // cout << setw(2) << numH[i][j] + numW[i][j] - 1 << " ";
        }
        // cout << endl;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 35712
S = input()
ans = 0
for i in range(2**(len(S)-1)):
    ls = []
    index = 0
    for j in range(len(S)-1):
        if ((i >> j) & 1):
            ls.append(int(S[index:j+1]))
            index = j+1
    ls.append(int(S[index:]))
    ans += sum(ls)
print(ans)

Measured memory_bytes: 9200
import java.util.*;

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

Measured memory_bytes: 22612
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>


#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#ifdef LOCAL
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)
#else
#define show(...)
#define showlr(n,l,r)
#endif

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;
/*------------end of definitions------------*/

string S;

signed main(){

    in(S);
    out(S.substr(0,S.rfind("FESTIVAL")));

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<map>
using namespace std;
#define hh putchar(10)
#define ll long long


char f[3]={'+','-'};
void Main()
{
    char a,b,c,d;
    cin>>a>>b>>c>>d;
    a^=48;b^=48;c^=48;d^=48;
    if(a+b+c+d==7)printf("%d+%d+%d+%d=7",a,b,c,d);
    else if(a+b+c-d==7)printf("%d+%d+%d-%d=7",a,b,c,d);
    else if(a+b-c+d==7)printf("%d+%d-%d+%d=7",a,b,c,d);
    else if(a+b-c-d==7)printf("%d+%d-%d-%d=7",a,b,c,d);
    else if(a-b+c+d==7)printf("%d-%d+%d+%d=7",a,b,c,d);
    else if(a-b+c-d==7)printf("%d-%d+%d-%d=7",a,b,c,d);
    else if(a-b-c+d==7)printf("%d-%d-%d+%d=7",a,b,c,d);
    else if(a-b-c-d==7)printf("%d-%d-%d-%d=7",a,b,c,d);
}






int main()
{
    Main();
    return 0;
}


Measured memory_bytes: 256
a, b, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
X, Y, C = [], [], []
for _ in range(m):
    x, y, c = map(int, input().split())
    X.append(x)
    Y.append(y)
    C.append(c)
 
ans = min(A) + min(B)
for i in range(m):
    tot = A[X[i]-1] +B[Y[i]-1] - C[i]
    ans = min(tot, ans)
print(ans) 

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

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

using namespace std;
using lint=long long;

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

	lint cnt[5]={};
	rep(i,n){
		string s; cin>>s;
		if(s[0]=='M') cnt[0]++;
		if(s[0]=='A') cnt[1]++;
		if(s[0]=='R') cnt[2]++;
		if(s[0]=='C') cnt[3]++;
		if(s[0]=='H') cnt[4]++;
	}

	lint ans=0;
	int p[]={0,0,1,1,1};
	do{
		int idx[3],n=0;
		rep(i,5) if(p[i]==1) idx[n++]=i;
		ans+=cnt[idx[0]]*cnt[idx[1]]*cnt[idx[2]];
	}while(next_permutation(p,p+5));
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
n = int(input())
s = input().rstrip()
 
 
def check(length):
    d = set()
    for i in range(n - 2 * length + 1):
        d.add(s[i:i + length])
        if s[i + length:i + 2 * length] in d:
            return True
    return False
 
 
lo = 0
hi = n // 2 + 1
while lo + 1 < hi:
    mid = (lo + hi) // 2
    if check(mid):
        lo = mid
    else:
        hi = mid
print(lo)

Measured memory_bytes: 135644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(var, begin, end) for (int var = (begin); var < (end); var++)
#define RFOR(var, begin, end) for (int var = (begin) - 1; var >= (end); var--)
#define REP(var, length) FOR(var, 0, length)
#define RREP(var, length) RFOR(var, length, 0)
#define SORT(vector) sort(vector.begin(), vector.end())

const ll MOD = 1e9 + 7;

vector<vector<int>> e;
vector<int> dp;

int DFS(int n) {
  if (dp[n] != -1) {
    return dp[n];
  }

  int ret = -1;
  for (auto to : e[n]) {
    ret = max(ret, DFS(to) + 1);
  }
  dp[n] = ret;
  return ret;
}

void solve(istream& cin, ostream& cout) {
  int n, m;
  cin >> n >> m;

  e = vector<vector<int>>(n, vector<int>(0));
  dp = vector<int>(n, -1);

  REP(i, m) {
    int x, y;
    cin >> x >> y;
    x--;
    y--;
    e[x].push_back(y);
  }

  int ans = 0;
  REP(i, n) {
    ans = max(ans, DFS(i) + 1);
  }
  cout << ans << endl;
}

#ifndef TEST
int main() {
  solve(cin, cout);
}
#endif


Measured memory_bytes: 8192
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        String line = scan.nextLine();

        String[] strList = line.split("",0);
        String str1 = "";


        for(int i=0; i<strList.length; i++) {
            if(strList[i].equals("0")) {
                str1+="0";
            } else if(strList[i].equals(("1"))) {
                str1+="1";
            } else {
                if(str1.length()>0) {
                    String[] hoge = str1.split("", 0);
                    str1 = "";
                    for(int j=0;j<hoge.length-1;j++) {
                        str1 += hoge[j];
                    }
                }
            }
        }

        System.out.println(str1);


    }
}


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

int g[3][30];
int main(){
    int n, c;
    cin >> n >> c;
    int d[c][c], cc;
    for(int i = 0; i < c; i++){
        for(int j = 0; j < c; j++){
            cin >> d[i][j];
        }
    }
    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            cin >> cc;
            g[(i + j) % 3][cc - 1]++;
        }
    }
    int sum = 1e9+7;
    for(int i = 0; i < c; i++){
        for(int j = 0; j < c; j++){
            if(i == j) continue;
            for(int k = 0; k < c; k++){
                if(i == k || j == k) continue;
                int tmp = 0;
                for(int l = 0; l < c; l++){
                    tmp += d[l][i] * g[0][l];
                    tmp += d[l][j] * g[1][l];
                    tmp += d[l][k] * g[2][l];
                }
                sum = min(sum, tmp);
            }
        }
    }
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <algorithm>
#include <numeric>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, k;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n >> k;
    if (k == 1)
    {
        cout << 0 << "\n";
        return 0;
    }
    n = n - k;
    cout << n << "\n";
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cassert>
#include <utility>
#include <numeric>
#include <cstring>
#include <map>
#include <set>
#include <cmath>
#define rep(i,n) for (int i=0; i<(n); ++i)

using namespace std;
using ll = long long;

int main (){
    string S,T,U;
    cin >> S >> T;
    int a,b;
    cin >> a >>b;
    cin >> U;
    if (S == U){
        a -=1;

    }
    else b--;
    cout << a << " " << b;


}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 5005;
const ll mod = 1e9 + 7;
const ll INF = 1e9 + 7;

char str[200000];
int main()
{
	scanf("%s",str);

	int len=strlen(str);

	int l=0,r=0;
	int s=0;
	for (int q=0;q<len;q++)
	{
		if (str[q]=='1')
		{
			if (l>0) l--,s+=2;
			else r++;
		}
		else
		{
			if (r>0) r--,s+=2;
			else l++;
		} 
	}

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

	return 0;
}

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

#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sax(x) cout << "!!!!!!!!!!! " << #x << " = " << x << '\n'
#define inf (sizeof(int) == 4 ? (int)1E9 : (int)1E18)
#define one(x) x.insert(x.begin(), 0);
#define TCT template <class T>
#define TCT12 template <class T1, class T2>

//#include <ext/pb_ds/assoc_container.hpp>
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,
//tree_order_statistics_node_update> imsi;

TCT12 istream& operator>>(istream &I, pair<T1,T2>& p) {return I >> p.first >> p.second;}
TCT12 ostream& operator<<(ostream &O, const pair<T1,T2>& p) {return O << '(' << p.first << ' ' << p.second << ')';}
TCT istream& operator>>(istream &I, vector<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const set<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const unordered_multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT ostream& operator<<(ostream &O, const multiset<T>& v) {for (const T &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const unordered_map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT12 ostream& operator<<(ostream &O, const map<T1,T2>& v) {for (const auto &e: v) O << e << ' '; return O;}
TCT istream& operator>>(istream &I, deque<T>& v) {for (T &e: v) I >> e; return I;}
TCT ostream& operator<<(ostream &O, const deque<T>& v) {for (const T &e: v) O << e << ' '; return O;}
typedef pair<int,int> pii;
typedef vector<int> vi;





void _main() {
        int n; cin >> n;
        int m; cin >> m;
        vector<pair<int,string>> vec(m); cin >> vec;
        int a = 0;
        vector<int> cor(n + 1);
        for (int i = 0; i< vec.size(); i++) {
                if (vec[i].second != "AC") continue;
                cor[vec[i].first] = true;
        }

        a = accumulate(all(cor), 0ll);
        cor = vector<int>(n + 1);
        int b = 0;
        vector<int> incor(n + 1);
        for (int i = 0; i <vec.size(); i++) {
                if (cor[vec[i].first]) continue;
                if (vec[i].second == "AC") {
                        cor[vec[i].first] = true;
                        b += incor[vec[i].first];
                } else {
                        incor[vec[i].first]++;
                }
        }

        cout << a << ' ' << b;
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}

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

using namespace std;

int main() {
    int n,x;
    cin >> n >> x;
    vector <int> a(n);
    for(int i=0;i<n;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());
    int ans=0,sum=0;
    for(int i=0;i<n;i++){
        sum+=a[i];
        if(sum>x){
            break;
        }
        ans++;
    }
    if(ans==n){
        if(x!=sum){
            ans--;
        }
    }
    cout << ans << endl;
    return 0;
}

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

auto test(std::uint64_t* const up, std::uint64_t val) {
	auto& x = *up;
	std::cout << ((x >> val) & 1 ? 1 : 0) << "\n";
}

auto set(std::uint64_t* const up, std::uint64_t val) {
	*up |= (1ull << val);
}

auto clear(std::uint64_t* const up, std::uint64_t val) {
	*up &= ~(1ull << val);
}

auto flip(std::uint64_t* const up, std::uint64_t val) {
	*up ^= (1ull << val);
}


auto all( std::uint64_t x)->decltype(x) {
	bool all = true;
	for (int i{}; i < 64; ++i) {
		all = (x >> i) & 1;
		if (!all)
			break;
	}

	return
		(all ? 1 : 0);
}

auto any( std::uint64_t x)->decltype(x) {
	bool any = false;
	for (int i{}; i < 64; ++i) {
		if (any)	break;
		any = (x >> i) & 1;
	}
	return
		(any ? 1 : 0);
}

auto none( std::uint64_t x)->decltype(x) {
		bool none = true;
		for (int i{}; i < 64; ++i) {
			if (!none)break;
			none = 1 & ~(x >> i);
		}

		return none ? 1 : 0;
}

auto count( std::uint64_t x)->decltype(x){
	decltype(x) count{};
	for (int i{}; i < 64; ++i) {
		count += (x >> i) & 1 ? 1 : 0;
	}
	return count;
}


int main() {

	std::uint64_t x{0};

	int q;
	std::cin >> q;

	for (int i{}; i < q; ++i) {
		std::uint64_t code, val{};
		std::cin >> code;
		if (code <= 3)
			std::cin >> val;

		switch (code)
		{
			case 0:
				test(&x, val);
				break;

			case 1://set 1
				set(&x, val);
				break;

			case 2://set 0
				clear(&x, val);
				break;

			case 3://flip
				flip(&x, val);
				break;

			case 4://all
				val = all(x);
				break;

			case 5:
				val = any(x);
				break;

			case 6:
				val = none(x);
				break;

			case 7:
				val = count(x);
				break;

			case 8:
				val = x;
				break;
			default:
				break;
		}

		if (4 <= code )
			std::cout << val << "\n";

//		std::cout <<"  >>  "<< x << "\n";
	}
}



Measured memory_bytes: 3084
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=100;
const int INF=1e9+7;
const ll LINF=1e18;

int main()
{
	int t1;
	cin>>t1;
	int ans=0,z=1;
	z=10;
	
	int t=9;
	while (t1>=z)
	{
		ans+=t;
		t*=100;
		z*=100;
	}
	z/=10;
	if (t1>=z)
	{
		ans+=t1-z+1;
	}

	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <string>
#include<limits>
#include<cstdlib>
#include<functional>
#include<cassert>
using namespace std;

int main()
{
	string s, a, aa, aaa;
	int ans = 999;
	int sum;

		cin >> s;
	
		for (int i = 0; i < s.size() - 2; i++) {
			aaa = s[i];
			aa = s[i + 1];
			a = s[i + 2];
			sum = stoi(aaa)*100 + stoi(aa)*10 + stoi(a);
			ans = min(ans, abs(753 - sum));
		}
		cout << ans << endl;



	
	return 0;
}

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

using ll= long long;
#define double long double
#define sz(x) (int)x.size()
#define all(x) (x).begin(),(x).end()
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define _set(x) __builtin_popcount(x)
#define _setl(x) __builtin_popcountll(x)
#define PI  3.14159265358979323846264338327950L
#define mod 1000000007LL

void debug(){
	cerr<<"]\n";
}
template<class H,class ... T> void debug(H h,T... t){
	cerr<<h;
	if(sizeof... (t)){
		cerr<<", ";
	}
	debug(t...);
}
#ifdef DEBUG
	#define dbg(...) cerr << "LINE(" << __LINE__ << ") -> [" << #__VA_ARGS__ << "]: [", debug(__VA_ARGS__)
	#define dpv(...) cerr<< "["#__VA_ARGS__ " : ";for(int i: (__VA_ARGS__)){cerr<<i<<" ";}cerr<<"]\n"
#else
	#define dbg(...) 0
	#define dpv(...) 0
#endif


void solve(){
	int d,t,s;
	cin>>d>>t>>s;
	if((d+s-1)/s <=t){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
}


int32_t main(){
	IOS
	// freopen("input.txt","r",stdin);
	int _;
	// cin>>_;
	_=1;
	for(int i=1;i<=_;i++){
		// cout<<"Case #"<<i<<": ";
		solve();
	}
	return 0;
}

/*
   check for overflows int long long
   correct mize of array
*/


Measured memory_bytes: 3648
#include <stdio.h>

int main(){
  char line[100];
  int b, f, r, v=0;
  int num;
  int room[4][3][10];
  int i;
  for(b=0; b<4; ++b){
	for(f=0; f<3; ++f){
	  for(r=0; r<10; ++r){
		room[b][f][r]=0;
	  }
	}
  }
  fgets(line, sizeof(line), stdin);
  sscanf(line, "%d", &num);
  for(i=0; i<num; ++i){
	fgets(line, sizeof(line), stdin);
	sscanf(line, "%d %d %d %d", &b, &f, &r, &v);
	room[b-1][f-1][r-1]+=v;	
	if(room[b-1][f-1][r-1]<0)
	  room[b-1][f-1][r-1]=0;
  }
  for(b=0; b<4; ++b){
	for(f=0; f<3; ++f){
	  for(r=0; r<10; ++r){
		printf(" %d", room[b][f][r]);
	  }
	  printf("\n");
	}
	if(b!=3){
	for(i=0; i<20; ++i){
	  printf("#");
	}
	printf("\n");
  }
  }
  return 0;
}



Measured memory_bytes: 2100
/*
 * Created by KeigoOgawa
 */


#include <cstdio>
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <cmath>

#define INF (int)1e8
#define EPS 1e-10
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define MIN(a, b) (a > b ? b : a)
#define MAX(a, b) (a > b ? a : b)
#define debug(x) cout << #x << ": " << x << endl
#define all(a) (a).begin(), (a).end()

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> PII;

ll N, X;

void solve() {
  ll x = X, n = N, nx = N - X, ans = 0;
  ans += x + nx;
  while (x != 0) {
    ll y = nx / x;
    ll ym = nx % x;

    ans += y * x * 2;
    nx = x;
    x = ym;
  }
  ans -= nx;
  cout << ans << endl;
}

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

  cin >> N >> X;
  solve();
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int top, S[1000];

void push(int x) {
    // topを加算してからその位置へ挿入
    // topはスタックポインタ変数
    S[++top] = x;
}

int pop() {
    // topを一つ落とす
    top--;
    // topが指していた要素を返す
    return S[top+1];
}

int main() {
    int a, b;
    top = 0;
    char s[100];

    while (scanf("%s", s) != EOF) {
        if (s[0]=='+') {
            a = pop();
            b = pop();
            push(b+a);
        }
        else if (s[0]=='-') {
            a = pop();
            b = pop();
            push(b-a);
        }
        else if (s[0]=='*') {
            a = pop();
            b = pop();
            push(b*a);            
        }
        else {
            push(atoi(s));
        }
    }

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

    return 0;
}


Measured memory_bytes: 2112
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
using namespace std;
template <typename T = int>
T in() {
    T temp;
    cin >> temp;
    return temp;
}


int main() {
    int N(in()), M(in()), C(in());
    int B[M];

    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }

    int count = 0;
    for (int i = 0; i < N; i++) {
        int sum = 0;
        for (int j = 0; j < M; j++) {
            int temp(in());
            sum += (temp*B[j]);
        }
        if ((sum + C) > 0) count++;
    }
    cout << count << endl;
    return 0;
}




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

#define REP(i, a, b) for (int i = int(a); i < int(b); i++)
#define dump(val) cerr << __LINE__ << ":\t" << #val << " = " << (val) << endl

using namespace std;

typedef long long int lli;

template<typename T>
vector<T> make_v(size_t a, T b) {
    return vector<T>(a, b);
}

template<typename... Ts>
auto make_v(size_t a, Ts... ts) {
    return vector<decltype(make_v(ts...))>(a, make_v(ts...));
}

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

Measured memory_bytes: 256
n = int(input())
seeds = 'ATCG'
def ng(currents):
  v = 'AGC' in currents
  for k in range(max(1, len(currents) - 3), len(currents)):  # 先頭の方はチェック済み
    v = v or 'AGC' in (currents[:k-1] + currents[k] + currents[k-1] + currents[k+1:])
  return v

memo = {}  # 今の長さと最新4つだけメモする
def f(index, currents):
  key = '%d:%s' % (index, currents[-4:])
  if key not in memo:
    if ng(currents):
      memo[key] = 0
    else:
      memo[key] = 1 if index == n else sum([f(index+1, currents + s) for s in seeds])
  return memo[key]

print(f(0, '') % int(1e9+7))


Measured memory_bytes: 7616
def solve():

    s = input()
    mod = 2019
    remains = [0]*mod

    ans = 0
    now = 0
    remains[0] = 1
    for i, val in enumerate(s[::-1]):
        now += int(val) * pow(10, i, mod)
        now %= mod
        ans += remains[now]
        remains[now] += 1

    print(ans)


if __name__ == "__main__":
    solve()


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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin >> n;
	if (n % 10 == 3) {
		cout << "bon" << endl;
	}
	else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {
		cout << "pon" << endl;
	}
	else {
		cout << "hon" << endl;
	}

	return 0;
}


Measured memory_bytes: 3608
N, x = map(int, input().split())
A = list(map(int, input().split()))
pre_a = 0
ans = 0
for a in A:
  if a > x - pre_a:
    ans += a - (x - pre_a)
    pre_a = x - pre_a
  else:
    pre_a = a

print(ans)

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

using namespace std;

template <unsigned long long MOD = 1000000007, unsigned long long base = 2009>
struct RollingHash {
	vector<unsigned long long> hash, power;

	RollingHash() {}
	RollingHash(const string& s) {
		int n = s.size();
		hash.assign(n + 1, 0);
		power.assign(n + 1, 1);
		for (int i = 0; i < n; ++i) {
			hash[i + 1] = (hash[i] * base + s[i]) % MOD;
			power[i + 1] = power[i] * base % MOD;
		}
	}
	RollingHash(vector<unsigned long long> si) {
		int n = si.size();
		hash.assign(n + 1, 0);
		power.assign(n + 1, 1);
		for (int i = 0; i < n; ++i) {
			hash[i + 1] = (hash[i] * base + si[i]) % MOD;
			power[i + 1] = power[i] * base % MOD;
		}
	}
	
	unsigned long long get(int l, int r) {
		unsigned long long res = hash[r] + MOD - hash[l] * power[r - l] % MOD;
		return res - (res >= MOD ? MOD : 0);
	}

	int LCP(const RollingHash<MOD, base>& b, int l1, int r1, int l2, int r2) {
		int len = min(r1 - l1, r2 - l2);
		int low = -1, high = len + 1;
		while (high - low > 1) {
			int mid = (low + high) / 2;
			if (get(l1, l1 + mid) == b.get(l2, l2 + mid)) low = mid;
			else high = mid;
		}
		return low;
	}
};

template <unsigned long long MOD, unsigned long long base1, unsigned long long base2>
vector<vector<unsigned long long> > RollingHash_2d(vector<string> &T, int r, int c) {
	vector<RollingHash<MOD, base1> > rhs;
	for (string s : T) rhs.push_back(s);
	int h = T.size(), w = T[0].size();
	vector<vector<unsigned long long> > res(h - r + 1, vector<unsigned long long>(w - c + 1));

	for (int j = 0; j + c <= w; ++j) {
		vector<unsigned long long> si(h);
		for (int i = 0; i < h; ++i) si[i] = rhs[i].get(j, j + c);
		RollingHash<MOD, base2> rh(si);
		for (int i = 0; i + r <= h; ++i)
			res[i][j] = rh.get(i, i + r);
	}
	return res;
}

int main() {
	int H, W; cin >> H >> W;
	vector<string> T(H);
	for (string& s : T) cin >> s;
	int R, C; cin >> R >> C;
	vector<string> P(R);
	for (string& s : P) cin >> s;
	const unsigned long long mod = 1000000007,
		base1 = 1007, base2 = 2009;
	auto trh = RollingHash_2d<mod, base1, base2>(T, R, C);
	auto prh = RollingHash_2d<mod, base1, base2>(P, R, C);
	for (int i = 0; i < H - R + 1; ++i)
		for (int j = 0; j < W - C + 1; ++j)
			if (trh[i][j] == prh[0][0]) printf("%d %d\n", i, j);

	return 0;
}


Measured memory_bytes: 27364
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}

func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}

func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	p := iSScan(n)
	q := make([]int, n)
	copy(q, p)
	sort.Ints(q)
	c := 0
	for i, v := range p {
		if v != q[i] {
			c++
		}
	}
	if c <= 2 {
		fmt.Println("YES")
	} else {
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1780
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import qualified Data.IntMap as IM
import Text.Printf
import Test.HUnit

main :: IO ()
-- main = runTestTT (TestList tests) >> return ()
main = do
  n <- getl toInt
  xs <- rgetl n toDbl
  mapM_ disp $ solve xs

solve :: [Double] -> [(Int,Int)]
solve xs = IM.assocs $ count xs

disp :: (Int,Int) -> IO ()
disp (i,j) = printf "%d:%s\n" i (replicate j '*')

judge :: Double -> Int
judge x
  | x < 165.0 = 1
  | x < 170.0 = 2
  | x < 175.0 = 3
  | x < 180.0 = 4
  | x < 185.0 = 5
  | otherwise = 6

count :: [Double] -> IM.IntMap Int
count = foldl f imp
  where
    imp = IM.fromList [(i,0)| i <- [1..6]]
    f mp h = IM.insertWith (+) (judge h) 1 mp

toInt :: String -> Int
toInt s = read s

toDbl :: String -> Double
toDbl s = read s

getl :: (String -> a) -> IO a
getl f = f <$> getLine

rgetl :: Int -> (String -> a) -> IO [a]
rgetl n f = map f <$> replicateM n getLine

Measured memory_bytes: 4244
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <ctime>
#include <limits.h>
#define N 200005

using namespace std;

int n;
int x[N], y[N];
int Rmax, Rmin, Bmax, Bmin;
long long ans = 1e18;

inline void cmin(int &u, int v) { if(u > v) u = v; }
inline void cmax(int &u, int v) { if(u < v) u = v; }
inline void read(int &x) {
	x = 0; char ch = getchar();
	while(!isdigit(ch)) ch = getchar();
	while(isdigit(ch)) x = x * 10 + ch - '0', ch = getchar();
}

inline long long judge(int x, int y) {
	static int trmax, trmin, tbmax, tbmin;
	trmax = max(x, Rmax), trmin = min(x, Rmin);
	tbmax = max(y, Bmax), tbmin = min(y, Bmin);
	return 1ll * (trmax - trmin) * (tbmax - tbmin);
}
inline void change(int x, int y) {
	cmax(Rmax, x), cmin(Rmin, x);
	cmax(Bmax, y), cmin(Bmin, y);
	return;
}

int main() {
	read(n);
	for(int i = 1; i <= n; ++i)
		read(x[i]), read(y[i]);
	
	srand(time(0));
	int tim = 50;
	while(tim --) {
		Rmax = Bmax = INT_MIN;
		Rmin = Bmin = INT_MAX;
		for(int i = 1; i <= n; ++i) {
			int p = rand() % n + 1;
			swap(x[i], x[p]), swap(y[i], y[p]);
		}
		for(int i = 1; i <= n; ++i) {
			if(judge(x[i], y[i]) < judge(y[i], x[i])) {
				change(x[i], y[i]);
			} else {
				change(y[i], x[i]);
			}
		}
		long long res = 1ll * (Rmax - Rmin) * (Bmax - Bmin);
		if(ans > res) ans = res;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<utility>
#include<cmath>


#define rep(i,x) for(int i=0;i<(int)(x);i++)
#define reps(i,x) for(int i=1;i<=(int)(x);i++)
#define rrep(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(int i=((int)(x));i>0;i--)

#define all(x) (x).begin(),(x).end()
#define SZ(x) ((int)(x).size())
#define INF 2e9

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

using namespace std;

int main()
{
    ll n;
    cin >> n;
    vector<ll> v(n, 0);
    rep(i, n){
        ll tmp;
        cin >> tmp;
        v[tmp]++;
    }

    ll mod = pow(10, 9) + 7;

    int f = 1;
    ll ans;
    if(n % 2 == 1){
        if(v[0] != 1) f = 0;

        rep(i, n){
            if(i != 0 && i % 2 == 0){
                if(v[i] != 2) f = 0;
            }
            if(i % 2 == 1){
                if(v[i] > 0) f = 0;
            }
        }
        if(f == 0){
            ans = 0;
        }else{
            ans = 1;
            rep(j, (n-1)/2){
                ans *= 2;
                ans = ans % mod;
            }
        }
    }else{
        
        rep(i, n){
            if(i % 2 == 0){
                if(v[i] > 0) f = 0;
            }
            if(i % 2 == 1){
                if(v[i] != 2) f = 0;
            }
        }

        if(f == 0){
            ans = 0;
        }else{
            ans = 1;
            rep(i, n/2){
                ans *= 2;
                ans = ans % mod;
            }
        }
    }

    cout << ans;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
int n, t, x;
ll ans, last;
int main() {
	scanf("%d%d", &n, &t);
	ans = t, last = 0;
	for (int i = 0; i < n; ++i) {
		scanf("%d", &x);
		ans += min((ll)t, x - last);
		last = x;
	}
	cout << ans << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<functional>
#include<array>
#include<math.h>
typedef long long ll;
using namespace std;

int main(int argc, char const *argv[])
{
    int X, Y;
    std::cin >> X >> Y;
    
    if (X % Y != 0) {
        std::cout << X << '\n';
    } else {
        std::cout << -1 << '\n';
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

#define N_MAX 100

using namespace std;

char grid[N_MAX][N_MAX];
int row_all_white[N_MAX];
int col_all_white[N_MAX];

int main(){
    int H, W;
    cin >> H >> W;
    for(int i = 0; i < H; i++){
        for(int j = 0; j < W; j++){
            cin >> grid[i][j];
        }
    }

    for(int i = 0; i < H; i++){
        row_all_white[i] = 1;
        for(int j = 0; j < W; j++){
            if(grid[i][j] == '#'){
                row_all_white[i] = 0;
                break;
            }
        }
    }

    for(int i = 0; i < W; i++){
        col_all_white[i] = 1;
        for(int j = 0; j < H; j++){
            if(grid[j][i] == '#'){
                col_all_white[i] = 0;
                break;
            }
        }
    }

    for(int i = 0; i < H; i++){
        if(row_all_white[i] == 0){
            for(int j = 0; j < W; j++){
                if(col_all_white[j] == 0){
                    cout << grid[i][j];
                }
            }
            cout << '\n';
        }
    }
    return 0;

}

Measured memory_bytes: 256
N, M = map(int, input().split())
bridges = []
for i in range(0, M):
	bridges.append(list(map(lambda v: int(v)-1, input().split())))
bridges.reverse()
grp = []
counters = []
for i in range(0, N):
	grp.append(i)
	counters.append(1)
ans = [(N*(N-1))//2]
for i in range(0, M):
	rootA = bridges[i][0]
	que1 = []
	sum1 = 0
	while True:
		if grp[rootA] == rootA:
			break
		sum1 += counters[rootA]
		counters[rootA] = 0
		que1.append(rootA)
		rootA = grp[rootA]
	counters[rootA] += sum1
	L1 = len(que1)
	for j in range(0, L1):
		grp[que1.pop(0)] = rootA
	rootB = bridges[i][1]
	que2 = []
	sum2 = 0
	while True:
		if grp[rootB] == rootB:
			break
		sum2 += counters[rootB]
		counters[rootB] = 0
		que2.append(rootB)
		rootB = grp[rootB]
	counters[rootB] += sum2
	L2 = len(que2)
	for j in range(0, L2):
		grp[que2.pop(0)] = rootB
	if rootA == rootB:
		ans.append(ans[-1])
	else:
		ans.append(ans[-1]-(counters[rootA])*(counters[rootB]))
		counters[rootB] += counters[rootA]
		counters[rootA] = 0
		grp[rootA] = rootB
ans.reverse()
for i in range(0, M):
	print(ans[i+1])

Measured memory_bytes: 84056