akhauriyash/Code-Regression huggingface dataset:
/*        ,---,
               / _=_ \.~
              (,(OvO),) ##}
             ,-\(-"-) /{ #)\
             {  '---'  (   }\_
             {{ ).___|__( '}}  \_
             {  )       (  }}    \
             {  /        \ }}    /
             {  )       (  }  /  /
             ((_'_     _'_))_,\__\
       */
    // ____      _                _          _      _                  _                         _      
    //|  _ \ ___| |_ __ _ _ __ __| | ___  __| |    / \   _ __   ___    | | ____ _    ___ ___   __| | ___ 
    //| |_) / _ \ __/ _` | '__/ _` |/ _ \/ _` |   / _ \ | '_ \ / _ \   | |/ / _` |  / __/ _ \ / _` |/ _ \
    //|  _ <  __/ || (_| | | | (_| |  __/ (_| |  / ___ \| |_) |  __/   |   < (_| | | (_| (_) | (_| |  __/
    //|_| \_\___|\__\__,_|_|  \__,_|\___|\__,_| /_/   \_\ .__/ \___|   |_|\_\__,_|  \___\___/ \__,_|\___|
    // 

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

int b[100000];

ll haha(int a[], int n){
    if (b[n] != -1) return b[n];
    if(n == 2){
        if(abs(a[2]-a[0])> abs(a[2]-a[1]) + abs(a[1]- a[0])) return abs(a[2]-a[1]) + abs(a[1]- a[0]);
        return abs(a[2]-a[0]);
    }
    if(n==1) return abs ((a[0] - a[1]));
    b[n] = min ((abs(a[n]-a[n-1]) + haha(a, n-1)), (abs(a[n]-a[n-2]) + haha(a, n-2)));
    return b[n];


}

int main(){
    for(int i = 0; i<100000; i++){
        b[i] = -1;
    }
    int n; cin >> n;
    int a[n];
    for(int i =0; i<n; i++){
        cin >> a[i];
    }
    cout << haha(a, n-1);

}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
typedef long long ll;

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  double sum=0.0;
  rep(i,n){
    cin >> a.at(i);
    sum+=a.at(i);
  }
  double ave=sum/n;

  int ans=0;
  if(ave-floor(ave)<=0.5){
    ans=floor(ave);
  }else{
    ans=floor(ave)+1;
  }

  int sum2=0;
  rep(i,n){
    sum2+=pow(a.at(i)-ans,2);
  }
  cout << sum2 << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define M_PI       3.14159265358979323846
#define Speed_UP  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define 	pb	push_back 
#define 	ff	first 
#define 	ss	second 
#define sz(x) (int)x.size()
#warning Remeber to change t
using namespace std;
typedef long long ll;
inline void setIO(string name="") {
	#ifndef ONLINE_JUDGE 
	freopen((name+".in").c_str(), "r", stdin); 
	freopen((name+".out").c_str(), "w", stdout);
	#endif
	}

int main(){
	Speed_UP
  ll n;
  cin>>n;
	pair<ll,ll>arr[n];
  for(int i=0;i<n;i++)
    cin>>arr[i].ff>>arr[i].ss;
  ll arr1[n],arr2[n];
  
  for(int i=0;i<n;i++){
    arr1[i]=arr[i].ff+arr[i].ss;
  }
  for(int i=0;i<n;i++){
    arr2[i]=arr[i].ff-arr[i].ss;
  }
  sort(arr1,arr1+n);
  sort(arr2,arr2+n);
  ll ans=-1;
  ans=max(arr1[n-1]-arr1[0],arr2[n-1]-arr2[0]);
  cout<<ans;




}


Measured memory_bytes: 9876
#include <iostream>
#include <vector>
//#include<bits/stdc++.h>
#include <algorithm>
using namespace std;

int main(){
  char a, ans;
  cin >> a;
  if(a == 'A')ans = 'T';
  if(a == 'T')ans = 'A';
  if(a == 'C')ans = 'G';
  if(a == 'G')ans = 'C';
  
  cout << ans << endl;
}

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

using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.setf(ios_base::fixed);
	cout.precision(8);

	int x[100], t, n;
	int d1=0, di=0, d2=0;
	long long d3=0;
	cin>>n;
	for(int i=0; i<n; i++) {
		cin>>x[i];
	}
	for(int i=0; i<n; i++) {
		cin>>t;
		t = abs(t-x[i]);
		d1+=t;
		d2+=t*t;
		d3+=t*t*t;
		di=max(di, t);
	}
	cout<<d1<<'\n';
	cout<<sqrt(d2)<<'\n';
	cout<<pow(d3, 1.0/3.0)<<'\n';
	cout<<di<<'\n';
	return 0;
}



Measured memory_bytes: 3488
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
	int a,b;
	double resa,resb; 
	cin>>a>>b;
	resa=12.5*a;
	resb=10*b;
	int i,j,flag=0;
	if(resb>=(resa+12.5)||(resb+10)<=resa)
		cout<<"-1"<<endl;
	else 
	{
		
		for(i=0;i<10;resb++)
	{
		if(resb>=resa&&resb<(resa+12.5))
		{
			flag=1;
			break;
		}

	}
	if(flag)cout<<resb<<endl;
	else cout<<"-1"<<endl;
	
	}

	
	
	return 0;
}

Measured memory_bytes: 256
///Bismillahir Rahmanir Rahim
#include "bits/stdc++.h"

#define                           ll                          long long
#define                           int                         ll
#define                           fi                          first
#define                           si                          second
#define                           mp                          make_pair
#define                           pb                          push_back
#define                           pi                          pair<ll,ll>
#define                           clr(x)                      memset(x,0,sizeof(x));
#define                           f(i,l,r)                    for(int i=l;i<=r;i++)
#define                           rf(i,r,l)                   for(int i=r;i>=l;i--)
#define                           done(i)                     cout<<"done = "<<i<<endl;
#define                           show(x,y)                   cout<<x<<" : ";for(auto z:y)cout<<z<<" ";cout<<endl;
#define                           fast                        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

using namespace std;

const ll inf=1e18;
const int mod=1e9+7;
const int M=100005;

inline ll bigmod(ll B,ll P){ll R=1;while(P>0){if(P&1){R=(R*B)%mod;}P>>=1;B=(B*B)%mod;}return R;}
inline ll ad(ll x,ll y){ll ret=(x%mod+y%mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll sub(ll x,ll y){ll ret=((x%mod)-(y%mod)+mod)%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}
inline ll gun(ll x,ll y){ll ret=((x%mod)*(y%mod))%mod;if(ret<0){ret+=mod,ret=ret%mod;}return ret;}

const int N = 1e6 + 100;
namespace Combi {
    int fact[N], inv[N];

    int bm(int b, int p, int m) {
        if(p == 0) return 1%m;
        int t = bm(b,p/2,m);
        t = (1ll*t*t)%m;
        if(p&1) return 1ll*t*b%m;
        return t;
    }

    int C(int n, int r) {
        if(n < 0 or r < 0 or r > n) return 0;
        int ret = 1ll*fact[n]*inv[r]%mod;
        ret = 1ll*ret*inv[n-r]%mod;
        return ret;
    }
    // X1 + X2 + ... + Xvar = Sum
    int no_of_eqns(int sum, int var) {
        return C(sum+var-1,var-1); // Xi >= 0
        // return C(sum-1,var-1); // Xi > 0
    }
    void init() {
        fact[0] = 1;
        for(int i = 1; i < N; i++) {
            fact[i] = 1ll*fact[i-1]*i%mod;
        }
        inv[N-1] = bm(fact[N-1], mod-2, mod);
        for(int i = N-2; i >= 0; i--) {
            inv[i] = 1ll*inv[i+1]*(i+1)%mod;
        }
    }
}

int yo(int x1,int y1,int x2,int y2)
{
    int r=x2-x1;
    int c=y2-y1;
    int lob=Combi::fact[r+c];
    int ret=gun(lob,Combi::inv[r]);
    ret=gun(ret,Combi::inv[c]);
    return ret;
}
 main()

{
    fast
    Combi::init();
    int h,w,a,b;
    cin>>h>>w>>a>>b;
    int ses=0;
    for(int r=1;r<=h-a;r++)
    {
        int x=gun(yo(1,1,r,b),yo(r,b+1,h,w));
        ses=ad(ses,x);
    }
    cout<<ses<<endl;
    return 0;

}





































Measured memory_bytes: 19220
#include<bits/stdc++.h>
#define ll long long int
#define fl(i,x,y) for( int i=x;i<y;i++)
#define w(t) while(t--)
#define vi vector<ll>
#define vvi vector< vi >
#define si set<ll>
#define msi multiset<ll>
#define si_d set<ll, greater<ll> >
#define mii map<ll,ll>
#define pb push_back
#define msi_it  multiset<ll> :: iterator
#define si_it set<ll> :: iterator
#define sort1(v) sort(v.begin(),v.end());
#define F first
#define S second
using namespace std;
#define N 1000000007
#define mod 15000000000031
int main()
{
	int a,b,d=0;
	cin>>a>>b;
	fl(i,1,1300)
	{
	    if(i*8/100==a && i*10/100==b) {cout<<i;d=1;break;}
	}
	if(d==0) cout<<-1;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
  int flag=0;
    while(n!=0){
        int digi=n%10;
        if(digi==7){
            cout<<"Yes";
            flag=1;
          	break;
        }
        n=n/10;
    }
    if(flag!=1)
    cout<<"No";
    return 0;
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pint pair<int, int>
#define plint pair<ll, ll>
#define ALL(x) (x).begin(), (x).end()
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i,n) for (int i = 0; i < (n); ++i)
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int main(){
    int n,sum,min=100*100*100;
    cin >> n;
    vector<int >  x(n);
    REP(i,n) cin >> x[i];
    REP(p,100){
        sum = 0;
        REP(i,n){
            sum += abs(p+1 - x[i])*abs(p+1 - x[i]);
        }
        if(min>=sum){
            min = sum;
        }
    }
    cout << min << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
readline = sys.stdin.readline

D = int(readline())
C = list(map(int,readline().split()))
S = [None] * D
for i in range(D):
  s = list(map(int,readline().split()))
  S[i] = s
  
def calc_score(arr):
  point = 0
  last_submit = [-1] * 26
  for i in range(len(arr)):
    point += S[i][arr[i]]
    last_submit[arr[i]] = i
    for j in range(len(last_submit)):
      point -= (i - last_submit[j]) * C[j]
    print(point)
  return point

T = [None] * D
for i in range(D):
  T[i] = int(readline()) - 1
  
ans = calc_score(T)


Measured memory_bytes: 74180
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<math.h>
#include<map>
#include<functional>
#include<queue>
#include<stack>
#include<string.h>
#define ll long long int
#define MOD 1000000007LL
using namespace std;
int main() {
	long long int a, b, c;
	cin >> a >> b >> c;
	ll ans;
	if ((a % 2 == 0) || (b % 2 == 0) || (c % 2 == 0)) {
		ans = 0;
	}
	else {
		ans=min(min(a*b, b*c), a*c);
	}
	cout << ans << endl;
}


Measured memory_bytes: 256
A = str(input())
B = str(input())
C = str(input())

turn = "A"
while True:
  if turn == "A":
    if len(A) == 0:
      print(turn)
      break
    turn = A[0].upper()
    A = A[1:len(A)]
  elif turn == "B":
    if len(B) == 0:
      print(turn)
      break
    turn = B[0].upper()
    B = B[1:len(B)]
  else:
    if len(C) == 0:
      print(turn)
      break
    turn = C[0].upper()
    C = C[1:len(C)]


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

int N, M;

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

	cin >> N >> M;

	for (int i = N;i <= M;i++){
		if(M%i == 0){ cout << M/i << endl; break;}
		if(i*2 > M){ cout << 1 << endl; break;}
	}

	return 0;

}


Measured memory_bytes: 256
h,w,k = map(int,input().split())
s = [input() for _ in range(h)]
data_yoko = [[0]*(w+1) for _ in range(h)]
for i in range(w):
    for j in range(h):
        if s[j][i] == "1":
            data_yoko[j][i+1] = 1
        data_yoko[j][i+1] += data_yoko[j][i]
data_tate = [[0]*w for _ in range(h+1)]
for i in range(h):
    for j in range(w):
        if s[i][j] == "1":
            data_tate[i+1][j] = 1
        data_tate[i+1][j] += data_tate[i][j]

ans = h*w
for case in range(2**(h-1)):
    now = 0
    use = []
    for bit in range(h-1):
        if case>>bit & 1:
            use.append(bit+1)
            now += 1
    use.append(h)
    left = [0]*len(use)
    pre = -1
    check1 = True
    check2 = True
    for i in range(w):
        for j in range(len(use)):
            to = data_tate[use[j]][i] if j == 0 else data_tate[use[j]][i]-data_tate[use[j-1]][i]
            if k < to:
                check1 = False
                break
            if to + left[j] > k:
                check2 = False
                break
            left[j] += to
        if not check1:
            break
        if check2:
            continue
        for j in range(len(use)):
            left[j] = data_tate[use[j]][i] if j == 0 else data_tate[use[j]][i]-data_tate[use[j-1]][i]
        now += 1
        check2 = True
    if check1:
        ans = min(ans,now)

print(ans)

Measured memory_bytes: 45532
N,A,B=map(int,input().split())
S=input()
student=0
abroad=0
for i in range(len(S)):
    if S[i]=='c':
        print('No')
    
    if S[i]=='a':
        if student<(A+B):
            print('Yes')
            student+=1
        else:
            print('No')
    
    if S[i]=='b':
        if student<(A+B) and abroad<B:
            print('Yes')
            student+=1
            abroad+=1
        else:
            print('No')

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

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
 
int main(){
    ll N, T, A, H[1100];

    cin >> N >> T >> A;
    for(int i = 0; i < N; i++) cin >> H[i];

    double tmp = 1e9;
    ll ans = 0;
    for(int i = 0; i < N; i++){
        double t = (double)T - (double)H[i]*6/1000;

        if(abs(A-t) < tmp ){
            tmp = abs(A-t);
            ans = i;
        }
        
    }

    cout << ans + 1 << endl;

    return 0;
}

Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    A = [il() for _ in range(3)]
    B = []
    for _ in range(3):
        B.append([False, False, False])

    N = ii()
    for n in range(N):
        b = ii()
        for i in range(3):
            for j in range(3):
                if A[i][j] == b:
                    B[i][j] = True

    for i in range(3):
        if B[i][0] and B[i][1] and B[i][2]:
            print('Yes')
            exit()
    for j in range(3):
        if B[0][j] and B[1][j] and B[2][j]:
            print('Yes')
            exit()
    if (B[0][0] and B[1][1] and B[2][2]) or (B[0][2] and B[1][1] and B[2][0]):
        print('Yes')
        exit()

    print('No')


if __name__ == '__main__':
    main()


Measured memory_bytes: 10244
//q6.cpp
//Sat Aug  8 10:08:39 2020

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
#define MOD 1000000007
#define rep(i,n) for (int i=0;i<(n);++i)

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

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

	int mae[n][10],ushiro[n][10];
	rep(i,n){
		rep(j,10){
			mae[i][j] = 0;
			ushiro[i][j] = 0; 
		}
	}

	rep(i,n){
		if (i>0){
			rep(j,10){
				mae[i][j] = mae[i-1][j];
			}
		}
		mae[i][int(s[i]-'0')]++;
	}

	for (int i=n-1;i>=0;i--){
		if(i<n-1){
			rep(j,10){
				ushiro[i][j] = ushiro[i+1][j];
			}
		}
		ushiro[i][int(s[i]-'0')]++;
	}

	int count[1000];
	fill(count,count+1000,0);
	for (int i=1;i<n-1;i++){
		int center = int(s[i]-'0')*10;
		rep(j,10)rep(k,10){
			if (mae[i-1][j]!=0 && ushiro[i+1][k]!=0){
				int tmp = 100*j+center+k;
				count[tmp]++;
			}
		}
	}

	int ans = 0;
	rep(i,1000){
		if (count[i]!=0) ans++;
	}

	cout << ans << endl;
//	printf("%.4f\n",ans);
}

Measured memory_bytes: 5980
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 1e5 + 10;
const int mod = 1e9+7;
const int INF=0x3f3f3f3f;

ll vis[3010][3010];
ll dp[3010][3010][4];
void solve() {
    int r,c,t;
    cin>>r>>c>>t;
    for(int i=0;i<t;i++){
        int a,b,c;
        cin>>a>>b>>c;
        vis[a][b]=c;
    }
    for(int i=1;i<=r;i++) {
        for (int j = 1; j <= c; j++) {
            for (int k = 1; k < 4; k++) {
                dp[i][j][k] = max(dp[i][j][k], dp[i - 1][j][3] + vis[i][j]);
                dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);
                dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k - 1] + vis[i][j]);
            }
        }
    }
    ll res=0;
    for(int i=0;i<4;i++){
        res=max(res,dp[r][c][i]);
    }
    cout<<res;
}

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


Measured memory_bytes: 356312
/*
Website : https://atcoder.jp/contests/abc145/tasks/abc145_f
Problem : F - Laminate
Method  : dp
Status  : 
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int inf=1e18;
const int maxn=305;
inline int read() {
	int x(0),neg(1);char ch(getchar());
	while(!isdigit(ch)) {
		if (ch=='-') neg=-1;
		ch=getchar();
	}
	while(isdigit(ch)) {
		x=(x<<1)+(x<<3)+(ch^48);
		ch=getchar();
	}
	return x*neg;
}
int dp[maxn][maxn];
int n,k;
int num[maxn];
signed main() {
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	n=read(),k=read();
	for (int i=1;i<=n;++i) num[i]=read();
	for (int i=1;i<=n;++i) dp[i][1]=num[i];
	for (int i=1;i<=n;++i) {
		for (int j=2;j<=n-k;++j) {
			dp[i][j]=inf;
			for (int l=1;l<i;++l) {
				dp[i][j]=min(dp[i][j],dp[l][j-1]+max(0ll,num[i]-num[l]));
			}
		} 
	} 
	int ans=inf;
	for (int i=1;i<=n;++i) {
		ans=min(ans,dp[i][n-k]);
	}
	printf("%lld\n",ans);
	return 0;
}


Measured memory_bytes: 1024
#include<algorithm>
#include<array>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<iso646.h>
#include<queue>
#include<stack>
#include<string>
#include<vector>

using std::cin;
using std::cout;
using std::endl;

#define FOR(counter,initial_value,condition) for(int counter = initial_value; counter < condition;counter++)

int main()
{
	std::string s;
	cin >> s;
	if (s[0] == '9' or s[1] == '9') {
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <map>
#include <iomanip>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <time.h>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;
 
const ll nmax = 1e9 + 7;
const ll Mod = 998244353;
const double PI = 2 * asin(1);

int N, S, A[3005];
ll DP[3005][3005];

int main(){

  scanf("%d%d", &N, &S);
  for (int i = 1; i <= N; i++) scanf("%d", &A[i]);

  DP[0][0] = 1;
  for (ll i = 1; i <= N; i++){
    for (int j = 0; j <= S; j++){
      DP[i][j] = DP[i-1][j];
    }
    
    if (A[i] > S) continue;
    if (A[i] == S){
      DP[i][S] += i * (N - i + 1);
      DP[i][S] %= Mod;
    }else{
      DP[i][A[i]] += i;
    }

    for (int j = 1; j + A[i] < S; j++){
      DP[i][j + A[i]] += DP[i-1][j];
    }
    if (A[i] < S) DP[i][S] += DP[i-1][S - A[i]] * (N - i + 1);

    for (int j = 0; j <= S; j++){
      DP[i][j] %= Mod;
    }
  }
  printf("%lld\n", DP[N][S]);

  return 0;
}


Measured memory_bytes: 70656
#include<stdio.h>
#include<string.h>

int min(int a, int b);

int main() {
	int len, i, ew, ow, eb, ob;
	char s[110000];

	scanf("%s", &s);
	len = strlen(s);
	
	ew = eb = 0;
	for (i = 0; i < len; i += 2) {
		if (s[i] == '1') ew++;
		else eb++;
	}

	ow = ob = 0;
	for (i = 1; i < len; i += 2) {
		if (s[i] == '1') ow++;
		else ob++;
	}

	printf("%d", min(ew + ob, eb + ow));
}

int min(int a, int b) {
	return (a < b) ? a : b;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define  rep(i, n) for(int i = 0; i < n; i++) 
#define  all(x) (x).begin(),(x).end()     // 昇順ソート
#define  rall(v) (v).rbegin(), (v).rend() // 降順ソート
#define  INF 1LL << 60
typedef long long int LL;
typedef long long int ll;
#define pll pair<ll, ll>
#define F first
#define S second
const int MOD = 1000000007;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return true; } return false; }
//sort(all(x))とするとソートできるよ
// 10^x は pow(10,(x)) 
// 任意のlogは　対数の底の変換を使う    log(N) / log(任意の底)

int main(){
    int N;cin >> N;
    vector<int> H(N);
    rep(i,N)cin >> H[i];
    vector<int> rui(N,0);
    for(int i = N-1;i >= 0;i--){
        if(i == N-1)rui[N-1] = 0;
        else {
            if(H[i] - H[i+1] >= 0){
                rui[i] = rui[i+1] + 1;
            }
            else{
                rui[i] = 0;
            }
        }
    }
    sort(rall(rui));
    cout << rui[0] << endl;
}



Measured memory_bytes: 1152
#include <stdio.h>

int main(void){
    int a,b,c,q;
    int x1,x2,y1,y2,z;
    int flg=0;
    scanf("%d %d",&a,&b);
    x1=1;x2=0;y1=0;y2=1;
    if(a<b){c=a;a=b;b=c;flg=1;}
    while(1){
        q=a/b;c=a%b;
        if(c==0){break;}
        z=x1-x2*q;x1=x2;x2=z;
        z=y1-y2*q;y1=y2;y2=z;
        a=b;b=c;
    }
    if(flg==1){c=x2;x2=y2;y2=c;}
    printf("%d %d\n",x2,y2);
}


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

int H, W;
int h[1000][1000];
int memo[1000][1000];

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

int dfs(int x, int y) {
	if (memo[x][y]) return memo[x][y] - 1;
	int res = x * W + y;
	for (int i = 0; i < 4; i++) {
		int tx = x + dx[i], ty = y + dy[i];
		if (0 <= tx && tx < H && 0 <= ty && ty < W && h[tx][ty] < h[x][y]) {
			auto p = dfs(tx, ty);
			if (p == -2) {
				res = -2;
				break;
			}
			if (res == x * W + y) {
				res = p;
			}
			else if (res != p) {
				res = -2;
				break;
			}
		}
	}
	memo[x][y] = res + 1;
	return res;
}

int main()
{
	cin >> H >> W;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			cin >> h[i][j];
		}
	}
	int res = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			res += dfs(i, j) < 0;
		}
	}
	cout << res << endl;
	return 0;
}



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

using namespace std;

typedef long long ll;
int n,W;
vector<ll> w,v;

ll dp[100][(int)1e5+1] ; 


int main()
{
	int t=1;
	// cin >> t ;

	while(t--)
	{
		for(int i=0 ; i<100 ; i++) 
			for(int j=0 ; j<=1e5 ; j++) dp[i][j] = 0 ;
		cin>>n>>W ;
		w.resize(n);
		v.resize(n);
		for(int i=0 ; i<n ; i++) cin>>w[i]>>v[i] ;

		// cout<<fun(0,W) << endl ;

		for(int i=n-1; i>=0; i--)
			for(int c=0; c<=W; c++)// ? best value in pathars i, i+1, ... n with capacity c.
			{
				if(i+1<n)
					dp[i][c] = dp[i+1][c]; 

				if(c >= w[i])
				{
					if(i+1<n)
						dp[i][c] = max(dp[i][c], v[i]+dp[i+1][c-w[i]]);
					else
						dp[i][c] = v[i];
				}
			}

		cout<<dp[0][W]<<endl;

	}
	return 0;
}

Measured memory_bytes: 78464
# AtCoder Beginner Contest 097
# B - Exponential

X=int(input())

ans = 1

for i in range (1,X):
    for j in range (2,X):
        a=i**j
        if a==a//1 and a > ans and a<=X :
            ans=a
        if a>X:
            break
    if a>X:
        continue
print(ans)

Measured memory_bytes: 9092
#include <iostream>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define nHr(n,r) nCr((int)((n)+(r)-1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
void tmpInit(int *c,ll m) {ll i;rep(i,m) c[i]=i;}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int a[LIMIT2]={0};
  string s;
  
  cin >> n;
  rep(i,n) cin >> a[i];
  result=1000;
  rep(i,n-1){
    if(a[i]<a[i+1]){
      k = result/a[i];
      result %= a[i];
      result += k*a[i+1];
    }
  }
  cout << result << endl;
  
  return 0;
}

Measured memory_bytes: 5584
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int sz = 2e5+5;
ll int arr[sz]={0},arr1[sz]={0};
//ll int arr[100][100]= {0};
int prime[10005]= {0};
vector <ll int> vec,vec1,vec2;
//vector <pair <int,int>> vec;
set<ll int>st;

int main()
{
    ll int a,b,x;
    cin>>a>>b>>x;

    ll int k = b/x;
    ll int l = a/x;
    k++, l++;
    if(a%x==0)
        l--;

    cout<<k-l<<endl;

}


Measured memory_bytes: 3640
<?php
fscanf(STDIN, "%d %d", $a, $b);
if($a === 1){
  $a = 14;
}
if($b === 1){
  $b = 14;
}
if($a === $b){
  echo 'Draw';
}elseif($a > $b){
  echo 'Alice';
}else{
  echo 'Bob';
}
?>

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

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

  if (S == "Sunny")
    cout << "Cloudy" << endl;
  else if (S == "Cloudy")
    cout << "Rainy" << endl;
  else if (S == "Rainy")
    cout << "Sunny" << endl;
  return 0;
}

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

int x,y,nx,ny;

int sol[110][110];

int main()
{
    int dl[5]={0,1,0,-1,0};
    int dc[5]={0,0,1,0,-1};
    int h,w,n;
    cin>>h>>w>>n;
    int i,j,d=1,c;
    x=y=1;
    for(i=1;i<=n;i++)
    {
        cin>>c;
        for(j=1;j<=c;j++)
        {
            sol[x][y]=i;
            nx=x+dc[d];
            ny=y+dl[d];
          //  cout<<dc[d]<<' '<<dl[d]<<' '<<x<<' '<<y<<' '<<nx<<' '<<ny<<'\n';
            if( sol[nx][ny]!=0 || nx<1 || nx>h || ny<1 || ny>w)
            {
                d++;
                if(d==5) d=1;
            }
            //cout<<"d: "<<d<<'\n';
            x+=dc[d];
            y+=dl[d];
        }
    }
    for(i=1;i<=h;i++)
    {
        for(j=1;j<=w;j++) cout<<sol[i][j]<<' '; cout<<'\n';
    }
    return 0;
}



Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
using namespace std;
long long sum ;
int n;
long long dp[3005][3005],a[3005];
int main(){
	cin>>n;
	for(int i=1;n>=i;i++)
		{
			cin>>a[i];
			sum+=a[i];
		}

	for(int i=1;n>=i;i++)
		dp[i][i]=a[i];
	for(int i=2;n>=i;i++)
	{
		for(int j=1;j+i-1<=n;j++)
		{
			dp[j][j+i-1]=max(a[j]-dp[j+1][j+i-1],-dp[j][j+i-2]+a[i+j-1]);
		}
	}
	cout<<dp[1][n];

	return 0;
}


Measured memory_bytes: 70016
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>
#include <functional>
#include <iomanip>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

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

	int n; cin >> n;
	vector<int> cs(n - 1);
	for (auto& c : cs) {
		cin >> c;
	}

	int sum = cs[0];

	FOR_LT(i, 0, n - 2) {
		sum += min(cs[i], cs[i + 1]);
	}
	sum += cs[n - 2];

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
char S[1];
int a=0,z,i=1;
while(cin>>S[0]){
if(a==0 && S[0]=='A')a=i;
if(a!=0 && S[0]=='Z')z=i;
i++;
}
cout<<z-a+1<<endl;
return 0;
}

Measured memory_bytes: 256
# coding: utf-8
# Your code here!
import sys
read = sys.stdin.read
readline = sys.stdin.readline

n,*s = map(int,read().split())

dp = 1
for i in s:
    dp |= dp<<i

#print(bin(dp)[::-1])

ans = 0
for i in range(10010):
    if dp&1 and i%10:
        ans = i    
    dp >>= 1

print(ans)







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

int main()
{
  int N ;
  cin>>N ;
  vector<int>X(N) ;
  for(int i=0;i<N;i++) cin>>X.at(i) ;
  sort(X.begin(),X.end()) ;
  
  int min=1e9 ;
  for(int i=X.at(0);i<=X.at(N-1);i++){
    int sum=0 ;
    for(int j=0;j<N;j++) sum+=(X.at(j)-i)*(X.at(j)-i) ;
    if(sum<min) min=sum ;
  }
  
  cout<<min<<endl ;
  
  return 0 ;
}

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

int main(){
  string S,T;
  cin>>S>>T;
  sort(S.begin(),S.end());
  sort(T.begin(),T.end());
  reverse(T.begin(),T.end());
  if(S<T)
    cout<<"Yes"<<endl;
  else
    cout<<"No"<<endl;
}

Measured memory_bytes: 256
N = int(input())

print(0)
l = str(input())
if l == 'Vacant':
  exit()
print(N-1)
r = str(input())
if r == 'Vacant':
  exit()
  
left, right = 0, N-1
for i in range(20):
  n = (right+left) // 2
  print(n)
  a = str(input())
  if a == 'Vacant':
    exit()
  if (n-left) % 2 == 0:
    if l == a:
      left = n
    else:
      right = n
  else:
    if l == a:
      right = n
    else:
      left = n
      l = a


Measured memory_bytes: 9152
import java.util.Arrays;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		boolean map[][]=new boolean[21][21];
		while(true){
			int n=sc.nextInt();
			if(n == 0) break;
			for(int i=0; i<21; i++) Arrays.fill(map[i], false);
			for(int i=0; i<n; i++){
				int x=sc.nextInt();
				int y=sc.nextInt();
				map[y][x]=true;
			}
			int m=sc.nextInt();
			int nx,ny;
			nx=ny=10;
			for(int i=0; i<m; i++){
				String dir=sc.next();//direction
				int move=sc.nextInt();
				//ここから移動処理。どうやら入力で範囲をはみ出ることはないらしいが、一応そこのチェックを書いておいた。
				//途中でめんどくさくなってmoveの範囲外の処理は書かなかった。
				//処理順が気持ち悪いのは方角と方向の対応を勘違いしてたため。
				if(dir.equals("S")){
					for(int j=0; j<=move; j++){
						if(0 <= ny-j){
							map[ny-j][nx]=false;
						}
					}
					ny-=move;
				}
				else if(dir.equals("E")){
					for(int j=0; j<=move; j++){
						if(nx+j < 21){
							map[ny][nx+j]=false;
						}
					}
					nx+=move;
				}
				else if(dir.equals("N")){
					for(int j=0; j<=move; j++){
						if(ny+j < 21){
							map[ny+j][nx]=false;
						}
					}
					ny+=move;
				}
				else if(dir.equals("W")){
					for(int j=0; j<=move; j++){
						if(0 <= nx-j){
							map[ny][nx-j]=false;
						}
					}
					nx-=move;
				}
//				System.out.println("ny="+ny+" nx="+nx);
			}
			//complet check
			boolean f=false;
			for(int i=0; i<21; i++){
				for(int j=0; j<21; j++){
					if(map[i][j]){
						f=true;
						break;
					}
				}
			}
			if(f) System.out.println("No");
			else System.out.println("Yes");
		}

	}

}

Measured memory_bytes: 34080
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vector<ll>>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
bool chmin(auto &a,auto b){if(a>b){a=b;return true;}return false;}
bool chmax(auto &a,auto b){if(a<b){a=b;return true;}return false;}
void outvi(vi v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
void outvvi(vvi v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n,h,ans=0;cin>>n>>h;
    priority_queue<P> pq;
    rep(i,n){
        rep(j,2){
            ll a;cin>>a;
            pq.push(P(a,j));
        }
    }
    while(h>0){
        auto q=pq.top();pq.pop();
        if(q.se){
            h-=q.fi;
            ans++;
        }
        else{
            ans+=(h-1)/q.fi+1;
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 6384
#include<iostream>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
const ll half=(mod+1)/2;
int n,q;
int a[3001];
int x[3001],y[3001];
int p[3001][3001];
ll ax[3001];
ll xb[3001];
ll p2q=1;
int main(){
	ios::sync_with_stdio(false);
	cin >> n >> q;
	for(int i=1; i<=n ;i++) cin >> a[i];
	for(int i=1; i<=q ;i++){
		p2q=p2q*2%mod;
		cin >> x[i] >> y[i];
		if(x[i]>y[i]) swap(x[i],y[i]);
	}
	for(int i=1; i<=n ;i++){
		for(int j=1; j<=n ;j++){
			p[i][j]=(i>j);
		}
	}
	for(int i=q; i>=1 ;i--){
		ll orz=(p[x[i]][y[i]]+p[y[i]][x[i]])*half%mod;
		for(int j=1; j<=n ;j++){
			ax[j]=(p[x[i]][j]+p[y[i]][j])*half%mod;
			xb[j]=(p[j][x[i]]+p[j][y[i]])*half%mod;
		}
		for(int j=1; j<=n ;j++){
			p[x[i]][j]=p[y[i]][j]=ax[j];
			p[j][x[i]]=p[j][y[i]]=xb[j];
		}
		p[x[i]][y[i]]=p[y[i]][x[i]]=orz;
	}
	ll ans=0;
	for(int i=1; i<=n ;i++){
		for(int j=i+1; j<=n ;j++){
			if(a[i]==a[j]) continue;
			if(a[i]<a[j]) ans=(ans+p[i][j])%mod;
			else ans=(ans+mod+1-p[i][j])%mod;
		}
	}
	cout << ans*p2q%mod << endl;
}

Measured memory_bytes: 35456
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int ans = 100000000;
        for (int i = 0; i < s.length()-2; i++) {
            ans = Math.min(ans, Math.abs(Integer.parseInt(s.substring(i, i+3)) - 753));
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 21716
#include <bits/stdc++.h>
typedef long long ll;
#define pb push_back
using namespace std;
typedef pair<ll,ll> pll;



typedef long double ld;
ld a,b,x;
int main()
{
        cout << setprecision(12) << fixed;
        cin >> a >> b >> x;
        ld yo = x / (a*a);
        if(yo > b) {
                cout << "0\n"; return 0;
        }
        ld ay = a*b*b / (2.0 * x);
        ld ans = (180.0 / (atan(1) * 4.0))*atan(ay);

        if(2*x/(a*a) - b  >= 0) {

                ld yo = (2*x / (a*a)) - b;

                //cout << yo << endl;
                if(yo <= b) {
                        ans = min((ld)ans, (180.0 / (atan(1) * 4.0))*atan((b-yo)/ a));
                }
        }
        cout << ans << endl;
        return 0;
}


Measured memory_bytes: 256
/************************************/
/* NoobM							*/
/* File Name : chaa.cpp				*/
/* Date : 13.07.2020 02:37:00 +06	*/
/************************************/

#include <bits/stdc++.h>

#define rr(i, b)    for (int i = 0; i < int(b); i++)
#define vi(n, a) vector <int> a(n); rr(i, n) cin >> a[i]
#define pvec(a) rr(i, a.size()) cout << a[i] << " "; cout << endl
#define bug(x) cout << #x << " " << x << endl
#define ll long long
#define vii vector <int>

using namespace std;

void solve() {
	string a, b;
	cin >> a >> b;
	
	int j = stoi(a + b);
	
	//int num = a * pow(10, j) + b;
	
//	cout << j << endl;
	
	if(((int)sqrt(j)*sqrt(j)) == j) cout << "Yes" << endl;
	else cout << "No" << endl;
}
 
int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(false);
	
	int t = 1;
	//cin >> t;
	
	while (t--) {
		solve();
	}
    return 0;
}


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

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

  string ans = "No";
  for ( int c = 0; c*4 <= n; c++ ) {
    for ( int d = 0; d*7 + c*4 <= n; d++ ) {
      if ( d*7 + c*4 == n ) { ans = "Yes"; }
    }
  }

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


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

int main()
{
	int a,b;
	cin>>a>>b;
	
	if(a==1)
		a+=13;
	if(b==1)
		b+=13;
	
	if(a>b)
		cout<<"Alice";
	if(a<b)
		cout<<"Bob";
	if(a==b)
		cout<<"Draw";
	
	return 0;
}

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

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

            var input = new int[6];
            for (int i = 0; i < 6; i++) {
                input[i] = int.Parse(Console.ReadLine());
            }

            Console.WriteLine((input[4] - input[0]) <= input[5] ? "Yay!" : ":(");
        }
    }
}

Measured memory_bytes: 13140
#include <algorithm>
#include <iostream>
#define MAXN 1000000

using namespace std;

int n, x;
int a[MAXN];

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

    long long total = 0;
    for (int i = 1; i < n; i++) {
        if (a[i - 1] + a[i] > x) {
            int diff = min(a[i], a[i - 1] + a[i] - x);
            a[i] -= diff;
            total += diff;
        }
    }
    if (a[0] + a[1] > x) {
        int diff = a[0] - a[1] - x;
        a[0] -= diff;
        total += diff;
    }
    if (a[n - 2] + a[n - 1] > x) {
        int diff = a[n - 2] + a[n - 1] - x;
        a[n - 1] -= diff;
        total += diff;
    }
    cout << total << endl;
}


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

// iterator
#define REP(i,init, n) for(lli i=init;i<n;i++)
#define REPE(i,init, n) for(lli i=init;i<=n;i++)
#define REPIT(it,container) for(auto it = container.begin(); it != container.end(); it++)
#define REPIT_R(it,container) for(auto it = container.rbegin(); it != container.rend(); it++)

// input
#define cin1(x)             cin >> x
#define cin2(x, y)          cin >> x >> y
#define cin3(x, y, z)       cin >> x >> y >> z
#define ncin1(n, x)         REP(i, 0, n) {cin1(x[i]);}
#define ncin2(n, x, y)      REP(i, 0, n) {cin2(x[i], y[i]);}
#define ncin3(n, x, y, z)   REP(i, 0, n) {cin3(x[i], y[i], z[i]);}

// output
#define cout1(x)         cout << #x << ": " << x << endl;
#define ncout1(n, x)     REP(i, 0, n) {cout << #x << "[" << i << "]: "<< x[i] << endl;}

// sort
#define sort_r(x, y)        sort(x, y, greater<lli>()); // 降順(5,4,3,,,)

#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

typedef long long int lli;
typedef pair<lli, lli> P;

int main() {
    lli n;
    cin1(n);
    cout << 3 * n * n << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define F first
#define S second
using namespace std;
using ll = long long;
typedef pair<int, int> P;
ll Mod = 1000000007;
int main() {
  int N;
  cin >> N;
  cout << (1000 - (N % 1000)) % 1000 << endl;
  return 0;
}

Measured memory_bytes: 3632
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"

using namespace std;

int N;

int main() {
	cin >> N;
	cout << (N*(N+1))/2<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <complex>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
#include <limits>
#include <time.h>
#include <cstdint>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(ll i=n-1;i>=0;i--)
#define rRep(i,a,b) for(ll i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template <class T, class U> inline bool chmax(T& lhs, const U& rhs) { if (lhs < rhs) { lhs = rhs; return 1; } return 0; }
template <class T, class U> inline bool chmin(T& lhs, const U& rhs) { if (lhs > rhs) { lhs = rhs; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

string S,T;

int main(){
  ll N,A[1000];
  cin >> N;
  rep(i,N){
    cin >> A[i];
  }
  ll ans=INF;
  rep(i,101){
    ll Z=0;
    rep(j,N){
      Z+=(A[j]-i)*(A[j]-i);
    }
    ans=min(ans,Z);
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#define eol '\n';
using namespace std;

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

  int N,W;
  cin >> N >> W;
  int* v = new int[N+1];
  int* w = new int[N+1];

  for (int i = 1; i <= N; i++) {
    cin >> v[i] >> w[i];
  }

  int** dp = new int*[N+1];
  for (int i = 0; i <= N; i++) {
    dp[i] = new int[W+1];
  }

  int ans = 0;
  for (int i = 1; i <= N; i++) {
    for (int j = 0; j <= W; j++) {
      dp[i][j] = dp[i-1][j];
      if (j >= w[i-1]) {
        dp[i][j] = max(dp[i][j], dp[i-1][j-w[i-1]] + v[i-1]);
      }
      if (j >= w[i]) {
        dp[i][j] = max(dp[i][j], dp[i][j-w[i]] + v[i]);
      }
      if (i == N) {
        ans = max(ans, dp[i][j]);
      }
    }
  }
  cout << ans << eol;
  return 0;
}

Measured memory_bytes: 5104
import java.io.IOException;
import java.io.InputStream;
import java.util.NoSuchElementException;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner();
		int N = sc.nextInt();
		int A = sc.nextInt();

		if( (N % 500) <= A)
			System.out.println("Yes");
		else
			System.out.println("No");
	}
}

class FastScanner {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr = 0;
	private int buflen = 0;

	private boolean hasNextByte() {
		if (ptr < buflen) {
			return true;
		} else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	private int readByte() {
		if (hasNextByte())
			return buffer[ptr++];
		else
			return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <= 126;
	}

	public boolean hasNext() {
		while (hasNextByte() && !isPrintableChar(buffer[ptr]))
			ptr++;
		return hasNextByte();
	}

	public String next() {
		if (!hasNext())
			throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while (isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if (!hasNext())
			throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if (b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while (true) {
			if ('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			} else if (b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			} else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE)
			throw new NumberFormatException();
		return (int) nl;
	}

	public double nextDouble() {
		return Double.parseDouble(next());
	}
}


Measured memory_bytes: 21204
import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    a, b, c = map(int, input().split())
    
    if a == b and b == c:
        print('No')
        return
    if a != b and b != c and c != a:
        print('No')
        return
    else:
        print('Yes')

    return

if __name__ == '__main__':
    main()

Measured memory_bytes: 66028
#include<stdio.h>

int main(){
    int n;
    scanf("%d",&n);
    int d[n][2];
    for(int i=0;i<n;i++){
        scanf("%d %d",&d[i][0],&d[i][1]);
    }

    int make=0;
    for(int i=0;i<n;i++){
        if(d[i][0]==d[i][1]){
            if(d[i+1][0]==d[i+1][1]&&d[i+2][0]==d[i+2][1]){
                make++;
            }
        }
    }
    if(make>0){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    return 0;
}

Measured memory_bytes: 1644
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<cstdlib>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
int stack[20];
inline void write(int x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
inline void pr1(int x){write(x),putchar(' ');}
inline void pr2(int x){write(x),puts("");}
int a[200010],head[2],tail[2],list[2][200010];
int main()
{
    //freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n=read(),m=read(),ans=1,sum=0;
	head[0]=head[1]=1,tail[0]=tail[1]=0;
	for(int i=1;i<=n;i++)
	{
		a[i]=read()+1;bool bk=true,pd=true;
		while(head[0]<=tail[0] && list[0][head[0]]<=i-m)head[0]++,bk=false;
		while(head[1]<=tail[1] && list[1][head[1]]<=i-m)head[1]++;
		if(i>m)
		{
			ans++;
			if(a[i]>a[list[1][head[1]]] && bk==false)ans--,pd=false;
		}
		while(head[0]<=tail[0] && a[i]<a[list[0][tail[0]]])tail[0]--;
		while(head[1]<=tail[1] && a[i]>a[list[1][tail[1]]])tail[1]--;		
		list[0][++tail[0]]=i,list[1][++tail[1]]=i;
		if(tail[0]-head[0]+1==m && pd==true)sum++;
	}pr2(ans-max(0,sum-1));
    return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#define LL long long
using namespace std;

int m,num,ans1,ans2=999;
string s;

int main()
{
	cin>>s;
	int len=s.length();
	for(int i=0;i<26;i++)
	{
		num=0;ans1=0;
		for(int j=0;j<len;j++)
		{
			if(s[j]!=i+'a')num++;
			else
			{
				ans1=max(ans1,num);
				num=0;
			}
		}
		ans1=max(ans1,num);
		ans2=min(ans1,ans2);
	}
	printf("%d\n",ans2);
	return 0;
}

Measured memory_bytes: 256