akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
	using namespace std;
	typedef long long ll;
	#define endl "\n"
	#define space " "
	#define ll long long int
	#define vl vector<ll>
	#define vvl vector < vll >
	#define pii pair<int,int>
	#define pll pair<ll,ll>
	#define vpl vector < pll >
	#define mod 1000000007
	#define pi 3.1415926535897932384626433
	#define inf 1000000000000000001;
	#define fast ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
	#define all(c) c.begin(),c.end()
	#define mp(x,y) make_pair(x,y) 
	#define mem(a,val) memset(a,val,sizeof(a))
	#define pb push_back
	#define f first
	#define s second
	
	void solve()
	{
		int n,k; cin>>n>>k;
		int a[n],sum=0;
		for (int i = 0; i < n; ++i)
		{
			/* code */cin>>a[i];
		}
		sort(a,a+n);
		for (int i = 0; i < k; ++i)
		{
			/* code */sum+=a[i];
		}
		cout<<sum;
	}

	signed main()
	{

	fast;
	#ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
     #endif

	ll T=1;
	// cin>>T;
	while(T--)
	{
		solve();
	}
	return 0;
	}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
using pint = pair<int, int>;
using vi = vector<int>;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

const int MOD = 1000000007;
const lint INF = 1LL << 60;

int main() {
    int n;
    cin >> n;
    vi x(n);
    rep(i, n) cin >> x[i];

    lint res = INF;

    for (int p = 1; p <= 100; p++) {
        lint s = 0;
        rep(i, n) {
            s += (x[i] - p) * (x[i] - p);
        }
        res = min(res, s);
    }

    cout << res << endl;
    return 0;
}


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

int main() {
int N;
cin>>N;
vector<int> a(N);
for(int i=0;i<N;i++) cin>>a[i];
int cl=99999;
int ans=0;
for(int i=0;i<N-1;i++){
  if(a[i]==a[i+1]){
    a[i+1]=cl;
    cl--;
    ans++;
  }
}
cout<<ans<<endl;
}


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

int A=10,B=11,C=12,D=13,E=14,F=15;

int main()
{
	char x,y;
	scanf("%c %c",&x,&y);
	if(x > y) printf(">");
	if(x == y) printf("=");
	if(x < y) printf("<");
	return 0;
}

Measured memory_bytes: 128
from math import sqrt, gcd
import sys


def osk_a(M):
    p = [i for i in range(M+1)]
    for x in range(2, int(sqrt(M))+1):
        if p[x] == x:
            for y in range(2*x, M+1, x):
                if p[y] == y:
                    p[y] = x
    return p


def main():
    n = int(sys.stdin.buffer.readline())
    a = list(map(int, sys.stdin.buffer.readline().split()))

    def g(a):
        g = 0
        for x in a:
            g = gcd(g, x)
        return g

    if g(a) > 1:
        print("not coprime")
        exit()
    p = osk_a(10**6)
    chk = set()
    while a[0] > 1:
        chk.add(p[a[0]])
        a[0] //= p[a[0]]
    for x in a[1:]:
        tmp = set()
        while x > 1:
            tmp.add(p[x])
            x //= p[x]
        if not chk.isdisjoint(tmp):
            print("setwise coprime")
            exit()
        chk |= tmp
    print("pairwise coprime")


if __name__ == "__main__":
    main()


Measured memory_bytes: 113116
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define M 1000000000000000000
ll n,k,a[5005],ans,d[5005],dp[5005];
int main(void){
    cin>>n>>k;
    ans=n;
    dp[0]=1;
    for(int i=0;i<n;i++){
        cin>>a[i];
        for(int j=k-a[i];j>=0;j--)dp[j+a[i]]=(dp[j+a[i]]+dp[j])%M;
    }
    for(int i=0;i<n;i++){
        if(a[i]>=k){
            ans--;
            continue;
        }
        for(int j=0;j<k;j++){
            if(j-a[i]>=0)d[j]=(dp[j]+M-d[j-a[i]])%M;
            else d[j]=dp[j];
            if(j>=k-a[i]&&d[j]>0){
                ans--;
                break;
            }
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#define REP(i, a, n) for (long long i = (a); i < (long long)(n); ++i)
#define REPC(i, a, n) for (long long i = (a); i <= (long long)(n); ++i)
#define ALL(t) t.begin(), t.end()
#define RALL(t) t.rbegin(), t.rend()
#define MATINIT(type, row, col, init)                                          \
  vector<vector<type>>(row, vector<type>(col, init));
#define Yes(cond) cout << (cond ? "Yes" : "No") << endl;
#define YES(cond) cout << (cond ? "YES" : "NO") << endl;
using namespace std;
using LL = long long;
using ULL = unsigned long long;
template <class T> using VEC = std::vector<T>;
template <class T> using MAT = std::vector<std::vector<T>>;
void DUMP() { cerr << endl; }
template <class Head, class... Tail> void DUMP(Head &&head, Tail &&... tail) {
  cerr << head << ", ";
  DUMP(std::move(tail)...);
}
template <typename T> ostream &operator<<(ostream &os, vector<T> &vec) {
  os << "{";
  for (auto v : vec)
    os << v << ",";
  os << "}";
  return os;
}
template <typename T> ostream &operator<<(ostream &os, set<T> &s) {
  os << "{";
  for (auto p : s)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, map<T1, T2> &m) {
  os << "{";
  for (auto p : m)
    os << p << ",";
  os << "}";
  return os;
}
template <typename T1, typename T2>
ostream &operator<<(ostream &os, pair<T1, T2> p) {
  os << "[" << p.first << " " << p.second << "]";
  return os;
}
int Keta(int n, int s){
  int cnt =0;
  while(n>0){
    cnt++;
    n/=s;
  }
  return cnt;

}

int main() {
  int N,K;
  cin>>N>>K;
  cout<<Keta(N, K)<<endl;

  return 0;
}


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

int main(void) {
    int n, a, b, c, d;
    char *s;

    scanf("%d%d%d%d%d", &n, &a, &b, &c, &d);

    s = calloc(n, sizeof(char));

    scanf("%s", s);

    int a_1 = a;
    int b_1 = b;

    if (c < d) {
        while (a_1 != a || b_1 != d) {
            int i = 0;
            int a_2 = a_1;
            int b_2 = b_1;

            if (b_1 != d && s[b_1] == '.')
                b_2 += 1;
            else if(b_1 != d && s[b_1 + 1] == '.')
                b_2 += 2;
            if (a_1 != c && s[a_1] == '.' && b_1 != a_1 + 1)
                a_2 += 1;
            else if (a_1 != c && s[a_1 + 1] == '.' && b_1 != a_1 + 2)
                a_2 += 2;

            if (a_1 == a_2 && b_1 == b_2)
                break;
            else {
                a_1 = a_2;
                b_1 = b_2;
            }
        }
    }

    if (c > d) {
        while (a_1 != a || b_1 != d) {
            int i = 0;
            int a_2 = a_1;
            int b_2 = b_1;


            if (s[b_1 - 2] == '.' && s[b_1] == '.' && a_2 < b_2)
                a_2 = b_2 + 1;

            if (b_1 != d && s[b_1] == '.')
                b_2 += 1;
            else if(b_1 != d && s[b_1 + 1] == '.')
                b_2 += 2;
            if (a_1 != c && s[a_1] == '.' && b_1 != a_1 + 1)
                a_2 += 1;
            else if (a_1 != c && s[a_1 + 1] == '.' && b_1 != a_1 + 2)
                a_2 += 2;

            if (a_1 == a_2 && b_1 == b_2)
                break;
            else {
                a_1 = a_2;
                b_1 = b_2;
            }
        }
    }
    
    if (a_1 == c && b_1 == d)
        printf("Yes\n");
    else
        printf("No\n");

    return 0;
}

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

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

	deque<int> b;
	for(int i = 0; i < n; ++i) {
		if( i % 2 == n % 2 ) {
			b.push_back( a[i] );
		} else {
			b.push_front( a[i] );
		}
	}

	for(int i = 0; i < n; ++i)
		i != n-1 ? cout << b[i] << " " : cout << b[i] << endl;

	return 0;
}

Measured memory_bytes: 3840
import java.io.*;
import java.util.*;
 
public class Main {
 
	public static void main(String[] args) throws IOException {
		Scanner scn = new Scanner(System.in);
		String T = scn.next();
		int idx = T.indexOf('7');
		System.out.print(idx == -1 ? "No" : "Yes");
	}
 
	static class Scanner {
 
		StringTokenizer st;
		BufferedReader br;
 
		public Scanner(InputStream s) {
			br = new BufferedReader(new InputStreamReader(s));
		}
 
		public String next() throws IOException {
			while (st == null || !st.hasMoreTokens())
				st = new StringTokenizer(br.readLine());
			return st.nextToken();
		}
 
		public int nextInt() throws IOException {
			return Integer.parseInt(next());
		}
 
		public long nextLong() throws IOException {
			return Long.parseLong(next());
		}
	}
}

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

int main() {
  int N, M, C;
  cin >> N >> M >> C;
  vector<int> B(M);
  for (int i = 0; i < M; i++) cin >> B[i];
  vector<vector<int>> A(N, vector<int>(M));
  for (int i = 0; i < N; i++) for (int j = 0; j < M; j++) cin >> A[i][j];

  int ans = 0;
  for (int i = 0; i < N; i++) {
    int sum = C;
    for (int j = 0; j < M; j++) sum += A[i][j] * B[j];
    if (sum > 0) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
long long b[200005];
int main()
{
    long long n,m,i,j,k,x=0,y,z;
    cin>>n;
    long long a[n+5];
    for(i=1;i<=n;i++){
        cin>>a[i];
    }
    map<long long,long long>mp;
    j=1;
    for(i=1;i<=n;i++){
        if(a[i]<=i && mp[a[i]]==0 && b[a[i]]==0 && j==a[i]){
            b[j]=1;
            j=j+1;
            mp[a[i]]=1;
            a[i]=-1;
        }
    }
    for(i=1;i<=n;i++){
        if(a[i]!=-1){
            x++;
        }
    }
    if(x==n){
        cout<<-1<<endl;
        return 0;
    }
   cout<<x<<endl;
}




Measured memory_bytes: 15872
N = int(input())
*h, = map(int, input().split())

dp = [float('inf')]*(10**6)
dp[0] = 0

for i in range(1,N):

    if i==1:
        dp[i] = dp[i-1]+abs(h[i]-h[i-1])
        continue
    dp[i] = min(dp[i-1]+abs(h[i]-h[i-1]), dp[i-2]+abs(h[i]-h[i-2]))

print(dp[N-1])

Measured memory_bytes: 18612
#include <math.h>
#include <time.h>
#include <ctype.h>
#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include<iomanip>

#define mod 1000000007
#define ll long long int
#define pb(x) push_back(x)
#define MP(x,y) make_pair(x,y)

using namespace std;

ll power(ll a, ll b, ll m)
{
	if (b == 0)
		return(1);
	ll sol = power(a, b / 2, m);
	sol = (sol * sol) % m;
	if (b % 2 == 1)
		sol = (sol * a) % m;
	return(sol);
}

ll gcd(ll a, ll b)
{
	if (b == 0)
		return a;
	else
	{
		return gcd(b, a % b);
	}
}
void solve()
{
	ll a,b,ans=1;
	cin >> a >> b;
	ll g = gcd(a, b);
	for (ll i = 2; i <= 1000000; i++)
	{
		if (g % i)
			continue;
		ans++;
		while (g % i == 0)
		{
			g = g / i;
		}
	}
	if (g > 1)
		ans++;
	cout << ans;
}
int main()
{
	int t = 1;
	//cin >> t;
	while (t--)
	{
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
} 

ll modPow(ll a, ll x, ll p) {
    //calculates a^x mod p in logarithmic time.
    ll res = 1;
    while(x > 0) {
        if( x % 2 != 0) {
            res = (res * a) % p;
        }
        a = (a * a) % p;
        x /= 2;
    }
    return res;
}

ll modInverse(ll a, ll p) {
    //calculates the modular multiplicative of a mod m.
    //(assuming p is prime).
    return modPow(a, p-2, p);
}
ll modBinomial(ll n, ll k, ll p) {
// calculates C(n,k) mod p (assuming p is prime).

    ll numerator = 1; // n * (n-1) * ... * (n-k+1)
    for (int i=0; i<k; i++) {
        numerator = (numerator * (n-i) ) % p;
    }

    ll denominator = 1; // k!
    for (int i=1; i<=k; i++) {
        denominator = (denominator * i) % p;
    }

    // numerator / denominator mod p.
    return ( numerator* modInverse(denominator,p) ) % p;
}

ll f[200001];
 
ll pow(ll a, ll b, ll MOD)
{
 ll x=1,y=a; 
 while(b > 0)
    {
        if(b%2 == 1)
    {
        x=(x*y);
        if(x>MOD) x%=MOD;
    }
    y = (y*y);
    if(y>MOD) y%=MOD; 
    b /= 2;
    }
 return x;
}
 
/* Modular Multiplicative Inverse
 Using Euler's Theorem
 a^(phi(m)) = 1 (mod m)
 a^(-1) = a^(m-2) (mod m) */
ll InverseEuler(ll n, ll MOD)
{
 return pow(n,MOD-2,MOD);
}
 
ll C(ll n, ll r, ll MOD)
{
 
 return (f[n]*((InverseEuler(f[r], MOD) * InverseEuler(f[n-r], MOD)) % MOD)) % MOD;
}
 


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int x=nxt(),y=nxt();
    for(int i=0;i<=x;i++)
    {
        if(2*i+4*(x-i)==y)
        {
            cout<<"Yes\n";
            return 0;
        }
    }

    cout<<"No\n";

    return 0;   
}


 
 


Measured memory_bytes: 3652
import sys
sys.setrecursionlimit(10 ** 9)
input = sys.stdin.readline

from itertools import permutations,  combinations, accumulate
from functools import *
from collections import deque, defaultdict, Counter
from heapq import heapify, heappop, heappush, heappushpop

INF = float('inf')
NIL = - 1

def YesNo(flag): print('Yes' if flag else 'No')
def yesno(flag): print('yes' if flag else 'no')

""" Input
N = int(input())
N, A, B = map(int, input().split())
A = list(map(int, input().split()))
D = [int(input()) for _ in range(N)]
"""

S = input().rstrip()
T = input().rstrip()

counter = 0
for i in range(3):
    if S[i] == T[i]:
        counter += 1

print(counter)

# def main():


# if __name__ == '__main__':
#     main()


Measured memory_bytes: 3572
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P>IP;
typedef vector<ll> V;
typedef vector<V> V2;
typedef vector<vector<P> > G;
void g_dir(G &graph, ll a, ll b, ll w = 1){graph[a].push_back(P(b, w));}
void g_undir(G &graph, ll a, ll b, ll w = 1){g_dir(graph, a, b, w);g_dir(graph, b, a, w);}
#define rep(i, n) for(ll (i) = 0; (i) < (n); (i)++)
#define rep1(i, n) for(ll (i) = 1; (i) <= (n); (i)++)
#define rrep(i, n) for(ll (i) = (n) - 1; (i) >= 0; (i)--)
#define rrep1(i, n) for(ll (i) = (n); (i) >= 1; (i)--)
template<class T> void chmax(T &a, const T &b){if(a < b){a = b;}}
template<class T> void chmin(T &a, const T &b){if(a > b){a = b;}}
const ll INF = 1145141919;
const ll MOD = 1000000007;
const ll NUM = 101010;

priority_queue<P, vector<P>, greater<P> >Q;

ll N, v[NUM], dep[NUM], chi[NUM];

int main(){
    cin >> N;
    for (ll i = 2; i <= N; i++) {
        cin >> v[i];
        chi[v[i]]++;
    }
    for (ll i = 2; i <= N; i++) {
        if (chi[i] == 0) {
            Q.push(P(dep[i], i));
        }
    }
    while(!Q.empty()){
        ll j = Q.top().second;
        Q.pop();
        if (j == 1)break;
        ll i = v[j];
        if (dep[i] <= dep[j])dep[i] = dep[j] + 1;
        else dep[i]++;
        chi[i]--;
        if (chi[i] == 0) {
            Q.push(P(dep[i], i));
        }
        
    }
    cout << dep[1] << endl;
    
    return 0;
}

Measured memory_bytes: 6476
#include <iostream>
#include <stdlib.h>
using namespace std;

int main(){
    int a;
    cin >> a;
    int b[a];
    long c = 0;
    long d = 0;
    long e = 9000000000000000000;
    for(int i = 0; i< a; i++){
        cin >> b[i];
        d += b[i]; 
    }
    for(int i = 0; i< a; i++){
        d -= b[i];
        c += b[i];
        if((labs(d - c) < e))e = labs(d - c);
    }
    cout << e << endl;
}

Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#include <string>
#include <vector>
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define REP(i, n) for (int i = 0; i < n; i++)
using namespace std;

int search(int A[], int n, int key) {
    int i = 0;
    A[n] = key;
    while (A[i] != key) i++;
    return i != n;
}

int main() {
    int n, q;
    int S[10010], T[510];
    cin >> n;
    REP(i, n) cin >> S[i];
    cin >> q;
    REP(i, q) cin >> T[i];
    int cnt = 0;

    REP(i, q) {
        if (search(S, n, T[i])) cnt++;
    }
    cout << cnt << endl;
}


Measured memory_bytes: 3132
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <cstring>
#include <queue>
#include <functional>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cassert>
#define SIZE 100005
#define MOD 998244353

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

ll gcd(ll x,ll y)
{
	if(x==0) return y;
	return gcd(y%x,x);
}
ll A[SIZE];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%lld",&A[i]);
	sort(A,A+n);
	ll ret=A[0];
	for(int i=1;i<n;i++)
	{
		ret=ret*gcd(A[i],i)%MOD;
	}
	printf("%lld\n",ret);
	return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
int main()
{
	int h1,m1,h2,m2,k;
	scanf("%d %d %d %d %d",&h1,&m1,&h2,&m2,&k);
	int jam1 = h1 * 60 + m1;
	int jam2 = h2 * 60 + m2;
	printf("%d\n",jam2-jam1-k);
	return 0;
	
	
}

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

#define mx 100005
#define md 1000000007
using namespace std;

int n, k, kind = 1, j, l;
long long t, d, num1[mx], num2[mx], ans, tmp;
pair<long long, long long> sushi[mx];
bool al[mx];

int main(){
	scanf("%d%d", &n, &k);
	for(int i = 0; i < n; i++){
		scanf("%lld%lld", &t, &d);
		sushi[i] = make_pair(d, t);
	}
	sort(sushi, sushi+n, greater<pair<long long, long long> >());

	for(int i = 0; i < n; i++){
		if(!al[sushi[i].second]){
			al[sushi[i].second] = true;
			num1[j++] = sushi[i].first + kind;
			kind += 2;
		}else num2[l++] = sushi[i].first;
	}

	for(int i = 0; i < min(j, k); i++) tmp += num1[i];
	for(int i = 0; i < max(0, k - j); i++) tmp += num2[i];
	ans = tmp;

	for(int i = max(0, k - j); i < min(l, k); i++){
		tmp += num2[i] - num1[k-1-i];
		ans = max(ans, tmp);
	}

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

Measured memory_bytes: 2688
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <algorithm>
#include <iomanip>
#include <queue>
using ll = long long;
using namespace std;

int const MOD = 1e9 + 7;

int cnt;

int p[100010];

struct UnionFind
{
    vector<int> rnk, par;

    UnionFind(int N) : rnk(N), par(N)
    {
        for (int i = 0; i < N; ++i)
        {
            rnk[i] = 1;
            par[i] = i;
        }
    }
    int root(int x)
    {
        if (par[x] == x)
            return x;
        return par[x] = root(par[x]);
    }
    void unite(int x, int y)
    {
        x = root(x);
        y = root(y);

        if (x == y)
            return;

        if (rnk[x] > rnk[y])
            par[y] = x;
        else
        {
            par[x] = y;
            if (rnk[x] == rnk[y])
                rnk[y]++;
        }
    }
    bool same(int x, int y)
    {
        x = root(x);
        y = root(y);
        return x == y;
    }
};

int main(void)
{
    int N, M;
    cin >> N >> M;

    UnionFind uf(N);

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

    for (int i = 0; i < M; ++i)
    {
        int x, y;
        cin >> x >> y;
        x--;
        y--;
        uf.unite(x, y);
    }
    int ans = 0;

    for (int i = 0; i < N; ++i)
    {
        if (uf.same(i, p[i]))
            ans++;
    }

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

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

typedef long long LL;
typedef long double LD;
typedef pair < int, int > PII;
typedef pair < LL, LL > PLL;
typedef pair < LD, LD > PDD;

#define _upgrade ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()
template < typename _T > inline void _DBG(const char *s, _T x) { cerr << s << " = " << x << "\n"; }
template < typename _T, typename... args > void _DBG(const char *s, _T x, args... a) { while(*s != ',') cerr << *s++; cerr << " = " << x << ','; _DBG(s + 1, a...); }

#ifdef LOCAL
#define DBG(...) _DBG(#__VA_ARGS__, __VA_ARGS__)
#else
#define DBG(...) (__VA_ARGS__)
#define cerr if(0) cout
#endif

// ********************** CODE ********************** //

int main()
{
    _upgrade
    string s; cin >> s;
    if(sz(s) >= 4 && s.substr(0, 4) == "YAKI")
        cout << "Yes\n";
    else
        cout << "No\n";
	return 0;
}


Measured memory_bytes: 384
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

d = {}
for s in S:
  if(s not in d):
    d[s] = 1
  else:
    d[s] += 1
for t in T:
  if(t in d):
    d[t] -= 1
print(max(max(d.values()), 0))

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define COUT(x) cout<<(x)<<"\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define REP(i, n) for(int i=0;i<n;i++)
#define YES(x) cout<<(x?"YES":"NO")<<"\n"
#define Yes(x) cout<<(x?"Yes":"No")<<"\n"
#define dump(x) cout<<#x<<" = "<<(x)<<"\n"
#define endl "\n"
using G = vector<vector<int>>;
using M = map<int,int>;
using P = pair<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int,vector<int>,greater<int>>;
using V = vector<int>;
using ll = long long;
using edge = struct { int to; int cost; };
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll LINF = 1e18;

const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const { return pow(mod-2);}
  mint& operator/=(const mint a) { return *this *= a.inv();}
  mint operator/(const mint a) const { return mint(*this) /= a;}
};
istream& operator>>(istream& is, const mint& a) { return is >> a.x;}
ostream& operator<<(ostream& os, const mint& a) { return os << a.x;}

ll choose(ll n, ll a) {
  ll x = 1, y = 1;
  for (ll i = 0; i < a; i++) {
    x *= n-i;
    y *= i+1;
  }
  return x / y;
}

// パスカルの三角形
mint c[4005][4005];

// パスカルの三角形を前計算する
void init() {
  c[0][0] = 1;
  REP(i,4001) REP(j,i+1) {
    c[i+1][j] += c[i][j];
    c[i+1][j+1] += c[i][j];
  }
}

mint comb(int n, int k) {
  return c[n][k];
}

mint f2(int n, int k) {
  return comb(n+k-1,k-1);
}

// n個の中から、k個選ぶ
mint f(int n, int k) {
  if (n < k) return 0;
  if (n == 0 && k == 0) return 1;
  if (k < 1) return 0;
  return f2(n-k,k);
}

int main() {
  IOS;
  init();
  int n, k; cin >> n >> k;

  for (int i = 1; i <= k; i++) {
    mint blue = f(k,i);
    mint red = f2(n-k-(i-1), i+1);
    /*
    mint red = 0;
    {
      red += f(n-k,i-1); // 両端を含まない
      red += f(n-k,i); // 片方の端を含む
      red += f(n-k,i); // 片方の端を含む
      red += f(n-k,i+1); // 両端を含む
    }
    */
    mint ans = blue * red;
    COUT(ans);
  }
  return 0;
}

Measured memory_bytes: 128940
#include<bits/stdc++.h>
	using namespace std;
	int main()
	{
	
	priority_queue<int> pq;
	int n, m;
	cin >> n >> m;
	for(int i = 0; i < n; ++i){
		int x;
		cin >> x;
		pq.push(x);
	}
	while(m--){
		int k = pq.top();
		pq.pop();
		pq.push(k/2);
	}
	long long sum = 0;
	for(int i = 0; i < n; ++i){
		sum += pq.top();
		pq.pop();
	}
	cout << sum;
	return 0;
	}

Measured memory_bytes: 892
N = int(input())
A = list(map(int, input().split()))

# 各山に(2 * L_i)リットルの雨が降ったとする
# ナンバリングは０オリジン
L = [0 for i in range(N)]
A_even = [A[2 * i] for i in range((N + 1) // 2)] 
A_odd = [A[2 * i + 1] for i in range((N - 1) // 2)]

L[0] = (sum(A_even) - sum(A_odd)) // 2
for i in range(1, N):
    L[i] = A[i - 1] - L[i - 1]

ans = [L[i] * 2 for i in range(N)]

print(' '.join(map(str, ans)))

Measured memory_bytes: 23880
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)1e9+7;
const ll N = 3005, inf = 1e9+5000;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

ll grid[N][N];
ll dp[N][N][4];

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  
  int r, c; cin >> r >> c;
  int n; cin >> n;
  rep (i, n) {
    int ri, ci; cin >> ri >> ci;
    ri--, ci--;
    cin >> grid[ri][ci];
  }

  for (int i = 0; i < r; i++) {
    for (int j = 0; j < c; j++) {
      for (int taken = 1; taken <= 3; taken++) {
        // take i, j
        for (int t_left = 0; t_left <= taken-1; t_left++)
          dp[i][j][taken] = max(dp[i][j][taken], ((j>0)?dp[i][j-1][t_left]:0)+grid[i][j]);
        for (int t_above = 0; t_above <= 3; t_above++)
          dp[i][j][taken] = max(dp[i][j][taken], ((i>0)?dp[i-1][j][t_above]:0)+grid[i][j]);
      }
      for (int taken = 0; taken <= 3; taken++) {
        // leave i, j
        for (int t_left = 0; t_left <= taken; t_left++)
          dp[i][j][taken] = max(dp[i][j][taken], ((j>0)?dp[i][j-1][t_left]:0));
        for (int t_above = 0; t_above <= 3; t_above++)
          dp[i][j][taken] = max(dp[i][j][taken], ((i>0)?dp[i-1][j][t_above]:0));
      }
    }
  }

  ll ans = 0;
  for (int taken = 0; taken <= 3; taken++) 
    ans = max(ans, dp[r-1][c-1][taken]);

  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 355480
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <list>
#include <set>
#include <numeric>

#include <map>
#include <math.h>
#include <iomanip>
#include <stack>
#include <queue>
#include <bitset>

#define INF 100100100

typedef long long int llint;

using namespace std;

typedef pair<int, int>Pii;

int main() {
	char c[2][3];
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	if (c[0][0] == c[1][2] && c[1][0] == c[0][2] && c[0][1] == c[1][1])puts("YES");
	else puts("NO");
	return 0;
}

Measured memory_bytes: 256
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	var cnt int

	a := nextInt()
	b := nextInt()
	c := nextInt()
	x := nextInt()

	for i := 0; i <= a; i++ {
		for j := 0; j <= b; j++ {
			for k := 0; k <= c; k++ {
				if 500*i+100*j+50*k == x {
					cnt++
				}
			}
		}
	}
	fmt.Println(cnt)
}


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

public class Main {
    static int answer = 0;
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int q = sc.nextInt();

        int[][] query = new int[q][4];

        for(int i = 0; i < q; i++){
            query[i][0] = sc.nextInt() -1;
            query[i][1] = sc.nextInt() -1;
            query[i][2] = sc.nextInt();
            query[i][3] = sc.nextInt();
        }

        solve(n, m, q, query);

        System.out.println(answer);

    }
    static void solve(int n, int m, int q, int[][] query){
        int[] a = new int[n];
        Arrays.fill(a, 0);
        solveSub(a, m, 0, q, query);
    }

    static void solveSub(int[] a, int m, int index, int q, int[][] query){
        if(index < a.length){
            int start = 0;
            if(index != 0) start = a[index - 1];
            for(int i = start; i < m; i++ ){
                a[index] = i;
                solveSub(a, m, index + 1, q, query);
            }
        } else {
            answer = Math.max(answer, score(a, q, query));
        }
    }

    static int score(int[] a, int q, int[][] query){
        int score = 0;
        for(int i = 0; i < q; i++){
            if(query[i][2] == (a[query[i][1]] + 1) - (a[query[i][0]] + 1)) score += query[i][3];
        }
        return score;
    }
}

Measured memory_bytes: 36724
import sys

input=sys.stdin.readline

H,W,N=map(int,input().split())
point=set([])
ans=[0 for i in range(0,10)]
ans[0]=(H-2)*(W-2)

def black(x,y):
    ans=0
    if x!=1:
        if y!=1:
            if (x-1,y-1) in point:
                ans+=1
        if (x-1,y) in point:
            ans+=1
        if y!=W:
            if (x-1,y+1) in point:
                ans+=1
    if y!=1:
        if (x,y-1) in point:
            ans+=1
    if (x,y) in point:
        ans+=1
    if y!=W:
        if (x,y+1) in point:
            ans+=1
    if x!=H:
        if y!=1:
            if (x+1,y-1) in point:
                ans+=1
        if (x+1,y) in point:
            ans+=1
        if y!=W:
            if (x+1,y+1) in point:
                ans+=1
    return ans

for _ in range(0,N):
    a,b=map(int,input().split())
    if a>2:
        if b>2:
            ss=black(a-1,b-1)
            ans[ss]-=1
            ans[ss+1]+=1

        if W>b>1:
            ss=black(a-1,b)
            ans[ss]-=1
            ans[ss+1]+=1

        if W-1>b:
            ss=black(a-1,b+1)
            ans[ss]-=1
            ans[ss+1]+=1
    if H>a>1:
        if b>2:
            ss=black(a,b-1)
            ans[ss]-=1
            ans[ss+1]+=1

        if W>b>1:
            ss=black(a,b)
            ans[ss]-=1
            ans[ss+1]+=1

        if W-1>b:
            ss=black(a,b+1)
            ans[ss]-=1
            ans[ss+1]+=1

    if H-1>a:
        if b>2:
            ss=black(a+1,b-1)
            ans[ss]-=1
            ans[ss+1]+=1
        if W>b>1:
            ss=black(a+1,b)
            ans[ss]-=1
            ans[ss+1]+=1

        if W-1>b:
            ss=black(a+1,b+1)
            ans[ss]-=1
            ans[ss+1]+=1

    point.add((a,b))

for i in range(0,10):
    print(ans[i])


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

int n;
int a[500500];

int main()
{
    scanf("%d", &n);
    for (int i = 0; i < n; i++)
        scanf("%d", &a[i]);
    for (int i = n - 1; i >= 0; i -= 2)
        printf("%d ", a[i]);
    for (int i = n & 1; i < n; i += 2)
        printf("%d ", a[i]);
}


Measured memory_bytes: 2944
// Aizu Vol0 0002: Digit Number
// 2018.09.08
 
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
 
#define MAX 8
int max[MAX] = {
    0,
    0,
    10,
    100,
    1000,
    10000,
    100000,
    1000000
};
 
int main()
{
    int a, b, c;
    int i;
 
    while (scanf("%d%d", &a, &b) == 2) {
        c = a + b;
        for (i = MAX - 1; i >= 0; i--) {
            if (c >= max[i]) break;
        }
        putchar('0' + i);
        putchar('\n');
    }
    return 0;
}


Measured memory_bytes: 2036
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n,i;
  cin>>n;
  vector<tuple<string,int,int>> t(n);
  for(i=0;i<n;i++) {
    cin>>get<0>(t.at(i))>>get<1>(t.at(i));
    get<1>(t.at(i))=-get<1>(t.at(i));
    get<2>(t.at(i))=i;
  }
  sort(t.begin(),t.end());
  for(i=0;i<n;i++) cout<<get<2>(t.at(i))+1<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char a[200005];
int n,p,s[200005],cnt[200005];
long long ans=0;
int main(){
	scanf("%d%d%s",&n,&p,a+1);
	if(p==2){
		for(int i=n;i>=1;i--)if(a[i]%2==0)ans+=i;
		cout<<ans;
		return 0;
	}
	if(p==5){
		for(int i=n;i>=1;i--)if(a[i]=='0'||a[i]=='5')ans+=i;
		cout<<ans;
		return 0;
	}
	for(int i=n,pp=1;i>=1;i--,pp=pp*10%p)s[i]=(1ll*(a[i]-'0')*pp%p+s[i+1])%p;
	cnt[0]=1;
	for(int i=n;i>=1;i--){
	//	cout<<s[i]<<' ';
		ans+=cnt[s[i]];
		cnt[s[i]]++;
	}
	cout<<ans;
}

Measured memory_bytes: 1280
import math

A, B, H, M = map(int, input().split())

jihari = 30 * H + 1 / 2 * M
hunhari = 6 * M 

theta = abs(jihari - hunhari)
thetarad = math.radians(theta)

l = math.sqrt(A**2 + B**2 - 2 * A * B * math.cos(thetarad))

print(l)

Measured memory_bytes: 9496
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
  int N, M;
  cin >> N >> M;
  int l, r;
  cin >> l >> r;  // 1st

  for (int i = 1; i < M; ++i) {
    int l_i, r_i;
    cin >> l_i >> r_i;

    if(l <= l_i){
      l = l_i;
    }
    if(r >= r_i){
      r = r_i;
    }
  }
  
  cout << max(0, r - l + 1) << endl;

  return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
const long long MOD = 1e9 + 7, MAX = 1e18, larg = 1e5, INF = -1e9;
long long A, B, C, D, E, F, G, H, I, J, K, L, N, M, O, P, Q, R, S, T, U, V, W;
typedef long long ll;
typedef pair<ll, ll> Pa;
typedef pair<Pa, Pa> info;

vector<int> arr;
vector<info> infos;

ll dfs(int prev) {
	ll ans = 0;
	if (arr.size() == N) {
		ll sum = 0;
		rep(i, Q) 
			if ((arr[infos[i].first.second] - arr[infos[i].first.first]) 
					== infos[i].second.first) 
				sum += infos[i].second.second;
		
		return sum;
	}
	else {
		for (int i = prev; i <= M; i++) {
			arr.push_back(i);
			ans = max(ans, dfs(i));
			arr.pop_back();
		}
	}
	return ans;
}

int main()
{
	cin >> N >> M >> Q;
	rep(i, Q) {
		cin >> A >> B >> C >> D;
		A--; B--;
		infos.push_back(info(Pa(A, B), Pa(C, D)));
	}
	cout << dfs(1);
}


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

// #define int long long
#define rep(i, n) for (long long i = (long long)(0); i < (long long)(n); ++i)
#define reps(i, n) for (long long i = (long long)(1); i <= (long long)(n); ++i)
#define rrep(i, n) for (long long i = ((long long)(n)-1); i >= 0; i--)
#define rreps(i, n) for (long long i = ((long long)(n)); i > 0; i--)
#define irep(i, m, n) for (long long i = (long long)(m); i < (long long)(n); ++i)
#define ireps(i, m, n) for (long long i = (long long)(m); i <= (long long)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) long long(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;
using vtp = vector<tuple<ll,ll,ll>>;
using vb = vector<bool>;

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

const ll INF = 1e9;
const ll MOD = 1e9+7;
const ll LINF = 1e18;

ll bitcount(ll x){
  if(x==0) return 0;
  return bitcount(x>>1)+(x&1);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  
  ll n; cin>>n;
  vector<vpll> xy(n);
  rep(i,n){
    ll a; cin>>a;
    rep(j,a){
      ll x,y; cin>>x>>y; x--,y;
      xy[i].emplace_back(x,y);
    }
  }
  
  ll ans=0;
  for(ll bit=0; bit<(1<<n); bit++){
    bool ok=true;
    rep(i,n){
      if(bit>>i&1){
        for(auto e: xy[i]){
          ll x=e.first, y=e.second;
          if(bit>>x&1){
            if(y==0) ok=false;
          }else{
            if(y==1) ok=false;
          }
        }
      }
    }
    if(ok){
      // cout<<bit<<endl;
      ll cnt=bitcount(bit);
      chmax(ans,cnt);
    }
  }
  cout<<ans<<endl;
}

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

int main() {
  int n; cin >> n;
  vector<int> d(n);
  rep(i,n) cin >> d[i];
  sort(d.begin(), d.end());
  int ans = d[n/2] - d[n/2-1];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3768
#include <bits/stdc++.h>
#define rep(i, n) for (int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll MOD = 1000000007;
const ll INF = 10000000000000000;
vector<int> x4 = {0, 1, 0, -1}, x8 = {0, 1, 1, 1, 0, -1, -1, -1};
vector<int> y4 = {1, 0, -1, 0}, y8 = {1, 1, 0, -1, -1, -1, 0, 1};
template<class T> struct edge { int from, to; T cost;};
template<class T> inline bool chmin(T& a, T b){if (a>b){a = b; return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if (a<b){a = b; return true;}return false;}
template<class T> inline T powerM(T a,T b){if (b==0) return 1;
T tmp = powerM(a,b/2); if (b%2==0) return tmp*tmp%MOD; else return tmp*tmp%MOD*a%MOD; }
template<class T> inline T power(T a,T b,T m){ if (b==0) return 1;
  T tmp = power(a,b/2,m); if (b%2==0) return tmp*tmp%m; else return tmp*tmp%m*a%m; }
template<class T> inline T gcd(T a, T b){if (b==0) return a; return gcd(b, a%b);}
template<class T> inline T lcm(T a, T b){return a / gcd(a,b) * b;}
// ax+by=gcd(a,b)を解く
template<class T> inline T extgcd(T a,T b,T &x,T &y){if (b==0){x=1; y=0; return a;} T d=extgcd(b,a%b,y,x); y -= a/b*x; return d;}


/*
int N;
Graph G;

int main() {
  cin >>N;
  rep(i, N-1){
    int a,b; cin >>a >>b; a--; b--;
    G[a].push_back(b); G[b].push_back(a);
  }
}
*/

int main() {
  string s; cin >>s;
  int n = s.size();
  if (n < 4){ cout <<"No" <<endl; return 0;}
  string t = "YAKI";
  rep(i, 4){
    if (s[i] != t[i]){ cout <<"No" <<endl; return 0;}
  }
  cout <<"Yes" <<endl;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;

class Program
{
    static void Main(string[] args)
    {
        var hw = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var fromto = new int[10][];
        for (var i = 0; i < 10; i++)
            fromto[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        var gred = new int[hw[0]][];
        for (var i = 0; i < hw[0]; i++)
            gred[i] = Array.ConvertAll(ReadLine().Split(' '), int.Parse);
        for (var k = 0; k < 10; k++)
            for (var i = 0; i < 10; i++)
                for (var j = 0; j < 10; j++)
                    fromto[i][j] = Min(fromto[i][j], fromto[i][k] + fromto[k][j]);
        var res = 0L;
        for (var i = 0; i < hw[0]; i++)
            for (var j = 0; j < hw[1]; j++)
                if (gred[i][j] != -1 && gred[i][j] != 1)
                    res += fromto[gred[i][j]][1];
        WriteLine(res);
    }
    private const string ALFA = "abcdefghijklmnopqrstuvwxyz";
    private const int MOD = 1000000007;
}


Measured memory_bytes: 13268
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <cmath>
#include <climits>
#include <iomanip>
#include <set>
#include <map>
using namespace std;
typedef long long ll;
int main(){
  ll n,m;
  cin >> n >> m;
  vector<ll> a(n);
  for(int i = 0;i < n;i++)cin >> a[i];
  map<ll,ll> mp;
  a[0] %= m;
  mp[a[0]]++;
  for(int i = 1;i < n;i++){
    a[i] += a[i - 1];
    a[i] %= m;
    mp[a[i]]++;
  }
  ll res = 0;
  for(auto i:mp){
    res += (i.second - 1) * i.second / 2;
  }
  res += mp[0];
  cout << res << endl;
}

Measured memory_bytes: 7792
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    int n;
    cin >> n;
    vector<pair<int,int>> task(n);
    for (int i = 0; i < n; i++) {
        cin >> task[i].first >> task[i].second;
    }

    sort(task.begin(), task.end(),
         [](auto& a, auto& b) { return a.second < b.second; });

    int t = 0;
    for (int i = 0; i < n; i++) {
        t += task[i].first;
        if (t > task[i].second)
            goto No;
    }
    cout << "Yes" << endl;
    return 0;
No:
    cout << "No" << endl;
    return 0;
}

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

using namespace std;

# define REP(i, a, b) for(int i = a; i <= b; ++ i)
# define CLR(i, a) memset(i, a, sizeof(i))
# define REPD(i, a, b) for(int i = a; i >= b; -- i)
# define REPG(i, h, x) for(int i = h[x], v; ~i; i = edge[i].next)

const int N = 2e4 + 3, M = 1010000;

# define ls (x << 1)
# define rs (x << 1 | 1)
# define u tr[x]
# define uls tr[ls]
# define urs tr[rs]

int tr[N << 2];

int tot, cnt, head[N << 1], len;
struct qwq { int v, next; } edge[M << 1];
inline void add(int x, int y) { edge[++ cnt] = (qwq) { y, head[x] }, head[x] = cnt; }

struct info { 
	int val, id; 
	info() {}
	info(int _val, int _id) : val(_val), id(_id) {} 
	bool operator <(const info y)const { 
		return val == y.val ? id < y.id : val < y.val; 
	}
} a[N];

int n, ptot, pos[N];

inline int id(int x, int op) { return op ? x + n : x; }

void lk(int x, int l, int r, int ql, int qr, int p) {
	if(ql > qr) return ;
	if(ql <= l && qr >= r) { add(p, u); return; }
	int mid = l + r >> 1;
	if(ql <= mid) lk(ls, l, mid, ql, qr, p);
	if(qr > mid) lk(rs, mid + 1, r, ql, qr, p);
}
bool fl = 0;
void build(int x, int l, int r) {
	if(l == r) { 
		u = a[l].id > n ? a[l].id - n : a[l].id + n; 
//		if(fl) printf("%d:[%d,%d]\n", u, l, r);
		return ; 
	}
	u = ++ ptot;
//	if(fl) printf("%d:[%d,%d]\n", u, l, r);
	int mid = l + r >> 1;
	build(ls, l, mid), build(rs, mid + 1, r);
	add(u, uls), add(u, urs);
}

int dfn[N << 1], bel[N << 1], belnum, tp, tim, stk[N << 1], low[N << 1];
int instk[N << 1], vtim;

void dfs(int x, int f) {
	low[x] = dfn[x] = ++ tim;
	stk[++ tp] = x;
	instk[x] = vtim;
	REPG(i, head, x) if((v = edge[i].v) != f){
		if(!dfn[v]) {
			dfs(v, x), low[x] = min(low[v], low[x]);
		}
		else if(instk[v] == vtim) {
			low[x] = min(dfn[v], low[x]);
		}
	}
	if(low[x] == dfn[x]) {
		++ belnum;
		int tmp = stk[tp];
		while(tmp != x) {
			bel[tmp] = belnum;
			instk[tmp] = 0;
			tmp = stk[-- tp];
		} 
		bel[stk[tp]] = belnum;
		instk[stk[tp --]] = 0;
	}
}

bool chk(int k) {
	cnt = 0, CLR(head, -1);
	ptot = len;
	build(1, 1, len);
	REP(i, 1, len) {
		int l = lower_bound(a + 1, a + len + 1, info(a[i].val - k + 1, 0)) - a;
		int r = upper_bound(a + 1, a + len + 1, info(a[i].val + k - 1, len + 3)) - a - 1;
		lk(1, 1, len, l, pos[a[i].id] - 1, a[i].id);
		lk(1, 1, len, pos[a[i].id] + 1 , r, a[i].id);
	}
	REP(i, 1, ptot) bel[i] = dfn[i] = low[i] = 0;
	belnum = tp = tim = 0, ++ vtim;
	REP(i, 1, ptot) {
		if(!dfn[i]) dfs(i, 0);
	} 
	REP(i, 1, n) {
		if(bel[i] == bel[i + n]) return 0;
	}
	return 1;
}

int main() {
//	freopen("1.in", "r", stdin);
	scanf("%d", &n);
	len = n << 1;
	REP(i, 1, n) {
		int x, y; scanf("%d%d", &x, &y);
		a[i] = info(x, i);
		a[i + n] = info(y, i + n);
	}
	sort(a + 1, a + len + 1); 
//	REP(i, 1, len) cout<<a[i].val<<","<<a[i].id<<endl;
	REP(i, 1, len) pos[a[i].id] = i;
	int l = 0, r = 1e9;
	while(l < r) {
		int mid = l + r + 1 >> 1;
		if(chk(mid)) l = mid;
		else r = mid - 1;
	}
	printf("%d\n", l);
	return 0;
}

Measured memory_bytes: 10240
#include<stdio.h>
int main(void){
    int a[3];
    int sum;
    int i;
    sum=0;
    scanf("%d %d %d",&a[0],&a[1],&a[2]);
    for(i=0;i<3;++i){
        sum+=a[i];
    }
    if(sum<=21){
        printf("win\n");
    }else{
        printf("bust\n");
    }
    return 0;
}

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

int main() {
    int N;
    cin >> N;

    for (int i = 0;i <= 25;i++)
    {
        for (int n = 0;n <= 14;n++)
        {
            if (N == 4 * i + 7 * n)
            {
                cout << "Yes" << endl;
                return 0;
            }
        }
    }

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

Measured memory_bytes: 3640
using System;
using System.Collections.Generic;
class program{
	static void Main (string[] args){
    	string input = Console.ReadLine();
      	List<char> output = new List<char>();
      	for(int i = 0; i < input.Length;i ++){
        	switch(input[i]){
              case '0':
   				output.Add('0');
                break;
              case '1':
                output.Add('1');
                break;
              default:
                if(output.Count > 0)output.RemoveAt(output.Count - 1);
                break;
            }
        }
      char[] final = new char[output.Count];
      for(int i = 0;i < output.Count;i ++){
      	final[i] = output[i];
      }
      
      Console.WriteLine(final);
    }
}

Measured memory_bytes: 13140
package main

import ( "fmt" )

func main() {
  var a int
  var b int

  fmt.Scanf("%d %d", &a, &b)

  if a < b {
    fmt.Printf("a < b\n")
  } else if a > b  {
    fmt.Printf("a > b\n")
  } else {
    fmt.Printf("a == b\n")
  }
}


Measured memory_bytes: 1108