akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
                     
#define int             long long
#define ld              long double
#define mp              make_pair
#define ff              first
#define ss              second
#define pb              push_back
#define fo(i,n)         for(i=0;i<n;i++)
#define fo1(i,n)        for(i=1;i<=n;i++)
#define FO(i,a,b)       for(i=a;i<=b;i++)
#define FOR(i,a,b)       for(i=a;i>=b;i--)
#define all(c)          c.begin(),c.end()
#define rall(c)         c.rbegin(),c.rend()
#define si              set<int>
#define vi              vector<int>
#define mii             map<int,int>
#define pii             pair<int,int>
#define vpii            vector<pii>
#define vvi             vector<vi>
#define usi             unordered_set<int>
#define umii            unordered_map<int,int>
#define pqmx            priority_queue<int>
#define pqmn            priority_queue<int,vi,greater<int> >
#define sp(x)           cout<<setprecision(x)<<fixed;
#define setbits(x)      __builtin_popcountll(x)
#define zerobits(x)     __builtin_ctzll(x)
#define in(a,n)         vi a(n);fo(i,n)cin>>a[i];
#define in1(a,n)        vi a(n+1);fo1(i,n)cin>>a[i];
#define w(t)            int t;cin>>t;while(t--)
#define sz(v)           (int)v.size()
#define gcd             __gcd
#define lcm(x,y)        x*(y/gcd(x,y))
#define endl            '\n'
#define PI              3.14159265358979323846
const int inf =         1e18;
const int mod =         1e9+7;
void __p(int x) {cout<<x;}
void __p(int32_t x){cout<<x;}
void __p(float x){cout<<x;}
void __p(double x){cout<<x;}
void __p(ld x) {cout<<x;}
void __p(char x){cout <<'\''<<x<<'\'';}
void __p(const char *x){cout <<'\"' <<x<<'\"';}
void __p(const string &x) {cout<<'\"'<<x<<'\"';}
void __p(bool x) {cout<<(x?"true":"false");}
void _p() {cout << "]\n";}
template<typename T,typename V>     void __p(const pair<T,V> &x) {cout<<'{';__p(x.first);cout<<',';__p(x.second);cout<<'}';}
template<typename T>                void __p(const T &x) {int f = 0; cout << '{'; for (auto &i: x) cout << (f++ ? "," : ""), __p(i); cout << "}";}
template <typename T,typename... V> void _p(T t, V... v) {__p(t);if(sizeof...(v))cout<<", ";_p(v...);}
int po(int x,int p) {int ans=1;x%=mod;while(p>0){if(p&1)ans=(ans*x)%mod;p=p>>1;x=(x*x)%mod;}return ans;}
int inv(int x){return po(x,mod-2)%mod;}
#ifndef ONLINE_JUDGE
#define dbg(x...) cout<<"["<<#x<<"]=[";_p(x)
#else 
#define dbg(x...)
#endif
//=================================================================================




const int N=1e5+6;
int n,m,k,x,y,z,b,c,d,i,j,l,r,f,q;

int a[N]={};






void sol()
{ 
  cin>>n;
  
  fo1(x,105)
  fo1(y,105)
  fo1(z,105)
  {
      l=x*x+y*y+z*z+x*y+y*z+x*z;
      a[l]++;
  }
  
  fo1(i,n)cout<<a[i]<<"\n";

  //cout<<  <<endl;
}





int32_t main()
{ 
  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  //pre();
  //sp(10);
//   w(t)
  sol();
  return 0;
}  

Measured memory_bytes: 4132
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0;i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int main() {
  string s;
  cin >> s;
  int box[10] ={0};
  rep(i,s.size()){
    if(s.at(i)=='1'){
      box[1]++;
    }else if(s.at(i)=='2'){
      box[2]++;
    }else if(s.at(i)=='3'){
      box[3]++;
    }else if(s.at(i)=='4'){
      box[4]++;
    }else if(s.at(i)=='5'){
      box[5]++;
    }else if(s.at(i)=='6'){
      box[6]++;
    }else if(s.at(i)=='7'){
      box[7]++;
    }else if(s.at(i)=='8'){
      box[8]++;
    }else if(s.at(i)=='9'){
      box[9]++;
    }
  }    
  ll sum = 0;
  sum = box[1]*1 + box[2]*2 + box[3]*3 + box[4]*4 + box[5]*5 + box[6]*6 + box[7]*7 + box[8]*8 + box[9]*9;
  // cout << sum << endl;
  if(sum%9==0){
    cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3724
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>().split_whitespace()
    .map(|e| e.parse().ok().unwrap()).collect()
}

fn part3(s: &str, i: usize, j: usize) -> (String, String, String) {
    let (l,m) = s.split_at(i);
    let (m,r) = m.split_at(j - i + 1);
    (l.to_string(), m.to_string(), r.to_string())
}

fn main() {
    let mut s: String = read();
    let n: usize = read();
    for _ in 0..n {
        let v: Vec<String> = read_vec();
        let (a,b): (usize, usize) =
            (v[1].parse().unwrap(), v[2].parse().unwrap());
        match v[0].as_ref() {
            "print" => {
                let (l,m,r) = part3(&s,a,b);
                println!("{}", m);
            },
            "reverse" => {
                let (l,mut m,r) = part3(&s,a,b);
                m = m.chars().rev().collect();
                s = l + &m + &r;
            },
            "replace" => {
                let (l,_,r) = part3(&s,a,b);
                s = l + &v[3] + &r;
            },
            _ => ()
        }
    }
}



Measured memory_bytes: 5036
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)

string s;
int o, e;

int main(){
	cin >> s;
	REP(i, (int)s.size()){
		if(s[i] == '0')e++;
		else o++;
	}
	cout << (int)s.size() - abs(o - e) << endl;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype>
#include <functional>
#include <ctime>
#include <cmath>
#include <limits>
#include <numeric>
#include <type_traits>
unsigned euclidean_gcd(unsigned a, unsigned b) {
    if (a < b) return euclidean_gcd(b, a);
    unsigned r;
    while ((r = a % b)) {
        a = b;
        b = r;
    }
    return b;
}
using namespace std;

int main() {
    int a;
    cin >> a;
    int y = 0;
    for (int i = 0; i < a; i++) {
        for (int j = 0; j < a; j++) {
            for (int k = 0; k < a; k++) {
                y += __gcd(i + 1, __gcd(j + 1, k + 1));
            }
        }
    }
    cout << y << endl;
}

Measured memory_bytes: 3648
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define TABLE_SIZE 16777216
#define ORDER_LENGTH 7
#define STR_LENGTH 13

using namespace std;

int translateChar(char ch){
    switch(ch){
    case 'A':
        return 1;
    case 'C':
        return 2;
    case 'G':
        return 3;
    case 'T':
        return 4;
    }
    return -1;	//must not reach here
}


int translateStr(char buf[]){
    int sum = 0,mult = 1;
    for(int i = 0; buf[i] != '\0'; i++){
        sum += translateChar(buf[i])*mult;
        mult *= 4;
    }
    return sum - 1;
}

int main(){

    int n;
    scanf("%d",&n);
    char order[ORDER_LENGTH],str[STR_LENGTH];

    char* check_table = new char[TABLE_SIZE];

    for(int i = 0; i < n; i++){
        scanf("%s %s",order,str);
        if(order[0] == 'i'){
            check_table[translateStr(str)] = 'Y';
        }else{
            if(check_table[translateStr(str)] == 'Y'){
                printf("yes\n");
            }else{
                printf("no\n");
            }
        }
    }
}

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

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

  if (n >= m) {
    cout << 0 << endl;
    return 0;
  }
  sort(a.begin(), a.end());
  vector<long long> diffs;
  for (int i = 1; i < a.size(); i++) {
    diffs.push_back(a[i] - a[i - 1]);
  }
  sort(diffs.begin(), diffs.end(), greater<long long>());

  long long res = a.back() - a[0];
  for (int i = 0; i < min((int)diffs.size(), n - 1); i++) {
    res -= diffs[i];
  }
  cout << res << endl;
}

Measured memory_bytes: 1784
x,n=map(int,input().split())
*p,=map(int,input().split())

q=[0]*(102)

for pp in p:
    q[pp]=1
diff=1000
ans=-1

for i in range(0,102):
    if q[i]:
        continue

    cdiff=abs(i-x)

    if cdiff<diff:
        diff=cdiff
        ans=i
    
print(ans)

Measured memory_bytes: 61976
#include <iostream>
#include <vector>
#include <queue>
#include<map>
#include<algorithm>
#include<set>
#include<iomanip>
#define rep(i,n) for(int i = 0;i < n;i++)
#define req(i,n) for(int i = 1; i<=n;i++)
#define rrep(i,n) for(int i = n-1;i >=0;i--)
#define ALL(a) a.begin(),a.end()
#define PI  acos(-1)
using namespace std;
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T & val) {
    std::fill((T*)array, (T*)(array + N), val);
}
typedef long long int ll;
typedef long double ld;
const int MOD = 1e9 + 7;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 }, sum = 0,h,w;
int main() {
    int n; cin >> n;
    string c[7] = { "thu","fri","sat","sun","mon","tue","wed" };
    cout << c[n % 7] << endl;
}


Measured memory_bytes: 3216
#include<bits/stdc++.h>
using namespace std;
#define INF	LONG_MAX
#define yen first
#define snk second

struct Node {
    vector<int> dst;
    map<int, pair<int, int>> cost;
};

int main() {
    int n, m, src, dst;
    vector<Node> Graph;//vertex:integer
    vector<pair<long, long>> cost;
    vector<long> result;
    vector<bool> visited;
    queue<int> Queue;
    cin >> n >> m >> src >> dst;
    src--; dst--;
    Graph.resize(n); cost.resize(n); visited.resize(n); result.resize(n);
    for (int i = 0; i < m; i++) {
        int u, v, a, b;
        cin >> u >> v >> a >> b;
        u--; v--;
        Graph[u].dst.push_back(v);
        Graph[v].dst.push_back(u);
        Graph[u].cost[v].yen = Graph[v].cost[u].yen = a;
        Graph[u].cost[v].snk = Graph[v].cost[u].snk = b;
    }
    for (int i = 0; i < n; i++)cost[i].yen = cost[i].snk = result[i] = INF, Graph[i].cost[i].yen = Graph[i].cost[i].snk = 0;
    for (int i = 0; i < n; i++)visited[i] = false;
    cost[src].yen = cost[dst].snk = 0;
    Queue.push(src);
    while (!Queue.empty()) {
        bool flag = false;
        int pos = Queue.front(); Queue.pop();
        for (int i = 0; i < Graph[pos].dst.size(); i++) {
            int to = Graph[pos].dst[i];
            long change = cost[to].yen;
            cost[to].yen = min(Graph[pos].cost[to].yen + cost[pos].yen, cost[to].yen);
            if(change != cost[to].yen)Queue.push(to);
        }
    }

    //snuke
    for (int i = 0; i < visited.size(); i++)visited[i] = false;
    Queue.push(dst);
    while (!Queue.empty()) {
        bool flag = false;
        int pos = Queue.front(); Queue.pop();
        for (int i = 0; i < Graph[pos].dst.size(); i++) {
            int to = Graph[pos].dst[i];
            long change = cost[to].snk;
            cost[to].snk = min(Graph[pos].cost[to].snk + cost[pos].snk, cost[to].snk);
            if(change != cost[to].snk)Queue.push(to);
        }
    }

    for (int i = 0; i < n; i++)result[i] = cost[i].yen + cost[i].snk; //minimum cost from src to dst via i:0~n-1
    for (int i = n-2; i>=0; i--)result[i] = min(result[i],result[i+1]); //consider year: if later is smaller, then that is better in earlier
    for(int i=0;i<n;i++)cout << 1000000000000000 - result[i] << endl;
    return 0;
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
#pragma GCC optimize("O3")

#define fi first
#define se second
#define ep emplace
#define eb emplace_back
#define mp make_pair
#define pi pair<int,int>
#define vi vector<int>
#define vpi vector<pair<int,int>>
#define vll vector<ll>
#define vpll vector<pair<ll,ll>>
#define endl '\n'

#define si(v) int((v).size())
#define all(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i) 
#define rep2(i, n, m) for (ll i = n; i <= (ll)(m); ++i)
#define rep3(i, n, m) for (ll i = n; i >= (ll)(m); --i)

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

using ll = long long;
using ld = long double;
using namespace std;

constexpr ll MOD = 1000000007;

signed main()
{
  cout << fixed << setprecision(20);
  ios::sync_with_stdio(false);
  cin.tie(0);

  int n; cin >> n;
  int ans = 1, mx = 0;

  rep2(i, 1, n) {
    int score = 0;
    int j = i;

    while (j % 2 == 0) {
      j /= 2;
      ++score;
    }

    if (mx < score) {
      mx = score;
      ans = i;
    }
  }

  cout << ans << endl;

  return (0);
}


Measured memory_bytes: 3620
#include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

long solve(int n, int x, int t)
{
  int count = 0;
  long result = 0;
  while (count < n) {
    count += x;
    result += t;
  }
  return result;
}

int main()
{
  int n, x, t;
  std::cin >> n >> x >> t;

  std::cout << std::setprecision(20);
  std::cout << solve(n, x, t) << std::endl;
}


Measured memory_bytes: 3636
n = int(input())
apple = []
for _ in range(n):
    apple.append(int(input()))
apple = sorted(apple)
apple.append(0)
count = 0
ans = 1
for i in range(n):
    if apple[i] == apple[i + 1]:
        ans += 1
    else:
        if ans%2 == 0:
            ans = 1
        else:
            count += 1
print(count)


Measured memory_bytes: 8284
#include<stdio.h>

int main(){
int a,b,max;
  scanf("%d %d",&a,&b);
  max = a+b;
  if(max<a*b){
  max = a*b;
  }
  if(max<a-b)
    max = a-b;
  
  printf("%d",max);
  return 0;
}

Measured memory_bytes: 128
n=list(map(int,input()))[0]
a = list(map(int, input().split()))
count=1

l=[]
for i in a:
    l.append(i-count)
    count+=1
import numpy
l=numpy.array(l)
b=numpy.median(l)
ans=0
for i in l:
    ans+=abs(i-b)
print(int(ans))





Measured memory_bytes: 43968
import java.util.*;import java.io.*;import java.math.*;
public class Main
{
    public static void process()throws IOException
    {
        String s=nln()+"s";
        int c=0;
        int max=0;
        for(int i=0;i<4;i++)
        {
            if(s.charAt(i)=='R')
            c++;
            else
            {
            max=Math.max(max,c);
            c=0;
            }
        }
        pn(max);
    }
    static AnotherReader sc;
    static PrintWriter out;
    public static void main(String[]args)throws IOException
    {
        boolean oj = true;
        if(oj){sc=new AnotherReader();out=new PrintWriter(System.out);}
        else{sc=new AnotherReader(100);out=new PrintWriter("output.txt");}
        int t=1;
        // t=ni();
        while(t-->0) {process();}
        out.flush();out.close();  
    }

    static void pn(Object o){out.println(o);}
    static void p(Object o){out.print(o);}
    static void pni(Object o){out.println(o);out.flush();}
    static int ni()throws IOException{return sc.nextInt();}
    static long nl()throws IOException{return sc.nextLong();}
    static double nd()throws IOException{return sc.nextDouble();}
    static String nln()throws IOException{return sc.nextLine();}
    static int[] nai(int N)throws IOException{int[]A=new int[N];for(int i=0;i!=N;i++){A[i]=ni();}return A;}
    static long[] nal(int N)throws IOException{long[]A=new long[N];for(int i=0;i!=N;i++){A[i]=nl();}return A;}
    static long gcd(long a, long b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int gcd(int a, int b)throws IOException{return (b==0)?a:gcd(b,a%b);}
    static int bit(long n)throws IOException{return (n==0)?0:(1+bit(n&(n-1)));}

/////////////////////////////////////////////////////////////////////////////////////////////////////////

    static class AnotherReader{BufferedReader br; StringTokenizer st;
    AnotherReader()throws FileNotFoundException{
    br=new BufferedReader(new InputStreamReader(System.in));}
    AnotherReader(int a)throws FileNotFoundException{
    br = new BufferedReader(new FileReader("input.txt"));}
    String next()throws IOException{
    while (st == null || !st.hasMoreElements()) {try{
    st = new StringTokenizer(br.readLine());}
    catch (IOException  e){ e.printStackTrace(); }}
    return st.nextToken(); } int nextInt() throws IOException{
    return Integer.parseInt(next());}
    long nextLong() throws IOException
    {return Long.parseLong(next());}
    double nextDouble()throws IOException { return Double.parseDouble(next()); }
    String nextLine() throws IOException{ String str = ""; try{
    str = br.readLine();} catch (IOException e){
    e.printStackTrace();} return str;}}
   
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Measured memory_bytes: 36428
#include <bits/stdc++.h>
 
using namespace std;
#define int long long

const int MAX = 1000000007;
 
 


vector<int> k[26];
signed main(){
    int L, R;
    cin>>L>>R;
    int l=0,r=0,q=1;
    while(L>=(q<<l))l++;
    while(R>=(q<<r))r++;
    int dpl[l],dpr[r],u;
    dpl[0]=1;u=1;
    for(int i=1;i<l;i++){
        if(1&(L>>(i-1))){
            dpl[i]=dpl[i-1];
        }else{
            dpl[i]=(2*dpl[i-1]+u)%MAX;
        }
        u=(u*3)%MAX;
    }
   // cerr<<'t';
    u=1;dpr[0]=1;
    for(int i=1;i<r;i++){
        if(1&(R>>(i-1))){
            dpr[i]=(2*dpr[i-1]+u)%MAX;
        }else{
            dpr[i]=dpr[i-1];
        }
        u=(u*3)%MAX;
    }
    //cerr<<'u';
    if(l!=r){
        u=1;
        for(int i=0;i<l;i++)u=(u*3)%MAX;
        int ans=(dpl[l-1]+dpr[r-1])%MAX;
        for(int i=l+1;i<r;i++){
            ans=(ans+u)%MAX;
            u=(u*3)%MAX;
        }
        cout<<ans;
    }else{
        int ans=0;
        for(int i=l-1;i>=0;i--){
            if((1&(R>>i))&&(!(1&(L>>i)))){
                ans=(ans+dpr[i]+dpl[i])%MAX;
            }
            if((1&(L>>i))&&(!(1&(R>>i)))){
                ans-=1;
                break;
            }
        }
        ans++;
        cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 256
# dp[i][k] := 先頭i桁を13で割った余りがkとなるものの個数 or
# dp[i][k] := 先頭i桁（残りはすべて0）を13で割った余りがkとなるものの個数
# どちらが良いか?
# 後者で。
# 先頭からでも下位からでもアルゴリズムは同じはず。下位からのほうが添え字が見やすい。
# →尺取っぽくやるのは下位の桁を追加したときだ。上位から決めないとダメじゃね?
# →前者じゃないとダメか。

# 配るDP
# 桁dがあれば：dp[i+1][k+ (d * 10 ** a)% 13] = dp[i][k]
# 桁が?ならば：10通りあるから10回配る? dp[i+1][k+ (d * 10 ** a)% 13] = dp[i][k]
# 10^5 * 10 * 13は無理じゃない?
# 全体-残り3つとして、+-しながら管理　（これができるのは1の桁の場合だけ）

s = input()
l = len(s)
dp = [[0 for _ in range(13)] for _ in range(l+1)]
dp[0][0] = 1
temp = [0] * 13
summ = 1
mod = 10 ** 9 + 7

for i in range(0, l):
    if s[i] != '?':
        for k in range(13):
            dp[i+1][(k*10+int(s[i])) % 13] = dp[i][k]
    else:
        # ?の場合
        for k in range(13):
            temp[(k*10) % 13] = dp[i][k]
        
        excluded = temp[1] + temp[2] + temp[3]
        for k in range(13):
            dp[i+1][k] = (summ - excluded) % mod
            excluded -= temp[(k+1)%13]
            excluded += temp[(k+4)%13]

        summ *= 10
        summ %= mod

print(dp[l][5])
# print(dp)            




Measured memory_bytes: 65496
import java.util.Scanner;

public class Main {

	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int N= sc.nextInt();
		String[] s = new String[N];
		for (int i = 0; i < N; i++)
			s[i] = sc.next();
		int M = sc.nextInt();
		String[] t = new String[M];
		for (int i = 0; i < M; i++)
			t[i] = sc.next();
		sc.close();

		int ans = 0;

		for (int i = 0; i < N; i++) {
			int tem = 0;
			for (int j = 0; j < N; j++)
				if (s[i].equals(s[j]))
					tem++;
			for (int j = 0; j < M; j++)
				if (s[i].equals(t[j]))
					tem--;
			if (tem > ans)
				ans = tem;
		}

		System.out.println(ans);
	}
}

Measured memory_bytes: 21972
#include <iostream>
#include <vector>
#include <utility>


#define inf 1000000007

using namespace std;

int main(){
	int n;
	cin >> n;
	vector<pair<int,int> > m(n);
	for(int i=0;i<n;++i)cin >> m[i].first >> m[i].second;
	vector<vector<int> > dp;
	dp.resize(n);
	for(int i=0;i<n;++i){
		dp[i].resize(n);
		for(int j=0;j<n;++j)dp[i][j] = 0;
	}
	vector<int> p;
	for(int i=0;i<n;++i)p.push_back(m[i].first);
	p.push_back(m[n-1].second);
	for(int i=1;i<n;++i){
		for(int j=0;j+i<n;++j){
			dp[j][i+j] = inf;
			int t = i+j;
			for(int k=j+1;k<=t;++k){
				dp[j][t] = min(dp[j][t],dp[j][k-1]+dp[k][t]+p[j]*p[k]*p[t+1]);
			}
		}
	}
	cout << dp[0][n-1] << endl;
}


Measured memory_bytes: 3168
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <set>
#include <stack>
#include <numeric>
#include <chrono>
#include <bitset>
#include <tuple>
#include <queue>
#include <map>
#include <cstring>
#include <cassert>
#include <math.h>
using namespace std;

const int N = 2e5 + 10, mod = 1e9 + 7;

int n, k, arr[N];

bool check(int x) {
    int cnt = 0;
    for(int i = 0; i < n; i++) {
        int cur = (arr[i] + x - 1) / x;
        cnt += cur - 1;
    }
    return cnt <= k;
}

int main() {
    // ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int tc = 1;
    // scanf("%d", &tc);
    for(int cn = 1; cn <= tc; cn++) {
        scanf("%d%d", &n, &k);
        for(int i = 0; i < n; i++) scanf("%d", &arr[i]);
        int l = 1, r = 1e9, res = 1e9;
        while(l <= r) {
            int mid = (l + r) >> 1;
            if(check(mid)) {
                res = mid;
                r = mid - 1;
            }
            else l = mid + 1;
        }
        printf("%d\n", res);
    }
    return 0;
}

Measured memory_bytes: 4588
import sys
import math
from collections import deque
import heapq
MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)
def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(sys.stdin.readline())
def S(): return input()

N = I()

n = 100
ans = 0
while n < N:
  n += int(n*0.01)
  ans += 1
print(ans)


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair

#define int ll

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

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

int h, w;
string s[400];

bool used[400][400];

//t%2 ? # : .
pii dfs(int x, int y, int t)
{
  if(used[y][x]){
    if(t%2){
      return mp(0, 0); 
    }else{
      return mp(0, 0);
    }
  } 
//  cout << x << " , " << y << endl;

  used[y][x] = true;

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

  pii ret = t%2 ? mp(1, 0) : mp(0, 1);
  rep(i, 4){
    int nx = x + dx[i];
    int ny = y + dy[i];

    if(nx < 0 or w <= nx or ny < 0 or h <= ny) continue;
    if(s[ny][nx] == (t%2 ? '#' : '.')) continue;
    
    pii x = dfs(nx, ny, t+1);
    ret.first += x.first;
    ret.second += x.second;
  }

  return ret;
}
  
signed main()
{
  cin >> h >> w;
  rep(i, h) cin >> s[i];

  int ans = 0;
  rep(i, h) rep(j, w){
    pii cnt;  
    cnt = dfs(j, i, s[i][j] == '#');
    ans += cnt.first * cnt.second;
  }

  cout << ans << endl;

  return 0;
}


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

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

using namespace std;

using ll = long long;
using ld = long double;

const ld pi = 3.141592653589793;
string s;
int main() {
  cin >> s;
  if (s == "RRR") {
    cout << 3 << endl;
    return 0;
  }
  if (s == "RRS" || s == "SRR") {
    cout << 2 << endl;
    return 0;
  }
  if (s == "SSS") {
    cout << 0 << endl;
    return 0;
  }
  cout << 1 << endl;
}

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

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

    int a1[n];
    int a2[n];

    for (int i = 0; i < n; i++) cin >> a1[i];
    for (int i = 0; i < n; i++) cin >> a2[i];

    int ans = 0;
    for (int i = 0; i < n; i++) {
        int sum = 0;
        for (int j = 0; j <= i; j++) sum += a1[j];
        for (int j = i; j < n; j++) sum += a2[j];
        ans = max(ans, sum);
    }

    cout << ans << endl;

    return 0;
}


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

int n,k;
int h[100001];
bool visited[100001];
int inf = 1e9+1;
vector<int> DP(100001,inf);

int main()
{
	cin >> n >> k;
	for (int i = 1; i <= n; ++i)
	{
		cin >> h[i];
	}

	//mincost to reach stone 1
	DP[1] = 0;

	for(int i=1 ; i <=n ; i++)
	{
		for(int j=1; j <= k ; j++)
		{
			DP[i+j] = min(DP[i+j], DP[i]+abs(h[i]-h[i+j]));
		}
	}

	cout << DP[n] << endl;
	return 0;
}

Measured memory_bytes: 1024
#include<iostream>
using namespace std;
typedef long long ll;

int main()
{
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	if(m1<=m2)cout<<max(0,(h2-h1)*60+m2-m1-k);
	else cout<<max(0,(h2-h1-1)*60+(60-m1+m2)-k);
	return 0;
}

Measured memory_bytes: 3192
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
#define FAST() cin.tie(0), ios::sync_with_stdio(false)

#define NIL -1
#define LN() cout << '\n'
struct Node{
  int p,l,r;
  Node(): p(NIL), l(NIL), r(NIL){}
};

int N;
Node T[30];

void preorder(int u){
  if(u == NIL)return;
  cout << ' ' << u;
  preorder(T[u].l);
  preorder(T[u].r);
}
void inorder(int u){
  if(u == NIL)return;
  inorder(T[u].l);
  cout << ' ' << u;
  inorder(T[u].r);
}
void postorder(int u){
  if(u == NIL)return;
  postorder(T[u].l);
  postorder(T[u].r);
  cout << ' ' << u;
}

main()
{
  FAST();
  int v,l,r;
  int root;
  cin >> N;
  rep(i,N){
    cin >> v >> l >> r;
    T[v].l = l, T[v].r = r;
    T[l].p = T[r].p = v;
  }
  rep(i,N)
    if(T[i].p == NIL){
      root = i;
      break;
    }

  outl("Preorder");preorder(root);LN();
  outl("Inorder");inorder(root);LN();
  outl("Postorder");postorder(root);LN();
}

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

 int main(){
   
   int a,b,c;
   cin >> a >> b >> c;
   
   if ( a == b && b == c ){
     
     cout << 1 << endl;
     
   }
   
   else if ( (a == b && a != c) || (a == c && a != b) || (b == c && b != a) ){
     
     cout << 2 << endl;
     
   }
   
   else {
     
     cout << 3 << endl;
     
   }
   
 }


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

using namespace std;
typedef long long ll;
#define int ll

#define REP(i,n) for(int i=0;i<n;++i)
#define SORT(name) sort(name.begin(), name.end())
#define ZERO(p) memset(p, 0, sizeof(p))
#define MINUS(p) memset(p, -1, sizeof(p))
#if 1
#  define DBG(fmt, ...) printf(fmt, ##__VA_ARGS__)
#else
#  define DBG(fmt, ...)
#endif

const ll LLINF = (1LL<<60);
const int INF = (1LL<<30);
const double DINF = std::numeric_limits<double>::infinity();
const int MOD = 1000000007;
#define MAX_N 3010

ll N;
vector<double> P;
double dp[MAX_N][MAX_N];

// i 枚目のコインを見ていて、ここまで表になったコインの数が j 枚のときの
// 表が多くなる確率
double dfs(ll i = 0, ll j = 0) {
    if(i >= N) { return (j > N / 2) ? 1.0 : 0; }

    double& ret = dp[i][j];
    if(ret != DINF) { return ret; }
    ret = 0;

    // 表が出た場合
    ret += dfs(i+1, j+1) * P[i];
    // 裏が出た場合
    ret += dfs(i+1, j) * (1 - P[i]);

    return ret;
}

signed main()
{
    cin >> N;
    P.assign(N, 0);
    REP(i, N) { cin >> P[i]; }
    REP(i, N) { REP(j, N) { dp[i][j] = DINF; } }
    printf("%.11f\n", dfs());
    return 0;
}


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

#define FOR(i, l, r) for(ll i = l; i < r; i++)
#define rep(i, N) FOR(i, 0, N)

#define MOD 1000000007
#define INF 1000000000

using ll = long long int;
using namespace std;

typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main() {
    ll K, A, B; cin >> K >> A >> B;
    ll ans = 1;
    if(A+2 >= B || K < A+1) ans += K;
    else{
      ans = A + (((K-A+1)/2)*(B-A)) + (K-A+1)%2;
    }

    cout << ans << "\n";
    return 0;
}


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

int hyoka(string);
int isNum(int);

int main(){
	int n,i;
	string s;
	
	cin>>n;
	for(i=0;i<n;i++){
	 cin>>s;
	 cout<<hyoka(s)<<endl;
	}
			
	return 0;
}


int hyoka(string s){
	long int total=0,work=0;
	long int tmp1,tmp2;
	int oi=0;
	char oc;
	int n;
	string cs;
	
	if(s[oi]=='(' || isNum(s[oi])!=-1){s="+"+s;}
	//cout<<s<<endl;

	while(1){
	 oc=s[oi];if(oc=='='){total+=work;break;}
	 
	 if(s[oi+1]!='('){	//??°???????????????
	  tmp1=0;
	  while(1){
	   oi++;
	   tmp2=isNum(s[oi]);
	   if(tmp2!=-1){tmp1=tmp1*10+tmp2;}else{break;}
	  }
	 }else{	//??????????????°
	  cs="";n=1;oi++;
	  while(1){
	   oi++;
	   switch(s[oi]){
		case '(':n++;break;
		case ')':n--;break;
	   }
	   if(n!=0){cs+=s[oi];}else{break;}
	  }
	  cs+='=';
	  //cout<<cs<<endl;
	  tmp1=hyoka(cs);
	 }
	
	 switch(oc){
	  case '+':total+=work;work=tmp1;break;
	  case '-':total+=work;work=-tmp1;break;
	  case '*':work*=tmp1;break;
	  case '/':work/=tmp1;break;
	 }
	}
	
	return total;
}

int isNum(int c){
	if(48<=c && c<=57){
	 return c-48;
	}
	return -1;
}

Measured memory_bytes: 1212
import java.util.Scanner;

public class Main {
	public void run() {
		Scanner scan = new Scanner(System.in);
		int n, k;
		n = scan.nextInt();
		k = scan.nextInt() - 1;
		StringBuilder s = new StringBuilder(scan.next());
		s.setCharAt(k, (char) (s.charAt(k) + 32));
		System.out.println(s);
	}
	public static void main(String[] args) {
		new Main().run();
	}

}


Measured memory_bytes: 23124
#include <stdio.h>
#include <stdlib.h>
struct data {
	char number;
	int value;
};
int compare(const void *a, const void *b) {
	return ((struct data*)b)->value - ((struct data*)a)->value;
}
int main() {
	int i;
	int v;
	struct data counter[100];
	for (i = 0; i < 100; i++) {
		counter[i].number = i + 1;
		counter[i].value = 0;
	}
	while (scanf(" %d", &i) != EOF) {
		counter[i-1].value += 1;
	}
	qsort(counter, 100, sizeof(struct data), compare);
	v = counter[0].value;
	for (i = 0; i < 100; i++) {
		if (counter[i].value != v)
			break;
		printf("%d\n", counter[i].number);
	}
	return 0;
}

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

// macros
#define int long long 
#define TIME clock() * 1.0 / CLOCKS_PER_SEC
#define all(c) c.begin(), c.end()
#define PB push_back
#define MP make_pair
#define bitcount __builtin_popcount
#define watch(x) cerr<< (#x) << " is " << (x) <<"\n";
#define sz(x) ((int)((x).size()))
#define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin())
#define pii2ll(p) ((ll)(p).first<<32 | (p).second)

// type definitions
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vi > vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef long double ld;

// template functions
template < typename A, typename B >
ostream& operator << ( ostream& os, const pair< A, B > & p ) {
    return os << "(" << p.first << ", " << p.second << ")";
}
template < typename T >
ostream &operator << ( ostream & os, const vector< T > &v ) {
    os << "[";
    typename vector< T > :: const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "]";
}
template < typename T >
ostream &operator << ( ostream & os, const set< T > &v ) {
    os << "{";
    typename set< T > :: const_iterator it;
    for ( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << *it;
    }
    return os << "}";
}
template < typename A, typename B >
ostream &operator << ( ostream & os, const map< A, B > &v ) {
    os << "[";
    typename map< A, B >::const_iterator it;
    for( it = v.begin(); it != v.end(); it++ ) {
        if( it != v.begin() ) os << ", ";
        os << it -> first << " -> " << it -> second ;
    }
    return os << "]";
}
template <typename T>
inline void printV(vector<T>& a, int n) { for(int i=0; i<n; i++) { cerr<<a[i]<<" "; } cerr<<"\n"; }
template <typename T>
inline void printVV(vector<vector<T>>& a) { for(int i=0; i<sz(a); i++) { cerr<<a[i]<<"\n"; } cerr<<"\n"; }
template <typename T>
inline void clearVV(vector<vector<T>>& a) { for(auto &x : a) { x.clear(); } a.clear(); }
template <typename T>
inline void assignVV(vector<vector<T>> &a, T val) { for(int i=0; i<sz(a); i++) { a[i].assign(sz(a[i]), val); } }
template<typename T>
T gcd(T a, T b) { if(a==0 or b==0) return a+b; return gcd(b, a%b) ; }

// random number generation
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

// constants
const long double eps = LDBL_EPSILON;
const int inf = 5e8;
const int modn = 1e9+7;
const int MAX = 1e5;


int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    // Your code here
	int n;
	cin>>n;
	vi a(n+1);
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	vi res(n+1);
	for(int i=n; i>=1; i--) {
		int sum = 0;
		for(int j=i; j<=n; j+=i) {
			sum+=res[j];
		} 
		sum%=2;
		res[i] = sum^a[i];
	}
	vi ans;
	for(int i=1; i<=n; i++) {
		if(res[i]) {
			ans.PB(i);
		}
	}
	cout<<sz(ans)<<"\n";
	for(int val : ans) {
		cout<<val<<" ";
	}
	cout<<"\n";
    return 0;
}



Measured memory_bytes: 5108
#include<iostream>

using namespace std;

int main(){
    int input;

    cin >> input;
    double n;

    if(input%2){
        n = input/2+1;
    }else
    {
        n = input/2;
    }

    double p = n/input;

    //cout << n << endl;
    cout << p << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np

def is_ok(mid, k):
    s = np.maximum(a - mid // f, 0).sum()
    if s <= k:
        return True
    else:
        return False

n, k = map(int, input().split())
a = [int(i) for i in input().split()]
f = [int(i) for i in input().split()]
a.sort()
f.sort(reverse=True)
a = np.array(a)
f = np.array(f)

l, r = -1, np.max(a * f) # l:ng, r:ok
while l + 1 < r:
    mid = (l + r) // 2
    if is_ok(mid, k):
        r = mid
    else:
        l = mid
print(r)

Measured memory_bytes: 43572
import java.util.*;
import java.util.Map.Entry;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main {

	int INF = 1 << 28;
	HashMap<Integer, Integer> score;
	void run() {
		Scanner sc = new Scanner(System.in);
		int n= sc.nextInt();
		score = new HashMap<Integer, Integer>();
		for( int i=0;i<n*(n-1)/2;i++ ) {
			int a = sc.nextInt();
			int b = sc.nextInt();
			int c = sc.nextInt();
			int d = sc.nextInt();
			if( score.containsKey(a) ) {
				score.put(a, score.get(a) + ( (c > d)? 3: ( c == d )? 1: 0 ) );
			}
			else {
				score.put(a, ( (c > d)? 3: ( c == d )? 1: 0 ) );
			}
			if( score.containsKey(b) ) {
				score.put(b, score.get(b) + ( (c < d)? 3: ( c == d )? 1: 0 ) );
			}
			else {
				score.put(b, ( (c < d)? 3: ( c == d )? 1: 0 ) );
			}
		}
//		debug(score);
		Pair[] pairs = new Pair[n];
		int i=0;
		for(Map.Entry<Integer, Integer> entry: score.entrySet()) {
			pairs[i++] = new Pair( entry.getKey(), entry.getValue() );
		}
		sort(pairs, new MyComp());
		i = 1;
		int[] ans = new int[n];
		ans[pairs[0].f-1] = i;
		for(int j=1;j<n;j++) {
			if( pairs[j].s != pairs[j-1].s ) {
				ans[pairs[j].f-1] = j + 1;
				i = j + 1;
			}
			if( pairs[j].s == pairs[j-1].s ) ans[pairs[j].f-1] = i;
		}
		ans[pairs[n-1].f-1] = i;
		for(int ind: ans) System.out.println(ind);
		
	}
	
	class MyComp implements Comparator<Pair> {

		@Override
		public int compare(Pair o1, Pair o2) {
			// TODO 自動生成されたメソッド・スタブ
			return o2.s - o1.s;
		}
		
	}
	
	class Pair {
		int f, s;
		Pair(int f, int s) {
			this.f = f;
			this.s = s;
		}
	}

	public static void main(String[] args) {
		new Main().run();
	}

	void debug(Object... os) {
		System.err.println(Arrays.deepToString(os));
	}
}

Measured memory_bytes: 13000
#include<iostream>
using namespace std;
long long a,b,c,d,ans;
int main()
{
	cin>>a>>b>>c;
	for(int s=0;s<a;s++)
	{
		cin>>d;
		if(d<b||d>=c)
		{
			ans++;
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#define ll long long
#define rep(i,j,k) for (i=j;i<=k;i++)
#define down(i,j,k) for (i=j;i>=k;i--)
using namespace std;
const int N=2e3+5,mod=924844033;
int n,k,i,j,l,t,p,sgn;
ll ans,fac[N],g[N],h[N],f[N][N][2];
int main()
{
//	freopen("count.in","r",stdin);
//	freopen("count.out","w",stdout);
	scanf("%d%d",&n,&k); fac[0]=1;
	fac[1]=1; rep(i,2,n) fac[i]=fac[i-1]*i%mod;
	ans=fac[n];
	f[0][0][1]=1;
	rep(i,1,n)
		rep(j,0,i/2)
		{
			f[i][j][0]=(f[i-1][j][1]+f[i-1][j][0])%mod; 
			if (j>0) f[i][j][1]=f[i-1][j-1][0];
		}
	h[0]=1;
	rep(i,1,min(n,k*2))
	{
		j=i; l=0;
		if (j-k>0) l++;
		while (j<=n)
		{
			l++;
			j+=k;
		}
		rep(j,0,n) g[j]=h[j],h[j]=0;
		rep(j,0,n)
			rep(t,0,min(j,l))
				rep(p,0,1)
					h[j]=(h[j]+g[j-t]*f[l][t][p])%mod;
	}
	sgn=-1;
	rep(i,1,n)
	{
		ans=(ans+sgn*h[i]*fac[n-i])%mod;
		sgn*=(-1);
	}
	ans=(ans+mod)%mod;
	printf("%I64d\n",ans);
	return 0;
}

Measured memory_bytes: 60672
#include <iostream>
#include <algorithm>
#include <string>
#include <cstdlib>
#include <cmath>
using namespace std;
 
int main()
{
  int n, boss = 0;
  cin >> n;
  int map[2][n];
 
    for (int i = 0; i < n; i++)
    {
      cin >> map[0][i];
    }
 
    for (int i = 0; i < n; i++)
    {
      cin >> map[1][i];
    }
 
  for (int i = 0; i < n; i++)
  {
    int result = 0;
    for (int j = 0;j <= i; j++)
    {
      result += map[0][j];
    }
 
    for (int k = i; k < n; k++)
    {
      result += map[1][k];
    }
 
    if(result > boss) boss = result;
  }
 
  cout << boss << endl;
 
}

Measured memory_bytes: 256
#include <stdio.h>

void XORSwap(int *x, int *y)
{
    *x ^= *y;
    *y ^= *x;
    *x ^= *y;
}

int main(void)
{
    int a, b, c;
    
    scanf(" %d %d %d", &a, &b, &c);

    if (a > b){
        XORSwap(&a, &b);
    }
    if (b > c){
        XORSwap(&b, &c);
    }
    if (a > b){
        XORSwap(&a, &b);
    }

    printf("%d %d %d\n", a, b, c);

    return 0;
}

Measured memory_bytes: 596
# -*- coding utf-8 -*-

MOD = 10 ** 9 + 7

N, K, Q = map(int, input().split())
AQ = [int(input()) for _ in range(Q)]

ans = [0] * N
for a in AQ:
    ans[a - 1] += 1
for i in range(N):
    if K - (Q - ans[i]) <= 0:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 8640
#include<iostream>
using namespace std;
int main(void)
{
	int N;
	int T;
	int i;
	int t[200000];
	int allT=0;

	cin >> N;
	cin >> T;

	for (i =0; i <= N-1; i++) {
		cin >> t[i];
	}
		
	for (i = 1; i <= N-1; i++) {
		if (t[i] -t[i-1]< T) {
			allT += t[i]-t[i-1];
		}
		else {
			allT += T;
		}
	}
	allT += T;
	cout << allT<<endl;

}




Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  int L, R;
  cin >> L >> R;
  int ans = 0;
  for (int a = 1; a < 10; a++) {
    for (int b = 0; b < 10; b++) {
      for (int c = 0; c < 10; c++) {
        int x = 10001 * a + 1010 * b + 100 * c;
        if (x >= L && x <= R) {
          ans++;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N, M, C = map(int, input().split())
B = list(map(int, input().split()))
ans = 0
for i in range(N):
    A = list(map(int, input().split()))
    s = C
    for j in range(M):
        s += A[j] * B[j]
    if s > 0:
        ans += 1
print(ans)


Measured memory_bytes: 3060
#include <iostream>
using namespace std;
int main()
{
    long long int i, n, sum, input, min, max;
   
    cin >> n;
    cin >> input;
    sum = 0;
    min = input;
    max = input;
    for(i=1; i<=n; i++)
    {
        sum = sum + input;
        
        if(input > max)
            max = input;
        else if(input < min)
            min = input;
        cin >> input; 
    }
    cout << min << " " << max << " " << sum << endl;
}


Measured memory_bytes: 3116
#include<iostream>
#include<sstream>
#include<vector>
#include<algorithm>
#include<string>
#include<stdexcept>
#include<stdio.h>
#include<queue>
using namespace std;
typedef long long ll;
 vector<pair<ll,ll>> P;
 int main(){
   string s; cin >> s;
   ll zero=0,one=0;
   for(int j=0;j<s.size();j++){
     if(s[j]=='0') zero++;
     if(s[j]=='1') one++;
   }
   if(zero>one) cout<< one*2 <<endl;
   else cout << zero*2 <<endl;
 }
  

Measured memory_bytes: 512
N,ika=map(int,input().split())
A=input().split()
A1=list(map(int,A))
AS={}

for i in range(N):
    if A1[i] in AS:
        AS[A1[i]] +=1
    else:
        AS[A1[i]] =1
AS=sorted(AS.items(), key=lambda x:x[1])
kesushurui=len(AS)-ika
ans=0
if kesushurui>0:
    for k in range(kesushurui):
        ans+=AS[k][1]
        
print(ans)    
        

Measured memory_bytes: 52636
import java.util.Scanner;
public class Main {
    public static void main(String[] args){
        Scanner sc= new Scanner(System.in);
        String S = sc.nextLine();
        long K = sc.nextLong();
        int notone=-1;
        int notoneindex=-1;
        int[] arr=new int[100];
        for(int i=0;i<S.length();i++){
            arr[i]=S.charAt(i)-'0';
        }
        for(int i=0;i<S.length();i++){
            if(arr[i]!=1){
                notone=arr[i];
                notoneindex=i;
                break;
            }
        }
        if(notone==-1){
            System.out.println("1");
        }else if(K<=notoneindex){
            System.out.println("1");
        }else{
            System.out.println(notone);
        }
    }
}


Measured memory_bytes: 23764
#include <bits/stdc++.h>
using namespace std;
int main(void) {
    int n,a,q,b;
    std::deque<int> deq1;
    deque<int> deq2;
    cin >>n;
    for (int i=0;i<n;i++) {
        cin >> a;
        deq1.emplace_back(a);
    }
    cin >> q;
    for (int j=0;j<q;j++) {
        cin >> b;
        deq2.emplace_back(b);
    }
    if ( includes(deq1.begin(),deq1.end(),deq2.begin(),deq2.end())==true ) {
        cout << "1" << endl;
    } else {
        cout << "0" << endl;
    }
}


Measured memory_bytes: 4448
// C++ implementation of the approach 
#include <bits/stdc++.h> 
using namespace std; 

// Function to find special numbers 
void divisibilityCheck(int arr[], int n) 
{ 
    unordered_set<int> s; 
    int max_ele = INT_MIN; 
    for (int i = 0; i < n; i++) { 
        s.insert(arr[i]);  
        max_ele = max(max_ele, arr[i]); 
    } 

    // Traversing the array elements and storing the array 
    // multiples that are present in s in res 
    unordered_set<int> res; 
    for (int i = 0; i < n; i++) { 

        // Check for non-zero values only 
        if (arr[i] != 0) { 

            // Checking the factors of current element 
            for (int j = arr[i] * 2; j <= max_ele; j += arr[i]) { 

                // If current factor is already part 
                // of the array then store it 
                if (s.find(j) != s.end()) 
                    res.insert(j); 
            } 
        } 
    } 

    // For non-distinct elmments 
    // To store the frequency of elements 
    unordered_map<int, int> mp; 
    for (int i = 0; i < n; i++) 
        mp[arr[i]]++; 

    unordered_map<int, int>::iterator it; 
    vector<int> ans; 
    for (it = mp.begin(); it != mp.end(); it++) { 

        // If frequency is at least 2 
        if (it->second >= 2) { 
            if (res.find(it->first) == res.end()) { 

                // If frequency is greater than 1 and 
                // the number is not divisible by 
                // any other number 
                int val = it->second; 

                // Then we push the element number of 
                // times it is present in the vector 
                while (val--) 
                    ans.push_back(it->first); 
            } 
        } 

        // If frequency is greater than 1 and the number 
        // is divisible by any other number 
        if (res.find(it->first) != res.end()) { 
            int val = it->second; 

            // Then we push the element number of 
            // times it is present in the vector 
            while (val--) 
                ans.push_back(it->first); 
        } 
    } 

    // Print the elements that are divisible by 
    // at least one other element from the array 
    cout<<n-ans.size();
} 

// Driver code 
int main() 
{ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r", stdin) ;
        freopen("output.txt","w", stdout) ;
        freopen("error.txt","w", stderr) ;
    #endif
    int n; cin>>n;
    int v[n];
    for(int i=0;i<n;i++)
        cin>>v[i];

    divisibilityCheck(v, n); 

    return 0; 
} 


Measured memory_bytes: 30624
// Sort I - Shell Sort
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_2_D
using System;
using System.Linq;
using System.Collections.Generic;

namespace ALDS1_2_D {
	class Program {
		public Program() {}
		
		public static void Main() {
			new Program().Calc();
		}
		
		void Calc() {
			var N = int.Parse(Input);	// Number of elements
			var A = new int[N];         // Array : N elements
            for (int i = 0; i < N; i++)
                A[i] = int.Parse(Input);
			shellSort(A, N);
		}
		
		String Input {
			get {
				return Console.ReadLine();
			}
		}
		
		void Output(String str) {
			Console.WriteLine(str);
		}

        int[] selectionSort(int[] A, int N, int g, ref int count) {
            for(int i = g; i < N; i++) {
				int target = A[i];
				int j = i - g;
				while(j >= 0 && target < A[j]) {
					A[j+g] = A[j];
                    count++;
                    j -= g;
                }
				A[j+g] = target;
			}
            //Output(A.Select(s => s.ToString())
            //        .Aggregate((s, t) => s + " " + t));
            return A;
        }
        
        void shellSort(int[] A, int N) {
            int cnt = 0;
            var GList = new List<int>() {1};
            int tmp = 4;
            while(tmp < N) {
                GList.Add(tmp);
                tmp = 3 * tmp + 1;  // G_n+1 = 3 * G_n + 1
            }
            GList.Reverse();
            var G = GList.ToArray();
            int m = G.Length;

            Output(m.ToString());
            Output(G.Select(i => i.ToString())
						.Aggregate((i, j) => i + " " + j));
            for(int i = 0; i < m; i++) {
                A = selectionSort(A, N, G[i], ref cnt);
            }

            Output(cnt.ToString());
            for (int i = 0; i < N; i++)
                Output(A[i].ToString());
        }
	}
}

Measured memory_bytes: 16896
# C - Poll
from collections import Counter


def main():
    _, *S = open(0).read().split()
    cnt = Counter(S).most_common()
    max_votes = cnt[0][1]
    ans = []
    for a, i in cnt:
        if i < max_votes:
            break
        ans.append(a)
    ans.sort()
    print("\n".join(map(str, ans)))


if __name__ == "__main__":
    main()


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

#define rep(i, N) for (int i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define repr(i, N) for (ll i = N-1; i >= 0; i--)
#define repr1(i, N) for (ll i = N; i > 0; i--)

using ll = long long;
using namespace std;

int main(){
    int A, B, C, X, Y;
    cin >> A >> B >> C >> X >> Y;

    ll ans = 0;
    ans = min(A*X + B*Y, min(C*2*min(X,Y) + ((X > Y) ? A*(X-Y) : B*(Y-X)),C*2*max(X,Y)));
    
    cout << ans << endl;
}


Measured memory_bytes: 256