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

using namespace std;

typedef unsigned long long ull;
typedef long long ll;

int x[3], y[3];
double m, r;

double area(){
	int xx[2], yy[2];
	for(int i=0; i<2; i++){
		xx[i]=x[i+1]-x[0];
		yy[i]=y[i+1]-y[0];
	}
	return abs(xx[0]*yy[1]-xx[1]*yy[0])/2.0;
}

double circle(){
	double l=0.0;
	for(int i=0; i<3; i++){
		double t=sqrt(pow(x[(i+1)%3]-x[i], 2)+pow(y[(i+1)%3]-y[i], 2));
		l+=t;
		m=max(m, t);
	}
	return 2.0*area()/l;
}

int main(){
	for(int i=0; i<3; i++){
		cin >> x[i] >> y[i];
	}
	r=circle();
	printf("%.9f\n", r*m/(2*r+m));
	return 0;
}

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

class query {
public:
	int a, d, c;
	query () {
		a = d = c = 0;
	}
	query (int _a, int _d, int _c) {
		a = _a;
		d = _d;
		c = _c;
	}
};

bool vis[101010][11];
int col[101010];
vector <vector <int> > v;

void dfs (int ind, int d, int c) {
	bool paint = true;
	for (int i=0;i<=d;i++) {
		if (vis[ind][i]) {
			paint = false;
			break;
		}
	}
	for (int i=d;i<11;i++) {
		if (vis[ind][i]) {
			return;
		}
	}
	vis[ind][d] = true;
	if (paint)
		col[ind] = c;
	if (!d) {
		return;
	}

	for (int i=0;i<v[ind].size();i++) {
		dfs(v[ind][i], d-1, c);
	}
}

int main () {
	int n, m;
	scanf ("%d %d", &n, &m);
	v.resize(n);

	int a ,b;
	for (int i=0;i<m;i++) {
		scanf ("%d %d", &a, &b);
		a --, b --;
		v[a].push_back(b);
		v[b].push_back(a);
	}

	int q, d, c;
	vector <query> vq;
	scanf ("%d", &q);

	for (int i=0;i<q;i++) {
		scanf ("%d %d %d", &a, &d, &c);
		vq.push_back(query(a-1, d, c));
	}
	reverse(vq.begin(),vq.end());
	for (int i=0;i<vq.size();i++) {
		dfs(vq[i].a, vq[i].d, vq[i].c);
	}

	for (int i=0;i<n;i++) {
		printf ("%d\n", col[i]);
	}

	return 0;
}

Measured memory_bytes: 9584
import java.util.*;

public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int p, q, s;
		double sum, t, r;
		double max = -1;
		int n = sc.nextInt();
		for(int i=0;i<=n;i++){
			p = sc.nextInt();
			q = sc.nextInt();
			sum = 0;
			r = 0;
			for(int j=0;j<q;j++){
				s = sc.nextInt();
				t = sc.nextDouble();
				sum += s*t;
				r += t;
			}
			sum /= r;
			
			if(i==n){
				if(max-sum>0.0000001) System.out.println("YES");
				else System.out.println("NO");
			}else{
				max = Math.max(max, sum);
			}
		}
	}	
}

Measured memory_bytes: 28364
#include <algorithm>
#include <array>
#include <cmath>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <cassert>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;

int m[100][100];

int main() {
    int H, W, N;
    cin >> H >> W >> N;
    vector<int> A(N);

    rep(i, N) {
        cin >> A[i];
    }

    int nth = 0;
    rep(i, H) {
        rep(j, W) {
            int idx = (i%2) ? W - j - 1 : j;
            m[i][idx] = nth + 1;

            A[nth]--;
            if(A[nth] == 0)
                nth++;
        }
    }
    rep(i, H) {
        rep(j, W) {
            cout << m[i][j] << " ";
        }
        cout << endl;
    }

    return 0;
}



Measured memory_bytes: 3204
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using tlll = tuple<ll, ll, ll>;
using Graph = vector<vector<int>>;
const int MOD = 1e9 + 7;

int main() {
    int R;
    cin >> R;
    cout << (R < 1200 ? "ABC" : (R < 2800 ? "ARC" : "AGC")) << endl;

    return 0;
}


Measured memory_bytes: 256
N, X = map(int, input().split())
l = 0

if X < N-X:
  long = N - X
  short = X
else:
  long = X
  short = N - X
l += N
while True:
  l += long // short * short * 2
  x = long % short
  if x == 0:
    l -= short
    break
  long = short
  short = x
  
print(l)

Measured memory_bytes: 2940
N = int(input())
#A = list(map(int,input().split()))
d = dict()
for i in range(N):
    key = input()
    if key not in d:
        d[key] = 1
    else:
        d[key] += 1
val_max = 1
for key in d.keys():
    val_max = max(val_max, d[key])
ans = []
for key in d.keys():
    if d[key] == val_max:
        ans.append(key)
ans.sort()
for a in ans:
    print(a)

Measured memory_bytes: 32096
import java.util.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        short a = sc.nextShort();
        short b = sc.nextShort();
        if ((a * b) % 2 == 0)
            System.out.println("Even");
        else
            System.out.println("Odd");
    }
}

Measured memory_bytes: 35672
///****In the name of ALLAH, most Gracious, most Compassionate****//

#include <bits/stdc++.h>
using namespace std;

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

#define ALL(a) a.begin(), a.end()
#define FastIO ios::sync_with_stdio(false); cin.tie(0);cout.tie(0)
#define IN freopen("input.txt","r+",stdin)
#define OUT freopen("output.txt","w+",stdout)

#define DBG(a) cerr<< "line "<<__LINE__ <<" : "<< #a <<" --> "<<(a)<<endl
#define NL cout<<endl

template < class T1,class T2>
ostream &operator <<(ostream &os,const pair < T1,T2 > &p)
{
    os<<"{"<<p.first<<","<<p.second<<"}";
    return os;
}

const int N=3e5+5;
const ll oo=1e16+7;

ll a[N];
ll mx[N][2];


int32_t main()
{
    FastIO;
    int n;
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>a[i];
        mx[i][0] = max(a[i] / 2 + mx[i-1][0]  , a[i]>= 1 and a[i-1] >= 1 ? (a[i] - 1 )/ 2 + mx[i-1][1] + 1 : -oo  );
        if(a[i]>=1)
        {
            a[i]--;
            mx[i][1] = max(a[i] / 2 + mx[i-1][0]  , a[i]>= 1 and a[i-1] >= 1 ? (a[i] - 1 )/ 2 + mx[i-1][1] + 1 : -oo  );
            a[i]++;
        }
        else mx[i][1] = -oo;


//        DBG(mx[i][0]);
//        DBG(mx[i][1]);
//        NL;
    }
    cout<<max(mx[n][0] ,mx[n][1])<<"\n";

}


Measured memory_bytes: 3840
#define __USE_MINGW_ANSI_STDIO
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;

#define all(v)		((v).begin()), ((v).end())
#define sz(v)		((int)((v).size()))
#define endl		"\n"
#define fx(n)		fixed<<setprecision(n)
#define mk			make_pair	

void fast()
{
	ios::sync_with_stdio(NULL);
	cout.tie(NULL);
	cin.tie(NULL);
}
void File()
{
#ifndef ONLINE_JUDGE
	freopen("output.txt", "w", stdout);
	freopen("input.txt", "r", stdin);
#endif
#ifdef ONLINE_JUDGE
	/*freopen("output.txt", "w", stdout);
	freopen("story.in", "r", stdin);*/
#endif
}
const double pi = 2 * acos(0.0);
const ll oo = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
const int nn = 1e5 + 15;
int dx[8] = { 1, -1, 0, 0, 1, -1, 1, -1 };
int dy[8] = { 0, 0, 1, -1, 1, -1, -1, 1 };

int main()
{
	fast();
	//File();
	ll x;
	cin >> x;
	ll res = x / 500 * 1000;
	x %= 500;
	res += (x / 5 * 5);
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.InputMismatchException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CPrison solver = new CPrison();
        solver.solve(1, in, out);
        out.close();
    }

    static class CPrison {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            int n = in.nextInt();
            int m = in.nextInt();
            int[] pre = new int[n + 2];
            for (int i = 0; i < m; ++i) {
                pre[in.nextInt()] += 1;
                pre[in.nextInt() + 1] -= 1;
            }
            for (int i = 1; i < pre.length; ++i) pre[i] += pre[i - 1];
            int ans = 0;
            for (int i = 0; i < pre.length; ++i) if (pre[i] == m) ++ans;
            out.println(ans);
        }

    }

    static class FastReader {
        private InputStream stream;
        private byte[] buf = new byte[8192];
        private int curChar;
        private int pnumChars;

        public FastReader(InputStream stream) {
            this.stream = stream;
        }

        private int pread() {
            if (pnumChars == -1) {
                throw new InputMismatchException();
            }
            if (curChar >= pnumChars) {
                curChar = 0;
                try {
                    pnumChars = stream.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (pnumChars <= 0) {
                    return -1;
                }
            }
            return buf[curChar++];
        }

        public int nextInt() {
            int c = pread();
            while (isSpaceChar(c))
                c = pread();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = pread();
            }
            int res = 0;
            do {
                if (c == ',') {
                    c = pread();
                }
                if (c < '0' || c > '9') {
                    throw new InputMismatchException();
                }
                res *= 10;
                res += c - '0';
                c = pread();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}



Measured memory_bytes: 22996
#include<stdio.h>
 
int main()
{   
    int a, b;
    int num;
    int count = 1;
    while(scanf("%d %d", &a, &b) != EOF){
 
        num = a + b;
        while(num >= 10){
            num /= 10;
            count++;
        }
        printf("%d\n", count);
        count = 1;
    }
 
 
    return 0;
}

Measured memory_bytes: 1760
import bisect
import copy
import heapq
import math
import sys
from collections import *
from functools import lru_cache
from itertools import accumulate, combinations, permutations, product
def input():
    return sys.stdin.readline()[:-1]
def ruiseki(lst):
    return [0]+list(accumulate(lst))
sys.setrecursionlimit(5000000)
mod=pow(10,9)+7
al=[chr(ord('a') + i) for i in range(26)]
direction=[[1,0],[0,1],[-1,0],[0,-1]]

a,b=map(int,input().split())
sa=b-a
print(sum(range(1,sa))-a)

Measured memory_bytes: 38384
#include <bits/stdc++.h>
#define range(i, l, r) for(long long int (i) = (l); (i) < (r); (i)++)
#define reversed_range(i, l, r) for (long long int (i) = (r) - 1; (i) >= l; (i)--)
using namespace std;
template <typename T>
using vec = vector<T>;
using lint = long long;
using ulint = unsigned long long;
using pint = pair<int, int>;
using plint = pair<lint, lint>;

template <typename S, typename T>
ostream& operator <<(ostream& os, pair<S, T> p) {
    os << "(";
    os << p.first << ", " << p.second;
    return os << ")";
}

template <typename T>
ostream& operator <<(ostream& os, vec<T> v) {
    os << "[";
    if (v.size() == 0) return os << "]";
    for (int i = 0; i < v.size() - 1; i++) {
        os << v.at(i) << ", ";
    }
    return os << v.at(v.size() - 1) << "]";
}

template <typename T>
ostream& operator <<(ostream& os, set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename T>
ostream& operator <<(ostream& os, unordered_set<T>& s) {
    os << "{";
    if (s.begin() == s.end()) return os << "}";
    auto it_first_item = s.begin();
    os << *it_first_item;
    for (auto it = ++it_first_item; it != s.end(); it++) {
        os << ", " << *it;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

template <typename K, typename V>
ostream& operator <<(ostream& os, unordered_map<K, V> m) {
    os << "{";
    if (m.begin() == m.end()) return os << "}";
    auto it_first_item = m.begin();
    os << it_first_item->first << ": " << it_first_item->second;
    for (auto it = ++it_first_item; it != m.end(); it++) {
        os << ", " << it->first << ": " << it->second;
    }
    return os << "}";
}

lint pow(lint num, lint e, lint MOD) {
    lint res = 1;
    lint cur_num = num;
    while (e) {
        if (e & 1) {
            res *= cur_num;
            res %= MOD;
        }
        cur_num *= cur_num;
        cur_num %= MOD;
        e >>= 1;
    }
    return res;
}

int main() {
    cin.tie(0); cout.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    lint R, G; cin >> R >> G;
    cout << 2 * G - R << "\n";
}

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

int main(){
	int N;
	cin >> N;
	map<string,int> ma;
	string s;
	int max_num=0;
	for(int i=0;i<N;i++){
		cin >> s;
		max_num = max(++ma[s],max_num);
	}
	for(auto a:ma){
		if(a.second==max_num){
			cout << a.first << endl;
		}
	}
}

Measured memory_bytes: 25216
/*
 
 * This code is written by Sanskar Agarwal
 
*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 

using namespace __gnu_pbds;
using namespace std;

#define ll long long
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define VPLL vector<PLL>
#define VPII vector<PII>
#define PQ priority_queue<PLL,VPLL, greater<PLL> > 
#define PQI priority_queue<PII,VPII,greater<PII> >
#define S second
#define F first
#define PB push_back

ll n,a[50][50],result[50][50];
const ll MOD=1000000007;

void sq(void)
{
    ll temp[n][n];
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++) {
            temp[i][j]=0;
            for(ll k=0;k<n;k++) {
                temp[i][j]+=(a[i][k]%MOD*a[k][j]%MOD)%MOD;
                temp[i][j]%=MOD;
            }
        }
    }
    for(ll i=0;i<n;i++)
        for(ll j=0;j<n;j++)
            a[i][j]=temp[i][j];
}

void mul(void) 
{
    ll temp[n][n];
    for(ll i=0;i<n;i++)
    {
        for(ll j=0;j<n;j++) {
            temp[i][j]=0;
            for(ll k=0;k<n;k++) {
                temp[i][j]+=(a[i][k]%MOD*result[k][j]%MOD)%MOD;
                temp[i][j]%=MOD;
            }
        }
    }
    for(ll i=0;i<n;i++)
        for(ll j=0;j<n;j++)
            result[i][j]=temp[i][j];
}

ll matrix_power_final(ll x) {
    for(ll i=0;i<n;i++) {
        result[i][i]=1;
    }
    while(x) {
        if(x&1LL) 
            mul();
        sq();
        x>>=1;
    }
    ll sm=0;
    for(ll i=0;i<n;i++) {
        for(ll j=0;j<n;j++) {
            if(result[i][j])
                sm=(sm+result[i][j]%MOD)%MOD;
        }
    }
    cout << sm;
}

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

    ll k;
    cin>>n>>k;
    for(ll i=0;i<n;i++)
        for(ll j=0;j<n;j++)
            cin>>a[i][j];
    
    matrix_power_final(k);
   
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
const int mod=998244353,MAX=200005,INF=1<<30;

int main(){
    
    std::ifstream in("text.txt");
    std::cin.rdbuf(in.rdbuf());
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    mt19937_64 rng(58);
    
    while(1){
        vector<string> S(8);
        for(int i=0;i<8;i++) cin>>S[i];
        if(S[0].size()==0) break;
        
        sort(all(S));
        set<vector<string>> SE;
        int ans=0;
        
        do{
            if(SE.find(S)==SE.end()) ans++;
            else continue;
            
            vector<string> T=S;
            
            for(int t=0;t<100;t++){
                SE.insert(T);
                for(int i=0;i<rng()%10;i++){
                    vector<string> U(8);
                    for(int j=0;j<8;j++){
                        U[j]=T[(j+2)%8];
                    }
                    T=U;
                    
                    SE.insert(T);
                }
                
                vector<string> U(8);
                U[0]=T[6];
                U[1]=T[0];
                U[2]=T[4];
                U[3]=T[2];
                U[4]=T[5];
                U[5]=T[3];
                U[6]=T[7];
                U[7]=T[1];
                
                T=U;
            }
            
        }while(next_permutation(all(S)));
        
        cout<<ans<<endl;
    }
}






Measured memory_bytes: 8800
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>
#include <limits>
#include <queue>
#include <iomanip>
#include <deque>
#include <stack>
#include <cstdio>
#include <cmath>
#include <complex.h>
#include <cstdio>
#include <random>
#include <chrono>
#include <numeric>
#include <cassert>
#include <iso646.h>
#include <exception>
#include <stdexcept>

using namespace std;

typedef long long i64;

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

    i64 a, b, c, d, e, f;
    cin >> a >> b >> c >> d >> e >> f;

    i64 best_water = 100 * a;
    i64 best_sugar = 0;

    for (i64 i1 = 0; i1 <= 30; i1++)
        for (i64 i2 = 0; i2 <= 30; i2++)
        {
            i64 mass_a = i1 * (100 * a);
            i64 mass_b = i2 * (100 * b);
            i64 water = mass_a + mass_b;
            if (water > f) break;

            for (i64 i3 = 0; i3 * c <= water; i3++)
            {
                i64 mass_c = i3 * c;
                
                if (water + mass_c > f ||
                    e * water / 100 < mass_c)
                    break;

                for (i64 i4 = 0; i4 * d <= water; i4++)
                {
                    i64 mass_d = i4 * d;
                    i64 sugar = mass_c + mass_d;

                    if (water + sugar > f ||
                        e * water / 100 < sugar)
                        break;

                    if (water > 0 && (1.0l * sugar / (water + sugar) > (1.0l * best_sugar / (best_water + best_sugar))))
                    {
                        best_water = water;
                        best_sugar = sugar;
                    }
                }
            }
                
        }
    
    cout << best_water + best_sugar << ' ' << best_sugar;
}

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

#define rep(i,n) for(long long i = 0; i < (long long)(n); i++)
#define repi(i,a,b) for(long long i = (long long)(a); i < (long long)(b); i++)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define mt make_tuple
#define mp make_pair
template<class T1, class T2> bool chmin(T1 &a, T2 b) { return b < a && (a = b, true); }
template<class T1, class T2> bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

using ll = long long; using vll = vector<ll>; using vvll = vector<vll>; using P = pair<ll, ll>;
using ld = long double;  using vld = vector<ld>; 
using vi = vector<int>; using vvi = vector<vi>; vll conv(vi& v) { vll r(v.size()); rep(i, v.size()) r[i] = v[i]; return r; }
using Pos = complex<double>;

template <typename T, typename U> ostream &operator<<(ostream &o, const pair<T, U> &v) {  o << "(" << v.first << ", " << v.second << ")"; return o; }
template<size_t...> struct seq{}; template<size_t N, size_t... Is> struct gen_seq : gen_seq<N-1, N-1, Is...>{}; template<size_t... Is> struct gen_seq<0, Is...> : seq<Is...>{};
template<class Ch, class Tr, class Tuple, size_t... Is>
void print_tuple(basic_ostream<Ch,Tr>& os, Tuple const& t, seq<Is...>){ using s = int[]; (void)s{0, (void(os << (Is == 0? "" : ", ") << get<Is>(t)), 0)...}; }
template<class Ch, class Tr, class... Args> 
auto operator<<(basic_ostream<Ch, Tr>& os, tuple<Args...> const& t) -> basic_ostream<Ch, Tr>& { os << "("; print_tuple(os, t, gen_seq<sizeof...(Args)>()); return os << ")"; }
ostream &operator<<(ostream &o, const vvll &v) { rep(i, v.size()) { rep(j, v[i].size()) o << v[i][j] << " "; o << endl; } return o; }
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { o << '['; rep(i, v.size()) o << v[i] << (i != v.size()-1 ? ", " : ""); o << "]";  return o; }
template <typename T>  ostream &operator<<(ostream &o, const set<T> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it << (next(it) != m.end() ? ", " : ""); o << "]";  return o; }
template <typename T, typename U>  ostream &operator<<(ostream &o, const unordered_map<T, U> &m) { o << '['; for (auto it = m.begin(); it != m.end(); it++) o << *it; o << "]";  return o; }
#define ldout fixed << setprecision(40) 

template <typename T> istream& operator>>(istream& i, vector<T>& o) { rep(j, o.size()) i >> o[j]; return i;}

static const double EPS = 1e-14;
static const long long INF = 1e18;
static const long long mo = 1e9+7;

string bits_to_string(ll input, ll n=64) { string s; rep(i, n) s += '0' + !!(input & (1ll << i)); return s; }
template <typename T> unordered_map<T, ll> counter(vector<T> vec){unordered_map<T, ll> ret; for (auto&& x : vec) ret[x]++; return ret;};

int main(void) {
    cin.tie(0); ios::sync_with_stdio(false);
    ll x; cin >> x;
    if(x>=1200) cout << "ARC" <<endl;
    else cout << "ABC" << endl;
    return 0;
}


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

int main() {
    int in,s1=0,s2=0,s3=0;
    cin >> in;
    s1 = in / 100;
    s2 = in / 10 - s1 * 10;
    s3 = in - s1 * 100 - s2 * 10;
    cout << s1+s2+s3 << endl;
}

Measured memory_bytes: 256
N,L = map(int,input().split())

apple = []
for i in range(N):
    apple.append(L+i)
if apple[0] * apple[-1] < 0:
    print(sum(apple))
elif apple[0] < 0:
    print(sum(apple[:N-1]))
else:
    print(sum(apple[1:]))

Measured memory_bytes: 3060
#include<stdio.h>
#include<string.h>
int main(void)
{
   int i,n;
   char s[101];
   scanf("%s",s);
   n=strlen(s);
   for(i=0; i<n; i++){
      s[i]='x';
   }
   printf("%s\n",s);
   return 0;
}


Measured memory_bytes: 128
# -*- coding: utf-8 -*-

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

count = 0
if A >= B:
    count += A
    A -= 1
else:
    count += B
    B -= 1

if A >= B:
    count += A
    A -= 1
else:
    count += B
    B -= 1

print(count)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repr(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define FORR(i, m, n) for (int i = (m); i >= (n); --i)
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll mod2 = 998244353;
//x, y方向独立で
// nCrはa/b mod pを用いる

ll modpow(ll a,ll n) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

ll nCr(ll n, ll r) {
  r = min(n-r, r);
  if (r == 0) return 1;
  ll ans = 1;
  FOR(i, n-r+1, n+1) ans = ans * i % mod;
  ll a = 1;
  FOR(i, 1, r+1) a = a * i % mod;
  ans = ans * modpow(a, mod-2) % mod;
  return ans;
}

int main() {
  ll n, m, k;
  cin >> n >> m >> k;
  ll comb = nCr(n*m-2, k-2);
  ll ans = 0;
  rep(i, m) {
    ll cost = comb;
    cost = cost * (m-i) % mod;
    cost = cost * i % mod;
    cost = cost * n % mod;
    cost = cost * n % mod;
    ans += cost;
    ans %= mod;
  }
  rep(i, n) {
    ll cost = comb;
    cost = cost * (n-i) % mod;
    cost = cost * i % mod;
    cost = cost * m % mod;
    cost = cost * m % mod;
    ans += cost;
    ans %= mod;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define lvector vector<ll>
#define P pair<ll,ll> 
#define rep(i,n) for(ll (i)=0; (i)<(n); ++(i))
#define print(a) cout << (a) << endl

const ll mod=1e9+7;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n,a,ans=0;cin>>n;
  map<ll,ll> mp;rep(i,n) {cin>>a;mp[a]++;}
  vector<P> v;
  for(auto i:mp) v.emplace_back(P(i.first,i.second));
  ll l=v.size();
  bool isok=true;
  if(n%2==0) {
    if(v[0].first==1&&v[0].second==2) {
      for(ll i=1;i<l;++i)
        if(!(v[i].first==2*i+1&&v[i].second==2)) {isok=false;break;}
      if(isok) {
        ans=1;
        rep(i,l) ans=(ans*2)%mod;
      }
    }
  }
  else {
    if(v[0].first==0&&v[0].second==1) {
      for(ll i=1;i<l;++i)
        if(!(v[i].first==2*i&&v[i].second==2)) {isok=false;break;}
      if(isok) {
        ans=1;
        rep(i,l-1) ans=(ans*2)%mod;
      }
    }
  }
  print(ans);
  return 0;
}

Measured memory_bytes: 5368
N, M = map(int, input().split())
H = list(map(int, input().split()))
AB = []
for _ in range(M):
    AB.append(list(map(int, input().split())))


for d in range(0,M):
    if H[AB[d][0]-1] < H[AB[d][1]-1]:
        AB[d].pop(1)
    elif H[AB[d][0]-1] > H[AB[d][1]-1]:
        AB[d].pop(0)


bad = [e for row in AB for e in row]
badsingle = list(set(bad))
print(N - len(badsingle))

Measured memory_bytes: 34664
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)

	A, B, C := nextInt(), nextInt(), nextInt()

	ab := A * B
	ac := A * C
	bc := B * C

	if A%2 == 0 || B%2 == 0 || C%2 == 0 {
		fmt.Println(0)
	} else {
		fmt.Println(min(ab, min(ac, bc)))
	}
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define repp(i, a, b) for (int i = a; i <= (b); ++i)
#define repr(i, a, b) for (int i = a; i >= (b); --i)
#define bit(n) (1LL << (n))
#define len(x) ((ll)(x).size())
#define debug(var) cout << "[" << #var << "]\n" << var << endl
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001001001001001001ll;
const int MOD = 1000000007;
const double EPS = 1e-9;

template <typename T>
ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  for (int i = 0; i < len; ++i) {
    s << v[i];
    if (i < len - 1)
      s << ' ';
  }
  return s;
}

template <typename T>
ostream& operator<<(ostream& s, const vector<vector<T>>& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) {
    s << vv[i];
    if (i != len - 1)
      s << '\n';
  }
  return s;
}

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

__attribute__((constructor)) void initial() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
}

signed main() {
  string S;
  cin >> S;
  int N = len(S);
  ll ans = 0;
  ll offset = 0;
  rep(i, N) {
    if (S[i] == 'W') {
      ans += i - offset;
      offset++;
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 720
from collections import defaultdict
n = int(input())
a = list(map(int, input().split()))

MOD = 10**9 + 7
MAX = n + 5
fact = [1 for _ in range(MAX)]
finv = [1 for _ in range(MAX)]
for i in range(2, MAX):
    fact[i] = fact[i - 1] * i % MOD
    finv[i] = pow(fact[i], MOD-2, MOD)

def comb(n: int, k: int) -> int:
    if n < k or n < 0 or k < 0:
        return 0
    return (fact[n] * finv[k] % MOD) * finv[n-k] % MOD


d = defaultdict(list)
for i in range(n+1):
    d[a[i]].append(i)
    if len(d[a[i]]) == 2:
        i1, i2 = sorted(d[a[i]])
        m1 = i1
        m2 = i2 - i1 - 1
        m3 = n - i2

# print((i1, i2), m1, m2, m3)
ans = []
for k in range(1, n+2):
    ansi = comb(n+1, k) - comb(m1+m3, k-1)
    ansi = (ansi + MOD) % MOD
    ans.append(ansi)

for ansi in ans:
    print(ansi)


Measured memory_bytes: 40688
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double W = sc.nextDouble();
		double H = sc.nextDouble();
		double a = sc.nextDouble();
		double b = sc.nextDouble();
		
		double half = W * H / 2;
		System.out.print(half + " ");
		
		if((a == W / 2) && (b == H / 2)) {
			System.out.print(1);
		}else {
			System.out.print(0);
		}
	}

}

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

using namespace std;

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

  set <string> sub;
  for(int i = 0; i < s.length(); i++) {
    for(int j = 1; j <= 5 && i + j - 1 < s.length(); j++) {
      sub.insert(s.substr(i, j));
    }
  }

  vector <string> ans;
  for(auto i: sub) {
    ans.push_back(i);
  }
  sort(ans.begin(), ans.end());
  cout << ans[k - 1] << endl;
}

Measured memory_bytes: 1920
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; ++i)
#define REPP(i, n) for(int i = 1; i <= n; ++i)
#define REPR(i, n) for(int i = n-1; i >= 0; --i)
#define FOR(i, m, n) for(int i = m; i < n; ++i)
#define ALL(v) v.begin(), v.end()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end());
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1000000007;
const ll INF = 1000000000;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    vector<double> v(n);
    REP(i,n) cin >> v[i];
    sort(ALL(v));
    double ans = (v[0]+v[1])/2;
    FOR(i,2,n) {
        ans = (ans+v[i])/2;
    }
    cout << setprecision(5) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD = 1000000007, INF = 1e9;

int v[110], m[110];
int main()
{
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    for(int i = a; i < b; i++){
        v[i] = 1;
    }
    for(int i = c; i < d; i++){
        m[i] = 1;
    }
    int ans = 0;
    for(int i = 0; i <= 100; i++){
        if(v[i] && m[i]){
            ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); i++)
#define RREP(i, s, n) for (int i = s; i < (n); i++)
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()
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; }
using namespace std;
using ll = long long;
typedef pair<int, int> pint;
typedef pair<ll, ll> pll;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
const int inf = (1<<29);

int main() {

    string s;
    cin >> s;

    int n = s.size();

    vector<ll> val(2019, 0);
    ll fac = 1;
    ll cur = 0;
    val[cur]++;

    for (int i = 0; i < n; i++) {
        ll add = s[n-1-i] - '0';
        cur = (cur + fac * add) % 2019;
        fac = (fac * 10) % 2019;
        val[cur]++;
    }

    ll res = 0;
    for(int i = 0; i < val.size(); i++) {
        res += val[i] * (val[i] -1) / 2;
    }

    cout << res << endl;
    

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

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

using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair

vector<int> ed[100001];
int rem[100001];
void dfs(int x,int p){

int i;
for(i=0;i<ed[x].size();i++){

    int o=ed[x][i];
    if(o!=p){

        dfs(o,x);

        if(rem[x]==0){

            if(rem[o]==0)
            {

                rem[o]=1;
                rem[x]=1;

            }

        }


    }




}



}
int main(){
int n;
cin>>n;
int i;
for(i=1;i<n;i++)
{

    int x,y;
    cin>>x;
    cin>>y;
    ed[x].pb(y);
    ed[y].pb(x);

}


dfs(1,0);
int co=0;
for(i=1;i<=n;i++){

    if(rem[i])
        co++;



}

if(co==n)
    cout<<"Second"<<endl;
else
    cout<<"First"<<endl;
return 0;

}


Measured memory_bytes: 6272
/**
 * File    : A.cpp
 * Author  : Kazune Takahashi
 * Created : 2018-7-14 21:02:11
 * Powered by Visual Studio Code
 */

#include <iostream>
#include <iomanip>   // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple>
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set>
#include <functional>
#include <random> // auto rd = bind(uniform_int_distribution<int>(0, 9), mt19937(19920725));
#include <chrono> // std::chrono::system_clock::time_point start_time, end_time;
// start = std::chrono::system_clock::now();
// double elapsed = std::chrono::duration_cast<std::chrono::milliseconds>(end_time-start_time).count();
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.

typedef long long ll;

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

// const int C = 1e6+10;
// const ll M = 1000000007;

int N;
int a[100010];

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

Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<utility>
using namespace std;
#define MS(m,z) memset(m,z,sizeof(m))
typedef unsigned U;typedef long long ll;typedef pair<int,int > P;
void inp();
int main(){
#ifdef XS
	//freopen(".in","r",stdin);
#endif
	//int ttt;scanf("%d",&ttt);for(int i=1;i<=ttt;i++)
	inp();
	return 0;
}
ll max(ll a,ll b){
	return a>b?a:b;
}
void inp(){
	ll n,k,ans;scanf("%lld%lld", &n,&k);
	ans = 0;
	if( k ==  0)ans = n * n;
	else for(ll b = k + 1;b <= n; b++){
		ll c = n / b;
		ans += (b - 1 - k + 1) * c;
		ans += max((n % b - k + 1), 0);
		//printf("b:%lld %lld\n",b, ans);
	}
	printf("%lld\n", ans);
}
//b.cc by xsthunder at Sat Aug  4 13:53:44 2018


Measured memory_bytes: 128
def cmb(n,r,mod):
  bunshi=1
  bunbo=1
  for i in range(r):
    bunbo = bunbo*(i+1)%mod
    bunshi = bunshi*(n-i)%mod
  return (bunshi*pow(bunbo,mod-2,mod))%mod
mod = 10**9+7
x,y = map(int,input().split())
sum = 0
if x%2 == 1:
  for k in range((x+1)//2):
    k = 2*k +1
    l = (x-k)//2
    if l+2*k == y:
      sum += cmb(k+l,l,mod)
      sum = sum%mod
  print(sum)
if x%2 == 0:
  for k in range(x//2):
    k = 2*k
    l = (x-k)//2
    if l+2*k == y:
      sum += cmb(k+l,l,mod)
      sum = sum%mod
  print(sum)

Measured memory_bytes: 3064
#include <iostream>

using namespace std;
typedef long long  ll;
#define rep(i,s,n)for(int i = s;i<n;i++)

ll gcd(ll a, ll b) {
	if (b == 0) {
		return a;
	}
	return gcd(b, a%b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return (a / g) * b;
}

int main()
{
	int N; cin >> N;
	ll T[100];
	ll ans = 1;
	rep(i, 0, N) {
		cin >> T[i];

		ans = lcm(ans, T[i]);
	}

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

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

#define int long long

int32_t main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n, L;   
    cin >> n >> L; 
    vector <int> a(n);
    int s = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        s += a[i];
    }
    bool good = false;
    int pos = -1;
    for (int i = 0; i + 1 < n; i++) {
        if (a[i] + a[i + 1] >= L) good = true, pos = i;
    }
    if (!good) {
        cout << "Impossible\n";
        return 0;
    }
    cout << "Possible\n";
    for (int i = 0; i < pos; i++) {
        cout << i + 1 << '\n';
    }
    for (int i = n - 2; i >= pos + 1; i--) {
        cout << i + 1 << '\n';  
    }
    cout << pos + 1 << '\n';
    return 0;
}


Measured memory_bytes: 1664
#include<stdio.h>
#include<string>
#include<utility>
#include<iostream>
#include<queue>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<bitset>

using namespace std;
typedef long long ll;
#define REP(i,n) for(int i=0;i<(int)(n);i++)

int main(){
    ll a,b;
    scanf("%lld%lld",&a,&b);
    if((a-b)%2==1 || (b-a)%2==1){
        printf("IMPOSSIBLE\n");
        return 0;
    }
    printf("%lld\n",a+(b-a)/2);
    return 0;
}

Measured memory_bytes: 256
import math
import sys
if sys.version[0] == '2':
    range, input = xrange, raw_input


class FenwickTree:
    def __init__(self, a_list, f, default):
        # 0-indexed
        self.N = len(a_list)
        self.bit = a_list[:]
        self.f = f
        self.default = default
        for _ in range(self.N, 1 << int(math.ceil(math.log(self.N, 2)))):
            self.bit.append(self.default)
        for i in range(self.N - 1):
            self.bit[i | (i + 1)] = self.f(self.bit[i | (i + 1)], self.bit[i])

    def update(self, i, val):
        while i < self.N:
            self.bit[i] = self.f(self.bit[i], val)
            i |= i + 1

    def query(self, n):
        # [0, n]
        ret = 0
        while n >= 0:
            ret = self.f(ret, self.bit[n])
            n = (n & (n + 1)) - 1
        return ret


N = int(input())
X = [int(x) for x in input().split()]
dp = FenwickTree([0] * N, lambda x, y: max(x, y), 0)
for x, i in sorted((x, i) for i, x in enumerate(X)):
    dp.update(i, dp.query(i) + x)
print(N * (N + 1) // 2 - dp.query(N - 1))

Measured memory_bytes: 23424
import java.util.*;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        String S = sc.next();
        StringBuilder ans = new StringBuilder();
        char prev = '0';
        for (int i = 0; i < N; i++) {
            char c = S.charAt(i);
            if (prev != c) {
                ans.append(c);
            }
            prev = c;
        }
        System.out.println(ans.length());
    }
}


Measured memory_bytes: 26752
package main

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

var sc = bufio.NewScanner(os.Stdin)
var out = bufio.NewWriter(os.Stdout)

func main() {
	/*/TODO:!!!!!!!テスト用!!!!!!!!!
	sc = bufio.NewScanner(strings.NewReader(`
										`))
	//TODO:!!!!!!!テスト用!!!!!!!!!*/

	buf := make([]byte, 1024*1024)
	sc.Buffer(buf, bufio.MaxScanTokenSize)
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!caution!!!! you must use Fprint(out, ) not Print()
	/* --- code --- */
	//fmt.Fprintln(out, "[DEBUG]", time.Now())

	n := nextInt()
	a := nextInts(n)
	m := 1000000007

	ans := 0
	wij := 0
	for i := n - 2; i >= 0; i-- {
		wij = (wij + a[i+1]) % m
		wa := (a[i] * wij) % m
		ans = (ans + wa) % m
	}

	//fmt.Fprintln(out, "[DEBUG]", a)
	fmt.Fprintln(out, ans)

}

// 挿入ソート配列
type slist struct {
	l []int
}

func makeSlist() slist {
	return slist{[]int{}}
}

func (s *slist) add(a int) {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	if pos < len(s.l) {
		s.l = append(s.l[:pos+1], s.l[pos:]...)
		s.l[pos] = a
	} else {
		s.l = append(s.l, a)
	}
}
func (s slist) contains(a int) bool {
	pos := sort.Search(len(s.l), func(i int) bool { return s.l[i] >= a })
	return pos < len(s.l) && s.l[pos] == a
}

//------------------------------------------------------------------------------

// -*-*-*-*-*-*-*-*-
// * I/O utilities *
// -*-*-*-*-*-*-*-*-

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func chars(s string) []string {
	ret := make([]string, len([]rune(s)))
	for i, v := range []rune(s) {
		ret[i] = string(v)
	}
	return ret
}

func printArray(a []int) {
	for i := 0; i < len(a); i++ {
		if i >= 1 {
			fmt.Fprint(out, " ")
		}
		fmt.Fprint(out, a[i])
	}
	fmt.Fprintln(out)
}

func absInt(x int) int {
	return int(math.Abs(float64(x)))
}
func minInt(x, y int) int {
	if x < y {
		return x
	}
	return y
}
func maxInt(x, y int) int {
	if x > y {
		return x
	}
	return y
}
func sign(x int) int {
	if x == 0 {
		return 0
	}
	if x > 0 {
		return 1
	}
	return -1
}
func log10(x int) float64 {
	return math.Log10(float64(x))
}
func divCeil(shi, bo int) int {
	ans := shi / bo
	if shi%bo != 0 {
		ans++
	}
	return ans
}


Measured memory_bytes: 6408
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;

int main()
{
	string W;
	string T;
	cin >> W;
	int num = 0;
	while(true)
	{
	
		int pos = 0;
		cin >> T;
		if (T == "END_OF_TEXT") break;
		for (int i = 0; i < T.size(); i++)
		{
			T[i] = tolower(T[i]);
		}
		if (T == W) num++;
	} 
	cout << num << endl;
}


Measured memory_bytes: 3172
#include<iostream>
#include<algorithm>
#include <string>
#include <cstring>
#include<climits>
#include <vector>
#include <queue>
#include <stack>
using namespace std;
typedef long long ll;

int n, k;
int d[1001];
vector<double> v;
int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	for (int i = 1; i <= 1000; i++) {
		d[i] = d[i - 1] + i;
	}
	int n, k; cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int x; cin >> x;
		double cnt = d[x] / (double)x;
		v.push_back(cnt);
	}
	double ans = 0.0;
	for (int i = 0; i < k; i++) {
		ans += v[i];
	}
	double Ans = ans;
	for (int i = k; i < n; i++) {
		ans -= v[i - k];
		ans += v[i];
		Ans = max(Ans, ans);
	}

	cout << fixed;
	cout.precision(10);
	cout << Ans << '\n';


}

Measured memory_bytes: 2420
#
# 　　  ⋀_⋀　 
#　　  (･ω･)  
# .／ Ｕ ∽ Ｕ＼
#  │＊　合　＊│
#  │＊　格　＊│ 
#  │＊　祈　＊│ 
#  │＊　願　＊│ 
#  │＊　　　＊│ 
#      ￣
#
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from math import floor,sqrt,factorial,hypot,log #log2ないｙｐ
from heapq import heappop, heappush, heappushpop
from collections import Counter,defaultdict,deque
from itertools import accumulate,permutations,combinations,product,combinations_with_replacement
from bisect import bisect_left,bisect_right
from copy import deepcopy
from fractions import gcd
from random import randint
def ceil(a,b): return (a+b-1)//b
inf=float('inf')
mod = 10**9+7
def pprint(*A): 
    for a in A:     print(*a,sep='\n')
def INT_(n): return int(n)-1
def MI(): return map(int,input().split())
def MF(): return map(float, input().split())
def MI_(): return map(INT_,input().split())
def LI(): return list(MI())
def LI_(): return [int(x) - 1 for x in input().split()]
def LF(): return list(MF())
def LIN(n:int): return [I() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]
def LLIN_(n: int): return [LI_() for _ in range(n)]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def I(): return int(input())
def F(): return float(input())
def ST(): return input().replace('\n', '')
def main():
    N=I()
    S=ST()
    b = ""
    a = 0
    for s in S:
        if b!=s:
            b = s
            a += 1
    print(a)
if __name__ == '__main__':
    main()

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

int main()
{
	int N;
	long long K;
	cin >> N >> K;
	vector<long long> A( N );
	for( int i = 0; i < N; i++ ) {
		cin >> A[i];
	}

	sort( A.begin(), A.end() );
	long long l = -1e9 * 1e9;
	long long r = 1e9 * 1e9;
	while( r - l > 1 ) {
		long long m = (l + r) / 2;
		long long k = 0;
		for( int i = 0; i < N; i++ ) {
			if( A[i] == 0 ) {
				if( m >= 0 ) k += N - (i + 1);
			}
			else if( A[i] < 0 ) {
				int L = i;
				int R = N;
				while( R - L > 1 ) {
					int M = (L + R) / 2;
					if( A[i] * A[M] <= m ) R = M;
					else L = M;
				}
				k += N - R;
			}
			else {
				int L = i;
				int R = N;
				while( R - L > 1 ) {
					int M = (L + R) / 2;
					if( A[i] * A[M] <= m ) L = M;
					else R = M;
				}
				k += L - i;
			}
		}
		if( k >= K ) r = m;
		else l = m;
	}

	long long ans = r;
	cout << ans << endl;
}


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

int main()
{
  int n;
  cin>>n;
  vector<int> v(n);
  for(int &i:v) cin>>i;
  int ans=0;
  for(int i=1;i<n-1;i++)
    if(v[i]>v[i-1]&&v[i]<v[i+1])
      ans++;
    else if(v[i-1]>v[i]&&v[i]>v[i+1])
      ans++;
  cout<<ans<<"\n";
  
  
  return 0;
}

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

size_t gcd(size_t m, size_t n) {
  if (m == 0) return n;
  if (n == 0) return m;
  if (m < n) std::swap(m, n);
  size_t r = 1;
  while (r != 0) {
    r = m % n;
    m = n;
    n = r;
  }
  return m;
}

int main() {
  size_t n;
  std::cin >> n;

  std::vector<size_t> a(n + 2, 0);
  for (size_t i = 1; i <= n; ++i) std::cin >> a[i];

  std::vector<size_t> l(n + 2, 0);
  for (size_t i = 0; i < n; ++i) l[i + 1] = gcd(l[i], a[i]);

  std::vector<size_t> r(n + 2, 0);
  for (size_t i = n; i > 0; --i) r[i] = gcd(r[i + 1], a[i]);

  std::vector<size_t> m(n);
  for (size_t i = 1; i <= n; ++i) m[i - 1] = gcd(l[i], r[i + 1]);

  const auto it = std::max_element(m.begin(), m.end());
  std::cout << *it << std::endl;
}

Measured memory_bytes: 3328
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#include <iomanip>
#include <numeric>
#include <unordered_map>
#include <sstream>   
#include<limits.h>
#include<list>
using namespace std;
#define i64  long long
//  #define int  long long
 
#define I32_MAX 2147483647
#define I64_MAX 9223372036854775807
#define MOD 1000000007


int GN;
bool recfn(int i, int m,vector<int> & vec)
{
  if(m==0) return 1;
  if(i >= GN) return 0;

  int res = recfn(i+1,m,vec)||recfn(i+1,m-vec[i],vec);
  return res;
}


void solve()
{
  int N;
  cin>>N;
  GN =N;
  vector<int> vec(N,0);
  for (int i = 0; i < N; i++)
  {
    cin>>vec[i];
  }

  int Q;
  cin>>Q;
  for (int i = 0; i < Q; i++)
  {
    int T;
    cin>>T;
    if(recfn(0,T,vec))
  {
    cout<<"yes"<<endl;
  }
  else
  {
    cout<<"no"<<endl;
  }
    
  }

  
  
  
  return;
}

int32_t main(int32_t argc, const char *argv[])
{
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  solve();

 
  return 0;
}


Measured memory_bytes: 3184
from collections import Counter
n=int(input())
dics=([Counter(input()) for i in range(n)])
std_dic=dics[0]

for dic in dics[1:]:
  for k,v in std_dic.items():
    if k in dic:
      std_dic[k]=min(v,dic[k])
    else:
      std_dic[k]=0
ans="".join(sorted(std_dic.elements()))
print(ans)

Measured memory_bytes: 3316
def print_it(l, n):
    print(''.join([l[x % 2] for x in range(n)]))

matrix = []
while True:
    values = input()
    if '0 0' == values:
        break
    matrix.append([int(x) for x in values.split()])

sc = ['#', '.']
cs = ['.', '#']
for height, width in matrix:
    if 1 == height and 1 == width:
        print('#')
        print()
        continue
    for i in range(height):
        if 0 == i % 2:
            print_it(sc, width)
        else:
            print_it(cs, width)
    print()

Measured memory_bytes: 7736