akhauriyash/Code-Regression huggingface dataset:
//in the name of god
//if you read this code please search about imam hussain
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define pb push_back
#define endl "\n";
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define read freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);

const int maxn=1e5+5;
const int mod=1e9+7;
const int inf=1e9;
const int del=728729;
int arr[maxn],ps[maxn];
int main(){
	migmig;
	int n,x;
	cin>>n>>x;
	int cnt=0;
	for(int i=0;i<n;i++){
		cin>>arr[i];
	}
	ps[0]=0;
	for(int i=1;i<=n;i++){
		ps[i]=ps[i-1]+arr[i-1];
	}
	for(int i=0;i<=n;i++){
		if(ps[i]<=x){
			cnt++;
		}
	}
	cout<<cnt;
	return 0;
}



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

int main(){
  double a,b,c=0,d=0,e,n,m,x,y;
  cin>>n;
  string s;
  rep(i,0,n){
    cin>>a>>s;
    if(s=="JPY") c+=a;
    else c+=a*38e4;
  }
  co(c);
  
  return 0;
}

Measured memory_bytes: 256
a = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
N=int(input())
print(a[N-1])

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

int main(){
  char a,b,c,d,f,e;
  cin >> a >> b >> c;
  cin >> d >> e >> f;
  if(a==f && b==e && c==d) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#template
def inputlist(): return [int(j) for j in input().split()]
#template
N = int(input())
li = [0]*N
for i in range(N):
    li[i] = input()
from collections import Counter
dic = Counter(li)
keys = ["AC","WA","TLE","RE"]
for key in keys:
    print(key,"x",str(dic[key]))

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

int main() {
  long long int a;
  cin>>a;
  long long int p=a-1;
  double b=sqrt(a);
  long long int c=int(b);
  
  for(int i=1;i<c+1;i++){
    if(a%i==0){
      p=i+a/i-2;
    }
  }
  cout<<p<<endl;
}

Measured memory_bytes: 384
//#include "stdafx.h"
#include <iostream>
#include <set>
#include <queue>
#include <vector>
#include <algorithm>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <tuple>
#include <numeric>

using namespace std;

/*-----------------------------------------------------------------------------
　定義
 -------------------------------------------------------------------------------*/
#define REP(i, n) for (int (i) = 0 ; (i) < (int)(n) ; ++(i))
#define REPN(i, m, n) for (int (i) = m ; (i) < (int)(n) ; ++(i))
#define INF						2e9
#define MOD						(1000 * 1000 * 1000 + 7)
#define Ceil(x, n)				(((((x))+((n)-1))/n))		/* Nの倍数に切り上げ割り算 */
#define CeilN(x, n)				(((((x))+((n)-1))/n)*n)		/* Nの倍数に切り上げ */
#define FloorN(x, n)			((x)-(x)%(n))				/* Nの倍数に切り下げ */
#define IsOdd(x)				(((x)&0x01UL) == 0x01UL)			
#define IsEven(x)				(!IsOdd((x)))						
#define	BitSetV(Val,Bit)		((Val) |= (Bit))			
#define	BitTstV(Val,Bit)		((Val) & (Bit))				
#define ArrayLength(x)			(sizeof( x ) / sizeof( x[ 0 ]))
#define MAX_DWORD				(0xFFFFFFFF)
#define	MAX_SDWORD				((SDWORD)0x7FFFFFFF)
#define	MIN_SDWORD				((SDWORD)0x80000000)
#define	MAX_QWORD				((QWORD)0xFFFFFFFFFFFFFFFF)
#define	MIN_QWORD				((QWORD)0x0000000000000000)
#define	MAX_SQWORD				((SQWORD)0x7FFFFFFFFFFFFFFF)
#define	MIN_SQWORD				((SQWORD)0x8000000000000000)
#define M_PI					3.14159265358979323846
#define deg_to_rad(deg)			(((deg)/180)*M_PI)
#define rad_to_deg(rad)			((rad*180)/M_PI)
#define prique(T)				priority_queue<T, vector<T>, greater<T>>

typedef long					SDWORD;
typedef long long				SQWORD;
typedef unsigned long			DWORD;
typedef unsigned long long int	QWORD;
typedef pair<int, int> P;

/*-----------------------------------------------------------------------------
　処理
 -------------------------------------------------------------------------------*/
#define N_MAX	(200 * 1000)
#define K_MAX	(10)
#define M_MAX	(10)
#define H_MAX	(1000)
#define W_MAX	(1000)

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

	int cnt = 0;
	int ans = 0;
	REP(i, S.size()) {
		if ((S[i] == 'A' || S[i] == 'C' || S[i] == 'G' || S[i] == 'T')) {
			cnt++;
		} else {
			ans = max(ans, cnt);
			cnt = 0;
		}
	}
	ans = max(ans, cnt);
	cout << ans;
	cout << endl;
	return 0;
}



Measured memory_bytes: 256
D,G = list(map(int,input().split()))
PC = [tuple(map(int,input().split())) for i in range(D)]
res = 99999999999
for i in range(1 << D):
  n = 0
  po = 0
  for j in range(D):
    if ((i >> j) & 1)  == 1:
      n = n + PC[j][0]
      po = PC[j][1] + po + (j+1)*100*PC[j][0]
  if po >= G:
    res = min(n,res)
    continue
  for j in reversed(range(D)):
    if ((i >> j) & 1)  == 0:
      if po + (j+1)*100*(PC[j][0] - 1)  >= G:
        n = n + (G-po+100*(j+1)-1)//(100*(j+1))
        po = G+1
        break
      else:
      	n = n + PC[j][0] - 1
      	po = po + (j+1)*100*(PC[j][0] - 1)
  if po >= G:
  	res = min(n,res)

print(res)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define repz(i, z, n) for (decltype(n) i = (z); i < (n); i++)
#define rep(i, n) for (decltype(n) i = 0; i < (n); i++)

#define REPZ(i, z, n) for (decltype(n) i = (z); i <= (n); i++)
#define REP(i, n) for (decltype(n) i = 0; i <= (n); i++)
#define ALL(v) v.begin(), v.end()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) (*max_element(ALL(v)))
#define MIN(v) (*min_element(ALL(v)))
#define INF 1000000000000  // 1E+12

// 略
#define PB push_back
#define F first
#define S second
#define MP make_pair
#define READ cin >>
#define PRINT cout <<
#define PYES cout << "Yes" << endl;
#define POK cout << "OK" << endl;
#define PNO cout << "No" << endl;
#define PNG cout << "NG" << endl;

using namespace std;

// デバッグ用
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cout << H << " ";
  debug_out(T...);
}

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;
}

#ifdef _DEBUG
#define debug(...) debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

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

// const
// 円周率
const double pi = M_PI;
// mod用
// 1E+9 +7
const ll mod = (int)1e+9 + 7;
// 1s間で可能なループ回数2E+8回
// int        最大値2147483647         〜2E+9
// long long  最大値9223372036854775807〜9E+18
// 総和accumulate
// 単純リストvector<type> push_back
// 連想配列map<key,value> insert,
// 集合set<type>
// pair キーとバリューを格納 firstとsecondでアクセス
// 小数点指定 cout << fixed << setprecision(15) << endl;
// to_string<->stoi
// stoll(longlong)
// stod(double)
// deep copy v1->v2 copy(v1.begin(), v1.end(), back_inserter(v2) );
// 大文字65-90(-32)
// 小文字97-122(+32)

int main() {
  // faster
  // C言語流の入出力は使用できない
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];
  vector<int> b(n, 0);
  vector<int> res;
  for (int i = n; i >= 1; i--) {
    int sum = 0;
    for (int j = i + i; j <= n; j += i) {
      sum += b[j-1];
    }
    sum %= 2;
    b[i-1] = sum != a[i-1];
    if (b[i-1] == 1) res.push_back(i);
  }
  cout << SIZE(res) << endl;
  reverse(ALL(res));
  rep(i, SIZE(res)) {
    cout << res[i];
    if (i != SIZE(res)-1)
      cout << " ";
    else
      cout << endl;
  }

  return 0;
}


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

#define double long double
#define ff first
#define ss second
#define endl '\n'
#define ii pair<int, int>
#define mp make_pair
#define mt make_tuple
#define DESYNC                      \
  ios_base::sync_with_stdio(false); \
  cin.tie(0);                       \
  cout.tie(0)
#define pb push_back
#define vi vector<int>
#define vii vector<ii>
#define all(x) x.begin(), x.end()
#define EPS 1e-9
#define INF 1e18
#define ROOT 1
#define M 1000000007
#define curtime chrono::steady_clock::now().time_since_epoch().count
#define rep(i, beg, n, s) for (int i = beg; i < n; i += s)
const double PI = acos(-1);

using namespace std;

int x[20], y[20], p[20];

long long best[20];

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

  for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> p[i], best[i] = INF;

  // brute people
  int d[n];
  for (int msk = 0; msk < (1 << n); msk++) {
    int cnt = __builtin_popcount(msk);
    for (int dir = msk;; dir = (dir - 1) & msk) {
      for (int i = 0; i < n; i++) d[i] = min(abs(x[i]), abs(y[i]));
      for (int i = 0; i < n; i++) {
        if (msk >> i & 1) {
          if (dir >> i & 1)
            for (int j = 0; j < n; j++) {
              d[j] = min(d[j], abs(x[i] - x[j]));
            }
          else
            for (int j = 0; j < n; j++) {
              d[j] = min(d[j], abs(y[i] - y[j]));
            }
        }
      }

      long long ans = 0;
      for (int i = 0; i < n; i++) {
        ans += (1LL * d[i] * p[i]);
      }
      best[cnt] = min(best[cnt], ans);
      if (dir == 0) break;
    }
  }

  for (int i = 0; i <= n; i++) cout << best[i] << endl;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))

// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;

ll fact[125252];

ll modinv(ll a){
  ll b=MOD-2, r=1;
  while(b){
    if(b&1)r=r*a%MOD;
    a=a*a%MOD;
    b>>=1;
  }
  return r;
}

ll comb(int a, int b){
  return fact[a]*modinv(fact[b])%MOD*modinv(fact[a-b])%MOD;
}

int main(){
  int n,m;
  cin>>n>>m;
  fact[0] = 1;
  FOR(i,1,125252)fact[i] = fact[i-1]*i%MOD;
  ll ans = 1;
  for(int x=2;x*x<=m;x++){
    if(m%x!=0)continue;
    int cnt = 0;
    while(m%x==0){
      m/=x;cnt++;
    }
    (ans *= comb(n-1+cnt,n-1)) %= MOD;
  }
  if(m>1){
    (ans *= n) %= MOD;
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 1280
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        while(n>0){
            int sum=0;
            int[] s = new int[n];
            for(int i=0;i<n;i++){
                s[i]=scan.nextInt();
                sum+=s[i];
            }
            double ave = (double)sum/n;
            //System.out.println(ave);
            double HF=0;
            for(int i=0;i<n;i++){
                HF+=(ave-s[i])*(ave-s[i]);
            }
            HF/=(double)n;
            HF=Math.pow(HF,0.5);
            System.out.println(HF);
            n = scan.nextInt();
        }
    }
}


Measured memory_bytes: 31232
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) V.begin(), V.end()
#define L_B lower_bound
#define U_B upper_bound
#define pb push_back
#define ll long long
#define rep(i,n) for (i = 0; i < n; ++i) 
#define REP(i,k,n) for (i = k; i <= n; ++i) 
#define REPR(i,k,n) for (i = k; i >= n; --i)
using namespace std;
template<class T, class T1> int chkmin(T &x, const T1 &y) { return x > y ? x = y, 1 : 0; }
template<class T, class T1> int chkmax(T &x, const T1 &y) { return x < y ? x = y, 1 : 0; }
const int MAXN = (1 << 20);
bool prime(ll x)
{
  if(x==1)
    return false;
  if(x==2||x==3||x==5)
    return true;
  for(ll i=2;i<=sqrt(x);i++)
  {
    if(x%i==0)
      return false;
  }
  return true;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
#ifndef ONLINE_JUDGE 
   freopen("input.txt", "r", stdin); 
   //freopen("error.txt", "w", stderr); 
   freopen("output.txt", "w", stdout); 
#endif 
   
 ll T = 1 ;
 //cin>>T;

 for(ll t=0;t<T;t++)
 {
  ll n , ans = 0 , mod = 1000000007;
  cin>>n;
  ll sum = 0;
  vector <ll> arr(n);
  for(ll i=0;i<n;i++)
    {
      cin>>arr[i];
      sum  = (sum + arr[i])%mod;
    }
  
  for(ll i = n-1;i>0;i--)
  {
    sum = (mod + sum - arr[i])%mod;
   ans = (ans + (sum*arr[i])%mod)%mod;
  }
  cout<<ans<<endl;

 }
  return 0;
}


Measured memory_bytes: 4788
#include <iostream>
#include <cmath>
#include <stack>

using namespace std;

int main(){
    int n,m[3];
    cin>>n;
    for(int i=0;i<n;++i) cin>>m[i];
    int a=m[0],b=m[1],c;
    for(int i=0;i<n-1;++i){
        while(b){
            c=a;a=b;b=c%b;
            }
            b=m[2];
    }
    stack<int> s;
    for(int i=1;i<=sqrt(a);++i){
        if(a%i==0){
            cout<<i<<endl;
            if(i!=sqrt(a)) s.push(i);
        }
    }
    while(!s.empty()){
        cout<<a/s.top()<<endl;s.pop();
    }
    return 0;
}

Measured memory_bytes: 3056
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int n,k,a[10];
int judge(int x)
{
    int p;
    while(x)
    {
        p = x % 10;
        for(int i=0; i<k; i++)
        {
            if(p == a[i])
                return false;
        }
        x /= 10;
    }
    return true;
}
int main()
{
    cin>>n>>k;
    for(int i=0; i<k; i++)
        cin>>a[i];
    for(int i=n; ; i++)
    {
        if(judge(i))
        {
            cout<<i<<endl;
            break;
        }
    }
    return 0;
}


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

#define wait() system("pause")

int mat[210][210], n, m, r;
int a[10]; int dp[10][(1<<8)+10];

int get(int pos, int mask) {
	if(mask == (1<<r)-1) return 0;
	if(dp[pos][mask] != -1) return dp[pos][mask];
	int ret = 1e9; for(int i=0; i<r; i++) {
		if(mask&(1<<i)) continue;
		ret = min(ret, mat[a[pos]][a[i]] + get(i, mask | (1<<i)));
	} return dp[pos][mask] = ret;
}

int main () {
	cin>>n>>m>>r; memset(dp, -1, sizeof dp);
	for(int i=0; i<r; i++) cin>>a[i];
	for(int i=1; i<=n; i++) for(int j=1; j<=n; j++) mat[i][j] = 1e9;
	for(int i=1; i<=m; i++) {
		int x, y; cin>>x>>y; cin>>mat[x][y]; mat[y][x] = mat[x][y];
	}
	for(int k=1; k<=n; k++) {
		for(int i=1; i<=n; i++) {
			for(int j=1; j<=n; j++) {
				mat[i][j] = min(mat[i][j], mat[i][k] + mat[k][j]);
			}
		}
	}
	int ret = 1e9;
	for(int i=0; i<r; i++) ret = min(ret, get(i, (1<<i)));
	cout<<ret<<endl;
	//wait();
	return 0;
}

Measured memory_bytes: 384
#include <cstdio>
using namespace std;

int main(){
    int n, x;
    while(true){

    int cnt = 0;
    scanf("%d %d", &n, &x);
    
    if(n == 0 && x == 0) break;

    for(int i = 1; i <= n; ++i){
    for(int j = i + 1; j <= n; ++j){
    for(int k = j + 1; k <= n; ++k){
        if(i + j + k == x) ++cnt;
    }
    }
    }

    printf("%d\n", cnt); 
    }
    return 0;
}

Measured memory_bytes: 1028
#include <bits/stdc++.h>
#include <stdio.h>
 
using namespace std;
 
#define int long long
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define trav(i, a) for (auto &i: (a))
#define sz(x) (int)(x).size()
#define all(v) (v).begin(), (v).end()
#define fr(i, a, b) for (int i = (a); i <= (b); ++i)

void solve();

signed main () {
    clock_t beg = clock();
    cout << fixed << setprecision(15);
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    #ifdef LOCAL
    freopen("input.txt", "r", stdin);
    #endif 
    int t = 1; 
    // cin >> t;    
    int tt = t;
    while (t--) {
        // cout << "Case #" << tt - t << ": "; 
        solve();
    }
    cerr << "\nExecution time: " << (clock() - beg) / 1000 << '\n';
    return 0;
}
int dp[(int) 1e6 + 5][2][2];
void solve() {
    int n;
    cin >> n;
    memset(dp, 0, sizeof dp);
    const int M = 1e9 + 7;
    dp[0][0][0] = 1;
    for (int i = 1; i <= n; ++i) {
        for (int p0 = 0; p0 < 2; ++p0) {
            for (int p9 = 0; p9 < 2; ++p9) {
                for (int here = 0; here <= 9; ++here) {
                    int n0 = p0, n9 = p9;
                    if (here == 0)
                        n0 = 1;
                    if (here == 9)
                        n9 = 1;
                    dp[i][n0][n9] += dp[i - 1][p0][p9];
                    dp[i][n0][n9] %= M;
                }
            }
        } 
    }
    cout << dp[n][1][1];
}

Measured memory_bytes: 34904
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
//const long long mod = 1000000007;
//const long long mod = 998244353;

int main() {
	int N;
	scanf("%d", &N);
	bool yes = false;
	for (int i = 1; i <= 9; i++) {
		if (N%i == 0 && N / i < 10)yes = true;
	}
	printf(yes ? "Yes" : "No");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    int tama = 0;
    string s;
    cin >> s;
    
    for ( int i = 0; i < s.size(); ++i ){
        
        
        if ( s[i] == '1' ){
            ++tama;
        }
    
    }

    cout << tama << endl;
}


Measured memory_bytes: 3600
import collections
import itertools

H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]


def is_white(i, j):
    return i in range(H) and j in range(W) and s[i][j] == "."


def adjacent_white_squares(i, j):
    return [
        (i + di, j + dj)
        for di, dj in [(0, -1), (0, 1), (-1, 0), (1, 0)]
        if is_white(i + di, j + dj)
    ]


def distance_to_goal():
    distances = [[-1 for _ in range(W)] for _ in range(H)]
    distances[0][0] = 0
    queue = collections.deque([(0, 0)])

    d = 0
    while queue:
        i, j = queue.popleft()
        to_visit = [
            (k, l) for k, l in adjacent_white_squares(i, j) if distances[k][l] == -1
        ]
        for k, l in to_visit:
            if (k, l) == (H - 1, W - 1):
                return distances[i][j] + 1

            distances[k][l] = distances[i][j] + 1
            queue.append((k, l))

    return -1


def black_squares():
    return sum(1 for c in itertools.chain.from_iterable(s) if c == "#")


distance = distance_to_goal()
if distance == -1:
    print(-1)
else:
    print(H * W - (distance + 1) - black_squares())


Measured memory_bytes: 3316
/*
                       _oo0oo_
                      o8888888o
                      88" . "88
                      (| -_- |)
                      0\  =  /0
                    ___/`---'\___
                  .' \\|     |// '.
                 / \\|||  :  |||// \
                / _||||| -:- |||||- \
               |   | \\\  -  /// |   |
               | \_|  ''\---/''  |_/ |
               \  .-\__  '-'  ___/-. /
             ___'. .'  /--.--\  `. .'___
          ."" '<  `.___\_<|>_/___.' >' "".
         | | :  `- \`.;`\ _ /`;.`/ - ` : | |
         \  \ `_.   \_ __\ /__ _/   .-` /  /
     =====`-.____`.___ \_____/___.-`___.-'=====
                       `=---='
 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
  Akshay Vashishtha 

//It’s just pathetic to give up on something before you even give it a shot.
//Knowing you’re different is only the beginning. If you accept these differences 
you’ll be able to get past them and grow even closer.
//You can die anytime, but living takes true courage.
//Every journey begins with a single step. We just have to have patience.
//Life is not a game of luck. If you wanna win, work hard.
//It’s more important to master the cards you’re holding 
//than to complain about the ones your opponent was dealt.
//If you just submit yourself to fate, then that’s the end of it.
//Whatever you do, enjoy it to the fullest. That is the secret of life.
//I too will obtain everything that I desire. Not because someone asked me to do it, 
//but because I know in my heart that I have something worth fighting for.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/   
#include<bits/stdc++.h>
 
#define ps push_back
#define le length
#define in insert
#define vint vector<int>
#define vlld vector<long long int>
#define pii pair<int,int>
#define mk make_pair
#define vst vector<string>
#define lld long long int 
#define FAST ios_base::sync_with_stdio(false),cin.tie(NULL)
#define sv()                  int t; scanf("%d",&t); while(t--)
using namespace std;
 
vlld v;

void fn(int pre , int idx , lld n)
{
  if(n >= 3234566667){
    return;
  }else{
    lld st = pre - 1 , ed = pre + 1;
    if(st < 0){
      st = 0;
    }
    if(ed > 9){
      ed = 9;
    }
    for(lld i = st ; i <= ed ; i++){
      v.ps((n * (lld)10) + i);
      fn(i , idx+1 , ((n * (lld)10) + (lld)i));
    }
  }
}

int main()
{
  int k;
  cin>>k;
	for(int i = 1 ; i <= 9 ; i++){
    v.ps(i);
    fn(i , 1 , i);
  }
  sort(v.begin() , v.end());
  // for(int i = 0 ; i < v.size() ; i++){
  //   cout<<v[i]<<" ";
  // }
  cout<<v[k-1]<<endl;
	return 0;
}

Measured memory_bytes: 6384
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <utility>

using namespace std;

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

#define PI 3.14159265358479

typedef long long ll;

ll n, a, c[1000010][5],no[10];
vector<ll> vl;

int main(){
	while (cin >> n){
		if (!n)break;
		REP(i, n){
			c[i][1] = 0;
			REP(j, 9){
				if (j == 0){
					cin >> c[i][j];
					continue;
				}
				cin >> a;
				if (j % 2 != 0){
					a *= 60;
				}
				c[i][1] += a;
			}
			vl.push_back(c[i][1]);
		}
		sort(ALL(vl));
		REP(i, n){
			if (c[i][1] == vl[0]){
				no[0] = c[i][0];
			}
			else if (c[i][1] == vl[1]){
				no[1] = c[i][0];
			}
			if (c[i][1] == vl[n - 2]){
				no[2] = c[i][0];
			}
		}
		REP(i, 3){
			cout << no[i] << endl;
		}
		vl.clear();
	}
}

Measured memory_bytes: 1520
#include <algorithm>
#include <array>
#include <cassert>
#include <cctype>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <optional>
#include <queue>
#include <set>
#include <string>
#include <string_view>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int64_t read_int() {
    int64_t ret = 0, sgn = 1;
    int ch = getchar_unlocked();
    while (isspace(ch)) { ch = getchar_unlocked(); }
    if (ch == '-') { sgn = -1; ch = getchar_unlocked(); }
    for (; isdigit(ch); ch = getchar_unlocked())
        ret = (ret * 10) + (ch - '0');
    ungetc(ch, stdin);
    return sgn * ret;
}

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

template <typename T> inline void assign_min(T& x, const T& value) noexcept { x = min(x, value); }
template <typename T> inline void assign_max(T& x, const T& value) noexcept { x = max(x, value); }

constexpr char LF = '\n';

//-------------------------------------------------------------------------------------------------

int main() {
    int N = read_int();
    vector<int64_t> A(N);
    REP(i, N) A[i] = read_int();

    sort(ALL(A), greater());

    int64_t score = A[0];
    int k = 1;
    for (int i = 2; i < N; ++i) {
        score += A[k];
        if (i % 2 == 1) ++k;
    }
    cout << score << LF;
}


Measured memory_bytes: 4304
#include <iostream>
#include <vector>
#include <utility>
#include <map>
#include <algorithm>
#include <queue>
#include <cmath>

using namespace std;

int main() {
  int p,q,r;
  int ans = INT_MAX;
  cin >> p >> q >> r;

  ans = min(ans, p+q);
  ans = min(ans, q+r);
  ans = min(ans, r+p);

  cout << ans << endl;
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

const ll mod=1e9+7;

ll mod_inv(ll n)
{
    ll pw[32];
    pw[0]=n;
    for(int i=1; i<32; ++i) pw[i]=(pw[i-1]*pw[i-1])%mod;

    ll ret=1;
    ll p=mod-2;
    rep(i,32) if(p>>i&1) (ret*=pw[i])%=mod;
    return ret;
}

ll fact[200001];

ll comb(ll n, ll r)
{
    ll ret=fact[n];
    (ret*=mod_inv(fact[r]))%=mod;
    (ret*=mod_inv(fact[n-r]))%=mod;
    return ret;
}

int main()
{
    fact[0]=1;
    for(int i=1; i<=200000; ++i) fact[i]=(fact[i-1]*i)%mod;

    ll h,w,a,b;
    cin >>h >>w >>a >>b;

    ll ans=0;

    for(ll i=b; i<w; ++i)
    {
        ll add=1;

        ll p=h-a-1;

        (add*=comb(p+i,i))%=mod;
        (add*=comb(w-1-i+a-1,a-1))%=mod;

        (ans+=add)%=mod;
    }

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


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const long long INF = 1LL << 60;
using Graph = vector<vector<int>>;

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

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

inline int gcd(int a, int b) { return (a%b == 0) ? b : gcd(b, a%b); }
inline int fac(int n) { return (n==0) ? 1 : n * fac(n - 1); }

int main() {
    ll n;
    cin >> n;
    int k = to_string(n).length();
    string str = to_string(n);
    int c = str[0] - '0';
    for (int i = 1; i < str.length(); i++) {
        if (str[i] != '9') {
            cout << (c - 1) + (k - 1) * 9 << endl;
            return 0;
        }
    }

    cout << c + (k - 1) * 9 << endl;

    return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <algorithm>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, x, n) for (int i = x; i < (n); i++)
#define ll = long long;

int main()
{
    int a, b, mul;
    cin >> a >> b;
    mul = a * b;
    cout << mul << endl;
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <numeric>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
typedef long long lli;
typedef vector<lli> vll;
typedef vector<bool> vbl;
typedef vector<vector<lli> > mat;
typedef vector<vector<bool> > matb;
typedef vector<string> vst;
typedef pair<lli,lli> pll;
typedef pair<double,double> pdd;

lli n;
vst s;
lli asc[128];
lli asc_[128];
string ans;

int main(){
    cin >> n;
    s = vst(n);
    for(lli i = 0;i < n;i++) cin >> s[i];
    for(lli i = 0;i < 128;i++) asc[i] = 1ll << 62;
    for(lli i = 0;i < n;i++){
        for(lli j = 0;j < 128;j++) asc_[j] = 0;
        for(lli j = 0;j < s[i].size();j++){
            asc_[s[i][j]]++;
        }
        for(lli j = 0;j < 128;j++){
            asc[j] = min(asc[j],asc_[j]);
        }
    }
    for(lli i = 0;i < 128;i++){
        while(asc[i]--) ans += (char)i;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  string N;
  cin >> N;
  int i(0);
  int sum(0);

  while(N[i] != '\0')
  {
    sum += (N[i++] - '0');
  }
  if (sum % 9 == 0)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <numeric>

using namespace std;

int main(){
    int n;
    cin>>n;
    int ans=0;
    for(int i=1;i<=n;i++)ans+=i;
    cout<<ans<<endl;
}

   


Measured memory_bytes: 256
// ABC144B.cpp
#include <iostream>
using namespace std;
int main()
{
	int N;
	cin >> N;
	bool ans=false;
	for (int i = 1; i < 10; i++)
	{
		if (N%i==0&&N/i<10)
		{
			ans = true;
			break;
		}
	}
	if (ans)
	{
		cout << "Yes"<<endl;
	}
	else
	{
		cout << "No" << endl;
	}
}

Measured memory_bytes: 384
import itertools as it
n=int(input())
q=list(map(int,input().split()))
b=list(map(int,input().split()))
List = list(it.permutations(list( range(1,n+1) )))
a=c=0
for i in range(len(List)):
    if(List[i]==tuple(q)):
        a=i
    if(List[i]==tuple(b)):
        c=i
print(abs(a-c))


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

dp = [0 for i in range(n)]

dp[n-1] = 0
dp[n-2] = abs(a[n-1] - a[n-2])

for i in range(n-3,-1,-1):
	dp[i] = min(dp[i+1] + abs(a[i]-a[i+1]), dp[i+2]+abs(a[i]-a[i+2]))

# print(dp)
print(dp[0])

Measured memory_bytes: 13980
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int n=gi();
	    int[] l= new int[n];
	    int[] r= new int[n];
	    int c=0;
	    for(int i=0; i<n; i++) {
	    	l[i]=gi();
	    	r[i]=gi();
	    	c+= r[i]-l[i]+1;
	    }
	    
	    //System.out.print(String.valueOf(s.charAt(0))+ (s.length()-2)+s.charAt(s.length()-1));

	    System.out.print(c);


	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 38476
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int N,T;
    cin >> N >> T;
    int c[N],t[N];
    int ans=INF;
    rep(i,N){
        cin >> c[i] >> t[i];
        if(t[i]<=T) ans=min(ans,c[i]);
    }
    if(ans==INF) cout << "TLE" << endl;
    else cout << ans << endl;



}


Measured memory_bytes: 892
//includes
#include<iostream>
#include<vector>
#include<set>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<string>
#include<stack>
#include<map>
#include<queue>
#include<iomanip>
#include<numeric>
#include<assert.h>
#include<cstring>
#include<unordered_map>
#include<bitset>


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

//macros and consts
#define REP(i, n) for(int i = 0; i < (int)(n); i++)
#define all(a) (a).begin(),(a).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define FORE(i,a) for(auto &i : a)
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define accm accumulate
#define Fi first
#define Se second
#define INF 1e9
#define llINF (1LL<<60)
#define mINF -1e9
#define mllINF -(1LL<<60)
#define endl "\n"
#define CONT continue
#define BRK break
#define modulo(n, m) (((n)%(m)+(m))%m)

//shorter types
using namespace std;
using ll = long long;
using vi = std::vector<int>;
using vc = std::vector<char>;
using vll = std::vector<long long>;
using vs = std::vector<string>;
using Mi = map<int,int>;
using Mll = map<ll,ll>;
using UMi = unordered_map<int,int>;
using UMll = unordered_map<ll,ll>;
using Pi = pair<int,int>;
using Pll = pair<ll,ll>;
using vPi = vector<Pi>;
using vPll = vector<Pll>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<ll>>;
using vvc = vector<vector<char>>;
using vvs = vector<vector<string>>;
using pqgi = priority_queue<int,vector<int>,greater<int>>;
using pqsi = priority_queue<int,vector<int>,less<int>>;
using pqgll = priority_queue<int,vector<int>,greater<int>>;
using pssll = priority_queue<int,vector<int>,less<int>>;
template<class T>
using vec = vector<T>;
#define int long long

int N,W;
//here begins your code
signed main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  cin >> N >> W;
  vector<int> w,v;
  w.resize(N);
  v.resize(N);

  for(int i = 0; i < N ; i++){
  	cin >> w[i] >> v[i];
  }
  vector<vector<int>> dp(110, vector<int>(100100,llINF));
  dp[0][0] = 0;
  for(int i = 0 ; i < N ; i++){
  	for(int sum_v = 0 ; sum_v < 100100; sum_v++){
  		if(sum_v - v[i] >= 0) chmin(dp[i + 1][sum_v],dp[i][sum_v - v[i]]  + w[i]);
  		chmin(dp[i + 1][sum_v], dp[i][sum_v]);
  	}
  }

  int res = 0;
  for(int sum_v = 0; sum_v < 100100; sum_v++){
    if(dp[N][sum_v] <= W){
      res = sum_v;
    }
  }

  cout << res << endl;
  //check types
  //do not eb if you resize
  //resize before you access by idx
  return 0;
} 

Measured memory_bytes: 87808
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define Rep(n) for (ll _ = 0; _ < (ll)(n); _++) 
#define fs first
#define sc second
#define _GLIBCXX_DEBUG

template<class S>S sum(vector<S>&a){return accumulate(all(a),S());}
template<class S>S max(vector<S>&a){return *max_element(all(a));}
template<class S>S min(vector<S>&a){return *min_element(all(a));}
ll max(int a,ll b){return max((ll)a,b);} ll max(ll a,int b){return max(a,(ll)b);}
ll min(int a,ll b){return min((ll)a,b);} ll min(ll a,int b){return min(a,(ll)b);}

template <class S>
void print(vector<S> &v){for(ll i=0; i<(ll)v.size(); i++){
		cerr << v[i] << ' ';
	}
	cerr << endl;
}
template <class S>
void print(vector<vector<S>> &v) {
  	for (ll i = 0; i < (ll)v.size(); i++) {
    	for (ll j = 0; j < (ll)v[i].size(); j++) {
      		cerr << v[i][j] << ' ';
    	}
    	cerr << endl;
  	}
}

int main(void){
	int n,m;
	cin >> n >> m;
	vector<ll> h(n);
	rep(i,n) cin >> h[i];
	vector<bool> good(n, true);
	Rep(m){
		int a,b; cin >> a >> b;
		if(h[--a] >= h[--b]) good[b] = false;
		if(h[b] >= h[a]) good[a] = false;
	}
	int ans = 0;
	rep(i,n) ans += good[i];
	cout << ans << endl;
	print(good);
}

Measured memory_bytes: 4044
import java.util.Scanner;
import java.util.ArrayList;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
	int N = sc.nextInt();
	ArrayList<Integer> value = new ArrayList<Integer>();
	ArrayList<Integer> cost = new ArrayList<Integer>();

	for (int i=0; i<N ; i++){
		int v = sc.nextInt();
		value.add(v);
	}

	for (int i=0; i<N ; i++){
		int c = sc.nextInt();
		cost.add(c);
	}

	int total=0;
	for (int i = 0; i<N; i++){
		int sub = value.get(i)-cost.get(i);
		if(sub>0){
			total+=sub;
		}
	}
	System.out.println(total);
  }
}

Measured memory_bytes: 21844
n,k,q = list(map(int,input().split()))
a= [int(input()) for _ in range(q)]
b = [0]*n
for i in range(q) :
    b[a[i]-1] +=1
for i in range(n) :
    if k-q+b[i] > 0 :
        print ('Yes')
    else :
        print ('No')


Measured memory_bytes: 8592
n = int(input())
num = list(map(int,input().split()))

from fractions import gcd
l = [0]
r = [0]
for i in range(n-1):
  l += [gcd(l[i],num[i])]
  r += [gcd(r[i],num[-i-1])]
  
print(max(gcd(r[i],l[-i-1]) for i in range(n)))



Measured memory_bytes: 14076
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1e9+7;
const int INF=1e9;

int main(){
    int n;
    cin>>n;
    int a[n],mn=INF,mx=-INF,s,t;
    for(int i=0;i<n;i++){
        cin>>a[i];
        if(mn>a[i]){
            mn=a[i];
            s=i;
        }
        if(mx<a[i]){
            mx=a[i];
            t=i;
        }
    }
    cout<<2*n-1<<endl;
    if(-mn<=mx){
        for(int i=0;i<n;i++){
            cout<<t+1<<" "<<i+1<<endl;
        }
        for(int i=1;i<n;i++){
            cout<<i<<" "<<i+1<<endl;
        }
    }
    else{
        for(int i=0;i<n;i++){
            cout<<s+1<<" "<<i+1<<endl;
        }
        for(int i=n-1;i>0;i--){
            cout<<i+1<<" "<<i<<endl;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <functional>
#include <vector>
#include <bitset>
/*#include <queue>
#include <stack>
#include <set>
#include <cmath>
#include <string>
#include <cstring>
#include <fstream>*/

#define Rep(i,n) for(int i=0;i<n;i++)
#define RepU(i,bottom,ceiling) for(int (i)=(bottom);(i)<=(ceiling);(i)++)
#define RepD(i,ceiling,bottom) for(int (i)=(ceiling);(i)>=(bottom);(i)--)
#define pb(arr,el) arr.push_back(el)
#define ci(a) cin>>a
#define lco(a) cout<<a<<endl
#define co(a) cout<<a
#define vco(v) Rep(i,v.end()-v.begin()){ co(*(i+v.begin())); } co('\n')

using namespace std;

typedef long long ll;

const int dir[8][2]={{0,1},{1,0},{0,-1},{-1,0},{1,1},{1,-1},{-1,1},{-1,-1}};
const int INF=1e9+5;

int main(){
	ll n,cnt=0,tem=-1;
	ci(n);
	vector<int> arr(300000);
	Rep(i,n){
		ci(arr[i]);
		if(tem+1<arr[i]){ lco("-1"); return 0; }
		if(tem>=arr[i]) cnt+=tem;
		tem=arr[i];
	}
	cnt+=tem;
   lco(cnt);
   return 0;
}




Measured memory_bytes: 1408
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<stdint.h>
#include<malloc.h>
#include<math.h>
#include<x86intrin.h>


int my_gets(char *buf,int nBuf,FILE *fp){
    int ch;

    while(--nBuf >0){
        ch=getc(fp);
        if(ch==EOF || ch=='\n')
            break;
        *(buf++)=(char)ch;
    }
    *(buf)='\0';

    return nBuf;
}

void InputIntAry(int *a,int nDigit,int N){      //nDigitは想定される最大桁数
    char *buf,*ptr;

    buf=(char*)malloc( (N*(nDigit+2)) * sizeof(char) );
    my_gets(buf,N*(nDigit+2),stdin);

    ptr=strtok(buf," ");
    while(ptr!=NULL && N-->0){
        *(a++)=atoi(ptr);
        ptr=strtok(NULL," ");
    }
    free(buf);
}

int CmpInt(const void *a, const void *b){        //b-aを返す(qsortなら降順)
    return *((int*)b)- *((int*)a);
}

#define MAXOF(a,b)  ( ((a)>(b)) ? (a) : (b) )

int main(){
    int A,B,C;

    scanf("%d %d %d%*c",&A,&B,&C);
    printf("%d\n", MAXOF(C-(A-B),0));
    return 0;
}

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

int isprime(long L){
  long i=3;
  long Ls = (long)sqrt(L);
  if (!(L%2)) return 0;
  while (i<=Ls) {
    if(!(L%i))return 0;
    i+=2;
  }
  return 1;
}

int main(void) {
  int N,n,t=0;
  long L;
  scanf("%d\n",&N);
  for(n=0;n<N;n++) {
    scanf("%ld\n",&L);
    if (L==2)     t++;
    else if (L>2) t+=isprime(L);
  }
  printf("%d\n",t);
  return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define abs(a) ((a)>(0)?(a):-(a))
#define min(a,b) ((a)<(b)?(a):(b))
using namespace std;
int main(){
	int s,b;
	cin>>s>>b;
	if(!(abs(s-b)%2))cout<<min(s,b)+abs(s-b)/2<<endl;
	else cout<<"IMPOSSIBLE"<<endl;
}

Measured memory_bytes: 256
#from statistics import median
#import collections
#aa = collections.Counter(a) # list to list || .most_common(2)で最大の2個とりだせるお a[0][0]
from fractions import gcd
from itertools import combinations,permutations,accumulate # (string,3) 3回
#from collections import deque
from collections import deque,defaultdict,Counter
#import bisect
#
#    d = m - k[i] - k[j]
#    if kk[bisect.bisect_right(kk,d) - 1] == d:
#
#
#
# pythonで無理なときは、pypyでやると正解するかも！！
#
#

import sys
sys.setrecursionlimit(10000000)
mod = 10**9 + 7
#mod = 9982443453
def readInts():
  return list(map(int,input().split()))
def I():
  return int(input())
N = I()
H = readInts()
NYA = [0] * N
for i in range(N-1,-1,-1):
    if i == N-1:
        prv = H[i]
    else:
        if prv <= H[i]:
            prv = H[i]
            NYA[i] = NYA[i+1] + 1
        else:
            prv = H[i]
print(max(NYA))


Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ld long double
#define REP(i,a,b) for(i=a;i<b;i++)
#define rep(i,a) REP(i,0,a)
#define rev(s) reverse(s.begin(),s.end())
#define pb push_back
#define MAX 100

int main()
{
	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	ll a,b,c,d;
	cin>>a>>b>>c>>d;
	while(a>0&&c>0)
	{
		c-=b;
		if(c>0)
			a-=d;
		else break;
	}
	if(a<=0)
		cout<<"No"<<endl;
	else cout<<"Yes"<<endl;

	return 0;
}

Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n ; i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x) // decltypeで型取得、引数があればva_argsのところに入れる
using namespace std;
typedef long long ll; // long longをllでかけるようにした
const int INF = 1e9;

int main(void){
    int n, k; cin >> n >> k;
    vector<int> A(n);
    REP(i, n) cin >> A[i];
    whole(sort, A, greater<int>());
    int ans = 0;
    REP(i, k) ans += A[i];
    cout << ans << endl;
}

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

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

// Greatest Common Divisor
ll gcd(ll a, ll b){ return b ? gcd(b,a%b) : a; }
// Least Common Multiple
ll lcm(ll a, ll b){ return a/gcd(a,b)*b; }


const string YES = "Yes";
const string NO = "No";

void solve(std::string S){
    map<ll, ll> cnt;
    for(int i = 0; i < S.size(); ++i) cnt[S[i]] += 1;
    if(cnt.size() == 2){
        bool flag = false;
        for(auto i : cnt){
            if(i.second != 2) flag = true;
        }
        if(flag) cout << NO << endl;
        else cout << YES << endl;
    }
    else cout << NO << endl;
}


int main(){
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef vector<ll> vll;

#define repi(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,a) repi(i,0,a)
#define rrep(i,a) for(ll i=a-1;i>=0;i--)
#define MOD 998244353

//debug
#define debug(arr) cerr<<#arr<<"(l"<<__LINE__<<") : ";for(auto x:arr)cerr<<x<<" ";cerr<<endl;


int main(){
  ll N, S;
  cin >> N >> S;
  vll A(N);
  rep(i, N) cin >> A[i];

  vector<vll> dp(2, vll(S+1, 0));
  ll ans = 0;
  rep(i, N){
    rep(s, S+1) dp[(i+1)%2][s] = dp[i%2][s];
    rep(s, S+1-A[i]) dp[(i+1)%2][s+A[i]] = (dp[(i+1)%2][s+A[i]] + dp[i%2][s]) % MOD;
    if(A[i] <= S) dp[(i+1)%2][A[i]] = (dp[(i+1)%2][A[i]] + i + 1) % MOD;
    ans = (ans + dp[(i+1)%2][S]) % MOD;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int N = 2000 + 10;
vector<int>vt[N];
int a[N],b[N],n,k,cnt;
void DFS(int u,int fa,int l) {
    if(l>k/2) cnt++;
    for(int i=0;i<vt[u].size();i++) {
        if(vt[u][i]==fa) continue;
        DFS(vt[u][i],u,l+1);
    }
}
int main() {
    scanf("%d%d",&n,&k);
    for(int i=1;i<n;i++) {
        scanf("%d%d",&a[i],&b[i]);
        vt[a[i]].push_back(b[i]);
        vt[b[i]].push_back(a[i]);
    }
    if(k==1||k>=n-1) return 0*printf("%d\n",max(0,n-1-k));
    int ans=3000;
    if(k&1) {
        for(int i=1;i<n;i++) {
            cnt=0;
            DFS(a[i],b[i],0);
            DFS(b[i],a[i],0);
            ans=min(ans,cnt);
        }
    }
    else {
        for(int i=1;i<=n;i++) {
            cnt=0;
            DFS(i,-1,0);
            ans=min(ans,cnt);
        }
    }
    printf("%d\n",ans);
    return 0;
}

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

int main() {
  int a,b;
  cin>>a>>b;
  int ans=6;
  ans-=(a+b);
  cout<<ans<<endl;
  
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pi 3.14159
using namespace std;
typedef long long LL;
const LL MOD = 1e9 + 7;
const int N = 2e7 + 9, M = 1e7, OO = 0x3f3f3f3f;
#define AC ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin.sync_with_stdio(0);
int main()
{
int n,i;
string s;
cin>>s;
n=s.size();
int acounter=0,bcounter=0;
for(i=0;i<n;++i){
    if(s[i]=='A'){
        acounter++;
    }
    else{
        bcounter++;
    }
}
if(acounter==0||bcounter==0){
    printf("No\n");
}
else{
    printf("Yes\n");
}




    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using s64 = signed long long;
using u64 = unsigned long long;
using f128 = long double;

int main()
{
    s64 x;
    cin >> x;

    if(x >= 30)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
#define f first
#define s second
#define pb push_back
typedef long long int ll;
const int N=105;
int k,c;
vector < ll > v;
void rec(ll num, int ind){
    if(ind==c-1){
        v.pb(num);
        return;
    }
    int x= (num%10);
    num*=10;
    if(x-1>-1) rec(num+x-1,ind+1);
    rec(num+x,ind+1);
    if(x+1<10) rec(num+x+1,ind+1);
    return;
}
int main(){
    cin.tie(NULL);
    cout.tie(NULL);
    ios_base::sync_with_stdio(false);
    cin>>k;
    while(v.size()<k){
        c++;
        for(int i=1;i<=9;i++)
            rec(i,0);
    }
    cout<<v[k-1]<<'\n';
    return 0;
}


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

#define ll long long int
#define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define vvi vector<vector<ll>>
#define vi vector<ll>
#define all(a) (a).begin(),(a).end()
#define pii pair<ll,ll>
#define rep(x,n) for(ll i=x;i<n;++i)
#define repd(x,n) for(ll i=x-1;i>=n;--i)
#define repn(x,n) for(ll j=x;j<n;++j)
#define repnd(x,n) for(ll j=x-1;j>=n;--j)
#define endl '\n'
#define M 1000000007
const ll INF = 1ll<<60;

using namespace std;

ll fact(ll n){ ll p=1; rep(1,n+1){ p*=i; } return p; }

bool isprime(ll a){
    if(a==2) {
        return 1;
    }
    if(!(a&1) ) {return 0;}
    for(ll i=3;i*i<=a;i+=2){
        if(a%i==0) {return 0;}
    }
    return 1;
}

ll fast_power(long long base, long long power)  //for(2^100)
{   long long result=1;
    while(power>0) {
        if(power&1) {
            result=(result*base)%M;
        }
        base=(base*base)%M;
        power>>=1;
    }
    return result;
}

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

    string s1,s2;
    cin>>s1;
    cin>>s2;
    int k=0;
    rep(0,s2.size()-1){
        if(s1[i]!=s2[i]){k=1;break;}
    }
    if(k==0) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;

	return 0;
}



Measured memory_bytes: 3652
INF = 2 * (10 ** 9) - 1

n = int(input())
xl = [[0] * 2 for i in range(n)]
for i in range(n) :
    x, l = map(int, input().split())
    xl[i][0] = x-l
    xl[i][1] = x+l

xl.sort(key=lambda x:x[1])

cnt = 0
#print(xl)
cur = -10 ** 10
ans = 0

for i in range(n) :
    if cur <= xl[i][0] :
        #print(i)
        ans += 1
        cur = xl[i][1]
        #prinst(xl[i])


print(ans)


Measured memory_bytes: 21320
#include <iostream>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <cstdio>
#include <algorithm>
#include <stack>
#include <queue>
#include <cmath>
#include <iomanip>
#include <fstream>
//#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
const ll INF = (1 << 30);
const ll inf = (1LL << 50LL);
const int  maxn = 1e5 + 5;
int n, m;
vector<int> graph[maxn];
int dp[maxn];
int rek(int at){
    if(dp[at] != -1){
        return dp[at];
    }
    int ret = 0;
    for(int i = 0; i < (int)graph[at].size(); i ++){
        int node = graph[at][i];
        ret = max(ret, rek(node) + 1);
    }
    return dp[at] = ret;
}
int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
//    ifstream cin("in.txt");
    cin >> n >> m;
    int a, b;
    for(int i = 0; i < m; i ++){
        cin >> a >> b;
        a --;
        b --;
        graph[a].push_back(b);
    }
    memset(dp, -1, sizeof dp);
    int ret =0 ;
    for(int i =0 ; i < n; i ++){
        ret = max(ret, rek(i));
    }
    cout << ret << endl;
    return 0;
}


Measured memory_bytes: 8832
import math
import itertools
import statistics
#n = int(input())
n = int(input())
t, a = list(map(int, input().split()))
h =  list(map(int, input().split()))

m = 100000
min_index = -1
for i in range(n):
    tem = t-h[i]*0.006
    if abs(a-tem) < m:
        m = abs(a-tem)
        min_index = i

print(min_index+1)

Measured memory_bytes: 5404