akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> ii;
typedef pair<ii, ll> iii;
typedef vector<ll> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef map<ll, ll> mpii;
typedef unordered_map<ll, ll> umpii;

#define pb(v) push_back(v)
#define all(v) v.begin(), v.end()
#define upb(v, key) (upper_bound(all(v), key) - v.begin())
#define lob(v, key) (lower_bound(all(v), key) - v.begin())

ll inf = 1e9;
ll INF = inf * 1ll * inf;
ll mod = 1e9 + 7;
double eps = 1e-9;
const ld pi = ld(3.1415926535897932384626433832795);
ll dr[] = {-1, 0, 0, 1};
ll dc[] = {0, 1, -1, 0};

template <class TH>
void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; }
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a)
{
  while (*sdbg != ',')
    cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
template <class T>
ostream &operator<<(ostream &os, vector<T> V)
{
  os << "[";
  for (auto vv : V)
    os << vv << ",";
  return os << "]";
}
template <class L, class R>
ostream &operator<<(ostream &os, pair<L, R> P)
{
  return os << "(" << P.st << "," << P.nd << ")";
}
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)

/*...................................................*/
ll dp[3010][3010][2];
ll a[3010];
ll fn(int l, int r, int p)
{
  if(l > r) return 0;
  ll &res = dp[l][r][p];
  if(res != -1) return res;
  res = 0;
  if(p == 0) 
  res = max(fn(l + 1, r, p ^ 1) + a[l], fn(l, r - 1, p ^ 1) + a[r]);
  else 
  res = min(fn(l + 1, r, p ^ 1) - a[l], fn(l, r - 1, p ^ 1) - a[r]);
  return res;
}
main()
{
  int n;
  cin >> n;
  for(int i = 0; i < n; i++)
  cin >> a[i];
  memset(dp, -1, sizeof(dp));
  cout << fn(0, n - 1, 0);
}

Measured memory_bytes: 142080
#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define pii pair<ll,ll>
#define inf 1000000000000000000
#define bpc(x) __builtin_popcountll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 

using namespace std;
mt19937_64 mt(chrono::steady_clock::now().time_since_epoch().count());

int main()
{
  FAST/**/
   
   ll d,t,s;
   cin>>d>>t>>s;
   if(d<=s*t)   
        cout<<"Yes\n";
   else cout<<"No\n";        
   
   return 0;        
}  

  
          
   

Measured memory_bytes: 3564
H,W = map(int,input().split())
S = []
for _ in range(H):
    S.append(input())

ans = []
for i in range(H):
    s = ''
    for j in range(W):
        if S[i][j] == '.':
            count = 0
            for x in [-1,0,1]:
                for y in [-1,0,1]:
                    if 0 <= i+x < H and 0 <= j+y < W:
                        count += 1 if S[i+x][j+y] == '#' else 0
            s += str(count)
        else:
            s += '#'
    ans.append(s)

print(*ans,sep='\n')

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <iostream>

using namespace std;

const double EPS=1e-10;

double solve(int k,double l,double r,double p,double e,double t)
{
	if(k==0) return abs((l+r)/2-t)<e+EPS?1:0;
	if(t-e-EPS<l && r<t+e+EPS) return 1; // [l,r] \subset [t-e,t+e]
	if(r-EPS<t-e || t+e<l+EPS) return 0; // [l,r] \and [t-e,t+e] = \emptyset
	
	double m=(l+r)/2;
	if(m<=t) return (1-p)*solve(k-1,m,r,p,e,t)+p*solve(k-1,l,m,p,e,t);
	else     return (1-p)*solve(k-1,l,m,p,e,t)+p*solve(k-1,m,r,p,e,t);
}

int main()
{
	for(int k,l,r;cin>>k>>l>>r;){
		double p,e,t; cin>>p>>e>>t;
		printf("%.10f\n",solve(k,l,r,p,e,t));
	}
}

Measured memory_bytes: 1240
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
using namespace std;
#define INF 100000000
#define MAXN 110
typedef long long ll;
 
int a[MAXN];
 
int main(void) {
    int n;
    while (cin >> n) a[n]++;
    int ma = 0;
    for (int i = 0; i <= 100; i++) ma = max(ma, a[i]);
    vector<int> ans;
    for (int i = 0; i <= 100; i++) {
        if (a[i] == ma) ans.push_back(i);
    }
    for (int i = 0; i < ans.size(); i++) {
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
#define rep2(i,x,n) for (int i = x; i < n; i++)
using ll = long long int;
int main() {
    string S,T;
    cin >> S >> T;
    int ans=0;
    rep(i,S.size()) if (S.at(i)!=T.at(i)) ans++;
    cout << ans <<endl;
    return 0;
}

Measured memory_bytes: 3928
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ull unsigned long long


using namespace std;


int main()
{
    ios_base::sync_with_stdio(false);	
    cin.tie(NULL); cout.tie(NULL);
    
    ll a, b, c, k; cin >> a >> b >> c >> k;
    ll ans = 0;
    
    while(k && a)
    {
		ans++;
		k--; a--;
	}
	
	while(k && b)
    {
		k--; b--;
	}
	
	while(k && c)
    {
		ans--;
		k--; c--;
	}
	
	cout << ans;
    
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).bigin(), (c).end())

int main()
{
    int n, a[4], s[8][3];
    cin >> n;
    for (int i = 3; i >= 0; i--)
        a[i] = n % 10, n /= 10;

    for (int i = -1; i < 2; i += 2)
        for (int j = -1; j < 2; j += 2)
            for (int k = -1; k < 2; k += 2)
                if (a[0] + a[1] * i + a[2] * j + a[3] * k == 7)
                {
                    cout << a[0] << (i == -1 ? "-" : "+") << a[1] << (j == -1 ? "-" : "+") << a[2] << (k == -1 ? "-" : "+") << a[3] << "=7" << endl;
                    return 0;
                }

    return 0;
}

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

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

  cin >> a >> b >> c;

  // cout << b / a;

  if(c<(b/a))
    cout << c;
  else{
    cout << b / a;

  }
}


Measured memory_bytes: 3592
#include<stdio.h>
#include<stdlib.h>
#include<string.h>

int order=0;
int Ans[100];

int check(int a[]){
	int i=0,j,b[101];
	if(a[1]==0 && a[0]==1){
		Ans[order++]=1;
		return 0;
	}

	while(a[i]!=0){
		if(i+1<a[i]){
			return -1;
		}
		i++;
	}
	i=0;
	while(a[i]!=0){
		if(i+1==a[i]){
			for(j=0;j<i;j++){
				b[j]=a[j];
			}
			for(j=i;j<=100;j++){
				b[j]=a[j+1];
			}

			if(check(b)==0){
				Ans[order++]=a[i];
				return 0;
			}

		}
		i++;
	}
	return -1;
}

int main(){
	int i,k,N;
	scanf("%d",&N);
	int a[101];

	for(i=0;i<N;i++){
		scanf("%d",&a[i]);
	}
	a[N]=0;
	k=check(a);

	if(k==0){
		for(i=0;i<N;i++){
			printf("%d\n",Ans[i]);
		}
	}else{
		printf("-1\n");
	}

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  vector<int> num(3);
  for(int i=0;i<3;i++){
    cin>>num.at(i);
  }
  sort(num.begin(),num.end());
  int count=0;
  if(num.at(0)==num.at(1) && num.at(1)==num.at(2)){
    count =0;
  }
  else if(num.at(0)==num.at(1) && num.at(1) < num.at(2) ){
    while(num.at(1) < num.at(2) ){
      num.at(1) ++;
      count ++;
    }
  }
  else if(num.at(2)==num.at(1) && num.at(0) < num.at(1)){
    if(num.at(2) %2 == num.at(0)%2){
      while(num.at(0) < num.at(2)){
        num.at(0) += 2;
        count ++;
      }
    }
    else{
      while(num.at(0) < num.at(2) ){
        num.at(0) += 2;
        count++;  
      }
      count ++;
    }
    
  }
  else{
    while(num.at(1) < num.at(2)){
      num.at(0)++;
      num.at(1)++;
      count++;
    }
    if(num.at(0) < num.at(1)){
      if(num.at(2) %2 == num.at(0)%2){
        while(num.at(0) < num.at(2)){
          num.at(0) += 2;
          count ++;
        }
      }
      else{
        while(num.at(0) < num.at(2) ){
          num.at(0) += 2;
          count++;  
        }
        count ++;
      }
    }
  }
  cout<<count<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath> 
#include<algorithm>
#include<string>
using namespace std;
string s;
int f[3],ans;
int main()
{
	cin>>s;
	int len=s.size() -1;
	for(int i=0;i<=len;i++)
	{
		if(s[i]=='g')  f[1]++;
		else f[2]++;
	}
	int x=(len+1)/2;
	if(x>=f[1])
	{
	ans+=x-f[1];
	cout<<ans;
	return 0;
	 } 
	else if(x<f[1])
	{
		 ans+=x;
		 int k;
		 f[1]-=k;
		 ans-=f[2];
		 cout<<ans;
		 return 0;
	 }
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ITR(x,c) for(__typeof(c.begin() x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin() x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

#define lf double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

int main(void)
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll x; cin >> x;
	if (x==7||x==5||x==3)
		cout << "YES\n";
	else
		cout << "NO\n";
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val N = nextInt()
    val X = listOfInt()
    val left = X.min()!!
    val right = X.max()!!
    val P = IntArray(right - left + 1)
    for (p in left .. right) {
        var s = 0
        X.forEach {
            val d = it - p
            s += d * d
        }
        P[p - left] = s
    }
    val ans = P.min()!!
    println(ans)
}

fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map(String::toInt)


Measured memory_bytes: 36000
#include <bits/stdc++.h>
using namespace std;
using pii = pair<int,int>;
using pll = pair<long long, long long>;
const long long INF = 1<<29;

const int MOD = 1000000007;
long long ruizyou(long long m,long long n){
  if(m == 0)return 0;
  if(m == 1)return 1;
  long long ans = 1;
  long long tmp = m;
  for(int i=0;i<=30;i++){
    if(n & (1<<i)){
      ans *= tmp;
      ans %= MOD;
    }
    tmp *= tmp;
    tmp %= MOD;
  }
  return ans;
}
long long kaizyou(long long x){
  if(x == 0)return 1;
  return x * kaizyou(x-1) % MOD;
}
long long comb(long long x,long long y){
  long long bunsi = kaizyou(x);
  long long bunbo = kaizyou(x-y) * kaizyou(y) % MOD;
  return bunsi * ruizyou((int)bunbo,MOD-2) % MOD;
}
struct unionfind{
  vector<int> par;
  vector<int> hukasa;
  unionfind(int n){
    par = vector<int>(n);
    hukasa = vector<int>(n,0);
    for(int i=0;i<n;i++){
      par.at(i) = i;
    }
  }
  int root(int x){
    if(par.at(x) == x)return x;
    return root(par.at(x));
  }
  void unite(int x,int y){
    int rx = root(x);
    int ry = root(y);
    if(rx == ry)return;
    if(hukasa.at(rx) >= hukasa.at(ry)){
      par.at(ry) = rx;
      hukasa.at(rx) = max(hukasa.at(ry) + 1,hukasa.at(rx));
    }
    else{
      par.at(rx) = ry;
    }
  }
  bool same(int x,int y){
    return root(x) == root(y);
  }
};
int ctoi(char a){
  return a - '0';
}
long long gcd(long long a,long long b){
  long long c = max(a,b);
  long long d = min(a,b);
  if(d % c == 0)return c;
  return gcd(c,d%c);
}
long long lcm(long long a,long long b){
  return a * b / gcd(a,b);
}
int main(){
  int n,k;
  cin >> n >> k;
  long long ans = 0;
  for(long long i=k;i<=n+1;i++){
    long long a,b;
    a = i*(i-1)/2;
    b = i*(2*n-i+1)/2;
    ans += b-a+1;
    ans %= MOD;
  }
  cout << ans << endl;
}

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

using namespace std;

using ll = long long;

template <typename T>
void printv(const vector<T> &v) {
  int sz = v.size();
  for (int i = 0; i < sz; i++) {
    cout << v[i] << " \n"[i == sz - 1];
  }
}

struct Edge {
  int to;
  ll s;
};

using Graph = vector<vector<Edge>>;
const int MAX_N = 100010;
const ll inf = 1e15;
vector<vector<ll>> dp(MAX_N, vector<ll>(2, inf));
Graph g(MAX_N);
int n, m;
bool f = true;

void rec(int cur, int flag, ll val) {
  if (dp[cur][flag] == inf) {
    dp[cur][flag] = val;
    for (const auto &e : g[cur]) {
      rec(e.to, 1 - flag, e.s - val);
    }
  }
  if (dp[cur][flag] != val) {
    f = false;
    return;
  }
}

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

  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v, s;
    cin >> u >> v >> s;
    u--;
    v--;
    g[u].push_back(Edge{v, s});
    g[v].push_back(Edge{u, s});
  }
  rec(0, 0, 0);
  //for(int i=0;i<n;i++){
  //    cout << "i: " << i+1 << " +a:" << dp[i][0] << " -a: " << dp[i][1] << endl;
  //}
  if (!f) {
    cout << 0 << endl;
    return 0;
  }
  // bipatite
  if (dp[0][1] == inf) {
    ll low = 1, high = inf;
    for (int i = 1; i < n; i++) {
      if (dp[i][0] != inf) {
        low = max(low, -dp[i][0] + 1);
      } else {
        high = min(high, dp[i][1] - 1);
      }
    }
    //cout << "high: " << high << " low: " << low << endl;
    cout << max(0LL, high - low + 1) << endl;
    return 0;
  }
  ll tmp = dp[0][1] - dp[0][0];
  if (tmp % 2) {
    cout << 0 << endl;
    return 0;
  }
  tmp /= 2;
  for (int i = 0; i < n; i++) {
    ll ret1 = tmp + dp[i][0], ret2 = -tmp + dp[i][1];
    if (ret1 <= 0 || ret2 <= 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  cout << 1 << endl;
}


Measured memory_bytes: 23040
local s = io.read()
local n = #s
local t = {}
for i = 1, 26 do
  t[i] = 0
end
do
  local a = s:sub(1, 1):byte() - 96
  t[a] = t[a] + 1
end
local ret = 1
for i = 2, n do
  local a = s:sub(i, i):byte() - 96
  ret = ret + i - 1 - t[a]
  t[a] = t[a] + 1
end
print(ret)


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

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(A: int, B: int, C: int):
    list = [A,B,C]
    if len(set(list)) == 2:
        print(YES)
    else:
        print(NO)

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    C = int(next(tokens))  # type: int
    solve(A, B, C)

if __name__ == '__main__':
    main()


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

int h, n, m;

int main() {
	cin >> h >> n;
	for (int i = 0; i < n; i++) {
		int x;
		cin >> x;
		m += x;
	}
	if(h <= m) return cout << "Yes", 0;
	cout << "No";
	return 0;
}

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


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

    cout << "2018" + s.substr(4, s.size()) << endl;

}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
static const int MAXN = 66;
int vis[MAXN];
int main()
{
    int n , m;
    scanf("%d%d" , &n , &m);
    for(int i = 1 ; i <= m ; ++i)
    {
        int x , y;
        scanf("%d%d" , &x , &y);
        ++vis[x];
        ++vis[y];
    }

    for(int i = 1 ; i <= n ; ++i)
    {
        printf("%d\n" , vis[i]);
    }
}


Measured memory_bytes: 256
import heapq
n,m=map(int,input().split())
work=[[] for _ in range(m)]
for _ in range(n):
    a,b=map(int,input().split())
    if a<=m:
        work[a-1].append(b)
ans=0
q=[]
heapq.heapify(q)
for i in range(m):
    for x in work[i]:
        heapq.heappush(q,-x)
    if q!=[]:
        ans+=heapq.heappop(q)*(-1)
print(ans)


Measured memory_bytes: 18496
/****Author: Barish Namazov****/
#include <bits/stdc++.h>

using namespace std;

/***TEMPLATE***/
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

#define F first
#define S second
#define pb push_back

#define endl '\n'

const int max4 = 10004;
const int maxx = 100005;
const int max6 = 1000006;
const int lg5 = 17;

const int INF = 2 * 1000000007;
const long long INFLL = 4LL * 1000000000 * 1000000000;

/***************/

int powmod (int a, int b, int mod) {
    int res = 1; a %= mod;
    for (; b; b >>= 1) {
        if (b & 1) {
            res = 1LL * res * a % mod;
        }
        a = 1LL * a * a % mod;
    }
    return res;
}

int gcd (int a, int b) {
    while (b > 0) {
        int t = a % b;
        a = b, b = t;
    }
    return a;
}

int lcm (int a, int b) {
    return (a / gcd (a, b)) * b;
}

int is_prime (int n) {
    if (n <= 1 || n > 3 && (n % 2 == 0 || n % 3 == 0))
        return 0;
    for (int i = 5, t = 2; i * i <= n; i += t, t = 6 - t)
        if (n % i == 0)
            return 0;
    return 1;
}

/******Don't forget to use long long when needed!!******/

int main() {
    //freopen("in.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ios_base :: sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int a[3];
    cin >> a[0] >> a[1] >> a[2];
    sort(a, a + 3);
    int d1 = a[1] - a[0], d2 = a[2] - a[1];
    cout << a[2] - a[0] << endl;
    return 0;
}


Measured memory_bytes: 256
from sys import exit

N = int(input())
P = [int(i) for i in input().split()]
p_min = 10 ** 8
count = 0
for i in range(N):
  if P[i] == 1:
    print(count + 1)
    exit()
  elif p_min > P[i]:
    count += 1
    p_min = P[i]
print(count)

Measured memory_bytes: 25768
#include <iostream>

using namespace std;

static const int INFTY = 10000000;

int a[124][124] = {{}};
int n;


int prim(){

  int d[124] = {};
  int p[124] = {};
  int flag[124] = {};
  int min = INFTY;
  int u;
  int sum = 0;

  for(int i = 0;i < n;i++){
    d[i] = INFTY;
    p[i] = -1;
  }

  d[0] = 0;
  while(1){
    u = -1;
    min = INFTY;
    for(int i = 0;i < n;i++){
      if(flag[i] == 0 && d[i] <= min){
        u = i;
        min = d[i];
      }
    }
    //cout << "u = " << u << endl;
    //cout << "min = " << min << endl;

    if(u == -1) break;
    sum += min;
    flag[u] = 1;

    for(int i = 0;i < n;i++){
      if(flag[i] == 0 && a[u][i] != INFTY){
        if(d[i] > a[u][i]){
          d[i] = a[u][i];
          p[i] = u;
        }
      }
    }
  }
  //for(int i = 0;i < n;i++) if(a[p[i]][i] != INFTY)sum += a[p[i]][i];
  return sum;
}

int main(){

  cin >> n;

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

  cout << prim() << endl;
}

Measured memory_bytes: 3092
#include <bits/stdc++.h>
using namespace std;
template<typename T = int> vector<T> create(size_t n){ return vector<T>(n); }
template<typename T, typename... Args> auto create(size_t n, Args... args){ return vector<decltype(create<T>(args...))>(n, create<T>(args...)); }
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	auto g = create<int>(3,3);
	for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++) cin >> g[i][j];
	set<int> seen;
	int n; cin >> n;
	while(n--){
		int x; cin >> x;
		seen.insert(x);
	}
	int mx = 0;
	for(int i = 0; i < 3; i++){
		int sum = 0;
		for(int j = 0; j < 3; j++) sum += seen.count(g[i][j]);
		mx = max(mx, sum);
		sum = 0;
		for(int j = 0; j < 3; j++) sum += seen.count(g[j][i]);
      mx = max(mx, sum);
	}
	mx = max((unsigned long)mx, seen.count(g[0][0]) + seen.count(g[1][1]) + seen.count(g[2][2]));
	mx = max((unsigned long)mx, seen.count(g[0][2]) + seen.count(g[1][1]) + seen.count(g[2][0]));
	if(mx == 3) cout << "Yes\n";
	else cout << "No\n";
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int n;
int prime[50001];
V v;
ll ans[50001];

int main(){
	fill(prime, prime + 50000, 1);
	prime[0] = prime[1] = 0;
	for (int i = 2; i*i <= 50000; i++){
		if (prime[i] == 1){
			for (int j = 2 * i; j <= 50000; j += i){
				prime[j] = 0;
			}
		}
	}
	for (int i = 0; i < 50000; i++){
		if (prime[i] == 1)v.push_back(i);
	}
	REP(i, v.size()){
		FOR(j, i, v.size()){
			if (v[i] + v[j] > 50000)continue;
			ans[v[i] + v[j]]++;
		}
	}
	while (cin >> n&&n){
		cout << ans[n] << endl;
	}
}

Measured memory_bytes: 1900
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define printYes() cout << "Yes" << endl;
#define printNo() cout << "No" << endl;
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int R;
  cin >> R;
  string ans = "AGC";
  if (R < 1200)
    ans = "ABC";
  else if (R < 2800)
    ans = "ARC";
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
using System.Linq;
using System;
class P{
  static void Main(){
    var s=Console.ReadLine().Split().Select(int.Parse).ToArray();
    var x=Enumerable.Repeat(true,s[1]).ToArray();
    for(int i=0;i<s[0];i++){
      var l=Console.ReadLine().Split().Skip(1).Select(int.Parse).ToArray();
      for(int f=1;f<=s[1];f++){
      	x[f-1]=x[f-1]&&l.Contains(f);
      }
    }
    Console.WriteLine(x.Count(y=>y));
  }
}

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

int main (){
    int N = 0;
    cin >> N;
    string A;
    cin >> A;
    int temp = 0;
    int ans = 0;
    int ansans = 0;
    for(int i = 0; i < N; i++)
    {
        
        if (A.at(i) == 'W')
        {
            ansans++;
        }
    }

    for (size_t i = 0; i < N-ansans; i++)
    {
        if (A.at(i) == 'W')
        {
            temp++;
        }
        
    }
    //ans =min(ans,temp);
    

    ans = min(temp,min(ansans,N-ansans));

    cout << ans << endl;


    
}

Measured memory_bytes: 3716
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;

vector<vector<P>> G;
vl color;  // color[i] : 辺iの色

void dfs(ll v, ll p = -1, ll c = -1) {  // cは辺v-pの色
    // 行きの処理はこのへんに書く
    ll num = 1;
    for(auto p1 : G[v]) {
        ll u = p1.first;
        ll e = p1.second;
        if(u == p) {
            continue;
        }
        if(c == num) {
            num++;
        }
        color[e] = num;
        num++;
        dfs(u, v, num-1);
        // 帰りの処理はこのへんに書く
    }
}

int main() {
    ll n;
    cin >> n;    

    G.resize(n);
    rep(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--;  b--;
        G[a].pb(make_pair(b, i));
        G[b].pb(make_pair(a, i));
    }

    ll K = 0;
    rep(i, n) {
        chmax(K, (ll)G[i].size());
    }

    color.resize(n-1);    
    const ll root = 0;
    dfs(root);

    out(K);
    rep(i, n-1) {
        out(color[i]);
    }

    re0;
}

Measured memory_bytes: 9728
N = input()
N_list = list(N)
if N_list[-1] == "2" or N_list[-1] == "4" or N_list[-1] == "5" or N_list[-1] == "7" or N_list[-1] == "9":
    print("hon")
elif N_list[-1] == "0" or N_list[-1] == "1" or N_list[-1] == "6" or N_list[-1] == "8":
    print("pon")
else:
    print("bon")
    

Measured memory_bytes: 61832
a, b = map(int, input().split())

card = [0, 15, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

if card[a] > card[b]:
    print("Alice")
elif card[a] < card[b]:
    print("Bob")
else:
    print("Draw")


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

using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

#define FOR(k,m,n) for(ll (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<< #str << " " str<<endl

constexpr int INF = (1 << 30);
constexpr ll INFL = (1ll << 60);
constexpr ll MOD = 1000000007;// 10^9+7



int main()
{
	ll N;
	cin >> N;
	vector<ll> a(N);
	REP(i, N)cin >> a[i];

	priority_queue<pll, vector<pll>, greater<pll>> pq;
	REP(i, N)pq.push({ a[i],i });

	ll res = 0;
	set<ll>st;
	st.insert(-1);
	st.insert(N);
	while (!pq.empty()) {
		auto p = pq.top(); pq.pop();
		ll times = p.first;
		ll now = p.second;

		auto itr = st.lower_bound(now);
		ll aft = *itr - now;
		--itr;
		ll bef = now - *itr;

		res += bef * aft*times;
		st.insert(now);
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 15212
h, w = map(int, input().split())
tizu = [input() for _ in range(h)]
check = [[False for _ in range(w)] for _ in range(h)]
ans = [[1 for _ in range(w)] for _ in range(h)]

for i in range(h):
    for j in range(w):
        if check[i][j]:
            continue
        if tizu[i][j] == "#":
            continue
        pos = [i]
        cnt = 0
        for k in range(i + 1, h):
            if tizu[k][j] == "#":
                break
            pos.append(k)
            cnt += 1
        for k in range(i - 1, -1, -1):
            if tizu[k][j] == "#":
                break
            pos.append(k)
            cnt += 1
        for l in pos:
            ans[l][j] += cnt
            check[l][j] = True

check = [[False for _ in range(w)] for _ in range(h)]
max_ans = 0
for i in range(h):
    for j in range(w):
        if check[i][j]:
            continue
        if tizu[i][j] == "#":
            continue
        pos = [j]
        cnt = 0
        for k in range(j + 1, w):
            if tizu[i][k] == "#":
                break
            pos.append(k)
            cnt += 1
        for k in range(j - 1, -1, -1):
            if tizu[i][k] == "#":
                break
            pos.append(k)
            cnt += 1
        for l in pos:
            ans[i][l] += cnt
            check[i][l] = True
            max_ans = max(max_ans, ans[i][l])
print(max_ans)

Measured memory_bytes: 178844
a,b,c,x,y = map(int, input().split()) 

if a + b <= 2*c:
    print(a*x+b*y)
else:
    ab_cnt = min(x,y)
    remain_a = x-ab_cnt
    remain_b = y-ab_cnt


    if remain_a > 0 and a > 2*c:
        print(ab_cnt*2*c + remain_a*2*c)
    elif remain_b > 0 and b > 2*c:
        print(ab_cnt*2*c + remain_b*2*c)
    else:
        print(ab_cnt*2*c + remain_a*a + remain_b*b)

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	a := len(s) - 1
	z := 0
	for i, v := range s {
		if v == 'A' {
			if i < a {
				a = i
			}
		}
		if v == 'Z' {
			z = i
		}
	}
	fmt.Println(z - a + 1)
}


Measured memory_bytes: 1920
c = str(input())
A = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
xx = 0
for i in A:
  xx = xx + 1
  
  if i == c:
    print(A[xx])


Measured memory_bytes: 2940
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import sys
import re
import math
import collections
import itertools
import functools

DEBUG = True
DEBUG = False

def dbg(*args):
    if DEBUG:
        print("DBG: ", file=sys.stderr, end="")
        print(*args, file=sys.stderr)



def main():
    s = input();
    yes = len(set(s)) == len(s)
    print("yes" if yes else "no")

if __name__ == "__main__": main()


Measured memory_bytes: 3956
#include<stdio.h>
int main()
{
    int n,m,i,p,sum=0;
    scanf("%d",&n);
    m=n;
    for(i=0; m!=0; i++)
    {
        p=m%10;
        sum+=p;
        m=(m-p)/10;
    }
    if(n%sum==0)
        printf("Yes\n");
    else
        printf("No\n");
    return 0;



}


Measured memory_bytes: 128
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
using namespace std;

#define MAX(a,b) ((a)>(b)?(a):(b))
#define MIN(a,b) ((a)<(b)?(a):(b))
#define ABS(a) ((a)>(0)?(a):-(a))
#define rep(i,a,b) for(int (i)=int(a);(i)<int(b);(i)++)
#define rrep(i,a,b) for(int (i)=int(a);(i)>=int(b);(i)--)

#define put(a) cout << (a) << endl
#define puts(a) cout << (a) << " "

#define llint long long int

#define INF (long long)1e9+1
#define MOD (long long)1e9+7
#define INF64 (long long)1e18+1

#define F first
#define S second

#define Pii  pair<int,int>
#define Pll  pair<long long,long long>
#define Piii pair<int,pair<int,int>>
#define Plll pair<long long,pair<long long,long long>>

#define Vll(a,b,c)    vector<vector<long long>> (a)((b),vector<long long>((c))
#define Vlll(a,b,c,d) vector<vector<vector<long long>>> (a)((b),vector<vector<long long>>((c),vector<long long>((d)))

#define MAX_N 1000000

int main (void)
{
  llint N,M,L,A,B,C;
  llint K[MAX_N];
  llint ans;
  bool bool_ans;

  cin >> A;
  cin >> B;
  cin >> C;

  N = A-B;
  if (N >= C ) {
    M = 0;
  } else {
    M = C -N;
  }
  cout << M << endl;

  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

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

		for (int i = 0; i < 3; i++) {
			ar[i] = sc.nextInt();
		}

		for (int j = 0; j < 2; j++) {
			for (int i = 0; i < 2; i++) {
				if (ar[i] > ar[i + 1]) {
					int temp = ar[i];
					ar[i] = ar[i + 1];
					ar[i + 1] = temp;
				}
			}
		}

		System.out.println(ar[0] + " " + ar[1] + " " + ar[2]);

	}
}



Measured memory_bytes: 26240
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <cmath>
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;

int main(){
  int N;
  int AN = 0,WN = 0,TN = 0,RN = 0;
  cin >> N;
  string ch;
  for(int i = 0;i < N;i++){
    cin >> ch;
    if(ch == "AC"){
      AN++;
    }else if(ch == "WA"){
      WN++;
    }else if(ch == "TLE"){
      TN++;
    }else if(ch == "RE"){
      RN++;
    }
  }
  cout << "AC x " << AN << endl;
  cout << "WA x " << WN << endl;
  cout << "TLE x " << TN << endl;
  cout << "RE x " << RN << endl;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define ll long long
#define INF 0x3f3f3f3f
using namespace std;
const ll maxn = 1e3 + 5;
ll n,m,ans1,ans2,temp;
string book[1000000],temp2;
ll book2[1000000];
int main()
{
    cin >> n >> m;
    for(int i = 0; i < m; i++)
    {
        cin >> temp >> temp2;
        if(book[temp] == "WA")
        {
            if(temp2 == "AC")
            {
                ans2++;
                ans1 += book2[temp];
                book[temp] = "AC";
            }
            else
                book2[temp]++;
        }
        else if(book[temp] != "AC")
        {
            if(temp2 == "AC")
            {
                ans2++;
                book[temp] = "AC";
            }
            else
            {
                book2[temp]++;
                book[temp] = "WA";
            }
        }
    }
    cout << ans2 << " " << ans1 << endl;
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll , ll> PLL;
typedef long double ld;

#define pb push_back
#define all(c) c.begin(),c.end()
#define allr(c) c.rbegin(),c.rend()
#define MOD 1000000007
#define PI 3.14159265
#define endl '\n'

#define MAX 100001

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

    int x1 , x2 , y1 , y2;
    cin >> x1 >> y1 >> x2 >> y2;
    int lx = (x1 - x2) , ly = (y1 - y2);
    cout << x2 + ly << " " << y2 - lx << " " << x1 + ly << " " << y1 - lx << endl;


    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<string> VS;
typedef vector< vector<int> > VVI;
typedef vector< vector<ll> > VVL;
typedef pair<int,int> PII;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
#define ub upper_bound
#define lb lower_bound

int main(){
  double L;
  cin>>L;
  double X=L/3;
  cout<<setprecision(10);
  cout<<X*X*X<<endl;
}

Measured memory_bytes: 256
n,k = map(int, input().split())
p = [int(x) for x in input().split()]

li = []
count=0
ans = 0

for i in range(len(p)):
    p[i] += 1
    li.append(p[i])
    if len(li) < k:
        continue
    elif len(li) == k:
        max = sum(li)
        buf = max
    elif len(li) > k:
        tmp = buf - li[count] + li[-1]
        buf = tmp
        if tmp >= max:
            max = tmp
        count+=1

print(max/2)


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

int main() {
	int n;
	cin >> n;
	int a[] = { 11,31,41,61,71,101,131,151, 181, 191 ,211, 241, 251, 271,281, 311, 331, 401, 421 ,431, 461, 491,  521,541,571, 601 , 631, 641 , 661, 691 ,701 , 751, 761, 811, 821, 881 ,911 , 941,  971 , 991, 1021, 1031 ,1051 ,1061 , 1091, 1151, 1171, 1181 , 1201, 1231, 1291, 1301 ,1321, 1361 ,1381 , 1451, 1471 ,1481 , 1511 };
	for (int i = 0;i < n;i++) {
		cout << a[i] << " ";
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ot(x) cout<<x<<" ";
#define out(x) cout<<x<<"\n";
#define pb push_back
#define in insert
#define ll long long int
#define ld long double
#define ull unsigned long long int
#define YES cout<<"YES\n";
#define NO cout<<"NO\n";
#define yes cout<<"yes\n";
#define no cout<<"no\n";
#define Yes cout<<"Yes\n";
#define No cout<<"No\n";
#define fa(i,a) for(auto i:a)
#define f(i,x,a) for(i=x;i<a;i++)
#define next cout<<"\n";
#define sp(n) cout<<fixed<<setprecision(n);
#define  gcd(a,b)    __gcd(a,b)
#define bs  binary_search
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define test int t;cin>>t;while(t-->0)
#define mod 1000000007




int main()
{
   fast
   string s;cin>>s;
   if(s=="SRR"){
       out(2)
   }
    if(s=="RRS"){
       out(2)
   }
    if(s=="SRS"){
       out(1)
   }
    if(s=="RSR"){
       out(1)
   }
    if(s=="SSS"){
       out(0)
   }
    if(s=="RRR"){
       out(3)
   }
    if(s=="SSR"){
       out(1)
   }
    if(s=="RSS"){
       out(1)
   }
  return 0;
}

                                                                     

Measured memory_bytes: 3652
#include <iostream>
#include <string>
#include <vector>
#include <numeric>
#include <queue>
#include <unordered_map>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <sstream>
#include <stack>
#include <map>
#include <set>
#include <ios>
#include <cctype>
#include <cstdio>
#include <functional>
#include <cassert>
#include <fstream>
#include <ctime>

using namespace std;
using ll = long long;

#define REP(i, a) for (int i = 0; i < (a); ++i)
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORR(i, a, b) for (int i = (a)-1; i >= (b); --i)
#define ALL(obj) (obj).begin(), (obj).end()
#define SIZE(obj) (int)(obj).sizeT()
#define YESNO(cond, yes, no) \
    { cout << ((cond) ? (yes) : (no)) << endl; }
#define SORT(list) sort(ALL((list)));
#define RSORT(list) sort((list).rbegin(), (list).rend())
#define ASSERT(cond, mes) assert(cond&& mes)

constexpr int MOD = 1'000'000'007;
constexpr int INF = 1'050'000'000;

template <typename T>
T round_up(const T& a, const T& b) {
    return (a + (b - 1)) / b;
}

template <typename T1, typename T2>
istream& operator>>(istream& is, pair<T1, T2>& p) {
    is >> p.first >> p.second;
    return is;
}

template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2>& p) {
    os << p.first << p.second;
    return os;
}

template <typename T>
istream& operator>>(istream& is, vector<T>& v) {
    REP(i, (int)v.size())
    is >> v[i];
    return is;
}

template <typename T>
T clamp(T& n, T a, T b) {
    if (n < a)
        n = a;
    if (n > b)
        n = b;
    return n;
}

template <typename T>
static T GCD(T u, T v) {
    T r;
    while (v != 0) {
        r = u % v;
        u = v;
        v = r;
    }
    return u;
}

template <typename T>
static T LCM(T u, T v) {
    return u / GCD(u, v) * v;
}

std::vector<int> enum_div(int n) {
    std::vector<int> ret;
    for (int i = 1; i * i <= n; ++i) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i != 1 && i * i != n) {
                ret.push_back(n / i);
            }
        }
    }
    return ret;
}

template <typename T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

template <typename T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

struct ToUpper {
    char operator()(char c) { return toupper(c); }
};

struct ToLower {
    char operator()(char c) { return tolower(c); }
};

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    string S;
    cin >> S;
    string T = S;
    reverse(T.begin(), T.end());

    int ans = 0;
    REP(i, S.length()) {
        if (S[i] != T[i])
            ans++;
    }

    cout << round_up(ans, 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
using namespace std;
 
int main()
{
  int n,m;
  cin>>n>>m;
  if(n==m)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <array>
int main(){
    using namespace std;
    array<int, 26> ary{};
    //int ary[26] = {};
    string str;
    while(getline(cin,str)){//control+dで抜けれる
    for(int i{0}; i<str.size(); i++){
        if(str[i]>='a'&&str[i]<='z') {ary[ str[i] - 'a' ]++;}
        else if(str[i]>='A'&&str[i]<='Z') {ary[ str[i] - 'A' ]++;}
    }}
    for(int i{0}; i<26; i++){
        //printf("%c : %d\n", 'a'+i, ary[i]);
        cout << (char)('a'+i) << " : " << ary[i] << endl;
    }
}


Measured memory_bytes: 3104
P, Q, R = [int(x) for x in input().split()]

l = [P, Q, R]
res_l = []
for (i_index, i) in enumerate(l):
    for (j_index, j) in enumerate(l):
        if i_index != j_index:
            res_l.append(i+j)

print(min(res_l))


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

int main(){
  int a, b;
  cin >> a >> b;
  if (a == 1 && b == 1) cout << "Draw" << endl;
  else if (a == 1) cout << "Alice" << endl;
  else if (b == 1) cout << "Bob" << endl;
  else if (a == b) cout << "Draw" << endl;
  else if (a > b) cout << "Alice" << endl;
  else if (a < b) cout << "Bob" << endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main() {
    int a[5], k;
    for (int i=0; i<5; i++) {
        cin >> a[i];
    }
    cin >> k;
    if (a[4]-a[0] > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
using namespace std;
int main (){
	
	long long n , maxx=0;
	cin >> n;
	for(long long i=1 ; i<=n ; i++){
		if(i*i<=n)maxx=max(i*i , maxx);
	}
	cout << maxx;
	
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
using namespace std;
int main()
{
          long long int a,b;
          cin>>a>>b;
          if((a==1 && b==2)||(a==2 && b==1))
          {
                 cout<<"3"<<endl;
          }
          else if((a==2 && b==3)||(a==3 && b==2))
          {
                    cout<<"1"<<endl;
          }
          else
                    cout<<"2"<<endl;
return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    s64 x, y;
    s64 zmax, zmin, wmax, wmin;
    zmax = wmax = -1e18;
    zmin = 1e18, wmin = 1e18;
    rep (i, n)
    {
        cin >> x >> y;
        zmax = max(zmax, x + y);
        zmin = min(zmin, x + y);
        wmax = max(wmax, x - y);
        wmin = min(wmin, x - y);
    }

    s64 ans = max(zmax - zmin, wmax - wmin);
    cout << ans << "\n";

    return 0;
}



Measured memory_bytes: 3624
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
	
using namespace std;
typedef pair<int,int> P;
const int MAX_N=2e5;
int N,p[MAX_N+1],N2;
P ma[MAX_N<<2],mi[MAX_N<<2];
bool laz[MAX_N<<2];
int ans[MAX_N];
P query(int l,int r,int f,int k=0,int a=0,int b=N2){
	if (r<=a || b<=l){
		return P(0,N);
	}
	if (laz[k]){
		laz[k]=false;
		if (b-a==1){
			ma[k].first*=-1;
			mi[k].first*=-1;
		}else{
			laz[k*2+1]^=true;
			laz[k*2+2]^=true;
			swap(ma[k],mi[k]);
			ma[k].first*=-1;
			mi[k].first*=-1;
		}
	}
	if (l<=a && b<=r){
		if (f==0){
			return ma[k];
		}else{
			return mi[k];
		}
	}
	P ln=query(l,r,f,k*2+1,a,(a+b)/2),rn=query(l,r,f,k*2+2,(a+b)/2,b);
	P ret;
	if (f==0){
		ret=max(ln,rn);
	}else{
		ret=min(ln,rn);
	}
	return ret;
}
void mul(int l,int r,int k=0,int a=0,int b=N2){
	if (r<=a || b<=l){
		return;
	}
	if (l<=a && b<=r){
		laz[k]^=true;
		return;
	}
	mul(l,r,k*2+1,a,(a+b)/2);
	mul(l,r,k*2+2,(a+b)/2,b);
	query(a,(a+b)/2,0,k*2+1,a,(a+b)/2);
	query((a+b)/2,b,1,k*2+2,(a+b)/2,b);
	ma[k]=max(ma[k*2+1],ma[k*2+2]);
	mi[k]=min(mi[k*2+1],mi[k*2+2]);
}
void update(int inx,int k=0,int a=0,int b=N2){
	if (inx<a || b<=inx){
		return;
	}
	if (laz[k]){
		laz[k]=false;
		if (b-a==1){
			ma[k].first*=-1;
			mi[k].first*=-1;
		}else{
			laz[k*2+1]^=true;
			laz[k*2+2]^=true;
			swap(ma[k],mi[k]);
			ma[k].first*=-1;
			mi[k].first*=-1;
		}
	}
	if (a+1==b){
		ma[k]=mi[k]=P(0,N);
	}else{
		update(inx,k*2+1,a,(a+b)/2);
		update(inx,k*2+2,(a+b)/2,b);
		query(a,(a+b)/2,0,k*2+1,a,(a+b)/2);
		query((a+b)/2,b,1,k*2+2,(a+b)/2,b);
		ma[k]=max(ma[k*2+1],ma[k*2+2]);
		mi[k]=min(mi[k*2+1],mi[k*2+2]);
	}		
}
int bit[MAX_N+1];
void add(int x){
	while(x<=N){
		bit[x]++;
		x+=x&(-x);
	}
}
int smq(int x){
	int ret=0;
	while(x){
		ret+=bit[x];
		x-=x&(-x);
	}
	return ret;
}
int main(){
	cin>>N;
	REP(i,N){
		cin>>p[i];
		p[i]=N+1-p[i];
	}
	p[N]=0;
	N2=1;
	while(N2<N){
		N2<<=1;
	}
	REP(i,N2){
		if (i<N){
			ma[N2+i-1]=mi[N2+i-1]=P(p[i],i);
			if (i%2){
				ma[N2+i-1].first*=-1;
				mi[N2+i-1].first*=-1;
			}
		}else{
			ma[N2+i-1]=mi[N2+i-1]=P(0,N);
		}
	}
	REP(i,N2-1){
		int inx=N2-i-2;
		int l=inx*2+1,r=inx*2+2;
		ma[inx]=max(ma[l],ma[r]);
		mi[inx]=min(mi[l],mi[r]);
	}
	REP(i,N>>1){
		P p1=query(0,N2,0);
		ans[i*2]=N+1-p[p1.second];
		int lb=p1.second+1,ub=N+1;
		int sm1=smq(lb);
		while(ub-lb>1){
			int mid=(lb+ub)>>1;
			int sm=smq(mid);
			if (sm==sm1){
				lb=mid;
			}else{
				ub=mid;
			}
		}
		P p2=query(p1.second,lb,1);
		ans[i*2+1]=N+1-p[p2.second];
		mul(p1.second,p2.second);

		update(p1.second);
		update(p2.second);
		add(p1.second+1);
		add(p2.second+1);
	}
	REP(i,N){
		if (i){
			cout<<" ";
		}
		cout<<ans[i];
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 16512
/**
 *    author:  FromDihPout
 *    created: 2020-08-12
**/

#include <bits/stdc++.h>
using namespace std;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vector<int> c(n-1), s(n-1), f(n-1);
    for (int i = 0; i < n - 1; i++) {
        cin >> c[i] >> s[i] >> f[i];
    }
    
    for (int i = 0; i < n; i++) {
        int t = 0;
        for (int j = i; j < n - 1; j++) {
            t = max(t, s[j]);
            int next = (t / f[j]) + (t % f[j] != 0);
            t = next * f[j];
            t += c[j];
        }
        
        cout << t << '\n';
    }
    return 0;
}

Measured memory_bytes: 3584
import math

N ,K = map(int, input().split())

ans = 0

for n in range(1,N+1):
    cnt = 0
    while True:
        if n * (2 ** cnt) >= K:
            break
        else:
            cnt += 1
    ans += (1 / N) / (2**cnt)
print(ans)

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
    int r;
    int D;
    int x0;
    vector<int> x(11);
    cin >> r >> D >> x0;
    x[0] = x0;
    for(int i=1; i<11; i++){
        x[i] = r*x[i-1] - D;
        cout << x[i] << endl;
    }
}


Measured memory_bytes: 256
using System;

public class Program
{
	public static void Main()
	{
		string str = Console.ReadLine();
		bool N = false;
		bool W = false;
		bool S = false;
		bool E = false;
		for (int i = 0; i < str.Length; i++)
		{
			switch (str[i])
			{
				case 'N':
				N = true;
				break;
				case 'W':
				W = true;
				break;
				case 'S':
				S = true;
				break;
				case 'E':
				E = true;
				break;
			}
		}
		if ((N ^ S) || (W ^ E))
		{
			Console.WriteLine("No");
		}
		else
		{
			Console.WriteLine("Yes");
		}
	}
}

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

int main(){
 int n;
 cin >> n;
 string s;
 cin >> s;
  int ans = 0;
  int maxans = 0;
  for(int i = 0; i < n; i++){
    if(s[i] == 'I') ans ++;
    else ans--;
    maxans = max(ans,maxans);
  }
  cout << maxans;
  return 0;
}

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

int main(){
  long long A,B,M,res,price,a_min;
  cin >> A >> B >> M;
  long long a[A],b[B],x,y,c;
  res = 1000000;
  a_min=100000;
  for(long long i=0;i<A;i++){
    cin >> a[i];
    a_min = min(a_min,a[i]);
  }
  for(long long i=0;i<B;i++){
    cin >> b[i];
    price = a_min + b[i];
    res = min(res,price);
  }
  for(long long i=0;i<M;i++){
    cin >> x >> y >> c;
    price = a[x-1]+b[y-1]-c;
    res = min(res,price);
                     
  }
  cout << res << endl;
  return 0;
}

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

namespace lean
{
    class Program
    {
        static void Main()
        {
            int X = int.Parse(Console.ReadLine());
            int count = 0;
            if (X != 0)
            {
                count = (X / 500)*1000;
                X = X % 500;
                if (X != 0)
                {
                    count = count+(X / 5)*5;
                    X = X % 5;
                }
            }
            Console.WriteLine(count);
        }
    }
}


Measured memory_bytes: 11092