akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
 
using namespace std;
 
#define xx         first
#define yy         second
#define pb         push_back
#define mp         make_pair
#define LL         long long
#define inf        INT_MAX/3
#define mod        1000000007ll
#define PI         acos(-1.0)
#define linf       (1ll<<60)-1
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define REP(I,N)   FOR(I,0,N)
#define For(I,N)   for(int I=1;I<=(N);I++)
#define ALL(A)     ((A).begin(), (A).end())
#define set0(ar)   memset(ar,0,sizeof ar)
#define vsort(v)   sort(v.begin(),v.end())
#define setinf(ar) memset(ar,126,sizeof ar)
#define SZ(X) ((int)(X.size()))
#define LG(X) ((int)(X.length()))
#define CL(X) (X).clear()
#define MAXEL(A,B) (*max_element(A,B))
#define MINEL(A,B) (*min_element(A,B))
#define ROPEN(X) freopen(X,"r",stdin)
#define WOPEN(X) freopen(X,"w",stdout)
#define BG(X) (X.begin())
#define EN(X) (X.end())
#define VI vector<int>
#define PII pair<int,int>
 
//cout << fixed << setprecision(20) << p << endl;
 
template <class T> inline T bigmod(T p,T e,T M){
    LL ret = 1;
    for(; e > 0; e >>= 1){
        if(e & 1) ret = (ret * p) % M;
        p = (p * p) % M;
    } return (T)ret;
}
template <class T> inline T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template <class T> inline T modinverse(T a,T M){return bigmod(a,M-2,M);}


int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int a,b,c,k;
	cin>>a>>b>>c>>k;
	cout<<a+b+c+max({a,b,c})*((1<<k)-1);
	return 0;
}


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

#define BUF 2 * 100000 + 2

int main(void) {
  char s[BUF], t[BUF];
  scanf("%s %s", s, t);
  int result = 0;
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    if (s[i] != t[i]) result++;
  }
  printf("%d\n", result);

  return 0;
}


Measured memory_bytes: 2112
#include<iostream>
#include<string>
#include<cstdlib>
using namespace std;
 
struct Node {
    int key;
    Node *parent, *right, *left;
    public:
    Node(Node *r, Node *l, Node *p, int k) : right(r), left(l), parent(p), key(k) {};
};
 
Node *root, *NIL;
 
void insert(int key) {
    Node *z = new Node(NIL, NIL, NIL, key);
    Node *y = NIL;
    Node *x = root;
    while (x != 0) {
        y = x;
        if (z->key < x->key) {
            x = x->left;
        }
        else {
            x = x->right;
        }
    }
    z->parent = y;
    if (y == NIL) {
        root = z;
    }
    else if (z->key < y->key) {
        y->left = z;
    }
    else {
        y->right = z;
    }
    return;
}
 
Node* find(Node *u,int key){
    while(u != NIL && key != (u->key)){
        if(key < (u->key)) u = u->left;
        else u = u->right;
    }
    return u;
}
 
void inorder(Node *u) {
    if (u == NIL) return;
    inorder(u->left);
    cout << " " << u->key;
    inorder(u->right);
    return;
}
 
void preorder(Node *u) {
    if (u == NIL)return;
    cout << " " << u->key;
    preorder(u->left);
    preorder(u->right);
    return;
}
 
void print(Node *u) {
    inorder(root);
    cout << endl;
    preorder(root);
    cout << endl;
    return;
}
 

Node* successor(Node *u){
    if(u->right != NIL){
        Node *x;
        x=u->right;
        while(x->left != NIL) x=x->left;
        return x;
    }
    Node *y=u->parent;
    while(y!=NIL && u==y->right){
        u=y;
        y=y->parent;
    }
    return y;
}

void deleteNode(Node *u){
    Node *y;
    Node *x;
    if(u->left == NIL || u->right == NIL) y=u;
    else y=successor(u);
    if(y->left != NIL) x=y->left;
    else x=y->right;
    if(x!=NIL) x->parent=y->parent;
    if(y->parent==NIL) root=x;
    else {
        if(y==y->parent->left) y->parent->left=x;
        else y->parent->right=x;
    }
    if(y!=u) u->key=y->key;
    free(y);
}
int main() {
    int n,key;
    string order;
    cin >> n;
    for (int i = 0; i < n; i++) {
        cin >> order;
        if (order == "insert") {
            cin >> key;
            insert(key);
        }
        else if (order == "delete"){
            cin >> key;
            deleteNode(find(root,key));
        }
        else if (order == "print") {
            print(root);
        }
        else if (order == "find"){
            cin >> key;
            if (find(root, key) != NIL) cout<<"yes"<<endl;
            else cout<<"no"<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 19960
#include<iostream>
#include<iomanip>
int main()
{
	while (true)
	{
		double a;
		std::cin >> a;
		if (std::cin.eof())
		{
			break;
		}
		std::cout << std::fixed << std::setprecision(10) << a * 211 / 27 << std::endl;
	}
	return 0;
}


Measured memory_bytes: 3216
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)

int solve(int K) {
	int mod = 9 * K;
	int cur = 10%mod;
	for (int i = 1; i <= K; i++) {
		if (cur == 1)return i;
		cur *= 10;
		cur %= mod;
	}
	return -1;
}

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

	int K;
	cin >> K;
	if (K % 7 == 0)K /= 7;
	puts(solve(K));
	

	return 0;
}

Measured memory_bytes: 3112
using System;

namespace ABC100C
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long[] a = Array.ConvertAll(Console.ReadLine().Split(' '), long.Parse);

            long ans = 0;
            for (int i = 0; i < n; i++)
            {
                long k = a[i];
                while (k % 2 == 0)
                {
                    ans++;
                    k /= 2;
                }
            }
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 11872
#include <bits/stdc++.h>
 #define rep(i,a,b) for (int i=a;i<b;i++)
 #define rep2(i,a,b) for (int i=a;i>=b;i--)
 #define mod 1000000007
 #define INF  1e9+5
 #define f first
 #define se second
 #define endl '\n'
 #define ll long long
 #define ii pair <int,int>
 #define pll pair <ll,ll>
 #define vi vector <int>
 #define vl vector <ll>
 #define vvi vector < vi >
 #define vii vector < ii >
 #define vvii vector < vii >
 #define vll vector < ll >
 #define mi map<int,int>
 #define mll map<ll,ll>
 #define mci map<char,int>
 #define msi map<string,int>
 #define vb  vector <bool>
 #define pb push_back
 #define mk make_pair
 #define sz(a) a.size()
 #define all(a) a.begin(),a.end()
 #define rall(a) a.rbegin(),a.rend()
 #define int long long int
 #define Anurag_Gupta ios_base::sync_with_stdio(false);
#define IIIT_ALLD    cin.tie(NULL);cout.tie(NULL);
using namespace std;
vi fact(1000007);
inline int mdpower(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res%mod*a%mod)%mod;
        b/=2;
        a = (a%mod*a%mod)%mod;
    }
    return res;
}
inline int power(int a,int b)
{
    int res =1;
    while(b)
    {
        if(b&1) res = (res*a);
        b/=2;
        a = a*a;
    }
    return res;
}

inline void factorial()
{
    fact[0]=1;
    for(int i=1;i<1000007;i++)
        fact[i] = (fact[i-1]%mod*i%mod)%mod;
}

inline int inverse(int a)
{
    return mdpower(a,mod-2);
}
int n;
int h[1000005];
int dp[1000005];
int solve(int idx)
{
	if(idx==n-1)
		return 0;
	if(idx>=n)
		return INF;
	if(dp[idx]!=-1)
		return dp[idx];
	int x = abs(h[idx]-h[idx+1])+solve(idx+1);
	int y = abs(h[idx]-h[idx+2])+solve(idx+2);
	return dp[idx]=min(x,y);
}
 signed main()
 {
     Anurag_Gupta
     IIIT_ALLD
     
    /* #ifndef ONLINE_JUDGE
         freopen("input.txt","r",stdin);
         freopen("output.txt","w",stdout);
     #endif*/

         cin>>n;
         for(int i=1;i<=n;i++)
         	cin>>h[i];
         memset(dp,-1,sizeof dp);
         dp[0]=0;
         dp[1]=0;
         dp[2]=abs(h[2]-h[1]);
         //cout<<dp[1]<<" "<<dp[2]<<"\n";
         for(int i=3;i<=n;i++)
         {
         	dp[i]=min(abs(h[i-1]-h[i])+dp[i-1],abs(h[i-2]-h[i])+dp[i-2]);
         	//cout<<dp[i]<<" ";
         }
         cout<<dp[n]<<"\n";
 }


Measured memory_bytes: 18304
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int k;
    int a, b;
    cin >> k >> a >> b;
    for (int i = a; i <= b; ++i) {
        if (i % k == 0) {
            cout << "OK" << endl;
            return 0;
        }
    }
    cout << "NG" << endl;
}

Measured memory_bytes: 3692
#include <bits/stdc++.h>
using namespace std;
const int MOD =(int)(1e9)+7;
int main()
{
    int r,g,b;
    cin >> r >> g >> b;
    if((10*g+b)%4==0){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
    return 0;
}

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

int main(){
	int r,g,b;
	cin >> r >> g >> b;
	if((g*10+b) % 4 == 0)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#define N 210
#define S(a) scanf("%d",&a)
#define foru(i,a,b) for(int i=a;i<=b;++i)

using namespace std;
int f[N][21],t[N],p[N],rk[N],n;
bool cmp(int a,int b)
{
	return t[a]<t[b];
}
int main()
{
	while(1)
	{
		S(n); if(!n) break;
		foru(i,1,n) S(p[i]),S(t[i]);
		foru(i,1,n) rk[i]=i;
		sort(rk+1,rk+n+1,cmp);
		memset(f,127,sizeof(f));
		f[0][0]=0; t[rk[0]]=rk[0]=0;
		foru(i,1,n)
		  foru(k,1,3)
		  {
		  	  if(t[rk[i]]-t[rk[i-1]]>=k*abs(p[rk[i]]-p[rk[i-1]]))
		  	    f[i][k]=min(f[i][k],f[i-1][k-1]+abs(p[rk[i]]-p[rk[i-1]]));
		  	  if(k==1)
		  	    foru(kk,1,3)
		  	      if(t[rk[i]]-t[rk[i-1]]>=(1+kk)*p[rk[i-1]]+p[rk[i]])
		  	        f[i][1]=min(f[i][1],f[i-1][kk]+p[rk[i]]+p[rk[i-1]]);
		  }
		if(f[n][1]>=(int)1e8&&f[n][2]>=(int)1e8&&f[n][3]>=(int)1e8)
		{
			foru(i,1,n)
			  if(f[i][1]>=(int)1e8&&f[i][2]>=(int)1e8&&f[i][3]>=(int)1e8)
			  {
			  	  printf("NG %d\n",rk[i]); break;
			  }
		}
		else printf("OK %d\n",min(f[n][1],min(f[n][2],f[n][3]))+p[rk[n]]);
	}
	return 0;
}

Measured memory_bytes: 1232
# -*- coding: utf-8 -*-
from bisect import bisect_left
INF = 10**18
a,b,q = map(int, input().split())
sl = [-INF] + [int(input()) for _ in range(a)] + [INF]
tl = [-INF] + [int(input()) for _ in range(b)] + [INF]
# print(sl)
# print(tl)
for _ in range(q):
    x = int(input())
    si = bisect_left(sl,x)
    ti = bisect_left(tl,x)
    # print(x,si,ti)
    res = INF
    for s in [sl[si-1], sl[si]]:
        for t in [tl[ti-1], tl[ti]]:
            res = min(
                res,
                abs(s-x)+abs(t-s),
                abs(t-x)+abs(s-t)
            )
    print(res)


Measured memory_bytes: 14616
//#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
//#pragma comment(linker, "/stack:200000000")

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

#define X first
#define Y second

//#include <boost/unordered_map.hpp>
//using namespace boost;

/*
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> rbtree;
rbtree T;
*/

namespace io{
	const int L = (1 << 20) + 1;

	char buf[L], *S , *T, c;

	char getchar() {
		if(__builtin_expect(S == T, 0)) {
			T = (S = buf) + fread(buf, 1, L, stdin);
			return (S == T ? EOF : *S++);
		}
		return *S++;
	}

	int inp() {
		int x = 0, f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	unsigned inpu()
	{
		unsigned x = 0; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar());
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x;
	}

	ll inp_ll() {
		ll x = 0; int f = 1; char ch;
		for(ch = getchar(); !isdigit(ch); ch = getchar())
			if(ch == '-') f = -1;
		for(; isdigit(ch); x = x * 10 + ch - '0', ch = getchar());
		return x * f;
	}

	char B[25], *outs=B+20, *outr=B+20;
	template<class T>
	inline void print(register T a,register char x=0){
		if(x) *--outs = x, x = 0;

		if(!a)*--outs = '0';
		else
			while(a)
				*--outs = (a % 10) + 48, a /= 10;

		if(x)
			*--outs = x;

		fwrite(outs, outr - outs , 1, stdout);
		outs = outr;
	}
};

using io :: print;
using io :: inp;
using io :: inpu;
using io :: inp_ll;

using i32 = int;
using i64 = long long;
using u8 = unsigned char;
using u32 = unsigned;
using u64 = unsigned long long;
using f64 = double;
using f80 = long double;

ll power(ll a, ll b, ll p)
{
	if (!b) return 1;
	ll t = power(a, b/2, p);
	t = t*t%p;
	if (b&1) t = t*a%p;
	return t;
}

ll exgcd(ll a, ll b, ll &x, ll &y)
{
	if (b == 0)
	{
		x = 1;
		y = 0;
		return a;
	}
	ll px, py;
	ll d = exgcd(b, a%b, px, py);
	x = py;
	y = px-a/b*py;
	return d;
}

template<class T>
inline void freshmin(T &a, const T &b)
{
	if (a > b) a = b;
}

template<class T>
inline void freshmax(T &a, const T &b)
{
	if (a < b) a = b;
}

const int MAXN = 100010;
const int MOD = 1000000007;
const f80 MI = f80(1)/MOD;
const int INF = 1000000000;

int a[MAXN], b[MAXN];

int main()
{
	
	int n,m,c;
	cin >> n >> m >> c;
	for (int i = 1; i <= m; ++ i)
	{
		cin>>b[i];
	}
	int ans = 0;
	for (int i = 1; i <= n; ++ i)
	{
		int ret = c;
		for (int j = 1; j <= m; ++ j)
		{
			cin >> a[j];
			ret += a[j]*b[j];
		}
		if (ret > 0) ans++;
	}
	cout<<ans<<endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define lln long long int
#define llu unsigned lln
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(res) printf("%lf\n",res);
#define maxii 100005
using namespace std;
typedef pair<int,int> pii;
typedef pair<lln,lln> pll;
vector<int> vi[maxii];
vector<int>:: iterator child;
typedef vector<lln> vl;
typedef vector<pii> vii;
typedef vector<pll> vll;


int arr[maxii];
int arr2[maxii];
bool check[maxii];
int cnt=0,n;
void dfs(int node)
{
    check[node]=true;
    if(vi[node].size()==n-1)cnt++;
    for(int child=0;child<vi[node].size();child++)
    {
        if(check[vi[node][child]]==false)
        {
            dfs(vi[node][child]);
        }
    }
}

int main()
{
    int a,b;
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    if(a==b)cout<<"Draw";
    else if(a>b)cout<<"Alice";
    else cout<<"Bob";

}






Measured memory_bytes: 5936
#include <iostream>
#include <algorithm>

using namespace std;

int dp[3010];

struct Dish{
    int w, v;
    Dish(){
    }
    Dish(int _w, int _v){
        w = _w; v = _v;
    }

    bool operator <(const Dish a) const{
        return w < a.w;
    }
};

Dish d[3010];

int main(){
    int n, t;

    cin >>n >> t;

    for(int i=0;i<n;i++){
        int w, v;
        cin >>w>>v;
        d[i] = Dish(w, v);
    }

    sort(d, d+n);

    int ans = 0;
    for(int i=0;i<n-1;i++){
        ans = max(ans, dp[t-1] + d[i].v);
        for(int j=t-1;j>=d[i].w;j--){
            dp[j] = max(dp[j], dp[j - d[i].w] + d[i].v);
        }
    }
    ans = max(ans, dp[t-1] + d[n-1].v);
    cout <<ans;
}




Measured memory_bytes: 256
n=int(raw_input())
A=map(int, raw_input().split())
q=int(raw_input())
m=map(int, raw_input().split())

def solve(j, m):
  if m == 0:
    return 1
  if j >= n or m > sum(A):
    return 0
  res = solve(j + 1, m) or solve(j + 1, m - A[j])
  return res

for i in range(0,q):
  if solve(0,m[i]):
    print "yes"
  else:
    print "no"

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

int main() {
    string s; cin >> s;
    int c = 10e7;
    int f = 0;
    for(int i = 0; i < s.length(); i ++) {
        if(s[i]=='C') c = min(i,c);
        if(s[i]=='F') f = max(i,f);
    }
    cout << (c<f ? "Yes" : "No") << endl;
}

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

class Assignment {
  static void Main() {
    var N = int.Parse(Console.ReadLine().Trim());
    var L = Console.ReadLine().Trim().Split(' ').Select(x => int.Parse(x.Trim())).ToArray();
    //N = L.Length;
    var answer = 0;
    //var prev_i = 0;
    //ソート
    Array.Sort(L);
    //Console.WriteLine(string.Join(" ", L));
    
    for(var i = 0; i < N - 2; i++) {   
      /*
      var prev_j = 0;
      if(L[i] == prev_i) {
        continue;
      }
      */
      for(var j = i + 1; j < N - 1; j++) {
        /*
        var prev_k = 0;
        if(L[j] == prev_j) {
          continue;
        }
        */
        /*
        if(L[j] == L[i]) {
          continue;
        }
        */
        for(var k = N - 1; k > j; k--) {
          if(L[i] + L[j] > L[k]) {
            answer += k - j;
            break;
          }
        }
        /*
        for(var k = j + 1; k < N; k++) {
          //Console.WriteLine(i + ", " + j + ", " + k + ", " + answer);
         
          if(L[i] + L[j] > L[k]) {
            answer++;   

          } else {
            break;
          }
        }
        */
      }
    }
    Console.WriteLine(answer);
    
  }
}

Measured memory_bytes: 13392
while True:
    (a, op, b) = [int(i) if i.isdigit() else i for i in input().split()]
    if op == '?':
        break
    elif op == '+':
        print(a + b)
    elif op == '-':
        print(a - b)
    elif op == '*':
        print(a * b)
    elif op == '/':
        print(a // b)

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

int main()
{

  string Sin;
  string T;
  cin >> Sin;
  cin >> T;

  int start = -1;
  vector<int> sv;

  //cout << T.size() << endl;
  rep(i,Sin.size()-T.size()+1){
    start = i;
    rep(j,T.size()){
      //cout << Sin[i+j] << " " << T[j] << endl;
      if(Sin[i+j] != T[j] && Sin[i+j] != '?')break;
      if(j==T.size()-1) sv.push_back(start);
    }
  }

  if (sv.size() == 0){
    cout << "UNRESTORABLE" << endl;
    return 0;
  }
  int count = 0;
  rep(i,int(Sin.size())){
    if(sv.at(sv.size() - 1) <= i && i<sv.at(sv.size() - 1) + T.size()){
      cout << T[count];
      //cout << sv.at(sv.size()-1) << " " << sv.size() << endl;
      ++count;
    }
    else if(Sin[i] == '?')cout <<'a';
    else cout<<Sin[i];
    
  }
  cout << endl;
  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
using namespace std;
char s[11];
int main(){
	cin >> s;
	int len = strlen(s);
	if(len & 1) {
		cout << "No" << endl;
		return 0;
	}
	for(int i = 0; i < len; ++i){
		if(i & 1){
			if(s[i] != 'i'){
				cout << "No" << endl;
				return 0;
			}
		} 
		else{
			if(s[i] != 'h'){
				cout << "No" << endl;
				return 0;
			}
		}
	}
	cout << "Yes" << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define mp make_pair
using namespace std;

void power(ll a, ll b)
{
	ll ans = 1;
	while(b)
	{
		if(b&1)
			ans = ans* a %mod;
		a = a*a%mod;
		b = b>>1;
	}
	cout<<ans<<endl;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n;
	cin>>n;
	int a,b[n];
	memset(b,0,sizeof(b));
	for(int i = 0;i<n; i++)
	{
		cin>>a;
		b[a]++;
	}
	int coun= 0,i=1;
	if(n&1)
		for(i=0;i <n; i+=2)
		{
			if(i==0 && b[i]==1)
				continue;
			else if(b[i]!=2)
			{
				cout<<0<<endl;
				return 0;
			}
		}
	else
	{
		for(i = 1; i<n; i+=2)
			if(b[i]!=2)
			{
				cout<<0<<endl;
				return 0;
			}
	}
	power(2,n/2);
	return 0;
}

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

int N, K;
vector<int> d;
vector<vector<int>> A;

void input() {
    cin >> N >> K;
    d.resize(K);
    A.resize(K, vector<int>());
    for(int i = 0; i < K; i++) {
        cin >> d[i];
        A[i].resize(d[i]);
        for(int j = 0; j < d[i]; j++) {
            cin >> A[i][j];
        }
    }
}

void solve() {
    int ans = 0;
    for(int i = 1; i <= N; i++) {
        bool have = false;
        for(auto v : A) {
            for(auto p : v) {
                if(p == i) have = true;
            }
        }
        if(!have) ans++;
    }
    cout << ans << endl;
}

int main() {
    input();
    solve();
    return 0;
}



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

int main() {
	ios_base::sync_with_stdio( false );

	int H, W;
	cin >> H >> W;

	for( int i = 0; i < H; ++i ) {
		string c;
		cin >> c;

		cout << c << '\n' << c << '\n';
	}
}


Measured memory_bytes: 384
#include <stdio.h>

int main()
{
    int a,b,c,i;
    scanf("%d %d %d",&a,&b,&c);

    for (i = 1; i <= b; i++)
    {
        if((a * i) % b == c)break;
    }
    printf("%s\n",i == b + 1 ? "NO" : "YES");
}

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

#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_CAT_I(x,y) x ## y
//#define CPP_STR(x) CPP_STR_I(x)
//#define CPP_STR_I(args...) #args
//#define ASSERT(expr...) assert((expr))

using i8 = int8_t;
using u8 = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;
using f32 = float;
using f64 = double;
//using f80 = __float80;

constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
constexpr char EL[] = "\n";

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define all(x) (x).begin(),(x).end()
#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))
#define UNIQUE(x) (x).erase(unique(all(x)), (x).end());
#define REPIT(x) for(auto it=(x).begin(), end=(x).end(); it!=end; ++it)
#define perm(c) sort(all(c)); for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<typename T = i64>
T IN() { T x; cin >> x; return (x); }

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }
template<typename T, size_t N>
i64 SIZE(const T(&)[N]) { return static_cast<i64>(N); }

template<typename T, typename U, typename Comp = less<>>
bool chmax(T& xmax, const U& x, Comp comp = {}) {
	if (comp(xmax, x)) {
		xmax = x;
		return true;
	}
	return false;
}
template<typename T, typename U, typename Comp = less<>>
bool chmin(T& xmin, const U& x, Comp comp = {}) {
	if (comp(x, xmin)) {
		xmin = x;
		return true;
	}
	return false;
}

void print() {
  cout << EL;
}
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(tail) != 0) cout << " ";
  print(forward<Tail>(tail)...);
}
template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
	cout << a;
	if (&a != &vec.back()) cout << " ";
  }
  cout << EL;
}
template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
	print(vec);
  }
}

struct ProconInit {
	static constexpr int IOS_PREC = 15;
	static constexpr bool AUTOFLUSH = false;

	ProconInit() {
		cin.tie(nullptr);
		ios::sync_with_stdio(false);
		cout << fixed << setprecision(IOS_PREC);
		if (AUTOFLUSH)
			cout << unitbuf;
	}
} PROCON_INIT;
#pragma endregion

signed solve()
{
	int n, m;
	cin >> n >> m;
	map<int, int> mp_s, mp_g;
	REP(i, m)
	{
		int a, b;
		cin >> a >> b;
		if (a == 1)
			mp_s[b]++;
		if (b == n)
			mp_g[a]++;
	}
	REPIT(mp_s)
	{
		if (mp_g.count((*it).first) > 0)
		{
			print("POSSIBLE");
			return 0;
		}
	}
	print("IMPOSSIBLE");
	return 0;
}

#ifndef LOCALCODE
signed main()
{
	return solve();
}
#endif


Measured memory_bytes: 9600
using System;
using System.Collections.Generic;
using System.Windows;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
    public class Program
    {
        private static long mod = 1000000007;
        private static long max = 999999999999;

        static void Main(string[] args)
        {
            var a = Read().Double();
            var ans = a + Math.Pow(a, 2) + Math.Pow(a, 3);
            WriteRead((long)ans);
        }

        public static string Read()
        {
            return Console.ReadLine();
        }

        public static string[] ReadSplit()
        {
            return Console.ReadLine().Split(' ');
        }

        public static void WriteRead(object str)
        {
            Console.WriteLine(str);
            Read();
        }

        public static void Write(object str)
        {
            Console.WriteLine(str);
        }

        private static bool ChangeMin<T>(ref T a, T b) where T : IComparable
        {
            if (a.CompareTo(b) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }

        private static bool ChangekMax<T>(ref T a, T b) where T : IComparable
        {
            if (b.CompareTo(a) > 0)
            {
                a = b;
                return true;
            }
            return false;
        }
    }
}


public static class Extentions
{
    public static int Int(this object obj)
    {
        return int.Parse(obj.ToString());
    }

    public static long Long(this object obj)
    {
        return long.Parse(obj.ToString());
    }

    public static decimal Decimal(this object obj)
    {
        return decimal.Parse(obj.ToString());
    }

    public static double Double(this object obj)
    {
        return double.Parse(obj.ToString());
    }

    public static T2 GetValueZero<T1, T2>(this Dictionary<T1, T2> d, T1 key) where T2 : struct
    {
        T2 value;
        if (d.TryGetValue(key, out value))
        {
            return value;
        }
        return new T2();
    }
}



Measured memory_bytes: 18196
#include<stdio.h>

int main(){

int a , b , ans;

// 窓の長さ
scanf("%d",&a);  
// カーテン１枚の長さ
scanf("%d",&b);

if (a>2*b){
// 窓の長さ-カーテン２枚の長さ=隠れない部分
    ans=a-2*b;
    printf("%d",ans);
}else{
    printf("0");
}

return 0; 
}

Measured memory_bytes: 128
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<map>
#include<set>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>
#include<sstream>
#include<numeric>
#include<cassert>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define rep(i,s,n) for(int i=(s); i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()
#define IN(x,s,g) ((x) >= (s) && (x) < (g))
#define ISIN(x,y,w,h) (IN((x),0,(w)) && IN((y),0,(h)))
#define print(x) printf("%d\n",x)

using namespace std;

typedef unsigned int uint;
typedef long long ll;

const int _dx[] = {0,1,0,-1};
const int _dy[] = {-1,0,1,0};

int getInt(){
  int ret = 0,c;
  c = getchar();
  while(!isdigit(c)) c = getchar();
  while(isdigit(c)){
    ret *= 10;
    ret += c - '0';
    c = getchar();
  }
  return ret;
}

int c[16];
int x[20000];
int n,m;

int memo[20000][256];

int solve(int now, int prev, int kabe){
  if(now == n) return 0;
  if(memo[now][prev]!=-1) return memo[now][prev];

  int ret = INT_MAX;
  REP(i,m){
    int t = min(255,max(0,prev + c[i]));
    int g = (t - x[now]) * (t - x[now]);
    if(true || kabe - g > 0){
      int s = solve(now+1, t, kabe-g);
      if(s == INT_MAX) continue;
      ret = min(ret, g+s);
      kabe = min(kabe,ret);
    }
  }
  return memo[now][prev] = ret;
}

int main(){
  while(scanf("%d%d",&n,&m), n+m){
    REP(i,m) scanf("%d",c+i);
    REP(i,n) scanf("%d",x+i);
    memset(memo,-1,sizeof(int)*256*n);
    printf("%d\n",solve(0,128,INT_MAX));
  }
  return 0;
}

Measured memory_bytes: 21000
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N,K,d;
    cin >> N >> K;
    int S[N]={0},A;
    for(int i=0; i<K; i++){
        cin >> d;
        for(int j=0; j<d; j++){
            cin >> A;
            S[A-1]=1;
        }
    }
    int ans=0;
    for(int i=0; i<N; i++){
        if(S[i]==0) ans++;
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define inf (ll)(1e18)
#define mod 1000000007

int main()
{
    int t=1;
    //cin>>t;

    while( t-- )
    {
        string s1,s2;
        cin>>s1>>s2;
        bool flag=1;
        for( int i=0 ; i<s1.size() ; i++ )
            if( s1[i]!=s2[i] )
            {
                flag=0;
                break;
            }

        if( flag )
            cout<<"Yes"<<endl;
        else
            cout<<"No"<<endl;
    }
    return 0;
}












Measured memory_bytes: 3568
N = int(input())
L = list(map(int, input().split()))
L = list(reversed(sorted(L)))
#print(L)
ans = 0
for i in range(len(L)):
    for j in range(i + 1, len(L)):
        for k in range(j + 1, len(L)):
            #print(L[i], L[j], L[k])
            if L[i] > L[j] and L[j] > L[k] and L[j] + L[k] > L[i]:
                ans += 1
print(ans)

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

int main(){
    int N,M;
    ll tes;
    vector<ll>::iterator max;
    size_t maxIndex;
    ll ans=0;
    cin >> N >> M;
    priority_queue<ll> A;
    rep(i,N){
        cin >> tes;
        A.push(tes);
    }
    rep(i,M){
        tes = A.top();
        tes /= 2;
        A.pop();
        A.push(tes);
    }
    rep(i,N){
        ans += A.top();
        A.pop();
    }
    cout << ans <<endl; 
    return 0;
}

Measured memory_bytes: 1400
package main

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

func configure(scanner *bufio.Scanner) {
	scanner.Split(bufio.ScanWords)
	scanner.Buffer(make([]byte, 1000005), 1000005)
}
func getNextString(scanner *bufio.Scanner) string {
	scanned := scanner.Scan()
	if !scanned {
		panic("scan failed")
	}
	return scanner.Text()
}
func getNextInt(scanner *bufio.Scanner) int {
	i, _ := strconv.Atoi(getNextString(scanner))
	return i
}
func getNextInt64(scanner *bufio.Scanner) int64 {
	i, _ := strconv.ParseInt(getNextString(scanner), 10, 64)
	return i
}
func getNextFloat64(scanner *bufio.Scanner) float64 {
	i, _ := strconv.ParseFloat(getNextString(scanner), 64)
	return i
}
func main() {
	fp := os.Stdin
	wfp := os.Stdout
	extra := 0
	if os.Getenv("I") == "IronMan" {
		fp, _ = os.Open(os.Getenv("END_GAME"))
		extra = 100
	}
	scanner := bufio.NewScanner(fp)
	configure(scanner)
	writer := bufio.NewWriter(wfp)
	defer func() {
		r := recover()
		if r != nil {
			fmt.Fprintln(writer, r)
		}
		writer.Flush()
	}()
	solve(scanner, writer)
	for i := 0; i < extra; i++ {
		fmt.Fprintln(writer, "-----------------------------------")
		solve(scanner, writer)
	}
}
func solve(scanner *bufio.Scanner, writer *bufio.Writer) {
	for n := getNextInt(scanner); n > 0; n = getNextInt(scanner) {
		tt := make([]team, n)
		for i := 0; i < n; i++ {
			tt[i].id = getNextInt(scanner)
			tt[i].uni = getNextInt(scanner)
			tt[i].ac = getNextInt(scanner)
			tt[i].pn = getNextInt(scanner)
		}
		sort.SliceStable(tt, func(i, j int) bool {
			if tt[i].ac == tt[j].ac {
				if tt[i].pn == tt[j].pn {
					return tt[i].id < tt[j].id
				}
				return tt[i].pn < tt[j].pn
			}
			return tt[i].ac > tt[j].ac
		})
		cc := make([]int, 100005)
		ans := make([]int, 0)
		for i := 0; i < n; i++ {
			if cc[0] < 10 && cc[tt[i].uni] < 3 {
				cc[0]++
				cc[tt[i].uni]++
				ans = append(ans, tt[i].id)
				continue
			}
			if cc[0] < 20 && cc[tt[i].uni] < 2 {
				cc[0]++
				cc[tt[i].uni]++
				ans = append(ans, tt[i].id)
				continue
			}
			if cc[0] < 26 && cc[tt[i].uni] < 1 {
				cc[0]++
				cc[tt[i].uni]++
				ans = append(ans, tt[i].id)
				continue
			}
		}
		for i := 0; i < len(ans); i++ {
			fmt.Fprintln(writer, ans[i])
		}
	}
}

type team struct {
	id, uni, ac, pn int
}



Measured memory_bytes: 1244
#include <iostream>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <map>
#include <queue>

static const int INF = 1000000007;
using ll = long long;
using u32 = unsigned;
using namespace std;
using P = pair<int, int>;

int main() {
    int h, w;
    cin >> h >> w;
    vector<vector<char>> v(h+2, vector<char>(w+2, '.'));
    for (int i = 1; i <= h; ++i) {
        string s;
        cin >> s;
        for (int j = 1; j <= w; ++j) {
            v[i][j]=s[j-1];
        }
    }
    int x = 0, y = 0;
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if(v[i][j] == '#' && x*y == 0) {
                x = i, y = j;
                break;
            }
        }
    }
    int dx[2] = {0, 1}, dy[2] = {1, 0};
    queue<P> Q;
    Q.emplace(x, y);
    while(!Q.empty()){
        P p = Q.front(); Q.pop();
        v[p.first][p.second] = '.';
        for (int i = 0; i < 2; ++i) {
            if(v[p.first+dx[i]][p.second+dy[i]]== '#'){
                Q.emplace(p.first+dx[i], p.second+dy[i]);
                break;
            }
        }
    }
    cout << "\n";
    for (int i = 1; i <= h; ++i) {
        for (int j = 1; j <= w; ++j) {
            if(v[i][j] == '#') {
                cout << "Impossible" << "\n";
                return 0;
            }
        }
    }
    cout << "Possible" << "\n";
    return 0;
}


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

int main(void) {
    int N;
    int Q;
    int M;
    int date;

    int choice;
    int max_count;

    while (1) {
        std::cin >> N >> Q;
        if (N == 0 && Q == 0) {
            break;
        }
        choice = 0;
        max_count = Q;
        std::vector<int> D(100, 0);
        for (int i = 0; i < N; i++) {
            std::cin >> M;
            for (int j = 0; j < M; j++) {
                std::cin >> date;
                D[date]++;
            }
        }

        for (int i = 99; i > 0; i--) {
            if (D[i] >= max_count) {
                choice = i;
                max_count = D[i];
            }
        }

        std::cout << choice << std::endl;
    }

    return 0;
}

Measured memory_bytes: 3036
#include <cstdio>
#include <vector>
#include <queue>
using namespace std;

int main(){
	int m, n, x, y;
	scanf("%d%d", &m, &n);
	vector<vector<int> > G(m + 1);
	vector<int> c(m + 1);
	for(int i = 0; i < n; ++i){
		scanf("%d%d", &x, &y);
		G[x].push_back(y);
		++c[y];
	}
	
	queue<int> q;
	for(int i = 1; i <= m; ++i){
		if(c[i] == 0){ q.push(i); }
	}

	while(!q.empty()){
		printf("%d\n", q.front());
		for(int i = 0; i < G[q.front()].size(); ++i){
			int t = G[q.front()][i];
			if(--c[t] == 0){ q.push(t); }
		}
		q.pop();
	}
}

Measured memory_bytes: 1052
import java.util.*;

class Main{
    public static void main(String args[]){
        Scanner sc=new Scanner(System.in);
        for(int i=0;i<7;i++){
            int a,b;
            a=sc.nextInt();
            b=sc.nextInt();
            System.out.println(a-b);
        }
    }
}


Measured memory_bytes: 26128
using System.Collections.Generic;
using System.Linq;
using System;
 
class p{
  static void Main(){
    int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
    int H = n[0];
    int W = n[1];
    string[] mark = new string[H + 2];
    for (int i = 1; i <= H; i++){
      mark[i] = "." + Console.ReadLine() + ".";
    }
    
    for (int i = 0; i < W + 2; i++){
      mark[0] += ".";
      mark[H + 1] += ".";
    }
    
    bool flag = true;
    for (int i = 1; i <= H; i++){
      for (int j = 1; j <= W; j++){
        if (mark[i][j] == '#'&&mark[i - 1][j] == '.'&&mark[i + 1][j] == '.'&&mark[i][j - 1] == '.'&&mark[i][j + 1] == '.') flag = false;
      }
    }
    
    Console.WriteLine(flag ? "Yes" : "No");
  }
}

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

int H, W;
vector<vector<int>> cells(20, vector<int>(20, -1));

vector<int> dw = {1, 0, -1, 0};
vector<int> dh = {0, 1, 0, -1};

bool inside(int h, int w) {
  if (h >= 0 && h < H && w >= 0 && w < W) return true;
  return false;
}

int calc(int i, int j) {
  vector<vector<int>> d(H, vector<int>(W));
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      d[i][j] = cells[i][j];
    }
  }
  // for (int i = 0; i < d.size(); i++) { cout << d[i][0]; for (int j = 1; j < d[i].size(); j++) { cout << ' ' << d[i][j]; } cout << '\n'; }
  int ans = 0;

  queue<pair<int, int>> q;
  q.push(make_pair(i, j));
  d[i][j] = 0;

  while (!q.empty()) {
    pair<int, int> c = q.front(); q.pop();
    int ch = c.first; int cw = c.second;
    for (int i = 0; i < 4; i++) {
      int nh = ch + dh[i];
      int nw = cw + dw[i];
      if (inside(nh, nw) && d[nh][nw] == -1) {
        d[nh][nw] = d[ch][cw] + 1;
        q.push(make_pair(nh, nw));
        ans = max(ans, d[nh][nw]);
      }
    }
  }
  return ans;
}

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

  cin >> H >> W;
  for (int i = 0; i < H; i++) {
    string s; cin >> s;
    for (int j = 0; j < W; j++) {
      if (s[j] == '#') cells[i][j] = -10;
    }
  }

  int ans = 0;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      if (cells[i][j] == -1) {
        ans = max(ans, calc(i, j));
      }
    }
  }

  cout << ans << '\n';
  return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <bitset>
#include <cstdio>
#include <limits>
#include <vector>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <fstream>
#include <numeric>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <unordered_map>

using namespace std;


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

  long long n, c, k;
  cin >> n;
  vector<long long> s;
  int ans = 0;
  for (long long i = 0; i < n; ++i) {
    long long x;
    cin >> x;
    if (x % 2 != 0) {
      ++ans;
    }
  }
  cout << (ans % 2 == 0 ? "YES" : "NO") << endl;
  return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"
#define rep(i,a,b) for (int i = (a); i < (b); i++)
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> P;
typedef complex<double> com;
const int mod = 1e9 + 7;
const int MOD = 998244353;
const int inf = 2e9;

ll mpow(ll a, ll b) {
	ll res = 1;
	a %= mod;
	while (b) {
		if (b & 1) res = res * a % mod;
		a = a * a % mod;
		b >>= 1;
	}
	return res;
}

string s;
ll res(int now) {
	if (now <= 0) {
		if (now==0&&s[0] == '1') return 3;
		else return 1;
	}
	if (s[now] == '1') return (2LL * res(now - 1) + mpow(3, now)) % mod;
	else return res(now - 1);
}

int main() {
	 cin >> s;
	int ans = 1;
	reverse(s.begin(), s.end());
	printf("%d", res(s.size()-1));
	return 0;
}


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

#define SZ(x) (((int)x.size()))

using namespace std;

const int maxn = 200*1000+10;
int dp[maxn][2];
string s;

int main()
{
	cin >> s;
	dp[1][0] = 1;
	dp[1][1] = -maxn;
	for (int i = 2; i <= SZ(s); i++)
	{
		dp[i][0] = dp[i - 1][1] + 1;
		if (s[i - 1] != s[i - 2])
			dp[i][0] = max(dp[i][0], dp[i - 1][0] + 1);
		dp[i][1] = dp[i - 2][0] + 1;
		if (i == 2 || (i >= 4 && (s[i - 4] != s[i - 2] || s[i - 3] != s[i - 1])))
			dp[i][1] = max(dp[i][1], dp[i - 2][1] + 1);
	}
	cout << max(dp[SZ(s)][0], dp[SZ(s)][1]);
	return 0;
}


Measured memory_bytes: 2180
#include <bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int i=0;i<int(N);++i)
using ll = long long;
const int INF = 2147483647;
const ll MOD = 1e9+7;
// const ll INF = 1000000000000000000LL;

 //使い方
 int main() {
	 ll n;
	 cin >> n;
	 vector<int> a(n);
	 vector<int> ans(n);
	 rep(i,n) cin >> a[i];
	 for(int i=n-1;i>=0;i--){
		 int num = i+1;
		 ans[i] = a[i];
		 if(ans[i]==1){
			for(int j=1;j*j<=num;j++){
					if(num % j ==0){
						int x = j;
						int y = num / j;
						a[x-1] = 1 - a[x-1];
						if(x!=y)
							a[y-1] = 1 - a[y-1];
					}		 
				}
		 }
	 }
	 int cnt = 0;
	 vector<int> ans_vec;
	 rep(i,n){
		 if(ans[i]){
			  cnt++;
				ans_vec.push_back(i+1);
		 }
	 }
	 cout << cnt << endl;
	 if(cnt==0) return 0;
	 rep(i,ans_vec.size()){
		 cout << ans_vec[i] << ' ';
	 }
	 cout << endl;
 }

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

using namespace std;

int main()
{
  int n;
  cin >> n;
  vector<int> ans(26, 1e9);
  for (int i = 0; i < n; i++)
  {
    string s;
    cin >> s;
    vector<int> cnt(26, 0);
    for (int j = 0; j < s.size(); j++)
      cnt[s[j] - 'a']++;
    for (int j = 0; j < 26; j++)
      ans[j] = min(ans[j], cnt[j]);
  }
  for (int i = 0; i < 26; i++)
    for (int j = 0; j < ans[i]; j++)
      cout << (char)('a' + i);
  cout << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<iomanip>
#include<cmath>
#include<vector>
#include<algorithm>

using namespace std;

#define int long long
#define endl "\n"

const long long INF = (long long)1e18;
const long long MOD = 1'000'000'007; 

string yn(bool f){return f?"Yes":"No";}
string YN(bool f){return f?"YES":"NO";}



signed main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	int x = 0, y = 0;
	string s;
	int n;
	
	cin>>n;
	
	cin>>s;
	
	for(int i = 0; i < s.size(); i++){
		if('a' <= s[i] && s[i] <= 'm'){
			x++;
		}
		if('m' < s[i] && s[i] <= 'z'){
			x--;
		}
		if('A' <= s[i] && s[i] <= 'M'){
			y++;
		}
		if('M' < s[i] && s[i] <= 'Z'){
			y--;
		}
	}
	
	cout<<(int)(abs(x) + abs(y))<<endl;
	
//	cout<<x<<" "<<y<<endl;
	if(x < 0){
		x = abs(x);
		
		for(int i = 0; i < x; i++){
			cout<<"z";
		}
	} else {
		for(int i = 0; i < x; i++){
			cout<<"a";
		}
	}
	
	
	if(y < 0){
		y = abs(y);
		
		for(int i = 0; i < y; i++){
			cout<<"Z";
		}
	} else {
		for(int i = 0; i < y; i++){
			cout<<"A";
		}
	}
	
	cout<<endl;
	
	return 0;
}


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

using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;

ll GCD(ll x, ll y){
	return y ? GCD(y, x%y) : x;	
}

int main() {
	int r; cin >> r;
	double ans = double(2*r*M_PI);
	printf("%.3f\n", ans);
	return 0;
}

Measured memory_bytes: 3700
/*
　　こんにちは。あたしはｶｳｶﾞｰﾙ。
　　RedcoderになるためAtCoderを巡る旅をしてます。

　　　 　＿_
　　　 ヽ|＿_|ノ　　　　ﾓｫ
　　　　||‘‐‘||ﾚ　　_)_, ―‐ 、
　　　　/(Ｙ (ヽ＿ /・ ヽ　　   ￣ヽ
　　　　∠ ＿ ゝ　 ｀^ヽ ﾉ.::::_(ノヽ
　　　　 _/ヽ　 　　  /ヽ￣￣￣/ヽ
*/

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define dump(x) cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO") << endl
#define Yes(n) cout << ((n) ? "Yes" : "No") << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE") << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible") << endl

#define rep(i, n) REP(i, 0, n)                  // 0, 1, ..., n-1
#define REP(i, x, n) for(int i = x; i < n; i++) // x, x + 1, ..., n-1
#define FOREACH(x, a) for(auto &(x) : (a))

#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()

#define COUT(x) cout << (x) << endl

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

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

    int A, B;
    cin >> A >> B;
    COUT(6 - A - B);
}


Measured memory_bytes: 256
ma = lambda :map(int,input().split())
ni = lambda:int(input())
import collections
import math
import itertools
gcd = math.gcd
h,w,k = ma()
area = []
for i in range(h):
    s = input()
    area.append(s)
ans = 0
for i in range(2**h):
    for j in range(2**w):
        cnt = 0
        for y in range(h):
            for x in range(w):
                if (i>>y &1) or (j>>x &1):
                    pass
                else:
                    if area[y][x] =="#":
                        cnt+=1
        if cnt==k:ans+=1
print(ans)


Measured memory_bytes: 9464
#!python3.4
# -*- coding: utf-8 -*-
# hitachi2020/hitachi2020_a
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    S = i2s()
    if S.replace('hi', '') == '':
        print('Yes')
    else:
        print('No')
    return

main()


Measured memory_bytes: 3064
#ifdef DEBUG

#else

#    pragma GCC optimize("O3,no-stack-protector")
#    pragma GCC optimize("unroll-loops")

#    if __cplusplus >= 201703L
#        pragma GCC target("avx2")
#    else
#        pragma GCC target("avx")
#    endif

#endif
// 実数の場合
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define dump(x) cout << x << endl
typedef int64_t Int;

using namespace std;
using Graph = vector<vector<Int>>;

const double pi = M_PI;
const Int MOD = 1000000007;

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

    Int n, m;
    cin >> n;
    string in;
    map<string, Int> s;
    for (Int i = 0; i < n; i++) {
        cin >> in;
        if (!s.insert({in, 1}).second) {
            s[in]++;
        }
    }
    map<string, Int> t;
    cin >> m;
    for (Int i = 0; i < m; i++) {
        cin >> in;
        if (!t.insert({in, 1}).second) {
            t[in]++;
        }
    }

    Int ans = 0;
    for (auto e : s) {
        if (t.count(e.first) == 0) {
            ans = max(ans, e.second);
        } else {
            ans = max(ans, e.second - t[e.first]);
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 384
import copy
h, w, k = list(map(int, input().split()))
c = [list(input()) for _ in range(h)]

c_ = copy.deepcopy(c)
ans = 0
for a in range(2 ** h):
  for b in range(2 ** w):
    for i in range(h):
      if (a >> i) & 1 != 0:
        for j in range(w):
          c[i][j] = '*'
    for j in range(w):
      if (b >> j) & 1 != 0:
        for i in range(h):
          c[i][j] = '*'

    # print(c)
    cnt = 0
    for l in c:
      cnt += l.count('#')
    if cnt == k:
      ans += 1

    c = copy.deepcopy(c_)

print(ans)


Measured memory_bytes: 9340
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
long long K, T;
int a[10001];
int main() {
	cin >> K >> T;
	int maxV = 0, sum = 0;
	for (int i = 0; i < T; ++i) {
		cin >> a[i];
		maxV = max(a[i], maxV);
		sum += a[i];
	}
	sum -= maxV;
	if (maxV - 1 <= sum) cout << 0 << endl;
	else cout << 2 * maxV - K - 1 << endl;

	return 0;
}


Measured memory_bytes: 256