akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <utility>
#include <vector>
using namespace std;


struct process{
  string first;
  int second;
};

template <typename T>
class queue{
  private:
    vector<T> array;
    int head, tail, n;
  public:
    queue(int n){
      array.resize(n);
      head=tail=0;
      this->n = n;
    }

    void push(T value){
      if (head == (tail+1)%n)
        return ;
      array[tail] = value;
      tail = (tail+1)%n;
    }

    bool empty(){
      if (head == tail)
        return true;
      return false;
    }

    void pop(void){
      if (head == tail) return;
      head = (head+1)%n;
    }

    T front(void){
      return array[head];
    }
};

int main(){
  int n, q;
  cin >> n >> q;
  queue<pair<string,int>> processes(100000);
  for (int i=0;i<n;++i){
    string name;
    int time;
    cin >> name >> time;
    processes.push(make_pair(name, time));
  }

  auto uptime = 0;
  while(!processes.empty()){
    auto process = processes.front();
    processes.pop();
    if (process.second <= q){
      uptime += process.second;
      cout << process.first << " " << uptime << endl;
      continue;
    }
    uptime += q;
    processes.push(make_pair(process.first, process.second-q));
  }
  return 0;
}


Measured memory_bytes: 6772
#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> data(n-1);
  for ( int i = 0 ; i < data.size() ; i++ ) {
    cin >> data.at(i);
  }
  
  vector<int> vec(n,0);
  for ( int i = 0 ; i < data.size() ; i++ ) {
    vec.at(data.at(i)-1)++;
  }
  
  for ( int i = 0 ; i < vec.size() ; i++ ) {
    cout << vec.at(i) << endl;
  }
}

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

int main(){
  int n;
  cin >> n;
  vector<int> list(n);
  vector<long long> count(n,0);
  for (int i=0; i<n; i++){
    cin >> list.at(i);
    list.at(i) --;
    count.at(list.at(i)) ++;
  }
  long long sum = 0;
  for (int i=0; i<n; i++){
    sum+=count.at(i)*(count.at(i)-1)/2;
  }
  for (int i=0; i<n; i++){
    long long ans = sum;
    ans -= count.at(list.at(i))-1;
    cout << ans << endl;
  }
}

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

signed main() {
  int N; cin >>N;
  vector<int> A(N);
  for(int i=0; i<N; i++) cin >> A[i];
  
  double sum = 0;
  for(int i=0; i<N; i++) sum += 1.0 /A[i];
  printf("%.7f\n", 1/sum);
  
}


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

using namespace std;
using ll = long long;

int main(void){
    ll N, W;
    cin >> N >> W;
    vector<vector<ll>> wv(4);
    ll w, v;
    cin >> w >> v;
    wv[0].push_back(v);

    for(ll i=1;i<N;i++){
        ll x, y;
        cin >> x >> y;
        wv[x-w].push_back(y);
    }

    for(auto& it : wv){
        sort(it.begin(), it.end(), greater<ll>());
    }

    ll ans = 0;
    for(ll i=0;i<=wv[0].size();i++){
        for(ll j=0;j<=wv[1].size();j++){
            for(ll k=0;k<=wv[2].size();k++){
                for(ll l=0;l<=wv[3].size();l++){
                    if(i*w+j*(w+1)+k*(w+2)+l*(w+3) <= W) {
                        ll v=0;
                        for(ll m=0;m<i;m++) v += wv[0][m];
                        for(ll m=0;m<j;m++) v += wv[1][m];
                        for(ll m=0;m<k;m++) v += wv[2][m];
                        for(ll m=0;m<l;m++) v += wv[3][m];
                        ans = max(ans, v);
                    }
                }
            }
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long k = sc.nextLong();
        long[] a = new long[n];
        for(int i = 0; i < n; i++) {
            a[i] = sc.nextLong();
        }
        long x = 0;
        int count = 0;
        while(Math.pow(2, count + 1) <= k) count++;
        while(count >= 0) {
            long tmp = x + (long) Math.pow(2, count);
            if(tmp > k) {
                count--;
                continue;
            }
            long sum1 = 0;
            long sum2 = 0;
            for(int i = 0; i < n; i++) {
                sum1 += tmp ^ a[i];
                sum2 += x ^ a[i];
            }
            if(sum1 > sum2) {
                x = tmp;
            }
            count--;
        }
        long ans = 0;
        for(int i = 0; i < n; i++) {
            ans += x ^ a[i];
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 60032
#include <bits/stdc++.h>
#include <numeric>
using namespace std;
#define ll long long
#define mod 100000007

ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}

int main()
{
    int A,B;
    cin >> A >> B;
    cout << lcm(A, B) << endl;
}


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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  
  while(true) {
    C -= B;
    if (C <= 0) {
      cout << "Yes" << endl;
      return 0;
    }
    
    
    A -= D;
    if (A <= 0) {
      cout << "No" << endl;
      return 0;
    }
    
    
  }
  

}

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


ll a[100005];
vector<ll> cache(100005,-1);
ll n;

ll frog1(ll x)
{
	if(cache[x]!=-1)
		return cache[x];
	if(x>=n)
		return INT_MAX;
	if(x==n-1)
		return 0;
	else
		return cache[x] = min( abs(a[x+1]-a[x])+frog1(x+1), abs(a[x+2]-a[x])+frog1(x+2));
}

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

Measured memory_bytes: 4096
#include<bits/stdc++.h>
using namespace std;
#define int 		  long long
#define	pb 			  push_back
#define all(a)		  (a).begin(),(a).end()
#define sz(x)		  (int)x.size()
#define F 			  first
#define S 			  second
#define endl	 	  "\n"
#define inf 		  1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigboi		  1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(all(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 
//int dp[333][2];

long long binpow(long long a, long long b) {
    long long res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}
void solve(){
	int n, cnt=0, res=0;
	cin>>n;
	while(n>0){
		cnt+=binpow(2, res++);
		n/=2;
	}
	cout<<cnt;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int t=1; 	
	//cin>>t;
	FOR(i, 1, t+1){	
	//	cout<<"Case #"<<i<<":"<<endl;
		solve();
	}
	cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
	return 0;
 
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define F first
#define S second
using namespace std;

double dist(pair<int, int> a, pair<int, int> b)
{
    double re = (a.F - b.F) * (a.F - b.F) + (a.S - b.S) * (a.S - b.S);
    return sqrt(re);
}

int main()
{
    int n;
    cin >> n;
    vector<pair<int, int>> p;
    int x, y;

    for (int i = 0; i < n; i++) {
        cin >> x >> y;
        p.push_back(make_pair(x, y));
    }
    int f = 1;
    for (int i = 2; i <= n; i++) f *= i;
    double dis = 0.0;
    for (int i = 0; i < f; i++) {
        for (int j = 1; j < p.size(); j++) {
            dis += dist(p[j], p[j - 1]);
        }
        next_permutation(p.begin(), p.end());
    }
    //cout << dis / 2.0 << "\n";
    printf("%0.10lf\n", dis / f);
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        // 標準入力からデータを読み込む準備
        try (Scanner sc = new Scanner(System.in)) {
            while (true) {
                int m = sc.nextInt();
                int f = sc.nextInt();
                int r = sc.nextInt();
                if (m == -1 && f == -1 && r == -1)
                    break;
                if (m == -1 || f == -1) {
                    System.out.println("F");
                } else if (m + f >= 80) {
                    System.out.println("A");
                } else if (m + f >= 65) {
                    System.out.println("B");
                } else if (m + f >= 50 || r >= 50) {
                    System.out.println("C");
                } else if (m + f >= 30) {
                    System.out.println("D");
                } else if (m + f < 30) {
                    System.out.println("F");
                }
            }
        }
    }
}


Measured memory_bytes: 26164
# Card
class Card
  attr_reader :suit, :value

  def initialize(suit, value)
    @suit = suit
    @value = value
  end
end

def bubble_sort a
  n = a.size
  0.upto(n - 1) do |i|
    (n - 1).downto(i + 1) do |j|
      if a[j].value < a[j - 1].value
        a[j], a[j - 1] = a[j - 1], a[j]
      end
    end
  end
  a
end

def selection_sort a
  n = a.size
  0.upto(n - 1) do |i|
    mini = i
    i.upto(n - 1) do |j|
      mini = j if a[j].value < a[mini].value
    end
    unless i == mini
      a[i], a[mini] = a[mini], a[i]
    end
  end
  a
end

n = gets.chop.to_i
a = []
gets.chop.split.each do |card|
  a << Card.new(card[0], card[1])
end

b = bubble_sort(a.dup).map { |card| card.suit + card.value.to_s }
s = selection_sort(a.dup).map { |card| card.suit + card.value.to_s }

puts b.join(' ')
puts 'Stable'
puts s.join(' ')
puts (b == s) ? 'Stable' : 'Not stable'

Measured memory_bytes: 6120
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(), (x).end()
#define dbg(x) cerr << #x << ": " << x << endl
int main() {
  int H, W;
  cin >> H >> W;
  int ch, cw;
  cin >> ch >> cw;
  cout << H * W - cw * H - W * ch + ch * cw << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >>n;
  string s;
  cin >>s;
  
  bool a[26]={0};
  bool b[26]={0};
  int count=0,ans=0;
  string ss,st;
  for(int i=1; i<n; i++){
    count =0;
  	ss=s.substr(0,i);
    st=s.substr(i,n-1);
    
    for(int j=0; j<ss.size();j++){
    	a[ss[j]-'a']=1;
    }
    for(int j=0; j<st.size();j++){
    	b[st[j]-'a']=1;
    }
    for(int j=0; j<26;j++){
    	if(a[j]==b[j]&& b[j]==1) count++;
    }
    ans=max(ans,count);
    for(int j=0; j<26;j++){
    	a[j]=b[j]=0;
    }
  }
  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    IN(ll, A);
    IN(ll, B);
    OUT(A * (N / (A + B)) + min(N % (A + B), A));
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}

template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define debug(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define debug(x...)
#endif
#define fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) 
#define ll long long 
#define int long long 
#define vll vector<long long>
#define pii pair<long long ,long long > 
#define vvi vector< vector<long long > > 
#define vpii vector<pair<int,int>> 
#define pll  pair<long long ,long long > 
#define pb  push_back
#define ff  first 
#define sec second  
#define SORT(a) sort(a.begin(),a.end())
#define SORTR(a) sort(a.rbegin(),a.rend()) 
#define m_p make_pair
#define all(x) (x.begin(),x.end()) 
#define sz(v) ((int)(v.size()))
#define endl '\n'
typedef vector< long long > vi ;
const int MOD=1e9 +7 ;
int size=10000000; 
 
int32_t main(){
  fast; 
/*  #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
  #endif */
    
  int T=1; //cin>>T; 
  while(T--){

    int n; cin>>n; 
    int ac=0; int wa=0; int tle=0 ;int re =0; 
    for(int i=0;i<n ; i++ ){
        string s; cin>>s; 
        if(s=="AC") ac++; 
        else if (s=="WA") wa++; 
        else if (s=="TLE") tle++; 
        else if (s=="RE") re++; 
    }



    cout<<"AC x "<<ac<<endl; 
    cout<<"WA x "<<wa<<endl; 
    cout<<"TLE x "<<tle<<endl; 
    cout<<"RE x "<<re<<endl; 
  






  }
    


  return 0; 
} 

Measured memory_bytes: 3660
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define Vi vector<int>
#define pb push_back
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repr(i,a,b) for(int i=a;i>b;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
#define MOD 1000000007
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int k,s;
  cin >> k >> s;
  int ans = 0;
  rep(i,0,k+1){
    rep(j,i,k+1){
      rep(l,j,k+1){
        if(i+l+j==s) {
          if(i==j && j==l) ans++;
          if(i==j && j!=l) ans += 3;
          if(i!=j && j==l) ans += 3;
          if(i!=j && j!=l) ans += 6;
        }
      }
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstddef>
#include <limits>
#include <climits>
#include <cfloat>
#include <cstdint>
#include <cstdlib>
#include <new>
#include <typeinfo>
#include <exception>
#include <initializer_list>
#include <stdexcept>
#include <cassert>
#include <cerrno>
#include <system_error>
#include <string>

#if __has_include(<string_view>)
#   include <string_view>
#endif

#include <array>
#include <deque>
#include <forward_list>
#include <list>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <iterator>
#include <algorithm>
#include <cfenv>
#include <random>
#include <numeric>
#include <cmath>
#include <iosfwd>
#include <iostream>
#include <ios>
#include <streambuf>
#include <istream>
#include <ostream>
#include <iomanip>
#include <sstream>
#include <fstream>

#if __has_include(<filesystem>)
#   include <filesystem>
#endif

#include <cstdio>
#include <cinttypes>


#include <regex>
#include <atomic>
#include <thread>
#include <mutex>
#include <shared_mutex>
#include <condition_variable>
#include <future>

using namespace std::literals ;

int N, Y;

int main(){
  std::cin >> N >> Y;
  
  // i : ¥10000, j : ¥5000, k : ¥1000
  bool flag = 0;
  int x = -1;
  int y = -1;
  int z = -1;
  for ( int i = 0 ; i <= N ; ++i ){
    for ( int j = 0 ; j <= N - i ; ++j ){
      if ( 10000*i + 5000*j + 1000*(N - i - j) == Y )
      {
        x = i;
      	y = j;
        z = N - i - j;
		flag = 1;
      	break;
      }
     if ( flag == 1 )
       break;
    }
  }
  
  std::cout << x << " "s << y << " "s << z;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
#include <utility>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
using namespace std;
   
 
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);

  long long a,b,k;
  cin>>a>>b>>k;

  long long K=k,A=a,B=b;
  a-=k;
  if(a<0){
    a=0;
    k-=A;
    b-=k;
  }

  if(b<0){
    b=0;
  }
  
  cout<<a<<" "<<b<<'\n';
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string.h>
using namespace std;
int cmpnum(const void * n1, const void * n2)
{
	return 	strcmp((char *)n1 ,(char *)n2);
}
int main(){
	int N;
	char a[200000][15];
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> a[i];
	}
	qsort(a, N, sizeof(char[15]), cmpnum);
	int out = 1;
	char *tmp = a[0];
	for(int i=1;i<N;i++){
		if(strcmp(tmp,a[i])==0){
		}else{
			out++;
			tmp = a[i];
		}
	}
	cout << out << endl;
}



Measured memory_bytes: 8628
#include <iostream>
#include <math.h>

using namespace std;

int main()
{
  int n;
  cin >> n;
  int x = sqrt(n);
  bool yes = false;
  for (int i = x; i <= 9; ++i)
  {
    if (n % i == 0 && n / i <= 9)
    {
      yes = true;
      break;
    }
  }
  cout << (yes ? "Yes" : "No") << endl;

  return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cctype>
#define G getchar()
#define I isdigit
#define P printf
using namespace std;
int a[100005];
inline void _(int &x)
{
	char c=G;
	while(!I(c))
		c=G;
	for(x=0;I(c);c=G)
		x=x*10+c-'0';
}
int main()
{
	int n,M=0;
	_(n);
	for(int i=1;i<=n;i++)
		_(a[i]);
	
	for(int i=1;i<=n;)
	{
		if(a[i]==i&&a[i+1]!=i+1)
			M++;
		if(a[i]==i&&a[i+1]==i+1)
			M++,i++;
		i++;
	}
	P("%d\n",M);
return 0;
}

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

class MyClass
{
    static void Main(string[] args)
    {
        int w = int.Parse(Console.ReadLine());
        int n = int.Parse(Console.ReadLine());
        int[] amida = new int[w];
        for (int i = 0; i < w; i++)
        {
            amida[i] = i + 1;
        }
        for (int i = 0; i < n; i++)
        {
            string[] str = Console.ReadLine().Split(',');
            int a = int.Parse(str[0]) - 1;
            int b = int.Parse(str[1]) - 1;
            int t = amida[a];
            amida[a] = amida[b];
            amida[b] = t;
        }
        foreach (var item in amida)
        {
            Console.WriteLine(item);
        }
    }
}


Measured memory_bytes: 5592
#include <iostream>
#include <vector>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <queue>
#include <cmath>
// #include <atcoder/all>
using namespace std;
// using namespace atcoder;

int main() {
	int n, k;
	cin >> n >> k;
	vector<long long int> v(n, 0);
	for (int i = 0; i < n; i++) {
		cin >> v[i];
	}
	vector<long long int> v1(n, 0), v2(n, 0);
	v1[0] = max(v[0], (long long int)0);
	v2[n - 1] = max(v[n - 1], (long long int)0);
	vector<long long int> v3(n, 0);
	v3[0] = v[0];
	for (int i = 1; i < n; i++) {
		v1[i] = v1[i - 1] + max(v[i], (long long int)0);
		v2[n - i - 1] = v2[n - i] + max(v[n - i - 1], (long long int)0);
		v3[i] = v[i] + v3[i - 1];
	}
	long long int res = 0;
	for (int i = 0; i + k <= n; i++) {
		// [i, i + k - 1]
		long long int r = 0;
		if (i - 1 >= 0) {
			r += v1[i - 1];
		}
		if (i + k < n) {
			r += v2[i + k];
		}
		r += max((long long int)0, v3[i + k - 1] - (i > 0 ? v3[i - 1] : 0));
		res = max(res, r);
	}
	cout << res << endl;
}






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

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

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

#define int long long
#define endl "\n"
#define REP(i,a,n) for(int i=a;i<n;++i)
#define REPR(i,a,n) for(int i=a;i>n;--i)
#define RUP(a,b) ((a+b-1)/(b))
#define SORTG(v) sort(v.begin(),v.end(),greater<>())
#define SORT(v) sort(v.begin(),v.end())
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define MOD 1000000007
#define INF LLONG_MAX/3

typedef long long ll;
typedef pair<int,int> Pii;
typedef tuple<int,int,int> Tiii;
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef vector<string> Vs;

template<class T> void chmax(T& a, T b) {if(a<b){a=b;}}
template<class T> void chmin(T& a, T b) {if(a>b){a=b;}}
void YesNo(int a){cout<<((a)?"Yes":"No")<<endl;}
void YESNO(int a){cout<<((a)?"YES":"NO")<<endl;}
void AorB(int a,string b,string c){cout<<((a)?b:c)<<endl;}
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void start(){cin.tie(0);cout.tie(0);ios::sync_with_stdio(false);}

signed main(){start();
    int a,b;
    cin>>a>>b;
    if(6<=a && a<=12) b/=2;
    else if(a<=5) b=0;
    cout<<b<<endl;
}


Measured memory_bytes: 256
import numpy as np
a = [int(i) for i in input().split()]
x_1 = np.array(a[:2])
x_2 = np.array(a[2:])
v_1 = x_2-x_1
v_2 = np.array([-v_1[1],v_1[0]])
print(*np.concatenate((x_2+v_2,x_1+v_2), axis=None))

Measured memory_bytes: 21800
using namespace std;
#include <iostream>
#include <stdio.h>
#include <sstream>      // std::ostringstream
#include <math.h>
int main()
{
    string str_r,str_g,str_b,str_n;
    cin >> str_r >> str_g >> str_b >> str_n;
    int r = stoi(str_r);
    int g = stoi(str_g);
    int b = stoi(str_b);
    int n = stoi(str_n);

    int count = 0;
    for(int i=0;i<=n;i+=r){
        for(int j=0;j<=n;j+=g){
            int v = i+j;
            if(n>=v&&(n-v)%b==0){
                count++;
            }
        }
    }
    cout << count << endl;
    return 0;
}


Measured memory_bytes: 256
N,K = map(int,input().split())

h = list(map(int,input().split()))

lis = [0] + [float("inf")] * (N-1)

#print (lis)



for i in range(N-1):

    for j in range(K):

        j += 1

        if i + j < N :

            lis[i+j] = min( lis[i+j] , lis[i] + abs(h[i+j] - h[i]) )

print (lis[-1])


Measured memory_bytes: 55264
// 2012/12/10 Tazoe

#include <iostream>
using namespace std;

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

	int m;
	cin >> m;

if(n==0&&m==0)
break;

	int G[501][501];
	for(int i=1; i<=n; i++){
		for(int j=1; j<=n; j++){
			G[i][j] = 0;
		}
	}

	for(int i=0; i<m; i++){
		int a, b;
		cin >> a >> b;

		G[a][b] = G[b][a] = 1;
	}

	int F[501];
	for(int i=2; i<=n; i++){
		F[i] = 0;
	}

	for(int i=2; i<=n; i++){
		if(G[1][i]==1){
			F[i] = 1;
		}
	}

	for(int i=2; i<=n; i++){
		if(F[i]==1){
			for(int j=2; j<=n; j++){
				if(G[i][j]==1&&F[j]==0){
					F[j] = 2;
				}
			}
		}
	}

	int cnt = 0;
	for(int i=2; i<=n; i++){
		if(F[i]==1||F[i]==2){
			cnt++;
		}
	}

	cout << cnt << '\n';
}

	return 0;
}

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

using namespace std;

#define S scanf
#define P printf
#define G getline
#define SZ size()
#define C clear()
#define B begin()
#define F front()
#define T top()
#define E end()
#define EM empty()
#define V vector
#define Q queue
#define DQ deque
#define PQ priority_queue
#define ST stack
#define FI first
#define SE second
#define PI acos(-1)
#define PS push
#define PP pop()
#define PSF push_front
#define PSB emplace_back
#define PPF pop_front()
#define PPB pop_back()
#define MP make_pair
#define LL long long int
#define ULL unsigned long long int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>
#define PLI pair<long long int,int>
#define PLL pair<long long int,long long int>
#define MII map<int,int>
#define MSI map<string,int>
#define MIS map<int,string>
#define MLI map<long long int,int>
#define FAST() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)





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






int main()
{
    FAST();

//    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);

    int i,m,n,x,y;
    cin >> n >> m;
    V<int>ans(n,-1);
    V<int>cnt(n,0);
    while(m--)
    {
        cin >> x >> y;
        if(cnt[x-1]  &&  ans[x-1] != y)
        {
            cout << "-1";
            return 0;
        }
        ++cnt[x-1];
        ans[x-1]=y;
    }
    for(i=0;i<n;i++)
    {
        if(cnt[i] == 0)
        {
            if(i == 0  &&  n == 1)ans[i]=0;
            else if(i == 0)ans[0]=1;
            else ans[i]=0;
        }
    }
    if(ans[0] == 0  &&  n > 1)
    {
        cout << "-1";
        return 0;
    }
    for(i=0;i<n;i++)cout << ans[i];
    return 0;
}


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

using namespace std;
typedef long long int lli;

const int MAXN = 60;
const int MAXS = 50*50 + 10;

int n, k;

int v[MAXN];

lli dp[MAXN][MAXN][MAXS];

lli solve(int i, int qtd, int s)
{
	if( s < 0 ) return 0;
	if( qtd < 0 ) return 0;

	lli& ans = dp[i][qtd][s];

	if( ans != -1 ) return ans;

	if( i == 0 )
	{
		if( qtd == 0 && s == 0 ) return ans = 1;
		return ans = 0;
	}

	ans = solve( i - 1 , qtd , s );
	ans += solve( i - 1 , qtd - 1 , s - v[i] );

	return ans;
}

int main()
{
	scanf("%d %d",&n,&k);

	memset( dp , -1 , sizeof(dp) );

	for(int i = 1 ; i <= n ; i++)
		scanf("%d",&v[i]);

	lli ans = 0;

	for(int i = 1 ; i <= n ; i++)
		ans += solve( n , i , k*i );

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

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

int main() {
    int x;
    int n;
    vector<int> pi;

    cin >> x;
    cin >> n;
    for (int i = 0; i < n; ++i) {
        int p;
        cin >> p;
        pi.push_back(p);
    }

    for (int i = 0; i < 51; i++) {
        if (x - i >= 0) {
            if (pi.end() == find(pi.begin(), pi.end(), x - i)) {
                cout << x - i << endl;
                return 0;
            }
        }
        if (x + i <= 101) {
            if (pi.end() == find(pi.begin(), pi.end(), x + i)) {
                cout << x + i << endl;
                return 0;
            }
        }
    }

    return 0;
}


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

int main () {
  int N;
  cin >> N;
  vector<int>a(N);
  vector<int>count(100001,0);
  vector<int>ans(99999);
  for (int i = 0; i < N; i++) {
    cin >> a.at(i);
    count.at(a.at(i))++;
  }
  
  for (int i = 0; i < 99999; i++) {
    ans.at(i) = count.at(i) + count.at(i+1) + count.at(i+2);
  }
  sort(ans.begin(), ans.end());
  
  cout << ans.at(99998) << endl;
}
  

Measured memory_bytes: 4488
import java.util.Scanner

object Main extends App {

  val sc = new Scanner(System.in)

  val n = sc.nextInt
  val q = sc.nextInt
  val s = sc.next

  // (li, ri) の組 として扱う
  val lrs = Seq.fill(q)((sc.nextInt, sc.nextInt))

  // Vector[Int]は略せるが、わかりやすさのため。。。
  val commutativeCount: Vector[Int] = {
    s.tail.foldLeft((Vector(0), s.head)){case ((vec, pre), ch) =>
      (pre, ch) match {
        case ('A', 'C') => ( vec :+ (vec.last + 1), ch )
        case _          => ( vec :+  vec.last     , ch )
      }
    }._1
  }

  val res = lrs.map{ case (l,r) =>
    commutativeCount(r - 1) - commutativeCount(l - 1)
  }

  res.foreach(println)



  //文字列Sに含まれるACの個数を求めるメソッド countAC を実装する
//  def countAC(str: String): Int = {
//    str.tail.foldLeft((0, str.head)){ case ( (cnt, pre), ch) =>
//      (pre, ch) match {
//        case ('A','C') => (cnt + 1, ch)
//        case _         => (cnt    , ch)
//      }
//    }._1
//  }

  //各iに対して文字列Sを左からli,右からriだけ切り出してcountACを施す
//  val res =
//    lrs.map{ case (l, r) =>
//      val subStr = s.substring(l - 1, r)
//      countAC(subStr)
//    }
//  res.foreach(println)
}


Measured memory_bytes: 98312
n, m = map(int, input().split())
foods = set()
tmp = set()

a = list(map(int, input().split()))
for  j in range(1, len(a)):
    foods.add(a[j])

for i in range(n-1): 
    a = list(map(int, input().split()))
    for j in range(1,len(a)):
        tmp.add(a[j])
    foods &= tmp
    tmp.clear()
    
print(len(foods))

Measured memory_bytes: 3064
#include<iostream>
int main()
{
    std::string in;
    int ans=0,max=0;
    std::getline(std::cin,in);
    for(int i=0;i<in.size();i++){
        switch (in[i])
        {
            case 'A':case 'T':case 'G':case 'C':ans++;break;
            default:
            if(ans!=0){
                if(ans>max)max=ans;
                ans=0;
            }
                break;
        }
    }
    if(ans>max) max=ans;
    std::cout<<max;
    return 0;
}

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

int main(){
  int N, L;
  cin>>N>>L;
  vector<string> iroha(N);
  for(int i=0; i<N; i++){
    string S;
    cin>>S;
    iroha.at(i)=S;
  }
  sort(iroha.begin(), iroha.end());
  for(int i=0; i<N; i++) cout<<iroha.at(i);
}
 


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

using namespace std;
using ll = long long;

int main() {
	int mp[13][1005] = {};
	int h, w, k;
	cin >> h >> w >> k;
	rep(i, h) rep(j, w) scanf("%1d", &mp[i+1][j+1]);
	rep(i, h - 1) rep(j, w) mp[i + 2][j+1] += mp[i+1][j+1];
	rep(j, w - 1) rep(i, h) mp[i+1][j + 2] += mp[i+1][j+1];
	int ans = 1e9;

	for (int i = 0; i < (1 << (h - 1)); i++) {
		int cut = 0;
		rep(x, h - 1) if (i >> x & 1) cut++;
		int afterH = 0;
		int afterW = 0;
		bool small = true;
		int now = 1;
		while (now <= w) {
			int c;
			afterH = 0;
			small = true;
			for (int b = 0; b < (h - 1); b++) {
				if (i >> b & 1) {
	c = mp[b+1][now] - mp[b+1][afterW] - mp[afterH][now] + mp[afterH][afterW];
					if (c > k) small = false;
					afterH = b + 1;
				}
			}
	c = mp[h][now] - mp[h][afterW] - mp[afterH][now] + mp[afterH][afterW];
			if (c > k) small = false;
			if (small == false) {
				if (afterW == now - 1) {
					cut = 1e9;
					now++;
				}
				cut++;
				afterW = now - 1;
				now--;
			}
			now++;
		}
		ans = min(ans, cut);
	}
	cout << ans << endl;
	return 0;
}
//......mp[ah][aw] ..............mp[ah][now]


//......mp[b+1][aw]..............mp[b+1][now]












Measured memory_bytes: 3824
n = gets.to_i
v = {}
mx = 0
n.times {
  s = gets.chomp
  if v.key?(s)
    v[s] += 1
  else
    v[s] = 1
  end
  if v[s] > mx
    mx = v[s]
  end
}

v.sort.each do |x, y|
  if y == mx
    puts x
  end
end


Measured memory_bytes: 42204
#include<bits/stdc++.h>
#define ll long long 
#define ld long double
#define vl vector
#define pb push_back
#define ff first
#define ss second
using namespace std;

int main()
{
    ll n,m,i,a,b,k,t;
    cin>>n>>m;
    if(500*n>=m) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 3556
import java.util.*;

public class Main {


	public static void main (String [] args) {
		
		
		int n;
		boolean sw = false;
		Scanner sc = new Scanner(System.in);
		
	 
		
		do {
			
			n = sc.nextInt(); 
			
		}while(!(n>=1 && n<=100));
	
		
		for(int i = 1;i<=9;i++) {
			
			for(int j = 1;j<=9;j++) {
				
				if(i*j == n) {
					sw = true;
				}
			}
			
		}
		
		if(sw == true) {
			
			System.out.println("Yes");
		}else {
			
			System.out.println("No");
		}
	
		
		
	}
}
		

Measured memory_bytes: 23892
#include "stdio.h"

int main(void){
  int x,y,i;
  char a;
  for(i = 0;i < 10000;i++){
    scanf("%d %c %d", &x, &a, &y);
    if(a == '+'){
      printf("%d\n", x+y);
    }else if(a == '-'){
      printf("%d\n", x-y);
    }else if(a == '*'){
      printf("%d\n", x*y);
    }else if(a == '/'){
      printf("%d\n", x/y);
    }else if(a == '?')break;
  }
}



Measured memory_bytes: 2108
#include <iostream>
#include <vector>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int main()
{
    int h, w, cnt = 0;
    cin >> h >> w;
    vector<vector<char>> Grid(h, vector<char>(w));
    vector<vector<bool>> check(h, vector<bool>(w, true));

    repi(i, h, 0)
    {
        cnt = 0;
        repi(j, w, 0)
        {
            cin >> Grid[i][j];
            if (Grid[i][j] == '.')
            {
                cnt++;
            }
        }
        if (cnt == w)
        {
            repi(j, w, 0)
            {
                check[i][j] = false;
            }
        }
    }
    repi(i, w, 0)
    {
        cnt = 0;
        repi(j, h, 0)
        {
            if (Grid[j][i] == '.')
            {
                cnt++;
            }
        }
        if (cnt == h)
        {
            repi(j, h, 0)
            {
                check[j][i] = false;
            }
        }
    }
    repi(i, h, 0)
    {
        bool print = false;
        repi(j, w, 0)
        {
            if (check[i][j])
            {
                print = true;
                cout << Grid[i][j];
            }
        }
        cout << (print ? "\n" : "");
    }

    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<ctime>
#include<string>
#include<cstring>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<bitset>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;

#define PI 3.141592653589793238462643383279
#define mod 1000000007LL
#define rep(i, n) for(i = 0;i < n;++i)
#define rep1(i, n) for(i = 1;i < n;++i)
#define per(i, n) for(i = n - 1;i > -1;--i)
#define int(x) int x; scanf("%d",&x)
#define int2(x, y) int x, y; scanf("%d%d",&x, &y)
#define int3(x, y, z) int x, y, z; scanf("%d%d%d",&x, &y, &z)
#define int4(v, x, y, z) int v, x, y, z; scanf("%d%d%d%d", &v, &x, &y, &z)
#define int5(v, w, x, y, z) int v, w, x, y, z; scanf("%d%d%d%d%d", &v, &w, &x, &y, &z)
#define ll2(x, y) ll x, y; cin >> x >> y;
#define scn(n, a) rep(i, n)cin >> a[i]
#define sc2n(n, a, b) rep(i, n)cin >> a[i] >> b[i]
#define pri(x) cout << (x) << "\n"
#define pri2(x, y) cout << (x) << " " << (y) << "\n"
#define pri3(x, y, z) cout << (x) << " " << (y) << " " << (z) << "\n"
#define pb push_back
#define mp make_pair
#define all(a) (a).begin(),(a).end()
#define endl "\n"
#define kabe puts("---------------------------")
#define kara puts("")
#define debug(x) cout << " --- " << (x) << "\n"
#define debug2(x, y) cout << " --- " << (x) << " " << (y) << "\n"
#define debug3(x, y, z) cout << " --- " << (x) << " " << (y) << " " << (z) << "\n"
#define X first
#define Y second
#define eps 0.0001
#define prid(x) printf("%.15lf\n", x)

int p[1024];

signed main(void){
  int i, j;
  for(int testcase = 0;testcase >= 0;testcase++){
    int2(n, m);
    if(!(n | m))break;

    scn(n, p);
    sort(p, p + n);

    int cnt = 0, sum = 0;
    per(i, n){
      ++cnt;
      if(cnt == m)cnt = 0;
      else sum += p[i];
    }
    pri(sum);


//*/

//*/ break;
  }
  return 0;
}

Measured memory_bytes: 3172
package main

import (
	"fmt"
)

func main() {
	var a, b, k, min, max int
	fmt.Scanf("%d %d %d", &a, &b, &k)
	min = a + k
	max = b - k
	for i := a; i <= b; i++ {
		if i < min || max < i {
			fmt.Println(i)
		}
	}
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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 ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;



signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll n; cin>>n;
  vll a(n);
  rep(i,n) cin>>a[i];
  sort(a.rbegin(),a.rend());
  
  ll ans=0;
  
  map<ll,ll> m;
  rep(i,n){
    m[a[i]]++;
    if(m[a[i]]>=2){
      if(ans==0){
        ans+=a[i];
      }else{
        ans*=a[i];
        break;
      }
      m[a[i]]-=2;
    }
  }
  
  cout<<ans<<endl;
  
}

Measured memory_bytes: 6272
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
using namespace std;
using ll = long long;
map <int ,int> mpa,mpb;

int main (){
  int N;
  cin >> N;
  int ans=100000000;
  int a=0;
  int t;
  for(int i=1;i<N;i++){
    t=0;
    a=i;
    int b=N-i;
    while(a>0){
      t+=a%10;
      a/=10;
    }
    while(b>0){
      t+=b%10;
      b/=10;
    }
    ans=min(ans,t);
  }
  cout << ans << endl;
}

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

#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--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

const string YES = "Yes";
const string NO = "No";
const ll mod = 1e9+7;



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

    ll ans;
    ll h,a; cin >> h >> a;
    if(h%a==0){
        ans = h/a;
    }
    else{
        ans = h/a+1;
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include <iostream>
using namespace std;
/*
 * n < s : ありえない
 * n = s : b = n + 1
 * n > s : b
 */

// n % b + n / b % b 
//
long f(long b, long n) {
  if(n < b) return n;
  return f(b, n / b) + n % b;
}
long n, s;
int main() {
  cin >> n >> s;
//  for(int i = 2; i <= n + 1; i++) {
//    cout << i << ":" << f(i, n) << endl;
//  }
  for(long i = 2; i * i <= n || (n < 1000 && i <= n + 1); i++) {
    if(f(i, n) == s) {
      cout << i << endl;
      return 0;
    }
  }

  if(n < 1000){
    cout << -1 << endl;
    return 0;
  }
  long ans = n + 200;
  if(n == s) {
    ans = n + 1;
  }
  for(long i = 1; i * i <= n; i++) {
    // n / b == i
    // n / (i + 1) < b <= n / i
    long tmp = f(n / i, n);
    if((s - tmp) % i) continue;
    long m = (s - tmp) / i;
    // n / i - mが解の候補
    long t = n / i - m;
    if(t >= 2) {
      if(f(t, n) == s) {
        ans = min(ans, t);
      }
    }
  }
  if(ans == n + 200) ans = -1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 888
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;

namespace AtCoder
{
    class Program
    {
        static int LoadInt() { return int.Parse(Console.ReadLine()); }
        static int[] LoadIntArray() { return Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray(); }

        static void Main(string[] args)
        {
            var vals = LoadIntArray();
            var N = vals[0];
            var D = vals[1];
            Console.WriteLine((int)Math.Ceiling((double)N / (double)(1 + D * 2)));
        }

    }
}


Measured memory_bytes: 13268
def bmon(n , a , b):

    ans = 0
    count = n // (a + b)
    ans = count * a

    ans += min(n % (a + b), a)

    return ans

def main():
    n , a , b = map(int , input().split())
    print(bmon(n , a , b))

if __name__ == '__main__':
    main()

Measured memory_bytes: 38384
import sys
from itertools import accumulate

# functions used
r = lambda: sys.stdin.readline().strip() #single: int(r()), line: map(int, r().split())
R = lambda: list(map(int, r().split())) # line: R(), lines: [R() for _ in range(n)]
Rmap = lambda: map(int, r().split())
# set inputs
N, C = R()
STC = [R() for _ in range(N)]
#  0.5sec as one unit
tbl = [[0]*(2*(10**5)+5) for _ in range(C)]

for s, t, c in STC:
    c -= 1
    # if we can record the programms continuously (ver1)
    if tbl[c][2*s] != 0:
        tbl[c][2*s] += 1
        tbl[c][2*t] -= 1
    # if we can record the programms continuously (ver2)
    elif tbl[c][2*t-1] != 0:
        tbl[c][2*t-1] -= 1
        tbl[c][2*s-1] += 1
    # else:
    else:
        tbl[c][2*s-1] = 1
        tbl[c][2*t] = -1

tbl2 = [list(accumulate(a)) for a in tbl]
for i in range(200002):
     for j in range(C):
         if tbl2[j][i]==2:
          	tbl2[j][i]=1

ans = max([sum(x) for x in zip(*tbl2)])
print(ans)

# tmp = [sum(x) for x in zip(*tbl2)]

# res = 0
# for i in range(200002):
#     cc = 0
#     for j in range(C):
#         if tbl2[j][i]:
#             cc += 1
#     res = max(res, cc)
# print(res)


Measured memory_bytes: 178424
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#include <list>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#ifdef DEBUG
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
#else
#define show(...) 42
#endif
using namespace std;
using ll = long long;
using pii = pair<int, int>;
template <typename T, typename S>
ostream& operator<<(ostream& os, pair<T, S> a) {
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> v) {
    for (auto x : v) os << x << ' ';
    return os;
}
void debug() {
    cerr << '\n';
}
template <typename H, typename... T>
void debug(H a, T... b) {
    cerr << a;
    if (sizeof...(b)) cerr << ", ";
    debug(b...);
}
int main(){
    int N, C;
    cin >> N >> C;
    vector<int>s(N),t(N),c(N);
    vector<vector<int>>a(C,vector<int>(200005));
    rep(i,N){
        cin >> s[i] >> t[i] >> c[i];
        c[i]--;
        a[c[i]][s[i]*2-1]++;
        a[c[i]][t[i]*2]--;
    }
    rep(i,C)rep(j,200004)a[i][j+1] += a[i][j];
    int ans = 0;
    rep(j,200005){
        int sm = 0;
        rep(i,C)sm += (a[i][j]> 0 ? 1 : 0);
        ans = max(sm, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 25728
import sys
readline=sys.stdin.readline
n=int(readline())
aa=list(map(int,readline().split()))
laa=len(aa)
cnt=[0]*(10**5+2)
for n in range(laa):
  i=aa[n]
  if i > 0:
    cnt[i-1]+=1
  cnt[i]+=1
  cnt[i+1]+=1

ans=0

for _ in cnt:
  ans=max(ans,_)

print(ans)

Measured memory_bytes: 13304
import math
import fractions
(a,b,c,d)=map(int,input().split())
g=c*d//fractions.gcd(c,d)
k=0
k+=b//c+b//d-b//g-int(a-1)//c-(a-1)//d+(a-1)//g

print(b-a+1-k)



Measured memory_bytes: 5304
N,K,Q=map(int,input().split())
A=list(map(int,[input() for i in range(Q)]))

correctList = list()
for i in range(N):
    correctList.append(0)

for a in A:
    correctList[a-1] += 1

for correct in correctList:
    if K - (Q - correct) <= 0:
        print('No')
    else:
        print('Yes')


Measured memory_bytes: 13356
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll>
 
using namespace :: std;
 
const ll maxn=3100;
const ll mod=1e9+7;
const ll inf=1e9+500;
 
ll a[maxn];
vector<ll> out[maxn];
vector<ll> in[maxn];
bool ans[maxn];
bool vis[maxn];
vector<ll> topol;
 
void dfs(ll a){
    vis[a]=1;
    for(auto v:in[a]){
        if(vis[v]==0){
            dfs(v);
        }
    }
    topol.pb(a);
}
char ansyal[maxn][maxn];
 
int main(){
    ll n;
    cin>>n;
    for(ll i=1;i<=n;i++){
        cin>>a[i];
    }
    for(ll i=1;i<n;i++){
        ll v,u;
        cin>>v>>u;
        if(a[v]!=a[u]){
            if(a[v]>a[u]){
                swap(v,u);
            }
            out[u].pb(v);
            in[v].pb(u);
        }
    }
    for(ll i=1;i<=n;i++){
        if(vis[i]==0){
            dfs(i);
        }
    }
    vector<ll> anss;
    for(ll i=n-1;i>=0;i--){
        ll v=topol[i];
        bool win=0;
        for(auto u:out[v]){
            // javab v-->u
            ansyal[v][u]='w';
            for(auto z:out[u]){
                if(ansyal[u][z]=='w'){
                    ansyal[v][u]='l';
                }
            }
            if(ansyal[v][u]=='w'){
                win=1;
            }
        }
        if(win){
            anss.pb(v);
        }
    }
    sort(anss.begin(),anss.end());
    for(auto v:anss){
        cout<<v<<' ';
    }
}

Measured memory_bytes: 9344
n=int(input())
s=input()
ans=0
for i in range(1,n):
  x=s[:i]
  y=s[i:]
  cnt=0
  for j in range(i):
    if y.count(x[j]):
      y=y.replace(x[j],'')
      cnt+=1
  ans = max(ans, cnt)
print(ans)

Measured memory_bytes: 3064