akhauriyash/Code-Regression huggingface dataset:
//#include<bits/stdc++.h>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<stack>
#include<set>
using namespace std;
#define int long long
#define ll long long
#define str string
#define db double
#define ac() cout<<"Yes"<<endl;
#define wa() cout<<"No"<<endl;
#define ddd cout<<"---debug---"<<endl;
#define ff(a,b) for(signed long long (a)=1;(a)<=(b);(a)++)
#define fff(a,b) for(signed long long (a)=0;(a)<(b);(a)++)
#define re readdd()
#define pr(a) printtt(a)
#define pee puts("");
#define eee putchar(' ');
#define pss(a) push_back(a)
#define ps(a) push(a)
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}//
int ppow(int a,int b,int mod){a%=mod;//
int ans=1%mod;while(b){if(b&1)ans=(long long)ans*a%mod;
a=(long long)a*a%mod;b>>=1;}return ans;}
int readdd(){int x=0,f=1;char c=getchar();//
while(!isdigit(c)&&c!='-')c=getchar();
if(c=='-')f=-1,c=getchar();
while(isdigit(c))x=x*10+c-'0',c=getchar();
return f*x;}
void printtt(int x){if(x<0)putchar('-'),x=-x;
if(x>=10)printtt(x/10);putchar(x%10+'0');}
bool addd(int a,int b){return a>b;};
//
const int maxm=3e5+5;
struct Node{
    int v;
    int id;
}e[maxm];
signed main(){
    int x,y,A,B,C;
    cin>>x>>y>>A>>B>>C;
    int n=0;
    for(int i=1;i<=A;i++)cin>>e[++n].v,e[n].id=1;
    for(int i=1;i<=B;i++)cin>>e[++n].v,e[n].id=2;
    for(int i=1;i<=C;i++)cin>>e[++n].v,e[n].id=3;
    sort(e+1,e+1+n,[](Node a,Node b){return a.v>b.v;});
    int xx=0,yy=0,zz=0;
    int ans=0;
    for(int i=1;i<=n;i++){
        if(e[i].id==1){
            if(xx<x)xx++,ans+=e[i].v;
        }else if(e[i].id==2){
            if(yy<y)yy++,ans+=e[i].v;
        }else{
            if(xx+yy+zz<x+y)zz++,ans+=e[i].v;
        }
        if(xx+yy+zz==x+y)break;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 4992
#include <iostream>
#include <iomanip>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <numeric>
 
using namespace std;
 
#define eb emplace_back
#define pb push_back
#define MP make_pair
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
#define rep(i,j,n) for (int i = j; i < n; ++i)
#define repn(i,j,n) for (int i = j; i <= n; ++i)
#define revn(i,j,n) for (int i = j; i >= n; --i)
#define sz(i) i.size()
#define mem(i,v) memset(i,v,sizeof(i))
#define all(v) v.begin(), v.end()
#define endl '\n'
#define int long long
#define INF 1e18
#define ss second
#define ff first

typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
 
//const int mod=1e9+7;
const int mod=998244353;
const int up=1e5+10;
const int MAXN=1e6+10;

// int n,m,x,y,res=0,sz[2*up],par[2*up],ans[2*up];

// int get(int x)
// {
//     return x*(x-1)/2;
// }

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

// void merge(int u,int v)
// {
//     x=find(u);
//     y=find(v);
//     if(sz[x]<sz[y])
//         swap(x,y);
//     res-=get(sz[x]);
//     res-=get(sz[y]);
//     sz[x]+=sz[y];
//     res+=get(sz[x]);
//     par[v]=u;
// }

// void solve()
// {
//     cin>>n>>m;
//     vector<pii>q(m+1);
//     vector<pair<int,pii>>e(n);
//     repn(i,1,n)
//     {
//         sz[i]=1;
//         par[i]=i;
//     }
//     repn(i,1,n-1)
//     {
//         cin>>e[i].ss.ff>>e[i].ss.ss>>e[i].ff;
//     }
//     repn(i,1,m)
//     {
//         cin>>q[i].ff;
//         q[i].ss=i;
//     }
//     sort(all(e));
//     sort(all(q));
//     int pos=1;
//     repn(i,1,m)
//     {
//         while(pos<n && e[pos].ff<=q[i].ff)
//         {
//             x=e[pos].ss.ff;
//             y=e[pos].ss.ss;
//             merge(x,y);
//             ++pos;
//         }
//         ans[q[i].ss]=res;
//     }
//     repn(i,1,m)
//     {
//         cout<<ans[i]<<" ";
//     }
//     cout<<endl;
// }


int dp[5005][5005],a[2*up];
void solve()
{
    int n;
    string s;
    cin>>n;
    cin>>s;
    mem(dp,0);
    int ans=0;
    revn(i,sz(s)-1,0)
    {
        revn(j,sz(s)-1,i+1)
        {
            if(s[i]==s[j])
            {
                dp[i][j]=max(dp[i][j],dp[i+1][j+1]+1);
            }
            dp[i][j]=min(dp[i][j],j-i);
            ans=max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;
}

int32_t main()
{
    int t;
    // memset(prime, true, sizeof(prime)); 
    // sieve();
    // cin>>t;
    t=1;
    while(t--)
    {
        solve();
    }
}



Measured memory_bytes: 195968
def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )
N = int(input())
A = [int(c) for c in input().split()]
log = [0]*(N+1)
for i in range(N+1):
  if log[A[i]]!=0:
    j = i
  log[A[i]] = 1
c = A[j]
i = A.index(c)
m = i+N-j
for k in range(1,N+2):
  if m>=k-1:
    x = cmb(N+1,k,mod)-cmb(m,k-1,mod)
    print(x%mod)
  else:
    x = cmb(N+1,k,mod)
    print(x%mod)
    

Measured memory_bytes: 132500
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<stack>
#include<vector>
#include<string>
#include<cstring>
#include<cmath>
#include<queue>
#include<sstream>
#define ll long long
const int inf = 0x3f3f3f3f;
const int N = 1e3+50;
const ll M = 1e9+7;

using namespace std;



int main()
{
	ios::sync_with_stdio(false);
	ll ans = 0;
	ll a;
	string b;
	cin>>a>>b;
	ans = (b[0]-'0')*100 + (b[2]-'0')*10 + (b[3]-'0');
	ans = a*ans/100;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3680
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <float.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	long int i, j;
	long int n, k;
	long int count;
	long int p[200000] = {0};
	char str[200000];
	char work;
	
	scanf("%ld%s", &n, str);
	
	str[n] = '0';
	str[n + 1] = '\0';
	
	count = 0;
	work = str[0];
	
	for(i = 1; i <= n; i++) {
		if(work != str[i]) {
			work = str[i];
			count++;
		}
	}
	
	printf("%ld\n", count);
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[200009];
/*
 * state: index
 * base case: n = 0
 * Transition: either jump 1 step or jump 2 steps
 * cost: next index - current index
 */
const int maxn = 100005;
int dp[maxn];
int n,k;
int solve(int i) {
    if (i == n - 1)
        return 0;
    if(i>n-1)
        return 99999;
    if (dp[i] != INT_MAX)
        return dp[i];
    for (int j = 1; j <= k; ++j) {
        if(i+j < n)
        dp[i] = min(abs(a[i + j] - a[i]) + solve(i + j), dp[i]);
    }
    return dp[i];
}
int main() {
    scanf("%d%d",&n,&k);
    for(int i = 0;i<n;++i){
        scanf("%d",a+i);
    }
    for(int i=0;i<maxn;++i)
        dp[i] = INT_MAX;
    printf("%d",solve(0));
}

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

#include <vector>
class UnionFind {

    vector<uint64_t> parent;
    vector<uint64_t> size;

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

public:

    UnionFind(uint64_t N) : parent(N), size(N) {
        for(uint64_t i=0; i<N; i++){
            parent[i] = i;
            size[i] = 1;
        }
    }

    void unite(uint64_t x, uint64_t y){
        uint64_t rx = root(x);
        uint64_t ry = root(y);
        if (rx == ry) return;
        parent[rx] = ry;
        size[ry] += size[rx];
    }

    bool isSame(uint64_t x, uint64_t y){
        uint64_t rx = root(x);
        uint64_t ry = root(y);
        return rx == ry;
    }

    uint64_t sizeOf(uint64_t x){
        uint64_t rx = root(x);
        return size[rx];
    }
};

int main()
{
    int N, M, K;
    cin >> N >> M >> K;

    int *A = new int[200000];
    int *B = new int[200000];
    int *C = new int[200000];
    int *D = new int[200000];
    int *NF = new int[200000];

    UnionFind uf(N);

    for(int m=0; m<M; m++){
        cin >> A[m] >> B[m];
        uf.unite(A[m]-1, B[m]-1);
    }

    for(int n=0; n<N; n++){
        NF[n] = uf.sizeOf(n)-1;
    }

    for(int m=0; m<M; m++){
        NF[A[m]-1] -= 1;
        NF[B[m]-1] -= 1;
    }

    for(int k=0; k<K; k++){
        cin >> C[k] >> D[k];
        if(uf.isSame(C[k]-1, D[k]-1)){
            NF[C[k]-1] -= 1;
            NF[D[k]-1] -= 1;
        }
    }

    for(int n=0; n<N; n++){
        cout << NF[n] << " ";
    }


	return 0;
}


Measured memory_bytes: 4736
I=lambda:list(map(int,input().split()))
n,m,q=I()
l=[[0]*-~n for _ in range(n+1)]
for _ in range(m):
  s,g=I()
  l[s][g]+=1
for i in range(1,n+1):
  for j in range(1,n+1):
    l[i][j]+=l[i][j-1]
for i in range(1,n+1):
  for j in range(1,n+1):
    l[i][j]+=l[i-1][j]
for _ in range(q):
  s,g=I()
  print(l[g][g]-l[s-1][g]-l[g][s-1]+l[s-1][s-1])

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

int main(){
    int K;
    string S;

    cin >> K >> S;

    if(S.length()<=K) {
        cout << S << endl;
    } else {
        cout << S.substr(0,K) << "..." << endl;
    }
}

Measured memory_bytes: 3592
//------------------------------------------------------------------------------MANAS UNIYAL---------------------------------------------------------
//																				NEVER GIVE UP
#include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);	cin.tie(NULL);	cout.tie(NULL);
#define ll long long
#define pb push_back
#define fi first 
#define se second
#define pii pair<ll,ll>
#define INF 0x3f3f3f3f
#define LINF 98765432123456789
#define mod 1000000007
#define testcases() ll t; cin>>t; while(t--)
#define debug1(x) cout<<#x<<" "<<x<<"\n";
#define debug2(x,y) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<"\n";
#define debug3(x,y,z) cout<<#x<<" "<<x<<" "<<#y<<" "<<y<<" "<<#z<<" "<<z<<"\n";
#define rep(i,start,end) for(ll i=start;i<end;i++)
 
//----------------------------------------------------------------------------------------------------------------------------------------------------

int main()
{
	fast;
	ll n;
	cin>>n;
	ll ans1 = n/500;
	ll ans2 = (n - (ans1 * 500))/5;
	ll ans = 1000*ans1 + 5*ans2;
	cout<<ans;
	return 0;	
}

Measured memory_bytes: 256
from collections import Counter
n=int(input())
a=list(map(int, input().split()))

c=Counter(a)
bl=True
if n%3==0:
    if len(c.keys())==3:
        l=[]
        for i,j in c.items():
            if j!=n//3:
                bl=False
            l.append(i)
        if 0 in l:
            bl=False
        if l[0]^l[1]!=l[2]:
            bl=False
    elif len(c.keys())==2:
        if c[0]!=n//3:
            bl=False
    else:
        bl=False
else:
    bl=False
if c[0]==n:
    bl=True

if bl:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 20848
#include <algorithm>
#include <climits>
#include <complex>
#include <cstring>
#include <iostream>
#include <map>
#include <set>
#include <vector>

// using
using namespace std;

// typedef
typedef long long ll;

// define
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define UNIQ(c) unique(ALL(c))
#define FOR(i, a, b, c) for (int i = (int)(a); i < (int)(b); i += (int)(c))
#define REP(i, n) FOR(i, 0, n, 1)
#define RFOR(i, a, b, c) for (int i = (int)(a); i >= (int)(b); i -= (int)(c))
#define RREP(i, n) RFOR(i, n, 0, 1)

// functions
int ceil(int a, int b) {
    return (a + b - 1) / b;
}
int round(int a, int b) {
    return (a + b / 2) / b;
}
int gcd(int a, int b) {
    return b ? gcd(b, a % b) : a;
}
int lcm(int a, int b) {
    return a * b / gcd(a, b);
}
template <class T> bool amax(T &a, const T &b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> bool amin(T &a, const T &b) {
    if (b < a) {
        a = b;
        return true;
    }
    return false;
}

// main
int main() {
    const int MAX_N = 100000;
    int N, K, A[MAX_N];
    cin >> N >> K;
    REP(i, N) {
        cin >> A[i];
    }
    N -= K;
    cout << 1 + ceil(N, K - 1) << endl;
    return 0;
}


Measured memory_bytes: 640
using System;

namespace B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int n = int.Parse(In[0]);
            int x = int.Parse(In[1]);
            int[] L = new int[n];
            string[] In2 = Console.ReadLine().Split(' ');
            for(int i=0; i < n; i++)
            {
                L[i] = int.Parse(In2[i]);
            }
            int sum = 0;
            int cnt = 1;
            for(int i = 0; i < n; i++)
            {
                sum += L[i];
                if (sum > x) break;
                cnt++;
            }
            Console.WriteLine(cnt);
        }
    }
}


Measured memory_bytes: 27552
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
#include <cstdint>
#include <unordered_set>
#include <unordered_map>
using namespace std;
typedef long long i64;
typedef vector<int> ivec;
typedef vector<string> svec;

int main(){
    //?????°?????£?¨?
    int R[100];
    int N;

    //?????????????????????
    scanf("%d", &N);
    for (int i=0; i<N; i++) scanf("%d", &R[i]);

    //?????????


    //??¢?????´?????????

    for (int k=0; k<N-1; k++) printf("%d ", R[k]);
    printf("%d",R[N-1]);
    printf("\n");

    for (int i=1; i<N; i++){

        int v = R[i];
        int j = i-1;

        while (j >= 0 && R[j] > v){
            R[j+1] = R[j];
            j--;
        }

        R[j+1] = v;

        for (int k=0; k<N-1; k++) printf("%d ", R[k]);
        printf("%d",R[N-1]);
        printf("\n");

    }

    //??????

    return 0;
}

Measured memory_bytes: 1176
N = input()
H = list(map(int, input().split()))

now = H[0]
move = 0
ans = 0

for i in range(1, len(H)):
    if now >= H[i]:
        move += 1
        ans = max(ans, move)
    else:
        # ans = max(ans, move)
        move = 0
    now = H[i]
print(ans)

Measured memory_bytes: 14224
#include <iostream>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <deque>

int main(){
  int N;
  scanf("%d", &N);
  std::string S;
  std::cin >> S;
  std::string ans;
  /*std::dequeue<char > dequeue;
  for (int i=0; i<S.length(); i++){
    dequeue.push_back(S[i]);
    }*/
  int prevcount = 0;
  int lastcount = 0;
  int thiscount = 0;
  for (int i=0; i<S.length(); i++){
    if (S[i]=='('){
      thiscount++;
    } else {
      thiscount--;
    }
    if (thiscount<0){
      prevcount++;
      thiscount=0;
    }
  }
  lastcount = thiscount;
  
  for (int i=0; i<prevcount; i++){
    S = '(' + S;
  }
  for (int i=0; i<lastcount; i++){
    S += ')';
  }
  std::cout << S << std::endl;
  return 0;
}


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

int n, k, i, j;
int nom [101];
bool dp [100001];

int main ()
    {
    scanf ("%d%d",&n,&k);
    for (i=1; i<=n; i++)
        scanf ("%d",&nom[i]);
    for (i=1; i<=k; i++)
        for (j=1; j<=n; j++)
            if (i-nom[j]>=0)
                dp[i]|=(!dp[i-nom[j]]);
    printf ("%s\n", dp[k] ? "First" : "Second");
    return 0;
    }


Measured memory_bytes: 384
#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

int main() {
    int n; cin >> n;
    string s; cin >> s;
    int ans = 0;
    REP(i, 1000) {
        int a = i / 100, b = (i - a * 100) / 10, c = i % 10;
        int f = 0;
        REP(j, s.size()) {
            if (f == 0 && s[j] - '0' == a) f = 1;
            else if (f == 1 && s[j] - '0' == b) f = 2;
            else if (f == 2 && s[j] - '0' == c) f = 3;
        }
        if (f == 3) ans++;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
a = []
b = []
for i in range(N):
    a.append(input())
c = 0
ans = "No"
for i in range(M):
    b.append(input())
for i in range(N-M+1):
    for j in range(N-M+1):
        for k in range(M):
            if a[i+k][j:j+M] == b[k]:
                c += 1
        if c == M:
            ans = "Yes"
            break
        c = 0
print(ans)


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

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };
    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };
    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        n: i64,
        k: i64
    }
    let mut x = 1;
    for _ in 0..n {
        x = std::cmp::min(x * 2, x + k);
    }
    println!("{}", x);
}


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


int main(){
	ll w, h, x, y;
	cin >> w >> h >> x >> y;
	int judge = 0;
	if(x*2 == w && y*2 == h) judge = 1;
	double size = w*h/2.0;
	printf("%.9lf %d",size,judge);


	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <algorithm>
#include <string>
#include <vector>
#include <algorithm>    // std::copy
#include <iterator>     // std::back_inserter
#include <set>
using namespace std;
 
int main(){
    string s;
    cin >> s;

    bool odd = true;
    bool even = true;
    for(int i = 0 ; i < s.size() ; i++){
        if( (i + 1 ) % 2 == 1 ){
            if(s[i] == 'R' || s[i] == 'U' || s[i] == 'D' ){}
            else {
                odd = false;
            }
        }
        else if( (i + 1 ) % 2 == 0 ){
            if(s[i] == 'L' || s[i] == 'U' || s[i] == 'D' ){}
            else {
                even = false;
            }
        }
    }

    if(odd == true && even == true){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main () {
	int a[101],n;
	cin >> n;
	for(int i=0;i<n;i++) cin>>a[i];
	for (int i=n-1;i>0;i--){
		cout << a[i]<<' ';
			} cout<<a[0]<<endl;
	return 0;
}


Measured memory_bytes: 3112
package main

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

func main() {
	N := readLineInt()[0]
	S := readLine()
	result := ""

	for _, c := range S {
		var lresult int32
		lresult = c
		Loop(0, N, func(i int) {
			if lresult == int32([]byte("Z")[0]) {
				lresult = int32([]byte("A")[0])
			} else {
				lresult = lresult + 1
			}
		})
		result += string(lresult)
	}

	fmt.Println(result)
}

/////////////////////////////////////////

func readLineInt() []int {
	result := make([]int, 0)
	for _, v := range strings.Split(readLine(), " ") {
		i, _ := strconv.Atoi(v)
		result = append(result, i)
	}
	return result
}

var reader = bufio.NewReaderSize(os.Stdin, 1e6)

func readLine() string {
	result := make([]byte, 0, 1e6)
	for {
		line, remains, e := reader.ReadLine()
		if e != nil {
			panic(e)
		}
		result = append(result, line...)
		if !remains {
			break
		}
	}
	return string(result)
}

func Loop(start, end int, f func(i int)) {
	for i := start; i < end; i++ {
		f(i)
	}
}

Measured memory_bytes: 9728
def mark(number):
    """ビンゴシートにマークする

    Parameters
    ----------
    number : int
        出た数字
    """
    if number in yoko1:
        yoko1[number] = True

    if number in yoko2:
        yoko2[number] = True

    if number in yoko3:
        yoko3[number] = True

    if number in tate1:
        tate1[number] = True

    if number in tate2:
        tate2[number] = True

    if number in tate3:
        tate3[number] = True

    if number in naname1:
        naname1[number] = True

    if number in naname2:
        naname2[number] = True


def is_bingo():
    """ビンゴ達成したか否かを返す。
    """
    ans_list = []
    ans_list.append(False not in yoko1.values())
    ans_list.append(False not in yoko2.values())
    ans_list.append(False not in yoko3.values())
    ans_list.append(False not in tate1.values())
    ans_list.append(False not in tate2.values())
    ans_list.append(False not in tate3.values())
    ans_list.append(False not in naname1.values())
    ans_list.append(False not in naname2.values())

    return True in ans_list


row1 = list(map(int, input().split()))
row2 = list(map(int, input().split()))
row3 = list(map(int, input().split()))

yoko1 = {row1[0]: False, row1[1]: False, row1[2]: False}
yoko2 = {row2[0]: False, row2[1]: False, row2[2]: False}
yoko3 = {row3[0]: False, row3[1]: False, row3[2]: False}

tate1 = {row1[0]: False, row2[0]: False, row3[0]: False}
tate2 = {row1[1]: False, row2[1]: False, row3[1]: False}
tate3 = {row1[2]: False, row2[2]: False, row3[2]: False}

naname1 = {row1[0]: False, row2[1]: False, row3[2]: False}
naname2 = {row1[2]: False, row2[1]: False, row3[0]: False}

N = int(input())

for i in range(N):
    b = int(input())
    mark(b)

print("Yes") if is_bingo() else print("No")


Measured memory_bytes: 38256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std ;
#define int                 long long
#define ull                 unsigned long long int
#define ld                  long double
#define vi                  vector<int>
#define vii                 vector<pair<int,int>>
#define vvi                 vector<vector<int>>
#define pii                 pair<int,int>
#define pb                  push_back
#define prec(x)             fixed<<setprecision(15)<<x
#define all(x)              x.begin(),x.end()
#define rall(x)             x.rbegin(),x.rend()
#define rev(x)              reverse(x.begin(),x.end())
#define mset(a,b)           memset(a,b,sizeof(a))
#define mcpy(a,b)           memcpy(a,b,sizeof(a))
#define fo0(i,n)            for(int i=0,i##end=n;i<i##end;i++)
#define fo1(i,n)            for(int i=1,i##end=n;i<=i##end;i++)
#define fo(i,a,b)           for(int i=a,i##end=b;i<=i##end;i++)
#define foe(i,x)            for(__typeof((x).end())i=(x).begin();i!=(x).end();++i)
#define fre(i,x)            for(__typeof((x).rend())i=(x).rbegin();i!=(x).rend();++i)
#define mk(arr,n,type)      type *arr=new type[n];
#define dbg(x) cerr << #x << " is " << x << endl;
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(0);cout.tie(0)
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }
clock_t beg = clock();
const int inf=1e18;const int mod=1e9+7;const int N=2e5+9;
const double pi = 3.1415926535897932384626433;
void FILE_IO(){
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}

void JH(){
    int d=0,e=0,f=0,g=0,p=0,w=0,flag=0,ans=0,res=0,cnt=0,sum=0;double f1=0.0,f2=0.0,f3=0.0;
    int n;cin>>n;
    if(n>=30)
        cout<<"Yes";
    else
        cout<<"No";

}

int32_t main()
{
    FILE_IO();FAST_IO;int t=1;
    // cin>>t;
    while(t--){JH();}cerr<<fixed<<setprecision(3)<<(double)(clock()-beg)/1000<<"s ";
}

Measured memory_bytes: 3776
H, W = map(int, input().split())
wall = '.' * (W+2)
s = []
s.append(wall)
for i in range(H):
  tmp = "." + input() + "."
  s.append(tmp)
s.append(wall)
#for i in range(len(s)):
#  print(s[i])
for i in range(1, H+1):
  for j in range(1, W+1):
    #print(s[i][j])
    if s[i][j]=='#' and s[i-1][j]=='.' and s[i][j-1]=='.' and s[i+1][j]=='.' and s[i][j+1]=='.':
      print("No")
      exit()
print("Yes")


Measured memory_bytes: 64956
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef pair<ll,ll> P;
typedef vector<ll> vec;
typedef vector<vec> mat;
int main(){
    double L;
    cin>>L;
    cout<<setprecision(10)<<(L/3)*(L/3)*(L/3)<<"\n";
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
	long N,D,X,s[109],result=0,memo=0;
	int i,j,k;
	scanf("%ld%ld%ld",&N,&D,&X);
	
	for(i=0;i<N;i++)
	{
		scanf("%ld",&s[i]);
	}
	
	for(i=0;i<N;i++)
	{
		result=1+result+(D-1)/s[i];
	}
	
	
	printf("%ld",result+X);
	
	}

Measured memory_bytes: 128
#include<bits/stdc++.h>
#define ll long long
#define pb emplace_back
#define N 53
#define INF 1000000000
using namespace std;
vector<int> e[N];
struct Info{ll nu,si,co;}a[N];
ll sp[N],p[N],n,m,x,d,si[N],dp[N*N*N],st[N*N*N],na,nd[N*N*N],ans;
void dfs(int x){
	sp[x]=p[x];si[x]=1;
	for (auto y:e[x]){dfs(y);si[x]+=si[y];sp[x]+=sp[y];}
}
void add(ll x,ll y,ll z){
	for (int i=0;i<y;i++){
		int l=1,r=0;
		for (int j=i;j<=n*n*n;j+=y){
			if (st[l]+x*y<j) l++;
			if (l<=r)nd[j]=min(dp[st[l]]+z*((j-st[l])/y),dp[j]);else nd[j]=m+1;
			while (r>=l&&dp[j]<dp[st[r]]+((j-st[r])/y)*z)r--;
			st[++r]=j;
		}
	}
	for (int i=0;i<=n*n*n;i++)dp[i]=min(dp[i],nd[i]);
}
bool c1(const Info &a,const Info &b){return a.co*b.si<b.co*a.si;}
int main(){
	cin>>n>>m>>d;
	for (int i=1;i<=n;i++){cin>>p[i];if (i!=1){cin>>x;e[x].pb(i);}}
	dfs(1);
	dp[0]=0;for (int i=1;i<=n*n*n;i++)dp[i]=m+1;
	for (int i=1;i<=n;i++){
		if (i==1){add(n,si[i],sp[i]);a[++na]=(Info){INF,si[i],sp[i]};}
		else{add(min(n,d),si[i],sp[i]);a[++na]=(Info){max(0ll,d-n),si[i],sp[i]};}
	}
	sort(a+1,a+na+1,c1);
	for (int i=0;i<=n*n*n;i++){
		ll su=i,ne=dp[i];
		if (ne<=m){
			for (int j=1;j<=n;j++){
				if (a[j].nu<=(m-ne)/a[j].co){ne+=a[j].nu*a[j].co;su+=a[j].si*a[j].nu;}
				else{su+=a[j].si*((m-ne)/a[j].co);break;}
			}
			ans=max(ans,su);
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3200
#include <iomanip>
#include <algorithm>
#include <iostream>
#include <vector>

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

#define INF 1000000000

using namespace std;

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

    cout << std::setprecision(20) << (L * L * L) / 27.0 << endl;

    return 0;
}


Measured memory_bytes: 256
N = int(input())
k = list(map(int, input().split()))
base = k[0]
ans = "Yes"
max = 0

for i in range(1, N):
  #print(str(base-1))
  #print(k[i])
  if base-1 >= max:
    max = base -1;
  #print("-----------")
  if (base-1 <= k[i]) and (max <= k[i]):
    pass
  else:
    ans = "No"
    break
  base = k[i]
    
print(ans)

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

int main(){
  int a,b,c;
  cin >> a >>b >>c;
  
  if(a+b <= b+c && a+b <= a+c)
    cout << a+b <<endl;
  else if(b+c < a+b && b+c < a+c)
    cout << b+c <<endl;
  else
    cout << a+c <<endl;
}

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

int main(){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    deque<int> b;
    for(int i = 0; i < n; i++){
        if(i % 2){
            b.push_front(a[i]);
        } else {
            b.push_back(a[i]);
        }
    }
    if(n % 2)
        reverse(b.begin(), b.end());
    for(auto x : b)
        cout << x << endl;
    return 0;
}

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

int main()
{
    int a;
    string s;
    cin >> a;
    cin >> s;
    if(a < 3200)
    {
        cout << "red" << endl;
    }
    else{
        cout << s << endl;
    }


    return 0;
}


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

using namespace std;

#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define F first
#define S second
#define pb push_back

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

const int N = 2e6 + 1;
const ll INF = 1e18 + 9;
const int B = 1e9 + 7;

int n, a[N], c[N];
ll f[N], rf[N];

ll pwr(ll a, ll b) {
    ll res = 1;
    for (; b; b >>= 1, a = a * a % B)
        if (b & 1) res = res * a % B;
    return res;
}

ll cnk(ll n, ll k) {
    if (n < k) return 0;
    return f[n] * rf[n - k] % B * rf[k] % B;
}

int main() {
    #ifdef black
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
    #endif // black
    ios_base :: sync_with_stdio(0);
    cin.tie(0);

    f[0] = rf[0] = 1;
    forn(i, 1, N - 1) {
        f[i] = f[i - 1] * i % B;
        rf[i] = pwr(f[i], B - 2);
    }

    cin >> n;
    int x, y;
    forn(i, 1, n + 1) {
        cin >> a[i];
        if (c[a[i]])
            x = c[a[i]], y = i;
        c[a[i]] = i;
    }
    cout << n << "\n";
    forn(i, 2, n + 1)
        cout << (cnk(n + 1, i) - cnk(x + n - y, i - 1) + B) % B << "\n";

    return 0;
}


Measured memory_bytes: 36096
#include<bits/stdc++.h>
using namespace std;
char a[888][888];
int to[888][888];
pair<int,int> cop[2333333];
int n,m,k,px,py;
bool check(int x,int y)
{
	return ((x==1)||(x==n)||(y==1)||(y==m));
}
int dis(int x,int y)
{
	return min(min(x-1,n-x),min(y-1,m-y));
}
int main()
{
	//freopen("in.txt","r",stdin);
	scanf("%d%d%d",&n,&m,&k);
	memset(a,'#',sizeof(a));
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++)
	{
		char ch=getchar();
		if ((ch!='S')&&(ch!='#')&&(ch!='.')) ch=getchar();
		a[i][j]=ch;
		if (ch=='S') {px=i;py=j;}
	}
	if (check(px,py)) {printf("0\n");return 0;}
	memset(to,127/3,sizeof(to));
	int head=1,tail=0;cop[head]=make_pair(px,py);to[px][py]=0;
	while (head!=tail)
	{
		pair<int,int> s=cop[++tail];
		if ((a[s.first-1][s.second]!='#')&&(to[s.first-1][s.second]>1e8))
		{
			to[s.first-1][s.second]=to[s.first][s.second]+1;
			cop[++head]=make_pair(s.first-1,s.second);
		}
		if ((a[s.first+1][s.second]!='#')&&(to[s.first+1][s.second]>1e8))
		{
			to[s.first+1][s.second]=to[s.first][s.second]+1;
			cop[++head]=make_pair(s.first+1,s.second);
		}
		if ((a[s.first][s.second-1]!='#')&&(to[s.first][s.second-1]>1e8))
		{
			to[s.first][s.second-1]=to[s.first][s.second]+1;
			cop[++head]=make_pair(s.first,s.second-1);
		}
		if ((a[s.first][s.second+1]!='#')&&(to[s.first][s.second+1]>1e8))
		{
			to[s.first][s.second+1]=to[s.first][s.second]+1;
			cop[++head]=make_pair(s.first,s.second+1);
		}
	}
	int ans=2100000000;
	for (int i=1;i<=n;i++)
	for (int j=1;j<=m;j++) if (to[i][j]<=k)
	{//cout<<i<<' '<<j<<' '<<dis(i,j)<<endl;
		if (check(i,j)) {printf("1\n");return 0;}
		ans=min(ans,dis(i,j));
	}
	printf("%d\n",1+ans/k+(ans%k!=0));
}

Measured memory_bytes: 12032
#!/usr/bin/env python3

# input = stdin.readline

def solve(n,m,a,queries):
  res = 0
  cnt = 0
  queries += [[1,x] for x in a]
  queries = list(sorted(queries,key=lambda x: x[1],reverse=True))
  for query in queries:
    if cnt >= n:
      break
    else:
      res += query[1] * min(query[0],n-cnt)
      cnt += query[0]
  return res



def main():
  N,M = map(int,input().split())
  a = list(map(int,input().split()))
  queries = list(list(map(int,input().split())) for _ in range(M))
  print(solve(N,M,a,queries))

if __name__ == '__main__':
  main()


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


int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    
    int x, y;
    cin >> x >> y;

    for (int i = 0; i <= x; i++) {
        int a = i, b = x-i;
        if (2*a + 4*b == y) {
            cout << "Yes\n";
            return 0;
        }
    }
    cout << "No\n";
 
    return 0;
}

Measured memory_bytes: 3648
#include <cmath>
#include <cstdio>
#include <iostream>
#include<cstdlib>
#include<string>
using namespace std;


int main(){
string s;
cin >> s;
long ans=0;
long st=0;
char sing;
bool last=false;
//cout <<s.size()<<endl;
for(int bit=0;bit<(1<<s.size());bit++){
  for(int i=0;i<s.size();i++){
    sing=s.at(i);
    st += sing -'0';
    if(bit & (1<<i)){
      ans+=st;
      //    cout<<st<<" ";
      st=0;
      last=false;
    }else{
    st*=10;
    last=true;
    }

  }
  if(last=true){st/=10;}
  ans+=(st);
  //cout << st << endl;
  st=0;
}

  cout << ans/2<<endl;

}

Measured memory_bytes: 256
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto A = RD;
	auto B = RD;
	auto C = RD;
	auto K = RD;

	while (A >= B)
	{
		B *= 2;
		--K;
	}
	while (B >= C)
	{
		C *= 2;
		--K;
	}

	writeln(K >= 0 ? "Yes" : "No");
	stdout.flush;
	debug readln;
}


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

int main(){
	string s;
	cin>>s;
	int len=s.size();
	ll ans=0;
	if(len==1){
		cout<<s<<endl;
		return 0;
	}
	for(int i=0; i<pow(2, len-1); i++){
		ll tmp=0;
		for(int j=len-2; j>=0; j--){
			tmp=tmp*10+static_cast<ll>(s[len-j-2]-'0');
			if((i>>j)&1){
				ans+=tmp;
				tmp=0;
			}
		}
		ans+=tmp*10+static_cast<ll>(s[len-1]-'0');
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.*;
import java.awt.geom.*;
import java.awt.geom.Line2D.Double;

public class Main {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		
		while(in.hasNext()){
            String buffer=  in.nextLine();
            Scanner sc = new Scanner(buffer.replace(',', ' '));

			double xa = sc.nextDouble();
			double ya = sc.nextDouble();
			double xb = sc.nextDouble();
			double yb = sc.nextDouble();
			double xc = sc.nextDouble();
			double yc = sc.nextDouble();
			double xd = sc.nextDouble();
			double yd = sc.nextDouble();
			
			Line2D.Double s = new Line2D.Double();
			Line2D.Double t = new Line2D.Double();
			int ans = 1;
			
			while(true){
			
				ans = 1;
				s.setLine(xa, ya, xd, yd);
				t.setLine(xb, yb, xc, yc);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xb, yb, xd, yd);
				t.setLine(xa, ya, xc, yc);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xc, yc, xd, yd);
				t.setLine(xa, ya, xb, yb);
				if(s.intersectsLine(t)==true)ans*=0;
				if(ans==1){
					System.out.println("NO");
					break;
				}
				
				ans = 1;
				s.setLine(xa, ya, xc, yc);
				t.setLine(xb, yb, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xb, yb, xc, yc);
				t.setLine(xa, ya, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xd, yd, xc, yc);
				t.setLine(xa, ya, xb, yb);
				if(s.intersectsLine(t)==true)ans*=0;
				if(ans==1){
					System.out.println("NO");
					break;
				}
			
				ans = 1;
				s.setLine(xa, ya, xb, yb);
				t.setLine(xc, yc, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xc, yc, xb, yb);
				t.setLine(xa, ya, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xd, yd, xb, yb);
				t.setLine(xa, ya, xc, yc);
				if(s.intersectsLine(t)==true)ans*=0;
				if(ans==1){
					System.out.println("NO");
					break;
				}
				
				ans = 1;
				s.setLine(xb, yb, xa, ya);
				t.setLine(xc, yc, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xc, yc, xa, ya);
				t.setLine(xb, yb, xd, yd);
				if(s.intersectsLine(t)==true)ans*=0;
				s.setLine(xd, yd, xa, ya);
				t.setLine(xb, yb, xc, yc);
				if(s.intersectsLine(t)==true)ans*=0;
				if(ans==1){
					System.out.println("NO");
					break;
				}
				
				System.out.println("YES");
				break;
			}
		}
	}	
}

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

int k, n, p, r, s, dp[100 * 10000][4], ans;
string t;

int main() {
	//dp 0 = r , dp 1 = s, dp 2 = p
	cin >> n >> k >> r >> s >> p;
	cin >> t;
	for (int i = 0; i < k; i++) {
		if(t[i] == 's') dp[i][0] = r;
		if(t[i] == 'p') dp[i][1] = s;
		if(t[i] == 'r') dp[i][2] = p;
		//cout << i << ' ' << 'r' << dp[i][0] << ' '  << 's' << dp[i][1] << ' ' << 'p' << dp[i][2] << '\n';
	}
	for (int i = k ; i < n; i++) {
		dp[i][0] = max(dp[i - k][1], dp[i - k][2]);
		dp[i][1] = max(dp[i - k][0], dp[i - k][2]);
		dp[i][2] = max(dp[i - k][0], dp[i - k][1]);
		if(t[i] == 's') dp[i][0] += r;
		if(t[i] == 'p') dp[i][1] += s;
		if(t[i] == 'r') dp[i][2] += p;
		//cout << i << ' ' << 'r' << dp[i][0] << ' '  << 's' << dp[i][1] << ' ' << 'p' << dp[i][2] << '\n';
		
	}
	for (int i = n - 1; i > n - 1 - k; i--) ans += max(dp[i][0] , max(dp[i][1], dp[i][2]));
	cout << ans;
 	return 0;
 }
			


Measured memory_bytes: 2048
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#define pai 3.1415926535

int main(void) {
	char S[101];
	scanf("%s", S);
	int a = strlen(S);
	int count = 0;

	if(a%2==0){
		for (int i = 0; i < strlen(S)/2; i++) {
			if (S[i] != S[a - 1]) {
				count++;
			}

			a--;
		}
	}
	else {
		for (int i = 0; i <(strlen(S)-1) / 2; i++) {
			if (S[i] != S[a - 1]) {
				count++;
			}
			a--;
		}
	}
	printf("%d", count);


	return 0;
}

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

int main(){
  int arr[3];
  cin >> arr[0] >> arr[1] >> arr[2];
  sort(arr,arr+3);
  if (arr[0] != arr[1] && arr[1] != arr[2]) cout << "No" << endl;
  else if (arr[0] == arr[1] && arr[1] != arr[2]) cout << "Yes" << endl;
  else if (arr[0] != arr[1] && arr[1] == arr[2]) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 256
using System;

namespace ABC101_A_Eating_Symbols_Easy
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			string s = Console.ReadLine();
			int x = 0;

			for (int i = 0; i < 4; i++) {
				if (s.Substring(i, 1) == "+")
				{
					x++;
				}
				else
				{
					x--;
				}
			}
			
			Console.WriteLine(x);
		}
	}
}

Measured memory_bytes: 13140
import java.util.*;

class Main{
        public static void main(String[] args){
                Scanner sc = new Scanner(System.in);
                int[] a = new int[5];
                for(int i = 0; i < 5; i++){
                        a[i] = sc.nextInt();
                }   
                Arrays.sort(a);
                for(int i = 4; i > 0; i--){
                         System.out.print(a[i]+" ");
                }   
                System.out.println(a[0]);
                sc.close();
        }   
}

Measured memory_bytes: 12000
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {

	public static void main(String args[]) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

		String str[] = br.readLine().split(" ");
		int n = Integer.parseInt(str[0]);
		int m = Integer.parseInt(str[1]);

		if (n <= m) {
			System.out.println("unsafe");
		} else {
			System.out.println("safe");
		}
	}
}


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

int main(){
  int n, k;
  cin >> n >> k;
  vector<int> d(n);
  for(int i = 0; i < k; i++){
    int m;
    cin >> m;
    for(int j = 0; j < m; j++){
      int a;
      cin >> a;
      d[a - 1] = 1;
    }
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(d[i] == 0) ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3576
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=1e5+7;
const ll mod=1e9+7;
int T;
ll a[maxn];
int n,k;
ll f[maxn];
ll kqow(ll a,ll b)
{
    ll ans=1;
    while(b)
    {
        if(b%2) ans*=a;
        a*=a;
        ans%=mod;
        a%=mod;
        b/=2;
    }
    return ans;
}
ll ans;
int main()
{
    f[1]=1;
    f[0]=1;
    for(int i=2;i<=100002;i++)  f[i]=i*f[i-1]%mod;
    scanf("%d%d",&n,&k);
    for(int i=1;i<=n;i++)   scanf("%lld",&a[i]);
    sort(a+1,a+1+n);
    ll ab=f[k-1];
    for(int i=1;i<=n;i++)
    {
        if(i>=k)
        {
            ans+= kqow(ab * f[i-k]%mod ,mod-2)  *  f[i-1]  %mod*a[i];
            ans%=mod;
        }
        if(n-i>=k-1)
        {
            ans-=kqow(ab*f[n-i-k+1]%mod,mod-2)  *  f[n-i]   %mod*a[i];
            ans%=mod;
        }
    }


    printf("%lld\n",(ans+mod)%mod);
}



Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int main (){
    string A;
    cin>>A;
    int ramen=700;
    string ajitama;
    string chashoo;
    string negi;
    ajitama = A.substr(0,1);
    chashoo = A.substr(1,1);
    negi = A.substr(2,1);
    if (ajitama == "o"){
        ramen += 100;
    }
    if(chashoo == "o"){
        ramen += 100;
    }
    if(negi == "o"){
        ramen += 100;
    }
    cout << ramen;

}

Measured memory_bytes: 256
/*input
3 2
*/
#include <bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector")
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;
#define IOS ios_base::sync_with_stdio(0); cin.tie(0)
#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define F first
#define S second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define pb push_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
template<typename T1,typename T2>
ostream& operator<<(ostream& out,pair<T1,T2> P){
	out<<'('<<P.F<<','<<P.S<<')';
	return out;
}

//}}}
const ll maxn=300005;
const ll maxlg=__lg(maxn)+2;
const ll INF64=8000000000000000000LL;
const int INF=0x3f3f3f3f;
const ll MOD=ll(1e9+7);
const ld PI=acos(-1);
const ld eps=1e-9;
//const ll p=880301;
//const ll P=31;

ll mypow(ll a,ll b){
	ll res=1LL;
	while(b){
		if(b&1) res=res*a%MOD;
		a=a*a%MOD;
		
		b>>=1;
	}
	return res;
}

int main(){
	IOS;
	ll n,k;
	cin>>n>>k;
	ll ans=(n/k)*(n/k)*(n/k);
	if(k%2==0){
		n+=k/2;
		ans+=(n/k)*(n/k)*(n/k);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256
import copy

S = input()
T = input()
if len(S) < len(T):
  print("UNRESTORABLE")
  exit()
flg = True
Sarray = []
for i in range(len(S)-len(T)+1):
  flg=True
  Stmp = copy.copy(S)
  for idx, c in enumerate(T):
    if Stmp[i+idx]!=c and Stmp[i+idx]!='?':
      flg=False
      break
  if flg:
    Stmp = Stmp[:i] + T + Stmp[len(T)+i:]
    Stmp = Stmp.replace('?', 'a')
    Sarray.append(Stmp)
if len(Sarray)==0:
  print("UNRESTORABLE")
  exit()
else:
  Sarray.sort()
  print(Sarray[0])

Measured memory_bytes: 3444
#include <bits/stdc++.h>
using namespace std;
#define rep(i, srt, end) for (long long i = (srt); i < (long long)(end); i++)
#define VL vector<ll>
#define INF 100000000
typedef long long ll;

int main(){
    ll R;
    cin>>R;
    if(R<1200)cout<<"ABC";
    else if(R<2800&&R>=1200)cout<<"ARC";
    else cout<<"AGC";
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <iostream>
#include <utility> // pair
#include <string>
#include <vector>
#define MAX_N 100001
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
#define FOR(i, a, b) for(ll i=a; i<b; i++)
#define REP(i, n) for(ll i=0; i<n; i++)
#define REV(i, n) for(ll i=n-1; i>=0; i--)
#define ALL(v) v.begin(), v.end()
#define pb push_back
const ll INF = 9e18;
ll n, m1[10], m2[10][10], m3[10][10][10];
string s;
// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

void keta3(int i, int j, int now){
	m3[i][j][now] = 1;
}

void keta2(int i, int now){
	for(int j=0; j<10; j++){
		if(m2[i][j] == 1) keta3(i, j, now);
		if(j == now){
			m2[i][j] = 1;
		}
	}
}

void keta1(int now){
	for(int i=0; i<10; i++){
		if(m1[i] == 1) keta2(i, now);
		if(i == now){
			m1[now] = 1;
		}
	}
}

signed main(){
	cin >> n >> s;
	Fill(m1, 0);
	Fill(m2, 0);
	Fill(m3, 0);
	for(char c: s){
		int now = c - '0';
		keta1(now);
	}

	ll ret = 0;
	for(int i=0; i<10; i++){
		for(int j=0; j<10; j++){
			for(int k=0; k<10; k++){
				ret += m3[i][j][k];
			}
		}
	}
	cout << ret << endl;
    return 0;
}

Measured memory_bytes: 256
A = input().strip()
C = {chr(i):0 for i in range(97,123)}
n = len(A)
for i in range(n):
    C[A[i]] += 1
cnt = 0
for a in C:
    cnt += (C[a]*(C[a]-1))//2
print(1+(n*(n-1))//2-cnt)

Measured memory_bytes: 40688