akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
using namespace std;

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

class Point{
	public:
		double x, y;

		Point(double x = 0, double y = 0): x(x), y(y) {}

		Point operator + (Point p){ return Point(x + p.x, y + p.y);}
		Point operator - (Point p){ return Point(x - p.x, y - p.y);}
		Point operator * (double a){ return Point(a * x, a * y);}
		Point operator / (double a){ return Point(x / a, y / a);}

		double abs(){ return sqrt(norm());}
		double norm(){ return x * x + y * y;}

		bool operator < (const Point &p) const{
			return x != p.x ? x < p.x : y < p.y;
		}

		bool operator == (const Point &p) const{
			return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
		}
};

struct Segment {
	Point p1, p2;
};
typedef Segment Line;

class Circle{
	public:
		Point c;
		double r;
		Circle(Point c = Point(), double r = 0.0): c(c), r(r) {}
};

typedef Point Vector;
typedef vector<Point> Polygon;

double dot(Vector a, Vector b){
	return a.x * b.x + a.y * b.y;
}
double cross(Vector a, Vector b){
	return a.x * b.y - a.y * b.x;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;
static const int ONLINE_FRONT = -2;
static const int ON_SEGMENT = 0;

int ccw(Point p0, Point p1, Point p2){
	Vector a = p1 - p0;
	Vector b = p2 - p0;
	if(cross(a, b) > EPS) return COUNTER_CLOCKWISE;
	if(cross(a, b) < -EPS) return CLOCKWISE;
	if(dot(a, b) < -EPS) return ONLINE_BACK;
	if(a.norm() < b.norm()) return ONLINE_FRONT;

	return ON_SEGMENT;
}

bool intersect(Point p1, Point p2, Point p3, Point p4){
	return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}
bool intersect(Segment s1, Segment s2){
	return intersect(s1.p1, s1.p2, s2.p1, s2.p2);
}

int main(){
	int q;
	Segment s1, s2;
	cin >> q;
	for(int i=1;i<=q;i++){
		cin >> s1.p1.x >> s1.p1.y >> s1.p2.x >> s1.p2.y >> s2.p1.x >> s2.p1.y >> s2.p2.x >> s2.p2.y;
		if(intersect(s1, s2) == true) cout << "1" << endl;
		else cout << "0" << endl;
	}
	return 0;
}

Measured memory_bytes: 3224
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
int main(){
int N;
cin>>N;
string S[N];
for(int i=0;i<N;i++)cin>>S[i];
set<string>a;
for(int i=0;i<N;i++)a.insert(S[i]);
cout<<a.size();

return 0;
}

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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;


int main() {
    string s, t;
    cin >> s >> t;
    li cnt = 0;
    rep(i, sz(s)) {
        if (s[i] != t[i]) {
            cnt++;
        }
    }
    cout << cnt << endl;


    return 0;
}

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

int main(){
    string t;
    cin >> t;
    int cnt[26] = {};
    for(char c : t) cnt[c-'a']++;
    priority_queue<int> pq;
    for(int i = 0; i < 26; i++){
        if(cnt[i])  pq.push(-cnt[i]);
    }
    if(pq.size() == 1){
        cout << t.length() << endl;
        return 0;
    }
    int ans = 0;
    while(pq.size() > 1){
        int p = pq.top();   pq.pop();
        int q = pq.top();   pq.pop();
        ans -= p+q;
        pq.push(p+q);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3352
#include <iostream>
#include <vector>
using namespace std;
const long INF = 1e9;
const long MOD = 1e9 + 7;
#define repi(i, n, init) for (int i = init; i < int(n); i++)

int main()
{
    int n, q;
    cin >> n;
    vector<int> S(n);
    repi(i, n, 0)
    {
        cin >> S[i];
    }
    cin >> q;
    vector<int> T(q);
    repi(i, q, 0)
    {
        cin >> T[i];
    }

    int cnt = 0;
    bool once = false;
    repi(i, q, 0)
    {
        once = false;
        repi(j, n, 0)
        {
            
            if (S.at(j) == T.at(i) && !once)
            {
                once = true;
                cnt++;
            }
        }
    }
    cout << cnt << endl;
    return 0;
}


Measured memory_bytes: 3140
using System;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] In = Console.ReadLine().Split(' ');
            int[] A = new int[3];
            for(int i = 0; i < 3; i++)
            {
                A[i] = int.Parse(In[i]);
            }
            Array.Sort(A);
            Console.WriteLine(A[0] + A[1]);
        }
    }
}


Measured memory_bytes: 27384
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
using in = int64_t;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
const double PI=3.14159265358979323846;
const in MOD = 1000000007;
const in INF=1e18+7;
const int inf=1e9+7;
using P=pair<int,int>;
vector<int> dx={0,1,-1,0};
vector<int> dy={1,0,0,-1};

in gcd(in a, in b) {return b != 0ll ? gcd(b, a % b) : a;}//最大公約数
map<in,in> soin(in n){
    map<in,in> ret;
    for(in i=2ll;i*i<=n;i ++){
        while(n%i==0ll){
            ret[i] ++;
            n /= i;
        }
    }
    if(n!=1ll) ret[n]=1ll;
    return ret;
}

int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cout << fixed << setprecision(10);
    in a,b;
    cin>>a>>b;
    in x=gcd(a,b);
    auto y=soin(x);
    in ans =y.size();
    ans ++;
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define rep1(i, n) for (ll i = 1; i <= (n); ++i)
#define rrep(i, n) for (ll i = (n - 1); i >= 0; --i)
#define perm(c) sort(ALL(c));for(bool c##p=1;c##p;c##p=next_permutation(ALL(c)))
#define ALL(obj) (obj).begin(), (obj).end()
#define pb push_back
#define to_s to_string
#define len(v) (ll)v.size()
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define print(x) cout << (x) << '\n'
#define drop(x) cout << (x) << '\n', exit(0)
#define debug(x) cout << #x << ": " << (x) << '\n'
using namespace std;
using ll = long long;
typedef pair<ll, ll> P;
typedef vector<ll> vec;
typedef vector<vector<ll>> vec2;
typedef vector<vector<vector<ll>>> vec3;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
ll MOD = 1e9 + 7;
ll devc(ll x, ll y) { return 1 + (x - 1) / y; }

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

    ll N;
    cin >> N;
    map<ll, ll> mp;
    priority_queue<ll> pq;

    rep(i, N){
        ll x;
        cin >> x;
        ++mp[x];
        if(mp[x] >= 2) pq.push(x), mp[x] = 0;
    }

    if(len(pq) < 2) drop(0);

    ll ans = 1;
    rep(i, 2){
        ans *= pq.top();
        pq.pop();
    }
    print(ans);

    return 0;
}

Measured memory_bytes: 6528
n = int(input())
div = []
for i in range(1, int(n**0.5)+1):
    if n % i == 0:
        div.append(i)
        if i != n // i:
            div.append(n//i)
i = 0
div.sort()
while True:
    if div[i]*div[i+1] == n:
        print(div[i]+div[i+1]-2)
        break
    elif div[i]*div[i] == n:
        print(div[i]+div[i]-2)
        break     
    else:
        i += 1

Measured memory_bytes: 3268
def main():
    N, M, L = map(int, input().split())
    A = tuple(tuple(map(int, input().split())) for _ in range(N))
    B = tuple(tuple(map(int, input().split())) for _ in range(M))

    cell = 0
    row = []
    for n in range(N):
        for l in range(L):
            for m in range(M):
                cell += A[n][m] * B[m][l]
            row.append(cell)
            cell = 0
        print(*row, sep=' ')
        row = []

main()

Measured memory_bytes: 8572
toInt :: (String -> Int)
toInt x = read x ::Int

getInts :: IO [Int]
getInts = do
  x <- getLine
  let y = (map$toInt)$words x
  return y




cll :: [Int] -> Int
cll xs = cwsl xs 0 True
  where
  cwsl :: [Int] -> Int -> Bool -> Int
  cwsl [] _ _ = 0
  cwsl (x:xs) _ True = 1 + cwsl xs x False
  cwsl (x:xs) n False = (if x<n then 1 else 0) + cwsl xs (min x n) False
    





main = do
  n <- getInts
  x <- getInts
  putStrLn $ show (cll x)

Measured memory_bytes: 38268
from collections import defaultdict
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def MI1(): return map(int1, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def SI(): return sys.stdin.readline()[:-1]

def main():
    def impossible():
        for u in range(n):
            du = dd[u]
            for v in to[u]:
                if dd[v] <= du: break
            else:
                return True
        return False

    def dfs(u=0,pu=-1,c=0):
        color[u]="B" if c else "W"
        for v in to2[u]:
            if v==pu:continue
            dfs(v,u,1-c)

    inf = 10 ** 9
    n, m = MI()
    dd = LI()
    to = defaultdict(list)
    uvtoi = {}
    for i in range(m):
        u, v = MI1()
        uvtoi[u, v] = uvtoi[v, u] = i
        to[u].append(v)
        to[v].append(u)
    if impossible():
        print(-1)
        exit()
    cost = [inf] * m
    to2 = defaultdict(set)
    for u in range(n):
        mn = (inf, inf, inf)
        for v in to[u]:
            t = (dd[v], uvtoi[u, v], v)
            if t < mn: mn = t
        v = mn[2]
        cost[mn[1]] = dd[u]
        to2[u].add(v)
        to2[v].add(u)
    color=["N"]*n
    for u in range(n):
        if color[u]!="N":continue
        dfs(u)
    print("".join(color))
    print(*cost,sep="\n")

main()


Measured memory_bytes: 142284
#include<bits/stdc++.h>
using namespace std;
int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  int n,k;
  cin>>n>>k;
  int count[101];
  for(int i=1;i<=n;i++)
      {
     count[i]=0;
    
      }
  for(int i=0;i<k;i++){
    int d;
    cin>>d;
    int a[100];
    for(int j=0;j<d;j++){
      cin>>a[j];
      count[a[j]]++;
    }

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

    }
  }
  cout<<f;
    

}

Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <functional>
#include<vector>
#include<math.h>
#include<bitset>
#include<string>
#include <deque>
#include<queue>
#include<map>
#include<type_traits>
using namespace std;


int main() {	
	int N=0;
	string S;
	cin >> S;
	for (int i = 0; i < 4; i++) {
		if (S[i] == '+') {
			N++;
		}
		else {
			N--;
		}
	}
	cout << N << endl;
	
	return 0;
}



Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
 
public class ABC0123_A3v2 {
    private static void OutputAnswer(string text) => Console.WriteLine(text);
 
    private static void Main(string[] args) {
        var inputs = ReadStringList(6);
        ConvertInputs(inputs);
    }
 
    private static List<string> ReadStringList(int numberOfLines) {
        var stringList = new List<string>();
 
        for (int lineIndex = 0; lineIndex < numberOfLines; lineIndex++) {
            stringList.Add(Console.ReadLine().Trim());
        }
 
        return stringList;
    }
 
    private static void ConvertInputs(List<string> inputs) {
        var population = long.Parse(inputs[0]);
        inputs.RemoveAt(0);
        var capacity = ConvertListToLong(inputs);
 
        Solve(capacity, population);
    }
 
    private static List<long> ConvertListToLong(List<string> texts) => texts.Select(x => long.Parse(x)).ToList();
 
    private static void Solve(List<long> capacity, long population) {
        var minimumCapacity = capacity.Min();
        var time = 5 + Math.Ceiling((population / (decimal)minimumCapacity) - 1);
        OutputAnswer(time.ToString());
    }
}

Measured memory_bytes: 13396
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <climits>

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

#define EPS (1e-7)
#define INF (1e12)
#define PI (acos(-1))

#define amari(x) ((x) % 1000000007)

#define fillInt(xs, x)        \
  for (int i = 0; i < (x); i++) \
    scanf("%d", &xs[i]);
#define fillLong(xs, x)       \
  for (int i = 0; i < (x); i++) \
    scanf("%ld", &xs[i]);
#define fillString(xs, x)       \
  for (int i = 0; i < (x); i++) \
    cin >> xs[i];
#define sortv(xs) sort(xs.begin(), xs.end());
#define sortvdi(xs) sort(xs.begin(), xs.end(), std::greater<int>());
#define lbv(xs, x) lower_bound(xs.begin(), xs.end(), x) - xs.begin();
#define ubv(xs, x) upper_bound(xs.begin(), xs.end(), x) - xs.begin();

#define rep(i,n) for(int i=0; i<(n); i++)
#define isValidPoint(x, y, mx, my) x >= 0 && x  < mx && y >= 0 && y < my

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

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

  string s;

  cin >> s;

  long cnt = 0;
  long whiteCnt = 0;

  for (int i = s.size() - 1; i >= 0; i--) {
    if (s[i] == 'W') {
      whiteCnt++;
    }
    if (s[i] == 'B') {
      cnt += whiteCnt;
    }
  }

  cout << cnt << endl;

  return 0;
}


Measured memory_bytes: 832
#include<bits/stdc++.h>
#define int long long
#define mod 1000000007
#define for0(i, n) for(int i = 0; i < (n); i++)
#define for1(i, n) for(int i = 1; i <= (n);i++)
#define mp make_pair
#define all(x) x.begin(),x.end()
using namespace std;
signed main() {
	long long a, b, c; cin >> a >> b >> c;
	cout << (c > a + b && 4 * a*b < (c - a - b) *(c - a - b) ? "Yes\n" : "No\n");
}

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

struct node{
	long long v;
	int id;
}a[100001];

int n,sz[100001],s1[100001],s2[100001];
long long s,t;
vector<int> ga[100001];
map<long long,int> num;

bool cmp(node a,node b){
	return a.v>b.v;
}

void dfs(int x,int fa,long long d){
	s+=d;
	for(int i=0;i<ga[x].size();i++)
		if(ga[x][i]!=fa)dfs(ga[x][i],x,d+1);
}

int main(){
	int i,x,y;
	cin >> n;
	for(i=1;i<=n;i++){
		cin >> a[i].v;
		num[a[i].v]=i;
		a[i].id=i;
		sz[i]=1;
	}
	sort(a+1,a+n+1,cmp);
	for(i=1;i<n;i++){
		x=a[i].id;
		t=a[i].v-(n-sz[x])+sz[x];
		if(!num[t] || t>=a[i].v){
			cout << -1;
			return 0;
		}
		y=num[t];
		s1[i]=x;
		s2[i]=y;
		sz[y]+=sz[x];
		ga[x].push_back(y);
		ga[y].push_back(x);
	}
	dfs(a[n].id,0,0);
	if(s!=a[n].v){
		cout << -1;
		return 0;
	}
	for(i=1;i<n;i++)
		cout << s1[i] << ' ' << s2[i] << endl;
	return 0;
}

Measured memory_bytes: 18944
#include<iostream>

using namespace std;

int main() {
	int r, g, b;
	cin >> r >> g >> b;

	int x = r * 100 + g * 10 + b;
	if (x % 4 == 0) cout << "YES" << endl;
	else cout << "NO" << endl;



	return 0;
}

Measured memory_bytes: 256
#[allow(unused_macros)]
macro_rules! vec_md {
    ( $ init : expr ; $ ( $ dim : expr ) ;* ) => { vec_md ! ( $ ( $ dim ) ;* => $ init ) };
    ( $ head : expr ; $ ( $ tail : expr ) ;* => $ init : expr ) => { vec ! [ vec_md ! ( $ ( $ tail ) ;* => $ init ) ; $ head ] };
    ( $ head : expr => $ init : expr ) => { vec ! [ $ init ; $ head ] };
}

#[allow(dead_code)]
pub const D: usize = 23;

fn main() {
    use std::io::Read;
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();
    let mut iter = buf.split_whitespace();
    
    let _n: usize = iter.next().unwrap().parse().unwrap();
    let m: usize = iter.next().unwrap().parse().unwrap();
    let q: usize = iter.next().unwrap().parse().unwrap();
    
    let mut ranges: Vec<Data> = Vec::with_capacity(m+q);
    for _ in 0..m {
        let l: usize = iter.next().unwrap().parse().unwrap();
        let r: usize = iter.next().unwrap().parse().unwrap();
        ranges.push(Data {l:l, r:r, query_index: None});
    }
    for i in 0..q {
        let l: usize = iter.next().unwrap().parse().unwrap();
        let r: usize = iter.next().unwrap().parse().unwrap();
        ranges.push(Data {l:l, r:r, query_index: Some(i)});
    }
    ranges.sort();
    let mut sq = vec_md![0;D;D];
    let mut sq2 = vec![0;D];
    let mut ret = vec![0;q];
    for Data{l,r,query_index} in ranges {
        if let Some(i) = query_index {
            ret[i] = sum(&sq, &sq2, r+1) - sum(&sq, &sq2, l);
        } else {
            sq[l/D][l%D] += 1;
            sq2[l/D] += 1;
        }
    }

    for i in 0..q {
        println!("{}", ret[i]);
    }
}

fn sum(sq: &[Vec<usize>], sq2: &[usize], n: usize) -> usize {
    let mut ret = 0;
    for i in 0..(n/D) {
        ret += sq2[i];
    }
    for i in 0..(n%D) {
        ret += sq[n/D][i];
    }
    ret
}

#[derive(PartialEq, Eq, Debug)]
pub struct Data{
    l: usize,
    r: usize,
    query_index: Option<usize>
}
impl PartialOrd for Data {
    fn partial_cmp(&self, other: &Data) -> Option<std::cmp::Ordering> {
        Some(self.cmp(other))
    }
}
impl Ord for Data {
    fn cmp(&self, other: &Data) -> std::cmp::Ordering {
        match self.r.cmp(&other.r) {
            std::cmp::Ordering::Equal => self.query_index.cmp(&other.query_index),
            other => other
        }
    }
}

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

int main()
{
    string S;
    cin >> S;
    int ans = 0;
    for (int i = 0; i < S.size() - 1; i++) if (S.substr(i, 2) == "WB" || S.substr(i, 2) == "BW") ans++;
    cout << ans << endl;

    return 0;
}


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

int main() {
  int n, t;
  cin >> n;
  cin >> t;

  int t_i[n];

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

  int sum = 0;
  for(int i=1;i<n;i++) {
    int diff = t_i[i] - t_i[i-1];
    sum += (diff > t) ? t : diff;
  }
  sum += t;
  cout << sum << endl;
}

Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <iomanip>
#include <algorithm>
#include <cassert>
#include <queue>
#include <set>
#include <vector>
#include <cmath>
#include <bitset>
#include <functional>
#include <limits>
#include <map>
using namespace std;

typedef long long ll;
#define rep1(i, n) for(ll i = 1; i <=(ll)(n); i++)
#define rep0(i, n) for(ll i = 0; i <=(ll)(n); i++)

ll pow(ll a, ll n) { //compute a^n with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a;
        a = a * a;
        n >>= 1;
    }
    return res;
}

ll pow(ll a, ll n, ll mod) { //compute a^n (mod mod) with o(logn)
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}

const int MAX = 199;
const int MOD = 1000000007;
ll fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

//順列計算
ll PER(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[n - k] % MOD) % MOD;
}

int main(){
    long double a,b,x;
    cin >> a >> b >> x;
    long double theta;
    if(x == a*a*b){
        theta = 0;
    }else{
        double y = 2*x/(a*b);
        if(y > a){
            y = 2*x/(a*a) -b;
            theta = atan((b-y)/a)*180.0/M_PI;
        }else{
            theta = atan(b/y)*180.0/M_PI;
        }
    }
    cout << setprecision(10) << theta << endl;
    return 0;
}

Measured memory_bytes: 3228
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define _GLIBCXX_DEBUG
using namespace std;
using P = pair<int,int>;

bool cmp(P a,P b) {
    return a.second < b.second;
}

int main() {
    int n,m;
    cin >> n >> m;
    vector<P> p(m);
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        p[i] = {a,b};
    }
    sort(p.begin(),p.end(),cmp);
    int ans = 0;
    int last = -1;
    for(P a : p) {
        int na = a.first;
        int nb = a.second;
        if(na <= last) continue;
        else {
            ans++;
            last = nb-1;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define pi 3.141592653589793238
#define int long long
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;



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

#ifndef ONLINE_JUDGE
	if(fopen("INPUT.txt","r"))
	{
	freopen ("INPUT.txt" , "r" , stdin);
	freopen ("OUTPUT.txt" , "w" , stdout);
	}
#endif  

	string s;
	cin>>s;
	int n=s.length();
	int x=0,y=0;
	int ans=0;
	for(int i=0;i<n;i++)
	{
		if(s[i]=='B')
			x++;
		else
		{
			ans+=x;
			y++;

		}
	}	
	cout<<ans;

}


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

int sum[10001];
int main() {
	int n, m; scanf("%d%d", &n, &m);
	rep(i, m) {
		string s; cin >> s;
		rep(j, n) {
			if (s[j] == 'W')sum[j + 1]++;
		}
	}
	for (int i = 1; i <= n; i++)sum[i] += sum[i - 1];
	int id, Min = INT_MAX;
	for (int i = 0; i <= n; i++) {
		int a = i*m - sum[i], b = sum[n] - sum[i];
		if (Min > a + b) {
			Min = a + b; id = i;
		}
	}
	printf("%d %d\n", id, id + 1);
}

Measured memory_bytes: 3408
#include "bits/stdc++.h"
using namespace std;
#define dbg(var) cout<<#var<<"="<<var<<" "
#define nl cout<<"\n"
#define fr(i,n) for(int i=0;i<n;i++)
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define fast ios::sync_with_stdio(false);cin.tie(0);
#define vi vector<int>
#define vvi vector<vi>
#define pb push_back
#define fa(v) for(auto &i:v)
#define all(v) v.begin(),v.end()
#define sz(v) (int)(v.size())
#define int long long
int32_t main()
{
  int a,b,c; cin >> a >> b >> c;
  cout << (b/c - --a/c);  		
}

Measured memory_bytes: 3520
#include <stdio.h>

#define rep(i,r) for(int i=0;i<r;i++)

int main() {
	int N;
	scanf("%d", &N);
	char S[N];
	scanf("%s", &S);
	int rgb[3] = {0};
	rep(i,N) rgb[S[i] == 'R' ? 0 : (S[i] == 'G' ? 1 : 2)]++;
	
	long count = (long)rgb[0] * rgb[1] * rgb[2];
	for (int i = 0; i < N - 2; i++) {
		for (int j = 1; i + j * 2 < N; j++) {
			if (S[i] != S[i + j]
				&& S[i] != S[i + j * 2]
				&& S[i + j] != S[i + j * 2]) count--;
		}
	}
	
	printf("%ld", count);
	return 0;
}


Measured memory_bytes: 1732
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#define LC(x) (x << 1)
#define RC(x) (x << 1 | 1)
#define MID(x, y) ((x + y) >> 1)
using namespace std;
typedef long long LL;
const int MAXN = 2e5 + 5;
struct node1{
    LL sum, id;
} a[MAXN];
struct node2 {
    LL l, r, sum;
} tree[MAXN * 4];
LL ans, n, k;
bool cmp(node1 a, node1 b){
    return a.sum == b.sum ? a.id < b.id : a.sum < b.sum;
}
inline void pushup(LL p){
    tree[p].sum = tree[LC(p)].sum + tree[RC(p)].sum;
}
inline void build(LL p, LL l, LL r){
    tree[p].l = l;
    tree[p].r = r;
    if (l == r){
        //scanf("%d", &tree[p].sum);
        return;
    }
    build(LC(p), l, MID(l, r));
    build(RC(p), MID(l, r) + 1, r);
    pushup(p);
}
inline void update(LL p, LL id){
    if (tree[p].l == id && tree[p].r == id){
        tree[p].sum++;
        return;
    }
    LL mid = MID(tree[p].l, tree[p].r);
    if (mid >= id)
        update(LC(p), id);
    else
        update(RC(p), id);
    pushup(p);
}
inline void query(int p, int l, int r){
    if (l > tree[p].r || r < tree[p].l)
        return;
    if (l <= tree[p].l && r >= tree[p].r)
    {
        ans += tree[p].sum;
        return;
    }
    query(LC(p), l, r);
    query(RC(p), l, r);
}
int main(){
    scanf("%lld%lld", &n, &k);
    for (int i = 1; i <= n; i++){
        LL x;
        scanf("%lld", &x);
        a[i].id = i;
        a[i].sum = a[i - 1].sum + x - k;
    }
    sort(a + 1, a + n + 1, cmp);
    build(1, 1, n);
    //cout << "ssdfsf" << endl;
    for (int i = 1; i <= n; i++){
        update(1, a[i].id);
        if (a[i].sum >= 0)
            ans++;
        if (a[i].id - 1 == 0)
            continue;
        query(1, 1, a[i].id - 1);
    }
    //cout << "sdfsfs" << endl;
    printf("%lld\n", ans);
    return 0;
}

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

using namespace std;
using int64 = long long;
//const int mod = 1e9 + 7;
const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int64 A;
  cin >> A;
  string S;
  cin >> S;
  if(S.size() == 1)S += ".";
  if(S.size() == 2)S += "0";
  if(S.size() == 3)S += "0";
  for(auto &c : S) c -= '0';
  int64 B = 0;
  B += S[0];
  B *= 10;
  B += S[2];
  B *= 10;
  B += S[3];
  cout << A * B / 100 << "\n";
}




Measured memory_bytes: 3656
#include <stdio.h>

int absol(int a,int b)
{
  if(a>b)
    return a-b;
  else
    return b-a;
}

int main(void)
{
  int a,b,c,d,flag;
  scanf("%d%d%d%d",&a,&b,&c,&d);
  if(absol(a,c)<=d)
  {
    flag=1;
  }
  else if(absol(a,b)<=d && absol(b,c)<=d)
  {
    flag=1;
  }
  else
  {
    flag=0;
  }
  if(flag)
  {
    printf("Yes\n");
  }
  else
  {
    printf("No\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
using namespace std;
int main()
{
  int a,p;
  cin >> a >> p;
  cout << (3*a+p)/2 << "\n";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int ara[500];
int main()
{
    int a,i,j,len=0,l;
    char s[500];
    char alpha[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','\0'};
    scanf("%s",s);
    l=strlen(s);
    for (i=0;i<l;i++){
        for(j=0;j<26;j++){
            if(s[i]==alpha[j]){
                ara[j]++;
            }
        }
    }

    for(j=0;j<26;j++){
        if(ara[j]%2==0){
            len++;
        }
    }
    if(len==26) printf("Yes\n");
    else printf("No\n");


    return 0;
}

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

sum = 0

if L >= 0:
    for i in range(1, N):
        sum += int(i) + L

elif abs(L) < N:
    for i in range(N):
        sum += int(i) + L

else:
    for i in range(0, N-1):
        sum += int(i) + L

print(sum)


Measured memory_bytes: 3060
#include<stdio.h>
int main(){
 int a,b,c;
 int j = 0;
 scanf("%d%d%d",&a,&b,&c);
 for (int i=a;i<=b;i++){
   int d = c/i;
   if (c-d*i){}
   else{
     j++;
   }
 }
 printf("%d\n",j);
 return 0;
}



Measured memory_bytes: 2740
#include<bits/stdc++.h> 
//compiling code: g++ test.cpp(file) -o script(output) -std=c++11(version) -O2(make it 2x faster)
using namespace std;
int N;
tuple<string, int, int> A[100];

int main(){
    
    cin >> N;
    for (int i = 0; i < N; i++ ){
        string name;
        cin >> name;
        int rating;
        cin >> rating;
        A[i] = make_tuple(name, -rating, i+1);
    }
    sort(A, A + N);
    for (int i = 0; i < N; i++){
        cout << get<2>(A[i]) << "\n";
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
 
using namespace std;
 
template<typename T> void uin(T &a, T b) {
    if (b < a) {
        a = b;
    }
}
 
template<typename T> void uax(T &a, T b) {
    if (b > a) {
        a = b;
    }
}

#define int long long
#define left left228
#define right right228
#define prev prev228
#define mp make_pair
#define all(v) v.begin(), v.end()
#define forn(i, n) for (int i = 0; i < (int)n; ++i)
#define firn(i, n) for (int i = 1; i < (int)n; ++i)
#define x first
#define y second

const int N = 200 * 1000 + 228;
const int INF = 3e9 + 228;

int n, l, t;
int x[N], w[N], fx[N], meet[N], pref[N][3], ans[N];

int dist(int i) {
    return x[(i - 1) % n + 1] + l * ((i - 1) / n);
}
int summa(int i, int T) {
    return (pref[(i - 1) % n + 1][T] + ((i - 1) / n) * pref[n][T]) % n;
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> l >> t;
    for (int i = 1; i <= n; ++i) {
        cin >> x[i] >> w[i];
        if (w[i] == 1) {
            fx[i] = (x[i] + t) % l;
        } else {
            fx[i] = ((x[i] - t) % l + l) % l;
        }
    }
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= 2; ++j) {
            pref[i][j] = pref[i - 1][j] + (w[i] == j);
        }
    }
    for (int i = 1; i <= n; ++i) {
        if (w[i] == 1) {
            int l = i, r = INF;
            while (r - l > 1) {
                int m = (l + r) >> 1;
                if (dist(m) - dist(i) < t * 2) l = m;
                else r = m;
            }
            meet[i] = summa(l, 2) - summa(i, 2);
            ans[(i - 1 + meet[i]) % n + 1] = fx[i];
        } else {
            int l = 1, r = i + n * INF;
            while (r - l > 1) {
                int m = (l + r) >> 1;
                if (dist(i + n * INF) - dist(m) < t * 2) r = m;
                else l = m;
            }
            meet[i] = summa(i + n * INF, 1) - summa(r - 1, 1);
            ans[((i - 1 - meet[i]) % n + n) % n + 1] = fx[i];
        }
    }
    for (int i = 1; i <= n; ++i) {
        cout << ans[i] << '\n';
    }
    return 0;
}
 
/*



3
0 1
-2 3
2 2

3
0 1
-2 2
2 2

*/

Measured memory_bytes: 10624
using System;
using System.Collections.Generic;
using System.Text;

class Program
{
    public void Proc()
    {
        string[] inpt = Console.ReadLine().Split(' ');
        int packCount = int.Parse(inpt[0]);
        int trackCount = int.Parse(inpt[1]);

        int[] packList = new int[packCount];
        int packTotal = 0;
        int packMax = 0;
        for(int i=0; i<packCount; i++)
        {
            packList[i] = int.Parse(Console.ReadLine());
            packTotal += packList[i];
            packMax = Math.Max(packMax, packList[i]);
        }

        this.Max = packTotal;
        this.Min = Math.Max(packTotal / trackCount, packMax);

        while(Max > Min)
        {
            int target = (Max + Min) / 2;
            int trackIdx = 1;
            int trackLaggage = 0;
            bool can = true;
            for(int i=0; i<packList.Length; i++)
            {
                if(trackLaggage + packList[i] > target)
                {
                    trackIdx++;
                    trackLaggage = 0;
                    if(trackIdx > trackCount)
                    {
                        if (this.Min == target)
                        {
                            this.Min += 1;
                        }
                        else {
                            this.Min = target;
                        }
                        can = false;
                        break;
                    }
                }
                trackLaggage += packList[i];
            }
            if(can)
            {
                Max = target;
            }
        }
        Console.WriteLine(this.Max);
    }

    private int Min = 0;
    private int Max = 0;

    static void Main(string[] args)

    {

        Program prg = new Program();
        prg.Proc();

    }
}

Measured memory_bytes: 9908
/*
h s, d't skp th si tll i's svedclTabCtrl
 * ABC141 E
 * ABC145 D
 * ABC147 F
 * ABC174 F
*/
#include<bits/stdc++.h>
#define ll long long
#define mod 1000000007
using namespace std;
int main()
{
int n,x;
cin>>x>>n;
int vl;
set<int> st;
for(int i=0;i<n;i++)
{
cin>>vl;
st.insert(vl);
}
int mx=mod;
int ans=0;
for(int i=0;i<=200;i++)
{
if(st.count(i)==0 && abs(i-x)<mx)
{
mx=abs(i-x);
ans=i;
}
}
cout<<ans;
}
/*
 *||||

 */

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
typedef pair< int, string > State;

const int v1[] = {1, 2, 3, 4, 5, 6, 7, 8, 0};
const int v2[] = {8, 0, 1, 2, 3, 4, 5, 6, 7};
const int v3[] = {6, 7, 8, 0, 1, 2, 3, 4, 5};
const int v4[] = {3, 4, 5, 6, 7, 8, 0, 1, 2};

int main()
{
  int Horizon, Vertical;
  while(cin >> Horizon >> Vertical, Horizon) {
    string D = "", E = "";
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        string K;
        cin >> K;
        D += K;
      }
    }
    for(int i = 0; i < 3; i++) {
      for(int j = 0; j < 3; j++) {
        string K;
        cin >> K;
        E += K;
      }
    }

    priority_queue< State, vector< State >, greater< State > > que;
    que.push(State(0, D));
    unordered_map< string, int > used;
    used[D] = 0;
    while(!que.empty()) {
      string q = que.top().second;
      int cost = que.top().first;
      que.pop();
      if(q == E) {
        cout << cost << endl;
        break;
      }
      if(used.find(q) != used.end() && used[q] < cost) {
        continue;
      }
      int pos = q.find('0'), nextCost;
      
      nextCost = cost + Horizon;
      swap(q[pos], q[v1[pos]]);
      if(used.find(q) == used.end() || used[q] > nextCost) {
        used[q] = nextCost;
        que.push(State(nextCost, q));
      }
      swap(q[pos], q[v1[pos]]);
      swap(q[pos], q[v2[pos]]);
      if(used.find(q) == used.end() || used[q] > nextCost) {
        used[q] = nextCost;
        que.push(State(nextCost, q));
      }
      swap(q[pos], q[v2[pos]]);
      if(used.find(q) == used.end() || used[q] > nextCost) {
        used[q] = nextCost;
        que.push(State(nextCost, q));
      }
      nextCost = cost + Vertical;
      swap(q[pos], q[v3[pos]]);
      if(used.find(q) == used.end() || used[q] > nextCost) {
        used[q] = nextCost;
        que.push(State(nextCost, q));
      }
      swap(q[pos], q[v3[pos]]);
      swap(q[pos], q[v4[pos]]);
      if(used.find(q) == used.end() || used[q] > nextCost) {
        used[q] = nextCost;
        que.push(State(nextCost, q));
      }
      swap(q[pos], q[v4[pos]]);
    }
  }
}

Measured memory_bytes: 47252
# Suplemental: ABC54 B
N, M = map(int, input().split())
A = []
for i in range(N):
    A.append(list(input()))
B = []
for i in range(M):
    B.append(list(input()))

for i in range(N-M+1):
    for j in range(N-M+1):
        flag = True
        for k in range(M):
            for l in range(M):
                if(A[i+k][j+l] != B[k][l]):
                    flag = False
                    break
            if flag == False:
                break
            
        if flag == True:
            print('Yes')
            exit()

print('No')

Measured memory_bytes: 3064
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <algorithm>  
#include <iostream>  
#include <cstdlib>  
#include <cstring>  
#include <string>
#include <cstdio>  
#include <climits>
#include <cmath> 
#include <vector>
#include <set>
#include <queue>
#include <stack>
#include <map>
#include <sstream>
#define INF 0x3f3f3f3f
#define LL long long
#define fora(i,a,n) for(int i=a;i<=n;i++)
#define fors(i,n,a) for(int i=n;i>=a;i--)
#define sci(x) scanf("%d",&x);
#define scl(x) scanf("%lld",&x);
#define MAXN 100024
const double eps = 1e-8;
using namespace std;
LL X;

int main() {
#ifdef DID
	freopen("in.txt", "r", stdin);
	//freopen("out.txt","w",stdout);
#endif
	scl(X);
	LL l = 0, r = 1000000;
	while (l < r) {
		LL m = (l + r) >> 1;
		//cout << l << " " << r << " " << m << endl;
		if ((1 + m)*m < 2 * X) { l = m + 1; }
		else r = m;
	}
	printf("%lld\n", l);
	return 0;
}

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

inline long long read(){
	long long s = 0, w = 1;
	char ch = getchar();
	while (ch < '0' || ch > '9'){
		if (ch == '-') w = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9'){
		s = s * 10 + ch - '0';
		ch = getchar();
	}
	return s * w;
}
const int MAX_N = 1e6;
map <string, int> pq;
struct xcj{
	string nam;
	int num;
}q[MAX_N];
int n, cnt;
bool cmp (xcj x, xcj y){
	if (x.num != y.num){
		return x.num > y.num;
	}
	return x.nam < y.nam;
}
int main(){
	n = read();
	for (int i = 1; i <= n; i++){
		string s;
		cin >> s;
		if (pq[s] == 0){
			cnt++;
			q[cnt].nam = s;
		}
		pq[s]++;
	}
	for (int i = 1; i <= cnt; i++){
		q[i].num = pq[q[i].nam];
	}
	sort(q + 1, q + 1 + cnt, cmp);
	int Max = q[1].num;
	for (int i = 1; i <= cnt; i++){
		if (q[i].num < Max){
			break;
		}
		cout << q[i].nam << endl;
	}
	
	return 0;
}


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

      int x = sc.nextInt();
      int y = sc.nextInt();
      int sum = 0;

      if(x==1){
        sum = sum + 300000;
      }
      if(x==2){
        sum = sum + 200000;
      }
      if(x==3){
        sum = sum + 100000;
      }
      if(y==1){
        sum = sum + 300000;
      }
      if(y==2){
        sum = sum + 200000;
      }
      if(y==3){
        sum = sum + 100000;
      }
      if(x==1&&y==1){
        sum = sum + 400000;
      }
      System.out.println(sum);
  }
}


Measured memory_bytes: 22996
#!/usr/bin/env python3

# from typing import Optional
from typing import List

# from typing import Dict
from typing import Tuple
from typing import Set

# from typing import Sequence

Cod = Tuple[int, int]


def main():
    args = input().split()
    H = int(args[0])
    W = int(args[1])
    M = int(args[2])

    codList = {}
    columnSumList: List[int] = [0] * W
    rowSumList: List[int] = [0] * H
    for i in range(M):
        h, w = map(lambda x: int(x), input().split())
        item = (h, w)
        codList.setdefault(h, {})
        codList[h][w] = item
        columnSumList[w - 1] += 1
        rowSumList[h - 1] += 1

    maxColumnSum = max(columnSumList)
    maxColumIndexList = [i for i, x in enumerate(columnSumList) if x == maxColumnSum]
    maxRowSum = max(rowSumList)
    maxRowIndexList = [i for i, x in enumerate(rowSumList) if x == maxRowSum]

    result = maxColumnSum + maxRowSum
    for row in maxRowIndexList:
        for column in maxColumIndexList:
            if row + 1 in codList and column + 1 in codList[row + 1]:
                continue
            else:
                print(result)
                return

    print(result - 1)


if __name__ == "__main__":
    main()


Measured memory_bytes: 157956
#include <bits/stdc++.h>
#define fastIO (cin.tie(0), cout.tie(0), ios::sync_with_stdio(false))
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define precise(i) fixed << setprecision(i)
using namespace std;

int main() {
  fastIO;
  int n, m, c;
  cin >> n >> m >> c;

  vector<int> B(m);
  rep(i, m) cin >> B.at(i);

  int cnt = 0;
  rep(i, n) {
    int subsum = 0;
    rep(j, m) {
      int a;
      cin >> a;
      subsum += a * B.at(j);
    }
    if(subsum + c > 0)
      cnt++;
  }

  cout << cnt << endl;
}


Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define f0(i,a,b) for(int i=a;i<b;i++)
#define f1(i,a,b) for(int i=a;i<=b;i++)
#define f2(i,a,b) for(int i=a;i>b;i--)
#define f3(i,a,b) for(int i=a;i>=b;i--)
#define all(a) a.begin(),a.end()
#define pb push_back
#define mp make_pair
#define pii pair<int,int>

#define fi first
#define se second
#define mod 1000000007
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define test int t;cin>>t;while(t--)

signed main(){
    fast

    int n;
    cin>>n;
    if(n>=30)cout<<"Yes";
    else cout<<"No";
}

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

/* メモリ食い過ぎ注意 */
#define int long long

typedef long long ll;

ll gcd(ll a, int b)
{
    if (a < b)
        gcd(b, a);
    if (b == 0)
        return a;
    int r;
    while ((r = a % b))
    {
        a = b;
        b = r;
    }
    return b;
}

/* define const */
const ll INF = (1ll << 60);
const ll MOD = (ll)1e9 + 7;
/* end defineing */

signed main()
{
    string s;
    cin >> s;
    int len = s.length();

    bool f = false;
    while (!f)
    {
        len -= 2;
        int half = len / 2;
        for (int i = 0; i < half; i++)
        {
            if (s[i] != s[i + half])
            {
                f = false;
                break;
            }
            f = true;
        }
    }
    cout << len << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

string binarize(ll x) {
    string res = "";
    int i = 0;
    while (x != 0) {
        if (abs(x) % (ll)pow(2, i+1) != 0) {
            res += "1";
            if (i % 2 == 0) {
                x += -(ll)pow(2, i);
            } else {
                x += (ll)pow(2, i);
            }
        } else {
            res += "0";
        }
        i++;
    }
    reverse(res.begin(), res.end());
    if (sz(res) == 0) res += "0";
    return res;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin >> n;
    cout << binarize(n) << endl;
}

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

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  cin >> N >> M;
  vector<vector<int>> S(M);
  for (int i = 0; i < M; i++) {
    int k;
    cin >> k;
    for (int j = 0; j < k; j++) {
      int s;
      cin >> s;
      S[i].emplace_back(s - 1);
    }
  }
  vector<int> P(M);
  for (int i = 0; i < M; i++) {
    cin >> P[i];
  }

  int res = 0;
  for (int bit = 0; bit < (1 << N); bit++) {
    bool flag = true;
    for (int i = 0; i < M; i++) {
      int cnt = 0;
      for (auto s : S[i]) {
        if ((bit >> s) & 1) cnt++;
      }
      if (cnt % 2 != P[i]) flag = false;
    }
    if (flag) res++;
  }
  cout << res << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>

using namespace std;

int main(void) {
	int a,b;
	cin >> a;
	cin >> b;
	a = a % 3;
	b = b % 3;
	if(!a || !b || a+b == 3) goto possible;
	cout << "Impossible";
	return 0;
possible:
	cout << "Possible";
	return 0;
}

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

ans = 10 ** 9
for kaisai in range(100 + 1):
    tairyoku = 0
    for c in coord:
        tairyoku += (c - kaisai) ** 2
    ans = min(ans, tairyoku)

print(ans)


Measured memory_bytes: 2940