akhauriyash/Code-Regression huggingface dataset:
/* Author : tushar3105 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef pair<long long int,long long int> ii;					// Pair of integers
typedef vector<long long int> vi;                   				// Vector of integers
typedef vector<vector<long long int>> vvi;                 			// Vector of vi
typedef vector<pair<long long int, long long int>> vii;				// Vector of ii

#define pb push_back								// Push back to vectors
#define mp make_pair								// For pairs
#define ff first								// For pairs
#define ss second								// For pairs
#define all(c) (c).begin(),(c).end()						// Use in sorting
#define sz(a) ((long long int)(a).size())
#define lli long long int
#define ull unsigned long long int
#define ld long double
#define ref(i,x,y) for(long long int i=(x);i<=(y);++i)				// Loop to go forward
#define reb(i,x,y) for(long long int i=(x);i>=(y);--i)				// Loop to go backward
#define trf(c,it) for(auto it = (c).begin(); it != (c).end(); it++)		// Remember it is an iterator
#define trb(c,it) for(auto it = (c).end()-1; it != (c).begin()-1; it--)		// Remember it is an iterator
#define tc(t) long long int t; cin>>t;while(t--)				// Test cases
//fill (dist,dist+110000,pinf);							// For setting default

const long long int mod = 1e9+7;
const long long int pinf = 9223372036854775807;
const long long int ninf = -9223372036854775807;

/*-----------------------------Code begins----------------------------------*/

int main (void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
	char s[5];
	
	cin>>s;
	
	if (strcmp(s,"RRR")==0)
		cout<<3<<endl;

	if (strcmp(s,"RRS")==0)
		cout<<2<<endl;

	if (strcmp(s,"RSR")==0)
		cout<<1<<endl;

	if (strcmp(s,"RSS")==0)
		cout<<1<<endl;

	if (strcmp(s,"SRR")==0)
		cout<<2<<endl;

	if (strcmp(s,"SRS")==0)
		cout<<1<<endl;

	if (strcmp(s,"SSR")==0)
		cout<<1<<endl;

	if (strcmp(s,"SSS")==0)
		cout<<0<<endl;

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#include <cstdio>
#include<stdio.h>
#include<string.h>

unsigned long long lucas(unsigned long long);

int main(void){
    unsigned long long n, ans;
    scanf("%llu", &n);
    if(n==1){
        printf("1");
        return 0;
    }
        ans = lucas(n);
        printf("%llu\n", ans);
        return 0;
}

unsigned long long lucas(unsigned long long n){
    unsigned long long l = 2, r = 1, temp, ans;
    while(n>1){
            ans = l + r;
            temp = r;
            r = ans;
            l = temp;
            n--;
    }
    return ans;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int main() {
	int r,c,g[123][123],sr[123],sc[123],s=0;
	cin>>r>>c;
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			cin>>g[i][j];
			s+=g[i][j];
		}
	}
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			sr[i]+=g[i][j];
		}
	}
	for(int i=0;i<c;i++){
		for(int j=0;j<r;j++){
			sc[i]+=g[j][i];
		}
	}
	for(int i=0;i<r;i++){
		for(int j=0;j<c;j++){
			cout<<g[i][j]<<" ";
		}
		cout<<sr[i]<<endl;
	}
	for(int j=0;j<c;j++){
			cout<<sc[j]<<" ";
	}
	cout<<s<<endl;
}



Measured memory_bytes: 3128
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;

static const int INF=1e9;
typedef long long ll;
typedef pair<int,int> P;

int main(){
   int a,b,c;
   cin >> a >> b >> c;
   int ans=min(a+b,min(a+c,b+c));
   cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define m1(x) memset(x,-1,sizeof(x))
const int INF = 1e9 + 1;
const ll MOD = 1e9 + 7;
const double PI = 3.141592653589793;

int main(){
  int n, m;
  cin >> n >> m;
  bool loved[30];
  fill(loved, loved + 30, true);
  rep(i, n){
    int k;
    cin >> k;
    bool checked[30];
    fill(checked, checked + 30, false);
    rep(i, k){
      int a;
      cin >> a;
      checked[a-1] = true;
    }
    rep(i, m){
      if(!checked[i]) loved[i] = false;
    }
  }
  cout <<  count(loved, loved + m, true) <<endl;;
}
  

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define ALL(A) A.begin(), A.end()

using namespace std;

typedef long long ll;
typedef pair<int, int> P;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	int n = s.length();
	stack<char> S;
	
	rep (i, n){
		if (s[i] != 'B') S.push(s[i]);
		else
		if (!S.empty()) S.pop();
	} // end rep

	string res = "";
	while(!S.empty()){
		res += S.top(); S.pop();
	} // end while
	reverse(ALL(res));

	cout << res << endl;

	return 0;
}

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

using namespace std;

typedef int itn;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef map<int, int> M;
typedef pair<int, int> P;
typedef stack<int> S;
typedef queue<int> Q;

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int a, b;
    cin >> a >> b;
    string s;
    cin >> s;
    bool f = true;
    for (itn i = 0; i < (int)s.size(); ++i)
    {
        if (i == a) f = (s[i] != '-')?false:f;
        else if ((s[i] < '0') || (s[i] > '9')) f = false;
    }
    if (f) cout << "Yes" << endl;
    else cout<< "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
N=int(input())
MAXN=1005
MAXV=N*(N-1)//2

a=[[0 for j in range(N-1)] for i in range(N)]
for i in range(N):
  line=list(map(int,input().split()))
  for j in range(N-1):
    a[i][j]=line[j]-1

id=[[0 for j in range(MAXN)] for i in range(MAXN)]
v=0
for i in range(N-1):
  for j in range(i+1,N):
    id[i][j]=v
    v+=1

def toId(i,j):
  if i>j:
    i,j=j,i
  return id[i][j]

to=[[] for i in range(MAXV)]
inner=[0 for i in range(MAXV)]
for i in range(N):
  for j in range(N-1):
    a[i][j]=toId(i,a[i][j])
  for j in range(N-2):
    to[a[i][j]].append(a[i][j+1])
    inner[a[i][j+1]]+=1

ans=0
stack=[]
isstarted=[False for i in range(v)]
dist=[0 for i in range(v)]
for i in range(v):
  if inner[i]==0:
    stack.append([i,1])

while stack:
  node=stack.pop()
  e=node[0]
  d=node[1]
  if d>dist[e]:
    dist[e]=d
  else:
    d=dist[e]
  if dist[e]>ans:
    ans=dist[e]
  inner[e]-=1
  if inner[e]<=0 and not isstarted[e]:
    isstarted[e]=True
    children=to[e]
    for child in children:
      stack.append([child,d+1])
for i in range(len(isstarted)):
  if not isstarted[i]:
    print(-1)
    break
else:
  print(ans)


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

namespace ABC127
{
    class C
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToArray();
            int N = a[0], M = a[1];
            List<int> llist = new List<int>();
            List<int> rlist = new List<int>();
            for (int i = 0; i < M; i++)
            {
                int[] b = Console.ReadLine().Split(' ').Select(t => int.Parse(t)).ToArray();
                llist.Add(b[0]); rlist.Add(b[1]); 
            }
            int max = llist.Max();
            int min = rlist.Min();
            int r = min - max+1; if (r < 0) r = 0;
            Console.WriteLine(r);

        }

    }
}


Measured memory_bytes: 19272
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=sc.nextInt();
		int cnt=0;
		int[] nums =new int[4];
		String[] colors= {"P","W","G","Y"};

		for(int i=0; i<n;i++) {
			String s=sc.next();
			for(int j=0; j<4;j++) {
				if(s.equals(colors[j])) {
					nums[j]+=1;
				}
			}
		}

		for(int nu : nums) {
			if(nu>0) {
				cnt++;
			}
		}
		if(cnt==4) {
			System.out.println("Four");
		}else {
			System.out.println("Three");
		}

	}
}

Measured memory_bytes: 23764
//#pragma GCC optimize("O3")
//#pragma GCC target("avx2")
// 293206GT
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <unordered_set>
#include <stack>
#include <string>
#include<algorithm>
#include <random>
#include <bitset>
#include <chrono>

typedef long long ll;

using namespace std;
#define put(a) cout << (a) << '\n'
#define sqr(x) (x) * (x)
typedef pair<ll, ll> pii;
typedef long double ld;
#define double long double
typedef pair<ld, ld> pld;
#define rep(x, y, a) for (int x = (y); x < (int)(a); ++x)
#define all(a) a.begin(), a.end()
#define chkmax(a, b) a = max(a, (b))
#define chkmin(a, b) a = min(a, (b))
#define prev asasdasd
#define next aasdasda
#define left asdasdasdasd
#define right asnabsdkasdl
#define rank asdasdknlasd
#define move asdasdas

typedef vector<ll> vi;
typedef vector<pii> vpii;
namespace IO {
    template<class A, class B>
    ostream &operator<<(ostream &out, pair<A, B> &a) {
        out << a.first << " " << a.second;
        return out;
    }

    template<class A, class B>
    ostream &operator<<(ostream &out, vector<pair<A, B>> &a) {
        for (pair<A, B> x: a)
            out << x.first << " " << x.second << '\n';
    }

    template<class A>
    ostream &operator<<(ostream &out, vector<A> &a) {
        for (A x: a) out << x << ' ';
        return out;
    }

    template<class A, class B>
    istream &operator>>(istream &in, pair<A, B> &a) {
        in >> a.first >> a.second;
        return in;
    }

    template<class A>
    istream &operator>>(istream &in, vector<A> &a) {
        for (A &x: a) in >> x;
        return in;
    }
}
using namespace IO;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define int ll

void solve() {
    int h1, m1, h2, m2, k;
    cin >> h1 >> m1 >> h2 >> m2 >> k;
    put((h2-h1)*60+m2-m1-k);
}


signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(30);
//    freopen("input.txt", "r", stdin);
//    freopen("input.txt", "r", stdin);
    int q = 1;
//    cin >> q;
    while (q--) solve();
}



Measured memory_bytes: 3200
#include<iostream>
#include <cmath>
using namespace std;
int main(){
  int D,N,powD,ans;
  cin >> D >> N;
  powD = pow(100, D);
  if(N != 100)
  ans = powD*N;
  else
    ans = powD*(101);
  cout << ans << "\n";
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define mod 1000000007
void solve()
{
  ll n;
  cin>>n;
  ll g=1ll<<n;
  ll a[n+1][n+1];
  for(int x=0;x<n;x++)
  for(int y=0;y<n;y++)
  cin>>a[x][y];
  ll dp[g]={0};
  for(ll x=0;x<g;x++)
  {   vector<ll> ae;
      for(int y=0;y<n;y++)
      {
          if(x&(1ll<<y))
            ae.push_back(y);
      }
      for(int i=0;i<ae.size();i++)
      for(int y=i+1;y<ae.size();y++)
          dp[x]+=a[ae[i]][ae[y]];
    dp[x]=max(dp[x],0ll);
  }
  for(ll x=0;x<g;x++)
  {   vector<ll> ae;
      for(int y=0;y<n;y++)
      {
          if(x&(1ll<<y))
            ae.push_back(y);
      }
      ll r=1ll<<((ll)ae.size());
      for(ll i=0;i<r;i++)
      {
          ll w=0;
          ll e=0;
          for(ll t=0;t<ae.size();t++)
          {
              if(i&(1ll<<t))
                w|=(1ll<<ae[t]);
            else
                e|=(1ll<<ae[t]);
          }
          dp[x]=max(dp[x],dp[w]+dp[e]);
      }
  }
  cout<<dp[g-1];
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
}


Measured memory_bytes: 768
import itertools
s = input()
n = len(s)
ans = 0
for b in itertools.product([0, 1], repeat=n-1):
    array = [s[0]]
    for i, c in enumerate(s[1:]):
        array.append(b[i] * "+")
        array.append(c)
    ans += sum(map(int, "".join(array).split("+")))
print(ans)


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

int main(void){
    // Your code here!
    int r,g,b;
    cin >> r >> g >> b;
    if((r *100 +  g * 10 +  b)%4){
        cout << "NO" << endl;
    }else{
        cout << "YES" << endl;
    }
    
}


Measured memory_bytes: 256
use proconio::input;

fn main() {
	input!(n: usize);
	input!(k: usize);
	input!(p: [usize; n]);

	let mut p = p;
	p.sort();
	let mut ans = 0;
	for i in 0..k {
		ans += p[i];
	}
	println!("{}", ans);
}



Measured memory_bytes: 2164
#include<iostream>
#include<cstring>
#include<string>
#include <bitset>
#include <type_traits>
#include <string>
#include <climits>
#include <cmath>
#include <vector>


using namespace std;

// long long func(long long a, long long b, long long c){ 
//     long long ret = 0;
//     a %= c; 
//     while (b) { 
//         if (b & 1){
//         	ret = (ret + a) % c; 
//         }  
//         a = (2 * a)%c; 
//         b >>= 1;
//     } 
//     return ret; 
// } 

int main(){
	#ifndef ONLINE_JUDGE
	    // for getting input from input.txt
	    freopen("input.txt", "r", stdin);
	    // for writing output to output.txt
	    freopen("output.txt", "w", stdout);
	#endif

	string stro;

	cin >> stro;

	if(stro.back()=='s'){
		stro += "es";
	} else{
		stro += "s";
	}
	cout << stro << endl;
	return 0;
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<math.h>
int main()
{
	int n,a[1000];
	double average;
	while(1)
	{
		scanf("%d",&n);
		if(n==0) break;
		int sum=0;
		for(int i=0;i<n;i++)
		  {
		  	 scanf("%d",&a[i]);
	        sum=sum+a[i];
			average=1.0*sum/n;
		  }
		  
		  double sum2=0.0;
	 for(int i=0;i<n;i++)
	  {
	  	sum2=sum2+(average-a[i])*(average-a[i]);
	  }
	  printf("%lf\n",sqrt(sum2/n));
	}
	
}

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

int main() {
  vector<int> A(101);
  rep(i, 9) {
    int a;
    cin >> a;
    A[a] = i + 1;
  }

  int n;
  cin >> n;
  vector<int> cnt(10);
  rep(i, n) {
    int b;
    cin >> b;
    cnt[A[b]]++;
  }

  if(cnt[1] + cnt[2] + cnt[3] == 3 || cnt[4] + cnt[5] + cnt[6] == 3 ||
     cnt[7] + cnt[8] + cnt[9] == 3 || cnt[1] + cnt[4] + cnt[7] == 3 ||
     cnt[2] + cnt[5] + cnt[8] == 3 || cnt[3] + cnt[6] + cnt[9] == 3 ||
     cnt[1] + cnt[5] + cnt[9] == 3 || cnt[3] + cnt[5] + cnt[7] == 3)
    cout << "Yes";
  else
    cout << "No";
}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define fr first
#define sc second
#define ll long long
#define mp make_pair
#define ii pair<ll,ll>
using namespace std;
int main()
{
 int n;
 cin>>n;
 map < string , int > my;
 ll ans = 0;
 for(int i=0;i<n;i++)
 {
     string s;
     cin>>s;
     vector<char>v;
     for(int j=0;j<10;j++)
        v.push_back(s[j]);
     sort(v.begin(),v.end());
     for(int j=0;j<10;j++)
        s[j] = v[j];
     ans+=my[s];
     my[s]++;
 }
 cout<<ans<<endl;
}


Measured memory_bytes: 11136
N = int(input())
train_list = [tuple(map(int, input().split())) for _ in range(N - 1)]

for i in range(N - 1):
    t = 0
    for j in range(i, N - 1):
        if t < train_list[j][1]:
            t = train_list[j][1]
        elif t % train_list[j][2] == 0:
            pass
        else:
            t = t + train_list[j][2] - t % train_list[j][2]
        t += train_list[j][0]
    print(t)
print(0)


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

int main()
{
    double a[11]= {0};
    while(cin >> a[1])
    {
        double sum=a[1];
        for(int i=2;i<=10;i++)
        {
            if(i%2 == 1)
            {
                a[i] = a[i-1]/3;
                sum += a[i];
            }
            else
            {
                a[i] = a[i-1]*2;
                sum += a[i];
            }
        }
    printf("%.8f\n",sum);
    }

    return 0;
}

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

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    long x;
    scan(x);

    long t;
    while (t * (t + 1) / 2 < x) t++;

    writeln(t);
}



void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#define rep(i,n) for(int i=0; i<n; i++)
typedef long long ll;
typedef pair<int,int> P;
const ll MOD = (int)1e9+7;
const ll INF = MOD*MOD;
const ll powll = 1LL<<1;

int main(void){
  ll n,m;
  cin >> n >> m;
  ll ama = max(0LL, m-2*n);
  cout << min(n,m/2) + ama/4 << "\n";
}

Measured memory_bytes: 256
x,y,z,k = gets.split.map(&:to_i)
as = gets.split.map(&:to_i)
bs = gets.split.map(&:to_i)
cs = gets.split.map(&:to_i)

tmp = []

as.each do |a|
  bs.each do |b|
    tmp << a+b
  end
end

tmp.sort!.reverse!
tmp = tmp.first(k)
cs.sort!.reverse!

tmp2 = []
cs.each do |c|
  tmp.each do |t|
    tmp2 << c + t
  end
end

tmp2.sort!.reverse!

k.times do |i|
  puts tmp2[i]
end


Measured memory_bytes: 70124
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  y = NULL; //xの親
  x = root; //Tの根
  while(x != NULL){
    y = x; //親を設定
    if(z->key < x->key) x = x->left; //左の子へ移動
    else x = x->right; //右の子へ移動
  }

  z->parent = y;

  if(y == NULL) root = z; //Tが空の場合
  else if(z->key < y->key) y->left = z; //zをyの左の子にする
  else y->right = z; //zをyの右の子にする

}

Node treeSearch(Node u, int k){
  while(u != NULL) {
    if(k == u->key) return 0;
    else if(k <= u->key){
      u = u->left;
    } else {
      u = u->right;
    }
  }
  return -1;
}

void inorder(Node x){
  if(x!= NIL){
    inorder(x->left);
    printf(" %d",x->key);
    inorder(x->right);
}
}
void preorder(Node x){
  if(x!= NIL){
    printf(" %d",x->key);
    preorder(x->left);
    preorder(x->right);
  }
}

int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      x = treeSearch(root, x);
      if (x  == 0 ) printf("yes\n");
      else printf("no\n");
    } if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 19364
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		int[] f = new int[N + 1];
		for(long x=1;x * x<=N;x++){
			for(long y=1;y * y<=N;y++){
				for(long z=1;z * z<=N;z++){
					long v = x * x + y * y + z * z + x * y + y * z + z * x;
					if(v <= N){
						f[v]++;
					}
				}
			}
		}
		Console.WriteLine(String.Join("\n",f.Skip(1)));
		
	}
	long N;
	public Sol(){
		N = ri();
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(char sep=' '){return Console.ReadLine().Split(sep);}
	static int[] ria(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>int.Parse(e));}
	static long[] rla(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>long.Parse(e));}
	static double[] rda(char sep=' '){return Array.ConvertAll(Console.ReadLine().Split(sep),e=>double.Parse(e));}
}


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

void get_winner(int N, int K, int *A){
    bool dp[K+1];
    dp[0] = 0;
    for (int p=1; p<=K; p++)
	    dp[p]=0;
    for(int i=1; i<=K; i++){
        for(int j=0; j<N; j++){
	    if (A[j] <= i && dp[i-A[j]]==0){
	    dp[i] = 1;
	    }
        }
    }
    if (dp[K]){
	    cout << "First" << endl;
    }
    else{
	    cout << "Second" << endl;
	}

}

int main()
{
    int N, K;
    cin >> N >> K;
    int A[K];
    for(int i=0; i < K; i++)
        cin >> A[i];
    /*for(int i=0; i<N; i++)
        cout << P[i] << " ";
    cout << endl;
    */
    get_winner(N, K, A);
    return 0;
}



Measured memory_bytes: 384
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <deque>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <chrono>
#include <random>
#include <time.h>
#include <fstream>
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep3(i,a,b) for(ll i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb emplace_back
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define all(c) begin(c),end(c)
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
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;}
void print(vec v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vecll v){for(auto e:v)cout<<e<<" ";cout<<endl;}
void print(vector<vec> v){for(auto e:v){for(auto ee:e)cout<<ee<<" ";cout<<endl;}}
void print(map<int,int> mp){for(auto e:mp)cout<<e.first<<" "<<e.second<<endl;cout<<endl;}
const int INF=1e6;
const ll int MOD=998244353;

main(){
    ll n=lin();
    ll a=lin(),b=lin();
    if((b-a)%2){
        ll t=a+(b-a-1)/2;
        ll s=(n-b+1)+(n-(a+(n-b+1)))/2;
        cout<<min(t,s);
    }
    else{
        cout<<(b-a)/2;
    }
}

Measured memory_bytes: 256
n, k = map(int, input().split())
count = 0
lis = []

for m in range(0, k):
  d = int(input())
  li = [int(i) for i in input().split()]
  lis = lis + li
  
for s in range(1, n+1):
  if s in lis:
    count += 0
  else:
    count += 1

print(count)

Measured memory_bytes: 9172
-- I love math
import Control.Applicative
 
main :: IO ()
main = do
    -- 整数の入力
    -- a <- readLn
    -- スペース区切り整数の入力
    [b, c] <- map read . words <$> getLine
    -- 文字列の入力
    -- s <- getLine
    -- 出力
    putStrLn $ show (b + (div c 2)) 

Measured memory_bytes: 508
def pushBack(x):
	A.append(x)


def randomAccess(p):
	print(A[p])


def popBack():
	A.pop()


q = int(input())
A = []
for _ in range(q):
	tmp = input()
	if tmp=='2':
		popBack()
	else:
		a, b = map(int, tmp.split())
		if a==0:
			pushBack(b)
		else:
			randomAccess(b)



Measured memory_bytes: 13356
import java.util.Scanner;
 
//Railway Lines
public class Main{
 
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while(sc.hasNext()){
            String[] s = sc.next().split(",");
            int[] a = new int[11];
            int sum = 0;
            for(int i=0;i<10;i++){
                a[i]=Integer.parseInt(s[i]);
                sum += a[i];
            }
            double v1 = Double.parseDouble(s[10]);
            double v2 = Double.parseDouble(s[11]);
            int d = 0;
            for(int i=0;i<10;i++){
                d += a[i];
                double t = d/v1;
                if(d + t*v2 >= sum){
                    System.out.println(i+1);
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 26096
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <algorithm>

using namespace std;
typedef char CHAR;
typedef unsigned char UCHAR;
typedef short SHORT;
typedef unsigned short USHORT;
typedef int INT;
typedef unsigned int UINT;
typedef long long LLONG;
typedef unsigned long long ULLONG;

#define LengthOf(x)    (sizeof(x) / sizeof(x[0]))

#if 1
//No.1
int main()
{
	INT S, W;
	cin >> S >> W;

	if (W >= S) { cout << "unsafe"; }
	else {
		cout << "safe";
	}
	return 0;
}
#endif


Measured memory_bytes: 3636
#include <stdio.h>
int main (void){
int min,max,n,v,a[10000];
long long int sun=0;
scanf ("%d",&n);

for (v=0; v<n;v++){
scanf ("%d",&a[v]);
}

max=a[0];
v=1;
while(1){
        if(v==n)break;
    if(max<a[v]){
        max=a[v];
    }
v++;
}
min=a[0];
v=1;
while(1){
        if(v==n)break;
    if(min>a[v]){
        min=a[v];
    }
v++;
}
v=0;
while(1){
        if(v==n)break;

        sun+=a[v];

v++;
}

printf("%d %d %lld\n",min,max,sun);



return 0;
}

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


int N, W;
vector<vector<long long>> map1(101, vector<long long>(100001, 0));


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

  cin >> N >> W;
  vector<pair<int, int>> goods(101);
  for(int i = 1; i <= N; i++){
    int a, b;
    cin >> a >> b;
    pair<int, int> p = make_pair(a, b);
    goods.at(i) = p;
  }

  for(int i = N - 1; i >= 0; i--){
    for(int j = 0; j <= W; j++){
      if(j - goods.at(i + 1).first >= 0){
        map1.at(i).at(j) = max(map1.at(i + 1).at(j), map1.at(i + 1).at(j - goods.at(i + 1).first) + goods.at(i + 1).second);
      } else{
        map1.at(i).at(j) = map1.at(i + 1).at(j);
      }
    }
  }

  cout << map1.at(0).at(W) <<endl;
}

Measured memory_bytes: 80256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> P;

const int dx[] = {-1, 1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const char kind[] = {'#', '@', '*'};


int INF = 1 << 10;

vector<string> field(101);

void display(int h, int w){
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      cout << field[i][j] << " ";
    }
    cout << endl;
  }
  cout << endl;
}

void dfs(int h, int w, char c, P s){
  field[s.first][s.second] = '.';
  for(int i = 0; i < 4; i++){
    int nx = s.second + dx[i], ny = s.first + dy[i];
    if(0 <= nx && nx < w && 0 <= ny && ny < h && field[ny][nx] == c){
      dfs(h, w, c, P(ny, nx));
    }
  }
}

P getStart(int h, int w, char c){
  bool flag = false;
  P res(INF, INF);
  for(int i = 0; i < h; i++){
    for(int j = 0; j < w; j++){
      if(field[i][j] == c){
        res.first = i;
        res.second = j;
        flag = true;
        break;
      }
    }
    if(flag) break;
  }
  return res;
}

int main(){
  int h, w;

  while(1){
    cin >> h >> w;
    if(h == 0 && w == 0) break;
    
    for(int i = 0; i < h; i++){
      cin >> field[i];
    }

    int ans = 0;
    for(int i = 0; i < 3; i++){
      char c = kind[i];
      while(1){
        P s = getStart(h, w, c);
        if(s == P(INF, INF)) break;
        dfs(h, w, c, s);
        ans++;
      }
    }

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

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

enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;



void main() {
    string s;
    scan(s);

    int N = s.length.to!int;

    foreach (l ; 0 .. N) {
        foreach (r ; l .. N + 1) {
            auto t = s[0 .. l] ~ s[r .. N];
            if (t == "keyence") {
                writeln("YES");
                return;
            }
        }
    }

    writeln("NO");
}






void scan(T...)(ref T args) {
    auto line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront;
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x > arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;
    foreach (arg; args) if (x < arg) {
        x = arg;
        isChanged = true;
    }
    return isChanged;
}

void yes(bool ok, string y = "Yes", string n = "No") {
    return writeln(ok ? y : n);
}


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

using namespace std;


int main(){
    double x1,y1,x2,y2;
    cin >> x1 >> y1 >> x2 >> y2;
    double a = sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
    printf("%.8f\n",a);
    
}


Measured memory_bytes: 3216
#include <bits/stdc++.h>
#include <list>
using namespace std;
 
#define REP(i,n) for(int i=0;i<(n);++i)
#define ll long long
const long long INF = 1LL<<60;
const long long mod = 100000007;
using Graph = vector<vector<int>>;


int main(){
    string S;
    cin >> S;
    int N = S.size();
    bool p = true;
    REP(i,N/2) if(S[i]!=S[N-i-1]) p = false;
    REP(i,N/4) if(S[i]!=S[N/2-i-1]) p = false;
    for(int i = N/2 + 1; i < N; ++i){
        if(S[i]!=S[N-i-1]) p = false;
    } 
    if(p) cout << "Yes" << endl;
    else cout << "No" << endl;
}

Measured memory_bytes: 3588
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
        }

        public void Solve(ConsoleInput cin)
        {
            var K = cin.ReadInt;
            var N = cin.ReadInt;
            var A = new int[N];

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

            var max = 0;

            for (int i = 0; i < N; i++)
            {
                int d;
                if (i == N-1)
                {
                    d = K + A[0] - A[i];
                }
                else 
                {
                    d = A[i + 1] - A[i];
                }

                if (d > max) max = d;
            }

            WriteLine(K - max);
        }

        public void Display(int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0}", txt);
        }

        public void Display(int index,int[] array)
        {
            var txt = "";
            foreach (var item in array)
            {
                txt += " " + item.ToString();
            }
            WriteLine("{0} : {1}", index,txt);
        }

        public void Display(List<int>[] list) 
        {
            for (int i = 0; i < list.Length; i++)
            {
                Display(i, list[i].ToArray());
            }
        }
    }

    public class ConsoleInput
    {
        private readonly System.IO.TextReader _stream;
        private char _separator = ' ';
        private Queue<string> inputStream;
        public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
        {
            this._separator = separator;
            this._stream = stream;
            inputStream = new Queue<string>();
        }

        public string Read
        {
            get
            {
                if (inputStream.Count != 0) return inputStream.Dequeue();
                string[] tmp = _stream.ReadLine().Split(_separator);
                for (int i = 0; i < tmp.Length; i++)
                    inputStream.Enqueue(tmp[i]);
                return inputStream.Dequeue();
            }
        }

        public string ReadLine { get { return _stream.ReadLine(); } }
        public int ReadInt { get { return int.Parse(Read); } }
        public long ReadLong { get { return long.Parse(Read); } }
        public double ReadDouble { get { return double.Parse(Read); } }
        public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
        public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
        public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
    }
}


Measured memory_bytes: 47096
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
const LL INF = 1LL << 60;
string s;

int main() {
	cin >> s;
	bool flg = 0;
	int l = s.length();
	for(int i = 0; i < l; i++) {
		if(s[i] == '7') {
			flg = 1;
			break;
		}
	}
	if(flg) puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <stdio.h>

using namespace std;

int main()
{
    int M1, M2, D1, D2;

    cin >> M1 >> D1;
    cin >> M2 >> D2;

    if(M1 == (M2 - 1)) cout << "1" << endl;
    else cout << "0" << endl;

    return 0;
}

Measured memory_bytes: 256
if __name__ == "__main__":
    N = int(input())
    A = list(map(int, input().split()))
    
    odd_is_even = True
    for Ai in A:
        if Ai % 2 == 1:
            odd_is_even = not odd_is_even
    
    if odd_is_even:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 14108
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define f first
#define s second
#define go ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
/*bool sortbysec(const pair<int,int> &a,
              const pair<int,int> &b)
{
    return (a.second < b.second);
} */
map<ll,ll>mp;
int main()
{
    ll arr[5][5],n,a;
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            cin>>arr[i][j];
        }
    }
    cin>>n;
    while(n--)
    {
        cin>>a;
        mp[a]++;
    }
    ll cnt=0,arr1[10],arr2[10];
    for(int i=0;i<10;i++)
        arr1[i]=0,arr2[i]=0;
    for(int i=0;i<3;i++)
    {
        for(int j=0;j<3;j++)
        {
            if(i==j)
            {
                if(mp[arr[i][j]]!=0)
                    cnt++;
            }
            if(mp[arr[i][j]]!=0)
            {
                arr1[i]++;
                arr2[j]++;
            }
        }
    }
    if(cnt==3)
        cout<<"Yes"<<endl;
    else if(mp[arr[0][2]]==1 && mp[arr[0][2]]==mp[arr[1][1]] && mp[arr[0][2]]== mp[arr[2][0]])
        cout<<"Yes"<<endl;
    else
    {
        ll pk=0;
    for(int i=0;i<3;i++)
    {
        if(arr1[i]==3 ||arr2[i]==3)
        {
            cout<<"Yes"<<endl;
            pk=10;
        }
    }
    if(pk==0)
        cout<<"No"<<endl;
    }
}



Measured memory_bytes: 256
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define repr(i, n) for(int i = n; i >= 0; i--)
#define srep(i) for(int i = 0; i < s.size(); i++)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 1e9
#define PI 3.14159265358979
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[] = {0, 0, 1, -1, 0};
int dx[] = {1, -1, 0, 0, 0};

int N, W, A, B, K;
int a[100005];
int h[100005];
int weight[105] = {}, value[105] = {};
ll dp[100000005];
int in = 0;
int cnt = 0;

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;
}

ll all_search(int i) {
    ll res = INF;
    if(i + 1 == N) {
        return 0;
    }

    for(int k = 1; k <= K; k++) {
        if(i + k == N) {
            return all_search(i + k - 1) + abs(h[i] - h[i + k - 1]);
        } else {
            res = min(res, all_search(i + k) + abs(h[i] - h[i + k]));
        }
    }
    return res;
}

ll dp_recursive(int i) {
    ll res = INF;
    if(dp[i] >= 0) {
        return dp[i];
    }

    if(i + 1 == N) {
        return 0;
    }

    for(int k = 1; k <= K; k++) {
        if(i + k == N) {
            return dp[i] = dp_recursive(i + k - 1) + abs(h[i] - h[i + k - 1]);
        } else {
            res = min(res, dp_recursive(i + k) + abs(h[i] - h[i + k]));
        }
    }
    return dp[i] = res;
}

ll dp_for(int n, int k) {
    for(int i = 0; i < N; i++)
        dp[i] = INF;
    dp[0] = 0;

    for(int i = 0; i < n; i++) {
        for(int j = 1; j <= k; j++) {
            chmin(dp[i + j], dp[i] + abs(h[i] - h[i + j]));
        }
    }
    return dp[n - 1];
}

int main() {
    cin >> N >> K;
    rep(i, N) cin >> h[i];
    memset(dp, -1, sizeof(dp));
    cout << dp_recursive(0) << endl;
}


Measured memory_bytes: 786560
#include <iostream>
#include <string>

int main(){

	long long int N,A,B;

	std::cin >> N >> A >> B;

	long long int count = N/(A+B)*A;
	long long int dis = N%(A+B);
	if(dis>=A){
		count += A;
	}else{
		count += dis;
	}
	std::cout << count;
	return 0;
}


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

const int MAXN = 1001;
const int MAXH = 10001;
const ll INF = 100000000000ll;

int H, N, v[MAXN], c[MAXN];
ll DP[MAXH][MAXN];
bool vis[MAXH][MAXN];

ll dp(int w, int id) {
	if (w <= 0) return 0;
	if (id < 0) return INF;
	if (vis[w][id]) return DP[w][id];
	vis[w][id] = true;
	DP[w][id] = min(dp(w, id-1), dp(w -c[id], id) + v[id]);
	return DP[w][id];
}

int main(){
	ios::sync_with_stdio(0),cin.tie(0);
	while (cin >> H >> N) {
		memset(vis, 0, sizeof(vis));
		for (int i = 0; i < N; ++i) {
			cin >> c[i] >> v[i];
		}
		cout << dp(H, N-1) << '\n';
	}
	return 0;
}


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

int main(){
  int n,a;
  cin >> n;
  vector<int> A;
  for(int i=0;i<n;i++){
    cin >> a;
    A.push_back(a);
  }
  sort(A.begin(),A.end());
  for(int i=0;i<n-1;i++){
    if(A[i]==A[i+1]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
}

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

using namespace std;

int main() {
   int N, T;
   cin >> N >> T;
   vector<pair<int, int>> road(N);
   for(int i = 0; i < N; i++) cin >> road.at(i).first >> road.at(i).second;

   int min_cost = 1001;
   for(int i = 0; i < N; i++){
       if(road.at(i).second <= T){
           min_cost = min(min_cost, road.at(i).first);
       }
   }

   if(min_cost == 1001) puts("TLE");
   else cout << min_cost << endl;

}

Measured memory_bytes: 256
import java.util.*;
import java.io.PrintWriter;
import static java.lang.Integer.*;
import static java.lang.Long.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static int MOD = 1000000007;
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		for (i = 1; i <= 3; i++) {
			if(a!=i && b!=i) {
				out.println(i);
			}
		}
	}
}


Measured memory_bytes: 21844
import java.util.*;
import static java.lang.Integer.*;
//import static java.lang.Long.*;
//import static java.lang.Math.*;
import static java.lang.Math.*;
import static java.lang.System.*;

public class Main {
	public static void main(String[] args) {
		int i,j;
		Scanner sc = new Scanner(in);
		int a = parseInt(sc.next());
		int b = parseInt(sc.next());
		sc.close();
		int n = b-a;
		out.println(n*(n-1)/2-a);
	}
}


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

int main() {
  int N;
  int a = 0;
  cin >> N;
  for(int i = 0; i < N; i++){
    int l_i,r_i;
    cin >> l_i >> r_i;
    a += r_i-l_i+1;
  }
  cout << a << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[100005];
int main(){
	std::ios::sync_with_stdio(false);
	int n;
	cin>>n;
	long long sum=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=2;i<=n;i+=2){
		sum-=2*a[i];
	}
	cout<<sum<<" ";
	for(int i=1;i<n;i++){
		sum=2*a[i]-sum;
		cout<<sum<<" ";
	}
} 

Measured memory_bytes: 1664
#include <iostream>
#include <string>
using namespace std;
int main() {
 int a=800;
 int b=200;
 int N;
 cin>>N;
 
 int x=a*N;
 int y=(N/15)*b;
 
 cout << x-y <<endl;
 
 
 
 
 
 	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <set>
#include <sstream>
#include <bitset>
#include <stack>
#include <cstdlib>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

typedef long long ll;

using namespace std;

int main() {
    
    int n;
    cin >> n;
    vector<string> s(n);
    FOR(i, 0, n){
        cin >> s[i];
    }
    
    int m;
    cin >> m;
    vector<string> t(m);
    FOR(i, 0, m){
        cin >> t[i];
    }
    
    vector<int> cnt(n);
    FOR(i, 0, n){
        FOR(j, 0, n){
            if(s[i] == s[j]){
                cnt[i]++;
            }
        }
        FOR(j, 0, m){
            if(s[i] == t[j]){
                cnt[i]--;
            }
        }
    }
    
    int tmp=0;
    FOR(i, 0, n){
        if(cnt[i]<=0){
            tmp++;
        }
    }
    if(tmp == n){
        cout << "0" << endl;
    }else{
        cout << *max_element(cnt.begin(),cnt.end()) << endl;
    }
    
    
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<long long int> arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
    }
    long long int tc=0;
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            for(int k=j+1;k<n;k++){
                long long int a=arr[i]+arr[j];
                long long int b=arr[j]+arr[k];
                long long int c=arr[i]+arr[k];
                if(arr[i]!=arr[j] && arr[j]!=arr[k] && arr[i]!=arr[k]){
                    if(a>arr[k] && b>arr[i] && c>arr[j]){
                        tc++;
                    }
                }
            }
        }
    }
    cout<<tc<<endl;
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  string s;
  R s;
  ll n=s.size();
  ll c[26],ans=n*(n-1)/2;
  mem(c);
  rep(i,n) c[s[i]-'a']++;
  rep(i,26) ans-=c[i]*(c[i]-1)/2;
  pr(ans+1);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}


Measured memory_bytes: 720
import java.util.Scanner;
public class Main {
	public static void main(String[] args){

		Scanner sc = null;

		try {
			sc = new Scanner(System.in);
			//??´??°????????°???????????????
			int loop = sc.nextInt();

			//??????????????¨?????°
			int count = 0;

			//??\??????????????????(?????????)
			for (int i = 0; i < loop; i++) {
				int num = sc.nextInt();

				//?´???°????????§??????
				boolean check = true;
				double border = Math.sqrt(num);
				if (num == 2 || num % 2 != 0) {

					//1??¨????????°??\?????§???????????????????????§??????
					for (int j = 3; j <= border; j+=2) {
						if ((num % j) == 0) {
							check = false;
							break;
						}
					}
				}else {
					check = false;
				}

				//?´???°??????????????????
				if (check) {
					count++;
				}
			}
			//????????????
			System.out.println(count);
		}catch (Exception e) {
			System.out.println(e);
		} finally {
			if (sc != null) {
				sc.close();
			}
		}
	}
}

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

#define CPP_STR(x) CPP_STR_I(x)
#define CPP_CAT(x,y) CPP_CAT_I(x,y)
#define CPP_STR_I(args...) #args
#define CPP_CAT_I(x,y) x ## y

using i8  = int8_t;
using u8  = uint8_t;
using i16 = int16_t;
using u16 = uint16_t;
using i32 = int32_t;
using u32 = uint32_t;
using i64 = int64_t;
using u64 = uint64_t;

using f32 = float;
using f64 = double;

#define FOR(i, start, end) for(i64 i = (start), CPP_CAT(i,xxxx_end)=(end); i < CPP_CAT(i,xxxx_end); ++i)
#define REP(i, n) FOR(i, 0, n)
#define REPS(i, n) for(i64 i = 1; i <= n; ++i)
#define RREP(i, n) for(i64 i = n - 1; i >= 0 ; --i)
#define RREPS(i, n) for(i64 i = n; i >= 1; --i)

#define ALL(f,c,...) (([&](decltype((c)) cccc) { return (f)(std::begin(cccc), std::end(cccc), ## __VA_ARGS__); })(c))

#define UNIQUE(v) v.erase( unique(v.begin(), v.end()), v.end() );

#define pb push_back
#define mp make_pair
#define F first
#define S second

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

template<typename C>
i64 SIZE(const C& c) { return static_cast<i64>(c.size()); }

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


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

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


// dp[i] := 現在の段差からi段昇る方法の総数
// dp[i] := dp[i-1] + dp[i-2]


#define MAX_N 100000
#define MOD 1000000007

i64 N, M;
i64 A[MAX_N];
i64 dp[MAX_N + 1];
i64 oks[MAX_N + 1];

void solve() {
  dp[0] = 1;
  dp[1] = 1;

  for (i64 i = 2; i <= N; i++) {
    dp[i] = dp[i-1] + dp[i-2];
    dp[i] %= MOD;
  }

  i64 cnt = 1;
  i64 prev_stair = 0;
  REP(i, M) {
    cnt *= dp[(A[i] - 1) - prev_stair];
    cnt %= MOD;
    prev_stair = A[i] + 1;
  }
  cnt *= dp[N - prev_stair];
  cnt %= MOD;

  cout << cnt << endl;
}

void solve2() {
  dp[0] = 1;
  dp[1] = 1;
  REP(i, N + 1) {
    oks[i] = 1;
  }
  REP(i, M) {
    oks[A[i]] = 0;
  }

  for (i64 i = 2; i <= N; i++) {
    dp[i] = 0;

    if (oks[i - 1])
      dp[i] += dp[i - 1];
    if (oks[i - 2])
      dp[i] += dp[i - 2];

    dp[i] %= MOD;
  }

  cout << dp[N] << endl;
}

int main() {
  cin >> N >> M;
  REP(i, M) {
    cin >> A[i];
  }

  solve2();

  return 0;
}

Measured memory_bytes: 2560
#include<stdio.h>
#include<math.h>
int Sosuu(int);

int main(){
  int a[10000],n,i,count=0,result;

  scanf("%d",&n);
  
  for(i = 0 ; i < n ; i++){
    scanf("%d",&a[i]);
    result = Sosuu(a[i]);
    if(result == 1) count++;
  }

  printf("%d\n",count);

  return 0;
}

int Sosuu(int x){
  int i,result = 1;
  double a=sqrt(x);

  for(i = 2 ; i <= a ; i++){
    if(x % i == 0){
      result = 0;
      break;
    }
  }
  return result;
}



Measured memory_bytes: 2128