akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a[] = new int[10];
		int N = sc.nextInt();
		for (int i=1;i<10;i++) {
			a[i-1] = i*100+i*10+i;
		}
		for (int i=0;i<10;i++) {
			if (N<=a[i]) {
				System.out.println(a[i]);
				return ;
			}
		}
	}
}

Measured memory_bytes: 35544
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int N; cin >> N;
    vector<int> A(N), B(N), C(N);
    for(int i=0;i<N;i++) cin >> A[i];
    for(int i=0;i<N;i++) cin >> B[i];
    for(int i=0;i<N;i++) cin >> C[i];
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());
    sort(C.begin(), C.end());

    int64_t ans = 0;
    for(int i=0;i<N;i++){
        int64_t a = (int64_t) (lower_bound(A.begin(), A.end(), B[i]) - A.begin());
        int64_t c = N - (int64_t)(upper_bound(C.begin(), C.end(), B[i]) - C.begin());
        ans += a*c;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1408
#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>

#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef vector<int> vec;
typedef vector<vector<int>> mat;
using P = pair<ll, ll>;

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

const ll mod = 1000000007;
const int INF = 1<<29;

int main(){
  int N, R; cin >> N >> R;

  int res = 0;
  if (N >= 10) res = R;
  else res = R + 100 * (10 - N);
  cout << res << endl;
}


Measured memory_bytes: 256
/*
    Author: Alam Khan
    AUST CSE 40th Batch

*/

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

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vl;
typedef deque<ll> dl;
typedef stack<ll> stl;
typedef set<ll> sl;
typedef map<string, ll> msl;
typedef map<ll,ll> mll;
#define sf(n)     scanf("%lld",&n)
#define sff(n,m)     scanf("%lld %lld",&n,&m)
#define sfff(n,m,r)     scanf("%lld %lld %lld",&n,&m,&r)
#define sfs(n)     scanf("%s",n)
#define pf(n)     printf("%lld\n",n)
#define pff(n,m)     printf("%lld %lld\n",n,m)
#define pfff(n,m,r)     printf("%lld %lld %lld\n",n,m,r)
#define pfs(n)     printf("%s\n",n)
#define pfcs(i,n)     printf("Case %lld: %lld\n",i,n)
#define pb     push_back
#define prf     printf
#define inf     2e18
#define low     -1000000000000
#define PI        acos(-1.0)
#define rep1(i,n) for(i=1;i<n;i++)
#define rep0(i,n) for(i=0;i<n;i++)
#define rep(i,a,n) for(i=a;i<n;i++)
#define repe1(i,n) for(i=1;i<=n;i++)
#define repe0(i,n) for(i=0;i<=n;i++)
#define repe(i,a,n) for(i=a;i<=n;i++)
#define endl  "\n"
#define FAST  ios_base::sync_with_stdio(false);cin.tie(NULL);
#define fr freopen("input.txt","r",stdin)
#define fw freopen("output.txt","w",stdout)

int main()
{
    ll i,n,t,k,j,x=0,y=0,m;
    string str;
    cin>>str;
    if(str[2]==str[3] && str[5]==str[4])
        cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}



Measured memory_bytes: 256
#!/usr/bin/python
# -*- coding: UTF-8 -*-

import sys


def get_ints():
    return map(int, sys.stdin.readline().strip().split())


def std_in():
    return sys.stdin.readline().strip()


def main():
    n = int(std_in())
    l = list(get_ints())
    c = 0

    for i in range(n):
        for j in range(i+1, n):
            for k in range(j+1, n):
                if l[i] != l[j] and l[j] != l[k]:
                    s = {l[i], l[j], l[k]}
                    L = [l[i], l[j], l[k]]
                    L.sort()
                    if len(s) == 3:
                        if L[-1] < L[0] + L[1]:
                            c += 1
    print(c)


if __name__ == "__main__":
    main()


Measured memory_bytes: 9212
#include <bits/stdc++.h>
#define rep(i, end) for (long long int i=0; i<end; i++)
#define repp(i, begin, end) for (long long int i=begin; i<end; i+)
#define srt(x) sort((x).begin(), (x).end());
#define rsrt(x) sort((x).rbegin(), (x).rend());
#define deb(x) cout<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<<endl;
using namespace std;
using ll = long long int;
using vi = vector<int>;
using vll = vector<long long int>;
using vs = vector<string>;
ll sm(vll x) {ll sum=0; rep(i, x.size()) sum+=x[i]; return sum;}
void vdeb(string s, vector<int> x) {cout<<s<<" = { "; rep(i, x.size()) cout<<x[i]<<' '; cout <<'}'<<endl;}
//=======================================================================================================

int main()
{
    ll n;
    cin >> n;
    vll d(n);
    rep(i, n) cin >> d[i];

    srt(d);
    ll ans = d[d.size() / 2] - d[d.size() / 2 - 1];
    if(d[d.size() / 2] == d[d.size() / 2 - 1]) ans = 0;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner stdIn = new Scanner(System.in);
		int x = stdIn.nextInt();
		int y = stdIn.nextInt();
		
		if (x < y) {
			if(x==0)
				System.out.println(y);
			if(y==0)
				System.out.println(-x);
			if (x > 0 || y < 0)
				System.out.println(y - x);
			if (x < 0 && y > 0) {
				if ((-x) >= y){
					System.out.println(-x-y+1);
				}
				else
					System.out.println(x+y+1);
			}
		}
		if (y<x) {
			if(x==0)
				System.out.println(1-y);
			if(y==0)
				System.out.println(1+x);
			if (y >0 || x < 0)
				System.out.println(2+x-y);
			if (y < 0 && x > 0) {
				if ((-y) >= x)
					System.out.println(1-x - y);
				else
					System.out.println(1 + x +y);
			}
		}

	}
}


Measured memory_bytes: 9044
/*
ID: amagica1
TASK: ariprog
LANG: C++
*/
#include <bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
#define NINF -INF
#define mp make_pair
#define boost() cin.tie(0); cin.sync_with_stdio(0)
#define For(i, a, b) for(int i=a; i<b; i++)
#define FOR(i, a, b) for(int i=a; i<=b; i++)
#define Rev(i, a, b) for(int i=a; i>b; i--)
#define REV(i, a, b) for(int i=a; i>=b; i--)
typedef long long ll;
typedef long double ld;
typedef int64_t l;
typedef pair<int, int> pii;
typedef pair<int, ll> pil;
typedef pair<ll, ll> pll;
const ll MOD = 1e9 + 7;
const int MAXN = 100005;
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a*b/gcd(a,b);}
ll fpow(ll  b, ll exp, ll mod){if(exp == 0) return 1;ll t = fpow(b,exp/2,mod);if(exp&1) return t*t%mod*b%mod;return t*t%mod;}
ll divmod(ll i, ll j, ll mod){i%=mod,j%=mod;return i*fpow(j,mod-2,mod)%mod;}
ll choose(ll n) {return n*(n-1)/2;}
ll BIT[64][3*MAXN]; int N;
void upd(int idx, int x) {
    for(int i=x; i<3*MAXN; i+=i&-i)
        BIT[idx][i] = BIT[idx][i] % MOD + 1 % MOD;
}
ll sum(int idx, int x) {
    ll sum=0;
    for(int i=x; i>0; i-=i&-i)
        sum = sum % MOD + BIT[idx][i] % MOD;
    return sum % MOD;
}

int main() {
    //-----------FILE------------//
    // freopen("ariprog.in", "r", stdin);
    // freopen("ariprog.out", "w", stdout);
    //----------------------------//
    scanf("%d", &N);
    for(int i=1; i<=N; i++) {
        ll x; scanf("%lld", &x);
        for(ll j=0; j<62; j++) {
            if(((x>>j)&1)) upd(j, i);
        }
    }
    ll ans=0;
    for(ll i=0; i<62; i++) {
        ll numOfOnes = (sum(i, N) - sum(i, 0)) % MOD, numZeroes = (N-numOfOnes) % MOD;
        ans = (ans % MOD + numOfOnes % MOD * numZeroes % MOD * ((1L<<i) % MOD)) % MOD;
    }
    printf("%lld\n", ans % MOD);
}


Measured memory_bytes: 141568
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
    public static void main(String[] args) {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));
        int n;
        String aLine = "";
        try {
            n = Integer.parseInt(bufferedReader.readLine());
            aLine = bufferedReader.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }

        String[] aStringArray = aLine.split(" ");
        int[] aIntArray = convertStringArray(aStringArray);

        int divided = 0;
        while (!isInCludedOddNumber(aIntArray)) {
            for (int i = 0; i < aIntArray.length; i++) {
                aIntArray[i] /= 2;
            }
            divided++;
        }

        System.out.println(divided);
    }

    private static boolean isInCludedOddNumber(int[] array) {
        for (int i : array) {
            if (i % 2 != 0) {
                return true;
            }
        }
        return false;
    }

    private static int[] convertStringArray(String[] array) {
        int[] aIntArray = new int[array.length];
        for (int i = 0; i < aIntArray.length; i++) {
            aIntArray[i] = Integer.parseInt(array[i]);
        }
        return aIntArray;
    }
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;
  vector<int> T(100);
  for (int i = A; i < B; i++) {
    T.at(i) = 1;
  }
  for (int i = C; i < D; i++) {
    T.at(i) += 1;
  }
  int ans;
  for (int i = 0; i < 100; i++) {
    if (T.at(i) == 2) ans++;
  }
  cout << ans << endl;
}


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

int main()
{
    char s[4];
    int a=0;
    cin >> s ;
    for(int i=0;i<4;i++){
        if(s[i]=='+'){
            a+=1;
        }else{
            a-=1;
        }
    }
    cout << a << endl ;
    return 0;
}

Measured memory_bytes: 256
# coding:utf-8

import sys
from collections import defaultdict

INF = float('inf')
MOD = 10 ** 9 + 7

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x) - 1 for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def SI(): return input()


n = I()

prime_cnt = defaultdict(int)
for num in range(2, n + 1):
    i = 2
    while i * i <= num:
        if num % i == 0:
            cnt = 0
            while num % i == 0:
                cnt += 1
                num //= i
            prime_cnt[i] += cnt
        i += 1

    if num != 1:
        # nに素数が残っている場合処理をする
        prime_cnt[num] += 1

ans = 1
for v in prime_cnt.values():
    ans *= v + 1
    ans %= MOD

print(ans)


Measured memory_bytes: 3444
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
using namespace std;

int main(void)
{
    int A, B;

    scanf("%d %d", &A, &B);

    printf("%d\n", B % A ? B - A : A + B);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n,N) for(int i=(n);i<(int)N;i++)
#define p(s) cout<<(s)<<endl
#define ck(n,a,b) (a)<=(n)&&(n)<(b)
typedef long long ll;
using namespace std;
const int inf=1e9;

int main(){
	int N,T;
	cin>>N>>T;
	int time[200020];
	ll ans=0,tmp=0;
	cin>>time[0];
	REP(i,1,N) {
		cin>>time[i];
		if(time[i]>time[i-1]+T){
			ans+=time[i-1]+T-tmp;
			tmp=time[i];

		}
	}
	ans+=time[N-1]+T-tmp;
	p(ans);
	return 0;
}


Measured memory_bytes: 1024
//#typedef int ll
// include
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <tuple>
// namespace
using namespace std;
// typedef
typedef long long ll;
typedef long double ld;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef pair<int, int> pint;
// const
const int inf = 1e9;
const int mod = ((int)1e9 + 7);
// loop
#define rep(i, n) for(int i = 0, i##_mx = n; i < i##_mx; i++)
#define brep(i, b, e) for(int i = b; i < e; i++)
#define erep(i, b, e) for(int i = b; i <= e; i++)
#define rrep(i, b, e) for(int i = b; i >= e; i--)
// STL
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
// function
ll gcd(ll a, ll b){return b ? gcd(b, a % b) : a;}
ll lcm(ll a, ll b){return a * b / gcd(a, b);}
void prime(vint& v, int n){brep(i, 2, n){bool fg = false; for(auto e : v){if(i % e == 0){fg = true;}} if(fg){continue;} v.pb(i);}}
void in(vint& v){for(auto& i : v){cin >> i;}}
void in(vll& v){for(auto& i : v){cin >> i;}}

signed main(){
    int n, k;
    cin >> n >> k;
    
    if(k > (n - 1) * (n - 2) / 2){
        cout << -1 << endl;
        return 0;
    }
    
    int m = n - 1 + (n - 1) * (n - 2) / 2 - k;
    
    cout << m << endl;
    
    int cnt = 0;
    int i = 1;
    int j = 2;
    while(1){
        cout << i << " " << j << endl;
        cnt++;
        if(cnt == m){
            break;
        }
        if(j >= n){
            i++;
            j = i + 1;
        }else{
            j++;
        }
    }
	
	return 0;
}


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

// #undef DEBUG
//#define DEBUG
/// {{{ DEBUG --- ///
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
#ifdef DEBUG
#define dump(...) cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n";
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream & os, tuple<T...> const & t){ _ot<0>(os, t); return os; }
#else
#define dump(...)
#endif
/// }}}--- ///

#define uniq(v) {sort(begin(v), end(v)); (v).erase(unique(begin(v), end(v)), end(v)); }
const int N = 1e5;
vector<int> g[N];

vector<int> v;
int used[N];
int dfs(int i) {
  used[i] = 1;
  v.emplace_back(i);
  for(int j : g[i]) if(!used[j]) {
    dfs(j);
  }
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n, m; cin >> n >> m;
  int p[N];
  for(int i =0; i < n;i ++) {
    int a; cin >> a;
    a--;
    p[a] = i;
  }
  for(int i = 0; i < m; i++) {
    int a, b;cin >>a>>b;a--;b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  ll ans = 0;
  for(int i=0;i < n;i++) if(!used[i]) {
    v.clear();
    dfs(i);
    sort(begin(v), end(v));
    vector<int> vv;
    for(size_t i = 0; i < v.size(); i++) vv.emplace_back(p[v[i]]);
    v.insert(begin(v), begin(vv), end(vv));
    int t = v.size();
    uniq(v);
    ans += t - v.size();
  }
  cout << ans << endl;
}


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

using namespace std;

using ll = int64_t;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = 2147483647;
constexpr ll L_INF = 9223372036854775807LL;

//===


// Z-algorithm
// string Sに対して、各iについてSとS[i:|S|]の「最長共通接頭辞の長さ」を記録した配列Aを作成する
std::vector<int> z_algorithm(const std::string& s)
{
	int sl = static_cast<int>(s.size());
	std::vector<int> res(sl);
	res[0] = sl;
	int i = 1, j = 0;
	while (i < sl) {
		while (i + j < sl && s[j] == s[i + j]) ++j;
		res[i] = j;
		if (j == 0) { ++i; continue; }
		int k = 1;
		while (i + k < sl && k + res[k] < j) {
			res[i + k] = res[k];
			++k;
		}
		i += k; j -= k;
	}
	return res;
}



int main()
{
	int N;
	string S;
	cin >> N;
	cin >> S;

	int sl = static_cast<int>(S.size());
	int ans = 0;
	for (int i = 0; i < sl; ++i) {
		Vi lcpv = z_algorithm(S.substr(i, sl - i));
		for (int j = 0; j < sl - i; ++j) {
			ans = max(ans, min(lcpv[j], j));
		}
	}

	cout << ans << endl;

	return 0;
}

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

int main() {
    int N, M;
    cin >> N >> M;
    string S = "";
    for(int i = 0; i < N; i++) {
        if(i == 0) {
            S += "1";
        } else {
            S += "0";
        }
    }
    pair<int, int> sc[M];
    vector<bool> change(M, false);
    for(int i = 0; i < M; i++) {
        int a, b;
        cin >> a >> b;
        sc[i] = make_pair(a, b);
    }
    int ans = 0;
    if(M == 0) {
        if(N == 1) {
            cout << 0 << endl;
        } else {
            cout << stoi(S) << endl;
        }
        return 0;
    }
    for(int i = 0; i < M; i++) {
        int index = sc[i].first-1;
        int value = sc[i].second;
        if(change[index] == false) {
            S[index] = value+'0';
            change[index] = true;
        } else if(change[index] == true && S[index] == value+'0') {
            continue;
        } else {
            ans = -1;
        }
    }
    if(S[0] == '0' && S.size() != 1) {
        ans = -1;
    }
    if(ans != -1) {
        ans = stoi(S);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
def binary_search(c1, c2):
    m = (c1 + c2 + 1) // 2
    if abs(c1 - c2) <= 1:
        return m
    else:
        cnt = 0
        for i in a:
            cnt += (i - 1) // m
        #print(cnt, m)
        if cnt <= k:
            c2 = m
        else:
            c1 = m
        return binary_search(c1, c2)

n, k = map(int, input().split())
a = list(map(int, input().split()))
x = binary_search(0, 10 ** 9)
for i in range(x + 5, max(x - 5, 0), -1):
    cnt = 0
    for j in a:
        cnt += (j - 1) // i
    if cnt <= k:
        ans = i
print(ans if not k == 0 else max(a))

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

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

class union_find {
public:
  vector<int> rank, par;

  union_find(){};
  union_find(int size) {
    par.resize(size, 0);
    rank.resize(size, 0);
    init(size);
  }

  void init(int size) {
    for (int i = 0; i < size; i++) {
      par[i] = i;
      rank[i] = 0;
    }
  }

  bool same(int x, int y) { return root(x) == root(y); }

  void unite(int x, int y) {
    x = root(x);
    y = root(y);
    if (x == y) {
      return;
    }

    if (rank[x] > rank[y]) {
      par[y] = x;
    }
    else {
      par[x] = y;
      if (rank[x] == rank[y]) {
        rank[y]++;
      }
    }
  }

  int root(int x) {
    if (x == par[x]) {
      return par[x];
    }
    else {
      return par[x] = root(par[x]);
    }
  }
};

int n, k, l;
vector<int> p, q, r, s;

void abc049d() {
  union_find road = union_find(n + 1), rail = union_find(n + 1);

  for (int i = 0; i < k; i++) {
    road.unite(p[i], q[i]);
  }
  for (int i = 0; i < l; i++) {
    rail.unite(r[i], s[i]);
  }

  map<pair<int, int>, int> mp;
  for (int i = 1; i <= n; i++) {
    int root1 = road.root(i), root2 = rail.root(i);
    mp[make_pair(root1, root2)]++;
  }

  for (int i = 1; i <= n; i++) {
    int root1 = road.root(i), root2 = rail.root(i);
    cout << mp[make_pair(root1, root2)] << ' ';
    if (i == n) {
      cout << '\n';
    }
  }
}

int main() {
  cin >> n >> k >> l;
  p.resize(k);
  q.resize(k);
  r.resize(l);
  s.resize(l);
  for (int i = 0; i < k; i++) {
    cin >> p[i] >> q[i];
  }
  for (int i = 0; i < l; i++) {
    cin >> r[i] >> s[i];
  }

  abc049d();
  return 0;
}

Measured memory_bytes: 16640
#include <vector>
#include <list>
#include <map>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <cstdio>
#include <climits>
#include <complex>
#include <cstdint>
#include <tuple>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }
inline int readInt() { int x; scanf("%d", &x); return x; }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define SQ(a) ((a)*(a))
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,s,n) for(int i=s;i<(int)n;++i)
#define REP(i,n) FOR(i,0,n)
#define MOD 1000000007

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()

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

int N;

int p[11];
vector<vector<int>> v(15);
int main() {
    //cout << fixed << setprecision(15);

    int M; cin >> N >> M;

    REP(i, M){
        int k; cin >> k;
        REP(j, k){
            int p; cin >> p;
            p--;
            v[i].push_back(p);
        }
    }

    REP(i, M){
        cin >> p[i];
    }

    int ans = 0;
    for(int bit=0; bit<(1<<N); ++bit){

        bool arr[15];
        for(int i=0; i<15; ++i) arr[i] = false;
        for(int i=0; i<N; ++i){
            if(bit >> i & 1){
                arr[i] = true;
            }
        }

        int cnt2=0;
        for(int i=0; i<M; ++i){
            int cnt = 0;
            for(int j=0; j<v[i].size(); ++j){
                if(arr[v[i][j]]) cnt++;
            }
            if(cnt%2 == p[i]) cnt2++;
        }
        if(cnt2 == M) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <vector>
#include <cmath>
#include <algorithm>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <tuple>
#include <unordered_set>
#include <unordered_map>
#include <functional>
#include <cassert>
#include <boost/multiprecision/cpp_int.hpp>
#define repeat(i,n) for (int i = 0; (i) < (n); ++(i))
#define whole(f,x,...) ([&](decltype((x)) y) { return (f)(begin(y), end(y), ## __VA_ARGS__); })(x)
typedef long long ll;
typedef boost::multiprecision::cpp_int integer;
using namespace std;
 
vector<int> sieve_of_eratosthenes(int n) { // enumerate primes in [2,n] with O(n log log n)
    vector<bool> is_prime(n+1, true);
    is_prime[0] = is_prime[1] = false;
    for (int i = 2; i*i <= n; ++i)
        if (is_prime[i])
            for (int k = i+i; k <= n; k += i)
                is_prime[k] = false;
    vector<int> primes;
    for (int i = 2; i <= n; ++i)
        if (is_prime[i])
            primes.push_back(i);
    return primes;
}
integer sq(integer x) { return x*x; }
integer cubed(integer x) { return x*x*x; }
integer norm(integer s, vector<int> const & primes) {
    for (int p : primes) {
        if (s < p) break;
        while (s % cubed(p) == 0) {
            s /= cubed(p);
        }
    }
    assert (s >= 1);
    return s;
}
integer inv(integer s, vector<int> const & primes) {
    integer t = 1;
    for (int p : primes) {
        if (s % p == 0) {
            if (s % sq(p) == 0) {
                t *= p;
                s /= sq(p);
            } else {
                t *= sq(p);
                s /= p;
            }
        }
    }
    if (s != 1) {
        integer r = sqrt(s);
        if (s == r * r) {
            t *= r;
        } else {
            t *= s * s;
        }
    }
    assert (t >= 1);
    return t;
}
 
int main() {
    // input
    int n; scanf("%d", &n);
    vector<ll> s(n); repeat (i,n) scanf("%lld", &s[i]);
    // compute
    vector<int> primes = sieve_of_eratosthenes(pow(*whole(max_element, s), 1/3.) + 3);
    map<integer, int> f;
    repeat (i,n) {
        integer x = norm(s[i], primes);
        f[x] += 1;
    }
    int ans = 0;
    set<integer> used;
    for (auto it : f) {
        integer x; int cnt; tie(x, cnt) = it;
        if (used.count(x)) continue;
        integer y = inv(x, primes);
        if (f.count(y)) {
            used.insert(y);
            ans += max(cnt, f[y]);
        } else {
            ans += cnt;
        }
    }
    if (f.count(1)) {
        ans -= f[1];
        ans += 1;
    }
    // output
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 12416
#include <iostream>

using namespace std;
int dp[100005];
int v[301];
int main()
{
    int i,n,k;
    cin >> n >> k;
    for(i = 1; i <= n; i++)
    {
        cin >> v[i];

    }
    for(int x = 0;x <= k;x++)
    {
        for(i = 1;i <= n;i++){
            if(x >= v[i] && dp[x - v[i]] == false)
                dp[x]  =true;
        }
    }
    if(dp[k])
        cout << "First";
    else
        cout << "Second";
    return 0;
}


Measured memory_bytes: 640
def main():
    s=input()
    tmp = 0
    cnt = 0
    for i in s:
        if i =='A' or i == 'T' or i =='C' or i=='G':
            cnt +=1
        else:
            if tmp <= cnt:
                tmp = cnt
                cnt = 0
            else:
                cnt = 0

    print(max(tmp,cnt))

if __name__ == '__main__':
    main()


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

int main(){
    int h , w ;
    cin >> h >> w;

    string blank ;
    for ( int i = 0; i < w + 2; i++)
    {
     blank +=".";
    }

    string str = blank;

    for (int i = 0; i < h ; i++)
    {
        string s ;
        cin >> s ;
        str += "."+ s + ".";
        //strin =  "."+ s + ".";
        //cout << strin << endl;
    }
    //cout << blank << endl;

     str += blank;
     //cout << str << endl;
    for (int  i = 0; i < h; i++)
    {
        string yokoretu;
        for (int j = 0; j < w; j++)
        {
            if(str.at((w+2)*(i+1) + j+1 )== '#'){
                yokoretu += "#";
            }
            else{
                string what_does_exist ;
                what_does_exist = str.substr((w+2)*(i) + j,3)+
                                str.substr((w+2)*(i+1) + j,1)+str.substr((w+2)*(i+1) + j+2,1)+ 
                                str.substr((w+2)*(i+2) + j,3);
                //cout << "what does exist" <<  what_does_exist << endl;
                int how_many_bomb = 0;
                for (int k = 0; k < 8; k++)
                {
                    if(what_does_exist.at(k) == '#'){
                        how_many_bomb ++;
                    }
                }
                //cout << "how many bomb" << how_many_bomb << endl;
                

                yokoretu += to_string(how_many_bomb);   
            }
        }
        cout << yokoretu << endl;
        
    }
    

}






















Measured memory_bytes: 3700
# -*- coding: utf-8 -*-
# 標準入力の取得
K = int(input())
A,B = list(map(int, input().split()))

# 求解処理
min_value = K * (A // K)
if min_value < A:
    min_value += K
result = ""
if min_value <= B:
    result = "OK"
else:
    result = "NG"

# 結果出力
print(result)

Measured memory_bytes: 9176
/**
 * Author: Behradm
 * Created: 04-04-2020 16:26:55
**/
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef vector<int> vi;

#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())

#ifdef LOCAL
	#define debugi(x) cerr << "{" << #x << "}: " << (x) << '\n'
	#define debug(v, begin, end) cerr << "{ | "; for(auto i = begin; i < end; i++){cerr << #v << "[" << i << "]: " << v[i] << " | ";} cerr << " }\n"
	#define debugp(a, b) cerr << "\n{ " << a << " " << b << " }\n"
#else
	#define debugi(x) 42
	#define debug(v, begin, end) 42
	#define debugp(a, b) 42 
#endif

int32_t main()
{
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cout.precision(6);
	cout << fixed;
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << '\n';
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define printVec(v) printf("{"); for (const auto& i : v) { std::cout << i << ", "; } printf("}\n");
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; }
using namespace std;
using P = pair<int,int>;
using ll = long long;
const ll INF = 1LL<<60;
const double PI = 3.1415926535897932;
const int MOD = 1e9 + 7;

//cin.tie(0);ios::sync_with_stdio(false);
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  rep(i, n) cin >> a[i];

  int maxn = *max_element(a.begin(), a.end());

  ll dis = INF;
  ll ans;
  for (int i = 0; i < n; i++) {
    if (a[i] == maxn) continue;
    int x = maxn - a[i];
    if (dis > abs(a[i] - x)) {
      dis = abs(a[i] - x);
      ans = a[i];
    }
  }

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


Measured memory_bytes: 3704
n=int(input())
x=n/1.08
int_x=int(x)
if x-int_x==0:
    print(int_x)
else:
    if int(int_x*1.08)==n:
        print(int_x)
    elif int((int_x+1)*1.08)==n:
        print(int_x+1)
    else:
        print(':(')

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

ll a, b, c, x ,y;
ll k, ans;

int main() {
  cin >> a >> b >> c >> x >> y;
  ans = 0;
  if (a + b >= 2 * c) {
    k = min(x, y);
    x -= k; y -= k;
    ans += 2 * k * c;
  }
  if (a >= 2 * c) {
    ans += 2 * c * x;
    x = 0;
  }
  if (b >= 2 * c) {
    ans += 2 * c * y;
    y = 0;
  }
  ans += x * a + y * b;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3592
#include <stdio.h>
int main()
{
    int a,b,c,sum;
    scanf("%d%d%d",&a,&b,&c);
    if(a+c<a+b && a+c<b+c)
    {
        sum=a+c;
    }
    else if(a+c>a+b && a+b<b+c)
    {
        sum=a+b;
    }
    else
    {
        sum=b+c;
    }
    printf("%d\n",sum);
    return 0;
}

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

using namespace std;
using ll = long long;
using pint = pair<int, int>;

int main() {
	int N, L;
	cin >> N >> L;

	vector<string> S(N);
	for (int i = 0; i < N; ++i) {
		cin >> S[i];
	}

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

	string ans = "";
	for (int i = 0; i < N; ++i) {
		ans += S[i];
	}

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


Measured memory_bytes: 3552
#include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < n; i++)
#define vv(T) vector<vector<T>>
using namespace std;
using ll = long long;
using vint = vector<int>;
using vvint = vector<vector<int>>;
using vll = vector<long long>;
using vvll = vector<vector<long long>>;
using vbool = vector<bool>;
using vvbool = vector<vector<bool>>;


int main(){
    ll h, w;
    cin >> h >> w;
    ll ans;
    ans = (h * w) + 1;
    ans /= 2;
    if(h == 1 || w == 1) ans = 1;
    cout << ans << endl;
    return 0;
}


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

const int MAX_N = 123500;
bool notPrime[2 * MAX_N];
int acum[2 * MAX_N];

int main() {
    // init
    notPrime[0] = notPrime[1] = true;
    for (int i = 2; i * 2 < 2 * MAX_N; ++i) {
        if (!notPrime[i]) {
            for (int j = i * 2; j < 2 * MAX_N; j += i) {
                notPrime[j] = true;
            }
        }
    }
    for (int i = 0; i < 2 * MAX_N; ++i) {
        if (!notPrime[i]) ++acum[i];
    }
    for (int i = 1; i < 2 * MAX_N; ++i) {
        acum[i] += acum[i - 1];
    }

    while (true) {
        int n;
        cin >> n;
        if (n == 0) break;
        cout << acum[2 * n] - acum[n] << endl;
    }
    return 0;
}


Measured memory_bytes: 4212
#include<bits/stdc++.h>
const int N=5e5+9;
using namespace std;
char s[N];
int a[N],n,f[N],pre[N];
int main()
{
	scanf("%d",&n);
	scanf("%s",s+1);
	for(int i=1;i<=n;++i) a[i]=s[i]-'0';
	
	int last=0;
	for(int i=1;i<=n;++i) 
	{
	   pre[i]=last;
	   if(a[i]==0) last=i;
	}
	for(int i=1;i<=n;++i)
	{
	  f[i]=0;
	  if(a[i]==0)     f[i]=f[i-1];
	  else
	   {
	     last=pre[i];
		 if(last==0) f[i]=0;
		 else 
		 {
		 	if(a[last-1]==1)
		 	{
		 	 f[i]=f[last-2]+i-last;
		 	 f[i]=max(f[i],f[pre[last]]+last-pre[last]-1);
		     f[i]=max(f[i],f[pre[last]+1]+last-pre[last]-2);
		    }
		    f[i]=max(f[i],f[i-1]);
		 }	
	   } 
	}
	int ans=f[n];
	cout<<ans<<endl;
	return 0;
}
/*
10
0011011101
*/ 

Measured memory_bytes: 6656
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9+5;
int arr[1000000];

int main() {
    int n, k;
    cin >> n >> k;
    for(int i = 0; i < n; i++) {
        cin >> arr[i];
    }
    vector<int> dp(n, INF);
    dp[0]=0;
    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            if(i + j < n) {
                dp[i+j]=min(dp[i+j], dp[i] + abs(arr[i] - arr[i + j]));
            }
        }
    }
   // for(int i = 0; i < n; i++) cout << dp[i] << " ";
    //cout << endl;
    cout << dp[n-1] << endl;
    return 0;
}

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

using namespace std;

int N, C;
vector<int> colors = vector<int>(3, 0);
int ans = 1e9;

vector<vector<int>> dp;

void dfs(int idx) {
  if (idx == 3) {
    int sum = dp[0][colors[0]] + dp[1][colors[1]] + dp[2][colors[2]];
    if (ans > sum) ans = sum;
    return;
  }
  for (int i = 1; i <= C; i++) {
    bool b = true;
    for (int j = 0; j < idx; j++)
      if (i == colors[j]) b = false;
    if (!b) continue;
    colors[idx] = i;
    dfs(idx + 1);
  }
}

int main() {
  cin >> N >> C;
  auto D = vector<vector<int>>(C + 1, vector<int>(C + 1, 0));
  auto board = vector<vector<int>>(N + 1, vector<int>(N + 1, 0));
  for (int i = 1; i <= C; i++)
  	for (int j = 1; j <= C; j++)
      cin >> D[i][j]; // (y, x)
  for (int i = 1; i <= N; i++)
    for (int j = 1; j <= N; j++)
      cin >> board[i][j];
  dp = vector<vector<int>>(3, vector<int>(C + 1, 0));
  for (int j = 1; j <= C; j++)
    for (int k = 1; k <= N; k++)
      for (int l = 1; l <= N; l++)
        if (board[k][l] != j) dp[(k + l) % 3][j] += D[board[k][l]][j];
  dfs(0);
  cout << ans << endl;
  return 0;
}

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


int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	cin >> n >> k;
	string S;
	cin >> S;//S.size() = n
	int res = 0;
	rep(i, n - 1) {
		if (S[i] == S[i + 1]) res++;
	}
	int ans = min(res + 2 * k, n - 1);
	cout << ans << endl;
	return 0;
}

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

def bellman_ford(N: int, edges: list, src: int) -> list:
    """ ベルマンフォード(頂点数, 辺集合(0-indexed), 始点) """

    # 頂点[ある始点からの最短距離] (経路自体を知りたい時はここに前の頂点も持たせる)
    res = [INF] * N
    res[src] = 0
    # 各辺によるコストの置き換えを頂点数N-1回繰り返す
    for _ in range(N-1):
        for u, v, cost in edges:
            # INFからは更新しない
            if res[u] == INF:
                continue
            if res[v] > res[u] + cost:
                res[v] = res[u] + cost
    tmp = res[:]
    # 負の閉路(いくらでもコストを減らせてしまう場所)がないかチェックする
    for _ in range(N-1):
        for u, v, cost in edges:
            if res[u] == INF:
                continue
            if res[v] > res[u] + cost:
                # 検出した負閉路はすぐに-INFにする
                res[v] = -INF
    for i in range(N):
        if tmp[i] != res[i]:
            res[i] = -INF
    return res

N, M = MAP()
edges = []
for i in range(M):
    a, b, c = MAP()
    a -= 1; b -= 1
    edges.append((a, b, -c))

res = bellman_ford(N, edges, 0)

if res[N-1] != -INF:
    print(-res[N-1])
else:
    print('inf')


Measured memory_bytes: 3444
#include<iostream>
#include<string>
using namespace std;
int main(){
    string a,b,c;
    cin>>a>>b>>c;
    int e1=a.size()-1,e2=b.size()-1;
    if(a[e1]==b[0]&&b[e2]==c[0])cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
}

Measured memory_bytes: 256
// #pragma GCC optimize(“O2”)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include<bitset>
using namespace std;
#define pi 3.14159265358979323846264338327950254
 #define STDIN freopen("in.txt","r",stdin); freopen("out.txt","w",stdout);//************************************


using namespace std;

typedef long long LL;
typedef long long ll;

const int N = 300010, mod = 1e9 + 7;


int fact[N], infact[N];


int qmi(int a, int k, int p)
{
    int res = 1;
    while (k)
    {
        if (k & 1) res = (LL)res * a % p;
        a = (LL)a * a % p;
        k >>= 1;
    }
    return res;
}

ll pre[N];
int main()
{
    
    

    int a, b;
    scanf("%d%d", &a, &b);
    for (int i = 1; i <= a+1; i++)
    {
        pre[i] += pre[i-1] + i-1;
    }
    ll sum = 0;
    for (int i = b; i <= a + 1; i++)
    {
        sum = (pre[a+1]-pre[a-i+1]-pre[i] +1 + sum)% mod;
    }
    cout << sum << endl;

    return 0;
}


Measured memory_bytes: 5208
#include<bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;

int main(){
  int N, T, A;
  int ans = INF;
  int res;
  cin >> N;
  cin >> T >> A;

  for (int i=0; i<N; i++) {
    int h;
    cin >> h;
    float tmp = 1000*T - 6*h;
    if (abs(tmp-1000*A) < abs(ans-1000*A)) {
      ans = tmp;
      res = i+1;
    }
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, M;
  cin >> N >> M;
  if (N == 0) {
    N = 1;
  } else if (M == 0) {
    M = 1;
  }
  cout << N * (N - 1) / 2 + M * (M - 1) / 2 << endl;
  return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    N = int(input())
    S = input()

    result = 0
    for i in range(1000):
        password = str(i).zfill(3)

        cur = 0
        for c in S:
            if password[cur] == c:
                cur += 1
            if cur == 3:
                result += 1
                break

    print(result)


Measured memory_bytes: 41180
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
constexpr long long INF = (long long)1e18 * 4 + 10;

int main(){
  int T; cin >> T;
  rep(t, T) {
    long long N; cin >> N;
    long long A, B, C, D; cin >> A >> B >> C >> D;
    map<long long, int> mp;
    priority_queue<pair<long long, long long>,
                   vector<pair<long long, long long>>,
                   greater<pair<long long, long long>>>
        q;

    q.emplace(0, N);
    long long ans = INF;
    while (!q.empty()) {
      long long used, now;
      if (ans <= used) break;
      tie(used, now) = q.top(); q.pop();
      if (mp[now] == 1) continue;

      if (now < INF / D) ans = min(ans, used + D * now);

      mp[now] = 1;
      if (now % 2 == 1) {
        q.emplace(used + A + D, now / 2);
        q.emplace(used + A + D, now / 2 + 1);
      } else {
        q.emplace(used + A, now / 2);
      }
      int num = min(now % 3, 3 - (now % 3));
      q.emplace(used + B + D * num, (now + 1) / 3);
      num = min(now % 5, 5 - (now % 5));
      q.emplace(used + C + D * num, (now + 2) / 5);
    }

    cout << ans << endl;
  }
}


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

int main()
{
  int n, x[100], y[100];
  cin >> n;
  for (int i = 0; i < n; i++)
    cin >> x[i] >> y[i];

  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (atan2(y[i], x[i]) > atan2(y[j], x[j]))
      {
        swap(x[i], x[j]);
        swap(y[i], y[j]);
      }

  long long ans = 0;
  for (int i = 0; i < n; i++)
  {
    int sumX = 0, sumY = 0;
    for (int j = 0; j < n; j++)
    {
      sumX += x[(i + j) % n];
      sumY += y[(i + j) % n];
      ans = max(ans, 1LL * sumX * sumX + 1LL * sumY * sumY);
    }
  }

  cout << fixed << setprecision(12) << sqrt(ans) << endl;
}


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

long long N, K;

double cal(long long first_point) {
	long long cur = first_point;
	double prob = 1;
	while(cur < K){
		cur *= 2;
		prob *= 0.5;
	}
	return prob;
}

int main(){
	cin >> N >> K;
	double prob = 0;
	for(int i = 1; i <= N; i++){
		prob += cal(i);
	}
	printf("%.10f\n", prob/N);
}

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

int main(){
    
    ll n;
    cin>>n;
    ll arr[n];
    for(ll i=0;i<n;i++)
        cin>>arr[i];
    
    if(n==1) {
        cout<<"0"<<endl;
        return 0;
    }
    ll cnt=0;
    ll maxi=arr[0];
    for(ll i=1;i<n;i++)
    {
        if(arr[i]<maxi){
            cnt+=(maxi-arr[i]);
        }else{
            maxi=arr[i];
        }
    }

    cout<<cnt<<endl;
    return 0;
}

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

int main()
{
  int a, b, t;
  cin >> a >> b >> t;

  int total = 0;
  for(int i = a; ; i+=a){
    if(i > t) break;

    total += b;

  }

  cout << total << endl;

  return 0;

}


Measured memory_bytes: 256
#define _USE_MAT_DEFINES
#include<iostream>
#include <iomanip>
#include<stdio.h>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include <queue>
#include <utility>
#include <map>
#include <set>
#include <deque>
#include <numeric>
#include <functional>
using namespace std;

int main() {
    long long N, x, ans = 0;
    cin >> N >> x;
    vector<long long>a(N);
    for (int i = 0; i < N; i++) {
        long long n;
        cin >> n;
        if (n > x) {
            ans += n - x;
            a[i] = x;
        }
        else a[i] = n;
    }

    for (int i = 1; i < N; i++) {
        long long sum = a[i - 1] + a[i];
        if (sum > x) {
            ans += sum - x;
            a[i] -= sum - x;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
using Map = map<string,ll>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;


int main(){
    ll N;
    cin >> N;
    ll K;
    cin >> K;
    vector<ll> v(N+1,0);
    for(ll i=0;i<N;i++){
        cin>>v[i+1]   
    ;}
    ll ans=0;
    for(ll i=0;i<=N;i++){
        for(ll j=0;i+j<=K&&i+j<=N;j++){
            priority_queue<ll, vector<ll>, greater<ll>> pq;
            ll sum=0;
            for(ll k=1;k<=i;k++){
                pq.push(v[k]);
                sum+=v[k];
            ;}
            for(ll k=N-j+1;k<=N;k++){
                pq.push(v[k]);
                sum+=v[k];
            ;}
            ll count=K-i-j;
            while(pq.size()&&pq.top()<0&&count>0){
                sum-=pq.top();
                pq.pop();
                count--;
            }
            ans=max(ans,sum);
        ;}
    ;}
    cout<<ans<<endl;
    return 0;
}


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

int main(){
    while (1){
        int n;
        cin >> n;
        if (!n) break;
        vector<int> a(n);
        for (int i = 0; i < n; i++) cin >> a[i];
        double avr = 0;
        for (int i = 0; i < n; i++) avr += a[i];
        avr /= n;
        int ans = 0;
        for (int i = 0; i < n; i++){
            if (a[i] <= avr) ans++;
        }
        cout << ans << endl;
    }
}


Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
 
int main(){
  int i,j,cnt=INT_MAX;
  int x,y;
  cin>>x>>y;
  //符号の反転を全部試す
  if(x<=y)cnt=y-x;
  if(-x<=y)cnt=min(cnt,1+x+y);
  if(x<=-y)cnt=min(cnt,1-x-y);
  if(-x<=-y)cnt=min(cnt,2+x-y);
  cout<<cnt<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String S = sc.next();
    boolean result = true;
    for (int i = 0; i < S.length(); i++) {
      if (i % 2 == 0) {
        if (S.charAt(i) == 'L') {
          result = false;
          break;
        }
      } else {
        if (S.charAt(i) == 'R') {
          result = false;
          break;
        }
      }
    }
    System.out.println(result ? "Yes" : "No");
  }
}

Measured memory_bytes: 23892
open Batteries
let n = read_int ()
let rec loop i zoro_count =
  if zoro_count >= 3 then true else
  if i >= n then false else (
    Scanf.sscanf (read_line()) "%d %d" (fun d1 d2 -> 
      if d1 = d2 then loop (i+1) (zoro_count+1) else loop (i+1) 0
    )
  )

let () = (if (loop 0 0) then "Yes" else "No") |> print_endline


Measured memory_bytes: 5412
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
#define REP(i, n) for (LL i = 0; i < (LL)(n); i++)
#define FOR(i, m, n) for (LL i = m; i < n; i++)
#define SORT(x) sort(x.begin(), x.end())
#define REVE(x) reverse(x.begin(), x.end())
#define ALL(x) (x).begin(), (x).end()
#define SUM(x) accumulate(x.begin(), x.end(),0)
#define vLL(v,n) vector<LL> v(n); REP(i,n)cin>>v[i];
#define vstr(v,n) vector<string> v(n); REP(i,n)REP(i,n)cin>>v[i];
LL INF = 1e9 + 1;
LL MOD = 1e9+7;
  LL a,b,c,d,e,n,m,l,r,x,y,z,ans=-INF,ans2=0,count;
string s,S,t;
int main() {
  cin >> s;
  if(s[s.size()-1]=='s'){
    cout << s << "es";
  }else{
    cout << s<< "s";
  }
}

Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <sstream>
#include <cmath>

using namespace std;

typedef long long ll;

int main(int argc, const char * argv[]) {
    ll L, R;
    cin >> L >> R;
    
    ll n = (R - L >= 2019) ? 2019 : R - L;
    ll ans = 2019;
    for (ll i = L; i <= L + n; i++) {
        for (ll j = i + 1; j <= L + n; j++) {
            ll tmp = ((i % 2019) * (j % 2019)) % 2019;
            if (tmp < ans) {
                ans = tmp;
            }
        }
    }
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<map>

using namespace std;

int ara[1000];

int main(void)

{
    int N, M, b, i, j, a;
    cin>>N>>M;
    for(i = 0; i < M; i++){
        cin>>a>>b;
        ara[a]++;
        ara[b]++;
    }
    for(i = 1; i <= N; i++)
        cout<<ara[i]<<"\n";
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  int r, d, x;
  cin >> r >> d >> x;
  rep(i, 10){
    int nx = r*x - d;
    cout << nx << endl;
    x = nx;
  }
  return 0;
}

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

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n,i,s,cnt=0;
	cin >> n;
	for(i=1;i<=n;i++)
	{
		cin >> s;
		if(i%2!=0 && s%2!=0) cnt++;
	}
	
	cout << cnt << endl;
	
	return 0;
}

Measured memory_bytes: 3576