akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N,S;
  int sum=0;
  cin>>N;
  S=N;
  while(N!=0){
    sum=sum+N%10;
    N=N/10;
  }
  if(S%sum==0){
   cout<<"Yes"<<endl;
  }else{
   cout<<"No"<<endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<b;i++)
#define f(i,n) for(int i=0;i<n;i++)
typedef unsigned long long ull;
typedef long long ll;
#define vint vector<int>
#define pb(a) push_back(a);
#define bug(x) cout<<#x<<" = "<<x<<endl;
#define fastio ios_base::sync_with_stdio(false); cin.tie(0);

int dp[3001][3001];
int main()
{	
	fastio;
	string s, t;
	int n, m;
	cin >> s >> t;
	n = s.size();
	m = t.size();
	// int dp[n + 1][m + 1];
	memset(dp,0,sizeof(dp));
	for (int i = 0; i <= n; i++)
	{
		for (int j = 0; j <= m; j++)
		{
			if (i == 0 || j == 0)
				dp[i][j] = 0;
			else if (s[i - 1] == t[j - 1])
				dp[i][j] = dp[i - 1][j - 1] + 1;
			else
				dp[i][j] = max(dp[i - 1][j], dp[i][j - 1]);
		}
	}
	stack<char> st;
	int i = n, j = m;
	while (i > 0 && j>0)
	{
		if (s[i - 1] == t[j - 1])
		{
			st.push(s[i - 1]);
			i--;
			j--;
		}
		else
		{
			int k = max(dp[i - 1][j], dp[i][j - 1]);
			if (dp[i - 1][j] == k)
			{
				i--;
			}
			else
			{
				j--;
			}
		
		}
	}
	if(dp[n][m]!=0)
	while (!st.empty())
	{
		cout << st.top();
		st.pop();
	}
	else
	{
		cout<<"";
	}
	
}

Measured memory_bytes: 35456
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll n, k;
	cin >> n >> k;
	cout << min(n % k, abs((n % k) - k)) << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


Measured memory_bytes: 256
using System;

namespace Test
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split(' ');
            int a = int.Parse(s[0]);
            int b = int.Parse(s[1]);

            if(b % k <= b - a)
                Console.WriteLine("OK");
            else
                Console.WriteLine("NG");
        }
    }
}

Measured memory_bytes: 17864
using System;
class Program
{
    static void Main()
    {
        //以下入力を受け取る
        string[] s = Console.ReadLine().Split(' ');
        int a, b, c, d;
        a = int.Parse(s[0]);
        b = int.Parse(s[1]);
        c = int.Parse(s[2]);
        d = int.Parse(s[3]);

        //以下処理内容
        bool ansb = Math.Abs(c - a) <= d || (Math.Abs(a - b) <= d && Math.Abs(b - c) <= d);
        string anss = ansb ? "Yes" : "No";

        //以下解答の出力
        Console.WriteLine(anss);
    }
}

Measured memory_bytes: 13140
#include <stdio.h>
#include <string.h>
int main(void) {
 
    int n,i,S[13],H[13],C[13],D[13],num;
    char s[100];
    scanf("%d", &n);
    for(i=0;i<n;i++){
        scanf("%s %d",&s,&num);
        if(strcmp("S",s)==0){
            S[num] = num;
        }
        if(strcmp("H",s)==0){
            H[num] = num;
        }
        if(strcmp("C",s)==0){
            C[num] = num;
        }
        if(strcmp("D",s)==0){
            D[num] = num;
        }
    }
    for(i=1;i<14;i++){
        if(S[i]!=i){
            printf("S %d\n",i);
        }
    }
    for(i=1;i<14;i++){
        if(H[i]!=i){
            printf("H %d\n",i);
        }
    }
    for(i=1;i<14;i++){
        if(C[i]!=i){
            printf("C %d\n",i);
        }
    }
    for(i=1;i<14;i++){
        if(D[i]!=i){
            printf("D %d\n",i);
        }
    }
    return 0;
}
 

 


 

Measured memory_bytes: 596
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
using ll = long long;
int main(){
    int x, y;
    cin >> x >> y;
    if(4*x>= y&& 2*x <=y && y%2 ==0 ){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

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

static const int MAX = 200000;

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
std::vector<int> Eratosthenes( const int N )
{
    std::vector<bool> is_prime( N + 1 );
    for( int i = 0; i <= N; i++ )
    {
        is_prime[ i ] = true;
    }
    std::vector<int> P;
    for( int i = 2; i <= N; i++ )
    {
        if( is_prime[ i ] )
        {
            for( int j = 2 * i; j <= N; j += i )
            {
                is_prime[ j ] = false;
            }
            P.emplace_back( i );
        }
    }
    return P;
}
int main()
{
    int N;
    cin >> N;
    for( const auto &x: Eratosthenes( 1000000 ))
    {
      if (N <= x) {
        cout << x << endl;
        break;
      }
    }
    return 0;
}


Measured memory_bytes: 3976
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) { cout << H << " "; debug_out(T...); }
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

ll gcd (ll x, ll y) { return y ? gcd(y,x%y) : x; }

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  ll n, m;
  cin >> n >> m;
  if (n > m) swap(n,m);
  ll ans = 0;
  if (n == 1 && m == 1) ans = 1;
  else if (n == 1) ans = m-2;
  else ans = (n-2)*(m-2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<list>
#include<map>
#include<numeric>
#include<iomanip>
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define ll long long

using namespace std;

int fact(int n) {
	int ans = 1;
	for (int i = n; i > 0; i--) {
		ans *= i;
	}
	return ans;
}

int main(){
	int n;
	cin >> n;
	vector<double>x(n, 0);
	vector<double>y(n, 0);
	rep(i, n) {
		cin >> x[i] >> y[i];
	}
	
	vector<int>v(n, 0);
	rep(i, n) v[i] = i + 1;
	double ans = 0;
	do {
		double part = 0;
		rep(i, v.size() - 1) {
			double temp1 = x[v[i] - 1] - x[v[i + 1] - 1];
			double temp2 = y[v[i] - 1] - y[v[i + 1] - 1];
			part += sqrt(temp1 * temp1 + temp2 * temp2);
		}
		ans += part;
	} while (next_permutation(v.begin(), v.end()));
	ans = ans / fact(n);

	cout << fixed << setprecision(13) << ans << endl;

	return 0;
}

Measured memory_bytes: 256
def div(x):
    ans = 0
    for i in range(1, x + 1):
        if x % i == 0:
            ans += 1
    return ans
n = int(input())
ans = 0
for x in range(1, n + 1, 2):
    if div(x) == 8:
        ans += 1
print(ans)


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

#define ASC(a) a.begin(), a.end()		// 昇順ソート 例：sort(ASC(a));
#define DESC(a) a.rbegin(), a.rend()	// 降順ソート 例:sort(DESC(a));
#define rep(i, n) for(int i = 0; i < n; ++i)
//#define rep(i, a, n) for(int i = a; i < n; ++i)
#define Rep(i, n) for(int i = 1; i < n; ++i)
#define In(a) rep(i, n) cin>>a[i];
#define ANS(s) cout << s << endl
#define inc(a, b) cin >> a >> b;
#define only_unique(vec) vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
#define souwa(vec) accumulate(ASC(vec), 0)

const int mod = 1000000007;
const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<vector<int> > vvi;
typedef vector<pair<int, int> > vii;

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

ll GCD(ll a, ll b) { return b ? GCD(b, a % b) : a; }
ll LCM(ll a, ll b) { return (a * b) / GCD(a, b); }
int round_int(int a, int b) { return (a + (b - 1)) / b; }


// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };


// ────────────────────────────────────────────────────
int n;

bool check(vi a) {
	int def = a[1] - a[0];
	Rep(i, a.size()) {
		if (a[i] - a[i - 1] != def) return false;
	}
	return true;
}

int  main() {
	while (1) {
		cin >> n;
		if (!n) break;

		vi h(n + 1);
		rep(i, n + 1) cin >> h[i];

		rep(i, n + 1) {
			vi tmp = h;
			tmp.erase(tmp.begin() + i);
			if (check(tmp)) {
				cout << h[i] << endl;
				break;
			}
		}
	}
}



Measured memory_bytes: 3088
#include <bits/stdc++.h>
#define cina(a, n) for (int i = 0; i < n; ++i){ cin >> a[i]; }
#define ll long long

using namespace std;

int main () {
	
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int a, b, c, k, ca, cb;
	cin >> a >> b >> c >> k;
	ca = min(a, k);
	k -= ca;
	cb = min(b, k);
	k -= cb;
	cout << ca - k;
	return 0;
}

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define pp pair<ll,ll>
#define pq_min priority_queue<ll,vector<ll>,greater<ll>>
#define pq_max priority_queue<ll>
#define forx(i,a,b) for(ll i=0;i<a;i++)
#define ld long double
const ll mod=1e9 + 7;
const int N = 2000001; 
ll power(ll a,ll b)
{
	a=a%mod;
	ll ans=1;
	while(b>0)
	{
		if(b%2==1)
		{
			ans=(ans*a)%mod;
		}
		b=b/2;
		a=(a*a)%mod;
	}
	return ans;
}

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	srand(time(NULL));
    ll a,b,c;
    cin>>a>>b>>c;
    if(a+b+c >= 22)
    {
    	cout<<"bust";
	}
	else
	{
		cout<<"win";
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n,m,sum=0;cin>>n;
  vector<int> t(n);
  for(int i=0;i<n;i++){
    cin>>t.at(i);
    sum+=t.at(i);
  }
  cin>>m;
  vector<int> p(m),x(m);
  for(int j=0;j<m;j++)cin>>p.at(j)>>x.at(j);
  for(int k=0;k<m;k++)cout<<sum-t.at(p.at(k)-1)+x.at(k)<<endl;
  
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    q = N // K
    r = N % K
    count = q 
    if abs(r - K) < r:
        r = abs(r - K)
    print(r)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    solve(N, K)

if __name__ == '__main__':
    main()


Measured memory_bytes: 3060
x=['L','U','D','R']
s=input()
a='Yes'
for i in range(len(s)):
  if i%2==0:
    if s[i] not in x[1:]:
      a='No'
      break
  else:
    if s[i] not in x[:3]:
      a='No'
      break
print(a)

Measured memory_bytes: 2940
A, B, C, X, Y = [int(i) for i in input().split()]
if X < Y:
    ans = X*C*2+(Y-X)*B
else:
    ans = Y*C*2+(X-Y)*A
ans = min(A*X+B*Y, max(X, Y)*C*2, ans)
print(ans)


Measured memory_bytes: 38256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <cassert>
#include <queue>
using namespace std;
using lint = long long;
const lint mod = 256;
#define all(x) (x).begin(), (x).end()
#define bitcount(n) __builtin_popcountl((lint)(n))
#define fcout cout << fixed << setprecision(15)
#define highest(x) (63 - __builtin_clzl(x))
template<class T> inline void YES(T condition){ if(condition) cout << "YES" << endl; else cout << "NO" << endl; }
template<class T> inline void Yes(T condition){ if(condition) cout << "Yes" << endl; else cout << "No" << endl; }
template<class T> inline void POSS(T condition){ if(condition) cout << "POSSIBLE" << endl; else cout << "IMPOSSIBLE" << endl; }
template<class T> inline void Poss(T condition){ if(condition) cout << "Possible" << endl; else cout << "Impossible" << endl; }
template<class T> inline void First(T condition){ if(condition) cout << "First" << endl; else cout << "Second" << endl; }
template<class T = string, class U = char>int character_count(T text, U character){ int ans = 0; for(U i: text){ ans += (i == character); } return ans; }
lint power(lint base, lint exponent, lint module){ if(exponent % 2){ return power(base, exponent - 1, module) * base % module; }else if(exponent){ lint root_ans = power(base, exponent / 2, module); return root_ans * root_ans % module; }else{ return 1; }}
struct position{ int y, x; }; position mv[4] = {{0, -1}, {1, 0}, {0, 1}, {-1, 0}}; // double euclidean(position first, position second){ return sqrt((second.x - first.x) * (second.x - first.x) + (second.y - first.y) * (second.y - first.y)); }
template<class T, class U> string to_string(pair<T, U> x){ return to_string(x.first) + "," + to_string(x.second); } string to_string(string x){ return x; }
template<class itr> void array_output(itr start, itr goal){ string ans; for(auto i = start; i != goal; i++) ans += to_string(*i) + " "; if(!ans.empty()) ans.pop_back(); cout << ans << endl; }
template<class itr> void cins(itr first, itr last){ for(auto i = first; i != last; i++){ cin >> (*i); } }
template<class T> T gcd(T a, T b){ if(a && b){ return gcd(min(a, b), max(a, b) % min(a, b)); }else{ return a; }} template<class T> T lcm(T a, T b){ return a / gcd(a, b) * b; }
struct combination{ vector<lint> fact, inv; combination(int sz) : fact(sz + 1), inv(sz + 1){ fact[0] = 1; for(int i = 1; i <= sz; i++){ fact[i] = fact[i - 1] * i % mod; } inv[sz] = power(fact[sz], mod - 2, mod); for(int i = sz - 1; i >= 0; i--){ inv[i] = inv[i + 1] * (i + 1) % mod; } } lint C(int p, int q) const{ if(q < 0 || p < q) return 0; return (fact[p] * inv[q] % mod * inv[p - q] % mod); } };
template<class itr> bool next_sequence(itr first, itr last, int max_bound){ itr now = last; while(now != first){ now--; (*now)++; if((*now) == max_bound){ (*now) = 0; }else{ return true; } } return false; }

using p = pair<lint, int>;

int main(){
    int ans = 0;
    int last = 0;
    for(int i = 0; i < 5; i++){
        int x;
        cin >> x;
        ans += (x + 9) / 10 * 10;
        if(x % 10 == 0){
            continue;
        }
        last = max(last, 10 - x % 10);
    }
    cout << ans - last << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
using namespace std;

int main()
{
    long long N,M;
    cin >> N >> M;
    long long ans=0;
    while(N)
    if(N*2<=M){//sccを作る
        ans+=N;
        M-=N*2;
        N=0;
    }else{
        ans+=M/2;
        N=0;
        M=0;
    }

    //sがなくなるのでsを作る
    ans+=M/4;
    cout << ans << endl;
    
    return 0;
}


Measured memory_bytes: 256
/*...Part - 01...*/

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <iterator>
#include <bitset>
#include <assert.h>
#include <new>
#include <sstream>
//#include <bits/stdc++.h>
using namespace std ;

/*...Part - 02...*/

typedef long long               ll ;
typedef long double             ld ;
typedef unsigned long long      ull ;
typedef pair<int,int>           pii ;
typedef pair<ll,ll>             pll ;
typedef vector<int>             vi ;
typedef vector<ll>              vll ;
typedef vector<vector<int>>     vvi ;

int Int(){int x ; scanf("%d",&x) ; return x ;}
ll Long(){ll x ; scanf("%lld",&x) ; return x ;}

/*...Part - 03...*/
/*....Debugger....*/

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {cout << endl ;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << ' ' ;
    err(++it, args...);
}

/*...Part - 04...*/
/*...Needed to change according to problem requirements...*/

const int N          = (int)2e5 + 5 ;
const int maxN       = (int)1e6 + 6 ;
const ll  Mod        = (ll)1e9 + 7 ;
const int inf        = (int)2e9 ;
const ll  Inf        = (ll)1e18 ;

/*..........................................................*/
/*...Part - 05...*/

#define     debug(x)    cerr << #x << " = " << x << '\n' ;
#define     rep(i,b,e)  for(__typeof(e) i = (b) ; i != (e + 1) - 2 * ((b) > (e))  ; i += 1 - 2 * ((b) > (e)))
#define     Int         Int()
#define     Long        Long()
#define     all(x)      x.begin() , x.end()
#define     sz(x)       (int)x.size()
#define     ff          first
#define     ss          second
#define     pb          push_back
#define     eb          emplace_back
#define     mem(a)      memset(a , 0 ,sizeof a)
#define     memn(a)     memset(a , -1 ,sizeof a)

/*...Part - 06...*/
/*...... ! Code start from here ! ......*/

int dp[N][3], a[N], n;

int call(int p, int r){
    if(p == n - 1)return 0 ;
    int& ret = dp[p][r] ;
    if(~ret)return ret ;
    ret = inf ;
    if(p + 1 < n)ret = min(ret, call(p + 1, 1) + abs(a[p] - a[p + 1])) ;
    if(p + 2 < n)ret = min(ret, call(p + 2, 2) + abs(a[p] - a[p + 2])) ;
    return ret ;
}


int main(){
    int test = 1 , tc = 0 ;
    while(test--){
        n = Int ;
        for(int i = 0 ; i < n ; ++i)a[i] = Int ;
        memn(dp) ;
        cout << call(0, 0) << '\n' ;
    }
    return 0 ;
}

/*...Always look at the part - 04...*/
/*...............END................*/




Measured memory_bytes: 7680
#include<stdio.h>

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



Measured memory_bytes: 2108
#include<stdio.h>
int main(void){

  int a[4],b[4],i,j,Hit,Blow;

  while(1)
    {
      Hit=0;
      Blow=0;
      if(scanf("%d %d %d %d",&a[0],&a[1],&a[2],&a[3])==EOF)break;
      scanf("%d %d %d %d",&b[0],&b[1],&b[2],&b[3]);

      for(i=0;i<4;i++)
	{
	  if(a[i]==b[i])Hit++;
	}
      
      for(i=0;i<4;i++)
	{
	  for(j=0;j<4;j++)      
	    {
	      if(a[i]==b[j])
		{
		  Blow++;
		}
	    }
	}
      printf("%d %d\n",Hit,Blow-Hit);
    }
  
  return 0;
}

Measured memory_bytes: 0
import java.util.*;

public class Main {

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

	public void run() {
		Scanner sc = new Scanner(System.in);
		char c[] = sc.next().toCharArray();

		int d1=c[0]-'0';
		int d2=c[1]-'0';
		int d3=c[2]-'0';
		int d4=c[3]-'0';


		for(int i=0; i<2; i++) {
			for(int j=0; j<2; j++) {
				for(int k=0; k<2; k++) {
					int sum = d1;
					if(i%2==0) {
						sum+=d2;
					}else {
						sum-=d2;
					}
					if(j%2==0) {
						sum+=d3;
					}else {
						sum-=d3;
					}
					if(k%2==0) {
						sum+=d4;
					}else {
						sum-=d4;
					}
					if(sum==7) {
						System.out.print(d1);
						System.out.print(i%2==0 ? '+' : '-');
						System.out.print(d2);
						System.out.print(j%2==0 ? '+' : '-');
						System.out.print(d3);
						System.out.print(k%2==0 ? '+' : '-');
						System.out.print(d4);
						System.out.println("=7");
						sc.close();
						return;
					}
				}
			}
		}
		sc.close();
	}
}


Measured memory_bytes: 35664
#include <bits/stdc++.h>
#define ll long long int
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using namespace std;

int main() {
    fast
	int t=1;
// 	cin>>t;
	while(t--){
	    int n;
	    cin>>n;
	    unordered_set<string> se;
	    for(int i=0;i<n;i++) {
	        string x;
	        cin>>x;
	        se.insert(x);
	    }
	    cout<<se.size();
	    
	}
	return 0;
}


Measured memory_bytes: 17656
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;


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

typedef pair<ll, ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;
typedef vector<vll> vvll;
typedef vector<ld> vld;

#define fi first
#define se second

typedef tree<pll, null_type, less<pll>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const ll inf = ll(1e18);
const int MOD = (1e9 + 7);

int main() 
{

	ios_base::sync_with_stdio(false);
    	cin.tie(NULL);
	#ifdef DEBUG_
		freopen("input.txt","r",stdin);
	#endif
	cout.setf(ios::fixed), cout.precision(20);
	ll n;
	cin >> n;
	string st;
	cin >> st;
	if(n%2==1)
		cout<<"No"<<"\n";
	else{
		bool yes=true;
		for(int i=0;i<n/2;i++){
			if(st[i]!=st[n/2+i]){
				yes=false;
				break;
			}
		}
		if(yes) 
			cout<<"Yes"<<"\n";
		else 
			cout<<"No"<<"\n";
	}
	return 0;
}



Measured memory_bytes: 256
S = input()
T = input()

def calculate(s, t):
    dictS = {}
    dictT = {}

    for ss in s:
        if dictS.get(ss) == None:
            dictS.__setitem__(ss, 1)
        else:
            dictS.__setitem__(ss, dictS.get(ss) + 1)

    for tt in t:
        if dictT.get(tt) == None:
            dictT.__setitem__(tt, 1)
        else:
            dictT.__setitem__(tt, dictT.get(tt) + 1)

    sValues = dictS.values()
    tValues = dictT.values()

    sNums = {}
    tNums = {}


    for value in sValues:
        if sNums.get(value) == None:
            sNums.__setitem__(value,1)
        else:
            sNums.__setitem__(value,sNums.get(value) + 1)

    for value in tValues:
        if tNums.get(value) == None:
            tNums.__setitem__(value,1)
        else:
            tNums.__setitem__(value,tNums.get(value) + 1)

    if (sNums == tNums):
        print("Yes")
    else:
        print("No")

calculate(S, T)


Measured memory_bytes: 3632
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner x= new Scanner(System.in);

String y = x.next();
char[] z = new char[y.length()];
int c=0;
for(int i=0;i<y.length();i++){
if(y.charAt(i)=='B'){
    if(c!=0){
	c--;
    z[c] =0;

    }
}else{
    z[c] = y.charAt(i);
    c++;
    }
}

String o = "";
for(int i=0;i<c;i++){
	o = o+z[i];

}
System.out.println(o);
}
}

Measured memory_bytes: 9424
def is_prime(x):
    if x == 1:
        return False
    for d in range(2, int(x ** 0.5)+1):
        if x % d == 0:
            return False
    return True


n = int(input())
ans = 0
for _ in range(n):
    x = int(input())
    if is_prime(x):
        ans += 1
print(ans)



Measured memory_bytes: 5704
#include <algorithm>
#include <cmath>
#include <climits>
#include <cstring>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <map> //pair is also included in this library
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

#define REP(i, s, n) for(int i = (int)(s); i < (int)(n); i++)
#define fst first
#define snd second
#define MP make_pair //incase c++11 or later is not available

using namespace std;

typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;

//prefer define statement
//for reason that const int ver. of INF will raise a silly warning (unused variable)
#define INF (INT_MAX/3)
#define LIM_INF (INT_MAX)
//const int INF = INT_MAX/3;

/*------------------------------------------------------------------------------*/

int main(){
  string s;
  cin >> s;

  int cnt = 0;
  bool y = true;
  while(cnt < (int)s.size()){
    if(s.substr(cnt, 5) == "dream"){
      cnt += 5;
      if(s.substr(cnt, 3) == "erd" || s.substr(cnt, 3) == "ere"){
        cnt += 2;
      } else if(s.substr(cnt, 2) == "er" && (cnt + 2) == (int)s.size()){
        break;
      }
    } else if(s.substr(cnt, 5) == "erase"){
      cnt += 5;
      if(s[cnt] == 'r'){
        cnt++;
      }
    } else {
      y = false;
      break;
    }
  }
  if(y){
    printf("YES\n");
  } else{
    printf("NO\n");
  }

  return 0;
}


Measured memory_bytes: 512
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		String s = "";
		Scanner sc = new Scanner(System.in);
		s = sc.next();
		int len = s.length();
		String[] ar = s.split("");
		int count = 0;
		for (int i = 0; i < len / 2; i++) {
			if (ar[i].equals(ar[len - i - 1]) == false) {
				count++;
			}
		}
		System.out.println(count);
	}
}


Measured memory_bytes: 23892
import sys
import io, os
input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

from collections import defaultdict

class BIT:
    def __init__(self, n):
        self.n = n
        self.bit = [0]*(self.n+1) # 1-indexed

    def init(self, init_val):
        for i, v in enumerate(init_val):
            self.add(i, v)

    def add(self, i, x):
        # i: 0-indexed
        i += 1 # to 1-indexed
        while i <= self.n:
            self.bit[i] += x
            i += (i & -i)

    def sum(self, i, j):
        # return sum of [i, j)
        # i, j: 0-indexed
        return self._sum(j) - self._sum(i)

    def _sum(self, i):
        # return sum of [0, i)
        # i: 0-indexed
        res = 0
        while i > 0:
            res += self.bit[i]
            i -= i & (-i)
        return res

class RangeAddBIT:
    def __init__(self, n):
        self.n = n
        self.bit1 = BIT(n)
        self.bit2 = BIT(n)

    def init(self, init_val):
        self.bit2.init(init_val)

    def add(self, l, r, x):
        # add x to [l, r)
        # l, r: 0-indexed
        self.bit1.add(l, x)
        self.bit1.add(r, -x)
        self.bit2.add(l, -x*l)
        self.bit2.add(r, x*r)

    def sum(self, l, r):
        # return sum of [l, r)
        # l, r: 0-indexed
        return self._sum(r) - self._sum(l)

    def _sum(self, i):
        # return sum of [0, i)
        # i: 0-indexed
        return self.bit1._sum(i)*i + self.bit2._sum(i)

def main():

    n, q = map(int, input().split())
    C = list(map(int, input().split()))
    LI = [[] for _ in range(n)]
    for i in range(q):
        l, r = map(int, input().split())
        l, r = l-1, r-1
        LI[r].append((l, i))

    #LR.sort(key=lambda x: x[1])

    bit = RangeAddBIT(n)
    preidx = defaultdict(lambda: -1)
    ans = [-1]*q
    for r in range(n):
        p = preidx[C[r]]
        bit.add(p+1, r+1, 1)
        preidx[C[r]] = r
        for l, i in LI[r]:
            ans[i] = bit.sum(l, l+1)
    print(*ans, sep='\n')

if __name__ == '__main__':
    main()


Measured memory_bytes: 242664
#include <string>
#include <vector>
#include <iostream>
using namespace std;
int n, vis[11]; long long z, p; string s;
long long rec(long long x, int d) {
	if(d == n) return x;
	long long ret = -1, sa = -1;
	for(int i = 0; i <= 9; i++) {
		if(!vis[i]) {
			vis[i] = 1;
			long long res = rec(x * 10 + i, d + 1);
			long long d1 = abs(res - z);
			long long d2 = min(d1, p - d1);
			if(sa < d2) {
				ret = res;
				sa = d2;
			}
			vis[i] = 0;
		}
	}
	return ret;
}
int main() {
	cin >> s;
	n = s.size(); p = 1;
	for(int i = 0; i < n; i++) {
		z = z * 10 + s[i] - 48;
		p *= 10;
	}
	long long ret = rec(0, 0);
	for(int i = 0; i < n; i++) {
		p /= 10;
		cout << (ret / p) % 10;
	}
	cout << endl;
	return 0;
}

Measured memory_bytes: 3196
N = int(input())

u_list = []
v_list = []
w_list = []

for _ in range(N-1):
  u, v, w = map(int, input().split())
  u_list.append(u-1)
  v_list.append(v-1)
  w_list.append(w)
  
color_dict = dict()
uvw_list = list(zip(u_list, v_list, w_list))
color_dict[u_list[0]] = 1

def eval_single(u, v, w, color_dict):
  skip = True

  if u in color_dict:
    color_dict[v] = assign_color(color_dict[u], w)
    skip = False
    
  if v in color_dict:
    color_dict[u] = assign_color(color_dict[v], w)
    skip = False
    
  return skip, color_dict
  

def assign_color(color, w):
  if w%2==0:
    return color
  else:
    return color*(-1)+1
  
while True:
  ind_list = []
  for ind, (u, v, w) in enumerate(uvw_list):
    skip, color_dict = eval_single(u, v, w, color_dict)
    
    if skip:
      ind_list.append(ind)

  uvw_list = [uvw_list[ind] for ind in ind_list]
  
  if len(color_dict) == N:
    break

for i in range(N):
  print(color_dict[i])


Measured memory_bytes: 138244
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
// 多倍長テンプレ
/* ---------------------- ここから ---------------------- */
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
/* ---------------------- ここまで ---------------------- */
void YES(){cout << "YES" << endl;}
void NO(){cout << "NO" << endl;}
void Yes(){cout << "Yes" << endl;}
void No(){cout << "No" << endl;}
int main() {
  int N,X,T;
  cin >> N >> X >> T;
  int sum=0;
  if(N%X==0){
    sum=N/X*T;
  }
  else{
    sum=((N/X)+1)*T;
  }
  cout << sum;
  cout << endl;
  return 0;
}


Measured memory_bytes: 3632
/******************
*  Author: BD747  *
******************/
#include<algorithm>
#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<map>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<vector>
#include<bits/stdc++.h>
using namespace std;

int n;
int h[100005],dp[100005];

int main(){

	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>h[i];
	}
	dp[1]=0;
	dp[2]=abs(h[2]-h[1]);
	for(int i=3;i<=n;i++){
		dp[i]=min(abs(h[i]-h[i-1])+dp[i-1],abs(h[i]-h[i-2])+dp[i-2]);
	}
	cout<<dp[n]<<endl;

	return 0;
}


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

using namespace std;

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

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

int main() {
    int n;
    cin >> n;
    bool flag=1;
    int a;
    for (int i=0;i<n;i++) {
        cin  >> a;
        if (a%2==0) {
            if (a%3!=0 && a%5!=0) flag=0;
        }
    }
    if (flag) cout << "APPROVED" << endl;
    else cout << "DENIED" << endl;
}

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

struct node { 
    int key;
    node *left, *right, *parent;
};
node *root, *NIL;

node* minimum(node *x) {
    while( x ->left != NIL ) x = x->left;
    return x;
}

node * successor( node *x ) {
    if( x->right != NIL ) return minimum(x->right);
    node *y = x->parent;
    while( y != NIL && x == y->right ) {
        x = y;
        y = y->parent;
    }
    return y;
}

void delete_node( node* z ) {
    node *y, *x;

    if( z->left == NIL || z->right == NIL ) y = z;
    else y = successor(z);
    if( y ->left != NIL ) x = y->left;
    else x = y->right;

    if( x != NIL ) x->parent = y ->parent;

    if( y->parent == NIL ) root = x;
    else
        if(y == y->parent->left) {
            y->parent->left = x;
        } else {
            y->parent->right = x;
        }
    
    if( y != z ) z->key = y->key;
}

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

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

    while( x != NIL ) {
        y = x;
        if( z->key < x->key ) x = x->left;
        else x = x->right;
    }
    z->parent = y;
    if( y == NIL ) root = z;
    else {
        if( z->key < y->key ) y->left = z;
        else y ->right = z;
    }
}

node* find(node *x, int key) {
    while( x != NIL && key != x->key) {
        if( key < x->key) {
            x = x->left;
        } else {
            x = x->right;
        }
    }
    return x;
}

void preParse(node* u) {
    if(u == NIL) return;
    printf(" %d", u->key);
    preParse(u->left);
    preParse(u->right);
}

void inParse(node* u) {
    if(u == NIL) return;
    inParse(u->left);
    printf(" %d", u->key);
    inParse(u->right);
}

signed main() {
    ll n; scanf("%lld", &n); 
    string com;
    for( ll i = 0; i < n; i++ ) {
        cin >> com;
        if( com.at(0) == 'i') {
            int x;
            scanf("%d", &x);
            insert(x);
        } else if( com.at(0) == 'f' ) {
            int x;
            scanf("%d", &x);
            node* t = find(root, x);
            if( t != NIL ) printf("yes\n");
            else printf("no\n");
        } else if( com.at(0) == 'd' ) {
            int x; scanf("%d", &x);
            delete_node(find(root, x));
        } else  {
            inParse(root);
            putchar('\n');
            preParse(root);
            putchar('\n');
        }
    }

    return 0;
}





Measured memory_bytes: 22076
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <complex>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <iomanip>
#include <assert.h>
#include <array>
#include <cstdio>
#include <cstring>
#include <random>
#include <functional>
#include <numeric>
#include <bitset>
#include <fstream>

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { cout << #a << " = " << a << endl; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }

typedef long long ll;
int const inf = 1<<29;

#define MAX_V 222

int V;
vector<int> G[MAX_V];
int match[MAX_V];
bool used[MAX_V];

void add_edge(int u, int v)
{
    G[u].push_back(v);
    G[v].push_back(u);
}

bool dfs(int v)
{
    used[v] = true;
    for (int i = 0; i < (int)G[v].size(); i++) {
  int u = G[v][i], w = match[u];
  if (w < 0 || (!used[w] && dfs(w))) {
      match[v] = u;
      match[u] = v;
      return true;
  }
    }
    return false;
}

int bipartite_matching()
{
    int res = 0;
    memset(match, -1, sizeof(match));
    for (int v = 0; v < V; v++) {
  if (match[v] < 0) {
      memset(used, false, sizeof(used));
      if (dfs(v)) {
                res++;
            }
  }
    }
    return res;
}

int main() {

  int N, M;
  while(cin >> N >> M && (N|M)) {

    vector<tuple<int, int, int>> vs;
    rep(i, N) {
      int x, y, v; cin >> x >> y >> v;
      vs.push_back(make_tuple(x, y, v));
    }

    vector<tuple<int, int>> ts;
    rep(i, M) {
      int x, y; cin >> x >> y;
//      cout << "x, y " << x << ", " << y << endl;
      ts.push_back(make_tuple(x, y));
    }

    V = N + M;

    vector<tuple<double, int, int>> es;
    rep(i, N) rep(j, M) {
      int x, y, v; tie(x, y, v) = vs[i];
      int tx, ty; tie(tx, ty) = ts[j];
      es.emplace_back(sqrt((x-tx)*(x-tx)+(y-ty)*(y-ty)) / v, i, N + j);
    }

    double L = 0.0, R = 1e10;

    rep(_, 150) {
      double T = (L + R) / 2.0;
      rep(i, MAX_V) G[i].clear();
      rep(i, es.size()) {
        double c; int x, y; tie(c, x, y) = es[i];
        if(T >= c) {
          add_edge(x, y);
        }
      }
      if(bipartite_matching() == M) {
        R = T;
      } else {
        L = T;
      }
    }

    printf("%.20lf\n", R);
  }

  return 0;
}

Measured memory_bytes: 3492
import java.util.Arrays;
import java.util.HashMap;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();

		HashMap<String, Long> map = new HashMap<>();
		int i;
		String key;
		char[] temp;

		for(i = 0; i < n; i++) {
			key = scan.next();
			temp = key.toCharArray();
			Arrays.sort(temp);
			key = new String(temp);

			if(map.containsKey(key)) {
				long sum = map.get(key);
				if(sum == 0)
					map.put(key, new Long(1));
				else
					map.put(key, map.get(key) + 1);
			}else {
				map.put(key, new Long(0));
			}
		}

		long ans = 0;
		for(long a: map.values()) {
			ans += ((1 + a) * a) / 2;
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 58440
n = int(input())
x = list(map(int,input().split()))

syukai = sum(x)//n
ans=0
ans1=0
ans2=0
for i in range(n):
    ans += pow(x[i]-syukai-1,2)
    ans1 += pow(x[i]-syukai,2)
    ans2 += pow(x[i]-syukai+1,2)
print(min(ans,ans1,ans2))

Measured memory_bytes: 3064
# Aさんは a[m] 地点、Bさんは b[m] 地点、Cさんは c[m] 地点
# 二人の人間は、距離が d[m] 以内のとき直接会話可能
# A・Cが直接的に会話ができる or A・Bさんが直接会話でき、かつB・Cが直接会話できる
# 会話できるなら Yes を, できないなら No を出力せよ。
 
a,b,c,d = map(int , input().split())
# print(a)
# print(b)
# print(c)
# print(d)
 
# aとcの差の絶対値がd以下
if abs(c-a) <= d:
    print('Yes')
# aとbの差の絶対値がd以下かつbとcの差の絶対値がd以下
elif abs(b-a) <= d and abs(c-b) <= d:
    print('Yes')
else:
    print('No') 

Measured memory_bytes: 9060
#include<bits/stdc++.h>
 
using namespace std;
 
#define  fastio         ios:: sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<fixed;cout<<setprecision(10);
#define  randomINIT     mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define  foo(i,a,n)     for(ll i = (a); i <= n; i++)
#define  frr(i,a,n)     for(ll i = (a); i >= n; i--)
#define  fo(i,n)        for(ll i = 0; i < n; i++)
#define  all(x)         (x).begin(),(x).end()
#define  mset(x,val)    memset(x,val,sizeof(x))
#define  newl           cout<<"\n"
#define  pb             push_back
#define  mp             make_pair
#define  s              second
#define  f              first
#define  dline          cerr<<"///REACHED///\n";
#define  deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define  deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define  deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';
 
typedef  long long             ll;
typedef  long double           ld;
typedef  pair<ll,ll>           pll;
typedef  vector<ll>            vll;
typedef  vector<pll>           vpll;
 
const ll   MOD   =  1e+9+7;
const ll   INF   =  0x7f7f7f7f7f7f7f7f;
const int  INFi  =  0x7f7f7f7f;
const ll   N  =  1e+6+10;
 
vll adj[N];
int dx8[]={0,1,1,1,0,-1,-1,-1}, dy8[]={1,1,0,-1,-1,-1,0,1};
int dx4[]={0,1,0,-1}, dy4[]={1,0,-1,0};
 
//<<-----Declare Variable Here------->>//
int t=1;
ll n,m,k;
ll x1,g1,x2,g2;
string s[N];
ll ans = INF;
ll vis[N],visit_act[N];
struct Point{
	ll x,y,res;
};
//<<-----Implement Functions Here---->>//
void bfs()
{
	vis[(x1-1)*m+g1] = 1;
	queue<Point>q;
	q.push({x1,g1,0});
 
	while(q.size()>0)
	{
		Point p = q.front();q.pop();
		ll x = p.x;ll y = p.y;ll res = p.res;
 
		visit_act[(x-1)*m+y] = 1;
		if(x==x2&&y==g2)
		{
			ans =min(ans,res);
			break;
		}
		
		for(ll i=0;i<4;i++)
		{
			for(ll j=1;j<=k;j++)
			{
				ll dx = x+j*dx4[i];
				ll dy = y+j*dy4[i];
				if(s[dx][dy]=='@'||visit_act[(dx-1)*m+dy]==1)break;
				if(vis[(dx-1)*m+dy]==0)
				{
					q.push({dx,dy,res+1});
					vis[(dx-1)*m+dy]=1;
				}
			}
		}
 
	}
}
//<<-----Start of Main--------------->>//
void MAIN(){
		cin>>n>>m>>k;
		cin>>x1>>g1>>x2>>g2;
 
		for(ll i=1;i<=n;i++)
		{
			cin>>s[i];
			s[i] = "@" + s[i] + "@";
		}
		s[0] = s[n+1] = string(m+2,'@');
		bfs();
		if(ans==INF)cout<<-1;
		else cout<<ans;
 
		
}
 
int main(){
	fastio;randomINIT;
 
	//cin>>t;
	while(t--){
		MAIN();
	}
 
   
}

Measured memory_bytes: 73684
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod = 1e9+7;
const long long INF = 1e15;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);

    string s;
    cin >> s;
    int n = s.size();
    for(int i = 0; i < n; i++){
        if(i%2 == 0) cout << s[i];
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 3664
#include<algorithm>//sort,二分探索,など
#include<bitset>//固定長bit集合
#include<cmath>//pow,logなど
#include<complex>//複素数
#include<deque>//両端アクセスのキュー
#include<functional>//sortのgreater
#include<iomanip>//setprecision(浮動小数点の出力の誤差)
#include<iostream>//入出力
#include<map>//map(辞書)
#include<numeric>//iota(整数列の生成),gcdとlcm(c++17)
#include<queue>//キュー
#include<set>//集合
#include<stack>//スタック
#include<string>//文字列
#include<utility>//pair
#include<list>
#include<vector>//可変長配列
#include <assert.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define all(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<ll,ll>
#define F first
#define S second
int dx[8] = { 1,0,-1,0,1,-1,-1,1 };
int dy[8] = { 0,1,0,-1,1,1,-1,-1 };


string s;

int main() {
	cin >> s;
	if (s == "ABC")
		cout << "ARC\n";
	else
		cout << "ABC\n";
	return 0;
}


Measured memory_bytes: 3620
x1, y1, x2, y2 = map(int, input().split())

x3 = x2 - (y2 - y1)
y3 = y2 + (x2 - x1)

x4 = x3 - (y3 - y2)
y4 = y3 + (x3 - x2)

print(x3, y3, x4, y4)

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

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  if(a+b>=c) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
using PP = pair<int,pair<int,int>>;
using T = tuple<string,int,int>;
const string EMP = " ";
const ll INF = 1LL<<60;
const ll MOD = 1000000007;

int main(){
  ll n; cin >> n;
  vector<ull> a(n);
  for(int i = 0; i < n; i++){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  ull ans = 1;
  if(a[0] == 0){
    cout << 0 << endl;
    return 0;
  }
  for(int i = 0; i < n; i++){
    ull temp = ans;
    ans *= a[i];
    if(temp != ans/a[i]){
      cout << -1 << endl;
      return 0;
    }
    if(ans > 1000000000000000000){
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 4056
#include<bits/stdc++.h>
using namespace std;
#define int long long int 
int32_t main()
{
  int n,k;
  cin>>n>>k;
  if(n%k==0)
    cout<<0<<endl;
  
  else if(n%k<k/2)
    cout<<n%k;
  else
    cout<<k-n%k;
  return 0;
  
  
}
  
  

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

int main(void){
    int n;
    while(cin >> n, n){
        int k[101];
        string s;
        for(int i=0; i < n; i++)
            cin >> k[i];
        cin >> s;

        for(int i=0; i < s.length(); i++){
            for(int j=0; j < k[i%n]; j++){
                if(s[i] == 'A'){
                    s[i] = 'z';
                }else if(s[i] == 'a'){
                    s[i] = 'Z';
                }else{
                    s[i]--;
                }
            }
        }
        cout << s << endl;
    }
    return 0;
}

Measured memory_bytes: 1208
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <deque> 
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <cctype> 
using namespace std;

int main(){
    int N;
    string S;
    cin >> N >> S;
    int cnt=0 ,max=0;
    for (int i=0; i<N; i++) {
        if (S.at(i)=='I') cnt++;
        else cnt--;

        if (cnt>max) max=cnt;
    }
    cout << max << endl;
}

Measured memory_bytes: 256
num = int(input())

l = []

for i in range(num):
    c = [int(x) for x in input().split()]
    if c[0]== 0:
        l.append(c[1])
    elif c[0] ==1:
        print(l[c[1]])
    elif c[0] ==2:
        del(l[-1:])
        
        
    


Measured memory_bytes: 13364
#include<bits/stdc++.h>
using namespace std;
const long long maxn=200010LL;
long long n,d,a,xx,yy,res=0LL,pre[maxn];
pair<long long,long long> v[maxn];
long long num(long long x)
{
	long long ans=x/a;
	if(x%a) ++ans;
	return ans;
}
int main()
{
	cin>>n>>d>>a;
	long long ld=d*2LL+1LL; 
	for(long long i=1LL;i<=n;i++) cin>>v[i].first>>v[i].second;
	sort(v+1LL,v+1LL+n);
	v[n+1]=make_pair(1e18,1e18);
	for(long long i=1LL;i<=n;i++)
	{
		pre[i]+=pre[i-1];
		long long di=v[i].second-pre[i];
		if(di<=0LL) continue;
		long long tim=num(di);
		res+=tim;
		long long att=tim*a;
		long long ind=upper_bound(v+1LL,v+2LL+n,make_pair(v[i].first+ld,0LL))-v;
		pre[i]+=att;
		pre[ind]-=att;
	}
	cout<<res<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>     // [PRIMES]               1777 ~2^10.80  
using namespace std;                     //                       10333 ~2^13.33
using ll=long long;                      // seq 1 128 | factor   100333 ~2^16.61
using vl=vector<ll>;                     //   | grep -v ' .* '  1300111 ~2^20.31
using vvl=vector<vl>;                    //                    10300777 ~2^23.30
using vb=vector<bool>;                   //                   100400999 ~2^26.58
using vs=vector<string>;                 //                  1300400999 ~2^30.28
using pll=pair<ll,ll>;                   //                 10200500333 ~2^33.25
const ll oo =0x3f3f3f3f3f3f3f3fLL;       //                100200400777 ~2^36.54
const double eps=1e-9;                   //               1200300700111 ~2^40.13
#define sz(c) ll((c).size())             //              10200300500777 ~2^43.21
#define all(c) begin(c),end(c)           //             100200300400777 ~2^46.51
#define mp make_pair                     //            1200300400600999 ~2^50.09
#define mt make_tuple                    //           10200300400600111 ~2^53.18
#define pb push_back                     //          100200300400600333 ~2^56.48
#define eb emplace_back                  //         1200300400500800999 ~2^60.06
#define xx first
#define yy second
#define FOR(i,a,b) for(ll i=(a); i<(b); i++)
#define FORD(i,a,b) for(ll i=ll(b)-1;i>=(a);i--)
#define TR(X) ({if(1) cerr << "TR: " << (#X) << " = " << (X) << endl; })

using namespace std;

int main(){
	cin.sync_with_stdio(0);
	
	int n; string s;
	cin >> n >> s;
	
	ll maxi = 0;
	FOR(dist, 1, n - 1) {
		ll currSum = 0;
		for(ll starting = 0; starting + dist < n; starting++) {
			ll ending = starting + dist;
			
			if(s[starting] == s[ending]) {
				currSum++;
				currSum = min(currSum, dist);
				maxi = max(maxi, currSum);
			} else {
				currSum = 0;
			}
		}
	}
		
	cout << maxi << endl;

	return 0;
}

Measured memory_bytes: 384