akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
int v1[]={1,400,800,1200,1600,2000,2400,2800};
int v2[]={399,799,1199,1599,1999,2399,2799,3199};
int vf[100];
int main() {
    FILE * fi, * fout;
    int i,n,j;
    //fi = fopen("A.in" ,"r");
    //fout = fopen("A.out" ,"w");
    fi=stdin;
    fout=stdout;
    fscanf(fi,"%d" ,&n);
    int cnt=0,ans=0;
    for(i=1;i<=n;i++) {
       int x;
       fscanf(fi,"%d" ,&x);
       if(x>3199)
         cnt++;
       for(j=0;j<8;j++)
         if(v1[j]<=x&&x<=v2[j]){
            vf[j]++;
            break;
         }
    }
    for(j=0;j<8;j++)
      if(vf[j]>0)
         ans++;
    if(ans==0&&cnt>0)
       fprintf(fout,"1 %d\n" ,ans+cnt);
    else
       fprintf(fout,"%d %d\n" ,ans,ans+cnt);
    //fclose(fi);
    //fclose(fout);
}


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

//repetition
#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)

//container util
#define all(x) (x).begin(),(x).end()

//typedef
typedef long long ll;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//const value
//const ll MOD = 1e9 + 7;
//const int dx[] = {0,1,0,-1};//{0,0,1,1,1,-1,-1,-1};
//const int dy[] = {1,0,-1,0};//{1,-1,0,1,-1,0,1,-1};

//conversion
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
inline ll toLL(string s) {ll v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}


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

  while(true){
      cin >> n;
      if(n == 0) break;
      vector<map<int,bool>> p(n);
      rep(i,n){
        int m;
        cin >> m;
        rep(j,m){
          int x;
          cin >> x;
          x--;
          p[i][x] = true;
        }
      }
      int k;
      cin >> k;
      VI l(k);
      rep(i,k){
        cin >> l[i];
        l[i]--;
      }
      VI ans;
      rep(i,n){
        bool flag = true;
        rep(j,k){
          if(p[i][l[j]] == false) flag = false;
        }
        if(flag) ans.push_back(i+1);;
      }
      if(ans.size() == 1) cout << ans.back() << endl;
      else cout << -1 << endl;
  }
  return 0;
}



Measured memory_bytes: 3608
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		final Scanner sc = new Scanner(System.in);
		int white = sc.nextInt();
		int black = sc.nextInt();
		char[][] chars = new char[100][100];
		for (int h = 0; h < 50; h++) {
			for (int w = 0; w < 100; w++) {
				chars[h][w] = '.';
			}
		}
		for (int h = 50; h < 100; h++) {
			for (int w = 0; w < 100; w++) {
				chars[h][w] = '#';
			}
		}
		for(int i = black-1, k = 0; i > 0; i--, k++) {
			int h = (k / 50)*2;
			int w = (k % 50)*2;
			chars[h][w] = '#';
		}
		for(int i = white-1,k = 0; i > 0; i--, k++) {
			int h = (k / 50)*2+51;
			int w = (k % 50)*2;
			chars[h][w] = '.';
		}
		System.out.println(100+" "+100);
		for(char[] a : chars) {
			for(char c : a) {
				System.out.print(c);
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 28116
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		int[][][] BigHouse=new int[4][3][10];
		for(int i=0;i<4;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<10;k++){
					BigHouse[i][j][k]=0;
				}
			}
		}

		int order=sc.nextInt();
		for(int i=0;i<order;i++){
			int b=sc.nextInt()-1;
			int f=sc.nextInt()-1;
			int r=sc.nextInt()-1;
			int v=sc.nextInt();
			BigHouse[b][f][r]+=v;
			if(BigHouse[b][f][r]<0){
				BigHouse[b][f][r]=0;
			}
		}

		//出力
		for(int i=0;i<4;i++){
			for(int j=0;j<3;j++){
				for(int k=0;k<10;k++){
					System.out.print(" "+BigHouse[i][j][k]);
				}
				System.out.println();
			}
			if(i!=3){
				System.out.println("####################");
			}
		}
	}

}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
typedef vector<pll> vll;

const double PI = acos(-1);
#define MOD 1000000007

#define pb push_back
#define F first
#define S second
#define test int tc; cin>>tc; while(tc--)
#define forn(i,n) for(i=0;i<n;i++)
#define rforn(i,n) for(i=n-1;i>=0;i--)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define sz(x) (int)x.size()
#define el <<'\n'
#define sp <<' '

#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (abs(a*b)/gcd(a,b))
#define sqr(a) (a*a)

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

///binary to decimal
long double btod(string a){
    long double i,c=sz(a)-1,s=0,d=0;
    for(i=c;i>=0;i--){
        a[i]-=48;
        s+=a[i]*pow(2,d);
        d++;
    }
    return s;
}

main()
{
    optimize();
    int n,i,m,s=0;
    cin>>n>>m;
    int a[n];
    forn(i,n) {cin>>a[i]; s+=a[i];}
    sort(a,a+n);
    i=n-1;
    s=(s+(4*m)-1)/(4*m);
    while(m>0&&a[i]>=s&&i>=0){
        m--;
        i--;
    }
    if(!m)cout<<"Yes" el;
    else cout<<"No" sp el;
}










//Brainless_Loco Terminates Here!


Measured memory_bytes: 256
#include <iostream>
#include <stack>
#include <queue>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
#include <functional>
#include <map>
#include <math.h>
#include <list>

using namespace std;
#define ll long long int


int main(void) {

	ios::sync_with_stdio(false);
	cin.tie(0);

	char alphabet[28] = "abcdefghijklmnopqrstuvwxyz";
	
	ll n;
	cin >> n;
	string a = "";

	ll i = 26;
	while (true) {
		n -= 1;
		a = alphabet[n % i] + a;
		n /= 26;
		if (n == 0) break;

	}

	cout << a << endl;


	return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
const lli N=1e5+5;
lli n,a,b,c,flag;
string s[N];
vector<char> v;

void solve(lli x)
{
    if(x==n)
    {
        cout<<"Yes"<<endl;
        for(int i=0;i<v.size();i++)
        {
            cout<<v[i]<<endl;
        }
        flag=1;
        exit(0);
    }
    
    if(s[x][0]=='A')
    {
        if(a>0)
        {
            if(s[x][1]=='B') b++;
            else             c++;
            
            v.push_back(s[x][1]);
            a--;
            
            solve(x+1);
            
            v.pop_back();
            a++;
            
            if(s[x][1]=='B') b--;
            else             c--;
        }
    }
    else if(s[x][0]=='B')
    {
        if(b>0)
        {
            if(s[x][1]=='A') a++;
            else             c++;
            
            v.push_back(s[x][1]);
            b--;
            
            solve(x+1);
            
            v.pop_back();
            b++;
            
            if(s[x][1]=='A') a--;
            else             c--;
        }
    }
    else if(s[x][0]=='C')
    {
        if(c>0)
        {
            if(s[x][1]=='B') b++;
            else             a++;
            
            v.push_back(s[x][1]);
            c--;
            
            solve(x+1);
            
            v.pop_back();
            c++;
            
            if(s[x][1]=='B') b--;
            else             a--;
        }
    }
    
    if(s[x][1]=='A')
    {
        if(a>0)
        {
            if(s[x][0]=='B') b++;
            else             c++;
            
            v.push_back(s[x][0]);
            a--;
            
            solve(x+1);
            
            v.pop_back();
            a++;
            
            if(s[x][0]=='B') b--;
            else             c--;
        }
    }
    else if(s[x][1]=='B')
    {
        if(b>0)
        {
            if(s[x][0]=='A') a++;
            else             c++;
            
            v.push_back(s[x][0]);
            b--;
            
            solve(x+1);
            
            v.pop_back();
            b++;
            
            if(s[x][0]=='A') a--;
            else             c--;
        }
    }
    else if(s[x][1]=='C')
    {
        if(c>0)
        {
            if(s[x][0]=='B') b++;
            else             a++;
            
            v.push_back(s[x][0]);
            c--;
            
            solve(x+1);
            
            v.pop_back();
            c++;
            
            if(s[x][0]=='B') b--;
            else             a--;
        }
    }
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n>>a>>b>>c;
    
    for(int i=0;i<n;i++) cin>>s[i];
    
    solve(0);
    cout<<"No";
    return 0;
}

Measured memory_bytes: 13144
import math

nm = input().split(" ")

m = int(nm[0])
n = int(nm[1])

alist = input().split(" ")

sum = 0

for i in range(n):
    sum = sum + int(alist[i])

if sum <= m:
    sa = math.floor(m-sum)
    print(sa)
else:
    print(-1)

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

int main() {
	int N, K;
	cin >> N >> K;
	int a = 1;
	for (int i=0; i<N; i++) {
		if (a<K) a*=2;
		else a+=K;
	}
	cout << a << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h> 
using namespace std; 
 
int main() 
{ 

    int r,g,b,n;
    cin>>r>>g>>b>>n;


    int cnt=0;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n;j++){
            int k=(n-i*r-j*g)/b;
            if(i*r+j*g+k*b==n&&k>=0)
                cnt++;
        }
    }

    cout<<cnt<<endl;

    return 0; 
} 

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

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep3(i,m,n) for(int (i)=m;(i)<=(n);(i)++)
#define rep3rev(i,m,n) for(int (i)=m;(i)>=(n);(i)--)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second

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

void Main()
{
	string s; int k;
	cin >> s >> k;
	set<string> data;
  	rep(i,s.size()){
    	rep3(j,1,k){
        	data.insert(s.substr(i,j));
        }
    }
  	auto itr = data.begin();
  	rep(i,k-1) itr++;
    cout << *itr << endl;
	return;
}

int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
	return 0;
}

Measured memory_bytes: 1664
#define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <iostream>
#include <string>
#include <cstdio>
using namespace std;
int main() {
	string s;
	cin >> s;
	for (int i = 0; i < (int)s.length() - 1;i++)
		if (s[i] != s[(int)s.length() - i - 2]) {
			printf("-1\n");
			return 0;
		}
	if (s[s.length() - 1] == '1' || s[0] == '0') {
		printf("-1\n");
		return 0;
	}
	int last = 1, cur = 2;
	for (int i = 1; i < (int)s.length(); i++) {
		if (s[i] == '1') {
			printf("%d %d\n", last, cur);
			last = cur;
			for (int j = cur + 1; j <= i + 1; j++)
				printf("%d %d\n", cur, j);
			cur = i + 2;
		}
	}
	printf("%d %d\n", last, cur);
	return 0;
}

Measured memory_bytes: 1664
#include<iostream>
#include<string>
using namespace std;
 
int main(){
 
  int n, k[100], x, i, j;
  string sta="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", s;
 
  while(cin>>n, n){
    for(i=0;i<n;i++) cin>>k[i];
    cin>>s;
 
    for(i=0;i<s.size();i++){
      for(j=0;j<56;j++){
    if(s[i]==sta[j]){
      x=j-k[i%n];
      if(x<0){
        x+=52;
        break;
      }else break;
    }
      }
      cout<<sta[x];
    }
    cout<<endl;
  }
  return 0;
}

Measured memory_bytes: 3168
#include<stdio.h>
#include<math.h>

int sosudiagnosis(int);

int main()
{
  int n; //入力できる個数
  int s; //数
  int l=0; //ループの回数
  int count=0;//素数の数

  scanf("%d",&n);
  while(l < n){
    l++;
    scanf("%d",&s);

    if(sosudiagnosis(s)==1) count++;
  }
  printf("%d\n",count);
  return 0;
}

int sosudiagnosis(int s)
{
  int i=3;
  if(s == 2) return 1;

  if(s < 2 || s%2==0) return 0;

  while(i <= sqrt(s)){
    if(s%i==0) return 0;
  
    i = i + 2;
  }
  return 1;
}

Measured memory_bytes: 596
#include <iostream>
#include <iomanip>
#include <string>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <numeric>

using namespace std;

int main(int argc, char* argv[]){
  long long int a,b,x;
  cin >> a;
  cin >> b;
  cin >> x;
  if(a%x == 0){
    cout << b/x - a/x + 1 << endl;
  }else{
    cout << b/x - a/x << endl;
  }
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import static java.lang.System.*;

class FastScanner {
  private final InputStream in = System.in;
  private final byte[] buffer = new byte[1024];
  private int ptr = 0;
  private int buflen = 0;
  private boolean hasNextByte() {
      if (ptr < buflen) {
          return true;
      }else{
          ptr = 0;
          try {
              buflen = in.read(buffer);
          } catch (IOException e) {
              e.printStackTrace();
          }
          if (buflen <= 0) {
              return false;
          }
      }
      return true;
  }
  private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
  private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
  public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}
  public String next() {
      if (!hasNext()) throw new NoSuchElementException();
      StringBuilder sb = new StringBuilder();
      int b = readByte();
      while(isPrintableChar(b)) {
          sb.appendCodePoint(b);
          b = readByte();
      }
      return sb.toString();
  }
  public long nextLong() {
      if (!hasNext()) throw new NoSuchElementException();
      long n = 0;
      boolean minus = false;
      int b = readByte();
      if (b == '-') {
          minus = true;
          b = readByte();
      }
      if (b < '0' || '9' < b) {
          throw new NumberFormatException();
      }
      while(true){
          if ('0' <= b && b <= '9') {
              n *= 10;
              n += b - '0';
          }else if(b == -1 || !isPrintableChar(b)){
              return minus ? -n : n;
          }else{
              throw new NumberFormatException();
          }
          b = readByte();
      }
  }
  public int nextInt() {
      long nl = nextLong();
      if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
      return (int) nl;
  }
  public double nextDouble() { return Double.parseDouble(next());}
}

class Main {
  public static final int MOD = 1000000007;
  public static final int INF = 1000000000;
  public static void main(String[] args) {
    FastScanner sc = new FastScanner();
    int N = sc.nextInt();
    int K = sc.nextInt();
    int Q = sc.nextInt();
    int A[] = new int[Q];
    for(int i=0; i<Q; i++) A[i] = sc.nextInt()-1;
    int cnt[] = new int[N];
    for(int i=0; i<Q; i++){
      cnt[A[i]]++;
    }
    for(int i=0; i<N; i++){
      if(K - (Q-cnt[i]) > 0) out.println("Yes");
      else out.println("No");
    }
  }
}

Measured memory_bytes: 46740
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define f(i,a,b) for(ll i=a;i<=b;i++)
#define g(i,a,b) for(ll i=a;i>=b;i--)
#define F first
#define vv vector
#define S second
#define mp make_pair
#define pb push_back
#define mh make_heap
#define ph push_heap
#define pq priority_queue
using namespace std;


int main()
{

ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
ll n;
cin>>n;
ll a[n];
f(i,0,n-1) cin>>a[i];
ll s=0;
f(i,0,n-1)
f(j,i+1,n-1) s+=a[i]*a[j];
cout<<s;


}







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

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


Measured memory_bytes: 384
S = input()
memo_ls = [[0 for j in range(13)] for i in range(len(S) + 1)]
memo_ls[0][0] = 1
for i in range(len(S)):
    for _ in range(10):
        if S[i] != "?" and int(S[i]) != _:
            continue
        for j in range(13):
            memo_ls[i + 1][(j * 10 + _) % 13] += memo_ls[i][j]
    for j in range(13):
        memo_ls[i + 1][j] %= 10**9+7

print(memo_ls[len(S)][5])

Measured memory_bytes: 66652
import java.util.*;

public class Main {
  public static void main(String[] args) throws Exception {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int C = sc.nextInt();
    int X = sc.nextInt();  //Aの個数
    int Y = sc.nextInt();  //Bの個数
    int MAX = Math.max(X,Y);
    int MIN = Math.min(X,Y);
    int diff = MAX - MIN;
    int result = 0;

    if(MAX == X){
      result += Math.min((diff * A) , (diff * C * 2));
    
    }else{
      result += Math.min((diff * B) , (diff * C * 2));
    }
    
    if((C * (MIN * 2)) > ((A * MIN) + (B * MIN))){
      result += (A * MIN) + (B * MIN);
      
    }else{
      result += C * (MIN * 2);
    }
    
    System.out.println(result);
  }
}


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

int main() {
	int n,a;
	cin >> n;
	string k = "APPROVED";
	for(int i = 0;i < n;i++)
	{
		cin >> a;
		if(a % 2 == 0)
		{
			if(a % 3 != 0 && a % 5 != 0)
			{
				k = "DENIED";
			}
		}
	}
	cout << k <<endl;
	return 0;
}


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

namespace ABC
{
    class ProgramA
    {
        static void Main(string[] args)
        {
            var list = new int[3];
            var inputs = Console.ReadLine().Split(" ");
            list[0] = int.Parse(inputs[0]);
            list[1] = int.Parse(inputs[1]);
            list[2] = int.Parse(inputs[2]);
            var result = 0;

            list = list.OrderBy(x => x).ToArray();

            result += list[1] - list[0];
            result += list[2] - list[1];

            Console.WriteLine(result);
        }
    }
}


Measured memory_bytes: 28304
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   main.cpp                                           :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: monoue <marvin@student.42.fr>              +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2020/04/22 12:30:15 by monoue            #+#    #+#             */
/*   Updated: 2020/04/23 06:20:01 by monoue           ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include <bits/stdc++.h>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/adaptors.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/algorithm/string/classification.hpp> // is_any_of
#include <boost/algorithm/string/split.hpp>
#include <boost/algorithm/string/join.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/math/tools/minima.hpp>

const int MOD = 1e9+7;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = (n); i >= 0; --i)

namespace adaptor = boost::adaptors;
using namespace std;
using boost::math::tools::brent_find_minima;
using boost::irange;
using boost::algorithm::join;
using boost::algorithm::split;
using boost::algorithm::replace_all;
using boost::multiprecision::cpp_int;
using ll = long long;
using P = pair<int, int>;

// TOP
void	Main()
{
	int n, m;
	cin >> n >> m;
	if (m == 1 || n >= m)
	{
		cout << 0 << endl;
		return ;
	}
	vector<int>	V(m);
	rep(i, m)
		cin >> V.at(i);
	sort(V.begin(), V.end());
	vector<P>	P(m - 1); // 各点の間隔なので、m でなく m - 1
	rep(i, m - 1)
	{
		P.at(i).first = abs(V.at(i + 1) - V.at(i));
		P.at(i).second = i; // 例えば i = 0 の要素は 0 と 1 の間の間隔
	}

	sort(P.begin(), P.end(), greater<>());
	vector<int>	VB(n - 1);
	rep(i, n - 1) // 例えば３個のコマを置くなら、間隔が大きい順に２点分かれば置き場所が定まる
		VB.at(i) = P.at(i).second;
	sort(VB.begin(), VB.end()); // 例えば値が 0 なら、0 と 1 の間の間隔
	int mini = 0; // 各区間の最小値の記録用
	int sum = 0;
	rep(i, n - 1) // 終わりの区間はまだ含まないので -1
	{
		sum += (V.at(VB.at(i)) - V.at(mini));
		mini = VB.at(i) + 1;
	}
	sum += V.at(m - 1) - V.at(mini); // 終わりの区間
	cout << sum << endl;
}
// END

int		main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout << fixed << setprecision(15);
	Main();
}


Measured memory_bytes: 1792
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <string>    
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
ll n, m;
string str;

int main(){
	cin >> str;
	
	string ans = "TBD";
	
	if(atoi((str.substr(5, 2)).c_str()) <= 4){ans = "Heisei";}
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
package main

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

func main() {
	scanner := makeWordScanner()
	n := eGetInt(scanner)
	ss := make([]string, n)
	for i := 0; i < len(ss); i++ {
		ss[i] = eGetLine(scanner)
	}
	m := eGetInt(scanner)
	ms := make([]string, m)
	for i := 0; i < len(ms); i++ {
		ms[i] = eGetLine(scanner)
	}
	score := make(map[string]int)
	for i := 0; i < len(ss); i++ {
		score[ss[i]]++
	}
	for i := 0; i < len(ms); i++ {
		score[ms[i]]--
	}
	max := 0
	for _, v := range score {
		if v > max {
			max = v
		}
	}
	fmt.Println(max)
}

////////////////////////////////////////////////////////////////////////////////
// ライブラリ
////////////////////////////////////////////////////////////////////////////////
func makeScanner(maxByte int) *bufio.Scanner {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Buffer(make([]uint8, 0, 8192), maxByte)
	return scanner
}
func makeWordScanner() *bufio.Scanner {
	scanner := makeScanner(8192)
	scanner.Split(bufio.ScanWords)
	return scanner
}
func eGetLine(r *bufio.Scanner) string {
	if r.Scan() {
		return r.Text()
	}
	err := r.Err()
	if err != nil {
		log.Fatal(err)
	}
	// EOF
	return ""
}

func eGetInt(r *bufio.Scanner) int {
	line := eGetLine(r)
	return eAtoi(line)
}
func eGetInt64(r *bufio.Scanner) int64 {
	line := eGetLine(r)
	return eAtoInt64(line)
}
func eGetFields(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Fields(line)
}
func eGetInts(r *bufio.Scanner) []int {
	fields := eGetFields(r)
	ints := make([]int, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoi(fields[i])
	}
	return ints
}
func eGetInt64s(r *bufio.Scanner) []int64 {
	fields := eGetFields(r)
	ints := make([]int64, len(fields))
	for i := 0; i < len(ints); i++ {
		ints[i] = eAtoInt64(fields[i])
	}
	return ints
}
func eGetChars(r *bufio.Scanner) []string {
	line := eGetLine(r)
	return strings.Split(line, "")
}
func eAtoi(s string) int {
	n, err := strconv.Atoi(s)
	if err != nil {
		log.Fatal(err)
	}
	return n
}
func eAtoInt64(s string) int64 {
	n, err := strconv.ParseInt(s, 10, 64)
	if err != nil {
		log.Fatal(err)
	}
	return n
}


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

	int a, b, maior, res = 0;
	cin >> a >> b;

	rep(i,2){

		if (a > b){

			maior = a;
			a--;

		}else{

			maior = b;
			b--;
		}

		res += maior;
	}
	cout << res;
}

Measured memory_bytes: 3588
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int output;
		
		if(N%K == 0) {
			output = 0;
		} else {
			output = 1;
		}
		
		System.out.println(output);
	}

}

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

typedef struct sort{
    int nakami;
    int juni = 1;
}sorter;

int main() {
    sorter a, b, c;

    cin >> a.nakami >> b.nakami >> c.nakami;

    if (a.nakami > b.nakami) {
        a.juni++;
    }
    else {
        b.juni++;
    }
    if (a.nakami > c.nakami) {
        a.juni++;
    }
    else {
        c.juni++;
    }
    if (b.nakami > c.nakami) {
        b.juni++;
    }
    else {
        c.juni++;
    }


    if (a.juni == 1)cout << a.nakami << " ";
    if (b.juni == 1)cout << b.nakami << " ";
    if (c.juni == 1)cout << c.nakami << " ";

    if (a.juni == 2)cout << a.nakami << " ";
    if (b.juni == 2)cout << b.nakami << " ";
    if (c.juni == 2)cout << c.nakami << " ";

    if (a.juni == 3)cout << a.nakami << endl;
    if (b.juni == 3)cout << b.nakami << endl;
    if (c.juni == 3)cout << c.nakami << endl;


    return 0;
}


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

using namespace std;

char s[222222];
int n, cur;

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%s",&s);
	int n = strlen(s);
	int an = 0;
	for(int i = 0; i < strlen(s); ++i){
		if (s[i] == 'S') ++cur;
		else if (cur) --cur, ++an;
		else cur = 0;
	}
	printf("%d",n - an * 2);
	return 0;
}

Measured memory_bytes: 384
n, k = map(int, input().split())
la = list(map(int, input().split()))

lm = [1] * (n + 1)
visited = [False] * (n + 1)
firstVst = [-1] * (n + 1)

cycle = n
start = k

for i in range(n):
    lm[i + 1] = la[lm[i] - 1]
    if not visited[lm[i] - 1]:
        visited[lm[i] - 1] = True
        firstVst[lm[i] - 1] = i
    else:
        cycle = i - firstVst[lm[i] - 1]
        start = min(start, firstVst[lm[i] - 1])

if cycle == n:
    start = 0
# print(cycle)
# print(start)
# print(firstVst)
# print(lm)

m = (k - start) % cycle
# print(m)

print(lm[start + m])


Measured memory_bytes: 94360
#include <iostream>
#include <cmath>
#include <iomanip>
#include <limits>
#include <string>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <list>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)

int main(){
    while(1){
    int n,x,ans=0;
    cin >> n >> x;
    if(n==0 && x==0) return 0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            if(i==j) continue;
            if(x-i-j != i && x-i-j != j && x-i-j >=1 && x-i-j <=n) ans++;
        }
    }
    cout << ans/6 << endl;
    }
}


Measured memory_bytes: 3088
n = gets.to_i
a = Array.new(n-1)
x = 1
s = 2
a.each.with_index do |e, i|
  next unless e.nil?
  while i < n-1
    a[i] = x
    i += s
  end
  x += 1
  s *= 2
end

(n-1).times do |i|
  puts a[0...n-i-1] * " "
end

Measured memory_bytes: 2044
#include<iostream>
#include<cstdio>

#include<vector>
#include<string>

#include<algorithm>
#include<cmath>

using namespace std;
typedef long long ll;
const int INF = 1e9+1;
template <class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template <class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}

int N;

int main() {
    cin >> N;
    vector<string> S(N);
    for (int i = 0; i < N; i++) cin >> S[i];

    vector<ll> A = {0,0,0,0,0};
    for (int i = 0; i < N; i++) {
        if (S[i][0] == 'M') A[0]++;
        if (S[i][0] == 'A') A[1]++;
        if (S[i][0] == 'R') A[2]++;
        if (S[i][0] == 'C') A[3]++;
        if (S[i][0] == 'H') A[4]++;
    }
    ll res = 0;
    for (int i = 0; i < 5; i++) {
        for (int j = i+1; j < 5; j++) {
            for (int k = j+1; k < 5; k++) {
                res += A[i]*A[j]*A[k];
            }
        }
    }
    cout << res << endl;
    

}


Measured memory_bytes: 6144
fun main(args: Array<String>) {
    val inStr = readLine() ?: return
    val (r, c) = inStr.split(' ').map { e -> e.toInt() }

    var columnSum = IntArray(c)

    for (i in 0 until r) {
        val line = readLine() ?: return
        val rowData = line.split(' ').map { e -> e.toInt() }.toIntArray()
        val rowSum = rowData.sum()
        println("%s %d".format(line, rowSum))

        columnSum = columnSum.zip(rowData).map { (t, e) -> t + e }.toIntArray()
    }
    println("%s %d".format(columnSum.joinToString(" "), columnSum.sum()))

}



Measured memory_bytes: 37812
#include <bits/stdc++.h>
using namespace std;
#define int long long
using namespace std;
int a[1000005];
int32_t main()
{
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++)
  {
    int x;
    cin >> x;
    a[x] = i;
  }
  int ans = 0;
  int cnt = 1;
  for (int i = 1; i < n; i++)
  {
    if (a[i] < a[i + 1])
    {
      cnt++;
    }
    else
    {
      ans = max(ans, cnt);
      cnt = 1;
    }
  }
  ans = max(ans, cnt);
  cout << n - ans << endl;
  return 0;
}


Measured memory_bytes: 5216
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <set>
#include <sstream>
#include <numeric>
#include <bitset>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <cassert>
using namespace std;

typedef long long ll;
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
bool ISINT(double x){return fabs(x-(int)x)<EPS;}
bool ISEQ(double x,double y){return fabs(x-y)<EPS;}
string itos(ll x){stringstream ss;ss<<x;return ss.str();}
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) REP(i,0,n)
#define EREP(i,a,b) for(int i=a;i<=b;i++)
#define erep(i,n) EREP(i,0,n)
#define foreach(itr,c) for(__typeof(c.begin()) itr=c.begin();itr!=c.end();itr++)

typedef pair<int,int> P;

class State{
public:
  int id,del,cost;
  State(){}
  State(int _id,int _del,int _cost){
    id = _id;
    del = _del;
    cost = _cost;
  }

  bool operator<(const State &st)const{
    return cost > st.cost;
  }
};

int n,m,c;
vector<P> t[102];
bool closed[102][102];

int main(void){
  while(scanf("%d%d%d",&n,&m,&c),n||m||c){
    rep(i,n+1) t[i].clear();
    rep(i,m){
      int a,b,c;
      scanf("%d%d%d",&a,&b,&c);
      t[a].push_back(P(b,c));
    }

    priority_queue<State> open;
    open.push(State(1,0,0));
    memset(closed,0,sizeof(closed));

    int ans = INT_MAX;

    while(!open.empty()){
      State st = open.top(); open.pop();
      if(closed[st.id][st.del]) continue;
      closed[st.id][st.del] = true;

      if(st.id == n){
        ans = min(ans,st.del);
        continue;
      }

      rep(i,t[st.id].size()){
        P e = t[st.id][i];
        if(st.cost + e.second <= c && !closed[e.first][st.del]){
          open.push(State(e.first,st.del,st.cost+e.second));
        }
        if(st.del+1 <= n && !closed[e.first][st.del+1]){
          open.push(State(e.first,st.del+1,st.cost));
        }
      }
    }

    printf("%d\n",ans);
  }
}

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

using namespace std;
using ll = long long;

#define FOR(i,a,n) for(int i=(a); i<(n); i++)
#define REP(i,n) FOR(i, 0, n)
#define FORD(i,a,n) for(int i=(a); i>=(n); i--)
#define REPD(i,n) FOR(i, n, 0)

#define ALL(o) (o).begin(), (o).end()

template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
template<class T> using PQ = priority_queue<T>;
template<class T> using PQR = priority_queue<T, vector<T>, greater<T> >;

const ll MOD = 1000000007;

int main() {
	int a,b;
	cin >> a >> b;

	if(a >= 10) {
		cout << b << endl;
		return 0;
	}
	int ans = b + 100*(10-a);
	cout << ans << endl;


	return 0;

}




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

const int N = 55, L = 18, K = 14000000;

int n, k, len, s, t, a[N], popcount[1 << L], cnt = 0, tot = 0;
pair<int, int> vec[K];
unsigned long long coef[N], c[N][N], ans = 0ull;

int lowbit (int x) {
	return x & -x;
}

int main () {
	scanf("%d%d%d%d", &n, &k, &s, &t);
	len = 0;
	if ((s & t) != s) {
		puts("0");
		return 0;
	}
	for (int i = (t ^ s); i; i ^= lowbit(i)) len++;

	for (int i = 1; i <= n; i++) {
		int x;
		scanf("%d", &x);
		if ((x & s) != s) continue;
		if ((x & t) != x) continue;
		a[cnt] = 0;
		for (int j = (t ^ s), k = 0; j; j ^= lowbit(j), k++) {
			if (x & lowbit(j)) a[cnt] |= (1 << k);
		}
		cnt++;
	}

	int U = (1 << len) - 1;
	popcount[0] = 0;
	for (int i = 1; i <= U; i++) popcount[i] = popcount[i >> 1] + (i & 1);
	for (int i = 0; i < cnt; i++) {
		int b = U ^ a[i];
		for (int j = a[i]; ; j = (j - 1) & a[i]) {
			for (int k = b; ; k = (k - 1) & b) {
				vec[tot++] = make_pair(j, a[i] | k);
				if (!k) break;
			}
			if (!j) break;
		}
	}
	for (int i = 0; i <= n; i++) coef[i] = 0ull, c[i][0] = c[i][i] = 1ull;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j < i; j++) c[i][j] = c[i - 1][j] + c[i - 1][j - 1];
	}
	sort(vec, vec + tot);
	for (int i = 0, j = 0; i < tot; i++) {
		if (i && vec[i] != vec[i - 1]) j = 0;
		j++;
		if (i == tot - 1 || vec[i] != vec[i + 1]) {
			if ((popcount[vec[i].first] + popcount[vec[i].second] + len) & 1) coef[j]--;
			else coef[j]++;
		}
	}

	for (int i = 1; i <= k; i++) {
		for (int j = i; j <= n; j++) ans += coef[j] * c[j][i];
	}
	printf("%llu\n", ans);
	return 0;
}

Measured memory_bytes: 107284
#include <bits/stdc++.h>
using namespace std ;
int main()
{
    string x , y ;
    long long a = 0 ;
    cin >> x >> y ;
    for(int i=0 ; i<x.size() ; i++){
        if(x[i] == y[i])
        a = a + 1 ;
    }
    cout << a ;

    return 0 ;
}


Measured memory_bytes: 256
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define pll pair<ll,ll>
#define pq priority_queue
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define ios ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define lb(c,x) distance(c.begin(),lower_bound(all(c),x))
#define ub(c,x) distance(c.begin(),upper_bound(all(c),x))
 
using namespace std;
 
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;}
 
const ll mod=1234567;
 
int main(){
    ll n,m;
    cin >> n >> m;
    vector<ll> c(n);
    rep(i,m){
        ll a,b;
        cin >> a >> b;
        a--; b--;
        c[a]++;
        c[b]++;
    }
    bool ok=true;
    rep(i,n){
        if(c[i]%2==1){
            ok=false;
        }
    }
    if(ok) cout << "YES" << endl;
    else cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 1024
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#define popcount __builtin_popcount
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
    int n, m; cin>>n>>m;
    int l0=1, r0=n;
    for(int i=0; i<m; i++){
        int l, r; cin>>l>>r;
        l0=max(l, l0);
        r0=min(r, r0);
    }
    cout<<max(0, r0-l0+1)<<endl;
    return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int n;
	int i,j;
	int flg;
	cin>>n;
	flg=0;
	for(i=1;i<10;i++){
		for(j=1;j<10;j++){
			if(i*j==n)	flg=1;
		}
	}
	if(flg==1)	cout<<"Yes"<<endl;
	else		cout<<"No"<<endl;
	return 0;
}
	

Measured memory_bytes: 256
#include <stdio.h>

int main(void){
  long long int a,b,c,d;
  long long int max = 0;

  scanf("%lld %lld %lld %lld", &a, &b, &c, &d);
  max = b*d;
  if(a*c>max) max=a*c;
  if(a*d>max) max=a*d;
  if(b*c>max) max=b*c;
  
  /*
  for(long long int i=a;i<=b;i++){
    for(long long int j=c;j<=d;j++){   
        if(i*j>max){
          max=i*j;
        } 
    }
  }
  */
  printf("%lld", max);
      
  return 0;
}
  

Measured memory_bytes: 1728
def ints():
  return [int(x) for x in input().split()]
def ii():
  return int(input())

N, T = ints()
dp = [[0]*T for j in range(N+1)]
F = sorted([ints() for i in range(N)])

for i in range(N):
  a, b = F[i]

  for t in range(T):
    dp[i+1][t] = max(dp[i+1][t], dp[i][t])
    nt = t+a
    if nt<T:
      dp[i+1][nt] = max(dp[i+1][nt], dp[i][t]+b)

w = max([F[i][1] + dp[i][T-1] for i in range(1, N)])
print(w)


Measured memory_bytes: 119644
#pragma GCC optimize("Ofast")
#include<cstdio>
#include<cstring>
using namespace std;
const int maxn=200010,maxm=400010;
int n,m,cnt,head[maxn];
struct edge{
    int to,next;
}edges[maxm];
bool c[maxn],sz[maxn];
char cc;
inline bool check(int p){
    bool hd;
    if(head[p]<0) return false;
    register int j;
    for(j=head[p];sz[edges[j].to];j=edges[j].next);
    if(j>=0) hd=c[edges[j].to];
    for(;j>=0;j=edges[j].next) if(!sz[edges[j].to]){
        if(c[edges[j].to]^hd) return true;
    }
    return false;
}
inline void dfs(int p){
    sz[p]=true;
    for(register int j=head[p];j>=0;j=edges[j].next) if((!sz[edges[j].to])&&(!check(edges[j].to))) dfs(edges[j].to);
}
inline void gi(int &x){
    for(cc=getchar();cc<48||cc>57;cc=getchar());
    for(x=0;cc<='9'&&cc>='0';cc=getchar()) x=x*10+(cc&15);
}
int main(){
    scanf("%d%d",&n,&m);getchar();
    for(register int i=1;i<=n;i++) c[i]=(getchar()==65);
    int xx,yy;memset(head,-1,sizeof(head));
    for(register int i=1;i<=m;i++){
        gi(xx);gi(yy);
        edges[cnt]=(edge){yy,head[xx]};
        head[xx]=cnt++;
        edges[cnt]=(edge){xx,head[yy]};
        head[yy]=cnt++;
    }
    bool flag;
    while(true){
        flag=true;
        for(register int i=1;i<=n;i++) if((!sz[i])&&(!check(i))){
            flag=false;dfs(i);
        }
        if(flag) break;
    }
    for(register int i=1;i<=n;i++) if(!sz[i]){
        printf("Yes\n");return 0;
    }
    printf("No\n");
    return 0;
}

Measured memory_bytes: 5888
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n;
    long long sum = 0;
    cin>>n;
    for (long long i = 1; i <= n;i++){
        if(i%3!=0&&i%5!=0)
            sum += i;
    }
    cout << sum;
    return 0;
}

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

using namespace std;

#define FOR(i,k,n) for(int i=(k); i<(int)(n); ++i)
#define REP(i,n) FOR(i,0,n)
#define FORIT(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
struct Point{
  double x, y, z;
  Point(double a, double b){
    x = cos(a) * cos(b);
    y = cos(a) * sin(b);
    z = sin(a);
  }
  double norm(){
    return x*x + y*y + z*z;
  }
  double abs(){
    return sqrt(norm());
  }
};
double dot(Point p, Point q){
  return p.x*q.x + p.y*q.y + p.z*q.z;
}

int main(){
  double a, b, c, d;
  const double R = 6378.1;
  while(cin >> a >> b >> c >> d && a != -1){
    a *= M_PI / 180.0;
    b *= M_PI / 180.0;
    c *= M_PI / 180.0;
    d *= M_PI / 180.0;
    Point p(a, b);
    Point q(c, d);
    double theta = acos(dot(p, q) / p.abs() / q.abs());
    printf("%.0lf\n", R * theta);
  }
  return 0;
}

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

int A[200009], F[200009];
bool C[200009];

void upd(int x, int y) {
    for(int i=x; i<=200000; i+=(i&-i)) F[i] += y;
}

int get(int x) {
    int ret = 0;
    for(int i=x; i>=1; i-=(i&-i)) ret += F[i];
    return ret;
}

int main() {
    long long ans = 0;
    int N, K; scanf("%d%d",&N,&K);
    C[K] = 1;
    for(int i=1; i<=N; i++) {
        scanf("%d", &A[i]);
        if(i > K) {
            upd(A[i-K] + 1, -1);
            if(get(A[i-K])) C[i] = 1;
            if(K - get(A[i]) - 1) C[i] = 1;
        }
        upd(A[i] + 1, +1);
        if(C[i]) ++ans;
    }
    int l = 1, c = 0;
    for(int i=1; i<=N; i++) {
        if(i >= 2 && A[i-1] > A[i]) l = i;
        if(i - l + 1 >= K && C[i]) ++c;
    }
    printf("%lld", ans - max(0, c-1));
    return 0;
}


Measured memory_bytes: 2048
n = int(input())
a = list(map(int,input().split()))

res = 1
flag = 0
prev = a[0]
for i in a:
    # 前と値が変わらない
    if prev==i:
        tmp = 0
    # 前より大きい
    elif prev<i:
        tmp = 1
    # 前より小さい
    else:
        tmp = -1

    if tmp==1:
        if flag==-1:
            flag = 0
            res += 1
        else:
            flag = tmp
    elif tmp==-1:
        if flag==1:
            flag = 0
            res += 1
        else:
            flag = tmp

    #print(i,res)
    prev = i

print(res)


Measured memory_bytes: 14224
oddStep = ['R', 'U', 'D']
evenStep = ['L', 'U', 'D']

S = input()
flag = True
for i,s in enumerate(S):
    if i % 2 != 0:
        if not s in evenStep:
            flag = False
            break
    else:
        if not s in oddStep:
            flag = False
            break

if flag:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 2940
<?php

list($a, $b) = getLineExploded(' ');


$ret = 0;
for ($i = 0; $i < 2; $i++) {
    if ($a > $b) {
        $ret += $a;
        $a--;
    } else {
        $ret += $b;
        $b--;
    }
}

println($ret);




function println($str)
{
    echo $str . "\n";
}

function sprintlnFormat($format, $str)
{
    println(sprintf($format, $str));
}

function getOneLine()
{
    $str = trim(fgets(STDIN));
    return $str;
}

function getLineExploded($delimiter = ' ')
{
    $str = getOneLine();
    $ret = explode($delimiter, $str);
    return $ret;
}

Measured memory_bytes: 4728
/*****************************
??????????????????????????????dp(?????£????????????)
?????£?????????????¬??????\???????£????????????????????????????????????????????????????????????¨??????1??\????????¬?????§????????????????????????
????????????3?????§?????°???????????¨????????£????????????n,d???10??\????????£????????§??????

???????????°???????§??????????????????£???
????????????????????????????????£????????????(x - j)???????????????????¶??????????????????£?????¨??????
*****************************/

#include <iostream>
#include <vector>

using namespace std;

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

int main(void)
{
	int n, d, x;
	cin >> n >> d >> x;
	vec<vec<int>> p(d, vec<int>(n));

	rep(i, d) rep(j, n) cin >> p[i][j];


	rep(i, d - 1) {
		//i??\??????k?????£??????i+1??\???????????????????????§???????????¨????????? dp[k]
		vec<int> dp(x + 1, 0);
		rep(j, n) {
			for (int k = p[i][j]; k <= x; k++) if (dp[k] < dp[k - p[i][j]] + p[i + 1][j]) dp[k] = dp[k - p[i][j]] + p[i + 1][j];
		}

		int p = x;
		rep(j, x + 1) if (p < dp[j] + (x - j)) p = dp[j] + (x - j);
		x = p;
	}
	cout << x << endl;
	return 0;
}

Measured memory_bytes: 3240
#include<bits/stdc++.h>
#define mod 1000000007
#define mx 10005
//#define y 3
using namespace std;
typedef  long long int ll;
#define  f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back
int ans = 0;
bool check(vector<vector<int> > &vec, vector<int> &swtch, int n, int m, vector<int>&a){
    int cnt = 0;
    f(i, m){
        cnt = 0;
        f(j, n){
            if(vec[i][j] == 1 && swtch[j] == 1)++cnt;
        }
        if(cnt % 2 != a[i])return false;
    }
    return true;
}
void solve(vector<vector<int> > &vec, vector<int> &swtch, int n, int m , vector<int> &a, int i){
    if(i == n){
        if(check(vec, swtch, n, m, a))++ans;
        return;
    }
    swtch[i] ^= 1;
    solve(vec, swtch, n, m, a, i + 1);
    swtch[i] ^= 1;
    solve(vec, swtch, n, m, a, i + 1);
}
void input(){
   int n, m; cin>> n >>m;
   vector<vector<int> > vec(m, vector<int>(n, 0));
   f(i, m){
       int k ; cin >> k;
       f(j, k){
         int x ; cin>> x;
         vec[i][x - 1] = 1;
       }
   }
   vector<int>a(m);
   f(i, m) cin>>a[i];
   vector<int>swtch(n, 0);
   solve(vec, swtch, n, m, a, 0);
   cout << ans <<endl;
}
int main(){
    input();
    return 0;
}



Measured memory_bytes: 256
import static java.util.Arrays.*;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	static void tr(Object... os) {
		System.err.println(deepToString(os));
	}

	void solve() {
		int n = sc.nextInt();
		int q = sc.nextInt();

		int[] a = new int[1024 * 1024];
		int[] b = new int[1024];

		for (int qi = 0; qi < q; qi++) {
			int pos = sc.nextInt() - 1;
			int v = sc.nextInt();
			a[pos] += v;
			int bi = pos / 1024;

			b[bi] = a[bi];
			for (int i = 0; i < 1024; i++) {
				if (a[b[bi]] < a[bi * 1024 + i]) {
					b[bi] = bi * 1024 + i;
				}
			}

			int resIndex = 0;
			for (int i = 0; i < 1024; i++) if (a[resIndex] < a[b[i]]) {
				resIndex = b[i];
			}
			System.out.println((resIndex + 1) + " " + a[resIndex]);
		}
	}

	public static void main(String[] args) throws Exception {
		new Main().run();
	}

	MyScanner sc = null;
	PrintWriter out = null;
	public void run() throws Exception {
		sc = new MyScanner(System.in);
		out = new PrintWriter(System.out);
		for (;sc.hasNext();) {
			solve();
			out.flush();
		}
		out.close();
	}

	class MyScanner {
		String line;
		BufferedReader reader;
		StringTokenizer tokenizer;

		public MyScanner(InputStream stream) {
			reader = new BufferedReader(new InputStreamReader(stream));
			tokenizer = null;
		}
		public void eat() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					line = reader.readLine();
					if (line == null) {
						tokenizer = null;
						return;
					}
					tokenizer = new StringTokenizer(line);
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
		}
		public String next() {
			eat();
			return tokenizer.nextToken();
		}
		public String nextLine() {
			try {
				return reader.readLine();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
		public boolean hasNext() {
			eat();
			return (tokenizer != null && tokenizer.hasMoreElements());
		}
		public int nextInt() {
			return Integer.parseInt(next());
		}
		public long nextLong() {
			return Long.parseLong(next());
		}
		public double nextDouble() {
			return Double.parseDouble(next());
		}
		public int[] nextIntArray(int n) {
			int[] a = new int[n];
			for (int i = 0; i < n; i++) a[i] = nextInt();
			return a;
		}
	}
}

Measured memory_bytes: 60168
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        final Scanner scanner = new Scanner(System.in);

        scanner.nextLine();

        final String[] sp = scanner.nextLine().split(" ");
        final int[] nums = Arrays.stream(sp).mapToInt(Integer::parseInt).toArray();

        int count = 0;
        for (int i = 0; i < nums.length - 2; i++) {
            int p0 = nums[i];
            int p1 = nums[i + 1];
            int p2 = nums[i + 2];

            if (Math.max(Math.max(p0, p1), p2) != p1 && Math.min(Math.min(p0, p1), p2) != p1) {
                count++;
            }
        }

        System.out.println(count);
    }
}

Measured memory_bytes: 28880