akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
//#include <tr1/unordered_map>
//#include"Bignum/bignum.h"
//#define big bignum
#define lowbit(x) (x & -x)
#define debug(x) (cout << "#x = " << (x) << endl)
#define Set(x, i) memset (x, i, sizeof(x))
#define R register
#define For(i, j, k) for(R int i = (j), ED = (k); i <= ED; ++i)
#define Rep(i, j, k) for(R int i = (j), ED = (k); i >= ED; --i)
#define Cross(i, j, k) for(R int i = (j); i; i = (k))
using namespace std;
typedef long long ll;
const ll N = 100011;
const ll INF = 5e16;

namespace IO {

	inline char gc() {
		static char buf[100000], *p1 = buf, *p2 = buf;
		return (p1 == p2) && (p2 = (p1 = buf) +
			fread (buf, 1, 100000, stdin), p1 == p2)? EOF: *p1++;
	}

	#define dd ch = getchar()
	inline ll read() {
		R ll x = 0; R int f = 0; R char dd;
		for (; !isdigit (ch); dd) f ^= (ch == '-');
		for (; isdigit (ch); dd)  x = x * 10 + (ch ^ 48);
		return f? -x: x;
	}
	#undef dd

	inline void write( ll x ) {
		if (x < 0) putchar ('-'), x = -x;
		if (x > 9) write (x / 10); putchar (x % 10 | 48);
	}

	inline void wrn ( ll x ) { write (x); putchar (' '); }

	inline void wln ( ll x ) { write (x); putchar ('\n'); }

	inline void wlnn ( ll x, ll y ) { wrn (x), wln (y); }

}

using IO::wln;
using IO::read;

namespace Cesare {
	
	ll n, d[N];
	
	int main() {
		n = read();
		For ( i, 1, n ) d[i] = read();
		sort (d + 1, d + n + 1);
		return wln (d[n / 2 + 1] - d[n / 2]), 0;
	}
	
}

int main()
{
	return Cesare::main();
}

/*

*/






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

using namespace std;

// MACROS

#define ll long long
#define ull unsigned long long
#define ld long double

#define vi vector<int>
#define vll vector<ll>
#define vld vector<ld>
#define u_s unordered_set

#define pii pair<int,int>
#define pll pair<ll,ll>

#define FOR(i, n) for (ll (i) = 0; i < n; i++)
#define FORN(i, a, b) for (ll (i) = a; i < b; i++)
#define FORE(i, l) for (auto (i) : l)

#define pb push_back
#define pob pop_back
#define emp emplace

#define in(n) cin >> (n);
#define debug(n) cout << #n << ": " << n << '\n';

// FUNCTIONS

template< typename T >
inline T gcd(T a, T b) { if (b) return gcd(b, a % b); return a; }

template< typename T >
inline T ext_gcd(T a, T b, T & x, T & y) { if (a == 0) { x = 0; y = 1; return b; } T x1, y1; T g = ext_gcd(b % a, a, x1, y1); x = y1 - (b / a) * x1; y = x1; return g; }

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
    ll n;    
    cin >> n;
    vll a(n);
    ll neg = 0;
    ll m = 1e9 + 1;
    ll sum = 0;
    FOR(i, n)
    {
        cin >> a[i];
        if (a[i] < 0) neg++;
        a[i] = abs(a[i]);
        m = min(m, a[i]);
        sum += a[i];
    }
    if (neg % 2 == 0) cout << sum << '\n';
    else cout << sum - 2 * m << '\n';
}



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

using namespace std;

using ll = long long;
using ull = long long;

int main()
{
	ll H;
	cin>>H;
	ull ans = 1;
	int i = 1;
	while (H != 1) {
		ans += (1UL<<i);
		H /= 2;
		i += 1;
	}

	cout<<ans<<endl;

	return 0;
}


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

public static class Solution
{
    public static void Main()
    {
        var s = Console.ReadLine();
        if (s.Last() == 's')
        {
            s += "es";
        }
        else
        {
            s += "s";
        }

        Console.WriteLine(s);
    }
}

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

int main() {

	ll x, k, d; cin >> x >> k >> d;
	if (x < 0) x *= -1;
	ll quo = x / d;
	ll mod = x % d;
	ll ans;
	if (quo <= k) {
		if (k % 2 == quo % 2) {
			ans = mod;
		}
		else {
			ans = abs(d - mod);
		}
	}
	else if (k < quo) {
			ans = d * (quo - k) + mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=0; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define F first
#define S second

using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef pair<int, int> pint;

int main()
{
  int n, t ;
  cin >> n >> t ;
  vector<pair<int,int>> vec(n) ;
  int ans = 0 ;
  
  REP(i,n){
    int a, b ;
    cin >> a >> b ;
    vec.at(i) = make_pair(a,b) ;
  }
  
  sort(ALL(vec)) ;
  
  REP(i,n){
    if(vec.at(i).second<=t){
      ans = vec.at(i).first ;
      break ;
    }
  }
  if(ans==0){
    cout <<"TLE"<<endl ;
  }
  else{
    cout <<ans<<endl ;
  }
      

  return 0 ;
}




Measured memory_bytes: 256
n = int(input())
t = list(map(int, input().split()))
v = list(map(int, input().split()))
T = sum(t)

vmax_l = [0 for _ in range(2*T+1)]
vmax_r = [0 for _ in range(2*T+1)]
vmax = [0 for _ in range(2*T+1)]
for i in range(1, 2*T+1):
    tt = 0
    for j in range(n):
        if i > tt+t[j]*2:
            tt += t[j]*2
        else:
            vmax_l[i] = min(v[j], vmax_l[i-1]+0.5)
            break
for i in range(2*T-1, -1, -1):
    tt = 2*T
    for j in range(n-1, -1, -1):
        if i < tt-t[j]*2:
            tt -= t[j]*2
        else:
            vmax_r[i] = min(v[j], vmax_r[i+1]+0.5)
            break
for i in range(2*T+1):
    vmax[i] = min(vmax_l[i], vmax_r[i])

point_t = [0]
point_v = [0]
for i in range(1, 2*T):
    if vmax[i-1] != vmax[i] or vmax[i] != vmax[i+1]:
        point_t.append(i)
        point_v.append(vmax[i])
point_t.append(2*T)
point_v.append(0)

ans = 0
for i in range(1, len(point_t)):
    ans += (point_t[i]-point_t[i-1])*(point_v[i]+point_v[i-1])/4
print(ans)

Measured memory_bytes: 4144
N,M=map(int,raw_input().split())
PY=[]
for i in range(M):
    PY.append(map(int,raw_input().split())+[i])


PY.sort()
Ans={i:0 for i in range(M)}
counter=0

for i in range(M):
    if i==0:
        counter+=1
    elif PY[i][0]==PY[i-1][0]:
        counter+=1
    else:
        counter=1
    Ans[PY[i][2]]=str(PY[i][0]).zfill(6)+str(counter).zfill(6)
    
for i in range(M):
    print Ans[i]

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

void readtxt()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif
}
int main()
{
      //readtxt();
      long long int a, b, n;
      cin >> a >> b >> n;
      if(n<b)
      {
        cout << ((a*n)/b) - (a*(n/b)) << endl;
      }
      else
      {
        cout << ((a*(b-1))/b) - (a*((b-1)/b)) << endl;
      }
      //for(int i = 1; i<=248; i++)
      //{
      //   cout << ((a*i)/b) - (a*(i/b)) << endl;
      //}
}

Measured memory_bytes: 3632
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;
using static System.Console;
using static System.Math;
class Z { static void Main() => new K(); }
class K
{
	int F => int.Parse(Str);
	long FL => long.Parse(Str);
	int[] G => Strs.Select(int.Parse).ToArray();
	long[] GL => Strs.Select(long.Parse).ToArray();
	string Str => ReadLine();
	string[] Strs => Str.Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
	const int MOD = 1000000007;
	public K()
	{
		SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
		Solve();
		Out.Flush();
	}
	void Solve()
	{
		var S = Str;
		WriteLine(S.Length == 2 ? S : new string(S.Reverse().ToArray()));
	}
}


Measured memory_bytes: 13268
using System;

class sample
{
	static void Main()
	{
		int input = Convert.ToInt32(Console.ReadLine());
      
        string[] musiclist =new string[input];
        int[] musicplay =new int[input];
      
      for(int i=0;i<input;i++)
      {
        string[] music =Console.ReadLine().Split(' ');
        musiclist[i]=music[0];
        musicplay[i]=Convert.ToInt32(music[1]);
      }
      
      string lastm = Console.ReadLine();
      
      int index = Array.IndexOf(musiclist,lastm);
      int playtime =0;
      for(int j=index+1;j<musicplay.Length;j++)
      {
        playtime += musicplay[j];
      }
      Console.WriteLine(playtime);  
      
      
	}
}





Measured memory_bytes: 13152
#include<bits/stdc++.h>
using namespace std;
int main() {
	int n, m, c2 = 0 , ans;
	map<int, int>a;
	int over = 0;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> m;
		a[m]++;
	}
	ans = (int)a.size();

	for (pair<int, int>p : a) {
		over += p.second - 1;
	}

	if (over % 2)cout << ans - 1 << endl;
	else cout << ans << endl;

}


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

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

    stack<char> st;
    for (int i = 0; i < N; i++) {
        if (st.empty()) {
            st.push(S[i]);
        } else {
            if (st.top() == '(' && S[i] == ')') {
                st.pop();
            } else {
                st.push(S[i]);
            }
        }
    }

    string left, right;
    while (!st.empty()) {
        char c = st.top(); st.pop();
        if (c == '(') {
            right += ')';
        } else{
            left += '(';
        }
    }

    cout << left + S + right << endl;
    return 0;
}

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

LL n,k,q = 0,p[5005];
char ch = 'z';
string s,t;

int main(){
	cin >> n >> k;
	cin >> s;
	for(LL i = 0;i < n;i ++) ch = min(ch,s[i]);
	for(LL i = 0;i < n;i ++){
		p[i] = (s[i] == ch ? p[i - 1] + 1 : 0);
		q = max(q,p[i]);
	}
	q = max(q,p[n - 1] << 1);
	t = s; reverse(t.begin(),t.end()); s = s + t;
	t = s.substr(0,n);
	for(LL i = 1;i <= n;i ++) t = min(t,s.substr(i,n));
	for(LL i = 2;i <= k;i ++){
		s = t; reverse(s.begin(),s.end()); s += t;
		t = s.substr(n - q,n);
		q <<= 1; if(q > n) break;
	}
	cout << t << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s, t;
	cin >> s >> t;
	int n = s.length();
	int m = t.length();
	int dp[n+1][m+1];
	
	string ans = "";
	

	for(int i = 0; i <= n; i++)
	{	
		for(int j =0; j <= m ;j++)
		{
			if(i==0 || j==0)
				dp[i][j]=0;
			else if(s[i-1] == t[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 = n , j = m;
	while(i>0 && j>0)
	{
		if(s[i-1] == t[j-1])
		{
			ans+= s[i-1];
			i--;
			j--;
		}
		else if(dp[i-1][j] > dp[i][j-1])
			i--;
		else
			j--;

	}
	reverse(ans.begin(), ans.end());
	

	cout << ans << endl;
}


Measured memory_bytes: 35456
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : abs(x); }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : abs(x); }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

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

	int n, a, b;
	cin >> n >> a >> b;

	int ansA = min(a, b);
	int ansB = n < a + b ? a + b - n : 0;

	cout << ansA << " " << ansB << endl;
	return 0;
}


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

int main() {

    string s, t; cin >> s >> t;

    s = "#" + s;
    t = "#" + t;

    int n = s.length(), m = t.length();

    vector <vector <int> > dp(n, vector <int> (m, 0));
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j]) {
                dp[i][j] = 1 + (i && j ? dp[i - 1][j - 1] : 0);
            }

            dp[i][j] = i ? max(dp[i - 1][j], dp[i][j]) : dp[i][j];
            dp[i][j] = j ? max(dp[i][j - 1], dp[i][j]) : dp[i][j];
        }
    }

    string result = "";
    int i = n - 1, j = m - 1;
    while (i > 0 && j > 0 && dp[i][j] > 0) {
        if (i && dp[i - 1][j] == dp[i][j]) i--;
        else if (j && dp[i][j - 1] == dp[i][j]) j--;
        else {
            result += s[i];
            i--; j--;
        }
    }

    // if ((i == 0 || j == 0) && dp[i][j] > 0) result += t[j];

    reverse(result.begin(), result.end());

    cout << result << "\n";

    return 0;
}

Measured memory_bytes: 35584
#include<bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
main(){int n,ans=0,x[200000],y[200000];cin>>n;r(i,n)scanf("%d",&x[i]);r(i,n)scanf("%d",&y[i]);r(i,n)r(j,n)ans^=x[i]+y[j];cout<<ans;}

Measured memory_bytes: 5292
# coding: utf-8

N = int(input())
p = list(map(int, input().split()))

need = 0
skip = 0

for i in range(N):
    if(p[i] == i + 1 and skip == 0):
        need += 1
        skip = 1
    else:
        skip = 0
        
print(need)


Measured memory_bytes: 13880
def main():
    N = int(input())
    A = list(map(int, input().split()))
    if 0 in A:
        print(0)
        return

    ans = 1
    l = 10 ** 18
    for v in A:
        ans *= v
        if ans > l:
            ans = -1
            break

    print(ans)


if __name__ == '__main__':
    main()

Measured memory_bytes: 84944
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bits/stdc++.h>
#include<cmath>
#include<bitset>
#include<queue>
#define ll long long
#define itn int
#define co(ans) cout<<ans<<endl;
#define COYE cout<<"YES"<<endl;
#define COYe cout<<"Yes"<<endl;
#define COye cout<<"yes"<<endl;
#define CONO cout<<"NO"<<endl;
#define CONo cout<<"No"<<endl;
#define COno cout<<"no"<<endl;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define FFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n)  FFOR(i,1,n)
#define SORT(V) sort((V).begin(),(V).end())
#define REVERSE(V) reverse((V).begin(),(V).end())
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1000000007
#define MAX 510000
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;}
using namespace std;


int main(){
  int N,ans;
  cin>>N;
  
  int R[N];
  REP(i,N) cin>>R[i];
  
  int maxv=-2000000000;
  int minv=R[0];
  
  for(int i=1; i<N; ++i){
      maxv=max(maxv,R[i]-minv);
      minv=min(minv,R[i]);
  }
  
  cout<<maxv<<endl;
  return 0;
}


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

#define rep(i, n) for(int i=0; i < n; i++)
#define REP(i, n, m) for(int i=n; i < m; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define ALL(v) v.begin(), v.end()
#define rALL(v) v.rbegin(), v.rend()
#define pb(x) push_back(x)
#define mp(x,y) make_pair(x,y)

using namespace std;
using ll=long long;

const ll INF = 1LL << 60;

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 a,b,c,d,e;cin>>a>>b>>c>>d>>e;
  cout<<60*c+d-60*a-b-e;
}


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

namespace ConsoleApp1 {
    public class Class {
        static void Main(string[] args) {
            var S = Console.ReadLine();
            var T = Console.ReadLine();
            long ans = 0;
            for(var i = 0; i < S.Length; i++) {
                if (S[i] != T[i]) ans++;
            }
            Console.Write(ans);
        }
    }
}

Measured memory_bytes: 27224
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>


using namespace std;

#ifdef _MSC_VER
#define __typeof__ decltype
template <class T> int __builtin_popcount(T n) { return n ? 1 + __builtin_popcount(n & (n - 1)) : 0; }
#endif

#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CLEAR(arr, val) memset(arr, val, sizeof(arr))

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

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

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

const double EPS = 1e-8;
const double PI = acos(-1.0);
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
bool valid_pos(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }


ll mod_mul(ll x, ll n, ll mod)
{
	if (n == 0)
		return 0;
	if (x < 0)
		x = (x + mod) % mod;
	if (n < 0)
		n = (n + mod) % mod;
	//bool nega = n < 0;
	//if (nega)
	//	n = -n;

	ll res = 0;
	while (n > 0)
	{
		if (n & 1)
			res = (res + x) % mod;
		x = x * 2 % mod;
		n /= 2;
	}

	//if (nega)
	//	res = (mod - res) % mod;
	return res;
}
ll ext_gcd(ll a, ll b, ll &x, ll &y)
{
	if (b)
	{
		ll g = ext_gcd(b, a % b, y, x);
		y -= (a / b) * x;
		return g;
	}
	else
	{
		x = 1, y = 0;
		return a;
	}
}
ll mod_inverse(ll a, ll mod)
{
	ll x, y;
	if (ext_gcd((a + mod) % mod, mod, x, y) == 1)
		return (mod + x % mod) % mod;
	else
		return 0;
}
int main()
{
	ios::sync_with_stdio(false);

	const ll mod = 9999999967LL;

	int n;
	cin >> n;
	ll x = 0;
	while (n--)
	{
		int o, y;
		cin >> o >> y;
		if (o == 1)
			x += y;
		else if (o == 2)
			x -= y;
		else if (o == 3)
			x = mod_mul(x, (y + mod)%mod, mod);
		else
			x = mod_mul(x, mod_inverse(y, mod), mod);

		x = (x + mod) % mod;
	}
	if (x >= 1LL << 31)
		x -= mod;
	cout << x << endl;
}

Measured memory_bytes: 900
from collections import Counter
 
M = 998244353
n = int(input())
a = map(int, input().split())
x, c = next(a), Counter(a)
r = 0
if x == c[0] == 0:
    r = p = i = 1
    while c[i]:
        r = r * pow(p, c[i], M) % M
        p = c[i]
        n -= p
        i += 1
print((r, 0)[n > 1])


Measured memory_bytes: 22636
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define REP(i, n) for (int i = 0; i < n; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<int> vi;
const int INF = 1LL << 58;
const int MOD = 1000000007;
const int MAX_N = 200100;

signed main()
{
    //  以降 cin の入力元が 'input.txt' になる
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());
    int N ,K;
    cin >> N>>K;
    vi v;
    v.resize(N);
    REP(i, N){
        v[i] = 0;
    }
    REP(i, K){
       int t;
       cin >> t;
       REP(i, t){
           int a;
           cin >> a;
           v[a-1]++;
       } 
    }
    int ans = 0;
    REP(i, N){
        if(v[i] == 0)
        ans++;
    }
    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3604
n,m=gets.split.map &:to_i
s=gets
mint=Array(n+1)
mint[0] = n
cur=1
ok=true
n.times {|i|
  idx = n-i-1
  if s[idx] == '0' then
    if mint[cur-1] - idx > m then
      cur += 1
      if mint[cur-1] == nil || mint[cur-1] - idx > m then
        ok = false
        break
      end
    end
    mint[cur] = idx
  end
}
if ok then
ans=[]
cur.times {|i|
  idx=cur-i
  ans << (mint[idx-1]-mint[idx])
}
puts ans.join(' ')
else
  puts -1
end


Measured memory_bytes: 3964
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
//#define ll long long
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 (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define rep_rev(i, n) for (int (i) = (int)(n) - 1 ; (i) >= 0 ; --(i))
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll t1,t2,t3;
const ll mod = 998244353;
const int INF = 1e9;
const ll INFLONG = 1e18;

int main(){
  string s;
  ll k;
  cin >> k;
  cin >> s;
  ull len = s.size();
  if(len > k){
    rep(i,k){
      cout << s[i];
    }
    cout << "..." << endl;
  }else{
    cout << s << endl;
  }
}

Measured memory_bytes: 3632
#include <stdio.h>

int main(void)
{
  int n,k,ans = 0;
  scanf("%d %d",&n,&k);
  int i,h[n];
  for(i = 0;i < n;i++) scanf("%d",&h[i]);
  for(i = 0;i < n;i++) {
    if(h[i] >= k) ans++;
  }
    
  printf("%d\n",ans);
  
  return 0;
}


Measured memory_bytes: 512
/*
  GOOD is not Enough
  You've got to be GREAT.
*/
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
// #include<boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define mod 1000000007
#define FAST ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define f(i,n) for(int i=0;i<n;i++)
#define fp(i,k,n) for(int i=k;i<=n;i++)
#define fr(i,k,n) for(int i=k;i>=n;i--)
#define pb push_back
#define pii pair<int,int>
#define dbg(x) cout << (#x) << " is " << (x) << '\n' 
#define F first
#define S second
#define all(a) a.begin(),a.end()
typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;


void solve()
{ 
  string s;
  cin >> s;
  if(s[1]=='R')
    cout << "ABC\n";
  else
    cout << "ARC\n";
  return;
}

signed main()
{
  FAST
  int T=1;
//   cin >> T;
  while(T--)
  {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3652
n = int(input())
s1=input()
s2=input()
k=1
i=0
if s1[0]==s2[0]:
    i+=1
    k=3
else:
    i+=2
    k=6
mod=1000000007
while i<n:
    if s1[i]!=s2[i] and s1[i-1]!=s2[i-1]:
        k*=3
        i+=2
    elif s1[i]!=s2[i] and s1[i-1]==s2[i-1]:
        k*=2
        i+=2
    else:
        if s1[i-1]==s2[i-1]:
            k*=2
        i+=1
    k%=mod
print(k)
        
    

Measured memory_bytes: 61908
#include<iostream>
#include<deque>
#include<vector>

int main() {
  std::cin.tie(0); std::ios::sync_with_stdio(false);
  int N, M; std::cin >> N >> M;
  std::vector<std::vector<int>> G(N);
  for(int i = 0; i < M; ++i) {
    int A, B; std::cin >> A >> B; --A; --B;
    G[A].push_back(B);
    G[B].push_back(A);
  }
  int a = 0, b = G[a][0];
  std::deque<int> ans = {a, b};
  std::vector<bool> used(N, false);
  used[a] = used[b] = true;
  for(;;) {
    bool ok = true;
    for(int v: G[ans.front()]) if(!used[v]) {
      ok = false;
      ans.push_front(v);
      used[v] = true;
      break;
    }
    if(!ok) continue;
    for(int v: G[ans.back()]) if(!used[v]) {
      ok = false;
      ans.push_back(v);
      used[v] = true;
      break;
    }
    if(ok) break;
  }
  std::cout << ans.size() << "\n";
  for(int i = 0; i < ans.size()-1; ++i) std::cout << (ans[i]+1) << " ";
  std::cout << ans.back()+1 << std::endl;
  return 0;
}

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

int main(){
	int N,M; cin>>N>>M;
	int S[M]; char C[M];
	rep(i,M){ cin>>S[i]>>C[i]; --S[i]; }
	int ans = 1000;
	rep(i,1000){
		string A = to_string(i);
		if(A.size() != N) continue;
		bool ok = true;
		rep(j,M) if(A[S[j]] != C[j]){ ok = false; break; }
		if(ok){ cout<<i<<endl; return 0; }
	}
	puts("-1");
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int N = 0;
  int min_ = 1000000;
  int count = 0;
  
  cin >> N;
  
  for (int i = 0; i < N; i++) {
    int P = 0;
    cin >> P;
    
    if (min_ > P) {
      min_ = P;
      count++;
    }
  }
  
  cout << count << endl;
}

Measured memory_bytes: 256
#include<iostream>
#include <algorithm>
#include <numeric>
#include <queue>
using namespace std;

int main(){
    int n, m;
    //int *payment;
    int tmp;
    int max_value;
    long long sum = 0;
    priority_queue<int> que;
    cin >> n >> m;
    //payment = new int[n];
    for(int i=0; i<n; i++){
        cin >> tmp;
        que.push(tmp);
    }
    for(int i=0; i<m; i++){
        max_value = que.top();
        max_value /= 2;
        que.pop();
        que.push(max_value);
    }
    while(!que.empty()){
        sum += que.top();
        que.pop();
    }
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 892
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();

		int sum = 0;
		for (int i = 1; i <= b - a; i++) {
			sum += i;
		}

		System.out.println(sum - b);

		sc.close();
	}

}


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

bool getSeven(vector<int>v,int index,int result,vector<char>&op)
{
    if(op.size()==4)
    {
        if(result==7)
        {
            cout<<v[0];
            for(int i=1;i<op.size();i++)
            {
                cout<<op[i];
                cout<<v[i];
            }   
            cout<<"=7";
            return true;
        }
        
        else
        return false;
    }
    else
    {
        vector<char>temp=op;
        temp.push_back('+');
        if(getSeven(v,index+1,result+v[index],temp)==true)
        {
            return true;
        }
        temp.pop_back();
        temp.push_back('-');
        if(getSeven(v,index+1,result-v[index],temp)){
            return true;
        }
        return false;
    }
}

int main(){
    int n;
    cin>>n;
    vector<int>v(4);
    for(int i=3;i>=0;i--){
        v[i]=n%10;
        n/=10;
    }
    vector<char>op;
    int index=0;
    getSeven(v,0,0,op);
    
}

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

int main(){
  string S;
  cin >> S;
  
  int k = 0;
  for(char c : S){
    if(c == '+')
      k++;
    else if(c == '-')
      k--;
  }

  cout << k << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}



int main(){
	char c;
	cin >> c;
	if('A' <= c && c <= 'Z')
		cout << 'A' << endl;
	else
		cout << 'a' << endl;

	return 0;
}

Measured memory_bytes: 3488
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc=new Scanner(System.in);
  long a=Long.parseLong(sc.next());
  long b=Long.parseLong(sc.next());
  long n=Long.parseLong(sc.next());
  if(a%n!=0)a+=n-a%n;
  if(b%n!=0)b-=a%n;;
  if(a>b)System.out.println(0);
  else if(a==b)System.out.println(1);
  else System.out.println((b-a)/n+1);
}
}


Measured memory_bytes: 22996
#-*- using:utf-8 -*-

N = int(input())
C = [0,0,0,0]
for _ in range(N):
    a = str(input())
    if(a == "AC"):
        C[0] += 1
    elif(a == "WA"):
        C[1] += 1
    elif(a == "TLE"):
        C[2] += 1
    elif(a == "RE"):
        C[3] += 1
print("AC x " + str(C[0]))
print("WA x " + str(C[1]))
print("TLE x " + str(C[2]))
print("RE x " + str(C[3]))

Measured memory_bytes: 69916
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace NotFounds
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve();
        }

        public void Solve()
        {
            var cin = new MyInputStream();
            var o = ReadLine();
            var e = ReadLine();
            for (int i = 0; i < o.Length + e.Length; ++i)
            {
                if (i % 2 == 0)
                    Write(o[i >> 1]);
                else
                    Write(e[i >> 1]);
            }
            WriteLine();
        }
    }

    public class MyInputStream
    {
        private char separator = ' ';
        private Queue<string> inputStream;
        public MyInputStream(char separator = ' ')
        {
            this.separator = separator;
            inputStream = new Queue<string>();
        }

        public string Read()
        {
            if (inputStream.Count != 0) return inputStream.Dequeue();
            string[] tmp = Console.ReadLine().Trim().Split(separator);
            for (int i = 0; i < tmp.Length; i++)
            {
                inputStream.Enqueue(tmp[i]);
            }
            return inputStream.Dequeue();
        }
        public string ReadLine() => Console.ReadLine();
        public int ReadInt() => int.Parse(Read());
        public long ReadLong() => long.Parse(Read());
        public double ReadDouble() => double.Parse(Read());
    }
}


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

// using
using namespace std;

// typedef
typedef long long ll;

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

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

// main
int main() {
    string S;
    cin >> S;
    int res = 0;
    REP(i, 3) {
        if (S[i] == '1') {
            res++;
        }
    }
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iomanip>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <bitset>

using namespace std;
typedef long long ll;
ll ds(ll Q){
        ll sum=0;
        ll dig;
        while(Q){
        dig = Q % 10;
        sum = sum + dig;
        Q = Q / 10;
        }
        return sum;
    }

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


    ll ans=0;
    ll anss =0;
    ll count=0;
    ll i,j;
  
    long double x;
    vector<ll> aa;

    ll Q,N,K;
    long double a, b;
    string S;
    cin  >>K;
    ll flag=0;
    ll t1=0;
    ll t2=0;
  	
    ll Q1=Q;

    ll temp=1;
    ll pl=1;

    

    for(i=1;i<K+1;i++){
        //if(i==1) {cout << 1 << endl;}
        //else{
            //if(temp==999){
            //    cout <<"99!! "<< (temp+pl)/ds(temp+pl) <<" a "<<(temp+2*pl)/ds(temp+2*pl);
            //    
            //}
            if(double((temp+pl))/double(ds(temp+pl)) > double((temp+2*pl))/double(ds(temp+2*pl))){
                //cout<<"aaa"<<endl;
                pl=pl*10;
            }
             
            cout << temp << endl;
            temp += pl; 
            //if((i+1)%9==0 && i!=1){
             //   pl=pl*10;
            //}
        //}
    }
    
    //ans=((N-1)/(K-1));

    //if((N-1)%(K-1)!=0) ans++;

    
    
      
    
      
   
    return 0;
}

Measured memory_bytes: 256
class Dice:
    def __init__(self):
        self.omote=1
        self.sita=2
        self.migi=3
        self.ue=5
        self.hidari=4
        self.ura=6

    def North(self):
        self.omote,self.ue,self.ura,self.sita=self.sita,self.omote,self.ue,self.ura

    def East(self):
        self.omote,self.hidari,self.ura,self.migi=self.hidari,self.ura,self.migi,self.omote

    def West(self):
        self.omote,self.migi,self.ura,self.hidari=self.migi,self.ura,self.hidari,self.omote

    def South(self):
        self.omote,self.ue,self.ura,self.sita=self.ue,self.ura,self.sita,self.omote

    def Right(self):
        self.sita,self.migi,self.ue,self.hidari=self.migi,self.ue,self.hidari,self.sita

    def Left(self):
        self.sita,self.hidari,self.ue,self.migi=self.hidari,self.ue,self.migi,self.sita

n=int(input())
while(n!=0):
    sum=1
    dice=Dice()
    dice_def={"North":dice.North,"East":dice.East,"South":dice.South,"West":dice.West,"Right":dice.Right,"Left":dice.Left}
    for i in range(n):
        dice_def[input().strip()]()
        sum+=dice.omote
    print(sum)
    n=int(input())

Measured memory_bytes: 7668
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main {
    public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		
		// 入力
		String s = sc.next();
		
		// 計算
		String result = s.replace(",", " ");
		
		// 出力
		System.out.println(result);
	}

	public static class Scanner {
		private BufferedReader br; private StringTokenizer tok;
		public Scanner(InputStream is) throws IOException { br = new BufferedReader(new InputStreamReader(is));}
		private void getLine() throws IOException { while(!hasNext()) tok = new StringTokenizer(br.readLine());}
		private boolean hasNext() { return tok != null && tok.hasMoreTokens();}
		public String next() throws IOException { getLine(); return tok.nextToken();}
		public int nextInt() throws IOException { return Integer.parseInt(next());}
		public long nextLong() throws IOException { return Long.parseLong(next());}
		public double nextDouble() throws IOException { return Double.parseDouble(next());}
	}
}


Measured memory_bytes: 22996
#pragma GCC optimize("Ofast", "unroll-loops")

// #define USE_AC_LIBRARY

#include <bits/stdc++.h>
#ifdef USE_AC_LIBRARY
#include <atcoder/all>
#endif

using namespace std;
#ifdef USE_AC_LIBRARY
using namespace atcoder;
#endif

#define ll long long
#define ld long double

ll modpow(ll a, ll b, ll mod = 1000000007LL){
	if (b == 0) return 1LL;
	ll tmp = modpow(a, b / 2, mod);
	if (b % 2)
		return tmp * tmp % mod * a % mod;
	return tmp * tmp % mod;
}

constexpr ll mod = 1000000007LL;

int main(void){
	int N; cin >> N;
	ll res = ((modpow(10, N) - 2 * modpow(9, N) % mod + mod)	% mod + modpow(8, N)) % mod;
	cout << res << endl;
	return 0; 
}

Measured memory_bytes: 3596
#include <cstdio>

int terms[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};

int main(){
	int K;
  	scanf("%d",&K);
  	printf("%d\n",terms[K-1]);

	return 0;
}

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

using namespace std;

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


int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);	
	int x;
	cin >> x;
	int k=0;
	int t=0;
	while (k < x) {
		t+=1;
		k+=t;	
	}
	cout << t << "\n";
}



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

int paper[10][10] = { 0 };
int white = 100, max = 0;

void ink(int x, int y) {
	if (0 <= x && x <= 9 && 0 <= y && y <= 9) {
		if (paper[x][y] == 0) white--;
		paper[x][y] += 1;
		max = paper[x][y] > max ? paper[x][y] : max;
	}
}

int main() {
	int x, y, s;
	while (std::scanf("%d,%d,%d", &x, &y, &s) != EOF) {
		if (s >= 3) {
			ink(x - 2, y);
			ink(x + 2, y);
			ink(x, y - 2);
			ink(x, y + 2);
		}
		if (s >= 2) {
			ink(x - 1, y - 1);
			ink(x - 1, y + 1);
			ink(x + 1, y - 1);
			ink(x + 1, y + 1);
		}
		ink(x, y);
		ink(x - 1, y);
		ink(x + 1, y);
		ink(x, y - 1);
		ink(x, y + 1);
	}
	std::cout << white << std::endl << max << std::endl;
	return 0;
}


Measured memory_bytes: 3128
N = int(input())
A_1 = list(map(int,input().split()))
A_2 = list(map(int,input().split()))

cnt_max = 0

# どの時点で下段にいくのか、で全探索
for i in range(1,N+1):
  cnt = 0
  cnt += sum(A_1[:i])
  cnt += sum(A_2[i-1:])
  
  cnt_max = max(cnt,cnt_max)

print(cnt_max)

Measured memory_bytes: 3060
import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}
import scala.annotation.tailrec

object Main extends App {
  val n = in.readInt
  val a = in.readLine.split(" ").map(_.toInt)

  val tableL = Array.ofDim[Int](n)
  val tableR = Array.ofDim[Int](n)
  val table = Array.ofDim[Int](n)

  var f = a.head
  var l = a.last
  for(i <- 0 until n-1) {
    val j = n-1 - i
    f = gcd(f, a(i))
    tableL(i+1) = f
    l = gcd(l, a(j))
    tableR(j-1) = l
  }

  table(0) = tableR(0)
  table(n-1) = tableL(n-1)
  for(i <- 1 until n-1) {
    table(i) = gcd(tableL(i),tableR(i))
  }

  val init = table(0) max table(n-1)
  val ans = (1 until n-1)./:(init)((acc,i) => acc max gcd(tableL(i),tableR(i)))
  println(ans)

  def gcd(a:Int, b:Int):Int = {
    if(b== 0) a
    else gcd(b, a%b)
  }
}

Measured memory_bytes: 49064
#include<stdio.h>

int main(void)
{
	int r,g,b;
	scanf("%d%d%d",&r,&g,&b);
	double rgb = (r*100.0+g*10.0+b)/4.0 ;
	if( rgb - (int)(rgb) == 0 ) printf("YES");
	else printf("NO");
	return 0;
}

Measured memory_bytes: 128
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


N=int(input())
S=0
T=0
for i in range(1,N+1):
    for j in range(i+1,N+1):
        for k in range(j+1,N+1):
            S+=gcd(i,j,k)
for i in range(1,N+1):
    for j in range(i+1,N+1):
            T+=gcd(i,j,j)
            T+=gcd(i,j,j)
print(6*S+3*T+N*(N+1)//2)

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

using namespace std;

int main(){

	vector<int> arr(26,0);
  	string s; cin >> s;
  	for(int i = 0; i < s.size(); ++i) arr[s[i]-'a']++;
  
  	for(int i = 0; i < 26; ++i){
    	if(arr[i]%2==1){
        	cout << "No\n";
          	return 0;
        }
    }
  
  	cout << "Yes\n";
}

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

typedef long long ll;
 
int main(){
  set<int> s;
  int n;
  cin >> n;
  for(int i=0; i<n; i++){
    int a; cin >> a;
    s.insert(a);
  }
  cout << s.size() << endl;
  return 0;
}


Measured memory_bytes: 256
def hit_blow(arr1, arr2)
  n, m = 0, 0
  
  4.times do |i|
    n += 1 if arr1[i] == arr2[i]
    m += 1 if arr1.include?(arr2[i])
  end
  
  return [n, m - n]
end

puts hit_blow($_.split, gets.split).join(" ") while gets

Measured memory_bytes: 6100
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define endl '\n'
typedef vector<vector<ll>> matrix;
const ll INF = 1e18;
const int MAX = 2e5+4;
const int MOD = 1e9+7;
//vector<int> dp(MAX);
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n,l;
	cin >> n >> l;
	vector<int> p(n+1);
	int c=INT_MAX,index=0,res=INT_MAX;
	int x=0,y=0,sum=0;
	for(int i=1;i<=n;i++)
	{
		p[i]=l+i-1;
		sum+=p[i];
	}
	int k=abs(sum)-abs(sum-p[1]);
	res=sum-p[1];
	for(int i=2;i<=n;i++)
	{
		int c=abs(sum)-abs(sum-p[i]);
		if(abs(c)<abs(k))
		{
			res=sum-p[i];
			k=c;
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 256
import math
number = input().split()
value_list= input().split()
cost_list= input().split()

answer = 0

for i, value in enumerate(value_list):
    if int(value) > int(cost_list[i]):
        answer = answer + (int(value)-int(cost_list[i]))
    else:
        answer = answer

print(answer)


Measured memory_bytes: 3060
import itertools
import fractions
def main():
  L = [] * 5
  a = L.append(int(input()))
  b = L.append(int(input()))
  c = L.append(int(input()))
  d = L.append(int(input()))
  e = L.append(int(input()))
  k = int(input())
  ans = 'Yay!'
  for n,m in itertools.combinations(L,2):
    if abs(n-m) <= k:
      pass
    else:
      ans = ':('
      break
  print(ans)

if __name__ == '__main__':
  main()

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

namespace Atcoder
{
    public class Program
    {
        private static long mod = 1000000007;

        static void Main(string[] args)
        {
            var n = Read().Int();
            var cl = new int[n];
            var sl = new int[n];
            var fl = new int[n];
            for (int i = 0; i < n - 1; i++)
            {
                var r = ReadSplit();
                cl[i] = r[0].Int();
                sl[i] = r[1].Int();
                fl[i] = r[2].Int();
            }
            var ansl = new int[n];
            for (int i = 0; i < n - 1; i++)
            {
                var ans = 0;
                ans += sl[i];
                ans += cl[i];
                for (int j = i + 1; j < n - 1; j++)
                {
                    if (i + 1 >= n - 1) break;
                    ans = sl[j] + (int)Math.Ceiling((decimal)(ans - sl[j]) / (decimal)(fl[j])) * fl[j];
                    if (ans <= sl[j])
                    {
                        ans = sl[j];
                    }
                    ans += cl[j];
                }
                ansl[i] = ans;
            }
            for (int i = 0; i < n; i++)
            {
                Write(ansl[i]);
            }
            Read();
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < (int)n; i++)
const int MOD = 1000000007;
// long long a;
int main(){
  int a,b;
  cin >> a>>b;


  if(a == 1) a = 14;
  if(b == 1) b = 14;
  if(a == b) cout << "Draw" << endl;
  else if(a > b) cout << "Alice" << endl;
  else cout << "Bob" << endl;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstring>

int main()
{
  char s[11];
  scanf("%s", s);
  if (*s != 'A' || ('A' <= s[1] && s[1] <= 'Z'))
  {
    puts("WA");
    return 0;
  }
  int len = strlen(s);
  int c = 0;
  for (int i = 2; i <= len - 2; ++i)
  {
    if (s[i] == 'C')
    {
      ++c;
    }
    else if (s[i] >= 'A' && s[i] <= 'Z')
    {
      puts("WA");
      return 0;
    }
  }
  if (c != 1 || ('A' <= s[len - 1] && s[len - 1] <= 'Z'))
  {
    puts("WA");
    return 0;
  }
  puts("AC");
  return 0;
}


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

using namespace std;

#define fst(t) std::get<0>(t)
#define snd(t) std::get<1>(t)
#define thd(t) std::get<2>(t)
#define unless(p) if(!(p))
#define until(p) while(!(p))

using ll = long long;
using P = std::tuple<int,ll>;

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

template <class T>
using priority_queue_with_greater = std::priority_queue<T, std::vector<T>, std::greater<T>>;

vector<P> G[100100];
ll dist[100100];
priority_queue_with_greater<tuple<ll, int> > pq;

template <typename T, typename U, int n>
void dijkstra(T s, std::vector<std::tuple<T, U>> (&graph)[n], U (&dist)[n], priority_queue_with_greater<std::tuple<U, T> > &pq){
    std::fill(dist, dist+n, std::numeric_limits<U>::max() / 2);
    dist[s] = 0;
    pq.emplace(dist[s], s);

    while(!pq.empty()){
        T u;
        U d;
        std::tie(d, u) = pq.top();
        pq.pop();

        if(dist[u] < d){continue;}

        for(const auto& p : graph[u]){
            T v;
            U c;
            std::tie(v, c) = p;
            if(dist[v] > d + c){
                dist[v] = d + c;
                pq.emplace(dist[v], v);
            }
        }
    }
}

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

    int N;
    std::cin >> N;

    for(int i=0;i<N-1;++i){
        int a, b, c;
        std::cin >> a >> b >> c;

        G[a].emplace_back(b, c);
        G[b].emplace_back(a, c);
    }

    int Q, K;
    std::cin >> Q >> K;

    dijkstra(K, G, dist, pq);

    for(int i=0;i<Q;++i){
        int x, y;
        std::cin >> x >> y;

        ll res = dist[x] + dist[y];
        std::cout << res << std::endl;
    }
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007
typedef long long ll;
typedef unsigned long long ull;

int main() {
  string s;
  cin >> s;

  if (s[2] == s[3] && s[4] == s[5]) {
    cout << "Yes";
  } else {
    cout << "No";
  }
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
typedef long long ll;
#include <bits/stdc++.h>

using namespace std;

ll mod = 1000000007;

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

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

template<class Type>
Type gcd(Type x, Type y)
{
	Type r;
	if (x < y)
	{
		swap(x, y);
	}

	while (0 < y)
	{
		r = x % y;
		x = y;
		y = r;
	}
	return x;
}

template<class Type>
bool isPrime(Type x)
{
	if (x == 2) return true;
	if (x < 2 || x % 2 == 0) return false;

	for (Type i = 3; i <= sqrt(x); i += 2)
	{
		if (x % i == 0) return false;
	}
	return true;
}

template<class Type>
vector<bool> eratos(Type n)
{
	vector<bool> isPrime(n + 1, true);
	isPrime[0] = isPrime[1] = false;
	for (Type i = 2; i <= n; i++)
	{
		if (isPrime[i])
		{
			Type j = i + i;
			while (j <= n)
			{
				isPrime[j] = false;
				j = j + i;
			}
		}
	}
	return isPrime;
}

bool binarySearchJudge(vector<int> a, int index, int key)
{
	if (key <= a[index]) return true;
	else return false;
}

int binarySearch(vector<int> a, int key)
{
	int ng = -1;
	int ok = a.size();
	while (1 < abs(ng - ok))
	{
		int mid = (ng + ok) / 2;
		if (binarySearchJudge(a, mid, key)) ok = mid;
		else ng = mid;
	}
	return a[ok] == key;
}

double dist(vector<int> x, vector<int> y, int i, int j)
{
	return sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
}

int main()
{
	int n;
	cin >> n;
	vector<int> x(n);
	vector<int> y(n);
	for (int i = 0; i < n; i++) cin >> x[i] >> y[i];
	vector<int> v(n);
	for (int i = 0; i < n; i++) v[i] = i;

	double sum = 0;
	int cnt = 0;
	do
	{
		for (int i = 0; i < n - 1; i++) sum += dist(x, y, v[i], v[i + 1]);
		cnt++;
	} while (next_permutation(v.begin(), v.end()));

	cout << fixed << setprecision(10) << sum / cnt << endl;
}

Measured memory_bytes: 256