akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

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

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

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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


int main(){
    char x,y;
    cin>>x>>y;
    if(x>y){
        cout<<">"<<endl;
    }else if(x==y){
        cout<<"="<<endl;
    }else{
        cout<<"<"<<endl;
    }
}









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

#define MOD 1000000007
#define debug(x) cout << (#x) << " is " << (x) << endl
typedef long long int ll;
#define int ll
typedef pair < ll, ll > pll;
typedef vector < vector < ll > > matrix;
typedef vector < ll > vll;

#define pi 3.1415926536
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    string s1, s2;
    cin >> s1 >> s2;
    int c = 0;
    for (int i = 0; i < 3; i++){
        if(s1[i] == s2[i]){
            c++;
        }
    }
    cout << c << endl;

    return 0;
}

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


int main(){
	
	char odd[64];
	char even[64];
	char password[128];
	
	scanf("%s", &odd);
	scanf("%s", &even);
	
	int i = 0;
	while( odd[i] != '\0' ){
		
		password[2*i] = odd[i];
		password[2*i + 1] = even[i];
		i++;
		
	}
	password[2*i] = '\0';
	
	printf( "%s\n", password );
	
	return 0;
	
}

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

using namespace std;

long long n,m;

int main(){
	scanf("%lld%lld", &n, &m);
	
	long long res = min(n, m / 2);
	n -= res;
	m -= res * 2LL;
	res += m / 4LL;
	
	printf("%lld\n", res);
}


Measured memory_bytes: 256
def f(currentNode, visitedNodeSet):
    if len(visitedNodeSet) == N - 1:
        return 1
    sum = 0
    for a, b in AB:
        if (a == currentNode) and (b not in visitedNodeSet):
            vns = visitedNodeSet.copy()
            vns.add(a)
            sum += f(b, vns)
        if (b == currentNode) and (a not in visitedNodeSet):
            vns = visitedNodeSet.copy()
            vns.add(b)
            sum += f(a, vns)
    return sum


N, M = [int(x) for x in input().split()]
AB = []

for i in range(M):
    a, b = [int(x) for x in input().split()]
    AB.append((a, b))

# print(AB)

print(f(1, set()))


Measured memory_bytes: 3064
#include<iostream>
using namespace std;
typedef long long ll;

ll n,s;
bool chk(ll n,ll i,ll s)
{
    ll tot=0,x=n;
    while(x)
    {
        tot+=x%i;
        x/=i;
    }
    return tot==s;
}
ll calc(ll n, ll s)
{
    if(s>n)return -1;
    if(s==n)return n+1;
    for(ll i=2;i*i<=n;i++)if(chk(n,i,s))return i;
    ll now=n-s,res=-1;
    for(ll i=1;i*i<=now;i++)
    {
        if(now%i==0)
        {
            ll x=i+1;
            if(chk(n,x,s))
            {
                if(res==-1||res>x)res=x;
            }
            x=now/i+1;
            if(chk(n,x,s))
            {
                if(res==-1||res>x)res=x;
            }
        }
    }
    return res;
}
main()
{
    cin>>n>>s;
    cout<<calc(n,s);
    return 0;
}

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

using namespace std;

typedef long long int ll;
typedef pair<ll, ll> pll;

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

string A[4] = {"A", "C", "G", "T"};
//! [入れる文字][1文字前][2文字前]
ll dp[105][5][5][5];

int main() {
    ll N;
    cin >> N;
    memset(dp, 0, sizeof(dp));
    REP(i, 4) {
        REP(j, 4) {
            REP(k, 4) {
                string s = A[i] + A[j] + A[k];
                if (s == "AGC" || s == "ACG" || s == "GAC")
                    continue;
                dp[3][k][j][i] = 1;
            }
        }
    }

    for (ll i = 4; i <= N; ++i) {
        REP(a, 4) {
            REP(b, 4) {
                REP(c, 4) {

                    REP(j, 4) {
                        string s = A[b] + A[c] + A[j];
                        if (s == "GAC" || s == "AGC" || s == "ACG")
                            continue;
                        string t = A[c] + A[j];
                        if (t == "GC" && A[a] == "A")
                            continue;
                        string r = A[a] + A[b];
                        if (r == "AG" && A[j] == "C")
                            continue;
                        dp[i][j][c][b] += dp[i - 1][c][b][a];
                        dp[i][j][c][b] %= MOD;
                    }
                }
            }
        }
    }

    ll ans = 0;
    REP(i, 4) {
        REP(j, 4) {
            REP(k, 4) {
                ans += dp[N][i][j][k];
                ans %= MOD;
            }
        }
    }

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

Measured memory_bytes: 384
import java.util.Scanner;

public class Main {
    public static void main(String args[]){
	Scanner in= new Scanner(System.in);
	short a = 0;
	short b = 0;
	short c = 0;
	while (true){
		a = in.nextShort();
		b = in.nextShort();
		if (a == 0 && b == 0){
			break;
		}else if (a > b){
			c = a;
			a = b;
			b = c;
		}
	        System.out.printf("%d %d%n", a, b);
	} 
    }   
}

Measured memory_bytes: 34144
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

const int MAX_N=1001;
int n;
vector<int> g[MAX_N];
int match[MAX_N];
int used[MAX_N];
void add_edge(int src,int dst){
    g[src].pb(dst);
    g[dst].pb(src);
}
bool dfs(int v){
    used[v]=true;
    rep(i,g[v].size()){
        int u=g[v][i],w=match[u];
        if(w<0||!used[w]&&dfs(w)){
            match[v]=u;
            match[u]=v;
            return true;
        }
    }
    return false;
}

int bipartite_matching(){
    int res=0;
    memset(match,-1,sizeof(match));
    rep(i,n){
        if(match[i]<0){
            memset(used,0,sizeof(used));
            if(dfs(i)) ++res;
        }
    }
    return res;
}

int a[1001];
int main(){
    int m;
    while(cin>>n>>m,n|m){
        rep(i,1001) g[i].clear();
        rep(i,n) cin>>a[i];
        rep(i,m) cin>>a[i+n];
        rep(i,n)FOR(j,n,n+m){
            if(__gcd(a[i],a[j])!=1) add_edge(i,j);
        }
        n+=m;
        cout<<bipartite_matching()<<endl;
    }
    return 0;
}


Measured memory_bytes: 4948
#include <bits/stdc++.h>
#define ll long long
#define REP(i, n) for (ll i = 0, max_i = (n); i < max_i; i++)
#define REPI(i, a, b) for (ll i = (a), max_i = (b); i < max_i; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define RALL(obj) (obj).rbegin(), (obj).rend()
#define fi first
#define se second
#define pb push_back
#define debug(x) cerr << #x << ": " << (x) << endl
#define debug2(x, y) cerr << #x << ": " << (x) << " " << #y << ": " << y << endl;
#define int long long
using namespace std;
using II = pair<int, int>;
using VII = vector<II>;
using VI = vector<int>;
using VVI = vector<VI>;
using VVVI = vector<VVI>;
template <class T = int> inline T in() { T x; cin >> x; return x; }
template <class T = int> inline bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template <class T = int> inline bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }
template <class T> ostream& operator<<(ostream &s, const vector<T>& d) { int n = d.size(); REP (i, n) s << d[i] << " "; return s; }
template <class T> ostream& operator<<(ostream &s, const vector<vector<T>>& dd) { for (vector<T> d: dd) s << d << endl; return s; }
struct Fast { Fast() { cin.tie(0); ios::sync_with_stdio(false); } } fast;
const int MOD = 1e9 + 7;
class UndirectedGraph {
  struct Edge { int to, cost; };
public:
  vector<vector<Edge>> G;
  int V;
  UndirectedGraph(int V) : G(V), V(V) {}
  void add_edge(int u, int v, int cost) {
    G[u].push_back({v, cost});
    G[v].push_back({u, cost});
  }
  VI dijkstra(int s) {
    VI d(V, 1e18); d[s] = 0;
    priority_queue<II, VII, greater<II>> que; // {dist, v}
    que.push({0, s});
    while (!que.empty()) {
      II p = que.top(); que.pop();
      int v = p.second;
      if (d[v] < p.first) continue;
      for (Edge e: G[v]) {
        int tmp = d[v] + e.cost;
        if (d[e.to] <= tmp) continue;
        d[e.to] = tmp;
        que.push({tmp, e.to});
      }
    }
    return move(d);
  }
};

signed main() {
  int n, m, s, t; cin >> n >> m >> s >> t;
  s--; t--;
  UndirectedGraph g1(n), g2(n);
  REP (i, m) {
    int u, v, a, b; cin >> u >> v >> a >> b;
    u--; v--;
    g1.add_edge(u, v, a);
    g2.add_edge(u, v, b);
  }
  VI d1 = g1.dijkstra(s);
  VI d2 = g2.dijkstra(t);
  VI ans(n + 1, 1e18);
  for (int i = n - 1; i >= 0; i--) {
    ans[i] = min(ans[i + 1], d1[i] + d2[i]);
  }
  REP (i, n) {
    cout << (int)1e15 - ans[i] << endl;
  }
}


Measured memory_bytes: 19016
n=int(input())
s=input()
r=s.count('R')
g=s.count('G')
b=s.count('B')
ans=r*b*g
for i in range(1,(n-1)//2+1):
    for j in range(n):
        if j+i+i>n-1:
            break
        if s[j]!=s[j+i] and s[j+i]!=s[j+i+i] and s[j]!=s[j+i+i]:
            ans-=1
print(ans)

Measured memory_bytes: 78208
n,p = map(int,input().split())
a = list(map(int,input().split()))
odd = [i for i in a if i%2==1]
eve = [i for i in a if i%2==0]
odd_len = len(odd)
eve_len = len(eve)
if p==0:
    ans = 2**eve_len
else:
    ans = 0
count = 0
if p==0:
    if odd_len!=0:
        ans *= 2**odd_len//2
else:
    ans +=   (2**eve_len)*(2**odd_len//2)
print(ans)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <algorithm>
#define ll long long
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(abs(a-c)<=d||(abs(a-b)<=d&abs(c-b)<=d)){
        cout<<"Yes";
    }else{
        cout<<"No";
    }
    return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <complex>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>
#include <functional>
#include <cstring>
#include <regex>
#include <random>
#include <cassert>
#include <stack>
#include <climits>
#include <chrono>
#include <fstream>
using namespace std;

#pragma region

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repr(i, s, n) for (int i = (s); i < (int)(n); i++)
#define revrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define revrepr(i, s, n) for (int i = (n) - 1; i >= s; i--)
#define debug(x) cerr << #x << ": " << x << "\n"
#define popcnt(x) __builtin_popcount(x)

const double PI = acos(-1.0);

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

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; }

template<class T>
istream& operator >>(istream &is, vector<T> &v) {
    for (int i = 0; i < (int)v.size(); i++) cin >> v.at(i);
    return is;
}

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

template<class T>
void print(const vector<T> &v, const string &delimiter = " ") { rep(i, v.size()) cout << (0 < i ? delimiter : "") << v.at(i); cout << endl; }

template<class T>
void print(const vector<vector<T>> &vv, const string &delimiter) { for (const auto &v: vv) print(v, delimiter); }

#pragma endregion


int main() {
    int n, h, w;
    cin >> n >> h >> w;
    int ans = 0;
    rep(i, n) {
        int a, b;
        cin >> a >> b;
        if (h <= a && w <= b) ans++;
    }
    cout << ans << endl;
}

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


//TEMPLATE
#define pb                push_back
#define mp                make_pair
#define ll                long long
#define ld                long double
#define pii               pair <ll, ll>
#define piii              pair <ll, pii>
#define F                 first
#define S                 second

#define newline           printf("\n")
#define minusone          printf("-1\n")
#define zeroo             printf("0\n")
#define scl1(a)           scanf("%lld", &a)
#define scl2(a, b)        scanf("%lld %lld", &a, &b)
#define scl3(a, b, c)     scanf("%lld %lld %lld", &a, &b, &c)
#define prl1(a)           printf("%lld\n", a)
#define prl2(a, b)        printf("%lld %lld\n", a, b)
#define ssl1(s)           scanf(" %[^\n]", s)
#define scd1(a)           scanf("%lf", &a)
#define scd2(a, b)        scanf("%lf %lf", &a, &b)
#define prd(a)            printf("%lf\n", a)
#define prld(a)           printf("%Lf\n", a)
#define prcase(cs)        printf("Case %lld: ", cs)
#define cin1(a)           cin >> a
#define cin2(a, b)        cin >> a >> b
#define cin3(a, b, c)     cin >> a >> b >> c
#define cin4(a, b, c, d)  cin >> a >> b >> c >> d
#define cot1(a)           cout << a << "\n"
#define cot2(a, b)        cout << a << " " << b << "\n"
#define cot3(a, b, c)     cout << a << " " << b << " " << c << "\n"
#define cot4(a, b, c, d)  cout << a << " " << b << " " << c << " " << d << "\n"
#define cotline           cout << "\n"
#define cotminus          cout << "-1\n"
#define cot0              cout << "0\n"
#define cotyes            cout << "YES\n"
#define cotno             cout << "NO\n"
#define cotcase(cs)       cout << "Case " << cs << ": "

#define reversed(s)       reverse(s.begin(), s.end())
#define asort(s)          sort(s.begin(), s.end())
#define dsort(s)          sort(s.rbegin(), s.rend())
#define all(s)            s.begin(), s.end()
#define uniq(s)           s.resize(distance(s.begin(),unique(s.begin(), s.end())))
#define found(s, x)       (s.find(x) != s.end())

#define for0(i, n)        for (i = 0; i < n; i++)
#define for1(i, n)        for (i = 1; i <= n; i++)
#define fora(i, a, b)     for (i = a; i <= b; i++)
#define forb(i, b, a)     for (i = b; i >= a; i--)
#define fori(it, s)       for(auto it = s.begin(); it != s.end(); it++)

#define FR                ios_base::sync_with_stdio(false);cin.tie(NULL)
#define ms(a, x)          memset(a, x, sizeof a)
#define bitcount(n)       __builtin_popcountll(n)

//#define pi              3.1415926536
#define pi                acos(-1)

const ll INF = LLONG_MAX;
const ll SZ = 4e5+5;
const ll mod = 1e9+7;


ll n;
//ll a[SZ];
//ll b[SZ];

ll nsum(ll x) {
    return ((x * (x-1)) / 2);
}


int main() {
    ll cs = 0, tc = 1, x, y, z, i, j, k, g, p, q, ans = 0, sum = 0, c = 0, t = 0;
//    ll a, b, d;
    string s, s1, s2;

    cin1(n);
    cot1(nsum(n));

    return 0;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string s;
	cin >> s;
	if(s[0] == 'S'){
		cout << "Cloudy\n";
	}else if(s[0] == 'C'){
		cout << "Rainy\n";
	}else{
		cout << "Sunny\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <cstdlib>
#include <algorithm>
#include <iterator>
#include <stack>
#define INF 100000000
typedef long long int lli;
using namespace std;

struct edge{int from1,to1,from2,to2,cost;};
int shortest_path(int s,int V,int E,vector<int> d,vector<edge> es){
	int result=0;
	for(int i=0; i<V; ++i) d[i]=INF;
	d[s]=0;
	while(true){
		bool update = false;
		for(int i=0; i<E; ++i){
			edge e=es[i];
			if(d[e.from1]!=INF&&d[e.to1]>d[e.from1]+e.cost){
				d[e.to1]=d[e.from1]+e.cost;
				update=true;
			}
			if(d[e.from2]!=INF&&d[e.to2]>d[e.from2]+e.cost){
				d[e.to2]=d[e.from2]+e.cost;
				update=true;
			}
		}
		if(!update) break;
	}
	for(int i=0; i<V; ++i){
		result+=d[i];
	}
	return result;
}

int main(){
	int n;
	while(cin>>n&&n){
		vector<edge> es(n);
		int m=0;
		for(int i=0; i<n; ++i){
			int a,b,c;
			cin >> a >> b >> c;
			m=max(a,max(b,m));
			es[i].from1=a;
			es[i].to1=b;
			es[i].from2=b;
			es[i].to2=a;
			es[i].cost=c;
		}
		vector<int> d(m+1);
		int ans_d=INF;
		int ans_s;
		for(int i=m; i>=0; --i){
			int tmp=shortest_path(i,m+1,n,d,es);
			//cout << tmp << "\n";
			if(ans_d>=tmp){
				ans_d=tmp;
				ans_s=i;
			}
		}
		cout << ans_s << " " << ans_d << "\n";
	}
	return 0;
}

Measured memory_bytes: 1220
#include<bits/stdc++.h>
using namespace std;
long long a,b,ans;
int test;
inline bool check(long long o) {
	if (o&1) {
		long long x=(o+1)>>1,y=(o+1)>>1;
		if (a<=x) x++;
		if (b<=y) y++;
		return x*y<a*b;
	}
	else {
		long long x=o>>1,y=o>>1;
		y++;
		if (a<=x) x++;
		if (b<=y) y++;
		if (x*y>=a*b) return false;
		x=o>>1,y=o>>1;
		x++;
		if (a<=x) x++;
		if (b<=y) y++;
		return x*y<a*b;
	}
}

int main() {
	scanf("%d",&test);
	while (test--) {
		scanf("%lld%lld",&a,&b);
		long long l=0,r=2*((long long ) sqrt(a*b)+5);
		ans=0;
		while (l<=r) {
			long long mid=(l+r)>>1;
			if (check(mid)) ans=mid,l=mid+1;
			else r=mid-1;
		}
		printf("%I64d\n",ans);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <utility>
#include <tuple>
#include <regex>
#include <map>
#include <bitset>

using namespace std;
using ull = unsigned long long;
using ll = long long;

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

#define EPS (1e-7) 
#define ALL(x) begin(x), end(x)

int main() {
	size_t R, G, B, N;
	cin >> R >> G >> B >> N;

	vector<ull> rgVec;
	ull ans = 0;
	for (size_t r = 0; r <= N; r++) {
		const ull rr = r * R;
		if (rr > N) break;
		for (size_t g = 0; g <= N; g++) {
			const ull gg = g * G;
			const ull rg = rr + gg;
			if (rg <= N) {
				if ((N - rg) % B == 0) {
					ans++;
				}
			} else {
				break;
			}
		}
	}

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def bb081():
    n = int(input())
    an = list(map(int, input().split()))

    cnt = 0
    alleven = True
    while alleven:
        for i in range(0, n):
            if an[i]%2 == 0:
                an[i] /= 2
            else:
                alleven = False
                break
        if alleven:
            cnt += 1

    print(cnt)

bb081()

Measured memory_bytes: 3060
#include <bits/stdc++.h> // imports every library in c++
using namespace std; // ; is essential | says that you are USING the libraries

//  COMMAND TO USE WHEN RUNNING CODE: g++ day6.cpp -o day6 -std=c++11 -O2  | to run: ./(name of file)  //

string S, T, s[3], t[3];
int c = 0;

int main() {
    cin >> S;
    cin >> T;
    for ( int i = 0; i < 3; i++ ) {
        s[i] = S[i];
    }
    for ( int i = 0; i < 3; i++ ) {
        t[i] = T[i];
    }
    for ( int i = 0; i < 3; i++ ) {
        if ( s[i] == t[i] ) {
            c += 1;
        }
    }
    cout << c;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
int a[100002][5];
int N;
int dp[100002][5];
int fun(int i,int x)
{
  int max;
  if(i==N)
  {
    dp[i][x]=0;
    return 0;
  }
  if(x==0)
  {
    if(dp[i+1][1]==-1)
      dp[i+1][1]=fun(i+1,1);
    if(dp[i+1][2]==-1)
      dp[i+1][2]=fun(i+1,2);
    max=dp[i+1][1]>=dp[i+1][2]?dp[i+1][1]:dp[i+1][2];
    dp[i][0]=a[i][0]+max;
  }
  else if(x==1)
  {
    if(dp[i+1][0]==-1)
      dp[i+1][0]=fun(i+1,0);
    if(dp[i+1][2]==-1)
      dp[i+1][2]=fun(i+1,2);
    max=dp[i+1][0]>=dp[i+1][2]?dp[i+1][0]:dp[i+1][2];
    dp[i][1]=a[i][1]+max;
  }
  else
  {
    if(dp[i+1][1]==-1)
      dp[i+1][1]=fun(i+1,1);
    if(dp[i+1][0]==-1)
      dp[i+1][0]=fun(i+1,0);
    max=dp[i+1][1]>=dp[i+1][0]?dp[i+1][1]:dp[i+1][0];
    dp[i][2]=a[i][2]+max;
  }
  return dp[i][x];
}
int main()
{
  int i,max;
  cin>>N;
  for(i=0;i<N;i++)
  {
  	cin>>a[i][0]>>a[i][1]>>a[i][2];
  }
  for(i=0;i<100002;i++)
  {
    dp[i][0]=-1;
    dp[i][1]=-1;
    dp[i][2]=-1;
    dp[i][3]=-1;
  }
  dp[0][0]=fun(0,0);
  dp[0][1]=fun(0,1);
  dp[0][2]=fun(0,2);
  max=dp[0][0]>=dp[0][1]?dp[0][0]:dp[0][1];
  max=max>=dp[0][2]?max:dp[0][2];
  cout<<max<<endl;
  return 0;
}

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

const int MAX = 510000;
const int MOD = 1000000007;

#define lli long long 
#define DEBUG 0

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;
}

int main() {
    // 前処理
    COMinit();

    lli h,w;
    lli a,b;
    cin>>h>>w>>a>>b;

    h--;
    w--;

    lli ans = 0;

    for(lli i=0;i<=h-a;i++){
    	if(DEBUG)cout<<"b+iCi"<<COM(b+i,i)<<" C "<<COM(h-i+w-b,h-i)<<endl;
    	ans += (COM(b+i-1,i) * COM(h-i+w-b,h-i)) % MOD;
    }

    cout<<ans%MOD<<endl;

    // 計算例
    //cout << COM(100000, 50000) << endl;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
#define REP(i,n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i,a,b) for (ll i=(a);i<(ll)b; i++)
#define ALL(obj) (obj).begin(),(obj).end()
#define INF 1LL << 60
using namespace std;
typedef long long ll;
typedef double db;
typedef string str;
typedef pair<ll,ll> p;
const long long MOD=1000000007;

// vector<p> cut(M); vector<vector<ll> > v(4);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()), sort(v.rbegin(), v.rend()); //sort
// char '' str ""
int main(void)
{
    int N,K; cin>>N>>K;
    int sum=1;
    for(int i=0;i<N;i++){
      int po = sum * 2;
      int pl = sum + K;
      sum = min(po, pl);
    }

    cout<<sum<<endl;

    return 0;
}


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

int main()
{
    int A;
    cin >> A;
    
    int ans = 0;
    int N = 1;
    int fans = 0; 
    while(N<=A){
        for(int i=1; i<=N; i++){
            if(N%i == 0){
                ans += 1;
            }
        }
        if(ans == 8){
            fans += 1;
        }
        N += 2;
        ans = 0;
    }
    
    cout << fans << endl;
}



Measured memory_bytes: 3640
import java.util.*;
import static java.lang.Math.*;
import java.math.BigInteger;

public class Main {
    
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		
		// 入力
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		
		// 計算
		int result = min(c, b/a);

		// 出力
		System.out.println(result);
        
	}
}


Measured memory_bytes: 23764
def solve():
    N=list(input())
    if N==["0"]:
        exit()
    else:
        ans=0
        cnt={i:0 for i in range(11)}
        sums=0
        cnt[0]=1
        N=N[::-1]
        for i in range(len(N)):
            sums+=pow(10,i,11)*int(N[i])
            sums%=11
            cnt[sums]+=1
            if int(N[i])==0:
                ans-=(cnt[sums]-1)
        for i in range(11):
            K=cnt[i]
            ans+=(K*(K-1))//2
        print(ans)
        return solve()
if __name__=="__main__":
    solve()        


Measured memory_bytes: 15368
#include <iostream>
#include <algorithm>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <cmath>
#include <bitset>
#include <complex>

// output
#define SPBR(w, n) std::cout<<(w + 1 == n ? '\n' : ' ');
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
// utility
#define ALL(i) (i).begin(), (i).end()
#define FOR(i, a, n) for(int i=(a);i<(n);++i)
#define RFOR(i, a, n) for(int i=(n)-1;i>=(a);--i)
#define REP(i, n) for(int i=0;i<int(n);++i)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define IN(a, x, b) (a<=x && x<b)
#define OUT(a, x, b) (x<a || b<=x)
template<class T> inline T chmax(T & a, const T b) { return a = (a < b) ? b : a; }
template<class T> inline T chmin(T& a, const T b) { return a = (a > b) ? b : a; }

// type/const
#define int ll
using ll = long long;
using ull = unsigned long long;
using ld = long double;
const int MOD = 1000000007;
const int INF = 1e18;
const double PI = acos(-1);

using namespace std;


signed main() {
  int X, Y, Z, K;
  cin >> X >> Y >> Z >> K;

  vector<int> A(X), B(Y), C(Z);
  REP(i, X) cin >> A[i];
  REP(i, Y) cin >> B[i];
  REP(i, Z) cin >> C[i];

  sort(ALL(A), greater<int>());
  sort(ALL(B), greater<int>());
  sort(ALL(C), greater<int>());

  priority_queue<pair<int, tuple<int, int, int>>> q;
  q.push(make_pair(A[0]+B[0]+C[0], make_tuple(0, 0, 0)));
  vector<vector<vector<bool>>> vec(1010, vector<vector<bool>>(1010, vector<bool>(1010, false)));
  while(K--){
    auto p = q.top(); q.pop();
    int i = get<0>(p.second);
    int j = get<1>(p.second);
    int k = get<2>(p.second);
    cout << p.first << endl;

    if(i+1 < X && !vec[i+1][j][k]){
      q.push(make_pair(A[i+1]+B[j]+C[k], make_tuple(i+1, j, k)));
      vec[i+1][j][k] = true;
    }
    if(j+1 < Y && !vec[i][j+1][k]){
      q.push(make_pair(A[i]+B[j+1]+C[k], make_tuple(i, j+1, k)));
      vec[i][j+1][k] = true;
    }
    if(k+1 < Z && !vec[i][j][k+1]){
      q.push(make_pair(A[i]+B[j]+C[k+1], make_tuple(i, j, k+1)));
      vec[i][j][k+1] = true;
    }
  }

  return 0;
}

Measured memory_bytes: 184064
#!/usr/bin/env python3
n, k = [int(_) for _ in input().split()]
v = [int(_) for _ in input().split()]

ans = 0

for l in range(n):
    for r in range(n - l + 1):
        if l + r > k:
            break
        nv = v[:l] + v[n - r:]
        nv.sort()
        for i in range(k - l - r):
            if not nv or nv[0] >= 0:
                break
            del nv[0]
        ans = max(ans, sum(nv))

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <unordered_set>

#define NMAX 100010
#define MOD 1000000007
#define INF 2000000000
#define PI 3.1415926535
#define EPS 1.e10-6

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) > 0 ? (a) : (-a))

typedef unsigned long long ull;

using namespace std;

int n;

int main()
{
	int a, b, c;
	cin >> a >> b >> c;
	if (a + b + c > 21)
		cout << "bust\n";
	else
		cout << "win\n";
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int zettaiti(int a, int b) {
	int c;
	c = a - b;
	if (c >= 0) {
		return c;
	}
	else {
		c = (-1)*c;
		return c;
	}
}

int main(void) {
	int x, y, z;
	int s, t;

	scanf("%d%d%d", &x, &y, &z);

	s = zettaiti(x, y);
	t = zettaiti(x, z);

	if (s <= t) {
		printf("A\n");
	}
	else {
		printf("B\n");
	}

	return 0;

	
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF 1e18
#define int long long
#define Rep(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) Rep(i, 0, n)
#define all(a) (a).begin(), (a).end()
using namespace std;
typedef pair<int, int> P;
typedef pair<int, P> PP;
const int mod = 1000000007;

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

    int n;
    cin >> n;
    cout << (n % 2 ? (n + 1.0) / (2.0 * n) : 0.5) << endl;
}

Measured memory_bytes: 256
import sys
sys.setrecursionlimit(700000)

def s_in():
    return input()

def n_in():
    return int(input())

def l_in():
    return list(map(int, input().split()))

class Interval():
    def __init__(self, li):
        self.li = li
        self.n = len(li)
        self.sum_li = [li[0]]
        for i in range(1, self.n):
            self.sum_li.append(self.sum_li[i-1] + li[i])

    def sum(self, a, b=None):
        if b is None:
            return self.sum(0, a)

        res = self.sum_li[min(self.n-1, b-1)]
        if a > 0:
            res -= self.sum_li[a-1]
        return res

n,k = l_in()
P = list(map(lambda p: (1+p)/2, l_in()))

res = sum(P[:k])
current = res

for i in range(k, n):
    current -= P[i-k]
    current += P[i]
    res = max(res, current)

print(res)


Measured memory_bytes: 77448
#include<bits/stdc++.h>
#include<vector>
using namespace std;
int main(void){
  string N;
  cin >> N;
  if(N == "Sunny"){
     cout << "Cloudy";
  } else if(N == "Cloudy"){
    cout << "Rainy";
  } else {
    cout << "Sunny";
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main{
    public static void main(String[]args){
        Scanner sc=new Scanner(System.in);
        
        int d=sc.nextInt();
        int n=sc.nextInt();
        if(n==100)n++;
        long ans=(long)Math.pow(100,d)*n;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
package main

import "fmt"

func main() {
	var a, b, x int
	fmt.Scan(&a, &b, &x)
	var min, max int
	if a%x != 0 {
		min = (a/x + 1) * x
	} else {
		min = (a / x) * x
	}
	if b%x != 0 {
		max = b / x * x
	} else {
		max = (b / x) * x
	}
	if max < min {
		fmt.Println(0)
		return
	}
	fmt.Println((max-min)/x + 1)
}


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

using namespace std;

int main()
{
    vector<int> list;

    for (int i = 0; i < 10; ++i) {
        int tmp;
        cin>>tmp;
        list.push_back(tmp);
    }
    sort(list.begin(),list.end(),greater<int>());
    for (int j = 0; j < 3; ++j) {
        cout<<list[j]<<endl;
    }
    return 0;
}

Measured memory_bytes: 1216
#include <iostream>
#include <string>
#include <algorithm>
#include <cctype>
 
using namespace std;

typedef long long lli;
 
lli exp();
lli term();
lli factor();
 
string str, in;
lli pos, p;
bool f;
 
lli xgcd(lli a, lli b, lli& x, lli& y){
  if(b == 0){
    x = 1;
    y = 0;
    return a;
  }
  lli g = xgcd(b, a%b, y, x);
  y -= a / b * x;
  return g;
}

lli modinv(lli a, lli m){
  lli x, y;
  if(xgcd(a, m , x, y) == 1) return (x + m) % m;
  return -1;
}

lli exp(){
  lli val = term();
  while(str[pos] == '+' || str[pos] == '-'){
    char op = str[pos++];
    lli t = term();
    if(op == '+') val = (val + t) % p;
    else val = (val + p - t) % p;
  }
  return val;
}
 
lli term(){
  lli val = factor();
  while(str[pos] == '*' || str[pos] == '/'){
    char op = str[pos++];
    lli t = factor();
    if(op == '*') val = val * t % p;
    else{
      if(t == 0) f = false;
      else val = val * modinv(t, p) % p;
    }
  }
  return val;
}
 
lli factor(){
  if(str[pos] == '('){
    pos++;
    lli val = exp();
    pos++;
    return val;
  }else {
    lli val = 0;
    while(isdigit(str[pos])) val = (val * 10 + (str[pos++] - '0')) % p;
    return val;
  }
}
 
void solve(){
  f = true;
  pos = 0;
  lli res = exp();
  if(!f) cout << "NG" << endl;
  else cout << str << " = " << res << " (mod " << p << ")" << endl;
}
 
main(){
  while(getline(cin, in) && in != "0:"){
    int k = in.find(':');
    p = atoll(in.substr(0, k).c_str());
    string tmp = in.substr(k+1);
    str = "";
    for(lli i=0;i<tmp.size();i++) if(tmp[i] != ' ') str += tmp[i];
    solve();
  }
}

Measured memory_bytes: 1340
A = int(input())
B = int(input())
C = int(input())
X = int(input())
ans = 0
for a in range(A + 1):
    for b in range(B + 1):
        for c in range(C + 1):
            if a * 500 + b * 100 + 50 * c == X:
                ans += 1
print(ans)


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/






int N, x[101], y[101], h[101];
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) cin >> x[i] >> y[i] >> h[i];

    rep(cx, 0, 101) rep(cy, 0, 101) {
        int H = 1;
        rep(i, 0, N) if (h[i]) H = h[i] + abs(cx - x[i]) + abs(cy - y[i]);
        int ok = 1;
        rep(i, 0, N) if (max(H - abs(x[i] - cx) - abs(y[i] - cy), 0) != h[i]) ok = 0;
        if (ok) {
            printf("%d %d %d\n", cx, cy, H);
            return;
        }
    }
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func getScanner(fp *os.File) *bufio.Scanner {
	scanner := bufio.NewScanner(fp)
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 500001), 500000)
	return scanner
}

func getNextString(scanner *bufio.Scanner) string {
	scanner.Scan()
	return scanner.Text()
}

func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}

func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}

func getNextUint64(scanner *bufio.Scanner) uint64 {
	i, _ := strconv.ParseUint(getNextString(scanner), 10, 64)
	return i
}

func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}

func main() {
	fp := os.Stdin
	wfp := os.Stdout

	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
		if len(os.Args) > 2 {
			wfp, _ = os.Create(os.Args[2])
		}
	}

	scanner := getScanner(fp)
	writer := bufio.NewWriter(wfp)

	a := getNextInt(scanner)
	b := getNextInt(scanner)
	c := getNextInt(scanner)

	ans := "No"
	if c <= a+b {
		ans = "Yes"
	}

	fmt.Fprintln(writer, ans)
	writer.Flush()
}


Measured memory_bytes: 640
#include<iostream>

#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);++i)

using namespace std;

typedef long long int lli;

lli A[100010];
lli B[100010];

int main(){
  lli N;
  cin >> N;
  REP (i, 0, N) cin >> A[i] >> B[i];
  lli ans = 0;
  lli sum = 0;
  for (int i = N - 1; i >= 0; i--) {
    A[i] += sum;
    lli temp = (B[i] - (A[i] % B[i])) % B[i];
    ans += temp;
    sum += temp;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr double INFD = 1e100;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
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; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int H;
    cin >> H;
    while(H != 0){
        vector<vector<int>> G(H,vector<int> (5));
        for(int i=0; i<H; i++){
            for(int j=0; j<5; j++){
                cin >> G[i][j];
            }
        }
        int ans = 0;
        while(1){
            bool did = false;
            for(int i=0; i<H; i++){
                for(int j=0; j<3; j++){
                    if(G[i][j] == -1) continue;
                    int cnt = 1;
                    while(j+cnt<5 and G[i][j] == G[i][j+cnt]){
                        cnt++;
                    }
                    if(cnt>=3){
                        did = true;
                        ans += cnt*G[i][j];
                        int temp = G[i][j];
                        while(G[i][j] == temp){
                            G[i][j] = -1;
                            j++;
                        }
                        break;
                    }
                }
            }
            while(1){
                bool did2 = false;
                for(int i=H-1; i>=1; i--){
                    for(int j=0; j<5; j++){
                        if(G[i][j] == -1 and G[i-1][j] != -1){
                            G[i][j] = G[i-1][j];
                            G[i-1][j] = -1;
                            did2 = true;
                        }
                    }
                }
                if(!did2) break;
            }
            if(!did) break;
        }
        cout << ans << enld;
        cin >> H;
    }
    return 0;
}



Measured memory_bytes: 3192
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		var a=sc.Ia;
		var d=new double[s[0]];
		double ans=0,p=0;
		for(int i = 0;i<s[0];i++) {
			if(i>=s[1]){p-=d[i-s[1]];}
			d[i]=(double)Ap(1,1,a[i])/a[i];
			p+=d[i];
			ans=Max(ans,p);
		}
		Console.WriteLine("{0}",ans);
	}
	static long Ap(long a,long d,long n){return (n*((a<<1)+(n-1)*d))>>1;}
}
public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public double[] Da2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),double.Parse);}}
	public double[] Da3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),double.Parse);}
	public double[] Da3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),double.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}

Measured memory_bytes: 29788
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let s = read::<String>().chars().collect::<Vec<_>>();
    if s[2] == s[3] && s[4] == s[5] {
        println!("Yes");
    } else {
        println!("No");
    }
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


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

int main() {
    int H, W;
    cin >> H >> W;
    while (H != 0 || W !=0) {
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                if ((i + j) % 2 == 0) {
                    cout << "#";
                } else {
                    cout << ".";
                }
            }
            cout << endl;
        }
        cout << endl;
        cin >> H >> W;
    }
}


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


int main(){
  unsigned long long A;
  long double B;
  cin>>A>>B;
  B*=A;
  ll ans=B;
  cout<<ans;
}


Measured memory_bytes: 3728
#include<bits/stdc++.h>
#define ll long long int 
#define pb push_back
#define mp make_pair
#define f(i,a,n) for(int i=a;i<n;i++)
#define ve vector
#define ss second 
#define ff first
#define pf pop_front
#define pob pop_back
#define psf push_front
#define it vector<ll>:: iterator
#define res(x) cout<<x<<'\n'
#define read(t) ll t;cin>>t
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    read(n);
    read(k);
    ll a[n];
    f(i,0,n)
    cin>>a[i];
    sort(a,a+n);
    bool dp[k+1];
    for(int i=0;i<=k;i++){
        dp[i]=0;
    }
   // dp[0]=1;
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i<a[j]){
                break;
            }
            else{
                if(!dp[i-a[j]]){
                    dp[i]=1;
                    break;
                }
            }
        }
    }
    if(dp[k]){
        cout<<"First";
    }
    else{
        cout<<"Second";
    }
    return 0;
    }

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

N = int(input())
S = list(input())
R = []
G = []
B = set()
for i in range(N):
    if S[i] =="R":
        R.append(i)
    if S[i] =="G":
        G.append(i)
    if S[i] =="B":
        B.add(i)
M =len(B)
cnt = 0
for r in R:
    for g in G:
        a = (r+g)/2
        b = 2*g-r
        c = 2*r-g
        if a in B:
            cnt-=1
        if b in B:
            cnt-=1
        if c in B:
            cnt-=1
        cnt += M
        
print(cnt)

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

int main()
{
  int n, m;
  cin >> n >> m;
  vector<int> vint(2*m);
  for (int i = 0; i < 2*m; i++)
  {
    cin >> vint.at(i);
  }
  vector<int> ans(n);
  for (int i = 0; i < n; i++)
  {
    ans.at(i) = 0;
  }
  for (int i = 0; i < 2*m; i++)
  {
    ans.at(vint.at(i) - 1)++;
  }
  for (int i = 0; i < n; i++)
  {
    cout << ans.at(i) << endl;
  }
  
  return 0;
}


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

int main()
{
    int n, m;
    cin >> n >> m;
    if (n == m)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}

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

int main() {
  int N;
  cin >> N;
  
  rep (i, N) {
    string S;
    cin >> S;
    
    if (S == "Y") {
      cout << "Four" << endl; 
      break;
    } 
   
    if (i == N-1) {
      cout << "Three" << endl;
    }
  } 
}

Measured memory_bytes: 256
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }

    fn vec<T: FromStr>(&mut self, len: usize) -> Vec<T> {
        (0..len).map(|_| self.input()).collect()
    }

    fn mat<T: FromStr>(&mut self, row: usize, col: usize) -> Vec<Vec<T>> {
        (0..row).map(|_| self.vec(col)).collect()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);

    let (n, k): (i64, i64) = (sc.input(), sc.input());
    let arr: Vec<i64> = sc.vec(n as usize);

    let mut ans = (1i64 << 61);
    for mask in 0..(1 << n) {
        if ((mask as u64).count_ones() as i64) < k {
            continue;
        }

        let mut sum = 0;
        let mut prev_max = 0;
        let mut cnt = 0;
        for i in 0..n {
            if mask >> i & 1 == 1 {
                if prev_max >= arr[i as usize]  {
                    sum += prev_max - arr[i as usize] + 1;
                    prev_max += 1;
                } else {
                    prev_max = arr[i as usize];
                }
                cnt += 1
            } else {
                if prev_max < arr[i as usize] {
                    prev_max = arr[i as usize];
                    cnt += 1;
                }
            }
        }
        if cnt >= k {
            ans = std::cmp::min(ans, sum);
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4352