akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
#define int long long
#define INF 1e18
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; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

signed main(){
    string s, t;
    cin >> s >> t;
    cout << t << s << endl;

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<cassert>
#include<math.h>
#include<complex>
#include<algorithm>
#include<utility>
#include<queue>
#include<string.h>
#include<string>
#include<set>
#include<map>
#include<unordered_map>
#include<functional>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
const ll INF=2e18;
const ll MOD=1e9+7;
ll gcd(ll a, ll b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
ll N;
int main(){
    cin>>N;
    ll ans=0;
    for(ll i=1;i<=N;i++){
        for(ll j=1;j<=N;j++){
            for(ll k=1;k<=N;k++){
                ans+=gcd(gcd(i,j),k);
            }
        }
    }
    cout<<ans;
    return 0;
}

Measured memory_bytes: 3624
#include<iostream>
#include <cstdio>
#include<algorithm>
#include<vector>
#include<set>
#include<utility>
#include<queue>

#define REP(i,n) for(int i = 0;i < n ;i++)
	
using namespace std;

int mp[60][60],dp[60][60];
int w,h,ans;
int dx[] = {1,1,0,-1,-1,-1,0,1},dy[] = {0,1,1,1,0,-1,-1,-1};

void dfs(int x,int y)
{
	REP(i,8)
	{
		int cx = x + dx[i],cy = y + dy[i];
		if(cx >= 0 && cx < h && cy >= 0 \
				&& cy < w && dp[cx][cy] == 0 && mp[cx][cy] == 1)
				{
					dp[cx][cy] = 1;
					dfs(cx,cy);
				
				}
				
	}
}
			

int main()
{
	for(;;)
	{
		ans = 0;
		REP(i,60)REP(j,60)dp[i][j]=0;
		cin >> w >> h;
		if(w == 0 && h == 0) break;
		REP(i,h)REP(j,w)cin >> mp[i][j];
		REP(i,h)REP(j,w)
		{
			if(mp[i][j] == 1 && dp[i][j] == 0)
			{
				ans++;
				dfs(i,j);
			}
		}
		
		cout << ans << endl;
		
	}
	return 0;

}

Measured memory_bytes: 3152
k = int(input())
s = input()
L = len(s)
mod = 10**9+7

MAX = 2*10**6
fact = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact[i] = (fact[i-1]*i) % mod

inv = [1]*(MAX+1)
for i in range(2, MAX+1):
    inv[i] = inv[mod % i]*(mod-mod//i) % mod

fact_inv = [1]*(MAX+1)
for i in range(1, MAX+1):
    fact_inv[i] = fact_inv[i-1] * inv[i] % mod

def comb(n, k):
    if n < k:
        return 0
    return fact[n] * fact_inv[n-k] * fact_inv[k] % mod
  
p25 = [1]*(k+1)
p26 = [1]*(k+1)

for i in range(k):
  p25[i+1] = p25[i]*25%mod
  p26[i+1] = p26[i]*26%mod

ans = 0
for p in range(k+1):
  chk = p25[p]*comb(L-1+p,L-1)%mod
  chk *= p26[k-p]%mod
  ans += chk
  ans %= mod
  
print(ans)

Measured memory_bytes: 153112
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String s = sc.next();
    boolean ym = check(s.substring(0,2),s.substring(2,4));
    boolean my = check(s.substring(2,4),s.substring(0,2));
    if(ym){
      if(my){
        System.out.println("AMBIGUOUS");
      }else{
        System.out.println("YYMM");
      }
    }else{
      if(my){
        System.out.println("MMYY");
      }else{
        System.out.println("NA");
      }
    }
  }
  public static boolean check(String y,String m){
    int yy = Integer.parseInt(y);
    int mm = Integer.parseInt(m);
    int judge = 0;
    if(yy>=0)judge++;
    if(mm>0&&mm<13)judge++;
    boolean ret = false;
    if(judge==2)ret = true;
    return ret;
  }
}


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

using namespace std;

#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define INF 114514810
#define ELEM(array) (sizeof (array)/sizeof *(array))
#define MAX_N 100
#define SAFE_FREE(ptr) if( ptr != NULL ){ free(ptr); ptr = NULL; }
typedef unsigned int UINT;
typedef long long ll;
typedef pair<int, int> P;


int N, W;
int v[105], w[105];
int dp[105][10005];

int solve(int i, int j)//jは残りの重さ
{
	if (dp[i][j] >= 0)return dp[i][j];
	int res;//res,solve,dpには価値が入っている　iはインデント
	if (i==N)res = 0;
	else if (w[i] > j) res = solve(i + 1, j); 
	else{ 
		res = max(solve(i + 1, j), solve(i + 1, j - w[i])+v[i]); 
	}
	dp[i][j] = res;
	return res;
}

int main()
{
	cin >> N >> W;
	REP(i, N)cin >> v[i] >> w[i];
	REP(i, 105)REP(j, 10005)dp[i][j] = -1;
	cout << solve(0, W) << endl;
	return 0;
}

Measured memory_bytes: 5268
#include <iostream>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
const int N=5002;
char s[N]; int k;
vector<string> v;
int main() {
    scanf("%s%d",s+1,&k);
    int n=strlen(s+1);
    for(int i=1;i<=n;i++){
        for(int j=i;j<=min(i+k-1,n);j++){
            string str="";
            for(int k=i;k<=j;k++){
                str+=s[k];
            }
            v.push_back(str);
        }
    }
    sort(v.begin(),v.end());
    v.erase(unique(v.begin(),v.end()),v.end());
    cout<<v[k-1]<<endl;
}

Measured memory_bytes: 1660
#include <cstdio>

int N, M;
char S[2100][2100];
int Q;
int x1, x2, y1, y2;
int comp[2100][2100];
int link_h[2100][2100];
int link_v[2100][2100];
int num[2100][2100];
int res;
int num2[2100][2100];

void pre()
{
	int i, j;
	if(S[0][0] == '1')
		comp[0][0] = 1;
	else
		comp[0][0] = 0;
	for(i=0; i<M; i++)
		link_h[0][i] = 0;
	for(i=1; i<N; i++){
		if(S[i-1][0] == '1' && S[i][0]=='1')
			link_h[i][0] = 1;
		else
			link_h[i][0] = 0;
		for(j=1; j<M; j++){
			if(S[i-1][j] == '1' && S[i][j]=='1')
				link_h[i][j] = link_h[i][j-1] + 1;
			else
				link_h[i][j] = link_h[i][j-1];
		}
	}
	for(i=0; i<N; i++)
		link_v[i][0] = 0;
	for(i=1; i<M; i++){
		if(S[0][i-1] == '1' && S[0][i]=='1')
			link_v[0][i] = 1;
		else
			link_v[0][i] = 0;
		for(j=1; j<N; j++){
			if(S[j][i-1] == '1' && S[j][i]=='1')
				link_v[j][i] = link_v[j-1][i] + 1;
			else
				link_v[j][i] = link_v[j-1][i];
		}
	}
	
	num[0][0] = comp[0][0];
	for(i=1; i<M; i++){
		if(S[0][i] == '1')
			num[0][i] = num[0][i-1] + 1;
		else
			num[0][i] = num[0][i-1];
	}
	for(i=1; i<N; i++){
		if(S[i][0] == '1')
			num[i][0] = num[i-1][0] + 1;
		else
			num[i][0] = num[i-1][0];
	}
	for(i=1; i<N; i++){
		for(j=1; j<M; j++){
			num[i][j] = num[i-1][j] + num[i][j-1] - num[i-1][j-1];
			if(S[i][j] == '1')
				num[i][j] ++;
		}
	}
	
	num2[0][0] = comp[0][0];
	for(i=1; i<N; i++){
		if(S[i][0] == '1')
			num2[i][0] = 1;
		else
			num2[i][0] = 0;
	}
	for(i=0; i<N; i++){
		for(j=1; j<M; j++){
			if(S[i][j] == '1' && S[i][j-1] == '0')
				num2[i][j] = num2[i][j-1] + 1;
			else
				num2[i][j] = num2[i][j-1];
		}
	}
	
	for(i=1; i<M; i++){
		if(S[0][i] == '1')
			comp[0][i] = comp[0][i-1] + 1;
		else
			comp[0][i] = comp[0][i-1];
		comp[0][i] -= link_v[0][i];
	}
	for(i=1; i<N; i++){
		if(S[i][0] == '1')
			comp[i][0] = comp[i-1][0] + 1;
		else
			comp[i][0] = comp[i-1][0];
		comp[i][0] -= link_h[i][0];
	}
	for(i=1; i<N; i++){
		for(j=1; j<M; j++){
			//comp[i][j] = comp[i-1][j] + (num[i][j]-num[i-1][j]) - link_h[i][j];
			comp[i][j] = comp[i-1][j] + (num2[i][j]) - link_h[i][j];
		}
	}
}

void solve()
{
	if(x1>=1)
		res = comp[x2][y2] - comp[x1-1][y2];
	else
		res = comp[x2][y2];
	if(x2 > x1-1)
		res += link_h[x1][y2];
	int tmp = 0;
	if(y1>=1){
		if(x1>=1)
			tmp = comp[x2][y1-1] - comp[x1-1][y1-1];
		else
			tmp = comp[x2][y1-1];
		if(x2 > x1-1)
			tmp += link_h[x1][y1-1];
	}
	res -= tmp;
	if(x1>=1)
		res += link_v[x2][y1] - link_v[x1-1][y1];
	else
		res += link_v[x2][y1];
	printf("%d\n", res);
}

int main()
{
	//freopen("in.txt", "r", stdin);
	int i, j;
	scanf("%d%d%d", &N, &M, &Q);
	for(i=0; i<N; i++)
		scanf("%s", S[i]);
	pre();
	for(i=0; i<Q; i++){
		scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
		x1--, y1--, x2--, y2--;
		solve();
	}
	return 0;
}

Measured memory_bytes: 91904
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(a) (a).begin(),(a).end()
#define rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(ll i=(a);i<(b);i++)
#define rrep(i,n) for(ll (i)=(n)-1;(i)>=0;i--)
#define SHOW(x) cout << #x << ": " << x << endl;
const ll INF=1e18;
const int iINF=1e9,MOD=1e9+7;
int mh[4]={1,0,-1,0},mw[4]={0,1,0,-1};

int main(){
    int n;
    cin>>n;
    double cnt=0;
    for(int i=1;i<=n;i++)if(i%2==1)cnt++;
    cout<<cnt/n<<endl;
}



Measured memory_bytes: 256
#include <iostream>
#include <utility>
static void bsort(char c[][3], int n) {
    for (int i = 0; i < n; ++i) {
        for (int j = n - 1; j > i; --j) {
            if (c[j][1] < c[j - 1][1]) {
                std::swap(c[j], c[j - 1]);
            }
        }
    }
}
static void ssort(char c[][3], int n) {
    for (int i = 0; i < n; ++i) {
        int min = i;
        for (int j = i + 1; j < n; ++j) {
            if (c[j][1] < c[min][1]) {
                min = j;
            }
        }
        if (min > i) {
            std::swap(c[i], c[min]);
        }
    }
}
int main() {
    int n;
    char a[36][3], b[36][3];
    std::cin >> n;
    for (int i = 0; i < n; ++i) {
        std::string s;
        std::cin >> s;
        a[i][0] = b[i][0] = s[0];
        a[i][1] = b[i][1] = s[1];
        a[i][2] = b[i][2] = '\0';
    }
    bsort(a, n);
    ssort(b, n);
    for (int i = 0; i < n; ++i) {
        std::cout << ((i == 0) ? "" : " ") << a[i];
    }
    std::cout << std::endl << "Stable" << std::endl;
    bool f = true;
    for (int i = 0; i < n; ++i) {
        std::cout << ((i == 0) ? "" : " ") << b[i];
        if (a[i][0] != b[i][0]) {
            f = false;
        }
    }
    std::cout << std::endl << (f ? "Stable" : "Not stable" ) << std::endl;
}



Measured memory_bytes: 3160
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(300000)


def solve(N: int, M: int, p: "List[int]", S: "List[str]"):
    a = 0
    w = 0
    ac = [0] * (N + 1)
    wa = [0] * (N + 1)
    for i in range(M):
        if S[i] == 'WA' and not ac[p[i]]:
            wa[p[i]] += 1
        if S[i] == 'AC' and not ac[p[i]]:
            ac[p[i]] = 1
            a += 1
            w += wa[p[i]]
    print(a, w)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    p = [int()] * (M)  # type: "List[int]"
    S = [str()] * (M)  # type: "List[str]"
    for i in range(M):
        p[i] = int(next(tokens))
        S[i] = next(tokens)
    solve(N, M, p, S)

if __name__ == '__main__':
    main()


Measured memory_bytes: 14880
//vec[i]の範囲外エラー表示
#define _GLIBCXX_DEBUG
//includeとusing
#include <bits/stdc++.h>
using namespace std;
//型名省略
template <class T>
using V = vector<T>;
template <class T>
using VV = V<V<T>>;
using ll = long long;
using st = string;
using vl = vector<long long>;
using vvl = vector<vector<long long>>;
using vc = vector<char>;
using vvc = vector<vector<char>>;
using vs = vector<string>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using pll = pair<ll, ll>;
using pcc = pair<char, char>;
//定数
const ll INF = 1e9;
const ll MOD = 1e9+7;
const vl dx = {1,0,-1,0,1,0,-1,0};
const vl dy = {0,1,0,-1,0,1,0,-1};
//マクロ
#define rep(i,n) for(ll i = 0; i < (ll) n; i++)
#define rrep(i,n) for(ll i = (ll) n - 1; i >= 0;i--)
#define REP(i,x,n) for(ll i = (ll) x; i < (ll) n; i++)
#define RREP(i,x,n) for(ll i = (ll) n - 1; i >= x; i--)
#define each(i,A) for(ll i: (vl) A)
#define all(A) A.begin(), A.end()
#define Size(A) ll(A.size())
//入力
template<typename T> T input() {T x; cin >> x; return x;}
//正誤判定
void Yes(bool ans){cout << (ans? "Yes" : "No") << endl;}
void YES(bool ans){cout << (ans? "YES" : "NO") << endl;}
//余り切り上げ
ll ceil(ll a,ll b) {return (a + b - 1) / b;}
//最大値・最小値
template <typename T> bool chmax(T &a, const T& b) {if(a < b) {a = b; return true;} return false;}
template <typename T> bool chmin(T &a, const T& b) {if(a > b) {a = b; return true;} return false;}
//最大公約数
ll gcd(ll a,ll b){if(a<b)swap(a,b); if(a%b==0)return b; return gcd(b,a%b);}
//最小公倍数
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}
//n乗の余り
ll modpow(ll x,ll n,ll mod){ll res=1;for(ll i=0;i<n;i++){res=res*x%mod;}return res;}
ll MODpow(ll x,ll n){ll res=1;for(ll i=0;i<n;i++){res=res*x%MOD;}return res;}


/*--------------------------------------------------------------------------*/

//main関数
int main() {
    ll n, k; cin >> n >> k;
    ll base = 1;
    ll ans = 0;
    while(base <= n){
        base *= k;
        ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define REPW(i,n) for(i=0;i<(int)(n);++i)
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)   // c++14
#define SZ(c) ((int)c.size())
#define EXIST(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,v) os << *i << (i==end(v)-1 ? "" : "\n"); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,v) is >> * i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
        is >> p.first >> p.second; return is; }
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return 1;}return 0;}
//------------------------------------------------------------------------------
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
    }
} before_main_function;
//------------------------------------------------------------------------------

const int MOD=1e9+7;
signed main() {
    int n,m;
    cin>>n>>m;
    if(abs(n-m)>1) {
        cout<<0<<endl;
        return 0;
    }
    int ans=1;
    REPF(i,1,n+1) ans*=i,ans%=MOD;
    REPF(i,1,m+1) ans*=i,ans%=MOD;
    if(n==m) {
        ans*=2;
        ans%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#!usr/bin/env python3
from collections import defaultdict
from collections import deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
import itertools
sys.setrecursionlimit(10**5)
stdin = sys.stdin
bisect_left = bisect.bisect_left
bisect_right = bisect.bisect_right
def LI(): return list(map(int, stdin.readline().split()))
def LF(): return list(map(float, stdin.readline().split()))
def LI_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def II(): return int(stdin.readline())
def IF(): return float(stdin.readline())
def LS(): return list(map(list, stdin.readline().split()))
def S(): return list(stdin.readline().rstrip())
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')

#A
def A():
    a, p = LI()
    print((a*3+p)//2)
    return

#B
def B():
    n = II()
    sp = []
    for i in range(n):
        sp.append(input().split())
    another = [(s[0], -1 * int(s[1]),num) for num,s in enumerate(sp)]
    another.sort()
    for s,p,q in another:
        print(q+1)

    return

#C
def C():
    n, m = LI()
    ks = LIR_(m)
    p = LI()
    patern = itertools.product(range(2), repeat=n)
    ans = 0
    for on in patern:
        ki = [0 for i in range(m)]
        for num, oni in enumerate(on):
            if oni:
                for i,ksi in enumerate(ks):
                    ksi = ksi[1::]
                    if num in ksi:
                        ki[i] ^= 1
        for num, pi in enumerate(p):
            if pi != ki[num]:
                break
        else:
            ans += 1
    print(ans)

            
    return

#D
def D():
    N, K = LI()#random.randint(1,50),random.randint(1,100)
    v = LI()#[random.randint(-10 ** 2, 10 ** 2) for i in range(N)]
    ans = 0
    for a in range(min(N, K) + 1):
        for b in range(min(N, K) + 1):
            if a + b > min(K,N):
                break
            if a == b == 0:
                continue
            deletes = K - a - b
            left = v[:a]
            right = v[:-b-1:-1]
            x = left + right
            x.sort()
            tmp = sum(x)
            for delete in range(min(deletes, len(x))):
                if x[delete] >= 0:
                    break
                tmp -= x[delete]
            ans = max(ans,tmp)
    
    print(ans)
                

    return

#E
def E():
    return

#F
def F():
    return

#Solve
if __name__ == '__main__':
    D()


Measured memory_bytes: 42860
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
#include <iomanip>
#include <limits>
#include <fstream>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
const int inf = 1e9;
// ダイクストラO(elogv)
struct edge{
  int to, cost;
  edge(int t, int c) {
    to = t, cost = c;
  }
};
typedef pair<int, int> P;
int N;
vector<edge> G[111];
int d[111];
void dijkstra(int s){
  priority_queue<P, vector<P>, greater<P> >que;
  FOR(i,1,N+1) d[i] = inf;
  d[s] = 0;
  que.push(P(0, s));
  while(!que.empty()){
    P p = que.top(); que.pop();
    int v = p.second;
    if(d[v] < p.first) continue;
    for(auto &e : G[v]){
      if(d[e.to] > d[v] + e.cost){
        d[e.to] = d[v] + e.cost;
        que.push(P(d[e.to], e.to));
      }
    }
  }
}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin>>N;
  FOR(i,0,N){
    int u, k;
    cin >> u >> k;
    FOR(j,0,k){
      int v, c;
      cin >> v >> c;
      G[u].push_back(edge(v, c));
    }
  }
  dijkstra(0);
  FOR(i,0,N){
    cout << i << " " << d[i] << endl;
  }
}


Measured memory_bytes: 3092
// A.

#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
	int x, a, b;
	cin >> x >> a >> b;
	int d = -a + b;
	if (d <= 0) {
		cout << "delicious" << endl;
	} else if (d <= x) {
		cout << "safe" << endl;
	} else {
		cout << "dangerous" << endl;
	}
	return 0;
}


Measured memory_bytes: 256
N, W = map(int, input().split())
goods = []
for i in range(N):
    goods.append(list(map(int, input().split())))
dp = [[0 for i in range(W+1)]]
for n in range(0, N):
    dp.append([0])
    g = goods[n]
    for w in range(1, W+1):
        if w>=g[1]:
            dp[-1].append(max(dp[-1][w-g[1]]+g[0],dp[-2][w]))
        else:
            dp[-1].append(dp[-2][w])
print(dp[-1][-1])


Measured memory_bytes: 42476
#include<bits/stdc++.h>
    using namespace std;
    #define ll double
    
int main(){
    ll n;
    cin>>n;
    if((int)n%2==0) cout<<"0.5000000000"<<endl;
  	else { cout<<setprecision(8)<<fixed;  cout<<(n/2+0.5)/n<<endl; }
  return 0;
}

Measured memory_bytes: 256
<?php
$a = (int)trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($N,$K) = array_map('intval',explode(" ",trim(fgets(STDIN))));
//$A = array_map('intval',explode(" ",trim(fgets(STDIN))));

printf("%d\n",$a+$a*$a+$a*$a*$a);

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

namespace practice
{
    class MainClass
    {
        public static bool Has3InDecimal(int v)
        {
            int x = v;
            while (x != 0)
            {
                if (x % 10 == 3)
                {
                    return true;
                }
                x /= 10;
            }
            return false;
        }

        public static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input);
            for(int i = 1;i <= n; i++)
            {
                if (i % 3 == 0 || Has3InDecimal(i))
                {
                    Console.Write(" " + i);
                }
            }
            Console.WriteLine();
        }
    }
}


Measured memory_bytes: 15936
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

def diff(s):
    if s == 'a': return 0
    if s == 'b': return 25
    if s == 'c': return 24
    if s == 'd': return 23
    if s == 'e': return 22
    if s == 'f': return 21
    if s == 'g': return 20
    if s == 'h': return 19
    if s == 'i': return 18
    if s == 'j': return 17
    if s == 'k': return 16
    if s == 'l': return 15
    if s == 'm': return 14
    if s == 'n': return 13
    if s == 'o': return 12
    if s == 'p': return 11
    if s == 'q': return 10
    if s == 'r': return 9
    if s == 's': return 8
    if s == 't': return 7
    if s == 'u': return 6
    if s == 'v': return 5
    if s == 'w': return 4
    if s == 'x': return 3
    if s == 'y': return 2
    if s == 'z': return 1

def sol():
    S = list(input().strip())
    K = int(input())

    for i, s in enumerate(S):
        if s == 'a':
            continue
        else:
            if diff(s) <= K:
                S[i] = 'a'
                K -= diff(s)

    last = K % 26
    S[-1] = chr(ord(S[-1]) + last)
    print(*S, sep='')

sol()

Measured memory_bytes: 71928
#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,k;
    cin>>n>>k;
    ll ar[n];
    for(ll i=0;i<n;++i){cin>>ar[i];}
    sort(ar,ar+n);
    ll ans=0;
    for(ll i=0;i<k;++i){
        ans+=ar[i];
    }
    cout<<ans<<endl;

    return (0);
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;

LL inf = 1000000000000;
LL mod = 1000000007;

int main()
{
	LL n;
	cin >> n;
	bool ans = true;
	map<LL, LL> mp;

	for (LL i = 0; i < n; ++i) {
		LL x;
		cin >> x;
		mp[x]++;
		if (mp[x] == 2) {
			ans = false;
			break;
		}
	}

	if (ans ) {
		cout << "YES\n";
	}
	else {
		cout << "NO\n";
	}


	
}

Measured memory_bytes: 12800
N,A,B,C = map(int,input().split())

l = [int(input()) for i in range(N)]

INF = 10 ** 10
def dfs(point, a, b, c):
  if point == N:
    if min(a, b, c) > 0:
      return abs(a - A) + abs(b - B) + abs(c - C) - 30  
    else:
      return INF
  ret0 = dfs(point + 1, a, b, c)
  ret1 = dfs(point + 1, a + l[point], b, c) + 10
  ret2 = dfs(point + 1, a, b + l[point], c) + 10
  ret3 = dfs(point + 1, a, b, c + l[point]) + 10
  return min(ret0, ret1, ret2, ret3)
print(dfs(0, 0, 0, 0))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
const int N=105;
int a[N];
int main()
{
	int n,s1=0,s2=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		scanf("%d",&a[i]);
		s2+=a[i];
	}
	int ans=1e9;
	for(int i=1;i<n;i++)
	{
		s1+=a[i];
		s2-=a[i];
		ans=min(ans,abs(s1-s2));
	}
	printf("%d\n",ans); 
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007
int main() {
	ll h,m;
	cin>>h>>m;
	ll cnt=0;
	for(ll i=0;i<m;i++){
		ll now;
		cin>>now;
		cnt+=now;
	}
	if(cnt>=h){
		cout << "Yes";
	}
	else{
		cout << "No";
	}
	// your code goes here
	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  int n;
  cin>>n;
  int a[n][n];
  for(int i=0;i<n;i++)
    for(int j=0;j<n;j++)
      cin>>a[i][j];
  int ans=0;
  bool used[n];
  memset(used,0,sizeof(used));
  used[0]=1;
  int cost[n];
  for(int i=0;i<n;i++) cost[i]=a[0][i];
  while(1){
    int v=-1;
    for(int i=0;i<n;i++){
      if(used[i]||cost[i]<0) continue;
      //cout<<i<<":"<<cost[i]<<endl;
      if(v<0||cost[i]<cost[v]) v=i;
    }
    if(v<0) break;
    used[v]=1;
    ans+=cost[v];
    //cout<<v<<endl;
    for(int i=0;i<n;i++){
      if(a[v][i]<0) continue;
      if(cost[i]<0||a[v][i]<cost[i]) cost[i]=a[v][i];
    }
  }
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 3192
import java.util.*;

import static java.lang.System.*;
import static java.lang.Math.*;

class Main {
	public static Scanner sc = new Scanner(in);
	public static Random rand=new Random();

	public int getPos(char s){
		switch(s){
		case '1':case '4':case '7':return 0;
		default:return 1;
		case '3':case '6':case '9':return 2;
		}
	}

	public void run() {
		TCase:while(true){
			String sstr=sc.next();
			if("#".equals(sstr))return;
			char[] steps=sstr.toCharArray();

			int[][][] prev=new int[3][3][2];
			for(char step:steps){
				int[][][] next=new int[3][3][2];
				for(int l=0;l<3;l++)for(int r=0;r<3;r++)
						Arrays.fill(next[l][r],Integer.MAX_VALUE/10);

				int pos=getPos(step);
				//左足で踏む
				for(int r=pos;r<3;r++){
					int minv =Integer.MAX_VALUE;
					for(int l=0;l<3;l++)
						minv=min(minv,prev[l][r][1]);
					for(int l=0;l<3;l++)
						minv=min(minv,prev[l][r][0]+1);

					next[pos][r][0]=minv;
				}
				//右足で踏む
				for(int l=0;l<=pos;l++){
					int minv =Integer.MAX_VALUE;
					for(int r=0;r<3;r++)
						minv=min(minv,prev[l][r][0]);
					for(int r=0;r<3;r++)
						minv=min(minv,prev[l][r][1]+1);

					next[l][pos][1]=minv;
				}
				prev=next;
			}

			int minv=Integer.MAX_VALUE;
			for(int l=0;l<3;l++)
				for(int r=0;r<3;r++)
					for(int d=0;d<2;d++)
						minv=min(prev[l][r][d],minv);

			ln(minv);
		}
	}
	public static void main(String[] args) {
		new Main().run();
	}

	public int[] nextIntArray(int n){
		int[] res=new int[n];
		for(int i=0;i<n;i++){
			res[i]=sc.nextInt();
		}
		return res;
	}
	public static void pr(Object o) {
		out.print(o);
	}
	public static void ln(Object o) {
		out.println(o);
	}
	public static void ln() {
		out.println();
	}
}

Measured memory_bytes: 93484
import math
N,M = map(int,input().split())
rtM = math.floor(math.sqrt(M))
divs = []
for i in range(1,rtM+1):
    if M % i == 0:
        if i <= M/N:
            divs.append(i)
        if M//i <= M/N:
            divs.append(M//i)
print(max(divs))

Measured memory_bytes: 3060
if __name__ == "__main__":
    N = int(input())

    count = 0
    for i in range(1, N + 1):
        if 1 <= i and i <= 9:
            count += 1
        elif 100 <= i and i <= 999:
            count += 1
        elif 10000 <= i and i <= 99999:
            count += 1

    print(count)


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

int main() {
    int n = 0, k = 0;
    int d[100], a[100][100];
    
    cin >> n >> k;
    for (int i = 0; i < k; i++) {
        cin >> d[i];
        for (int j = 0; j < d[i]; j++) {
            cin >> a[i][j];
        }
    }

    set<int> s;
    for (int i = 0; i < k; i++) {
        for (int j = 0; j < d[i]; j++) {
            s.insert(a[i][j]);
        }
    }

    cout << n - s.size() << endl;
}

Measured memory_bytes: 3664
#include<stdio.h>
#include<string.h>


#define M 1046527
#define NIL (-1)
#define L 14

int kansu(int i){
  if(i==25964)
    return 0;
    else return i;
}

char H[M][L];

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key % M; }
int h2(int key){ return 1 + (key % (M-1)); }

int find(char str[]){
  long long key, i, h;
  key = getKey(str);
  for ( i = 0;; i++){
    h = (h1(key)+i*h2(key))%M;
    if( strcmp(H[h],str) == 0 ) return 1;
    else if ( strlen(H[h]) == 0 ) return 0;
  }
  return 0;
}

int insert(char str[]){
  long long key, i, h;
  key = getKey(str);
  for ( i = 0; ; i++ ){
    h = (h1(key)+i*h2(key))%M;
    if( strcmp(H[h],str) == 0 ) return 1;
    else if ( strlen(H[h]) == 0 ){
      strcpy(H[h], str);
      return 0;
    }
  }
  return 0;
}

main(){
  int i, n, h;
  char str[L], com[9];
  for ( i = 0; i < M; i++ ) H[i][0] = '\0';
  scanf("%d", &n);
  for ( i = 0; i < n; i++ ){
    scanf("%s %s", com, str);

    if ( com[0] == 'i' ){
      if (insert(str)){

      }
    } else {
      if (find(str) ){
	printf("yes\n");
      } else {
	printf("no\n");
      }
    }
  }
  return 0;
}


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

const int MAX = 510000;
const int MOD = 998244353;

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

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

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

long long modpow(long long a, long long n) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

int main() {
  long long N,M,K,ans=0;
  cin >> N >> M >> K;
  COMinit();
  for(long long i=0; i<=K; i++){
    ans += ( ( (M * modpow(M-1,N-1-i))%MOD )*COM(N-1,i) )%MOD;
    ans = ans%MOD;
  }
  if(ans >= 0) cout << ans;
  else cout << MOD+ans;
  return 0;
}

Measured memory_bytes: 15608
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
using namespace std;
int cmp(const void*a,const void*b)
{
    return strcmp((char*)a,(char*)b);
}
char s[200005][15];
int main()
{
    int n;
    int i;
    int cnt;
    int mmax;
    scanf("%d",&n);
    for(i=0;i<=n-1;i++)
    {
        scanf("%s",s[i]);
    }
    qsort(s,n,sizeof(s[0]),cmp);
    cnt=1;
    mmax=-1;
    for(i=0;i<=n-2;i++)
    {
        if(strcmp(s[i],s[i+1])==0)
        {
            cnt++;
        }
        else
        {
            mmax=max(cnt,mmax);
            cnt=1;
        }
    }
    mmax=max(cnt,mmax);
    cnt=1;
    for(i=0;i<=n-2;i++)
    {
        if(strcmp(s[i],s[i+1])==0)
        {
            cnt++;
        }
        else
        {
            if(cnt==mmax)puts(s[i]);
            cnt=1;
        }
    }
    if(cnt==mmax)puts(s[n-1]);
    return 0;
}


Measured memory_bytes: 6012
Imports System
Module ABC153A
	Sub Main()
		Dim h,a As Integer
		Dim inputs() As String = Console.ReadLine().Split()
		h = Integer.Parse(inputs(0))
		a = Integer.Parse(inputs(1))
		Dim ans As Integer = h \ a
		If (h Mod a) <> 0
			ans += 1
		End If
		Console.WriteLine(ans)
	End Sub
End Module


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

int main() {
  long long x; cin >> x;
  long long  s = 0, g = 0;
  while(x - 500 >= 0){
    x = x - 500;
    s++;
  }
  while(x - 5 >= 0){
    x = x - 5;
    g++;
  }
  cout << s * 1000 + g * 5;
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
  char x[1001];
  int sum, i;

  while (1) {
    sum = 0;
    scanf("%s", x);
    if (x[0] == '0') break;

    for (i = 0; x[i] != '\0'; i++) {
      sum += x[i] - '0';
    }
    printf("%d\n", sum);
  }

  return 0;
}


Measured memory_bytes: 2100
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" \
                              << "\n";

int main()
{
  int n, ans = INF;
  cin >> n;
  vector<int> x(n);
  REP(i, n)
  {
    cin >> x.at(i);
  }
  sort(x.begin(), x.end());
  for (int i = x.at(0); i <= x.at(n - 1); i++)
  {
    int cost = 0;
    REP(j, n)
    {
      cost += (x.at(j) - i) * (x.at(j) - i);
    }
    ans = min(ans, cost);
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
use proconio::input;
// use std::collections::HashMap;

fn main() {
    input! {
        S: String,
    }

    let ans = if &S[2..3] == &S[3..4] && &S[4..5] == &S[5..6] {
        "Yes"
    } else {
        "No"
    };
    println!("{}", ans);
}


Measured memory_bytes: 2092
import java.util.*;
import java.lang.*;
import java.io.*;

public class Main{ 
    public static void main(String[] args) throws IOException{
        FastReader sc = new FastReader();
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] nums = new int[n];
        int ans = 0;
        for (int i = 0; i < n; i++){
            nums[i] = sc.nextInt();
        }
        Arrays.sort(nums);
        for (int i = 0; i < k; i++){
            ans+=nums[i];
        }
        System.out.println(ans);
    }
}

class FastReader{ 
    BufferedReader br; 
    StringTokenizer st; 
    public FastReader() { 
        br = new BufferedReader(new InputStreamReader(System.in)); 
    } 
    String next(){ 
        while (st == null || !st.hasMoreElements()) { 
            try{ 
                st = new StringTokenizer(br.readLine()); 
            }catch (IOException  e){ 
                e.printStackTrace(); 
            } 
        } 
        return st.nextToken(); 
    } 
    int nextInt(){ 
        return Integer.parseInt(next()); 
    } 
    long nextLong(){ 
        return Long.parseLong(next()); 
    } 
    double nextDouble(){ 
        return Double.parseDouble(next()); 
    } 
    String nextLine(){ 
        String str = ""; 
        try{ 
            str = br.readLine(); 
        } 
        catch (IOException e){ 
            e.printStackTrace(); 
        } 
        return str; 
    } 
}



Measured memory_bytes: 32812
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define si size()
#define bk back()
#define popb pop_back()
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define endl "\n"
#define lb lower_bound
#define ub upper_bound
#define emp empty()
#define beg begin()
#define en end()
#define ump unordered_map
#define forl(i,a,n) for(int i=a;i<n;i++)
#define rfor(i,n,a) for(int i=n;i>=a;i--)
#define fore(i,a,n) for(int i=a;i<=n;i++)
#define len length()
#define ld long double
const ll N=1e18;
const ll maxi=1e5+10;
ll dp[maxi];
int main()
{
    int n,w;
    cin>>n>>w;
    ll arr[n+1][2];
    forl(i,1,n+1) forl(j,0,2) cin>>arr[i][j];
    forl(i,0,maxi) dp[i]=N;
    dp[0]=0;
    forl(i,1,n+1)
    {
        rfor(j,maxi,0)
        {
            if(j-arr[i][1]>=0) dp[j]=min(dp[j],dp[j-arr[i][1]]+arr[i][0]);
        }

    }
    ll ans=0;
    forl(i,0,maxi)
    {
        if(dp[i]<=w) ans=i;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 1024
// E - Knapsack2 https://atcoder.jp/contests/dp/tasks/dp_e
/* 入力例
3 8
3 30
4 50
5 60
// →出力　90
*/
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int N, W;
    int INF=INT_MAX/2;
    cin >> N >> W;
    long long int v[N], w[N], dp[N][N*1000 + 1];
    for(int i = 0; i < N; i++) {
        cin >> w[i] >> v[i];
    }
    for(int i = 0; i < N; i++) {
        for(int j = 0; j <= N*1000+1; j++) {
            if(i == 0) {
                if(j<=v[i])
                    dp[i][j] = w[i];
                else
                    dp[i][j] = INF;
            } else {
                if(j <= v[i])
                    dp[i][j] = min(dp[i-1][j],w[i]);
                else
                    dp[i][j] = min(dp[i-1][j],dp[i-1][j-v[i]]+w[i]);
            }
        }
    }
    int flag=0;
    for(int j=0;j<N*1000+1;j++){
        if(dp[N-1][j]<=W && dp[N-1][j+1]>W){
           cout << j<<  endl;
           flag=1;
        }
    }
    if(flag==0)cout << N*1000 <<  endl;

    return 0;
}


Measured memory_bytes: 78336
#include<bits/stdc++.h>
#define endl '\n'
#define mp make_pair
using namespace std;
// #include <ext/pb_ds/assoc_container.hpp> 
// #include <ext/pb_ds/tree_policy.hpp> 
// using namespace __gnu_pbds; 
// #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
typedef long long int ll;
ll mod =1000000007;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,d,a,b;
    cin>>n>>a>>b;
    ll ans=n*a;
    ans=min(ans,b);
    cout<<ans<<endl;
}

Measured memory_bytes: 256
n = input()
a = list(map(int, input().split(' ')))
p = 0
z = False
ret = 0
for i in range(len(a)):
    if a[i] == 0:
        z = True
    if a[i] < 0:
        p = (p + 1) % 2
        a[i] = -a[i]
    ret = ret + a[i]
a.sort()
if z == True or p == 0:
    print(ret)
else:
    print(ret-2*a[0])

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

#define FOR(i, j, n) for (int i(j); i < n; ++i)
#define FORR(v, c) for (auto &v : c)
#define F first
#define S second
#define SQ(x) (x)*(x)
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define dbg(x) cerr<<#x<<" = " << (x) << endl
#define pnl(x) cout << x << '\n'
#define pns(x) cout << x << ' '
#define read(x) cin >> x
#define read2(x,y) cin >> x >> y
#define read3(x, y, z) cin >> x >> y >> z
#define read4(a, b, c, d) cin >> a >> b >> c >> d
#define readv(v) FORR(c,v) read(c)

struct Arrete { int v, c;};
struct Point {int x, y; double distance(Point other) const {return sqrt(SQ(x-other.x)+SQ(y-other.y));}};

typedef	vector<int>	vi;
typedef pair<int,int>	ii;
typedef vector<string>	vs;
typedef vector<ii>	vii;
typedef vector<Arrete>	vg;
typedef vector<long long>	vl;
typedef	long long ll;

const int MAXW = 1e5+1;

ll value [MAXW];

int		main(void)
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	
	int N, W;
	read2(N, W);

	for (int i(0); i < N; ++i)
	{
		ll w, v;
		read2(w, v);

		for (int j(W); j >= w;--j)
			value[j] = max(value[j], value[j-w] + v);
	}
	ll ans(0);
	FOR(i, 0, W+1)
		ans = max(ans, value[i]);
	pnl(ans);
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,N) for(int i=0; i<N; i++){    ;
int main() {
int N;
cin>>N;
int max=0;
int answer=0;
vector<int>H(N);
rep(i,N)
cin>>H.at(i);
if(max<=H.at(i)){
    answer++;
    max=H.at(i);
}
}
cout<<answer<<endl;
 }


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

typedef long long ll;

int main()
{
    int H, W;
    cin >> H >> W;

    for (int i = 0; i < H; ++i)
    {
        string S;
        cin >> S;
        cout << S << endl;
        cout << S << endl;
    }
}


Measured memory_bytes: 3628
from sys import stdin
import sys
sys.setrecursionlimit(10**8)

def getInputs():
	inputs=[]
	for line in stdin:
		line=line.split()
		inputs.append(line)
	return inputs

def r(x):
	return x[::-1]


def main(inputs):
	s=inputs[0][0]
	n=len(s)
	if s[::-1]!=s:
		print("No")
		sys.exit(0)
# 	print(s[0:(n-1)//2])
	if s[0:(n-1)//2]!=r(s[0:(n-1)//2]):
		print("No")
		sys.exit(0)
# 	print(s[(n+3)//2-1:])
	if s[(n+3)//2-1:]!=r(s[(n+3)//2-1:]):
		print("No")
		sys.exit(0)
	print("Yes")
	
	

if __name__=="__main__":
	inputs=getInputs()
# 	inputs=simInputs()
	main(inputs)



Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
typedef long long LL;
LL MOD = 1000000007LL;
vector<int> pos[100001];
LL fact[100001];
LL inv_fact[100001];
LL mod_pow(LL a, LL n) {
	if (n == 0) return 1;
	if (n % 2 == 0) {
		LL b = mod_pow(a, n / 2);
		return (b*b) % MOD;
	}
	return (a*mod_pow(a, n - 1)) % MOD;
}
LL comb(LL n, LL k) {
	if (n < k) return 0;
	LL ret = fact[n];
	(ret *= inv_fact[k]) %= MOD;
	(ret *= inv_fact[n - k]) %= MOD;
	return ret;
}
int main() {
	int n;
	cin >> n;
	for (int i = 0; i < n+1; i++) {
		int a;
		cin >> a;
		pos[a].push_back(i);
	}
	int idx = -1;
	for (int i = 1; i <= n; i++) {
		if (pos[i].size() == 2) {
			idx = i;
			break;
		}
	}
	fact[0] = inv_fact[0] = 1;
	for (int i = 1; i <= n; i++) {
		fact[i] = (fact[i - 1] * i) % MOD;
		inv_fact[i] = (inv_fact[i - 1] * mod_pow(i, MOD - 2)) % MOD;
	}
	for (int k = 1; k <= n + 1; k++) {
		LL ans = comb(n - 1, k);
		(ans += 2 * comb(n - 1, k - 1)) %= MOD;
		int x = pos[idx][0] + (n - pos[idx][1]);
		ans = (ans - comb(x, k - 1) + MOD) % MOD;
		(ans += comb(n - 1, k - 2)) %= MOD;
		cout << ans << endl;
	}
}

Measured memory_bytes: 8192
#include <stdio.h>
#include <math.h>

int main(void){
  int i, j, k = 3, n, x, s, sosu[1231], count = 0;

  sosu[0] = 1;
  sosu[1] = 2;
  sosu[2] = 3;
  for(i = 5; i <= 10007; i += 2){
    s = 0;
    for(j = 2; sosu[j] <= sqrt((double)i); j++){
      if(i % sosu[j] == 0){
	s++;
	break;
      }
    }
    if(s == 0){
      sosu[k++] = i;
    }
  }

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%d", &x);
    s = 0;
    for(j = 1; sosu[j] <= sqrt((double)x); j++){
      if(x % sosu[j] == 0){
	s++;
	break;
      }
    }
    if(s == 0){
      count++;
    }
  }
  printf("%d\n", count);
  return 0;
}

Measured memory_bytes: 600
N = int(input())
A = list(map(int, input().split()))

d = {}
for a in A:
    d.setdefault(a, 0)
    d[a] += 1

A = sorted(set(A))
t = [True] * (10 ** 6 + 1)

for a in A:
    for i in range(a + a, 10 ** 6 + 1, a):
        t[i] = False

for a in d:
    if d[a] > 1:
        t[a] = False

result = 0
for a in A:
    if t[a]:
        result += 1
print(result)


Measured memory_bytes: 149272
#include<iostream>
#include<iomanip>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<time.h>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
#define INF (1<<30)
#define INFLL (1LL << 60)
#define MOD 1000000007
#define rep(i, n) for(int i=0; i<(n); ++i)
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; }


struct Edge {
	int to; int cost;
	Edge(int t, int c) { to = t; cost = c; }
};
using Graph = vector<vector<Edge>>;

ll prim(const Graph& graph, int start)
{
	vector<bool> seen(graph.size(), 0);
	using CostPair = pair<ll, int>;
	priority_queue<CostPair, vector<CostPair>, greater<CostPair>> pq;
	pq.push(make_pair(0, start));
	ll sumcost = 0;
	while (!pq.empty()) {
		auto top = pq.top(); pq.pop();
		ll c = top.first;
		int v = top.second;
		if (seen[v]) continue;
		seen[v] = 1;
		sumcost += c;
		for (Edge e : graph[v]) {
			if (seen[e.to]) continue;
			pq.push(make_pair(e.cost, e.to));	//keyは、辺のコスト
		}
	}
	return sumcost;
}

int main()
{
	int N; cin >> N;
	vector<pair<int, int>> xy(N), xi(N), yi(N);
	rep(i, N) {
		int x, y; cin >> x >> y;
		xy[i] = make_pair(x, y);
		xi[i] = make_pair(x, i);
		yi[i] = make_pair(y, i);
	}
	//auto uf = UF(N);
	sort(xi.begin(), xi.end());
	sort(yi.begin(), yi.end());

	//グラフの構築
	Graph graph(N);
	rep(i, N - 1) {
		int x0 = xi[i].first, x1 = xi[i + 1].first;
		int i0 = xi[i].second, i1 = xi[i + 1].second;
		graph[i0].emplace_back(Edge(i1, abs(x0 - x1)));
		graph[i1].emplace_back(Edge(i0, abs(x0 - x1)));

		int y0 = yi[i].first, y1 = yi[i + 1].first;
		i0 = yi[i].second, i1 = yi[i + 1].second;
		graph[i0].emplace_back(Edge(i1, abs(y0 - y1)));
		graph[i1].emplace_back(Edge(i0, abs(y0 - y1)));
	}
	cout << prim(graph, 0) << endl;;
	return 0;
}


Measured memory_bytes: 14808
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s,d,rep;
    int n,a,b;
    char c;
    cin >> s >> n;
    while(n--) {
        cin >> d;
        if(d == "print") {
            cin >> a >> b;
            cout << s.substr(a,b-a+1) << endl;
        }
        else if(d == "reverse") {
            cin >> a >> b;
            for(int i = 0; i < (b-a+1)/2; i++) {
                c = s.at(a+i);
                s.at(a+i) = s.at(b-i);
                s.at(b-i) = c;
            }
        }
        else if(d == "replace") {
            cin >> a >> b >> rep;
            s = s.replace(a,b-a+1,rep);
        }
    }
}


Measured memory_bytes: 3172
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)


int main() {
    int n; cin >> n;
    cout << fixed << setprecision(10);
    cout << n*2*M_PI << endl;
}





Measured memory_bytes: 3788
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long n = sc.nextLong();
		long count = n/11*2;
		n -= n/11*11;
		if(n<=6&&n>0) count++;
		else if(n>6) count += 2;
		System.out.println(count);
		sc.close();
	}
}

Measured memory_bytes: 25044
T = raw_input()
Tlist = list(T)
S = raw_input()

i = 0
while i < len(Tlist):
  i = i+1
  Tword = ''
  for j in range(0,len(Tlist)):
    Tword = Tword + Tlist[j]

  if Tword == S:
    print('Yes')
    break

  last_word = Tlist[-1]
  new_List =[0 for k in range(len(Tlist))]
  for j in range(1,len(Tlist)):
    new_List[j]=Tlist[j-1]
  new_List[0]=last_word
  Tlist = new_List

if Tword != S:
  print('No')


Measured memory_bytes: 2568
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define show(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(){
    string s;
    cin >> s;
    int n = (int) s.size();
    rep(i,n-1){
        if(s[i] == s[i+1]){
            cout << i+1 << " " << i+2 << endl;
            return 0;
        }
    }
    rep(i,n-2){
        if(s[i] == s[i+2]){
            cout << i+1 << " " << i+3 << endl;
            return 0;
        }
    }
    cout << "-1 -1" << endl;
}

Measured memory_bytes: 632
#include <bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
const long long mod = 1e9+7;
long long power(long long a, long long b, long long m = mod) {
    long long x = 1;
    while(b) {
        if(b & 1) {
            x = 1ll * x * a % m;
        }
        a = 1ll * a * a % m;
        b /= 2;
    }
    return x;
}
const int N = 2e5+9;
int a[N];
long long f[N];
signed main() {  
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    
    
    int n; cin >> n;
    for(int i = 1; i <= n; i++) {
        cin >> a[i];
        f[a[i]]++;
    }
    long long ans = 0;
    for(int i = 1; i <= n; i++) {
        ans += f[i] * (f[i]-1)/2;
    }
    for(int i = 1; i <= n; i++) {
        long long tmp = ans - f[a[i]] * (f[a[i]]-1) / 2;
        tmp += (f[a[i]] - 1) * (f[a[i]] - 2) / 2;
        cout << tmp << "\n";
    }




    return 0;
    
}

Measured memory_bytes: 3968