akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;

namespace cs
{
    public class Program
    {
        public static void Main(string[] args)
        {
            
            var N = int.Parse(Console.ReadLine());
            var input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int Cnt = 0;


            for(int i = 1; i < N-1; i++){
                if(input[i-1] <= input[i] && input[i] < input[i+1]) Cnt++;
                else if(input[i - 1] > input[i] && input[i] >= input[i+1]) Cnt++;


            }
            
            Console.WriteLine(Cnt);
            
/*
            Console.WriteLine();
            Console.WriteLine("続行するにはアレ");*/
            //Console.ReadKey();
           
        }

        public static long GCD(long n, long m){
            
            if(m % n == 0) return n;
            else return GCD(m%n, n);

        }

        public static long LCD(long n, long m){

            return m * n / GCD(n,m);
        }
    }
}


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

signed main(){
  int A,B,C,X,Y;
  cin >> A >> B >> C >> X >> Y;
  int D;
  if(max(X,Y)==X){
    D=A*(X-Y);
  }
  else{
    D=B*(Y-X);
  }
  if(A*X+B*Y<C*max(X,Y)*2&&A*X+B*Y<C*min(X,Y)*2+D){
    cout << A*X+B*Y << endl;
  }
  else{
    if(2*C*max(X,Y)>2*C*min(X,Y)+D){
      cout << 2*C*min(X,Y)+D << endl;
    }
    else{
      cout << 2*C*max(X,Y) << endl;
    }
  }
}


Measured memory_bytes: 3560
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'

vector<string> V;
string cad, ans;

int main(){
	ios_base::sync_with_stdio(0);cin.tie(NULL);
	int n,l,i,j;
	cin>>n>>l;
	for(i=0; i<n; i++){
		cin>>cad;
		V.push_back(cad);
	}
	sort(V.begin(), V.end());
	ans = "";
	for(i=0; i<n; i++){
		for(j=0; j<V[i].size(); j++){
			ans.push_back(V[i][j]);
		}
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
dic = {}
for i in range(N):
    a = list(map(int,input().split()))
    a = a[1:]
    for j in a:
        if(j in dic):
            dic[j] += 1
        else:
            dic[j] = 1
ans = 0
for key,value in dic.items():
    if(value == N):
        ans += 1
print(ans)

Measured memory_bytes: 38384
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
int main() {
	string S; cin >> S;
	int max = S.size() / 2;
	if (S.size() % 2 != 0) max++;
	int ans = 0;
	for (int i = 0; i < max; i++) {
		if (S.at(i) != S.at(S.size() - i - 1)) ans++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
fun main(){
    val s = readLine()!!.split(" ")[0].toCharArray()
    val t = readLine()!!.split(" ")[0].toCharArray()
    var ans = 0
    for (i in 0 until s.size){
        if (s[i] != t[i]){
            ans++
        }
    }
    println(ans)
}


Measured memory_bytes: 43480
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
#define INF (1<<30)
#define LINF (1ll<<60ll)
#define MOD 1000000007
#define pb(a) push_back(a)
#define _overload4(_1,_2,_3,_4,name,...) name
#define _rep(i,n) _repi(i,0,n)
#define _repi(i,a,b) for(int i=a, i##_len=(b); i<i##_len; ++i)
#define _repis(i,a,b,s) for(int i=a, i##_len(b); i<i##_len; i+=s)
#define REP(...) _overload4(__VA_ARGS__,_repis,_repi,_rep,)(__VA_ARGS__)
#define REPR(i, n) for(int i = n;i >= 0;--i)
#define REPARR(i, v) for(int i = 0;i < sz(v);++i)
#define all(vec) (vec.begin()),(vec.end())
#define sz(x) ((int)(x).size())
#define bit(n) (1ll<<(n))
#define d(a) cerr<<#a<<":"<<a<<endl
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(a>b){a=b;return true;}return false;}
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define yes(n) cout<<((n)?"yes":"no")<<endl
#define poss(n) cout<<((n)?"possible":"impossible")<<endl
#define Poss(n) cout<<((n)?"Possible":"Impossible")<<endl
#define POSS(n) cout<<((n)?"POSSIBLE":"IMPOSSIBLE")<<endl


int main(){
    int x,y;
    cin>>x>>y;
    cout<<x+y/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define llint long long 
#define inf 1e18

using namespace std;

llint n;
llint a[16][16];
llint s[1<<16];
llint dp[1<<16];

int main(void)
{
	cin >> n;
	for(int i = 0; i < n; i++){
		for(int j = 0; j < n; j++){
			cin >> a[i][j];
		}
	}
	
	llint S = 1<<n;
	for(int i = 0; i < S; i++){
		for(int j = 0; j < n; j++){
			for(int k = 0; k < n; k++){
				if( (i&(1<<j)) && (i&(1<<k)) ) s[i] += a[j][k];
			}
		}
		s[i] /= 2;
	}
	
	for(int i = 0; i < S; i++) dp[i] = s[i];
	for(int i = 0; i < S; i++){
		for(int j = i; ; j = ((j-1)&i)){
			dp[i] = max(dp[i], dp[j]+dp[i&~j]);
			if(j == 0) break;
		}
	}
	
	cout << dp[S-1] << endl;
	return 0;
}

Measured memory_bytes: 1280
N = int(input())
B = [int(s) for s in input().split()]

total = 0

for i in range(N):
  if i == 0:
    total += B[i]
  elif i <= N-1-1:
    total += min(B[i-1], B[i])
  else:
    total += B[i-1]
print(total)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr int INF = 0x3f3f3f3f;
constexpr ll INFL = 0x3f3f3f3f3f3f3f3f;
constexpr double PI = 3.141592653589793238462643383279;
ll getDigit(ll x) {
  return x == 0 ? 1 : log10(x) + 1;
}

signed main() {
  string S;
  cin >> S;
  S = S + 'R';
  ll countR = 0;
  ll countL = 0;
  char before = '-';
  rep(i, S.size()) {
    char s = S[i];
    if (s == 'R') {
      countR++;
    }
    if (s == 'L') {
      countL++;
    }
    if (s == 'R' && before == 'L') {
      // debug(i);
      // debug(countR);
      // debug(countL);
      countR--;
      ll migi = countR / 2 + countL / 2 + countL % 2;
      ll hidari = countR / 2 + countL / 2 + countR % 2;

      rep(a, countR) {
        if (a == countR - 1) {
          cout << hidari << " ";
        } else {
          cout << 0 << " ";
        }
      }
      rep(b, countL) {
        if (b == 0) {
          cout << migi << " ";
        } else {
          cout << 0 << " ";
        }
      }
      countR = 1;
      countL = 0;
    }
    before = s;
  }
  ENDL;
  return 0;
}

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


public class Test
{	
    public static void Main()
	{   
	    int[] nums = new int[4]; 
	    for(int i = 0 ; i <4 ; i++) nums[i] = int.Parse(Console.ReadLine()); 
        Console.WriteLine(Math.Min(nums[0],nums[1]) + Math.Min(nums[2],nums[3]) );
	}
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
using P = pair <int, int>;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
const long long INF = 1LL << 60;
const int mod = 1000000007;

int main() {
    int a,b,c;
    cin >> a>>b>>c;
    int ans = 0;
    rep(i,31){
        if(a%2==1||b%2==1||c%2==1){
            cout << ans << endl;
            return 0; 
        }
        int A = a;
        int B = b;
        int C = c;
        a = (B+C)/2;
        b = (A+C)/2;
        c = (B+C)/2;
        ans++;
    }
    cout << -1 <<endl;
}

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

using namespace std;


bool samenum(int a,int b,int c)
{
return a==b && b==c ;
}


bool renban(int a,int b,int c){
return a+2==b+1 && b+1==c; 
}
bool ok(int a,int b,int c){
	return samenum(a,b,c)|| renban(a,b,c);
}
bool clear(int a1,int a2,int a3,int a4,int a5,int a6,int a7,int a8,int a9){
return ok(a1,a2,a3)&&ok(a4,a5,a6)&&ok(a7,a8,a9);
}



int main() {
int n,num[9];
string col;
cin>>n;

for (int kk=0;kk<n;kk++){
	for(int k=0;k<9;k++){
		cin>>num[k];
	}
	for(int k=0;k<9;k++){
		cin>>col;
		if(col=="R"){
			num[k]=num[k]+10;
		}
		if(col=="G"){
		num[k]=num[k]+20;	
		}
		if(col=="B"){
			num[k]=num[k]+30;
		}
	}
	int j=0;
	sort (num,num+9);
	do{
		if(clear(num[0],num[1],num[2],num[3],num[4],num[5],num[6],num[7],num[8])) j=1;
	}while(next_permutation(num,num+9));
	cout<<j<<endl;
}
	return 0;
}

Measured memory_bytes: 1224
//LiningUp.cpp (C)
#include <iostream>
#include <string>
using namespace std;

int main(){
  int N;
  cin >> N;
  int A[N];
  int num[110000] = {0};
  for(int i = 0; i < N; i++) cin >> A[i], ++num[A[i]];
  bool flag = true;
  if(N%2==0){
    for(int i = 1; i < N; i+=2){
      if(num[i]!=2){
        flag = false;
        break;
      }
    }
  }else{
    for(int i = 2; i < N; i+=2){
      if(num[i]!=2){
        flag = false;
        break;
      }
    }
    if(num[0]!=1) flag = false;
  }
  long long Ans = 1;
  if(flag){
    for(int i = 1; i <= N/2; i++){
      Ans *= 2;
      if(Ans >= 1000000007) Ans %= 1000000007;
    }
    printf("%lld\n",Ans);
  }
  else printf("0\n");
  return 0;

}


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

int main() {
    int K, A , B;
    cin >> K >> A >> B;
    int i=0;
    while (true){
        int X = i*K;
        if(X>=A){
            if(X <= B){
                cout << "OK" << endl;
            }
            if(X > B){
                cout << "NG" << endl;
            }
            break;

        }
        i++;

    }
}

Measured memory_bytes: 3592
#include<stdio.h>
#include<string.h>

int main(){
	char a[100000];
	int res=0;
	scanf("%s",a);
	for(int i=0;i<strlen(a)-1;i++){
		if(a[i]!=a[i+1]){
			res++;
		}
	}
	printf("%d",res);
}

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

// vector<p> cut(M);
// cut[i].second
// cut[i].first;
// REP(i,M){
//     int a,b;cin>>a>>b;
//     cut[i] = make_pair(b,a);//last first の順番
// }
// for(int i=0; i<N;i++){
// }
// sort(cut.begin(),cut.end()); //sort
// char '' str ""
int main(void)
{
    str a,b,c; cin>>a>>b>>c;

    if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
      cout<<"YES"<<endl;
      return 0;
    }

    cout<<"NO"<<endl;
    return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-       
import math
def is_prime(x):
    if(x%2==0):return 0
    else:
        a = 3
        while(a<=math.sqrt(x)):
            if(x%a==0):return 0
            a += 2
    return 1
 
q = int(input())
MAX = 10**5+2
prime = [0 for i in range(MAX)]
alike = [0 for i in range(MAX)]
num = [0 for i in range(MAX)]
prime[2],prime[3] = 1,1
for i in range(4,MAX):
    prime[i] = is_prime(i)
for i in range(1,MAX-1,2):
    if(prime[i]==1 and prime[(i+1)//2]==1):
        alike[i] = 1
    num[i] = num[i-2]+alike[i]
    num[i+1] = num[i]
for i in range(q):
    l, r = list(map(int,input().split()))
    print(num[r]-num[l-1])

Measured memory_bytes: 6936
using System;
using System.Collections.Generic;
using System.Linq;
class Program{
static void Main(string[] args){
  var NY = Console.ReadLine().Split().Select(x => int.Parse(x)).ToList();
  int N=NY[0];
  int Y=NY[1]/1000;
  int[] ans=new int[]{-1,-1,-1};
  for(int i=0;i<N+1;i++){
  	for(int j=0;j<N-i+1;j++){
      for(int k=0;k<N-i-j+1;k++){
        if(i+j+k==N){
      		if(i*10+j*5+k*1==Y){
          ans=new int[]{i,j,k};
            }
        }
      }
    }
  }
  Console.WriteLine("{0} {1} {2}",ans[0],ans[1],ans[2]);
}
}


Measured memory_bytes: 13268
import java.util.Scanner;

public class Main {
    public static void debug(String str) {
        System.out.println(str);
    }

    public static void main(String[] args) {

        String S;

        try (Scanner sc = new Scanner(System.in)) {
            S = sc.next();
        }
        String result = "";
        
        if("Sunny".equals(S)){
            result = "Cloudy";
        }else if("Cloudy".equals(S)){
            result = "Rainy";
        }else{
            result = "Sunny";
        }


        System.out.println(result);
    }


}


Measured memory_bytes: 21204
#include <iostream>
#include <cstdio>
#include <vector>
#include <deque>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <string>

using namespace std;

int main(){
    int H,M;
    int K;

    scanf("%d %d %d",&H,&M,&K);

    for(int i=0;i<=H;i++){
        for(int j=0;j<=M;j++){
            if(i*M+j*H-2*i*j==K){
                printf("Yes\n");
                return 0;
            }
        }
    }

    printf("No\n");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  int N;
  cin >> N;
  vector<int> a(N);
  rep(i, N)
  {
    cin >> a[i];
  }
  int ans = 0;
  rep(i, N)
  {
    if (i % 2 == 0 && a[i] % 2 == 1)
      ans++;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    cin>>n;
    int flag=0;
    while(n>0){
        if(n%10==7){
            flag=1;
            break;
        }n/=10;
    }if(flag==1){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
	return 0;
}

Measured memory_bytes: 3636
S = input()
def f():
    if S[:1] != 'A':
        return False
    t = S[2:-1]
    if t.count('C') != 1:
        return False
    i = t.find('C')
    u = S[1:2+i] + S[2+i+1:]
    if u.lower() != u:
        return False
    return True
    
print("AC" if f() else "WA")

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d%d%d",&a,&b,&c);
	if(a+b==c||a+c==b||b+c==a)
	    printf("Yes\n");
	else
	    printf("No\n");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string> 
#include <vector> 
#include <algorithm> 
#include <utility> 
#include <tuple> 
#include <cstdint> 
#include <cstdio> 
#include <map> 
#include <queue> 
#include <set> 
#include <stack> 
#include <deque> 
#include <unordered_map> 
#include <unordered_set> 
#include <bitset> 
#include <cctype> 
#include<math.h>
using namespace std;

#define int long long
#define endl "\n"
#define fir first
#define sec second
#define fro front
#define m_p make_pair
#define mod 1000000007
#define rep(i,n)  for(int i=0; i<(int) (n); i++)
#define all(v)  v.begin(),v.end()
#define vecin(v) for(int i=0; i<(int)v.size(); i++)cin>>v[i];
using namespace std;

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
int jousu(int x00, int y00) {
	int z00 = 1;
	for (int i = 0; i < y00; i++) {
		z00 *= x00;
	}
	return z00;
}
int keta(int x00) {
	int z00 = x00;
	int w00 = 0;
	while (z00 != 0) {
		z00 /= 10;
		w00++;
	}
	return w00;
}

int modinv(int a, int m) {
	int b = m, u = 1, v = 0;
	while (b) {
		int t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
int modpow(int a, int n) {
	int res = 1;
	while (n > 0) {
		if (n & 1) res* a% mod;
		a = a * a % mod;
		n >>= 1;
	}
	return res;
}
int gcd(int xx, int yy) {
	int p = xx;
	int q = yy;
	if (q > p)swap(p, q);
	while (p % q != 0) {
		p %= q;
		swap(p, q);
	}
	return q;
}
int lcm(int xx, int yy) {
	return xx * yy / gcd(xx, yy);
}
bool prime(int xx) {
	int a = xx;
	for (int i = 2; i * i <= xx; i++) {
		if (xx % i == 0) {
			return 0;
		}
	}
	return 1;
}
int com(int xx, int yy) {
	int zz = 1;
	for (int i = xx; i > xx - yy; i--) {
		zz *= i;
		zz %= mod;
	}
	for (int i = 1; i <= yy; i++) {
		zz *= modinv(i, mod);
		zz %= mod;
	}
	return zz;
}



signed main() {
	int n, t = 0, a = 0, b = 0, c = 0;
	string s;
	cin >> n;
	rep(i, n) {
		cin >> s;
		rep(j, s.size()-1) {
			if (s[j] == 'A' && s[j + 1] == 'B') {
				t++;
			}
		}
		if (s[0] == 'B' && s[s.size()-1] == 'A') {
			c++;
			continue;
		}
		if (s[0] == 'B') {
			b++;
		}
		if (s[s.size() - 1] == 'A') {
			a++;
		}
	}
	if (c > 0) {
		if (a + b == 0) {
			cout << t + c - 1 << endl;
			return 0;
		}
		if (a == 0 || b == 0) {
			cout << t + c << endl;
			return 0;
		}
		if (a > 0 && b > 0) {
			cout << t + c + min(a, b) << endl;
		}
	}
	else {
		cout << t + min(a, b) << endl;
	}
}



Measured memory_bytes: 384
#include <iostream>

using namespace std;

int insertion_sort(int *seq, int length, int g) {
  int temp, count = 0;
  int v, j;
  for (int i = g; i < length; i ++) {
    v = seq[i];
    j = i - g;
    while (j >= 0 && seq[j] > v) {
      seq[j + g] = seq[j];
      j = j - g;
      count ++;
    }
    seq[j + g] = v;
  }
  return count;
}

int shellSort(int *A, int n) {
  int cnt = 0, m;
  int i = 1;
  int G[1000000];

  for (int i = 1, j = 0; i < n; j++, i *= 2) {
    G[j] = i;
    m = j;
  }

  cout << m + 1 << endl;
  for (int i = m; i >= 0; i --) {
    cnt += insertion_sort(A, n, G[i]);
    cout << G[i] << " ";
  }
  cout << endl;
  return cnt;

}


int main(){
  int N, count;
  int seq[1000000];
  cin >> N;
  for (int i = 0; i < N; i ++)
    cin >> seq[i];

  count = shellSort(seq, N);
  cout << count << endl;
  for (int k = 0; k < N; k ++)
    cout << seq[k] << endl;
}



Measured memory_bytes: 6916
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scan(&s)
	// dreamerase dreameraser のケースが困る
	// その他考えうる並び
	// eraseerase,eraseeraser,erasedream,erasedreamer
	// erasererase,erasereraser,eraserdream,eraserdreamer
	// dreamdream,dreamdreamer
	// dreamerdream,dreamerdreamer,dreamererase,dreamereraser
	// dreameraserを先にチェック、その次にdreameraseをチェック
	// 消すのではなく、一旦関係ない文字に置換して別の文字列を形成しないようにする
	s = strings.Replace(s, "dreameraser", "X", -1)
	s = strings.Replace(s, "dreamerase", "X", -1)
	s = strings.Replace(s, "dreamer", "X", -1)
	s = strings.Replace(s, "eraser", "X", -1)
	s = strings.Replace(s, "dream", "X", -1)
	s = strings.Replace(s, "erase", "X", -1)
	s = strings.Replace(s, "X", "", -1)
	// fmt.Println(s)
	switch s {
	case "":
		fmt.Println("YES")
	default:
		fmt.Println("NO")
	}
}


Measured memory_bytes: 1920
#include<math.h>
#include <bits/stdc++.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ll long long int
#define py printf("Yes\n")
#define pn printf("No\n")
#define in cin>>
using namespace std;
const int INF = 1001001001;

int main()
{
    int n;
    bool gflag=false;
    bool wflag=false;
    bool yflag=false;
    bool pflag=false;

    in n;
    vector<char> s(n);
    rep(i,n)in s[i];
    rep(i,n)
    {
        if(s[i]=='G')gflag=true;
        if(s[i]=='W')wflag=true;
        if(s[i]=='Y')yflag=true;
        if(s[i]=='P')pflag=true;
    }
    if(gflag&&wflag&&yflag&&pflag)cout<<"Four"<<endl;
    else cout<<"Three"<<endl;

}


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

int main() {
	int a, b;
	cin >> a >> b;
	int ans = 0;
	
	for (int i = 0; i < 2; i++) {
		if (a <=  b) {
			ans = ans + b;
			b--;
		}
		else if (b<a){
		
			ans = ans + a;
			a--;
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
/*
ID: juryc
PROG: AC OR WA
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,m; cin>>n>>m; 
if(n==m) cout<<"Yes"<<"\n"; 
else cout<<"No"<<"\n"; 
return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <vector>
#include <chrono>
#include <random>

std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count());

const int ms = 200200;

long long ans = 0;

int n;
int a[ms], b[ms];

void dfs(int on) {
	int v[3];
	for(int i = -1; i <= 1; i++) {
		v[i+1] = b[(on+i+n)%n];
	}
	int use = v[1] / (v[0] + v[2]);
	use = std::min(use, (v[1] - a[on]) / (v[0] + v[2]));
	if(use == 0) {
		return;
	}
	ans += use;
	b[on] -= use * (v[0] + v[2]);
	dfs((on-1+n)%n);
	dfs((on+1+n)%n);
}

int main() {
	// A = oldA + B + C
	// oldA = A - B - C
	std::ios_base::sync_with_stdio(false); std::cin.tie(NULL);
	std::cin >> n;
	for(int i = 0; i < n; i++) {
		std::cin >> a[i];
	}
	for(int i = 0; i < n; i++) {
		std::cin >> b[i];
	}
	for(int rep = 0; rep < 50; rep++) {
		for(int i = 0; i < n; i++) {
			dfs(i);
		}
	}
	for(int i = 0; i < n; i++) {
		if(a[i] != b[i]) {
			ans = -1;
		}
	}
	std::cout << ans << '\n';
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define fi first
#define se second
using namespace std;
const ll INF = 1LL<<60;
const int inf = 1<<30;
inline void fastio() {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}

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


Measured memory_bytes: 3612
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <bits/stdc++.h>
#include<queue>
#include <numeric>
#include<stdio.h>
using namespace std;
 
//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}
 template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
 
//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define fore(i,a) for(auto &i:a)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);
 
//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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

LL lcm(LL a, LL b){
    LL g = gcd(a,b);
    return a/g *b;
}

int main(){
    int A,B;
    cin >> A >>B;
    int pos=0;
    int num_max=max(A,B);
    int num_min=min(A,B);
    int ans=0;
    while(pos<=1){
        ans+=num_max;
        num_max-=1;
        num_max=max(num_max,num_min);
        ++pos;
    }
    cout << ans;
    }

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_4_C
 * 
 * @author chrone
 * 
 */
public class Main {
    public static void main(String[] args) {
        try {
            BufferedReader stdReader = new BufferedReader(
                    new InputStreamReader(System.in));
            
            String sStr;
            while ((sStr = stdReader.readLine()) != null) {
                String[] inputs = sStr.split(" ");
                
                int a = Integer.valueOf(inputs[0]);
                String op = inputs[1];
                int b = Integer.valueOf(inputs[2]);
                
                if (op.equals("?")) {
                    break;
                    // nothing to do.
                }
                
                switch (op) {
                    case "+":
                        System.out.println(a + b);
                        break;
                    case "-":
                        System.out.println(a - b);
                        break;
                    case "*":
                        System.out.println(a * b);
                        break;
                    case "/":
                        System.out.println((int)(a / b));
                        break;
                }
            }
            stdReader.close();
        } catch (Exception e) {
            System.exit(-1);
        }
    }
}

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

#define  pf                  printf
#define  sc                  scanf
#define  PI                  2*acos(0.0)
#define  fast                ios_base::sync_with_stdio(false);cin.tie(0); cout.tie(0)
#define  mem(a,b)            memset(a, b, sizeof(a) )
#define  gcd(a,b)            __gcd(a,b)
#define  lcm(a,b)            (a*(b/gcd(a,b)))
#define  MAX                 1234567899
#define  mod                 1000000007
#define  all(v)              (v).begin(),(v).end()
#define  vSort(v)            sort(all(v))
#define  maxSort(v)          sort(all(v),greater<int>())
#define  Unique(v)           v.erase(unique(all(v)),v.end())
#define  sqr(x)              ((x)*(x))
#define  qube(x)             ((x)*(x)*(x))
#define  deci(n)             cout<<fixed<<setprecision(n)
#define  sci(n)              sc("%d",&(n))
#define  scii(x,y)           sc("%d %d",&(x),&(y))
#define  scl(x)              sc("%lld",&(x))
#define  scll(x,y)           sc("%lld %lld",&(x),&(y))
#define  vi                  vector<int>
#define  hi                  pf(" HI \n")
#define  pp                  pair<int,int>
#define  pb(x)               push_back(x)
#define  mp(x,y)             make_pair(x,y)
#define  F                   first
#define  S                   second
#define  check(n,pos)        (n & (1<<(pos)))
#define  biton(n,pos)        (n  (1<<(pos)))
#define  bitoff(n,pos)       (n & ~(1<<(pos)))
typedef  long long int       lli;
typedef  unsigned long long int ulli;
int dx4[] = { 0, 0, -1, 1 } ;
int dy4[] = { -1, 1, 0, 0 } ;
bool valid( int r, int c, int x, int y )
{
    if( x >= 1 && x <= r && y >= 1 && y <= c ) return 1 ;
    return 0 ;
}

using namespace std;
lli arr[102][100005];
lli c;
lli result;
lli v[1000+2];
lli w[1000+2];
lli KP(lli n, lli c)
{
    if(arr[n][c]!=0)
        return arr[n][c];

    if(n==0 || c==0)
        return 0;
    else if(w[n]>c){
        result= KP(n-1,c);}
    else
    {
        lli temp1= KP(n-1,c);
        lli temp2= v[n]+ KP(n-1,c-w[n]);
        result= max(temp1,temp2);
    }
    arr[n][c]=result;
    return result;
}
int main ()
{
    lli n;

    cin >> n >> c;
    for(int i=1; i<=n; i++)
        cin >> w[i]>> v[i];
//    for(int i=1; i<=n; i++)
//        cin >> w[i];
  //  cin >> c;
    lli ans= KP(n,c);
    cout << ans <<endl;

    return 0;
}



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

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    int64_t n;
    string s;
    cin >> n >> s;
    // 全列挙だと、4000^3~10^10でオーバーしてしまう
    // 1週目でRGBの数え上げをする→　自分以外の少ないほうが答えになる
    // 2週目で条件2に合致するものを除外していく
    // (R, G, B)っていう構造
    vector<tuple<int64_t, int64_t, int64_t>> tv(n+1);
    tv.at(n) = make_tuple(0,0,0);
    for(int64_t i=n-1; i>=0; i--){
        if(s.at(i) == 'R'){
            get<0>(tv.at(i+1))++;
        }else if(s.at(i) == 'G'){
            get<1>(tv.at(i+1))++;
        }else{
            get<2>(tv.at(i+1))++;
        }
        tv.at(i) = tv.at(i+1);
    }
    int64_t res = 0;
    rep(i,n-1){
        int64_t rc = get<0>(tv.at(i+1));
        int64_t gc = get<1>(tv.at(i+1));
        int64_t bc = get<2>(tv.at(i+1));
        if(s.at(i) == 'R'){
            res += gc * bc;
        }else if(s.at(i) == 'G'){
            res += rc * bc;
        }else{
            res += rc * gc;
        }
        // cout << rc << "  " << gc << "  " << bc << endl;
        // cout << res << endl;
    }
    // 3つが等間隔の場合を除去 → 計算量が少ないので全探索可能
    for(int64_t i=0; i<n-1; i++){
        for(int64_t j=i+1; j<n; j++){
            if(s.at(i) != s.at(j)){
                int64_t k = 2*j - i;
                // cout << s.at(k) << endl;
                // cout << "i:" << i << ", j:" << j << ", k:" << k << endl;
                if(k>=n) break;
                if(s.at(k)!=s.at(i) && s.at(k)!=s.at(j)){
                    res--;
                }
            }
        }
    }
    cout << res << endl;
}

Measured memory_bytes: 3688
#include<cstdio>
#include<complex>
#include<cmath>

#define Re real()
#define Im imag()
#define Eps 1e-9
using namespace std;

typedef complex<double> Point;
typedef complex<double> Vector;

double dot(Point a,Point b)
{
    return (conj(a)*b).Re;
}

double cross(Point a,Point b)
{
    return (conj(a)*b).Im;
}

bool isParallel(Point a1,Point a2,Point b1,Point b2)
{
    return fabs(cross(a2-a1, b2-b1)) < Eps;
}

bool isOrthogonal(Point a1,Point a2,Point b1,Point b2)
{
    return fabs(dot(a2-a1, b2-b1)) < Eps;
}

int main()
{
    int vol;
    double x1,x2,y1,y2,m1,m2,n1,n2;
    scanf("%d",&vol);
    while(vol--)
    {
        scanf("%lf%lf%lf%lf%lf%lf%lf%lf",&x1,&y1,&x2,&y2,&m1,&n1,&m2,&n2);
        Point p1(x1,y1),p2(x2,y2),q1(m1,n1),q2(m2,n2);
        if(isParallel(p1,p2,q1,q2)) printf("2\n");
        else if(isOrthogonal(p1,p2,q1,q2)) printf("1\n");
        else printf("0\n");
    }
    return 0;
}

Measured memory_bytes: 1052
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int i = n;
        long factrial = 1;
        while(i > 0){
            factrial *= i;
            i--;
        }
        System.out.println(factrial);
    }
}


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

ll pow(ll x,ll y){
  if(y==0){
    return 1;
  }else if(y==1){
    return x%MOD;
  }else if(y%2==0){
    return pow(x,y/2)*pow(x,y/2)%MOD;
  }else{
    return x*pow(x,y-1)%MOD;
  }
}

int main(){
  ll N,A,B;cin >> N >> A >> B;
  ll X = 1;
  ll Y = 1;
  for(ll i=N;i>=N-A+1;i--){
    X = X * i % MOD;
  }
  for(ll i=1;i<=A;i++){
    Y = Y * i % MOD;
  }
  ll NA = X * pow(Y,MOD-2)%MOD;
  X = 1;
  Y = 1;
  for(ll i=N;i>=N-B+1;i--){
    X = X * i % MOD;
  }
  for(ll i=1;i<=B;i++){
    Y = Y * i % MOD;
  }
  ll NB = X * pow(Y,MOD-2)%MOD;
  ll ans = pow(ll(2),N);
  ans = (ans - NA + MOD)%MOD;
  ans = (ans - NB + MOD)%MOD;
  cout << ans-1 << endl;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int peopleNumber = sc.nextInt();
        int[] trueNumbers = new int[peopleNumber];
        if (peopleNumber % 2 == 0) {
            for (int i = 0; i < peopleNumber; i = i + 2) {
                trueNumbers[i] = i + 1;
                trueNumbers[i + 1] = i + 1;
            }
        } else {
            trueNumbers[0] = 0;
            for (int i = 1; i < peopleNumber; i = i + 2) {
                trueNumbers[i] = i + 1;
                trueNumbers[i + 1] = i + 1;
            }
        }

        int[] targetNumbers = new int[peopleNumber];
        for (int i = 0; i < peopleNumber; i++) {
            targetNumbers[i] = sc.nextInt();
        }
        Arrays.sort(targetNumbers);

        boolean isCorrect = true;
        for (int i = 0; i < peopleNumber; i++) {
            if (trueNumbers[i] != targetNumbers[i]) {
                isCorrect = false;
                break;
            }
        }
        if (isCorrect) {
            long answer = 1;
            for (int i = 0; i < peopleNumber / 2; i++) answer = 2 * answer % 1000000007;
            System.out.println(answer);
        } else {
            System.out.println(0);
        }

    }
}


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

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

class team {
  public:
    long long tid;
    long long correct;
    long long penalty;
    void print();
    bool operator < (const team&);
};

void team::print() {
  cout << tid << ' ' << correct << ' ' << penalty << endl;
}

bool team::operator < (const team &right) {
  if (correct != right.correct) return correct < right.correct;
  else if (penalty != right.penalty) return penalty > right.penalty;
  else return tid > right.tid;
}

int main() {
  long long t, p, r;
  long long tid, pid, time_;
  long long point;
  string message;

  while (cin >> t >> p >> r && t && p && r) {
    vector<team> teams(t);
    vector<long long> corrects(t, 0);
    vector<long long> penalties(t, 0);
    vector<vector<long long>> wrongs(t);
    rep (i, t) wrongs[i].resize(p);

    rep (i, r) {
      cin >> tid >> pid >> time_ >> message;
      tid--; pid--;

      if (message == "CORRECT") {
        corrects[tid]++;
        point = wrongs[tid][pid] * 1200 + time_;
        // cout << "team id: " << tid << endl;
        // cout << "penalty: " << penalties[tid] << endl;
        // cout << "wrongs[tid][pid]: " << wrongs[tid][pid] << endl;
        // cout << "point: " << point << endl;
        penalties[tid] += point;
      }
      else if (message == "WRONG") {
        wrongs[tid][pid]++;
      }
    }

    rep (i, t) {
      teams[i].tid = i+1;
      teams[i].correct = corrects[i];
      teams[i].penalty = penalties[i];
    }

    sort(teams.begin(), teams.end());
    reverse(teams.begin(), teams.end());
    rep (i, t) teams[i].print();
  }
}

Measured memory_bytes: 3200
import java.util.Scanner;

/**
 *
 * @author lenovo
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner sc = new Scanner(System.in);
        String str = sc.next();
        String ans = "Yes";
                
        int in  = str.indexOf("9");
        if (in == -1) {
            ans = "No";
        }
        
        System.out.println(ans);
    }
    
}

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

#define ll long long
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pb push_back
#define all(x) (x).begin(), (x).end()

#define MAX(a,b) (a > b ? a : b)
#define MIN(a,b) (a < b ? a : b)
const int MOD = 1000000007;

int main() {
    IOS;
    ll n, m;
    cin >> n >> m;
    vector<ll> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    std::vector<pair<ll, ll> > bc(m);
    for(int i = 0; i < m; i++) cin >> bc[i].second >> bc[i].first;
    sort(all(a));
    sort(all(bc));
    int i = 0, j = m - 1;
    while(i < n && j >= 0) {
        while(i < n && bc[j].second && bc[j].first > a[i]) {
            a[i] = bc[j].first;
            i++;
            bc[j].second -= 1;
        }
        j--;
    }
    ll sum = 0;
    for(ll x : a) sum += x;
    cout << sum << "\n";
    return 0;
}

Measured memory_bytes: 2560
#include <bits/stdc++.h>
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define LB(a,x) lb(all(a),x)-a.begin()
#define UB(a,x) ub(all(a),x)-a.begin()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<n;i++)
const double pi=3.141592653589793;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

bool ok(ll x1,ll y1,ll x2,ll y2,ll r,ll c){
    bool a=0,b=0;
    if(x1==0||x1==r) a=1;
    if(y1==0||y1==c) a=1;
    if(x2==0||x2==r) b=1;
    if(y2==0||y2==c) b=1;
    if(a&&b) return 1;
    return 0;
}

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    ll r,c,n;
    cin>>r>>c>>n;
    ll x[2][n],y[2][n];
    V<ll> a;
    rep(i,n){
        rep(j,2) cin>>x[j][i]>>y[j][i];
        if(ok(x[0][i],y[0][i],x[1][i],y[1][i],r,c)){
            a.push_back(i);
        }
    }
    
    V<P> s,t,u,v;
    for(ll k:a){
        rep(i,2){
            if(x[i][k]==0) v.emplace_back(y[i][k],k);
            else if(x[i][k]==r) t.emplace_back(y[i][k],k);
            else if(y[i][k]==0) s.emplace_back(x[i][k],k);
            else if(y[i][k]==c) u.emplace_back(x[i][k],k);
        }
    }
    sort(all(s));
    sort(all(t));
    sort(all(u),greater<P>());
    sort(all(v),greater<P>());
    bool ok=1;
    stack<ll> sk;
    set<ll> st;
    
    for(auto ss:s){
        if(sk.empty()){
            sk.push(ss.sc);
            st.insert(ss.sc);
        }else{
            if(ss.sc==sk.top()) sk.pop();
            else sk.push(ss.sc);
        }
    }
    for(auto ss:t){
        if(sk.empty()){
            sk.push(ss.sc);
            st.insert(ss.sc);
        }else{
            if(ss.sc==sk.top()) sk.pop();
            else sk.push(ss.sc);
        }
    }
    for(auto ss:u){
        if(sk.empty()){
            sk.push(ss.sc);
            st.insert(ss.sc);
        }else{
            if(ss.sc==sk.top()) sk.pop();
            else sk.push(ss.sc);
        }
    }
    for(auto ss:v){
        if(sk.empty()){
            sk.push(ss.sc);
            st.insert(ss.sc);
        }else{
            if(ss.sc==sk.top()) sk.pop();
            else sk.push(ss.sc);
        }
    }
    if(!sk.empty()) ok=0;
    if(ok) cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
}
//ペナルティ出しても焦らない　ACできると信じろ！！！
//どうしてもわからないときはサンプルで実験　何か見えてくるかも
//頭で考えてダメなら紙におこせ！！
/*
V,P(大文字)使用不可
乗算などの際にオーバーフローに注意せよ！
(適切にmodをとれ　にぶたんで途中で切り上げろ)
制約をよく読め！
{
    ・全探索できるなら全探索しろ
    ・異常な制約ならそこに注目
}
stringの計算量(扱い)注意
コーナー注意！(特に数値が小さいものについては要検証)
N行出力のときは'¥n'
グリッド上では行先が範囲内におさまるかif文で確認(RE注意)
if文ではちゃんと比較演算子==を使え('='でもエラー出ない)
配列(vector)の大きさが0か1以上かで場合分けせよ(RE注意)
(vector<int> a(m)でm==0というものはできない)
modはなるべく最後に取れ！
doubleを扱うときには(abs)ではなく'fabs'!!!
*/

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


int main()
{

    int n;
    cin>>n;
    int x=3;
    while(x--)
    {
	int y=n%10;
	if(y==7)
	{
	    cout<<"Yes";
	    return 0;
	}
	n/=10;
    }
    cout<<"No";
    return 0;
}


Measured memory_bytes: 3672
N = int(input())
s = [int(input()) for _ in range(N)]

result = sum(s)

if result % 10 == 0:
    for _ in range(N):
        min_s = min(s)
        if min_s % 10 == 0:
            s.remove(min_s)
        else:
            result -= min_s
            break

    if result % 10 == 0:
        result = 0

print(result)


Measured memory_bytes: 2940
#include <iostream>
#include <queue>
#include <map>
using namespace std;
int main(){
  int N, M, K;
  cin >> N >> M >> K;
  int D[M], V[N][K];
  for(int i = 0; i < M; ++i){
    cin >> D[i];
    --D[i];
  }
  map<int,int> R;
  for(int i = 0; i < M; ++i){
    R[D[i]] = i+1;
  }
  for(int i = 0; i < N; ++i){
    for(int j = 0; j < K; ++j){
      cin >> V[i][j];
      --V[i][j];
    }
  }
  queue<int> que;
  //queue< pair<int,int> > que;
  map<int,int> L;
  int d = (1<<M)-1;
  que.push(d);
  //que.push(make_pair(d,1));
  L[d] = 1;
  while(!que.empty()){
    int s = que.front(), len = L[s];
    //int s = que.front().first, len = que.front().second;
    que.pop();
    for(int i = 0; i < K; ++i){
      int t = 0;
      for(int j = 0; j < M; ++j){
	if(((s>>j)&1) && R[V[D[j]][i]]){
	  t |= (1<<(R[V[D[j]][i]]-1));
	}
      }
      if(!t){
	cout << len << endl;
	return 0;
      }
      if(len+1 < L[t] || !L[t]){
	que.push(t);
      //que.push(make_pair(t,len+1));
	L[t] = len+1;
      }
    }
  }
  return 0;
}

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

int main() {
	
	int N, A[100];
	int ans = 0;
	int max = 0;

	cin >> N;

	for (int i = 0; i < N; i++) {
		cin >> A[i];
	}

	for (int i = 0; i < N; i++) {
		if (A[i] == 1) {
			ans++;
			if (ans > max) max = ans;
		}
		else ans = 0;

	}

	cout << max + 1 << endl;
	
	return 0;

}



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

int mincost(int *h,int n)
{

    int cost[n];
    cost[0]=0;
    cost[1]=abs(h[0]-h[1]);

    for(int i=2;i<n;i++)
    {
        cost[i] = min(
                      (cost[i-1] + abs(h[i-1]-h[i])),
                       (cost[i-2] + abs(h[i-2]-h[i]))
                      );
    }
    return cost[n-1];
}

int main()
{
int n;

cin>>n;

int h[n];
for(int i=0;i<n;i++)
    cin>>h[i];



cout<<mincost(h,n);



    return 0;
}





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

using namespace std;

using ll = long long;
using pii = pair<int, int>;
using ld = long double;

template <typename T>
int sz(T &x) {
  return (int)(x.size());
}

const int inf = 1'000'000'007;

void solve() {
  int k;
  cin >> k;
  vector<int> a(k);
  for (int i = 0; i < k; ++i) {
    cin >> a[i];
  }
  if (a[k - 1] != 2) {
    cout << "-1\n";
    return;
  }
  ll l = 2, r = 3;
  for (int i = k - 2; i >= 0; --i) {
    ll sl = ((l + a[i] - 1) / a[i]) * a[i];
    ll sr = (r / a[i]) * a[i];
    if (sl > r) {
      cout << "-1\n";
      return;
    }
    l = sl;
    r = sr + a[i] - 1;
  }
  cout << l << " " << r << "\n";
}

int main() {
  ios_base :: sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  t = 1;
  while(t--) {
    solve();
  }
  return 0;
}


Measured memory_bytes: 3724
#include<iostream>
#include <iomanip>

#define PI 3.14159265359	

using namespace std;

int main(){
	int n, c, max, min;
	long long sum;
	cin >> n >> max;
	min = max;
	sum = max;
	for (int i = 1; i < n; i++){
		cin >> c;
		if (c > max) max = c;
		if (c < min) min = c;
		sum += c;
	}
	cout << min << " " << max << " " << sum << endl;
}

Measured memory_bytes: 3092
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin>>N;
    vector<int> d(N);
    for(int i=0;i<N;i++){
        cin>>d.at(i);
    }
    sort(d.begin(),d.end());
    cout<<d.at(N/2)-d.at(N/2-1)<<endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
long long a[100001],b[100001],c[100001],dp[100001][3],n;
long long cal(long long idx,long long v)
{
    //cout<<dp[idx][v]<<' '<<idx<<endl;
    if (idx>n) return 0;
    if (dp[idx][v]!=-1) return dp[idx][v];
    else dp[idx][v]=0;
    if (v==0) dp[idx][v]=max(cal(idx+1,1)+a[idx],max(cal(idx+1,2)+b[idx],cal(idx+1,3)+c[idx]));
    if (v==1) dp[idx][v]=max(cal(idx+1,v+1)+b[idx],cal(idx+1,v+2)+c[idx]);
    if (v==2) dp[idx][v]=max(cal(idx+1,v-1)+a[idx],cal(idx+1,v+1)+c[idx]);
    if (v==3) dp[idx][v]=max(cal(idx+1,v-2)+a[idx],cal(idx+1,v-1)+b[idx]);
    return dp[idx][v];
}
int main()
{
    cin>>n;
    for (int i=1;i<=n;i++) cin>>a[i]>>b[i]>>c[i];
    for (int i=1;i<=n;i++)
        for (int j=0;j<=3;j++) dp[i][j]=-1;
    cout<<cal(1,0);
}


Measured memory_bytes: 9600
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int s[105],p=0;
char in[10];
int main()
{
    while(cin>>in)
        if(in[0]=='+')s[p]+=s[p--];
        else if(in[0]=='-')s[p]-=s[p--];
        else if(in[0]=='*')s[p]*=s[p--];
        else s[++p]=atoi(in);
    cout<<s[1]<<endl;
    return 0;
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int maxn = 100005;
int n;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    cin >> n;
    ll rez = 0;
    for(int i=1;i<n;i++){
        int u, v;
        cin >> u >> v;
        if(u > v)swap(u, v);
        rez -=  (ll)u * (n - v + 1);
    }
    for(int i=1;i<=n;i++)rez += (ll)i * (n - i + 1);
    cout << rez << endl;
    return 0;
}


Measured memory_bytes: 3640
#include<iostream>
#include<string>
using namespace std;
int main()
{
    int n;
    long long ans = 0, a[5] = {0};
    string s;
    cin >> n;
    for(int i = 0; i < n; i++){
        cin >> s;
        if(s[0] == 'M') a[0] += 1;
        if(s[0] == 'A') a[1] += 1;
        if(s[0] == 'R') a[2] += 1;
        if(s[0] == 'C') a[3] += 1;
        if(s[0] == 'H') a[4] += 1;
    }
    for(int i = 0; i <= 2; i++){
        for(int j = i+1; j <= 3; j++){
            for(int k = j+1; k <= 4; k++){
                ans += a[i] * a[j] * a[k];
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
function Main(input) {
	var lines = input.split("\n");
	var words = lines[0].split(" ");
	var x = Number(words[0]);
	while(1) {
		var cand = x++
		if(isPrime(cand)){
			console.log(cand)
			return
		}
	}
	function isPrime(num) {
		for(var d = 2; d < num; d++) {
			if(num % d === 0) {
				return false
			}
		}
		return true
	}
}


Main(require("fs").readFileSync("/dev/stdin", "utf8"))

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

c_list = []

for i in range(N):
    a,b = list(map(int,input().split()))
    c_list.append([a,"a"])
    c_list.append([b,"b"])    
c_list=sorted(c_list,key=lambda x: x[0])
c_list=c_list[::-1]

score = 0
count = 0
for i in range(2*N):
    if c_list[i][1]=="a":
        if (H-score)%c_list[i][0]==0:
            count += int((H-score)/c_list[i][0])
        else:
            count += int((H-score)/c_list[i][0])+1
        break
    else:
        count+=1
        if H<=score+c_list[i][0]:
            break
        score+=c_list[i][0]

print(count)

Measured memory_bytes: 35220
#include <bits/stdc++.h>
using namespace std;
int main(){
  long long int n;
  cin >>n;
  bool en=false;
  for(long long int i=1;i<=3500;i++){
    if(en)break;
    for(long long int j=1;j<=3500;j++){
      if(en)break;
      if(4*i*j-n*j-n*i>0){
        if(n*i*j%(4*i*j-n*j-n*i)==0){
          long long int ans=n*i*j/(4*i*j-n*j-n*i);
          cout<<i<<" "<<j<<" "<< ans <<endl;
          en=true;
        }
      }
    }
  }
}


Measured memory_bytes: 256
using System; using System.Collections.Generic;
class A {
	static void Main() {
		var n = Console.ReadLine();
		var dic = new Dictionary<char,int>();
		foreach(var c in n) {
			if(dic.ContainsKey(c))
				dic[c]++;
			else
				dic[c] = 1;
		}
		foreach(var d in dic) {
			if(d.Value % 2 == 1) {
				Console.Write("No");
				return;
			}
		}
		Console.WriteLine("Yes");
	}
}

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

int main() {
	char P[3];
	char R[3];
	int cnt = 0;

	for (int i = 0; i < 3; i++) {
		cin >> P[i];
	}

	for (int j = 0; j < 3; j++) {
		cin >> R[j];
	}

	for (int k = 0; k < 3; k++) {
		if (P[k] == R[k]) {
			cnt++;
		}
	}

	cout << cnt << "\n";

	return 0;
}

Measured memory_bytes: 256