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


typedef complex<double> P; //Point
typedef pair<P,P> L; //Line, Segment

const double INF = 1e13;
const double EPS = 1e-10;
const double PI = 6.0 * asin(0.5);

namespace std {
  bool operator < (const P& a, const P& b){
    return fabs(real(a)-real(b)) < EPS ? imag(a) < imag(b) : real(a) < real(b);
  }
  bool operator == (const P& a,const P& b){
    return fabs(real(a)-real(b)) < EPS && fabs(imag(a)-imag(b))<EPS;
  }
}

double dot(P a, P b){ return real(conj(a)*b); }
double cross(P a, P b){ return imag(conj(a)*b); }
// 線分と点の交差判定
bool isIntersectSP(L s, P p){ 
  return abs(s.first-p) + abs(s.second-p) - abs(s.second-s.first) < EPS; 
}

int N;
L seg[1001];
P tp,pp;
int startid;

P getPoint(double dis,int di){
  double r = 0.0;
  if( di == -1 ){
    r = abs(seg[startid].first-tp);
  } else {
    r = abs(seg[startid].second-tp);
  }

  if( dis < r + EPS ){
    P v;
    if( di == -1 ){
      v = seg[startid].first - tp;
      if( r < EPS ) return seg[startid].first;
    }
    else {
      v = seg[startid].second - tp;    
      if( r < EPS ) return seg[startid].second;
    }
    //  cout << "getPoint " << v << " " << tp << " "<< r << " " << dis << endl;
    return tp + v/abs(v)*dis;
  }

  for(int i=startid+di;0<=i && i<N-1;i+=di){
    double s = dis - r;
    r += abs(seg[i].first - seg[i].second);
    double kr =abs(seg[i].first - seg[i].second);
    if( dis < r + EPS ){
      P v;
      if( di == -1 ){
	v = seg[i].first - seg[i].second;
	return seg[i].second + v/kr*s;      
      }
      else {
	v = seg[i].second - seg[i].first;  
	return seg[i].first + v/kr*s;      
      }
    }
  }
  return P(INF,INF);
}

double solve(int bit,int tv,int pv,double now,P pnow){
  if( bit == 3 ) return now;
  double res = 1e20;
  for(int i=0;i<2;i++){
    if( bit & (1<<i) ) continue;

    double st = now, ed = 1000000000.0;
    P pnext=pnow;
    while( fabs(ed-st) > EPS ){
      double t = (st + ed)/2.0;
      int di = i==0?-1:1;
      double dis = (double)tv * t;
      P p = getPoint(dis,di);

      //  cout << t << " " << dis << " " <<pnow << " -> " << p << endl;

      if( p == P(INF,INF) ){
	ed = t;
      } else {
	double disp  = (double)pv * (t-now);
	double ky = abs(p - pnow);
	//	cout << "disp " << disp << " ky " << ky << endl;
	if( disp+EPS > ky ){
	  pnext = p;
	  ed = t;
	} else {
	  st = t;
	}
      }
    }
    //      cout << pnow << " -> " << pnext << endl;
    // cout << st << " " << now << endl;
    res = min( res,solve(bit|(1<<i),tv,pv,st,pnext) );
  }
  return res;
}


int main(){
  /* cout << 1000 << endl;
  for(int i=0;i<1000;i++){
    cout << i*10 << " " << 0 << endl;
  }
  cout <<"0 0 1" << endl;
  cout << "10000 0 1" <<endl;
  return 0;
  */
  cin >> N;
  P pr;
  for(int i=0;i<N;i++){
    int x,y;
    cin >> x >> y;
    seg[i].first = P(x,y);
    if( i ) seg[i-1].second = P(x,y);
  }
  
  int tx,ty,tv;
  int px,py,pv;
  cin >> tx >> ty >> tv;
  tp = P(tx,ty);
  for(int i=0;i<N-1;i++){
    if( isIntersectSP(seg[i],tp) ) {
      startid = i;
      break;
    }
  }
  cin >> px >> py >> pv;
  pp = P(px,py);  
  
  printf("%.9lf\n",solve(0,tv,pv,0.0,pp));    
}

Measured memory_bytes: 1248
#pragma region kyomukyomupurin

/**
 *    author  : 𝒌𝒚𝒐𝒎𝒖𝒌𝒚𝒐𝒎𝒖𝒑𝒖𝒓𝒊𝒏
 *    created : 2020-04-24 14:15:54
 **/

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <chrono>
#include <cmath>
#include <complex>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>

using namespace std;

using int64 = long long;

template <class T>
using binary_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::pair<T, U>& p) {
  return os << '(' << p.first << ", " << p.second << ')';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::vector<T>& vec) {
  int flag = 0;
  for (auto e : vec) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::ostream& operator<<(std::ostream& os, const std::set<T>& st) {
  int flag = 0;
  for (auto e : st) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T, class U>
std::ostream& operator<<(std::ostream& os, const std::map<T, U>& mp) {
  int flag = 0;
  for (auto e : mp) os << (flag++ ? ", " : "{") << e;
  return os << '}';
}

template <class T>
std::istream& operator>>(std::istream& is, std::vector<T>& vec) {
  for (T& e : vec) is >> e;
  return is;
}

#define all(_) begin(_), end(_)
#define rall(_) rbegin(_), rend(_)

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]: ", debug_out(__VA_ARGS__)
#else
#define debug(...)
#endif

void debug_out() { std::cerr << '\n'; }

template <class Head, class... Tail>
void debug_out(Head&& head, Tail&&... tail) {
  std::cerr << head;
  if (sizeof...(Tail) != 0) std::cerr << ", ";
  debug_out(std::forward<Tail>(tail)...);
}

#pragma endregion kyomukyomupurin

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

  int n; cin >> n;
  int64 v; cin >> v;
  vector<int64> a(n), b(n), c(n), d(n); cin >> a >> b >> c >> d;

  vector<int64> ab, cd;

  for (int64 ea : a) {
    for (int64 eb : b) {
      ab.emplace_back(ea + eb);
    }
  }

  for (int64 ec : c) {
    for (int64 ed : d) {
      cd.emplace_back(ec + ed);
    }
  }

  sort(all(ab));
  sort(all(cd));

  int64 ans = 0;

  for (int64 e : ab) {
    ans += upper_bound(all(cd), v - e) - lower_bound(all(cd), v - e);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 23160
#include<bits/stdc++.h>
using namespace std;
multiset<int> s;
int main()
{
	int n;
	scanf("%d",&n);
	while(n--)
	{
		int x, y;
		scanf("%d%d",&x,&y);
		if(x == 0) 
		{
			s.insert(y);
			printf("%d\n",s.size());
		}
		else if(x == 1) printf("%d\n",s.count(y));
		else if(x == 2) s.erase(y);
		else if(x == 3)
		{
			int l, r;
			l = y;
			scanf("%d",&r);
			multiset<int>::iterator it, it2;
			it = s.lower_bound(l);
			it2 = s.upper_bound(r);
			for(; it!=it2; it++) printf("%d\n",*it);
		}
	}
	return 0;
}


Measured memory_bytes: 12388
// 61706535

import java.io.*;
import java.util.*;

public class Main {	
	public static class Parser {
		private final String str;
		private long ans;
		private int idx = 0;
		private final char[] ex012 = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
		private class InvalidExpressionException extends Exception {
			InvalidExpressionException(int idx) {
				super("around input[" + idx + "] : " + "Invalid expression");
			}
		}
		Parser(String str) {
			this.str = str + "$";
			try {
				this.ans = expr();
				if(this.str.charAt(idx) != '$') {
					throw new InvalidExpressionException(idx);
				}
			}
			catch(ArithmeticException e) {
				System.out.println("around input[" + idx + "] : " + e.getMessage());
				throw new IllegalStateException();
			}
			catch(InvalidExpressionException e) {
				System.out.println(e.getMessage());
				throw new IllegalStateException();
			}
		}
		long answer() {
			return this.ans;
		}
		long expr() throws InvalidExpressionException {
			long ret = term();
			while(true) {
				char c = str.charAt(idx);
				if(c == '$') {
					return ret;
				} else if(c == '+') {
					check('+');
					ret = Math.addExact(ret, term());
				} else if(c == '-') {
					check('-');
					ret = Math.subtractExact(ret, term());
				} else {
					return ret;
				}
			}
		}
		long term() throws InvalidExpressionException {
			long ret = fact();
			while(true) {
				char c = str.charAt(idx);
				if(c == '*') {
					check('*');
					ret = Math.multiplyExact(ret, fact());
				} else if(c == '/') {
					check('/');
					ret /= fact();
				} else {
					return ret;
				}
			}
		}
		long fact() throws InvalidExpressionException {
			char c = str.charAt(idx);
			if(c == '(') {
				check('(');
				long ret = expr();
				check(')');
				return ret;
			} else {
				return numb();
			}
		}
		long numb() throws InvalidExpressionException {
			long ret = 0;
			boolean flag = false;
			while(true) {
				char c = str.charAt(idx);
				if('0' <= c && c <= '9') {
					flag = true;
					ret = Math.multiplyExact(ret, 10);
					// ret *= 10;
					ret = Math.addExact(ret, Character.getNumericValue(c));
					// ret += Character.getNumericValue(c);
					check(ex012);
				} else {
					if(!flag) {
						throw new InvalidExpressionException(idx);
					}
					return ret;
				}
			}
		}
		void check(char expected) throws InvalidExpressionException  {
			char[] ex = {expected};
			check(ex);
		}
		void check(char[] expected) throws InvalidExpressionException {
			char got = str.charAt(idx);
			for(char c : expected){
				if(got == c) {
					idx++;
					return;
				}
			}
			throw new InvalidExpressionException(idx);
		}
	}

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		while(n > 0) {
			n--;
			String str = scan.next();
			str = str.substring(0, str.length() - 1);
			try {
				Parser parse = new Parser(str);
				System.out.println(parse.answer());
			}
			catch(IllegalStateException e) {}
			finally {
				continue;
			}
		}
	}
}



Measured memory_bytes: 26060
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
using namespace std;



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


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define acc(v) accumulate(v.begin(), v.end(), 0)

using namespace std;
typedef long long ll;
const int INF = 1e9;
const ll LINF = 1e18;
const ll MOD = 1e9 + 7;

int main()
{
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    int tmpm = min(a, b);
    int tmpM = max(a, b);
    a = tmpm;
    b = tmpM;
    double T, t;
    T = 1.0 * 30 * h + 30 * 1.0 * m / 60;
    t = 1.0 * 360 / 60 * m;
    double ax, ay, bx, by;
    ay = a * cos(t * M_PI / 180);
    ax = a * sin(t * M_PI / 180);
    by = b * cos(T * M_PI / 180);
    bx = b * sin(T * M_PI / 180);
    printf("%.12f\n", pow(pow(ax - bx, 2) + pow(ay - by, 2), 0.5));
    return 0;
}


Measured memory_bytes: 4240
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);
		double d = scan.nextInt();
		int t = scan.nextInt();
		double s = scan.nextInt();
		
		double a = d/s;
		
		if(a <= t) {
			System.out.print("Yes");
		}else {
			System.out.print("No");
		}

	}

}


Measured memory_bytes: 35708
import java.util.*;

public class Main {

    public static void main(String[] args) {
        final Scanner sc = new Scanner(System.in);

        final long n = sc.nextLong();

        System.out.println(euler(n, primeFactorize(n)));
    }

    private static List<Map<Long, Integer>> primeFactorize(long n) {
        List<Map<Long, Integer>> res = new ArrayList<>();
        for (long a = 2; a*a <= n; a++) {
            if (n % a != 0) {
                continue;
            }
            int ex = 0;
            while (n % a == 0) {
                ex++;
                n /= a;
            }
            res.add(Collections.singletonMap(a, ex));
        }
        if (n != 1) {
            res.add(Collections.singletonMap(n, 1));
        }
        return res;
    }

    private static long euler(final long n, final List<Map<Long, Integer>> pfs) {
        long res = n;
        for (Map<Long, Integer> pf : pfs) {
            for (Map.Entry<Long, Integer> entry : pf.entrySet()) {
                res *= entry.getKey()-1;
                res /= entry.getKey();
            }
        }
        return res;
    }

    // 1 - 1/2 = 1/2
    // 1 - 1/3 = 2/3
    // 1 - 1/4 = 3/4
}



Measured memory_bytes: 26332
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double db;
#define endl '\n'
#define fi first
#define se second
#define pi pair<ll,ll>
#define pii pair<ll,pi>
#define pb push_back
#define mk make_pair
const ll nax = 1e3 + 7;
const ll inf = 1e18;
ll h1, w1, h2, w2;
ll n, m;
char v[nax][nax];
const ll dx[] = {1, -1, 0, 0};
const ll dy[] = {0, 0, 1, -1};
ll dis[nax][nax];
bool ok(ll i, ll j) {
	return (i >= 0 && i < n && j >= 0 && j < m);
}
int main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cin >> n >> m;
	cin >> h1 >> w1;
	cin >> h2 >> w2;
	for (ll i = 0; i < n; ++i) {
		for (ll j = 0; j < m; ++j) {
			cin >> v[i][j];
		}
	}
	for (ll i = 0; i < n; i++) {
		for (ll j = 0; j < m; j++) {
			dis[i][j] = inf;
		}
	}
	deque<pi>q;
	--h1, --w1, --h2, --w2;
	q.push_front({h1, w1});
	dis[h1][w1] = 0;
	while (!q.empty()) {
		pi r = q.front();
		ll x = r.fi;
		ll y = r.se;
		q.pop_front();
		for (ll k = 0; k < 4; k++) {
			ll nx = x + dx[k];
			ll ny = y + dy[k];
			if (ok(nx, ny) && v[nx][ny] == '.') {
				if (dis[nx][ny] > dis[x][y]) {
					dis[nx][ny] = dis[x][y];
					q.push_front({nx, ny});
				}
			}
		}
		for (ll nx = x - 2; nx <= x + 2; nx++) {
			for (ll ny = y - 2; ny <= y + 2; ny++) {
				if (ok(nx, ny) && v[nx][ny] == '.') {
					if (dis[nx][ny] > dis[x][y] + 1) {
						dis[nx][ny] = 1 + dis[x][y];
						q.push_back({nx, ny});
					}
				}
			}
		}
	}
	ll ans = 0;
	if (dis[h2][w2] == inf)ans = -1;
	else ans = dis[h2][w2];
	cout << ans << endl;
}

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

int main(){
  int n; cin >>n; vector<int>v(n); int sum=0;
  for(int i=0; i<n; i++) cin >>v[i];
  sort(v.begin(),v.end());
  for(int a=0; a<n-2; a++){
    for(int b=a+1; b<n-1; b++){
      for(int c=b+1; c<n; c++){
        if(v[a]+v[b]-v[c]>0) sum++;
        else break;
      }
    }
  }
  cout <<sum;
return 0;}

Measured memory_bytes: 256
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = True
class Combination:
    def __init__(self,N,P=10**9+7):
        if N > 10**7:
            self.fact = lambda x: x * self.fact(x-1) % P if x > 2 else 2
            self.perm = lambda x, r: x * self.perm(x-1,r-1) % P if r > 0 else 1
            self.cmb = lambda n,r: (self.perm(n,min(n-r,r)) * pow(self.fact(min(n-r,r)) ,P-2 ,P) % P) if r > 0 else 1
        else:
            self.__fact = [1] * (N+1)
            self.__inv = [1] * (N+1)
            self.__inv_fact = [1] * (N+1)
            for i in range(2,N+1):
                self.__fact[i] = self.__fact[i-1] * i % P
                self.__inv[i] = - self.__inv[P%i] * (P//i) % P
                self.__inv_fact[i] = self.__inv_fact[i-1] * self.__inv[i] % P
            self.fact = lambda n: self.__fact[n]
            self.perm = lambda n,r: self.__fact[n] * self.__inv_fact[n-r] % P
            self.cmb = lambda n,r: (self.__fact[n] * self.__inv_fact[n-r] * self.__inv_fact[r] % P) if n >= r > 0 else 0 if r > n else 1
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]
    N,K =LMIIS()
    A = LMIIS()
    A.sort()
    cmb = Combination(N)
    ans = 0
    P = 10**9+7
    for i,a in enumerate(A):
        ans = (ans + cmb.cmb(i,K-1)*a - cmb.cmb(N-i-1,K-1)*a)%P
    print(ans)


    






if __name__ == '__main__':
    main()

Measured memory_bytes: 89568
#include <stdio.h>
#include <string.h>
#include <iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<unordered_map>
#include<unordered_set>
#define P pair<int,int>
using namespace std;

int BIT[100005];
void add(int a) {
	while (a < 100005) {
		BIT[a]++;
		a += a&-a;
	}
}
void take(int a) {
	while (a < 100005) {
		BIT[a]--;
		a += a&-a;
	}
}
int sum(int a) {
	int b = 0;
	while (a > 0) {
		b += BIT[a];
		a -= a&-a;
	}
	return b;
}
P c[300000];
signed main() {
	int a, b; cin >> a >> b;
	for (int d = 0; d < a; d++) {
		int e, f; scanf("%d%d", &e, &f);
		c[d] = { f - e,e };
	}
	sort(c, c + a);
	int ans = a;
	int K = 0;
	for (int i = 1; i <= b; i++) {
		while (K<a&&c[K].first + 1 < i) {
			ans--;
			add(c[K].second); take(c[K].second + c[K].first + 1);
			K++;
		}
		int N = 0;
		for (int j = i; j <= b; j += i) {
			N += sum(j);
		}
		printf("%d\n", ans + N);
	}
}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include <cmath>
#include <limits>
#include<set>
#include <iomanip>
#include <queue>
#include <map>
#include <string>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const long long INF=200000000000000;
const double inf=pow(10,10);
double pi=3.141592653589793;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const ll MOD = 1000000007;
void init(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
}

	
int main(){
	init();
	ll N,M;
	cin>>N>>M;
	vector<ll>a(N);
	vector<ll>b(N);
	vector<ll>c(M);
	vector<ll>d(M);
	for(int i=0;i<N;i++)cin>>a[i]>>b[i];
	for(int i=0;i<M;i++)cin>>c[i]>>d[i];
	
	for(int i=0;i<N;i++){
		ll nowmin=INF;
		ll ans=-1;
		for(int j=0;j<M;j++){
			ll num=abs(a[i]-c[j])+abs(b[i]-d[j]);
			if(num<nowmin){
				ans=j+1;
				nowmin=num;
			}
		}
		cout<<ans<<endl;
	}
}


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

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

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using ul = unsigned 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 (a > b) { a = b; return 1; } return 0; }

ll GCD(ll a, ll b) { return b ? GCD(b, a%b) : a; }
ll LCM(ll a, ll b) { return a / GCD(a, b)* b; }

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

inline bool inside(int y, int x, int H, int W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

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

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  int a,b,c,d; cin>>a>>b>>c>>d;
  int w=c-a;
  int h=d-b;
  rep(i,w)   cout<<"R";
  rep(i,h+1) cout<<"U";
  rep(i,w+1) cout<<"L";
  rep(i,h+1) cout<<"D";
  cout<<"R";
  
  rep(i,h)   cout<<"U";
  rep(i,w+1) cout<<"R";
  rep(i,h+1) cout<<"D";
  rep(i,w+1) cout<<"L";
  cout<<"U"<<endl;;
}


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

using namespace std;

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

    std::unordered_map<string, int> m;

    int max_num = 0;

    for(int i=0;i<n;i++){
        string tmp;
        cin >> tmp;
        max_num = max(max_num, ++m[tmp]);
    }

    std::vector<string> ans;
    for(auto& v : m){
        if(v.second == max_num){
            ans.push_back(v.first);
        }
    }

    sort(ans.begin(), ans.end());
    for(auto& v : ans){
        cout << v << endl;
    }

    return 0;
}


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

public class Main {

    void run() {
        Scanner sc = new Scanner(System.in);

        int[] ar = new int[5];
        for (int i = 0; i < 5; i++) {
            ar[i] = sc.nextInt();
        }

        Arrays.sort(ar);

        System.out.println(solve(0, 0, ar));
    }

    int solve(int cnt, int S, int[] ar) {
        int ret = 1 << 20;
        for (int i = 0; i < 5; i++) if (((S >> i) & 1) == 0) {
            int tmp = cnt;
            if (tmp % 10 != 0) {
                tmp += 10 - tmp % 10;
            }
            ret = Math.min(ret, solve(tmp + ar[i], S | (1 << i), ar));
        }
        if (ret == (1 << 20)) {
            return cnt;
        } else {
            return ret;
        }
    }

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


Measured memory_bytes: 21716
fun main(args: Array<String>) {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }
    val l = readLine()!!.split(" ").map { Math.abs(it.toInt() - y) }.toSet().reduce{a,b -> gcd(a, b)}
    println(l)
}

fun gcd(a: Int, b: Int): Int {
    if (b == 0) return a
    return if (a < b)gcd(b, a) else gcd(b, a % b)
}


Measured memory_bytes: 76648
A=[[0,0,0],[0,0,255],[0,255,0],[0,255,255],[255,0,0],[255,0,255],[255,255,0],[255,255,255]]
B=['black','blue','lime','aqua','red','fuchsia','yellow','white']
while(l=gets)!="0\n"
puts A.length.times.map{|i|[A[i].zip(l[1..-1].unpack("a2a2a2").map{|e|e.to_i(16)}).map{|e|(e[0]-e[1])**2}.reduce(&:+),B[i]]}.min[1]end

Measured memory_bytes: 2732
#include <stdio.h>
#include <string.h>
int main() {
	char s[200000];
	int a, b;
	scanf("%s", s);
	int len = strlen(s);
	for (int i = 0; i < len; i++) {
		if (s[i] == 'A') {
			a = i;
			break;
		}
	}
	for (int i = len - 1; i >= 0; i--) {
		if (s[i] == 'Z') {
			b = i;
			break;
		}
	}
	printf("%d\n", b - a + 1);
	return 0;
}

Measured memory_bytes: 384
#if defined(_WIN32)
#include "stdc++.h"
#else
#include <bits/stdc++.h>
#endif

template <class Type>
struct IN
{
	Type val;

	IN()
	{
		std::cin >> val;
	}

	operator Type&()
	{
		return val;
	}

	IN<Type>& operator=(const Type& _value)
	{
		val = _value;
		return *this;
	}
};

template <class Char, class Type>
std::basic_ostream<Char>& operator <<(std::basic_ostream<Char>& os, const IN<Type>& value)
{
	return os << value.val;
}

template <class Char, class Type>
std::basic_istream<Char>& operator >>(std::basic_istream<Char>& is, IN<Type>& value)
{
	return is >> value.val;
}

std::string INSTR()
{
	std::string value;
	std::cin >> value;
	return value;
}

void OUT()
{
	std::cout << std::endl;
}
template <class Type, class ... Args>
void OUT(const Type& value, const Args& ... args)
{
	std::cout << value;
#pragma warning(disable: 4127)
	if (sizeof...(args) != 0) std::cout << ' ';
	OUT(args...);
}

using ll = long long;
using inll = IN<ll>;
using vll = std::vector<ll>;
using setll = std::set<ll>;
using msetll = std::multiset<ll>;

#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); ++(i))
#define REP(i, n) for(ll (i) = 0; (i) < (n); ++(i))
#define REPR(i, n) for(ll (i) = (n); (i) >= 0; --(i))
#define ITRREP(it, v) for(auto (it) = (v).begin(); (it) != (v).end(); ++(it))
#define ITRREPR(it, v) for(auto (it) = (v).rbegin(); (it) != (v).rend(); ++(it))
#define DIVUP(a, b) (((a) + (b) - 1) / (b))

void Main();

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

	Main();

	return 0;
}

using namespace std;

//////////////////////////////

void Main()
{
	inll n, h;

	ll aMax = 0;
	msetll b;
	REP(i, n)
	{
		inll a_, b_;
		aMax = max(aMax, a_.val);
		b.insert(b_);
	}

	ll cnt = 0;
	ITRREPR(it, b)
	{
		if (*it < aMax) break;
		h -= *it;
		cnt++;
		if (h <= 0)
		{
			return OUT(cnt);
		}
	}

	cnt += DIVUP(h, aMax);
	return OUT(cnt);
}


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

using namespace std;

bool check(string s){
    for(int i=0; i< s.size()-1; i++) if(s[i] != s[i+1]) return false;
    return true;
}

int main(){
    string s;
    while(cin >> s, s!= "0"){
        queue<pair<string, int> > que;
        que.push(make_pair(s, 0));
        int ret = 100;

        map<string, int> m;
        while(que.size()){
            s = que.front().first; int count = que.front().second; que.pop();

            if(ret < count) continue;
            if(check(s))ret = count;

            if(m[s] == 0 || count+1 < m[s]){
                string tmp = s;
                m[s] = count+1;
                string t = "rgb";
                vector<int> v(3); v[0] = 0; v[1] = 1; v[2] = 2;
                map<string, int> mp; mp["r"] = 0; mp["g"] = 1; mp["b"] = 2;
                do{
                    for(int i=0; i< s.size(); i++){
                        s[i] = t[v[mp[s.substr(i, 1)]]];
                    }
                    m[s] = count+1;
                }while(next_permutation(v.begin(), v.end()));
                s = tmp;
            }
            else continue;

            for(int i=0; i< s.size()-1; i++){
                if(s[i] != s[i+1]){
                    string t = s.substr(i, 2);
                    sort(t.begin(),t.end());
                    if(t == "br") t = "gg";
                    else if(t == "bg") t = "rr";
                    else if(t == "gr") t = "bb";
                    que.push(make_pair(s.substr(0, i)+t+s.substr(i+2), count+1));
                }
            }
        }
        if(ret == 100) cout << "NA" << endl;
        else cout << ret << endl;
    }
}

Measured memory_bytes: 7292
#include<bits/stdc++.h>
using namespace std;
const int SS=32780;
const int mod=1e9+7;
int n,m,u[255],v[255];
int f[2][SS],c[SS],d[SS],bin[255];
int ans;

int main(){
	int s,i,j,lim;
	scanf("%d%d",&n,&m);
	bin[0]=1;
	for(i=1;i<=m;++i) bin[i]=bin[i-1]*2%mod;
	lim=1<<n;
	for(i=1;i<=m;++i) {
		scanf("%d%d",&u[i],&v[i]);
		u[i]--;v[i]--;
	}
	for(s=1;s<lim;++s)
	for(i=1;i<=m;++i){
		if(((s>>u[i])&1)&&((s>>v[i])&1)) c[s]++;
		if(((s>>u[i])&1)||((s>>v[i])&1)) d[s]++;
	}
	for(i=0;i<2;++i)
	 for(s=1;s<lim;++s){
	 	if(!((s>>i)&1)) continue;
	 	f[i][s]=bin[c[s]];
	 	for(j=s;j;j=(j-1)&s)
	 	 f[i][s]=((f[i][s]-1ll*f[i][s-j]*bin[c[j]])%mod+mod)%mod;
	 }
	for(i=1;i<lim;++i)
	 for(j=1;j<lim;++j){
	 	if((i&j)||(c[i]+c[j]!=c[i|j])||(!(i&1))||(!((j>>1)&1))) continue;
	 	ans=(ans+1ll*f[0][i]*f[1][j]%mod*bin[m-d[i|j]]%mod)%mod;
	 }
	ans=((bin[m]-ans)%mod+mod)%mod;
	printf("%d\n",ans);
}

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

int main() {
	int n; cin >> n;
	string s = to_string(n);
    for (int i = 0; i < 3; i++) {
        if (s.at(i) == '1') s.at(i) = '9';
        else if (s.at(i) == '9') s.at(i) = '1';
    }
	cout << stoi(s) << endl;
}

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

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string S;
    cin >> S;
    vector<int> freq(26, 0);
    for (char c : S){
        ++freq[c - 'a'];
    }
    for (int i = 0; i != freq.size(); ++i){
        if (freq[i] == 0){
            cout << char('a' + i) << endl;
            return 0;
        }
    }
    cout << "None" << endl;
    return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define MOD 1000000007

int main(){
  int h,w;
  cin>>h>>w;
  int c[10][10];
  for(int i=0;i<10;i++){
    for(int j=0;j<10;j++) cin>>c[i][j];
  }
  for(int k=0;k<10;k++){
    for(int i=0;i<10;i++){
      for(int j=0;j<10;j++) c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
    }
  }
  int ans=0;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      int x;
      cin>>x;
      if(x==-1) continue;
      else{
        ans+=c[x][1];
      }
    }
  }
  cout<<ans<<endl;
  return 0;
}

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

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
LL L;
LL A[200111];
LL sums[200111];

void MAIN() {
    scanf("%lld%d", &L, &N);
    REP (i, N) scanf("%lld", A+i);

    LL ans = 0;
    REP (t, 2) {
	REP (i, N) sums[i+1] = sums[i] + A[i];

	REP (i, N) {
	    int left = i+1;
	    int right = N-i-1;

	    if (right >= left) {
		LL tmp = sums[i+1]*2 + 
		    L*left*2 - (sums[i+1+left] - sums[i+1])*2 - A[i];
		amax(ans, tmp);
	    } else {
		LL tmp = (sums[i+1] - sums[i-right])*2 +
		    L*right*2 - (sums[i+1+right] - sums[i+1])*2 - A[i];
		amax(ans, tmp);
	    }
	}

	REP (i, N) A[i] = L - A[i];
	reverse(A, A+N);
//	rprintf("%lld", A, A+N);
    }

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

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 3328
local s=io.read()
local sable={}
for i=1,#s do
    sable[i]=s:byte(i)-97
end
local k=io.read("n")
for i=1,#s do
    local a=sable[i]
    if i~=#s and k>=26-a and a>0 then
        sable[i]=string.char(97)
        k=k-(26-a)
    elseif i==#s then
        sable[i]=string.char((sable[i]+k)%26+97)
    else
        sable[i]=string.char(sable[i]+97)
    end
end
print(table.concat(sable,""))

Measured memory_bytes: 3924
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<(n);++i)
constexpr int mod=1000000007;
constexpr int mod1=998244353;
vector<int> dx={0,1,0,-1},dy={-1,0,1,0};
bool inside(int y,int x,int h,int w){
	if(y<h && y>=0 && x<w && x>=0) return true;
	return false;
}





int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n;cin >> n;
	vector<ll> a(n);
	rep(i,n) cin >> a.at(i);
	vector<ll> sum(n + 1);
	rep(i,n){
		sum.at(i + 1) += sum.at(i) + a.at(i);
	}
	ll ans = 1e18;
	rep(i,n + 1){
		ans = min(ans, abs(sum.at(n) - sum.at(i) * 2));
	}
	cout << ans << endl;
}


Measured memory_bytes: 3456
#include<bits/stdc++.h>
using namespace std;
int n,p[1000005],ans;
vector<int> v;
void sieve(){
  	for(int i=2;i<=n;i++) p[i]=1;
    for(int i=2;i<=sqrt(n);i++){
      if(p[i]){
      	for(int j=i*i;j<=n;j+=i) p[j]=0;
      }
    }
  	for(int i=2;i<=n;i++){
        if(p[i]) v.push_back(i);
    } 
}
int main(){
  cin>>n;
  sieve();
  for(int i=1;i<n;i++){
    int cnt1=1,tmp=n-i;
    for(int k=0;k<v.size();k++){
      int j=v[k];
      if(j*j*j>tmp) break;
      int cnt2=1;
      while(tmp%j==0){
        tmp/=j;
        cnt2++;
      }
      cnt1*=cnt2;
    }
    int s=sqrt(tmp);
    if(p[tmp]) cnt1*=2;
    else if(s*s==tmp && p[s]) cnt1*=3;
    else if(tmp!=1) cnt1*=4;
    ans+=cnt1;
  }
  cout<<ans;
  return 0;
}

Measured memory_bytes: 7764
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<math.h>
using namespace std;

#define MAX 256

int main(void){
	
	int n, a, b, c;

	scanf("%d", &n);
	int ans[n];

	for (int i = 0; i < n; i++){
		scanf("%d%d%d", &a, &b, &c);
		if (a > b){
			int d = a;
			a = b;
			b = d;
		}
		if (c < a){
			int d = a;
			a = c;
			c = b;
			b = d;
		}
		else if (c > a&&c < b){
			int d = b;
			b = c;
			c = d;
		}
		if (a*a + b*b == c*c){
			ans[i] = 1;
		}
		else{
			ans[i] = 0;
		}
	}

	for (int i = 0; i < n; i++){
		if (ans[i] == 1)printf("YES\n");
		if (ans[i] == 0)printf("NO\n");
	}

	return 0;
}

Measured memory_bytes: 3128
#include<bits/stdc++.h>
using namespace std;
int n;
int r1,l1;
int main() {
	cin>>n;
	int ans=0;
	for (int i=1; i<=n; i++) {
		cin>>r1>>l1;
		ans+=l1-r1+1;
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
///
// File:  2321.cpp
// Author: ymiyamoto
//
// Created on Fri Dec 29 10:09:56 2017
//

#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

int32_t main()
{
  while (true) {
    uint32_t N;
    cin >> N;
    if (N == 0) break;

    vector<uint64_t> sats(N + 1, 0);
    vector<uint32_t> dates(N + 1, 0);
    for (uint32_t i = 1; i <= N; i++) {
      uint64_t M, L;
      cin >> M >> L;
      uint32_t date = 0;
      for (uint32_t j = 0; j < M; j++) {
        uint32_t S, E;
        cin >> S >> E;
        for (uint32_t k = S - 6; k < E - 6; k++) {
          date |= 1 << k;
        }
      }
      sats[i] = L;
      dates[i] = date;
    }

    vector<vector<uint64_t>> dp(N + 1, vector<uint64_t>(1 << 16, 0));
    for (uint32_t i = 1; i <= N; i++) {
      for (uint32_t j = 0; j < (1 << 16); j++) {
        dp[i][j] = dp[i - 1][j];
      }
      for (uint32_t j = 0; j < (1 << 16); j++) {
        if (j & dates[i]) continue;
        dp[i][j | dates[i]] = max(dp[i][j | dates[i]], dp[i - 1][j] + sats[i]);
      }
    }

    uint64_t max_val = 0;
    for (auto d : dp[N]) {
      max_val = max(max_val, d);
    }
    cout << max_val << endl;
  }

  return 0;
}

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

using namespace std;
using ll = long long;



int main()
{
    vector<int> a(4);
    for(int i = 0; i < 4; i++)cin >> a[i];
    sort(a.begin(), a.end());

    do{
        if(a[0] == 1 && a[1] == 9 && a[2] == 7 && a[3] == 4){cout << "YES" << endl;return 0;}
    }while(next_permutation( a.begin(), a.end()) );
    cout << "NO" << endl;


}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
vector<vector<char>> s(300,vector<char>(300));
vector<vector<int>> a(300,vector<int>(300,0));
int h,w,k;

void paint2_l(int n,int i,int j){
	if(a[i][j] == 0){
		a[i][j] = n;
		if(i - 1 >= 0 && i - 1 < h){
			paint2_l(n,i - 1,j);
		}
	}
}

void paint2_r(int n,int i,int j){
	if(a[i][j] == 0){
		a[i][j] = n;
		if(i + 1 >= 0 && i + 1 < h){
			paint2_r(n,i+1,j);
		}
	}
}

void paint_l(int n,int i,int j){
	if(a[i][j] == 0){
		a[i][j] = n;
		if(j - 1 >= 0 && j - 1 < w){
			paint_l(n,i,j - 1);
		}
	}
}

void paint_r(int n,int i,int j){
	if(a[i][j] == 0){
		a[i][j] = n;
		if(j + 1 >= 0 && j + 1 < w){
			paint_r(n,i,j + 1);
		}
	}
}


void paint(int n,int i,int j){
	if(j - 1 >= 0 && j - 1 < w){
		paint_l(n,i,j - 1);
	}

	if(j + 1 >= 0 && j + 1 < w){
		paint_r(n,i,j + 1);
	}
	
}

void paint2(int n,int i,int j){
	if(i - 1 >= 0 && i - 1 < h){
		paint2_l(n,i - 1,j);
	}

	if(i + 1 >= 0 && i + 1 < h){
		paint2_r(n,i + 1,j);
	}
	
}


int main(){
	cin >> h >> w >> k;
	
	int counter = 1;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			char l;
			cin >> l;
			s[i][j] = l;
			if (l == '#'){
				a[i][j] = counter;
				counter++;
			}
		}	
	}


	counter = 1;
	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if (a[i][j] == counter){
				paint(counter,i,j);
				counter++;
			}
		}
	}

	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			if (a[i][j] != 0){
				paint2(a[i][j],i,j);
			}
		}
	}

	for(int i = 0; i < h; i++) {
		for(int j = 0; j < w; j++) {
			cout << a[i][j] << ' ';
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 1280
/*input
11 10 9
*/

#include <functional>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <utility> 
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>

using namespace std;

using ll = long long;
using ld = long double;

const int SINF = 1000000009;
const ll INF =  1000000000000000018;

#define sp          cout << " "
#define nl          cout << "\n"
#define all(c)      (c).begin(),(c).end()
#define prec(n)     cout << fixed << setprecision(n)
#define PI          3.14159265358979323846264338327951
#define ifalse      ios_base::sync_with_stdio(false), cin.tie(NULL)

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

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

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(auto x: v) {
    os << x << " ";
  }
  return os;
}

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

/******************************** START *********************************/
const int N = 100005;

int main()
{
  ifalse;
  ll a, b, n;
  cin >> a >> b >> n;
  ll x = min(b - 1, n);

  ll ans = floor(a * x) / b - a * floor(x / b);
  cout << ans, nl;
  return 0;
}

Measured memory_bytes: 3652
#include<stdio.h>
#include<math.h>
#include<stdlib.h>

int N,h[100000];
int a[100000];


int cost(int n)
{
  int k,temp;
  
  if(a[n]>=0)
  {
    temp=a[n];
  }
  else if(n==N-1)
  {
    temp=0;    
  }
  else if(n==N-2)
  {
    temp=cost(n+1)+abs(h[n]-h[n+1]);
  }
  else
  {
    temp=fmin(cost(n+1)+abs(h[n]-h[n+1]),cost(n+2)+abs(h[n+2]-h[n]));
  }
  a[n]=temp;
  return a[n];
}

int main()
{

  int j;
  scanf("%d",&N);
  for(j=0;j<N;j++)
  {
    scanf("%d",&h[j]);
    a[j]=-1;
  }
  
  j=cost(0);
  
  printf("%d",j);
  
  return 0;
}

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

int main() {
  int h, w;
  cin >> h >> w;
  
  char pic[h][w];
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) cin >> pic[i][j];
  }
  
  char frame[h + 2][w + 2];
  for (int i = 0; i < h + 2; i++) {
   for (int j = 0; j < w + 2; j++) 
     frame[i][j] = '#'; 
  }  
  
  for (int i = 0; i < h; i++) {
    for (int j = 0; j < w; j++) 
      frame[i + 1][j + 1] = pic[i][j];
  }
  
  for (int i = 0; i < h + 2; i++) {
    for (int j = 0; j < w + 2; j++) 
      cout << frame[i][j]; 
    cout << endl;
  }
}


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

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

#define rep(i, n) for(int i = 0; i < (n); i++)
#define repto(i, n) for(int i = 0; i <= (n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define mp make_pair
#define INF 1145141919
#define MOD 1000000007
#define DEBUG(x) cout << #x << ": " << x << endl;
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }

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

  string S, T;
  cin >> S >> T;
  int ans = 1001;
  rep (i, S.size()-T.size()+1) {
    int cnt = 0;
    rep (j, T.size()) {
      if (T[j] != S[i+j])
        cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3656
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#include <x86intrin.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define V vector
template <typename T> bool chmin(T &a, const T &b) {if(a > b){a = b; return true;} return false;}
template <typename T> bool chmax(T &a, const T &b) {if(a < b){a = b; return true;} return false;}
template<typename A, size_t N, typename T> void Fill (A (&array)[N], const T & val) {fill ((T*)array, (T*)(array+N), val);}
V<int> dx = {-1, 1,  0, 0, -1, -1,  1, 1};
V<int> dy = { 0, 0, -1, 1, -1,  1, -1, 1};

int main () {
    map<string, int> mp;
    int n; cin >> n;
    rep(i, n) {
        string s; cin >> s;
        mp[s]++;
    }
    int m; cin >> m;
    rep(i, m) {
        string s; cin >> s;
        mp[s]--;
    }
    int ans = 0;
    for (auto p : mp) {
        chmax(ans, p.second);
    }
    cout << ans << endl;

    return 0;
}

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

namespace a
{
    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine();
            int s = 0;
            int t = 0;
            for (int i = 0; i < x.Length; i++)
            {
                if(x[i]=='S')
                {
                    s++;
                }
                else //T
                {
                    if (s > 0) s--;
                    else t++;
                }
            }
            Console.WriteLine(s+t);
        }
    }
}


Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(i = 0; i < n; i++)
//2D::rep(i,j)rep(j,j)cin>>bin[i][j];
//vector<int> a(n)
#define Graph vector<vector<int>>
#define A1 cout<<"No"<<endl
#define A2 cout<<"Yes"<<endl
#define A3 cout<<ans<<endl
#define AA(i) cout<<i<<endl;
const int U=2e5+5;
const ll MOD=1000000007;
const int INF = 1001001001;

int main(){
    int X,N; cin >>X>>N;
    if(N == 0){
        AA(X);
    }
    else{
    vector<int> p(N);
    vector<bool> k(110,true);
    int i;
    rep(i,N) {
        cin >> p[i];
        k[p[i]] = false;
    }
    sort(p.begin(), p.end());
    if(k[X]){
        AA(X);
        return 0;
    }
    for(int i=1;i<110;i++){
        if(k[X-i]) {
            AA(X-i);
            return 0;
        }
        if(k[X+i]) {
            AA(X+i);
            return 0;
        }
    }
    }
    return 0;
}

Measured memory_bytes: 3628
n = int(input())
h = list(map(int, input().split()))
cnt = 1
hmax = [0] * n
hmax[0] = h[0]
for i in range(1, n):
    hmax[i] = max(hmax[i - 1], h[i])
    if hmax[i] == h[i]:
        cnt +=1
print(cnt)

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

int main(){
	int s[101][101] = {0};
	int i, j, r, c;
	
	cin >> r >> c;
	
	for(i = 0; i < r; i++){
		for(j = 0; j < c; j++){
			cin >> s[i][j];
			s[i][c] += s[i][j];
			s[r][j] += s[i][j];
		}
		s[r][c] += s[i][c];
	}
	
	for(i = 0; i < r + 1; i++){
		for(j = 0; j < c + 1; j++){
			cout << s[i][j];
			if(j != c){
				cout << " ";
			}
		}
		cout << endl;
	}
	return 0;
}

Measured memory_bytes: 3112
#include<bits/stdc++.h>
			#include <sstream> 
			#include<bitset>
			#include<string>
			#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
			using namespace std;
			#include <numeric> 
			using pi=pair<long long,long long>;
			#define pii 3.1415926536
			#define binary
			#define mod 1000000007 
			typedef long long ll;
			typedef long double ld;
			bool sortbysec(const ll &a, const ll &b) 
			{ 
			    return (a > b); 
			}
			bool compare(const pair<ll,ll> &a,const pair<ll,ll> &b)
			{
				
				if(a.second<b.second)
				return a.first<b.first;
			}
			int lcm(int a, int b)  
			 {  
			    return (a*b)/__gcd(a, b);  
			 } 
			 int Kad(ll dp[],ll n)
	{
	  ll curr_max=0,maxx=INT_MIN;
	  for(int i=0;i<n;i++)
	  {
	    curr_max=curr_max+dp[i];
	    if(curr_max>maxx)
	      maxx=curr_max;

	    if(curr_max<0)
	      curr_max=0;
	   
	  }

	  return maxx;
	}
	ll nextAlive(ll l,ll next[])
	{
		if(next[l]==l)
			return l;
		else
			return next[l]=nextAlive(next[l],next);

	}

int main()
			 {
			 	#ifndef ONLINE_JUDGE
     freopen("input.txt", "r", stdin);
     freopen("output.txt", "w", stdout);
     freopen("error.txt", "w", stderr);
     #endif  
     IOS;
     ll N;
     cin>>N;
     ll a[4];
     memset(a,0,sizeof(a));
     for (int i = 0; i < N; ++i)
     {
     	string str;
     	cin>>str;
     	if(str=="AC")
     	{
     		a[0]++;
     	}
     	else if(str=="WA")
     	{
     		a[1]++;
     	}
     	else if(str=="TLE")
     		a[2]++;
     	else if(str=="RE")
     		a[3]++;
     }
     cout<<"AC "<<"x "<<a[0]<<endl;
     cout<<"WA "<<"x "<<a[1]<<endl;
     cout<<"TLE "<<"x "<<a[2]<<endl;
     cout<<"RE "<<"x "<<a[3]<<endl;

 	
}
		


			 		
			 		
			 		
			 


Measured memory_bytes: 3656
import scala.math.{min,max}

object Main {
    def main(args: Array[String]) {
        var input = io.Source.stdin.getLines().mkString("\n");
        var ss = input.split('\n').toList;
        val xs = to_array_int(ss(0));
        val a = xs(0);
        val b = xs(1);
        if (a <= 5) {
            println(0);
        }
        else if (6 <= a && a <= 12) {
            println(b/2);
        }
        else {
            println(b);
        }
    }
    def to_array_int(s: String): Array[Int] = {
        return s.split(' ').map(_.toInt).toArray;
    }
}


Measured memory_bytes: 25512
using System;
namespace tes
{
    class Program
    {
        static void Main(string[] args)
        {
            var line1 = Console.ReadLine().Split();
            int a = int.Parse(line1[0]);
            int b = int.Parse(line1[1]);

            if (a < b)
            {
                Console.WriteLine("a < b");
            }
            else if (a > b)
            {
                Console.WriteLine("a > b");
            }
            else
            {
                Console.WriteLine("a == b");
            }


        }
    }
}

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

int N;
int L[110];

int main()
{
	cin >> N;
	for(int i=0;i<N;++i) cin >> L[i];

	int ans = 0;
	for(int i=1;i<N;++i){
		if(L[i-1]>L[i]){
			ans += L[i-1] - L[i];
		}
	}
	
	cout << ans + L[N-1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
using ll = long long;
using pll = pair<ll, ll>;
#define all(x) (x).begin(), (x).end()
#define call(x) (x).cbegin(), (x).cend()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define sz(x) ((x).size())
#define UNIQUE(v) v.erase(unique(v.begin(), v.end()), v.end())
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
const double PI = acos(-1);
const int mod = 1e9+7;
const long long INF = (1LL << 60);
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
ll gcd(ll a,ll b){return b ? gcd(b,a%b) : a;}
ll lcm(ll a,ll b){return a / gcd(a,b) * b;}
ll stringcount(string s, char c){return count(s.cbegin(), s.cend(), c);}
bool isInteger(double x){return floor(x) == x;}
ll ceil(ll a, ll b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmax(T &a, const T &b){ if(a < b){ a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b){ if(a > b){ a=b; return 1; } return 0; }


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

  string s;
  cin >> s;
  ll n = sz(s);
  rep(i, 0, n-1){
    if(s[i] == s[i+1]){
      cout << i+1 << ' ' << i+2 << endl;
      return 0;
    }
  }
  rep(i, 0, n-2){
    if(s[i] == s[i+2]){
      cout << i+1 << ' ' << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
  return 0;
}

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

#define _ << " _ " <<
#define TRACE(x) cout << #x << " = " << x << endl

typedef long long ll;


int n;
ll cnt['z' + 1];
string s;

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

    cin >> n >> s;
    for (char c : s) cnt[c]++;
    ll sol = 1, mod = 1e9 + 7;
    for (int i = 'a'; i <= 'z'; i++) sol = (sol * (cnt[i] + 1)) % mod;
    sol--;
    if (sol < 0) sol += mod;
    cout << sol;

    return 0;
}



Measured memory_bytes: 512
import sys
input = sys.stdin.readline

def main():
  n, k = map(int, input().split())
  point = [[int(x) for x in input().split()] for _ in range(n)]
  
  ans = pow(10, 18)*4
  for a in range(n):
    for b in range(a+1):
      for c in range(b+1):
        for d in range(c+1):
          x, y = [point[a][0], point[b][0], point[c][0], point[d][0]], [point[a][1], point[b][1], point[c][1], point[d][1]]
          x1, x2, y1, y2 = min(x), max(x), min(y), max(y)
          count = 0
          for e in range(n):
            if x1 <= point[e][0] <= x2 and y1 <= point[e][1] <= y2:
              count += 1
          if count < k:
            continue
          sub = (x2-x1)*(y2-y1)
          if ans > sub:
            ans = sub
  
  print(ans)
  
  
if __name__ == "__main__":
  main()

Measured memory_bytes: 74728
#include<stdio.h>
#define MAX 120



int main(){
int n,i,j;
int x,y,z;
int A[MAX][MAX]={0};

scanf("%d",&n);

for(i=1;i<=n;i++){
 scanf("%d",&x);
 scanf("%d",&y);
 if(y!=0){
  for(j=0;j<y;j++){
   scanf("%d",&z);
   A[x][z]=1;
  }
 }
}

for(i=1;i<=n;i++){
 for(j=1;j<n;j++){
  printf("%d ",A[i][j]);
 }
 printf("%d\n",A[i][n]);
}



return 0;
}


Measured memory_bytes: 2052