akhauriyash/Code-Regression huggingface dataset:
from itertools import combinations as c
from collections import Counter

n=int(input())
l=[]
for i in range(n):
    x,y=map(int,input().split())
    l.append([x,y])

if n==1:
    print(1)
else:
    l.sort()
    m=c(l,2)
    ans=[]
    for v in m:
        ans.append(str([v[1][0]-v[0][0],v[1][1]-v[0][1]]))
    a=Counter(ans).most_common()[0][1]
    print(n-a)

Measured memory_bytes: 3564
<?php
   $array = explode(" ",fgets(STDIN));
for($x = 0; $x<=$array[0]; $x++){
  for($y = 0; $y<=$array[0]-$x; $y++){
      $z = $array[0] - $x - $y;
  if(10000*$x+5000*$y+1000*$z == $array[1]){
        echo $x." ".$y." ".$z;
        exit;
    }
  }
}
echo "-1 -1 -1";
?>

Measured memory_bytes: 16180
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int n, m;   cin >> n >> m;
    long long mod = 1e9+7;
    vector<int> s(n), t(m);
    for (int i = 0; i < n; i++)
        cin >> s[i];
    for (int i = 0; i < m; i++)
        cin >> t[i];

    vector<vector<long long> > u(n+1, vector<long long>(m+1, 0)), v(n+1, vector<long long>(m+1, 1));
    u[0][0] = 1;
    
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            if (s[i] == t[j])
                u[i+1][j+1] = v[i][j];
            
            v[i+1][j+1] = (u[i+1][j+1] + v[i+1][j] + v[i][j+1] - v[i][j]) % mod;
        }
    }

    cout << (v[n][m] + mod) % mod << endl;
    return 0;
}   

Measured memory_bytes: 65984
#include <iostream>
#include <cmath>
#include <vector>
#include <unordered_map>

#define BIG 1000000007

using namespace std;

int total = 0;



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

    vector<int> weights(n);
    vector<int> values(n);
    int w1;
    for(int i = 0;i < n;++i){
        int iw;
        cin >> iw >> values[i];
        if(i == 0){
            w1 = iw;
        }
        weights[i] = iw - w1;
    }


    vector<vector<vector<long>>> dp(n + 1,vector<vector<long>>(4 * n + 1,vector<long>(n + 1,-1)));
    dp[0][0][0] = 0;
    for(int i = 0;i < n;++i){
        for (int j = 0; j < 4 * n;++j) {
            for(int k = 0;k < n;++k){
                if(0 > dp[i][j][k])continue;
                for(int t = j;t <= 4 * n;++t){
                    if(dp[i + 1][t][k] >= dp[i][j][k])break;
                    dp[i + 1][t][k] = dp[i][j][k];
                }

                int maxW = w - (k + 1) * w1;
                int newW = j + weights[i];

                if(newW > maxW) {
                    continue;
                }

                for(int t = newW;t <= 4 * n;++t){
                    if(dp[i + 1][t][k + 1] >= dp[i][j][k] + values[i])break;
                    dp[i + 1][t][k + 1] = dp[i][j][k] + values[i];
                }
            }
        }
    }
    long max = 0;
    for(int k = 0;k <= n;++k)if(max < dp[n][4 * n][k])max = dp[n][4 * n][k];
    cout << max << endl;
}








Measured memory_bytes: 33792
#include <stdio.h>



int main(void)
{
	//変数の宣言
	int n,m;
	int x[110];
	int y[110];
	int xmax,ymin;
	int ans;
	int i;
	
	//データの読み込み
	scanf("%d %d %d %d\n",&n,&m,&x[0],&y[0]);
	
	for(i=0;i<n;i++){
		scanf("%d",&x[i+1]);
	}
	
	for(i=0;i<m;i++){
		scanf("%d",&y[i+1]);
	}
	
//	printf("nは%dです\n", n);
//	printf("データの読み込み終了\n");
	//実際の処理
	
	xmax=-200;
	ymin=200;
	
	for(i=0;i<n+1;i++){
		if(xmax<x[i]) xmax=x[i];
	}
	
	for(i=0;i<m+1;i++){
		if(ymin>y[i]) ymin=y[i];
	}
	
	
	
	
	
//	printf("計算部分終了\n");
	
	//出力
	
	if(xmax<ymin){
		printf("No War");
	}else{
		printf("War");
	}
	
//	printf("結果の出力終了\n");
	
	return 0;
}



Measured memory_bytes: 128
#include <iostream>
#include <bits/stdc++.h>
#include <vector>
#include <string>
#include <string.h>

using namespace std;
#define ll long long int

int gcd(ll a, ll b){
	if(b==1)
		return a;
	else
		return gcd(b,a%b);
}

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

	ll n,m;
	cin>>n>>m;
	ll a=n%m;
	a=min(a,m-a);
	cout<<a;

	return 0;
}


Measured memory_bytes: 256
import java.io.*;

class Main{
	public static void main(String[] args)throws IOException{
		InputStreamReader isr = new InputStreamReader(System.in);
		BufferedReader br = new BufferedReader(isr);
		String[] str = br.readLine().split(" ");
		System.out.println(str[0].charAt(0)+""+str[1].charAt(0)+""+str[2].charAt(0));
	}
}

Measured memory_bytes: 8148
import sys

n = int(input())
originals = [input() for i in range(n)]

ret = {}
count = 0
for original in originals:
  str = "".join(sorted(list(original)))
  if str in ret:
    count += ret[str]
    ret[str] += 1
  else:
    ret[str] = 1
print(count)

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

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

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("Yes")
#define p_no() p("No")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

struct UnionFind{
    vector<ll> parent;
    UnionFind(ll sz){
        parent.resize(sz);
        reset();
    }

    void reset(){
        FOR(i, 0, parent.size()){
            parent[i] = i;
        }
    }

    void unite(ll a, ll b){
        if(a>b){
            swap(a, b);
        }
        ll rootA = findRoot(a);
        ll rootB = findRoot(b);
        if(rootA>rootB){
            swap(rootA, rootB);
        }
        if(rootA==rootB){
            return;
        }else{
            // 小さい方を親にする
            parent[rootB] = rootA;
        }
    }

    ll findRoot(ll a){
        if(parent[a]==a){
            return a;
        }else{
            return parent[a] = findRoot(parent[a]);
        }
    }

    map<ll, vector<ll> > getGroups(){
        map<ll, vector<ll> > G;
        FOR(i, 0, parent.size()){
            ll r = findRoot(i);
            G[r].push_back(i);
        }
        return G;
    }

    bool is_same_group(ll a, ll b){
        ll rootA = findRoot(a);
        ll rootB = findRoot(b);
        if(rootA==rootB){
            return true;
        }else{
            return false;
        }
    }
};

struct Edge{
    ll from;
    ll to;
    ll cost;
    Edge(ll from, ll to, ll cost): from(from), to(to), cost(cost) {}
    bool operator<(const Edge &another) const
    {
        return cost < another.cost;
    }
    bool operator>(const Edge &another) const
    {
        return cost > another.cost;
    }
};

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

    // input
    ll V, E;
    cin >> V >> E;

    auto uf = UnionFind(V);

    // コストの小さい順に取り出す設定
    priority_queue<Edge, vector<Edge>, greater<Edge> > que;
    FOR(i, 0, E){
        ll s, t, w;
        cin >> s >> t >> w;

        que.push(Edge(s, t, w));
    }

    ll sum = 0;
    while(!que.empty()){
        auto edge = que.top();
        que.pop();

        ll fr = edge.from;
        ll to = edge.to;
        if(!uf.is_same_group(fr, to)){
            uf.unite(fr, to);
            sum += edge.cost;
        }
    }

    p(sum);
    
    return 0;
}


Measured memory_bytes: 6056
N = int(input())
t, x, y = [0], [0], [0]
isPossible = True
for i in range(N):
    a, b, c = [int(j) for j in input().split()]
    t.append(a)
    x.append(b)
    y.append(c)

for i in range(N):
    dt = t[i+1] - t[i]
    dx = abs(x[i+1] - x[i])
    dy = abs(y[i+1] - y[i])
    
    if dt <  dx + dy or dt % 2 != (dx + dy) % 2:
        isPossible = False

print(("No", "Yes")[isPossible])


Measured memory_bytes: 11816
def plus_minus_seq(n):
    if n == 0:
        return ['']
    else:
        seqs = plus_minus_seq(n-1)
        posi = ['+' + seq for seq in seqs]
        nega = ['-' + seq for seq in seqs]
    return posi + nega

A, B, C, D = input()

for op1, op2, op3 in plus_minus_seq(3):
    seq = A+op1+B+op2+C+op3+D
    if eval(seq) == 7:
        print(seq + '=7')
        break

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <string>
#include <cstring>
#include <vector>
#include <climits>
using namespace std;

#define rep(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
#define SZ(x) ((int) (x).size())
typedef long long ll;

int main(){
	int n;
	while(cin >> n) {
		int x = INT_MIN, y, a, b;
		rep(i,0,n) {
			cin >> a >> b;
			if(a > x) x = a, y = b;
		}
		int ans = x + y;
		cout << ans << endl;
	}
    return 0;
}


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

#define max(a,b) (((a)>(b))?(a):(b))
#define min(a,b) (((a)>(b))?(b):(a))

typedef long long ll;
typedef unsigned long long ull;

int main(void)
{
	int a, b, c;
	scanf("%d%d%d", &a, &b, &c);
	printf("%d", a + b + c - max(max(a, b), c));
}

Measured memory_bytes: 128
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <iostream>
#include <bitset>
#include <deque>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <algorithm>
#include <iterator>
#include <string>
#include <chrono>
#include <random>

const int INF = 1000000009;
const long LINF = 1123456789012345678;

long n, m;
long w[105], v[105];
long dp[105][100005];//dp[i][j] cost needed to carry value at least j, given goods i

int main(){
	scanf("%ld%ld", &n, &m);
	for(int i = 1; i <= n; i++){
		scanf("%ld%ld", &w[i], &v[i]);
	}
	for(int j = 1; j <= 100000; j++){
		dp[0][j] = LINF;
	}
	for(int i = 1; i <= n; i++){
		for(int j = 1; j <= 100000; j++){
			dp[i][j] = std::min(dp[i-1][j], dp[i-1][std::max(0l, j - v[i])] + w[i]);
		}
	}
	for(long i = 100000; i >= 0; i--){
		if(dp[n][i] <= m){
			printf("%ld\n", i);
			return 0;
		}
	}
}


Measured memory_bytes: 80128
#include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <iomanip>
#include <numeric>
#include <queue>
#include <cmath>
using namespace std;

int main() {
    int n;
    cin >> n;
    int nn = 3 * n;
    vector<int> v(3 * n, 0);
    for (int i = 0; i < 3 * n; i++) {
        cin >> v[i];
    }

    vector<long long int> p1(3 * n, 0), p2(3 * n, 0);
    priority_queue<int> pq;
    long long int s = 0;
    long long int m = 0;
    for (int i = 0; i < 3 * n; i++) {
        s += v[i];
        pq.push(-v[i]);
        if (pq.size() > n) {
            s += pq.top();
            pq.pop();
        }
        m = max(m, s);
        p1[i] = m;
    }
    while (pq.size() > 0) pq.pop();
    s = 0;
    m = 0;
    bool flag = true;
    for (int i = nn - 1; i >= 0; i--) {
        s += v[i];
        pq.push(v[i]);
        if (pq.size() > n) {
            s -= pq.top();
            pq.pop();
        }
        if (nn - 1 - i + 1 >= n && (flag || s < m)) {
            m = s;
            flag = false;
        }
        p2[i] = m;
    }
    long long int res = 0;
    flag = true;
    for (int i = n - 1; nn - 1 - (i + 1) + 1 >= n; i++) {
        if (flag || p1[i] - p2[i + 1] > res) {
            res = p1[i] - p2[i + 1];
            flag = false;
        }
    }
    cout << res << endl;
}


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

using namespace std;

int main() {
  int n, m, X, Y, i, ans = 0;
  cin >> n >> m >> X >> Y;
  vector<int> x(n), y(m);
  for (i = 0; i < n; i++) {
    cin >> x[i];
  }
  for (i = 0; i < m; i++) {
    cin >> y[i];
  }
  sort(x.begin(), x.end());
  sort(y.begin(), y.end());
  for (i = X + 1; i <= Y; i++) {
    if (x[n - 1] < i && i <= y[0]) {
      ans = 1;
    }
  }
  if (ans) {
    cout << "No War"
         << "\n";
  } else {
    cout << "War"
         << "\n";
  }
  return 0;
}

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

int main(){
  int D;
  cin>>D;
  int C[26];
  map<int,int>mp;
  for(int i=0;i<26;i++){
    cin>>C[i];
    if(C[i]>26){
      mp[i]++;
    }   
  }
  
  
  
  
  int temp=0;
  while(temp<365){
    if(mp[temp%50]>0){
      cout<<temp%26+1<<endl;
    }
    else cout<<(temp+1)%26+1<<endl;
    temp++;
  }
  return 0;
}


Measured memory_bytes: 3620
n,m,c=map(int,input().split())
blist = [int(i) for i in input().split()]
counter = 0
for i in range(n):
    summ = 0
    alist = [int(ii) for ii in input().split()]
    for j in range(m):
        summ+=alist[j]*blist[j]
    summ+=c
    if summ>0:
        counter+=1
print(counter)

Measured memory_bytes: 3060
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;



ld dis(pair<ld, ld>l, pair<ld, ld>r) {
	ld dx=l.first-r.first;
	ld dy=l.second-r.second;
	return sqrt(ld(dx)*dx+ ld(dy)*dy);
}

ld get_x(pair<ld, ld>f, pair<ld, ld>t, ld y) {
	if(f.second>t.second)return get_x(t,f,y);

	ld a=y-f.second;
	ld b=t.second-y;

	return (t.first*a+f.first*b)/(a+b);
}

int main() {
	cout<<setprecision(10)<<fixed;
	while (true) {
		int N ; ld vw,vc;cin>>N;
		if(!N)break;
		cin>>vw>>vc;
		vector<pair<ld, ld>>points(N);


		for (int i = 0; i < N; ++i) {
			int a,b;cin>>a>>b;
			points[i]=make_pair(a,b);
		}

		vector<vector<pair<int, ld>>>edges(N);
		for (int i = 0; i < N - 1; ++i) {
			edges[i].push_back(make_pair(i+1,dis(points[i],points[i+1])/vw));
		}


		for (int i = 0; i < N - 1; ++i) {
			ld ny=points[i].second;
			if (points[i + 1].second > ny) {
				for (int j = i + 1; j < N-1; ++j) {
					ld fy=points[j].second;
					ld ty=points[j+1].second;

					if (ny < fy&&ty <= ny) {
						ld tunnel_x=get_x(points[j],points[j+1],ny);

						ld adis=abs(tunnel_x-points[i].first)/vc+dis(make_pair(tunnel_x,ny),points[j+1])/vw;

						edges[i].push_back(make_pair(j+1,adis));
						break;
					}
				}
			}
		}
		for (int i = 1; i < N; ++i) {
			ld ny = points[i].second;
			if (points[i - 1].second > ny) {
				for (int j = i - 1; j >0; --j) {
					ld fy = points[j].second;
					ld ty = points[j - 1].second;

					if (ny < fy&&ty <= ny) {
						ld tunnel_x = get_x(points[j], points[j - 1], ny);

						ld adis = abs(tunnel_x - points[i].first)/vc + dis(make_pair(tunnel_x, ny), points[j - 1])/vw;

						edges[j-1].push_back(make_pair(i, adis));
						break;
					}
				}
			}
		}

		vector<ld>memo(N,1e9);
		memo[0]=0;
		for (int i = 0; i < N; ++i) {
			for (auto e : edges[i]) {
				int to=e.first;
				ld cost=e.second;
				memo[to]=min(memo[to],memo[i]+cost);
			}
		}
		cout<<memo[N-1]<<endl;
	}
	return 0;
}


Measured memory_bytes: 3332
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  for(ld i=1;i<=100000;i++){
    if((int)(i*1.08)==n){
      std::cout << (int)i << '\n';
      return 0;
    }
  }
  std::cout << ":(" << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define rep(i,n) for(i=0;i<n;i++)
#define ll long long
#define PI 3.14159265358979323846264338327950L
int main(){
    int n,i;
    scanf("%d",&n);
    int c[n],v[n],ans=0;
    rep(i,n) scanf("%d",&v[i]);
    rep(i,n) scanf("%d",&c[i]);
    rep(i,n){
        if(v[i]>=c[i]){
            ans+=v[i]-c[i];
        }
    }
    printf("%d",ans);
    return 0;
}

Measured memory_bytes: 1724
/*
 * Author: ylx
 * Lang: c++
 * Prog: agc007c
 */
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void qmax(int &x,int y) {if (x<y) x=y;}
void qmin(int &x,int y) {if (x>y) x=y;}
inline int read()
{
	char s;
	int k=0,base=1;
	while ((s=getchar())!='-'&&s!=EOF&&!(isdigit(s)));
	if (s==EOF) exit(0);
	if (s=='-') base=-1,s=getchar();
	while (isdigit(s)) k=k*10+(s^'0'),s=getchar();
	return k*base;
}
inline void write(ll x)
{
	static char cnt,num[20];cnt=0;
	if (!x)
	{
		putchar('0');
		return;
	}
	for (;x;x/=10) num[++cnt]=x%10;
	for (;cnt;putchar(num[cnt--]+48));
}
double m,a,x,ans;
int n;
int main()
{
#ifdef ylx
	freopen("agc007c.in","r",stdin);
	freopen("agc007c.out","w",stdout);
#endif
	n=read(),a=read(),x=read();
	m=2*n;
	while (n--)
	{
		ans+=a+(m-1)*x/2.0;
		a=((m+2)*a+5*x)/m;
		x=(m+4)*x/m;
		m-=2;
	}
	printf("%.10lf",ans);
	return 0;
}
//2018年 12月 22日 星期六 15:54:00 CST


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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;



vector<int> data;
  int find_root(int a) { // 代表元を返す                                                
    return ((data[a] < 0) ? a : (data[a] = find_root(data[a])));
  }
  bool check(int a, int b) { // 同じ集合ならtrue                                        
    return (find_root(a) == find_root(b));
  }

  bool link(int a, int b) { // 新たな併合を行うとtrue                                   
    int ra = find_root(a);
    int rb = find_root(b);
    if (ra != rb) {
      if (data[rb] < data[ra])
        swap(ra, rb);
      data[ra] += data[rb];
      data[rb] = ra;
    }
    return (ra != rb);
  }

int solve() {
  int N, M; cin>>N>>M;
  vector<int> p(N);
  REP(i,N) {
    cin>>p[i];
    p[i]--;
  }
  data = vector<int> (N, -1);
  REP(i,M) {
    int x, y; cin>>x>>y;
    x--; y--;
    link(x, y);
  }
  int ans = 0;
  vector<vector<int > > cand(N);
  vector<set<int > > target(N);
  //  cout << "Go...." << endl;                                                         
  REP(i,N) {
    int pos = find_root(i);
    target[pos].insert(i);
    cand[pos].push_back(p[i]);
  }
  REP(i,N) {
    if(cand[i].empty()) continue;
    REP(j,cand[i].size()) {
      if(target[i].find(cand[i][j]) != target[i].end()) {
        ans++;
      }
    }
  }

  return ans;
}


int main() {
  int ans = solve();
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 15872
#include<iostream>
#include<algorithm>

using namespace std;

int main(){
	char cs[26] = {'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'};
	string str;
	int n;
	while(cin>>n){
		cin>>str;
		for(int i=0;i<str.length();i++)
			str[i]=cs[((str[i]-'A')+n)%26];
		cout<<str<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
n, k = map(int, input().split())
s = input()

start = [0]
end = []

if s[0] == "0":
    end.append(0)

for i, (c0, c1) in enumerate(zip(s, s[1:])):
    if c0 == "1" and c1 == "0":
        end.append(i + 1)
    elif c0 == "0" and c1 == "1":
        start.append(i + 1)

if s[-1] == "1":
    end.append(n)
if n > 1 and s[-1] == "0":
    end.append(n)
    start.append(n)

k = min(k, len(start) - 1)

print(max(en - st for st, en in zip(start, end[k:])))



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

const int max_n = static_cast<int>(1e6);
int dp[max_n],odp[max_n];
vector<int> odd,all;

int main() {

    for(int i=1; i*(i+1)*(i+2)/6<max_n; i++){
        if((i*(i+1)*(i+2)/6)%2 == 1){
            odd.push_back(i*(i+1)*(i+2)/6);
        }
        all.push_back(i*(i+1)*(i+2)/6);
    }

    memset(dp,1000000,sizeof(dp));
    memset(odp,1000000, sizeof(odp));
    dp[0] = 0;
    odp[0] = 0;

    for(int i=1; i<max_n; i++){
        for(int j=0; j<all.size(); j++){
            if(i-all[j] < 0) {
                break;
            }
            dp[i] = min(dp[i],dp[i-all[j]] + 1);
        }
    }

    for(int i=1; i<max_n; i++){
        for(int j=0; j<odd.size(); j++){
            if(i-odd[j] < 0) {
                break;
            }
            odp[i] = min(odp[i],odp[i-odd[j]] + 1);
        }
    }

    while(true){
        int n;
        cin >> n;
        if(n == 0){
            break;
        }
        cout << dp[n] << " " << odp[n] << endl;
    }

    return 0;
}


Measured memory_bytes: 10824
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <cstdint>
#include <cmath>
#include <algorithm>
#include <utility>
#include <numeric>
#include <functional>
#include <cassert>

using namespace std;
typedef int64_t ll;
typedef uint64_t ull;

constexpr ll INF = 1000000000;/* 1e+9a */

void solve(istream &cin) {
    ll N;
    if (!(cin >> N)) { return; }
    vector<int> cost(N, INF);
    deque<int> np;
    cost[1] = 1;
    np.push_back(1);
    while(!np.empty()){
        int c = np.front();
        np.pop_front();
        int nextc = c + 1;
        nextc %= N;

        if(cost[nextc] > cost[c] + 1){
            cost[nextc] = cost[c] + 1;
            np.push_back(nextc);
        }
        nextc = 10 * c;
        nextc %= N;
        if(cost[nextc] > cost[c]) {
            cost[nextc] = cost[c];
            np.push_front(nextc);
        }
    }
    cout << cost[0] << endl;
}

int main(int argc, char *argv[]) {
    string FileName("D"), Modifier("MEPH_");
    string ExecutionName = Modifier + FileName;
    string sub(argv[0]);
    // /home/USER/.../MEPH_X -> MEPH_X
    if (sub.size() > ExecutionName.size())
        sub = sub.substr(sub.size() - ExecutionName.size(), ExecutionName.size());

    cout << setprecision(16) << scientific;
    if (sub != ExecutionName) {
        cin.tie(0);
        ios::sync_with_stdio(false);
        while (cin) { solve(cin); }
    } else {
        cerr << sub << " test" << endl;
        string inFile = FileName + ".txt";
        auto fs = fstream(inFile, fstream::in);
        while (fs) { solve(fs); }
    }
}


Measured memory_bytes: 896
fn main() {
    let n: i32 = read_line_as_value();
    let s: String = read_line_as_value();
    let ans: String = s.chars().map(|c| {
        let mut next_n = (c as u8) + (n as u8);
        if next_n > 'Z' as u8 {
            next_n = next_n - 'Z' as u8 + 'A' as u8 - 1;
        }
        next_n
    }).map(|c| c as char).collect::<Vec<char>>().into_iter().collect();
    println!("{}", ans);
}

fn read_line_as_value<T: std::str::FromStr>() -> T {
    let mut input = String::new();
    let res = std::io::stdin().read_line(&mut input);
    if let Err(error) = res {
        panic!("io error at stdin.read_line: {}", error);
    };
    match input.trim().parse() {
        Ok(val) => val,
        _ => panic!("error while parsing input: {}", input)
    }
}

Measured memory_bytes: 2124
// clang-format off
#include <bits/stdc++.h>

#define mp make_pair
#define fst first
#define snd second
#define forn(i,n) for (int i = 0; i < int(n); i++)
#define forn1(i,n) for (int i = 1; i <= int(n); i++)
#define popcnt __builtin_popcount
#define ffs __builtin_ffs
#define ctz __builtin_ctz
#define clz __builtin_clz
#define all(a) (a).begin(), (a).end()
 
using namespace std;

using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
using pil = pair<int,ll>;
using pll = pair<ll,ll>;
template <typename T> using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T> using que = queue<T>;
template <typename T> using deq = deque<T>;

template <typename T> T id(T b) {return b;};
template <typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template <typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template <typename S, typename K> bool contains(S &s, K k) { return s.find(k) != s.end(); }
void fastio() { ios_base::sync_with_stdio(false); cin.tie(nullptr); }
constexpr ll TEN(int n) { if (n == 0) return 1LL; else return 10LL*TEN(n-1); }
// clang-format on

int main() {
    fastio();

    int n, r;
    cin >> n >> r;

    if (n >= 10) {
        cout << r << endl;
    } else {
        cout << r + 100 * (10 - n) << endl;
    }

    return 0;
}

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

using namespace std;

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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
const LL MOD = 1e9+7;
const int INF = (1e9);
const double EPS=1.0e-9;
const double PI=atan2(0,-1);


int main()
{
	string s;
	cin>>s;
	bool f1=0,f2=0;
	REP(i,s.size())
	{
		if(!f1)
		{
			if(s[i]=='C')
				f1=1;
		}
		else if(!f2)
		{
			if(s[i]=='F')
				f2=1;
		}
	}
	if(f2)
		cout<<"Yes"<<endl;
		else
		cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(mod_x) ((((long long)mod_x+modulo))%modulo)
#define Inf 100000000

int beki(int a,int b,int M = modulo){
	int x = 1;
	while(b!=0){
		if(b&1){
			x=((long long)x*a)%M;
		}
		a=((long long)a*a)%M;
		b>>=1;
	}
	return x;
}

pair<long long,long long> fix(long long A,long long B){
	if(A==0)return {0,1};
	if(B==0)return {1,0};
	
	long long g = gcd(abs(A),abs(B));
	A/=g;
	B/=g;
	if(B<0){
		A*=-1;
		B*=-1;
	}
	return {A,B};
}

int main(){
	
	long long N;
	cin>>N;
	
	vector<long long> A(N),B(N);
	for(int i=0;i<N;i++){
		cin>>A[i]>>B[i];
	}
	
	
	long long ans = 0;
	map<pair<long long,long long>,long long> mp;
	
	for(int i=0;i<N;i++){
		if(A[i]==0&&B[i]==0){
			ans++;
			continue;
		}
		mp[fix(A[i],B[i])]++;
	}
	long long t = 1;
	for(auto a:mp){
		auto X = a.first;
		auto Y = fix(-X.second,X.first);
		if(!mp.count(Y)){
			t = mod(t * beki(2,a.second));
		}
		else{
			if(X>Y)continue;
			t = mod(t * mod(beki(2,a.second) + beki(2,mp[Y])  - 1));
		}
	}
	
	ans = mod(ans + t);
	ans = mod(ans - 1);
	cout<<ans<<endl;
	
	return 0;
}



Measured memory_bytes: 18656
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF = 1LL << 40;
const ll MOD = 1e9 + 7;
#define FOR(i,k,n) for(int i=(k);i<(n);++i)

int main(){
    ll N, M;cin >> N >> M;
    if(abs(N-M)>=2){
        cout << 0 << endl;
        return 0;
    }
    ll fn=1LL,fm=1LL;
    FOR(i,1,N+1){
        fn *= (ll)i;
        fn %= MOD;
    }
    FOR(i,1,M+1){
        fm *= (ll)i;
        fm %= MOD;
    }
    if (abs(N-M)==0LL)cout << fn * fm % MOD * 2 % MOD << endl;
    else cout << fn * fm % MOD<< endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);
#define ll long long int
#define ull unsigned long long int
#define ld long double
#define mode 1000000007
#define inf 1000000000000000007
#define eps 0.00000001
#define pi 3.141592653589793
#define pii pair<int,int>
#define pdd pair<ld,ld>
#define pll pair<ll,ll>
#define ff first
#define ss second
#define vii vector<int>
#define vpl vector<pll>
#define vll vector<ll>
#define sti stack <int>
#define stll stack <ll>
#define mseti multiset <ll>
#define msetd multiset <ll, greater <ll> >
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound 
#define stp setprecision(20)//use fixed before stp
#define endl '\n'
int main()
{  
    FAST
    ll r,d,x;
    cin>>r>>d>>x;
    for(ll i=1;i<=10;i++)
    {
        x=(r*x)-d;
        cout<<x<<endl;
    }
}

Measured memory_bytes: 256
N, M = map(int, input().split())
scores = [[] for _ in range(8)]

for i in range(N):
  x, y, z = map(int, input().split())
  scores[0].append(x+y+z)
  scores[1].append(x+y-z)
  scores[2].append(x-y+z)
  scores[3].append(-x+y+z)
  scores[4].append(x-y-z)
  scores[5].append(-x+y-z)
  scores[6].append(-x-y+z)
  scores[7].append(-x-y-z)

max_num = -1
for i in range(8):
  tmp = scores[i]
  tmp.sort(reverse=True)
  sum_num = sum(tmp[:M])
  if max_num < sum_num:
    max_num = sum_num

print(max_num)

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

using ll = long long;
using ld = long double;
using vi = vector<int>;
using vll = vector<ll>;
using P = pair<int, int>;

const int INF = 1e9;
const ll INFLL = 1e18;
const int MOD = 1e9 + 7;
const int NIL = -1;
const ld PI = acos(-1);

#define rep(i,n) for(int i=0; i<(n); ++i)
#define all(n) n.begin(),n.end()

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

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	//cout << fixed << setprecision(6);
	const int a[] = {1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
	int k; cin >> k;
	cout << a[k-1] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include<algorithm>
#include <iomanip>
#include <math.h>

using namespace std;
typedef long long ll;
///定義場所///
ll i, j, k, l, m, n;
ll N, M, K, H, W, T, P;
ll MOD = 1000000007;
ll ans = 0;
//関数リスト//
int ctoi(char c) {
	switch (c) {
	case '0': return 0;
	case '1': return 1;
	case '2': return 2;
	case '3': return 3;
	case '4': return 4;
	case '5': return 5;
	case '6': return 6;
	case '7': return 7;
	case '8': return 8;
	case '9': return 9;
	default: return 0;
	}
}
//(注)pairの型・比較する場所(first/second)は毎回変えて使用する
bool pairCompare(const pair<int ,int> firstElof, pair<int,int> secondElof)
{
	return firstElof.second < secondElof.second;
}
int Keta(ll F) {
	int keta = 1;
	while (F/10 > 0) {
		keta++;
		F /= 10;
	}
	return keta;
}
//////////////

int main() {
	cin >> N;
	vector<int>P(N);
	for (i = 0; i < N; i++) {
		cin >> P[i];
	}
	for (i = 1; i < N - 1; i++) {
		if (P[i] > P[i - 1] && P[i] < P[i + 1]) {
			ans++;
		}
		else if (P[i] < P[i - 1] && P[i] > P[i + 1]) {
			ans++;
		}
	}
	cout << ans;
}

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

int main(){
    string str;
    cin >> str;
    int w;
    cin >> w;
    for(int i=0; i<str.length(); i+=w) cout << str[i];
    cout << endl;
    return 0;
}

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

#define all(x) x.begin(),x.end()
#define sc(x) scanf("%d",&x)
#define scl(x) scanf("%lld",&x)
#define pr(x) printf("%d",x)
#define prl(x) printf("%lld",x)
#define LL long long
#define pb push_back
#define PB pop_back
#define PF pop_front
#define F first
#define S second
#define inrow(vec)    for(int i=0;i<vec.size();i++)cout<<vec[i]<<" ";
#define incoloum(vec) for(int i=0;i<vec.size();i++)cout<<vec[i]<<endl;

const double PI=3.1415926;
const int KL=1e6;

using namespace std;

int n,a[KL],b[KL],h;
int dp[1010][10010];

int solve(int pos,int sum)
{
    if(sum<=0)return 0;
    if(pos==n)return 1e9;
    if(dp[pos][sum]!=-1)return dp[pos][sum];
    return dp[pos][sum]=min(solve(pos+1,sum),b[pos]+solve(pos,sum-a[pos]));
}


int main()
{
    memset(dp,-1,sizeof dp);
    sc(h);sc(n);
    for(int i=0;i<n;i++){sc(a[i]);sc(b[i]);}
    cout<<solve(0,h)<<endl;
    return 0;
}


Measured memory_bytes: 43776
#define __USE_MINGW_ANSI_STDIO 0
#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <set>
#include <numeric>
#include <bitset>
#include <map>
#include <limits.h>
using namespace std;
typedef unsigned long ul;
typedef pair<ul, ul> P;
const int INF = 1e9;
 
long long gcd(long long x, long long y){
			if(x<y){
				long long temp = x;
			x = y;
				y = temp;
			}
			long long r = x % y;
				while(r!=0){
					x = y;
					y = r;
				r = x % y;
	    		}
			return y;
	    }

   
int main(){
int N;
cin >> N;
vector<int> x(N);
vector<int> y(N);
for(int i = 0; i<N;i++){
  cin >> x[i];
}
for(int i = 0; i<N;i++){
  cin >> y[i];
}
int ans  = 0;
for(int i= 0; i< N; i++){
if((x[i]-y[i])<0)continue;
ans+=x[i]-y[i];
}
cout << ans << endl;
}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    string A, B, C;
    cin >> A >> B >> C;
    if(A[A.size() - 1] == B[0] && B[B.size() - 1] == C[0]) {
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF (1LL << 60)
typedef long long LL;
using namespace std;

void chmax(string& a, string b) {
	if (a.length() < b.length()) {
		a = b;
	}
	else if (a.length() == b.length()) {
		if (b > a) {
			a = b;
		}
	}
}

int main() {
	int num[10] = {10, 2, 5, 5, 4, 5, 6, 3, 7, 6 };
	int n, m;	cin >> n >> m;
	vector<int> a(m);
	for (auto &x : a) {
		cin >> x;
	}

	vector<string> dp(n + 1, "x");
	dp[0] = "";
	for (int i = 1; i <= n; i++) {
		for (auto x : a) {
			if (num[x] > i || dp[i - num[x]] == "x") continue;
			if (dp[i] == "x") {
				dp[i] = to_string(x) + dp[i - num[x]];
			}
			else {
				chmax(dp[i], to_string(x) + dp[i - num[x]]);
			}
		}
	}

	cout << dp[n];
}


Measured memory_bytes: 32384
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const ll M = 1e9 + 7;
int si[8] = {-1,0,1,-1,1,-1,0,1};
int sj[8] = {-1,-1,-1,0,0,1,1,1};

int main() {
  int d, t, s;
  cin >> d >> t >> s;
  if (t*s >= d) cout << "Yes" << endl;
  else cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 3592
s = gets.chomp.split("")
su = s.uniq
alla =["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"]
ans = Array.new(26,0)
su.length.times do |i|
        26.times do |k|
                if  su[i] == alla[k]
                        ans[k] = ans[k] + 1
                end
        end
end

26.times do |m|
	if ans[m] == 0
		puts alla[m]
	       exit
end
end
puts "None"

Measured memory_bytes: 6908
#include<bits/stdc++.h>
using namespace std;
#define ll long long
inline ll read() {
    char ch = getchar(); ll x = 0, f = 1;
    while(ch < '0' || ch > '9') {
        if(ch == '-') f = -1;
        ch = getchar();
    } while('0' <= ch && ch <= '9') {
        x = x * 10 + ch - '0';
        ch = getchar();
    } return x * f;
}
int weiyi;
int a[100050];
int main(){
	int n=read(),L=read(),T=read();
	for (int i=1;i<=n;i++)
	{
		int x=read(),w=read();
		w=3-w*2;
		x+=w*T;
		if (x>=L)	weiyi+=(x/L);
		if (x<0)	weiyi-=((-x)+(L-1))/L;
		a[i]=(x%L+L)%L;
	}
	sort(a+1,a+1+n);
	weiyi=(weiyi%n+n)%n;
	for (int i=1;i<=n;i++)
	 printf("%d\n",a[(i+weiyi-1)%n+1]);
}

Measured memory_bytes: 1536
def main():
    t = int(input())
    count = 0
    for i in range(1, t + 1):
        if i % 15 == 0:
            pass
        elif i % 5 == 0:
            pass
        elif i % 3 == 0:
            pass
        else:
            count += i
    print(count)


if __name__ == '__main__':
    main()

Measured memory_bytes: 9172
package main

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

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

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

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

// min, max, asub, absなど基本関数
func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

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

func asub(a, b int) int {
	if a > b {
		return a - b
	}
	return b - a
}

func abs(a int) int {
	if a >= 0 {
		return a
	}
	return -a
}

// テキスト "#"が壁のやつを幅優先探索(0,0)の距離
type queue struct {
	x, y int
}

const inf = 10000

func bfs(H, W int, s []string) [][]int {
	dist := make([][]int, H)
	// 初期化
	for i := 0; i < H; i++ {
		dist[i] = make([]int, W)
		for j := 0; j < W; j++ {
			dist[i][j] = -1
		}
	}

	if s[0][0] == '#' {
		dist[0][0] = 1
	} else {
		dist[0][0] = 0
	}

	for y := 0; y < H; y++ {
		for x := 0; x < W; x++ {
			if y == 0 && x == 0 {
				continue
			} else if y == 0 {
				dist[y][x] = dist[y][x-1]
				if s[y][x-1] == '.' && s[y][x] == '#' {
					dist[y][x]++
				}
			} else if x == 0 {
				dist[y][x] = dist[y-1][x]
				if s[y-1][x] == '.' && s[y][x] == '#' {
					dist[y][x]++
				}
			} else {
				a0 := dist[y][x-1]
				if s[y][x-1] == '.' && s[y][x] == '#' {
					a0++
				}

				a1 := dist[y-1][x]
				if s[y-1][x] == '.' && s[y][x] == '#' {
					a1++
				}
				dist[y][x] = min(a0, a1)
			}
		}
	}

	return dist
}

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

	H, W := getInt(), getInt()
	s := make([]string, H)
	for i := 0; i < H; i++ {
		s[i] = getString()
	}
	ret := bfs(H, W, s)

	out(ret[H-1][W-1])
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
#define fore(i,a,b) for(ll i=(ll)(a);i<=(ll)(b);++i)
#define rep(i,n) fore(i,0,(n)-1)
#define rfore(i,a,b) for(ll i=(ll)(b);i>=(ll)(a);--i)
#define rrep(i,n) rfore(i,0,(n)-1)
#define all(x) (x).begin(),(x).end()
const ll INF=1001001001;
const ll LINF=1001001001001001001;
const ll D4[]={0,1,0,-1,0};
const ll D8[]={0,1,1,0,-1,-1,1,-1,0};
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 N;
vector<string> ans;
void dfs(string s,char c){
    vl idx;
    rep(i,N){
        if(s[i]=='0')idx.push_back(i);
    }
    ll M=idx.size();
    if(M==0){
        ans.push_back(s);
        return;
    }
    s[idx[0]]=c;
    rep(i,1<<(M-1)){
        string t=s;
        rep(j,M-1){
            if(i>>j&1){
                t[idx[j+1]]=c;
            }
        }
        dfs(t,c+1);
    }
}
void solve(){
    string s;
    rep(i,N)s+='0';
    dfs(s,'a');

    sort(all(ans));
    for(string s:ans){
        cout<<s<<endl;
    }
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cin>>N;
    solve();
}


Measured memory_bytes: 7796
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
const int mod = (int)1e9 + 7;
int sum(int a, int b) {
    int s = a + b;
    if (s >= mod) s -= mod;
    return s;
}
int mult(int a, int b) {
    return (1LL * a * b) % mod;
}
int sub(int a, int b) {
    int s = a - b;
    if (s < 0) s += mod;
    return s;
}
const int maxN = 1e6 + 10;
int n;
int dp[maxN];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    cin >> n;
    dp[0] = 1;
    int sm = 1;
    for (int i = 1; i <= n; i++) {
        if (i >= 2) {
            dp[i] = sub(sm, dp[i - 2]);
        }
        else {
            dp[i] = sm;
        }
        sm = sum(sm, dp[i]);
    }
    int ans = dp[n];
    for (int sz = 0; sz <= (n - 1); sz++) {
        if (sz != n - 1) {
            ans = sum(ans, mult(dp[sz], sz + 1));
        }
        else {
            ans = sum(ans, mult(dp[sz], n - 1));
        }
    }
    for (int sz = 0; sz + 2 <= n; sz++) {
        ans = sum(ans, mult(dp[sz], mult(n - 1, n - 1)));
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 4224
n = gets.chomp.to_i
ans = 0
input = []
for i in 0..n-1
  input[i] = gets.chomp
end

nums = input.group_by(&:itself).to_a

for i in 0..nums.length-1
  if(nums[i][1].length%2==1)
    ans += 1
  end
end

puts ans


Measured memory_bytes: 27132
s = input()
#print(s)
m1 = False
m2 = False
 
s1 = int(s[0:2])
s2 = int(s[2:])
#print(s1, s2)
 
if 0 < s1 < 13:
  m1 = True
 
if 0 < s2 < 13:
  m2 = True
 
if m1 == True and m2 == True:
  print('AMBIGUOUS')
elif m1 == True and m2 == False:
  print('MMYY')
elif m1 == False and m2 == True:
  print('YYMM')
elif m1 == False and m2 == False:
  print('NA')

Measured memory_bytes: 3064
import java.util.*;

public class Main {

    public static void main(String[] args) {
        // write your code here
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int x = scanner.nextInt();
        int t = scanner.nextInt();

        int need = n / x;
        if (n % x != 0) {
            need++;
        }

        System.out.println(need * t);
    }
}

Measured memory_bytes: 35708
#include <stdio.h>
#include <string.h>

int main(){
 	
	char strA[100], strB[100], strC[100];
 	scanf("%s %s %s",&strA, &strB, &strC);
 	
	int lenA=strlen(strA);
 	int lenB=strlen(strB);
 	
 	if (strA[lenA-1] == strB[0] && strB[lenB-1] == strC[0]){
 		printf("YES");
	 }
	 
	 else{
	 	printf("NO");
	 }
 	
	return 0;	
	
	}

Measured memory_bytes: 1728
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const long long INF = 1e18;
# define len(x) ((int)(x).size())
# define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
# define reps(i, n) for(int i=1, i##_len=(n); i<=i##_len; ++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 foreps(i, m, n) for(int i = m;i < n;i++)
# define ALL(x) (x).begin(), (x).end()
# define rall(x) (x).rbegin(), (x).rend()
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; }

int main() {
    ll X, A, B; cin >> X >> A >> B;
    if (B <= A) cout << "delicious" << endl;
    else if (B - A <= X) cout << "safe" << endl;
    else cout << "dangerous" << endl;
}

Measured memory_bytes: 3572
(l,r,d) = map(int,input().split())


if l%d!=0:
	l = l + (d-l%d)
if r-l == 0:
	if (l%d==0):
		print(1)
	else:
		print(0)
elif l < r:
	print(r//d-l//d+1)
else:
	print(0)

Measured memory_bytes: 9020
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(int i=0;i<n;++i)
#define REPR(i,n) for(int i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(int i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define INF 999999999
#define SUR 1000000007
#define pb(a) push_back(a)
#define pf(a) push_front(a)
#define MP make_pair

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

using namespace std;

typedef pair<int,int> pii;

int main(){

  string s;
  cin >> s;

  map<char, int> mp;
  REP(i,s.length()){
    mp[s[i]]++;
  }

  REPI(itr,mp){
    if(itr->second % 2 != 0){
        cout << "No\n";
        return 0;
    }
  }

  cout << "Yes\n";
  return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main (){
    char W[11],T[1001];
    int count = 0,i;
    scanf("%s",W);
    while(scanf("%s",T)&& strcmp (T,"END_OF_TEXT") != 0){
        for(i = 0;i < strlen(T);i++){
            if(T[i] >='A' && T[i] <= 'Z'){
                T[i] += 32;
            }
        }
        if(strcmp(W,T) == 0)count++;
    }
    printf("%d\n",count);
    return 0;
}




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

int main(){
	int n;
	int cnt=0;
	cin>>n;
	map<string,int>mp;
	rep(i,n){
		string tstr;
		cin>>tstr;
		mp[tstr]++;
	}
	for(auto p:mp){
		cnt++;
	}
	cout<<cnt<<endl;

	return 0;
}

Measured memory_bytes: 19128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long N, a1, a2, a3, a4;
  cin >> N;
  string S[N];
  
  a1 = 0;
  a2 = 0;
  a3 = 0;
  a4 = 0;
  for ( int i = 0; i < N; i++ ) {
    cin >> S[i];
    if ( S[i] == "AC" ) {
      a1++;
    } else if ( S[i] == "WA" ) {
      a2++;
    } else if ( S[i] == "TLE" ) {
      a3++;
    } else if ( S[i] == "RE" ) {
      a4++;
    }
  }
  
  cout << "AC" << " x " << a1 << endl;
  cout << "WA" << " x " << a2 << endl;
  cout << "TLE" << " x " << a3 << endl;
  cout << "RE" << " x " << a4 << endl;
  
  return 0;
}

Measured memory_bytes: 6748
#include<cstdio>
#include<cstring>
#define RI register int
#define CI const int&
using namespace std;
const int N=45;
int n; char g[N][N]; long long f[N][N][N],ans;
inline long long DP(CI l,CI r,CI m)
{
	if (~f[l][r][m]) return f[l][r][m]; long long ret=0;
	if (l==r) return 1; if (l==m||r==m) return 0;
	for (RI j=l,k,p,q;j<m;++j) for (k=m+1;k<=r;++k)
	if (g[j][k]=='1') for (p=j;p<m;++p) for (q=m+1;q<=k;++q)
	ret+=DP(l,p,j)*DP(p+1,q-1,m)*DP(q,r,k); return f[l][r][m]=ret;
}
int main()
{
	RI i; for (scanf("%d",&n),n<<=1,i=1;i<=n;++i) scanf("%s",g[i]+1);
	for (memset(f,-1,sizeof(f)),i=2;i<=n;++i)
	if (g[1][i]=='1') ans+=DP(2,n,i); return printf("%lld",ans),0;
}

Measured memory_bytes: 1024
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if(s.size() < 3){
		cout << 0 << endl;
		return 0;
	}
	ll ans = 0, cnt = 0;
	for(int i = s.size()-1; i >= 0; i--){
		if(i > 0 && s[i] == 'C' && s[i-1] == 'B'){
			cnt++;
			i--;
		}
		else if(s[i] == 'A'){
			ans += cnt;
		}
		else{
			cnt = 0;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 720
//abc135_e.cpp
//Sat Oct 26 18:46:44 2019

#include <iostream>
#include <string>
#include <queue>
#include <map>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#include <set>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<ll,ll> P;

vector<P> ans;

ll curx=0;
ll cury=0;

void move(ll x,ll y){
	curx+=x;
	cury+=y;
	ans.push_back(P(curx,cury));
}

int main(){
	ll k,x,y;
	cin >> k >> x >> y;

	ll X = abs(x);
	ll Y = abs(y);

	if (k%2==0 && (X+Y)%2==1){
		cout << -1 << endl;
		return 0;
	}

	if (X+Y==k){
		cout << 1 << endl;
		cout << x << " " << y << endl;
		return 0;
	}

	int amari = -1;
	for (ll j=k*2;amari<0;j+=k){
		if ((j-(X+Y))%2==0){
			amari=(j-(X+Y))/2;
		}
	}

	if (amari){
		ll a=amari/k;
		while(a){
			move(-k,0);
			a--;
		}
		amari = amari%k;
		if (curx<0){
			move(k-amari,-amari);
		}else{
			if (X>Y){
				move(k-amari,-amari);
			}else{
				move(-amari,k-amari);
			}

		}

	}

	while(curx+k<=X){
		move(k,0);
	}
	while(cury+k<=Y){
		move(0,k);
	}

	if (curx!=X || cury!=Y){
		ans.push_back(P(X,Y));
	}

	cout << ans.size() << endl;
	for (int i=0;i<ans.size();i++){
		if (x<0){
			ans[i].first = ans[i].first*(-1);
		}
		if (y<0){
			ans[i].second = ans[i].second*(-1);
		}
		cout << ans[i].first << " " << ans[i].second << endl;
	}
}

Measured memory_bytes: 5484
#include <iostream>
    using namespace std;
     
    int main() {
        //Recieve the inputs
        int D, T, S;
        cin >> D >> T >> S;
     
        //Calculate the possible distance of Takahashi's travel
        int dist = S * T;
     
        //Output depending on the inequality between D and dist
        if (dist >= D) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }

Measured memory_bytes: 3588
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto N = readln.chomp.to!int;
    int[] XS, YS;
    foreach (x; readln.split.to!(int[])) {
        XS ~= x;
        YS ~= x;
    }
    sort(YS);
    auto a = YS[N/2-1], b = YS[N/2];
    foreach (x; XS) {
        if (x <= a) {
            writeln(b);
        } else {
            writeln(a);
        }
    }
}

Measured memory_bytes: 13324