akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
#define FOR(i,a,n) for(ll i=(ll)a;i<(ll)n;i++)
#define RFOR(i,a,n) for(ll i=(ll)n-1;i >= (ll)a;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,0,n)
#define ALL(v) v.begin(), v.end()
#define bra(first,second) '(' << first << ',' << second << ')'
ll MOD = 1000000007;
ll INF = 214748364700000000;
long double EPS = 1e-11;
long double PI = 3.141592653589793238;
template<typename T>
void remove(std::vector<T>& vector, unsigned int index){
    vector.erase(vector.begin() + index);
}

using Graph = vector<vector<pair<ll,ll>>>;

int main(){
   ll N,K,X,Y;
   cin >> N >> K >> X >> Y;
   if(N <= K){
       cout << X * N << endl;
   }else{
       cout << X * K + Y * (N-K) << endl;
   }
}


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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

const int mod = 1e9+7;
const int N = 2e3+23;

int dp[N];

int rek(int n) {
  if (n < 3) return 0;
  if (n < 6) return 1;
  int &ret = dp[n];
  if (ret != -1) return ret;
  ret = 1;
  for (int i = 3; i <= n-3; ++i) {
    ret = (ret+rek(n-i))%mod;
  }
  return ret;
}

void solve() {
  memset(dp, -1, sizeof(dp));
  int n; scanf("%d", &n);
  printf("%d", rek(n));
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3848
// vvvvvvvvvvvv TEMPLATE vvvvvvvvvvvv
#include <bits/stdc++.h>
using namespace std; using ll = long long; using P = pair<ll, ll>;
const ll linf = 1e18; const double eps = 1e-12, pi = acos(-1);
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define each(i,a) for (auto&& i : a)
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define eb emplace_back
#define all(a) begin(a),end(a)
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)
template<typename Head> void out(Head h) { cout << h << endl; } template<typename Head, typename... Tail>void out(Head h, Tail... t) { cout << h << " "; out(t...); }
template<typename T> istream& operator>>(istream& is, vector<T>& v) { each(x,v) is >> x; return is; }
template<typename T> ostream& operator<<(ostream& os, const vector<T>& v) { rep(i,v.size()) { if (i) os << " "; os << v[i]; } return os; }
ostream& operator<<(ostream& os, const vector<string>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T> ostream& operator<<(ostream& os, const vector<vector<T>>& v) { rep(i,v.size()) { if (i) os << endl; os << v[i]; } return os; }
template<typename T1, typename T2> ostream& operator<<(ostream& os, const pair<T1, T2>& p) { return os << "(" << p.first << ", " << p.second << ")"; }
struct yes_no : std::numpunct<char> { string_type do_truename() const { return "Yes"; } string_type do_falsename() const { return "No"; } };
void solve(); int main() {
  ios::sync_with_stdio(false); cin.tie(0); locale loc(locale(), new yes_no); cout.imbue(loc); cout << fixed << setprecision(10) << boolalpha;
  solve();
}
// ^^^^^^^^^^^^ TEMPLATE ^^^^^^^^^^^^

void solve() {
  string s; cin >> s;
  bool ans = true;
  rep(i, s.size()) {
    if (i % 2 == 0) {
      if (s[i] != 'h') ans = false;
    }
    else {
      if (s[i] != 'i') ans = false;
    }
  }
  if (s.size() % 2 == 1) ans = false;
  cout << ans << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  string s;
  cin >> s;
  if(s == "ABC")cout << "ARC" << endl;
  else cout << "ABC" << endl;
  return 0;
}

Measured memory_bytes: 3628
#ifndef call_from_test
#include<bits/stdc++.h>
using namespace std;
using Int = long long;
#endif
//BEGIN CUT HERE
template<typename T>
struct SegmentTree{
  using P = pair<int, T>;
  int n;
  vector<P> v;
  vector<vector<int> > dat;
  SegmentTree(){};
  SegmentTree(int n,vector<P> v):v(v){init(n);build();};

  void init(int n_){
    n=1;
    while(n<n_) n<<=1;
    dat.assign(n<<1,vector<int>());
  }
  void build(){
    for(auto p:v)
      dat[p.first+n].emplace_back(p.second);
    for(int i=0;i<n;i++)
      sort(dat[i+n].begin(),dat[i+n].end());

    for(int i=n-1;i;i--){
      merge(dat[(i<<1)|0].begin(),dat[(i<<1)|0].end(),
            dat[(i<<1)|1].begin(),dat[(i<<1)|1].end(),
            back_inserter(dat[i]));
    }
  }
  // [a,b) * [c,d)
  inline int query(int a,int b,int c,int d){
    int res=0;
    auto calc=[a,b,c,d](vector<int> &x){
                auto latte=lower_bound(x.begin(),x.end(),d);
                auto malta=lower_bound(x.begin(),x.end(),c);
                return int(latte-malta);
              };
    for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
      if(l&1) res+=calc(dat[l++]);
      if(r&1) res+=calc(dat[--r]);
    }
    return res;
  }

};
//END CUT HERE
#ifndef call_from_test
signed ABC106_D(){
  int n,m,q;
  scanf("%d %d %d",&n,&m,&q);
  vector<int> x(m),y(m);
  for(int i=0;i<m;i++) scanf("%d %d",&x[i],&y[i]);

  using P = pair<int, int>;
  vector<P> vp;
  for(int i=0;i<m;i++) vp.emplace_back(x[i],y[i]);

  SegmentTree<int> seg(n+1,vp);

  for(int i=0;i<q;i++){
    int a,b;
    scanf("%d %d",&a,&b);
    printf("%d\n",seg.query(a,b+1,a,b+1));
  }
  return 0;
}

signed main(){
  ABC106_D();
  return 0;
}
#endif


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

int main(){
  int n;
  int r = 0;
  cin >> n;
  for (int i=0; i<n; i++){
    int c;
    cin >> c;
    while(!(c % 2)){
      c /= 2;
      r++;
    }
  }

  cout << r;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i,n) for(int i=0;i<(int)(n);++i)

int main() {
  int a,b,c,d;
  cin>>a>>b>>c>>d;
  if(d==1) cout<<"1"<<endl;
  else cout<<"0"<<endl;
}


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

char T[1000];
int sum[3][1000][1000];

int main() {
	int m, n, k; scanf("%d%d%d", &m, &n, &k);
	rep(i, m) {
		scanf("%s", T);
		rep(j, n) {
			switch (T[j]) {
			case 'J':sum[0][i][j]++; break;
			case 'O':sum[1][i][j]++; break;
			case 'I':sum[2][i][j]++; break;
			}
		}
	}
	rep(i, 3)for (int j = 1; j < m; j++)rep(t, n)
		sum[i][j][t] += sum[i][j - 1][t];
	rep(i, 3)rep(j, m)for (int t = 1; t < n; t++)
		sum[i][j][t] += sum[i][j][t - 1];
	rep(i, k) {
		int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
		a--; b--; c--; d--;
		rep(i, 3) {
			int ans = sum[i][c][d];
			if (b)ans -= sum[i][c][b - 1];
			if (a)ans -= sum[i][a - 1][d];
			if (a&&b)ans += sum[i][a - 1][b - 1];
			printf(i == 2 ? "%d\n" : "%d ", ans);
		}
	}
	return 0;
}

Measured memory_bytes: 14776
#include<bits/stdc++.h>
int n,m;
int c[10],s[10];
int ans[10];
int vis[10];
int main(){
    int can=0;
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d%d",&s[i],&c[i]);
        if(c[i])can=1;
        if(vis[s[i]]&&c[i]!=ans[s[i]]){
            printf("-1");
            return 0;
        }
        vis[s[i]]=1;
        ans[s[i]]=c[i];
    }
    if(ans[1]==0&&vis[1]==1&&n!=1){
        printf("-1");
        return 0;
    }
    if(!can&&n!=1){
        printf("1");
        for(int i=2;i<=n;i++){
            printf("%d",ans[i]);
        }
        return 0;
    }
    int lp=1;
    if(n==1&&m==0){
        printf("0");
        return 0;
    }
    if(ans[1]==0&&vis[1]==0){
        printf("1");
        lp=2;
    }
    for(int i=lp;i<=n;i++){
        printf("%d",ans[i]);
    }
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define END '\n'
#define int long long
#define pb push_back
#define pii pair<int, int>
#define ff first
#define ss second
#define trace(x) cerr<<x<<END;
#define loop(i, a, b) for(int i = (a); i < (b); i++)
#define loopb(i, b, a) for(int i = (b); i > (a); --i) 
const int mod = 1e9+7;
const int mod1 = 998244353;
const int inf = 9223372036854775807ll;

void solve()
  {
   int n,x;
   cin>>x>>n;
   set<int> s;
   loop(i,0,n)
    {
      int num;
      cin>>num;
      s.insert(num);
    }
   int ans = 0;
   for(int i = 0;i<= 101 ;i++)
    {
      if(s.count(x-i) == 0 && x>=i)
         {
          cout<<x-i;
          return;
         }
      if(s.count(x+i) == 0)
         {
          cout<<x+i;
          return;
         }
    }
  } 
signed main()
 {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0); 
 
     solve();
  //cerr<<END<<1.0*clock();
  return 0;
} 

Measured memory_bytes: 3624
#include <algorithm>
#include <iostream>
#include <iterator>
#include <vector>

using namespace std;

int main()
{
    while (true) {
        int n, q;
        cin >> n >> q;
        if (n == 0 && q == 0) {
            return 0;
        }

        vector<int> v(101, 0);
        for (int i = 0; i < n; ++i) {
            int m;
            cin >> m;
            for (int j = 0; j < m; ++j) {
                int d;
                cin >> d;
                v[d] += 1;
            }
        }

        auto it = max_element(begin(v), end(v));
        auto day = distance(begin(v), it);
        cout << (*it >= q ? day : 0) << endl;
    }
}

Measured memory_bytes: 3048
N,M,K = map(int,input().split())
MOD = 998244353
MAX = 2*(10**5) + 1

fac = [0 for i in range(MAX)]
finv = [0 for i in range(MAX)]
inv = [0 for i in range(MAX)]

fac[0],fac[1] = 1,1
finv[0],finv[1] = 1,1
inv[1] = 1
for i in range(2, MAX):
	fac[i] = fac[i-1] * i % MOD
	inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
	finv[i] = finv[i-1] * inv[i] % MOD

def com(n, k):
	if n < k:
		return 0
	if n < 0 or k < 0:
		return 0
	return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD

def pow(n, k):
	ans = 1
	while k > 0:
		if k % 2 == 1:
			ans = ans * n % MOD
		n = n * n % MOD
		k = k // 2
	return ans

ans = 0
for k in range(K+1):
	tmp = M * pow(M-1, N-1-k) * com(N-1, k) % MOD
	ans = (ans + tmp) % MOD
print(ans)

Measured memory_bytes: 32836
import java.util.Scanner;

public class Main {
	static Scanner s = new Scanner(System.in);

	public static void main(String[] args) {

		int N = s.nextInt() + 1;
		long a = 2;
		long b = 1;
		long ans = 0;

		for (int i = 1; i < N - 1; i++) {
			ans = a + b;
			a = b;
			b = ans;
		}
		if (N == 2) {
			System.out.println(b);
		} else {
			System.out.println(ans);
		}
	}
}


Measured memory_bytes: 21844
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for _ in range(N)]

ans = 0

for i in range(N):
  count = C
  for j in range(M):
    count += A[i][j]*B[j]
  if count > 0:
    ans += 1
print(ans)


Measured memory_bytes: 3060
#include<iostream>
#include<memory.h>
#include<algorithm>
using namespace std;
int main()
{
	int n, W;
	int v[101], w[101];
	int dp[101][10001];
	cin >> n >> W;
	for (int i = 0; i < n; i++){
		cin >> v[i] >> w[i];
	}
	for (int i = 1; i <= n; i++){
		for (int i2 = 0; i2 <= W; i2++){
			if (i2 - w[i - 1] >= 0)dp[i][i2] = max(dp[i - 1][i2], dp[i][i2 - w[i-1]] + v[i-1]);
			else dp[i][i2] = dp[i - 1][i2];
		}
	}
	cout << dp[n][W] << endl;
}

Measured memory_bytes: 5080
#include <bits/stdc++.h>
#include <stdint.h>
#define mod 1000000007
#define ull unsigned ll
#define ll long long int
#define ld long double
#define pb push_back
#define mp make_pair
#define pi 3.1415926535897932
#define nui 100
using namespace std;
int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n; cin >> n;
    int rem = n % 1000;
    if(n!=0 && rem!=0){
    cout << 1000-rem << endl;
    }
    else{
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define rrep(i, n) for(int i=((int)(n)-1);i>=0;i--)
#define srep(i, from, to) for(int i=from;i<(int)(to);i++)

int main() {
  int k, x;
  cin >> k >> x;

  int d = k - 1;
  int start = x - d;
  int end = x + d;
  
  srep(i, start, end+1) {
    cout << i << endl;
  }
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
   int n, i;
   long long int s=0;

   scanf("%d",&n);

   for(i=1;i<=n;i++)
      if((i%3!=0)&&(i%5!=0))
         s=s+i;

   printf("%lld\n",s);
   return 0;
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define rep(i, a, n) for (int i=(a); i<(n); i++)
#define per(i, a, n) for (int i=(a); i>(n); i--)
typedef long long ll;
const int maxn = 2e6+5;
const int mod = 1e9+7;
using namespace std;

ll a[maxn];

void solve() {
	ll n, k, cur=1, tmp; cin >> n >> k;
	rep(i,0,n) cin >> a[i];
	rep(i,0,k) cur += a[i];
	rep(i,k,n) {
		tmp = cur;
		cur -= a[i-k];
		cur += a[i];
		if (cur > tmp) cout << "Yes\n";
		else cout << "No\n";
	}
}

int main(int argc, char * argv[]) 
{
	ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef DEBUG
	freopen("C:/Users/Fish_Brother/Desktop/in", "r", stdin);
	//freopen("C:/Users/Fish_Brother/Desktop/out", "w", stdout);
#endif

	//int t; cin >> t; while(t--)
	solve();

    return 0;
}

Measured memory_bytes: 5188
#include<iostream>
using namespace std;
int main()
{
  int A, B, C;
  cin >> A >> B >> C;
  if(A <= B && C <= B)
    cout << 10*B + C + A;
  else if(C <= A && B <= A)
    cout << 10*A + C + B;
  else if(B <= C && A <= C)
    cout << 10*C + B + A;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main
{
    public static void main(String[] args) 
    {
        Scanner scan = new Scanner(System.in);
        String s = scan.next();
        String one = "1";
        int output=0;

        String[] sr = s.split("");

        if(sr[0].equals(one))
        {
            output++;
        }
        if(sr[1].equals(one))
        {
            output++;
        }
        if(sr[2].equals(one))
        {
            output++;
        }
        System.out.println(output);
    }
}

Measured memory_bytes: 21972
#include<bits/stdc++.h>
using namespace std;
#define light ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define cases() ll t;cin>>t;while(t--)
#define all(c) c.begin(),c.end()
#define PI 3.14159265358979323846
const ll MAX = 1e6+5;
const ll INF = 1e18;
const ll MOD = 1e9+7;

int main()
{
    ll n,x,m,i,j,k,l,p,q,c,d,y;
    cin >> n >> x >> m;
    map<ll,ll> mp,mp2;
    l = x;p = 1;k = 0;j = 0;
    for(i=0;i<n;i++)
    {
        if(mp.find(l)==mp.end())
        {
            mp[l]=p;
            mp2[p]=l;
            k+=l;
            l = (l*l)%m;
            p++;
        }
        else
        {
            j++;
            break;
        }
    }
    if(j==0)
    {
        cout << k;
        return 0;
    }
    q = mp[l];
    j = p-q+1;
    vector<ll> a(j,0);
    for(i=1;i<j;i++)
        a[i] = a[i-1]+mp2[q+(i-1)];
    y = j-1;
    c = (n-p+1)/y;
    d = (n-p+1)%y;
    k+=(c*a[y]);
    k+=(a[d]);
    cout << k;
}

Measured memory_bytes: 9764
# coding: utf-8

import math
import fractions
import heapq
import collections
import re
import array
import bisect

from collections import Counter, defaultdict


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]


def palindrome(s):
    for i in range(len(s)):
        if not s[i] == s[-i-1]:
            return False
    return True


def main():
    s = input().strip()
    i = 0
    sdx = ""
    x = defaultdict(int)
    for c in s:
        if c == "x":
            x[i] += 1
        else:
            sdx += c
            i += 1
    if not palindrome(sdx):
        return -1

    cnt = 0
    k = list(x.keys())
    for d in k:
        cnt += max(0, x[d] - x[i-d])
    return cnt


if __name__ == "__main__":
    print(main())


Measured memory_bytes: 11596
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n,q; cin >> n >> q;
    int MOD = n;
    int res = 0;
    rep(i,q){
        int isQuery,k;
        cin >> isQuery >> k;
        if(isQuery){
            res = (k + res)%MOD;
           // cout << "res = " << res << endl;
        } else {
            cout << (res + k-1)%MOD + 1 << endl;
        }
    }
}





Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pi 3.141592653589793238
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MOD 1000000007
int main()
{
	fast;
	ll a,p;
	cin>>a>>p;
	cout<<(a*3 + p)/2;
	return 0;
}


Measured memory_bytes: 3660
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}
macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}
macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
        t: String,
        a: i32,
        b: i32,
        u: String
    }
    if s == u {
        println!("{} {}", a - 1, b);
    }
    else if t == u{
        println!("{} {}", a, b - 1);
    }
}


Measured memory_bytes: 4352
n, m, l= map(int, raw_input().split())
A = [[0 for i in range(m)] for j in range(n)]
B = [[0 for i in range(l)] for j in range(m)]
C = [[0 for i in range(l)] for j in range(n)]

for i in range(n):
    a = map(int, raw_input().split())
    for j in range(m):
        A[i][j] = a[j]
for i in range(m):
    b = map(int, raw_input().split())
    for j in range(l):
        B[i][j] = b[j]
for i in range(n):
    ans = ""
    for j in range(l):
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
        if(j == 0):
            ans += str(C[i][j])
        else:
            ans += " " + str(C[i][j])
    print(ans)

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

int main(){

    string s;

    cin >> s;

    rep(i,s.size()){
        if(s[i]==',') s[i]=' ';
        cout << s[i];
    }

    cout << endl;

    return 0;
}

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

const int ac = 1e6 + 10;
ll A[ac];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	ll a, b; cin >> a >> b;
	ll x = 1;
	while (a--)
	{
		if (x < b) x *= 2;
		else x += b;
	}
	cout << x << '\n';
}


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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);
// (a+b+c)%MOD
ll madd(ll a, ll b, ll c);
// (a-b)%MOD
ll msub(ll a, ll b);
// (a*b*c)%MOD
ll mtime(ll a, ll b, ll c);


int main() {
    ll n, sum = 0;
    cin >> n;
    vector<ll> l(n);
    rep(i, n) cin >> l[i];
    sort(ALL(l));
    rep(i, n-1) sum += l[i];
    if(sum > l[n-1]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count));
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}

ll madd(ll a, ll b, ll c) {
    ll ret = (a+b) % MOD;
    return (ret+c) % MOD;
}

ll msub(ll a, ll b) {
    if(a < b) return (a-b+MOD) % MOD;
    else return (a-b) % MOD;
}

ll mtime(ll a, ll b, ll c) {
    ll ret = (a*b) % MOD;
    return (ret*c) % MOD;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
constexpr long double EPS = 1e-15;
const long double PI = acos(-1);
constexpr int inf = 1e9;
constexpr ll INF = 2e18;
constexpr ll MOD = 1e9+7;
constexpr ll MOD1 = 998244353;
typedef pair<ll,ll> P;
//#define all(v) (v).begin(), (v).end()
#define rep(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define pb push_back
#define fi first
#define se second
//#define mp make_pair

int n;
ll a[1 << 18];

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


void solve() {
    ll ans = a[0] - 1;
    ll mask = 2;
    for (int i = 1; i < n; i++) {
        if (a[i] == mask) mask++;
        else ans += (a[i] - 1) / mask;
    }
    cout << ans << endl;
}

int main(int argc, char *argv[]){
    input();
    solve();
    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <utility>
#include <vector>
#include <string>
#include <stack>
#include <queue>

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define RREP(i, n) for (int i = (n) - 1; i >= 0; i--)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a); i > (b); i--)
#define ALL(a) (a).begin(), (a).end()

const ll INF = 1LL << 50;

int a[2000], b[2000];
ll c[2000], dist[1000];
int N, M;

int main() {
    cin >> N >> M;
    REP(i, M) {
        cin >> a[i] >> b[i] >> c[i];
        a[i]--; b[i]--; c[i] *= -1;
    }
    REP(i, N) dist[i] = INF;
    dist[0] = 0;

    REP(i, N - 1) REP(j, M) {
        if (dist[a[j]] == INF) continue;

        if (dist[b[j]] > dist[a[j]] + c[j])
            dist[b[j]] = dist[a[j]] + c[j];
    }
    ll ans = dist[N - 1];

    bool negative[1000] = {};
    REP(i, N) REP(j, M) {
        if (dist[a[j]] == INF) continue;

        if (dist[b[j]] > dist[a[j]] + c[j]) {
            dist[b[j]] = dist[a[j]] + c[j];
            negative[b[j]] = true;
        }

        if (negative[a[j]]) negative[b[j]] = true;
    }

    if (negative[N - 1]) cout << "inf" << endl;
    else cout << -ans << endl;
    return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

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

dp = [0]*n
c = a[0]
dp[1] = max(a[0],a[1])

for i in range(2,n):
    if i%2 == 0:
        c += a[i]
        dp[i] = max(dp[i-2]+a[i],dp[i-1])
    else:
        dp[i] = max(dp[i-2]+a[i],c)

print(dp[-1])
    


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

using ll=int64_t;
#define int ll

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)
#define MP make_pair
#define PB push_back
#define ALL(x) x.begin(),x.end()
#ifdef MAROON_LOCAL
#define cerr (cerr<<"-- line "<<__LINE__<<" -- ")
#else
class CerrDummy{}cerrDummy;
template<class T>
CerrDummy& operator<<(CerrDummy&cd,const T&){
	return cd;
}
using charTDummy=char;
using traitsDummy=char_traits<charTDummy>;
CerrDummy& operator<<(CerrDummy&cd,basic_ostream<charTDummy,traitsDummy>&(basic_ostream<charTDummy,traitsDummy>&)){
	return cd;
}
#define cerr cerrDummy
#endif
#define REACH cerr<<"reached"<<endl
#define DMP(x) cerr<<#x<<":"<<x<<endl
#define ZERO(x) memset(x,0,sizeof(x))
#define ONE(x) memset(x,-1,sizeof(x))

using pi=pair<int,int>;
using vi=vector<int>;
using ld=long double;

template<class T,class U>
ostream& operator<<(ostream& os,const pair<T,U>& p){
	os<<"("<<p.first<<","<<p.second<<")";
	return os;
}

template<class T>
ostream& operator <<(ostream& os,const vector<T>& v){
	os<<"{";
	REP(i,(int)v.size()){
		if(i)os<<",";
		os<<v[i];
	}
	os<<"}";
	return os;
}

ll read(){
	ll i;
	scanf("%" SCNd64,&i);
	return i;
}

void printSpace(){
	printf(" ");
}

void printEoln(){
	printf("\n");
}

void print(ll x,int suc=1){
	printf("%" PRId64,x);
	if(suc==1)
		printEoln();
	if(suc==2)
		printSpace();
}

string readString(){
	static char buf[3341000];
	scanf("%s",buf);
	return string(buf);
}

char* readCharArray(){
	static char buf[3341000];
	static int bufUsed=0;
	char* ret=buf+bufUsed;
	scanf("%s",ret);
	bufUsed+=strlen(ret)+1;
	return ret;
}

template<class T,class U>
void chmax(T& a,U b){
	if(a<b)
		a=b;
}

template<class T,class U>
void chmin(T& a,U b){
	if(b<a)
		a=b;
}

template<class T>
T Sq(const T& t){
	return t*t;
}

#define CAPITAL
void Yes(bool ex=true){
	#ifdef CAPITAL
	cout<<"YES"<<endl;
	#else
	cout<<"Yes"<<endl;
	#endif
	if(ex)exit(0);
}
void No(bool ex=true){
	#ifdef CAPITAL
	cout<<"NO"<<endl;
	#else
	cout<<"No"<<endl;
	#endif
	if(ex)exit(0);
}

const ll infLL=LLONG_MAX/3;

#ifdef int
const int inf=infLL;
#else
const int inf=INT_MAX/2-100;
#endif

signed main(){
	int n=read(),k=read();
	print((n-2)/(k-1)+1);
}


Measured memory_bytes: 256
#include <fstream>
#include <iostream>
#include <cmath>
#include <vector>
#include <queue>
#include <utility>
#include <algorithm>
using namespace std;

int main() {
  int n;
  while (cin >> n) {
    int cnt = 0;
    for (int a = 0; a < 10; a++) {
      for (int b = 0; b < 10; b++) {
        for (int c = 0; c < 10; c++) {
          for (int d = 0; d < 10; d++) {
            if (a+b+c+d==n) cnt++;
          }
        }
      }
    }
    cout << cnt << endl;
  }
}

Measured memory_bytes: 1160
N = int(input())
S = dict()
for i in range(N):
    r = 0
    s = input()
    s = "".join(sorted(s))
    if s not in S:
        S[s] = 1
    else:
        S[s] += 1
res = 0
for s in S:
    if S[s] > 1:
        res += (S[s]-1)*S[s] // 2
print(res)

Measured memory_bytes: 17800
#include <stdio.h>

int main(){
   
  int a=0,b=0,c=0,i;
  char str[4];
  
  scanf("%s",str);
  
  for(i=0;i<3;i++){
   if(str[i]=='a'){
     a=a+1;
  }
  }
  
    for(i=0;i<3;i++){
   if(str[i]=='b'){
     b=b+1;
  }
  }
  
   for(i=0;i<3;i++){
   if(str[i]=='c'){
     c=c+1;
  }
  }
  
    if(a==1&&b==1&&c==1){
      puts("Yes");
    }
    else {
       puts("No");
    }
  
  return 0;
}

Measured memory_bytes: 128
export class Main {
  static main(input): string {
    const [r, g, b, n]: number[] = input.split("\n")[0].split(" ").map(Number);
    let result: number = 0;
    const ball: number[] = [r, g, b];
    ball.sort((a1, a2) => a2 - a1);
    let count1: number = 0;
    while (true) {
      const c1: number = ball[0] * count1;
      if (c1 >= n) {
        if (c1 == n) {
          ++result;
        }
        break;
      }
      let count2: number = 0;
      while (true) {
        const c2: number = c1 + ball[1] * count2;
        if (c2 >= n) {
          if (c2 == n) {
            ++result;
          }
          break;
        }
        if ((n - c2) % ball[2] == 0) {
          ++result;
        }
        ++count2;
      }
      ++count1;
    }
    return `${result}`;
  }
}
console.log(Main.main(require("fs").readFileSync("/dev/stdin", "utf8")));

Measured memory_bytes: 7372
#include<stdio.h>
#include<string.h>

#define MYSTRINGMAX 200000 // 配列20万分取る
#define SIZE MYSTRINGMAX + 2 // MYSTRINGMAX+2した値をSIZEに入れたものを定義する SIZE = 200002

int main(void) {
	char s[SIZE], t[SIZE];

	fgets(s, SIZE, stdin);
	fgets(t, SIZE, stdin);

	int length = strlen(s); // lengthに文字列の長さを返すstrlen関数を配列sにて判定する
	
	for (int i = 0; i < length; i++) {
		if (s[i] != t[i]) {
			char c1 = s[i];
			int j;
			for (j = 0; j < i; j++) { // 変更し終わった部分を変えてしまう場合は"No"
				if (s[j] == t[i] || s[j] == c1) {
					printf("No\n");
					return 0;
				}
			}
			for (; j < length; j++) {
				if (s[j] == c1) {
					s[j] = t[i];
				}
				else if (s[j] == t[i]) {
					s[j] = c1; 
				}
			}
		}
	}
	printf("Yes\n"); // それ以外ならYesを実行
	return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
int GCD(int a,int b){
  if(a < b){
    int temp = a;
    a = b;
    b = temp;
  }
  while(b != 0){
    int c = a % b;
    a = b;
    b = c;
    if(b == 0) return a;
  }
}
int main(){
  int n,X;
  cin >> n >> X;
  vector<int> x(n);
  for(int i = 0;i < n;i++){
    cin >> x[i];
    x[i] = abs(X-x[i]);
  }
  int answer = GCD(x[0],x[0]);
  for(int i = 0;i < n;i++){
    answer = GCD(answer,x[i]);
  }
  cout << answer << endl;
}

Measured memory_bytes: 640
import Data.List
import Data.Bool

main = do
        s <- getLine
        putStrLn $ ans s

ans :: String -> String
ans s = if (isPalindrome s) && (isPalindrome (take (((length s)-1) `div` 2) s) ) && (isPalindrome (drop (((length s)+1) `div` 2) s)) 
          then "Yes"
          else "No"

isPalindrome :: String -> Bool
isPalindrome s= (s == reverse s)


Measured memory_bytes: 508
import math

lst = list(map(int,[input() for i in range(5)]))

lst_10 = sorted([i%10 for i in lst])
if sum(lst_10)==0:
    print(sum(lst))
    exit()
sum_time = sum([math.ceil(i/10)*10 for i in lst])
min_list=0
while min_list==0:
    min_list = lst_10.pop(0)
print(sum_time-10+min_list)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
#define INF 1e9
using ll = long long;
#define int ll
#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 all(x) (x).begin(),(x).end()
using namespace std;
signed main(){
	int n; cin >> n;
	vector<int> v(3*n),lv,sv;
	rep(i,0,3*n)	cin >> v[i];
	priority_queue<int,vector<int>,greater<int>>lque;
	priority_queue<int,vector<int>>sque;
	int ls=0,ss=0;
	rep(i,0,n){
		lque.push(v[i]);
		sque.push(v[2*n+i]);
		ls+=v[i];
		ss+=v[2*n+i];
	}
	lv.push_back(ls);
	sv.push_back(ss);
	int ans=-INF*INF;
	ans = max(ans,ls-ss);
	rep(i,0,n){
		lque.push(v[n+i]);
		sque.push(v[2*n-i-1]);
		ls+=(v[n+i]-lque.top()); //min change
		ss+=(v[2*n-i-1]-sque.top()); //max change
		lv.push_back(ls);
		sv.push_back(ss);
		sque.pop();
		lque.pop();
	}
	rep(i,0,lv.size())	ans = max(ans,lv[i]-sv[n-i]);
	cout << ans << endl;
}

Measured memory_bytes: 6508
N, M = map(int, input().split())
LRC = sorted([list(map(int, input().split())) for i in range(M)], key=lambda x: (x[0], x[1]))

inf = float('inf')
dp = [inf] * N
dp[0] = 0

for l, r, c in LRC:
    for i in range(r, l, -1):
        if dp[i-1] > dp[l-1] + c:
            dp[i-1] = dp[l-1] + c
        else:
            break

if dp[-1] < inf:
    print(dp[-1])
else:
    print(-1)

Measured memory_bytes: 97496
/*@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Author: z0marlin
Title: c.cpp
Time: 15-08-2019T13:38:31+0530 
I suck at CP T_T
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@*/
#include <bits/stdc++.h>
#if DEBUG
#define dprintf(...) printf(__VA_ARGS__)
#else
#define dprintf(...)
#endif
#define FOR(i, a, n) for(int i = a; i < n; ++i)
#define FORE(a, v) for(auto a:v)
#define MAX(a, b) ((a>b)?a:b)
#define MIN(a, b) ((a<b)?a:b)
#define MP(i, j) make_pair(i, j)
#define PB(a) push_back(a)
#define PPB(a) pop_back(a)
#define all(a) a.begin(), a.end()

using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pii_t;
typedef pair<ll,ll> pll_t;
typedef vector<int> vi_t;
typedef vector<ll> vll_t;

const int MAX_SZ=1e6+2;
const int MOD=1e9+7;
int t = 1, n, m, q, ql, qr;
char ch;
vi_t inp;

bool solve(){
	for(int i=n-2; i>=0; i--){
        if(inp[i]-1 > inp[i+1]) return false;
        if(inp[i]>inp[i+1]) inp[i]--;
    }
    return true;
}

int main(){
	// scanf("%d", &t);
	while(t--){
		scanf("%d", &n);
        inp.resize(n);
        FOR(i,0,n){
            scanf("%d", &inp[i]);
        }
        if(solve()) printf("Yes\n");
        else printf("No\n");
	}
}

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

#define rep(i, a, b) for(int i = (a); i < int(b); ++i)
#define rrep(i, a, b) for(int i = (a) - 1; i >= int(b); --i)
#define trav(it, v) for(auto &it : (v))
#define all(v) (v).begin(), (v).end()
#define what_is(x) cerr << #x << " is " << x << endl;
#define sz(x) (int)(x).size()

typedef double fl;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;

int main(){
	ios::sync_with_stdio(0);
    int H, W, N;
    cin >> H >> W >> N;
    int sr, sc;
    cin >> sr >> sc;
    --sr;
    --sc;
    string S, T;
    cin >> S >> T;
    /*int pos = sc;
    rep(j,0,N) {
        if (S[j] == 'R')
            pos = pos+1;
        if (T[j] == 'L')
            pos = max(pos-1, 0);
        if (pos >= W) {
            cout << "NO" << endl;
            return 0;
        }
    }
    pos = sc;
    rep(j,0,N) {
        if (S[j] == 'L')
            --pos;
        if (T[j] == 'R')
            pos = min(pos+1, W-1);
        if (pos < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }
    pos = sr;
    rep(j,0,N) {
        if (S[j] == 'D')
            pos++;
        if (T[j] == 'U')
            pos = max(pos-1, 0);
        if (pos >= H) {
            cout << "NO" << endl;
            return 0;
        }
    }
    pos = sc;
    rep(j,0,N) {
        if (S[j] == 'U')
            pos--;
        if (T[j] == 'D')
            pos = min(pos+1, H-1);
        if (pos < 0) {
            cout << "NO" << endl;
            return 0;
        }
    }*/
    //cout << "YES" << endl;
    int lox=-1, hix = W, loy=-1, hiy = H;
    rrep(i,N,0) {
        switch (T[i]) {
            case 'L':
                ++hix;
                if (hix > W)
                    hix = W;
                break;
            case 'R':
                --lox;
                if (lox < 0)
                    lox = -1;
                break;
            case 'U':
                ++hiy;
                if (hiy > H)
                    hiy = H;
                break;
            case 'D':
                --loy;
                if (loy < 0)
                    loy = -1;
                break;
        }
        switch (S[i]) {
            case 'R':
                --hix;
                break;
            case 'L':
                ++lox;
                break;
            case 'D':
                --hiy;
                break;
            case 'U':
                ++loy;
                break;
        }
        if (hix == lox+1 || hiy == loy+1) {
            cout << "NO" << endl;
            return 0;
        }
    }
    if (lox >= sc || hix <= sc || loy >= sr || hiy <= sr) {
        cout << "NO" << endl;
        return 0;
    }
    cout << "YES" << endl;
}


Measured memory_bytes: 920
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int n= stdIn.nextInt();
		int m= stdIn.nextInt();
		int l= stdIn.nextInt();
		long x[][] = new long[n][m];
		long y[][] = new long[m][l];
		long z=0;
		for(int i=0;i<n; i++) {
			for(int j=0;j<m; j++) {
				x[i][j] = stdIn.nextInt();
			}
		}
		for(int i=0;i<m; i++) {
			for(int j=0;j<l; j++) {
				y[i][j] = stdIn.nextInt();
			}
		}
		stdIn.close();
		for(int i=0;i<n; i++) {
			for(int j=0;j<l; j++) {
				z=0;
				for(int k=0;k<m; k++) {
					z +=x[i][k] * y[k][j];
				}
				System.out.print(z);
				if (j != l-1) {
					System.out.print(" ");
				}
			}
			System.out.println();
		}
	}
}



Measured memory_bytes: 56824
#include<stdio.h>
main()
{
    char a[200][200];
    int t,g,h,u,j,i;
    scanf("%d%d",&t,&g);
    for(i=0;i<t;i++)
    {
        for(j=0;j<=g;j++)
        {
            scanf("%c",&a[i][j]);

        }
    }
    for(i=0;i<g+2;i++)
        printf("#");
        printf("\n");
    for(i=0;i<t;i++)
    {
        printf("#");

        for(j=1;j<=g;j++){
            printf("%c",a[i][j]);}
        printf("#\n");
    }
    for(i=0;i<g+2;i++)
        printf("#");
        printf("\n");
        return 0;



}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main(){
  		
  	int N, A;
  	double sum;
	
  	cin >> N;
  	sum = 0.0;
  	for(int i = 0; i < N; i++){
    	cin >> A;
      	sum += (double) 1.0/A;
    }
  	
  	cout << 1/sum << endl;
 	return 0; 
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static Scanner scanner;

	public static void main(String[] args) {
	    scanner = new Scanner(System.in);

	    int N=gi();
	    int[] C=new int[N-1];
	    int[] S=new int[N-1];
	    int[] F=new int[N-1];

	    for (int i=0; i<N-1; i++) {
            C[i]=gi();
            S[i]=gi();
            F[i]=gi();
	    }
	    for (int i=0; i<N-1; i++) {
	    	int t=0;
	    	for (int j=i; j<N-1; j++) {
                  if (t<S[j]) {
                	  t=S[j];
                  }
                  while(t%F[j]!=0) {
                      t++;
                  }
                  t+=C[j];
		    }
	    	System.out.println(t);
	    }
	    System.out.println(0);
//        if (f) {
//    	    String a=Sq.substring(0, S.lastIndexOf(T)) + T + Sq.substring(S.lastIndexOf(T)+T.length());
//    	    System.out.print(a.replaceAll("\\?", "a"));
//        }else {
//        	System.out.print("UNRESTORABLE");
//        }
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

Measured memory_bytes: 38488
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include<climits>
#include <vector>
#include <queue>

using namespace std;
typedef long long ll;
int n, m, X;
int c[13];
int a[13][13];
int d[13];
int ans = -1;
vector<int> v;
void go(int x) {
	if (x == n) {
		for (int i = 0; i < m; i++)d[i] = 0;
		int cnt = 0;
		for (int i = 0; i < v.size(); i++) {
			cnt += c[v[i]];
			for (int j = 0; j < m; j++) {
				d[j] += a[v[i]][j];
				d[j] = min(d[j], X);
			}
		}

		for (int i = 0; i < m; i++) {
			if (d[i] < X)return;
		}
		if (ans == -1 || ans > cnt) {
			ans = cnt;
		}
		return;
	}
	go(x + 1);
	v.push_back(x);
	go(x + 1);
	v.pop_back();
}
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> n >> m >> X;
	for (int i = 0; i < n; i++) {
		cin >> c[i];
		for (int j = 0; j < m; j++) {
			cin >> a[i][j];
		}
	}
	go(0);
	cout << ans << '\n';



}

Measured memory_bytes: 3200
import math
l,r=map(int,input().split())
a=l%2019
b=r%2019
if r-l>=2018:
    print(0)
elif b-a<=0:
    print(0)
else:
    ans=2018
    for i in range(a,b+1):
        for j in range(i+1,b+1):
            ans=min(ans,i*j%2019)
    print(ans)

Measured memory_bytes: 3064
#include <algorithm>
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> P;
typedef pair<ll, ll> LLP;

// const int INF = (1 << 30) - 1;
// const ll LL_INF = (1LL << 62) - 1;
const ll MOD = 1e9 + 7;
// const double PI = M_PI;

ll N;
vector<ll> A;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  A.resize(N);
  rep(i, N) { cin >> A[i]; }

  vector<ll> color(3, 0);
  ll ans = 1;
  rep(i, N) {
    ll cnt = 0;
    ll added = false;
    rep(j, 3) {
      if (A[i] == color[j]) {
        cnt++;
        if (!added) {
          color[j]++;
          added = true;
        }
      }
    }
    ans *= cnt;
    ans %= MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    int N;
    cin >> N;

    vi L(N);
    int len = 0, lenmax = 0;

    for (int i = 0; i < N; i++) {
        cin >> L[i];
        len += L[i];
        lenmax = max(lenmax, L[i]);
    }

    if (len - lenmax > lenmax) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }


    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
def main():
    import sys
    from operator import itemgetter
    from collections import deque
    buf = sys.stdin.buffer
    
    n, d, a = map(int, buf.readline().split())
    m = map(int, buf.read().split())
    monsters = sorted(zip(m, m), key=itemgetter(0))
    
    bomb_area = deque([])
    bomb_power = deque([])
    total_damage = 0
    ans = 0
    for pos, hp in monsters:
        while bomb_area:
            area = bomb_area[0]
            if area < pos:
                bomb_area.popleft()
                power = bomb_power.popleft()
                total_damage -= power
            else:
                break
        if hp <= total_damage:
            continue
        else:
            count = (hp - total_damage + a - 1) // a
            ans += count
            power = a * count
            total_damage += power
            bomb_area.append(pos + 2 * d)
            bomb_power.append(power)
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 56024
#include <cstddef>
#include <cstdint>
#include <iostream>
#include <string>

using usize = std::size_t;
using u64 = std::uint64_t;

static constexpr u64 mod = 1000000007;

int main() {
  u64 n, m;
  std::cin >> n >> m;
  u64 ans = 0;
  if (n == 1) {
    ans = (m + 1) % mod;
  } else {
    const auto choose = [&](u64 x) {
      x %= mod;
      return x * x % mod;
    };
    u64 lar = m % (n - 1) + 1;
    u64 sma = (n - 1) - lar;
    ans += choose(m / (n - 1) + 1) * (lar % mod) % mod;
    ans += choose(m / (n - 1)) * (sma % mod) % mod;
    ans %= mod;
  }
  std::cout << ans << std::endl;
  return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<vector>
using namespace std;
int main(){
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    int n,max=0;
    cin>>n;
    vector<int> a(n);
    for(long long i=0;i<n;i++){
        cin>>a[i];
        if(max<a[i]){
            max=a[i];
        }
    }
    vector<bool> isPrime(max,true);
    isPrime[0]=false;
    isPrime[1]=false;
    for(long long i=2;i*i<=max;i++){
        if(isPrime[i]){
            for(long long j=2;i*j<=max;j++){
                isPrime[i*j]=false;
            }
        }
    }
    int sum=0;
    for(long long i=0;i<n;i++){
        if(isPrime[a[i]]){
            sum++;
        }
    }
    cout<<sum<<"\n";
    return(0);
}


Measured memory_bytes: 14820
import sys


l,r=map(int,input().split())

k=2020
if r-l>=2020:
    print(0)
    sys.exit()
else:
    for i in range(l,r):
        for j in range(i+1,r+1):
            k=min(k,(i*j)%2019)
print(k)

Measured memory_bytes: 9072
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

using namespace std;

int main() {
	vector<vector<int>> c(3, vector<int>(3, 0));
	int maxi = 0;
	for (int i = 0; i < 3; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
			maxi = max(maxi, c[i][j]);
		}
	}

	for (int a0 = 0; a0 <= maxi; a0++) {
	for (int a1 = 0; a1 <= maxi; a1++) {
	for (int a2 = 0; a2 <= maxi; a2++) {
		int b0 = c[0][0] - a0;
		int b1 = c[1][1] - a1;
		int b2 = c[2][2] - a2;

		if (
			c[0][1] == a0 + b1 &&
			c[0][2] == a0 + b2 &&
			c[1][0] == a1 + b0 &&
			c[1][2] == a1 + b2 &&
			c[2][0] == a2 + b0 &&
			c[2][1] == a2 + b1
			)
		{
			cout << "Yes" << endl;
			return 0;
		}
	}}}

	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

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

Measured memory_bytes: 256
#include <stdio.h>
#include<math.h>

int main(void)
{
	int N,D,count=0,i;
	double  x,y;
	scanf("%d %d",&N,&D);
  	for(i=1;i<=N;i++){
  		scanf("%lf %lf",&x,&y);
    		if(sqrt(x*x+y*y)<=D)
      			count++;
	 }
  	printf("%d\n",count);
  	return 0;
}

Measured memory_bytes: 2216
#include<bits/stdc++.h>
using namespace std;
int k;
double p,e,t;
double rt,lt;

double dfs(double r,double l,int time=0,double pp=1.0){
  double h=(r+l)/2.0;
  if(time==k){
    if(rt<=h&&h<=lt)return pp;
    else return 0;
  }
  if(rt<=r&&l<=lt)return pp;
  if(lt<r||l<rt)return 0;
  double a,b;
  if(h>=t){
    a=pp*(1.0-p);
    b=pp*p;
  }else{
    a=pp*p;
    b=pp*(1.0-p);
  }
  return dfs(r,h,time+1,a)+dfs(h,l,time+1,b);
}

int main(){
  double r,l;
  cin>>k>>r>>l>>p>>e>>t;
  rt=t-e;
  lt=t+e;
  printf("%.10lf\n",dfs(r,l,0));
  return 0;
}



Measured memory_bytes: 3288