akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

int main() {
    int N, M;
    cin >> N >> M;
    vector <int> fall(N, 0);
    vector <int> root(N, 0);
    for(int i = 0;i < M;i++)
    {
        int a;
        cin >> a;
        fall[a - 1] = 1; 
    }
    long long mod = pow(10, 9) + 7;

    if(fall[0] != 1)
    {
        root[0] = 1;
    }

    if(fall[1] != 1)
    {
        root[1] = 1 + root[0];
    }
    else
    {
        root[1] = 0;
    }

    for(int i = 2;i < N;i++)
    {
        if(fall[i] != 1)
        {
            root[i] = root[i - 1] + root[i - 2];
            root[i] %= mod;
        }
    }
    cout << root[N - 1] << endl; 


    return 0;  

}

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

using namespace std;

#define ok1 printf("ok1\n");
#define ok2 printf("ok2\n");
#define M 1000000000000000000LL
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,k,n)　for(int i=(k);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define pb push_back
#define pf push_front
#define MIN(a,b) a=min((a),(b))
#define MAX(a,b) a=max((a),(b))
#define SIZE(v) (int)v.size()
#define Eunique(v) v.erace(unique(all(v)),v.end())
#define pvec(v)　rep(i,v.size()){cout << v[i] << " ";}
#define INF 0x3f3f3f3f
#define mset(m,v) memset(m,v,sezeof(m))
#define mod 1e9 +7;

const double pi = acos(-1.0);

typedef string ss;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef deque<ll> dll;
typedef pair<ll,ll> P;
ll dx[4] = {1,0,-1,0},dy[4] = {0,1,0,-1};

ll gcd(ll x,ll y)
{
    ll r;
    while((r = x % y) != 0)
    {
        x = y;
        y = r;
    }
    return y;
}

ll lcm(ll x,ll y)
{
    x /= gcd(x,y);
    return (x*y);
}

#define WA printf("WA\n");
int main()
{
    ll n,m;
    cin >> n >> m;
    map<ll,ll> mp;
    rep(i,n){
        ll k;
        cin >> k;
        vll a(k);
        rep(j,k){
            ll tmp;
            cin >> tmp;
            mp[tmp]++;
        }
    }
    ll ans=0;
    for(auto p:mp){
        if(p.second == n)ans++;
    }

    cout << ans << endl;

    return 0;
}


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

int main(){
    int n,m;
    while(true){
        cin>>n>>m;
        if(n==0&&m==0)break;
        int goods[n];
        for(int i=0;i<n;i++)
            cin>>goods[i];
        int maximum=0;
        for(int i=0;i<n-1;i++){
            for(int j=i+1;j<n;j++){
                if(goods[i]+goods[j] <= m)
                    if(goods[i]+goods[j] > maximum)
                        maximum = goods[i]+goods[j];
            }
        }
        if(maximum==0)cout<<"NONE";
        else cout<<maximum;
        cout<<endl;
    }
}


Measured memory_bytes: 3100
let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init (3 * n) (fun _ -> Scanf.scanf "%d " (fun n -> n)) in
  Array.sort (fun x y -> compare y x) as_;
  Printf.printf "%d\n" (Array.fold_left ( + ) 0 (Array.init n (fun i -> as_.(2 * i + 1))))

Measured memory_bytes: 6400
# 解き直し
def add(i, b):
    if i:
        return "-" + str(b)
    else:
        return "+" + str(b)
def main():
    S = input()
    a, b, c, d = int(S[0]), int(S[1]), int(S[2]), int(S[3])
    ans = ""
    for i in range(2):
        for j in range(2):
            for k in range(2):
                if a + (-1)**i * b + (-1)**j * c + (-1)**k * d == 7:
                    ans += str(a)
                    ans += add(i, b)
                    ans += add(j, c)
                    ans += add(k, d)
                    ans += "=7"
                    print(ans)
                    return
main()

Measured memory_bytes: 9124
#include <iostream>

using namespace std;

int main(){
	int r, c;
	cin >> r >> c;
	int spreadsheet[101][101] = {};
	for(int i = 0; i < r; i++){
		int sum = 0;
		for(int j = 0; j < c + 1; j++){
			if(j < c){
				int e;
				cin >> e;
				spreadsheet[i][j] = e;
				sum += e;
			}
			else{
				spreadsheet[i][j] = sum;
			}
		}
	}

	for(int i = 0; i < c + 1; i++){
		int sum = 0;
		for(int j = 0; j < r + 1; j++){
			if(j < r){
				sum += spreadsheet[j][i];
			}
			else{
				spreadsheet[j][i] = sum;
			}
		}
	}

	for(int i = 0; i < r + 1; i++){
		for(int j = 0; j < c + 1; j++){
			cout << spreadsheet[i][j];
			if(j < c){
				cout << " ";
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1208
#include <bits/stdc++.h>
using namespace std;
// マクロ
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
// 型エイリアス
using ll = long long;
using vi = vector<int>;
using vs = vector<string>;
using vvi = vector<vi>;
using vvs = vector<vs>;

int main() {
    int n; 
    cin >> n;
    vector<ll> l(n+1);
    l[0] = 2;
    l[1] = 1;
    for(int i  = 2; i <= n; i++) {
        l[i] = l[i-1] + l[i-2];
    }
    cout << l[n] << endl;
}

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

typedef long long ll;
using namespace std;

int main() {
    string s;
    cin >> s;
    
    int y = atoi(s.substr(0, 4).c_str());
    int m = atoi(s.substr(5, 2).c_str());
    if (y < 2019 || (y == 2019 && m < 5)) cout << "Heisei";
    else cout << "TBD";
    return 0;
}


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

int main(){
    int n;
    cin >> n;
    int ans = 0;
    int a;
    rep1(i,n){
        cin >> a;
        if(a%2==1 and i%2==1){
            ans+=1;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 3616
/*author: hyperion_1724
  date: 
*/

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(int i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define endl '\n'
#define trav(x,A) for(auto &x:A)
#define veci vector<int>
#define vecl vector<long long>
#define FORI(a,b,c) for(int a=b;a<c;a++)
#define FORD(a,b,c) for(int a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long,long> pll;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2) % MOD; 
    p = (p * p) % MOD; 
  
    return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

	READV(S);
	ll N=ceil(sqrt((ld)S));
	if (N*N-S<=1e9)
	{
		cout<<0<<" "<<0<<" "<<N<<" "<<N*N-S<<" "<<1<<" "<<N<<endl;
	}
	else
	{
		cout<<0<<" "<<0<<" "<<N<<" "<<N*(N-1)-S<<" "<<1<<" "<<N-1<<endl;
	}

	return 0;
}

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

class Program
{
    static void Main(string[] args)
    {
        int N = int.Parse(Console.ReadLine());
        double[] v = new double[N];
        var input = Console.ReadLine().Split();
        double sum = 0;
        for(int i=0; i < N; i++)
        {
            v[i] = double.Parse(input[i]);
        }
        Array.Sort(v);
        double ans = 0;
        for(int i = 1; i < N; i++)
        {
            if (i == 1) { ans = (v[0] + v[1]) / 2; }
            else { ans = (ans + v[i]) / 2; }
        }
        Console.WriteLine(ans);
    }
}


Measured memory_bytes: 11348
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
  string T, W;
  string E = "END_OF_TEXT";
  
  cin >> W;
  
  bool end_of_text=false;
  int count_W=0;
  
  while(1){
    cin >> T;

    if(T.size() == W.size()){
      for(int j=0; j<T.size(); j++){
        for(int k=0; k<W.size(); k++){
          if(W[k]-'a' != T[j+k]-'a' &&
             W[k]-'A' != T[j+k]-'a' &&
             W[k]-'a' != T[j+k]-'A' &&
             W[k]-'A' != T[j+k]-'A' ){
            break;
          }
        
          if(k == W.size()-1){
            count_W += 1;
          }
        }
      }
    }
    
    if(T.size() == E.size()){
      for(int k=0; k<E.size(); k++){
        if(E[k] != T[k]){
          break;
        }
        if(k == E.size()-1){
          end_of_text=true;
        }
      }
    }
    
    if(end_of_text){
      break;
    }
    
  }
  
  cout << count_W << endl;
  
  return(0);

}

Measured memory_bytes: 1192
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0; i<(int)(n); i++)
#define all(vec) vec.begin(), vec.end()
#define MOD 1000000007
#define int int64_t

signed main() {
    int n;
    cin >> n;
    vector<int> v(3*n);
    rep(i,3*n) cin >> v.at(i);
    sort(all(v), greater<>());
    int ans=0;
    for(int i=1; i<=n; i++)  {
        ans+=v.at(2*i-1);
    }
    cout << ans << endl;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define MOD 1000000007LL
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main(void){
	int cnt=0;
	bool flag=true;
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++){
		string str;
		cin >> str;
		if(str=="A"){
			cnt++;
		}else{
			cnt--;
			if(cnt<0)flag=false;
		}
	}
	if(cnt!=0)flag=false;
	printf("%s\n",flag?"YES":"NO");
	return 0;
}


Measured memory_bytes: 3228
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ii=pair<ll,ll>;
using vi=vector<ll>;

#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF (ll)1e18
#define all(x) (x).begin(),(x).end()
#define print(a); for(auto x:a)cout<<x<<" "; cout<<"\n";
#define mset(a); memset(a,0,sizeof(a));

ll cnt[(int)1e6+5];

int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);
	ll n;cin>>n;mset(cnt);
	ll a[n];
    for(int i=0;i<n;i++){
        cin>>a[i];cnt[a[i]]++;
    }
    ll ans=0;
    for(int i=0;i<n;i++){
        cnt[a[i]]--;
        bool state=0;
        for(int j=1;j*j<=a[i];j++){
            if(a[i]%j==0&&cnt[j]>0){state=1;break;}
            if(a[i]%j!=0)continue;
            ll z=a[i]/j;
            if(cnt[z]>0){state=1;break;}
        }
        cnt[a[i]]++;
        if(state)continue;
        ans++;
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 13032
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i,n) for(int i = 0; i < (n); ++i)
int main() {
    int n, m, x;
    cin >> n >> m >> x;
    vector<int> a(m);
    vector<bool> flg(n, false);
    rep(i, m) {
        cin >> a[i];
        flg[a[i]] = true;
    }
    int lc = 0;
    int rc = 0;
    rep(i, x) if ( flg[i] ) ++lc;
    for ( int i = x; i < n + 1; i++ ) {
        if ( flg[i] ) ++rc;
    }
    cout << min(lc, rc) << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long int
#define vi vector< int >
#define vc vector< char >
#define vvi vector < vector< int > >
#define vvc vector < vector< char > >
#define vl vector< ll >
#define vll vector<pair<ll,ll>>
#define pii pair< int, int >
#define pll pair<ll, ll>
#define pf push_front
#define pb push_back
// #define range(c) c.begin(), c.end()
// #define ranger(c) c.rbegin(), c.rend()
#define all(c) c.begin(), c.end()
#define allr(c) c.rbegin(), c.rend()
#define forn(i, n) for(ll i = 0; i < n; ++i)
#define fornr(i, n) for(ll i = n-1; i >= 0; --i)
#define foro(i, n) for(ll i = 1; i <= n; ++i)
#define foror(i, n) for(ll i = n; i >= 1; --i)
#define endl '\n'
#define MOD 998244353
#define FIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pr(a) for(auto it :a) cout << (it) << " "; cout << endl;
#define pr2(a) for(int i = 0; i<a.size(); ++i){ for(int j = 0; j<a[i].size(); ++j) cout << a[i][j] << ' '; cout << endl;}
#define test ll T; cin >> (T); while(T--)

#define present(container, element) (container.find(element) != container.end())
// for set and maps
#define cpresent(container, element) (find(all(container),element) != container.end())
// for vectors

using namespace std;

int main() {
// #ifndef ONLINE_JUDGE
//     freopen("/home/shivam/input.txt", "r", stdin);
//     freopen("/home/shivam/output.txt", "w", stdout);
//     freopen("/home/shivam/error.txt", "w", stderr);
// #endif

    FIO;

    int n, k;
    cin >> n >> k;
    vi arr(n), dp(n);
    forn(i, n)
    cin >> arr[i];
    dp[0] = 0;

    foro(i, n - 1) {
        dp[i] = dp[i - 1] + abs(arr[i] - arr[i - 1]);
        for (int j = i - 2; j >= 0 && j >= i - k; --j)
            dp[i] = min(dp[i], dp[j] + abs(arr[i] - arr[j]));
    }

    cout << dp[n - 1] << endl;

    return 0;
}


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

#define I inline
#define fi first
#define se second
#define R register
#define LL long long
#define mp make_pair
#define reg register int
#define pii pair<int,int>
#define fo(i, a, b) for(reg i = a; i <= b; i++)
#define fd(i, a, b) for(reg i = a; i >= b; i--)
#define cr const reg&
using namespace std;
const int N = 5e3 + 1;

I int _max(cr x, cr y) {return x > y ? x : y;}
I int _min(cr x, cr y) {return x < y ? x : y;}
I int read() {
	reg x = 0, f = 1; char ch = getchar();
	while(ch < '0' || ch > '9') {if(ch == '-') f = -1; ch = getchar();}
	while(ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
	return x * f;
}
I void ptt(LL x) {if(x >= 10) ptt(x / 10); putchar(x % 10 + '0');}
I void put(LL x) {x < 0 ? putchar('-'), ptt(-x) : ptt(x);}
I void pr1(LL x) {put(x), putchar(' ');}
I void pr2(LL x) {put(x), puts("");}

struct node {int h, p;} a[N];
LL f[N];

I bool cmp(const node &a, const node &b) {return a.h + a.p < b.h + b.p;}

int main() {
	reg n = read();
	fo(i, 1, n) a[i].h = read(), a[i].p = read();
	sort(a + 1, a + n + 1, cmp);
	memset(f, 63, sizeof(f)); f[0] = 0;
	LL inf = f[1];
	fo(i, 1, n) {
		fd(j, i, 1) if(f[j - 1] <= a[i].h){
			f[j] = min(f[j], f[j - 1] + a[i].p);
		}
	} fd(i, n, 1) if(f[i] < inf) {pr2(i); return 0;
	}
	return 0;
}



Measured memory_bytes: 384
import math

n = int(input())

def is_prime(x):
    if x < 2: return False
    if x == 2 or x == 3 or x == 5: return True
    if x % 2 == 0 or x % 3 == 0 or x % 5 == 0: return False

    prime = 7
    step = 4
    while prime <= math.sqrt(x):
        if x % prime == 0: return False

        prime += step
        step = 6 - step

    return True

A = []
for a in range(11, 55555, 10):
    if is_prime(a):
        A.append(a)
        if len(A) == n:
            break
print(' '.join(map(str, A)))

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

using namespace std;

long Floor(double t)
{
  return (long)t;
}

int main()
{
  long a,b,n;
  cin>>a>>b>>n;
  
  if(b-1<=n)
  {
    cout<<floor((a*(b-1))/b)-a*floor((b-1)/b)<<endl;
  }
  else
  {
    cout<<floor((a*n)/b)-a*floor(n/b)<<endl;
  }
  
}

Measured memory_bytes: 3780
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#define taskname "123"
typedef long long lli;
typedef pair<int, int> pii;
string s;
int n;

void read_input()
{
    cin >> s;
    n = s.length();
}

void solve()
{
    int cnt = 0;
    for(char c: s)
        if(c == 'o') ++cnt;
    if(cnt + 15 - n >= 8) cout << "YES\n";
    else cout << "NO\n";
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    read_input();
    solve();
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define sc(x) scanf("%lld",&x)
vector<ll> a, p;
ll solve(ll n, ll x){
    if (n == 0 && x > 0) return 1;
    else if (n == 0 || x == 1) return 0;
    else if (x>1 && x<=a[n-1]+1) return solve(n-1, x-1);
    else if (x == a[n-1] + 2) return p[n-1]+1;
    else if (x>a[n-1]+2 && x<=a[n-1]*2+2) return p[n-1]+1+solve(n-1, x-a[n-1]-2);
    else return p[n-1]*2+1;
}
int main(){
    ll n, x; sc(n), sc(x);
    a.push_back(1ll), p.push_back(1ll);
    for (int i = 1; i <= n; i++) a.push_back(a[i-1]*2+3);
    for (int i = 1; i <= n; i++) p.push_back(p[i-1]*2+1);
    cout << solve(n, x) << endl;;
    return 0;
}

Measured memory_bytes: 256
// D.

#include <iostream>
#include <sstream>
#include <algorithm>
#include <vector>

using namespace std;

typedef long long LL;

LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
LL lcm(LL a, LL b) { return (a / gcd(a, b)) * b; }

LL count2(LL x) {
	LL count = 1;
	while ((x % (1LL << count)) == 0) {
		++count;
	}
	return count - 1;
}

int main(int argc, char* argv[]) {
#ifdef _MSC_VER
	while (true)
#endif
	{
		LL n = -1, m;
		cin >> n >> m;
		if (n < 0) return 0;
		vector<LL> a(n);
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
		}
		LL l = a[0] / 2, c = count2(a[0]);
		for (int i = 1; i < n; ++i) {
			l = lcm(l, a[i] / 2);
			if (count2(a[i]) != c) {
				l = 1e18;
				break;
			}
		}
		LL ans = (m / l + 1) / 2;
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 4060
n, m = (int(x) for x in input().split())
seq = sorted((int(x) for x in input().split()), reverse=True)
t = sum(seq) / (4*m)
for val in seq:
  if val >=t:
    m-=1
  else:
    break
if m < 1:
  print("Yes")
else:
  print("No")

Measured memory_bytes: 38256
#include<cstdio>
#include<cctype>
#include<cstdlib>
#include<algorithm>
typedef signed long long int int64;
inline unsigned getint() {
	register char ch;
	while(!isdigit(ch=getchar()));
	register unsigned x=ch^'0';
	while(isdigit(ch=getchar())) x=(((x<<2)+x)<<1)+(ch^'0');
	return x;
}
inline int64 min(const int64 &a,const int64 &b) {
	return a<b?a:b;
}
const int64 inf=0x7ffffffffffffff;
const int N=200001;
int n;
class FenwickTree {
	private:
		int64 val[N];
		int lowbit(const int &x) const {
			return x&-x;
		}
	public:
		FenwickTree() {
			std::fill(&val[0],&val[N],inf);
		}
		void modify(int p,const int64 &x) {
			while(p<=n) {
				if(x<val[p]) {
					val[p]=x;
				} else {
					return;
				}
				p+=lowbit(p);
			}
		}
		int64 query(int p) const {
			int64 ret=inf;
			while(p) {
				ret=min(ret,val[p]);
				p-=lowbit(p);
			}
			return ret;
		}
};
FenwickTree ta;
class RevFenwickTree {
	private:
		int64 val[N];
		int lowbit(const int &x) const {
			return x&-x;
		}
	public:
		RevFenwickTree() {
			std::fill(&val[0],&val[N],inf);
		}
		void modify(int p,const int64 &x) {
			while(p) {
				if(x<val[p]) {
					val[p]=x;
				} else {
					return;
				}
				p-=lowbit(p);
			}
		}
		int64 query(int p) const {
			int64 ret=inf;
			while(p<=n) {
				ret=min(ret,val[p]);
				p+=lowbit(p);
			}
			return ret;
		}
};
RevFenwickTree tb;
int64 f[N];
inline void modify(const int &p,const int64 x) {
	if(x<f[p]) {
		f[p]=x;
		ta.modify(p,x-p);
		tb.modify(p,x+p);
	}
}
int main() {
	n=getint();
	int q=getint(),a=getint(),b=getint();
	std::fill(&f[0],&f[N],inf);
	modify(a,0);
	int64 sum=0;
	while(q--) {
		a=b;
		b=getint();
		sum+=abs(a-b);
		int64 t1=ta.query(b)+b,t2=tb.query(b)-b;
		modify(a,min(t1,t2)-abs(a-b));
	}
	int64 tmp=inf;
	for(register int i=1;i<=n;i++) {
		tmp=min(tmp,f[i]);
	}
	printf("%lld\n",tmp+sum);
	return 0;
}

Measured memory_bytes: 4864
#include <bits/stdc++.h>
using namespace std;
 
int main() 
{
	int N;
	cin >> N;
	string s;
	cin >> s;
	
	int ir[4000] ={};
	int ig[4000] ={};
	int ib[4000] ={};
	int nr = 0;
	int ng = 0;
	int nb = 0;
	
	for(int i = 0; i < N; i++){
		char c = s[i];
		if(c == 'R') ir[nr++] = i;
		if(c == 'G') ig[ng++] = i;
		if(c == 'B') ib[nb++] = i;
	}
	
	unsigned int v = nr * ng * nb;
	
	for(int i = 1; i <= N; i++){
		char ci = s[i-1];
		for(int k = i+2; k <= N; k++){
			char ck = s[k-1];
			if(ci == ck) continue;
			if((i + k) & 1) continue;// jが小数になるなら却下
			int j = (i + k) / 2;
			char cj = s[j-1];
			if(ci != cj && cj != ck) v--;
		}
	}
	
	cout << v;
}

Measured memory_bytes: 3636
a,b,c,d = list(input())

ab = int(a+b)
cd = int(c+d)

if ab >= 1 and ab <= 12 and cd >= 1 and cd <= 12:
  ans = 'AMBIGUOUS'
else:
  if  ab >= 1 and ab <= 12:
    ans = 'MMYY'
  elif cd >= 1 and cd <= 12:
    ans = 'YYMM'
  else:
    ans = 'NA'

print(ans)

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

int main(){
  int q;
  cin>>q;
  while(q--){
    double xa,ya,ra,xb,yb,rb;
    cin>>xa>>ya>>ra>>xb>>yb>>rb;

    int f=-1; 
    if(ra>rb) f=1,swap(ra,rb),swap(xa,xb),swap(ya,yb);
    double dis=sqrt((xa-xb)*(xa-xb)+(ya-yb)*(ya-yb));
 
    if(dis>ra+rb) cout << 0<<endl;
    else if(dis+ra<rb)cout << f*2<<endl;
    else cout << 1<<endl;
  }
  return 0;
}

Measured memory_bytes: 1232
#include <bits/stdc++.h>
typedef long long int lld;
typedef unsigned long long int llu;
#define INF (lld)(9223372036854775807)
#define IINF (int)(2147483647)

using namespace std;

int main(void) {
  lld n;
  cin >> n;
  vector<lld> a(n);
  for (lld i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a.begin(), a.end(), greater<lld>());
  lld s = 0;
  queue<lld> q;
  for (lld i = 0; i < n; i++) {
    if (q.empty()) {
      q.push(a[i]);
      continue;
    }

    lld x = q.front();
    if (a[i] != x) {
      q.pop();
      q.push(a[i]);
    }
    q.push(a[i]);
    s += x;
  }
  cout << s << "\n";
}

Measured memory_bytes: 6428
from sys import stdin
INF = 1<<21
WHITE, GRAY, BLACK = 0, 1, 2
n = int(stdin.readline())
M = [[INF] * n for _ in range(n)]
for i in range(0, n):
    for j, e in enumerate(list(map(int, stdin.readline().split()))):
        if e != -1: M[i][j] = e
d = [INF] * n
d[0] = 0
color = [0] * n
def prim():
    while True:
        minv = INF
        u = -1
        for i in range(0, n):
            if minv > d[i] and color[i] != BLACK:
                u = i
                minv = d[i]
        if u == -1: break
        color[u] = BLACK
        for v in range(0, n):
            if color[v] != BLACK and d[v] > M[u][v]:
                d[v] = M[u][v]
    return sum(d)
print(prim())

Measured memory_bytes: 7860
def max(a, b)
	if a>b
		 a
	else
		 b
	end
end
def min(a, b)
	if a>b
		b
	else
		a
	end
end

num = gets.to_i
minv = gets.to_i
maxv = gets.to_i - minv
minv = min(minv,maxv+minv)
(num-2).times do
	n = gets.to_i
	maxv = max((n-minv),maxv)
	minv = min(minv,n)
end
puts maxv


Measured memory_bytes: 8872
def solve():
    H, W = map(int, input().split())
    grid = [[] for _ in range(H)]
    for i in range(H):
        grid[i] = list(map(int, input().split()))
    
    ans = []
    for i in range(H):
        for j in range(W - 1):
            if grid[i][j] % 2 == 1:
                grid[i][j + 1] += 1
                ans += [[i + 1, j + 1, i + 1, j + 2]]
    for i in range(H - 1):
        if grid[i][W - 1] % 2 == 1:
            grid[i + 1][W - 1] += 1
            ans += [[i + 1, W, i + 2, W]]
    
    N = len(ans)
    print(N)
    for ans_i in ans:
        print(*ans_i)


if __name__ == '__main__':
    solve()


Measured memory_bytes: 30352
import math
def f(x):return math.factorial(x)
def g(x):return f(x)//(f(x-2)*f(2))if x>1else 0
n,m=map(int,input().split())
b=0
c={}
for a in input().split():
  b+=int(a)
  c[b%m]=c.get(b%m,0)+1
print(sum(map(lambda x:g(x),c.values()))+c.get(0,0))

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

typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const int mod = 1e9+7;

#define pi pair<int,int>
#define pl pair<lld,lld>

#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl

#define mem0(x) memset(x,0,sizeof(x))
#define fillnum(x,n) fill(begin(x),end(x),n)
#define asort(x) sort(x.begin(),x.end())
#define dsort(x,t) sort(x.begin(),x.end(),greater<t>())
#define vuniq(x) x.erase(unique(x.begin(), x.end()), x.end())

#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)

int main() {
    ll N,K;
    cin >> N >> K;
    if(K != 1){
        cout << N-K << endl;
    } else {
        cout << 0 << endl;
    }
}

Measured memory_bytes: 3504
#include<stdio.h>
#include<stdlib.h>
int partition(int *,int);
void swap(int,int,int *);
int main(){
  int n,i,temp;
  int *list;
  scanf("%d",&n);
  list=(int *)malloc(n*sizeof(int));
  for(i=0;i<n;i++)scanf("%d",list+i);
  temp=partition(list,n);
  for(i=0;i<n;i++){
    if(i==temp)printf("[%d]%c",*(list+i),(i<n-1)?' ':'\n');
    else printf("%d%c",*(list+i),(i<n-1)?' ':'\n');
  }
  return 0;
}
int partition(int *l,int n){
int i,s=0,base=*(l+(n-1));
  for(i=0;i<n-1;i++){
    if(base>=*(l+i)){
      swap(i,s,l);
      s++;
    }
  }
  swap(s,n-1,l);
  return s;
}
void swap(int x,int y,int *l){
  int temp;
  temp=*(l+x);
  *(l+x)=*(l+y);
  *(l+y)=temp;
}



Measured memory_bytes: 2124
import Control.Monad
import Data.List
import Data.Function
import Data.Maybe
import qualified Data.ByteString.Char8 as BC8

main :: IO ()
main = do
  [n, k] <- (map read . words) <$> getLine :: IO [Int]
  rows <- replicateM n $ map (fst . fromJust . BC8.readInt) . BC8.words <$> BC8.getLine :: IO [[Int]]
  let sorted = sortBy (compare `on` head) rows
  print =<< solve k 0 0 sorted

solve k i a' rows
  | k <= i = return a'
  | otherwise = let [a, b]:rows' = rows in solve k (i + b) a rows'


Measured memory_bytes: 66940
#include <cstdio>
#include <vector>
const int MAXN = 605;
double dp[MAXN];
std::vector<int> G[MAXN];
int M, N;

double solve(int pos) {
    // Block an outgoing edge from `pos`
    for (int i = 1; i <= N; ++i) {
        dp[i] = 0.0;
    }
    for (int i = N-1; i >= 1; --i) {
        int K = G[i].size();
        if (K == 1) {
            dp[i] = dp[G[i][0]] + 1.0;
            continue;
        }
        double max = 0.0;
        double sum = 0.0;
        int skip = 1;
        for (auto nxt: G[i]) {
            sum += dp[nxt];
            max = std::max(dp[nxt], max);
        }
        if (i != pos) {
            max = 0.0;
            skip = 0;
        }
        dp[i] = 1.0 * (sum - max) / (K - skip) + 1.0;
    }
    return dp[1];
}

int main() {
    scanf(" %d%d", &N, &M);
    for (int i = 0; i < M; ++i) {
        int s, t;
        scanf(" %d%d", &s, &t);
        G[s].push_back(t);
    }
    double ret = N;
    for (int i = 1; i <= N; ++i) {
        ret = std::min(solve(i), ret);
    }
    printf("%.9f\n", ret);
    return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const ll INF = 1000000000000000000;

vector<int> E;
int A[100010], B[100010];
int main()
{
	int N;
	cin >> N;
	ll sum1 = 0, sum2 = 0;
	ll sum = 0;
	int ans = 0;
	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++) {
		sum1 += A[i];
		sum2 += B[i];
		if (A[i] < B[i]) {
			sum += B[i] - A[i];
			ans++;
		}
		else E.push_back(A[i] - B[i]);
	}
	if (sum1 < sum2) {
		cout << -1 << endl;
		return 0;
	}
	sort(E.rbegin(), E.rend());
	int i = 0;
	while (sum > 0) {
		sum -= E[i++];
		ans++;
	}
	cout << ans << endl;
}


Measured memory_bytes: 4512
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using pii=pair<int,int>;
#define ALL(c) begin(c),end(c)
#define RALL(c) rbegin(c),rend(c)
#define ITR(i,b,e) for(auto i=(b);i!=(e);++i)
#define FORE(x,c) for(auto &x:c)
#define REPF(i,a,n) for(int i=a,i##len=(int)(n);i<i##len;++i)
#define REP(i,n) REPF(i,0,n)
#define REPR(i,n) for(int i=(int)(n);i>=0;--i)
#define SZ(c) ((int)c.size())
#define CONTAIN(c,x) (c.find(x)!=end(c))
#define OUTOFRANGE(y,x,h,w) (y<0||x<0||y>=h||x>=w)
#define dump(...)
const int DX[9]={0,1,0,-1,1,1,-1,-1,0},DY[9]={-1,0,1,0,-1,1,1,-1,0};
#define INF (1001001001)
#define INFLL (1001001001001001001ll)
template<class T> ostream& operator << (ostream &os,const vector<T> &v) {
    ITR(i,begin(v),end(v)) os<<*i<<(i==end(v)-1?"":" "); return os; }
template<class T> istream& operator >> (istream &is,vector<T> &v) {
    ITR(i,begin(v),end(v)) is>>*i; return is; }
template<class T> istream& operator >> (istream &is, pair<T,T> &p) {
    is>>p.first>>p.second; return is; }
template <class T> bool chmax(T &a,const T &b) {if(a<b) {a=b;return 1;} return 0;}
template <class T> bool chmin(T &a,const T &b) {if(b<a) {a=b;return 1;} return 0;}
template <class T> using heap = priority_queue<T,vector<T>,greater<T>>;
struct before_main_function {
    before_main_function() {
        #ifdef int
            #undef INF
            #define INF INFLL
            #define stoi stoll
        #endif
        cin.tie(0);ios::sync_with_stdio(false);
        cout<<setprecision(15)<<fixed;
        #define endl "\n"
    }
} before_main_function;
//------------------8<------------------------------------8<--------------------

struct union_find {
    vector<int> data;
    union_find(int size) : data(size, -1) { }
    void unite(int x, int y) {
        x = root(x); y = root(y);
        if(x != y) {
            if(data[y] < data[x]) swap(x, y);
            data[x] += data[y];
            data[y] = x;
        }
    }
    bool same(int x, int y) {
        return root(x) == root(y);
    }
    int root(int x) {
        return data[x] < 0 ? x : data[x] = root(data[x]);
    }
    int size(int x) {
        return -data[root(x)];
    }
};
signed main() {
    int n;
    cin>>n;
    vector<pii> x(n),y(n);
    REP(i,n) {
        cin>>x[i].first;
        cin>>y[i].first;
        x[i].second=y[i].second=i;
    }
    sort(ALL(x));
    sort(ALL(y));
    vector<vector<int>> edge;
    REP(i,n-1) {
        int ax=x[i].second;
        int bx=x[i+1].second;
        int cx=abs(x[i].first-x[i+1].first);
        edge.push_back({cx,ax,bx});
        int ay=y[i].second;
        int by=y[i+1].second;
        int cy=abs(y[i].first-y[i+1].first);
        edge.push_back({cy,ay,by});
    }
    union_find uf(n);
    sort(ALL(edge));
    int ans=0;
    REP(i,SZ(edge)) {
        int c=edge[i][0];
        int a=edge[i][1];
        int b=edge[i][2];
        if(uf.same(a,b)) continue;
        uf.unite(a,b);
        ans+=c;
    }
    cout<<ans<<endl;
    return 0;
}


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

class AIZU0022
   {
   public static int par() { string s = Console.ReadLine() ; return int.Parse(s); }
   public static HashSet<int> Mount=new HashSet<int>(), Valley=new HashSet<int>();
   public static List<int> M=new List<int>();  //register the sum from first to n-th
   public static void Main(string[] args) {
      int N;
      int k,kp=0;
      while (true) {
         N=par();
         if (N<=0) break;
         M.Clear();  Mount.Clear(); Valley.Clear();
         kp=0;
         for (int i = 0; i<N; i++) {
            k=par(); M.Add((i>0?M.Last():0)+k);
            if (kp<=0 && k>0 && i!=0&&i!=N-1) Valley.Add(i-1);
            if (kp>=0 && k<0 && i!=0&&i!=N-1) Mount.Add(i-1);
            kp=k;
         }
         Console.WriteLine(Sup());
      }
   }

   public static int Sup() { 
      //versus First
      int Max = M.Max();
      //versus Last
      int beta;
      if (M.Last()>=0) {
         beta=M.Last()-M.Min();
         if (beta>Max) Max=beta;
      }
      if (Mount.Count==0) {
         List<int> m = new List<int>() { M[0] };
         for (int i = 1; i<M.Count; i++) {
            m.Add(M[i]-M[i-1]);
         }
         beta=m.Max();
         if (beta>Max) Max=beta;
      }
      foreach (int st in Valley) {
         beta=Mount.Where(i => i>st).Max(i => M[i])-M[st];
         if (beta>Max) Max=beta;
      }
      return Max;
   }
}

Measured memory_bytes: 10220
#include<iostream>
#include<map>
#include<algorithm>
using namespace std;
int main() {
	int N;
	cin >> N;
	map<long long, int> m;
	int ans = 0;
	long long num = 0;
	m[0] = -1;
	for (int i = 0; i < N; ++i) {
		int a;
		cin >> a;
		num += a;
		map<long long, int>::iterator itr = m.find(num);
		if (itr == m.end()) {
			m[num] = i;
		}
		else {
			ans = max(ans, i - m[num]);
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15568
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> mp;
ll inf =  1e9;


int main(){
 ll n,w,h;
 cin>>n>>w>>h;
 vector<ll> a(2*w,0),b(2*h,0);
 for(ll i=0;i<n;i++){
  ll x,y,d;
  cin>>x>>y>>d;
  a[max(0ll,x-d)]++;
  a[min(2*w,x+d)]--;
  b[max(0ll,y-d)]++;
  b[min(2*h,y+d)]--; 
 }
 bool flag = true;
 if( a[0] <= 0) flag = false;

 for(ll i=1;i<w;i++){
  a[i] += a[i-1];
  if( a[i] <= 0 ) flag = false;
 }
 if( flag ){
  cout<<"Yes"<<endl;
  return 0;
 }
 flag = true;
 if( b[0] <= 0 ) flag = false;
 for(ll i=1;i<h;i++){
  b[i] += b[i-1];
  if( b[i] <= 0 ) flag = false;
 }
 /*for(ll i=0;i<w;i++){
  cout<<a[i]<<' ';
 }
 cout<<endl;
 for(ll i=0;i<h;i++){
  cout<<b[i]<<' ';
 }
 cout<<endl;
*/
 if( flag ){
  cout<<"Yes"<<endl;
 }else{
  cout<<"No"<<endl;
 }

 
    return 0;
}



Measured memory_bytes: 6008
#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <numeric>
#include <algorithm>
#include <math.h>
#include <queue>

using namespace std;

int INF = 1000000000;

int H, W;
char A[1000][1000];
int d[1000][1000];

typedef pair<int, int> P;

int main(){
    cin >> H >> W;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)    cin >> A[i][j];
    }

    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)    d[i][j] = INF;
    }

    queue<P> que;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++){
            if( A[i][j] == '#' ){
                que.push(P(i, j));
                d[i][j] = 0;
            }
        }
    }

    while ( que.size() ){
        P pos = que.front();
        que.pop();
        int y = pos.first;
        int x = pos.second;
        if( 0 < x ){
            if( d[y][x-1] == INF ){
                que.push(P(y, x-1));
                d[y][x-1] = d[y][x] + 1;
            }
        }
        if( 0 < y ){
            if( d[y-1][x] == INF ){
                que.push(P(y-1, x));
                d[y-1][x] = d[y][x] + 1;
            }
        }
        if( x < W-1 ){
            if( d[y][x+1] == INF ){
                que.push(P(y, x+1));
                d[y][x+1] = d[y][x] + 1;
            }
        }
        if( y < H-1 ){
            if( d[y+1][x] == INF ){
                que.push(P(y+1, x));
                d[y+1][x] = d[y][x] + 1;
            }
        }
    }

    int ans = 0;
    for(int i=0;i<H;i++){
        for(int j=0;j<W;j++)    ans = max(ans, d[i][j]);
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 13328
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
inpl = lambda: list(map(int,input().split()))
MOD = 10**9 + 7

N, K = inpl()
edges = [set() for _ in range(N)]
for _ in range(N-1):
    a, b = inpl()
    a -= 1
    b -= 1
    edges[a].add(b)
    edges[b].add(a)

def dfs(node, colors, root=True):
    if colors == 0:
        return 0
    prod = colors
    if root:
        next_colors = K - 1
    else:
        next_colors = K - 2
    for p in edges[node]:
        if next_colors <= 0:
            return 0
        edges[p].remove(node)
        prod = prod*dfs(p,next_colors,False) % MOD
        if prod == 0:
            return 0
        next_colors -= 1
    return prod

print(dfs(0,K))

Measured memory_bytes: 176416
#pragma once
#include <stdio.h>
#include <sstream>
#include <string>
#include <string.h>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <limits>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define bit(x,v) ((ll)x << v)

const ll INF = 1000000007;
const int MAX = 210000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}
int pr[100010];
void uini(int n) {
	for (size_t i = 0; i <= n; i++)
	{
		pr[i] = i;
	}
}

int parent(int x) {
	if (x == pr[x]) return x;
	return pr[x] = parent(pr[x]);
}

bool unit(int x, int y) {
	int px = parent(x);
	int py = parent(y);

	if (px == py) return false;
	if (px < py) {
		pr[py] = px;
	}
	else {
		pr[px] = py;
	}
	return true;
}

// res[i][c] := i 文字目以降で最初に文字 c が登場する index (存在しないときは n)
vector<vector<int> > calcNext(const string& S) {
	int n = (int)S.size();
	vector<vector<int> > res(n + 1, vector<int>(26, n));
	for (int i = n - 1; i >= 0; --i) {
		for (int j = 0; j < 26; ++j) res[i][j] = res[i + 1][j];
		res[i][S[i] - 'a'] = i;
	}
	return res;
}

void solv() {
	
	ll k, s;
	cin >> k >> s;
	s /= 1000;
	for (ll x = 0; x <= k; x++)
	{
		for (ll y = 0; y+x <= k; y++)
		{
          
          for(ll l =0;x+y+l<= k; l++){
          
			ll lp = x * 10 + y * 5 +l;
			if (lp == s && l + x + y == k) {
				cout << x << " " << y << " " << l << endl;
				return;
			}
          
          }
		


		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;

}

int main() {
//COMinit();
	solv();

	return 0;
}
 


Measured memory_bytes: 256
from heapq import heappush, heappop
import re
from collections import deque
import sys
input = sys.stdin.readline


def int_raw():
    return int(input())


def ss_raw():
    return input().split()


def ints_raw():
    return tuple(map(int, ss_raw()))


DIV = 10**9+7


def mod_invs(n, mod=DIV):
    inv = [0]*(n+1)
    inv[0] = 1
    inv[1] = 1
    for i in range(2, n+1):
        inv[i] = (-(mod//i)*inv[mod % i]) % mod
    return inv


N,A,B,C,D = ints_raw()
S = input()
#N = int_raw()


def main():
    ans = 0
    if D==C:
        return "No"
    if S[D-1]=="#" or S[C-1]=="#":
        return "No"
    if "##" in S[A:max(B, D)]:
        return "No"
    if D>C:
        return "Yes"
    else:
        if "..." in S[B-2:min(min(D+1,N),C)]:
            #print(S[B-2:min(min(D+1, N), C)])
            return "Yes"
        return "No" 
    return ans


print(main())


Measured memory_bytes: 39792
#include<bits/stdc++.h>
#include<string>
#define ll long long
#define lld long double
#define llu unsigned long long int
#define pb push_back
#define mp make_pair
#define fir first
#define sec second
#define gll(a,n) for(ll i=0;i<n;i++) cin>>a[i];
#define mod 1000000007
#define mod1 998244353
#define pi 3.1415926535897
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //freopen("B-small-attempt0.in", "r", stdin);freopen("output.txt", "w", stdout);
    //std::cout << std::setprecision(9);
    //std::cout << std::fixed;
    ll n,a,b;
    cin>>n>>a>>b;
    cout<<min(n*a,b);
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	// 6,5,6,5...を頑張って繰り返す
	// 6までは1回 11までは2回 17までは3回 22までは4回 27までは5回 33までは6回...
	// 38(5) 44(6) 49(7) 55(8) 60(9) 66(11) 71(12) 77(13)
	var X int
	fmt.Scan(&X)
	if X%11 == 0 {
		fmt.Println(X / 11 * 2)
	} else {
		if X%11 <= 6 {
			fmt.Println(X/11*2 + 1)
		} else {
			fmt.Println(X/11*2 + 2)
		}
	}
}


Measured memory_bytes: 512
def is_prime(num):
    if num == 2:
        return True
    
    if num < 2 or num%2 == 0:
        return False
    
    for i in range(3, int(num**(1/2))+1, 2):
        if num%i == 0:
            return False
    return True

if __name__ == '__main__':
    N = int(input())
    A = [int(input()) for _ in range(N)]
    
    print(sum([is_prime(a) for a in A]))


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

char ary[1010];
int main(){
	cin>>ary;
	int cnt=0;
	char hog;
	while(ary[cnt]!='\0'){
		hog=ary[cnt];
		hog-=3;
		if(hog<'A') hog+=26;
		ary[cnt]=hog;
		cnt++;
	}
	cout<<ary<<endl;
	return 0;
}

Measured memory_bytes: 1140
#include <stdio.h>
#include <stdlib.h>//random,NULL
#include <string.h>
#include <time.h>
#include <unistd.h>//sleep()
#include <math.h>
#include <stdbool.h>

#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000


int main(){
  char buf[1024];
  int A,B,C;

  fgets(buf,sizeof(buf),stdin);
  sscanf(buf, "%d %d %d", &A, &B, &C);

  if((A<C && C<B) || (B<C && C<A)){
    printf("Yes\n");
  }
  else{
    printf("No\n");
  }

  return 0;


}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); i++)
using namespace std;
 
int main(){
    int n,m; cin >> n >> m;
    vector <int> broken(n+1);
    rep(i,m){
        int a; cin >> a;
        broken[a]=1;
    }
    
    vector <int> dp(n+2);
    const int mod = 1e9+7;
    dp[n]=1;
    for (int i=n-1; i>=0; i--){
        if (broken[i]){
            dp[i]=0;
            continue;
        }
        dp[i]=(dp[i+1]+dp[i+2])%mod;
    }
    cout << dp[0] << endl;
    return 0;
}

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



int main() {
    ll H,N;
    cin>>H>>N;
    vector<pair<ll,ll>> magic(N);
    rep(i,N){
        cin>>magic.at(i).first>>magic.at(i).second;
    }
    vector<ll> dp(H+1);
    dp[0]=0;
    for(ll i=1;i<H+1;i++){
        ll now,ans=100000000;
        rep(j,N){
            if(magic.at(j).first>i){now=magic.at(j).second;}
            else{
                now=magic.at(j).second+dp.at(i-magic.at(j).first);
            }
            ans=min(now,ans);
        }
        dp[i]=ans;
    }
    cout<<dp.at(H)<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define ll long long
#define dbg(x) cout<<#x<<"="<<x
#define nl cout<<"\n"
#define frn(i,n) for(int i = 0;i < n;i++)
#define fr(i,a,b) for(int i = a;i < b;i++)
#define pb push_back
using namespace std;


int main() {
  int a,b;
  cin>>a>>b;
  int n = b-a;
  int c = (n*(n-1))/2 - a;
  cout<<c;
}

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

using namespace std;

int main() {
	
	string a, b;
	cin>>a;
	int l=a.size();
	for (int i=0; i<l; i++) {
		if (i%2==0) {
			b+=a[i];
		}
	}
	cout<<b;
	
}


Measured memory_bytes: 512
#include <iostream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>
#include <map>
#include <list>
#include <climits>
#include <set>
#include <deque>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <bitset>

// #define cerr if(false)cerr
#define watch(x) cerr << "> " << #x << ": " << x << "\n";

using namespace std;

template <typename T>
std::ostream &operator <<(std::ostream &out, vector<T> &v) {
	for (typename vector<T>::size_type i = 0; i < v.size(); ++i)
		out << v[i] << " ";
	out << "\n";
    return out;
}
template <typename T, typename N>
std::ostream &operator <<(std::ostream &out, vector<pair<T, N> > &v) {
	for (size_t i = 0; i < v.size(); ++i)
		out << "(" << v[i].first << ", " << v[i].second << ") ";
	out << "\n";
    return out;
}
template <typename T>
std::ostream &operator <<(std::ostream &out, vector<vector<T> > &v) {
	for (size_t i = 0; i < v.size(); ++i) {
		for (size_t j = 0; j < v[i].size(); ++j) {
			out << v[i][j] << " ";
		}
		out << "\n";
	}
   	return out;
}

int main() {

	std::ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

	int n;
	cin >> n;

	set<int> elem;
	int a;
	for (int i = 0; i < n; ++i) {
		cin >> a;
		elem.insert(a);
	}

	if (elem.size() == n) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}

	return 0;

}

Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, D;
    cin >> N >> D;
    std::vector<double> x;
    std::vector<double> y;
    double a, b;
    int count = 0;
    for(int i = 0 ; i < N ; ++i)
    {
        cin >> a >> b;
        double d = sqrt(a*a+b*b);
        if(d <= D) ++count;
    }
    cout << count <<endl;
    
    // std::vector<double> x;
    // x.push_back(0.0);
    // cout << x.size() << endl;
    // int a, b, c;
    // cin >> a >> b >> c;
    // string s;
    // cin >> s;
    // cout << a+b +c << " " << s<< endl;
    // std::cout << "Hello, World" << std::endl;
    // int i = 0;
    // if( i == 0 )
    // {
    //     std::cout << "say hello!!!" << std::endl;
    // }
    // for(int i = 0 ; i < 10 ; ++i)
    // {
    //     std::cout << i << std::endl;
    // }
    // std::cin>>i;
    return 0;
}

Measured memory_bytes: 3800
#include <stdio.h>
int main()
{
    int n,m,i,p,d=0;
    scanf("%d%d",&n,&m);
    for(i=0;i<m;i++){
        scanf("%d",&p);
        d+=p;
    }
    if(d>n)
        printf("-1");
    else
        printf("%d",n-d);
    return 0;
}

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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin>>n;
    map<string,int> Map;
    rep(i,n){
        string s; cin>>s;
        Map[s]++;
    }
    int ma=0;
    for(auto e:Map){
        chmax(ma,e.se);
    }
    vector<string> ans;
    for(auto e:Map){
        if (e.se==ma) ans.pb(e.fi);
    }
    sort(all(ans));
    for(auto e:ans){
        cout<<e<<endl;
    }
    return 0;
}


Measured memory_bytes: 25584
#include <cstdio>
#include <cstring>
#include <string>
using namespace std;

int n;
char buf[10000];
string ans;

int main() {
  fgets(buf, 1000, stdin);
  n = strlen(buf);

  for (int i=0; i<n; i++) {
    char c = buf[i];
    if ('a' <= c && c <= 'z') {
      ans += 'A'+(c-'a');
    } else ans += c;
  }

  printf("%s", ans.c_str());
}

Measured memory_bytes: 2596
'''
ITP-1_3-C
 2 ????????°?????????
???????????´??° x, y ?????????????????????????????????????°?????????????????????????????????°?????????????????????????????????
?????????????????????????????\?????????????????????????????????????????????????????????????????????????????¨?????¨?????????????????????
???Input
??\???????????°????????????????????????????§?????????????????????????????????????????????????????????§??????????????????????????´??° x, y ?????????
?????????????§?????????????????????????
???Output
??????????????????????????¨??????x ??¨ y ????°????????????????????????????????????????????????????????????????x ??¨ y ????????????????????????????????\??????????????????
'''
# import
import sys

# input???????????????
for inputData in sys.stdin:
    inputData = inputData.split(" ")
    inputData01, inputData02 = int(inputData[0]), int(inputData[1])
    # 0?????´??? ????????????
    if inputData01 == 0:
        if inputData02 == 0:
            break

    if inputData01 > inputData02:
        outputData01 = inputData02
        outputData02 = inputData01
    else:
        outputData01 = inputData01
        outputData02 = inputData02

    # ????????????
    print((outputData01), (outputData02))

Measured memory_bytes: 7920