akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <ctype.h>
#include <inttypes.h>

//int compare_int(const void *a, const void *b){//qsort 整数比較<
//	return *(int*)a - *(int*)b;
//}
//int compare_int2(const void *a, const void *b){//qsort 整数比較>
//	return *(int*)b - *(int*)a;
//}
//
int main(void){
	char s[4]={'\0'};

	scanf("%s%s%s",&s[0],&s[1],&s[2]);
	if(s[0]=='S'){
		if(s[1]=='S'){
			if(s[2]=='S'){
				printf("0");
			}else{
				printf("1");
			}
		}else{
			if(s[2]=='S'){
				printf("1");
			}else{
				printf("2");
			}
		}
	}else{
		if(s[1]=='S'){
			printf("1");
		}else{
			if(s[2]=='S'){
				printf("2");
			}else{
				printf("3");
			}
		}
	}

	return 0;
}


Measured memory_bytes: 1612
#include <iostream>
#include <vector>
#include <set>

using namespace std;

int main(){
    int N, K; cin >> N >> K;
    vector<int> a(N);
    for(auto& t : a) cin >> t;
    set<int> S;
    int prev = 100;
    int cnt = 0;
    int sr = 0;
    int res = 0;
    for(int i=0;i<N;i++){
        if(prev > a[i]) cnt = 1;
        else ++cnt;
        prev = a[i];
        if(cnt >= K) sr = 1;
        else if(i >= K-1) ++res;
        S.insert(a[i]);
        if(i >= K){
            if(cnt < K && *S.rbegin() == a[i] && *S.begin() == a[i-K]) --res;
            S.erase(a[i-K]);
        }
    }
    cout << res + sr << endl;
}


Measured memory_bytes: 10368
#include<bits/stdc++.h>
using namespace std;
const int N = 1e5+1;
long long int tree[4*N]={0};
#define ff first
#define ss second
void update(long int node,long int l,long int r,long int ind,long long int val)
{
    if(l==r)
    {
        tree[node] = val;
    }
    else
    {
        long int mid = (l+r)/2;
        if(mid>=ind)
         update(2*node+1,l,mid,ind,val);
         else
         update(2*node+2,mid+1,r,ind,val);
         tree[node] = max(tree[2*node+1],tree[2*node+2]);
    }
}
long long int query(long int node,long int l,long int r,long int L,long int R)
{
    if(L>r || l>R)
    return 0;
    if(L<=l && R>=r)
    return tree[node];
    long int mid = (l+r)/2;
    return max(query(2*node+1,l,mid,L,R),query(2*node+2,mid+1,r,L,R));
}
long long int mod = 1e9+7;
bool compare(pair<long long int,long long int> a,pair<long long int,long long int> b)
{
    return a.ff>b.ff;
}

long long int power(long long int x,long long int y)
{
    long long int res=1;
    while(y>0)
    {
        if(y&1)res=(res*x)%mod;
        x=(x*x)%mod;
        y>>=1;
    }
    return res;
}
vector<long int> a[200001];bool vis[200001]={0};
long int kk=0;
void dfs(long int x)
{
    kk++;
    vis[x]=1;
    for(long int i=0;i<a[x].size();i++)
    {
        if(vis[a[x][i]]==0)
        {
            dfs(a[x][i]);
        }
    }
}
int main()
{
    long int t=1;
    // cin>>t;
    while(t--)
    {
        long int n,m;
        cin>>n>>m;
        long int aa,bb;
        for(long int i=0;i<m;i++)
        {
            cin>>aa>>bb;
            a[aa].push_back(bb);
            a[bb].push_back(aa);
        }
      long int ans=0;
      for(long int i=1;i<=n;i++)
      {
          if(!vis[i])
          {
              kk=0;
              dfs(i);
              ans=max(ans,kk);
          }
      }
      cout<<ans;
    }
}

Measured memory_bytes: 20976
#include <stdio.h>
#include <string>
#include <iostream>
#include <iomanip>
#include <map>
#include <algorithm>
#include <vector>
#include <math.h>
#define MOD 1000000007
using namespace std;

int main(void){
	string s,S;
	cin >> s;
	//端を落とす
	for(int i=0; i<s.length(); i++){
		S=s.substr(0,i);
		if(S=="keyence"){
			cout << "YES" << endl;
			return 0;
		}
		S=s.substr(i);
		if(S=="keyence"){
			cout << "YES" << endl;
			return 0;
		}
	}
	//中抜き
	for(int i=0; i<s.length(); i++){
		for(int j=0; i+j<s.length(); j++){
			S=s.substr(0,i)+s.substr(i+j);
			if(S=="keyence"){
				cout << "YES" << endl;
				return 0;
			}
		}
	}
	cout << "NO" << endl;
    return 0;
}

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

#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORd(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FORall(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define FORalld(it, a) for (__typeof((a).rbegin()) it = (a).rbegin(); it != (a).rend(); it++)
#define sz(a) int((a).size())
#define present(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<pi> vii;
const int MOD = (int) 1e9 + 7;
const int INF = (int) 1e9;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
template<class T> inline int chkmin(T& a, const T& val) {return val < a ? a = val, 1 : 0;}
template<class T> inline int chkmax(T& a, const T& val) {return a < val ? a = val, 1 : 0;}
template<class T> inline T isqrt(T k) {T r = sqrt(k) + 1; while (r * r > k) r--; return r;}
template<class T> inline T icbrt(T k) {T r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;}
inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;}
inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}

const int maxn = 2e5 + 5;
int n, k;
string s;

void solve() {
    cin >> n >> k >> s;
    queue<int> que;
    FOR(i, 0, n) que.push(s[i] - 'A');
    int dif = 0;
    int mn = min(k, n + n + n);
    FOR(i, 0, mn) {
        if (!(que.front() ^ dif)) {
            que.front() ^= 1;
        }
        else {
            int x = que.front();
            que.pop();
            que.push(x);
            dif ^= 1;
        }
    }
    if (k > mn && (k - mn & 1) && !(que.front() ^ dif)) {
        que.front() ^= 1;
    }
    FOR(i, 0, n) {
        cout << char('A' + (que.front() ^ dif));
        que.pop();
    }
    cout << "\n";
}

int main() {
#ifdef _LOCAL_
    freopen("in.txt", "r", stdin); //freopen("out.txt", "w", stdout);
#else
    ios_base::sync_with_stdio(0); cin.tie(0);
#endif
    solve();
    cerr << "\nTime elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << "s\n";
    return 0;
}


Measured memory_bytes: 1560
#include <stdio.h>

long long a,b,c[100100];

int main(void)
{
	
	int d,e,f,g;
	
	scanf("%d %lld",&d,&a);
	
	while(d--){
		scanf("%d",&e);
		scanf("%d",&f);
		c[e] += f;
	}
	
	b = 0;
	for(g = 1;g <= 100000; g++){
		b += c[g];
		if(b >= a){
			printf("%d\n",g);
			break;
		}
	}
	printf("\n");
	
	return(0);
}


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

using namespace std;
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;

#define REP(i, n, m) for(ll i=n; i<(ll)m; ++i)
#define IREP(i, n, m) for(ll i=n-1; i>=m; --i)
#define rep(i, n) REP(i, 0, n)
#define irep(i, n) IREP(i, n, 0)
#define all(v) v.begin(), v.end()

int main(){
    ll A, B, T;
    cin >> A >> B >> T;
    ll a = (T/A) * B;
    cout << a << endl;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> Card(N);
  for(int i = 0; i < N; i++) cin >> Card.at(i);
  sort(Card.begin(), Card.end());
  reverse(Card.begin(), Card.end());
  int A, B;
  A = 0;
  B = 0;
  for(int i = 0; i < N; i++){
    if(i % 2 == 0) A += Card.at(i);
    else B += Card.at(i);
  }
  cout << A - B << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
	public static void main(String[]args){
  		Scanner stdIn = new Scanner(System.in);
  		int N = stdIn.nextInt();
  		int M = stdIn.nextInt();
  		int Am=0;
  		int [] A=new int [M];
  		for(int i=0;i<M;i++){
  			A[i] = stdIn.nextInt();
  			Am=Am+A[i];
  		}
  		//System.out.println(N+"n"+M+"M" );
		for(int i=0;i<M;i++){
  			//System.out.println(A[i]+"A"+i);
  		}
  		int ret=N-Am;
  		if(ret<=-1)ret=-1;
  		System.out.println(ret);
 	}
 }

Measured memory_bytes: 46060
#include <stdio.h>
#define inf 1000000007
typedef long long ll;

ll ret(ll n,ll k) {
	return (k*(n-k+1)+1) % inf;
}

int main() {
	ll n,k,ans=0;
	scanf("%lld %lld", &n, &k);
	for (int i = k; i <= n+1; i++) {
		ans += (ret(n, i)) % inf;
	}
	ans = ans % inf;
	printf("%lld", ans);
}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    /*ll n,x=1,i;
    cin>>n;
    ll mod=1000000007;
    ll dp[n+2]
    for(i=1;i<=n-1;i++)
    {
        x=x*2;
        x=x%mod;
    }
    x=x+n-1;
    x=x%mod;
    cout<<x;*/
    /*ll n;
    cin>>n;
    ll a[n],i;
    for(i=0;i<n;i++)
    {
        cin>>n;
    }*/
    ll a,b,c,d;
    cin>>a>>b>>c>>d;
    ll maxi=LLONG_MIN;
    maxi=max(maxi,a*c);
    maxi=max(maxi,a*d);
    maxi=max(maxi,b*c);
    maxi=max(maxi,b*d);
    cout<<maxi;
}


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

using namespace std;

char ch[1005];

int main()
{
    scanf("%s",ch);
    int l = strlen(ch);
    int n;
    scanf("%d",&n);
    for(int i=1;i<=l;i++)
    {
        if(i%n==1&&n!=1)
            printf("%c",ch[i-1]);
    }
    if(n==1) printf("%s",ch);
    return 0;
}

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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll x,y;
    cin >> x >> y;
    if(y%2){
        cout << "No" << endl;
    }else{
        if(y < x*2 || y > 4*x){
            cout << "No" << endl;
        }else{
            cout << "Yes" << endl;
        }
    }

    return 0;
}

Measured memory_bytes: 3592
import heapq

X,Y,Z,K = (int(i) for i in input().split())
a = [-int(i) for i in input().split()]
b = [-int(i) for i in input().split()]
c = [-int(i) for i in input().split()]
q = []
S = set()
a.sort()
b.sort()
c.sort()

heapq.heappush(q,(a[0]+b[0]+c[0],0,0,0))

for i in range(K):
  p,i,j,k=heapq.heappop(q)
  print(-p)
  if i+1 < X and not((i+1,j,k) in S):
    S.add((i+1,j,k))
    heapq.heappush(q,(a[i+1]+b[j]+c[k],i+1,j,k))
  if j+1 < Y and not((i,j+1,k) in S):
    S.add((i,j+1,k))
    heapq.heappush(q,(a[i]+b[j+1]+c[k],i,j+1,k))
  if k+1 < Z and not((i,j,k+1) in S):
    S.add((i,j,k+1))
    heapq.heappush(q,(a[i]+b[j]+c[k+1],i,j,k+1))

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

using namespace std;

bool check(int x, set<int> &D)
{
    while (x > 0) {
        if (D.count(x % 10)) {
            return 0;
        }
        x /= 10;
    }
    return 1;
}

int main()
{
    int N, K, x;
    cin >> N >> K;
    set<int> D;
    for (int i = 0; i < K; i++) {
        cin >> x;
        D.insert(x);
    }

    for (int i = N; ; i++) {
        if (check(i, D)) {
            cout << i << endl;
            break;
        }            
    }    
    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

sum = 0
for i in range(N - 1, -1, -1):
	if A[i + 1] >= B[i]:
		sum += B[i]
		A[i + 1] -= B[i]
		B[i] = 0
	else:
		B[i] -= A[i + 1]
		sum += A[i + 1]
		A[i + 1] = 0
		if A[i] >= B[i]:
			sum += B[i]
			A[i] -= B[i]
			B[i] = 0
		else:
			B[i] -= A[i]
			sum += A[i]
			A[i] = 0

print(sum)

Measured memory_bytes: 82020
#include <bits/stdc++.h>
#define db(a) cout << a << endl
#define db2(a,b) cout << a << " " << b << endl
#define dbd(a) cout << #a << ": " << a << endl
#define dbd2(a,b) cout << #a << ": " << a << ", " << #b << ": " << b << endl 
#define dbp(a) cout << a.first << " " << a.second << endl
#define adb(a) for(auto _i:a) cout << _i << " "; cout << endl
#define adbp(a) for(auto _i:a) cout << _i.first << " " << _i.second << endl;
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define mod 998244353
#define N 10000010
#define M 100010
using namespace std;

int main()
{
    fastIO;
    long long x, y;
    cin >> x >> y;

    if(2*x <= y && y <= 4*x && y%2 == 0) cout << "Yes" << endl;
    else cout << "No";
}

Measured memory_bytes: 3604
#include<bits/stdc++.h>
 
using namespace std;
 
int main(void)
{
    int64_t A,B,N,ans,x;

    ans = 0;

    cin >> A >> B >> N;

    x  = min(B-1,N);

    ans = (A*x)/B;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
 
using namespace std;
typedef long long ll;
#define vi vector<int>
#define vl vector<ll>
#define vii vector< vector<int> >
#define vll vector< vector<ll> >
#define vs vector<string>
#define pii pair<int,int>
#define pis pair<int,string>
#define psi pair<string,int>
#define pll pair<ll,ll>
#define tll tuple<ll, ll, ll>
#define all(c) c.begin(),c.end()

#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
 
const ll inf = 1000000001;
const ll INF = 1e18;
const ll MOD = 1000000007;

char albt[26] = {'a','b','c','d','e','f','g','h','i','j','k','l',
                 'm','n','o','p','q','r','s','t','u','v','w','x',
                 'y','z'};

//vector<ll> g[202020];
//fill(score, score+202020, 0);
//vector<ll> v;

int main(){
  ll n;
  cin >> n;
  vector<ll> v;
  ll aa;
  cin >> aa;
  v.push_back(aa);
  for(int i=1;i<n;i++){
    ll tmp;
    cin >> tmp;
    //DEBUG(tmp);
    auto pos = lower_bound(v.begin(),v.end(),tmp);
    if (pos == v.end()) v.back() = tmp;
    else{
      ll dis = distance(v.begin(),pos);
      //cout << tmp << " " << dis << endl; 
      if (dis == 0) v.insert(v.begin(),tmp);
      else v[dis-1] = tmp;
    }
  }

  //for (int i=0;i<v.size();i++) cout << v[i] << " ";
  //cout << endl;
  cout << v.size() << endl;
}

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

using namespace std;

int N, t[55], ans;
string s[55], X;

int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> s[i] >> t[i];
  }
  cin >> X;
  for (int i = N - 1; i >= 0; i--) {
    if (s[i] == X) break;
    ans += t[i];
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
// Aizu Vol-1 0175: Quaternary Notation
// 2017.8.2

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>

char *gets(char *);
char buf[100], *p;
char ans[100], *a;

int getInt(void)
{
	int n = 0, minus = 0;
	while (isspace(*p)) p++;
	if (*p == '-') minus = 1, p++;
	while (isdigit(*p)) n = 10 * n + (*p++ - '0');
	if (minus) n = -n;
	return n;
}

int main()
{
	int n;

	while (1) {
		gets(p = buf);
		if ((n = getInt()) < 0) break;
		if (!n) puts("0");
		else {
			a = ans + 50, *a = 0;
			while (n) {
				*--a = (n & 3) + '0';
				n >>= 2;
			}
			puts(a);
		}
	}
	return 0;
}

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

namespace AC {
#define ll long long
#define PLL pair<ll, ll>
#define PDD pair<double, double>
#define PDPLL pair<double, PLL>
#define PLPLL pair<ll, PLL>
#define pb push_back
#define fi first
#define se second
#define ls rt << 1
#define rs rt << 1 | 1

    const ll N = 1e5 + 66;

    ll BUGS = 1;

    inline ll read(){
        ll x = 0;    bool flag = 1;   char ch = getchar();
        while(ch < '0' || ch > '9') { if(ch == '-') flag = 0; ch = getchar(); }
        while(ch >= '0' && ch <= '9') { x = (x << 1) + (x << 3) + ch - '0'; ch = getchar(); }
        if(flag) return x;  return (~(x - 1));
    }

    inline void read(ll arr[], ll s, ll e) { for(ll i = s; i <= e; ++i) arr[i] = read(); }

    inline void write(ll x){
        if(x < 0) { x = ~(x - 1); putchar('-'); }
        if(x > 9) write(x / 10); putchar(x % 10 + '0');
    }

    inline void print(ll x) { write(x); puts(""); }

    inline void print(ll arr[], ll s, ll e) {
        for(ll i = s; i <= e - 1; ++i) write(arr[i]), putchar(' ');
        write(arr[e]); puts("");
    }

    inline ll max3(ll a, ll b, ll c) { return max(a, max(b, c)); }

    inline ll min3(ll a, ll b, ll c) { return min(a, min(b, c)); }

    inline void debugNum(ll num, string ss) { cout << "BUGS" << BUGS++ << " : " << ss << " : " << num << endl; }

    inline void debugArr(ll arr[], ll s, ll e, string ss) {
        cout << "BUGS" << BUGS++ << " : " << ss << " : " << endl;
        for(ll i = s; i <= e; ++i) cout << "i : " << i << " val : " << arr[i] << endl;
    }

    inline void IO() {
        //ios::sync_with_stdio(false), cout.tie(0), cin.tie(0);
        //cout << setiosflags(ios::fixed) << setprecision(1); //保留小数点后1位
        //cout << setprecision(1); //保留1位有效数字
        freopen("in.txt", "r", stdin);
        freopen("out.txt", "w", stdout);
    }
}using namespace AC;

int main() {
    //IO();
    char c;
    cin >> c;
    if(isupper(c)) cout << "A";
    else cout << "a";
    return 0;
}



Measured memory_bytes: 3628
while True:
    n = int(input())
    if n == 0:
        break
    a = 0
    b = 0
    for i in range(n):
        a1,b1 = map(int,input().split())
        if a1 > b1:
            a += a1+b1
        elif a1 < b1:
            b += a1+b1
        else:
            a += a1
            b += b1
    print(a,b)    


Measured memory_bytes: 5608
// Vicfred
// https://atcoder.jp/contests/abc047/tasks/abc047_b
// implementation
import std.algorithm;
import std.stdio;

void main() {
    int w, h, n;
    readf("%s %s %s", &w, &h, &n);
    readln;

    int[] coords = new int[5];
    coords[1] = 0;
    coords[2] = w;
    coords[3] = 0;
    coords[4] = h;
    foreach(_; 0..n) {
        int x, y, a;
        readf("%s %s %s", &x, &y, &a);
        readln;
        if(a == 1) {
            coords[a] = max(coords[a], x);
        }
        if(a == 2) {
            coords[a] = min(coords[a], x);
        }
        if(a == 3) {
            coords[a] = max(coords[a], y);
        }
        if(a == 4) {
            coords[a] = min(coords[a], y);
        }
    }
    if((coords[4]-coords[3]) > 0 && (coords[2]-coords[1]) > 0)
        writefln("%s", (coords[4]-coords[3])*(coords[2]-coords[1]));
    else
        "0".writefln;
}



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

long long int lcm(long long int a,long long int b){
    if(a==1)    return 1;
    if(b==1)    return 1;
    long long int temp;
    if(a>b){
        temp=a;
        a=b;
        b=temp;
    }
    while(a!=1){
        if(b%a==0){
            return a;
        }
        b=b%a;
        temp=a;
        a=b;
        b=temp;
    }
    return a;
}

int main() {
    long long int a,b;
    cin>>a >>b;
    long long int ans=lcm(a,b);
    ans=(a*b)/ans;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3568
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string.h>
#include<stack>
#include<queue>
using namespace std;

int n;
int m[100][100], d[100], f[100];
int t = 0;
char c[100];
queue<int> q;

void bfs(int u){
  q.push(u);
  c[u] = 'g';
  d[u] = 0;

  while(q.empty() == 0){
    u = q.front();
    q.pop();
    for(int i = 0; i < n; i++){
      if(m[u][i] == 1 && c[i] == 'w'){
        q.push(i);
        c[i] = 'g';
        d[i] = d[u] + 1;
      }

    }
    c[u] = 'b';
  }

}


int main(){

  cin >> n;

  for(int i = 0; i < n; i++){
    c[i] = 'w';
    d[i] = 100;
    for(int j = 0; j < n; j++){
      m[i][j] = 0;

    }
  }

  for(int i = 0; i < n; i++){
    int id, k, x;
    cin >> id >> k;
    for(int j = 0; j < k; j++){
      cin >> x;
      m[i][x - 1] = 1;
    }
  }

  bfs(0);

  for(int i = 0; i < n; i++){
    cout << i + 1 << " " <<((c[i] == 'w') ? -1 : d[i]) << endl;
  }

  return 0;
}



Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int N,M,C;
  cin >> N >> M >> C;
  vector<int> b(M);
  int ans = 0;
  for(int i=0;i<M;i++) cin >> b[i];
  for(int i=0;i<N;i++){
    int sum=C;
    int A;
    for(int j=0;j<M;j++){
      cin >> A ;
      sum += b[j]*A;
    }
    if(sum > 0) ans++;
  }
  cout << ans << endl;
}


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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)

using namespace std;
const int INF = 1 << 30;
const long long MOD = 1000000000 + 7;
const double PI = acos(-1);

int main() {
	vector<int> num(3);
	vector<int> ans;
	rep(i, 3)cin >> num[i];
	rep(i, 3) {
		rep2(j, i + 1, 3) {
			ans.push_back(num[i] + num[j]);
		}
	}
	cout << *min_element(ans.begin(), ans.end());

}

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

int main()
{
	int N;
	int A[100010]={};
	int sum=0;
	
	cin >> N;
	for(int i=1;i<=N;i++)
		cin >> A[i];
	
	A[0]=0;
	A[N+1]=0;
	for(int i=0;i<=N;i++)
		sum+=abs(A[i+1]-A[i]);
	
	for(int i=1;i<=N;i++)
		cout << sum-(abs(A[i+1]-A[i])+abs(A[i]-A[i-1]))+abs(A[i+1]-A[i-1]) << endl;
	return 0;
}


Measured memory_bytes: 1664
import itertools
n = int(input())
p = [int(i) for i in input().split()]
q = [int(i) for i in input().split()]

perm = itertools.permutations(range(1,n+1))
ls = []
for i in perm:
    ls.append(list(i))

print(abs(ls.index(q) - ls.index(p)))


Measured memory_bytes: 77820
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> P;
typedef pair<ll, ll> PL;
const int INT_INF = 2147483646;
const ll LL_INF = 9223372036854775807;

int n;
ll x;
ll length[51];
ll pnum[51];
ll ans;

void calc(ll len,int num){
    for(int i = num; i >= 0; i--){
        //cout << len << ' ' << ans << '!' << i << endl;
        if(length[i] <= len){
            ans += pnum[i];
            len -= length[i];
          //  cout << len << ' ' << ans << endl;
            if(len >= 1){
                ++ans;
                --len;
            }else{
                return;
            }
            calc(len,i);
            break;
        }
        --len;
    }
}

int main(){
    pnum[0] = 1;
    length[0] = 1;
    for(int i = 1; i <= 50; i++){
        pnum[i] = pnum[i-1]*2+1;
        length[i] = length[i-1]*2+3;
    }
    cin >> n >> x;
    calc(x,n);
    cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int main(){
    int ans,n,r;
    cin>>n>>r;
    if(n>=10){
        ans=r;
    }else{
        ans=r+100*(10-n);

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


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

template<typename M>
struct PersistentSegmentTree {
    struct Node {
        Node *l, *r;
        M data;
        Node() : l(nullptr), r(nullptr) {}
    };

    PersistentSegmentTree(const function<M(M,M)>& f, const M& e, int sz) :
            f(f), e(e), sz(sz) {}

    Node* build() const {
        return _build(0, sz);
    }

    template<typename UpdateQuery>
    Node* update(Node* root, const UpdateQuery& q, int pos) const {
        // data[pos] = q(data[pos]);
        return _update(root, q, pos, 0, sz);
    }

    M query(Node* root, int a, int b) const {
        // return f[a,b)
        return _query(root, a, b, 0, sz);
    }

private:
    const function<M(M,M)> f;
    const M e;
    const int sz;

    Node* _new(const M& data) const {
        auto t = new Node();
        t->data = data;
        return t;
    }

    Node* _new(Node* l, Node* r) const {
        auto t = new Node();
        t->l = l, t->r = r, t->data = f(l->data, r->data);
        return t;
    }

    Node* _build(int l, int r) const {
        assert(l < r);
        if (l+1 == r) return _new(e);
        return _new(_build(l, (l+r)>>1), _build((l+r)>>1, r));
    }

    template<typename UpdateQuery>
    Node* _update(Node* t, const UpdateQuery& q, int pos, int l, int r) const {
        if (pos == l and pos+1 == r) return _new(q(t->data));
        if (r <= pos or pos < l) return t;
        return _new(_update(t->l, q, pos, l, (l+r)>>1),
                    _update(t->r, q, pos, (l+r)>>1, r));
    }

    M _query(Node* t, int a, int b, int l, int r) const {
        if (r <= a or b <= l) return e;
        if (a <= l and r <= b) return t->data;
        return f(_query(t->l, a, b, l, (l+r)>>1),
                 _query(t->r, a, b, (l+r)>>1, r));
    }
};


int main() {
    int N; cin >> N;
    vector<int> a(N);
    map<int,int> comp;
    for (int i = 0; i < N; ++i) {
        cin >> a[i];
        comp[a[i]] = -1;
    }
    int cnt = 0;
    for (auto &tp : comp) tp.second = cnt++;

    vector<vector<int>> G(N);
    for (int i = 0; i < N-1; ++i) {
        int u, v; cin >> u >> v; --u, --v;
        G[u].push_back(v);
        G[v].push_back(u);
    }

    PersistentSegmentTree<int> segt(
            [](int a,int b){ return max(a,b); },
            0, comp.size());

    map<int,PersistentSegmentTree<int>::Node*> root;
    root[-1] = segt.build();

    vector<int> ans(N);

    function<void(int,int)> dfs = [&](int v, int p) {
        int ma = segt.query(root[p], 0, comp[a[v]]);
        root[v] = segt.update(root[p], [&](int x){return max(ma+1, x);}, comp[a[v]]);
        ans[v] = segt.query(root[v], 0, comp.size());

        for (int u : G[v]) {
            if (u == p) continue;
            dfs(u, v);
        }
    };

    dfs(0, -1);

    for (int v : ans) {
        cout << v << endl;
    }

    return 0;
}


Measured memory_bytes: 235648
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N, Y;

    scanf("%d%d", &N, &Y);

    int f = 1;

    for(int x = 0; x <= N; x++){
        if(f == 0){
            break;
        }
        for(int y = 0; y <= N - x; y++){
            if(10000 * x + 5000 * y + 1000 * (N - x - y) == Y){
                f = 0;
                printf("%d %d %d\n", x, y, N - x - y);
                break;
            }
        }
    }

    if(f == 1){
        printf("-1 -1 -1\n");
    }

    return 0;
}

Measured memory_bytes: 1736
a = []
b = []
M = []

while True:
    x, m, y = map(str, input().split())
    if m == '?':
        break
    a.append(x)
    b.append(y)
    M.append(m)

a = list(map(int, a))
b = list(map(int, b))

for i in range(len(a)):
    if M[i] == '+':
        print(a[i] + b[i])
    elif M[i] == '-':
        print(a[i] - b[i])
    elif M[i] == '*':
        print(a[i]*b[i])
    else:
        print(a[i]//b[i])



Measured memory_bytes: 5600
from collections import defaultdict
n = int(input())

arr = defaultdict(int)
temp = n
for i in range(2, int(-(-n**0.5//1))+1):
    if temp%i==0:
        cnt=0
        while temp%i==0:
            cnt+=1
            temp //= i
        arr[i] = cnt

if temp!=1:
    arr[temp] = 1

if arr==[]:
    arr[n] = 1

ans = 0

for i in arr:
    c = 1
    while arr[i]-c>=0:
        arr[i] -= c
        c += 1
        ans += 1
print(ans)

Measured memory_bytes: 9748
#include <iostream>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    for(int i = 0; i < n; i++)
    {
        cin >> h[i];
    }
    int ans = 1;
    for(int i = 1; i < n; i++)
    {
        bool flag = true;
        for(int j = 0; j < i; j++)
        {
            if (h[i] < h[j]) {
                flag = false;
                break;
            }
        }
        if (flag) {
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader input =new BufferedReader (new InputStreamReader (System.in));
		String str = input.readLine( );
		String[] array = str.split(" ");
		int a = Integer.parseInt(array[0]);
		int b = Integer.parseInt(array[1]);
		int c = Integer.parseInt(array[2]);
		int d = Integer.parseInt(array[3]);

		int[] list = {a, b, c, d};
		Arrays.sort(list);
		int[] diff = {1, 4, 7, 9};
		if(Arrays.equals(list, diff)) {
			System.out.println("YES");
		}else {
			System.out.println("NO");
		}
	}

}

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

#define rep(i, n) for (int i = 0; i < n; i++)

int main() {
  int h, w;
  cin >> h >> w;
  vector<vector<char>> a(h + 2, vector<char>(w + 2, '#'));
  rep(i, h) rep(j, w) { cin >> a[i + 1][j + 1]; }
  rep(i, h + 2) {
    rep(j, w + 2) cout << a[i][j];
    cout << endl;
  }
  return 0;
}


Measured memory_bytes: 256
n = int(input())
s1 = input()
s2 = input()

ans = 1
prev = 0
i = 0
while i < len(s1):
    if s1[i] == s2[i]:
        ans *= (3 - prev)
        prev = 1
        i += 1
    else:
        if prev == 0:
            ans *= 6
        elif prev == 1:
            ans *= 2
        else:
            ans *= 3
        prev = 2
        i += 2
    ans %= 1000000007
print(ans)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
long long a[200005];
int main()
{
    long long n,i,j;
    scanf(" %lld",&n);

    for(i=0;i<n;i++){
        scanf(" %lld",&a[i]);
    }
    for(i=n-1;i>=0;i-=2){
        printf("%lld ",a[i]);
    }
    if(n%2==1){
        for(i=1;i<n;i+=2){
            printf("%lld ",a[i]);
        }
    }
    else{
        for(i=0;i<n;i+=2){
            printf("%lld ",a[i]);
        }
    }
    return 0;
}


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

#define INF 100000000
#define WH 0
#define GR 1
#define BK 2

int main() {
    int n;
    cin >> n;
    int M[100][100];
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            M[i][j] = INF;
        }
    }
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v, c;
            cin >> v >> c;
            M[u][v] = c;
        }
    }

    int color[100] = {};

    int d[100];
    for (int i = 0; i < n; i++) {
        d[i] = INF;
    }

    int p[100];
    for (int i = 0; i < n; i++) {
        p[i] = -1;
    }

    while (true) {
        d[0] = 0;

        int min_cost = INF;
        int u;
        for (int i = 0; i < n; i++) {
            if (color[i] != BK && d[i] < min_cost) {
                min_cost = d[i];
                u = i;
            }
        }

        if (min_cost == INF) {
            break;
        }

        color[u] = BK;

        for (int v = 0; v < n; v++) {
            if (color[v] != BK && M[u][v] < INF) {
                if (d[u] + M[u][v] < d[v]) {
                    d[v] = d[u] + M[u][v];
                    p[v] = u;
                    color[v] = GR;
                }
            }
        }
    }

    for (int v = 0; v < n; v++) {
        cout << v << " " << d[v] << endl;
    }


    // for (int i = 0; i < n; i++) {
    //     for (int j = 0; j < n; j++) {
    //         cout << " " << M[i][j];
    //     }
    //     cout << endl;
    // }

    return 0;
}



Measured memory_bytes: 3124
size = [60,80,100,120,140,160]        
weight = [2,5,10,15,20,25]
fee= [600,800,1000,1200,1400,1600]
while True:
    n = int(input())
    if n==0:
        break
    total = 0
    for _ in range(n):
        [x,y,h,wt] = list(map(int, input().strip().split()))
        sz = x+y+h
        if sz <= size[-1] and wt <= weight[-1]:
            isz = len(list(filter(lambda x: x<sz,   size)))
            iwt = len(list(filter(lambda x: x<wt, weight)))
            f   = fee[max(isz,iwt)]
            #print("%d %d %d %d %d" % (x,y,h,wt,f))
            total += f
    print(total)

Measured memory_bytes: 7564
#include<iostream>
#include<stdio.h>
using namespace std;

int main()
{
    int a,b;
    char op;
    
    for(int i=0; ; i++){
    cin >> a >> op >> b;
    if(op == '+'){
        cout << a+b << endl;
    }
    else if(op == '-'){
        cout << a-b << endl;
    }
    else if(op == '*'){
        cout << a*b << endl;
    }
    else if(op == '/'){
        cout << a/b << endl;
    }
    else if(op == '?')
        break;
    }
    
    
    return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

using ll = long long;
using ld = long double;

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int dp[3][100000];

int main(){
  int n, m;
  cin >> n >> m;
  queue<int> que;
  vector<vector<int>> edge(n, vector<int>());
  int u, v;
  REP(i, m) {
    cin >> u >> v;
    edge[u-1].push_back(v-1);
  }
  REP(i, 3) REP(j, n) dp[i][j] = INF;
  int s, t;
  cin >> s >> t;
  que.push(s-1);
  dp[0][s-1]=0;
  while(!que.empty()){
    int target = que.front();
    que.pop();
    for(auto pt: edge[target]){
      if(dp[0][pt] > dp[2][target]+1) { dp[0][pt]=dp[2][target]+1; que.push(pt); }
      if(dp[1][pt] > dp[0][target]+1) { dp[1][pt]=dp[0][target]+1; que.push(pt); }
      if(dp[2][pt] > dp[1][target]+1) { dp[2][pt]=dp[1][target]+1; que.push(pt); }
    }
  }
  cout << (dp[0][t-1]<INF ? dp[0][t-1]/3 : -1) << endl;
  return 0;
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; ++i)
#define FOR(i, a, b) for (int i = a; i < b; ++i)
#define ALL(vec) vec.begin(), vec.end()
#define rALL(vec) vec.rbegin(), vec.rend()
using namespace std;
using ll = long long;
// ------------------------------

int main() {
    string N;
    cin >> N;
    int sum = 0;
    rep(i, N.size()) {
        sum += N[i] - '0';
    }
    if (sum % 9 == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
typedef long long  ll;
typedef vector<int> VI;
typedef vector<ll> VLL;

int main(){
    string s;
    cin >> s;
    
    int size = s.size(),max=0;
    for(int i=0; i< size ; ++i){
        int count = 0;
        while(s[i] == 'A' || s[i] == 'C' || s[i] == 'G' || s[i] == 'T'){
            ++count;
            ++i;
        }
        if(count>max) max = count; 
    }
    cout << max << endl;
    return 0;
}

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

int main(void) {
    ll N;
    cin >> N;
    ll memo = N;
    ll X = 0;
    while(N != 0) {
        X += N % 10;
        N /= 10;
    }
    cout << ( memo % X == 0 ? "Yes" : "No" ) << endl;
    return 0;
}


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

class UNKO
{
    static void Main()
    {
        string word = Console.ReadLine();
        string sentence;
        int count = 0;

        while((sentence = Console.ReadLine()) != ("END_OF_TEXT"))
        {
            sentence = sentence.ToLower();
            string[] words = sentence.Split(' ');
            
            for (int i=0;i < words.GetLength(0);i++)
            {
                if (words[i] == word)
                    count++;
            } 
        }

        Console.WriteLine(count);
    }
}

Measured memory_bytes: 9124
#include<bits/stdc++.h>
using namespace std;
int main(){
  string s;
  cin>>s;
  int n=s.size(),count=0;
 string t(s.rbegin(),s.rend());
  if(s==t){
    count++;
 
  }
   string sub=s.substr(0,(n-1)/2);

  string q(sub.rbegin(),sub.rend());
  if(sub==q){
   count++;

  }
string sn=s.substr((n+2)/2);
  string w(sn.rbegin(),sn.rend());
  if(w==sn){
count++;

  }
  if(count==3) cout<<"Yes"<<endl;
else cout<<"No"<<endl;
  return 0;
}

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

const int N = 10005;

using namespace std;

int a[N];

int main() {
	int n; cin >> n;
	for(int i = 0; i < n;i++){
		cin >> a[i];
	}
	int Max = a[0], Min = a[0];
	for(int i = 1;i < n;i++){
		if(a[i] > Max){
			Max = a[i];
		}if(a[i] < Min){
			Min = a[i];
		}
	}
	cout << Max - Min;
	return 0;
}

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

using namespace std;

int main()
{
    char s[100010];
    cin >> s;
    char *p;
    p = s;
    int cnt = 0;
    char one = *p;
    char two;
    if(one == '1'){
        two = '0';
    }else{
        two = '1';
    }
    bool flag = true;
    while(*p){
        if(flag){
            if(*p == two){
                cnt++;
            }
        }else{
            if(*p == one)
                cnt++;
            }
        flag = !flag;
        p++;
    }
    printf("%d", cnt);

    return 0;
}


Measured memory_bytes: 384
n = int(input())
l = [0]*n
r = [0]*n
count = 0
for i in range(n):
    arr = input().split()
    arr = list(map(int,arr))
    l[i] = arr[0]
    r[i] = arr[1]
    count += r[i] - l[i] + 1
print(count)


Measured memory_bytes: 3060
//
// Created by 10940 on 2020/7/25.
//

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

const int MAX_N = 1e5;

int main() {
    int x;
    cin >> x;
    for (int i = 400, j = 8; i <= 1800; i+= 200, j--) {
        if (x >= i && x < i + 200) {
            cout << j << endl;
        }
    }




    return 0;
}

Measured memory_bytes: 3632
/*
　　　  ∧＿∧　やあ
　　 （´・ω・｀)　　　　　/　　　　　ようこそ、バーボンハウスへ。
　　 ／∇y:::::＼　　　 [￣]　　　　　このテキーラはサービスだから、まず飲んで落ち着いて欲しい。
　　 |:⊃:|:::::|　　　|──|
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|　うん、「また」なんだ。済まない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣￣|￣　  仏の顔もって言うしね、謝って許してもらおうとも思っていない。
￣￣￣￣￣￣￣￣￣￣￣￣￣￣／|
　　　　∇　∇　∇　∇　　　／.／|　　　でも、この提出を見たとき、君は、きっと言葉では言い表せない
　　　　┴　┴　┴　┴　／ ／　  |　　　「ときめき」みたいなものを感じてくれたと思う。
￣￣￣￣￣￣￣￣￣￣|／　　  |　　　殺伐としたコンテストの中で、そういう気持ちを忘れないで欲しい
￣￣￣￣￣￣￣￣￣￣　　　　 |　　　そう思って、この提出を投げたんだ。
　　　(⊆⊇)　(⊆⊇)　(⊆⊇)　　|
　    ||　　 ||　　||　　|　　　 じゃあ、判定を聞こうか。
　　.／|＼　／|＼ ／|＼
*/

#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <cmath>
#include <cstdio>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <vector>
using namespace std;
#define fst first
#define snd second
#define ALL(obj) (obj).begin(),(obj).end()
#define debug(x) cerr << #x << " -> " << x << " (line:" << __LINE__ << ")" << '\n';
#define debugpair(x, y) cerr << "(" << #x << ", " << #y << ") -> (" << x << ", " << y << ") (line:" << __LINE__ << ")" << '\n';
typedef long long lint;
typedef priority_queue<int> p_que;
typedef priority_queue<int, vector<int>, greater<int>()> p_que_rev;
// const int INF = INT_MAX;
const lint LINF = LLONG_MAX;
// const lint MOD = 1000000000 + 7;
const double EPS = 1e-9;
const double PI = acos(-1);
const int di[]{0, -1, 0, 1, -1, -1, 1, 1};
const int dj[]{1, 0, -1, 0, 1, -1, -1, 1};


int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    int a, b, h;
    cin >> a >> b >> h;
    cout << ((a + b) * h / 2) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>
int aa[20];
main()
{
	int a,b,c;
	
	while(~scanf("%d%d%d",&a,&b,&c))
	{
		memset(aa,0,sizeof(aa));
		aa[a]++;
		aa[b]++;
		aa[c]++;
		if(aa[5]==2&&aa[7]==1)
		{
			printf("YES\n");
		}
		else
		printf("NO\n");
	}
	
} 

Measured memory_bytes: 128
/*
START BY THE NAME OF ALMIGHTY ALLAH
THIS WONT BE ACCEPTED
STOP_GIVING_UP

██╗███████╗████████╗██╗ █████╗ ██╗  ██╗
██║██╔════╝╚══██╔══╝██║██╔══██╗██║ ██╔╝
██║███████╗   ██║   ██║███████║█████╔╝
██║╚════██║   ██║   ██║██╔══██║██╔═██╗
██║███████║   ██║   ██║██║  ██║██║  ██╗
╚═╝╚══════╝   ╚═╝   ╚═╝╚═╝  ╚═╝╚═╝  ╚═╝




*/
#include<bits/stdc++.h>
#define l(i,a,n)for(int i=a;i<n;i++)
#define pb push_back
#define in insert
#define mp make_pair
#define lw(v) sort(v.begin(),v.end());
#define hi(v) sort(v.begin(),v.end(),greater<long long>());
#define all(v) v.begin(),v.end()
#define filein freopen ("input.txt", "r", stdin)
#define fileout freopen ("output.txt", "w", stdout)
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    long long t,r=1,r1=0,r2=0,k=0,a,b,c=1,m,d=0,n,e,f,x=0,g,p=0,q=0,y=0,z=0;
    vector<long long>v;
    vector<long long>u;
    set<long long>s;
    std::vector<int>::iterator it;
    string  s1,s2,s3,s4;
    cin>>s1>>s2;
    l(i,0,s1.size())
    {
        if(s1[i]!=s2[i])
        {
            r1++;
        }
    }
    cout<<r1<<endl;

}


Measured memory_bytes: 3792
//18
#include<iostream>
#include<cmath>

using namespace std;

double r,l,p,e,t;

double dfs(int k,double r,double l){
  if(k==0){
    return fabs((r+l)/2-t)<=e;
  }else if(t+e<r||l<t-e){
    return 0;
  }else{
    double h=(r+l)/2;
    double hp=(h>t)?p:1-p;
    return dfs(k-1,h,l)*hp+dfs(k-1,r,h)*(1-hp);
  }
}

int main(){
  int k;
  double r,l;
  cin>>k>>r>>l>>p>>e>>t;
  cout.precision(5);
  cout<<fixed<<dfs(k,r,l)<<endl;
  return 0;
}
  

Measured memory_bytes: 1292
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;
using namespace std;
typedef tree<pair<int,int>,null_type,less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update> oset;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
	*this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
using ll = long long;

void test_case(){
	int n; cin >> n;
	vector<int> a(n);
	for(auto &x : a)
		cin >> x;
	int count = 0;
	for(int i = 1 ; i <= n ; i++)
		if(i%2 != 0 && a[i-1]%2 != 0)
			count++;
	cout<<count<<"\n";
}
 
int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int T=1;
	//~ cin >> T;
	while(T--){
		test_case();
	}
	return 0;
}


Measured memory_bytes: 3636
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;

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

	vector<int> v(1000100);
	int i, j, k;
	cin >> v[1];
	set<int> s;
	s.insert(v[1]);
	for (i = 2; ; i++) {
		if (v[i - 1] % 2 == 0) v[i] = v[i - 1] / 2;
		else v[i] = 3 * v[i - 1] + 1;
		if (s.find(v[i]) != s.end()) {
			cout << i << "\n";
			break;
		}
		s.insert(v[i]);
	}

	return 0;
}

Measured memory_bytes: 4224
#include <stdio.h>
#include <stdbool.h>
bool Fmeiji, Ftaisho, Fshowa, Fheisei = false;
void meiji(int year,int month, int day);
void taisho(int year,int month, int day);
void showa(int year,int month, int day);
void heisei(int year,int month, int day);
int year, month, day;
int main(void)
{
    int wagou;
    while ((scanf("%d %d %d", &year , &month, &day)) != EOF) {
    heisei(year, month, day);
    if (Fheisei == true) {
        wagou = year - 1988;
        printf("heisei %d %d %d\n", wagou, month, day);
    } else {
        showa(year, month, day);
        if (Fshowa == true) {
            wagou = year - 1925;
            printf("showa %d %d %d\n", wagou, month, day);
        } else {
            taisho(year, month, day);
            if (Ftaisho == true) {
                wagou = year - 1911;
                printf("taisho %d %d %d\n", wagou, month, day);
            } else {
                meiji(year, month, day);
                if (Fmeiji == true) {
                    wagou = year - 1867;
                    printf("meiji %d %d %d\n", wagou, month, day);
                } else {
                    printf("pre-meiji\n");
                }
            }
        }
        
    }
    }
    return 0;
}

void meiji(int year, int month, int day)
{
    if(year > 1868) {
        Fmeiji =true;
    } else if (year == 1868 && month > 9) {
        Fmeiji = true;
    } else if (year == 1868 && month == 9 && day >= 8) {
        Fmeiji = true;
    } else {
        Fmeiji = false;
    }
}

void taisho(int year, int month, int day)
{
    if(year > 1912) {
        Ftaisho =true;
    } else if (year == 1912 && month > 7) {
        Ftaisho = true;
    } else if (year == 1912 && month == 7 && day >= 30) {
        Ftaisho = true;
    } else {
        Ftaisho = false;
    }
}

void showa(int year, int month, int day)
{
    if(year > 1926) {
        Fshowa =true;
    } else if (year == 1926 && month > 12) {
        Fshowa = true;
    } else if (year == 1926 && month == 12 && day >= 25) {
        Fshowa = true;
    } else {
        Fshowa = false;
    }
}

void heisei(int year, int month, int day)
{
    if(year > 1989) {
        Fheisei =true;
    } else if (year == 1989 && month > 1) {
        Fheisei = true;
    } else if (year == 1989 && month == 1 && day >= 8) {
        Fheisei = true;
    } else {
        Fheisei = false;
    }
}

Measured memory_bytes: 1036
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
int main(){
  int N,M,X;
  cin>>N>>M>>X;
  vector<int> yen(N);
  int data[N][M];
  for(int i=0;i<N;i++){
      cin>>yen[i];
    for(int j=0;j<M;j++){
      cin>>data[i][j];
    }
  }
  int flag;
  ll ans=1LL<<60;
  for(int bit=0;bit<(1<<N);bit++){
    ll kane=0;
    vector<int>pawa(M,0);
    
    for(int i=0;i<N;i++){
      flag=0;
      if(bit&(1<<i)){//もし本i選んだら
        kane+=yen[i];
        for(int j=0;j<M;j++){
          pawa[j]+=data[i][j];
        }
        for(int j=0;j<M;j++){
          if(pawa[j]<X)flag=-1;
        }
        if(flag!=-1){
          ans=min(kane,ans);
        }
      }
    }
  }
  if(flag==-1){
    cout<<-1<<endl;
    return 0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 3628
N, M = map(int, input().split())
A = [int(i) for i in input().split()]

# dp[i] = i本使ってできる最大の数

# xを作るために使うマッチの本数
h = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}

dp = [-1] * (N + 1)
dp[0] = 0

for i in range(N + 1):
    for a in A:
        if i - h[a] < 0: continue
        dp[i] = max(10*dp[i-h[a]] + a, dp[i])

print(dp[N])

Measured memory_bytes: 14516
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val a = readLine()!!.split(' ').map { it.toInt() }
    var ans = 0
    var min = a.first()
    for (i in 0 until n) {
        min = Math.min(a[i], min)
        if (a[i] <= min) {
            ans++
        }
    }
    println(ans)
}


Measured memory_bytes: 83024
def v2i(v):
        v = list(v)
        n = 0
        for i,c in enumerate(v):
            if c == 'A':
                n += 0 + 4 * i
            elif c == 'C':
                n += 1 + 4 * i
            elif c == 'G':
                n += 2 + 4 * i
            elif c == 'T':
                n += 3 + 4 * i
            n *= 4
        n /= 4
        return int(n)



class Dict():

    def __init__(self):
        self.tree = [False] * 4**12

    def find(self,key):
        if self.tree[key] == True:
            print("yes")
        else:
            print("no")
    
    def insert(self,key):
        self.tree[key] = True

    
N = int(input())
D = Dict()
for i in range(N):
    Q,V = input().split()
    if Q == "insert":
        D.insert(v2i(V))
    else:
        D.find(v2i(V))
    #print(D.tree[:60])








Measured memory_bytes: 136652