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

typedef long long ll;
typedef pair<ll, ll> P;

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define dep(i, a, n) for(int i = a; i >= (n); i--)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll
#define INF 1500000000000000000

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

vector<P> vis[2][100001];
ll d[2][100001], n, mn[100001];

int dijkstra(int a, int b) {
  priority_queue<P, vector<P>, greater<P> > q;
  rep(i, n) d[b][i] = INF;
  d[b][a] = 0;
  q.push(make_pair(0, a));
  while(!q.empty()) {
    P p = q.top(); q.pop();
    ll t = p.second;
    if(d[b][t] < p.first) continue;
    for(auto x : vis[b][t]) {
      if(d[b][x.second] > d[b][t] + x.first) {
        d[b][x.second] = d[b][t] + x.first;
        q.push(make_pair(d[b][x.second], x.second));
      }
    }
  }
}

signed main() {
  ll m, s, t;
  cin >> n >> m >> s >> t;
  ll u, v, a, b;
  rep(i, m) {
    cin >> u >> v >> a >> b;
    u--, v--;
    vis[0][u].emplace_back(a, v);
    vis[0][v].emplace_back(a, u);
    vis[1][u].emplace_back(b, v);
    vis[1][v].emplace_back(b, u);
  }
  rep(i, n + 1) mn[i] = INF;
  dijkstra(s - 1, 0);
  dijkstra(t - 1, 1);
  dep(i, n - 1, 0) {
    mn[i] = min(mn[i + 1], d[0][i] + d[1][i]);
  }
  rep(i, n) cout << 1000000000000000 - mn[i] << endl;
	return 0;
}

Measured memory_bytes: 19196
/* HARDWORK IS THE KEY TO SUCCESS.
   RATING IS TEMPORARY , KNOWLEDGE IS PERMANENT.
   PREFER CODING RATHER THAN MEDITATION !!!*/

#include <bits/stdc++.h>
#define pragma
using namespace std;
#define ll long long
#define ld long double
#define vin ll n; cin>>n; vector<ll>x(n); for(ll i=0; i<n; i++) cin>>x[i]
#define vout for(ll i=0; i<n; i++) cout<<x[i]<<" "
#define T ll t = 1; cin>>t; while(t--)
#define ain ll n,i; cin>>n; ll a[n]; for( i=0; i<n; i++) cin>>a[i]
#define aout for(ll i=0; i<n; i++) cout<<a[i]<<" "
#define matin ll m,n; cin >> n >> m; ll a[n + 1][m + 1] ; for(ll i=1;i<=n;i++) for(ll j=1;j<=m;j++) cin>>a[i][j];
#define matout for(ll i=0;i<m;i++){for(ll j=0;j<n;j++) cout<<a[i][j]<<" "; cout<<"\n";}
#define F first
#define S second
#define I insert
#define sin set<ll>s; ll n; cin>>n; ll tmp; for(ll i=0;i<n;i++){cin>>tmp; s.I(tmp);}
#define sout for(auto it=s.begin();it!=s.end();++it) cout<<*it<<" "
#define AISORT sort(a,a+n)
#define ADSORT sort(a,a+n,greater<ll>())
#define VISORT sort(x.begin(),x.end())
#define VDSORT sort(x.begin(),x.end(),greater<ll>())
#define pb push_back
#define ppb pop_back
#define N_ cout<<"\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b) ((a)*1ll * (b)) / gcd(a, b)


 
const ll maxs = 1e5+3;
const ll maxs1 = 1e2+4;
const ll mod = 1e9 + 7;

//MODULO OPEARTIONS
inline ll add(ll a, ll b) { return (mod + a + b) % mod; }
inline ll sub(ll a, ll b) { return (a - b + mod) % mod; }
inline ll mul(ll a, ll b) { return (1ll * a * b) % mod; }

//POWER
ll fastpow(ll x,ll y)
{ll res = 1;x = x % mod;while (y > 0){ if (y & 1)res = (res * x) % mod; y = y >> 1 ; x = (x * x) % mod; } return res;}

//MODULAR INVERSE
ll inv(ll x){ return pow(x , mod - 2);}

bool vis[maxs];
vector<ll>graph[maxs];


int main()
{
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,i;
    cin >> n;
    cout << (n + 1)/2;
//     ll a[n];
//     for(i = 0;i < n;++i)
//     {
//         cin >> a[i];
//     }
//     map<ll,ll>mp;
//     for(i = 0;i < n;++i)
//     {
//         mp[i - a[i]] += a[i];
        
//     }
    
//     ll maxx = -1;
//     for(auto it:mp)
//     {
//         maxx = max(maxx,it.S);
//     }
    
//     cout << maxx;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

		public static void main(String[] args){
			Scanner sc = new Scanner(System.in);
			String a = sc.next();
			String b = sc.next();
			String c = sc.next();
					System.out.println(a.substring(0,1)+b.substring(1,2)+c.substring(2,3));}}

Measured memory_bytes: 23252
#include<iostream>
#include<cmath>
#include<algorithm>
#include <cassert>
#include<string>
#define rep(i,rept) for(long long i = 0; i <(long long)rept;i++)
using namespace std;
int main() {
	int a = 0, b = 0, c = 0, d[100000], e[100000], f = 0, g = 0, h = 0, count = 0,x=0,y=0,z=0;
	char rikka, toka[100000];
	string saya, homu, kyok, mami, mado[50];
	bool gg = false;
	int manji, nk[26] = { false };
	cin >> a;
	for (int j = 1; j < a+1; j = j + 2) {
       for (int i = 1; i < a+1; i = i + 2) {
		   if (j % i == 0) {
			   count++;
			}
		}
	   if (count == 8) { x++; }
	   count = 0;
	}
	cout << x << endl;
	return 0;
}

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

using namespace std;

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

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

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

template<typename T> inline void CHMAX(T& a, const T b) {if(a<b) a=b;}
template<typename T> inline void CHMIN(T& a, const T b) {if(a>b) a=b;}

constexpr ll MOD=1000000007ll;
// constexpr ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  // cout<<setprecision(10)<<fixed;
  ll t[2], a[2], b[2];
  cin>>t[0]>>t[1]>>a[0]>>a[1]>>b[0]>>b[1];
  if(a[0]>b[0]){
    swap(a[0], b[0]);
    swap(a[1], b[1]);
  }
  ll c=t[0]*a[0]+t[1]*a[1], d=t[0]*b[0]+t[1]*b[1];
  if(c==d){
    cout<<"infinity"<<'\n';
    return 0;
  }
  if(c<d){
    cout<<0<<'\n';
    return 0;
  }
  ll ans=1;
  ll x=t[0]*b[0]-t[0]*a[0];
  ans+=2*(x/(c-d));
  if(x%(c-d)==0){
    --ans;
  }
  cout<<ans<<'\n';
  return 0;
}

Measured memory_bytes: 256
"use strict";
const Main = (input) =>{
   let xs = input.trim().split(' ').map(v=>parseInt(v,10)); 
   let N = xs[0], A = xs[1], B = xs[2];
   let max = 0;
   let min = 0;
   if(A<B){
     max = A;
     if(N>A+B){
       min = 0;
     }else if(N==A&&N==B){
       min = A;
     }else{
       min = (A + B) - N;
     }
    console.log(max + ' ' +min);  
   }else{
     max = B;
     if(N>A+B){
       min = 0;
     }else if(N==A&&N==B){
       min = B;
     }else{
       min = (A + B) - N;
     }
    console.log(max + ' ' +min);
   }
}
Main(require('fs').readFileSync('/dev/stdin','utf8'));

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

int main()
{
    int W, H, x, y, r;
    cin >> W >> H >> x >> y >> r;
    if (x - r >= 0 && y - r >= 0 && x + r <= W && y + r <= H)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


Measured memory_bytes: 3112
#include<iostream>
using namespace std;
int A,B,C,tot,a,b,c;
int main()
{
    scanf("%d%d%d",&A,&B,&C);
    while(!((A&1)||(B&1)||(C&1)))
	{
        if(A==B&&B==C)
		{
            cout<<"-1"<<endl;
            return 0;
        }
        tot++,a=(B+C)>>1,b=(A+C)>>1,c=(B+A)>>1;
        A=a,B=b,C=c;
    }
    cout<<tot<<endl;
    return 0;
}

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

using namespace std;
typedef long long ll;

ll n;
ll a[1000000];
ll b[1000000];
bool comp2(const ll& left, const ll& right) {
    return left > right;
}
int main(){
    ll max1=0, max2=0;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> a[i];
        b[i] = a[i];
    }

    for(int i=0; i<n; i++){
        if( a[i]>max1 ){
            max2 = max1;
            max1 = a[i];
        }else if( a[i] >= max2){
            max2 = a[i];
        }
    }
    for(int i=0; i<n; i++){
        if( a[i]==max1) cout << max2 << endl;
        else cout << max1 << endl;
    }
    return 0;
}


Measured memory_bytes: 7296
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
  int n, m, s[393], l[393], p[393], w;
  vector< int > dp( 394, -1); //dp[i]:i長のメロディを作るための最大値
  dp[0] = 0;
  cin >> n;
  for(int i = 0; i < n; i++){
    cin >> s[i] >> l[i] >> p[i];
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j <= 393; j++){
      if(dp[j] == -1) continue;
      for(int k = s[i]; k <= l[i] && j + k < 394; k++){
        dp[j + k] = max( dp[j + k], dp[j] + p[i]);
      }
    }
  }
  cin >> m;
  vector< int > ret(m);
  bool flag = true;
  for(int i = 0; i < m && flag; i++){
    cin >> w;
    ret[i] = dp[w];
    flag &= ret[i] != -1;
  }
  if(flag){
    for(int i = 0; i < m; i++){
      cout << ret[i] << endl;
    }
  }else{
    cout << -1 << endl;
  }
  return 0;
}

Measured memory_bytes: 1200
/**
 *      purpose : 
 *      author  : kyomukyomupurin
 *      created : 
**/

#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
using pii = pair<int, int>;
using pll = pair<int64, int64>;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define all(v) (v).begin(), (v).end()
#define print(x) cout << (x) << '\n'
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define fi first
#define se second

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n, a, b; cin >> n >> a >> b;
    int sum = 0;
    for (int i = 0; i < n; ++i){
        int t; cin >> t;
        sum += (t < a || t >= b);
    }
    print(sum);
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <sstream>
#include <set>
#include <map>
#define LLMAX 9223372036854775807

using namespace std;
using ll = long long;

ll countCandy(vector<vector<ll>> &argA, ll posX, ll posY, ll argN)
{
	if (posX == 1 && posY == argN - 1) {
		return 0;
	}

	ll num1 = 0;
	if (posX + 1 < 2) {
		num1 = argA.at(posX + 1).at(posY) + countCandy(argA, posX + 1, posY, argN);
	}
	ll num2 = 0;
	if (posY + 1 < argN) {
		num2 = argA.at(posX).at(posY + 1) + countCandy(argA, posX, posY + 1, argN);
	}

	return max(num1, num2);
}

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

	vector<vector<ll>> argA(2, vector<ll>(argN));
	for (ll i = 0; i < 2; ++i) {
		for (ll j = 0; j < argN; ++j) {
			cin >> argA.at(i).at(j);
		}
	}

	ll ret = argA.at(0).at(0);
	ret += countCandy(argA, 0, 0, argN);

	cout << ret << endl;
}

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

int main(){
    int n;
    string s;
    cin>>n;
    cin>>s;
    
    bool f=true;
    for(int i=0;i<n;++i){
        if(s[i]=='R'){
            f=false;
            break;
        }
    }
    if(f){
        cout<<0<<endl;
        return 0;
    }
    
    f=true;
    for(int i=0;i<n;++i){
        if(s[i]=='W'){
            f=false;
            break;
        }
    }
    if(f){
        cout<<0<<endl;
        return 0;
    }
    
    int r=0;
    for(int i=0;i<n;++i){
        if(s[i]=='R') ++r;
    }
    int res=0;
    for(int i=0;i<r;++i){
        if(s[i]=='W') ++res;
    }
    
    cout<<res<<endl;
}

Measured memory_bytes: 3736
#include<iostream>
#include<list>
#include<vector>
#include<string>
#include<cmath>

using namespace std;

int main(){
    int H, W;
    cin >> H >> W;
  	char C[H][W] = {};
    for (int i = 0; i < H; i++) {
      for (int j = 0; j < W; j++) {
        cin >> C[i][j];
      }
    }
  
    for (int i = 0; i < 2*H; i++) {
      for (int j = 0; j < W; j++) {
        cout << C[i/2][j];
      }
      cout << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int n,m,vis1[300003],vis2[300003],a,b,i;
int main()
{
    cin>>n>>m;
    while(m--)
    {
        cin>>a>>b;
        if(a==1)
        {
            vis1[b]=1;
        }
        if(b==1)
        {
            vis1[a]=1;
        }
        if(a==n)
        {
            vis2[b]=1;
        }
        if(b==n)
        {
            vis2[a]=1;
        }
    }
    for(i=0;i<=300000;i++)
    {
        if(vis1[i]==1&&vis2[i]==1)
        {
            cout<<"POSSIBLE"<<endl;
            return 0;
        }
    }
    cout<<"IMPOSSIBLE"<<endl;

    return 0;
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
#define endl '\n'
#define int long long
#define lint long long
#define pii pair<int, int>
#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(v) (v).begin(), (v).end()
#define SZ(v) ((int)v.size())
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define MINF(a) memset(a, 0x3f, sizeof(a))
#define POW(n) (1LL << (n))
#define POPCNT(n) (__builtin_popcount(n))
#define IN(i, a, b) (a <= i && i <= b)
using namespace std;
template <typename T> inline bool CHMIN(T& a,T b) { if(a>b) { a=b; return 1; } return 0; }
template <typename T> inline bool CHMAX(T& a,T b) { if(a<b) { a=b; return 1; } return 0; }
template <typename T> inline void SORT(T& a) { sort(ALL(a)); }
template <typename T> inline void REV(T& a) { reverse(ALL(a)); }
template <typename T> inline void UNI(T& a) { sort(ALL(a)); a.erase(unique(ALL(a)),a.end()); }
template <typename T> inline T LB(vector<T>& v, T a) { return *lower_bound(ALL(v),a); }
template <typename T> inline int LBP(vector<T>& v, T a) { return lower_bound(ALL(v),a) - v.begin(); }
template <typename T> inline T UB(vector<T>& v, T a) { return *upper_bound(ALL(v),a); }
template <typename T> inline int UBP(vector<T>& v, T a) { return upper_bound(ALL(v),a) - v.begin(); }
template <typename T1, typename T2> ostream& operator<< (ostream& os, const pair<T1,T2>& p) { os << p.first << " " << p.second; return os; }
template <typename T1, typename T2> istream& operator>> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
template <typename T> ostream& operator<< (ostream& os, const vector<T>& v) { REP(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
template <typename T> istream& operator>> (istream& is, vector<T>& v) { for(T& in : v) is >> in; return is; }
template <typename T = int> vector<T> make_v(size_t a) { return vector<T>(a); }
template <typename T, typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...)); }
template <typename T, typename V> typename enable_if<is_class<T>::value == 0>::type fill_v(T &t, const V &v) { t = v; }
template <typename T, typename V> typename enable_if<is_class<T>::value != 0>::type fill_v(T &t, const V &v) { for(auto &e : t) fill_v(e, v); }
const lint MOD = 1000000007;
const lint INF = 0x3f3f3f3f3f3f3f3f;
const double PI = 3.14159265358979323846;
const double EPS = 1e-10;



void _main() {
    int M1, D1, M2, D2;
    cin >> M1 >> D1 >> M2 >> D2;
    cout << (M1 != M2) << endl;
}

signed main(signed argc, char **argv) {
    if (argc > 1) {
        if (strchr(argv[1], 'i')) freopen("input.txt", "r", stdin);
        if (strchr(argv[1], 'o')) freopen("output.txt", "w", stdout);
    }
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(10);
    _main();
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string>

#define rep(i, a, b) for ( int i = (a); i < (b); i++ )
#define per(i, a, b) for ( int i = (b)-1; i >= (a); i--)
#define pb push_back
#define mp make_pair
#define bg begin()
#define en end()
#define all(v) (v).begin(), (v).end()
#define sz(v) (int)(v).size()


using namespace std;

typedef long long ll;

static const long long MOD = 1000000007;
static const long long INF = 1<<30;

ll n, k, ans, a[505], s[505];
vector<ll> dv, r;
 
int main(void) {
  cin >> n >> k;
  
  ll sum = 0;
  rep(i, 0, n) {
    scanf("%lld", &a[i]);
    sum += a[i];
  }
  
  for (int i=1; i*i<=sum; i++) {
    if (sum%i==0) {
      dv.pb(i);
      dv.pb(sum/i);
    }
  }
  
  sort(all(dv));
 
  for (ll d : dv) {
    //printf("divisor: %lld\n", d);
    memset(s, 0, sizeof(s));
    vector<ll> r;
    ll c = INF;
    rep(i, 0, n) r.pb(a[i]%d);
    sort(all(r));
    /*for (ll x : r) printf("%lld ", x);
    printf("\n");*/
    rep(i, 1, n+1) s[i] = s[i-1] +r[i-1];
    
    rep(i, 0, n+1) {
      ll left = s[i];
      ll right = (n-i)*d - (s[n] - s[i]);
      //printf("left:%lld, right: %lld\n", left, right);
      ll t = max(left, right);
      //printf("c:%lld t:%lld\n", c, t);
      c = min(c, t);
    }
    
    if (c<=k) ans = d;
    
  }
  
    cout << ans << endl;
    return 0;
}


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

using namespace std;

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

  int s = sqrt(2.0 * N);
  while (s * (s + 1) / 2 < N)
    ++s;
  int r = s * (s + 1) / 2 - N;

  for (int i = 1; i < r; ++i)
    cout << i << "\n";
  for (int i = r + 1; i <= s; ++i)
    cout << i << "\n";
  return 0;
}


Measured memory_bytes: 256
import math

N, M = map(int, input().split())
ans = 0

if N>=2:
	ans += math.factorial(N)/(math.factorial(N-2)*math.factorial(2))
    
if M>=2:
	ans += math.factorial(M)/(math.factorial(M-2)*math.factorial(2))  

print(int(ans))

Measured memory_bytes: 3060
n,k=map(int,input().split())
a=[i for i in range(n+1)]

b=[0]
c=[a[-1]]
for i in range(1,n+1):
    b.append(i+b[i-1])
    c.append(c[i-1]+(n-i))


if n+1==k:
    print(1)
else:
    s=0
    for i in range(k-1,n+1):
        s+=abs(b[i]-c[i])+1
    print(s%1000000007)


Measured memory_bytes: 96728
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
using System.Threading;
using System.Runtime.CompilerServices;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var t="";
		for(int i = 0;i<n;i++) {
			t+="ACL";
		}
		Console.WriteLine("{0}",t);
	}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),int.Parse);}
	public int[] Ia3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),long.Parse);}
	public long[] La3(int a){return Array.ConvertAll((Console.ReadLine()+" "+a.ToString()).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(string a,string b){return Array.ConvertAll((a+Console.ReadLine()+b).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 27544
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <numeric>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
    ll A, B, N, x, ans;
    cin >> A >> B >> N;
    x = min(N, B - 1);
    ans = A*(x%B) / B;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,c=0;
  cin>>n;
  string s;
  cin>>s;
  for(int i=0;i<n-1;i++)
  {
    if(s[i]==s[i+1])
      c++;
  }
  cout<<n-c;
}

Measured memory_bytes: 512
h, n=input().split()
h = int(h)
n = int(n)

temp = input().split()
a = list(map(int, temp))

ans = 0

# range(n) = range(0,n,1) => start, end, skip
#for i in range(n):
#    ans += a[i]

#配列aの中身を最後までループ、中身はそのままiで計算できる
for i in a:
    ans += i

if (ans >= h):
    print("Yes")
else:
    print("No")

Measured memory_bytes: 13964
import math
def comb(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,P = map(int, input().split())
A = [int(i) for i in input().split()]

odd,even = 0,0
for a in A:
    if a % 2 == 0: even += 1
    else: odd += 1

ans = 0
for o in range(1 if P % 2 == 1 else 0, odd + 1, 2):
    for e in range(even + 1):
        ans += comb(odd, max(0,o)) * comb(even, e)

print(ans)

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

int main() {
    int n;
    cin >> n;
    int l[n];
    rep(i, n) cin >> l[i];
    sort(l, l + n);

    int ans = 0;
    rep(i, n) {
        for (int j = i + 1; j < n; j++) {
            for (int k = j + 1; k < n; k++) {
                if (l[k] < l[i] + l[j]) ans++;
            }
        }
    }

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


Measured memory_bytes: 3672
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repi(i,n) for(ll i=n-1;i>=0;i--)
#define sll(n) scanf("%lld", &n);
#define slf(n) scanf("%lf", &n);
typedef long long ll;
typedef double lf;
static const ll max_n = 51;
static const ll mod = 2019;
static const ll max_value = 100000000000100;
vector<vector<vector<ll>>> dp(max_n, vector<vector<ll>>(max_n, vector<ll>(max_n*max_n, 0)));
// static const ll max_x = max_value * max_value;
vector<ll> cards(max_n);
// vector<ll> S(max_n);
// vector<pair<ll, ll>> times_vec(max_n);
ll N, M;


int main(){
    // bool is_ok = true;
    // printf("------------- V=%lld---------\n", V);
    ll N, A, x, sum=0;
    sll(N);
    sll(A);
    rep(i, N){
        sll(x);
        cards[i] = x;
        // dp[0][i][x] = 1;
        sum += x;
    }

    rep(j,N+1){
        dp[0][j][0] = 1;
    }

    // dp[0][0][0] = 1;
    rep(i, N){
        // i++;
        rep(j, N){
            // j++;
            rep(k,sum+1){
                // printf("k - cards[%lld] = %lld, cards[%lld]=%lld\n", j, k-cards[j], j, cards[j]);
                ll v = dp[i+1][j][k];
                if(k-cards[j]>=0){
                    // printf("k - cards, dp[%lld][%lld][%lld]=%lld\n", i, j, k-cards[j], dp[i][j][k-cards[j]]);
                    v += dp[i][j][k-cards[j]];
                }
                dp[i+1][j+1][k] = v;
            }
        }
    }

    ll num = 0;
    rep(i,N){
        // i ++;
            // j ++;
        // printf("#### dp[%lld][%lld][%lld] = %lld\n", i+1, N, (i+1)*A, dp[i+1][N][(i+1)*A]);
        num += dp[i+1][N][(i+1)*A];
    }

    // cout<<fixed<<setprecision(10)<<num<<endl;
    cout << num << endl;
    return 0;

}

// ll main(){
//     Main();

//     return 0;

// }

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"
*/

int main()
{
    int n,q; cin >> n >> q;
    stack<int> S[n];
    rep(i,q){
        int query; cin >> query;
        if(query == 0){
            int t, x; cin >> t >> x;
            S[t].push(x);
        }else if(query == 1){
            int t; cin >> t;
            if(!S[t].empty()) cout << S[t].top() << endl;
        }else{
            int t; cin >> t;
            if(!S[t].empty()) S[t].pop();
        }
    }
}


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

ll H,h,m,s,d;
bool check(void){
  ll x = 60*H*s, y = (60*m*d+s)*H, z = 3600*h*d + 60*m*d + s;
  if(y==z)return false;
  ll dify = y-x, difz = x-z;
  if(dify<0)dify += 3600*H*d;
  if(difz<0)difz += 3600*H*d;
  return dify == difz;
}

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

int main(){
  while(cin >> H >> h >> m >> s, H){
    d = 119*H - 1; s *= d;

    for(;;){
      if(check()){
	ll g = gcd(s,d);
	cout << h << " " << m << " " << s/g << " " << d/g << endl;
	break;
      }
      s++;
      if(s/d==60)s = 0, m++;
      if(m==60)m = 0, h++;
      if(h==H)h = 0;
    }
  }
}

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

#define rep(i,n) for(long long int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(long long int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(long long int i=(a);i>(b);i--)
#define all(v) (v).begin(), (v).end()
#define pb(q) push_back(q)
#define P pair<int,int>
#define Abs(a,b) max(a,b)-min(a,b)
#define YES(condition) if(condition){cout << "YES" << endl;}else{cout << "NO" << endl;}
#define Yes(condition) if(condition){cout << "Yes" << endl;}else{cout << "No" << endl;}
#define Cout(x) cout<<(x)<<endl

typedef long long ll;

using namespace std;

const int INF = 1e9,MOD = 1e9 + 7;
const ll LINF = 1e18;

//while(x!=0){
            //sum+=x%10;
           // x/=10;
        //}
        //各桁の和

//pair<int,int> p[100000];
//P r[100000];
//cin >> tmp;
//p[i]=make_pair(tmp,i);
//cout << p[i].second+1 << endl;//ペアの右側つまりiを出力

//s.find(w[i])==string::npos
//findの使い方

//for(int i=0;i<n;i++){
   // b[i]=x%2;
    //x/=2;
  //}二進数

long long int n=1,cnt=0,ans=0,a,b,c,cmpt,cmpx,cmpy,data,m,h,w,x[100000],y[100000],t[100000],xcmp=0,ycmp=0,sum=0;

string s;

vector<int> z;

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

       cin >> n;
       rep(i,n){
           cin >> t[i] >> x[i] >> y[i];
       }
       rep(i,n){
           if(i==0){
               if(t[i]<x[i]+y[i]){
                   Cout("No");
                   return 0;
               }
              else{
                  if((t[i]-x[i]-y[i])%2==0){
                      continue;
                  }
              }
           }
           else{
                  cmpt=Abs(t[i-1],t[i]);
               cmpx=Abs(x[i-1],x[i]);
               cmpy=Abs(y[i-1],y[i]);
               if(cmpt<cmpx+cmpy){
                   Cout("No");
                   return 0;
               }
               if((cmpt-cmpx-cmpy)%2==0){
                   continue;
               }
               else{
                   Cout("No");
                   return 0;
               }
           }
           
       }
       
       Cout("Yes");
return 0;
}


Measured memory_bytes: 2560
h, w = map(int, input().split())

sl = [list(input()) for _ in range(h)]
ans = [[0]*(w+2) for _ in range(h+2)]
# print(sl,ans)

for i in range(h):
    for j in range(w):
        row = i+1
        col = j+1
        # print(sl[i][j])
        if sl[i][j] == '#':
            ans[row][col] = '#'
            if ans[row-1][col] != '#':ans[row-1][col] += 1
            if ans[row+1][col] != '#':ans[row+1][col] += 1
            if ans[row][col-1] != '#':ans[row][col-1] += 1
            if ans[row][col+1] != '#':ans[row][col+1] += 1
            if ans[row-1][col-1] != '#':ans[row-1][col-1] += 1
            if ans[row-1][col+1] != '#':ans[row-1][col+1] += 1
            if ans[row+1][col-1] != '#':ans[row+1][col-1] += 1
            if ans[row+1][col+1] != '#':ans[row+1][col+1] += 1



for i in range(h+2):
    if i != 0 and i != h+1:
        print(*ans[i][1:-1], sep='')


Measured memory_bytes: 9304
// #pragma GCC target("avx2")  // CPU 処理並列化
// #pragma GCC optimize("O3")  // CPU 処理並列化
// #pragma GCC optimize("unroll-loops")  // 条件処理の呼び出しを減らす
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
#include<numeric>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-10;
const double INF=1e+10;
const double PI=acos(-1.0);
const int C_SIZE = 3121000;
namespace{
	long long fact[C_SIZE];
	long long finv[C_SIZE];
	long long inv[C_SIZE];
	long long Comb(int a,int b){
	 	if(a<b||b<0)return 0;
	 	return fact[a]*finv[b]%mod*finv[a-b]%mod;
	}
	void init_C(int n){
		fact[0]=finv[0]=inv[1]=1;
		for(int i=2;i<n;i++){
			inv[i]=(mod-(mod/i)*inv[mod%i]%mod)%mod;
		}
		for(int i=1;i<n;i++){
			fact[i]=fact[i-1]*i%mod;
			finv[i]=finv[i-1]*inv[i]%mod;
		}
	}
	long long pw(long long a,long long b){
		if(a<0LL)return 0;
		if(b<0LL)return 0;
		long long ret=1;
		while(b){
			if(b%2)ret=ret*a%mod;
			a=a*a%mod;
			b/=2;
		}
		return ret;
	}
	int ABS(int a){return max(a,-a);}
	long long ABS(long long a){return max(a,-a);}
	double ABS(double a){return max(a,-a);}
	int sig(double r) { return (r < -EPS) ? -1 : (r > +EPS) ? +1 : 0; }
}
// ここから編集しろ
char S[5];
char T[5];
int main(){
	scanf("%s%s",S,T);
	int ret=0;
	for(int i=0;i<3;i++)if(S[i]==T[i])ret++;printf("%d\n",ret);
}

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

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;


#define pb push_back
#define ff first
#define ss second
#define INF int(3e9)
#define BIG_INF ll(9e18)
#define SIZE 200001
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define len(v) int((v).size())
#define sqr(x) (x) * (x)
#define cube(x) (x) * (x) * (x)
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout);


ll binpow(ll a, ll b, ll MOD = BIG_INF)
{
    ll res = 1;

    while(b)
    {
        if(b & 1)
            res *= a;
        a *= a;
        b >>= 1;
        a %= MOD;
        res %= MOD;
    }

    return res % MOD;
}

const ll mod = 1e9 + 7;

int T = 1;
int n, k;
ll a[SIZE];

void solve()
{
    cin >> n >> k;
    for(int i = 0; i < n; i++) cin >> a[i];


    for(int i = k; i < n; i++)
    {
        if(a[i] > a[i - k]) cout << "Yes\n";
        else cout << "No\n";
    }

    return;
}


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
//    filein;fileout;

//    cin >> T;

    while(T--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 5140
//#include <bits/stdc++.h>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define fast_io()                \
    ios::sync_with_stdio(false); \
    std::cin.tie(0);
#define mod 998244353
typedef long long ll;
typedef long double ld;
using namespace std;

int main()
{
    fast_io();
    int n;
    cin >> n;
    int a[n];
    int t;
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
        if (i > 0)
            t = t ^ a[i];
        else
            t = a[i];
    }
    int ans;
    for (int i = 0; i < n; i++)
    {
        ans = t ^ a[i];
        cout << ans << " ";
    }

    return 0;
}

Measured memory_bytes: 3888
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <math.h>
#include <sstream>

using namespace std;

int main()
{
  int N;
  string s;
  cin >> N;
  cin >> s;
  int cr = count(s.begin(), s.end(), 'R');
  int cb = count(s.begin(), s.end(), 'B');
  if (cr > cb) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <string>
#include <cmath>
#include <sstream>
#include <istream>
#include <iomanip>
#include <typeinfo>
#include <stack>

using namespace std;
typedef long long ll;
int MOD = 1000000007;
int dp[110][4][4][4];

int main(){

    int S;
    cin >> S;
    //AGCT 0123
   
    //初期化
    dp[0][3][3][3] = 1;

    for(int i = 0; i < S; i++){
        //cout << i << endl;
        for(int c1 = 0; c1 < 4; c1++){
            for(int c2 = 0; c2 < 4; c2++){
                for(int c3 = 0; c3 < 4; c3++){
                    if(dp[i][c1][c2][c3] == 0) continue;
                    //新しく前に追加するものをループで回す
                    for(int a = 0; a < 4; a++){
                        //追加の仕方で違反するもの
						if (a == 2 && c1 == 1 && c2 == 0) continue;
						if (a == 2 && c1 == 0 && c2 == 1) continue;
						if (a == 1 && c1 == 2 && c2 == 0) continue;
						if (a == 2 && c1 == 1 && c3 == 0) continue;
						if (a == 2 && c2 == 1 && c3 == 0) continue;

                        //文字列が作れるのでdp[n+1]に何個くれたのかを記録する
						dp[i + 1][a][c1][c2] += dp[i][c1][c2][c3];
						dp[i + 1][a][c1][c2] %= MOD;

                    }
                    
                }
            }
        }
    }

    int ans = 0;
    for(int c1 = 0; c1 < 4; c1++){
        for(int c2 = 0; c2 < 4; c2++){
            for(int c3 = 0; c3 < 4; c3++){
                ans += dp[S][c1][c2][c3];
                ans %= MOD;
            }
        }
    }

    cout << ans << endl;

} 

Measured memory_bytes: 256
<?php
  	fscanf(STDIN, '%d %d', $card_num, $gate_num);
	$bottom = 1;
	$top = $card_num;
	for($i = 0; $i < $gate_num; $i++){
      	fscanf(STDIN, '%d %d', $min, $max);
      	$bottom = max($bottom, $min);
      	$top = min($top, $max);
    }
	if($top < $bottom){
      	echo 0;
      	exit;
    }
	echo $top - $bottom + 1;


Measured memory_bytes: 4728
#! usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    a1, a2, a3 = map(int, input().split())

    c1 = abs(a2-a1) + abs(a3-a1)
    c2 = abs(a1-a2) + abs(a3-a2)
    c3 = abs(a1-a3) + abs(a2-a3)

    print(min(c1, c2, c3))


if __name__ == '__main__':
    main()


Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
const int mx = 100005;
int n, d[mx], ans;
int main(){
	scanf("%d", &n);
	rep(i,n) scanf("%d", d+i);
	sort(d, d+n);
	printf("%d\n", d[n/2] - d[n/2-1]);
}

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

int main(){
  int n,r = 0,b = 0;
  cin >> n;
  char s[n];
  for(int i=0;i<n;i++){
    cin >> s[i];
  }
  for(int i=0;i<n;i++){
    if(s[i] == 'B')b += 1;
    else r += 1;
  }
  if(r > b)cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
import sys

# A - Kenken Race
def can_goal(start, goal):
	global S

	way = S[start:goal+1]

	if not '##' in way:
		return True


def can_go_halfway(start, goal):
	global S

	way = S[start:goal+1]

	if way.find('...') > -1:
		return True


N, A, B, C, D = map(int, input().split())
S = input()
S = '.' + S

if C < D:
	if can_goal(B, D):
		if can_goal(A, C):
			print('Yes')
			exit()
else:
	if can_go_halfway(B - 1, D + 1):
		if can_goal(A, C):
			if can_goal(B, D):
				print('Yes')
				exit()

print('No')

Measured memory_bytes: 9428
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int n, m;
char a1;
int a2;

int main()
{
    while(cin>>n>>m)
    {
    	for(int i=1; i<=n; i++)
    	{
    		for(int j=0; j<m; j++)
    		{
    			string str;
    			cin>>str;
    			if(str == "snuke")
    			{
    				a1 = j + 'A';
    				a2 = i;
    			}
    		}
    	}
    	cout<<a1<<a2<<endl;
    }
}








Measured memory_bytes: 256
a,b,c,k=list(map(int,input().split(" ")))
ans=0
if(k>0):
	ans+=min(a,k)
	k-=min(a,k)
if(k>0):
	# ans+=min(b,k)
	k-=min(b,k)
if(k>0):
	ans-=min(c,k)
	k-=min(c,k)
print(ans)

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


int main(){
  int n; cin>>n;
  int ans=0;
  vector<int> vec(n);
  
  for(int i=0;i<n;i++){
    int count=0;
    cin>>vec[i];
      for(int j=0;j<i;j++){
        if(i!=0&&vec[i]>=vec[j])count++;
      }												
    if(count==i)ans++;
  }							
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<cstdio>
#define ll long long
using namespace std;
const int mod=1e9+7;
ll jc(int x){
    ll ans=1;
    for(int i=1;i<=x;i++) ans*=i,ans%=mod;
    return ans;
}
int main(){
    int n;
    scanf("%d",&n);
    printf("%lld\n",jc(n));
    return 0;
}

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

int main(){
ios::sync_with_stdio(0);
cin.tie(0);
ll arr[5];
ll ans=1;
for(int i=0;i<5;i++){
    cin>>arr[i];

    if(arr[i]==0){
        ans=ans+i;
    }
}



cout<<ans<<endl;

}


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


typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<vvd> vvvd;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

#define pb push_back
#define mp make_pair
#define snd second
#define fst first
#define debug printf("--%d--\n",__LINE__)
#define ll long long int

int N, M;

int main(void){
	cin >> N;
	vector<int> a(N);
	int cnt = 0;
	for(int i=0;i<N;i++){
		cin >> a[i];
		if (a[i] % 2) cnt++;
	}
	cout << ((cnt % 2) ? "NO" : "YES") << endl;
	
	
	
	
	
	return 0;
}


Measured memory_bytes: 640
/**
 * neb, sw=8, ts=8
 */

#include <iostream>
#include <algorithm>
#include <vector>

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;

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

template<typename T>
inline T max(const T &x, const T &y) { if (x > y) return x; else return y; }

template<typename T>
inline T min(const T &x, const T &y) { if (x < y) return x; else return y; }

template<typename T>
inline void print_vec(const std::vector<T> &a) { for (auto i: a) { std::cout << i << " "; } std::cout << std::endl; }

int main()
{
	int a, p;
	cin >> a >> p;

	int pieces = a * 3;
	pieces += p;

	cout << pieces / 2 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  vector<int> x(n);
  for(int &c : x) {
    cin >> c;
  }
  
  vector<int> ans(100, 0);
  for(int i = 1; i <= 100 ; i++) {
    for(int c : x) {
      ans.at(i -1) += (c - i) * (c - i);
    }
  }
  sort(ans.begin(), ans.end());
  cout << ans.at(0) << endl;
}

Measured memory_bytes: 3432
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <math.h>
#include <ctype.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
typedef long long ll;
using namespace std;
int main() {
	int n;
	cin >> n;
	vector<int>vec(n);
	rep(i, n)cin >> vec[i];

	vector<int>ans(n);
	for (int i = 0; i < n; i++) {
		ans[vec[i] - 1] = i + 1;
	}
	rep(i, n) cout << ans[i] << ' ';
}


Measured memory_bytes: 1536
#include<iostream>
#include<math.h>
#include<vector>
#include<array>
#include<algorithm>
#include<numeric>
#include<map>
#include<queue>
#include<deque>
#include<set>
#include<cstdio>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

int main(){
    ll X;cin>>X;
    while(true){
        bool b=true;
        ll M=sqrt(X)/1;
        for(int i=2;i<=M;i++){
            if(X%i==0){
                b=false;
                break;
            }
        }
        if(b){break;}
        else{X++;}
    }
    cout<<X<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <sstream>
#include <algorithm>
#include <limits>
#include <climits>
#include <numeric>
#include <string>
#include <vector>
#include <map>
#include <cmath>
using namespace std;

using ll = long long;
int N, M;
vector<int> C;
vector<int> memo;

int rec(int num)
{
    if (num == 0)
        return 0;
    if (memo[num] != -1)
        return memo[num];
    int res = num;
    //遷移先の最小値
    for (int i = 0; i < M; ++i)
    {
        if (num - C[i] < 0)
            continue;
        res = min(res, rec(num - C[i]) + 1); // +1 コインを消費
    }
    return memo[num] = res;
}

int main(void)
{
    cin >> N >> M;
    C.resize(N);
    memo.assign(N + 10, -1);
    for (int i = 0; i < M; ++i)
    {
        cin >> C[i];
    }

    cout << rec(N) << endl;
    return 0;
}


Measured memory_bytes: 5524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		double x1 = sc.nextDouble();
		double y1 = sc.nextDouble();
		double x2 = sc.nextDouble();
		double y2 = sc.nextDouble();

		System.out.println(Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)));
	}

}



Measured memory_bytes: 28012
mod = 10 ** 9 + 7
n = gets.to_i

h = Array.new(60,0)
bi = [1]
59.times {bi << bi[-1] * 2 % mod}

gets.split.each do |e|
    e = e.to_i
    60.times {|i| h[i] += e[i]}
end

ans = 0
h.each_with_index do |v, i|
    ans = (ans + v * (n - v) * bi[i]) % mod
end

puts ans

Measured memory_bytes: 32388
# A - Good Integer
#  標準入力N

N = input()
my_list = []
j = 0

for i in N:
    my_list.append(i)

if my_list[0] == my_list[1] == my_list[2] or my_list[1] == my_list[2] == my_list[3]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9100
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<string> s(n);
  int i;
  for(i=0;i<n;i++){
    cin >> s.at(i);
  }
  int m;
  cin >> m;
  vector<string> t(m);
  for(i=0;i<m;i++){
    cin >> t.at(i);
  }
  int j,ans=0;
  for(i=0;i<n;i++){
    int maxi=0;
    for(j=0;j<n;j++){
      if(s.at(i)==s.at(j)){
        maxi++;
      }
    }
    for(int k=0;k<m;k++){
      if(s.at(i)==t.at(k)){
        maxi--;
      }
    }
    ans=max(maxi,ans);
  }
  cout << ans;
}
      

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <iomanip>
#include <unordered_map>
using namespace std;
#define ll long long 
#define pi pair<ll,ll>
#define rep(i,a,n) for(ll i=a;i<n;i++)
#define rrep(i,a) for(ll i=a;i>=0;i--)
ll mod=1e9+7;
/*ll power(ll x,ll n)
{
    ll ans=1;
    while(n)
    {
       if(n&1)
       ans=(ans*x)%mod;
       n>>=1;
       x=(x*x)%mod;
    }
   // ans%=mod;
    return ans;
}
/*
struct comp {
    bool operator()(const pair& x, const pair& y) const {
        if (x.second != y.second)
            return x.second < y.second;

        return x.first < y.first;
    }
};
void dfs(int source,vector<int> graph[],vector<int> &path,bool status[])
{
 path.push_back(source);
 status[source]=0;
 //int j=graph[source].size();
 for(int i=0;i<graph[source].size();i++)
 {
     if(status[graph[source][i]]==1)
     dfs(graph[source][i],graph,path,status);
 }
 return;
}*
bool solve(int i,int j,string s)
{
    while(i<j)
    {
      if(s[i]<s[j])
      return 0;
      if(s[i]>s[j])
      return 1;
      i++;
      j--;
    }
    return 1;
}
bool isprime(ll x)
{
    for(ll i=2;i<=sqrt(x);i++)
    {
        if(x%i==0)
        return 0;
    }
    return 1;
    
}
ll lg(ll x,ll n)
{
    ll ans=0;
    while(x/n!=0)
    {
        ans++;
        x/=n;
    }
    return ans;
}*/


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,i,j,k,q,t,y,x,k1,i1,j1,z,x1,y1,m,d,p;
     cin>>x>>k>>d;
     ll ans;
     m=abs(x-0);
     n=m/d;
     if(n<=k)
     {
        k=k-n;
        ans=m%d;
        if(k%2==1)
        {
            ans=d-ans;
        }
     }
     else
     {
        ans=m-k*d;
     }
     cout<<ans;
}



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

string s, v[4] = {"AC", "WA", "TLE", "RE"};
int n, c[4];
 
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);

	cin >> n;
	while (n--) {
		cin >> s;
		if (s[0] == 'A') c[0]++;
		else if (s[0] == 'W') c[1]++;
		else if (s[0] == 'T') c[2]++;
		else c[3]++;
	}
	REP(i, 0, 4)
		cout << v[i] << " x " << c[i] << '\n';
}

Measured memory_bytes: 3628
from numpy import*
N,M,*U= map(int,open(0).read().split())
T=array(U[N:])
p=ones(M+1,dtype="i8")
for s in U[:N]:p[1:]=((p[:-1]*(s==T)).cumsum()+p[1:])%(10**9+7)
print(p[-1])

Measured memory_bytes: 27776
#include <iostream>
#include <cstdio>
#include <cstring>
#include <queue>
using namespace std;
int main()
{
	long long a,b,c,k;
	cin>>a>>b>>c>>k;
	if(k%2==0)cout<<a-b<<endl;
	else cout<<b-a<<endl;
	return 0;
}

Measured memory_bytes: 256
//ABC150 C

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint N;
lint P,Q;



int main() {
  cin >> N;
  
  int array[8];
  int tmp = 0;
  rep(i,N){
    cin >> tmp;
    P += tmp*pow(10,N-i-1);
    array[i] = i+1;
  }
  rep(i,N){
    cin >> tmp;
    Q += tmp*pow(10,N-i-1);
  }
  
  int cnt_p = 0;
  int cnt_q = 0;
  do{
    tmp = 0;
    rep(i,N){
      tmp += array[i]*pow(10,i);
    }
    if(tmp < P) cnt_p++;
    if(tmp < Q) cnt_q++;
  }while(next_permutation(array,array+N));

  ans = abs(cnt_p-cnt_q);

  printf("%lld\n",ans);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

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

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1000003;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

ll fastPow(ll x, ll n)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return res;
}

ll modDiv(ll a, ll b)
{
    return a * fastPow(b, MOD - 2) % MOD;
}

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

    int q;
    cin >> q;

    ll fac[1123456];
    fac[0] = 1;
    fac[1] = 1;
    for (int i = 2; i <= MOD; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
    }

    V res;
    REP(i, q)
    {
        ll x, d, n;
        cin >> x >> d >> n;

        if (d == 0)
        {
            res.push_back(fastPow(x, n));
            continue;
        }

        ll s = modDiv(x, d);
        ll t = (s + n - 1);

        if (s % MOD == 0 || t % MOD == 0 || (s / MOD != t / MOD))
        {
            res.push_back(0);
            continue;
        }

        if (t > MOD)
            assert(false);
        ll r = modDiv(fac[t % MOD], fac[s - 1]) * fastPow(d, n) % MOD;

        res.push_back(r);
    }

    for (int i : res)
        cout << i << endl;

    return 0;
}

Measured memory_bytes: 10104
import math

dishes=[int(input()) for _ in range(5)]
#print(dishes)

remain=[val%10 for val in dishes if val%10!=0]
up=[math.ceil(val/10)*10 for val in dishes]
#print(remain)
#print(up)
if not remain:
    print(sum(up))
else:
    print(sum(up)-10+min(remain))


Measured memory_bytes: 3060