akhauriyash/Code-Regression huggingface dataset:
arr = []
for i in range(5):
    arr.append(int(input()))
index = 0
rem_arr = []
for i in arr:
    time = i % 10
    if time == 0:
        time += 9
    rem_arr.append(time)
last_index = min(enumerate(rem_arr), key=lambda x: x[1])[0]
last = arr[last_index]
arr.pop(last_index)
total = 0
for i in arr:
    if i < 10:
        h = 10
    else:
        h = (i + 9) // 10 * 10
    total += h
total += last
print(total)

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

string solve(string a,string b){
	int m = a.size(), n = b.size();
  	string ans ="";
  	vector<vector<int>> dp(m+1,vector<int>(n+1));
  	for(int i=1; i<=m; i++){
    	for(int j=1; j<=n; j++){
        	if(a[i-1] == b[j-1]){
            	dp[i][j] = 1 + dp[i-1][j-1];
            }else{
            	dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            }
        }
    }
  	int i = m, j = n;
  	while(i>0 && j>0){
    	if(a[i-1] == b[j-1]){
        	ans = a[i-1] + ans;
          	i--,j--;
        }else if(dp[i-1][j] > dp[i][j-1]){
        	i--;
        }else{
        	j--;
        }
    }
  	return ans;
}
int main(){
	string a,b;
  	cin>>a;
  	cin.ignore();
  	cin>>b;
  	cout<<solve(a,b);
	return 0;
}


Measured memory_bytes: 35584
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
const int MAXN = 100500;

vector <pair <ll, ll> > must_know;
ll arr[MAXN];
ll dir[MAXN];
ll n, l, t;
vector <ll> coord[3];
vector <ll> res;

int main()
{                                                     
	//ios_base::sync_with_stdio(0);
	
	cin >> n >> l >> t;

	for (int i = 0; i < n; i++)
	{
		cin >> arr[i] >> dir[i];
		coord[dir[i]].push_back(i);
	}
/*
	if (n == 1)
	{
		if (dir[0] == 1)
			arr[0] += t;
		else
			arr[0] -= t;
		arr[0] = (arr[0] % l + l) % l;
		cout << arr[0] << '\n';
		return 0;
	}
*/
	for (int i = 0; i < min(n, 4ll); i++)
	{
		ll ind = i;

		for (int j : coord[dir[i] ^ 3])
		{
			ll len;
			if (dir[i] == 1)
			{
				len = arr[j] - arr[i];
			}
			else
			{
				len = arr[i] - arr[j];
			}

			assert(len);
			if (len < 0)
				len += l;

			ll delta;
			if (2 * t < len)
				delta = 0;
			else
				delta = (2 * t - len + l - 1) / l;
			
			if (dir[i] == 1)
				ind += delta;
			else
				ind -= delta;

			ind = (ind % n + n) % n;
		}
		
		ll val = arr[i];

		if (dir[i] == 1)
			val += t;
		else
			val -= t;
		val = (val % l + l) % l;
		//cout << val << ' ' << ind << '\n';
		must_know.push_back({ind, val});
	}

	for (int i = 0; i < n; i++)
	{
		ll val = arr[i];
		if (dir[i] == 1)
			val += t;
		else
			val -= t;
		val = (val % l + l) % l;
		res.push_back(val);
	}

	sort(res.begin(), res.end());
	res.resize(2 * n);

	for (int i = 0; i < n; i++)
		res[n + i] = res[i];

	for (int i = 0; i < n; i++)
	{
		bool ok = true;
		for (auto it : must_know)
		{
			ok &= res[i + it.first] == it.second;
		}

		if (ok)
		{
			for (int j = 0; j < n; j++)
			{
				cout << res[i + j] << '\n';
			}
			return 0;
		}
	}

	assert(false);
	
	return 0;
}



Measured memory_bytes: 5216
#include<bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin >> s;
  int count=0;
  int ma=0;
  rep(i,s.length()){
    if(s[i]=='A' || s[i]=='C' || s[i]=='G' || s[i]=='T'){
      count++;
      ma = max(ma,count);
    }else{
      count = 0;
    }
  }
  cout << ma << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<tuple>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;

#define INF ((int)(1e9))
#define MAX 110000


int main(){
	int n, m, temp, zero = 0;
	vector<int> ve, se, re;
	
	cin>>n;
	
	for(int i = 0; i < n; i++){
		cin>>temp;
		ve.push_back(temp);
		if(!temp)zero++;
	}
	cin>>m;
	
	for(int i = 0; i < m; i++){
		cin>>temp;
		se.push_back(temp);
		if(!temp)zero++;
	}
	re.resize(n+m);
	set_symmetric_difference(ve.begin(),ve.end(),se.begin(),se.end(),re.begin());
	
	sort(re.begin(), re.end());
	
	decltype(re)::iterator it = upper_bound(re.begin(), re.end(), 0);
	
	if(zero == 1)cout<<0<<endl;
	for(; it != re.end(); it++){
		cout<<*it<<endl;
	}
	return 0;
}


Measured memory_bytes: 6004
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <algorithm>

using namespace std;

int main() {
  int n;
  cin >> n;
  unordered_map<string, int> map;
  int max = 0;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int num = map[s];
    map[s] = num + 1;
    if (num + 1 > max) {
      max = num + 1;
    }
  }

  vector<string> maxs;
  
  for (auto &p : map) {
    if (p.second == max) {
      maxs.push_back(p.first);
    }
  }

  sort(maxs.begin(), maxs.end());

  for (auto &s : maxs) {
    cout << s << endl;
  }

  return 0;
}

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

int main() {
    int x, a, b;
    int dist[2];
    cin >> x >> a >> b;
    dist[0] = abs(x-a);
    dist[1] = abs(x-b);
    if (dist[0]<=dist[1]) cout << "A\n";
    else cout << "B\n";
}

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

typedef long long ll;
const int maxn=1e6+7;
const int inf=INT_MAX;
const ll inff=1e18;
const int mod=998244353;
#define pii pair<int,int>
#define mkp make_pair
#define F first
#define S second
#define pb push_back
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(),(v).end()
//#define int ll

#ifdef HNO2
#define IOS
#else
#define endl '\n'
#define IOS ios::sync_with_stdio(0); cin.tie(0);
#endif // HNO2

int dp[2][307][307];
vector<int> v;

inline int singlemod(int x)
{
    return x>=mod ? x-mod : x;
}

int32_t main()
{
    IOS
    string s;
    int n,K;
    cin>>s>>K;
    n=s.length();
    K=min(n,K);

    int summ=0;
    v.pb(0);
    for (int i=0;i<n;i++)
        if (s[i]=='0') v.pb(summ);
        else summ++;
    int _0=sz(v)-1;

    dp[0][0][0]=1;

    for (int i=1;i<=_0;i++)
    {
        //clear
        memset(dp[i&1],0,sizeof(dp[i&1]));

        for (int j=0;j<=(n-_0)-v[i];j++)
            for (int k=0;k<=n;k++)
        {
            for (int l=0;l<=j;l++) dp[i&1][j][k]=singlemod(dp[i&1][j][k]+dp[i&1^1][l][k]);
            for (int l=j+1;l<=min({j+(v[i]-v[i-1]),n,k+j});l++)
                dp[i&1][j][k]=singlemod(dp[i&1][j][k]+dp[i&1^1][l][k-(l-j)]);
        }
    }
    //

    int ans=0;
    for (int i=0;i<=(n-_0);i++)
        for (int j=0;j<=K;j++)
            if (i+j<=K) ans=(ans+dp[_0&1][i][j])%mod;
    cout<<ans<<endl;
}




Measured memory_bytes: 4380
ls=[0,0,0,0,0]
for i in range(5):
  ls[i]=int(input())
ls2=sorted(ls, key=lambda x: (x-1)%10)
ls3=[((e-1)//10+1)*10 for e in ls2]
print(ls2[0]+ls3[1]+ls3[2]+ls3[3]+ls3[4])

Measured memory_bytes: 3064
import sys
input = sys.stdin.readline
'''
allinputs = iter(input().splitlines())
input = lambda : next(allinputs)
#'''

N = int(input())
q = []
c = [0] * N
l = [0] * N
A = [[] for i in range(N)]
W = [[] for i in range(N)]

for i in range(N-1):
	u, v, w = map(int,input().split())
	u -= 1
	v -= 1
	
	A[u].append(v)
	A[v].append(u)
	W[u].append(w)
	W[v].append(w)

q.append(0)
for _ in range(N):
	if len(q) == 0:
		break
	i = q.pop(0)
	c[i] = 1
	k = 0
	for j in A[i]:
		if c[j] == 0:
			q.append(j)
			l[j] = l[i] + W[i][k]
		k += 1

for i in l:
	print('{}'.format(i%2))
	

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

int main(){
  int N;
  cin >> N;
  vector<int> oprt(10*N,N);
  oprt.at(0) = 0;
  for(int i=0; i<=N; i++){
    oprt.at(i+1) = min(oprt.at(i+1), oprt.at(i)+1);
    for(int j=6; i+j<=N; j*=6){
      oprt.at(i+j) = min(oprt.at(i+j), oprt.at(i)+1);
      for(int k=9; i+k<=N; k*=9){
        oprt.at(i+k) = min(oprt.at(i+k), oprt.at(i)+1);
        oprt.at(i+j+k) = min(oprt.at(i+j+k), oprt.at(i+j)+1);
      }
    }
  }
  cout << oprt.at(N);
  return 0;
}

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

#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

int p[1<<20], t[17][1<<20], n, L, q;

int main() {
	scanf("%d", &n);
	rep(i,0,n) scanf("%d", p + i);
	scanf("%d", &L);
	rep(i,0,n) t[0][i] = upper_bound(p,p+n,p[i]+L) - p - 1;
	rep(i,1,17) rep(j,0,n) t[i][j] = t[i-1][t[i-1][j]];
	scanf("%d", &q);
	rep(i,0,q) {
        int cur, fin, ret = 0;
        scanf("%d %d", &cur, &fin);
        cur--, fin--;
        if (cur > fin) swap(cur,fin);
        rep(i,17,0) {
            if (t[i][cur] < fin) {
                ret += (1<<i);
                cur = t[i][cur];
            }
        }
        printf("%d\n",ret+1);
	}
}


Measured memory_bytes: 35968
import sys

input = sys.stdin.buffer.readline
n = int(input())
S = []
for _ in range(n):
    S.append(int(input()))
S.sort()
goukei = sum(S)
if goukei %10!=0:
    print(goukei)
    exit()
ans = 0
for i in range(n):
    temp = goukei - S[i]
    if temp % 10 == 0:
        temp = 0
    ans = max(ans, temp)

print(ans)


Measured memory_bytes: 9184
package main

import "bufio"
import "fmt"
import "os"
import "sort"
import "strconv"

func main() {
        var N, K int
        fmt.Scanf("%d %d", &N, &K)
        if N <= K {
                fmt.Println(0)
                return
        }
        H := make([]int, N)
        sc := bufio.NewScanner(os.Stdin)
        sc.Split(bufio.ScanWords)
        for i := 0; i < N; i++ {
                sc.Scan()
                n, e := strconv.Atoi(sc.Text())
                if e != nil {
                        panic(e)
                }
                H[i] = n
        }
        sort.Sort(sort.Reverse(sort.IntSlice(H)))
        sum := 0
        for _, x := range H[K:] {
                sum += x
        }
        fmt.Println(sum)
}


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

int main(){
  int N;
  string S;
  cin >>N>>S;
  
  int sum = 0;
  int ans = 0;
  repeat(i,0,N){
    if(S[i]=='I') sum++;
    else if(S[i]=='D')sum--;
    ans = max(ans,sum);
  }
  cout <<ans<< endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <bits/stdc++.h>
#include <math.h>
#include <string>
#include <sstream>
#define ll long long
#define F first
#define S second
#define pb push_back
#define ld long double
#define pll pair<long long,long long>
#define pld pair<long double,long double>
#define ios     ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
using namespace std;
ll mod=1000000007;
ll INF=1e18;
ll gcd (ll a,ll b)
{
    if(b==0)
        return a;
    else
        return gcd(b,a%b);
}
ll fastexp(ll x ,ll n)
{
    ll result =1;
    while(n>0)
    {
        if(n%2==1)
            result*=x;
        x*=x;
        n=n/2;
    }
    return result;
}

ll modularExp(ll x,ll n,ll mod)
{
    ll result=1;
    while(n>0)
    {
        if(n%2==1)
            result=(result*x)%mod;
        x=((x%mod)*(x%mod))%mod;
        n=n/2;
    }
    return (result)%mod;
}
bool isPrime(ll n)
{
    for(ll i=2;i*i<=n;i++)
        if(n%i==0)
            return false;
    return true;
}
bool mycomp(pll &a,pll &b)
{
    if(a.F!=b.F)
        return a.F < b.F;
    else
        return a.S < b.S;
}



void solve()
{
     string s;
     cin>>s;
     ll n=s.length();
     ll i;
     ll sum=0;
     for(i=0;i<n;i++)
          sum+=s[i]-'0';
     if(sum%9==0)
          cout<<"Yes\n";
     else 
          cout<<"No\n";
}

     
     


int main()
{
    ios;
    ll t;
//    cin>>t;
   t=1;
    while(t--)
        solve();
}

Measured memory_bytes: 3744
function main(input) {
	var a = input[0].split(' ');
	console.log(parseInt(a[0])*parseInt(a[1]) + " " + 2*(parseInt(a[0])+parseInt(a[1])));
}

var input = '';

process.stdin.resume();
process.stdin.setEncoding('utf8');
process.stdin.on('data', function(chunk) {
  input += chunk;
});
process.stdin.on('end', function() {
  input = input.split('\n');
  main(input);
});

Measured memory_bytes: 7644
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define LINF (ll)INF*INF
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(int i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

#define int ll //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef vector<pii> vp;

int gcd(int a, int b){
    if(b==0) return a;
    return gcd(b,a%b);
}
int lcm(int a, int b){
    return a/gcd(a,b)*b;
}

int f(int a){
    if(a%1000 == 0)return a;
    a /= 1000;
    a++;
    return a*1000;
}

pii dp[105][105*1000];
//iまで見て小銭がj円のときの
//dp[i][j].first:500円玉の個数
//dp[i][j].second:最小金額

void update(pii &a,pii b){
    if(b.second >= INF)return ;
    if(a.first < b.first)a = b;
    else if(a.first == b.first && a.second > b.second)a = b;
}

signed main(void) {
    int n;
    while(cin >> n,n){
        vi p(n);
        rep(i,n)cin >> p[i];
        rep(i,n+1)rep(j,(n+1)*1000)dp[i][j] = pii(0,INF);
        dp[0][0].second = 0;
        rep(i,n)rep(j,(n+1)*1000){
            int cnt = dp[i][j].first;
            int sum = dp[i][j].second;
            update(dp[i+1][j],dp[i][j]);//かわない
            int t = f(p[i]) - p[i];//札のみのときのおつり
            //if(sum < INF)cout << i << " " << j << " " << cnt << " " << sum << " " << t << endl;
            if(t >= 500){
                update(dp[i+1][j+t-500], pii(cnt+1,sum+p[i]));
            }else{
                update(dp[i+1][j+t], pii(cnt, sum+p[i]));
                int ne = p[i]%500;//必要な端数
                if(!ne)ne = 500;
                if(ne <= j){//端数を消費し500円玉を手に入れる
                    update(dp[i+1][j-ne], pii(cnt+1,sum+p[i]));
                }
            }
        }
        pii ans = pii(0,INF);
        rep(j,(n+1)*1000)update(ans,dp[n][j]);
        cout << ans.first << " " << ans.second << endl;
    }
}



Measured memory_bytes: 175376
"""
WEEWW
<>><<
01100
10100
01000
10000
10010

下記の和
1. リーダーより左にいるWの数
2. リーダーより右にいるEの数
"""

N = int(input())
S = input()
# 1.
cntW = 0
W_num = [0]*N
for i,s in enumerate(S):
    if s == "W":
        cntW += 1
    W_num[i] = cntW
        
# 2. 
cntE = 0
E_num = [0]*N
for i,s in enumerate(S[::-1]):
    if s == "E":
        cntE +=1 
    E_num[i] = cntE
E_num = E_num[::-1]

ans = 10**10
for e,w in zip(E_num, W_num):
    cnt = e + w - 1
    ans = min(cnt, ans)
print(ans)

Measured memory_bytes: 20140
#include <bits/stdc++.h>
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
using namespace std;
int n,m,fa[200005],mp[200005],ans;
vector<int> v;
pii rel[200005];
int findfa(int x)
{
	if (fa[x]==x)
		return x;
	return fa[x]=findfa(fa[x]);
}
void unite(int x,int y)
{
	int fx=findfa(x),fy=findfa(y);
	if (fx>fy)
	{
		int c=fy;
		fy=fx;
		fx=c;
	}
	fa[fy]=fx;
}
int main()
{
	cin>>n>>m;
	memset(mp,-1,sizeof(mp));
	for(int i=0;i<n;i++)
		fa[i]=i;
	for(int i=0;i<m;i++)
	{
		int a,b;
		cin>>a>>b;
		if (b<a)
		{
			int c=b;
			b=a;
			a=c;
		}
		--a;
		--b;
		rel[i].F=a;
		rel[i].S=b;
	}
	sort(rel,rel+m);
	for(int i=0;i<m;i++)
	{
		int a=rel[i].F,b=rel[i].S;
		unite(a,b);
	}
	for(int i=0;i<n;i++)
		if (fa[i]==i)
		{
			mp[i]=(int)(v.size());
			v.pb(0);
		}
	for(int i=0;i<n;i++)
		v[mp[findfa(i)]]++;
	for(int i=0;i<v.size();i++)
		ans=max(ans,v[i]);
	cout<<ans<<endl;
	return 0;
}

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

const ll MOD = 1e9 + 7;

void solve(istream& cin, ostream& cout) {
  int n;
  cin >> n;
  int odd;
  odd = (n + 1) / 2;

  double ans = (double) odd / n;

  cout << setprecision(10) << ans << endl;

}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
vector<char> v;
int main ()
{
	long long n; cin >> n;
	while(n != 0)
	{
		n--;
		v.push_back(97 + (n % 26));
		n /= 26;
	}
	reverse(v.begin(), v.end());
	for(int i = 0; i < v.size(); i++)
		cout << v[i];
	cout << '\n';
}


Measured memory_bytes: 3636
#include <iostream>
int main()
{
    int arr1[7] = {1, 3, 5, 7, 8, 10, 12};
    int arr2[4] = {4, 6, 9, 11};
    int a, b;
    int count = 0;
    std::cin >> a >> b;
    for(const auto& num : arr1){
        if (num == a || num == b)
            count++;
    }
    if(count == 0){
        for(const auto& nem : arr2)
            if(nem == a || nem == b)
                count++;
    }
    if(count == 2)
        std::cout << "Yes";
    else
        std::cout << "No";
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

/*
??????

3????????´??°a, b, c?????????????????????????????? a < b < c????????¶????????????????????°"Yes"?????????????????????????????°"No"???????????????????????°?????????????????????????????????

Input
3????????´??°???????????§????????????????????????????????????

Output
Yes?????????No???1??????????????????????????????

*/

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

    scanf( "%d %d %d", &a, &b, &c );

	if ( ( a < b ) && ( b < c ) ) {
		printf( "Yes\n" );
	}
	else {
		printf( "No\n" );
	}


    return 0;
}

Measured memory_bytes: 580
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int n, x;
    std::cin>>n>>x;

    std::vector<int> m(n);
    for(auto i = m.begin();i != m.end();i++){
        std::cin>>*i;
    }

    int sum = std::accumulate(m.begin(), m.end(), 0);
    int min = *std::min_element(m.begin(), m.end());
    int cnt = n + (x - sum) / min;

    std::cout<<cnt<<std::endl;
    return 0;
}

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

typedef unsigned long long ulli;
const int MAXN = 300005;
const ulli B = 777737377ULL;
ulli Bn[MAXN];

int main() {
  Bn[0] = 1;
  for(int i = 1; i < MAXN; ++i) Bn[i] = Bn[i-1] * B;
  for(string S, T; cin >> S >> T; ) {
    map<ulli, ulli> num;
    ulli hash = 0;
    for(int i = 0; i < S.size(); ++i) {
      hash = hash * B + S[i];
      if(i >= T.size()) hash -= S[i-T.size()] * Bn[T.size()];
      if(i+1 >= T.size()) num[hash]++;
    }
    hash = 0;
    for(int i = 0; i < T.size(); ++i) {
      hash = hash * B + T[i];
    }
    ulli res = 0;
    for(int i = 0; i < T.size(); ++i) {
      for(char c = 'A'; c <= 'z'; ++c) {
        if(!isalpha(c)) continue;
        if(c == T[i]) continue;
        ulli nhash = hash;
        //        nhash += c * Bn[T.size()-i-1];
        //        nhash -= T[i] * Bn[T.size()-i-1];
        nhash = hash + (c - T[i]) * Bn[T.size()-i-1];
        //(signed char) * (unsigned long long) = (unsigned long long)
        if(num.count(nhash)) {
          res += num[nhash];
        }
      }
    }
    cout << res << endl;
  }
  return 0;  
}

Measured memory_bytes: 21556
with Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;
 use Ada.Text_IO, Ada.Integer_Text_IO, Ada.Float_Text_IO;

procedure main is
   S: String(1..3);
begin
   S := get_line;
   if (S(1) = '7') then put_line("Yes");
   elsif (S(2) = '7') then put_line("Yes");
   elsif (S(3) = '7') then put_line("Yes");
   else put_line("No");
   end if;
end main;

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

using namespace std;

int main(){
	int n;
	int ary[31] = { 1, 1, 2 };

	for (int i = 3; i <= 30; i++){
		ary[i] = ary[i - 1] + ary[i - 2] + ary[i - 3];
	}

	while (cin >> n, n != 0){
		int cnt = 0;
		if (ary[n] % 3650 == 0){
			cout << ary[n] / 3650 << endl;
		}
		else cout << ary[n] / 3650 + 1 << endl;
	}

	return 0;
}

Measured memory_bytes: 1160
from collections import Counter
from scipy.misc import comb
import numpy as np
N = int(input())
A = list(map(int, input().split()))

total = 0
answers = np.array([0] * (N + 1))
for number, appearance in Counter(A).items():
    flat = comb(appearance, 2, exact=True)
    minus_one = comb(appearance - 1, 2, exact=True)
    total += flat
    answers[number] = minus_one - flat
answers += total

print(*answers[A], sep="\n")


Measured memory_bytes: 36256
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define FORqr(i, m , n) for(int i = (n);i >=(m);--i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int (x); SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long (x); SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
#define M0(x) memset(x,0,sizeof(x))
#define FILL(x,y) memset(x,y,sizeof(x))
#define MM(x) memset(x,-1,sizeof(x))
#define ALL(x) (x).begin(),(x).end()
using namespace std;
typedef pair<int,int> PII;
typedef pair<long long,long long> PLL;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const ll MOD = 1000000007;
ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
///////////////////////////////////////////////
int main(){
    int N;
    cin >> N;
    static int A[100002] = {};

    REP(i,N){
        cin >> A[i];
    }

    int ans = gcd(A[0],A[1]);
    REP(i,N){
        ans = gcd(ans,A[i]);
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 640
#include<stdio.h>

int main(void)
{
  int a,b,c,d,ans1,ans2,ans;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  ans1=a*b;
  ans2=c*d;
  if(ans1>ans2)
   ans=ans1;
  else
   ans=ans2;
  printf("%d\n",ans);
  return 0;
}


Measured memory_bytes: 128
def popcnt10(x)
	x = (x & 0x5555) + (x >> 1 & 0x5555)
    x = (x & 0x3333) + (x >> 2 & 0x3333)
    x = (x & 0x0f0f) + (x >> 4 & 0x0f0f)
    (x & 0x00ff) + (x >> 8 & 0x00ff)
end

h, w, k = gets.split.map &:to_i
chocolate = h.times.map {gets}

min_cnt = 100000
(1 << h-1).times do |h_div|
  h_div_cnt = popcnt10(h_div) + 1
  white = [0] * h_div_cnt
  v_div_cnt = 0
  temp_max = 0
  w.times do |col|
    temp = [0] * h_div_cnt
    temp[0] += 1 if chocolate[0][col] == '1'
    row = 0
    (h-1).times do |i|
      row += 1 if h_div[i] != 0
      temp[row] += 1 if chocolate[i+1][col] == '1'
    end
    temp_max = [temp_max, temp.max].max
    break if temp_max > k
    h_div_cnt.times { |i| white[i] += temp[i] }
    if white.max > k
      v_div_cnt += 1
      white = temp
    end
  end
  min_cnt = [min_cnt, h_div_cnt-1+v_div_cnt].min if temp_max <= k
end

p min_cnt


Measured memory_bytes: 14348
N = int(input())
a_s = [None] + [int(elm) for elm in input().split(" ")]
bs = [None for _ in range(N+1)]

out_indexs = []
out_num = 0
for val in range(N, 0, -1):
    r = N // val
    tmp = [bs[val*i] for i in range(2, r+1)]
    #print(val, tmp)
    other_sums = sum(tmp) % 2
    if other_sums == a_s[val]:
        bs[val] = 0
    else:
        bs[val] = 1
        out_indexs.append(val)
        out_num += 1

print(out_num)
if out_num >= 1:
    print(" ".join(map(str, out_indexs)))

Measured memory_bytes: 21396
program prob49
    implicit none
    character(6) :: s
    read(*,*) s
    if(s(3:3) == s(4:4) .and. s(5:5) == s(6:6)) then
        write(*,*) "Yes"
    else
        write(*,*) "No"
    end if
    stop
contains
end program prob49

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



typedef unsigned long ul;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<ll> vint;
typedef vector< vector<ll> > vvint;
typedef vector< vector< vector<ll> > > vvvint;
typedef vector<string> vstring;
typedef vector< vector<string> > vvstring;
typedef vector<char> vchar;
typedef vector< vector<char> > vvchar;
typedef vector<long double> vdouble;
typedef vector< vector<long double> > vvdouble;
typedef vector< vector< vector<long double> > > vvvdouble;
typedef pair<ll,ll> pint;
typedef vector<pint> vpint;
typedef vector<bool> vbool;

#define rep(i,n) for(ll i=0;i<n;i++)
#define repf(i,f,n) for(ll i=f;i<n;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define ALL(obj) (obj).begin(), (obj).end()
// #define LLONG_MAX 9223372036854775806
#define vmax(vec) *max_element(vec.begin(), vec.end())
#define vmin(vec) *min_element(vec.begin(), vec.end())
#define vsort(vec) sort(vec.begin(), vec.end())
#define vsortgr(vec) sort(vec.begin(), vec.end(), greater<ll>())
#define MOD 1000000007
// #define MOD 998244353
// #define MOD LLONG_MAX
const double PI=3.14159265358979323846;

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




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



void printv(vint &v){
  for(auto e:v) cout<<e<<" ";
  cout<<endl;
}


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

const int MAX=2100000;
 
ll fact[MAX], fact_inv[MAX];
 
void init_fact(ll n){
  fact[0]=1;
  // 階乗の計算
  rep(i, n) fact[i+1]=fact[i]*(i+1)%MOD;
  fact_inv[n]=power(fact[n], MOD-2);
  // 逆元の計算
  for(ll i=n-1;i>=0;i--) fact_inv[i]=fact_inv[i+1]*(i+1)%MOD;
}
 
ll comb(ll n, ll r){
  return (fact[n]*fact_inv[r])%MOD*fact_inv[n-r]%MOD;
}
 
ll perm(ll n, ll r){
  return (fact[n]*fact_inv[n-r])%MOD;
}






int main() {
  cout<<fixed<<setprecision(10);

  ll a,b; cin>>a>>b;

  if( a <= 8 && b <= 8) puts("Yay!");
  else puts(":(");


}






Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using pint = pair<int,int>;
ll mod = 1000000007,mod2 = 998244353;

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

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 long long INF = 1LL<<60;
ll gcd(ll a,ll b){
    if(b == 0) return a;
    else return gcd(b,a%b);
}

bool is_prime[1000010];

int main() {
    ll cnt = 0;
    string s;
    cin >> s;
    for (int i = 0; i < s.size(); ++i) {
        cnt += s[i]-'0';
    }
    if(cnt%9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3704
N = int(input())
for i in range(N):
    h, m = map(int, input().split(":"))
    d = abs(60*h - 11*m)
    v = min(d, 720 - d)
    if v < 60:
        print("alert")
    elif v < 180:
        print("warning")
    else:
        print("safe")



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

typedef long long ll;
#define int ll
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;

#define int ll

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define ALL(s) (s).begin(),(s).last()
#define ALLn(s,n) s,s+n
#define F first
#define S second
#define pb push_back
#define tc(t) int t; cin >> t; while(t--)
#define _ ios_base::sync_with_stdio(false); cin.tie(NULL);
#define D1(x) { cerr << " [" << #x << ": " << x << "]\n"; }
#define D2(x) { cerr << " [" << #x << ": "; for(auto it:x) cerr << it << " "; cerr << "]\n"; }

const ll MOD = 1e9 + 7;
const ll MAXN = 1e6 + 7;
const ll INF = INT_MAX;


void solve() {
	string s;
	cin >> s;

	if (s[s.size() - 1] == 's') cout << s << "es";
	else cout << s << 's';
}

int32_t main() {
	_

#ifndef ONLINE_JUDGE
	freopen("in", "r", stdin);
	freopen("out", "w", stdout);
#endif

	// tc(t)
	solve();
	cerr << "[ Time : " << (float)clock() / CLOCKS_PER_SEC << " secs ]" << endl;
}

Measured memory_bytes: 3796
#include<stdio.h>

int main(){
    int n;//生徒の人数
    double x;
    int a[6];
    int i,j;
    
    for(i=0;i<6;i++){
        a[i]=0;
    }
    
    scanf("%d",&n);
    
    for(i=0;i<n;i++){
        scanf("%lf",&x);
        
        if(x<165){
            a[0]++;
        }else if(x>185){
            a[5]++;
        }else{
            a[((int)(x-165)/5)+1]++;
        }
    }
    
    for(i=0;i<6;i++){
        printf("%d:",i+1);
        for(j=0;j<a[i];j++){
            printf("*");
        }
        printf("\n");
    }
    
    return 0;
}

Measured memory_bytes: 640
require'matrix'
eval'H,W,K='+`tr \\  ,`
f=1,1,2,3,5,8,13,21
A=Matrix[
	*(1..W).map{|i|
		(1..W).map{|j|
			(i-j)**2<2 ? f[[i,j].min-1]*f[W-[i,j].max] : 0
		}
	}
]
p (A**H)[0,K-1].%10**9+7


Measured memory_bytes: 2904
#include<iostream>
using namespace std;
int main(){
	int N,v,j;
	cin >> N;
	int a[N];
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	for(int i=0;i<N;i++){
		v = a[i];
		j=i-1;
		while(j>=0&&a[j]>v){
			a[j+1] = a[j];
			j--;
			a[j+1] = v;
		}
		for(int x=0;x<N;x++){
if(x!=N-1){
			cout <<a[x] <<" ";
}
else{
cout <<a[x];
}
		}
		cout << "\n";
	}
	return 0;
}

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

class Program {
    static void Main(string[] args) {
        int n = Cin.Ni();
        for (int i = 0; i < n; i++) {
            int a = Cin.Ni();
            int b = Cin.Ni();
            int c = Cin.Ni();
            int a2 = a * a;
            int b2 = b * b;
            int c2 = c * c;


            Console.WriteLine(
                a2 + b2 == c2 ||
                b2 + c2 == a2 ||
                a2 + c2 == b2
                ? "YES" : "NO");
        }
    }
}
public class Cin {
    private static string[] s = new string[0];
    private static int i = 0;

    private static char[] cs = new char[] { ' ' };

    public static string Next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        i = 0;
        return Next();
    }

    public static int Ni() {
        return int.Parse(Next());
    }

    public static long NextLong() {
        return long.Parse(Next());
    }

    public static double NextDouble() {
        return double.Parse(Next());
    }

}

Measured memory_bytes: 8920
#include<bits/stdc++.h>
//ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
//clock_t start=clock();clock_t end=clock();cout<<(double)(end-start)/CLOCKS_PER_SEC<<endl;
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
typedef pair<double,double> pdd;
typedef vector<vector<ll>> mat;
ll mod=1000000007;
ll mod2=998244353;
ll mod3=1000003;
ll mod4=998244853;
ll mod5=1000000009;
ll inf=1LL<<60;
double pi=3.141592653589793238462643383279L;
double eps=1e-14;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
#define srep(itr,st) for(auto itr=st.begin();itr!=st.end();itr++)
#define mrep(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define Max(a,b) a=max(a,b)
#define Min(a,b) a=min(a,b)
int dh[4]={1,-1,0,0};
int dw[4]={0,0,1,-1};
int ddh[8]={-1,-1,-1,0,0,1,1,1};
int ddw[8]={-1,0,1,-1,1,-1,0,1};
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    if(b==0)return a;
    if(a%b==0)return b;
    return gcd(b,a%b);
}
ll Pow(ll n,ll k){
    ll ret=1;
    ll now=n;
    while(k>0){
        if(k&1)ret*=now;
        now*=now;
        k/=2;
    }
    return ret;
}
ll beki(ll n,ll k,ll md){
  ll ret=1;
  ll now=n;
  while(k>0){
    if(k%2==1){
      ret*=now;
      ret%=md;
    }
    now*=now;
    now%=md;
    k/=2;
  }
  return ret;
}
ll gyaku(ll n,ll md){
  return beki(n,md-2,md);
}
ll popcount(ll n){
    ll ret=0;
    ll u=n;
    while(u>0){
        ret+=u%2;
        u/=2;
        
    }
    return ret;
}
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int x;cin>>x;
    int ans=x/500*1000+(x%500)/5*5;
    cout<<ans<<endl;
}







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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 

#define ll long long
#define ff first
#define ss second
#define pb push_back
#define pf push_front
#define mp make_pair
#define pu push
#define pp pop_back
#define in insert
#define ld long double
#define forn(low,high,i) for(i = low;i < high;i++)
#define forrev(high,low,i) for(i = high; i >= low;i--)
#define trace(x) cerr << #x << ": " << x << " " << endl;
#define all(v) v.begin(),v.end()
#define sz(v) (int)v.size()
#define line cout << __LINE__;
#define prv(a) for(auto x : a) cout << x << ' ';cout << '\n';
#define decimal_digits cout << fixed << setprecision(15);
#define dbg2(a,b) cerr << #a << " = " << a << " " << #b << " = " << b << '\n';        
#define debug(x) cerr << __LINE__ << ' ' << #x << " = " << x << '\n';
#define dln cerr << '\n';
#define dsp cerr << ' ';
#define pln cout << '\n';
#define psp cout << ' ';

typedef unordered_map<int,int> umi;
typedef unordered_map<ll,ll> uml;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int inf = 1e9;
const ll INF = 1e18;
const ll mod = 1e9 + 7;

clock_t time_p = clock();

void ktj(){
  time_p = clock() - time_p;
  cerr << "Time elapsed : " << (float)(time_p)/CLOCKS_PER_SEC << "\n";
}

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

int main(){
  fastio

  ll a, b;
  cin >> a >> b;
  a = gcd(a, b);

  vl f;

  ll n = a;

  ll ans = 1;

  for(ll i = 2; i <= sqrt(n); i++){
    if(a % i == 0){
      while((a % i) == 0){
        a /= i;
      }
      ans++;
    }
    if(a == 1)
      break;
  }
  if(a > 2)
    ans++;

  cout << ans << '\n';

  ktj();
}


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

//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i++)
#define FORD(i,a,b) for(lol i=a;i>=lol(b);i--)
//xにはvectorなどのコンテナ
#define ALL(x) x.begin(),x.end() //sortなどの引数を省略したい
#define SIZE(x) lol(x.size()) //sizeをsize_tからllに直しておく
//定数
#define PI 3.1415926535897932385 //pi
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1000000007 //10^9+7:合同式の法
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)
//最大値最小値
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; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main()
{
    lol result{0};
    lol n; cin >> n;
    int k; cin >> k;
    int a[101][101] = {}, d[101];
    /*
    vector<int> a(n);
    REP(i, n)
    {
        cin >> a[i];
    }
    */
    FOR(i, 1, k)
    {
        cin >> d[i];
        FOR(j, 1, d[i])
        {
            cin >> a[i][j];
        }
    }
    vector<int> check(n+1, 0);
    FOR(i, 1, k)
    {
        FOR(j, 1, d[i])
        {
            check[a[i][j]] = 1;
        }
    }
    FOR(i, 1, n)
    {
        if(check[i] == 1)
            result++;
    }
    result = n - result;

    cout << result << endl;
    return 0;
}

Measured memory_bytes: 3668
#include<stdio.h>
int main(void){
    int a,b,i,m;
    while(scanf("%d %d",&a,&b)!=EOF){
     m=a+b;
      for(i=1;m>=10;i++){
        m=m/10;
    }
    printf("%d\n",i);
    }
     return 0;
    }

Measured memory_bytes: 600
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
#include <cstdio>
#include <tuple>
#include <string>
#include <vector> 
#include <set>
#include <string.h>
#include <map>
#include <cmath>
#include <deque>
using ll = long long;
using Graph = vector<vector<int>>;
#include <queue>
#include <stack>
#include <bitset>

//#define _USE_MATH_DEFINES

#include <math.h>  /* M_PI */

//動的計画
//最小化問題
// template<class T>
// bool chmin(T& a,T b){if(a >  b) {a = b;return true;}return false;}
template<class T> 
bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const int MAX_INDEX = 100010;
ll dp[MAX_INDEX];
const ll INF = 1LL << 60;
int main(){
    
    int k;
    cin >> k;
    int a,b;
    cin >> a >> b;
    bool f = false;
    for(int i = a;i <= b;i++){
        if(i % k == 0) {f = true;break;}

    }
    if(f) cout << "OK" << endl;
    else cout << "NG" << endl;


    return 0;

}

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

int main(void){
    int N;
    int Lbuf;
    vector<int> L;

    cin >> N;
    for(int i=0; i<N; i++){
        cin >> Lbuf;
        L.push_back(Lbuf);
    }

    sort(L.begin(), L.end());

    int numTriangles = 0;

    for(int i=0; i<N-2; i++){
        for(int j=i+1; j<N-1; j++){
            numTriangles += lower_bound(L.begin()+j+1, L.end(), L[j]+L[i]) - upper_bound(L.begin()+j+1, L.end(), L[j]-L[i]);
        }
    }

    cout << numTriangles;

    return 0;
}

Measured memory_bytes: 384
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        HashSet<Integer> set = new HashSet<>();
        ArrayList<Integer> nIslandPorts = new ArrayList<>();
        for(int i = 0; i < m; i++) {
            int a = sc.nextInt();
            int b = sc.nextInt();
            if(a == 1) set.add(b);
            if(b == n) nIslandPorts.add(a);
        }
        for(Integer num: nIslandPorts) {
            if(set.contains(num)) {
                System.out.println("POSSIBLE");
                return;
            }
        }
        System.out.println("IMPOSSIBLE");
    }

}

Measured memory_bytes: 100380
N = int(input())
x = list(map(int, input().split()))
A = [0] * N
B = [0] * N
x.sort()
x.reverse()
for i in range(N):
    if i % 2 == 0:
        A[i] = x[i]
    else:
        B[i] = x[i]
print(sum(A) - sum(B))

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

void optimize_cpp_stdio() {
    std::ios::sync_with_stdio(false);
    std::cout.tie(nullptr);
    std::cin.tie(nullptr);
}

int main() {
    optimize_cpp_stdio();
    int n, k, q;
    std::cin >> n >> k >> q;
    std::vector<int> a(n);
    for (int i = 0; i < n; i++)
        std::cin >> a[i];
    std::vector<int> s = a;
    std::sort(s.begin(), s.end());
    auto new_end = std::unique(s.begin(), s.end());
    s.erase(new_end, s.end());
    auto ok = [&](int x) {
        for (int low : s) {
            int high = low + x, count = 0;
            for (int i = 0, j = 0; i < n; i = j) {
                int valid = 0;
                while (j < n && low <= a[j])
                    valid += (a[j++] <= high);
                count += std::max(0, std::min(valid, j - i - k + 1));
                while (j < n && a[j] < low)
                    j++;
            }
            if (q <= count)
                return true;
        }
        return false;
    };
    int lo = -1, hi = s.back() - s.front();
    while (lo + 1 != hi) {
        int mi = (lo + hi) / 2;
        (ok(mi) ? hi : lo) = mi;
    }
    std::cout << hi << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <string>
#include <cstring>
#include <cmath>
#include <complex>
#include <map>
#include <climits>
#include <sstream>
using namespace std;

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define EPS 1e-8
#define F first
#define S second
#define mkp make_pair

static const double PI=6*asin(0.5);
typedef long long ll;
typedef complex<double> CP;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vint;
static const int INF=1<<24;

template <class T>
void initvv(vector<vector<T> > &v,int a,int b, const T  &t = T()){
	v.assign(a,vector<T>(b,t));
}

//v.erase(unique(v.begin(),v.end()),v.end());


int main(){
	int b,r,g,c,s,t;
	while(cin>>b>>r>>g>>c>>s>>t,b||r||g||c||s||t){
		cout<<b*(15*6-10)+r*(15*4-6)+g*7+c*2-3*(t-b*5-r*3-s)+100<<endl;
	}
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
typedef long long ll;
#define rep(i, a, b) for (int i = a; i <= b; ++ i)
using namespace std;
bool vis[35]; int n;
void calc(int x) {
	rep(i, 0, 29) if (x == ((1 << (i + 1)) - 1)) vis[i] = true;
}
int main() {
	scanf("%d", &n); int tmp = 0, x;
	rep(i, 1, n) scanf("%d", &x), tmp ^= x, calc(x ^ (x - 1));
	int now = 0, ans = 0;
	for (int i = 29; i >= 0; -- i) if (vis[i]) {
		if (((tmp >> i) & 1) ^ ((now >> i) & 1))
			++ ans, now ^= ((1 << (i + 1)) - 1);
	}
	if (now == tmp) printf("%d\n", ans); else printf("-1");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

int main() {
	double x1,y1,x2,y2;
	cin>>x1>>y1>>x2>>y2;
	double d1=(x1-x2);
	double d2=(y1-y2);
	printf("%lf\n",sqrt(d1*d1+d2*d2));
	
	return 0;
}

Measured memory_bytes: 3268
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<functional>
#include<tuple>
using namespace std;
int X, K, Q, p[100009], ans[100009], L = 0, R, s = 0, t; bool unity = false;
int l[100009], r[100009], v[100009]; bool u[100009];
int main() {
	cin >> X >> K; R = X; t = X;
	for (int i = 1; i < 100009; i++)p[i] = 1000000009;
	for (int i = 1; i <= K; i++)cin >> p[i]; p[K + 1] = 1000000007; K += 2;
	l[0] = 0; r[0] = R; v[0] = 0;
	for (int i = 1; i < K; i++) {
		if (i % 2 == 1) { s -= (p[i] - p[i - 1]); t -= (p[i] - p[i - 1]); if (s < 0) { L += (-s); s = 0; }if (t < 0) { unity = true; } }
		if (i % 2 == 0) { s += (p[i] - p[i - 1]); t += (p[i] - p[i - 1]); if (s > X) { s = X; unity = true; }if (t > X) { R -= (t - X); t = X; } }
		if (L >= R)unity = true;
		u[i] = unity; l[i] = L; r[i] = R; v[i] = s;
	}
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		int p1, p2; cin >> p1 >> p2;
		int pos1 = upper_bound(p, p + K, p1) - p; pos1--;
		int GG = max(l[pos1], min(r[pos1], p2)) - l[pos1]; GG += v[pos1];
		if (pos1 % 2 == 0)GG -= (p1 - p[pos1]); else GG += (p1 - p[pos1]);
		GG = max(0, min(X, GG));
		cout << GG << endl;
	}
	return 0;
}

Measured memory_bytes: 2816
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	double a, p;
	int N;
	cin >> N;
	if (N % 2 == 0)
		p = N / 2;
	else
		p = N / 2 + 1;
	a = p / N;
	printf("%.10lf\n", a);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <climits>

using namespace std;

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

    string s;
    int w;

    cin >> s >> w;

    for (int i = 0; i < s.size(); i+=w) {
        cout << s[i];
    }
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <utility>
#include <functional>
#include <deque>
#include <cctype>

const long long int Z = 1000000007;
const long long int INF = 1 << 30;
int flag = 0;
using ll = long long;

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

 int main() {
	 int n;
	 std::cin >> n;
	 int s[4][14] = { 0 };
	 for(int i=0;i<n;i++){
		 char c;
		 std::cin >> c;
		 if (c == 'S') {
			 int a;
			 std::cin >> a;
			 s[0][a] = 1;
		 }
		 if (c == 'H') {
			 int a;
			 std::cin >> a;
			 s[1][a] = 1;
		 }
		 if (c == 'C') {
			 int a;
			 std::cin >> a;
			 s[2][a] = 1;
		 }
		 if (c == 'D') {
			 int a;
			 std::cin >> a;
			 s[3][a] = 1;
		 }
	 }
	 for (int i = 0;i < 4;i++) {
		 for (int j = 1;j <= 13;j++) {
			 if (s[i][j] == 0) {
				 if (i == 0) {
					 std::cout << 'S' << ' ' << j << std::endl;
				 }
				 if (i == 1) {
					 std::cout << 'H' << ' ' << j << std::endl;
				 }
				 if (i == 2) {
					 std::cout << 'C' << ' ' << j << std::endl;
				 }
				 if (i == 3) {
					 std::cout << 'D' << ' ' << j << std::endl;
				 }
			 }
		 }
	 }
	return 0;
}


Measured memory_bytes: 3084
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
  ll n;cin>>n;
  ll a[3*n];
  for(ll i=0;i<3*n;i++)cin>>a[i];
  sort(a,a+3*n);
  ll ans=0;
  for(ll i=n;i<3*n;i+=2)ans+=a[i];
  cout<<ans<<endl;
}

Measured memory_bytes: 2560
#include <iostream>
#include <algorithm>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>

using namespace std;


int main() {
	long num[26];
	int N;
	cin >> N;
	for (int i = 0; i < 26; i++) {
		num[i] = 0;
	}
	for (int i = 0; i < N; i++) {
		char c;
		cin >> c;
		c -= 'a';
		num[c]++;
	}

	long n = 1;
	for (int i = 0; i < 26; i++) {
		if (num[i] == 0) { continue; }
		n *= num[i] + 1;
		n %= 1000000007;
	}
	cout << n - 1;
	return 0;
}

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

int main() {
  int sumprice = 0,sumnumber = 0,k=0,price,number;
  double ave = 0;
  while(scanf("%d,%d",&price,&number) == 2) {
    sumprice += price * number;
    sumnumber += number;
    k++;
  }
  cout << sumprice << endl;
  ave = (double)sumnumber / (double)k;
  ave += 0.5;
  ave = floor(ave);
  cout << ave << endl;
}

Measured memory_bytes: 0
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <fstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;
typedef long long LL;
typedef pair<int, int> P;
static const double EPS = 1e-5;

#define FOR(i,k,n) for (int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
static const int INF = 1e9;
int main(void){
  int n,k;
  while(cin>>n>>k){
    if(n==0) break;
    int route[100][100];
    REP(i,n)REP(j,n) route[i][j] = INF; 
    int t,a,b,c;
    REP(i,k){
      cin>>t;
      if(t==1){
        cin>>a>>b>>c;
        a--;b--;
        route[a][b]=min(route[a][b],c);
        route[b][a]=min(route[b][a],c);
        REP(i,n)REP(j,n){
          route[i][j] = min(route[i][j],route[i][a]+route[a][j]);
          route[i][j] = min(route[i][j],route[i][b]+route[b][j]);
        }
        REP(i,n)REP(j,n){
          route[i][j] = min(route[i][j],route[i][a]+route[a][j]);
          route[i][j] = min(route[i][j],route[i][b]+route[b][j]);
        }
      }else{
        cin>>a>>b;
        a--;b--;
        if(route[a][b]==INF) cout<<-1<<endl;
        else cout<<route[a][b]<<endl;
      }
    }
  }
  return 0;
}

Measured memory_bytes: 908
#include <iostream>
#include <stdint.h>
#include <string.h>
using namespace std;

uint64_t test(uint64_t x, char *s) {
  if (*s == '\0') {
    return x;
  }
  uint64_t i = x + atoll(s);
  for(int j = 1; j < strlen(s); j++) {
    char tmp[j + 1];
    memcpy(tmp, s, j);
    tmp[j] = '\0';
    i += test(x + atoll(tmp), s + j);
  }
  return i;
}

int main() {
  char s[11];
  cin >> s;
  cout << test(0, s);
  return 0;
}


Measured memory_bytes: 256