akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<string>
#include<cmath>
#include<math.h>
#include<array>
#include<algorithm>
#include<queue>
//#include<deque>
#include<vector>
//#include<utility>
//#include<set>
#include<map>
//#include<list>
#include<bitset>
#include<iomanip>

using namespace std;
using LLI = long long int;
LLI N;

//array<int, 8>dir_x = { 0,0,1,1,1,-1,-1,-1 };
//array<int, 8>dir_y = { 1,-1,1,0,-1,1,0,-1 };
//array<int, 4>dir_x2 = { 0,0,1,-1 };
//array<int, 4>dir_y2 = { 1,-1,0,0 };
//char alp[] = { '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' };

//class UnionFind {
//public:
//	vector<int>data;
//	UnionFind(int size) :data(size, -1) {};
//	bool unionset(int x, int y) {
//		x = root(x), y = root(y);
//		if (x != y) {
//			if (data[y] < data[x]) {
//				swap(x, y);
//			}
//			data[x] += data[y];
//			data[y] = x;
//		}
//		return x != y;
//	}
//	bool findset(int x, int y) {
//		return root(x) == root(y);
//	}
//	int root(int x) {
//		return data[x] < 0 ? x : data[x] = root(data[x]);
//	}
//	int size(int x) {
//		return -data[root(x)];
//	}
//};

//LLI gcd(LLI x, LLI y) {
//	LLI  r;
//	if (x < y) {
//		swap(x, y);
//	}
//	r = x % y;
//	while (r != 0) {
//		x = y;
//		y = r;
//		r = x % y;
//	}
//	return y;
//}
//LLI lcm(LLI x, LLI y) {
//	return x / gcd(x, y) * y;
//}

//long nCr(int n, int r) {
//	long ans = 1;
//	for (int i = n; i > n - r; i--) {
//		ans = ans * i;
//	}
//	for (int i = 1; i < r + 1; i++) {
//		ans = ans / i;
//	}
//	return ans;
//}
//long nHr(int n, int r) {
//	n = n + r - 1;
//	return nCr(n, r);
//}

//const int n_max = 8;
//array<array<bool, n_max>, n_max>graph;
//int dfs(int v,int N,array<bool,n_max>visited) {
//	int ret = 0;
//	bool all_visited = true;
//	for (int i = 0; i < N;i++) {
//		if (visited[i] == false) {
//			all_visited = false;
//		}
//	}	
//	if (all_visited) {
//		return 1;
//	}
//	for (int i = 0; i < N;i++) {
//		if (graph[v][i] == false) {
//			continue;
//		}
//		if (visited[i] == true) {
//			continue;
//		}
//		visited[i] = true;
//		ret += dfs(i,N,visited);
//		visited[i] = false;
//	}
//	return ret;
//}

//vector<vector<int>>sub;
//int dfs(int id) {
//	if (sub[id].size() == 0) {
//		return 1;
//	}
//	int minP = (int)1e9;
//	int maxP = 0;
//	for (int i : sub[id]) {
//		int P = dfs(i);
//		minP = min(minP, P);
//		maxP = max(maxP, P);
//	}
//	return minP + maxP + 1;
//}

//#define debug(x) cerr << #x << " : " << x << endl
//#define debugv(x) cerr << #x << " : "; for(auto i:x) cerr << i << ", "; cerr<<endl

int main(void) {
	LLI N;
	bool res = true;
	cin >> N;
	vector<LLI>vec(N);
	for (int i = 0; i < N; i++) {
		cin >> vec[i];
	}
	for (int i = N - 1; i >= 1;i--) {
		if (vec[i] < vec[i - 1]) {
			vec[i - 1]--;
		}
	}
	for (int i = 0; i < N - 1; i++) {
		if (vec[i] > vec[i + 1]) {
			res = false;
		}
	}
	if (res) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    string s;
    cin>>s;
    if(s[2]==s[3] && s[4]==s[5]){
        cout<<"Yes"<<'\n';
    }
    else{
        cout<<"No"<<'\n';
    }
    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

static const ll INF = (ll)1e15;

int main(void)
{
	ll n, m;
	cin >> n >> m;
	vector<ll> as(m);
	rep(i, m) cin >> as[i];
	ll sum = 0;
	rep(i, m) sum += as[i];
	if (n < sum) {
		cout << -1 << endl;
	}
	else {
		cout << n - sum << endl;
	}
	return 0;
}


Measured memory_bytes: 3708
from collections import deque

H, W = list(map(int,input().split()))
s = []
for i in range(H):  s.append(input())

dx = [0, 1, -1, 0]
dy = [1, 0, 0, -1]
           
def bfs(sx, sy):
    q = deque([])
    d = [[-1 for _ in range(W)] for _ in range(H)]
    q.append([sx, sy])
    d[sx][sy] = 0
    
    while(q):
        pop = q.popleft()
        x, y = pop[0], pop[1]
        for i in range(4):
            nx = x + dx[i]
            ny = y + dy[i]
            if 0 <= nx and nx < H and ny >= 0 and ny < W:
                if s[nx][ny] != "#" and d[nx][ny] == -1:
                    q.append([nx, ny])
                    d[nx][ny] = d[x][y] + 1
    return d

def max_dim2(d):
    ret = 0
    for i in range(len(d)):
        for j in d[i]:
            ret = max(ret, j)
    return ret

ans = 0
for i in range(H):
    for j in range(W):
        if s[i][j] == ".":
            ret = bfs(i, j)
            temp = max_dim2(ret)
            ans = max(ans, temp)
print(ans)    

Measured memory_bytes: 69012
n, w = map(int, input().split())
ws, vs = [], []
for i in range(n):
  wi, vi = map(int, input().split())
  ws.append(wi)
  vs.append(vi)
dp = [[[0] * (3 * i + 1) for i in range(n + 1)] for j in range(n + 1)]
for i in range(n):
  for j in range(n + 1):
    for k in range(3 * j + 1):
      dp[i + 1][j][k] = max(dp[i + 1][j][k], dp[i][j][k])
      if j < n:
        dp[i + 1][j + 1][k + ws[i] - ws[0]] = max(dp[i + 1][j + 1][k + ws[i] - ws[0]],
                                                  dp[i][j][k] + vs[i])
ans = 0
for i in range(n + 1):
  for j in range(3 * i + 1):
    if ws[0] * i + j <= w:
      ans = max(ans, dp[n][i][j])
print(ans)


Measured memory_bytes: 55644
import itertools

d = int(input())
c = list(map(int, input().split()))
s_di = [list(map(int, input().split())) for i in range(d)]
last = [0 for i in range(26)]

# donyoku
total_manzoku = 0
day = 0
chain = 3
# for i in range(1,d+1):
while day < d:
    tmp_max = -10 ** 10
    if day + chain > d:
        chain = d - day
    for i in itertools.product(range(26), repeat=chain):
        tmp_day = day
        tmp = 0
        tmp_last = last.copy()
        for j in i:
            tmp_day += 1
            fuman = sum([(tmp_day - tmp_last[k]) * c[k] for k in range(26)])
            tmp += -fuman + (tmp_day - tmp_last[j]) * c[j] + s_di[tmp_day - 1][j]
            tmp_last[j]=tmp_day
        if tmp > tmp_max:
            tmp_max = tmp
            tmp_choice = i
    total_manzoku += max(tmp_max, 0)
    for i in range(chain):
        print(tmp_choice[i] + 1)
        last[tmp_choice[i]] = day + i + 1
    day += chain

#print(total_manzoku)


Measured memory_bytes: 71280
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fLL;
const double EPS = 1e-8;
const int MOD = 1000000007;
// const int MOD = 998244353;
const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1};
const int dy8[] = {1, 1, 0, -1, -1, -1, 0, 1}, dx8[] = {0, -1, -1, -1, 0, 1, 1, 1};
template <typename T, typename U> inline bool chmax(T &a, U b) { return a < b ? (a = b, true) : false; }
template <typename T, typename U> inline bool chmin(T &a, U b) { return a > b ? (a = b, true) : false; }
struct IOSetup {
  IOSetup() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);
  }
} iosetup;

int main() {
  int n; string s; cin >> n >> s;
  vector<int> r(n + 1, 0), g(n + 1, 0), b(n + 1, 0);
  REP(i, n) {
    r[i + 1] = r[i] + (s[i] == 'R');
    g[i + 1] = g[i] + (s[i] == 'G');
    b[i + 1] = b[i] + (s[i] == 'B');
  }
  ll ans = 0;
  REP(i, n) FOR(j, i + 1, n) {
    if (s[i] == 'R') {
      if (s[j] == 'G') {
        ans += b[n] - b[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'B';
      } else if (s[j] == 'B') {
        ans += g[n] - g[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'G';
      }
    } else if (s[i] == 'G') {
      if (s[j] == 'R') {
        ans += b[n] - b[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'B';
      } else if (s[j] == 'B') {
        ans += r[n] - r[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'R';
      }
    } else if (s[i] == 'B') {
      if (s[j] == 'G') {
        ans += r[n] - r[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'R';
      } else if (s[j] == 'R') {
        ans += g[n] - g[j + 1];
        ans -= j + j - i < n && s[j + j - i] == 'G';
      }
    }
  }
  cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 3700
// C++ program to demonstrate default behaviour of 
// sort() in STL. 
#include <bits/stdc++.h> 
using namespace std;

/*
long long int lcm(long long int a,long long int b){
	
	
     a = (a/(__gcd(a, b))) * (b/(__gcd(a, b))) * (__gcd(a, b));
    
    return a;
	
}
*/
  
int main() 
{ 

   int n,k,w;
   int s = 0;
   
   cin >> n >> w;
   
   for(int i = 0;i < n;i++){
   	  cin >> k;
   	  
   	  if(k >= w) s++;
   	  
   	  
   	  
   }
   cout << s;
    return 0; 
}


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

template <class T> using V = vector<T>;
template <class S, class T> using P = pair<S, T>;
template <class... T> using TP = tuple<T...>;

using ll = long long;
using db = double;
using ldb = long db;
using str = string;
using vll = V<ll>;
using vvll = V<V<ll>>;
using pll = P<ll,ll>;
using tpll = TP<ll,ll,ll>;
using vpll =V<pll>;
using vst = V<str>;
using vch = V<char>;

#define FOR(i,a,b) for(ll i=(a);i<(ll)(b);i++)
#define rFOR(i,a,b) for(ll i=(b);i>(ll)(a);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(ll)(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) __lcm(a,b)
#define co(a) cout<<a<<endl
#define ci(a) cin>>a
#define pb(a) push_back(a)
#define pob pop_back()
#define mp make_pair
#define mt make_tuple
#define pbmp(a,b) push_back(mp(a,b))
#define subs(a,b) substr(a,b)
#define cfs(a) cout<<fixed<<setprecision(a)
#define INF 1e16
#define mod 1e9+7
//vvll v(n,vll(m)) n行m列
//A.erase(A.begin()+i) 配列Aのi番目を消せる
//std::binary_search(v.bgn,v.en,a);
//abs(a,b)   pow(a,n)  to_string  stoll
//auto Iter=lower_bound(v.bgn,v.en,a);
//lower//upper  co(*Iter)co(Iter-v.bgn);

const int MAX = 510000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void Comuse() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
#define comuse Comuse()
ll combi(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  ll n;
  cin>>n;
  vll v(n),A(n),B(n);
  FOR(i,0,n){
    cin>>v[i];
    A[i]=i+1;
    B[i]=i+1;
  }
  REV(B);
  ll count1=0,count2=0;
  FOR(i,0,n){
    if(v[i]==A[i]){
      count1++;
    }
    if(v[i]==B[i]){
      count2++;
    }
  }
  if(count1>n-3){
    co("YES");
  }
  else{
    co("NO");
  }
}


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

int main(){
    int a;
    cin>>a;
    vector<int> vec(4);
    vec.at(3)=a%10;
    vec.at(2)=(a%100)/10;
    vec.at(1)=(a%1000)/100;
    vec.at(0)=a/1000;
    vector<string> out(7);
    out.at(0)=to_string(vec.at(0));
    for(int tmp=0; tmp<(1<<(3)); tmp++){
        bitset<3> b(tmp);
        int ans=vec.at(0);
        for(int i=0; i<3; i++){
            if(b.test(i)){
                ans+=vec.at(i+1);
                out.at(2*i+1)="+";
                out.at(2*i+2)=to_string(vec.at(i+1));
                }
            else{
                ans-=vec.at(i+1);
                out.at(2*i+1)="-";
                out.at(2*i+2)=to_string(vec.at(i+1));
                }
        }
        if(ans==7){
            for(int i=0;i<7;i++){
                cout<<out.at(i);
            }
            break;
        }
    }
    cout<<"=7"<<endl;
}


Measured memory_bytes: 256
def solve(times)
  ok, ng = [0] * 3, [0] * 3
  times.each do |t|
    a, b = t.split
    h = a.split(':')[0].to_i
    m = (b.to_i - a.split(':')[1].to_i + 60) % 60
    if 11 <= h && h <= 14
      m > 8 ? ng[0] += 1 : ok[0] += 1
    elsif 18 <= h && h <= 20
      m > 8 ? ng[1] += 1 : ok[1] += 1
    elsif 0 <= h && h < 2 || 21 <= h && h <= 23
      m > 8 ? ng[2] += 1 : ok[2] += 1
    end
  end
  [ok, ng]
end

while n = gets.to_i
  break if n == 0
  ok, ng = solve(n.times.map{ gets.chomp })
  dish = ['lunch ', 'dinner ', 'midnight ']
  3.times do |i|
    puts dish[i] + ((t = ok[i] + ng[i]) == 0 ? 'no guest' : (ok[i] * 100 / t).to_s)
  end
end

Measured memory_bytes: 8624
/*
 * 競技プログラミング用テンプレート
 * by yuma140902
 * 2020/04/18
 * ver 0.3.0
 */
#include <bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef tuple<int, int> ii;
typedef tuple<int, int, int> iii;
const int INF = 900000;
const ll INFL = 9000000;

#define vi vector<int>
#define vii vector<vector<int> >
#define vi_def(n) vector<int>((n))
#define vii_def(n,m) vector<vector<int> >((n), vector<int>((m)))
#define vi_def_dflt(n, def) vector<int>((n), (def))
#define vii_def_dflt(n, m, def) vector<vector<int> >((n), vector<int>((m), (def)))

#define rep(i, n) for(int i=0; i < (n); ++i)
#define per(i, n) for(int i=(n)-1; i >= 0; --i)
#define range(i, begin, end) for(int i=(begin); i < (end); ++i)

#define ALL(vec) vec.begin(), vec.end()

#define DBG_FLAG
#ifdef DBG_FLAG
#define pdbg(msg) cout << (msg)
#define dbg if(true)
#else
#define pdbg(msg) ;
#define dbg if(false)
#endif

int A, B;
int main(){
  cin >> A >> B;

  int numPlug = 1;
  int numTap = 0;
  while(numPlug < B){
    --numPlug;
    numPlug += A;
    ++numTap;
  }

  printf("%d\n", numTap);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=(a); i<(b); i++)
#define ALL(v) v.begin(), v.end()
#define RALL(v) v.rbegin(), v.rend()
typedef long long ll;
int main(){
    string s; cin >> s;
    int n = s.size();
    int ans = n;
    rep(i,n-1){
        if(s[i] != s[i+1]){
            int tmp = max(i+1, n-i-1);
            ans = min(ans, tmp);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 512
#include <cstdio>
#include <cstdlib>

using namespace std;

int main(){
	int N,M;
	scanf("%d %d",&N,&M);

	int n[50];
	for(int i=0;i<N;i++){
		n[i] = 0;
	}

	for(int i=0;i<M;i++){
		int a,b;
		scanf("%d %d",&a,&b);
		a--;
		b--;
		n[a]++;
		n[b]++;
	}

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

	return 0;
}


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

def solve():
    N, K, C = map(int, input().split())
    S = input()

    # 右詰めで働く日
    right = [None for _ in range(len(S))]
    day = K
    i = N
    while i > 0:
        i -= 1

        if S[i] == "x": continue
        right[i] = day
        day -= 1
        if day < 1: break
        i -= C

    # 左詰めで働く日
    left = [None for _ in range(len(S))]
    day = 1  # 働いた日数
    i = -1
    while i < N:
        i += 1

        if S[i] == "x": continue
        left[i] = day

        # 検証
        if left[i] == right[i]:
            print(i+1)

        day += 1
        if day > K: break
        i += C


if __name__ == "__main__":
    solve()


Measured memory_bytes: 20604
#include <stdio.h>

int main(void){

	long a,b,c,i;

	
	while(scanf("%ld %ld",&a,&b)!=EOF){
		c = a+b;
		i = 1;
		while(c>=10){
			c=c/10;
			i++;
		}
		printf("%ld\n",i);

	}

	return 0;
}

Measured memory_bytes: 1028
#include <cstdio>
#include <iostream>
#include <cmath>
#include <algorithm>

using namespace std;

int sum_AS[200000], sum_BS[200000], sum_AT[200000], sum_BT[200000];

int main(){
	
	string str1, str2;
	
	cin >> str1 >> str2;
	
	int sum_A = 0;
	int sum_B = 0;
	
	for(int i = 0; i < str1.size(); i++){
		if(str1[i] == 'A'){
			sum_A++;
		}else{
			sum_B++;
		}
		sum_AS[i + 1] = sum_A;
		sum_BS[i + 1] = sum_B;
	}
	
	sum_A = 0;
	sum_B = 0;
	
	for(int i = 0; i < str2.size(); i++){
		if(str2[i] == 'A'){
			sum_A++;
		}else{
			sum_B++;
		}
		sum_AT[i + 1] = sum_A;
		sum_BT[i + 1] = sum_B;
	}
	
	sum_AS[0] = 0;
	sum_BS[0] = 0;
	sum_AT[0] = 0;
	sum_BT[0] = 0;
	
	int q;
	
	cin >> q;
	
	for(int loop = 0; loop < q; loop++){
		int a, b, c, d;
		cin >> a >> b >> c >> d;
		int num_AS = sum_AS[b] - sum_AS[a - 1];
		int num_BS = sum_BS[b] - sum_BS[a - 1];
		int num_AT = sum_AT[d] - sum_AT[c - 1];
		int num_BT = sum_BT[d] - sum_BT[c - 1];
		//cout << num_AS << num_BS << num_AT << num_BT << endl;
		if(((num_AS - num_BS) - (num_AT - num_BT)) % 3 == 0){
			cout << "YES" << endl;
		}else{
			cout << "NO" << endl;
		}
	}
	
	return 0;
}



Measured memory_bytes: 2432
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 1e5;
vector <int> G[N + 7];
int dp[N + 7];

void dfs(int v) {
	vector <int> T;
	for(auto u : G[v]) {
		dfs(u);
		T.push_back(dp[u]);		
	}
	sort(T.begin(), T.end(), greater <int>());
	for(int i = 0; i < (int) T.size(); ++i) dp[v] = max(dp[v], 1 + T[i] + i);
}

int main() {
	ios_base::sync_with_stdio(0);
	int n;
	cin >> n;
	for(int i = 2; i <= n; ++i) {
		int x;
		cin >> x;
		G[x].push_back(i);
	}
	dfs(1);
	cout << dp[1] << endl;
	return 0;
}

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

#define ll long long
#define ld long double

using namespace __gnu_pbds;
using namespace std;

template <class T> using oset = tree <pair <T, T>, null_type, less <pair <T, T>>, rb_tree_tag, tree_order_statistics_node_update>;

void usaco(string name = "")
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    if(name.size())
    {
        freopen((name+".in").c_str(), "r", stdin);
        freopen((name+".out").c_str(), "w", stdout);
    }
}

const int mxn = 1e5+1;
vector <int> adj[mxn], vis(mxn);

void dfs(int u)
{
    vis[u] = 1;
    for (int v : adj[u])
        if (!vis[v])
            dfs(v);
}

int32_t main()
{
    usaco();
    int n, m;
    cin >> n >> m;
    int ans = 0;
    for (int i = 1; i <= m; ++i)
    {
        int u, v;
        cin >> u >> v;
        adj[u].emplace_back(v);
        adj[v].emplace_back(u);
    }
    for (int i = 1; i <= n; ++i)
    {
        if (!vis[i])
        {
            dfs(i);
            ++ans;
        }
    }
    cout << --ans << '\n';
}


Measured memory_bytes: 9604
A,B,C,D,E,F = gets.split.map(&:to_f)
@a100 = A * 100.0
@b100 = B * 100.0

cnt_a = F % @a100 == 0 ? F / @a100 : F / @a100 + 1
cnt_b = F % @b100 == 0 ? F / @b100 : F / @b100 + 1
water = []
# binding.pry
0.upto(cnt_a) do |i|
  0.upto(cnt_b) do |j|
    pre = @a100 * i + @b100 * j
    water << pre if pre <= F
  end
end
water.uniq!
# p water
cnt_c = F % C == 0 ? F / C : F / C + 1
cnt_d = F % D == 0 ? F / D : F / D + 1
suger = []
0.upto(cnt_c) do |i|
  0.upto(cnt_d) do |j|
    pre = C * i + D * j
    suger << pre if pre <= F
  end
end
suger.uniq!
# p suger
ans = [A * 100, 0]
pre2 = 0
water.each do |wat|
  suger.each do |sug|
    sugwat = wat + sug
    sweet = 100 * sug / (sugwat)
    if 0 < sugwat && sugwat <= F && pre2 < sweet && sug / wat <= E / 100.0
      ans = [wat + sug, sug]
      pre2 = sweet
    end
  end
end
puts "#{ans[0].to_i} #{ans[1].to_i}"

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

void solve(){
    int l,r;
    cin >> l >> r;
    vector<int> v;
    if(r-l>2019){
        cout << 0 << endl;
    }
    else{
    for(int i=l; i<=r; i++){
        v.emplace_back(i%2019);
    }
    int m = (v[0]*v[1])%2019;
    int n=v.size();
    rep(i,n){
        rep(j,n){
            if(i!=j){
                m = min(m, (v[i]*v[j])%2019);
            }
        }
    }
    cout << m << endl;
    }
}

int main(){
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#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 vl vector<ll>
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  int x, y;
  std::cin >> x >> y;
  int k = 0;
  if(x==3) k+=100000;
  if(x==2) k+=200000;
  if(x==1) k+=300000;
  if(y==3) k+=100000;
  if(y==2) k+=200000;
  if(y==1) k+=300000;
  if(x==1&&y==1) k+=400000;
  std::cout << k << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<iostream>
#include<string>
using namespace std;
int main()
{
  string s ;
  int flag = 0 ;
  cin>>s;
  int long long n = s.size();
  string s2,s3;
  for(int long long i=0;i<=n/2;i++)
  {
    if(s[i] != s[n-i-1])
    {
      cout<<"No";
      flag=1;
      break;
    }
    if(i!=n/2)
    {
        s2+=s[i];
        s3+=s[n-i-1];
    }
  }
  //cout<<s2;
  n = s2.size();
  if(flag==0)
  {
  for(int long long i=0;i<=n/2;i++)
  {
    if(s2[i] != s2[n-i-1])
    {
      cout<<"No";
      flag=1;
      break;
    }
  }
  }
  if(flag==0)
  {
  for(int long long i=0;i<=n/2;i++)
  {
    if(s3[i] != s3[n-i-1])
    {
      cout<<"No";
      flag=1;
      break;
    }
  }
  }
  if(flag==0)
    cout<<"Yes";
  return 0;
}


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

int main() {
	int number[100001]={0};
	int three[100003]={0};
	int n;
	cin >> n;
	int a[n];
	for(int i=0;i<n;i++){
		cin >> a[i];
		number[a[i]]++;
	}
	
	for(int i=0;i<n;i++){
		three[i]=number[i]+number[i+1]+number[i+2];
	}
	
	int max = 1;
	for(int i=0;i<n;i++){
		if(three[i]>max) max = three[i];
	}
	
	cout << max << endl;
	

	return 0;
}

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

using namespace std;

typedef long long ll;
const int N = 12;
const int M = 1000;

int n, m;
int c[M], msk[M];
int dp[1 << N];

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

    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int len;
        cin >> c[i] >> len;
        for (int j = 1; j <= len; j++)
        {
            int bit;
            cin >> bit;
            bit--;
            msk[i] += (1 << bit);
        }
    }

    for (int i = 1; i < (1 << n); i++)
        dp[i] = (int) 1e9;

    for (int i = 0; i + 1 < (1 << n); i++)
        for (int j = 0; j < m; j++)
            dp[i | msk[j]] = min(dp[i | msk[j]], dp[i] + c[j]);

    if (dp[(1 << n) - 1] == (int) 1e9)
        cout << "-1\n";
    else
        cout << dp[(1 << n) - 1] << "\n";

    return 0;
}


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

public class Main {

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

        int n = sc.nextInt();
        int k = sc.nextInt();
        int red = n - k;
        long MOD = (long) 1e9 + 7;
        Combination combi = new Combination(n + 100, MOD);

        for (int i = 1; i <= k; i++) {
            long redPosition = combi.nck( red + 1, i);
            long bluePosition = combi.nck(k - 1, i - 1);
            System.out.println(redPosition * bluePosition % MOD);
        }
    }

    public class Combination {
        int n;
        long mod;
        long[] facts;

        public Combination(int n, long mod) {
            this.n = n;
            this.mod = mod;
            facts = new long[n];
            facts[0] = 1;
            for (int i = 1; i < n; i++) {
                facts[i] = facts[i - 1] * i % mod;
            }
        }

        long modpow(long a, long b) {
            if (b == 0) return 1;
            else if (b == 1) return a;

            long x = modpow(a, b / 2);
            return b % 2 == 0 ? x * x % mod : x * (x * a % mod) % mod;
        }

        long inv(long n) {
            return modpow(n, mod - 2);
        }

        public long nck(int n, int k) {
            if (n < k) return 0;
            return facts[n] * (inv(facts[n - k]) * inv(facts[k]) % mod) % mod;
        }
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


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

using namespace std;

int main(){
int a,b,c;
cin>>a>>b>>c;
int cnt=0;
while(1) {
    if(cnt==1e6) break;
    if(a&1 || b&1 || c&1) break;
    int x=a,y=b,z=c;
    a=y/2+z/2;
    b=x/2+z/2;
    c=x/2+y/2;
    cnt++;
}
if(cnt==1e6) cout<<-1<<endl;
else cout<<cnt<<endl;

return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define vl vector<ll>

int main() {

    ll N, K;
    cin >> N >> K;

    vl A;
    ll a;
    A.push_back(0);
    for (ll i = 0; i < N; ++i) {
        cin >> a;
        A.push_back(a);
    }

    vl B;
    set<ll> visited;
    B.push_back(1);
    visited.insert(1);
    ll next;
    ll loop_s = 0;
    ll loop_e = 0;
    for (ll i = 0; i < N+1; ++i) {
        next = A[B[i]];
        set<ll>::iterator itr = visited.find(next);
        if (itr != visited.end()) {
            for (ll j = 0; j <= i; ++j) {
                if (B[j] == next) {
                    loop_s = j;
                    break;
                }
            }
            loop_e = i;
            break;
        }
        else {
            B.push_back(next);
            visited.insert(next);
        }
    }

    if (K <= loop_e) {
        cout << B[K] << endl;
    }
    else {
        K -= loop_s;
        K %= (loop_e - loop_s + 1);
        K += loop_s;
        cout << B[K] << endl;
    }

    // cout << "loop_s : " << loop_s << endl;
    // cout << "loop_e : " << loop_e << endl;
    // for (ll i = 0; i < B.size(); ++i) {
    //     cout << B[i] << " ";
    // }
    // cout << endl;

    return 0;
}


Measured memory_bytes: 15588
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define chmin(x,y) x = min(x,y)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;

int main() {
    int a, b, x;
    cin >> a >> b >> x;
    double ans;
    if ((a*a*b)/2 <= x) ans = atan2(2*a*a*b - 2*x, a*a*a);
    else ans = atan2(a*b*b,2*x);
    ans = ans * 180 / M_PI;
    cout << std::fixed;
    cout << std::setprecision(9) << ans << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int countDeta;
		int[] deta = new int[10000];
		for (countDeta = 0; countDeta < 10000; countDeta++) {
			int x = sc.nextInt();
			if (x == 0) {
				break;
			}
			deta[countDeta] = x;
		}
		for (int i = 0; i < countDeta; i++) {
			System.out.println("Case" + " " + (i + 1) + ": " + deta[i]);
		}
		sc.close();
	}
}


Measured memory_bytes: 43656
arr = [input() for i in range(4)]
count = 0
sum = 0
for fihun in range(int(arr[0]) + 1):
    for hun in range(int(arr[1]) + 1):
        for fi in range(int(arr[2]) + 1):
            sum = fihun * 500 + hun * 100 + fi * 50
            if sum == int(arr[3]):
                count += 1
print(count)


Measured memory_bytes: 3064
#include <stdio.h>

int main(void){
	int i, j, n, min=1000000, max=-1000000, a[10000];
	long long sum = 0;
	
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d",&a[i]);
		
		if (a[i] < min)
		{
			min = a[i];
		}
		if (a[i] > max)
		{
			max = a[i];
		}
		
		sum = sum + a[i];
	}
	
	printf("%d %d %lld\n", min, max, sum);
	
	return 0;
}

Measured memory_bytes: 640
def grand_garden(n, h):

    count = 0
    j = 100
    for i in range(n):
        if h[i] != 0:
            j = i
            break
    if j == 100:
        return count

    while h[j] != 0:
        l = j  # 左はしきめる
        r = l  # 動く右はし
        for k in range(l, n):  # 右端はZeroでないかぎりのばす、ゼロになる最初の位置を取得、すべてゼロでなければ配列の右端
            if k == n-1 and h[k] != 0:
                r = n
            elif h[k] == 0:
                r = k
                break

        min_val = min(h[l:r])  # 右はしから左はしまでの最小値を取得
        for x in range(l, r):  # 各要素から共通の最小値を差し引く
            h[x] -= min_val
        count += min_val  # 最小値分カウントを追加
        if h[j] == 0:  # もしも左端がゼロだったらゼロでない最初の位置へ移動
            for t in range(j, n):
                if h[t] != 0:
                    j = t
                    break

        if j >= n:
            break
    return count


def main():
    n = int(input())
    h = list(map(int, input().split()))

    answer = grand_garden(n, h)
    print(answer)


'''
数列に0が含まれない最大の幅を取得(0ではない最小の左から最大の右でもよいのか)
その幅に含まれる要素高さを1ずつへらす、
count +=1

0 <= l,r <= n-1
while True:
    if h[i] == 0:
        l += 1
        i += 1
        continue
        if l >= n:
            break

   for i in range(n):
        if h[i] != 0:
            l = i
            r = l
            for j in range(l, n):
                if h[j] != 0:
                    r += 1
            for k in range(l, r):
                h[k] -= min(h[l:r])
#            if h[l] != 0:
#                i -= 1
            count += 1


'''


if __name__ == "__main__":
    main()


Measured memory_bytes: 64152
#include <iostream>
using namespace std;
static const int MAX=101;
static const int INFTY=(1<<21);
static const int WHITE=0;
static const int GRAY=1;
static const int BLACK=2;

int n,M[MAX][MAX];

void dijkstra(){
    int minv;
    int d[MAX],color[MAX];
    for(int i=0;i<n;i++){
        d[i]=INFTY;
        color[i]=WHITE;
    }
    
    d[0]=0;
    color[0]=GRAY;
    
    while(1){
        minv=INFTY;
        int u=-1;
        for(int i=0;i<n;i++){
            if(minv>d[i] && color[i]!=BLACK){
                u=i;
                minv=d[i];
            }
        }
        if(u==-1) break;
        color[u] = BLACK;
        for(int i=0;i<n;i++){
            if(color[i]!=BLACK && M[u][i]!=INFTY){
                if(d[i]>M[u][i]+d[u]){
                    d[i]=M[u][i]+d[u];
                    color[i]=GRAY;
                }
            }
        }
    }
    for(int i=0;i<n;i++){
        cout << i << " " << (d[i]==INFTY ? -1 : d[i]) << endl;
    }
}

int main(){
    cin >> n;
    
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            M[i][j]=INFTY;
        }
    }
    
    for(int i=0;i<n;i++){
        int x,y;cin >> x >> y;
        for(int j=0;j<y;j++){
            int z;cin >> z;
            cin >> M[x][z];
        }
    }
    
    dijkstra();
    
    return 0;
}










Measured memory_bytes: 3124
#include <iostream>
#include <algorithm>
#include <utility>
#include <cmath>

int n, m;
std::pair<int, int> data[100005];
int main() {
	std::cin >> n >> m;
	for (int i = 0; i < m; ++i) {
		int a, b;
		std::cin >> a >> b;
		data[i].first = b;
		data[i].second = a;
	}

	std::sort(data, data + m);

	int before = -1;
	int ans = 0;
	for (int i = 0; i < m; ++i) {
		if (before >= data[i].second)
			continue;
		++ans;
		before = data[i].first - 1;
	}

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


Measured memory_bytes: 1024
#include<stdio.h>

#define N 100001
int main()
{
  int cnt1=0,cnt2=0;
  char s[N];

  scanf("%s",s);
  
for(int i=0;i<N;i++)
{
  if(s[i]=='1'||s[i]=='0')
  {
    if(i%2==1&&s[i]=='0')
      cnt1++;
    if(i%2==0&&s[i]=='1')
      cnt1++;
  }
  else
   break;
}
  
  for(int i=0;i<N;i++)
  {
   if(s[i]=='1'||s[i]=='0')
    {
      if(i%2==1&&s[i]=='1')
        cnt2++;
      if(i%2==0&&s[i]=='0')
        cnt2++;
    }
    else
      break;
  }
    
  if(s[0]=='0')
  printf("%d",cnt1);
  else
  printf("%d",cnt2);
  
  return 0;
}

Measured memory_bytes: 384
#include <cstdio>
#include <iostream>
#include <cassert>
#include <string>
#include <algorithm>
#include <cstring>
#include <utility>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <unordered_map>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
const int MAXN = 345;
const LL INF = (LL)1e14;
LL dis[MAXN][MAXN], ans[MAXN][MAXN];
int edge[MAXN][MAXN];
bool visit[MAXN];

void bfs(int cur, int N) {
     memset(visit, 0, sizeof(visit));
     queue<int> qu;
     qu.push(cur);
     visit[cur] = 1;
     ans[cur][cur] = 0;
     while (!qu.empty()) {
           int tp = qu.front();
           qu.pop();
           for (int i = 1; i <= N; i++) {
               if (visit[i] || !edge[tp][i]) continue;
               visit[i] = 1;
               ans[cur][i] = ans[cur][tp] + 1;
               qu.push(i);
           }
     }

}

int main() {
    int N, M, L;
    scanf("%d %d %d", &N, &M, &L);
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if (i == j) continue;
            ans[i][j] = dis[i][j] = INF;
        }
    }
    for (int i = 0; i < M; i++) {
        int a, b, c;
        scanf("%d %d %d", &a, &b, &c);
        dis[a][b] = dis[b][a] = c;
    }
    for (int k = 1; k <= N; k++) {
        for (int i = 1; i <= N; i++) {
            for (int j = 1; j <= N; j++) {
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
            }
        }
    }
    for (int i = 1; i <= N; i++) {
        for (int j = 1; j <= N; j++) {
            if (dis[i][j] <= L) edge[i][j] = 1;
        }
    }
    for (int i = 1; i <= N; i++) {
        bfs(i, N);
    }
    int Q;
    scanf("%d", &Q);
    for (int i = 0; i < Q; i++) {
        int s, t;
        scanf("%d %d", &s, &t);
        if (ans[s][t] == INF) puts("-1");
        else printf("%lld\n", ans[s][t] - 1);
    }
    return 0;
}


Measured memory_bytes: 2560
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
    
		// 整数の入力
		int n = sc.nextInt();
        int[] list = new int[n];
        for(int i = 0; i < n; i++) {
          list[i] = sc.nextInt();
        }
		Arrays.sort(list);
    
		// 出力
		System.out.println(Math.abs(list[n - 1] - list[0]));
	}
}

Measured memory_bytes: 23124
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)n; i++)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<pi, pi> pp;
typedef pair<ll, ll> pl;
const double EPS = 1e-9;
const ll MOD = 1000000007;
const int inf = 1 << 30;
const ll linf = 1LL << 60;

string s, t;
ll dist[200000][26];

int main() {
    cin >> s >> t;
    int si = s.size();
    s += s;
    rep(i,s.size()) rep(j,26) dist[i][j] = linf;
    for (int i = s.size()-1; i >= 1; i--) {
        rep(j,26) dist[i-1][j] = dist[i][j]+1;
        dist[i-1][s[i]-'a'] = 1;
    }
    ll len = 0;
    int st = -1;
    rep(i,s.size()) {
        if (s[i] == t[0]) {
            st = i;
            len = i;
            break;
        }
    }
    if (st == -1) {
        cout << -1 << endl;
        return 0;
    }
    for (int i = 1; i < t.size(); i++) {
        len += dist[st][t[i]-'a'];
        if (len >= linf) {
            cout << -1 << endl;
            return 0;
        }
        st = len%si;
    }
    cout << len+1 << endl;
}

Measured memory_bytes: 41344
#include <bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int

using namespace std;



int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);cout.tie(NULL);
    ll N,M=0;
    ll sum=0;
    cin>>N;
    vector<ll> arr(N);

    for(ll i=0;i<N;i++){
        cin>>arr[i];

    }
    
    vector<ll> ar(N+1,0);


    for(ll i=N;i>=1;i--){
        sum=0;
        for(ll j=i;j<=N;j+=(i)){
            sum+=ar[j];
        }
        if(sum%2!=arr[i-1]){
            ar[i]=1;
            M++;

        }

    }

    

    cout<<M<<endl;
    for(ll i=1;i<=N;i++)
        if(ar[i])
            cout<<i<<endl;




    return 0;
}

Measured memory_bytes: 3968
import java.util.Scanner;

public class Main{
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int height, width;
		int h, w;

		height = sc.nextInt();
		width = sc.nextInt();

		while(height != 0 || width != 0){
			h = 0;
			while(true){
				if(h < height){
					w = 0;
					while(true){
						if(w < width){
							System.out.print("#");
							w++;
						}else{
							break;
						}
						if(w < width){
							System.out.print(".");
							w++;
						}else{
							break;
						}
					}
					System.out.println();
					h++;
					w = 0;
					if(h < height){
						while(true){
							if(w < width){
								System.out.print(".");
								w++;
							}else{
								break;
							}
							if(w < width){
								System.out.print("#");
								w++;
							}else{
								break;
							}
						}
						System.out.println();
						h++;
					}
				}else{
					break;
				}
			}

			height = sc.nextInt();
			width = sc.nextInt();
			System.out.println();
		}

	}
}


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

int main(void){
    char str[1001]={};
    char ins[1001]={};
    char re[1001]={};
    char temp[1001]={};
    int a=0,b=0,q,i;

    scanf("%s", str);
    scanf("%d", &q);
    while(q--){
        scanf("%s %d %d",ins,&a,&b);
        if(strcmp(ins,"replace") == 0){
            scanf("%s", re);
            for(i=0;i<b-a+1;i++) str[i+a] = re[i];
        }
        else if(strcmp(ins,"reverse") == 0){
            strncpy(temp,str,strlen(str));
            temp[strlen(str)] = '\0';
            for(i=0;i<=(b-a);i++) str[a+i] = temp[b-i];
        }
        else{
            for(i=a;i<=b;i++) printf("%c", str[i]);
            puts("");
        }
    }
    return(0);
}

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

int main(){
    for(int i=0;i<500000;i++){
        int h,w;
        cin>>h>>w;
        if(h==0&&w==0) break;
        else{
            for(int i=0;i<h;i++){
                for(int k=0;k<w;k++){
                    if((i+k)%2==0) cout<<'#';
                    else cout<<'.';
                }
                cout<<endl;
            }
        cout<<endl;
        }
    }
}


Measured memory_bytes: 3056
#pragma comment(linker, "/STACK:102400000,102400000")
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <map>
#include <set>
#include <queue>

#define LL long long

using namespace std;

const int MOD = 1000000007, N = 100000+10;

int n, a[N];
LL sum[N];

void gg()
{
	puts("No");
	exit(0);
}

int main()
{
	//freopen("test_in.txt", "r", stdin);
	//freopen("test_out.txt", "w", stdout);
	int n, c[600], s[600], f[600];
	 scanf("%d", &n);
	n--;
	for(int i = 1; i <= n; i++)
		scanf("%d%d%d", &c[i], &s[i], &f[i]);
	int ans[600] = {0};
	for(int i = 1; i <= n; i++)
	{
		ans[i] = s[i]+c[i];
		for(int j = i+1; j <= n; j++)
		{
			int d = (ans[i]%f[j]) ? (f[j]-ans[i]%f[j]) : 0;
			ans[i] = max(ans[i]+d, s[j])+c[j];
		}
	}
	for(int i = 1; i <= n; i++)
		cout<<ans[i]<<endl;
	cout<<0<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <utility>
#include <vector>
#include <tuple>
#include <unordered_map>
#include <algorithm>
#include <boost/functional/hash.hpp>

int p2i(const std::pair<int, int>& p){
  return std::get<0>(p)*2000+std::get<1>(p);
}

int main(){
  int N;
  std::cin >> N;
  std::unordered_map<int, std::vector<int>> t_arr;
  std::unordered_map<int, int> in_nodes;

  for(int i = 0; i < N; i++){
    int a;
    std::cin >> a;
    int p = p2i(std::minmax(i, a-1));
    in_nodes[p];
    for(int j = 1; j < N-1; j++){
      std::cin >> a;
      int q = p2i(std::minmax(i, a-1));
      t_arr[p].push_back(q);
      in_nodes[q] += 1;
      p = q;
    }
  }

  std::vector<int> p1, p2;
  for(auto&& it: in_nodes){
    if(it.second == 0) p1.push_back(it.first);
  }

  int ncount = 0, nd = 0;
  while(ncount < in_nodes.size()){
    if(p1.size() == 0){
      nd = -1;
      break;
    }
    ncount += p1.size();
    nd++;
    for(auto&& it: p1){
      for(auto&& it2: t_arr[it]){
        in_nodes[it2] -= 1;
        if(in_nodes[it2] == 0) p2.push_back(it2);
      }
    }
    p1.clear();
    std::swap(p1, p2);
  }

  std::cout << nd << std::endl;

  return 0;
}



Measured memory_bytes: 62952
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n ; ++i)
#define REP(i,a,b) for(int i=a; i<b; ++i)
typedef long long ll;
//プロトタイプ宣言
int gcd(int , int);


int main(){
  cin.tie(NULL);
  cout.tie(NULL);
  ll n,ans = 0;
  cin >> n;
  string s;
  unordered_map<string,ll> mp;
  while(n>0){
    cin >> s;
    sort(s.begin(),s.end());
    ans += mp[s];
    mp[s]++;
    n--;
  }
  cout << ans << endl;
}








































//以下、ライブラリ
//ユークリッドの互除法

int gcd(int a, int b) {
  return b ? gcd(b, a%b) : a;
}



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

bool IsPrime(ll num) {
  if (num < 2) return false;
  else if (num == 2) return true;
  else if (num % 2 == 0) return false;

  double sqrtNum = sqrt(num);
  for (ll i = 3; i <= sqrtNum; i += 2) {
    if (num % i == 0) return false;
  }

  return true;
}

double cntdiv(ll n, ll i) {
  double result = 0;
  while (n%i == 0) {
    result += 1;
    n /= i;
  }
  return result;
}
int main() {
  ll n;
  cin >> n;
  ll ans = 0;
  double sqn = sqrt(n);
  for (int i = 1; i <= sqn; ++i) {
    if (n%i == 0) {
      if (IsPrime(i)) ans += ll(floor((-1.0+sqrt(1.0+8.0*cntdiv(n,i)))/2.0));
      ll ni = n / i;
      if (IsPrime(ni) && i != ni) ans += ll(floor((-1.0+sqrt(1.0+8.0*cntdiv(n,ni)))/2.0));
    }
  }
  if (IsPrime(n)) ans = 1;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3748
/*  ex7_3 Grid Compression
    pandacodeb  */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int row, col;
    int i, j;

    scanf("%d %d", &row, &col);
    char** table;
    int* delRow; int* delCol;

    table = (char**) calloc(row, sizeof(char*));
    if (table == NULL)
        exit(1);

    for(i = 0; i < row; i++){
        table[i] = (char*) calloc(col, sizeof(char));
        if (table[i] == NULL)
            exit(1);
    }

    for (i = 0; i < row; i++){
        for (j = 0; j < col; j++){
            scanf(" %c", &table[i][j]);
        }
    }

    delRow = (int*) calloc(row, sizeof(int));
    if (delRow == NULL)
        exit(1);
    for (i = 0; i < row; i++)
        delRow[i] = 0;

    delCol = (int*) calloc(col, sizeof(int));
    if (delCol == NULL)
        exit(1);
    for (i = 0; i < col; i++)
        delCol[i] = 0;

    for (i = 0; i < row; i++){
        for (j = 0; j < col; j++){
            if (table[i][j] == '#')
                break;
            else if (j == col - 1)
                delRow[i] = 1;
        }
    }
    for (j = 0; j < col; j++){
        for (i = 0; i < row; i++){
            if (table[i][j] == '#')
                break;
            else if (i == row - 1)
                delCol[j] = 1;
        }
    }

    //出力
    for (i = 0; i < row; i++){
        if (delRow[i] == 1)
            continue;
        for (j = 0; j < col; j++){
            if (delCol[j] == 1)
                continue;
            
            printf("%c", table[i][j]);
        }
        printf("\n");
    }

    //開放
    for (i = 0; i < row; i++)
        free(table[i]);
    free(table);

    return 0;
}

Measured memory_bytes: 1672
package main

import "fmt"

func main() {
  var a, b, x int
  fmt.Scan(&a, &b, &x)
  if a > x {
    fmt.Println("NO")
  } else if (a + b) > x {
    fmt.Println("YES")
  } else {
    fmt.Println("NO")
  }
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
#define F first
#define S second
#define pb push_back
#define mp make_pair
#define full(a) a.begin(),a.end()
#define rfull(a) a.rbegin(),a.rend()

using namespace std;
const double pi=acos(-1.0);
const double pii=2*pi;
const double eps=1e-6;
const long long MOD=1e9+7;

void solve(){
    int k,a,b;cin>>k>>a>>b;
    for(int i=a;i<=b;i++){
        if(i%k==0){
            cout<<"OK\n";
            return;
        }
    }
    cout<<"NG\n";
}

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

    solve();
    return 0;
}

Measured memory_bytes: 3660
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
#define double long double

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

double dist(Point a, Point b) {
    return (a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y);
}

bool comp(Point a, Point b) {
    return atan2(a.y, a.x) < atan2(b.y, b.x);
}   

double PI = acos(-1);
double get(vector <pair <double, double> > a) {
    vector <pair <double, int> > sc;
    for (auto e : a) {
        if (e.f <= e.s) {
            sc.app(mp(e.f, 1));
            sc.app(mp(e.s, -1));
        }   
        else {
            sc.app(mp(e.f, 1));
            sc.app(mp(-PI, 1));
            sc.app(mp(e.s, -1));
        }   
    }   
    sort(all(sc));
    double ans = 0;
    int cur = 0;
    for (int i = 0; i < sc.size(); ++i) {
        cur += sc[i].s;
        if (cur == a.size()) {
            if (i + 1 < sc.size())
                ans += sc[i + 1].f - sc[i].f;                    
            else
                ans += PI - sc[i].f;
        }
    }   
    return ans;
}   

const int N = 107, INF = 1e9 + 7;
Point a[N];
double ans[N];
signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n;
    cin >> n;
    for (int i = 0; i < n; ++i)
        cin >> a[i].x >> a[i].y;
    cout.precision(20);
    for (int i = 0; i < n; ++i) {
        vector <pair <double, double> > in;
        for (int j = 0; j < n; ++j) {
            if (i == j)
                continue;

            auto v = a[j] - a[i];
            v = {-v.y, v.x};
            double ang1 = atan2(v.y, v.x);
            double ang2 = atan2(-v.y, -v.x);

            auto w = a[i] - a[j];
            double ang_w = atan2(w.y, w.x);

            if (ang2 < ang1) {
                swap(ang1, ang2);
            }   
            if (ang1 <= ang_w && ang_w <= ang2) {
                in.app(mp(ang1, ang2));
            }   
            else {
                in.app(mp(ang2, ang1));
            }   
        }
        /*
        cout << "i " << i << endl;
        for (auto e : in)
            cout << e.f << ' ' << e.s << endl;
        */
        cout << get(in) / (2 * PI) << endl;
    }
}

Measured memory_bytes: 512
N=int(input())
A=list(map(int,input().split()))
D=int(1)
ans=int(0)
A.sort()
if A[0]==0:
    ans==0
else:
    A.sort(reverse=True)
    for i in range(N):
        D*=A[i]
        if  D>10**18:
            ans=-1
            break

        else:
            ans=D
        

print(ans)

Measured memory_bytes: 21536
#include <bits/stdc++.h>
using namespace std;
 
int main(){
 
  int t[111][111];
 
  memset(t,0,sizeof(t));
  int n;
  cin >> n;
 
  for(int i = 0; i < n; i++){
    int a, b;
    cin >> a >> b;
    for(int j = 0; j < b; j++){
      int c;
      cin >> c;
      t[a][c] = 1;
    }
  }
 
  for(int i = 1; i <= n; i++){
    for(int j = 1; j <= n; j++){
      if(j != n)
      cout << t[i][j] << " ";
      else
    cout << t[i][j];
 
    }
    cout << endl;
  }
 
 
}

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

int main() {
 int N;
  cin >> N;
  vector<int> vec(N);
  for(int i = 0; i < N; i++){
    int A;
    cin >> A;
    vec[i] = A;
  }
  int c = 0;
  bool ans = false;
  
    while(true){
      int i = 0;
    while(i < N){
        if(vec[i] % 2 > 0){
        ans = true;
        break;
       }
      vec[i] = vec[i] / 2;
        i++;
    }
    if(ans){
      break;
    }
    c++;
 }
  cout << c << endl;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main() {
  int N, W;
  int w[110];
  int v[110];
  int d[110][10010];

  cin >> N >> W;

  for (int i = 0; i < N; i++) {
    cin >> v[i] >> w[i];
  }
  for (int j = 0; j <= W; j++) {
    d[0][j] = 0;
  }

  for (int i = 0; i < N; i++) {
    for (int j = 0; j <= W; j++) {
      if (j >= w[i]) {
        d[i+1][j] = max(d[i][j-w[i]] + v[i], d[i][j]);
      } else {
        d[i+1][j] = d[i][j];
      }
    }
  }
  cout  << d[N][W] << endl;
}



Measured memory_bytes: 7052