akhauriyash/Code-Regression huggingface dataset:
n,m = [int(x) for x in input().split()]
li = list()
for i in range(m):
    li.append([int(x) for x in input().split()])

if (m == 0):
    if (n == 3):
        print("100")
    elif (n ==2):
        print("10")
    else:
        print("0")
else:
    for i in range(1000):
        length = len(str(i))
        for j in li:
            if (length<j[0] or length != n):
                break
            if (str(i)[j[0]-1] != str(j[1])):
                break
        else :
            print(i)
            break
    else:
        print("-1")

Measured memory_bytes: 3064
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
int p[3][110];
int dp[3][110];
int main(){
	int a;scanf("%d",&a);
	for(int i=0;i<2;i++)for(int j=0;j<a;j++)scanf("%d",&p[i][j]);
	dp[0][0]=p[0][0];
	for(int i=0;i<2;i++)for(int j=0;j<a;j++){
		if(i==0)dp[i+1][j]=max(dp[i+1][j],dp[i][j]+p[i+1][j]);
		if(j<a-1)dp[i][j+1]=max(dp[i][j+1],dp[i][j]+p[i][j+1]);
	}
	printf("%d\n",dp[1][a-1]);
}


Measured memory_bytes: 128
/*
lakshaygpt28
Lakshay Gupta
*/

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

using ll = long long;
using db = double;
using pii = pair < int, int >;
using pll = pair < ll, ll >;
using vll = vector < ll >;

template < typename T > using OrderedSet = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;


#ifndef ONLINE_JUDGE
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template < typename Arg1 >
void __f(const char* name, Arg1&& arg1) {
    cerr << name << " : " << arg1 << std :: endl;
}
template < typename Arg1, typename... Args >
void __f(const char* names, Arg1&& arg1, Args&&... args) {
    const char* comma = strchr(names + 1, ',');
    cerr.write(names, comma - names) << " : " << arg1 << " | ";
    __f(comma + 1, args...);
}
#else
#define debug(...)
#endif

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

const db PI = acos(-1);
const ll LINF = LLONG_MAX;
const int INF = INT_MAX, MOD = 1e9 + 7, N = 1e5 + 10;

bool visited[N];
ll dp[N];
vll g[N];
ll dfs(ll node);

int main() {
    fast_io();
    ll n, m;
    cin >> n >> m;
    ll u, v;
    for (ll i = 0; i < m; i++) {
        cin >> u >> v;
        g[u].eb(v);
    }
    ll ans = 0;
    for (ll i = 1; i <= n; i++) {
        if (!visited[i]) {
            ans = max(ans, dfs(i));
        }
    }
    cout << ans << "\n";
    return 0;
}

ll dfs(ll node) {
    auto &ans = dp[node];
    if (visited[node]) {
        return ans;
    }
    ans = 0;
    for (auto x : g[node]) {
        ans = max(ans, dfs(x) + 1);
    }
    visited[node] = true;
    return ans;
}


Measured memory_bytes: 7936
import sys
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, K = map(int, input().split())

a = N % K
b = (-N) % K

ans = min(a, b)

print(ans)


Measured memory_bytes: 2940
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
static class Program
{
	static int[] ReadInts(this TextReader reader) => reader.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
	static IEnumerable<int[]> ReadInts(this TextReader reader, int count)
	{
		for (long i = 0; i < count; ++i)
			yield return reader.ReadInts();
	}

	static IEnumerable<long[]> ReadLongs(this TextReader reader, long count)
	{
		for (long i = 0; i < count; ++i)
			yield return reader.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
	}
	
	public static void Main(string[] args)
	{
		var input = Console.ReadLine();
		Console.WriteLine(input.ToCharArray().Contains('7') ? "Yes" : "No");
	}
}

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

#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;
const ll MOD = 1e9+7;
const vi dx = {1, 0, -1, 0, 1, -1, -1, 1};
const vi dy = {0, 1, 0, -1, 1, 1, -1, -1};


int main() {
    ll N,K; cin>>N>>K;
    cout<<min(abs(N % K), abs(N%K - K))<<endl;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a<b){
        cout<<"a < b"<<endl;
    }else if(a>b){
        cout<<"a > b"<<endl;
    }else if(a==b){
        cout<<"a == b"<<endl;
    }
}


Measured memory_bytes: 3088
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef vector<ll> vl;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef queue<ll> ql;
typedef deque<ll> dql;
typedef priority_queue<ll/*, vl, greater<ll>*/> pql; //降順(/*昇順*/)
typedef set<ll> sl;
typedef pair<ll, ll> pl;
typedef vector<vl> vvl;
typedef vector<pl> vpl;
#define rep(i, n) for(ll i = 0; i < ll(n); i++)
#define rep2(i, n) for(ll i = 1; i <= ll(n); i++)
//#define rep(i, k, n) for(ll i = k-1; i < ll(n); i++)
//#define rep2(i, k, n) for(ll i = k; i <= ll(n); i++)
#define all(v) (v).begin(), (v).end()
ll mod(ll a, ll b) {if(b == 0) return 0; return (a % b + b) % b;}
bool chmin(ll &a, ll b) {if(b < a) {a = b; return 1;} return 0;}
bool chmax(ll &a, ll b) {if(b > a) {a = b; return 1;} return 0;}
const ll INF = 1LL << 60;
const ll MOD = 1e9 + 7;
//const ll MOD = 998244353;
const ll MAX = 1e9;
const char newl = '\n';

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

  ll n;
  cin >> n;
  vc c(n);
  rep(i, n) cin >> c[i];
  
  ll l=0, r=n-1;
  for(; l<n; l++) if(c[l]=='W') break;
  for(; r>=0; r--) if(c[r]=='R') break;

  ll ans=0;
  while(r-l>0) {
    l++;
    r--;
    while(c[l]=='R') l++;
    while(c[r]=='W') r--;
    ans++;
  }
  cout << ans << newl;
  return 0;
}

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

#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repLRE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define Sort(v) sort(v.begin(), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define Lower_bound(v, x) \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vT = vector<T>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;
using dqll = deque<ll>;

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

/* Macros reg. ends here */

const ll INF = 1LL << 50;

static const long long mod = 1000000007;

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cout << fixed << setprecision(15);

  ll mp[3][3];
  rep(i, 3) rep(j, 3) cin >> mp[i][j];

  map<ll, bool> get;
  ll n;
  cin >> n;
  rep(i, n) {
    ll x;
    cin >> x;
    get[x] = true;
  }

  rep(i, 3) {
    bool ok = true;
    rep(j, 3) {
      if (get.count(mp[i][j]) == 0) {
        ok = false;
        break;
      }
    }
    if (ok) {
      puts("Yes");
      return 0;
    }
  }

  rep(j, 3) {
    bool ok = true;
    rep(i, 3) {
      if (get.count(mp[i][j]) == 0) {
        ok = false;
        break;
      }
    }
    if (ok) {
      puts("Yes");
      return 0;
    }
  }

  bool ok = get.count(mp[0][0]) && get.count(mp[1][1]) && get.count(mp[2][2]);
  ok |= get.count(mp[2][0]) && get.count(mp[1][1]) && get.count(mp[0][2]);
  if (ok) {
    puts("Yes");
    return 0;
  }

  puts("No");
  return 0;
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
 
import math
import itertools
import sys
import copy
 
# 入力
#A, B, C, D = map(int, input().split())
#L = list(map(int, input().split()))
#S = list(str(input()))
#N = int(input())
N, M = map(int, input().split())

if N == M :
  print ("Yes")
else :
  print ("No")

Measured memory_bytes: 38384
#114-C
import bisect
n=int(input())
l=[]
ll=[]
s=[3,5,7]
for i in s:
    for j in s:
        for k in s:
            l.append(i*100+j*10+k)
for i in s:
    for j in s:
        for k in s:
            for m in s:
                l.append(i*1000+j*100+k*10+m)

for i in s:
    for j in s:
        for k in s:
            for m in s:
                for o in s:
                    l.append(i*10000+j*1000+k*100+m*10+o)
            
for i in s:
    for j in s:
        for k in s:
            for m in s:
                for o in s:
                    for p in s:
                        l.append(i*100000+j*10000+k*1000+m*100+o*10+p)
                    
for i in s:
    for j in s:
        for k in s:
            for m in s:
                for o in s:
                    for p in s:
                        for q in s:
                            l.append(i*1000000+j*100000+k*10000+m*1000+o*100+p*10+q)
                    

for i in s:
    for j in s:
        for k in s:
            for m in s:
                for o in s:
                    for p in s:
                        for q in s:
                            for r in s:
                                    l.append(i*10000000+j*1000000+k*100000+m*10000+o*1000+p*100+q*10+r)
                    
for i in s:
    for j in s:
        for k in s:
            for m in s:
                for o in s:
                    for p in s:
                        for q in s:
                            for r in s:
                                for t in s:
                                    l.append(i*100000000+j*10000000+k*1000000+m*100000+o*10000+p*1000+q*100+r*10+t)
for i in range(len(l)):
    if len(set(str(l[i])))==3:
        ll.append(l[i])
print(bisect.bisect(ll,n))

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

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

int main()
{
    int n,ans;

    cin >> n;
    vector<int> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    //最大公約数
    ans = a[0];
    for (int i=1;i<n;++i) {
        ans = gcd(ans, a[i]);
    }

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


Measured memory_bytes: 3784
/*
    Author: Mohammad faisal
    Problem: Monsters Battle Royale.
    Date: 07/08/2019

*/
// #include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cstring>
#include<vector>
#include<algorithm>
#include<stack>
#include<map>
using namespace std;
long long gcd(long long a,long long b)
{
  if(b)
    return gcd(b,a%b);
  else
    return a;
}
int main()
{
    // int a,b;
    // cin >> a >> b;
    long long n;
    cin >> n;
    long long * arr = new long long[n];
    cin >> arr[0];
    for(int i=1;i<n;i++)
    {
      cin >> arr[i];
      arr[i-1] = gcd(arr[i-1],arr[i]);
    }
    cout<<*min_element(arr,arr+n)<<endl;
    return 0;
}

Measured memory_bytes: 1400
#include<bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define vi vector<int>
#define tc int t; cin>>t; while(t--)
#define mod 1000000007
 
using namespace std;
 
void fastio(){
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
    
}
 
int main(){
    fastio();
    int n,k;
    cin>>n>>k;
    int a[n];
    int sum=0;
    for(int i=0;i<n;i++){
        cin>>a[i];
        sum += a[i];
    }
    sort(a,a+n);
    k = k-sum;
    k = k/a[0];
    cout<<n+k;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;
#define pi 3.14159265

int main()
{
	long long ans = 0, i = 0, j = 0, k = 0, n, v[100000] = { 0 }, e[100001] = { 0 }, o[100001] = { 0 },
				emax=0, omax=0, sece=0, seco=0;
	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> v[i];
		if (i % 2)
			o[v[i]]++;
		else
			e[v[i]]++;
	}

	for (i = 0; i <= 100000; i++) {
		if (seco <= o[i]) {
			seco = o[i];
			if (seco > o[0]) {
				k = seco;
				seco = o[0];
				o[0] = k;
				omax = i;
			}
		}
		if (sece <= e[i]) {
			sece = e[i];
			if (sece > e[0]) {
				k = sece;
				sece = e[0];
				e[0] = k;
				emax = i;
			}
		}
	}

	if (omax != emax)
		ans = n - o[0] - e[0];
	else if ((e[0]+seco) > (o[0]+sece))
		ans = n - (e[0] + seco);
	else
		ans = n - (o[0] + sece);
	
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 2560
#include<bits/stdc++.h>
#define ll long long int
#define ul unsigned long long int 
#define pb push_back

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	int a,b;
	cin>>a>>b;
	if(a&1&&b&1)
		cout<<"Odd";
	else
		cout<<"Even";
}

Measured memory_bytes: 256
def dfs(i,f):
    if i == s-1:
        return sum(map(int,f.split("+")))
    return dfs(i+1,f + n[i+1]) + dfs(i+1 , f+ "+"  + n[i+1])

n = input()
s = len(n)
print(dfs(0,n[0]))

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

using namespace std;

using ll = long long;


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

  	ll L, R;
    cin >> L >> R;


    ll ans = 2018;
    R = min(R, L + 2018);
    for (ll i = L; i < R; ++i) {
        for (ll j = L + 1; j <= R; ++j) {
            ans = min(ans, (i * j) % 2019);
        }
    }
    cout << ans << '\n';


    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <deque>
#include <fstream>
#include <iostream>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stdio.h>
#include <string>
#include <vector>

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

using namespace std;

namespace Dump {
#define dump(...) Dump::print(#__VA_ARGS__, __VA_ARGS__)
static std::vector<string> dumpKey;
static string dumpKeyBuf;

void print() { cerr << endl; }
template <class Head, class... Tail> void print(Head &&head, Tail &&... tail) {
  if (dumpKey.empty()) {
    dumpKeyBuf = head;
    dumpKeyBuf.erase(std::remove_if(dumpKeyBuf.begin(), dumpKeyBuf.end(),
                                    [](char c) { return c == ' '; }),
                     dumpKeyBuf.end());

    std::istringstream stream(dumpKeyBuf);
    string field;
    while (std::getline(stream, field, ','))
      dumpKey.push_back(field);

    reverse(dumpKey.begin(), dumpKey.end());
  } else {
    cerr << dumpKey.back() << ":" << head << "  ";
    dumpKey.pop_back();
  }
  Dump::print(std::move(tail)...);
}
}

typedef long long ll;
typedef unsigned long long ull;

typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<long long> vll;
typedef vector<unsigned long long> vull;
typedef pair<int, int> pii; // p.first p.second

// ll n = to_T<ll>("114514")
template <class T> T to_T(const string &s) {
  istringstream is(s);
  T res;
  is >> res;
  return res;
}
template <class T> string to_s(const T &a) {
  ostringstream os;
  os << a;
  return os.str();
}

void solve(long long N, long long A) { cout << (N * N - A) << endl; }

int main() {
  ios::sync_with_stdio(false);
  long long N;
  long long A;
  cin >> N;
  cin >> A;
  solve(N, A);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define double long double
#define x first
#define y second
#define long long long
#define int long 



           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------

string s;
int d,n;
int cache[10002][102][2][2];
int modu=1000000007;
int dp(int pos,int mod,int less,int marked)
{
	if(pos==n)
	{
		if(mod==0&&marked==1)
			return 1;
		return 0;
	}
	if(cache[pos][mod][less][marked]!=-1)
		return cache[pos][mod][less][marked];
	if(less==1)
	{
		int ans=0;
		for(int i=0;i<=9;i++)
		{
			if(i!=0)
			ans+=dp(pos+1,(mod+i)%d,1,1);
			else
			ans+=dp(pos+1,(mod+i)%d,1,marked);	
			if(ans>modu)
				ans%=modu;
		}
		return cache[pos][mod][less][marked]=ans;
	}
	else
	{
		int ans=0;
		for(int i=0;i<=s[pos]-48;i++)
		{
			if(i!=s[pos]-48)
			{
				if(i==0)
				ans+=dp(pos+1,(mod+i)%d,1,marked);
				else
				ans+=dp(pos+1,(mod+i)%d,1,1);
			}
			else
			{
				if(i==0)
				ans+=dp(pos+1,(mod+i)%d,0,marked);
				else
				ans+=dp(pos+1,(mod+i)%d,0,1);	
			}
			if(ans>modu)
				ans%=modu;
		}
		return cache[pos][mod][less][marked]=ans;
	}

}
int32_t main()
{
    IOS
    cin>>s;
    n=s.length();
    cin>>d;
    memset(cache,-1,sizeof(cache));
    cout<<dp(0,0,0,0);
}

Measured memory_bytes: 33024
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef long double ld;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	int n,m;
	cin >> n >> m;
	vector<int> ans(n, -1);
	REP(i,m){
		int s,c;
		cin >> s >> c;
		s--;
		if(ans[s]!=-1 && ans[s]!=c){
			cout << "-1\n";
			return 0;
		}
		ans[s] = c;
	}
	if(n>1 && ans[0]==0){
		cout << "-1\n";
		return 0;
	}
	cout << (ans[0]==-1 ? (n==1 ? 0 : 1) : ans[0]);
	FOR(i,1,n) cout << (ans[i]==-1 ? 0 : ans[i]);
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int n;
    cin >> n;
    vector<int> a(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    vector<int> s = a;
    sort(s.rbegin(), s.rend()); //降順
    for(int i = 0; i < n; i++){
        int ans = s[0];
        if (s[0] == a[i]) ans = s[1];
        cout << ans << endl;
    }
}


Measured memory_bytes: 3200
#include <iostream>
#include <string.h>
#include <stdio.h>
#include <map>
#include <vector>
#include <math.h>
#include <algorithm>
#include <queue>
#include <set>
using namespace std;

#define rep(i,a) for(int i=0; i<a; i++)
#define rrep(i,a) for(int i=a; i>=0; i--)
#define loop3(i,j,k,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)
#define loop4(i,j,k,l,a) for(int i=0; i<a; i++)for(int j=0; j<a; j++)if(i!=j)for(int k=0; k<a; k++)if(i!=k&&j!=k)for(int l=0; l<a; l++)if(i!=l&&j!=l&&k!=l)
#define rep1(i,a) for(int i=1; i<=a; i++)

#define scnd1(a) scanf("%d", &a)
#define scnd2(a,b) scanf("%d%d", &a,&b)
#define scnd3(a,b,c) scanf("%d%d%d", &a,&b,&c)
#define scnd4(a,b,c,d) scanf("%d%d%d%d", &a,&b,&c,&d)

#define cin1(a) cin >> a;
#define cin2(a,b) cin >> a >> b;
#define cin3(a,b,c) cin >> a >> b >> c;
#define cin4(a,b,c,d) cin >> a >> b >> c >> d;
#define cout1(a) cout << a << endl;
#define cout2(a,b) cout << a << " " << b << endl;
#define cout3(a,b,c) cout << a << " " << b << " " << c << endl;
#define cout4(a,b,c,d) cout << a << " " << b << " " << c << " " << d << endl;
#define prtd1(a) printf("%d\n", a)
#define prtd2(a,b) printf("%d %d\n", a,b)
#define prtd3(a,b,c) printf("%d %d %d\n", a,b,c)
#define prtd4(a,b,c,d) printf("%d %d %d %d\n", a,b,c,d)

#define mem(a,n) memset( a, n, sizeof(a))
#define INF 1000000000
typedef long long ll;

int lis[35][100009];
int nums[100009];

int main() {
    int N, C;
    cin >> N >> C;
    
    mem(lis, 0);
    mem(nums, 0);
    
    int s, t, c;
    rep(i, N){
        scnd3(s, t, c);
        lis[c][s]++;
        lis[c][t+1]--;
    }
    
    rep1(i,C){
        rep1(j,100000){
            lis[i][j+1] += lis[i][j];
            if(lis[i][j]){
                nums[j]++;
            }
        }
    }
    
    int maxc = 0;
    rep1(i,100000) {
        if(nums[i] > maxc) maxc = nums[i];
    }
    
    cout1(maxc);
}


Measured memory_bytes: 14968
import java.util.*;

public class Main {
    static void swap(int[] x, int i, int j) {
        int tmp = x[i];
        x[i] = x[j];
        x[j] = tmp;
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] a = new int[3];
        a[0] = sc.nextInt();
        a[1] = sc.nextInt();
        a[2] = sc.nextInt();
        if(a[0] > a[1]) swap(a, 0, 1);
        if(a[1] > a[2]) swap(a, 1, 2);
        if(a[0] > a[1]) swap(a, 0, 1);
        System.out.println(a[0] + " " + a[1] + " " + a[2]);
    }
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int h, w;
	cin >> h >> w;
	vector<set<int>> st(h + 1);
	int n;
	cin >> n;
	REP(i, n) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		st[a].insert(b);
	}
	REP(i, w)st[h].insert(i);
	int m = 0;
	REP(i, h) {
		for (auto a : st[i + 1]) {
			if (a <= m) {
				cout << i + 1 << endl;
				return 0;
			}
		}
		if (st[i + 1].count(m + 1) == 0)m++;
	}
}

Measured memory_bytes: 28416
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=(1LL<<60);
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h, w, m;
    cin >> h >> w >> m;
    map<pair<ll, ll> , bool> mp;
    vector<ll> ch(h, 0), cw(w, 0); 
    ll a, b;
    for(int i=0;i<m;i++){
        cin >> a >> b;
        a--; b--;
        ch[a]++;
        cw[b]++;
        mp[{a, b}] = true;
    }
    multiset<pair<ll, ll> > ms1, ms2;
    for(int i=0;i<h;i++){
        ms1.insert({ch[i], i});
    }
    for(int i=0;i<w;i++){
        ms2.insert({cw[i], i});
    }
    ll ma1 = ms1.rbegin()->first, ma2 = ms2.rbegin()->first, ans = ma1 + ma2 - 1;
    while(ms1.begin()->first < ma1){
        ms1.erase(ms1.begin());
    }
    while(ms2.begin()->first < ma2){
        ms2.erase(ms2.begin());
    }
    for(auto i: ms1){
        for(auto j: ms2){
            if(!mp[{i.second, j.second}]){
                cout << ma1 + ma2 << endl;
                return 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 64160
N = int(input())
A = input()
B = input()
C = input()

result = 0
for i in range(N):
    if A[i] == B[i] and B[i] == C[i]:
        pass
    elif A[i] != B[i] and B[i] != C[i] and A[i] != C[i]:
        result += 2
    else:
        result += 1

print(result)


Measured memory_bytes: 3060
#include <stdio.h>
#include <math.h>
int main(void){
  int n,i,sum=0;
  int s[1000];
  double ave,SUM=0,a;
   
  while(scanf("%d",&n),n!=0){
      for(i=0;i<n;i++){
          scanf("%d",&s[i]);
          sum+=s[i];
      }
      ave=(double)sum/n;
      for(i=0;i<n;i++){
        SUM+=(s[i]-ave)*(s[i]-ave);
      }
      a=sqrt(SUM/n);
       
      printf("%f\n",a);
      sum=0;
      SUM=0;
  }
 
  return 0;
}


Measured memory_bytes: 2048
import java.util.Scanner;

public class Main {
	public static void main(String args[]) {
		Scanner sc = new Scanner(System.in);
		int x, y;
		int count;
		
		while (true) {
			x = sc.nextInt();
			y = sc.nextInt();
			if ((x | y) == 0) {
				break;
			}
			
			int swap = x + y;
			x = Math.max(x,  y);
			y = swap - x;
			count = 0;
			while (0 < y) {
				swap = x;
				x = y;
				y = swap % y;
				count++;
			}
			System.out.println(x + " " + count);
		}
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
#define int long long
#define all(v) v.begin(), v.end()
#define sc(a) scanf("%l64d", &a)
#define pr(a) printf("%l64d", a)

using namespace std;

const int INF = 1e18;
const int MAXN = 1e5 + 1;
const int M = 1e9 + 7;

main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    //freopen("", "r", stdin);
    //freopen("", "w", stdout);
    int n;
    cin >> n;
    int ans = 0;
    int l, r;
    for (int i = 0; i < n; i++){
        cin >> l >> r;
        ans += (r - l) + 1;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
from sys import stdin
from itertools import repeat
def main():
    n = int(stdin.readline())
    dat = map(int, stdin.read().split(), repeat(10, 2 * n))
    s = sum(dat[::2])
    a = [dat[i*2] + dat[i*2+1] for i in xrange(n)]
    a.sort(reverse=True)
    print s - sum(a[1::2])
main()


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

#define int long long
#define rep(i,l,r) for(int i=(int)(l);i<(int)(r);i++)
#define all(x) (x).begin(),(x).end()
template<class T>bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T &a,T b){if(a>b){a=b;return 1;}return 0;}

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

const int inf = 1LL<<60;
const int mod = 1e9 + 7;
const double eps = 1e-9;

/*{
  }*/

int n, a[400];
pii memo[400][400];
bool vis[400][400];

pii dfs(int l, int r){
  if(l == r) return {0, a[l]};
  if(vis[l][r]) return memo[l][r];

  pii res = {inf, 0};
  rep(i, l, r){
    pii tmp1 = dfs(l, i);
    pii tmp2 = dfs(i+1, r);
    int t = tmp1.first+tmp2.first + tmp1.second+tmp2.second;

    if(res.first > t){
      res.first = t;
      res.second = tmp1.second + tmp2.second;
    }
  }

//  cout << l << " " << r << ":" << res.first << " " << res.second << endl;

  vis[l][r] = true;
  return memo[l][r] = res;
}

signed main(){
  cin >> n;
  rep(i, 0, n) cin >> a[i];

  cout << dfs(0, n-1).first << endl;

  return 0;
}


Measured memory_bytes: 2816
#include<iostream>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<numeric>
#include<cmath>
#include<queue>
#include<stack>
#include<list>
#include<unordered_map>
#include<unordered_set>
#include<cctype>
#include<iomanip>
#include<limits>
#include<bitset>

using namespace std;
typedef long long int ll; typedef pair<int, int> P;
const ll mod = 1e9 + 7;
const int inf = 1e9 + 7;
const ll linf = 1LL << 60;
#define rep(i,n) for(int i=0;i<(int)n;i++)
#define REP(i,m,n) for(int i=(m);i<(int)n;i++)
#define all(a) (a).begin(),(a).end()
#define allg(a) (a).begin(),(a).end(),greater<>()
#define SUM(a) accumulate((a).begin(),(a).end(),0)
#define d10 std::setprecision(10)
#define d20 std::setprecision(20)
#define sz size()
using str = string;
const double PI = 3.14159265359;
ll gcd(ll a, ll b) { ll t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
int gcd(int a, int b) { int t; while (b != 0) { t = a % b; a = b; b = t; }return a; }
ll recfact(ll start, ll n) {
	ll i;
	if (n <= 16) {
		ll r = start;
		for (i = start + 1; i < start + n; i++) r = r * i % mod;
		return r % mod;
	}
	i = n / 2;
	return recfact(start, i) % mod * recfact(start + i, n - i) % mod;
}
ll lcm(ll a, ll b) {
	return a * b / gcd(a, b);
}
ll fct(ll n) { return recfact(1, n); }
ll ncm(ll n, ll m) {
	if (n < m)return 0;
	ll x = (fct(n) % mod / (fct(m) * fct(n - m)) % mod) % mod;
	return x;
}

bool arr[100][100] = { false };


int main(void) {
	ll ans = 0;
	ll n, m; cin >> n >> m;
	rep(i, m) {
		ll k; cin >> k;
		rep(j, k) {
			ll tmp; cin >> tmp;
			arr[i][tmp-1] = true;
		}
	}
	vector<int> p(m); rep(i, m)cin >> p[i];
	for (ll bit = 0; bit < (1 << n); bit++) {
		vector<int> w(m, 0);
		for (ll i = 0; i < n; ++i) {
			if (bit & (1 << i)) {
				for (ll x = 0; x < m; x++) {
					if (arr[x][i]) {
						w[x]++;
					}
				}
			}
		}
		bool f = 1;
		for (ll x = 0; x < m; x++) {
			if (w[x] % 2 != p[x]) {
				f = 0;
				break;
			}
		}
		if (f)ans++;
	}
	cout << ans << endl;

	return 0;
}

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

int main()
{
	int N;
	long long K;
	vector<int> vecA;
	cin >> N >> K;

	for (int i = 0; i < N; i++)
	{
		int tmp;
		cin >> tmp;
		vecA.push_back(tmp -1);
	}

	map<int, int> posCheck;
	posCheck[0] = 0;

	int nowPos = 0;
	int roop = 1;
	int roopStart;
	bool roopFind = false;
	for (long long i = 0; i < K; i++)
	{
		//cout << (nowPos+1) << endl;
		nowPos = vecA[nowPos];
		if(posCheck.find(nowPos) == posCheck.end()){
			posCheck[nowPos] = i +1;
		}else{
			roopStart = nowPos;
			roop = i+1 -posCheck[nowPos];
			roopFind = true;
			break;
		}
	}

	if(roopFind){
		long long y = (K - posCheck[nowPos]) % roop;

		//cout << (roopStart+1) <<":" << roop << endl;

		for (long long i = 0; i < y; i++)
		{
			nowPos = vecA[nowPos];
		}
	}

	cout << (nowPos+1) << endl;
	
	return 0;
}

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

int main()
{
    int m1,d1,m2,d2;
    cin>>m1>>d1>>m2>>d2;

    if(m1!=m2)  cout<<"1\n";
    else
        cout<<"0\n";
    return 0;
}


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

flag = True

for i in range(n):
    if a[i]%2 == 0:
        if a[i]%3 == 0 or a[i]%5 == 0:
            continue
        else:
            flag = False

if flag:
    print("APPROVED")
else:
    print("DENIED")

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

using namespace std;

const int N = 100010;

int h, n, sum;
int a[N];

int main()
{
    cin >> h >> n;
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) sum += a[i];
    
    if(sum >= h) puts("Yes");
    else puts("No");
    return 0;
}


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

#include <iostream>
//#include <algorithm>
// #include <iomanip>
#define ll long long
#define map unordered_map
#define set unordered_set
#define pll pair<ll, ll>
#define vll vector<ll>
#define mll map<ll, ll>

using namespace std;

const ll MOD = 1000000007LL;
const ll INF = (1LL << 60LL);

int main() {
  // std::cout << std::fixed << std::setprecision(10);
  ll L, R, d;
  scanf("%lld %lld %lld", &L, &R, &d);

  ll ans = 0;

  for (ll i = L; i <= R; i++) {
    if (i % d == 0) {
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3652
N,K=map(int,input().split())
S=str(input())
P=[1]
for i in range(1,N):
  if S[i]==S[i-1]:
    P[-1] +=1
  else:
    P +=[1]
if K*2<N:
  P=[sum(P[:2*K+1])]+P[2*K+1:]
  answer = sum(P)-len(P)
else:
  answer=N-1
print(answer)

Measured memory_bytes: 5364
import std;

const MOD = 998244353;
const N = 2 * 10^^5;

long calc(int n, int m, int k) {
    auto binom = new Binom(N);

    long ans = 0;
    foreach (i; 0..k+1) {
        ans += (m * modpow(m-1, n-i-1) % MOD) * binom(n-1, i) % MOD;
        ans %= MOD;
    }
    return ans;
}

void main() {
    int n, m, k; scan(n, m, k);
    writeln(calc(n, m, k));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T=string)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readints = reads!int;

long modpow(long x, long k) {
    if (k == 0) return 1;
    if (k % 2 == 0) return modpow(x * x % MOD, k / 2);
    return x * modpow(x, k - 1) % MOD;
}

class Binom {
    private long[] _fact;
    private long[] _invfact;

    this(size_t size) {
        _fact = new long[size + 10];
        _invfact = new long[size + 10];
        init();
    }

    private void init() {
        auto n = _fact.length;
        _fact[0] = 1;
        foreach (i; 1..n)
            _fact[i] = _fact[i-1] * i % MOD;
        _invfact[n-1] = modpow(_fact[n-1], MOD-2);
        foreach_reverse (i; 0..n-1)
            _invfact[i] = _invfact[i+1] * (i+1) % MOD;
    }

    long get(int n, int k) const {
        return (_fact[n] * _invfact[k] % MOD) * _invfact[n-k] % MOD;
    }

    long opCall(int n, int k) const {
        return (_fact[n] * _invfact[k] % MOD) * _invfact[n-k] % MOD;
    }
}


Measured memory_bytes: 6600
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define int ll
using pint = pair<int,int>;
using Graph = vector<vector<int>>;
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 1e10; //10^10
const double PI = acos(-1.0L);
/*mod逆元*/long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}
template< typename T >T mod_pow(T x, T n, T p=MOD) {T ret = 1;while(n > 0) {if(n & 1) (ret *= x) %= p;(x *= x) %= p;n >>= 1;}return ret;}
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; }
template<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}

//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    string s; cin >> s;
    if(s.size()&1) REVERSE(s);
    out(s);

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define all(x) (x).begin(), (x).end()
#define PI 3.14159265358979323846264338327950L
using namespace std;
typedef long long ll;
typedef long double ld;
int main(){
  int n;
  cin>>n;
  int i;
  for(i=1;i<=7;i++){
    if(n<pow(2,i)) break;
  }
  cout<<pow(2,i-1);
}

Measured memory_bytes: 4280
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
int acs(const void *a, const void *b) { 
  return *(int*)a - *(int*)b;
} /* 1,2,3,4.. */
int des(const void *a, const void *b) {
  return *(int*)b - *(int*)a;
} /* 8,7,6,5.. */
int cmp_char(const void *a, const void *b) { 
  return *(char*)a - *(char*)b;
} /* a,b,c,d.. */
int cmp_str(const void *a, const void *b) {
  return strcmp(*(const char **)a, *(const char **)b);
} /* aaa,aab.. */
#define min(a,b) (a < b ? a : b)
#define max(a,b) (a > b ? a : b)
#define rep(i, l, r) for (int i = l; i < r; i++)
#define MAX 100001
#define MOD 1000000007

typedef long long int lli;

int main(void) {
  int h, a;
  scanf("%d %d", &h, &a);

  int ans = (h - 1) / a + 1;
  printf("%d", ans);
  return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
const ll mod = 1000000007;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

int main() {
	int n;
	scanf("%d", &n);
	int x = 800*n;
	int y = (n/15) * 200;
	cout << x - y << endl;
    return 0;
}



Measured memory_bytes: 3640
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <vector>
#include <queue>
#include <ctime>
#include <map>
 
using namespace std;
 
#define FOR(i,a,b) for (ll i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
 
long gcd(long a, long b){
	if (a%b==0){
		return b;
	}
	else{
		return gcd(b,a%b);
	}
}
 
long lcm(long a, long b){
	return (a*b) / gcd(a,b);
}
 
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a < b) { a = b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a > b) { a = b; return 1; } return 0; }
 
typedef long long ll;
 
const ll INF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-10;

int r, D, x;

int main(){
	cin >> r >> D >> x;
	
	REP(i,10){
		x = r*x - D;
		cout << x << endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using db = double;
using ld = long double;
template<typename T> using V = vector<T>;
template<typename T> using VV = vector<vector<T>>;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define eb emplace_back
#define all(v) (v).begin(),(v).end()
#define siz(v) (ll)(v).size()
#define rep(i,a,n) for(ll i=a;i<(ll)(n);++i)
#define repr(i,a,n) for(ll i=n-1;(ll)a<=i;--i)
#define lb lower_bound
#define ub upper_bound
#define ENDL '\n'
typedef pair<int,int> Pi;
typedef pair<ll,ll> PL;
const ll mod = 1000000007;
const ll INF = 1000000099;
const ll LINF = (ll)(1e18 +99);
const vector<ll> dx={-1,1,0,0},dy={0,0,-1,1};
template<typename T,typename U> inline bool chmin(T& t, const U& u){if(t>u){t=u;return 1;}return 0;}
template<typename T,typename U> inline bool chmax(T& t, const U& u){if(t<u){t=u;return 1;}return 0;}
template<typename T> inline T gcd(T a,T b){return b?gcd(b,a%b):a;}
template<typename T,typename Y> inline T mpow(T a, Y n) {
  T res = 1;
  for(;n;n>>=1) {
    if (n & 1) res = res * a;
    a = a * a;
  }
  return res;
}



signed main(){
  cin.tie(0);ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);
  ll n,m;cin>>n>>m;
  V<bool> ac(n,false);
  V<int> pena(n,0);
  string s;
  rep(i,0,m){
    ll p;
    cin>>p>>s;
    --p;
    if(s=="AC"){
      ac[p]=true;
    }else{
      if(!ac[p])pena[p]++;
    }
  }

  ll ok=0,pn=0;
  rep(i,0,n){
    if(ac[i]){
      ok++;
      pn+=pena[i];
    }
  }
  cout<<ok<<" "<<pn<<ENDL;
}
//( ・ __ ・ ) KEEP BEING ORGANIZED
//CHECK overflow,vector_size,what to output?

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

int main() {
    string S, T;
    cin >> S >> T;
    int c = 0;
    for (int i = 0; i < 3; i++)
    {
        if (S.at(i) == T.at(i)){
            c++;
        }
    }
    cout << c;
}

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

int main()
{
    ll k, l = 7, ans = 1;
    cin >> k;
    if (k % 2 == 0 || k % 5 == 0)
    {
        cout << "-1" << endl;
    }
    else
    {
        while (true)
        {
            if (l % k == 0)
            {
                cout << ans << endl;
                break;
            }
            else
            {
                l = 10 * l + 7;
                l %= k;
                ans++;
            }
        }
    }
    return 0;
}

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

int main(void)
{
    int n, m;
    cin >> n >> m;
    vector<int> g[100];
    for (int i = 0; i < m; i++)
    {
        int v, u;
        cin >> v >> u;
        v--;
        u--;
        g[v].push_back(u);
        g[u].push_back(v);
    }
    for (int i = 0; i < n; i++)
    {
        cout << g[i].size() << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    string a,b,c;
    cin>>a>>b>>c;
    if(a[a.size()-1]==b[0] && b[b.size()-1]==c[0]){
      cout<<"YES"<<endl;
    }else{
      cout<<"NO"<<endl;
    }
}


Measured memory_bytes: 256
#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{HashMap, HashSet};
#[allow(unused_imports)]
use std::io::*;
#[allow(unused_imports)]
use std::str::*;

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

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

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

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(dead_code)]
fn read<T: FromStr>() -> T {
    let cin = stdin();
    let cin = cin.lock();
    let s: String = cin
        .bytes() // Bytes
        .map(|c| c.expect("failed reading char") as char)
        .skip_while(|c| c.is_whitespace()) // c が whitespace である限り skip
        .take_while(|c| !c.is_whitespace()) // c が whitespace でない限り要素を返す
        .collect();
    s.parse().ok().expect("failed parsing")
}

#[allow(non_snake_case)]
fn main() {
    input! {
        N:usize,
    }
    println!(
        "{}",
        match N % 10 {
            0 | 1 | 6 | 8 => "pon",
            3 => "bon",
            _ => "hon",
        }
    );
}


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

using namespace std;

int main() {
  int N, C, S, F;
  cin >> N;
  vector<int> t(N);
  for (int i = 0; i != N - 1; ++i) {
    cin >> C >> S >> F;
    t[i] = S + C;
    for (int j = 0; j != i; ++j) {
      if (t[j] < S) {
        t[j] = S + C;
      } else {
        t[j] += C + F - (t[j] - 1) % F - 1;
      }
    }
  }

  for (auto x: t) cout << x << endl;
}


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

int main()
{
	int X;
	scanf("%d", &X);
	
	int x = X / 100;
	if (X / 100 * 5 >= X % 100) printf("1\n");
	else printf("0\n");
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	int a, b;
	int c;
	int count;
	count = 0;
	scanf("%d %d %d", &a, &b, &c);
	for(; a <= b; a++) {
		if(c % a == 0) count++;
	}
	printf("%d\n", count);
	return 0;
}


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

using namespace std;

int main()
{
        string s;
        int i,k=0,j,f[1000]={0};
        cin>>s;
        for(i=0;s[i];i++)
        {
                f[s[i]]++;
        }
        for(i=0;s[i];i++)
        {
               /* if(f[s[i]]!=0)
                {
                        cout<<s[i]<<" "<<f[s[i]]<<endl;
                }*/
                if(f[s[i]]>1)
                   k++;
        }

        //cout<<k<<endl;
        if(k==0)
            cout<<"yes"<<endl;
        else
                cout<<"no"<<endl;
        return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 1000000000000000000LL
#define MOD 1000000007
#define writeln(n) cout<<n<<endl;
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;
//vector<tuple<long long, long long, long long>>vec;

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

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

int main()
{
    int n;
    cin>>n;
    vector<llong> a(n,0);
    REP(i,n) cin>>a[i];
    sort(a.begin(),a.end());
    a.push_back(INF);
    llong ans=0;
    llong cnt=1;
    for(int i=0; i<n; i++)
    {

        if(a[i]==a[i+1])
        {
            ++cnt;
        }
        else if(a[i]!=a[i+1])
        {
            if(cnt-a[i]>=0)ans+=(cnt-a[i]);
            else ans+=cnt;
            cnt=1;
        }
    }
    cout<<ans<<endl;

}

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

 using namespace std;
 typedef long long ll;

 int main() {
   int N, K;
   string S;
   cin >> N >> S >> K;

   for (int i = 0; i < N; i ++) {
     if (S.at(i) != S.at(K - 1)) S.at(i) = '*';
   }

   cout << S << endl;
  }


Measured memory_bytes: 256
using System;
using System.Runtime.InteropServices;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, b, t;
            string[] str =Console.ReadLine().Split(' ');
            a = int.Parse(str[0]);
            b = int.Parse(str[1]);
            t = int.Parse(str[2]);
            Console.WriteLine(b * (t / a));
        }
    }
}


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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

LL N;
LL a[55];
LL s;

int main(){
	scanf("%lld" , &N);
	repp(i,0,N){
		scanf("%lld" , a + i);
		s += a[i];
	}
	repm(r,N*(N-1),-1){
		LL K = s-r;
		if(K < 0) continue;
		LL b = 0;
		repp(i,0,N){
			LL p = (a[i]+K)%(N+1);
			if(p == N) b = -1234567;
			b += p;
		}
		if(b == r){
			printf("%lld\n" , K);
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256