akhauriyash/Code-Regression huggingface dataset:
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<sstream>
#include<climits>
#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define rrep(X,Y) for (int (X) = (Y)-1;(X) >=0;--(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};

const int MAX_N = 100000;
int s[MAX_N];

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

  int ans = n;
  for (int i = 1; i < n; ++i) {
    if (str[i-1] != str[i]) ans = min(ans,max(i,n-i));
  }
  
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin >> n;
    int x = n/3;
    int y = n/5;
    int z = n/15;
    long long total = 0;
    long long xtotal = 0;
    long long ytotal = 0;
    long long ztotal = 0;
    for(int i = 0; i <= n; i++) total += i;
    for(int i = 0; i <= x; i++) xtotal += 3*i;
    for(int i = 0; i <= y; i++) ytotal += 5*i;
    for(int i = 0; i <= z; i++) ztotal += 15*i;

    //cout << x << " " << total << " " << xtotal << " " << ytotal << " " << ztotal << endl;

    cout << total-xtotal-ytotal+ztotal << endl;  
} 


Measured memory_bytes: 3632
while 1:
    H, W = map(int, input().split())
    if H == 0 and W == 0:
        break
    elif W % 2 == 0:
        s = "#." * (W // 2)
    elif W % 2 == 1:
        s = '#.' * (W // 2) + '#'
    for i in range(H):
        print(s)
        s = s.translate(str.maketrans('#.', '.#'))
    print()

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

using namespace std;
typedef tuple<int,int> P;
typedef vector<int> V;
typedef vector<V> Graph;
#define PB push_back

struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init;

#define rep(i,n) for(auto i=(n)*0;i<n;i++)
#define range(it,v) for(auto &it:v)
void make_tree(int v,Graph& G,V& Par,V& D, Graph& C){
    range(e,G[v]){
	if(e!=Par[v]){
	    C[v].PB(e);
	    D[e]=D[v]+1;
	    Par[e]=v;
	    make_tree(e,G,Par,D,C);
	}
    }
}

void euler_tour(int v,Graph &C,vector<P>& seg,int &cnt){
    int l=cnt++;
    range(e,C[v])
	euler_tour(e,C,seg,cnt);
    int r=cnt++;
    seg[v]=P(l,r);
}

#define SIZE 1000000
#define L(v) (v*2+1)
#define R(v) (v*2+2)
#define SET 0
#define ADD 1
#define GET 2
typedef P val;
struct node{
    int bg,ed;
    val v;
    inline val getval(){
	return v;
    }
    inline void init(int b,int e){
	bg =b,ed=e;
	v=val(-1,-1);
    }
    bool isleaf(){return bg==ed;}
}mem[SIZE];
inline val comb(val l,val r){
	return max(l,r);
    }
class segTree{
private:node *t;
    void make_tree(int bg,int ed,int v=0){
	node *p=t+v;
	p->init(bg,ed);
	if(!p->isleaf()){
	    int m=(bg+ed)/2;
	    make_tree(bg,m,L(v));
	    make_tree(m+1,ed,R(v));
	}
    }
public:
    segTree(int bg,int ed):t(mem){make_tree(bg,ed);}
    inline void lazy_update(int v){
	node *p=t+v,*l=t+L(v),*r=t+R(v);
	if(p->isleaf())return;
	l->v=comb(p->v,l->v);
	r->v=comb(p->v,r->v);
    }
    val treat(int type,int bg,int ed,val x,int v=0){
	node *p=t+v,*l=t+L(v),*r=t+R(v);
	lazy_update(v);
	if(P(bg,ed)==P(p->bg,p->ed)){
	    if(type==ADD)p->v=comb(p->v,x);
	    return p->v;
	}
	int m;
	val res=P(-1,-1);
	if(bg<=(m=min(ed,l->ed)))
	    res=comb(res,treat(type,bg,m,x,L(v)));
	if((m=max(bg,r->bg))<=ed)
	    res=comb(res,treat(type,m,ed,x,R(v)));
	return res;
    }
    val get(int bg,int ed){
	return treat(GET,bg,ed,val());
    }
    void add(int bg,int ed,val x){
	treat(ADD,bg,ed,x);
    }
};

const int root=1;
int main(){
    for(int N,Q;cin>>N>>Q,N+Q;){
	Graph g(N+1),child(N+1);
	V depth(N+1,0),par(N+1,0);
	vector<P> seg(N+1);
	for(int i=2;i<=N;i++){
	    int j;
	    cin>>j;
	    g[i].PB(j);
	    g[j].PB(i);
	}
	make_tree(root,g,par,depth,child);
	int sz=0;
	euler_tour(root,child,seg,sz);
	segTree tree(0,sz);
	tree.add(0,sz,P(0,root));
	long long res=0;
	while(Q--){
	    string op;int v;
	    cin>>op>>v;
	    int l,r;
	    tie(l,r)=seg[v];
	    if(op=="M"){
		    tree.add(l,r,P(depth[v],v));
	    }
	    else{
		int d,p;
		tie(d,p)=tree.get(l,l);
		res+=p;
	    }
	}
	cout<<res<<endl;
    }
    return 0;
}

Measured memory_bytes: 40436
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
#include <sstream>
#include <iomanip>
#include <limits>
#include <cstring>

using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<double, double >pd;
typedef pair<string, string> sP;
typedef pair<ll, P> PP;
typedef pair<P, P> PPP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const double eps = 1e-10;
const double PI = 3.14159265358979323846;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };

#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define pb push_back
#define eb emplace_back
#define fr first
#define sc second




int main() {
	ll a, b;
	cin >> a >> b;
	cout << (a + b) / 2 << endl;
	return 0;
}



Measured memory_bytes: 3080
// finish date: 2018/09/23
#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>>
        vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>>
        vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 1000000007;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    string S, T;
    cin >> S >> T;
    map<char, char> word;
    rep(i, S.length()) {
        if (word.count(S[i]) && word[S[i]] != T[i]) {
            cout << "No" << endl;
            return 0;
        }
        word[S[i]] = T[i];
    }
    vb check(26, 0);
    for (auto e:word) {
        if (check[e.second - 'a']) {
            cout << "No" << endl;
            return 0;
        }
        check[e.second - 'a'] = true;
    }
    cout << "Yes" << endl;
    return 0;
}



Measured memory_bytes: 776
from collections import Counter
from operator import mul
from functools import reduce

def combinations_count(n, r):
    r = min(r, n - r)
    numer = reduce(mul, range(n, n - r, -1), 1)
    denom = reduce(mul, range(1, r + 1), 1)
    return numer // denom

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

count_by_kw=Counter()

for i in s:
    count_by_kw[''.join(sorted(i))]+=1

values, counts = zip(*count_by_kw.most_common())
cnt=0
for i in counts:
    if i>1:
        cnt+=combinations_count(i,2)

print(cnt)



Measured memory_bytes: 38268
#include <bits/stdc++.h>
using namespace std;
int n;
map<int,int>mp;
int m;
int main() {
cin>>n;
for(int a,i=0;i<n;i++){
	cin>>a;
	mp[a]++;
}
cin>>m;
for(int a,i=0;i<m;i++)
{
	cin>>a;
	if(!mp[a]){
		cout<<"NO";
		return 0;
	}
	mp[a]--;
}
cout<<"YES";
}

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

unsigned long long fact(int n){
  unsigned long long x=1;
  for(unsigned long long i=1;i<=n;++i)x*=i;
  return x;
}

int main(){
  string s;cin>>s;
  map<char,int> c;
  for(int i=0;i<s.size();++i){
    ++c[s[i]];
  }
  
  int odd=0;
  for(map<char,int>::iterator it=c.begin();it!=c.end();++it){
    odd+=((it->second) % 2)? 1 : 0;
  }
  
  if(odd<=1){
  	if((odd==1&&s.size()%2==0) || (odd==0&&s.size()%2==1)){
  		cout<<0<<endl;
  	}else{
	    int len=s.size()/2;
	    unsigned long long ans=fact(len);
	    for(map<char,int>::iterator it=c.begin();it!=c.end();++it){
	      ans/=fact(it->second/2);
	    }
	    cout<<ans<<endl;
    }
  }else{
    cout<<0<<endl;
  }
  return 0;
}

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

int main() {
    //input
    int n;
    cin >> n;
    vector<int> d(n);
    rep(i, 0, n) cin >> d[i];
    sort(d.begin(), d.end()); //昇順にソート
    if( d[n/2 - 1] == d[n/2] ) cout << "0" << endl; 
    else cout << d[n/2] - d[n/2 - 1] << endl;
    return 0; 
}

Measured memory_bytes: 640
#!/usr/bin/env python3
import sys


def solve(b: str):
    dict = {"A":"T","C":"G","G":"C","T":"A"}
    print(dict[b])
    return


# Generated by 1.1.3 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    b = next(tokens)  # type: str
    solve(b)

if __name__ == '__main__':
    main()


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

int main(void){
    ll n;
    cin>>n;
    ll a;
    string ans;
    while(n>0){
        a=n%26+96;
        n/=26;
        if(a==96){
            a+=26;
            n-=1;
        }
        ans = char (a) + ans;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3620
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
from collections import Counter
def main():
    n = int(input())
    a = tuple(map(int, input().split()))
    suma = sum(a)
    aa = Counter(a)
    q = int(input())
    m = map(int, read().split())
    for b, c in zip(m, m):
        kosu = aa[b]
        sa = c - b
        suma += sa * kosu
        print(suma)
        aa[b] = 0
        aa[c] += kosu

if __name__ == '__main__':
    main()


Measured memory_bytes: 110848
import java.util.Scanner;

public class Main {
	  public static void main(String[] args) {
	    Scanner sc = new Scanner(System.in);
	    String n = sc.next();
	    int count = 0;
	    for(int i = 0; i < n.length(); i++) {
	    	if("2".equals(n.substring(i, i+1))) {
	    		count++;
	    	}
	    }
	    System.out.println(count);
	}
}


Measured memory_bytes: 22736
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <tuple>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
typedef long long int64;
using namespace std;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long INFL = 1e18;
const int MOD = 1000000007;
const int MAX = 210000;

int gcd(int a, int b) {
    return b != 0 ? gcd(b, a % b) : a;
}

//逆元を求める関数
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;
}

void solve() {
		int n; cin >> n;
		int a; cin >> a;
		int b; cin >> b;
		cout << min((n * a), b) << endl;
    return;
}

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



Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <math.h>
#include <queue>
#include <string.h>
#include <map>
#include <set>
#include <cstdlib>

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

char ToUpper(char cX) { return toupper(cX); }
char Tolower(char cX) { return tolower(cX); }

const long long INF = 1LL << 60;
const long long MOD = 1000000007;

using namespace std;
typedef unsigned long long ull;
typedef  long long ll;



vector<vector<ll>> dp;

class UnionFind {
public:
	vector<ll> Parent;
	UnionFind(ll N) {
		Parent = vector<ll>(N, -1);
	}
	ll root(ll A) {
		if (Parent[A] < 0) {
			return A;
		}
		return Parent[A] = root(Parent[A]);
	}

	ll size(ll A) {
		return -Parent[root(A)];
	}

	bool connect(ll A, ll B) {
		A = root(A);
		B = root(B);
		if (A == B) {
			return false;
		}
		if (size(A) < size(B)) {
			swap(A, B);
		}

		Parent[A] += Parent[B];
		Parent[B] = A;

		return true;
	}

};

class Edge {
public:
	ll source, target, cost;
	Edge(ll source = 0, ll target = 0, ll cost = 0) :
		source(source), target(target), cost(cost) {}
	bool operator<(const Edge &e)const {
		return cost < e.cost;
	}
};

ll kuraskal(ll N, vector<Edge> &edges) {
	ll totalCost = 0;
	sort(edges.begin(), edges.end());
	UnionFind uni(N + 1);
	ll source, target;
	for (ll i = 0; i < edges.size(); i++) {
		Edge e = edges[i];
		if (uni.root(e.source) != uni.root(e.target)) {
			totalCost += e.cost;
			uni.connect(e.source, e.target);
		}
	}
	return totalCost;
}




int main()
{
	ll n;
	cin >> n;
	vector<vector<ll>> a;
	a.resize(n);
	for (int i = 0; i < n; i++) {
		a[i].resize(n);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	vector<Edge> edges;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i][j] != -1) {
				edges.push_back(Edge(i, j, a[i][j]));
			}
		}
	}

	cout << kuraskal(n, edges) << endl;
	return 0;
}



Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define REPR(i, n) for (int i = n - 1; i >= 0; --i)
#define FOR(i, m, n) for (int i = m; i < n; ++i)
#define FORR(i, m, n) for (int i = m; i >= n; --i)
#define ALL(v) (v).begin(),(v).end()
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; }
const ll INF=1LL<<60;
const int inf=(1<<30)-1;
const int mod=1e9+7;
int dx[8]={1,0,-1,0,-1,-1,1,1};
int dy[8]={0,1,0,-1,-1,1,-1,1};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s,t;cin >> s >> t;
    vector<int> a(26),b(26);
    REP(i,s.size()){
        a[s[i]-'a']++;
        b[t[i]-'a']++;
    }
    sort(ALL(a));
    sort(ALL(b));
    REP(i,26){
        if(a[i]!=b[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> VI;
typedef vector<VI> VVI;
const int mod=1e9+7;
int n; ll K;
VVI mul(VVI& a,VVI& b) {
	VVI c(n,VI(n));
	int i,j,k;
	for(i=0;i<n;i++) {
		for(j=0;j<n;j++) {
			for(k=0;k<n;k++) {
				c[i][j]=(c[i][j]+(ll)a[i][k]*b[k][j]%mod)%mod;
			}
		}
	}
	return c;
}
VVI Pow(VVI& mat,ll K) {
	VVI r(n,VI(n)),b=mat;
	int i;
	for(i=0;i<n;i++) r[i][i]=1;
	while(K>0) {
		if(K&1) r=mul(r,b);
		b=mul(b,b);
		K>>=1;
	}
	return r;
}
int main() {
	int i,j;
	scanf("%d%lld",&n,&K);
	VVI r(n,VI(n));
	for(i=0;i<n;i++) {
		for(j=0;j<n;j++) {
			scanf("%d",&r[i][j]);
		}
	}
	r=Pow(r,K);
	int res=0;
	for(i=0;i<n;i++) {
		for(j=0;j<n;j++) {
			res=(res+r[i][j])%mod;
		}
	}
	printf("%d", res);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 5;
const long long mod = 1e9 + 7;

long long n;
void printString(long long n)
{
    string st = "";
    int i = 0; // To store current index in str which is result

    while (n > 0) {
        // Find remainder
        long long rem = n % 26;

        // If remainder is 0, then a 'Z' must be there in output
        if (rem == 0) {
            st += 'z';
            n = (n / 26) - 1;
        }
        else // If remainder is non-zero
        {
            st += (rem - 1) + 'a';
            n = n / 26;
        }
    }

    // Reverse the string and print result
    reverse(st.begin(), st.end());
    cout << st << endl;

}
void solve(){
    printString(n);
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int i = 0;
    cin >> n;
    solve();
    return 0;
}


Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <string>
#include <queue>
#include <algorithm>
#include <cctype>
#define shosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const double pi=acos(-1);

vector<char> a(4),b(4);

int main(){
	char c,d,e,f;
	while(cin>>c>>d>>e>>f){
		int hit=0,blow=0;
		a[0]=c;
		a[1]=d;
		a[2]=e;
		a[3]=f;
		for(int i=0;i<4;i++) cin>>b[i];
		for(int i=0;i<4;i++){
			if(a[i]==b[i]) hit++;
		}
		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i==j) continue;
				if(a[i]==b[j]) blow++;
			}
		}
		cout<<hit<<' '<<blow<<endl;
	}
}

Measured memory_bytes: 1180
s = int(input())

a = [0 for _ in range(10 ** 5)]

ans = 1

while not a[s-1]:
    a[s-1] += 1
    if not s % 2:
        s = s // 2
    else:
        s = 3 * s + 1
    ans += 1

print(ans)

Measured memory_bytes: 3864
s=list(map(int,input().split()))
if s[0]<=s[2]:
  s[2]-=s[0]
  s[0]=0
else:
  s[0]-=s[2]
  s[2]=0
if s[1]<=s[2]:
  s[1]=0
else:
  s[1]-=s[2]
print(*[s[0],s[1]])

Measured memory_bytes: 3064
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#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 <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = 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;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int N, K; scanf("%d%d", &N, &K);
    vector<ll> A(N);
    for(int i=0; i<N; i++) scanf("%lld", &A[i]);

    for(int i=K+1; i<=N; i++) {
        ll a = A[i-K-1];
        ll b = A[i-1];
        if(a < b) puts("Yes");
        else puts("No");
    }
    return 0;
}


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

int main () {
  int N ;
  cin >> N ;
  
  int ans = 0 ;
  
  vector<int> line(N) ;
  
  for(int i = 0 ; i < N ; i++ ) {
    cin >> line[i] ;
    ans += line[i] ;
  }
  
  int M ;
  cin >> M ;
  
  for(int i = 0 ; i < M ; i++ ) {
    int a , b ;
    cin >> a >> b ;
    cout << ans -line[a-1] + b << endl ;
  }
  
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
int A,B,C,D;
cin>>A>>B>>C>>D;
int ar1,ar2;
ar1=A*B;
ar2=C*D;
if(ar1>ar2)
cout<<ar1;
else
if(ar1<ar2)
cout<<ar2;
else
if(ar1==ar2)
cout<<ar1;
return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main{

	public static void main(String[] args) {
		try (Scanner sc = new Scanner (System.in)){
			String W = sc.nextLine();
			String T = "";
			int count = 0;
			while(true) {
				String s = sc.nextLine();
				if (s.equals("END_OF_TEXT")) break;
				T += " " + s;
			}
			String[] Sp = T.split(" ");
			String s = "";
			for (int i=0; i<Sp.length; i++) {
				s = Sp[i].toLowerCase();
				if (s.equals(W)) count++;
			}
			System.out.println(count);
		}
	}
}


Measured memory_bytes: 26404
#include<iostream>
#include<string>
#include<algorithm>

#define NUMBER 10
#define CARD_NUM 9
#define COLOR_NUM 3

using namespace std;

const char *color = "RGB";

bool checkSet(int *card, int num){
  int numnum[NUMBER] = {0,};
  for(int i = 0; i < num; ++i){
    numnum[ card[i] ]++;
  }
  for(int i = 1; i < NUMBER-2; ++i){
    if( numnum[ i ] >= 1 && numnum[i+1] >= 1 && numnum[i+2] >= 1 ){
      numnum[i]--;
      numnum[i+1]--;
      numnum[i+2]--;
      --i;
    }
  }
  for(int i = 1; i < NUMBER; ++i){
    if( numnum[ i ] == 3 ){
      numnum[ i ] -= 3;
    }
  }

  for(int i = 1; i < NUMBER; ++i){
    if( numnum[i] > 0 ) return false;
  }
  return true;
}

int main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; ++i){
    bool win = true;
    int ccardnum[COLOR_NUM]={0,};
    int card[CARD_NUM];
    int ccard[COLOR_NUM][CARD_NUM];
    char cardcolor[CARD_NUM];

    for(int j = 0; j < CARD_NUM; ++j)
      cin >> card[j];
    for(int j = 0; j < CARD_NUM; ++j)
      cin >> cardcolor[j];

    for(int k = 0; k < COLOR_NUM; ++k){
      for(int j = 0; j < CARD_NUM; ++j){
	if( cardcolor[j] == color[k] ){
	  ccard[k][ccardnum[k]] = card[j];
	  ccardnum[k]++;
	}
      }
    }
    for(int k = 0; k < COLOR_NUM; ++k){
      if( !checkSet( ccard[k], ccardnum[k] ) ){
	win = false;
	break;
      }
    }

    if( win ) cout << '1';
    else cout << '0';
    cout << endl;
    
  }
  return 0;
}

Measured memory_bytes: 0
h,w = map(int,input().split())
a = []
cnt = 0
for _ in range(h):
    a.append(list(input()))
    cnt += a[-1].count("#")
looked = [[True for _ in range(w)]for i in range(h)]
looked[0][0] = False
x,y = 0,1
now = [0,0]
ans = 1

while(True):
    look = [[min(now[y]+1,h-1),now[x]],[now[y],min(now[x]+1,w-1)]]
    flag = 1
    for i in range(2):
        if looked[look[i][x]][look[i][y]]:
            if a[look[i][x]][look[i][y]] == "#":
                now = [look[i][y],look[i][x]]
                looked[look[i][x]][look[i][y]] = False
                ans += 1
                flag = 0
                break
    if flag:
        break
if ans == cnt and now == [w-1,h-1]:
    print("Possible")
else:
    print("Impossible")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
typedef long long ll;
#define pb push_back
#define fi first
#define se second
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
template <class T, class U> ostream &operator<<(ostream &os, const pair<T, U> &p){os<<"("<<p.first<<","<< p.second<<")";return os;}
template <class T> ostream &operator<<(ostream &os, const vector<T> &v){os<<"{";REP(i,(int)v.size()){if(i)os<<",";os<<v[i];}os<<"}";return os;}
template <typename T, size_t S> void printArray(const T (&array)[S]){for(auto val : array)std::cout << val << ", ";std::cout << "\n";}
void Yes() {cout << "Yes" << endl;}
void No() {cout << "No" << endl;}
void YES() {cout << "YES" << endl;}
void NO() {cout << "NO" << endl;}
const double PI=acos(-1);
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;
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 = 1LL<<60;
//const int dx[4] = {1, 0, -1, 0};
//const int dy[4] = {0, 1, 0, -1};
//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};

void solve(){
    ll n, m; cin >> n >> m;
    vector<ll> x(m), diff;
    REP(i, m) cin >> x[i];
    sort(ALL(x));
    REP(i, m-1){
        ll d = x[i+1] - x[i];
        diff.pb(d);
    }
    sort(RALL(diff));
    ll res = 0;
    for(int i=n-1; i<diff.size(); i++){
        res += diff[i];
    }
    cout << res << endl;
}

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

Measured memory_bytes: 2168
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	ll n;
	cin>>n;
	if(n&1){
		cout<<((n-1)/2)*n<<endl;
	}
	else{
		cout<<(n/2)*(n-1)<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
object Main extends App {
  @scala.annotation.tailrec
  def loop(i: Int, ints: Seq[Int]): String = ints match {
    case Seq() => "Yes"
    case _ :: Seq() => "Yes"
    case x :: xs if x - 1 == i => loop(x - 1, xs)
    case x :: xs if x <= i => loop(x, xs)
    case _ => "No"
  }

  val sc = new java.util.Scanner(System.in)
  val i :: ints = Seq.fill(sc.nextInt())(sc.nextInt()).reverse
  println(loop(i, ints))
}

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

int d[11];
int f[10];

bool check(int x) {
	while (x > 0) {
		if (f[x % 10]) return false;
		x /= 10;
	}
	return true;
}
	
int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 1; i <= k; i++) {
		cin >> d[i];
		f[d[i]] = 1;
	}
	while (1) {
		if (check(n)) {
			cout << n;
			return 0;
		}
		n ++;
	}
}

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

typedef long long ll;

int tot = 0;
int Q[1010] = {};
int L = 501, R = 500;

void work(ll x) {
	if (x == 1) {
		return;
	}
	if (x & 1) {
		work(x - 1); 
		Q[--L] = ++tot;
	}
	else {
		work(x >> 1);
		Q[++R] = ++tot;
	}
}

ll N;

int main()
{
	ios::sync_with_stdio(0);
	cin >> N;
	work(N + 1);
	cout << 2 * tot << endl;
	for (int i = L; i <= R; ++i) {
		cout << Q[i] << " ";
	}
	for (int i = 1; i <= tot; ++i) {
		cout << i << " ";
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
use proconio::{
    fastout, input,
    marker::{Bytes, Chars, Isize1, Usize1},
};

fn main() {
    input! {
        n:usize,k:usize,
        v:[(usize,usize);n]
    }
    let mut mask = !k;
    let mut p = 0;
    let mut ans = 0;
    while p <= 32 {
        let mut buf = 0;
        for (cost, value) in &v {
            if (mask & cost) == 0 {
                buf += value;
            }
        }
        ans = std::cmp::max(ans, buf);

        while mask & (1 << p) != 0 {
            p += 1;
            if p > 32 {
                break;
            }
        }
        for i in 0..p {
            mask &= !(1 << i);
        }
        mask |= 1 << p;
    }
    println!("{}", ans);
}


Measured memory_bytes: 5500
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#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=(b)-1; i>=(a); --i)
// const ll MOD=1000000007ll;
static const ll MOD=1e9 + 7;
static const int MAX=510000;

ll fact[MAX], fact_inv[MAX];

//繰り返し二乗法
ll power(ll a, ll b){
    ll res = 1;
    while(b > 0){
        if(b & 1) res = res * a % MOD;
        a = a * a % MOD;
        b >>= 1;
    }
    return res;
}

ll comb(ll n, ll r){
    return (fact[n] * fact_inv[r]) % MOD * fact_inv[n-r] % MOD;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}//mod mでの逆元aを計算

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




int main(){
    ll N, K; cin >> N >> K;
    fact[0] = 1;
    //階乗計算(O(n))
    REP(i, N) fact[i+1] = fact[i] * (i+1)%MOD;
    fact_inv[N] = power(fact[N], MOD - 2);
    //逆元計算(O(logp + n))
    FORR(i, 0, N) fact_inv[i] = fact_inv[i+1]*(i+1)%MOD;
    //あとはcomb(n,r)に値を突っ込めば良い
    //cout << comb(n, 3) << endl;

    for(int i = 1; i <= K;i++){
        if(i <= N - K + 1){
            cout <<  comb(N-K + 1, i) * comb(K-1, i-1) % MOD << endl;
        }else{
            cout << 0 << endl;
        }
    }
}

Measured memory_bytes: 2304
L = 10**2+10
n = int(input())
ans = [0] * n
for i in range(1, L):
    for j in range(1, L):
        for k in range(1, L):
            x = i**2+j**2+k**2+i*j+j*k+i*k
            if x <= n:
                ans[x-1] += 1
print(*ans, sep="\n")


Measured memory_bytes: 68952
#include<algorithm>
#include<iostream>
#include<string.h>
#include<iomanip>
#include<stdio.h>
using namespace std;

int main()
{
	int n;
	cin>>n;
	int a[n];
	
	for(int i=0; i<n; i++)
	{
		cin>>a[i];
	}
	
	int t;
	int flag=0;
	for(int i=0; i<n-1; i++)
	{
		t=i;
		for(int j=i+1; j<n; j++)
			if(a[j]<a[t])
			{
				t=j;
				
			}
//		cout<<i<<" "<<t<<endl;
		
		if(t!=i)
		{
			flag++;
			if(flag>1)
			{
				cout<<"NO";
				return 0;
			}
			swap(a[i],a[t]);
		}
		
	}
	cout<<"YES";
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)



template<class Abel> struct UnionFind {
    vector<int> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
    vector<int> siz; // 素集合のサイズを表す配列(1 で初期化)
    vector<int> rank;
    vector<Abel> diff_weight;    // 根からの距離

    UnionFind(int N,Abel s = 0) : par(N), siz(N, 1), rank(N,0){ //最初は全てが根であるとして初期化、頂点数N
        diff_weight.resize(N);
        for(int i = 0; i < N; i++) par[i] = i,diff_weight[i] = s;
    }

    int root(int x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        else {
            int r = root(par[x]);
            diff_weight[x] += diff_weight[par[x]]; // 累積和をとる
            return par[x] = r;
        }
    }

    void unite(int x, int y,Abel w=0) { // xとyの木を併合 重みがあるときはw指定
        w += weight(x); w -= weight(y);
        x = root(x); y = root(y);
        if (x == y) return ;
        if (rank[x] < rank[y]) swap(x, y), w = -w;
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        diff_weight[y] = w;
        // 素集合のサイズ更新
        siz[y] += siz[x];
        return ;

    }


    bool same(int x, int y) { // 2つのデータx, yが属する木が同じならtrueを返す
        int rx = root(x);
        int ry = root(y);
        return rx == ry;
    }

    int size(int x) { // 素集合のサイズ
        return siz[root(x)];
    }

    int weight(int x) {
        root(x); // 経路圧縮
        return diff_weight[x];
    }

    Abel diff(int x, int y) {    // 同じ集合内にある時のみ定義。異なる集合の頂点同士いれるとバグる。二頂点の距離を得る。
        return weight(y) - weight(x);
    }
};


int main(){
    int N,M;cin >> N >> M;
    UnionFind<int> uni(N);
    rep(i,M){
        int a,b,c;
        cin >> a >> b >> c;
        a--;b--;

        if(uni.same(a,b)){    // 同一集合内にある時の分岐
            int diff = uni.diff(a,b);

            if(diff != c){
                cout << "No" << endl;
                return 0;
            }
        }
        else{
            uni.unite(a,b,c);
        }
    }
    cout << "Yes" << endl;
}


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

using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> d(N);

    for(int i = 0; i < N; i++) cin >> d[i];
    sort(d.begin(),d.end());
    int ans;
   
    if(N % 2 == 0){ ans = d[(N - 1)/ 2 + 1] - d[(N - 1) / 2];}
    cout << ans;

 return 0;
}

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

struct UnionFind {
  vector<int> parent, rank;
  UnionFind(int N = 1) {
    init(N);
  }
  void init(int N = 1) {
    parent.resize(N);
    rank.resize(N);
    for (int i = 0; i < N; i++) {
      parent.at(i) = i;
      rank.at(i) = 0;
    }
  }
  int root(int x) {
    if (parent.at(x) == x) return x;
    else {
      int r = root(parent.at(x));
      parent.at(x) = r;
      return r;
    }
  }
  bool issame(int x, int y) {
    return root(x) == root(y);
  }
  void merge(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) return;
    if (rank.at(x) < rank.at(y)) swap(x, y);
    if (rank.at(x) == rank.at(y)) rank.at(x)++;
    parent.at(y) = x;
  }
};
int main() {
  int N, M; cin >> N >> M;
  vector<int> p(N+1);
  for (int i = 1; i <= N; i++) cin >> p.at(i);
  UnionFind uf(N+1);
  for (int i = 0; i < M; i++) {
    int x, y; cin >> x >> y;
    uf.merge(x, y);
  }
  int ans = 0;
  for (int i = 1; i <= N; i++) {
    if (uf.issame(p.at(i), i)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 1408
import * as fs from 'fs';

export class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

	readChars(): string[] {
		let S = this.readLine();
		return new Array(S.length).fill(null).map((_, i) => S.charAt(i));
	}

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

let reader = new Reader();

let S = reader.readLine();
let alphabets = new Set(S);
let closestIndex:Map<string, number> = new Map();
let maximumLength:Map<string, number> = new Map();

alphabets.forEach((alphabet) => {
	closestIndex.set(alphabet, S.length);
	maximumLength.set(alphabet, 0);
});

for(let i=S.length-1; i>=0; i--) {
	if (closestIndex.get(S[i])-i-1 > maximumLength.get(S[i])) {
		maximumLength.set(S[i], closestIndex.get(S[i])-i-1);
	}
	closestIndex.set(S[i], i);
}

alphabets.forEach((alphabet) => {
	if (closestIndex.get(alphabet) > maximumLength.get(alphabet)) {
		maximumLength.set(alphabet, closestIndex.get(alphabet));
	}
});

let minMax: number = Infinity;
maximumLength.forEach((value) => {
	if (value < minMax)
		minMax = value;
});

console.log(minMax);


Measured memory_bytes: 29664
import java.util.*;


public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int[] a = new int[10];
		for(int i=0; i<10; i++){
			a[i] = sc.nextInt();
		}
		Arrays.sort(a);
		
		System.out.println(a[9] +"\n" + a[8] + "\n" + a[7]);
	}
}

Measured memory_bytes: 26104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int INF = 0x3f3f3f3f;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const int N = 2e6 + 10;
const ll mod = 1e9 + 7;
int n, m, k;
ll a[3010][3010];
ll dp[3010][3010][4];
int main() {
	scanf("%d%d%d", &n, &m, &k);
	//for (int i = 1; i <= n; i++)for (int j = 1; j <= m; j++)a[i][j] = -inf;
	for (int i = 1; i <= k; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		scanf("%lld", &a[x][y]);
	}
	//for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)for (int x = 0; x <= 3; x++)dp[i][j][k] = -inf;
	for (int i = 0; i <= n; i++)for (int j = 0; j <= m; j++)dp[i][j][0] = 0;
	dp[1][1][0] = 0; if (a[1][1] >= 0)dp[1][1][1] = a[1][1];
	ll ans = 0;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			dp[i][j][0] = 0;
			//if (i == 1 && j == 1)continue;
			if (a[i][j] <= 0) {
				for (int x = 0; x <= 3; x++) {
					dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][x]);
					dp[i][j][x] = max(dp[i][j][x], dp[i][j - 1][x]);
				}
				continue;
			}
			dp[i][j][0] = max(dp[i][j][0], dp[i][j - 1][0]);
			for (int x = 0; x <= 3; x++)dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][x]), dp[i][j][1] = max(dp[i][j][1], dp[i - 1][j][x] + a[i][j]);
			for (int x = 1; x <= min(j, 3); x++) {
				dp[i][j][x] = max(dp[i][j][x], max(dp[i][j - 1][x], dp[i][j - 1][x - 1] + a[i][j]));
			}
			for (int k = 0; k <= 3; k++)ans = max(ans, dp[i][j][k]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 356480
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  ll N;
  cin >> N;
  vector<bool> b(35);
  if(N==0) cout << 0 << endl;
  else {
  while(N!=0){
    ll M = N;
    if(M<0){
      rep(i, 35){
        if(i%2) M+=(ll)pow(2, i);
        if(M>=0) {b[i] = true; N+=(ll)pow(2, i); break;}
        }
      }
    else if(M>0){
      rep(i, 35){
        if(!(i%2)) M-=(ll)pow(2, i);
        if(M<=0) {b[i] = true; N-=(ll)pow(2, i); break;}
      }
    }
  }
  int cnt = 0;
  for(int i=34; i>=0; i--){
    cnt ++; if(b[i]){
      cnt --; break;
    }
  }
  rep(i, cnt){
    b.pop_back();
  }
  reverse(b.begin(), b.end());
  rep(i, b.size()){
    cout << b[i];
  }
  cout << endl;
  }
  }

Measured memory_bytes: 256
package main

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

func main() {
	n := readInt()

	scanner := newMyScanner()
	vec := scanner.readIntLine(n)

	// copy
	cpVec := make([]int, len(vec))
	copy(cpVec, vec)
	sort.Ints(cpVec)

	left := cpVec[n/2-1]
	right := cpVec[n/2]

	for _, v := range vec {
		if v <= left {
			fmt.Println(right)
		} else if v >= right {
			fmt.Println(left)
		} else {
			fmt.Println("ERR")
		}
	}
}

type MyScanner struct {
	sc *bufio.Scanner
}

func newMyScanner() *MyScanner {
	ms := new(MyScanner)
	ms.sc = bufio.NewScanner(os.Stdin)
	return ms
}

func (ms *MyScanner) readIntLine(n int) []int {
	ms.sc.Split(bufio.ScanWords)

	ret := make([]int, 0)

	for i := 0; i < n; i++ {
		ms.sc.Scan()
		v, err := strconv.Atoi(ms.sc.Text())
		if err != nil {
			panic(err)
		}
		ret = append(ret, v)
	}

	return ret
}

func (ms *MyScanner) readInt64Line(n int) []int64 {
	ms.sc.Split(bufio.ScanWords)

	ret := make([]int64, 0)

	for i := 0; i < n; i++ {
		ms.sc.Scan()
		v, err := strconv.ParseInt(ms.sc.Text(), 10, 64)
		if err != nil {
			panic(err)
		}
		ret = append(ret, v)
	}

	return ret
}

func (ms *MyScanner) readInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func (ms *MyScanner) readInt64() int64 {
	var a int64
	fmt.Scan(&a)
	return a
}

func readInt() int {
	var a int
	fmt.Scan(&a)
	return a
}

func readIntLine(n int) []int {
	var sc = bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)

	ret := make([]int, 0)

	for i := 0; i < n; i++ {
		sc.Scan()
		v, e := strconv.Atoi(sc.Text())
		if e != nil {
			panic(e)
		}
		ret = append(ret, v)
	}

	return ret
}


Measured memory_bytes: 10880
import queue
import math
import copy
"""
N = int(input())
#S = input()
# (N,M) = (int(i) for i in input().split(" "))
# A = [int(i) for i in input().split()]
A = []
for i in range(N):
	A.append(int(input()))

print(A)

"""

N = int(input())
ans = ":("
for i in range(50000):
	if int(i*1.08) == N:
		ans = i
		break

print(ans)


Measured memory_bytes: 4336
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
#include<list>
#include <numeric>
using namespace std;
typedef unsigned long long int ulint;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define RE return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
const int mod=(int)1e9+7;
const llint big=(llint)(2.19e15+1)*18;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>bool mineq(T& a,U b){if(a>b){a=b;return true;}return false;}
template <class T,class U>bool maxeq(T& a,U b){if(a<b){a=b;return true;}return false;}
template <class T> void soun(T& ar)
{sort(ar.begin(),ar.end());ar.erase(unique(ar.begin(),ar.end()),ar.end());}
llint gcd(llint a,llint b){if(a%b==0){return b;}else{return gcd(b,a%b);}}
llint lcm(llint a,llint b){return a/gcd(a,b) *b;}
template<class T,class U> auto LB(T& ve,U in){return lower_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto UB(T& ve,U in){return upper_bound(ve.begin(),ve.end(),in);}
template<class T,class U> auto LBI(T& ve,U in){return LB(ve,in)-ve.begin();}
template<class T,class U> auto UBI(T& ve,U in){return UB(ve,in)-ve.begin();}
template<class T> void SO(T& ve){sort(ve.begin(),ve.end());}
template<class T> void REV(T& ve){reverse(ve.begin(),ve.end());}
int main(void){
	int h,w,i,j;cin>>h>>w;
	vector<string> mat(h+2);
	for(i=1;i<=h;i++){cin>>mat[i];mat[i].ins(mat[i].begin(),'#');mat[i].pub('#');}
	mat[0]=string(w+2,'#');
	mat[h+1]=string(w+2,'#');
	queue<tuple<int,int,int>> que;//y,x,sco
	que.push(mt(1,1,1));
	int ans=0;
	while(que.size()>0){
		int x,y,t;
		tie(y,x,t)=que.front();que.pop();
		//cerr<<"x="<<x<<"y="<<y<<endl;
		if(y==h&&x==w){ans=t;break;}
		if(mat[y][x]!='.'){continue;}
		mat[y][x]='A';
		que.push(mt(y+1,x,t+1));
		que.push(mt(y-1,x,t+1));
		que.push(mt(y,x+1,t+1));
		que.push(mt(y,x-1,t+1));
	}
	if(ans==0){cout<<"-1\n";RE;}
	int dot=0;
	for(i=1;i<=h;i++){
		for(j=0;j<=w;j++){
			if(mat[i][j]!='#'){dot++;}
		}
	}
	cout<<dot-ans<<endl;RE;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
ll a[105][100005];
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	ll n,u;
	cin >> n >> u;
	ll w[n + 1],v[n + 1];
	w[0] = v[0] = 0;
	for(ll i = 1;i <= n;i++){
		cin >> w[i] >> v[i];
	}
	for(ll i = 0;i <= n;i++){
		for(ll j = 0;j <= u;j++){
			if(j == 0 || i == 0) a[i][j] = 0;
			else if(w[i] <= j) a[i][j] = max(v[i] + a[i - 1][j - w[i]],a[i - 1][j]);
			else a[i][j] = a[i - 1][j];
		}
	}
	cout << a[n][u] << "\n";
 	return 0;
}

Measured memory_bytes: 80128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC123_B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] dish = new int[5];

            int time = 0;

            int minNumber = 10;
            int minDish = 0;

            for (int i = 0; i < 5; ++i)
            {
                dish[i] = int.Parse(Console.ReadLine());

                int digit = dish[i] % 10;
                if (digit != 0 && digit < minNumber)
                {
                    minNumber = digit;
                    minDish = i;
                }
            }

            for (int i = 0; i < 5; ++i)
            {
                int dishTime = dish[i];

                if (i != minDish)
                {
                    int digit = dishTime % 10;
                    if (1 <= digit)
                    {
                        dishTime = (dishTime / 10) * 10 + 10;
                    }
                }

                time += dishTime;
            }

            Console.WriteLine($"{time}");
        }
    }
}


Measured memory_bytes: 13140
s = input()
if s == "SUN":
  print(7)
elif s == "MON":
  print(6)
elif s == "TUE":
  print(5)
elif s == "WED":
  print(4)
elif s == "THU":
  print(3)
elif s == "FRI":
  print(2)
elif s == "SAT":
  print(1)

Measured memory_bytes: 2940
//------------------------------------------
// C++ templete 
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

#define endl "\n"

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<PII> VP;

//REPEAT
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//container util
//------------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define PRINT(V) for (auto v : (V)) cout << v << " "
#define SORT(V) sort((V).begin(),(V).end())
#define RSORT(V) sort((V).rbegin(), (V).rend())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//math
//------------------------------------------
int QP(int a,int b){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int QP(int a,int b,int MOD){int ans=1;do{if(b&1)ans=1ll*ans*a%MOD;a=1ll*a*a%MOD;}while(b>>=1);return ans;}
int GCD(int a,int b){return b?GCD(b,a%b):a;}

//debug
//------------------------------------------
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

//grobal variable
//------------------------------------------
int M;
VI Vec;

//動的計画法で役に立つ関数
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; }

//最大公約数と最小公倍数
ll gcd(ll a, ll b) {
    if(b==0)return a;
    return gcd(b, a%b);
}

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

vector<vector<long long> > comb(int n) {
  vector<vector<long long> > v(n + 1,vector<long long>(n + 1, 0));
  for (int i = 0; i < v.size(); i++) {
    v[i][0] = 1;
    v[i][i] = 1;
  }
  for (int j = 1; j < v.size(); j++) {
    for (int k = 1; k < j; k++) {
      v[j][k] = (v[j - 1][k - 1] + v[j - 1][k]);
    }
  }
  return v;
}

int N, D;
float dist(VI x, VI y)
{
    float f=0;
    REP(i, D)
    {
        f += pow((x[i]-y[i]),2);
    }
    return sqrt(f);
}

int main() 
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    

    cin >> N >> D;

    VVI X(N, VI(D));
    REP(i,N)
    {
        REP(j,D)
        {
            cin >> X[i][j];
        }
    }

    int res=0;
    REP(i, N)
    {
        REP(j, N)
        {
            if (i < j)
            {
                float d = dist(X[i], X[j]);
                if (d - floor(d) == 0) res++;
            }
        }
    }
    
    cout << res << endl;
    return 0;
}



Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

 main()

{
    fast
    int r,g,b;
    cin>>r>>g>>b;
    int cnt=0;
    int k;
    cin>>k;
    while(g<=r)
    {
        g=g*2;
        cnt++;
        if(cnt>k)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    while(b<=g)
    {
        b=b*2;
        cnt++;
        if(cnt>k)
        {
            cout<<"No"<<endl;
            return 0;
        }
    }
    //cout<<cnt<<" "<<k<<endl;
    if(cnt<=k)
    {
        cout<<"Yes"<<endl;
    }
    else
    {
        cout<<"No"<<endl;
    }
    return 0;

}





































Measured memory_bytes: 3596