akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll T[100005];

int main() {
    ll N, Q;
    cin >> N >> Q;
    string S;
    cin >> S;
    memset(T, 0, sizeof(T));
    FOR(i, N, 1) {
        if (S[i] == 'C' && S[i - 1] == 'A')
            T[i + 1]++;
    }
    REP(i, N) {
        T[i + 1] += T[i];
    }

    REP(i, Q) {
        ll l, r;
        cin >> l >> r;
        ll s = T[r] - T[l - 1];
        if (S[l - 2] == 'A' && S[l - 1] == 'C')
            s--;
        cout << s << endl;
    }

    return 0;
}

Measured memory_bytes: 1792
#!/usr/bin/env python3
def solve(n, a, b):
    if a > b:
        a, b = b, a
    if (b - a) % 2 == 0:
        return (b - a) // 2
    else:
        l = a + ((b - a) - 1) // 2
        r = (n - b + 1) + (n - (a + (n - b + 1))) // 2
        return min(l, r)
print(solve(*map(int, input().split())))


Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <set>
#include <queue>
#include <map>
#include <numeric>
#include <functional>
#include <math.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define INF ((int)1e9)
#define INFLL ((ll)1e18)
#define MOD (1000000007LL)


int main(int argc, const char * argv[]) {
    ios_base::sync_with_stdio(false);
    int H[2], M[2];
    int K;
    cin >> H[0] >> M[0] >> H[1] >> M[1] >> K;
    int Res = 60 * H[1] + M[1];
    Res -= (60 * H[0] + M[0]);
    Res -= K;
    cout << Res << endl;

    return 0;
}


Measured memory_bytes: 3612
/*------------------------- Bism Allah Alruhmin Alrahim -------------------------------*/
#include <bits/stdc++.h>
#define forn(i, n) for (int i = 0; i < n; i++)
#define ford(i, n) for (int i = n - 1; i > -1; i--)
#define forl(i, l, r) for (int i = l; i <= r; i++)
#define vc vector
#define f first
#define s second
#define pb(i) push_back(i)
#define mx(ar, n) (*max_element(ar, ar + n))
#define mn(ar, n) (*min_element(ar, ar + n))

using namespace std;

typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;


int main()
{

    int n , m ;
    cin >> n >> m ;
    int t = n , x[40] = {0};
    while (t--)
    {
        int k;
        cin >> k ;
        for (int i = 0; i < k; i++)
        {
            int a;cin >> a;
            x[a]++;
        }
        
    }
    int c = 0 ;
    for (int i = 0; i < 40; i++)
    {
        if(x[i] == n){
            c++;
        }
    }
    cout << c << endl ;
    
    
    return 0 ;
}



Measured memory_bytes: 256
// Author : Nachiket Kanore
// Institute : PICT, Pune

/* It does not matter how slowly you go as long as you do not stop.*/

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define endl '\n'
#define rep(x,s,e) for(int x=s;x<=(e);x++)
#define repn for(int x=0;x<n;x++)
#define rep1n for(int x=1;x<=n;x++)
#define rep1m for(int y=1;y<=m;y++)
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(), x.rend()
#define precise(x) cout << fixed << setprecision(x)
#define bits(x) __builtin_popcount(x)
#define pb push_back
#define mp make_pair
#define test int t; cin>>t; while(t--)
#define FAST                          \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL)

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


void __print(int x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}


template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}';}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}";}
void _print() {cerr << "]\n";}
template <typename T, typename... V>
void _print(T t, V... v) {__print(t); if (sizeof...(v)) cerr << ", "; _print(v...);}
#ifndef ONLINE_JUDGE
#define see(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#define see(x...)
#endif

const int inf = 1e18;
const int N = 1005;


int32_t main(){
    FAST;

    int a, b;   cin >> a >> b;
    int ans = max({a + b , a - b , a * b});
    cout << ans << endl;

    return 0;
}




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

using namespace std;

int N, L;
int dp[100000];

int f(int i, vector<int> &v) {
  if (dp[i]) return dp[i];
  int ma = 0;
  if (i - 1 >= 0 && v[i -1] > v[i]) ma = max(ma, f(i - 1, v));
  if (i + 1 < N && v[i + 1] > v[i]) ma = max(ma, f(i + 1, v));
  ma += L - v[i];
  return dp[i] = ma;
}

int main() {
  int ans = 0;
  cin >> N >> L;
  vector<int> v(N);
  for(int i = 0; i < N; i++) {
    cin >> v[i];
  }
  for(int i = 0; i < N; i++) {
    ans = max(ans, f(i, v));
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 5524
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

	public static void main(String[] args) {
		// 初期化
		FastScanner sc = new FastScanner(System.in);
        PrintWriter printWriter = new PrintWriter(System.out);
		int n = sc.nextInt();
		int q = sc.nextInt();
		String[] moji_data = sc.next().split("");
		int result_cnt=0;
		int[] ruiseki_data= new int[moji_data.length];

		// 文字列に含まれるACの数を累積和でカウントする。
		for(int i=0;i<moji_data.length-1;i++) {
			if(moji_data[i].equals("A") && moji_data[i+1].equals("C")) {
				// Cの箇所に加算する。
				ruiseki_data[i+1] = ruiseki_data[i]+1;
			}
			else {
				ruiseki_data[i+1] = ruiseki_data[i];
				
			}
		}
		for(int i=0;i<q;i++) {
			// 開始位置、終了位置の取得
			int start = sc.nextInt();
			int end = sc.nextInt();
			// 開始位置から終了位置までのACの数を取得する。
	        printWriter.printf("%d\n", ruiseki_data[end-1] - ruiseki_data[start-1]);
		}
        printWriter.close();
	}

	static class FastScanner {
        private BufferedReader reader = null;
        private StringTokenizer tokenizer = null;

        public FastScanner(InputStream in) {
            reader = new BufferedReader(new InputStreamReader(in));
            tokenizer = null;
        }

        public String next() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public String nextLine() {
            if (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    return reader.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }

            return tokenizer.nextToken("\n");
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public double nextDouble() {
             return Double.parseDouble(next());
         }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
    }
}


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

#define ALL(v) v.begin(), v.end()
#define V vector
#define P pair
#define ld long double
#define ll long long
#define mod 1000000007
#define IINF INT_MAX
#define INF 1LL << 30


int main() {
    int n, m; cin >> n >> m;
    V<int> b(n + 1);
    for(int i = 0; i < m; i++){
        int a; cin >> a;
        b[a] = 1;
    }

    V<int> dp(n + 2);
    dp[n] = 1;
    for(int i = n - 1; i >= 0; i--){
        if(b[i]){
            dp[i] = 0;
            continue;
        }
        dp[i] = (dp[i + 1] + dp[i + 2]) % mod;
    }
    cout << dp[0] << endl;


    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
const int inf=1e9+7;
const ll mod=1e9+7;
const ll big=1e18;

int DP[100000];

int main() {
    int N;
    vector<int> ansarr;
    string s, t;
    int sh, sm, ss, th, tm, ts;
    int ans;
    while(true){
        for(int i=0;i<100000;++i){
            DP[i] = 0;
        }
        cin>>N;
        if(N==0) break;
        for(int i=0;i<N;++i){
            cin>>s>>t;
            sh = stoi(s.substr(0, 2));
            sm = stoi(s.substr(3, 2));
            ss = stoi(s.substr(6, 2));
            th = stoi(t.substr(0, 2));
            tm = stoi(t.substr(3, 2));
            ts = stoi(t.substr(6, 2));
            DP[sh*60*60+sm*60+ss]++;
            DP[th*60*60+tm*60+ts]--;
        }
        for(int i=1;i<100000;++i){
            DP[i] += DP[i-1];
        }
        ans = 0;
        for(int i=0;i<100000;++i){
            if(ans<DP[i]) ans = DP[i];
        }
        ansarr.push_back(ans);
    }
    for(int i=0;i<ansarr.size();++i){
        cout<<ansarr[i]<<endl;
    }
}




Measured memory_bytes: 3448
import bisect,collections,copy,heapq,itertools,math,numpy,string
import sys
sys.setrecursionlimit(10**7)

def S(): return sys.stdin.readline().rstrip()
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())

def main():
    N = I()
    S,T = LS()
    ans = ""
    for i in range(N):
        ans += S[i]
        ans += T[i]
    print(ans)


main()



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

typedef long long int ll;
typedef vector<long long>lve;
typedef vector<pair<ll,ll> > lvp;
typedef vector<vector<int> > ivve;

#define sp         ' '
#define endl       '\n'
#define F          first
#define S          second
#define pb         push_back
#define mp         make_pair 
#define GCD(x,y)   __gcd(x,y)
#define lb         lower_bound
#define up         upper_bound
#define setp       setprecision
#define bs         binary_search
#define all(x)     x.begin(),x.end()
#define LCM(x,y)   ((x*y)/__gcd(x,y))
#define spc(x)     cout<<fixed<<setp(x)

const   long long  inf = 1e18;
const   long long  cs =  200005;
const   long long  mod = 1000000007;
const   double     PI =  2 * acos(0.0);
void solve()
{
    ll t,n,m,a,b,c,d,e,i,j,k,x,y,z,cnt=0,cnt1=0;
    bool flag = false;
    
    cin>>a>>b;
    cout<<LCM(a,b)<<endl;
}
int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);    cout.tie(NULL);

    // freopen ("input.txt","r",stdin);
    // freopen ("output.txt","w",stdout);

    // int32_t tc;
    // cin>>tc;
    // while(tc--)
    solve();

    return 0;
}

Measured memory_bytes: 3640
S = input()


def dfs(num_string, p):


  
  if len(S) == 1:
    ans = int(S)
    return ans
  
  if p > len(S) - 1:
    #終わり
    ans = eval(num_string)
    return ans
  
  
  ret = 0
  
  ret += dfs(num_string + "+" + S[p], p+1)
  ret += dfs(num_string + S[p], p+1)
  
  return ret

ans = dfs(S[0],1)
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
		int A,B,C,D;
		int start=0,end=0;
		int result=0;
		scanf("%i %i %i %i",&A,&B,&C,&D);
		if(A>=0 && A<=100 && B>=0 && B<=100
			&& C>=0 && C<=100 && D>=0 && D<=100)
		{      // A B C D
			if(A>=C && B<=D){
				start=A;
				end=B;
			}
			else if(A<=C && B>=D){
				start=C;
				end=D;
			}
			else if(A<=C && B<=D){
				start=C;
				end=B;
			}
			else if(A>=C && B>=D){
				start=A;
				end=D;
			}
			result=end-start;
			if(result>0){
				printf("%i",result);
			}
			else{
				printf("%i",0);
			}

		}	
	return 0;
}

Measured memory_bytes: 256
import java.io.*;
 
class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int N = Integer.parseInt(br.readLine());
        String[] elements = br.readLine().split(" ");
        int[] A = new int[N];
        for (int i = 0; i < N; i++) {
            A[i] = Integer.parseInt(elements[i]);
        }
 
        int key;
        int i, j, k;
        printArray(A, N);
        for (i = 1; i < N; i++) {
            key = A[i];
            j = i - 1;
            while (j >= 0 && A[j] > key) {
                A[j+1] = A[j];
                j--;
            }
            A[j+1] = key;
 
            printArray(A, N);
        }
    }
 
    public static void printArray (int[] array, int length) {
        StringBuilder output = new StringBuilder("");
        for (int i = 0; i < length; i++) {
            output.append(array[i]);
            if (i != length-1) {
                output.append(" ");
            }
        }
        System.out.println(output.toString());
    }
}

Measured memory_bytes: 26336
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/range/adaptor/reversed.hpp>

using namespace std;
typedef long long int ll;

#define PI (acos(-1))
#define REP(i,n) for(int (i)=0;(i)<(n);(i)++)

#define dump(x)  cerr << #x << " = " << (x) << endl;
#define dumparr(x) cerr << #x ; for(auto elem: x){cerr << " " << elem;} cerr << endl;
#define dumppairs(x) cerr << #x ; for(auto elem: x){cerr << "(" << elem.first << " " << elem.second << ") ";} cerr << endl;
#define dumpline cerr << "**********************" << endl;
#define dumpwline(x) cerr << "******** " << #x << "=" << (x) << " ********" << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define ARRAY_LENGTH(array) (sizeof(array) / sizeof(array[0]))

int main(void){
    int n; cin >> n;
    vector <double> as;
    REP(i, n){
        double a; cin >> a;
        as.push_back(a);
    }
    double gyaku_sum = 0;
    REP(i, n){
        gyaku_sum += 1.0 / as[i];
    }
    cout << 1.0 / gyaku_sum << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <ctype.h>
using namespace std;
int main(){
    string S; cin >> S;
    bool d[4]={};
    for (int i=0;i<S.size();i++){
        if (S[i]=='N') d[0]=true;
        if (S[i]=='W') d[1]=true;
        if (S[i]=='S') d[2]=true;
        if (S[i]=='E') d[3]=true;
    }
    if (d[0]!=d[2]||d[1]!=d[3]) cout << "No" << endl;
    else cout << "Yes" << endl;
}


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

int n, a[100005];
ll dp[100005];

int main()
{
    for(int i = 0; i < 100005; i++)
        dp[i] = INF;
    cin>>n;
    for(int i = 0; i < n; i++)
        cin>>a[i];

    dp[0] = 0;
    for(int i = 0; i < n; i++)
    {
        for(int j = 1; j <= 2 && i+j<n; j++)
        {
            dp[i+j] = min(dp[i+j], dp[i] + abs(a[i]-a[i+j]));
        }
    }

    cout<<dp[n-1]<<endl;
    return 0;
}


Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
using namespace std;
int main(){
char S[100];
cin >> S;
int i,j,x=0;
int s=strlen(S);
if(s%2==0){for(i=0,j=s-1;i<=(s-1)/2&&j>=(s-1)/2+1;i++,j--){if(S[i]!=S[j]){x++;}}}
else{for(i=0,j=s-1;i<=(s-1)/2&&j>=s/2;i++,j--){if(S[i]!=S[j]){x++;}}}

cout << x << endl;

return 0;
}

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

using namespace std;

int main(){
    int n,k,tmp,id=0;
    vector<int> v;
    cin>>n>>k;
    for(int i=0; i<n; i++){
        cin>>tmp;
        v.push_back(tmp);
    }
    sort(v.begin(),v.end());
    for(int i=0; i<n; i++){
        if(v[i]>=k){
            break;
        }
        id++;        
    }
    cout<<n-id<<endl;
    return 0;
}


Measured memory_bytes: 892
class UnionFind:
    def __init__(self, n):
        self.ps = [-1] * (n + 1)

    def find(self, x):
        if self.ps[x] < 0:
            return x
        else:
            self.ps[x] = self.find(self.ps[x])
            return self.ps[x]

    def unite(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return False
        if self.ps[x] > self.ps[y]:
            x, y = y, x
        self.ps[x] += self.ps[y]
        self.ps[y] = x
        return True

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        x = self.find(x)
        return -self.ps[x]

n = int(input())
v = 10**5 + 5
uf = UnionFind(v*2 + 10)
for _ in range(n):
  x, y = map(int, input().split())
  uf.unite(x, y+v)
d = dict()
for i in range(v*2):
  if uf.size(i) > 1:
    p = uf.find(i)
    if p not in d:
      d[p] = [0, 0]
    d[p][i > v] += 1
print(sum(x*y for x,y in d.values()) - n)

Measured memory_bytes: 6240
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <cstring>
#include <functional>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
#define rep(i, n) for(long long i=0; i<n; i++)
#define reps(i, s, e) for(long long i=s; i<e; i++)
#define repr(i, n) for(long long i=n-1; i>=0; i--)
#define reprs(i, s, e) for(long long i=e-1; i>=s; i--)

vector<pair<ll, ll> > prime_factorize(ll n) {
    vector<pair<ll, ll> > res;
    for (ll p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){

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

    ll n; cin >> n;

    auto vec = prime_factorize(n);

    ll ans = 0;
    for(auto x : vec){
        ll pow = x.second;

        reps(i, 1, 1e9){
            ll vsum = i * (i + 1) / 2;
            if(pow < vsum) break;

            ans++;
        }
    }

    cout << ans << endl;


    return 0;
}

Measured memory_bytes: 3680
#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <string>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <ctime>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <iomanip>
using namespace std;
#define vi vector<int>
#define pii pair<int,int>
#define x first
#define y second
#define all(x) x.begin(),x.end()
#define pb push_back
#define mp make_pair
#define SZ(x) (int)x.size()
#define rep(i,a,b) for(int i=a;i<b;i++)
#define per(i,a,b) for(int i=b-1;i>=a;i--)
#define pi acos(-1)
#define mod 1000000007
#define inf 1000000007
#define ll long long
#define ull unsigned long long
#define DBG(x) cerr<<(#x)<<"="<<x<<"\n";
#define N 100010
#define _DEBUG
template <class U,class T> void Max(U &x, T y){if(x<y)x=y;}
template <class U,class T> void Min(U &x, T y){if(x>y)x=y;}
template <class T> void add(int &a,T b){a=(a+b)%mod;}
inline int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
inline ll gcd(ll a,ll b){return b==0?a:gcd(b,a%b);}

int pow(int a,int b){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%mod;
        a=1LL*a*a%mod;b>>=1;
    }
    return ans;
}
int pow(int a,int b,int c){
    int ans=1;
    while(b){
        if(b&1)ans=1LL*ans*a%c;
        a=1LL*a*a%c;b>>=1;
    }
    return ans;
}

int main(){
    //srand(time(NULL)+clock());
    int T,ca=0,k,i,j,m=0,K,n;
    //double start=clock();
    int d[4]={0};
    rep(i,0,3){
        scanf("%d%d",&j,&k);j--,k--;
        d[j]++,d[k]++;
    }
    rep(i,0,4)if(d[i]==3){
        puts("NO");return 0;
    }
    puts("YES");
    //cerr<<(1.*clock()-start)/CLOCKS_PER_SEC<<"\n";
}


Measured memory_bytes: 256
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    a, b, c, d = map(int, readline().split())

    ans = -INF

    for x in (a, b):
        for y in (c, d):
            ans = max(ans, x * y)

    print(ans)


if __name__ == '__main__':
    main()


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

using namespace std;

int main() {
  int A, B, C, K;
  cin >> A >> B >> C >> K;

  int sum = 0;
  if (K > 0) {
    sum += min(A, K);
    K = K - A;
  }
  if (K > 0) {
    K = K - B;
  }
  if (K > 0) {
    sum -= min (C, K);
  }

  cout << sum << '\n';

  return 0;
}

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

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

#define FOR(i, n, m) for (ll(i) = (m); (i) < (n); ++(i))
#define REP(i, n) FOR(i, n, 0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll)1e15;

int main()
{
    int N, M, K;
    cin >> N >> M >> K;
    REP(i, N + 1)
    {
        REP(j, M + 1)
        {
            if (M * i + (N - 2 * i) * j == K)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define N 100010
using namespace std;
const int INF = 1LL<<55;
const int mod = (1e9)+7;
int Max(int &a,int b){return a=max(a,b);}
int Min(int &a,int b){return a=min(a,b);}


int A[N];
int n,T;
int find(int s,int x){
  return A + s - (lower_bound(A,A+s,x));
}

int dp[N];
signed main(){

  cin>>n>>T;
  for(int i=0;i<n;i++) cin>>A[i];
  sort(A,A+n);
  A[n] = 1LL<<50;
  
  dp[0] = 1;
  for(int i=1;i<n;i++){
    dp[i] = (dp[i-1] * (1 + find(i,A[i]-T)))%mod;
  }
  cout<<dp[n-1]<<endl;
  return 0;
}

Measured memory_bytes: 4708
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
typedef long long int ll;
#define BIG_NUM 2000000000
using namespace std;

struct Chair{
	int group_id,rest_time;
};

struct Info{
	int group_id,num,wait_sum,before_go;
	bool fixed;
};


int main(){

	int ans[100];

	Chair chair[17];
	for(int i = 0; i < 17; i++)chair[i].group_id = -1;
	Info info[100];
	for(int i = 0; i <= 99; i++){
		info[i].group_id = i;
		info[i].before_go = 5*i;
		info[i].wait_sum = 0;
		if(i%5==1){
			info[i].num = 5;
		}else{
			info[i].num = 2;
		}
		info[i].fixed = false;
	}

	int count;
	int FLG,tmp_num;
	bool isOK,waitFLG;

	while(true){

		for(int i = 0; i < 17; i++){
			if(chair[i].group_id != -1){
				chair[i].rest_time--;
				if(chair[i].rest_time <= 0){
					chair[i].group_id = -1;
				}
			}
		}

		waitFLG = false;
		count = 0;
		for(int i = 0; i < 100; i++){
			if(info[i].fixed)continue;
			if(waitFLG == false &&info[i].before_go == 0){
				FLG = -1;
				tmp_num = info[i].num;

				for(int k = 0; k <= 17-tmp_num;k++){
					isOK = true;
					for(int p = 0; p < tmp_num; p++){
						if(chair[k+p].group_id != -1){
							isOK = false;
							break;
						}
					}
					if(isOK){
						FLG = k;
						break;
					}
				}
				if(FLG != -1){
					for(int k = FLG; k < FLG + tmp_num;k++){
						chair[k].group_id = info[i].group_id;
						chair[k].rest_time = 17*(i%2)+3*(i%3)+19;
						info[i].fixed = true;
					}
				}else{
					waitFLG = true;
					info[i].wait_sum++;
					count++;
				}
			}else{
				if(info[i].before_go == 0){
					info[i].wait_sum++;
				}else{
					info[i].before_go--;
				}
				count++;
			}
		}
		if(count == 0)break;
	}

	for(int i = 0; i <= 99; i++){
		ans[i] = info[i].wait_sum;
	}

	int N;

	while(scanf("%d",&N) != EOF){
		printf("%d\n",ans[N]);
	}

    return 0;
}

Measured memory_bytes: 2612
import numpy as np

N, X = map(int, input().split())
x = list(map(int, input().split()))

x.append(X)
x.sort()

y = []

for i in range(N):
  y.append(x[i + 1] - x[i])
  
ans = y[0]

#print(x)
#print(y)
  
for i in range(N - 1):
  #print(ans, y[i+1])
  g = np.gcd.reduce([ans, y[i + 1]])
  #print(g)
  if g == 1:
    print(1)
    break
  else:
    ans = g
else:
  print(ans)

Measured memory_bytes: 38012
//
//  main.c
//  1_7 c
//
//  Created by x17037xx on 2018/05/25.
//  Copyright © 2018年 x17037xx. All rights reserved.
//

#include <stdio.h>

int main(int argc, const char * argv[]) {
    int r,c;//入力用
    
    int i,j;//アクセス用
    
    int sum=0;//列または行の合計を最後に入力する用
    
    scanf("%d %d",&r,&c);
    
    int a[101][101]={};
    
    
    
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            scanf("%d",&a[i][j]);
        }
    }
    
    for(i=0;i<r;i++){
        for(j=0;j<c;j++){
            sum+=a[i][j];
        }
        a[i][c]=sum;
        sum=0;
    }
    
    for(i=0;i<c;i++){
        for(j=0;j<r;j++){
            sum+=a[j][i];
        }
        a[r][i]=sum;
        sum=0;
    }
    
    for(i=0;i<r;i++){
        sum+=a[i][c];
    }

    a[r][c]=sum;
    
    for(i=0;i<r+1;i++){
        for(j=0;j<c+1;j++){
            
            printf("%d",a[i][j]);
            if(j==c){
                break;
            }
            printf(" ");
        }
        printf("\n");
    }
    
    return 0;
}


Measured memory_bytes: 2028
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <utility>
#include <functional>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_map>

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
const int INF = (1<<30);
const ll INFL = (1LL<<62);
const int MOD = 1000000007;
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<class T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> ll mod_pow(ll a, ll n, T mod) { mod=(ll)mod; ll res=1, p=a%mod; while(n){ if(n&1) res=res*p%mod; p=p*p%mod; n>>=1; } return res; }

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int cnt = 0;
    for(int i=a; i<=b; ++i){
        if(c%i==0) cnt++;
    }
    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 3092
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

long long int X, A, B;

void CALC(void) {

	for (long long int i = -250; i <= 250; i++) {
		for (long long int j = -250; j <= 250; j++) {
			if (pow(i, 5) - pow(j, 5) == X) { cout << i << " " << j << endl; return; }
		}
	}
}

int main(void) {

	cin >> X;

	CALC();

	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; 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 999999999
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};

char a, b;

int main()
{
    cin >> a >> b;
    if (a == 'H' && b == 'H')
    {
        cout << 'H' << endl;
    }
    else if (a == 'H' && b == 'D')
    {
        cout << "D" << endl;
    }
    else if (a == 'D' && b == 'H')
    {
        cout << 'D' << endl;
    }
    else if (a == 'D' && b == 'D')
    {
        cout << "H" << endl;
    }
}

Measured memory_bytes: 256
from sys import stdin
import math
import fractions
from collections import deque
from collections import Counter
import itertools

INF = 10 ** 10

N = int(stdin.readline().rstrip())
H = [int(x) for x in stdin.readline().rstrip().split()]


for i in range(N-2, -1, -1):
    diff = H[i] - H[i+1]

    if diff > 1:
        print("No")
        exit()

    # 右のマスよりちょうど1高い
    if diff == 1:
        H[i] = H[i] - 1


print("Yes")

Measured memory_bytes: 89580
INF = 10**10

def warshall_floyd(d):
    # d[i][j]: ij間の最小コスト
    # i=jのとき0, i!=jのときINFで初期化
    for k in range(N):
        for i in range(N):
            for j in range(N):
                d[i][j] = min(d[i][j], d[i][k]+d[k][j])
    return d

N, M, L = map(int, input().split())
dist = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):
    dist[i][i] = 0
for _ in range(M):
    a, b, c = map(int, input().split())
    a -= 1; b -= 1
    dist[a][b] = c; dist[b][a] = c
dist = warshall_floyd(dist)

dist2 = [[INF for _ in range(N)] for _ in range(N)]
for i in range(N):
    for j in range(N):
        if i == j:
            dist2[i][i] = 0
        else:
            if dist[i][j] <= L:
                dist2[i][j] = 1
dist2 = warshall_floyd(dist2)

Q = int(input())
for _ in range(Q):
    s, t = map(int, input().split())
    s -= 1; t -= 1
    if dist2[s][t] == INF:
        print(-1)
    else:
        print(dist2[s][t]-1)

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

x = 0
for bit in range(45,-1,-1):
    stand = 0
    for i in a:
        if i>>bit&1:
            stand += 1
    if stand*2 < n and x + 2**bit <= k:
        x += 2**bit

fx = 0
for i in a:
    fx += x^i

print(fx)

Measured memory_bytes: 69264
mod=10**9+7
n,k=map(int,input().split())
ans=1
coef1=n
coef2=n-1
for i in range(1,min(k+1,n)):
  tmp=1
  tmp*=coef1
  tmp%=mod
  tmp*=coef2
  tmp%=mod
  ans+=tmp
  ans%=mod  
  coef1*=n-i
  coef1%=mod
  coef1*=pow(i+1,mod-2,mod)
  coef1%=mod
  coef2*=n-1-i
  coef2%=mod
  coef2*=pow(i+1,mod-2,mod)
  coef2%=mod
print(ans)

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

int main(){
	int n, x,count;
	while (1){
		count = 0;
		cin >> n >> x;
		if (n == 0 && x == 0)break;
		for (int i = 1; i <= n-2; i++){
			for (int j = i+1; j <= n-1; j++){
				for (int k = j+1; k <= n; k++){
						if (i+j+k == x){
							count++;
						}
					}
				}
			}
		cout << count << endl;
		}
		
		return 0;
	}

Measured memory_bytes: 3068
import numpy as np

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

taste_list = np.arange(L, (L+N))

if min(taste_list) > 0:
    print(sum(taste_list) - min(taste_list))
elif max(taste_list) < 0:
    print(sum(taste_list) - max(taste_list))
else:
    print(sum(taste_list))

Measured memory_bytes: 20632
#include<bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, d;
	scanf("%d%d%*d%d%d%*d%*d", &a, &b, &c, &d);
	long long ans(0);
	for(int i(min(a, min(c, d)) - 10); i <= min(a, min(c, d)); i++) {
		if(i >= 0) {
			ans = max(ans, 3ll * i + (a - i) / 2 * 2ll + (c - i) / 2 * 2ll + (d - i) / 2 * 2ll);
		}
	}
	cout << ans + b << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] h = new int[n];
        int[] a = new int[m];
        int[] b = new int[m];
        for (int i = 0 ; i < n ; i++) {
            h[i] = sc.nextInt();
        }
        for (int i = 0 ; i < m ; i++) {
            a[i] = sc.nextInt() - 1;
            b[i] = sc.nextInt() - 1;
        }

        int[] c = new int[n];
        for (int i = 0 ; i < m ; i++) {
            if (h[a[i]] > h[b[i]]) {
                c[b[i]]++;
            } else if (h[a[i]] < h[b[i]]) {
                c[a[i]]++;
            } else {
                c[a[i]]++;
                c[b[i]]++;
            }
        }

        int count = 0;
        for (int i = 0 ; i < n ; i++) {
            if (c[i] == 0) count++;
        }

        System.out.println(count);


    }


}


Measured memory_bytes: 60628
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void)
{
    float x1, x2, x3, x4, y1, y2, y3, y4;
    float res1, res2;
    int k, i;
 
    scanf("%d", &k);
 
    for (i = 0; i < k; i++){
        scanf("%f %f %f %f %f %f %f %f", &x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4);
        res1 = (y2 - y1) / (x2 - x1);
        res2 = (y4 - y3) / (x4 - x3);
        if (res1 == res2){
            printf("YES\n");
        }
        else {
            printf("NO\n");
        }
    }
    return (0);
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
int main(){
    int n,m;
    cin >> n >> m;

    int sum=0;
    int a;
    for (int i = 0; i < m; i++)
    {
        cin >> a;
        sum += a;
    }

    n -= sum;

    if(n<0){
        cout << -1 << endl;
    }else{
         cout << n << endl;
    }
    
}

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

int main(){

    int n, flag=1, count=0;
    cin >> n;
    int A[n];
    for( int i=0 ; i<n ; i++){
        cin >> A[i];
    }

    while(flag){
        flag = 0;

        for( int j=n-1 ; j>=1 ; j-- ){
            if(A[j]<A[j-1]){
                int a;
                a = A[j];
                A[j] = A[j-1];
                A[j-1] = a;
                flag = 1;
                count++;
            }
        }
    }
    for( int k=0 ; k<n-1 ; k++){
        cout << A[k] << " ";
    }
    cout << A[n-1] << endl;
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 3100
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 100000 + 5;
#define INF 1e14
int a, b, q;
long long s[maxn], t[maxn];
vector<long long> ss, tt;

int main() {
  while(scanf("%d%d%d", &a, &b, &q) == 3) {
    ss.clear();
    tt.clear();
    for(int i = 0; i < a; i++) scanf("%lld", &s[i]);
    for(int i = 0; i < b; i++) scanf("%lld", &t[i]);
    long long pos;
    while(q--) {
      scanf("%lld", &pos);
      ss.clear(); tt.clear();
      int right_s = lower_bound(s, s+a, pos) - s;
      if(right_s < a) ss.push_back(s[right_s]);
      int left_s = right_s - 1;
      if(left_s >= 0) ss.push_back(s[left_s]);

      int right_t = lower_bound(t, t+b, pos) - t;
      if(right_t < b) tt.push_back(t[right_t]);
      int left_t = right_t - 1;
      if(left_t >= 0) tt.push_back(t[left_t]);

      long long ans = INF;
      for(unsigned i = 0; i < ss.size(); i++) {
        for(unsigned j = 0; j < tt.size(); j++) {
          long long t1 = abs(pos - ss[i]) + abs(ss[i] - tt[j]), t2 = abs(pos - tt[j]) + abs(tt[j] - ss[i]);
          ans = min(ans, min(t1, t2));
        }
      }
      printf("%lld\n", ans);
    }
  }

  return 0;
}

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

namespace arc_058_A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int i = 0;
            for (i = n[0]; ; i++)
            {
                string a = i.ToString();
                string sd = a;
                for (int k = 0; k < n[1]; k++)
                {
                    string x = s[k].ToString();
                    sd = sd.Replace(x,"?");
                }
                if (a == sd)
                {
                    break;
                }
            }
            Console.WriteLine(i);Console.ReadLine();
        }
    }
}


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

int main(){
    
	string s; cin >> s;
	for (int i = 1; i <= s.size(); i++) {
		switch (i % 2) {
		case 1:
			if (s[i - 1] != 'R' && s[i - 1] != 'U' && s[i - 1] != 'D') {
				cout << "No" << endl; return 0;
			}
			break;
		case 0:
			if (s[i - 1] != 'L' && s[i - 1] != 'U' && s[i - 1] != 'D') {
				cout << "No" << endl; return 0;
			}
			break;
		}
	}
	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)

	as := make([]int, n)
	bs := make([]int, n)
	cs := make([]int, n-1)
	for i, _ := range as {
		fmt.Scan(&as[i])
	}
	for i, _ := range bs {
		fmt.Scan(&bs[i])
	}
	for i, _ := range cs {
		fmt.Scan(&cs[i])
	}

	cnt := 0
	tmp := 0
	for _, a := range as {
		cnt = cnt + bs[a-1]

		if tmp+1 == a && tmp != 0 {
			cnt = cnt + cs[tmp-1]
		}

		tmp = a
	}

	fmt.Print(cnt)
}


Measured memory_bytes: 512
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
#include "numeric"
#include "cassert"
#include "ctime"

using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define rep(begin, i, end) for (int i = begin; i < (int)(end); i++)
#define all(v) v.begin(), v.end()
const int MOD = 1000000007;

int main()
{
    string S;
    cin >> S;
    for (auto s : S)
    {
        if (s == '9')
        {
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    cin>>str;
    int n = str.length();
    if(str[n-1]=='s')
    cout<<str<<"es\n";
    else
    {
        cout<<str<<"s\n";
    }
    

    // int a[n];
    // for(int i=0;i<n;i++)
    // cin>>a[i];
    // sort(a,a+n);
    // for(int i=0;i<n;i++)
    // cout<<a[i]<<" ";
    // cout<<endl;
}

Measured memory_bytes: 3628
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; ++i) {
			a[i] = sc.nextInt();
		}
		longestIncreasingSubsequence(a);
		// int N = sc.nextInt();
		// double[] x = new double[N];
		// double[] r = new double[N];
		// for (int i = 0; i < N; ++i) {
		// x[i] = sc.nextDouble();
		// r[i] = sc.nextDouble();
		// }
		// double[][] arr = new double[N][];
		// for (int i = 0; i < N; ++i) {
		// arr[i] = new double[] { x[i] + r[i], x[i] - r[i] };
		// }
		// Arrays.sort(arr, new Comparator<double[]>() {
		// @Override
		// public int compare(double[] o1, double[] o2) {
		// return Double.compare(o1[0], o2[0]);
		// }
		// });
		// int ans = 0;
		// double[] dp = new double[N];
		// Arrays.fill(dp, Double.MAX_VALUE / 10);
		// for (int i = 0; i < N; ++i) {
		// int left = -1;
		// int right = N;
		// while (right - left > 1) {
		// int middle = (left + right) / 2;
		// if (dp[middle] < arr[i][1]) {
		// left = middle;
		// } else {
		// right = middle;
		// }
		// }
		// dp[left + 1] = arr[i][1];
		// ans = Math.max(ans, left + 1);
		// }
		// System.out.println(ans + 1);
	}

	static void longestIncreasingSubsequence(int[] a) {
		int N = a.length;
		int ans = 0;
		double[] dp = new double[N];
		Arrays.fill(dp, Double.MAX_VALUE / 10);
		for (int i = 0; i < N; ++i) {
			int left = -1;
			int right = N;
			while (right - left > 1) {
				int middle = (left + right) / 2;
				if (dp[middle] < a[i]) {
					left = middle;
				} else {
					right = middle;
				}
			}
			dp[left + 1] = a[i];
			ans = Math.max(ans, left + 1);
		}
		++ans;
		System.out.println(ans);

	}

	static void tr(Object... objects) {
		System.out.println(Arrays.deepToString(objects));
	}
}

Measured memory_bytes: 68708
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		long mod = (long)1e9+7;
		long[] x = new long[n];
		for (int i = 0; i < n; i++) x[i] = sc.nextLong();
		long[] y = new long[m];
		for (int i = 0; i < m; i++) y[i] = sc.nextLong();
		long ans = 0;
		for (int i = 0; i < n-1; i++) {
			ans += ((x[i+1]-x[i])*(i+1)*(n-i-1))%mod;
			ans %= mod;
		}
		long ans2 = 0;
		for (int i = 0; i < m-1; i++) {
			ans2 += ((y[i+1]-y[i])*(i+1)*(m-i-1))%mod;
			ans2 %= mod;
		}
		System.out.println((ans*ans2)%mod);
		sc.close();
	}
}

Measured memory_bytes: 65816
#include <bits/stdc++.h>
using namespace std;
const int Maxn=200005;
int n,a[Maxn];
bool check(int lim){
    map<int,int>Map;
    for(int i=2;i<=n;i++){
        if(a[i]<=a[i-1]){
            while(Map.size()&&Map.rbegin()->first>a[i])
                Map.erase(prev(Map.end()));
            for(int j=a[i];;j--){
                if(!j)return false;
                if(Map[j]==lim-1)Map.erase(j);
                else{
                    Map[j]++;
                    break;
                }
            }
        }
    }
    return true;
}
int main(){
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    bool succ=true;
    for(int i=1;i<n;i++)
        if(a[i]>=a[i+1])
            succ=false;
    if(succ){
        cout<<"1\n";
        return 0;
    }
    int l=2,r=n;
    while(l<=r){
        int mid=(l+r)/2;
        if(check(mid))r=mid-1;
        else l=mid+1;
    }
    cout<<l<<"\n";
    return 0;
}

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

int main() {
    int n, m, num;
    int p[100010];
    bool f[100010];
    int ac=0, wa=0;
    string s;
    
    cin >> n >> m;
    
    rep(i, n+1){
        p[i] = 0;
        f[i] = false;
    }
    
    rep(i, m){
        cin >> num >> s;
        if(f[num]){
          continue;
        } else if(s == "AC"){
            f[num] = true;
            ac++;
        } else if(s == "WA"){
            p[num]++;
        }
    }
    
    rep(i, n+1){
        if(f[i]){
            wa += p[i];
        }
    }
    
    cout << ac << " " << wa << endl;
    
    return 0;
}




Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

int n,tak,aok;
vector<int> v[mx];
vector<vector<int>> d(2, vector<int>(mx,inf));    
 	                              // kyori data from i (bfs(int num, int i))

void bfs(int num, int i){
  queue<int> q;
  q.push(i);
  d[num][i]=0;
  while(!q.empty()){
    int x=q.front(); q.pop();
    for(auto to:v[x]){
      if(d[num][to]==inf){
        d[num][to] = d[num][x]+1;
        q.push(to);
      }
    }
  }
}

int main() {
  cin >> n >> tak >> aok; tak--; aok--;
  rep(i,n-1){
    int a,b; cin >> a >> b; a--; b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  bfs(0,tak);                                   //d[0][i]:takahashi karano kyori
  bfs(1,aok);                                   //d[1][i]:aoki karano kyori
  
  int ans=0,tmp=0;
  rep(i,n){ 
    if(ans<d[1][i] &&  0<d[1][i]-d[0][i]){ //aoki most far && aoki tooi than takahashi
      ans = d[1][i];
    }
  }
  ans -= 1;
  cout << ans << endl;
  return 0;
}  


Measured memory_bytes: 9840
#include <bits/stdc++.h>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int64_t N, M;
    cin >> N;
    vector<int64_t>vec(N);
    int64_t sum = 0;
    for (int i= 0; i < N; i++) {
        cin >> vec.at(i);
        sum += vec[i];
    }

    cin >> M;
    for (int i = 0; i < M; i++) {
        int64_t index, second;
        cin >> index >> second;
        int64_t ans = sum - vec[index-1] + second;
        cout << ans << endl;
    }

    return 0;
}

Measured memory_bytes: 256
import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    auto arr = readln.chomp.split.map!(to!int).array;
    
    arr.sort();

    if ((arr[0] == arr[1] && arr[1] != arr[2]) || 
        (arr[0] != arr[1] && arr[1] == arr[2])
       ) {
        writeln("Yes");
        return;
    }
    
    writeln("No");
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main () {
  int s;
  cin >> s;
  if (s == 1) {
    cout << 4 << endl;
    return 0;
  }
  if (s == 2) {
    cout << 4 << endl;
    return 0;
  }
  int ans = 1;
  while (s != 4) {
    if (s % 2) {
      s = 3 * s + 1;
    }
    else s /= 2;
    ans ++;
  }
  cout << ans + 3 << endl;
}
  

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        @SuppressWarnings("resource")
        Scanner sc = new Scanner(System.in);
        int[][] a = new int[3][3];
        for (int i = 0 ; i < 3 ; i++) {
            for (int j = 0 ; j < 3 ; j++) {
                a[i][j] = sc.nextInt();
            }
        }
        int n = sc.nextInt();
        int[] b = new int[n];
        for (int i = 0 ; i < n ; i++) {
            b[i] = sc.nextInt();
        }
        int [][] bingo = new int[3][3];
        for (int i = 0 ; i < n ; i++) {
            for (int j = 0 ; j < 3 ; j++) {
                for (int k = 0 ; k < 3 ; k++) {
                    if (b[i] == a[j][k]) {
                        bingo[j][k]++;
                    }
                }
            }
        }

        boolean flg = false;
        if (bingo[0][0] + bingo[0][1] + bingo[0][2] == 3) {
            flg = true;
        }
        if (bingo[1][0] + bingo[1][1] + bingo[1][2] == 3) {
            flg = true;
        }
        if (bingo[2][0] + bingo[2][1] + bingo[2][2] == 3) {
            flg = true;
        }
        if (bingo[0][0] + bingo[1][0] + bingo[2][0] == 3) {
            flg = true;
        }
        if (bingo[0][1] + bingo[1][1] + bingo[2][1] == 3) {
            flg = true;
        }
        if (bingo[0][2] + bingo[1][2] + bingo[2][2] == 3) {
            flg = true;
        }
        if (bingo[0][0] + bingo[1][1] + bingo[2][2] == 3) {
            flg = true;
        }
        if (bingo[0][2] + bingo[1][1] + bingo[2][0] == 3) {
            flg = true;
        }
        System.out.println(flg ? "Yes" : "No");
    }

}

Measured memory_bytes: 22996
n=int(input())
a=0
b=0
c=0
d=0
for i in range(n):
  w=input()
  if w=="AC":
    a=a+1
  elif w=="TLE":
    b=b+1
  elif w=="WA":
    c=c+1
  else:
    d=d+1
print("AC "+"x "+str(a))
print("WA "+"x "+str(c))
print("TLE "+"x "+str(b))
print("RE "+"x "+str(d))



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

int main () {
  int N; cin >> N;
  if (N < 2) cout << 1 << endl;
  else if (N < 4) cout << 2 << endl;
  else if (N < 8) cout << 4 << endl;
  else if (N < 16) cout << 8 << endl;
  else if (N < 32) cout << 16 << endl;
  else if (N < 64) cout << 32 << endl;
  else cout << 64 << endl;
}

Measured memory_bytes: 256
//#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"

#define rep(i,n) for(ll (i)=0;(i)<(ll)(n);(i)++)
#define all(x) (x).begin(),(x).end()
#define MOD 1000000007LL
#define INF (1LL<<60LL)
#define int long long
typedef long long ll;

using namespace std;


signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	ll n; cin >> n;
	if (n % 2 == 1)cout << 0 << endl;
	else {
		ll ans = 0;
		ll k = 10;
		while (n >= k) {
			ans += n / k;
			k *= 5;
		}
		cout << ans << endl;
	}
}

Measured memory_bytes: 256