akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
int main() {
//  cin.tie(0); ios_base::sync_with_stdio(false);
  int N, L; cin >> N >> L;
  vector<string> S(N); for (auto& s : S) cin >> s;
  sort(S.begin(), S.end());
  for (auto& s : S) cout << s;
  cout << '\n';
  return 0;
}


Measured memory_bytes: 256
S = input()
ans = 0
cnt = 0
for i in range(len(S)):
  if S[i] == 'A' or S[i] == 'C' or S[i] == 'G' or S[i] == 'T':
    cnt += 1
  else:
    cnt = 0
  ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 2940
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = float("INF")

#solve
def solve():
    n = II()
    a = LI()
    ans = [0] * n
    for i in range(n-1):
        ans[a[i] - 1] += 1
    print("\n".join(map(str, ans)))
    return


#main
if __name__ == '__main__':
    solve()


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

int main(){
    int n;
    cin >> n;
    vector<int> a(n),b(n),c(n-1);

    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    for(int i=0; i<n; i++){
        cin >> b[i];
    }
    for(int i=0; i<n-1; i++){
        cin >> c[i];
    }

    int sum=0;
    for(int i=0; i<n; i++){
        sum += b[a[i]-1];
        if(i>0 && a[i-1]+1 == a[i]){
            sum += c[a[i-1]-1];
        }
    }

    cout << sum << endl;
}

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

using namespace std;

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

int main() {
    int N, Y;
    cin >> N >> Y;
    int man = -1;
    int gsen = -1;
    int sen = -1;
    for(int i=0; i<=N; i++){
        for(int j=0; j<=N-i; j++){
            int k = N - i - j;
            if(10000*i+5000*j+1000*k == Y){
                man = i;
                gsen = j;
                sen = k;
            }
        }
    }
    cout << man << " " << gsen << " " << sen << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int l,n,i,j,tmp,sum=0;
  scanf("%d %d",&l,&n);
  int a[l];
  for(i=0;i<l;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<l;i++){
    for(j=i+1;j<l;j++){
      if(a[i]>a[j]){
        tmp=a[i];
        a[i]=a[j];
        a[j]=tmp;
      }
    }
  }
  for(i=0;i<n;i++){
    sum+=a[i];
  }
  printf("%d",sum);
  return 0;
}
  

Measured memory_bytes: 1736
s = input()
t = input()
n = len(s)
m = len(t)

dp = [[0] * (m + 1) for _ in range(n + 1)]

for i in range(n):
    for j in range(m):
        dp[i][j] = max([dp[i][j-1], dp[i-1][j], dp[i - 1]
                        [j - 1] + (s[i] == t[j])])

ans = []
i = n - 1
j = m - 1
while i >= 0 and j >= 0:
    if i >= 0 and dp[i - 1][j] == dp[i][j]:
        i -= 1
    elif j >= 0 and dp[i][j - 1] == dp[i][j]:
        j -= 1
    else:
        ans.append(s[i])
        i -= 1
        j -= 1
print("".join(reversed(ans)))


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

int main(){
	int aiNums[3] = {};

	scanf("%d %d %d", aiNums, &aiNums[1], &aiNums[2]);

	std::sort(aiNums, aiNums + 3);

	printf("%d %d %d\n", aiNums[0], aiNums[1], aiNums[2]);

	return 0;
}

Measured memory_bytes: 1188
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <cmath>
#include <list>
#include <ctime>
#include <sstream>
#include <queue>
#include <stack>
#include <random>
#include <bitset>
#include <numeric>
#include <cassert>
using namespace std;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef long long ll;
#define rep(x, b, e) for(int x=(b); x<(e); ++x)
#define ford(x, b, e) for(int x=((int)(b))-1; x>=(e); --x)
#define all(c) c.begin(),c.end()
#define sz(x) ((int)((x).size()))
#define pb push_back
#define st first
#define nd second
#define mp(x,y) make_pair(x,y)
typedef short int sint;

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it) {
	*this << ((it != d.b) ? ", " : "") << *it;
  }
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

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

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

int main() { 
    int N;
    cin >> N;
    int ans=0;
    vector<int> B(N-1);
    rep(i,N-1) cin >> B[i];
    vector<int> A(N);
    A[0] = B[0];
    A[N-1] = B[N-2];
    for(int i=1;i<=N-2; ++i) {
        A[i] = min(B[i-1],B[i]);
    }
    rep(i,N) ans+=A[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
S=raw_input()
judge=["dream","dreamer","erase","eraser"]

V=set()
V.add(0)

cnt=0
while cnt<len(S):
	tmp=set()
	for i in V:
		for j in judge:
			if S[i:i+7].find(j)==0:
				tmp.add(i+len(j))
				if i+len(j)==len(S):
					print "YES"
					sys.exit()
	V=tmp
	cnt+=1
else:
	print "NO"


Measured memory_bytes: 2692
//他人のソース
function main(input){
  const lines = input.split('\n');
  const NW = lines.shift().split(' ').map(x => parseInt(x));
  const N = NW[0]
  const W = NW[1]
  const items = lines.map(line => line.split(' ').map(x => parseInt(x)) );

//console.log(N);
//console.log(W);
//console.log(items);

  dp = []
  for(var i=0;i<W+1;i++){
    dp.push( Array(N+1).fill(0) );
  }

  var result = 0;
  for(var i=0;i<N;i++){
    for(var w=0;w<=W;w++){

      var weight = items[i][0]
      var value = items[i][1]

      if(weight <= w){
        dp[w][i+1] = Math.max(dp[w][i], dp[w-weight][i] + value);
      }else{
        dp[w][i+1] = dp[w][i];
      }

      if(dp[w][i+1] > result){result = dp[w][i+1];}

    }
  }

//  const result = Math.max( ...dp.map(arr => Math.max(...arr)) )
  console.log(result);

}

main(require('fs').readFileSync('/dev/stdin', 'utf8'));



Measured memory_bytes: 198688
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
  string A,B;
  cin>>A>>B;
  if(A.size()>B.size()){
    cout<<"GREATER"<<endl;
  }
  else if(A.size()<B.size()){
    cout<<"LESS"<<endl;
  }
  else{
    if(A>B){cout<<"GREATER"<<endl;}
    else if(A<B){cout<<"LESS"<<endl;}
    else{cout<<"EQUAL"<<endl;}
  }
  return 0;
}

Measured memory_bytes: 3564
import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X, K, D = map(int, read().split())

def main(X, K, D):
    L = X - D * K
    R = X + D * K
    if L >= 0:
        return L
    if R < 0:
        return -R
    t = (-L) // (D + D)
    ans = -L
    for i in range(t - 10, t + 10):
        x = L + (D + D) * i
        if L <= x <= R:
            ans = min(ans, abs(x))
    return ans

print(main(X, K, D))

Measured memory_bytes: 9204
player_list = ['a', 'b', 'c']
s = {player_list[n]: list(raw_input()) for n in xrange(len(player_list))}
 
current_turn = player_list[0]
 
while True:
    if not s[current_turn]:
        print current_turn.upper()
        break
    else:
        current_turn = s[current_turn].pop(0)

Measured memory_bytes: 2568
#include <iostream>
#include <iomanip> // << fixed << precision(10)
#include <vector>
#include <string>
#include <map>
#include <set>
#include <cmath>
#include <algorithm>
using namespace std;

#define FOR(i,s,t) for(int i=s;i<t;i++)
#define REP(i,n) FOR(i,0,n)
#define PRINT(s) cout << s << "\n"
#define SORT(A) sort(A.begin(), A.end())
#define EACHPRINT(A, T) for_each(begin(A), end(A), [&](T i){ cout << i << " "; });cout << "\n"
#define MOD 1000000007

typedef long lint;
typedef vector<lint> V;
typedef pair<lint, lint> P;
bool lessPair(const P& l, const P& r){return l.second < r.second;}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    lint N; cin >> N;
    lint K; cin >> K;

    if(1+2*(K-1) <= N) {
      PRINT("YES");
    } else {
      PRINT("NO");
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int H,W;
vector<vector<char>> field(1010,vector<char>(1010));
vector<vector<int>> dist(1010, vector<int>(1010, -1));

const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };

int main()
{
    queue<pair<int,int>> que;
    cin >>H>>W;
    REP(i, H){
        REP(j,W){
            char c;
            cin >> c;
            field[i][j] = c;
            if(c=='#') {
                que.push(make_pair(i, j));
                dist[i][j] = 0;
            }
        }
    }

    while(!que.empty()){
        pair<int, int> p = que.front();
        que.pop();
        int y = p.first;
        int x = p.second;

        REP(i, 4){
            int ny = y+dy[i];
            int nx = x+dx[i];
            if(nx<0||nx>=W||ny<0||ny>=H) continue;
            if(field[ny][nx]=='.'){
                field[ny][nx] = '#';
                dist[ny][nx] = dist[y][x]+1;
                que.push(make_pair(ny, nx));
            }
        }  
    }

    int dist_max=-1;
    REP(i,H){
        REP(j,W){
            chmax(dist_max, dist[i][j]);
        }
    }
    

    cout << dist_max << endl;

    return 0;
}

Measured memory_bytes: 13456
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define repp(i,l,r,k)for(ll i=(l);i<(r);i+=(k))
#define INF ((1LL<<62)-(1LL<<31))
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))
#define bit(n,m)(((n)>>(m))&1)
int upll(const void*a, const void*b){return*(ll*)a<*(ll*)b?-1:*(ll*)a>*(ll*)b?1:0;}
int downll(const void*a, const void*b){return*(ll*)a<*(ll*)b?1:*(ll*)a>*(ll*)b?-1:0;}
void sortup(ll*a,int n){qsort(a,n,sizeof(ll),upll);}
void sortdown(ll*a,int n){qsort(a,n,sizeof(ll),downll);}
ll pom(ll a,ll n,int m){ll x=1;for(a%=m;n;n/=2)n&1?x=x*a%m:0,a=a*a%m;return x;}
//#define MOD 998244353
#define MOD 1000000007
#define invp(a,p)pom(a,p-2,p)

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	int ans=0,crr=1;
	while(crr<b)crr+=a-1,ans++;
	printf("%d",ans);
}

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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll x; cin>>x;
  ll ans=0;
  ans=1000*(x/500);
  ans+=5*((x%500)/5);
  cout<<ans<<endl;
}

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    int h, w;
    cin >> h >> w;
    char field[h][w];
    vector<pair<int, int>> black;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> field[i][j];  
            if(field[i][j] == '#') black.push_back(make_pair(i, j));
        }
    }
    bool possible = true;
    for(int i = 0; i < black.size(); i++){
        bool possible_mini = false;
        if(black[i].first - 1 >= 0){
            if(field[black[i].first - 1][black[i].second] == '#') possible_mini = true;
        }
        if(black[i].first + 1 < h){
            if(field[black[i].first + 1][black[i].second] == '#') possible_mini = true;
        }
        if(black[i].second - 1 >= 0){
            if(field[black[i].first][black[i].second - 1] == '#') possible_mini = true;
        }
        if(black[i].second + 1 < w){
            if(field[black[i].first][black[i].second + 1] == '#') possible_mini = true;
        }
        if(!possible_mini) possible = false;
    }
    cout << (possible ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

pii INIT = pii(-1, -1);
int board[33][33];
int acc[33][33];
pii memo[33][33][33][33];

int H, W, E, S;

int getsum(int p, int q, int x, int y) {
    return board[x][y] - board[p][y] - board[x][q] + board[p][q];
}

// テ・ツーツ湘・ツ慊ーテ・ツ淞?(テ・ツ債甘ゥツ鳴? テ」ツ?ォテ」ツ?甘」ツ?妥」ツつ凝ァツュツ氾」ツ??
pii solve(int lx, int ly, int rx, int ry) {
    pii& ans = memo[lx][ly][rx][ry];
    if(ans != INIT) return ans;

    // テ・ツーツ湘・ツ慊ーテ・ツ淞淌」ツ?ッテヲツ敖。テ、ツサツカテ」ツつ津ヲツコツ?」ツ?淌」ツ?陛」ツ?ェテ」ツ??」ツ?ョテ」ツ?ァテ」ツ??ァツュツ氾」ツ?暗」ツ?ォテ・ツスツアテゥツ淞ソテ」ツ?療」ツ?ェテ」ツ??ヲツ?湘・ツ堕ウテ」ツ?ョテ」ツ?ェテ」ツ??・ツ?、テ」ツつ津ィツソツ氾」ツ??
    int sum = getsum(lx, ly, rx, ry);
    if(sum < E - S) return ans = pii(0, INF);

    // テァツュツ氾」ツ??
    ans = pii(1, S - (E - sum));

    // テヲツィツェテ」ツ?ョテ・ツ按?・ツ可イ
    rep(i,lx+1,rx) {
        pii ra = solve(lx, ly, i, ry);
        pii rb = solve(i, ly, rx, ry);
        pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
        chmax(ans, temp);
    }

    // テァツクツヲテ」ツ?ョテ・ツ按?・ツ可イ
    rep(i,ly+1,ry) {
        pii ra = solve(lx, ly, rx, i);
        pii rb = solve(lx, i, rx, ry);
        pii temp = pii(ra.first + rb.first, min(ra.second, rb.second));
        chmax(ans, temp);
    }
    return ans;
}

signed main() {
    while(cin >> H >> W >> S, H || W || S) {
        memset(board, 0, sizeof(board));
        rep(i,0,33) rep(j,0,33) rep(k,0,33) rep(l,0,33)
            memo[i][j][k][l] = INIT;
        rep(i,0,H) rep(j,0,W) cin >> board[i+1][j+1];
        rep(i,0,H) rep(j,0,W) board[i+1][j+1] += board[i+1][j];
        rep(j,0,W) rep(i,0,H) board[i+1][j+1] += board[i][j+1];

        E = getsum(0, 0, H, W);
        pii ans = solve(0, 0, H, W);
        printf("%lld %lld\n", ans.first, ans.second);
    }
    return 0;
}

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

int main() {
    int X;
    cin >> X;
    if(X < 600) {
        cout <<8;
    } else if(X < 800) {
        cout << 7;
    } else if(X < 1000) {
        cout << 6;
    } else if(X < 1200) {
        cout << 5;
    } else if(X < 1400) {
        cout << 4;
    } else if(X < 1600) {
        cout << 3;
    } else if(X < 1800) {
        cout << 2;
    }else {
        cout << 1;
    }
    return 0;
}

Measured memory_bytes: 3608
#include<iostream>
#include<algorithm>
#include<map>
#include<queue>
using namespace std;
map<string,int> dp;
int dir[4]={1,-1,4,-4};
void bfs()
{
    string str="01234567";
    dp[str]=0;
    queue<string> que;
    que.push(str);
    while(!que.empty())
    {
        string str1=que.front();
        que.pop();
        int pos=str1.find('0');
        for(int i=0;i<4;i++)
        {
            int npos=pos+dir[i];
            if(npos<0||npos>7||(pos==3&&npos==4)||(pos==4&&npos==3))
            {
                continue;
            }
            else
            {
                string str2=str1;
                swap(str2[npos],str2[pos]);
                if(dp.find(str2)==dp.end())
                {
                    dp[str2]=dp[str1]+1;
                    que.push(str2);
                }
            }
        }

    }
}
int main()
{
    bfs();
    string str;
    while(getline(cin,str))
    {
        str.erase(remove(str.begin(),str.end(),' '),str.end());
        cout<<dp[str]<<endl;
    }
}

Measured memory_bytes: 3436
# coding: utf-8
A,B,K = map(int, input().split())

a = list(range(1,min(A+1,B+1)))
a = sorted(a, reverse=True)
cnt = 0

#print(a)
for i in a:
  if(A%i==0 and B%i==0):
    cnt += 1
    if(cnt==K):
      print(i)
      break

Measured memory_bytes: 38460
#include <bits/stdc++.h>
#include <string.h>
#include <vector>
//s#define rep(i, n) for (int i = 0; i < (n); i++)
#define MAX 10000

using namespace std;

#define ll long long
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define rep(i,a,n) for(int i=a; i<n; i++)
#define r0 return 0
#define INF (int)1e15
#define MOD 1000000007

 int main(){

 long long a;
 cin>>a;

 long long n = 3*a;

 int v[n];

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

  sort(v,v+n);
  long long ans=0;

  for(int i = n-2;i>=a;i-=2){
    ans += v[i];
  }

  cout<<ans<<endl;

 return 0;
 }


Measured memory_bytes: 4808
def main():
    n,k,c=map(int,input().split())
    S=input()
    l1=[[0,0] for _ in range(n)]
    l2=[0]*n
    memo=[0]*n
    x=0
    for i in range(n):
        if S[i]=="o" and memo[i]==0:
            x+=1
            l1[i][0]=x
            l1[i][1]=i+c+1
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        elif S[i]=="o" and memo[i]==1:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
        elif S[i]=="x" and memo[i]==0:
            l1[i][0]=x
            l1[i][1]=i+1
        else:
            l1[i][0]=x
            l1[i][1]=l1[i-1][1]
    S_=S[::-1]
    memo=[0]*n
    x=0
    for i in range(n):
        if S_[i]=="o" and memo[i]==0:
            x+=1
            l2[i]=x
            for j in range(i,i+c+1):
                if j<n:
                    memo[j]=1
        else:
            l2[i]=x
    l2=l2[::-1]
    ans=0
    for i in range(n):
        if S[i]=="o":
            x=0
            if i!=0:
                x+=l1[i-1][0]
            if i==0 and n!=1:
                x+=l2[1]
            else:
                if l1[i-1][1]<n and i<n-1:
                    x+=l2[max(l1[i-1][1],i+1)]
            if x<k:
                print(i+1)
if __name__ == '__main__':
    main()

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

#define int long long
#define double long double

using namespace std;

template<class T> string tostr(T x) { stringstream o; o << x; return o.str(); }
template<class T> T sqr(T x) { return x*x; }
template<class T> T mypow(T x, int n) { T r = 1; while (n > 0) { if (n & 1)r = r*x; x = x*x; n >>= 1; }return r; }

int toint(string s) { int v; stringstream i(s); i >> v; return v; }
bool check(int x, int y, int w, int h) { return x >= 0 && y >= 0 && w > x && h > y; }
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }

#define REP(i,a,b)	for(int (i) = (a);i < (b);(i)++)
#define rep(i,n)	REP(i,0,n)
#define PER(i,a,b)	for(int (i) = (a-1);i >= (b);(i)--)
#define per(i,n)	PER(i,n,0)
#define each(i,n)	for(auto &i : n)
#define clr(a)		memset((a), 0 ,sizeof(a))
#define mclr(a)		memset((a), -1 ,sizeof(a))
#define all(a)		(a).begin(),(a).end()
#define dump(val) 	cerr << #val " = " << val << endl;
#define dum(val)	cerr << #val " = " << val;
#define FILL(a,v)	fill(a,a+sizeof(a)/sizeof(*a),v)

const int dx[8] = { +1,+0,-1,+0,+1,+1,-1,-1 };
const int dy[8] = { +0,-1,+0,+1,-1,+1,-1,+1 };
const int mod = 1e9 + 7;
const int INF = 1e9;

signed main() {

	string s;
	cin >> s;

	int ans = INF;
	for(char c = 'a'; c <= 'z'; c++){

		auto t = s;

		int count = 0;
		while(1){
			set<char> se;
			each(tc, t) se.insert(tc);
			if(se.size() == 1) break;

			string nt(t.size()-1, ' ');
			rep(i, nt.size()){
				if(t[i] == c || t[i+1] == c){
					nt[i] = c;
				}
				else nt[i] = t[i];
			}

			t = nt;
			count++;

		}

		ans = min(ans, count);
	}

	cout << ans << endl;


	return 0;
}


Measured memory_bytes: 256
"""
author : halo2halo
date : 4, Feb, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
S = [str(i) for i in readline().decode('utf8').strip()]
ans = 0
for s, t in zip(S, S[1:]):
    if s != t:
        ans += 1
print(ans + 1)


Measured memory_bytes: 4692
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define IOS ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define MOD 1000000007
#define MOD2 998244353
#define pb emplace_back
#define mp make_pair
#define all(v) v.begin(),v.end()
#define sz(x) (ll)x.size()
#define F first
#define S second
#define FOR(i,a,b) for(ll i=a;i<=b;++i)
#define ROF(i,a,b) for(ll i=a;i>=b;--i)
#define trace(x) cerr<<#x<<": "<<x<<'\n';
typedef long long ll;
using namespace std;
using namespace __gnu_pbds;
#define T int
#define ordered_set tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>
auto clk=clock();
 
ll mexp(ll a, ll b, ll m){
    ll ans=1;
    a%=m;
    while(b){
        if(b&1) ans=ans*a%m;
        b>>=1;
        a=a*a%m;
    }
    return ans;
}

const int N = 2005;

string s[N];
int U[N][N], D[N][N];
int L[N][N], R[N][N];
int h, w;

int main(){
    IOS
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cin >> h >> w;
    FOR(i,1,h){
        cin >> s[i];
        s[i] = "$" + s[i];
    }
    FOR(j,1,w){
        D[h+1][j] = h + 1;
    }
    FOR(i,1,h){
        R[i][w+1] = w + 1;
    }
    FOR(j,1,w){
        FOR(i,1,h){
            if(s[i][j] == '#'){
                U[i][j] = i;
            }
            else{
                U[i][j] = U[i-1][j];
            }
        }
    }
    FOR(j,1,w){
        ROF(i,h,1){
            if(s[i][j] == '#'){
                D[i][j] = i;
            }
            else{
                D[i][j] = D[i+1][j];
            }
        }
    }
    FOR(i,1,h){
        FOR(j,1,w){
            if(s[i][j] == '#'){
                L[i][j] = j;
            }
            else{
                L[i][j] = L[i][j-1];
            }
        }
    }
    FOR(i,1,h){
        ROF(j,w,1){
            if(s[i][j] == '#'){
                R[i][j] = j;
            }
            else{
                R[i][j] = R[i][j+1];
            }
        }
    }
    ll ans = 0;
    FOR(i,1,h){
        FOR(j,1,w){
            ans = max(ans, (i - U[i][j]) + (D[i][j] - i) + (j - L[i][j]) + (R[i][j] - j) - 3);
        }
    }
    cout << ans;


    cerr<<endl<<endl<<"Time: "<<fixed<<setprecision(12)<<(long double)(clock()-clk)/CLOCKS_PER_SEC<<" ms"<<endl<<endl;
 
    return 0;
}

Measured memory_bytes: 67072
#include<bits/stdc++.h>
using namespace std;
#define debug(x)        cout<<#x<<" :"<<x<<endl;
#define ff              first
#define ss              second
#define ar              array
#define int             long long
#define ld              long double
#define pb              push_back
#define mp              make_pair
#define pii             pair<int,int>
#define vi              vector<int>
#define mii             map<int,int>
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define mk(arr,n,type)  type *arr=new type[n];
#define w(x)            int x; cin>>x; while(x--)
#define f(i,n)          for(int i=0;i<n;i++)
#define MOD             1000000007
#define pi              3.14159265
#define umii            unordered_map<int,int>
#define umci            unordered_map<char,int>
#define umsi            unordered_map<string,int>

void k_007()
{
  ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

#ifndef ONLINE_JUDGE
  freopen("ip1.txt", "r", stdin);
  freopen("op1.txt", "w", stdout);
#endif
}

bool sortbysec(const pair<int, int> &a, const pair<int, int> &b)
{
  return (a.second < b.second);
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
int prime(int n) {
  int flag = 1;
  for (int i = 2; i <= sqrt(n); i++) {
    if (n % i == 0) {flag = 0; break;}
  }
  return flag;
}
int power(int x, int y)
{
  if (y == 0)
    return 1;
  else if (y % 2 == 0)
    return ((power(x, y / 2) % MOD) * ( power(x, y / 2) % MOD)) % MOD;
  else
    return ((x % MOD) * (power(x, y / 2) % MOD) * (power(x, y / 2) % MOD)) % MOD;
}
int lcm(int a, int b)
{
  return (a * b) / gcd(a, b);
}

int32_t main()
{
  k_007();
  int h, a;
  cin >> h >> a;
  cout << (int)(ceil(h / (long double)a));
}


Measured memory_bytes: 3668
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vs = vector<string>;
using vll = vector<long long>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    set<int> st;
    rep(i, n) {
        int a;
        cin >> a;
        if (st.count(a)) st.erase(a);
        else st.insert(a);
    }
    cout << st.size() << endl;
}

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

#define int long long

int f(vector<int> a , vector<int> p, int n, int x){
  if (n == 0)
    return x <= 0 ? 0 : 1;
  else if (x <= 1 + a[n - 1])
    return f(a, p, n-1,x-1);
  else
    return p[n-1] + 1 + f(a, p,n-1,x-2-a[n-1]);
}

signed main(void)
{
  int num; // num
  num = 0; // count, result
  // num = numeric_limits<int>::min(); // max
  // num = numeric_limits<int>::max(); // min
  int n;
  int x;

  vector<int> a;
  vector<int> p;

  cin >> n >> x;
  a.push_back(1);
  p.push_back(1);

  for (int i = 0; i < n; ++i){
    a.push_back(2 * a.back() + 3);
    p.push_back(2 * p.back() + 1);
  }

  cout << f(a,p,n,x) << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

vector<int> z_algorithm(const string &s) {
  vector< int > prefix(s.size());
  for(int i = 1, j = 0; i < s.size(); i++) {
    if(i + prefix[i - j] < j + prefix[j]) {
      prefix[i] = prefix[i - j];
    } else {
      int k = max(0, j + prefix[j] - i);
      while(i + k < s.size() && s[k] == s[i + k]) ++k;
      prefix[i] = k;
      j = i;
    }
  }
  return prefix;
}

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

    vector<int> lcp(N);
    for(int i=0; i<N; i++) {
        string substr = S.substr(i);
        auto subres = z_algorithm(substr);

        for(int j=i+1; j<N; j++) {
            if(subres[j-i] <= j-i)
                lcp[j] = max(lcp[j], subres[j-i]);
        }

    }
    
    int ans = *max_element(lcp.begin(), lcp.end());
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>

using namespace std;
int n,A[100005],i;
long long tot;
int main()
{
    cin>>n;
    for(i=1;i<=n;i++)
      cin>>A[i];
    for(i=1;i<=n;i++)
    {
        if(A[i]%2&&A[i+1]) A[i]++,A[i+1]--;
        tot+=1LL*A[i]/2;
    }
    cout<<tot;
    return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <cstdio>

using namespace std;

int main()
{
    int n;

    while (cin >> n) {
        if (!n)
            break;

        int tmp;
        int mat[11][11];

        for (int i = 0; i < 11; i++)
            for (int j = 0; j < 11; j++)
                mat[i][j] = 0;


        for (int i = 0; i < n; i++) {
            for (int j = 0; j < n; j++) {
                cin >> tmp;
                mat[i][j] = tmp;
                mat[i][n] += tmp;
                mat[n][j] += tmp;
            }
        }

        for (int i = 0; i <= n; i++) {
            for (int j = 0; j <= n; j++) {
                if (j == n && i != n)
                    mat[n][n] += mat[i][j];
                printf("%5d", mat[i][j]);
            }
            putchar('\n');
        }
    }
    
    return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<queue>
#include<stack>
#include<set>
#include<cmath>
#include<iomanip>
#include<functional>
using namespace std;

int MOD = 1e9 + 7;

typedef long long ll;
typedef pair<int, int> P;

int main() {
    string s; cin>>s;
    int n=s.size();

    ll ans=0;
    for(int bit=0; bit<(1<<n-1); bit++){
        ll tmp=(s[0]-'0'), sum=0;
        for(int i=0; i<n-1; i++){
            if(bit & (1<<i)){
                sum+=tmp;
                tmp=0;
            }
            tmp=tmp*10+(s[i+1]-'0');
        }
        ans+=tmp+sum;
    }
    cout<<ans<<endl;
}

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

int main(int, char **) {
  int64_t N;
  std::cin >> N;
  // 注意！社員番号は1から始まる。

  int64_t Ai = 0;
  std::vector<int64_t> i_san_no_buka_suu(N + 1, 0);
  //  std::vector<int64_t> A(N);
  for (int64_t i = 2; i < N + 1; ++i) {
    std::cin >> Ai;
    i_san_no_buka_suu.at(Ai)++;
  }
  for (int64_t i = 1; i < N + 1; ++i) {
    std::cout << i_san_no_buka_suu.at(i) << std::endl;
  }
}


Measured memory_bytes: 4788
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 600;
int C[N], S[N], F[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; ++i) {
    scanf("%d%d%d", &C[i], &S[i], &F[i]);
  }
  for (int i = 0; i < n; ++i) {
    int cur = 0;
    for (int j = i; j < n - 1; ++j) {
      cur = max((cur + F[j] - 1) / F[j] * F[j], S[j]) + C[j];
    }
    printf("%d\n", cur);
  }
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define vii vector <int>
#define vll vector <long long>
#define pii pair <int, int>
#define repDown(i,a,n) for(int i=n;i>a;i--)
#define rep(i,a,n) for(int i=a;i<n;i++)
#define endl '\n'
#define mem(a,b) memset(a, b, sizeof a)
#define max(a,b,c) max(c, min(a,b))
#define min(a,b,c) min(c, min(a,b))
ll mod=1000000007;
using namespace std;
void print(vector <int> &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}
void printll(vector <ll> &arr){
	for(int i=0;i<arr.size();i++)
		cout<<arr[i]<<" ";
	
	cout<<endl;
}

int main(){
/////////////////////////////////////////////////////////////////////
//	ios_base::sync_with_stdio(false);
//	cin.tie(nullptr);
//	cout.tie(nullptr);
//	cerr.tie(nullptr);
//For fast IO
///////////////////////////////////////////////////////////////////// 

	string s;
	cin>>s;
	if(s[0]=='A' && s[1]=='A' && s[2]=='A') cout<<"No"<<endl;
	else if(s[0]=='B' && s[1]=='B' && s[2]=='B') cout<<"No"<<endl;
	else cout<<"Yes"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define M 1000000007
#define mod 998244353
#define mp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define pi pair<ll,ll>
#define endl "\n"
using namespace std;
const ll N=500010;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    ll n,m;
    cin>>m>>n;
    ll ar[n];
    ll sum=0;
    for(ll i=0;i<n;++i){
        cin>>ar[i];
        sum+=ar[i];
    }
    ll ans=m-sum;
    if(ans<0){ans=-1;}
    cout<<ans;

    return (0);
}


Measured memory_bytes: 3648
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REVERSE(c) reverse(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    int H, W;
    char c, img[200][100];
    cin >> H >> W;
    REP(i, H) {
        REP(j, W) {
            cin >> c;
            img[2 * i][j] = c;
            img[2 * i + 1][j] = c;
        }
    }
    REP(i, 2 * H) {
        REP(j, W) {
            cout << img[i][j];
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedInputStream;
import java.util.Scanner;

public class Main {

    static int gcd(int a, int b)
    {
        int t = a % b;
        while(t != 0)
        {
            a = b;
            b = t;
            t = a % b;
        }

        return b;
    }
    public static void main(String[] args)
    {
        int a, b, g;

        long l;

        Scanner cin = new Scanner(new BufferedInputStream(System.in));

        while(cin.hasNext())
        {
            a = cin.nextInt();
            b = cin.nextInt();

            g = gcd(a, b);
            l = 1L * a*b / g;
            System.out.print(g+" ");
            System.out.println(new Long(l).toString());
        }

    }
}



Measured memory_bytes: 26316
#include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define pb push_back
#define debug(x) cout<< #x <<": "<<x<<endl
#define debug2(x,y) cout<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<i_i, int> p_i;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
template<class T> using vv=vector<vector< T > >;
typedef deque<int> di;
typedef deque<deque<int> > ddi;

int main() {
  while (true) {
    int w, h;
    cin >> w >> h;
    if (h == 0) { break; }
    vvi tiles(h+2, vi(w+2, -1)); // -1 : red, 0 : black, 1 : reached
    di current(2); // w(x), h(y)
    for (int ih = 1; ih <= h; ++ih) {
      for (int iw = 1; iw <= w; ++iw) {
        char c_tmp;
        cin >> c_tmp;
        if (c_tmp != '#') {
          tiles[ih][iw] = 0;
        }
        if (c_tmp == '@') {
          current = {ih, iw};
          tiles[ih][iw] = 1;
        }
      }
    }

    ddi s;
    s.pb(current);
    int reachable = 1;
    while ( !s.empty() ) {
      current = s.front();
      vvi search = {{1,0},{0,1},{-1,0},{0,-1}};
      for (auto v : search) {
        int next_h = current[0] + v[0];
        int next_w = current[1] + v[1];
        if (tiles[next_h][next_w] == 0) {
          tiles[next_h][next_w] = 1;
          reachable += 1;
          s.pb({next_h, next_w});
        }
      }
      s.pop_front();
    }
    printf("%d\n", reachable);
  }

  return 0;
}

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

int main(){
	
	int H, W;
	int i;
	char* line;

	scanf("%d %d", &H, &W);

	line = (char*)malloc(sizeof(char)* (W+1));

	for(i=0; i<H; i++){
		scanf("%s", line);
		printf("%s\n%s\n", line, line);
	}

	return 0;
	

}


Measured memory_bytes: 128
import java.util.Scanner;

class Main {
	public static void main(String[] args) throws Exception{
		Scanner sc = new Scanner(System.in);
		StringBuilder stdout = new StringBuilder();
		int x = sc.nextInt();
		int y = sc.nextInt();
		int z = sc.nextInt();
		stdout.append((x-z)/(y+z));
		System.out.println(stdout);
	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf = 1012345678;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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




int main(){
  int N;
  cin >> N;
  int l[1000];
  int M = 0;
  rep(i,N){
    cin >> l[i];
    M = max(l[i],M);
  }
  int sum = 0;
  rep(i,N){
    sum += l[i];
  }
  sum -= M;
  if(sum > M) cout << "Yes" << endl;
  else cout << "No" << endl;
}


Measured memory_bytes: 256
<?php
//error_reporting(0);
$N = trim(fgets(STDIN));
//list($A,$B,$C,$D) = explode(" ",trim(fgets(STDIN)));
//$A  = explode(" ",trim(fgets(STDIN)));

preg_match_all("([0-9])", $N, $m);
$res = array_sum($m[0]);
if ($res == 1) {
  $res = 10;
}
printf("%d\n",$res);
exit;
$wa = 99999999999;
for($i=1;$i<$N/2;$i++) {
  $wa = min($wa,getWa($i,$N-$i));
}
printf("%d\n",$wa);

function getWa($n1,$n2) {
  $sum = 0;
  preg_match_all("([0-9])", $n1, $m);
  $sum += array_sum($m[0]);
  preg_match_all("([0-9])", $n2, $m);
  $sum += array_sum($m[0]);
  printf("%d %d %d\n",$n1,$n2,$sum);
  return $sum;
}


Measured memory_bytes: 3828
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define REP(i,a) for(int i=0;i<a;i++)
#define printall(n,array) {for(int i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
typedef long long ll;
typedef pair<int, int> PI;
typedef pair<int, PI> V;
typedef vector<int> VE;
const ll mod = 10000000007; //10^9+7

int main(){
  int n;
  cin>>n;
  VE a,b,c;
  ll A,B,C;
  ll temp;
  REP(i,n){cin>>temp;a.push_back(temp);}
  REP(i,n){cin>>temp;b.push_back(temp);}
  REP(i,n){cin>>temp;c.push_back(temp);}
  sort(a.begin(),a.end());
  sort(b.begin(),b.end());
  sort(c.begin(),c.end());
  //REP(i,a.size())cout<<a[i]<<" ";cout<<endl;///
  //auto e=lower_bound(a.begin(),a.end(),6)-a.begin();///
  //print(a[e])///
  ll ans=0;
  REP(i,n){
    B=b[i];
    auto A=lower_bound(a.begin(),a.end(),B)-a.begin();
    auto C=upper_bound(c.begin(),c.end(),B)-c.begin();
    ans+=A*(n-C);
    //print(i<<" "<<A<<" "<<n-C<<" ans "<<ans);///
  }
  print(ans);
}

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

int n;
int A[50], C[49];
int sum = 0;

void solve() {
	for (int i = 0; i < n; ++i) {
		if (i != n-1 && A[i] + 1 == A[i + 1]) {
			sum += C[A[i] - 1];
		}
	}

}
int main() {
	cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> A[i];
	}

	for (int i = 0, B; i < n; ++i) {
		cin >> B;
		sum += B;
	}

	for (int i = 0; i < n - 1; ++i) {
		cin >> C[i];
	}

	solve();

	cout << sum << '\n';
	return 0;

}

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


using namespace std;
#define ll long long
#define ld long double
#define  P pair<ll,ll>
#define FOR(i,n,m) for(ll i=n; i<(ll)m;i++)
#define FORr(i,m,n) for(ll i=n; i>=(ll)m; i--)
#define FORm(i,m) for(auto i=m.begin();i!=m.end();i++)
#define sortAl(v) sort(v.begin(),v.end())
#define sortAlr(v) sort(v.begin(),v.end()); reverse(v.begin(),v.end())
#define cout(n) cout<<fixed<<setprecision(n)

struct UnionFind {
  vector<ll> data;
  UnionFind(ll size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(ll x, ll y) {
    return root(x) == root(y);
  }
  int root(ll x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(ll x) {
    return -data[root(x)];
  }
};

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,m;
    cin>>n>>m;
    vector<ll> v(n+1);

    UnionFind u(n+1);
    FOR(i,0,m){
      ll in1,in2,c;
      cin>>in1>>in2>>c;
      u.unionSet(in1,in2);
    }

    ll ans = n;
    FOR(i,1,n+1){
      v[u.size(i)]++;
    }

    FOR(i,1,n+1){
      ans -= v[i]/i*(i-1);
    }
    cout<<ans<<endl;
}


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

int main() {  
  int a, b;
  cin >> a >> b;
  cout << max(a+b,max(a-b,a*b)) << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;
public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
	    int n = scan.nextInt();
	    String s = scan.next();
	    scan.close();
	    char stoc[]=s.toCharArray();
	    int max=0;
		for (int i = 0; i < n-1; i++) {
			int cnt=0;
			int check[]=new int[26];
			for(int j=0;j<26;j++) {
				check[j]=0;
			}
			//Xカウント
			for (int j = 0; j <=i ; j++) {
				int a=(int)'a';
				if(check[stoc[j]-a]==0) {
					check[stoc[j]-a]=1;
					for (int k = i+1; k <n ; k++) {
						if(check[stoc[k]-a]==1) {
							cnt++;
							check[stoc[k]-a]=-1;
							break;
						}
					}
				}
			}
			if(max<cnt)max=cnt;
		}
		System.out.println(max);
	}

}


Measured memory_bytes: 23252