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

int	main()
{
	int64_t	a, b, c;
	cin >> a >> b >> c;
	long double	lhs = a * b;
	long double rhs = static_cast<long double>((c - a - b) * (c - a - b)) / 4;
	if (a + b >= c) 
		cout << "No" << endl;
	else if (lhs < rhs)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll MOD=1000000007;
const double PI=3.14159265358979;
const ll INF= pow(10,18);
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};

int main() {
  vl cnt(26,INF);
  ll n;
  cin >> n;
  rep(i,n){
    string s;
    cin >> s;
    rep(i,26){
      ll x=0;
      rep(j,s.size()){
        if(abc[i]==s[j]){
          x++;
        }
      }
      cnt[i]=min(cnt[i],x);
    }
  }
  string t="";
  rep(i,26){
    rep(j,cnt[i]){
      t+=abc[i];
    }
  }
  cout << t << endl;
}

Measured memory_bytes: 256
//#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue>
#include<map>
#include<string>
#include<stack>
#define fi first
#define se second
#define INF 0x3f3f3f3f
#define fio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define pqueue priority_queue
#define NEW(a,b) memset(a,b,sizeof(a))
const double pi=4.0*atan(1.0);
const double e=exp(1.0);
const int maxn=1e5+8;
typedef long long LL;
typedef unsigned long long ULL;
const LL mod=1e9+7;
const ULL base=1e7+7;
using namespace std;
int a[maxn];
LL C[2008][2008];
int main(){
    LL n,k;
    cin>>n>>k;
    LL g=n-k;
    C[0][0]=1;
    for(int i=1;i<=n;i++){
        C[i][0]=1;
        for(int j=1;j<i;j++){
            C[i][j]=C[i-1][j-1]+C[i-1][j];
            C[i][j]%=mod;
        }
        C[i][i]=1;
    }
    LL ans;
    for(int i=1;i<=k;i++){
        if(g+1<i){
            printf("0\n");
        }
        else{
            ans=C[g+1][i]*C[k-1][i-1];
            ans%=mod;
            printf("%lld\n",ans);
        }
    }
}


Measured memory_bytes: 30208
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define pb push_back
#define int long long
using namespace std;
typedef pair<int,int> p;
typedef long long ll;

signed main(){
	int n,m;
	cin>>n>>m;
	int ans=0;
	if(2*n<m){
		ans=n;
		m-=2*n;
		ans+=m/4;
	}else{
		ans=m/2;
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
//q3.cpp

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>

typedef long long ll;

using namespace std;

int h,w,ans[1010][1010];
char cloud[1010][1010];

int main(){
    
    scanf("%d%d",&h,&w);
    
    for(int i=0;i<100;i++)
        for(int j=0;j<100;j++)
            ans[i][j]=-1;
    
    for(int i=0;i<h;i++)
        scanf("%s",cloud[i]);
    
    for(int i=0;i<w;i++)
        for(int j=0;j<h;j++)
            for(int k=i;k<w;k++){
                if(cloud[j][k-i]=='c' && ans[j][k]<0)
                    ans[j][k]=i;
            }
    
    for(int i=0;i<h;i++)
        for(int j=0;j<w;j++)
            printf(j<w-1 ? "%d ":"%d\n",ans[i][j]);
    
    return 0;
}

Measured memory_bytes: 1684
from heapq import heappush,heappop

def resolve():
    n, q = map(int, input().split())

    hen = []
    for _ in range(n-1):
        a,b = map(int, input().split())
        heappush(hen,(a,b))

    ns = [0 for _ in range(n+1)]
    for _ in range(q):
        p, x = map(int, input().split())
        ns[p] += x

    # 操作はまとめられる。頂点nに対してpの和
    # 親から累積させながら末端へ下ろしていく

    while len(hen) > 0:
        a, b = heappop(hen)
        ns[b] += ns[a]

    print(*ns[1:n+1])
resolve()

Measured memory_bytes: 100644
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second

using pi = pair<int,int>;

const int N=303;
const int mod=1e9+7;

int n,m;
vector<pi> c[N];
int dp[N][N][N]={};

int main()
{
    cin >>n >>m;
    rep(i,m)
    {
        int l,r,x;
        cin >>l >>r >>x;
        c[r].pb(pi(l,x));
    }

    dp[1][0][0]=1;
    dp[0][1][0]=1;
    dp[0][0][1]=1;
    rep(i,n+1)
    {
        rep(j,i)rep(k,i)
        {
            bool ok = true;
            for(const auto &p:c[i])
            {
                int l=p.fi;
                int x=p.se;

                int ct=1;
                ct += (l<=j);
                ct += (l<=k);

                if(ct!=x) ok = false;
            }

            if(!ok)
            {
                dp[i][j][k] = 0;
                dp[j][i][k] = 0;
                dp[j][k][i] = 0;
                continue;
            }

            (dp[i+1][j][k]+=dp[i][j][k])%=mod;
            (dp[i][i+1][k]+=dp[i][j][k])%=mod;
            (dp[i][j][i+1]+=dp[i][j][k])%=mod;

            (dp[i+1][i][k]+=dp[j][i][k])%=mod;
            (dp[j][i+1][k]+=dp[j][i][k])%=mod;
            (dp[j][i][i+1]+=dp[j][i][k])%=mod;

            (dp[i+1][k][i]+=dp[j][k][i])%=mod;
            (dp[j][i+1][i]+=dp[j][k][i])%=mod;
            (dp[j][k][i+1]+=dp[j][k][i])%=mod;
        }
    }

    int ans=0;
    rep(i,n)rep(j,n)
    {
        (ans+=dp[n][i][j])%=mod;
        (ans+=dp[i][n][j])%=mod;
        (ans+=dp[i][j][n])%=mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 108800
#include <iostream>
#include <vector>

using namespace std;

int main(){
  int width, height, n;

  cin >> width >> height >> n;
  vector<int> x, y, patern;
  for(int i=0; i<n ;i++){
    int x_temp, y_temp, a_temp;
    cin >> x_temp >> y_temp >> a_temp;
    x.push_back(x_temp);
    y.push_back(y_temp);
    patern.push_back(a_temp);
  }

  vector< vector<int> > backet(height, vector<int>(width, 0));
  int start = 0;
  int end = 0;
  for(int i=0; i<n; i++){
    if(patern.at(i) == 1){
      start = 0;
      end = x.at(i);
    }else if(patern.at(i) == 2){
      start = x.at(i);
      end = width;
    }else if(patern.at(i) == 3){
      start = 0;
      end = y.at(i);
    }else if(patern.at(i) == 4){
      start = y.at(i);
      end = height;
    }

    if(patern.at(i) == 1 || patern.at(i) == 2){
      // cout << "x " << start << "  " << end << endl;
      for(int j=0; j<height; j++){
        for(int s=start; s<end; s++){
          backet[j][s] = 1;
        }
      }

    }else if(patern.at(i) == 3 || patern.at(i) == 4){
      // cout << "y " << start << "  " << end << endl;
      for(int j=start; j<end; j++){
        for(int s=0; s<width; s++){
          backet[j][s] = 1;
        }
      }
    }
  }

  int ans = 0;
  for(int i=0; i<height; i++){
    for(int j=0; j<width; j++){
      ans += backet[i][j];
      // cout << backet[i][j] << " ";
    }
  }

  cout << height*width-ans;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;

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

    set<int> s[26];  // 0:a, 1:b, 2:c, ..., 25:z
    REP(i, N) { s[(int)(S[i] - 'a')].insert(i); }

    vector<int> ans;
    for (int i = 0; i < Q; i++) {
        int q;
        cin >> q;
        if (q == 1) {
            int i;
            char c;
            cin >> i >> c;
            i--;
            s[(int)(S[i] - 'a')].erase(i);
            s[(int)(c - 'a')].insert(i);
            S[i] = c;
        } else if (q == 2) {
            int l, r;
            cin >> l >> r;
            l--, r--;
            int sum = 0;
            REP(i, 26) {
                auto it = s[i].lower_bound(l);
                if (it != s[i].end()) {
                    if (*it <= r) {
                        sum++;
                    }
                }
            }

            ans.push_back(sum);
        }
    }

    for (auto i : ans) {
        cout << i << endl;
    }

    return 0;
}


Measured memory_bytes: 24452
x1, y1, x2, y2 = list(map(int, input().split(" ")))

a = x2-x1
b = y2-y1

x3 = x2-b
y3 = y2+a
x4 = x3-a
y4 = y3-b

print(x3, y3, x4, y4)



Measured memory_bytes: 2940
using System;

namespace aoj6
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] str = (Console.ReadLine()).Split(' ');

            for(int i = 1; i <= n; i++)
            {
                Console.Write(str[n-i]);
                if( i == n)
                {
                    Console.Write("\n");
                }
                else
                {
                    Console.Write(" ");
                }
            }
        }
    }
}

Measured memory_bytes: 8804
package main

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

var sc = bufio.NewScanner(os.Stdin)

func read() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)
	N, _ := strconv.Atoi(read())
	isSwapped := false
	swpAt := 0
	ans := "YES"
	for i := 1; i <= N; i++ {
		p, _ := strconv.Atoi(read())
		if i != p {
			if isSwapped {
				if p == swpAt {
					ans = "YES"
				}
				break
			} else {
				swpAt = i
				isSwapped = true
				ans = "NO"
			}
		}
	}
	fmt.Printf("%s\n", ans)
}


Measured memory_bytes: 640
N = int(input())
A = [0] + [int(input()) for i in range(N)]
if A[1] != 0:
  print(-1)
  quit()

ans = 0
for i, a in enumerate(A[1:], 1):
  pre_a = A[i-1]
  if a - pre_a >= 2:
    print(-1)
    quit()
  elif a > pre_a:
    ans += 1
  else:
    ans += a

print(ans)

Measured memory_bytes: 12688
# Fall 7, Stand 8...
# !/ankit_SM/bin/env python
from __future__ import division, print_function
import os;
import sys;
from io import BytesIO, IOBase
import math
if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    n=str(input())
    if(n[-1] in ["2","4","5","7","9"]):
        print("hon")
    elif(n[-1] in ["0","1","6","8"]):
        print("pon")
    else:
        print("bon")





# region fastio
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd,
                        max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(
                b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd,
                        max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(
                b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")


def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()


if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(
        sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
    main()

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

using namespace std;
typedef long long ll;

int main(){
  ll N;
  cin >> N;
  vector<ll> X(N,0);
  for(ll i=0; i<N; i++) cin >> X[i];
  
  ll ret = 1e9;
  for(ll i=1; i<=100; i++){
    ll sum = 0;
    for(ll j=0; j<N; j++){
      sum += (X[j]-i) * (X[j] - i);
    }
    ret = min(ret, sum);
  }
  
  cout << ret << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, d1, d2, d3, d4;
  cin >> a;

  d1 = a % 10;
  d2 = a % 100 / 10;
  d3 = a % 1000 / 100;
  d4 = a / 1000;
  if (d1 == d2 && d1 == d3 || d2 == d3 && d2 == d4) {
      cout << "Yes" << endl;
  } else {
      cout << "No" << endl;
  }
}

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

#define ll long long

int main()
{
    int x, ans = 1;
    cin >> x;
    
    for (int i =  2; i*i <= x; i++) {
        int value = i*i;
        while (value <= x) {
            //cout << value << endl;
            ans = max(ans, value);
            value = value * i;
        }
        
        
    }
    cout << ans << endl;
    
    
    
    return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int s;
long long x,y,t=0,i=1;
int main()
{
	cin>>x>>y;
	t=y/x;
	while(i<=t)
    {
        s++;
        i*=2;
    }
	cout<<s<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

ll A,B;

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

    cin>>A>>B;
    if( (A&1)!=(B&1) )cout<<"IMPOSSIBLE\n";
    else cout<<(A+B)/2<<'\n';

    return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<vector<int>> d(n, vector<int>(3));
    for (int i = 0; i < n; i++)
    {
        cin >> d.at(i).at(0) >> d.at(i).at(1);
        if (d.at(i).at(0) == d.at(i).at(1))
            d.at(i).at(2) = 1;
    }
    bool ans = false;

    for (int i = 0; i < n - 2; i++)
    {
        if (d.at(i).at(2) != 1)
            continue;
        else if (d.at(i + 1).at(2) != 1)
            continue;
        else if (d.at(i + 2).at(2) != 1)
            continue;
        else
        {
            ans = true;
            break;
        }
    }

    if (ans)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <stdio.h>

int main(){
  int i, j, count = 0, A[100], minj, N, temp;
  
  //input
  scanf("%d",&N);

  for(i = 0; i < N; i++){
    scanf("%d",&A[i]);
  }
  
  //sort
  for(i = 0; i < N; i++){
    minj = i;
    
    for(j = i; j < N; j++){
      if(A[j] < A[minj]) minj = j;
    }
    
    temp = A[i];
    A[i] = A[minj];
    A[minj] = temp;
    if(i != minj) count++;
  }

  //output
  for(i = 0; i < N-1; i++){
    printf("%d ",A[i]);
  }

  printf("%d\n%d\n",A[i],count);

  return 0;
}


  



Measured memory_bytes: 2084
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define YY cout << "Yes" << endl;
#define NN cout << "No" << endl;
const int INF = 1000000007;
typedef long long ll;
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { return (a * b) / gcd(a,b); }
class UnionFind{
  private:
    vector<int>par;
  public:
    UnionFind(int n):par(n,-1){}
    int root(int x){
      if(par[x] < 0)return x;
      return par[x] = root(par[x]);
    }
    bool unite(int x,int y){
      x = root(x); y = root(y);
      if (x == y) return false;
      if (par[x] > par[y]) swap(x, y);
      par[x] += par[y];
      par[y] = x;
      return true;
    }
    bool same(int x,int y){
      return root(x) == root(y);
    }
    int size(int x) {
      return -par[root(x)];
    }
};
int solve(){
  int n,m;
  cin >> n >> m;
  vector<pair<int,int>>v(m);
  rep(i,m){
    int a,b;
    cin >> a >> b;
    a--;
    b--;
    v[i].first = a;
    v[i].second = b;
  }
  int ans = 0;
  rep(i,m){
    UnionFind uf(n);
    rep(j,m){
      if(i != j){
        uf.unite(v[j].first,v[j].second);
      }
    }
    set<int>check;
    rep(k,n)check.insert(uf.root(k));
    if(check.size() != 1)ans++;
  }
  cout << ans << endl;
  return 0; 
}
int main(){
  // ios::sync_with_stdio(false);cin.tie(nullptr);
  // cout << fixed;cout << setprecision(16) << endl; 
  solve();
  return 0;
} 

Measured memory_bytes: 256
#include<stdio.h>
#define N 100

int main(){
  int i, j, n, u, k, v;
  int V[N][N];
  scanf("%d", &n);

  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j++ ){
      V[i][j] = 0;
    }
  }

  for( i = 0 ; i < n ; i++ ){
    scanf("%d%d", &u, &k);
    for( j = 0 ; j < k ; j++ ){
      scanf("%d", &v);
      V[u-1][v-1] = 1;
    }
  }
  for( i = 0 ; i < n ; i++ ){
    for( j = 0 ; j < n ; j ++ ){
      if(j) printf(" ");
      printf("%d", V[i][j]);
    }
    printf("\n");
  }
  return 0;
}



Measured memory_bytes: 2056
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

template<typename T>
bool is_even(T const& val){
  return val % 2 == 0;
}
template<typename T>
bool is_odd(T const& val){
  return !is_even(val);
}

int main(void)
{
  int N, M;
  cin >> N >> M;
  vector<int> verts(N+1);
  for(int i = 0; i < M; i++){
    int a, b;
    cin >> a >> b;
    verts[a]++;
    verts[b]++;
  }
  if(count_if(verts.begin(), verts.end(), &is_odd<int>) > 0) cout << "NO";
  else cout << "YES";
  cout << endl;

  return 0;
}

Measured memory_bytes: 768
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws IOException {

		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		StringBuilder sb;
		int m;
		String line;

		while ((!(line = br.readLine()).equals("-"))) {
			sb = new StringBuilder(line);
			m = Integer.parseInt(br.readLine());
			for (int i = 0; i < m; i++) {
				int h = Integer.parseInt(br.readLine());
				sb.append(sb.substring(0, h));
				sb.delete(0, h);
			}
			System.out.println(sb.toString());
		}
	}
}

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

using namespace std;

#define Rep(b, e, i) for (int i = b; i <= e; i++)
#define Repr(e, b, i) for (int i = e; i >= b; i--)
#define rep(n, i) Rep(0, n - 1, i)
#define repr(n, i) Repr(n - 1, 0, i)
#define all(v) (v).begin(), (v).end()
#define pb(v) push_back(v)
#define uniq(v) (v).erase(unique(all(v)), (v).end())
#define bitcnt(x) __builtin_popcount(x)
#define fst first
#define snd second
#define Pqaz(T) priority_queue<T, vector<T>, greater<T>>
#define Pqza(T) priority_queue<T>
#define put(x) cout << x;
#define putsp(x) cout << x << ' ';
#define putbd cout << "---------------------------------------------" << endl;
#define putln(x) cout << x << endl;
#define debug(x) cerr << #x << "=" << x << endl;
#define ENJYU std::ios::sync_with_stdio(false) std::cin.tie(0);

typedef long long ll;
typedef pair<ll, ll> llP;
typedef pair<int, int> intP;
typedef complex<double> comp;
typedef vector<int> vec;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<vec> mat;
typedef vector<vecll> matll;
typedef vector<vecd> matd;

template <class T>
ostream &operator<<(ostream &o, const vector<T> &v)
{
	o << "{";
	for (int i = 0; i < (int)v.size(); i++)
		o << (i > 0 ? ", " : "") << v[i];
	o << "}";
	return o;
}

const int MAX = 200020;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1 << 29;
const ll INFL = 1e18;
const ll MOD = 1000000007;

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

//********************************template END****************************************//

void solve()
{
	ll a, b, c;
	cin >> a >> b >> c;
	if (a+b >= c)
	{
		cout << b+c << endl;
		return;
	}
	cout << a + b * 2 + (c>a+b) << endl;
}

int main()
{
	solve();
	//cout << "yui(*-v・)yui" << endl;
	return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long

int main() {
    set<int> s;
    int a, b, c;
    cin >> a >> b >> c;
    s.insert(a);
    s.insert(b);
    s.insert(c);

    cout << s.size() << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
	int side[3];
	int iso=0, cho=0;
	while(scanf("%d,%d,%d",&side[0],&side[1],&side[2]) != EOF){
		if(side[0]==side[1]) iso++;
		else if( (side[0]*side[0]) + (side[1]*side[1]) == (side[2]*side[2]) ) cho++;
	}
	printf("%d\n", cho);
	printf("%d\n", iso);
	return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;
 
#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
 
const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;
 
void test();
 
int main() {
    fast();

    ll tt=1;
    // cin>>tt;
    f(i,0,tt) test();   
    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}

void test(){
    int n;
    cin >> n;
    str s;
    cin >> s;
    set<ll>sets[26];
    f(i,0,s.size())
    {
        sets[s[i]-'a'].add(i);
    }
    ll q;
    cin >> q;
    while(q--){
        ll type,l,r;
        char ch;
        cin >>type;
        if(type==1)
        {
            cin >> l >> ch;
            l--;
            sets[s[l]-'a'].erase(l);
            s[l]=ch;
            sets[s[l]-'a'].add(l);
        }
        else
        {
            cin >> l >> r;
            l--;
            r--;
            ll ans=0;
            f(i,0,26){
                auto s=sets[i].lower_bound(l);
                if(s!=sets[i].end() and *s<=r)
                {
                    ans++;
                }
            }
            cout<<ans<<edl;
        }

    }

}  

Measured memory_bytes: 24220
/* Dsingh_24 */

#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define	endl		'\n'
#define pii         pair<ll int,ll int>
#define vi          vector<ll int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (ll int)x.size()
#define hell        1000000007
#define rep(i,a,b)	for(ll int i=a;i<b;i++)
#define lbnd        lower_bound
#define ubnd        upper_bound
#define bs          binary_search
#define mp          make_pair
#define ios	    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;

#define N  100005

int main()
{
	ios
	ll n,m,i,j,a,b;
	cin>>n>>a>>b;
	ll ans=(n-a+1)*(n-b+1);
	cout<<ans;
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
using namespace std;
typedef long long ll;

typedef pair<int, int> P;

#define MAX_N 1010
int n;
bool f[2 * MAX_N + 6][2 * MAX_N + 6];

int cp(int *z1, int *z2, int k)
{
	vector<int> xs;
	for (int i = 0; i<n; i++) {
		xs.push_back(z1[i]);
		if (z1[i] - 1 >= 0)xs.push_back(z1[i] - 1);
		xs.push_back(z2[i] - 1);
		if (z2[i]<k)xs.push_back(z2[i]);
	}
	sort(xs.begin(), xs.end());
	xs.erase(unique(xs.begin(), xs.end()), xs.end());

	for (int i = 0; i<n; i++) {
		z1[i] = find(xs.begin(), xs.end(), z1[i]) - xs.begin();
		z2[i] = find(xs.begin(), xs.end(), z2[i]) - xs.begin();
	}

	return xs.size();
}

int main()
{
	int dx[4] = { 0,1,0,-1 };
	int dy[4] = { 1,0,-1,0 };
	int w, h;
	while (scanf("%d%d", &w, &h), w || h) {
		scanf("%d", &n);
		int x1[MAX_N + 1], x2[MAX_N + 1], y1[MAX_N + 1], y2[MAX_N + 1];
		for (int i = 0; i<n; i++) {
			scanf("%d%d%d%d", &x1[i], &y1[i], &x2[i], &y2[i]);
		}

		w = cp(x1, x2, w);
		h = cp(y1, y2, h);

		for (int i = 0; i < h; i++)
			for (int j = 0; j < w; j++)
				f[i][j] = 0;
		for (int i = 0; i<n; i++) {
			for (int x = x1[i]; x<x2[i]; x++) {
				for (int y = y1[i]; y<y2[i]; y++) {
					f[x][y] = true;
				}
			}
		}

		int ans = 0;
		for (int i = 0; i<w; i++) {
			for (int j = 0; j<h; j++) {
				if (f[i][j])continue;
				ans++;

				queue<P> q;
				q.push(make_pair(i, j));
				f[i][j] = true;
				while (!q.empty()) {
					int x = q.front().first, y = q.front().second;
					q.pop();

					for (int l = 0; l<4; l++) {
						int xx = x + dx[l], yy = y + dy[l];
						if (xx<0 || xx >= w || yy<0 || yy >= h)continue;
						if (!f[xx][yy]) {
							q.push(make_pair(xx, yy));
							f[xx][yy] = true;
						}
					}
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}

Measured memory_bytes: 5232
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>
#include <queue>
#include <set>
#include <bitset>
#include <map>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<long long> vll;
typedef queue<int, int> qii;
typedef pair<int, int> pii;
typedef pair<string, int> psi;

#define PI 3.14159265359
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rept(i,n) rep(i,0,n)

//int型を受け取ってその桁数を返す
int check_digits(int n) {
	int digits = 0;
	while (n != 0) {
		n /= 10;
		digits++;
	}
	return digits;
}

//int型を受け取ってその各桁の和を返す
int sum_digits(int n) {
	int sum=0;
	int N = n;
	while (N) {
		sum += N % 10;
		N /= 10;
	}
	return sum;
}


//最大公約数を返す関数
int gcd(int n, int m) {
	while (n != 0) {
		if (n < m) swap(n, m);
		n = n % m;
	}
	return m;
}


//2点間の距離を返す
float dis(int x1, int y1, int x2, int y2) {
	return sqrt(pow(abs(x1 - x2), 2) + pow(abs(y1 - y2), 2));
}

void yes() {
	cout << "Yes" << endl;
}

void no() {
	cout << "No" << endl;
}

int main() {
	int a, b;
	cin >> a >> b;
	
	string ab= "", ba= "";
	rept(i, b) ab = ab + to_string(a);
	rept(i, a) ba = ba + to_string(b);

	if (ab > ba)cout << ba << endl;
	else cout << ab << endl;


	system("pause");
	return 0;
}


Measured memory_bytes: 504
vars = input().split()
n,a,b = int(vars[0]),int(vars[1]),int(vars[2])
passed = 0
os = 1
parts = input()
for c in parts:
  if c=="c":
    print("No")
  elif c=="b" and passed<a+b and os<=b:
    print("Yes")
    passed += 1
    os += 1
  elif c=="a" and passed<a+b:
    print("Yes")
    passed += 1
  else:
    print("No")

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

map<ll, ll> primeFactor(ll n) {
    map<ll, ll> ret;
    for (ll i = 2; i * i <= n; i++) {
        while (n % i == 0) {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1) ret[n] = 1;
    return ret;
}

int main() {
    ll n, p;
    cin >> n >> p;
    map<ll, ll> mp = primeFactor(p);
    ll ans = 1;
    for (pair<ll, ll> i : mp) {
        for (int j = 0; j < i.second / n; ++j) {
            ans *= i.first;
        }
    }
    cout << ans << endl;
}


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

int main(void)
{
    int i, j;
    int N;
    int x[8], y[8];
    float ans = 0.0;

    scanf("%d", &N);

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

    for (i = 0; i < N - 1; i++)
    {
        for (j = i + 1; j < N; j++)
        {
            ans += sqrt(pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2));
        }
    }

    printf("%f", ans * 2 / N);

    return 0;
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx=1e5+5;
ll a[maxx];
int main(){
    int n; cin>>n;
    ll ans=0;
    for(int i=1;i<=n;i++){
        scanf("%lld",&a[i]);
        if(i&1){
            ans+=a[i];
        }
        else{
            ans-=a[i];
        }
    }
    ans/=2;
    for(int i=1;i<=n;i++){
        if(i==1){
            printf("%lld ",ans*2);
        }else{
            printf("%lld ",(a[i-1]-ans)*2);
            ans=a[i-1]-ans;
        }
    }
puts("");
}

Measured memory_bytes: 2048
#include<iostream>
using namespace std;
int main(){
	int l,i;
	int m,n,sum,flg;
	while(1){
		cin>>l;
		sum=flg=0;
		if(l==0) break;
		for(i=1;i<=12;i++) {
			cin>>m>>n;
			sum+=m-n;
			if(sum>=l && flg==0) flg=i;
		}
		if(sum<l) cout<<"NA"<<endl;
		else if(flg!=0)cout<<flg<<endl;
	}
	return 0;
}

Measured memory_bytes: 2936
#include <bits/stdc++.h>
#define ll long long int
#define yorn(f) cout<<((f)?"Yes":"No")<<endl;
#define YORN(f) cout<<((f)?"YES":"NO")<<endl;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define put(x) cout << x << endl;
#define println(x) cout << x << endl;
using namespace std;
int main()
{
    int d, n;
    cin >> d >> n;
    int x = d == 0 ? 1 : d == 1 ? 100 : 10000;

    int cnt = 0;
    for (int i = 1; ; i++) {
        if (i % 100 == 0) {
            continue;
        }
        cnt ++;
        if (cnt == n) {
            put(x * i);
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long int

int main()
{
	int n;
	cin >> n;
	ll ans = 0;

	vector<int> a(n);
	rep(i, n) cin >> a[i];
	sort(a.begin(), a.end(), [](const int x, const int y) {return x > y;});

	ans += a[0];
	ll remain_add_cnt = n - 2;
	for (int i = 1; remain_add_cnt > 0; i++) {
		if (remain_add_cnt >= 2) {
			ans += a[i] * 2;
			remain_add_cnt -= 2;
		}
		else {
			ans += a[i];
			remain_add_cnt -= 1;
		}
	}

	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 4048
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,k,a[200005];
 
int main()
{  cin>>n>>k;
 
    for(int i=0;i<n;i++)
    {
    	cin>>a[i+1];
    	a[i+1]+=a[i];
	}
	int sum=0;
	for(int i=k;i<=n;i++)
	{ sum=max(sum,a[i]-a[i-k]);
		}
	  
		cout << fixed << setprecision(9) << (double)(sum+k)/2.0;
 
}

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


int main(){
    int n;
    cin>>n;
    int sum=0;
    for(int i=1;i<n;i++){
        sum=sum+((n-1)/i);
    }
    cout<<sum;

}


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

vector<int> p;
 
int find_root(int x) {
  if (p[x] != x) p[x] = find_root(p[x]);
  return p[x];
}
 
void unite(int x, int y) {
  int nx = find_root(x);
  int ny = find_root(y);
  if (nx == ny) return;
  else p[ny] = nx;
}

bool same(int x, int y) {
  int nx = find_root(x);
  int ny = find_root(y);
  return nx == ny;
}

int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  for (int i = 0; i < n ; i ++) {
    cin >> a[i];
    a[i] --;
  }

  p = vector<int>(n);
  for (int i = 0; i < n; i ++) p[i] = i;
  for (int i = 0; i < m; i ++) {
    int x, y;
    cin >> x >> y;
    x --, y --;
    if (x > y) swap(x, y);
    unite(x, y);
  }

  int ans = 0;
  for (int i = 0; i < n; i ++) {
    if (same(i, a[i])) ans ++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>
#include <functional>
#include <limits>


using namespace std;

#define int long long
#define endl "\n"

constexpr long long INF = (long long)1e18;
constexpr long long MOD = 1'000'000'007; 

class BIT{
	vector<signed> bit;
	
public:
	
	BIT(){
	}
	
	BIT(int size){
		init(size);
	}
	
	void init(int size){
		bit.clear();
		bit.resize(size+1);
	}
	
	int sum(int i){
		int s = 0;
		while(i > 0){
			s += bit[i];
			i -= i & -i;
		}
		return s;
	}

	void add(int i , int x){
		while(i < bit.size()){
			bit[i] += x;
			i += i & -i;
		}
	}

	int lower_bound(int w){
		if(w <= 0) return 0;
		int x = 0, t = 1;
		while(t*2 < bit.size()) t *= 2;
		
		for(int k = t; k > 0; k /= 2){
			if(x + k < bit.size() && bit[x + k] < w){
				w -= bit[x + k];
				x += k;
			}
		}
		return x + 1;
	}
};


signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int N, Q;
	string S;
	vector<BIT> bit(26);
	
	cin>>N;
	cin>>S;
	cin>>Q;
	
	for(int i = 0; i < 26; i++){
		bit[i].init(N+10);
	}
	
	for(int i = 0; i < N; i++){
		bit[S[i] - 'a'].add(i+1, 1);
	}
	
	for(int i = 0; i < Q; i++){
		int a, b;
		
		cin>>a>>b;
		
		
		if(a == 1) {
			char c;
			
			cin>>c;
			
			bit[S[b-1] - 'a'].add(b, -1);
			bit[c - 'a'].add(b, 1);
			S[b-1] = c;
			
		} else {
			int r;
			cin>>r;
			
			int con = 0;
			for(int j = 0; j < 26; j++){
				if(bit[j].sum(r) - bit[j].sum(b-1) >= 1) con++;
			}
			
			cout<<con<<endl;
		}
	}
	
	return 0;
}

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

int countPrimeNumbers(int nums[], int n);

int main(void)
{
	int n, nums[10000];
	cin >> n;
	
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}
	
	int count = countPrimeNumbers(nums, n);
	
	cout << count << endl;
	
	return 0;
}

int countPrimeNumbers(int nums[], int n)
{
	int count = 0;
	
	for (int i = 0; i < n; i++) {
		int j = 2;
		for (j = 2; j * j <= nums[i]; j++) {
			if (nums[i] % j == 0) break;
		}
		if (j * j > nums[i]) count++;
	}
	
	return count;
}

Measured memory_bytes: 3096
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <cstdlib>
#include <iomanip>
#define ll long long
#define ar array
#define AC ios_base::sync_with_stdio(0);
const int M = 1e9+7;
const int N = 2*1e5;
using namespace std;
int n;
ll h[N];
ll beauty[N];
ll dp[N];
set<pair<ll,ll>> S;


int main(){
    AC
    cin>>n;
    for(int i=0; i<n; i++)
        cin>>h[i];
    for(int i=0; i<n; i++)
        cin>>beauty[i];

    S.insert({0,0});
    for(int i=0; i<n; i++){
        auto optimal = prev(S.lower_bound({h[i],0}));
        dp[i] = beauty[i]+optimal->second;
        while(true){
            auto next = S.lower_bound({h[i],0});
            if(next!=S.end() && next->second<=dp[i])
                S.erase(next);
            else
                break;
        }
        S.insert({h[i], dp[i]});
    }
    cout<<*max_element(dp, dp+n)<<endl;

}

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

int main() {
  long n,ans=1,mod=1000000007;
  string s;
  vector<long> a(26);
  cin >> n >> s;
  for(long i=0;i<n;i++) a[s[i]-'a']++;
  for(long i=0;i<26;i++) ans=ans*(a[i]+1)%mod;
  ans=(ans+mod-1)%mod;
  cout << ans << endl;
}

Measured memory_bytes: 512
using System;
using System.Collections.Generic;
class Program
    {
        static void Main(string[] args)
        {   
            string[] s = Console.ReadLine().Split(' ');
            int h = int.Parse(s[0]), w = int.Parse(s[1]);

            string[] map = new string[h];
            Queue<int[]> blackList = new Queue<int[]>();
            int[,] blackCount = new int[h,w];
            for (int i=0; i<h; i++)
            {
                map[i] = Console.ReadLine();
                for (int j=0; j<w; j++)
                {
                    if (map[i][j] == '.')
                    {
                        blackCount[i,j] = -1;
                    }
                    else
                    {
                        int[] b = {i, j};
                        blackList.Enqueue(b);
                    }
                }
            }
            int ans = 0;
            while (blackList.Count > 0)
            {
                
                int[] b = blackList.Dequeue();
                for (int i=-1; i<=1; i++)
                {
                    for (int j=-1; j<=1; j++)
                    {
                        if (i * j != 0) continue;
                        if (i == 0 && j == 0) continue;
                        int[] c = {b[0] + i, b[1] + j};
                        if (c[0] < 0 || c[0] >= h || c[1] < 0 || c[1] >= w) continue;
                        if (blackCount[c[0], c[1]] == -1)
                        {
                            blackCount[c[0], c[1]] = blackCount[b[0], b[1]] + 1;
                            ans = blackCount[b[0], b[1]] + 1;
                            blackList.Enqueue(c);
                        }
                    }
                }
            }
            Console.WriteLine(ans);

            
        }
    }
    //mcs Main.cs
    //mono Main.exe

Measured memory_bytes: 66132
#include <iostream>
using namespace std;
int main(void){
    int N,A,B,sum=0,num;
    cin >> N >> A >> B;
    for(int i=1;i<=N;i++){
        num=i/10000+i%10000/1000+i%1000/100+i%100/10+i%10;
        if(num>=A && num<=B){
            sum += i;
        }
    }
    cout << sum << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repf(i,a,b) for (int i = (a); i < (b); i++)
#define repi(i,a,b) for (int i = (a); i <= (b); i++)
#define repr(i,a,b) for (int i = (a); i >= (b); i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SORT(x) sort(all(x));
#define RSORT(x) sort(rall(x));
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vd = vector<double>;
using vb = vector<bool>;
using pii = pair<int, int>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using tiii = tuple<int, int, int>;
const ll inf = 1ll<<29;
const ll mod = 1000000007;
const double eps = 1e-9;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  int N; cin >> N;
  vi A(N+2);
  A.at(0) = 0;
  A.at(N+1) = 0;
  repi(i,1,N) cin >> A.at(i);

  vi L(N+2), R(N+2);
  L.at(0) = 0;
  repi(i,0,N) {
    L.at(i+1) = gcd(A.at(i+1),L.at(i));
  }
  R.at(N+1) = 0;
  repr(i,N,0) {
    R.at(i) = gcd(A.at(i),R.at(i+1));
  }
  
  vi M(N+2);
  repi(i,1,N) {
    M.at(i) = gcd(L.at(i-1),R.at(i+1));
  }

  cout << *max_element(all(M)) <<endl;
}

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

int a[100005];

int main(){
	int n,i;cin>>n;
	for(i=1;i<=n;++i) cin>>a[i];
	sort(a+1,a+n+1,greater<int>());
	for(i=1;i<=n;++i){
		if(a[i+1]<i+1 && a[i]>=i){
			int j=0;
			while(a[j+i+1]==i) j++;
			if((a[i]-i)%2==0 && j%2==0) puts("Second");
			else puts("First");
		}
	}
}

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

S=0
for i in range(N):
    S+=B[i]
for i in range(N-1):
    if A[i+1]==A[i]+1:
        S+=C[A[i]-1]
        i+=1
    else:
        i+=1

print(S)

Measured memory_bytes: 3064
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let n: usize = iterator.next().unwrap().parse().unwrap();
    let k: usize = iterator.next().unwrap().parse().unwrap();
    let mut a: Vec<bool> = vec![false; n];
    for _ in 0..k {
        let d: usize = iterator.next().unwrap().parse().unwrap();
        for _ in 0..d {
            let ai: usize = iterator.next().unwrap().parse().unwrap();
            a[ai - 1] = true;
        }
    }

    let ans: usize = a.iter().filter(|it| **it == false).count();
    return ans.to_string();
}


Measured memory_bytes: 2076
#include <cstdio>
#include <algorithm>
using namespace std;
int main () {
    int n,mn=2e9+7,ans=-1e9-7;
	scanf ("%d",&n);
	for (int i=0;i<n;i++) {
		int tmp;
		scanf ("%d",&tmp);
		ans=max(ans,tmp-mn);
		mn=min(mn,tmp);
	}
	printf ("%d\n",ans);
    return 0;
}


Measured memory_bytes: 2760
using System;
using System.Collections.Generic;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {

            List<int> hList=new List<int>();

            string s="";


            int dat = 0;

            while(true)
            {
                s = Console.ReadLine();

                if (s == null)
                {
                    break;
                }

                dat = Convert.ToInt32(s.Split(' ')[0]) + Convert.ToInt32(s.Split(' ')[1]);

                hList.Add(dat.ToString().Length);
                
            } 


            for (int i = 0; i < hList.Count; i++)
            {
                Console.WriteLine(hList[i].ToString());
            }
            Console.ReadLine(); 
        }
    }

}

Measured memory_bytes: 5768
#include<iostream>
using namespace std;
int main(){
	bool color[8];
	for(int i=0;i<8;i++)color[i]=false;
	int any=0;
	int num=0;
	int fill=0;
	cin>>num;
	for(int i=0;i<num;i++){
		int a=0;
		cin>>a;
		int rate=400;
		int j=1;
		for(;j<=8;j++){
			if(a<(rate*j)){
				if(!color[j-1]){
					fill++;
					color[j-1]=true;
				}
				break;
			}
		}
		if(j==9){
			any++;
		}
	}
	int max=fill+any;
	int min=fill;
	if(fill==0)min=1;
	cout<<min<<" "<<max<<endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Text.RegularExpressions;

namespace ITP1_8
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] sl = Console.ReadLine().ToCharArray().Select(e => e.ToString()).ToArray();
            Regex bre = new Regex(@"^[A-Z]$");
            Regex sre = new Regex(@"^[a-z]$");
            foreach(string s in sl)
                Console.Write(bre.IsMatch(s) ? s.ToLower() :
                              sre.IsMatch(s) ? s.ToUpper() : s);
            Console.WriteLine();
        }
    }
}

Measured memory_bytes: 11540
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 210000;

int n;
int a[maxn],p[maxn];
int T[maxn],f[maxn];

bool judge(const int x,const int y,const int z){return x<y?(z<x||z>y):(y<z&&z<x);}

int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&a[i]),p[a[i]]=i;
	
	T[n]=0;
	for(int i=n-1;i>=1;i--)
	{
		if(!T[i+1])
		{
			if(p[i]<p[i+1]) T[i]=0;
			else T[i]=1,f[i]=i+1;
		}
		else
		{
			if(judge(p[f[i+1]],p[i],p[i+1])) T[i]=T[i+1],f[i]=f[i+1];
			else T[i]=T[i+1]+1,f[i]=i+1;
		}
	}
	printf("%d\n",T[1]);
	
	return 0;
}


Measured memory_bytes: 3328
use std::collections::HashMap;

fn main() {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let n: usize = s.trim().parse().unwrap();

    let mut h: HashMap<char, usize> = HashMap::new();
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).unwrap();
    let c: Vec<char> = s.trim().chars().collect();
    for e in &c {
        let x = match h.get(e) {Some(x) => *x, None => 0};
        h.insert(*e, x+1);
    }

    for _ in 1..n {
        let mut m: HashMap<char, usize> = HashMap::new();
        let mut s = String::new();
        std::io::stdin().read_line(&mut s).unwrap();
        let c: Vec<char> = s.trim().chars().collect();
        for e in &c {
            let x = match m.get(e) {Some(x) => *x, None => 0};
            m.insert(*e, x+1);
        }
        for (k, v) in h.iter_mut() {
            let x = match m.get(k) {Some(x) => *x, None => 0};
            *v = std::cmp::min(x, *v);
        }
    }
    let mut v: Vec<char> = h.keys().map(|x| *x).collect();
    v.sort();
    for k in &v {
        let x = match h.get(k) {Some(x) => *x, None => 0};
        print!("{}", std::iter::repeat(*k).take(x).collect::<String>());
    }
    println!("");
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
// define
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (((a)%mod) * ((b)%mod)) % mod
#define rollcall cout << "I'm Sucu." << endl;
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define dmt(x, y, z) make_tuple(x, y, z)
#define pb(x) push_back(x)
#define pf(x) push_front(x)
#define fi first
#define se second
// typedef
typedef complex<double> Point;
typedef pair<int, int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;
// int sum = accumulate(a, a+n, 0LL);
// int mx = max_element(a, a+n);
// int mn = min_element(a, a+n);
// int cnt = count(a, a+n, k);


signed main(){
  int n;cin >> n;
  rep(i,n){
    int x, y, a, b;
    cin >> x >> y >> a >> b;
    int ans1 = x * a + y * b;
    int ans2 = x * max(a, (int)5) + y * max(b, (int)2);
    ans2 = ans2 * 8 / 10;
    cout << min(ans1, ans2) << endl;
  }
  return 0;
}



Measured memory_bytes: 3100