akhauriyash/Code-Regression huggingface dataset:
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
typedef long long int lld;

const lld N = 200043;
const lld MOD = 1000000007;

lld add(lld x, lld y)
{
    x += y;
    while(x >= MOD) x -= MOD;
    while(x < 0) x += MOD;
    return x;
}

lld mul(lld x, lld y)
{
    return (x * 1ll * y) % MOD;
}

lld binpow(lld x, lld y)
{
    lld z = 1;
    while(y)
    {
        if(y & 1) z = mul(z, x);
        x = mul(x, x);
        y >>= 1;
    }
    return z;
}

lld inv(lld x)
{
    return binpow(x, MOD - 2);
}

lld divide(lld x, lld y)
{
    return mul(x, inv(y));
}

// Combinations

/*
lld fact[N];

void precalc()
{
    fact[0] = 1;
    for(lld i = 1; i < N; i++)
        fact[i] = mul(fact[i - 1], i);
}

lld C(lld n, lld k)
{
    return divide(fact[n], mul(fact[k], fact[n - k]));
}
*/
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t,i,j;
    t=1;
    while(t--)
    {
        lld n,k;
        cin>>n>>k;
        set<lld>s;
        for(i=0;i<k;i++)
        {
            lld a;
            cin>>a;
            for(j=0;j<a;j++)
            {
                lld b;
                cin>>b;
                s.insert(b);
            }
        }
        cout<<n-s.size()<<endl;
    }
}


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

#define N 200000
#define L 10

int compare(const void *a, const void *b) {
	char *s = *(char **) a;
	char *t = *(char **) b;

	return strcmp(s, t);
}

int main() {
	static char s[L + 1], *ss[N];
	int n, i, j, k;

	scanf("%d", &n);
	for (i = 0; i < n; i++) {
		scanf("%s", s);
		ss[i] = strdup(s);
	}
	qsort(ss, n, sizeof *ss, compare);
	k = 0;
	for (i = 0; i < n; ) {
		j = i + 1;
		while (j < n && strcmp(ss[j], ss[i]) == 0)
			j++;
		if (k < j - i)
			k = j - i;
		i = j;
	}
	for (i = 0; i < n; ) {
		j = i + 1;
		while (j < n && strcmp(ss[j], ss[i]) == 0)
			j++;
		if (j - i == k)
			printf("%s\n", ss[i]);
		i = j;
	}
	return 0;
}


Measured memory_bytes: 9708
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
using P = pair<int, int>;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

signed main(){
	int n,m;
	cin >> n >> m;
	int c[m];
	rep(i,m){
		cin >> c[i];
	}
	vector<vector<int>> dp(m + 1, vector<int>(n + 1, INF));
	dp[0][0] = 0;
	for(int i = 0; i < m; i++){
		for(int j = 0; j <= n; j++){
			dp[i + 1][j] = min(dp[i + 1][j], dp[i][j]);
			if(j - c[i] < 0) continue;
			dp[i + 1][j] = min(dp[i + 1][j], dp[i + 1][j - c[i]] + 1);
		}
	}
	cout << dp[m][n] << endl;
	return 0;
}


Measured memory_bytes: 7124
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
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; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  string s;cin>>s;
  for(int i=s.size()-1;i>0;i--){
    if(s[i]=='C'){
      if(s[i-1]=='B'){
        s.erase(s.begin()+i);
        i--;
        s[i]='D';
      }
    }
  }
  ll c=0LL,cnt=0LL;
  rep(i,s.size()){
    if(s[i]=='A')cnt++;
    else if(s[i]=='D')c+=cnt;
    else cnt=0;
  }
  cout<<c;
}

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

// iterator
#define REP(i,from, to) for(lli i=from;i<to;i++)
#define REPE(i,from, to) for(lli i=from;i<=to;i++)
#define REP_R(i,from, to) for(lli i=from;i>to;i--)
#define REPE_R(i,from, to) for(lli i=from;i>=to;i--)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define cout2(x, y)      cout << #x << ": " << x << ", " << #y << ": " << y << endl;
#define cout3(x, y, z)   cout << #x << ": " << x << ", " << #y << ": " << y << ", " << #z << ": " << z << endl;;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

#define coutp(p)         cout << #p << ":" <<  " (" << p.first << ", " << p.second << ")" << endl;

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;
typedef tuple<lli, lli, lli> tup;
typedef vector<lli> vlli;

int main() {
    lli n;
    cin1(n);

    lli a[n];
    ncin1(n,a);

    //bool fist_is_plus;
    //if (a[0] > 0) {
    //    fist_is_plus = true;
    //}
    //else if (a[0] < 0) {
    //    fist_is_plus = false;
    //}
    //else {
    //    lli x = -1;
    //    REP(i,1,n) {
    //        if (a[i] !=0) {
    //            x = i;
    //            break;
    //        }
    //    }
    //    if (x == -1) {
    //        // すべてゼロ
    //        a[0]++;
    //        fist_is_plus = true;
    //    }
    //    else {
    //        if (x % 2 == 1) {
    //            a[0] = -1;
    //            fist_is_plus = false;
    //        }
    //        else {
    //            a[0] = 1;
    //            fist_is_plus = true;
    //        }
    //    }
    //}

    //bool need_plus = !fist_is_plus;

    lli sum = 0;
    lli ans = 0;
    bool need_plus = true;
    REP(i,0,n) {
        sum += a[i];
        if (need_plus) {
            if (sum <= 0) {
                ans += (-sum) + 1;
                sum = 1;
            }
        }
        else {
            if (sum >= 0) {
                ans += sum + 1;
                sum = -1;
            }
        }
        need_plus = !need_plus;
    }
    sum = 0;
    lli ans2 = 0;
    need_plus = false;
    REP(i,0,n) {
        sum += a[i];
        if (need_plus) {
            if (sum <= 0) {
                ans2 += (-sum) + 1;
                sum = 1;
            }
        }
        else {
            if (sum >= 0) {
                ans2 += sum + 1;
                sum = -1;
            }
        }
        need_plus = !need_plus;
    }
    cout << min(ans, ans2) << endl;

}


Measured memory_bytes: 1024
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            answer=x,y,z
            break
    else:
        continue
    break
print(*answer)

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

int main() {
    string s1,s2,s3;
    cin >> s1 >> s2 >> s3;
    if(s1.at(s1.size()-1) == s2.at(0) && s2.at(s2.size()-1) == s3.at(0)) cout << "YES" << endl;
    else cout << "NO" << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;




public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {
    	Scanner sc=new Scanner(System.in);

    	int N=sc.nextInt();
    	int M=sc.nextInt();

    	int[][] pos=new int[N][2];

    	for(int i=0;i<N;i++) {
    		pos[i][0]=sc.nextInt();
    		pos[i][1]=sc.nextInt();
    	}

    	int[][] checkpoints=new int[M][2];

    	for(int i=0;i<M;i++) {
    		checkpoints[i][0]=sc.nextInt();
    		checkpoints[i][1]=sc.nextInt();
    	}

    	int man=0;
    	for(int i=0;i<N;i++) {
    		int min=999999999;
    		int index=-1;

    		for(int j=0;j<M;j++) {
    			man=getmanhattan(pos[i][0], pos[i][1], checkpoints[j][0], checkpoints[j][1]);
    			if(min>man) {
    				min=man;
    				index=j+1;
    			}
    		}

    		System.out.println(index);
    	}



    }

    static int getmanhattan(int x,int y,int x2,int y2) {

    	return Math.abs(x2-x)+Math.abs(y2-y);

    }

}



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

using namespace std;

void euclidean(int &a, int &b, int &x0, int &x1 , int &y0, int &y1) {
    if (a != 0 && b != 0) {
        if (a > b) {
            x0 -= a/b*x1;
            y0 -= a/b*y1;
            a %= b;
            //cout << x0 << " " << x1 << " " << y0 << " " << y1 << " " << a << " " << b << endl;
            return euclidean(a, b, x0, x1, y0, y1);
        }
        if (b > a) {
            x1 -= b/a*x0;
            y1 -= b/a*y0;
            b %= a;
            //cout << x0 << " " << x1 << " " << y0 << " " << y1 << " " << a << " " << b << endl;
            return euclidean(a, b, x0, x1, y0, y1);
        }
        if (a == b) {
            x1 = 0; x1 = 0; y0 = 1; y1 = 1;
            a %= b;
        }
    }
}

int main() {
    int a, b; cin >> a >> b;
    int x0 = 1, y1 = 1, x1 = 0, y0 = 0;
    euclidean(a, b, x0, x1, y0, y1);
    if (a == 0) cout << x1 << " " << y1;
    if (b == 0) cout << x0 << " " << y0;
    cout << endl;
}


Measured memory_bytes: 3100
#include<stdio.h>
#define MAX 100005
#define NIL -1


typedef struct{
  int p;
  int l;
  int r;
}node;

  node T[MAX];
int n,D[MAX];

void disp(int u){

  int i,c;

  printf("node %d: parent = %d, depth = %d, ",u,T[u].p,D[u]);

  if(T[u].p==NIL)printf("root, ");
  else if(T[u].l==NIL)printf("leaf, ");
  else{printf("internal node, ");}

  printf("[");
  for(i=0,c=T[u].l;c!=NIL;i++,c=T[c].r){
    if(i)printf(", ");
    printf("%d",c);
  }

  printf("]\n");
  }

int deps(int u,int p){
  D[u]=p;
  if(T[u].r!=NIL)deps(T[u].r,p);
  if(T[u].l!=NIL)deps(T[u].l,p+1);
  return 1;
}
 
int main(){

  int i,j,d,v,c,l,r;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    T[i].p=NIL;
    T[i].l=NIL;
    T[i].r=NIL;
  }

  for(i=0;i<n;i++){

    scanf("%d%d",&v,&d);
    for(j=0;j<d;j++){

      scanf("%d",&c);

      if(j==0)T[v].l=c;
      else {T[l].r=c;}
      l=c;
      T[c].p=v;

    }
  }

  for(i=0;i<n;i++){
    if(T[i].p==NIL)r=i;
  }

  deps(r,0);

  for(i=0;i<n;i++){
    disp(i);
  }

  return 0;

}


Measured memory_bytes: 6412
#pragma comment (linker, "/STACK:256000000")
#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <cstring>
#include <queue>
#include <stack>
#include <math.h>
#include <iterator>
#include <vector>
#include <string>
#include <set>
#include <math.h>
#include <iostream>
#include <random>
#include<map>
#include <iomanip>
#include <time.h>
#include <stdlib.h>
#include <list>
#include <typeinfo>
#include <list>
#include <set>
#include <cassert>
#include<fstream>
#include <unordered_map>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <bitset>
using namespace std;
typedef string::const_iterator State;
#define Ma_PI 3.141592653589793
#define eps 1e-5
#define LONG_INF 2000000000000000000LL
#define GOLD 1.61803398874989484820458
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL
#define MOD 998244353LL
#define seg_size 262144*2
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long a = 0;a < b;++a)
#define ALL(x) (x).begin(),(x).end()
void init() {
    iostream::sync_with_stdio(false);
    cout << fixed << setprecision(20);
}

long double seg_tree[seg_size * 4];
long double seg_find(long long now, ll n_l, ll n_r, ll w_l, ll w_r) {
    if (w_l <= n_l && n_r <= w_r) return seg_tree[now];
    if (w_r <= n_l || n_r <= w_l) return 1;
    return seg_find(now * 2, n_l, (n_l + n_r) / 2, w_l, w_r) * seg_find(now * 2 + 1, (n_l + n_r) / 2,n_r,w_l, w_r);
}
long double seg_merge(long long now) {
    seg_tree[now] = seg_tree[now * 2] * seg_tree[now * 2 + 1];
    if (now != 1) seg_merge(now / 2);
    return 0;
}
void solve(){
    REP(i, seg_size * 4) {
        seg_tree[i] = 1.0;
    }
    int n;
    cin >> n;
    vector<pair<ll, ll>> earthquake;
    map<int, int> zip;
    REP(i, n) {
        int a, b;
        cin >> a >> b;
        earthquake.pb(mp(a, b));
        zip[a] = 1;
    }
    vector<pair<ll, ll>> query;
    int qu;
    cin >> qu;
    REP(i, qu) {
        int a, b;
        cin >> a >> b;
        query.push_back(mp(a, b));
        zip[a] = 1;
        zip[b] = 1;
    }
    int now_itr = 0;
    for (auto x = zip.begin(); x != zip.end();++x) {
        x -> second = now_itr;
        now_itr++;
    }
    REP(i, earthquake.size()) {
        earthquake[i].first = zip[earthquake[i].first];
        seg_tree[seg_size + earthquake[i].first] = (long double)((10 - earthquake[i].second)) / 10.0;
        seg_merge((seg_size + earthquake[i].first) / 2);
    }
    REP(i, query.size()) {
        query[i].first = zip[query[i].first];
        query[i].second = zip[query[i].second];
        long double ans = seg_find(1, 0, seg_size, query[i].first, query[i].second);
        ans *= (long double)1e9;
        cout << ans << endl;
    }
}
int main() {
    init();
    solve();
}


Measured memory_bytes: 52728
#include<bits/stdc++.h>
#define pr(x) cerr << "\n" << (#x) << " is " << (x) << endl
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define ull unsigned long long
#define Toggle(n,i) (n^(1<<i))
#define Check(n,i) (n&(1<<i))
#define Set(n,i) (n|(1<<i))
#define Reset(n,i) (n&(~(1<<i)))
#define fo(i,x,y) for(int i=(x);i<=(y);++i)
#define me(arr,val) memset(arr,val,sizeof arr)
#define inf 10e8
#define infl LLONG_MAX
#define mod 1000000007
#define f first
#define s second
#define  g(t,a)  (get<a>(t))
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
//int dx[]={+1,-1,0,0};//vertical horizontal
//int dy[]={0,0,+1,-1};//vertical horizontal
//int dx[]={+1,+1,-1,-1,+2,-2,+2,-2};//knights move
//int dy[]={+2,-2,+2,-2,+1,+1,-1,-1};//knights move
//int dx[]={+1,-1,0,0,+1,+1,-1,-1};//vertical horizontal diagonal
//int dy[]={0,0,+1,-1,-1,+1,+1,-1};//vertical horizontal diagonal
using namespace std;
using namespace __gnu_pbds;
/*typedef tree<int, null_type,less<int>, rb_tree_tag,
             tree_order_statistics_node_update>indexed_set;
for set use above*/
typedef tree<pair<int,int>, null_type,less_equal<pair<int, int>>, rb_tree_tag,
tree_order_statistics_node_update> indexed_multiset;


int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    int d=a-b;
    if(c-d<=0)
    {
        printf("0");
    }
    else
    {
        printf("%d",c-d);
    }
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
// std::cout << std::setprecision(2) << 3.141; // "3.1"
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <map>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef pair<double, ll> pdlg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
typedef tuple<double, double, double> tddd;

static const int giga = pow(10,9);
// double pi = 3.141592653589793238463;

int main(void){
  int n,m,c;
  cin >> n >> m >> c;
  vector<int> b(m);
  for(int i = 0; i < m; i++){
    int temp;
    cin >> temp;
    b[i] = temp;
  }
  int counter = 0;
  for(int i = 0; i < n; i++){
    long long int ans = 0;
    for(int j = 0; j < m; j++){
      int temp;
      cin >> temp;
      ans += temp*b[j];
    }
    if(ans + c > 0){
      counter++;
    }
  }

  cout << counter << endl;

  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <limits.h>

using namespace std;

int main() {
  int a, b, c;

  cin >> a >> b >> c;

  int ab = abs(a - b);
  int ac = abs(a - c);
  int bc = abs(b - c);

  int ans = INT_MAX;
  ans = min(ans, (ab + ac));
  ans = min(ans, (ab + bc));
  ans = min(ans, (ac + bc));

  cout << ans << endl;
}

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


#define vi vector<int>
#define pb push_back
#define pii pair<int, int>
#define mp make_pair
#define ll long long


int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int h[20];
    int n;

    cin >> n;
    for ( int i = 0; i < n; i++ ) cin >> h[i];

    int qnt = 1;
    for ( int i = 1; i < n; i++ ) {
    	bool pos = true;
    	for ( int j = 0; j < i; j++ ) {
    		if ( h[j] > h[i] ) {
    			pos = false;
    			break;
    		}
    	}
    	if ( pos ) {
    		qnt++;
    	}
    }

    cout << qnt << endl;


    return 0;
}


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

int main()
{
	auto pow_mod = [](int64_t a, int64_t n, int64_t mod) {
		int64_t r = 1;
		for (; n; n >>= 1)
		{
			if (n & 1)
			{
				(r *= a) %= mod;
			}
			(a *= a) %= mod;
		}
		return r;
	};
	int h, w, k;
	int64_t mod = 1000000007;
	cin >> h >> w >> k;
	int64_t dp[h + 1][w]{}; //dp[i][j] := i回選択したとき、jにいる通り数
	dp[0][0] = 1;
	int64_t dp2[w + 1]{}; //dp2[i] := 長さiの区間を、2つ以上連続せずに選ぶ通り数
	dp2[0] = 1;
	{
		int64_t dp3[w + 1][2]{}; //dp3[i][j] := 長さiの区間を、2つ以上連続せずに選ぶ通り数(j==0の時iを選ばない、j==1の時選ぶ)
		dp3[0][0] = 1;
		for (int i = 0; i < w; i++)
		{
			for (int j = 0; j < 2; j++)
			{
				(dp3[i + 1][0] += dp3[i][j]) %= mod;
				if (j == 0)
				{
					(dp3[i + 1][1] += dp3[i][j]) %= mod;
				}
			}
			dp2[i + 1] = (dp3[i + 1][0] + dp3[i + 1][1]) % mod;
		}
	}
	for (int i = 0; i < h; i++)
	{
		for (int j = 0; j < w; j++)
		{
			if (j)
			{
				(dp[i + 1][j - 1] += dp[i][j] * dp2[max(0, j - 2)] % mod * dp2[max(0, w - j - 2)] % mod) %= mod;
			}
			if (j + 1 != w)
			{
				(dp[i + 1][j + 1] += dp[i][j] * dp2[max(0, j - 1)] % mod * dp2[max(0, w - j - 3)] % mod) %= mod;
			}
			(dp[i + 1][j] += dp[i][j] * dp2[max(0, j - 1)] % mod * dp2[max(0, w - j - 2)] % mod) %= mod;
		}
	}
	cout << dp[h][k - 1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <sstream>
#include <fstream>

#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define cpresent(c, e) (find(all(c), (e)) != (c).end())
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define tr(c, i) for (iter(c) i = (c).begin(); i != (c).end(); ++i)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)

using namespace std;
typedef long long unsigned int ll;

int main() {
  int N, K;
  cin >> N >> K;
  int ans = 0;
  for (int i = 0; i < N; ++i)  {
    int x;
    cin >> x;
    ans += min(2 * x, 2 * abs(K - x));
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

int can[40][40];
int inside[40][40];

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

string answer;

vector<int> v;
int dfs(int x,int y,int hand){
	if(x == 1 && y == 2 ) return 0;
	//cout << x << " " << y << endl;
	
	if( !can[y+dy[hand]][x+dx[hand]] ){
		//v.push_back(hand);
		y += dy[hand];
		x += dx[hand];
		hand = (hand+1)%4;
		
	}
	if( can[y+dy[(hand+3)%4]][x+dx[(hand+3)%4]] ){
		do{
			hand = (hand+1)%4;
		}while(!can[y+dy[hand]][x+dx[hand]]);
		v.push_back(hand);
	}
	v.push_back(hand);
	dfs(x+dx[(hand+3)%4],y+dy[(hand+3)%4],hand);
	
}
int main(){

	for(int i = 0 ; i < 9 ; i++){
		if( i % 2 ){
			for(int j = 0 ; j < 5 ; j++){
				char c;
				cin >> c;
				if( c == '1' ){
					can[1+i/2*3][1+3*j] = 1;
					can[1+i/2*3+1][1+3*j] = 1;
					can[1+i/2*3+2][1+3*j] = 1;
					can[1+i/2*3+3][1+3*j] = 1;
				}
			}
		}else{
			for(int j = 0 ; j < 4 ; j++){
				char c;
				cin >> c;
				if( c == '1' ){
					can[i/2*3+1][1+j*3+0] = 1; 
					can[i/2*3+1][1+j*3+1] = 1;
					can[i/2*3+1][1+j*3+2] = 1;  
					can[i/2*3+1][1+j*3+3] = 1; 
				}
			}
		}
	}
	dfs(1,0,0);
	v.push_back(-1);
	int idx = 0;
	for(int i = 1 ; i < v.size() ; i++){
		if( v[i] != v[i-1] ){
			int len = (i - idx);
			//cout << len << endl;
			cout << string((len+1)/3,"RDLU"[v[idx]]);
			idx = i;
		}
	}
	cout << endl;
	
}
/*
RRRRRDDDDDLLLLUUUURRRDDDLLUURULLDDDRRRUUUULLLL
RRRRDDDDLLLUUURRDDLURULLDDDRRRUUUULLLL
*/

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

int compare_int(const void *a, const void *b){
    return *(int*)a - *(int*)b;
}

int main(){
    int n, cnt=1, d[100] = {0};

    scanf("%d", &n);
    for(int i=0; i<n; i++){ scanf("%d", &d[i]); }
    qsort( d, n, sizeof(int), compare_int );
    
    for(int i=0; i<n-1; i++){
        if( d[i] != d[i+1] ){ cnt++; }
    }
    printf("%d\n", cnt);

    return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define Rep(i,N) for(int i = 0; i < N; i++)
typedef pair<int,int> Pi;
#define F first
#define S second
#define pb push_back
#define INF 1 << 28

inline void chmin(int &a,int b) {
  a = min(a,b);
}

inline void chmax(int &a,int b) {
  a = max(a,b);
}

int W, H;
int mas[100][100];
int mx[] = {1,0,-1,0};
int my[] = {0,1,0,-1};

int dfs(int y, int x)
{
  int ret = 0;
  Rep(i,4) {
    int nx = x + mx[i];
    int ny = y + my[i];
    if(nx >= 0 && ny >= 0 && nx < W && ny < H && mas[ny][nx] == 1) {
      mas[ny][nx] = 0;
      chmax(ret,dfs(ny,nx) + 1);
      mas[ny][nx] = 1;
    }
  }
  return ret;
}

int main()
{
  while(cin >> W >> H, W || H) {
    int maxv = 0;
    Rep(i,H) Rep(j,W) cin >> mas[i][j];
    Rep(i,H) Rep(j,W) {
      if(mas[i][j] == 1) {
	mas[i][j] = 0;
	chmax(maxv,dfs(i,j) + 1);
	mas[i][j] = 1;
      }
    }
    cout << maxv << endl;
  }
  return 0;
}

Measured memory_bytes: 3112
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
#include<cstring>
#include<math.h>
#include<bitset>
#include<queue>
#include<set>
#include<iomanip>
#include<math.h>
#include<assert.h>
#include<string>
#include<cstdlib>
#include<cctype>
#include<unordered_map>
#include<sstream>
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1LL << 60;
const double INFD = 1e100;
const ll mod = 1000000007;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -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やllをstringに変換
template<typename T> inline string toString(const T &a){
  ostringstream oss;
  oss << a;
  return oss.str();
};
// ----------------------------------------------------------------------------

int main(){
  ll H;
  cin >> H;
  ll sum = 0;
  ll cnt = 0;
  while(H){
    cnt++;
    H /= 2;
  }
  for(int i=0; i<cnt; i++){
    sum += pow(2,i);
  }
  cout << sum << endl;
  return 0;
}


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int i,j,k,n,m,a[210001],t1,t2;
bool check(int x1,int x2,int v1,int v2){
	int i,j,k;
	if (v1==v2){
		if (v1==n-1) return 1;
		return n>=2*v1;
	}else{
		if (v2<x1+1) return 0;
		k=v2-x1;
		return x2>=2*k;
	}
}
int main(){
	scanf("%d",&n);
	for (i=1,t1=n+1,t2=0;i<=n;i++) scanf("%d",&a[i]),t1=min(t1,a[i]),t2=max(t2,a[i]);
	if (t1+1<t2){
		puts("No");return 0;
	}
	for (i=1,j=k=0;i<=n;i++){
		if (a[i]==t1) j++;
		if (a[i]==t2) k++;
	}
	puts(check(j,k,t1,t2)?"Yes":"No");
	return 0;
}

Measured memory_bytes: 512
#include <vector>
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <numeric>
#include <cstdlib>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define SORT(c) sort((c).begin(),(c).end())

int main(){
  ll N, M;
  cin >> N >> M;

  cout << abs(N-2) * abs(M-2) << endl;
}


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

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main() {
  string S;
  cin >> S;
  long long K;
  cin >> K;

  for (int i=0 ; i<K ; i++) {
    if (S[i] != '1') {
      cout << S[i] << endl;
      return 0;
    }
  }
  cout << '1' << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int gcd(int x,int y){
    if(y==0)return x;

    return gcd(y,x%y);
}
int lcm(int x,int y){
    return x*y/gcd(x,y);
}

int ctoi(char c) {
	if (c >= '0' && c <= '9') {
		return c - '0';
	}
	return 0;
}

int main()
{

    int N,M,a[60]={},b[60]={},c[60]={},d[60]={},ans[60]={};
    cin>>N>>M;

    for(int i=1;i<=N;i++){
        cin>>a[i]>>b[i];
    }
    for(int i=1;i<=M;i++){
        cin>>c[i]>>d[i];
    }

    for(int i=1;i<=N;i++){
        //学生ループ
        int min = INT_MAX;
        int diff=0;

        for(int j=M;j>0;j--){
            diff=abs(a[i]-c[j])+abs(b[i]-d[j]);
            if(min>=diff){
                min=diff;
                ans[i]=j;
            }
        }
        cout<<ans[i]<<endl;
    }

    
    return 0;
}

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

using namespace std;
typedef long long int ll;

int main()
{
   int N;
   cin >> N;
   vector<int>A(N);
   for(int i = 0; i < N;i++) cin >> A[i];
   sort(A.rbegin(),A.rend());
   ll ans = 0;
   int t = N-1;
   for(int i = 0; i < N; i++)
   {
       int lim = 2;
       if(i == 0) lim = 1;
       for(int j = 0; j < lim; j++)
       {
           if(t > 0)
           {
               ans += A[i];
               t--;
           }
       }
   }
   cout << ans << endl;
   return 0;
}

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

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

    ll ans = a * c; 

    if(a * d >= ans) ans = a * d;

    if(b * c >= ans) ans = b * c;

    if(b * d >= ans) ans = b * d;

    cout << ans << endl;

    return 0;
}


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

#define rep(i, n) for ( ll i = 0; i < (n); ++i )
#define reps(i, n) for ( ll i = 1; i <= (n); ++i )
#define _rep(i, n) for ( ll i = (n) - 1; i >= 0; --i )
#define _reps(i, n) for ( ll i = n; i > 0; --i )
#define all(x) (x).begin(), (x).end()
#define _all(x) (x).rbegin(), (x).rend()

using namespace std;
using ll =  long long;
using P = pair<ll, ll>;

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

	ll y = 100;
	ll n = 0;

	while ( y < x ) {
		y *= 1.01;
		n++;
	}

	cout << n << endl;

	return 0;
}


Measured memory_bytes: 3636
N, A, B = map(int,input().split())
list = [0] * 5
ans_list = []

for i in range(N):
    i += 1
    i = str(i)
    for j in range(len(i)):
        list[j] = (int(i[j]))
    result = sum(list)
    if result >= A and result <= B:
        ans_list.append(int(i))
     
print(sum(ans_list))

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

int main(){
    int a,b;
    cin >> a >> b;
    cout << ((a+b)%3==0||a%3==0||b%3==0?"Possible":"Impossible") << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int[][] mat_A = new int[n][m];
		int[] mat_B = new int[m];
		int[] mat_C = new int[n];

		for(int i = 0; i<n; i++){
			for(int j = 0;j<m;j++){
				int mat_element = sc.nextInt();
				mat_A[i][j] = mat_element;
			}
		}

		for(int i=0;i<m;i++){
			int mat_element2 = sc.nextInt();
			mat_B[i] = mat_element2;
		}

		for(int i = 0;i<n; i++){
			for(int j = 0; j<m; j++){
				mat_C[i] += mat_A[i][j] * mat_B[j];
			}
		}

		for(int i = 0; i<mat_C.length; i++){
			System.out.println(mat_C[i]);
		}
	}
}



Measured memory_bytes: 40600
#include<algorithm>
#include<iostream>
#include<queue>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
const ll INF = 1000000000000000000;

const int fact_idx_max = 1000010 * 2;
const long long big_prime = 1000000007;

long long fact_P[fact_idx_max + 1], fact_M[fact_idx_max + 1];

long long calc_sq(long long x) {
	x = x % big_prime;
	return (x * x) % big_prime;
}

//a^b
long long calc_pow(long long a, long long b) {
	long long ret;
	if (b == 0)return 1;
	if (b == 1)return a;
	if (b % 2 == 0) {
		ret = calc_sq(calc_pow(a, b / 2));
		return ret % big_prime;
	}
	if (b % 2 == 1) {
		ret = a * calc_sq(calc_pow(a, b / 2));
		return ret % big_prime;
	}
}

void make_fact(long long n) {
	fact_P[0] = fact_M[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact_P[i] = (fact_P[i - 1] * i) % big_prime;
		fact_M[i] = (fact_M[i - 1] * calc_pow(i, big_prime - 2)) % big_prime;
	}
}

//nCr
long long calc_comb(long long n, long long r) {
	long long ret = (((fact_P[n] * fact_M[r]) % big_prime)*fact_M[n - r]) % big_prime;
	return ret;
}

ll r1, c1, r2, c2;
ll ans;

ll f(ll r, ll c) {
	return calc_comb(r+c, r);
}

ll g(ll r, ll c) {
	ll ret = 0;
	for(int i = 0; i<=r; i++){
		ret += f(i+1, c);
		ret %= big_prime;
	}
	return ret;
}

int main() {
	cin >> r1 >> c1 >> r2 >> c2;
    make_fact(fact_idx_max);
	ans = g(r2, c2) - g(r2, c1 - 1) - g(r1 - 1, c2) + g(r1 - 1, c1 - 1);
	ans %= big_prime;
	if(ans < 0) {
		ans += big_prime;
	}
	cout << ans << endl;
}

Measured memory_bytes: 31488
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <queue>
#define ll long long int
#define mod 1000000007
#define pii pair<int, int>
#define fr(n) for (int i = 0; i < n; i++)
#define fr1(n) for (int i = 1; i <= n; i++)
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    int n, a[3] = {}, b;
    cin >> n;
    fr(n) {
        cin >> b;
        if (b % 4 == 0) a[2]++;
        else if (b % 2 == 0) a[1]++;
        else a[0]++;
    }
    if (a[1] == 0) {
        if (a[0] <= a[2] + 1) cout << "Yes";
        else cout << "No";
    } else {
        if (a[0] <= a[2]) cout << "Yes";
        else cout << "No";
    }
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
)

func main() {
	var (
		k int
		s string
	)
	fmt.Scan(&k, &s)

	var wr = bufio.NewWriter(os.Stdout)
	for i := range s {
		if i > k-1 {
			wr.WriteString("...")
			break
		}
		wr.WriteString(string(s[i]))
	}
	wr.WriteString("\n")
	wr.Flush()
}


Measured memory_bytes: 1636
#include <stdio.h>

int main() {
	int N,M;
	scanf("%d %d",&N,&M);
	int check[M+1];
	for (int i = 0; i < M; i++) {
		check[i] = 0;
	}
	int A[N][M+1];
	for (int i = 0; i < N; i++) {
		scanf("%d",&A[i][0]);
		int types=A[i][0];
		for (int j = 1; j < types+1; j++) {
			scanf("%d",&A[i][j]);
		}
		for (int j = 1; j < types+1; j++) {
			int contents=A[i][j];
			check[contents-1] += 1;
		}
	}
	int answer=0;
	for (int i = 0; i < M; i++) {
		//printf("%d ",check[i]);
		if (check[i] == N) answer++;
	}
	printf("%d\n",answer);
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>

using namespace std;

int main(void) {
	string s;
	cin >> s;
	bool f1 = false, f2 = false;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == 'C') {
			f1 = true;
		}
		if (s[i] == 'F'&&f1) {
			f2 = true;
		}
	}
	if (f1&&f2) {
		cout << "Yes";
	}
	else {
		cout << "No";
	}
	return 0;
}

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

int main() {
	int N, K, C;
	string S;
	cin >> N >> K >> C >> S;
	vector<int> V;
	int NOW = 0;
	while (1) {
		if (S[NOW] == 'o') V.push_back(NOW), NOW += C + 1;
		else NOW++;
		if (NOW >= N) break;
	}
	if (V.size() > K) {
		return 0;
	}
	else {
		vector<bool> B(N, false);
		for (int i = 0; i < V.size(); i++) B[V[i]] = true;
		V.clear();
		NOW = N - 1;
		while (1) {
			if (S[NOW] == 'o') V.push_back(NOW), NOW -= C + 1;
			else NOW--;
			if (NOW < 0) break;
		}
		reverse(V.begin(), V.end());
		for (int i = 0; i < V.size(); i++) {
			if (B[V[i]]) cout << V[i] + 1 << endl;
		}
	}
}

Measured memory_bytes: 2552
N = int(input())
S_ord = [ord(i) for i in input()]
S_ord_change = []
for i in S_ord:
    i += N
    if i >= 91:
        i = i - 26
    S_ord_change.append(i)

S_change_chr = [chr(i) for i in S_ord_change]
result = ''.join(S_change_chr)
print(result)

Measured memory_bytes: 9312
input = require('fs').readFileSync('/dev/stdin', 'utf8')
lines = input.split('\n')
N = lines.shift() * 1
A = lines.shift().split(' ')

b = []
for (i=0; i<N; i++) {
    b.push({ i: i + 1, o: A[i] })  
}

b.sort((a, b) => {
    return a.o - b.o
})

console.log(b.map(b => b. i).join(' ')) 

Measured memory_bytes: 35416
#include<iostream>
#include<algorithm>
#include <iostream> 
#include <algorithm> 
#include<string>
#include<queue>
#include<utility>
#include<fstream>
#include<queue>
#include<set>
#include<stack>
#include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define I(a) scanf("%d",&a)
#define I2(a,b) scanf("%d%d",&a,&b)
#define I3(a,b,c) scanf("%d%d%d",&a,&b,&c)
#define L(a) scanf("%lld",&a)
#define L2(a,b) scanf("%lld%lld",&a,&b)
#define L3(a,b,c) scanf("%lld%lld%lld",&a,&b,&c)
#define PI(a) printf("%d",a)
#define PL(a) printf("%lld",a)
#define PT(t) printf("Case %d: ",t)
#define PB push_back
#define x first
#define y second
#define xx first.first
#define xy first.second
#define yx second.first
#define yy second.second
#define SC scanf
#define PC printf
#define NL printf("\n")
#define SET(a) memset(a,0,sizeof a)
#define SETR(a) memset(a,-1,sizeof a)
#define SZ(a) ((int)a.size())-1
#define f(i,a,b) for(int i=a;i<=b; i++)
#define fr(i,a,b) for(int i=a;i<=b; i++)
#define frr(i,a,b) for(int i=a;i>=b; i--)
#define frv(i,a)  for(int i=0;i<a.size();i++)
#define pi 2.0*acos(0.0)
#define R(a) freopen(a, "r", stdin);
#define W(a) freopen(a, "w", stdout);
#define CB(x) __builtin_popcount(x)
#define STN(a) stringtonumber<ll>(a)
#define lol printf("BUG\n")
#define Endl "\n"
#define mk make_pair
using namespace std;
template <class T> inline T BM(T p, T e, T M)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    }
    return (T)ret;
}
template <class T> inline T gcd(T a, T b)
{
    if(b == 0)return a;
    return gcd(b, a % b);
}
template <class T> inline T mdINV(T a, T M)
{
    return BM(a, M - 2, M);
}
template <class T> inline T PW(T p, T e)
{
    ll ret = 1;
    for(; e > 0; e >>= 1)
    {
        if(e & 1) ret = (ret * p);
        p = (p * p);
    }
    return (T)ret;
}
 
 
template <class T>bool ISLEFT(T a, T b, T c)
{
    if(((a.xx - b.xx) * (b.yy - c.yy) - (b.xx - c.xx) * (a.yy - b.yy)) < 0.0)return 1;  //Uporer dike //A,b,c, x okkher ordera sorted
    else return 0;
}
 
 
typedef pair<int,int >P;
//////////////////////////
/////////////////////////
#define mx 100000
int main(){

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

    double ar[n+2];
    ar[0] = 0;
    for(int i=1;i<=n;i++){
        ll x;
        cin>>x;
        ar[i] = ar[i-1] + ((double)(x + 1)/2.0);  
    }

    double ans =0;

    for(int i=1;i<=n-m+1;i++){
        ans= max(ans, ar[i+m-1]- ar[i-1]);
    }
    printf("%.10lf\n",ans);

    return 0;
}

Measured memory_bytes: 1792
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if(a + b == 15){
            System.out.println("+");
        }
        else if(a * b == 15){
            System.out.println("*");
        }
        else {
            System.out.println("x");
        }
    }
}


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

namespace ConsoleApp1
{
    internal class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var As = Console.ReadLine().Split(' ').Select(x=>long.Parse(x)).ToArray();

            var ans = 0L;
            var zero = false;
            var minusCnt = 0;
            foreach (var a in As)
            {    
                if(a == 0)
                {
                    zero = true;
                    break;
                }
                if(a < 0)
                {
                    minusCnt ++;
                }
            }
            if(zero || minusCnt % 2 == 0)
            {

                ans = As.Sum(x => Math.Abs(x));
            }
            else
            {
                var min = long.MaxValue;
                foreach (var a in As)
                {
                    var val =  Math.Abs(a);
                    if (val < min)
                    {
                        min = val;
                    }
                    ans += val;
                }
                ans -= (min * 2);
            }

            Console.WriteLine(ans);
        }
        
    }
}


Measured memory_bytes: 29020
#include <iostream>
using namespace std;
int main(void){
    int A, B, C, D, P, cost_X, cost_Y;
    cin >> A >> B >> C >> D >> P;
    
    cost_X = P*A;
    
    if(P<C){
        cost_Y = B;
    }
    else cost_Y = B + (P-C)*D;
    
    if(cost_X < cost_Y){
        cout << cost_X << endl;
    }
    else cout << cost_Y << endl;
    return 0;
    
}



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

long long count(long long a, long long b){
    long long aNum = 0;
    long long bNum = 0;
    
    while(a > 0){
        a /= 10;
        aNum++;
    }
    
    while(b > 0){
        b /= 10;
        bNum++;
    }
    
    return max(aNum, bNum);
    
}

int main(void){
    // Your code here!
    long n;
    cin >> n;
    
    vector<int> A;
    for(long double i = 1; i <= sqrt(n); i++){
        if(ceil(n / i) == floor(n / i)){
            A.push_back(i);
        }
    }
    
    long long ans = 1e9;
    for(long long i = 0; i < A.size(); i++){
        long long b = n / A[i];
        if(ans > count(A[i], b)){
            ans = count(A[i], b);
        }
    }
    
    cout << ans << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

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

	int N, Q;
	N = sc.nextInt();
	Q = sc.nextInt();
	char S[] = (sc.next()).toCharArray();
	int l[] = new int[Q];
	int r[] = new int[Q];
	for (int i = 0; i < Q; i++) {
	    l[i] = sc.nextInt();
	    r[i] = sc.nextInt();
	}

	int t[] = new int[N];
	t[0] = 0;
	for (int i = 1; i < N; i++) {
	    if (S[i] == 'C' && S[i - 1] == 'A') {
		t[i] = t[i - 1] + 1;
	    } else {
		t[i] = t[i - 1];
	    }
	}

	for (int i = 0; i < Q; i++) {
	    System.out.println(t[r[i] - 1] - t[l[i] - 1]);
	}
	
    }
}

Measured memory_bytes: 81956
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<queue>
#include<iomanip>

#define ll long long

using namespace std;

int main(void) {
	int N, C;
	cin >> N >> C;
	vector<int> s(N), t(N), c(N);
	for (int i = 0; i < N; i++) cin >> s[i] >> t[i] >> c[i];
	vector<vector<int>> rc(C, vector<int>(100002));
	for (int i = 0; i < N; i++) {
		c[i]--;
		rc[c[i]][s[i]]++;
		rc[c[i]][t[i]]--;
	}
	vector<int> r(100002);
	for (int i = 0; i < C; i++) {
		for (int j = 1; j < 100002; j++) {
			if (rc[i][j] == 1) r[j - 1]++;
			if (rc[i][j] == -1) r[j]--;
		}
	}
	int ans = 0;
	int cumsum = 0;
	for (int i = 0; i < 100002; i++) {
		cumsum += r[i];
		ans = max(cumsum, ans);
	}
	cout << ans << endl;
	system("pause");
	return 0;
}

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

#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define ACC(c) (accumulate(ALL(c), 0LL))
#define PRINT(x) cout << (x) << "\n"

using namespace std;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;

inline int std_in(int& a) {return scanf("%d", &a);}
auto pint_compare = [](pint x, pint y) -> bool{return (x.first < y.first);};
const int MOD = 1000000007;

signed main(){
    int a[2], b[2], c[2], d[2];
    cin >> a[0] >> a[1] >> b[0] >> b[1];
    c[0] = b[0] - (b[1] - a[1]);
    c[1] = b[1] + (b[0] - a[0]);
    d[0] = c[0] - (c[1] - b[1]);
    d[1] = c[1] + (c[0] - b[0]);
    cout << c[0] << " " << c[1] << " " << d[0] << " " << d[1] << endl;
    return 0;
}

Measured memory_bytes: 256
''' Hey stalker :) '''
INF = 10**10
def main():
    print = out.append
    ''' Cook your dish here! '''
    n = get_int()
    li = [input() for _ in range(n)]
    cnt = Counter(li)
    st = []
    maxi = max(cnt.values())
    for i in cnt:
        if cnt[i]==maxi: st.append(i)
    st.sort()
    for i in st:
        print(i)


''' Pythonista fLite 1.1 '''
import sys
from collections import defaultdict, Counter
#from bisect import bisect_left, bisect_right
#from functools import reduce
#import math
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda: int(input())
get_list = lambda: list(map(int, input().split()))
main()
#[main() for _ in range(int(input()))]
print(*out, sep='\n')


Measured memory_bytes: 107500
#include <stdio.h>
#define MAX 2000000

int h, a[MAX+1];

void maxHeapify(int);

int main(){
  int i;

  scanf("%d", &h);
  for(i = 1;i <= h;i++){
    scanf("%d", &a[i]);
  }
  for(i = h/2;i >= 1;i--){
    maxHeapify(i);
  }
  for(i = 1;i <= h;i++){
    printf(" %d", a[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int i){
  int l, r, largest, b;

  l = 2 * i;
  r = 2 * i + 1;
  if(l <= h && a[l] > a[i]){
    largest = l;
  }
  else largest = i;
  if(r <= h && a[r] > a[largest]){
    largest = r;
  }
  if(largest != i){
    b = a[i];
    a[i] = a[largest];
    a[largest] = b;
    maxHeapify(largest);
  }
}

Measured memory_bytes: 2552
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
using namespace std;
using namespace __gnu_pbds; 
#define pb          push_back
#define ff          first
#define ss          second
#define ll          int64_t
#define ld          long double
#define mod         1000000007
#define mod2        998244353
#define inf         1000000000000007
#define pi          3.14159265358979323846
#define nl          cout<<"\n"
#define dbg(x)      cerr<<#x<<" = "<<x<<"\n"
#define all(v)      v.begin(),v.end()
#define forn(i,a,b) for(int64_t i=int64_t(a);i<int64_t(b);++i)
#define forb(i,a,b) for(int64_t i=int64_t(a);i>=int64_t(b);--i)
#define fastio()    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

template<typename T,typename U> static inline void amin(T &x,U y)   {if(y<x)x=y;}
template<typename T,typename U> static inline void amax(T &x,U y)   {if(x<y)x=y;}  

ll lcm(ll a,ll b)       {return (a*b)/__gcd(a,b);} 
ll count_digits(ll n)   {ll dig=floor(log10(n)+1);return dig;}
ll mpow(ll x,ll y,ll p) {ll r=1;x=x%p;while(y>0){if(y&1)r=(r*x)%p;y=y>>1;x=(x*x)%p;}return r;} 
string dec_bin_32(ll n) {string s;for(ll i=31;i>=0;i--){ll k=n>>i;s+=(k&1)?'1':'0';}return s;} 
string dec_bin_64(ll n) {string s;for(ll i=63;i>=0;i--){ll k=n>>i;s+=(k&1)?'1':'0';}return s;} 
ll mod_inv(ll a,ll m)   {ll m0=m,y=0,x=1;if(m==1)return 0;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;} 

//-------------------------------L_I_Erq34-------------------------------

const ll N=3007;
ld a[N],dp[N][N];		// total coins, no of heads

int main()
{
	fastio();
	ll z,n,m,t,k,i,j,l,d,h,r;
	cin>>n;
	forn(i,1,n+1)
		cin>>a[i];
	dp[0][0]=1;
	forn(i,1,n+1)
		forn(j,0,n+1)
		{
			if(!j)
				dp[i][j]=dp[i-1][j]*(1-a[i]);
			else
				dp[i][j]=dp[i-1][j-1]*a[i]+dp[i-1][j]*(1-a[i]);
		}
	ld ans=0;
	forn(i,n/2+1,n+1)
		ans+=dp[n][i];
	printf("%.10Lf\n",ans);
	cerr<<"\nTime elapsed: "<<1000*clock()/CLOCKS_PER_SEC<<"ms\n";
	return 0;
}


Measured memory_bytes: 141568
import sys

N = int(input())

def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

#eが何個のzに分けられるかを返す
def aiueo(e):
    i = 1
    Sum = 3
    while Sum <= e:
        i += 1
        Sum += i+1

    return i

hoge1 = prime_factorize(N)
hoge2 = list(set(hoge1))

num = 0
for i in range(len(hoge2)):
    a = hoge1.count(hoge2[i])
    num += aiueo(a)
    #print(hoge2[i],a,aiueo(a))

print(num)



Measured memory_bytes: 62832
#include <bits/stdc++.h>
using namespace std;
struct _I { _I() {cin.tie(0);ios::sync_with_stdio(false);}} __I;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i < (n); i++)
#define all(a) begin(a),end(a)
template<class F, class S> istream& operator >> (istream& s, pair<F, S>& p)
{ cin >> p.first >> p.second; return s;}
template<class T> istream& operator >> (istream& s, vector<T>& v)
{ for (T& x: v) { s >> x; } return s;}
template<class T> void cout_h(const vector<T>& c, int n=INT_MAX)
{ rep(i, min(n, (int)c.size())) cout << c[i] << (i==c.size()-1?"\n":" "); }
template<class T> inline bool chmin(T& a, T b) {return a>b?a=b,true:false;}
template<class T> inline bool chmax(T& a, T b) {return a<b?a=b,true:false;}
#define D1(a) cout<<#a<<":"<<a<<"\n"
#define D2(a,b) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<endl 
#define D3(a,b,c) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c <<endl
#define D4(a,b,c,d) cout<<#a<<":"<<a<<","<<#b<<":"<<b<<","<<#c<<":"<<c<<","<<#d<<":"<<d<<endl 
#define MOD 1000000007

int main()
{
    ll N, K; cin >> N >> K;
    vll h(N); cin >> h;

    vll dp(N, LLONG_MAX);
    dp[0] = 0;

    rep(i, N) {
        rep1(k, K+1) {
            int j = i + k;
            if (j >= N) break;
            dp[j] = min(dp[j], dp[i] + abs(h[i] - h[j]));
        }
    }

    cout << dp.back() << endl;
}


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

char a[100][100];

int main() {
	int h, w;
	cin >> h >> w;
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> a[i][j];
		}
	}

	for (int i = 0; i < w + 2; i++)cout << '#';
	cout << endl;
	for (int i = 0; i < h; i++) {
		cout << '#';
		for (int j = 0; j < w; j++) {
			cout << a[i][j];
		}
		cout << '#' << endl;
	}
	for (int i = 0; i < w + 2; i++)cout << '#';
	cout << endl;
}

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

using namespace std;

#define debug(x) '[' << #x << " is: " << x << "] "
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.precision(10);
	cout << fixed;
	int n;
	cin>>n;
	int g = 0;
	for(int i=1;i<=n;i++){
		int a;
		cin>>a;
		if(a != i)g++;
	}
	cout << (g>2 ? "NO" : "YES") << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <algorithm>
using namespace std;
const int N=1e3+10;
int main(){
    int n,q,l,r,a[N];
    scanf("%d",&n);
    for(int i=0;i<n;i++)scanf("%d",&a[i]);
    scanf("%d",&q);
    while(q--){
        scanf("%d%d",&l,&r);
        reverse(a+l,a+r);
    }
    printf("%d",a[0]);
    for(int i=1;i<n;i++)printf(" %d",a[i]);
    printf("\n");
    
}


Measured memory_bytes: 2732
#include<iostream>
#include<vector>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<string.h>
#include<algorithm>
#include<queue>
using namespace std;
int N,M,Q;

vector<vector<long long int> > A (550,vector<long long int>(550,0));

int main(void){
 int l,r;
 cin>>N>>M>>Q;

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

 for(int i=1; i<=N; i++)
  for(int j=1; j<=N; j++){
   A[i][j]+=A[i-1][j];
   A[i][j]+=A[i][j-1];
   A[i][j]-=A[i-1][j-1];
  }
 for(int i=0; i<Q; i++){
  cin>>l>>r;
  std::cout<<A[r][r]-A[r][l-1]-A[l-1][r]+A[l-1][l-1]<<std::endl;
 }

 return 0;
}

Measured memory_bytes: 3328