akhauriyash/Code-Regression huggingface dataset:
def main():
    from bisect import bisect_left, bisect_right

    N, K, C = map(int, input().split())
    s = input()

    L = [0] * (N + 2)
    R = [0] * (N + 2)
    # 1-indexedで管理した
    # 貪欲に端から配置した場合に達成可能な
    # 累積配置数

    need = [0] * N

    i = 0
    while i < N:
        if s[i] == 'o':
            L[i + 1] = 1
            need[i] += 1
            i += C + 1
        else:
            i += 1

    i = N - 1
    while i >= 0:
        if s[i] == 'o':
            R[i + 1] = 1
            need[i] += 1
            i -= C + 1
        else:
            i -= 1

    for i in range(N):
        L[i + 1] += L[i]
        R[i + 1] += R[i]

    ans = []
    for i in range(N):
        if need[i] == 2:
            li = bisect_left(L, L[i])  # 1-indexed
            if R[i + 1] == R[i + 2]:
                ri = bisect_right(R, R[i + 2]) + 1
            else:
                ri = i + 2  # 1-indexed
            d = (ri - li + 1 <= C)
            except_i = L[i] + (R[N] - R[i + 1]) - d
            if except_i < K:
                ans.append(i + 1)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# 前後両端について
# それぞれから貪欲に配置した累積配置数を準備
# 必ず働く日は
# 前から貪欲に配置したケースと
# 後ろから貪欲に配置したケースの重なりに含まれる必要があり、
# そのような重なり(need==2)について
# その日に働かないとした場合の前後の累積配置数の和がK未満なら働く必要がある


Measured memory_bytes: 33284
import os
from collections import Counter

import sys

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

sys.setrecursionlimit(10 ** 9)
INF = float("inf")
IINF = 10 ** 18
MOD = 10 ** 9 + 7
# MOD = 998244353


N, M = list(map(int, sys.stdin.buffer.readline().split()))


def test(ans):
    hist = []
    for a, b in ans:
        hist.append((0, (b - a) % N))
        hist.append((0, (a - b) % N))
    print(len(set(hist)) == M * 2)
    print(Counter(hist))


ans = []
if N % 2 == 1:
    for i in range(M):
        a, b = i + 1, N - i
        ans.append((a, b))
else:
    hist = set()
    d = 0
    for i in range(M):
        a, b = i + 1, N - i - d
        if (a - b) % N in hist or (b - a) % N in hist or (a - b) % N == (b - a) % N:
            d += 1
            a, b = i + 1, N - i - d
        hist.add((a - b) % N)
        hist.add((b - a) % N)
        ans.append((a, b))

for a, b in ans:
    print(a, b)

# test(ans)


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

// definition {{{ 1

// scaning {{{ 2
#define Scd(x) scanf("%d", &x)
#define Scd2(x,y) scanf("%d%d", &x, &y)
#define Scd3(x,y,z) scanf("%d%d%d", &x, &y, &z)
#define Scll(x) scanf("%llu", &x)
#define Scll2(x,y) scanf("%llu%llu", &x, &y)
#define Scll3(x,y,z) scanf("%llu%llu%llu", &x, &y, &z)
// }}} 2

// numerous {{{ 2
#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
// }}} 2

// systems {{{ 2
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)
// systems }}} 2

// }}} 1

int main() {

    int a[11] = {};

    Rep(i,3){
    scanf("%d", a);
    a[a[0]]++;
    }

    if(  a[5] == 2 && a[7] == 1 ){
        printf ("YES\n");
    }else{
        printf ("NO\n");
    }

    return 0;
}



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

#define mp make_pair
#define pb push_back
#define st first
#define nd second

typedef long long ll;
typedef pair < int , int > pp;
const int mod = 1e9 + 7;
const int N   = 2e3 + 3;

int A[N],B[N],n,k,q,i,j,ans;

int f(int b, int e){
    int i,las,t,x;
    las = t = x = 0;
    for(i=1;i<=n+1;i++){
        if(A[i] < b) { x += max(0, min(t , i-las-k)); las = i; t = 0; }
        else if(A[i] <= e) t++;
    }
    return x;
}

int main(){
    cin >> n >> k >> q;
    for(i=1;i<=n;i++) { cin >> A[i]; B[i] = A[i]; }
    sort(B+1 , B+n+1);
    ans = mod;
    for(i=j=1; i<=n; i++){
        for(; j <= i && f(B[j],B[i]) >= q ; j++)
            ans = min(ans , B[i]-B[j]);
    }

    if(ans == mod) assert(0);
    cout << ans << endl;
    return 0;
}   

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define gcd __gcd
#define all(x) (x).begin(), (x).end()
template<class T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<class T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
const int INF = 1e18, MOD = 1e9 + 7;
signed main() {
    INCANT;
    int n, cnt;
    cin>>n;
    int c[555], s[555], f[555];
    rep(i, n - 1) {
        cin>>c[i]>>s[i]>>f[i];
    }
    rep(i, n) {
        cnt = 0;
        rep(j, i, n - 1) {
            chmax(cnt, s[j]);
            cnt = (cnt + f[j] - 1) / f[j] * f[j];
            cnt += c[j];
        }
        cout<<cnt<<endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const long long LINF = 1e18;
const long long MOD = 1e9 + 7;

#define MAX_N 100000

ll n;
int m;
vector<int> G[MAX_N];
int color[MAX_N];

bool dfs(int v, int c){
    color[v] = c;
    for(auto u : G[v]){
        if(color[u] == c) return false;
        if(color[u] == 0 && !dfs(u, -c)){
            return false;
        }
    }
    return true;
}

signed main(){
    cin >> n >> m;
    REP(i,m){
        int a,b;
        cin >> a >> b;
        a--;
        b--;
        G[a].emplace_back(b);
        G[b].emplace_back(a);
    }
    if(!dfs(0, 1)){
        cout << n * (n - 1) / 2 - m << endl;
    }else{
        ll black = 0, white = 0;
        for(int v = 0; v < n; v++){
            if(color[v] == 1) black++;
            else white++;
        }
        cout << black * white - m << endl;
    }
    return 0;
}

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

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

int main() {
    int n;
    int k;
    
    cin >> n;
    cin >> k;
    int n2[n]; 
    int n3[n];
    
    for(int i = 0; i < n;i++ )
    {
    	cin >> n2[i];
    }

    std::sort(n2, n2 + ARRAY_SIZE(n2));
    int p = 0;
    for(int i = 0; i < k;i++ )
    {
        p += n2[i];
    }
    std::cout << p;
    return 0;
}

Measured memory_bytes: 3592
N = int(input())
a = list(input() for i in range(N)) #0～N-1まである
k = 0
for i in range(N-1): #0～N-2まである
  if a.count(a[i]) != 1:
    print('No')
    break
  elif a[N-1] == a[i]:
    print('No')
    break
  elif (a[i+1][0:1]) != (a[i][-1:]): #1～N-1までやりたい　#0～N-2までやりたい
    print('No')
    break
  else:
    k = k + 1

if k == (N-1):
  print('Yes')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
const int maxn = 505;
typedef long long ll;
ll a[maxn];

int main()
{
    int n;
    while(cin>>n){
        for(int i=0;i<n;i++){
            cin>>a[i];
        }
        sort(a, a+n);
        double temp = a[0];
        for(int i=1;i<n;i++){
            temp += (double)a[i];
            temp /= 2.0;
        }
        cout<<temp<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h> 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int 	     	  long long   // [9,223,372,036,854,775,807 to -9.....808] 19 digits
#define pb                push_back 
#define all(x)            (x).begin(),(x).end()
#define mp                make_pair
#define vi                vector<int> 
#define vpi               vector<pair<int,int>>
#define mii               map<int,int>
#define x                 first
#define y                 second 
#define mem(a,x)          memset(a,x,sizeof(a))
#define rep(i,a,b)        for(int i=a;i<b;i++)
#define sz(x)             (int)((x).size())

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; // find_by_order()  // order_of_key

//const int32_t hellhsh = 444440583533; const double pi=2*acos(0.0); 
const int32_t mod = 1e9+7;
const int32_t maxn=2e5+5;

void solve(){
    int n;cin>>n;
    int d[n];rep(i,0,n) cin>>d[i];
    int ans[n]={0};ans[1]=abs(d[1]-d[0]);
    //cout<<ans[1]<<' ';
    rep(i,2,n){
        ans[i]=min(ans[i-1]+abs(d[i]-d[i-1]),ans[i-2]+abs(d[i]-d[i-2]));
        //cout<<ans[i]<<" ";
    }
    cout<<ans[n-1];
}

signed main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int tc=1,k=1;                                                                                                                  
    //cin>>tc;
    while(tc--){
        //cout<<"Case #"<<k++<<": ";
        solve();
    }
    return 0;
}

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

const int N=5e5;
inline char* l(char* p, int s) { for(;*p==s;p++); return p; }

int main(int argc, char* argv[])
{
  int64_t sum=0;
  char s[N+1];
  char *p,*q,*r;
  scanf("%s",s);
  for (p=s;*p;p=r) {
    q=l(p,'<'), r=l(q,'>');
    int64_t m=q-p, n=r-q;
    sum += m*(m-1)/2 + n*(n-1)/2 + ((m>n)?m:n);
  }
  printf("%ld\n", sum);
  return 0;
}



Measured memory_bytes: 768
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

#define MIN(a,b) ((a)<(b)?(a):(b))
#define ALLOC(size,type) ((type*)calloc((size),sizeof(type)))

void run (void) {
  i32 n, w;
  scanf ("%" SCNi32 "%" SCNi32, &n, &w);
  i32 m = 1000 * n;
  i32 *dp = ALLOC (m + 1, i32);
  for (i32 i = 1; i <= m; ++i) {
    dp[i] = w + 1;
  }
  while (n--) {
    i32 a, b;
    scanf ("%" SCNi32 "%" SCNi32, &a, &b);
    for (i32 i = m; i >= b; --i) {
      i32 x = dp[i - b] + a;
      dp[i] = MIN (dp[i], x);
    }
  }
  while (dp[m] > w) m--;
  printf ("%" PRIi32 "\n", m);
}

int main (void) {
  run();
  return 0;
}


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

int main() {
    int N;
    cin >> N;
    vector<long long> A(N);
    for(int i=0; i<N; ++i) {
        cin >> A[i];
        A[i] -= i+1;
    }
    sort(A.begin(), A.end());
    long long res = 0;
    for(int i=0; i<N; ++i) res += abs(A[i] - A[N/2]);
    cout << res << endl;
}

Measured memory_bytes: 1792
import java.io.*;
import java.util.*;
public class Main{
    public static void main(String[] args) throws IOException{
        MyReader r = new MyReader();      
        int N, K;
        {int[] a = r.ii(); N = a[0]; K = a[1];}
        String S = r.s();
        int n = 0;
        int happy = 0;
        for(int i = 0; i < N; ){
            char x = S.charAt(i);
            int j = 0;
            while(i < N && x == S.charAt(i)){
                i++;
                j++;
            }
            n++;
            happy += j-1;
        }
        int k = n/2;
        if(n%2 == 1){            
            happy = Math.min(N-1, happy+2*Math.min(k, K));
        } else {
            if(k < K)
                happy = Math.min(N-1, happy+2*k-1);
            else
                happy = Math.min(N-1, happy+2*K);
        }
        println(happy);
    }
    static void print(Object o){
        System.out.print(o.toString());
    }
    static void println(Object o){
        System.out.println(o.toString());
    }
    static int Int(String s){
        return Integer.parseInt(s);
    }
    static long Long(String s){
        return Long.parseLong(s);
    }
    static class MyReader extends BufferedReader{
        MyReader(){
            super(new InputStreamReader(System.in));
        }
        String s() throws IOException{
            return readLine();
        }
        String[] ss() throws IOException{
            return s().split(" ");
        }
        int i() throws IOException{
            return Int(s());
        }
        int[] ii() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            int[] ii = new int[size];
            for(int j = 0; j < size; j++) ii[j] = Integer.parseInt(ss[j]);
            return ii;
        }
        long l() throws IOException{
            return Long(s());
        }
        long[] ll() throws IOException{
            String[] ss = ss();
            int size = ss.length;
            long[] ll = new long[size];
            for(int j = 0; j < size; j++) ll[j] = Long.parseLong(ss[j]);            
            return ll;
        }
    }
}

Measured memory_bytes: 23252
#include <bits/stdc++.h>
#define lli long long int
#define pb push_back
#define mod2 998244353
#pragma GCC optimize("-O2")
#define mod3 127
#define mod 1000000007
#define MAXN 1000000000
#define v32 vector<int>
#define v64 vector<lli>
#define v1024 vector<vector<int>>
#define v4096 vector<vector<lli>>
#define vt vector
#define f(x, y, z) for (lli x = y; x < z; x++)
#define fd(x, y, z) for (lli x = y; x > z; x--)
#define lb lower_bound
#define ld long double
#define m64 map<lli, lli>
#define m32 map<int, int>
#define m64it map<lli, lli>::iterator
#define m32it map<int, int>::iterator
#define fastio                    \
ios_base::sync_with_stdio(0); \
cin.tie(0);                   \
cout.tie(0)
#define ist insert
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define p_q priority_queue
#define min_p_q priority_queue<int, vt<int>, greater<int>>
using namespace std;
using namespace __gnu_pbds;
lli tmod(lli x, lli y)
{
    return (x % y + y) % y;
}
template <typename T>
void DEBUG_ARR(vt<T> a)
{
    f(i, 0, a.size()) cout << a[i] << " ";
    cout << "\n";
}
lli power(lli x, lli y) 
{
    lli res = 1;  
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x)%mod; 
        y = y>>1; 
        x = (x*x)%mod;
    }
    if(res<0)res+=mod;
    return res; 
}

int main()
{   
    fastio;
    int n,k;
    cin>>n>>k;
    lli h[n];f(i,0,n)cin>>h[i];
    sort(h,h+n);
    lli ans=0;
    f(i,0,n-k)ans+=h[i];
    cout<<ans<<"\n";
    return 0;
}


Measured memory_bytes: 1792
n, k, q = gets.chomp.split.map(&:to_i)
ans = Array.new(n, 0)

q.times do
    ans[gets.to_i - 1] += 1
end

n.times do |i|
    sum = k - (q - ans[i])
    if sum > 0
        puts 'Yes'
    else
        puts 'No'
    end
end

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

using namespace std;

int main() {
    std::ios::sync_with_stdio(false);
    string s;
    cin>>s;
    long n=s.length();
    long ans=0;
    int a;
    if(s[0]=='W' )
        a=0;
    else
        a=1;
    for(long i=0;i<n;i++){
        if(s[i]=='W' && a==1){
            a=0;
            ans+=1;
        }
        else if(s[i]=='B' && a==0){
            a=1;
            ans+=1;
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 512
using System;
using System.Collections.Generic;
using System.Linq;

namespace RoundOne
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputA = int.Parse(Console.ReadLine());
            var inputB = int.Parse(Console.ReadLine());
            List<int> numbers = new List<int> { 1, 2, 3 };
          
            numbers.Remove(inputA);
            numbers.Remove(inputB);

            Console.WriteLine(numbers[0]);                       
        }        
    }
}

Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
#define ALL(obj) begin(obj), end(obj)
using namespace std;
using ll = long long;
using ull = unsigned long long;

const int INF = 2100100100;
const int MOD = 1e9 + 7;

// 多次元 vector 生成
template <class T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}
template <class T>
bool chmax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return 1;
    }
    return 0;
}

int main() {
    // cin.tie(0);
    // ios::sync_with_stdio(false);
    ll N, M;
    cin >> N >> M;

    if (N > M) swap(N, M);

    if (N == 1 && M == 1) {
        cout << 1 << endl;
    } else if (N == 1) {
        cout << M - 2 << endl;
    } else {
        cout << (N - 2) * (M - 2) << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << (x) << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 29;
constexpr lint   INFL = 1LL << 61;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  string s;
  cin >> s;
  const int   len = s.length();
  vector<int> sv(len), ans(len);
  rep (i, len - 1) {
    if (s[i] == 'R') sv[i] = s[i + 1] == 'L' ? 1 : 0;
    if (s[i] == 'L') sv[i] = s[i + 1] == 'R' ? 3 : 2;
  }
  sv[len - 1] = 3;
  int  l = 0, lpos = 0;
  bool lside = true;
  rep (i, len) {
    if (lside) {
      if (sv[i] == 1) {
        lside = false;
        lpos  = i;
      }
    } else {
      if (sv[i] == 3) {
        int sum = i - l + 1;
        ans[lpos] = ans[lpos + 1] = sum / 2;
        if (sum & 1) {
          if ((l ^ lpos) & 1) ++ans[lpos + 1];
          else ++ans[lpos];
        }
        lside = true;
        l = i + 1;
      }
    }
  }
  rep (i, len) cout << ans[i] << (i != len - 1 ? " " : "\n");
  return 0;
}

Measured memory_bytes: 1488
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long 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 (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;
    vll a(n);
    rep(i, n) cin >> a[i];
    map<ll, ll> mp;
    rep(i, n) mp[a[i]]++;
    vi v;
    v.pb(0);
    for (int i = 1; i < n; ++i) if (a[v.back()] < a[i]) v.pb(i);
    vll ans(n, 0);
    for (int i = sz(v) - 2; i >= 0; --i) {
        while ((*mp.rbegin()).fi > a[v[i]]) {
            auto p = *mp.rbegin();
            mp.erase(p.fi);
            ans[v[i+1]] += (p.fi - a[v[i]]) * 1LL * p.se;
            mp[a[v[i]]] += p.se;
        }
    }
    for (auto p : mp) {
        ans[0] += p.fi * p.se;
    }

    rep(i, n) cout << ans[i] << endl;

}

Measured memory_bytes: 9468
#include<iostream>
#include<cstring>
using namespace std;
const int N=101;
int t[N],val[N];
long long dp[100001][N];
int main()
{
	int T,m;cin>>m>>T;
	for(int i=1;i<=m;i++)
		cin>>t[i]>>val[i];
	memset(dp,0x3f,sizeof(dp));
	dp[0][0]=0;
	for(int j=1;j<=m;j++)
		for(int i=0;i<=100000;i++)
		{
			dp[i][j]=dp[i][j-1];
			if(i>=val[j])dp[i][j]=min(dp[i][j],dp[i-val[j]][j-1]+t[j]);
		}
	for(int i=100000;i>=0;i--)
		if(dp[i][m]<=T){cout<<i;break;}
	return 0;
}

Measured memory_bytes: 82540
#include<bits/stdc++.h>
using namespace std;
int a,b;
int main(){
    scanf("%d%d",&a,&b);
    if(a%b==0){
        printf("-1");
        return 0;
    }
    for(int i=a;;i+=a)
        if(i%b!=0){
            printf("%d",i);
            return 0;
        }
}

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

int main(){
  int r, g, b;
  cin >> r >> g >> b;
  int tmp = r * 100 + g * 10 + b;
  if(tmp % 4 == 0) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <utility>
#include <numeric>

using namespace std;

using ll = long long;
using ull = unsigned long long;

const ll inf = 1ll << 60;
const ll mod = (ll)1e9 + 7;

#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()

#define print(s) cout << s;
#define println(s) cout << s << endl;
#define printd(s, f) cout << fixed << setprecision(f) << s << endl;


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

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

	int q;
	cin >> q;

	for (int i = 0; i < q; i++)
	{
		int k;
		cin >> k;

		decltype(a)::iterator it = lower_bound(all(a), k);
		if (it != a.end())
		{
			println(distance(a.begin(), it));
		}
		else
		{
			println(n);
		}
	}
}



Measured memory_bytes: 3136
N,M = map(int,input().split())
ks = [list(map(int,input().split())) for i in range(M)]
p = list(map(int,input().split()))
ans = 0
for i in range(2**N):
    bit = [i>>j & 1 for j in range(N)]
    for k,x in enumerate(ks):
        _,*s = x
        if p[k] != sum([bit[y-1] for y in s])%2:
            break
    else:
        ans += 1
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define 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 FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)

ll min(ll a, ll b){
	if (a<b) return a;
	else return b;
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n;
	cin >> n;
	vector<ll> a(5);
	REP(i, 5){cin >> a[i];}
	ll m = a[0];
	REP(i, 5){m = min(a[i], m);}
	if (m==n){
		cout << 5 << endl;
	} else{
	ll ans = (n-1)/m;
	cout << 5 + ans << endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <cmath>
#include <algorithm>
#include <vector>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>func(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p;
}

int main(){
  string s;
  cin>>s;
  for(int i=0;i<s.size();i++){
    for(int j=i;j<s.size();j++){
      string t=s.substr(0,i)+s.substr(j);
      if(t=="keyence"){cout<<"YES"<<endl;return 0;}
    }
  }
  cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 3636
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<bitset>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<deque>
#include<list>
#include<iomanip>
#include<cmath>
#include<cstring>
#include<functional>
using namespace std;
 
#define repr(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
#define rep(i, n) repr(i, 0, n)
#define INF 2e9
#define MOD 1000000007
//#define MOD 998244353
#define LINF (long long)4e18
#define jck 3.141592
 
using ll = long long;
using Pi = pair<int,int>;
using Pl = pair<ll,ll>;

ll dp[410][410];
int N;
vector<int> a;
vector<ll> sum;

ll solve(int L,int R){
	if(L == R) return 0;
	if(dp[L][R] != -1) return dp[L][R];

	ll res = LINF;
	repr(i,L,R){
		res = min(res,solve(L,i)+solve(i+1,R)+sum[R+1]-sum[L]);
	}
	return dp[L][R] = res;
}
 
int main(){
	cin >> N;
	a.resize(N);
	sum.resize(N+1);
	rep(i,N) cin >> a[i];
	rep(i,N) sum[i+1] = sum[i] + a[i];
	rep(i,410)rep(j,410) dp[i][j] = -1;
	ll ans = solve(0,N-1);
	cout << ans << endl;
}


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll ,P> P3;
typedef pair<P ,P> PP;
const ll MOD = ll(1e9+7);
const int IINF = INT_MAX;
const ll LLINF = LLONG_MAX;
const int MAX_N = int(1e5 + 5);
const double EPS = 1e-6;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int main() {
    int n, ma, mb, dp[450][450];
    P3 v[45];
    cin >> n >> ma >> mb;
    REP(i,450) fill(dp[i],dp[i]+450,IINF/3);
    dp[0][0] = 0;
    REP(i,n){
        int a, b, c;
        cin >> a >> b >> c;
        for(int ia=400;ia>=0;ia--){
            for(int ib=400;ib>=0;ib--){
                if(a>ia || b>ib)continue;
                dp[ia][ib] = min(dp[ia][ib], dp[ia-a][ib-b]+c);
            }
        }
    }
    int ans = IINF/3;
    REP(i,41){
        if(i==0)continue;
        ans = min(ans, dp[i*ma][i*mb]);
    }
    cout << (ans<IINF/3?ans:-1) << endl;
    return 0;
}

Measured memory_bytes: 1024
import java.util.*;
import java.io.*;

public class Main {
	static FastReader in = new FastReader();

	public static void main(String[] args) {
		solve();
	}

	static void solve() {
		int n = in.nextInt(), m = in.nextInt();
		
		HashSet<Integer>[] edges = new HashSet[n];
		for(int i = 0; i < n; i++) edges[i] = new HashSet<>();
		for(int i = 0; i < m; i++)
		{
			int a = in.nextInt() - 1, b = in.nextInt() - 1;
			edges[a].add(b);
			edges[b].add(a);
		}
		ff(n, edges);
	}
	
	static void ff(int n, HashSet<Integer>[] adj)
	{
		Queue<Integer> q = new LinkedList<Integer>();
		int maxsize = 0;
		boolean[] visited = new boolean[n];
		for(int i = 0; i < n; i++)
		{
			if(!visited[i])
			{
				int currsize = 0;
				q.add(i);
				visited[i] = true;
				while(!q.isEmpty())
				{
					int curr = q.poll();
					currsize++;
					for(int adjnode : adj[curr])
					{
						if(visited[adjnode]) continue;
						visited[adjnode] = true;
						q.add(adjnode);
					}
				}
				maxsize = Math.max(currsize,  maxsize);
			}
			
		}
		System.out.println(maxsize);
	}

	static class FastReader {
		BufferedReader br;
		StringTokenizer st;

		public FastReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}

		String next() {
			while (st == null || !st.hasMoreElements()) {
				try {
					st = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			}
			return st.nextToken();
		}

		int nextInt() {
			return Integer.parseInt(next());
		}

		long nextLong() {
			return Long.parseLong(next());
		}

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

		String nextLine() {
			String str = "";
			try {
				str = br.readLine();
			} catch (IOException e) {
				e.printStackTrace();
			}
			return str;
		}

		int[] readarr(int abc) {
			int[] a = new int[abc];
			for (int i = 0; i < abc; i++)
				a[i] = nextInt();
			return a;
		}
	}
}





Measured memory_bytes: 118352
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long H = sc.nextInt() - 1;
		long W = sc.nextInt() - 1;
		long A = sc.nextInt() - 1;
		long B = sc.nextInt() - 1;

		long MOD = 1000000007L;
		BigInteger BMOD = BigInteger.valueOf(MOD);
		//BigInteger x = BigInteger.ONE;
		//BigInteger y = BigInteger.ONE;
		long x = 1;
		long y = 1;

		for (long i = W - B; i <= W - B - 1 + H; i++) {
			//y = y.multiply(BigInteger.valueOf(i));
			y = (y * i) % MOD;
		}
		for (long i = 1; i <= H; i++) {
			//y = y.divide(BigInteger.valueOf(i));
			y = (y * BigInteger.valueOf(i).modInverse(BMOD).longValue()) % MOD;
		}

		//long ans = x.multiply(y).mod(BigInteger.valueOf(MOD)).longValue();
		long ans = (x * y) % MOD;
		long a1 = B + 1;
		long a2 = 1;
		long b1 = W - B - 1 + H;
		long b2 = H;
		for (int i = 1; i < H - A; i++) {
			//x = x.multiply(BigInteger.valueOf(a1))
			//		.divide(BigInteger.valueOf(a2));
			x = (x * a1) % MOD;
			x = (x * BigInteger.valueOf(a2).modInverse(BMOD).longValue()) % MOD;
			a1 += 1;
			a2 += 1;
			//y = y.multiply(BigInteger.valueOf(b2))
			//		.divide(BigInteger.valueOf(b1));
			y = (y * b2) % MOD;
			y = (y * BigInteger.valueOf(b1).modInverse(BMOD).longValue()) % MOD;
			b1 -= 1;
			b2 -= 1;
			//ans = (ans
			//		+ x.multiply(y).mod(BigInteger.valueOf(MOD)).longValue())
			//		% MOD;
			ans = (ans + x * y) % MOD;
		}
		System.out.println(ans);
	}
}


Measured memory_bytes: 33292
// DEGwerさんの数え上げpdfを読んで
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
#define inRange(x,a,b) (a <= x && x < b)
typedef long long ll;
const int mod = 1000000007;

int main(){
    int n;
    string s;
    cin >> n >> s;
    vector<vector<ll>> dp(n+1, vector<ll>(n+1, 0));
    dp[0][0] = 1;
    for(int i = 0; i < n; i++){
        for(int j = 0; j <= n; j++){
            if(dp[i][j] == 0)   continue;
            int del = max(0, j-1), add = j+1;
            dp[i+1][del] += dp[i][j];
            dp[i+1][del] %= mod;
            dp[i+1][add] += 2*dp[i][j];
            dp[i+1][add] %= mod;
        }
    }
    int ans = dp[n][s.length()];
    for(int i = 0; i < s.length(); i++){
        if(ans%2)   ans += mod;
        ans /= 2;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 195840
#include <climits>
#include <cstring>
#include <iostream>
#include <vector>
#include <utility>
#include <algorithm>
#include <string>
#include <set>
#include <unordered_set>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <fstream>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define f first
#define s second

#define MM INT_MAX/5
#define MIM INT_MIN/2

int di[] = { 1,-1,0,0 };
int dj[] = { 0,0,1,-1 };

#define FOR(i, a, b) for (int i=a; i<(b); i++)
#define F0R(i, a) for (int i=0; i<(a); i++)
#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)

#define v vector
#define sz(x) (int)(x).size()
#define mp make_pair
#define pb push_back
#define beg(x) x.begin()
#define en(x) x.end()
#define all(x) beg(x), en(x)
#define resz resize

#define MAX 401
using ll = long long;

int N;
vector<ll> slimes;
vector<ll> prefix;
ll dp[MAX][MAX];


int main()
{
	cin >> N;
	slimes.pb(0);
	prefix.pb(0);
	ll h1;
	for (ll i = 0; i < N; i++)
		cin >> h1, slimes.pb(h1), prefix.pb(prefix[i] + h1);
	for (ll size = 2; size <= N; size++)
		for (ll l = 1; l + size - 1 <= N; l++)
		{
			ll r = l + size - 1; //ex. size was 2: dp[1][2]
			ll mini = LLONG_MAX;
			for (ll slice = l; slice < r; slice++)
				mini = min(mini, dp[l][slice] + dp[slice + 1][r]);
			dp[l][r] = mini + prefix[r] - prefix[l - 1];
		}
	cout << dp[1][N];
}


//#include <climits>
//#include <cstring>
//#include <iostream>
//#include <vector>
//#include <utility>
//#include <algorithm>
//#include <string>
//#include <set>
//#include <unordered_set>
//#include <cmath>
//#include <queue>
//#include <stack>
//#include <map>
//#include <fstream>
//using namespace std;
//
//typedef long long ll;
//typedef pair<int, int> pii;
//typedef pair<ll, ll> pll;
//#define f first
//#define s second
//
//#define MM INT_MAX/5
//#define MIM INT_MIN/2
//
//int di[] = { 1,-1,0,0 };
//int dj[] = { 0,0,1,-1 };
//
//#define FOR(i, a, b) for (int i=a; i<(b); i++)
//#define F0R(i, a) for (int i=0; i<(a); i++)
//#define FORd(i,a,b) for (int i = (b)-1; i >= a; i--)
//#define F0Rd(i,a) for (int i = (a)-1; i >= 0; i--)
//
//#define v vector
//#define sz(x) (int)(x).size()
//#define mp make_pair
//#define pb push_back
//#define beg(x) x.begin()
//#define en(x) x.end()
//#define all(x) beg(x), en(x)
//#define resz resize
//
//#define MAX 401
//
//int N;
//vector<int> slimes;
//vector<int> prefix;
//int dp[MAX][MAX];
//
//int main()
//{
//	cin >> N;
//	slimes.pb(0);
//	prefix.pb(0);
//	int h1;
//	for (int i = 0; i < N; i++)
//		cin >> h1, slimes.pb(h1), prefix.pb(prefix[i]+h1);
//	for(int size = 2; size <= N; size++)
//		for (int l = 1; l + size - 1 <= N; l++)
//		{
//			int r = l + size - 1; //ex. size was 2: dp[1][2]
//			int mini = INT_MAX;
//			for (int i = 0; i < size-1; i++)
//				mini = min(mini, dp[l][l + i] + dp[l + i + 1][r]);
//			dp[l][r] = mini + prefix[r] - prefix[l - 1];
//		}
//	cout << dp[1][N];
//}


Measured memory_bytes: 1536
/*
	Name: Harshit Jain
	Institution: IIIT Vadodara
*/
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <list>
#include <stack>
#include <cstring>
#include <map>
#include <queue>
#include <ctime>
#include <iomanip>
#include <set>
#include <sstream>
#include <unordered_set>
#include <unordered_map>
#include <cmath>
#include <climits>

#define trace2(x, y)             cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<< endl;
#define trace3(x, y, z)          cout <<#x<<": "<<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl;
#define trace4(a, b, c, d)       cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl;
#define trace5(a, b, c, d, e)    cout <<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<<": "<<e<<endl;
const double PI=3.141592653589793238462643383279502884197169399375105820974944;
#define pb push_back
#define mp make_pair
#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ull unsigned long long
#define rep(i,a,b) for(ll i = a; i < b; ++i)
#define sz(a) int((a).size()) 
#define pb push_back 
#define all(c) (c).begin(),(c).end() 
#define tr(c,i) for(typeofa((c).begin() i = (c).begin(); i != (c).end(); i++) 
#define present(c,x) ((c).find(x) != (c).end()) 
#define cpresent(c,x) (find(all(c),x) != (c).end()) 
#define p(a) cout << a << "\n";
#define p1(a) cout << a << " ";

#define PI 3.141592653589793
#define MOD (ll)(1e9 + 7)
#define m(a) ((a)%MOD)

using namespace std;
typedef vector<int> vi; 
typedef vector<vi> vvi; 
typedef pair<int,int> ii; 
//=======================

void solve()
{
	ll n,h;
	cin >> n >> h;
	vector<pair<ll, ll> > vec(n);
	ll sum = 0;
	ll arr1[n];
	rep(i,0,n)	
	{
		ll a,b;
		cin >> a >> b;
		vec[i] = mp(a,b);
		arr1[i] = b;
	}
	sort(vec.begin(), vec.end());
	sort(arr1, arr1+n);
	ll count = 0;
	for(int i = n-1; i >= 0; --i)
	{
		if(arr1[i] > vec[n-1].first && sum < h)
		{
			++count;
			sum += arr1[i];
		}
	}
	// rep(i,0,n)
	// {
	// 	trace2(vec[i].first, vec[i].second)
	// }
	printf("%.0f\n", max(ceil(((h - sum)*1.0)/(1.0*vec[n-1].first)), 0.0) + count);
}

//=======================
int main()
{
	bool testing = false;
	IOS
	if(testing)
	{
		freopen("test.txt","rt",stdin);
		int start = clock();
		solve();
		int end = clock();
		cout << "time: " << (end - start)/(double)(CLOCKS_PER_SEC)*1000 << " milliseconds\n";
	}
	else
	{
		solve();
	}
} 

Measured memory_bytes: 2560
#include<stdio.h>
int main(){
  int s[10000],t[500];
  int n,q;
  int i,j;
  int cnt=0;


  scanf("%d",&n);
  for(i=0;i<n;i++)
    scanf("%d",&s[i]);

  scanf("%d",&q);
  for(j=0;j<q;j++)
    scanf("%d",&t[j]);

  for(j=0;j<q;j++){
    for(i=0;i<n;i++){
      if(s[i]==t[j]){
	cnt++;
	break;
      }
    }
  }

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



Measured memory_bytes: 2128
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;

int main() {

    string s;
    cin >> s;

    bool app[26];
    for (int i = 0; i < 26; i++)
        app[i] = false;

    for (int i = 0; s[i] != '\0'; i++) {
        app[ s[i]-'a' ] = true;
    }

    for (int i = 0; i < 26; i++) {
        if (!app[i]) {
            cout << (char)(i + 'a') << endl;
            return 0;
        }
    }
    
    cout << "None" << endl;

    return 0;
    
}


Measured memory_bytes: 512
//
//  main.cpp
//  CoderWork
//
//  Created by Minoru Hayashi on 2020/02/29.
//  Copyright © 2020 Minoru Hayashi. All rights reserved.
//

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

#define REP(i,n) for (int i=0; i<(n); i++)
#define REP2(i,x,n) for (int i=x; i<(n); i++)
#define ALL(n) begin(n), end(n)

using ll = long long;
using P = pair<int,int>;

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

const ll INF = 1LL<<60;

//#define __DBG__


ll DP[100010];
int h[100010];

void solve(void){

  int N, K;
  cin >> N >> K;

  REP(i,N) {
    cin >> h[i];
    DP[i]=INF;
  }
  
  DP[0]=0;
  
  REP(i,N){
    REP2(j,1,K+1){
      if(i+j<N){
        chmin(DP[i+j], DP[i]+abs(h[i+j]-h[i]));
      }
    }
  }
  
  cout << DP[N-1] << endl;
  
  return;
}

int main(int argc, const char * argv[]) {



    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);
  
    solve();
 
    return 0;
}






Measured memory_bytes: 1408
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int N;
int A[1000000]; 
int B[1000000]; 
int C[1000000]; 

void solve()
{
	sort(A, A + N);
	sort(B, B + N);
	sort(C, C + N);
	long long res = 0;
	for (int i = 0; i < N; i++) {
		long long t1 = lower_bound(A, A + N, B[i]) - A;
		long long t2 = N - (upper_bound(C, C + N, B[i]) - C);
		res += t1 * t2;
	}
	cout << res << endl;
}

int main()
{
	cin >> N;
	for (int i = 0; i < N; i++) scanf("%d", A + i);
	for (int i = 0; i < N; i++) scanf("%d", B + i);
	for (int i = 0; i < N; i++) scanf("%d", C + i);
	solve();
	return 0;
}

Measured memory_bytes: 8832
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 1e2+5;
int n, m;
char s[N], t[N];
int main()
{
    scanf("%d%s%s", &n, s+1, t+1);
    for(m = 0; m < n; ++m)
    {   
        int valid = 1;
        for(int i = 1; i <= n-m; ++i)
            if(s[m+i] != t[i]) valid = 0, i = n;
        if(valid) break;
    }
    printf("%d\n", n+m);
    return 0;
}

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

#define IOS ios::sync_with_stdio(false); cin.tie(0);
using INT64 = long long;


int main(void)
{
    IOS
    int n,k;
    cin >> n >>k;
    vector<int> v(n);
    for(int i = 0;i < n; i++) cin >> v[i];

    int gmax = min(n,k);
    int vmax = 0;
    for(int i = 0; i <= gmax;i++) {
        for(int l=0;l<=i;l++){

            for(int r=0;r<=i-l;r++) {
                //cerr << "l:" << l << "r:" << r << " ";
                vector<int> v2;
                for(int l2 = 0; l2<l; l2++) v2.push_back(v[l2]);
                for(int r2 = 0;r2<r; r2++) v2.push_back(v[n-r2-1]);

                /*
                for(int x = 0; x < v2.size(); x++) {
                    cerr << v2[x] << " ";
                }
                */
                //cerr << endl;

                sort(v2.rbegin(),v2.rend());

                for(int d=0;d < k-l-r;d++) {
                    if ( !(v2.empty()) && (v2.back() < 0)){
                        v2.pop_back();
                    } else {
                        break;
                    }
                }

                int val = accumulate(v2.begin(),v2.end(),0);
                //cerr << "v:" << val << endl; 
                if (vmax < val) vmax = val;
            }
        }
    }

    cout << vmax << endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
typedef long long lint;
 
int main() {
  string s;
  cin >> s;
  
  if(s=="Sunny")cout << "Cloudy" << endl;
  else if(s=="Cloudy")cout << "Rainy" << endl;
  else cout << "Sunny" << endl;

}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main()
{
	string s,t;
	cin>>s;
	cin>>t;
	int l1=s.length();
	int l2=t.length();
	int no=0,max=l2;
//    cout<<s<<" "<<t<<endl;
	for(int i=0;i<=l1-l2;i++)
	{
		for(int j=0;j<l2;j++)
		{
//		  cout<<"i= "<<i<<" j= "<<j<<" t["<<j<<"]= "<<t[j]<<" s["<<i+j<<"]= "<<s[i+j]<<endl;
		  if(t[j]!=s[i+j])
		  {
		  	no++;
		  }	
		}
		if(no<max)
		{
			max=no;
		}
	    no=0;
	}
	cout<<max<<endl;
}


Measured memory_bytes: 3116
#include <iostream>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;

int main() {
  int N, Q; cin>>N>>Q;
  vector<int> sum(N+10,	0);
  string S; cin>>S;
  for(int i = 0; i < S.length()-1; i++) {
    sum[i+1] = sum[i];
    if(S[i] == 'A' && S[i+1] == 'C') {
      sum[i+1] ++;
    }
  }
  REP(i, Q) {
    int	l, r; cin>>l>>r;
    cout << sum[r-1] - sum[l-1] << endl;
  }
  return 0;
}


Measured memory_bytes: 1408
// header {{{
// #define NDEBUG
#include <bits/stdc++.h>
using namespace std;

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define ALPHABET    (26)
#define INF         INT_MAX
#define MOD         (1000000007LL)
#define EPS         (1e-10)
#define EQ(a, b)        (abs((a)-(b)) < EPS)
#define CILING(a, b)    (((a)+(b)-1LL)/(b))

template<class T>
using PIT = pair<int, T>;
template<class T>
using PTI = pair<T, int>;
using PII = pair<int, int>;
using PDI = pair<double, int>;
using LL  = long long;
using ULL = unsigned long long;
// }}}

int main() {
    int a, b, c, d;cin >> a >> b >> c >> d;
    cout << max({min(b, d)-max(a, c), 0}) << endl;
    return 0;
}


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

int main(){
  int N,ans,a,ansmin;
  cin>>N;
  
  for(int i=0;i<10000;i++){
    if(i*(i+1)/2>=N){
      cout<<i<<endl;
      N-=i;
      for(int j=i-1;j>=0;j--){
        if(N==0){
          return 0;
        }
        if(N>=j){
          cout<<j<<endl;
          N-=j;
        }
      }
    }
  }
}

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

char dec(int a, int b, char c)
{
	if(c==' ')
		return ' ';

	int tmp = c - 'a';
	return 'a'+((a*tmp+b)%26);
}

int main(void)
{
	int i, j, n;
	cin >> n;
	string str;
	string ans = "";
	getline(cin,str);

	for(i=0; i<n; i++)
	{
		getline(cin,str);
		int a = 0, b = 0;
		for(a=0; a<26; a++){
			for(b=0; b<26; b++){
				for(j=0; j<str.size(); j++)
				{
					ans += dec(a,b,str[j]);
				}

				string::size_type index;
				index = ans.find("this");
				if(index != string::npos)
				{
					cout << ans << endl;
					ans = "";
					continue;
				}

				index = ans.find("that");
				if(index != string::npos)
				{
					cout << ans << endl;
					ans = "";
					continue;
				}
				ans = "";
			}
		}
	}
	return 0;
}

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

using namespace std;
#ifdef CLION
ifstream ifs("/home/kyuridenamida/CLionProjects/untitled4/input.txt");
#define cin ifs
#endif

int main() {
    vector<long long> A(5);
    int k;
    for (int i = 0; i < 5; i++) {
        cin >> A[i];
    }
    cin >> k;

    if (A[4] - A[0] > k) {
        cout << ":(" << endl;
    } else {
        cout << "Yay!" << endl;
    }
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define EFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define REP(i, n) FOR(i,0,n)
const int MOD = 1000000007;

int main(void){
    int S;
    cin >> S;
    vector<ll> A(S+10,0);
    ll ans = 0;
    A[0] = 1;
    EFOR(i,3,S){
        A[i] = (A[i-1] + A[i-3])%MOD;
        //f(i > S-2) continue;
        //ans = (ans + A[i]) % MOD;
    }
    cout << A[S] << endl;
    return 0;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<double> A(N);
  double sum_a = 0;
  
  for (int i=0; i<N; i++){
    double tmp=0;
    cin >> tmp;
    sum_a += tmp;
    A.at(i) = tmp;
  }
  
  int ans=0;
  for (int i=0; i<N; i++){
    if(A.at(i) >= sum_a/(4*M)){
      ans++;
    }
  }
  
  if(ans>=M){
    cout << "Yes" <<endl;
  }
  else{
    cout << "No" << endl;
  }
  
}


// int型の2次元配列(3×4要素の)の宣言
  //vector<vector<int>> data(3, vector<int>(4));
 
  // 入力 (2重ループを用いる)
  //for (int i = 0; i < 3; i++) {
    //for (int j = 0; j < 4; j++) {
      //cin >> data.at(i).at(j);
   // }
  //}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using llpair=pair<ll,ll>;
using llvec=vector<ll>;
using llmat=vector<vector<ll>>;
#define llmattp(name,a,b,num) name(a,vector<ll>(b,num))
#define LLINF 1LL<<60
#define ABS(x) ( (x)>0 ? (x) : -(x) )

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 gcd(ll a, ll b) {
	if(a==0||b==0) return 0;
	if(a<b) swap(a,b);
	ll tmp = a%b;
	while(tmp!=0) {
		a = b;
		b = tmp;
		tmp = a%b;
	}
	return b;
}

ll factorial(ll x) {
	ll f=1;
	for(ll i=2; i<x; i++) {
		f*=i;
	}
	return f;
}

ll nPr(ll n, ll r) {
	ll result=1;
	for(ll i=r+1; i<=n; i++) result*=i;
	return result;
}

ll nCr(ll n, ll r) {

	if (n == 0) { return 0; }
	if (r == 0) { return 1; }
	if (r == 1) { return n; }
	if (n == r) { return 1; }

	if (r > n / 2) { r = n / 2; }

	double result = 1;
	for (double i = 1; i <= r; i++) {
		result *= (n - i + 1) / i;
	}

	return (ll)result;
}

bool IsPrime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

	double sqrtNum = sqrt(num);
	for (ll i = 3; i <= sqrtNum; i += 2)
	{
		if (num % i == 0)
		{
			// 素数ではない
			return false;
		}
	}

	// 素数である
	return true;
}

ll GreaterBinarySearch(ll *array, ll key, ll max, ll min) {
	if(array[max]<array[min]) {
		return NULL;
	} else {
		ll mid = max + (min-max)/2;
		if(array[mid]<key) {
			return GreaterBinarySearch(array,key,max,mid-1);
		} if(array[mid]>key) {
			return GreaterBinarySearch(array,key,mid+1,min);
		} else {
			return mid;
		}
	}
}

int main() {
	int n; cin>>n;
	int hoge[10][10]={0};

	int tmp=100000;
	for(; tmp!=1; tmp/=10) {
		if(n/tmp) break;
	}

	if(tmp==1) { cout<<n<<endl; return 0; }

	for(int i=1; i<=n/tmp; i++) {
		if(i==n/tmp%10) {
			for(int j=1; j<10;j++) hoge[i][j]+=n%tmp/10;
			for(int j=1; j<=n%10; j++) hoge[i][j]++;
		}
		else for(int j=1; j<10; j++) hoge[i][j]+=tmp/10;
	}
	for(tmp/=10; tmp!=1; tmp/=10) {
		for(int i=1; i<10; i++) {
			for(int j=1; j<10; j++) hoge[i][j]+=tmp/10;
		}
	}
	for(int i=0; i<10; i++) hoge[i][i]++;
  
	
	ll result=0LL;
	for(int i=1; i<10; i++) {for(int j=1; j<10; j++) { result+=hoge[i][j]*hoge[j][i];}}
	cout<<result<<endl;
}


Measured memory_bytes: 256
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]


    N = II()
    if N % 2 == 0:
        print(0.5)
    else:

        print(((N-1)//2+1)/N)

if __name__ == '__main__':
    main()

Measured memory_bytes: 38256
#include <cstdio>
#include <bitset>
using namespace std;
int n, a;
bitset<1<<30> bs;
int main() {
	scanf("%d", &n);
	while(n--) {
		scanf("%d", &a);
		bs[a] = !bs[a];
	}
	printf("%d", bs.count());
	return 0;
}

Measured memory_bytes: 122880
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int sz = 2e5+5;

string ss[] = {"AC", "WA", "TLE", "RE"};

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

   int ans[4] = {};
   while(n--) {
      string s;
      cin >> s;
      if(s == "AC") ans[0]++;
      else if(s == "WA") ans[1]++;
      else if(s == "TLE") ans[2]++;
      else ans[3]++;
   }

   for(int i=0; i<4; i++) {
      cout << ss[i] << " x " << ans[i] << endl;
   }
}


Measured memory_bytes: 3604