akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
#include <climits>
using namespace std;

#define MOD1097 1000000007

#define ll long long
#define pint pair<int, int>
#define pll pair<ll, ll>
#define pb push_back
#define mp make_pair
#define pm(first, second) pb(mp(first, second))
#define SPACE " "
#define fpf first.first
#define fps first.second
#define spf second.first
#define sps second.second

#define all(X) (X).begin(), (X).end()

int main(){

	int n;
	cin >> n;
	unsigned ll tmp = 0;
	unsigned ll in;
	for(int i = 0; i < n - 1; i ++){
		cin >> in;
		tmp ^= in;
	}
	cin >> in;
	if(tmp == in)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}


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

int main(){
  int i,n,t,x[1001],min_ti=0;
  float tm[1001],a,min=100000000000;
  scanf("%d %d %f",&n,&t,&a);
  
  for(i=0;i<n;i++){
    scanf("%d",&x[i]);
    tm[i]=t-x[i]*0.006;
    //printf("%f\n",tm[i]);
  }
  
  for(i=0;i<n;i++){
    if(fabs(a-tm[i]) < min ) {
      min= fabs(a-tm[i]);
      min_ti = i;
    }
  }
  printf("%d\n",min_ti+1);
  return 0;
  
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
void ABC140(void);
void ABC141(void);
void ABC142(void);
void ABC143(void);
void ABC144(void);
void ABC145(void);
void ABC146(void);
void ABC147(void);
void ABC148(void);
void ABC149(void);

int main(void){
    ABC144();
}

void ABC144(){
    int a,b;
    cin>>a>>b;
    if(a<=9&&b<10)cout<<a*b<<endl;
    else cout<<-1<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/algorithm/string/join.hpp>
#include <boost/range/irange.hpp>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using boost::irange;
using boost::algorithm::join;

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
    #define endl "\n"
  }
} before_main_function;

// ========== end of template ==========
constexpr int N_MAX = 500;
int G[N_MAX][N_MAX];

int level(int u, int v) {
  REP(i, 9) {
    uint32_t mask = nbit(i);
    if ((u&mask) != (v&mask)) {
      return i+1;
    }
  }

  assert(false);
  return -1;
}

int main(int argc, char** argv) {
  int N;
  cin >> N;

  REP(i, N-1) {
    for (int j=i+1; j<N; j++) {
      cout << level(i+1, j+1);
      if (j<N-1) cout << " ";
    }
    cout << endl;
  }

  return 0;
}


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

using namespace std;

#define int long long

int32_t main() {
    ios::sync_with_stdio(false);

//  freopen("input.txt", "r", stdin);
//  freopen("output.txt", "w", stdout);

    int n, m, k, answ = 0;
    cin >> n >> m >> k;

    char c[n][m];

    for(int i = 0; i < n; i++)
        for(int j = 0; j < m; j++)
            cin >> c[i][j];

    for(int i = 0; i < pow(2, n); i++)
        for(int j = 0; j < pow(2, m); j++) {
            bitset<8> rows(i), cols(j);
            int cur = 0;
            for(int p = 0; p < n; p++)
                for(int l = 0; l < m; l++)
                    if(!rows[p] && !cols[l] && c[p][l] == '#')
                        cur++;
            if(cur == k)
                answ++;
        }

    cout << answ;

    return 0;
}


Measured memory_bytes: 4112
#include<stdio.h>
int main(){
	char a[1205];
	scanf("%[^\n]",a);
	int p=0;
	while(a[p]!='\0'){
		p++;
	}
	for(int i=0;i<p;i++){
		if(a[i]>='a'&&a[i]<='z'){
			a[i]=a[i]-32;
		}
		else if(a[i]>='A'&& a[i]<='Z'){
			a[i]=a[i]+32;
		}
	}
	printf("%s",a);
	printf("\n");

return 0;
}



Measured memory_bytes: 2032
n = int(input())
n_list = [0]*n
for i in range(n):
    n_list[i] = input().split()
    n_list[i].append(i+1)
for i in range(n):
    n_list[i][1] = int(n_list[i][1])
n_list.sort()
n_list.append("dum")
#print(n_list)
L = 0
for i in range(n):
    if n_list[i][0] != n_list[i+1][0]:
        for j in range(i,L-1,-1):
            print(n_list[j][2])
        L = i+1

Measured memory_bytes: 38384
#include<stdio.h>
int main()
{
    int a,b,c,d;
    scanf("%d %d %d %d",&a,&b,&c,&d);
     if(a>=c)
     {
         if(d<=a)
            printf("0");
         if(d>a)
         {
             if(d>=b)
                printf("%d",b-a);
              if(d<b)
                printf("%d",d-a);
         }
     }
     else
     {
         if(b<=c)
            printf("0");
         if(b>c)
         {
             if(b>=d)
                printf("%d",d-c);
              if(b<d)
                printf("%d",b-c);
         }
     }

 return 0;
}


Measured memory_bytes: 128
import sys
read = sys.stdin.read
def main():
    h, n = map(int, input().split())
    m = map(int, read().split())
    mm = zip(m, m)

    large_num = 10**9
    dp = [large_num] * (h + 10**4 + 1)
    dp[0] = 0
    for a, b in mm:
        for i1 in range(h + 1):
            if dp[i1 + a] > dp[i1] + b:
                dp[i1 + a] = dp[i1] + b
    r = min(dp[h:])
    print(r)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3696
#include <bits/stdc++.h>
using namespace std;
const int MOD = (int)1e9 + 7;
const long long INF = 1LL << 60;
const double PI = 3.14159265358979323846;
typedef long long ll;

int main(void) {
  int N, W;
  cin >> N >> W;
  ll w[110], v[110], vMax = 100100;
  for (int i = 0; i < N; i++) {
    cin >> w[i] >> v[i];
  }

  ll dp[110][vMax];
  for (int i = 0; i <= N; i++) {
    for (int j = 0; j < vMax; j++) dp[i][j] = INF;
  }
  // for (int i = 0; i < vMax; i++) dp[0][i] = 0;
  dp[0][0] = 0;
  for (int i = 0; i < N; i++) {
    for (int vSum = 0; vSum < vMax; vSum++) {
      if (vSum - v[i] >= 0) {
        dp[i + 1][vSum] = min(dp[i + 1][vSum], dp[i][vSum - v[i]] + w[i]);
      }
      dp[i + 1][vSum] = min(dp[i + 1][vSum], dp[i][vSum]);
    }
  }
  ll ans = 0;
  for (int i = 0; i < vMax; i++) {
    if (dp[N][i] <= W) ans = i;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 81152
/*
    -ensure correct output format
    -ensure printing required output
    -reread the problem statement
  */

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll>pll;
typedef pair<ll,pair<ll,ll>>plll;
#define fastread() (ios_base:: sync_with_stdio(false),cin.tie(NULL));
#define vll(v) v.begin(),v.end()
#define all(x) x.rbegin(),x.rend()
#define min3(a, b, c)   min(a, min(b, c))
#define max3(a, b, c)   max(a, max(b, c))
#define F first
#define S second
#define in  freopen("input.txt", "r", stdin)
#define out  freopen("output.txt", "w", stdout)
#define minheap int,vector<int>,greater<int>
#define pb push_back
#define eb emplace_back
#define ischar(x)  (('a' <= x && x <= 'z') || ('A' <= x && x <= 'Z'))
#define isvowel(ch) ((ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u')||(ch=='A'|| ch=='E' || ch=='I'|| ch=='O'|| ch=='U'))
#define bug cout<<"BUG"<<endl;
const int Max = 2e6 + 10;
const int Mod = 1e9 + 7;
const double PI  =3.141592653589793238463;
bool compare(const pair<ll,ll> &a, const pair<ll,ll> &b)
{
       return (a.first > b.first);
}
ll lcm(ll a,ll b)
{
    if(a==0 || b==0)return 0;

    return a/__gcd(a,b)*b;
}

void input(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)cin>>ara[i];
}
void print(ll ara[],ll n)
{
    for(ll i=0; i<n; i++)
        cout<<ara[i]<<" ";
    cout<<endl;
}


int main()
{

   fastread();

   ll i,j,n,m,p,a,sum=0,k,t,b,c,d,cnt=0,q,l,r;

      bool flag=false;

      string str;


       cin>>n>>m>>t;

       cnt=n/m;

       if(n%m)cnt++;

       cout<<cnt*t<<endl;



}



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

typedef long long intt;

int main()
{
        int n,k;
        cin>>n;
        int a[n][3];
        for(int i=0;i<n;i++)
        {
            for(int j=0;j<3;j++)
            {
                cin>>a[i][j];
            }
        }

        int dp[n][3]={{0}};
        dp[0][0]=a[0][0];
        dp[0][1]=a[0][1];
        dp[0][2]=a[0][2];
        for(int i=1;i<n;i++)
        {
            for(int j=0;j<3;j++)
            {
                for(int k=0;k<3;k++)
                {
                    if(k==j)
                    {
                        continue;
                    }
                    dp[i][k]=max(dp[i][k],a[i][k]+dp[i-1][j]);
                }
            }
        }
        cout<<endl;
        /*for(int i=0;i<n;i++)
        {
            for(int j=0;j<3;j++)
            {
                cout<<dp[i][j]<<" ";
            }
            cout<<"\n";
        }*/
        cout<<max(dp[n-1][0],max(dp[n-1][1],dp[n-1][2]));

	return 0;
}
/**
2
aaa
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
abab
1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
*/


Measured memory_bytes: 5928
#include<cstdio>
#include<algorithm>
using namespace std;
int n,Map[5][105],f[5][105];
int dfs(int x,int y,int sum)
{
	if(x>2||y>n)return sum;
	return f[x][y]=max(dfs(x,y+1,sum+Map[x][y]),dfs(x+1,y,sum+Map[x][y]));
}
int main()
{
	#ifdef LOACL
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	#endif
	scanf("%d",&n);
	for(int i=1;i<=n;i++)scanf("%d",&Map[1][i]);
	for(int i=1;i<=n;i++)scanf("%d",&Map[2][i]);
	printf("%d",dfs(1,1,0));
	return 0;
}

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

using namespace std;

int main(){
  string S,T,U;
  int A,B;
  cin >> S >> T >> A >> B >> U;
  if(S == U)A -= 1;
  if(T == U)B -= 1;
  cout << A << " " << B;
  return 0;
}

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

int main() {
    int W, H, N;
    cin >> W >> H >> N;
    int x_min=0, y_min=0, x_max=W, y_max=H;
    for (int i=0; i<N; i++){
        int x, y, z;
        cin >> x >> y >> z;
        if (z==1){
            x_min=max(x_min, x);
        }
        if (z==2){
            x_max=min(x_max, x);
        }
        if (z==3){
            y_min=max(y_min, y);
        }
        if (z==4){
            y_max=min(y_max, y);
        }
    }
    int ans=(y_max-y_min)*(x_max-x_min);
    if (y_max-y_min<0 && x_max-x_min<0) ans=0;
    if (ans<0) ans=0;
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() 
{
    long long x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;
    cout << x2 - (y2 - y1) << ' ' << y2 + (x2 - x1) << ' ' << x1 - (y2 - y1) << ' ' << y1 + (x2 - x1) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <cmath>

using namespace std;

int main(void)
{
    int N;
    double T, A;
    double temp;
    cin >> N >> T >> A;
    vector<pair<double, int>> t(N);
    for (int i = 0; i < N; i++)
    {
        cin >> temp;
        t[i].first = abs(A - (T - temp * 0.006));
        t[i].second = i + 1;
    }
    sort(t.begin(), t.end());
    cout << t[0].second << endl;
    return 0;
}

Measured memory_bytes: 256
N, X = map(int, input().split(' '))
height = [1]

for i in range(N):
	height.append(height[-1]*2 + 3)

def patty(N,X):
	if N==1:
		l = [0,1,2,3,3]
		return l[X-1]
	elif N>=2:
		if X == 1:
			return 0
		elif X <= height[N-1]+1:
			return patty(N-1,X-1)
		elif X == height[N-1]+2:
			return patty(N-1,height[N-1])+1
		elif X == height[N]:
			return patty(N-1,height[N-1])*2+1
		elif X >= height[N-1]+3:
			return patty(N-1,height[N-1])+1+ patty(N-1,X-2-height[N-1])

print(patty(N,X))


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int MAX=5005;
const int INF=0x3f3f3f3f;
const int MOD=1000000007;
ll n,m;
int main(){
    scanf("%lld%lld",&n,&m);
    if(n>=m/2) printf("%lld\n",m/2);
    else printf("%lld\n",(n+(m/2))/2);
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+1000;
ll a[N],b[N];
int n,m;
ll k;
int main()
{
	cin>>n>>m>>k;
	ll ans=0;
	for(int i=1;i<=n;i++) cin>>a[i];
	for(int i=1;i<=m;i++) cin>>b[i];
	for(int i=1;i<=n;i++) a[i]+=a[i-1];
	for(int i=1;i<=m;i++) b[i]+=b[i-1];
	for(ll i=0;i<=n;i++)
	{
		if(k>=a[i]) 
		{
			ans=max(ans,upper_bound(b+1,b+1+m,k-a[i])-b-1+i);
		 } 
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 6764
#include <iostream>
#include <stdio.h>

int main() {
	double a;
	a = 0;
	int b, c, d, e;
	std::cin >> b >> c;
	d = b / c;
	e = b % c;
	a = 1.00000 * b / c;
	std::cout << d << " " << e << " ";
	printf("%.5lf\n", a);
}

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

using namespace std;
using ll = long long;

int main() {
    int N = 0;
    cin >> N;
    vector<int> A(9,0);
    int ans = 0;
    for(int i = 0; i < N; i++) {
        int temp;
        cin >> temp;
        if(temp >= 3200) {
            A.at(8)++;
        } else {
            A.at(temp/400)++;
        }
    }
    for(int i = 0; i < 8; i++) {
        if(A.at(i)) {
            ans++;
        }
    }
    cout << ans + (ans == 0) << ' ';
    ans += A.at(8);
    cout << ans << endl;
    

    return 0;
}

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

int main() {
    string S;
    int win, lose = 0;
    cin >> S;
    for (int i; i < S.size(); i++) {
    if (S.at(i) == 'o') {
        win++;
    }
    else {
        lose++;
        }
    }
    if (15 - (win + lose) >= 8 - win) {
    cout << "YES" << endl;
    }
    else {
    cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
//
//  main.cpp
//  codeforces
//
//  Created by cfhaiteeh on 21/5/2018.
//  Copyright © 2018 cfhaiteeh. All rights reserved.
//

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <map>
#include <stack>
#include <queue>
#include <vector>
#define  LL long long

using namespace  std;
const int maxn=123456;

int n,H;
void init(){
    
    
}
LL ans;
//r 2e9
LL br(LL l,LL r,LL P,LL len){
    LL MIN=0;
    while(l<=r){
        LL mid=(l+r)/2;
        LL t1=(1+mid-1)*(mid-1)+mid-P;
        t1=n-t1;
        if(t1<0){
            r=mid-1;
        }
        else{
            LL x=t1/mid;
            if(t1%mid!=0)x++;
            LL need=(mid-1)*2+1-len;
            need+=x;
            
            if(MIN==0)MIN=need;
            else MIN=min(MIN,need);
            l=mid+1;
        }
    }
    return MIN;
}
void play(){
   
}
void pri(){
    printf("%lld\n",ans);
    
}
char ch[234];
int ai[2][26];
int main() {
    // insert code here...
    
    //   cout<<p*p/2<<endl;
    while(scanf("%d",&n)!=EOF){
        scanf("%s",ch+1);
        int ans=0;
        for(int i=2;i<=n;i++){
            memset(ai,0,sizeof(ai));
            for(int j=1;j<i;j++){
                ai[0][ch[j]-'a']++;
            }
            for(int j=i;j<=n;j++){
                ai[1][ch[j]-'a']++;
            }
            int sum=0;
            for(int j=0;j<26;j++){
                if(ai[0][j]>0&&ai[1][j]>0)sum++;
            }
            ans=max(ans,sum);
        }
        printf("%d\n",ans);
    }
    return 0;
}


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

int n,ans;
string S;
bool dp[30009][4][1009];

main()
{
        cin>>n>>S;
        dp[0][0][0]=true;

        rep(i,n) //for(int i=0;i<(int)(n);i++)
        {
                rep(j,4)
                {
                        rep(k,1000)
                        {
                        if(dp[i][j][k]==false)continue;

                        if(j<3)dp[i+1][j+1][k*10+S[i]-'0']=true;
                        dp[i+1][j][k]=true;
                        }
                }
        }

        for(auto it : dp[n][3])ans+=it;
        cout<<ans<<endl;
}

Measured memory_bytes: 118528
from collections import deque

WHITE = -1
BLACK = -2
GOAL = -3
field_mapping = {
    '.': WHITE,
    '#': BLACK
}


def neighbors(y, x):
    points = []
    if y-1 >= 0:
        points.append([y-1, x])
    if y+1 < H:
        points.append([y+1, x])
    if x-1 >= 0:
        points.append([y, x-1])
    if x+1 < W:
        points.append([y, x+1])
    return points


def searching():
    field[0][0] = 1
    queue = deque([[0, 0]])
    while len(queue) > 0:
        [y, x] = queue.popleft()
        current_distance = field[y][x]
        for [n_y, n_x] in neighbors(y, x):
            point_status = field[n_y][n_x]
            if point_status == WHITE:
                field[n_y][n_x] = current_distance + 1
                queue.append([n_y, n_x])
            elif point_status == GOAL:
                return current_distance + 1
    return -1


def main():
    global H, W, field
    [H, W] = [int(i) for i in input().split()]
    field = []
    white_num = 0
    for i in range(H):
        line = []
        for color in [field_mapping[s] for s in input()]:
            line.append(color)
            if color == WHITE:
                white_num += 1
        field.append(line)
    field[H-1][W-1] = GOAL
    walked_points = searching()
    if walked_points < 0:
        print(-1)
    else:
        print(white_num - walked_points)


if __name__ == '__main__':
    main()


Measured memory_bytes: 3316
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vvvl vector<vector<vector<ll>>>
#define debug(x) cerr<<#x<<" "<<x<<'\n';

ll gcd(ll a,ll b) {
    while(1) {
        if(a < b) swap(a, b);
        if(!b) break;
        a %= b;
    }
    return a;
}
int main() {
    string s;
    ll ans=0,cnt=0;
    cin>>s;
    rep(i,s.length()){
        if(s[i]=='A')cnt++;
        else if(s[i]=='B'&&s[i+1]=='C'){
            ans+=cnt;
            i++;
        }
        else cnt=0;
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 640
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<map>
#include<iomanip>
#include<queue>
#include<stack>
#include<time.h>
#define rep(i,n)for(int i=0;i<n;i++)
#define int long long
#define ggr getchar();getchar();return 0;
#define prique priority_queue
constexpr auto mod = 1000000007;
#define inf 1e15
#define key 1e9
using namespace std;
typedef pair<int, int>P;
template<class T> inline void chmax(T& a, T b) {
	a = std::max(a, b);
}
template<class T> inline void chmin(T& a, T b) {
	a = std::min(a, b);
}

//combination(Nが小さい時はこれを使う)
const int MAX = 330000;
int fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % mod;
		inv[i] = mod - inv[mod % i] * (mod / i) % mod;
		finv[i] = finv[i - 1] * inv[i] % mod;
	}
}
int COMB(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

bool prime(int n) {
	int cnt = 0;
	for (int i = 1; i <= sqrt(n); i++) {
		if (n % i == 0)cnt++;
	}
	if (cnt != 1)return false;
	else return n != 1;
}
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}

//繰り返し二乗法（Nが大きい時の場合のcombination)
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= (i % mod); res %= mod;
	}
	return res;
}
int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}
//UnionFind
class UnionFind {
protected:
	int* par, * rank, * size;
public:
	UnionFind(unsigned int size) {
		par = new int[size];
		rank = new int[size];
		this->size = new int[size];
		rep(i, size) {
			par[i] = i;
			rank[i] = 0;
			this->size[i] = 1;
		}
	}
	int find(int n) {
		if (par[n] == n)return n;
		return par[n] = find(par[n]);
	}
	void unite(int n, int m) {
		n = find(n);
		m = find(m);
		if (n == m)return;
		if (rank[n] < rank[m]) {
			par[n] = m;
			size[m] += size[n];
		}
		else {
			par[m] = n;
			size[n] += size[m];
			if (rank[n] == rank[m])rank[n]++;
		}
	}
	bool same(int n, int m) {
		return find(n) == find(m);
	}
	int getsize(int n) {
		return size[find(n)];
	}
};
int dight_sum(int n) {
	int sum = 0;
	rep(i, 20)sum += (n % (int)pow(10, i + 1)) / (pow(10, i));
	return sum;
}
int n;
int f[1111111];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	f[1] = 1, f[2] = 1;
	int memo = f[1] + f[2];
	for (int i = 3; i <= n; i++) {
		f[i] = (memo - f[i - 2] + mod) % mod;
		memo += f[i];
		memo %= mod;
	}
	int p = 0, q = 0;
	for (int i = 1; i <= n - 1; i++) {
		p += f[i];
		p %= mod;
	}
	p = (p * (n - 1) + 1) % mod;
	for (int i = 1; i <= n - 1; i++) {
		q += ((f[i] * (n - 2)) % mod + f[i + 1]) % mod;
		q %= mod;
	}
	cout << (p + (q + 1) * (n - 1) % mod) % mod << endl;
	ggr
}

Measured memory_bytes: 10496
#include <bits/stdc++.h>
#define N 300050
#define ll long long
#define x first
#define y second
#define all(v) v.begin(),v.end()
using namespace std;

int main() {
            ios_base::sync_with_stdio(false);
            cin.tie(NULL);
            cout.tie(NULL);
            ll n,k;
            cin>>n>>k;
            ll ar[n];
            for(int i=0;i<n;i++)
                cin>>ar[i];
            sort(ar,ar+n);
            ll mo=0;
            for(int i=0;i<n-k;i++)
                mo+=ar[i];
            cout<<mo;
            return 0;
}


Measured memory_bytes: 1792
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace AtCoder
{
	public class ABC
	{
		static void Main(string[] args)
		{
			Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });


			int[] vs = Console.ReadLine().Split().Select(int.Parse).OrderBy(p => p).ToArray();
			int a = vs[0];
			int b = vs[1];
			int ans = -1;
			if (a < 10 && b < 10) {
				ans = a * b;
			}

			Console.WriteLine(ans);


			Console.Out.Flush();
		}
	}
}


Measured memory_bytes: 13396
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
#include <climits>
#include <string.h>
#include <stdio.h>
#define LL long long
#define pii pair<int,int>
#define piii pair<int, pii >
#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define vi vector<int>
#define vpi vector< pii >
#define INF 2147483647
#define big 20160116
#define pb push_back
#define mp make_pair
using namespace std;
const int Maxk=1005;
string mul(string a,string b){
	int res[Maxk];
	memset(res,0,sizeof(res));
	reverse(a.begin(),a.end());
	reverse(b.begin(),b.end());
	for (int i=0;i<a.length();i++){
		for (int j=0;j<b.length();j++){
			res[i+j]+=(a[i]-'0')*(b[j]-'0');
		}
	}
	for (int i=0;i<Maxk;i++){
		if (res[i]>=10) {
			res[i+1]+=(res[i]/10);
			res[i]%=10;
		}
	}
	string ret;
	bool flag=false;
	for (int i=Maxk-1;i>=0;i--){
		if (flag || res[i]){
			flag=true;
			ret=ret+(char)(res[i]+'0');
		}
	}
	if (ret=="") ret="0";
	return ret;
}
string add(string a,string b){
	if (a.length()<b.length()) swap(a,b);
	while (a.length()!=b.length()){
		b='0'+b;
	}
	for (int i=a.length()-1;i>=0;i--){
		a[i]+=(b[i]-'0');
		if (a[i]>'9' && i){
			a[i]-=10;
			a[i-1]++;
		}
	}
	if (a[0]>'9'){
		a[0]-=10;
		a='1'+a;
	}
	return a;
}
const int Maxn=505;
int a[Maxn][Maxn];
long long s[Maxn][Maxn];
int b[Maxn];
int main(){
	int X,Y,x,y;
	scanf("%d %d %d %d",&X,&Y,&x,&y);
	if (X%x==0 && Y%y==0){
		printf("No\n");
		return 0;
	}
	bool flag=false;
	if (Y%y==0){
		swap(x,y);
		swap(X,Y);
		flag=true;
	}
	printf("Yes\n");
	for (int i=0;i<y;i++){
		if (i*2==y-1){
			b[i]=0;
		}
		else if (i*2<y-1){
			b[i]=1e6-1;
		}
		else{
			b[i]=-1e6;
		}
	}
	
	long long sum=0LL;
//	cerr<<123;
	for (int i=0;i<X;i++){
		for (int j=0;j<Y;j++){
			a[i][j]=b[j%y];
			sum+=a[i][j];
		//	printf("%d ",a[i][j]);
		}
		//printf("\n");
	}
	/*
//	cerr<<sum<<endl;
	if (sum<=0){
		
		throw 3;
	}
	for (int i=1;i<=X;i++){
		for (int j=1;j<=Y;j++){
			s[i][j]=s[i-1][j]+s[i][j-1]-s[i-1][j-1];
			s[i][j]+=a[i-1][j-1];
		}
	}
	for (int dx=1;dx<=X;dx++){
		for (int dy=1;dy<=Y;dy++){
			int ex=dx+x-1;
			int ey=dy+y-1;
			if (ex>X||ey>Y) continue;
			long long ss=s[ex][ey]+s[dx-1][dy-1]-s[ex][dy-1]-s[dx-1][ey];
			if (ss>=0LL){
				throw 3;
			}
		//	cerr<<ss<<' ';
		}
	//	cerr<<endl;
	}*/
	
	if (flag){
		for (int i=0;i<Y;i++){
			for (int j=0;j<X;j++){
				//if(flag)a[j][i]=b[j%y];else a[i][j]=b[j%y];
				printf("%d ",a[j][i]);
			}
			printf("\n");
		}
	}
	else{
		for (int i=0;i<X;i++){
			for (int j=0;j<Y;j++){
				//if(flag)a[j][i]=b[j%y];else a[i][j]=b[j%y];
				printf("%d ",a[i][j]);
			}
			printf("\n");
		}
	}
	return 0;
}

Measured memory_bytes: 3200
n, k = map(int, input().split())
a = list(map(int, input().split()))

arr = [-1]*n
next_town = 0
arr[0] = 0
flag = False
for i in range(1, k+1):
    #print(next_town+1)
    next_town = a[next_town] - 1
    if arr[next_town] >= 0:
        flag = True
        x = i - arr[next_town]
        l = arr[next_town]
        break
    else:
        arr[next_town] = i
#print(flag, x, k%x)
if flag == False:
    print(next_town+1)
else:
    for i in range((k-l)%x):
        #print(next_town+1)
        next_town = a[next_town] - 1

    print(next_town+1)

Measured memory_bytes: 92220
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m;cin>>n>>m;
    vector<vector<int>> a(100005,vector<int>(1,0));
    for(int i=0;i<n;i++){
        int b, c;cin>>b>>c;
        a.at(b).push_back(c);
    }
    int ans=0;
    
    priority_queue<int> pq;
    for(int i=1;i<=m;i++){
        for(int j=0;j<a.at(i).size();j++){
            pq.push(a.at(i).at(j));
        }
        if(!pq.empty()){
            ans += pq.top();
            pq.pop();
        }
    }
    cout << ans <<endl;
}


Measured memory_bytes: 6976
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstring>
using namespace std;
int pri[1000000];
int main()
{
    int i,j;
    memset(pri,0,1000000*sizeof(int));
    for (i=2;i<=1000;i++)
    {
        for (j=i*i;j<1000000;j=j+i)
        {
            pri[j]=1;
        }
    }
    int n;
    while (scanf("%d",&n)!=EOF)
    {
        int sum=0;
        for (i=2;i<=n;i++)
            if (pri[i]==0) sum++;
        printf("%d\n",sum);
    }
    return 0;
}



Measured memory_bytes: 7120
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >> n;
	int a[n];
	long long s = 0;
	for (int i=0;i<n;i++) cin >> a[i], s += a[i];
	cout << *min_element(a, a+n) << ' ' << *max_element(a, a+n) << ' ' << s << endl;
}


Measured memory_bytes: 3136
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int A,B,C;

int dfs(int a, int b, int c, int x){
    if(x==0) return 1;
    else if(x<0) return 0;
    int ans = 0;
    if(a<=A) ans += dfs(a+1, b, c, x-500);
    if(b<=B) ans += dfs(a, b+1, c, x-100);
    if(c<=C) ans += dfs(a, b, c+1, x-50);
    return ans;
}

int main(void)
{
    cin >> A >> B >> C;
    int X;
    cin >> X;
    int ans = 0;
    REP(a, A+1){
        REP(b, B+1){
            REP(c, C+1){
                if(a*500+b*100+c*50 == X) ans++;
            }
        }
    }
    pr(ans);
}

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

using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=b-1LL;i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

long long gcd(long long a, long long b){
  return b == 0LL ? a : gcd(b, a % b);
}

int main() {
  ll n,m;
  cin>>n>>m;
  string s1,s2;
  cin>>s1>>s2;
  ll a = gcd(n,m);
  ll index1 = 0;
  ll index2 = 0;
  ll flag = 1;
  while(1){
    if(index1>=n)break;
    if(index2>=m)break;
    if(s1[index1]!=s2[index2])flag = 0;
    index1 += n/a;
    index2 += m/a;
  }
  if(flag==0){
    cout << -1 << endl;
    return 0;
  }
  cout << n*m/a << endl;
  return 0;
}

Measured memory_bytes: 512
#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>;
using Graph = vector<vector<int>>;

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

int main(){
    int h, w, counter=0;
    cin >> h >> w;
    int check=h*w;
    int s[h][w];
    queue<pair<int,int>> que;
    rep(i,h){
        rep(j,w){
            char x;
            cin >> x;
            if(x=='#'){
                s[i][j]=1;
                que.push({i,j});
                ++counter;
                --check;
            }else if(x=='.'){
                s[i][j]=2;
            }
        }
    }
    int counter1=0, ans=0;
    if(check==0){
        cout << 0 << "\n";
        return 0;
    }
    while(!que.empty()) {
        if(counter==0){
            counter=counter1;
            ++ans;
            if(check==0){
                cout << ans << "\n";
                return 0;
            }
            counter1=0;
        }
        int u=que.front().first, v=que.front().second;
        que.pop();
        --counter;
        rep(i,4) {
            if(u+dy[i]<0 || v+dx[i]<0 || u+dy[i]>=h || v+dx[i]>=w) continue;
            if(s[u][v]==1 && s[u+dy[i]][v+dx[i]]==2) {
                s[u+dy[i]][v+dx[i]] = 1;
                --check;
                que.push({u+dy[i],v+dx[i]});
                ++counter1;
            }
        }
    }
    return 0;
}

Measured memory_bytes: 12304
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n,m;
    cin >> n >> m;
    int ans = 1;
    for(int i = 0;i < n;i++){
        if(ans*2 <= ans + m){
            ans *= 2;
        }else{
            ans += m;
        }
    }
    
    cout << ans << endl;
    
}


Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
//#include <bits/stdc++.h>
#include<vector>
#include<float.h>
#include<iomanip>
#include<algorithm>
#include<string>
#include<cstring>
#include<math.h>
#include<cmath>
#include<sstream>
#include<set>
#include<map>
#include<queue>
#include <cassert>
#include <cmath>
#include<cstdint>

#define INF 1e9
#define rep(i,n)for(int i=0;(i)<(int)(n);i++)
#define REP(i,a,b)for(int i=(int)(a);(i)<=(int)(b);i++)
#define VEC(type, c, n) std::vector<type> c(n);for(auto& i:c)std::cin>>i;
#define vec(type,n) vector<type>(n)
#define vvec(m,n) vector<vector<int>> (int(m),vector<int>(n))
#define ALL(a)  (a).begin(),(a).end()

using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;

vector<int>bitSearch(int bit,int n){
    vector<int>S;
    rep(i,n)if(bit&(1<<i))S.push_back(i);
    return S;
}


int main(){
    int n;cin>>n;
    vector<int>h(n);
    int mx = 0;
    rep(i,n){
        cin>>h[i];
        mx = max(mx,h[i]);
    }
    h.push_back(0);
    int res = 0;
    int cnt = 1;
    while(cnt<=mx){
        int f = 0;
        rep(i,n+1){
            if(h[i]>=cnt)f++;
            else if(h[i]<cnt && f>0){
                res++;
                f = 0;
            }
        }
        cnt++;
    }
    cout<<res;
}



Measured memory_bytes: 256
N = int(input())
student_list = list(map(int, input().split()))
turn_list = []

for i in range(N):
	turn_list.append([student_list[i], i+1]) # 何番目に, 誰が

turn_list.sort()
for i in range(N-1):
	print('{} '.format(turn_list[i][1]), end='')
print(turn_list[N-1][1])


Measured memory_bytes: 21440
import java.util.Scanner;


// ?????????????????????????????????????????????????????????
public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		boolean same = false; 
		Dice[] dice = new Dice[n];
		int[] array = new int[6 + 1];
		array[0] = 0;
		for (int i = 0; i < n; i++) {
			for (int j = 1; j < 7; j++) {
				array[j] = scan.nextInt();
			}
			dice[i] = new Dice(array);
		}
		for (int i = 0; i < n - 1; i++) {
			for (int j = i + 1; j < n; j++) {
				array = dice[j].getNum();
				if (dice[i].check(array)) {
					same = true;
					break;
				}
			}
			if (same) break;
		}
		if (same) {
			System.out.println("No");
		} else {
			System.out.println("Yes");
		}
	}
}
	

class Dice {
	private int[] num = new int[6 + 1];
	Dice() {
	}

	Dice(int[] array) {
		for (int i = 0; i < array.length; i++) {
			this.num[i] = array[i];
		}
	}
	
	public int[] getNum() {
		return this.num;
	}
	
	public int getNumber(int i) {
		return this.num[i];
	}
	
	// ??????????????¢??????????????????
	public int[] roll(int[]ary, String order) {
		int now_1 = 1;	int now_2 = 2;	int now_3 = 3;	int tmp;
		int[] array = ary;
		char[] check = {'N', 'E', 'S', 'W'};
		for (int i = 0; i < order.length(); i++) {
			for (int j = 0; j < check.length; j++) {
				if (order.charAt(i) == check[j]) {
					switch (j + 1) {
						case 1:
							tmp = now_1;
							now_1 = now_2;
							now_2 = 7 - tmp;
							break;
						case 2:
							tmp = now_1;
							now_1 = 7 - now_3;
							now_3 = tmp;
							break;
						case 3:
							tmp = now_1;
							now_1 = 7 - now_2;
							now_2 = tmp;
							break;
						case 4:
							tmp = now_1;
							now_1 = now_3;
							now_3 = 7 - tmp;
							break;
					}
				}
			}
		}
		int[] cp_array = new int[array.length];
		cp_array[1] = array[now_1]; cp_array[2] = array[now_2];
		cp_array[3] = array[now_3]; cp_array[4] = array[7 - now_3];
		cp_array[5] = array[7 - now_2]; cp_array[6] = array[7 -now_1];
		return cp_array;
	}
	
	
	// ??????????????????????????????????????????
	public boolean check(int[] tarary) {
		int[] ary = tarary;
		String[] str = {"null", "N", "N", "N", "E", "WW"};
		int sum = 0;
		int[] array = new int[this.num.length];
		for (int i = 0; i < this.num.length; i++) {
			array[i] = this.num[i];
		}
		boolean decision = false;
		for (int i = 0; i < str.length; i++) {
			array = this.roll(array, str[i]);
			for (int j = 0; j < 4; j++) {
				if (array[1] == ary[1]) {
					if (array[2] == ary[2]) {
						for (int k = 3; k < ary.length; k++) {
							
							if (array[k] != ary[k]) {
								decision = false;
								break;
							}
							decision = true;
						}
					}
					if (decision) {
						break;
					} else {
						array = this.roll(array, "NWS");
					}
				} else {
					break;
				}
			}
			if (decision) break;
		}
		

		return decision;
	}
}

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

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;

typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef long double ld;

const ll mod = (ll)1e9 + 7;
const ll mxN = 200200;




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

	ll n,k;
	cin>>n>>k;
	cout<<min(n%k,abs((n%k)-k));

}


Measured memory_bytes: 3644
#!/usr/bin/env python3

#(a^b) % (1e9 + 7)を求める
def powmod(a, b):
    result = 1;
    for i in range(b):
        result *= a
        result %= 1e9 + 7
    return result


n = int(input())

if n == 1:
    print(0)
elif n == 2:
    print(2)
else:
    # print(10 ** n - 2 * (9 ** n) + 8 ** n)
    r = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n)
    r = int(r % (1e9 + 7))
    print(r)




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

int main()
{
	char c;
	string str;
	int n,A,B,AB,O; 
	
	A=B=AB=O=0;
	while(cin >> n >> c>> str)
	{
		if(str=="A") A++;
		if(str=="B") B++;
		if(str=="O") O++;
		if(str=="AB") AB++;
	}
	cout << A << endl;
	cout << B << endl;
	cout << AB << endl;
	cout << O << endl;
}

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

int main(){
    int n,m;
    cin >> n >> m;
    if(m == 1){
        int a;
        cin >> a;
        cout << max(a-1,n-a) << endl;
        return 0;
    }
    vector<int> a(m);
    for(int i = 0; i < m; i++){
        cin >> a[i];
    }
    int ans = 0;
    for(int i = 0; i < m-1; i++){
        ans = max(ans,(a[i+1]-a[i])/2);
    }
    ans = max(ans,max(a[0]-1,n-a[m-1]));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3208
import sys
sys.setrecursionlimit(10**7)
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    n, *a = map(int, read().split())
    r = 0
    st = a[0]
    for ae in a[1:]:
        if st > ae:
            r += st - ae
        else:
            st = ae
    print(r)


if __name__ == '__main__':
    main()

Measured memory_bytes: 110368
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  ll a, b, c;
  cin >> a >> b >> c;
  if(c - a - b > 0 && 4*a*b < (c-a-b)*(c-a-b)) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  
  int s=1;
  
  for (int i=0; i<N ; i++) {
    if (s<=K) {
      s = s * 2;
    }
    else if (s>K) {
      s = s + K;
    }
  }
  cout << s <<endl;
}
  

Measured memory_bytes: 3600
#include<stdio.h>
#include<math.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int a[102];
    for (i = 0; i < n; i++)
        scanf("%d", &a[i]);
    double sum = 0;
    for (i = 0; i < n; i++)
        sum += a[i];
    sum /= n;
    int ans = 0;
    for (i = 0; i < n; i++)
        if (fabs(sum - a[ans]) > fabs(sum - a[i]))
            ans = i;
    printf("%d\n", ans);
    return 0;
}

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

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 1
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)

signed main(){

	lli n;
	cin>>n;
	vector<lli> a(n);
	lli mCnt=0;
	REP(i,0,n){
		cin>>a[i];
		if(a[i]<0){
			mCnt++;
			a[i]*=-1;
		}
	}

	sort(a.begin(),a.end());
	lli ans=0;
	REP(i,0,n){
		if(i==0 && mCnt%2==1){
			ans-=a[i];
		}
		else{
			ans += a[i];
		}
	}
	cout<<ans<<endl;


	return 0;
}

Measured memory_bytes: 1024
#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 ans = 1e18;

  for(ll i = 1; i <= 100; i++){
    ll tmp_sum = 0;
    for(ll j = 0; j < N; j++){
      tmp_sum += (X[j] - i) * (X[j] - i);
    }
    ans = min(ans, tmp_sum);
  }

  cout << ans << endl;
}

Measured memory_bytes: 384
N, M = map(int, input().split())
X = list(map(int, input().split()))

x = sorted(X)
x_diff = [(x[m] - x[m - 1]) for m in range(1, M)]
x_diff.sort(reverse=True)

print((x[-1] - x[0]) - sum(x_diff[:N - 1]))


Measured memory_bytes: 13968
nn=int(input())
aa=list(map(int,input().split()))
a=[x for x in aa if x!=1]
n=len(a)
if n<=1:
  print('pairwise coprime')
  exit()

# 素因数分解
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
      cnt=0
      while temp%i==0:
        cnt+=1
        temp //= i
      arr.append([i, cnt])
  if temp!=1:
    arr.append([temp, 1])
  if arr==[]:
    arr.append([n, 1])
  return arr
tmp=[i for i,j in factorization(min(a))]
not_flg=False
for t in tmp:
  flg=True
  for x in a:
    if x%t==0:
      pass
    else:
      flg=False
      break
  if flg:
    not_flg=flg
    break
if not_flg:
  if n==nn:
    print('not coprime')
  else:
    print('setwise coprime')
  exit()
#if n>78499:
if n>99999:
  print('setwise coprime')
  exit()
ary=set(())
for x in a:
  tmp={i for i,j in factorization(x)}
  for t in tmp:
    if t in ary:
      print('setwise coprime')
      exit()
    else:
      ary.add(t)
print('pairwise coprime')


Measured memory_bytes: 220116
//<方針>
//使用禁止数字の配列を作成しチェックさせる
//一番下の桁の数字を抽出し処理する
//一番下の桁を削除する
//全ての桁を処理し終わったら終了 （/=10 がゼロ）

#include<stdio.h>
int main() {
	int N, K;
	scanf("%d%d", &N, &K);
	int *D = (int *)malloc(sizeof(int)*K);
	int num[10] = { 0 };
	for (int i = 0; i < K; i++)
	{
		scanf("%d", &D[i]);
		num[D[i]] = 1;
	}
	for (int ans = N; ; ans++)
	{
		int NN = ans;
		while (1) {
			if (num[NN % 10] == 1) {
				break;
			}
			NN /= 10;
			if (NN == 0)
			{
				printf("%d\n", ans);
				return 0;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 128
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

int main() {
	string s; cin >> s;
	
	bool f=false, ans=false;
	for (int i = 0; i < s.length(); i++) {
		if (s[i] == 'C') {
			f=true;
		}
		if (s[i] == 'F' && f) {
			ans=true;
		}
	}

	cout << (ans?"Yes":"No") << endl;
}

Measured memory_bytes: 256
X,Y,A,B,C=map(int,input().split())
P = [int(i) for i in input().split()]
Q = [int(i) for i in input().split()]
R = [int(i) for i in input().split()]

S = P + Q + R
S = sorted(S)

a = 0
for i in range(A):
  if P[i] >= S[A+B+C-(X+Y)]:
    a += 1

b = 0
for i in range(B):
  if Q[i] >= S[A+B+C-(X+Y)]:
    b += 1

if a <= X and b <= Y:
  c = 0
  for i in range(A+B+C-(X+Y),A+B+C,1):
    c += S[i]
  print(c)
elif a > X:
  c = 0
  P = sorted(P)
  for i in range(A-X,A,1):
    c += P[i]
  T = Q + R
  T = sorted(T)
  for i in range(B+C-Y,B+C,1):
    c += T[i]
  print(c)
else:
  c = 0
  Q = sorted(Q)
  for i in range(B-Y,B,1):
    c += Q[i]
  U = P + R
  U = sorted(U)
  for i in range(A+C-X,A+C,1):
    c += U[i]
  print(c)  

Measured memory_bytes: 24028
using System;

namespace ABC136
{
    class C
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            string[] input = Console.ReadLine().Split(' ');

            int[] H = new int[N];
            for (int i = 0; i < N; i++)
            {
                H[i] = int.Parse(input[i]);
            }

            int temp = H[0];
            for (int i = 1; i < N; i++)
            {

                if (H[i] <= temp - 2)
                {
                    Console.WriteLine("No");
                    return;
                }

                if (temp < H[i])
                {
                    temp = H[i];
                }
            }
            Console.WriteLine("Yes");
        }
    }
}


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

using namespace std;

int main() {
    int a, b, c, d, p;
    cin >> a >> b >> c >> d >> p;
    if (p <= c) {
        cout << min(a * p, b) << '\n';
    } else {
        cout << min(a * p, b + (p - c) * d) << '\n';
    }
}


Measured memory_bytes: 3080
#include<stdio.h>
int main(){
  int i,j,n,a[101][101],b[100],c,k;
  for(i=0;i<=100;i++){
    for(j=0;j<=100;j++){
      a[i][j]=0;
    }
  }
  scanf("%d",&n);
  for(i=1;i<=n;i++){
    scanf("%d",&b[i]);
    scanf("%d",&k);
    for(j=0;j<k;j++){
      scanf("%d",&c);
      a[b[i]][c]=1;
  }
  }
  
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      if(j!=1)printf(" ");
      printf("%d",a[i][j]);
    }
    printf("\n");
    }
  return 0;
}

Measured memory_bytes: 644
#include<iostream>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, ll> pll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef long double ld;
#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

// const ll mod = 1e9 + 7;
const ll mod = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

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

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

ll id(char c) {
	return c - 'a';
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

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

	vi D(N);
	rep(i, N) {
		cin >> D[i];
	}

	rep(i, N-1) {
		repa(k, i+1, N) {
			ans += D[i] * D[k];
		}
	}

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

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    rep(i, 1, N + 1) {
        double x = i * 1.08;
        int X = floor(x);
        if (X == N) {
            cout << i << endl;
            return 0;
        }
    }
    cout << ":(" << endl;
    return 0;
}

Measured memory_bytes: 256