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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

ll gcd(ll a, ll b) {
  if(b == 0) return a;
  return gcd(b, a % b);
}

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

ll modpow(ll a, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

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

    int n;
    cin >> n;
    vector<ll> a(n);

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

    sort(a.begin(), a.end());

    ll N = a[n-1];//最大の数
    ll tmp_sub = abs(N-2*a[0]);
    ll r = a[0];
    for(int i = 0; i < n-1; i++){
        if(abs(N-2*a[i]) < tmp_sub){
            r = a[i];
            tmp_sub = abs(N-2*a[i]);
        }
    }

    cout << N << " " << r << endl;

    return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repr(i, n) for (int i = (n) - 1; i >= 0; i--)
#define range(a) a.begin(), a.end()

int MOD;

class mint {
  int n;
public:
  mint(int n_ = 0) : n(n_) {}
  explicit operator int() { return n; }
  friend mint operator-(mint a) { return -a.n + MOD * (a.n != 0); }
  friend mint operator+(mint a, mint b) { int x = a.n + b.n; return x - (x >= MOD) * MOD; }
  friend mint operator-(mint a, mint b) { int x = a.n - b.n; return x + (x < 0) * MOD; }
  friend mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
  friend mint &operator+=(mint &a, mint b) { return a = a + b; }
  friend mint &operator-=(mint &a, mint b) { return a = a - b; }
  friend mint &operator*=(mint &a, mint b) { return a = a * b; }
  friend bool operator==(mint a, mint b) { return a.n == b.n; }
  friend bool operator<(mint a, mint b) { return a.n < b.n; }
  friend bool operator!=(mint a, mint b) { return a.n != b.n; }
  friend istream &operator>>(istream &i, mint &a) { return i >> a.n; }
  friend ostream &operator<<(ostream &o, mint a) { return o << a.n; }
};

mint modinv(mint n) {
  int a = (int)n, b = MOD;
  int s = 1, t = 0;
  while (b != 0) {
    int q = a / b;
    a -= q * b;
    s -= q * t;
    swap(a, b);
    swap(s, t);
  }
  return s >= 0 ? s : s + MOD;
}


int main() {
  // S[j] - 10^{j-i} S[i] = 0
  // S[j] = 10^{j-i} S[i]
  // S[j] 10^{-j} = S[i] 10^{-i}
  int N; cin >> N >> MOD;
  string S; cin >> S;
  if (MOD == 2) {
    ll ans = 0;
    rep(i, N) {
      if ((S[i] - '0') % 2 == 0) {
        ans += i + 1;
      }
    }
    cout << ans << endl;
    return 0;
  }
  if (MOD == 5) {
    ll ans = 0;
    rep(i, N) {
      if ((S[i] - '0') % 5 == 0) {
        ans += i + 1;
      }
    }
    cout << ans << endl;
    return 0;
  }
  map<mint, ll> mp;
  mp[0]++;
  mint s = 0;
  mint p = 1;
  ll ans = 0;
  // P = 2, 5
  for (char c : S) {
    s = s * 10 + (c - '0');
    p *= modinv(10);
    ans += mp[s * p]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 4092
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using ddatas=pair<double,double>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<(ll)b;i++)
#define bFor(i,a,b) for(i=a;i>=(ll)b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define endl "\n"
#define pb push_back
#define output(v) do{bool f=0;for(auto outi:v){cout<<(f?" ":"")<<outi;f=1;}cout<<endl;}while(0)
const ll mod=1000000007;
const ll inf=1LL<<60;
const double PI = acos(-1);
const double eps = 1e-9;
template<class T> inline bool chmax(T& a,T b){bool x=a<b;if(x)a=b;return x;} 
template<class T> inline bool chmin(T& a,T b){bool x=a>b;if(x)a=b;return x;} 

void startupcpp(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(15);
}

double distance(ddatas& x,ddatas& y){
  double a=x.first-y.first,b=x.second-y.second;
  return sqrt(a*a+b*b);
}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

vec modncrlistp,modncrlistm;

ll modncr(ll n,ll r){
  ll i,size=modncrlistp.size();
  if(size<=n){
    modncrlistp.resize(n+1);
    modncrlistm.resize(n+1);
    if(!size){
      modncrlistp[0]=modncrlistm[0]=1;
      size++;
    }
    For(i,size,n+1){
      modncrlistp[i]=modncrlistp[i-1]*i%mod;
      modncrlistm[i]=modinv(modncrlistp[i]);
    }
  }
  return modncrlistp[n]*modncrlistm[r]%mod*modncrlistm[n-r]%mod;
}

ll modpow(ll a,ll n){
  ll res=1;
  while(n){
    if(n&1)res=res*a%mod;
    a=a*a%mod;
    n>>=1;
  }
  return res;
}

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

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}
void judgement(int a){
  if(a){
    cout<<"Yes"<<endl;
  }else{
    cout<<"No"<<endl;
  }
  if(a){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}

int main(){
  ll i,j,N,M;
  cin>>N>>M;
  N++;M++;
  vec a(N,0),b(M,0);
  mat v(N,vec(M,0));
  rep1(i,N)cin>>a[i];
  rep1(i,M)cin>>b[i];
  rep1(i,N){
    rep1(j,M){
      if(a[i]==b[j]){
        v[i][j]=v[i-1][j]+v[i][j-1]+1;
      }else{
        v[i][j]=v[i-1][j]+v[i][j-1]-v[i-1][j-1]+mod;
      }
      v[i][j]%=mod;
    }
  }
  N--;M--;
  cout<<(v[N][M]+1)%mod<<endl;
  return 0;
}


Measured memory_bytes: 31616
#include<stdio.h>
int main(void)
{
	int a,b;
	while(scanf("%d",&a)!=EOF){
	b=a%39;
	if(b==0){
		printf("3C39\n");
	}
	else if(b<10){
		printf("3C0%d\n",b);
	}
	else{
	printf("3C%d\n",b);
	}
	}
	return 0;
}

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

def solve(a, n, bool):  # bool = True: 偶数項を足した時に正
  change = 0
  sum = 0
  for i in range(n):
    sum+=a[i]
    if sum <= 0 and bool:  # 和が正を仮定しているのに0以下なら
      change += abs(1-sum)
      sum=1
    if sum >=0 and not bool:
      change += abs(-1-sum)
      sum=-1 
    bool = not bool
  return change

print(min(solve(a,n,True),solve(a,n,False)))

Measured memory_bytes: 20064
#include<stdio.h>
int A, B, i;
char c, a[102], b[102];
int main(){
  c=getchar();
  while(c!=10){
    a[A]=c;
    c=getchar(); A++;
  }
  c=getchar();
  while(c!=10){
    b[B]=c;
    c=getchar(); B++;
  }
  if(A>B){
    printf("GREATER\n");
    return 0;
  }else if(A<B){
    printf("LESS\n");
    return 0;
  }
  for(i=0; i<A; i++){
    if(a[i]>b[i]){
      printf("GREATER\n");
      return 0;
    }else if(a[i]<b[i]){
      printf("LESS\n");
      return 0;
    }
  }
  printf("EQUAL\n");
}


Measured memory_bytes: 128
#include <iostream>
#include <stdio.h>
using namespace std;
int main(){
    double r;
    cin >> r;
    
    double p=3.141592653589;
    double s= r*r*p;
    double c= 2*r*p;
    
    printf("%f %.5f\n", s, c);
    
    return 0;
    
}


Measured memory_bytes: 3196
/**
 * C - こだわり者いろはちゃん / Iroha's Obsession / 
 * https://atcoder.jp/contests/abc042/tasks/arc058_a
 **/
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;

int main() {
    int n, k; cin >> n >> k;
    vector<char> nums={'0','1','2','3','4','5','6','7','8','9'};
    for(int i=0; i<k; i++) {
        char di; cin >> di;
        nums.erase(remove(nums.begin(), nums.end(), di), nums.end());
    }
    string ans = "";
    for(int i=n;; i++) {
        string s = to_string(i);
        bool flag = true;
        for(int k=0; k<s.length(); k++) {
            if(count(nums.begin(), nums.end(), s[k])==0) {
                flag = false;
                break;
            }
        }
        if(flag) {
            ans=s;
            break;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <tuple>
#include <numeric>
#include <cstdio>
#include <cmath>
using namespace std;
using ll = long long;
const int INF = 1e9;

int main() {
    int n; cin >> n;
    vector<int> a(n+1, 0);
    for (int i = 2; i <= n; i++) {
       int inp; cin >> a[i];
    }
    vector<int> b(n+1, 0);

    for (int i = 2; i <= n; i++) {
        b[a[i]]++;
    }

    for (int i = 1; i <= n; i++) {
       cout << b[i] << endl;
    }
}

Measured memory_bytes: 4412
n=int(input())
s = [[0,0,0]]
for i in range(n):
    s.append(list(input().split()))

for i in range(1,len(s)):
    dt=int(s[i][0])-int(s[i-1][0])
    dx=int(s[i][1])-int(s[i-1][1])
    dy=int(s[i][2])-int(s[i-1][2])

    if dt<abs(dx)+abs(dy):
        print("No")
        exit()

    if (dx+dy)%2!=dt%2:
        print("No")
        exit()

print("Yes")


Measured memory_bytes: 27440
n = int(input())

s = input()

l = []

a = 0

for i in range(0, n):
    if s[i:i+1] == "E":
        a += 1
    l.append(a)

#print(l)

ans = n

for i in range(0, n):
    e = w = 0
    if i > 0:
        e = i-l[i-1]
    w = l[n-1]-l[i]
#    print(str(e)+' '+str(w))
    ans = min(ans, e+w)

print(ans)

Measured memory_bytes: 15256
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K, x) binary_search(K.begin(), K.end(), x)
#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout << x << endl
#define put(x) out(x)
#define in(x) cin >> x
#define maxx(a, b, c) max(a, max(b, c))
#define minn(a, b, c) min(a, min(b, c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;

    int main()
    {
    int N;
      in(N);
      if(N==1){
       out("Hello World") ;
      }
      else {
       int a,b;
        in(a>>b);
        out(a+b);
      }
    }

Measured memory_bytes: 256
#![allow(unused_imports)]

macro_rules! input {
    ($($name:ident : $t:tt),*,) => {
        input!($($name: $t),*)
    };
    ($($name:ident : $t:tt),*) => {
        let mut _scanned = ::_input::Scanned::new(::std::io::stdin(), 1024);
        $(
            let $name = unsafe { _read_value!(_scanned, $t) };
        )*
    };
}

macro_rules! _read_value {
    ($scanned:expr, ($($t:tt),*)) => {
        ($(_read_value!($scanned, $t)),*)
    };
    ($scanned:expr, 1based) => {
        _read_value!($scanned, usize) - 1
    };
    ($scanned:expr, [u8]) => {
        _read_value!($scanned, String).into_bytes()
    };
    ($scanned:expr, [$t:tt; $n:expr]) => {
        (0..$n).map(|_| _read_value!($scanned, $t)).collect::<Vec<_>>()
    };
    ($scanned:expr, $t:ty) => {
        $scanned.next::<$t>()
    };
}

mod _input {
    use std::fmt;
    use std::io::{self, Read};
    use std::str::{self, FromStr};

    pub struct Scanned {
        buf: Vec<u8>,
        pos: usize,
    }

    impl Scanned {
        pub fn new<R: Read>(mut input: R, estimated: usize) -> Self {
            let mut buf_ = Vec::with_capacity(estimated);
            let _ = io::copy(&mut input, &mut buf_).unwrap();
            debug_assert!(str::from_utf8(&buf_).is_ok());
            debug_assert!(buf_.iter().all(|&c| u32::from(c) <= 0x7F));
            Scanned { buf: buf_, pos: 0 }
        }

        #[inline]
        pub unsafe fn next<T: FromStr>(&mut self) -> T
        where
            T::Err: fmt::Debug,
        {
            let mut start = None;
            loop {
                match (self.buf[self.pos], start.is_some()) {
                    (b' ', true) | (b'\n', true) => break,
                    (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                    (_, false) => start = Some(self.pos),
                }
            }
            let target = &self.buf[start.unwrap()..self.pos];
            str::from_utf8_unchecked(target).parse().unwrap()
        }
    }
}

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Stderr, StderrLock, Stdout, StdoutLock, Write};
use std::iter::{self, Product, Sum};
use std::num::{ParseFloatError, ParseIntError};
use std::ops::{
    Add, AddAssign, BitAnd, BitAndAssign, BitOr, BitOrAssign, BitXor, BitXorAssign, Deref,
    DerefMut, Div, DivAssign, Mul, MulAssign, Neg, Not, Rem, RemAssign, Sub, SubAssign,
};
use std::str::{self, FromStr};
use std::{char, cmp, f32, f64, fmt, i16, i32, i64, i8, mem, thread, u16, u32, u64, u8};

fn main() {
    input! {
        x: u32,
        a: u32,
    }
    let p = x < a;
    println!("{}", if p { 0 } else { 10 });
}


Measured memory_bytes: 4352
#include<iostream>
using namespace std;
int main() {
    int n, m=1e9, b=0;
    long long r=0;
    cin >> n;
    for (int i=0; i<n; i++) {
        int a;
        scanf("%d", &a);
        r += abs(a);
        m = min(m, abs(a));
        b ^= a < 0;
    }
    cout << r - b * m * 2 << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bitset>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
using Nodes = vector<vector<int>>;
using Values = vector<ll>;

void solve(vector<ll>& ans, const Nodes& nodes, const Values& values, int idx, ll score) {
  ll n_score = values[idx] + score;
  ans[idx] = n_score;
  for(auto next : nodes[idx]) {
    if(ans[next] >= 0) {
      continue;
    }
    solve(ans, nodes, values, next, n_score);
  }
}

int main() {
  int N, Q;
  cin >> N >> Q;
  Values values(N + 1, 0);
  Nodes nodes(N + 1);
  {
    int a, b;
    for(int i = 0; i < N - 1; ++i) {
      cin >> a >> b;
      nodes[a].push_back(b);
      nodes[b].push_back(a);
    }
  }
  {
    int p, x;
    for(int i = 0; i < Q; ++i) {
      cin >> p >> x;
      values[p] += x;
    }
  }
  vector<ll> ans(N + 1, -1);
  solve(ans, nodes, values, 1, 0);

  for(int i = 1; i <= N; ++i) {
    cout << ans[i] << " ";
  }
  cout << endl;

  return 0;
}

Measured memory_bytes: 28928
#include<string>
#include<stack>
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
    string word;
    stack<int>S;
    int n,n1,n2,p;
    while(cin>>word){
        if(word=="+"){
            n1=S.top();
            S.pop();
            n2=S.top();
            S.pop();
            n=n1+n2;
            S.push(n);
        }
        else if(word=="-"){
            n1=S.top();
            S.pop();
            n2=S.top();
            S.pop();
            n=n2-n1;
            S.push(n);
        }
        else if(word=="*"){
            n1=S.top();
            S.pop();
            n2=S.top();
            S.pop();
            n=n1*n2;
            S.push(n);
        }
        else {
            p=atoi(word.c_str());
            S.push(p);
        }
    }
    cout<<S.top()<<endl;
    return 0;
}

Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
 
typedef vector<int> vi;
typedef vector<double> vd;
 
double mypow(double b ,int e){
      if(e == 0) return 1;
      if(e%2==0)
            return mypow( b*b, e/2 );
      else
            return mypow( b*b, e/2 ) * b;
}
 
int main(){
 
 
      int N,M,L; cin >> N >> M >> L ;
      if(N==1){
            cout << 1.0 << endl;
            return 0;
      }
      vector<vd> prob(N,vd(M+1,0.0));
      vector<vd> dist(N,vd(M+1,0.0));
 
      vd p(N),t(N),v(N);
      for(int i=0; i<N; i++) cin >> p[i] >> t[i] >> v[i];
 
      // PRE PROCESS
      for(int i=0; i<N; i++){
            dist[i][0] = (double)L / v[i];
            for(int j=1; j<=M; j++){
                  dist[i][j] = dist[i][j-1] + t[i];
            }
      }
      for(int i=0; i<N; i++)
            prob[i][0] = mypow((100-p[i])/100,M);
      for(int i=0; i<N; i++){
            for(int j=1; j<=M; j++){
                  if(p[i] != 100)
                        prob[i][j] = (prob[i][j-1] * (p[i]/100)) / ((100-p[i])/100);
                  else
                        prob[i][j] = 1.0;
            }
      }
      double comb = 1;
      for(int j=1; j<=M; j++){
            comb = comb * (M - j + 1) / j; 
            for(int i=0; i<N; i++){
                  prob[i][j] *= comb;
            }
      }
       
      vector<vd> sum = prob;
      for(int i=0; i<N; i++){
            for(int j=M-1; j>=0; j--){
                  sum[i][j] += sum[i][j+1];
                  if(sum[i][j] > 1) sum[i][j] = 1;
            }
      }
 
      vector<vd> ans = prob;
      for(int i=0; i<N; i++){
            for(int j=0; j<=M; j++){
                  for(int k=0; k<N; k++){
                        if(i==k) continue;
                        int id = upper_bound(dist[k].begin(),dist[k].end(), dist[i][j]) - dist[k].begin();
                        if(id > M) ans[i][j] = 0.0;
                        else       ans[i][j] *= sum[k][id];
 
                  }
            }
      }
 
      for(int i=0; i<N; i++){
            double tmp = 0.0;
            if(p[i] == 100) tmp = ans[i][M];
            else
                  for(int j=0; j<=M; j++)
                        tmp += ans[i][j];
            if(tmp > 1) tmp = 0;
            printf("%.10f\n",tmp);
      }
                         
}

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

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

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

string S,T;
ll dp[200010][2];
ll sum[200010][2];

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

  cin>>S>>T;
  ll N=T.size();
  dp[0][0]=1;
  rep(i,N)rep(j,2){
    if(T[i]=='?'){
      if(j==0){
        rep(d,S[i]-'0'+1){
          if(S[i]<(char)(d+'0')){

          }else if(S[i]==(char)(d+'0')){
            (dp[i+1][j]+=dp[i][j])%=mod;
            (sum[i+1][j]+=sum[i][j]*10+d*dp[i][j])%=mod;
          }else{
            (dp[i+1][1]+=dp[i][j])%=mod;
            (sum[i+1][1]+=sum[i][j]*10+d*dp[i][j])%=mod;
          }
        }
      }else{
        rep(d,10){
          (dp[i+1][1]+=dp[i][j])%=mod;
          (sum[i+1][1]+=sum[i][j]*10+d*dp[i][j])%=mod;
        }
      }
    }else{
      ll d=T[i]-'0';
      if(j==0){
        {
          if(S[i]<(char)(d+'0')){

          }else if(S[i]==(char)(d+'0')){
            (dp[i+1][j]+=dp[i][j])%=mod;
            (sum[i+1][j]+=sum[i][j]*10+d*dp[i][j])%=mod;
          }else{
            (dp[i+1][1]+=dp[i][j])%=mod;
            (sum[i+1][1]+=sum[i][j]*10+d*dp[i][j])%=mod;
          }
        }
      }else{
        {
          (dp[i+1][1]+=dp[i][j])%=mod;
          (sum[i+1][1]+=sum[i][j]*10+d*dp[i][j])%=mod;
        }
      }/*
      if(S[i]<T[i]){

      }else if(S[i]==T[i]){
        (dp[i+1][j]+=dp[i][j])%=mod;
        (sum[i+1][j]+=sum[i][j]*10+d*dp[i][j])%=mod;
      }else{
        (dp[i+1][1]+=dp[i][j])%=mod;
        (sum[i+1][1]+=sum[i][j]*10+d*dp[i][j])%=mod;
      }*/
    }
  }
  cout<<(sum[N][0]+sum[N][1])%mod<<endl;

  return 0;
}



Measured memory_bytes: 9852
package main
import "fmt"
var v1,v2,v3,res uint64
func main(){
  
  fmt.Scan(&v1,&v2,&v3)
  res = v2/v3 - v1/v3
  if v1%v3 == 0 {
    fmt.Println(res + 1)
  }else{
    fmt.Println(res)
  }
  
  
}


Measured memory_bytes: 512
N = int(input())
zoro = []
for i in range(1, 4):
    for j in range(1, 10):
        string = str(j) * i
        zoro.append(string)
zoro.append("1111")
#   print(zoro)
candidate = [i for i in zoro if int(i) >= N]
print(candidate[0])


Measured memory_bytes: 2940
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

#define FOR(i, a, b) for (int i = (a); i < int(b); ++i)
#define RFOR(i, a, b) for (int i = (b)-1; i >= int(a); --i)
#define REP(i, n) FOR(i, 0, n)
#define REP1(i, n) FOR(i, 1, int(n) + 1)
#define RREP(i, n) RFOR(i, 0, n)
#define RREP1(i, n) RFOR(i, 1, int(n) + 1)
#define ALL(c) begin(c), end(c)

template <typename T> using vec = std::vector<T>;
using vi = vec<int>;
using vvi = vec<vi>;
using pii = std::pair<int, int>;
using ll = long long;
using ld = long double;
// constexpr auto mod = 1000000007;
using namespace std;

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


Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.nio.charset.StandardCharsets;

public class Main {
	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		char[] str = in.readLine().toCharArray();
		str[3] = '8';
		String s = new String(str);
		System.out.println(s);
	}
}


Measured memory_bytes: 24404
from collections import deque
q = deque()
s = input()
k = int(input())
alpha = set(s)
alpha = sorted(alpha)
for i in range(len(s)):
    for a in alpha[:3]:
        if s[i] == a:
            for j in range(k+1):
                q.append(s[i:i+j])
setq = set(q)
setq = sorted(setq)
print(setq[k])


Measured memory_bytes: 4596
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
# from collections import Counter,defaultdict,deque
# from itertools import permutations, combinations
# from heapq import heappop, heappush
# # input = sys.stdin.readline
# sys.setrecursionlimit(10**8)
# mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

l = []
for i in range(1, 10):
    for j in range(1, 10):
        l.append(i * j)
n = inp()
print('Yes' if n in l else 'No')




Measured memory_bytes: 74924
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
using namespace std;
const int MaxN = 1e5 + 5;

int a[MaxN];
int b[MaxN];
int main()
{
	int n;
	long long sum = 0;
	scanf("%d", &n);
	a[0] = 0;
	a[n + 1] = 0;
	for(int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		b[i] = fabs(a[i] - a[i - 1]);
		sum = sum + b[i];
	}
	b[n + 1] = fabs(a[n + 1] - a[n]);
	sum = sum + b[n + 1];
	int h;
	for(int i = 1; i <= n; i++) {
		h = sum - b[i] - b[i + 1] + fabs(a[i+1] - a[i-1]);
		printf("%d\n", h);
	}
}

Measured memory_bytes: 1920
n, m = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
mod = 10 ** 9 + 7
ans = 0
def f(a, n):
    ret = 0
    for i, v in enumerate(a):
        ret += i * v - (n - i - 1) * v
        ret %= mod
    return ret
print((f(x, n) * f(y, m)) % mod)

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

#define ll long long
#define ld long double
#define ull unsigned long long
#define pw(x) (1LL << (x))

#define db(x) cerr << #x << " = " << x << endl
#define db2(x, y) cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n"
#define db3(x, y, z) cerr << "(" << #x << ", " << #y << ", " << #z << ") = (" << x << ", " << y << ", " << z << ")\n"

using namespace std;

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

    ll s, c, ans;
    cin >> s >> c;

    if (2 * s < c)
    {
        ans = s;
        ll tmp = c - 2 * s;
        ans += tmp / 4;
    }
    else
        ans = c / 2;

    cout << ans << '\n';

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N;
int a[100100];
int main(){
	cin >> N;
	int cnt = 0;
	for(int i=0;i<N;i++){
		cin >> a[i];
		if(a[i]%2==0)cnt++;
	}
	if(cnt%2==1)cout << "First" << endl;
	else{
		int r = 0;
		while(1){
			int c = 0;
			int g = 0;
			int odd = -1;
			for(int i=0;i<N;i++){
				// cout << a[i] << ' ';
				if(a[i]%2==1){
					c++;
					g = __gcd(g,a[i]-1);
					odd = a[i];
				}else{
					g = __gcd(g,a[i]);
				}
			}
			if(c!=1)break;
			if(odd==1)break;
			for(int i=0;i<N;i++){
				if(a[i]%2==1)a[i]--;
				a[i] /= g;
			}
			c = 0;
			for(int i=0;i<N;i++){
				if(a[i]%2==0)c++;
			}
			if(c%2==0)r++;
			else break;
		}
		if(r%2==0)cout << "Second" << endl;
		else cout << "First" << endl;
	}
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<queue>
#include<map>
#define il inline
#define re register
#define fo(i,j,k) for(register int i=j;i<=k;i++)
#define do(i,j,k) for(register int i=j;i>=k;i--) 
#define inf 0x7fffffff
typedef long long ll;
using namespace std;
il ll read()
{
	ll x=0,f=1;char c=getchar();
	while(c<'0'||c>'9'){if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
	return f*x;	
}
ll n,m,cnt; 
ll sum;
/*int h[200010],dis[200010],v[200010];
int dp[1005][1005];
struct edge
{
	int v,w,next;
}e[200010*2];
il void add(int u,int v)
{
	e[++cnt].v=v;
//	e[cnt].w=w;
	e[cnt].next=h[u];
	h[u]=cnt;
}*/ 
const ll mod=1e9+7;
int main()
{
	n=read(),m=read();
	for(ll i=m;i<=n+1;i++)
	{
		sum=(sum+(n-i+1)*i+1)%mod;
	}
	printf("%lld\n",sum);
	return 0;
}


Measured memory_bytes: 3768
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long ll;

int main() {
    ll a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    printf("%lld\n", min(b + a + b + 1, b + c));
    return 0;
}


Measured memory_bytes: 128
# include "cstdio"
# include "iostream"

using namespace std;

int GCD(int x,int y){
	return x==0?y:GCD(y%x,x);
}

int main(){
	register int T,X,Ans=0;
	scanf("%d",&T);
	while(T--){
		scanf("%d",&X);
		Ans=GCD(Ans,X);
	}
	printf("%d",Ans);
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <algorithm>
#define N_F 1010
#define N_CONST 1001
using namespace std;


int v,d,  f1,f2;
unsigned long long int f[N_F];
int node[N_CONST+10][N_CONST+10];

void rmNode( int i ){
  //  cout << "  remove : "<<i<<endl;

  node[i][i] = 0;
  for( int j=0;j<N_CONST;j++ ){
    if( node[j][j]==0 )
      continue;
    if( node[i][j]==1 ){
      rmNode( j );
    }
  }
}

int main(){
  f[0]=1;  f[1]=2;
  for( int i=2;i<N_F;i++ ){
    //  f[i] = f[i-1] + f[i-2];
      f[i] = (f[i-1] + f[i-2])% N_CONST;
      //        cout << i << "\t"<< f[i] << endl;
  }



  while( cin>>v >> d ){
    //    cout << v <<","<< d<< endl;

    memset( node,0,sizeof(node) );

    //    cout << "test1" << endl;
    for( int i=1;i<=v;i++ ){
      f1 = f[i] % N_CONST; // node ÂÃ label
      node[ f1 ][ f1 ]=1;  // nodeÂÂªÂÂ¶ÂÃÂÂ·ÂÃ©ÂÂ±ÂÃÂÃ°Â\ÂÂ·

      //cout << "test3 i="<<i<<" f1="<<f1 << endl;
      for( int j=1;j<=v;j++ ){
	f2 = f[j] % N_CONST;
	//	if( abs( f[i]-f[j] ) < d ){
	//	cout << "test4 j="<<j<<" f[j]="<<f[j]<<" f2="<<f2 << endl;
	if( abs( f1-f2 ) < d ){
	  node[ f1 ][ f2 ] = 1;
	  node[ f2 ][ f1 ] = 1;
	}
      }
    }
    //    cout << "test2" << endl;
    int n=0;
    for( int i=0;i<N_CONST;i++ ){
      if( node[i][i]==0 ) // ÂmÂ[ÂhÂÂªÂÂ¶ÂÃÂÂµÂÃÂÂ¢
	continue;
      n++;
      rmNode( i );     // i ÂÃÂÃÂÂ±ÂÂ³ÂÃªÂÂ½ÂmÂ[ÂhÂÃ°ÂSÂÃÂÃ­ÂÂ
    }
    cout << n << endl;

    //    break;
  }

  return 0;
}

Measured memory_bytes: 4872
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define FOR(e, c) for (auto &e : c)
#define SORT(v, n) sort(v, v + n);
#define vsort(v) sort(v.begin(), v.end());
#define rvisort(v) sort(v.begin(), v.end(), greater<int>());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
// #define int long long
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())
 
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned long;
 
 
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; }
 
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { return a * b / GCD(a, b); }

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

signed main()
{
  int x,y,z,k;
  cin>>x>>y>>z>>k;
  vector<ll> a(x), b(y), c(z);
  rep(i,x) cin>>a[i];
  rep(i,y) cin>>b[i];
  rep(i,z) cin>>c[i];
  sort(a.rbegin(),a.rend());
  sort(b.rbegin(),b.rend());
  sort(c.rbegin(),c.rend());
  vector<ll> ab(x*y);
  rep(i,x){
    rep(j,y) {
      ab.push_back((ll)a[i]+b[j]);
    }
  }
  sort(ab.rbegin(),ab.rend());
  vector<ll> abc(k*z);
  rep(i,k){
    rep(j,z){
      abc.push_back((ll)ab[i]+c[j]);
    }
  }
  sort(abc.rbegin(),abc.rend());
  rep(i,k) cout<<abc[i]<<endl;
}


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

int main() {
    int N, K;
    int x[101];
    cin >> N;
    cin >> K;
    for (int i = 1; i <= N; i++) {
        cin >> x[i];
    }
    long long ans = 0;
    for (int i = 1; i <= N; i++) {
        int pos = x[i];
        ans += min(pos, K - pos) * 2;
    }

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


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

using namespace std;

#define EPS (1e-10)
#define equals(a,b) (fabs((a)-(b))<EPS)

inline int sign(const double &x){
    if(x>EPS) return 1;
    else if(x<-EPS) return -1;
    return 0;
}

/*   点  */
struct Point{
    double x,y;

    Point(double x=0,double y=0):x(x),y(y){}

    Point operator + (Point p) { return Point(x+p.x,y+p.y); }
    Point operator - (Point p) { return Point(x-p.x,y-p.y); }
    Point operator * (double k) { return Point(k*x,k*y); }
    Point operator / (double k) { return Point(x/k,y/k); }

    //向量的大小
    double abs(){ return sqrt(norm()); }
    double norm() { return x*x+y*y; }

    bool operator < (const Point & p) const{
        return x!=p.x?x<p.x:y<p.y;
    }

    bool operator == (const Point & p) const {
        return fabs(x-p.x)<EPS&&fabs(y-p.y)<EPS;
    }
};

//两点间的距离
double getDistance(Point a,Point b){
    return (a-b).abs();
}

/*   向量  */
typedef Point Vector;

//向量a和b的内积
double dot(Vector a,Vector b){
    return a.x*b.x+a.y*b.y;
}
//向量a和b的外积
double cross(Vector a,Vector b){
    return a.x*b.y-a.y*b.x;
}

/*   线段  */
struct Segment{
    Point p1,p2;
};

/*   直线  */
typedef Segment Line;

//点到直线的距离
double getDistanceLP(Line l,Point p){
    return abs(cross(l.p2-l.p1,p-l.p1)/(l.p2-l.p1).abs());
}

//点到线段的距离
double getDistanceSP(Segment s,Point p){
    if(dot(s.p2-s.p1,p-s.p1)<0.0) return (p-s.p1).abs();
    if(dot(s.p1-s.p2,p-s.p2)<0.0) return (p-s.p2).abs();
    return getDistanceLP(s,p);
}

//判断p2与向量p1-p0的位置关系

const int COUNTER_CLOCKWISE = -1;   //逆时针
const int CLOCKWISE = 1;            //顺时针
const int ON_SEGMENT = 0;           //在线段上

int ccw(Point p0,Point p1,Point p2){
    Vector a=p1-p0;
    Vector b=p2-p0;
    if(cross(a,b)>EPS) return COUNTER_CLOCKWISE;
    if(cross(a,b)<EPS) return CLOCKWISE;
    return ON_SEGMENT;
}

//判断线段p1p2与线段p3p4是否相交
bool intersect(Point p1,Point p2,Point p3,Point p4){
    return ( ccw(p1,p2,p3)*ccw(p1,p2,p4)<=0 &&
             ccw(p3,p4,p1)*ccw(p3,p4,p2)<=0 );
}

bool intersect(Segment s1,Segment s2){
    return intersect(s1.p1,s1.p2,s2.p1,s2.p2);
}

//线段与线段的距离
double getDistance(Segment s1,Segment s2){
    if(intersect(s1,s2)) return 0.0;
    return min(min(getDistanceSP(s1,s2.p1),getDistanceSP(s1,s2.p2)),
               min(getDistanceSP(s2,s1.p1),getDistanceSP(s2,s1.p2)));
}

/* 直线正交
 * 判断向量a，b是否正交 =》a，b的内积为0
 */
bool isOrthogonal(Vector a,Vector b){
    return equals(dot(a,b),0.0);
}

bool isOrthogonal(Point a1,Point a2,Point b1,Point b2){
    return isOrthogonal(a1-a2,b1-b2);
}

/* 直线平行
 * 判断向量a，b是否平行 =》a，b的内积为0
 */
bool isParallel(Vector a,Vector b){
    return equals(cross(a,b),0.0);
}

bool isParallel(Point a1,Point a2,Point b1,Point b2){
    return isParallel(a1-a2,b1-b2);
}

struct Circle{
    Point c;
    double r;
    Circle(Point c = Point() ,double r = 0.0 ):c(c),r(r){}
};

/*   多边形  */
typedef vector<Point> Polygon;

int main(void) {
    int q;cin>>q;
    while(q) {
        Segment s1,s2;
        cin>>s1.p1.x>>s1.p1.y>>s1.p2.x>>s1.p2.y>>s2.p1.x>>s2.p1.y>>s2.p2.x>>s2.p2.y;
        printf("%.10f\n",getDistance(s1,s2));
        q--;
    }
    return 0;
}



Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 40;
#define FOR(i,k,n) for(int i=(k);i<(n);++i)
#define all(x) (x).begin(),(x).end()

int main(){
    int N;cin >>N;
    vector<int> a(N);
    FOR(i,0,N){
        cin >> a[i];
    }
    sort(all(a));
    cout << a[N-1]-a[0] << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){       
	int X,Y;      

	scanf("%c %c",&X,&Y);

	if ( X>=65&&X<=70&&Y>=65&&X<=70 )
	if ( X>Y ){
		printf(">");
	}
	else if ( X<Y ) {
		printf("<");
	}
	else printf("=");
	
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int infint = 1e9;
const int MOD = (int)1e9 + 7;
const int MAXN = (int)2e3 + 7;
ll n, m;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	if(n > m)
		swap(n, m);
	if(n == 1)
	{
		if(m == 1)
			return cout << 1, 0;
		else
			return cout << m - 2, 0;
	}
	cout << 1LL * (n - 2) * (m - 2);
}

Measured memory_bytes: 256
import math

a, b, Cdegree = map(float, input().split())
Cradian = math.radians(Cdegree)

# h = b sin C
h = b * math.sin(Cradian)
# c^2 = a^2 + b^2 - 2 a b cos C
c = math.sqrt(a * a + b * b - 2 * a * b * math.cos(Cradian))
L = a + b + c
S = a * h / 2

print(S)
print(L)
print(h)



Measured memory_bytes: 5688
N, K = gets.split.map(&:to_i)
A = gets.split.map(&:to_i)

indices = Hash.new { |h, k| h[k] = [] }

A.each_with_index do |a, idx|
  indices[a] << idx
end

node = [-1, :off]
path = []
visited = Hash.new(false)

# p indices

while !visited[node]
  visited[node] = true
  cur, status = node

  if cur == -1
    cur = 0
  end

  loop_cnt = 0

  loop {
    a = A[cur]

    if loop_cnt == 0 && status == :on
      if indices[a].size <= 1
        to = nil
      else
        cur = indices[a].first
        to = indices[a].bsearch { |x| x > cur }
      end
    else
      to = indices[a].bsearch { |x| x > cur }
    end

    # p [:a, a, :cur, cur, :to, to, :status, status]

    case status
    when :on
      status = :off
      cur = (cur + 1) % N

      if cur == 0
        cur = -1
        break
      end
    when :off
      status = :on

      if to.nil?
        break
      else
        cur = to
      end
    end

    loop_cnt += 1
  }

  node = [cur, status]
  # p [:node, node]
  path << node[0]
end

def simulate(init)
  counter = Hash.new(0)

  init.each do |a|
    counter[a] += 1
  end

  res = init.dup

  A.each do |a|
    if counter[a] > 0
      while counter[a] > 0
        v = res.pop
        counter[v] -= 1
      end
    else
      counter[a] += 1
      res << a
    end
  end

  res
end

# p indices
path.pop
path.unshift(-1)
pl = path.size
# p [:path, path]
# p [:path, path.map { |idx| A[idx] }]

res = []
10.times do |i|
  # res = simulate(res)
  # p [:i, i + 1, res]
end

if K == 1
  puts simulate([]).join(' ')
elsif pl == 0
  puts ''
else
  v = ((K - 1) % pl)
  idx = path[v]

  ft = if idx == -1
         []
       else
         [A[idx]]
       end
  # p [:k, k]
  # p simulate([k])

  # p [:ft, ft]
  res = simulate(ft)
  puts res.join(' ')
end


Measured memory_bytes: 75380
#include<bits/stdc++.h>
 
using namespace std;
 
#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) 42
#endif
 
const int mod=30011;
 
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);

template<typename A> ostream& operator<<(ostream&,vector<A>&);
 
const int N=1000002;

void solve(){
	int m,d;
	cin>>m>>d;
	int ans=0;
	for(int i=1;i<=m;i++){
		for(int j=22;j<=min(d,99);j++){
			if((j%10)<2)continue;
			if(((j%10)*((j/10)))==i){
				ans++;
			}
		}
	}
	cout<<ans;
}
 
signed main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
    int tc=1;
	//~ cin>>tc;
	for(int _=0;_<tc;_++){
		//~ cout<<"Case #"<<_+1<<": ";
		solve();
		if(_!=tc-1)
		cout<<"\n";
	}
}
 
int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}
 
void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
}
 
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}
 
template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}
 
template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}
 
template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;
}


Measured memory_bytes: 256
#include <stdio.h>

int main (){
	int angka;
	scanf("%d", &angka);
	
	long long int sum =0;
	
	for (int i=1 ; i<=angka; i++){
		if (i % 3 == 0 && i % 5 ==0){
			continue;
		}
		else if (i % 3 ==0){
			continue;
		}
		else if (i % 5 == 0){
			continue;
		}
		else {
			sum += i;
		}
	}
	
	printf("%lld", sum);
	return 0;
}

Measured memory_bytes: 1692
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <tuple>
template <typename T> constexpr T my_abs(const T &x) { return x < 0 ? -x : x; }
using ll = long long;
ll dp[5005][5005];
int main()
{
	// freopen("AGC032-D.in", "r", stdin);
	int n, a, b;
	scanf("%d%d%d", &n, &a, &b);
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0] = 0;
	for (int i = 0; i < n; i++)
	{
		int x;
		scanf("%d", &x);
		for (int j = 0; j <= n; j++)
		{
			if (dp[i][j] >= 1e18)
				continue;
			if (x > j)
			{
				dp[i + 1][x] = std::min(dp[i + 1][x], dp[i][j]);
				dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j] + a);
			}
			else
				dp[i + 1][j] = std::min(dp[i + 1][j], dp[i][j] + b);
		}
	}
	ll ans = 1e18;
	for (int i = 0; i <= n; i++)
		ans = std::min(ans, dp[n][i]);
	printf("%lld\n", ans);
	return 0;
}


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

// --
#define HOGE std::cin.tie(0);std::ios::sync_with_stdio(false);
template<typename T> void CIN_VAR(T& t) { cin >> t; }
template<typename A, typename...R> void CIN_VAR(A& car, R&...cdr) { std::cin >> car; CIN_VAR(cdr...); }
#define VAR(type, ...) type __VA_ARGS__; CIN_VAR(__VA_ARGS__);
#define VEC(t, c, n) std::vector<t> c(n); for(auto& i:c) std::cin>>i;
#define MAT(t, c, m, n) std::vector<std::vector<t>> c(m, std::vector<t>(n));for(auto& row:c) for(auto& w:row)std::cin>>w;

#define ALL(c) (c).begin(), (c).end()
#define CALL(c) (c).cbegin(), (c).cend()
#define RALL(c) (c).rbegin(), (c).rend()
#define CRALL(c) (c).crbegin(), (c).crend()
#define REP(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define FOR(i, s, n) for (int i = s; i < static_cast<int>(n); i++)
#define PSORT(s,p,e) partial_sort((s), next((s), (p)), (e))

#define IN(a, x, b) (a<=x && x<b)
template<class T> inline T CHMAX(T& x, const T y){return x=(x<y)?y:x;}
template<class T> inline T CHMIN(T& x, const T y){return x=(x>y)?y:x;}
#define SDESC(t) [](t& x, t& y){ return x > y; }

#define VIEW(v,t) for_each((v).begin(), (v).end(), [](t& a) { cout << a << " "; }); cout << "\n";
#define COUT(dist) std::cout<<(dist);
#define WS std::cout<<" ";
#define NL std::cout<<"\n";
// --

// --
using PII = pair<int, int>;
using PLL = pair<long long , long long>;
using LL = long long;
using ULL = unsigned long long;

template<class T> using V = vector<T>;
template<class T> using V2 = vector<vector<T>>;
template<class T, int W=255> using A = array<T, W>;
template<class T, int W=255, int H=255> using A2 = array<array<T, W>, W>;

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

LL n, k;
V<LL> t, d;
V<PLL> pv;
std::set<int> s;
std::stack<int> st;

int main() {
    HOGE;
    cin >> n; cin >> k;
    t.resize(n); d.resize(n); pv.resize(n);
    REP(i, n) { cin >> t[i]; cin >> d[i]; }
    {
        REP(i,n) pv[i] = PLL(d[i],t[i]);
        std::sort(ALL(pv), SDESC(PLL));
        REP(i,n) std::tie(d[i],t[i]) = pv[i];
    }

    LL ans = 0;
    REP(i,k) {
        if(s.count(t[i])) st.push(d[i]);
        s.insert(t[i]);
        ans += d[i];
    }
    LL sum = ans;
    ans += (LL)((LL)s.size()*(LL)s.size());
    FOR(i,k,n) {
        if(st.empty()) break;
        if(s.count(t[i])) continue;
        s.insert(t[i]);
        sum -= st.top(); st.pop();
        sum += d[i];
        CHMAX<LL>(ans, sum + (LL)(s.size()*s.size()));
    }
    COUT(ans)NL;
}


Measured memory_bytes: 6528
#include <cstdio>
#include <cstring>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <deque>
#include <vector>
#include <queue>
#include <string>
#include <map>
#include <stack>
#include <set>
#include <numeric>
#include <sstream>
#include <iomanip>
#include <limits>
#define INF 0x3f3f3f3f
#define CLR(a) memset(a, 0, sizeof(a))
using namespace std;
int a[100005];
int b[100005];
int main(){
	ios::sync_with_stdio(0);
	int n;
	while(scanf("%d",&n)!=EOF){
		CLR(a);
		int tmp1,tmp2,tmp3,tmp4;
		for(int i=0;i<n;i++){
			scanf("%d",&a[i]);
		}
		CLR(b);
		int Max1=0,Max2=0,Max3=0,Max4=0;
		int cnt=0;
		for(int i=0;i<n;i+=2){
			b[a[i]]++;
			if(b[a[i]]>Max1){
				Max1=b[a[i]];
				tmp1=a[i];
			}
		}
		Max2=0;
		CLR(b);
		for(int i=1;i<n;i+=2){
			b[a[i]]++;
			if(b[a[i]]>Max2){
				Max2=b[a[i]];
				tmp2=a[i];
			}
		}
		CLR(b);
		for(int i=0;i<n;i+=2){
			b[a[i]]++;
			if(b[a[i]]>Max3){
				if(a[i]==tmp1){
					continue;
				}
				Max3=b[a[i]];
				tmp3=a[i];
			}
		}
		CLR(b);
		for(int i=1;i<n;i+=2){
			b[a[i]]++;
			if(b[a[i]]>Max4){
				if(a[i]==tmp2){
					continue;
				}
				Max4=b[a[i]];
				tmp4=a[i];
			}
		}
		if(tmp1==tmp2){
			if(Max1>Max2){
				cnt+=n-Max1-Max4;
			}
			if(Max1<Max2){
				cnt+=n-Max2-Max3;
			}
			if(Max1==Max2){
				if(Max3<Max4){
					cnt+=n-Max1-Max4;
				}
				else{
					cnt+=n-Max1-Max3;
				}
			}
		}
		else{
			cnt+=n-Max1-Max2;
		}
		cout<<cnt<<endl;
	}
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include<math.h>
using namespace std;
int main()
{
  int co=0;
	int l, i=0, a[1024];
  int h=0;
    while(cin>>l){
        a[i] = l;
     // cout<<a[i]<<"\n";
     // if(i>0){
      h+=l;
      //}
        i++;
    }
  int sum=0;
  int r=pow(2,sizeof(int)*8);
  for(int k=1;k<=100;k++){
  sum=0;
	for(int j=1;j<=a[0]; j++){
	sum+=(k-a[j])*(k-a[j]);
	}
    //cout<<k<<","<<sum<<"\n";
 if(r>sum)
   r=sum;
  }
  cout<<r<<"\n";
}

Measured memory_bytes: 256
#!python3

iim = lambda: map(int, input().rstrip().split())

def resolve():
    A = [list(iim()) for i in range(3)]
    N = int(input())
    B = set(int(input()) for i in range(N))

    C = [[i in B for i in aa] for aa in A]

    #print(A)
    #print(B)
    #print(C)

    def f():
        for i in range(3):
            for j in range(3):
                if not C[i][j]:
                    break
            else:
                return True
            for j in range(3):
                if not C[j][i]:
                    break
            else:
                return True
        for i in range(3):
            if not C[i][i]:
                break
        else:
            return True
        for i in range(3):
            if not C[i][2-i]:
                break
        else:
            return True
        return False

    print("Yes" if f() else "No")


if __name__ == "__main__":
    resolve()


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <algorithm>
#include <utility>
#include <iomanip>
#include <functional>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#include <cstdio>
#define ll long long
#define INF 1000000000000000001
#define MOD 1000000007
using namespace std;



int main(){
    int A,B;
    cin >> A >> B;
    if((A+B)%2==1){
        cout<<"IMPOSSIBLE"<<endl;
    }else{
        cout<<(A+B)/2<<endl;
    }
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<algorithm>
#include<vector>
#include<string>
#include<sstream>
#include<iomanip>
#include<utility>
#include<cmath>
#include<set>
#include<list>
#include<string>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#include<set>
#include<cstring>
#include<iterator>
#include<bitset>
#include<assert.h>
//#include<chrono>
//#include<time.h>
//#include<windows.h>
using namespace std;
 
#define int ll
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,pair<int,int> > PP;
typedef vector<int> VI;
typedef vector<long long int> VL;
static const int MOD = 1000000007;
//static const int INF = 2147483647;
//static const long long INF = 9223372000000000000;
//static const long long INF = 9223372000000000000/2;
//static const int INF = 1000010000;
//int dx4[4] = {0,1,0,-1}, dy4[4] = {-1,0,1,0};
//int dx5[5] = {-1,0,0,0,1}, dy5[5] = {0,-1,0,1,0};
//int dx8[8] = {-1,0,1,1,1,0,-1,-1}, dy8[8] = {1,1,1,0,-1,-1,-1,0};
//int dx9[9] = {-1,0,1,1,1,0,-1,-1,0}, dy9[9] = {1,1,1,0,-1,-1,-1,0,0};
#define PB push_back
#define MP make_pair
#define MT make_tuple
#define FI first
#define SE second
#define NP next_permutation
#define PQ priority_queue
#define UB upper_bound
#define LB lower_bound
#define SZ(a) int((a).size())
#define LEN(a) int((a).length())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,x) for(int i=0;i<(int)(x);i++)
#define REP1(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREP1(i,x) for(int i=((int)(x));i>0;i--)
#define ALL(x) (x).begin(),(x).end()
#define YESNO(x) puts((x)?"YES":"NO")
struct edge {int /*from,*/to,cost;};

signed main(){
    int n,k;
    cin >> n >> k;
    if(k==0){
        printf("%lld\n",n*n);
        return 0;
    }

    int ans = 0;
    FOR(i,k+1,n+1){
        ans += (n/i) * (i-k);
        ans += max(0ll,(n%i)-k+1);
        //printf("b=%lldのとき:%lld\n",i,max(0ll,(n%i)-k+1)+(n/i) * (i-k));
    }

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

    return 0;
}


Measured memory_bytes: 256