akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <set>
#include <vector>

using namespace std;

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

	vector<int> a(n);

	for (auto& e : a) {
		cin >> e;
	}

	int ans = 0;
	for (auto e : a) {
		while (e % 2 == 0) {
			ans++;
			e /= 2;
		}
	}
	cout << ans << endl;
}


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

using namespace std;

const long long MOD = 1000000007;

int main(){
    int N;
    while(cin >> N){
        long long res = 1;
        vector<int> c(3, 0);
        for(int i=0;i<N;i++){
            int A; cin >> A;
            int m = 0;
            for(auto& t : c) if(t == A) m++;
            res = (res*m)%MOD;
            for(auto& t : c){
                if(t == A){
                    t++;
                    break;
                }
            }
        }
        cout << res << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <map>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
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;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

int main() {
  int in(N);

  vi A(N), B(N);
  rep(i, N) {
    cin >> A[i];
    B[i] = A[i] - i;
  }
  map<int, ll> m;
  ll ans = 0;
  rep(i, N) {
    ans += m[i-A[i]];
    ++m[A[i] + i];
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 27364
#include <algorithm>
#include <iostream>
using namespace std;
int scnt[26], tcnt[26];
int main() {
  string s, t;
  cin >> s >> t;
  for (char c = 'a'; c <= 'z'; c++) {
    for (int i = 0; i < s.length(); i++) {
      int cur = c - 'a';
      if (s.at(i) == c) scnt[cur] += 1;
      if (t.at(i) == c) tcnt[cur] += 1;
    }
  }

  sort(scnt, scnt + 26);
  sort(tcnt, tcnt + 26);
  for (int i = 0; i < 26; i++) {
    if (scnt[i] != tcnt[i]) {
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  return 0;
}

Measured memory_bytes: 776
#include <stdio.h>

long long int chmax(long long int a,long long int b){
  //b -> max
  if(a > b){
    b = a;
  }
  return b;
}

int main(){
  int n,max_w;
  scanf("%d%d",&n,&max_w);
  int w[n],v[n];
  long long int dp[n+1][max_w+1];
  for(int i=0; i<n; i++){
    scanf("%d%d",&w[i],&v[i]);
  }
  for(int i=0; i<=n; i++){
    for(int j=0; j<=max_w; j++){
      dp[i][j]=0;
    }
  }
  
  for(int i=0; i<n; i++){
    for(int sum_w=0; sum_w<=max_w; sum_w++){
      if(sum_w - w[i] >= 0){
        dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w-w[i]] + v[i]);
      }
      dp[i+1][sum_w] = chmax(dp[i+1][sum_w], dp[i][sum_w]);
    }
  }
  
  printf("%lld",dp[n][max_w]);
  
  return 0;
}


Measured memory_bytes: 79104
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(v) v.begin(), v.end()

ll GCD(ll a, ll b) { if(b==0) return a; else return GCD(b, a%b); }
ll LCM(ll a, ll b) { return a/GCD(a,b)*b; }

class AChangingACharacter {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n,k;in>>n>>k;
        string s;in>>s;
        s.at(k-1)=s.at(k-1)+32;
        out<<s<<endl;
	}
};


int main() {
	AChangingACharacter solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3048
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;
const ll MOD = 1e9+7;

int main() {
    string L;
    cin >> L;
    ll n = L.size();
    vector<vector<ll>> dp(n+1,vector<ll>(2));
    dp[0][1]=1;
    for(int i=0;i<n;i++){
        dp[i+1][0]=(dp[i][0]*3)%MOD;

        if(L[i]=='0')dp[i+1][1]=dp[i][1];
        else{
            dp[i+1][1]=(dp[i][1]*2)%MOD;
            dp[i+1][0]=(dp[i+1][0]+dp[i][1])%MOD;
        }
    }

    cout << (dp[n][0]+dp[n][1])%MOD << endl;
    

    return 0;
}

Measured memory_bytes: 5760
#include<stdio.h>
int main(void)
{
	int N, T, A,point=0;
	double tem,min=1000.0;
	long int H[1001];
	scanf("%d%d%d", &N, &T, &A);
	for (int i = 1; i <= N; i++) {
		scanf("%ld", &H[i]);
		tem = T - H[i] * 0.006;
		if (tem >= A) {
			if (min > tem - A) {
				min = tem - A;
				point = i;
			}
		}
		else if (tem < A) {
			if (min > A - tem) {
				min = A - tem;
				point = i;
			}
		}
	}
	printf("%d", point);
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i++)
#define showmap(is, js, x) {rep(i, is){rep(j, js){cout << x[i][j] << " ";}cout << endl;}}
#define show(x) {for(auto i: x){cout << i << " ";} cout<<endl;}
#define showm(m) {for(auto i: m){cout << m.x << " ";} cout<<endl;}
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> llP;
ll gcd(int x, int y){ return y?gcd(y, x%y):x;}
ll lcm(ll x, ll y){ return (x*y)/gcd(x,y);}


int main()
{
    string s, t;
    cin >> s >> t;

    int ans = 0;
    rep(i, s.size()){
        if (s[i] != t[i]) ans++;
    }
    cout << ans << endl;
}



Measured memory_bytes: 3912
n, m, q = list(map(int, input().split()))
a=[0]*q
b=[0]*q
c=[0]*q
d=[0]*q
for i in range(q):
    a[i],b[i],c[i],d[i] = map(int, input().split())
    a[i] -=1
    b[i] -=1

def score(A):
    score =0
    for ai, bi, ci, di in zip(a,b,c,d):
        if A[bi] - A[ai] == ci:
            score += di
    return score

def dfs(A):
    if len(A)==n:
        #print(A)
        return score(A)
    res = 0
    if len(A) > 0:
        last_term = A[-1]
    else:
        last_term = 1
    for i in range(last_term, m+1):
        A.append(i)
        res = max(res, dfs(A))
        A.pop()
    
    return res

print(dfs([]))

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

#define REP(i, n) for(int (i)=0;(i)<(n);++(i))
#define MOD 1000000007
#define MAXN 10

using namespace std;

typedef long long ll;

// WarshallFloyd 法によりグラフにおける任意の2頂点間の最短距離を求める
// n : |V|
// dist : 距離行列

void WarshallFloyd(int n, int dist[MAXN][MAXN])
{
    for (int k = 0; k < n; ++k)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < n; ++j)
            {
                dist[i][j] = min(dist[i][j], dist[i][k] + dist[k][j]);
            }
        }
    }
}

int main()
{
    ll H, W;
    cin >> H >> W;
    int c[10][10];
    REP(i, 10)
    {
        REP(j, 10)
        {
            cin >> c[i][j];
        }
    }
    int A[H][W];
    REP(i, H)
    {
        REP(j, W)
        {
            cin >> A[i][j];
        }
    }

    // 距離行列を最短になるように計算する
    WarshallFloyd(10, c);

    ll ans = 0;
    REP(i, H)
    {
        REP(j, W)
        {
            ans += c[A[i][j]][1];
        }
    }

    cout << ans <<endl;
}


Measured memory_bytes: 384
#include <stdio.h>
#include <stdlib.h>
#define int long long
#define p 998244353

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

signed compare(const void *a, const void *b){
	int sub = *(int *)a - *(int *)b;
	if(sub < 0){
		return -1;
	}
	else if(sub == 0){
		return 0;
	}
	else{
		return 1;
	}
}

signed main(){
	int N, i, ans = 1;
	scanf("%lld", &N);
	int *A = (int *)malloc(sizeof(int) * N);
	for(i = 0; i < N; i++){
		scanf("%lld", &A[i]);
	}
	qsort(A, N, sizeof(int), compare);
	for(i = 0; i < N; i++){
		ans = (ans * gcd(A[i], i)) % p;
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 1788
MOD = 10**9+7
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]
dp = [[0 for _ in range(w)] for _ in range(h)]
for i in range(h):
	for j in range(w):
		if (i == 0) & (j == 0):
			dp[i][j] = 1
		elif a[i][j] == '#':
			continue
		elif i == 0:
			dp[i][j] = dp[i][j-1]
		elif j == 0:
			dp[i][j] = dp[i-1][j]
		else:
			dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD
print(dp[h-1][w-1])

Measured memory_bytes: 89948
#include <iostream>
#include <cstring>
#include <stdio.h>
#include <algorithm>
using namespace std;

int main()
{
	ios::sync_with_stdio(0);
	int n,res=0;
	long long x; cin>>n>>x;
	while(n--){
		long long a,b; cin>>a>>b;
		if( a*a+b*b<=x*x )
			res++;
	}
	cout<<res<<endl;

	return 0;
}


Measured memory_bytes: 3640
import sys
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n = ni()
ans = 0
for i in range(n):
    l, r = nm()
    ans += r - l + 1
print(ans)


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

int n;  // 入力

// dp[i][j][k] := 皿に乗っている寿司の個数が (1,2,3) の皿の個数が (i,j,k) 枚のときに
// 全て食べきるまでの操作回数の期待値
vector<vector<vector<double>>> dp(305, vector<vector<double>>(305, vector<double>(305, -1)));

// メモ化再帰
double memo_rec(int i, int j, int k){
    if(dp[i][j][k] != -1)   return dp[i][j][k];
    if(i == 0 && j == 0 & k == 0)   return dp[0][0][0] = 0;
    
    double res = 0;
    res += n;
    if(i > 0)   res += memo_rec(i-1, j, k) * i;
    if(j > 0)   res += memo_rec(i+1, j-1, k) * j;
    if(k > 0)   res += memo_rec(i, j+1, k-1) * k;
    res *= 1.0 / (i + j + k);

    return dp[i][j][k] = res;
}

int main(){
    cin >> n;
    int cnt1 = 0, cnt2 = 0, cnt3 = 0;
    for(int i = 0; i < n; ++i){
        int a;
        cin >> a;
        if(a == 1)  ++cnt1;
        else if(a == 2) ++cnt2;
        else    ++cnt3;
    }
    cout << fixed << setprecision(10);
    cout << memo_rec(cnt1, cnt2, cnt3) << endl;
}

Measured memory_bytes: 225792
#include <stdio.h>

int main(void)
{
    int r, d, x, old, i;

    if(scanf("%d %d %d", &r, &d, &old) == 1);

    for(i = 0; i < 10; i++)
    {
        x = r * old - d;
        printf("%d\n", x);
        old = x;
    }

    return 0;
}

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

int main(){
  int a, b, x;
  cin >> a >> b >> x;
  int sum = a;
  for(int i = 0; i <= b; i++){
    if(sum == x){
      cout << "YES" << endl;
      return 0;
    }
    sum++;
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
import sys, os, math, bisect, itertools, collections, heapq, queue
# from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall
from decimal import Decimal
from collections import defaultdict, deque
import copy

sys.setrecursionlimit(10000000)

ii = lambda: int(sys.stdin.buffer.readline().rstrip())
il = lambda: list(map(int, sys.stdin.buffer.readline().split()))
fl = lambda: list(map(float, sys.stdin.buffer.readline().split()))
iln = lambda n: [int(sys.stdin.buffer.readline().rstrip()) for _ in range(n)]

iss = lambda: sys.stdin.buffer.readline().decode().rstrip()
sl = lambda: list(map(str, sys.stdin.buffer.readline().decode().split()))
isn = lambda n: [sys.stdin.buffer.readline().decode().rstrip() for _ in range(n)]

lcm = lambda x, y: (x * y) // math.gcd(x, y)

MOD = 10 ** 9 + 7
MAX = float('inf')


def main():
    if os.getenv("LOCAL"):
        sys.stdin = open("input.txt", "r")

    S = sl()
    stack = []
    operation = {
        '+': lambda a, b: b + a,
        '-': lambda a, b: b - a,
        '*': lambda a, b: b * a,
    }

    for s in S:
        if s.isdecimal():
            stack.append(s)
        else:
            stack.append(operation[s](int(stack.pop()), int(stack.pop())))
    print(*stack)


if __name__ == '__main__':
    main()



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

using namespace std;

struct bank {
	int n, r, t;
};

double pow(double a, int b) {
	double ret = 1;
	for (int i = 0; i < b; ++i)
		ret *= a;

	return ret;
}

int main() {
	int n;

	while (cin >> n, n) {
		int y; cin >> y;

		int max_r[2] = {-1, -1};
		int max_b[2];
		for (int i = 0; i < n; ++i) {
			int b, r, t; cin >> b >> r >> t;
			if (r > max_r[t-1]) max_r[t-1] = r, max_b[t-1] = b;
		}

		double max_g = -1;
		int ans;

		if (max_r[0] >= 0) {
			max_g = 1 + y * (double)max_r[0] / 100;
			ans = max_b[0];
		}

		if (max_r[1] >= 0 && pow(1 + (double)max_r[1] / 100, y) > max_g)
			ans = max_b[1];

		cout << ans << endl;
	}
}

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

const int MAX_N = 200005;
const int MAX_Q = 100005;

struct UF {
  vector<int> par, depth;
  //Initilize
  void init(int n) {
  	par.resize(n);
    depth.resize(n);
    rep(i, n) par[i] = i;
    rep(i, n) depth[i] = 0;
  }

  //search root
  int find(int x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
  }

  //unite x to y
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return ;
    if (depth[x] < depth[y]) par[x] = y;
    else {
      par[y] = x;
      if (depth[x] == depth[y]) depth[x]++;
    }
  }

  //check
  bool same(int x, int y) {
    return find(x) == find(y);
  }
};
    
int main() {
  int n,k,l; scanf("%d %d %d",&n,&k,&l);
  UF x,y;
  x.init(n);
  y.init(n);
  rep(i, k) {
    int a,b;
    scanf("%d %d",&a,&b);
    a--;
    b--;
    x.unite(a, b);
  }
  rep(i, l) {
    int a,b;
    scanf("%d %d",&a,&b);
    a--;
    b--;
    y.unite(a, b);
  }
  map<pair<int, int>, int> ma;
  rep(i, n) {
    pair<int, int> p(x.find(i), y.find(i));
    ma[p]++;
  }
  rep(i, n) {
    pair<int, int> p(x.find(i), y.find(i));
    printf("%d ", ma[p]);
  }
  printf("\n");
}


Measured memory_bytes: 15104
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define pii pair<int,int>
#define pli pair<ll,int>
#define pil pair<int,ll>
#define pll pair<ll,ll>
#define mat vector<vector<int>>
const int inf = 1 << 30;
const ll linf = 1e18;
const db EPS = 1e-7;
template<class T> void chmin(T& x, T y){if(x > y) x = y;}
template<class T> void chmax(T& x, T y){if(x < y) x = y;}

int N, D, A;
ll imos[200010];
vector<pll> ms;
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> N >> D >> A;
    for(int i = 0; i < N; ++i){
        ll X, H;
        cin >> X >> H;
        ms.emplace_back(pll{X, H});
    }
    sort(ms.begin(), ms.end());
    ll ans = 0;
    for(int i = 0; i < N; ++i){
        ll rest = ms[i].second - imos[i] * A;
        if(rest > 0){    
            ll add = (rest - 1) / A + 1;
            ans += add;
            int it = upper_bound(ms.begin(), ms.end(), pll{ms[i].first + 2 * D, inf}) - ms.begin();
            imos[it] -= add;
            imos[i] += add;
        }
        imos[i + 1] += imos[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 6512
//by rko27
//One more....
//---------------------------------------------------------------------------------------------------------------------------------------------------

#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int  long long 
#define ll  long long 
#define pb push_back
#define mp make_pair
#define fe first
#define se second
#define nl "\n"
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(x) (int)(x.size())
#define god ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

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

const long double pi = 3.14159265358979323;
int mod=1000000000+7;
int modu=998244353;

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

ll power(ll x,ll y){ll res=1;x=x;while(y>0){if(y&1)res=(res*x);y=y>>1;x=(x*x);}return res;}
ll powe(ll x, ll y){ x = x%mod, y=y%(mod-1);ll ans = 1;while(y>0){if (y&1){ans = (1ll * x * ans)%mod;}y>>=1;x = (1ll * x * x)%mod;}return ans;}
void fun()
{
	//#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//#endif
	//786
}
bool isPrime(int n){for(int i=2;i*i<=n;i++)if(n%i==0) return false;return true;}
ll ncr(ll n,ll r){ll res=1;if(r>n)return 0;if(r>n-r)r=n-r;for(ll i=0;i<r;i++){res*=(n-i);res/=(i+1);}return res;}

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

const int N=1e6+7;
std::vector<int> v[N];

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



//--------------------------------------------------------------------------------------------------------------------------------------------------------
signed main() 
{
	god;
	//rko;
	fun();
	int ttt=1; //cin>>ttt;
	while(ttt--)
	{
		int n,m; cin>>n>>m; swap(n,m);
		int sum=0;
		int a[n];
		for(int i=0;i<n;i++) cin>>a[i], sum+=a[i];
		if(m>=sum) cout<<m-sum;
		else cout<<-1;
	}
	return 0;
}

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

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

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

    // start
    vector<int> a(3);
    rep(i, 3) cin >> a.at(i);
    sort(all(a));
    int res = 0;
    res += a.at(1) - a.at(0);
    res += a.at(2) - a.at(1);
    cout << res << endl;
    // end

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
    long long N, T; cin >> N >> T;
    long long t[N];
    for(int i = 0; i < N; i++) cin >> t[i];
    long long ans = T;
    for (int i = 1; i < N; i++)
    {
        ans += min(t[i] - t[i-1], T);
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
const ll MOD = 1000000007;

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') cout << "vowel" << endl;
  else cout << "consonant" << endl;
  return 0;
}

Measured memory_bytes: 256
class UnionFind():
    def __init__(self,n):
        self.n=n
        self.parents = [i for i in range(n+1)]
        self.size = [1]*(n+1)
    def find(self,x):
        if self.parents[x]==x:
            return x
        else:
            self.parents[x]=self.find(self.parents[x])
            return self.parents[x]
    def unite(self,x,y):
        xRoot = self.find(x)
        yRoot = self.find(y)
        if xRoot == yRoot:
            return
        if self.size[xRoot]>self.size[yRoot]:
            self.parents[yRoot] = xRoot
            self.size[xRoot] += self.size[yRoot]
            self.size[yRoot] = 0
        else:
            self.parents[xRoot] = yRoot
            self.size[yRoot] += self.size[xRoot]
            self.size[xRoot] = 0

N,M = map(int,input().split())
tree = UnionFind(N)
for _ in range(M):
    a,b = map(int,input().split())
    tree.unite(a,b)

print(max(tree.size))


Measured memory_bytes: 82288
N=int(input())
L=list(map(int, input().split()))
A=sorted(L)
a=len(A)
cnt=0
if a<=2:
  print(0)
  exit()
for i in range(a-2):
  for j in range(i,a-1):
    for k in range(j,a):
      if A[i]+A[j]>A[k] and A[i]!=A[j] and A[i]!=A[k] and A[j]!=A[k]:
        cnt+=1
print(cnt)

Measured memory_bytes: 9196
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    if(k==10)
    {
        string a=to_string(n);
        cout<<a.size()<<endl;
    }
    else
    {
        vector<int>b;
        while(n!=0)
        {
            n=n/k;
            b.push_back(n%k);
        }
        cout<<b.size()<<endl;
    }

}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
const int maxn=444,mod=998244353;
#define MP make_pair
#define PB push_back
#define lson o<<1,l,mid
#define rson o<<1|1,mid+1,r
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define ROF(i,a,b) for(int i=(a);i>=(b);i--)
#define MEM(x,v) memset(x,v,sizeof(x))
inline ll read(){
	char ch=getchar();ll x=0,f=0;
	while(ch<'0' || ch>'9') f|=ch=='-',ch=getchar();
	while(ch>='0' && ch<='9') x=x*10+ch-'0',ch=getchar();
	return f?-x:x;
}
inline int qmo(int x){return x+(x>>31?mod:0);}
int n,a[maxn],b[maxn],as,bs,f[maxn][maxn],C[maxn][maxn],ans;
inline int qpow(int a,int b){
	int ans=1;
	for(;b;b>>=1,a=1ll*a*a%mod) if(b&1) ans=1ll*ans*a%mod;
	return ans;
}
int main(){
	n=read();
	FOR(i,1,n) as+=a[i]=read(),bs+=b[i]=read();
	FOR(i,0,bs) C[i][0]=C[i][i]=1;
	FOR(i,1,bs) FOR(j,1,i-1) C[i][j]=qmo(C[i-1][j]+C[i-1][j-1]-mod);
	f[0][0]=1;
	int asinv=qpow(as,mod-2);
	FOR(i,1,n) ROF(j,as,a[i]) ROF(k,bs,0){
		int pr=1,fac=1ll*a[i]*asinv%mod;
		FOR(t,0,min(b[i]-1,k)){
			f[j][k]=qmo(f[j][k]-1ll*f[j-a[i]][k-t]*C[k][t]%mod*pr%mod);
			pr=1ll*pr*fac%mod;
		}
	}
	FOR(j,0,as) FOR(k,0,bs) ans=qmo(ans+1ll*f[j][k]*qpow(1ll*as*qpow(j,mod-2)%mod,k+1)%mod-mod);
	printf("%d\n",qmo(-ans));
}

Measured memory_bytes: 5168
n, a, b = map(int, input().split())
xlist = list(map(int, input().split()))

prevx = xlist[0]
c = 0
for x in xlist[1:]:
  if (x - prevx) * a > b:
    c += b
  else:
    c += (x - prevx) * a
  prevx = x
print(c)

Measured memory_bytes: 15020
#include <cstdio>
#include <cctype>
#include <utility>
#include <vector>
#include <string>
#include <functional>
using namespace std;

#define gcu getchar_unlocked
#define pcu putchar_unlocked
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _vo _il void out
#define _vl _il void outl
_vo(bool b) {pcu('0'+b);}
_vo(const char *s){while(*s)pcu(*s++);}
_vo(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_vo(string s){for(char c:s)pcu(c);}
#endif
_T _vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
_vl(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _vo(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _vo(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _vl(T&&... t){out(move(t)...);outl();}

using VV = vector<string>;
using P = pair<int, char>;

int main() {
	for (int w, h; w = in(), h = in();) {
		VV m(h);
		int B = 0, W = 0;
		for (auto &y: m)
			scan(y);
		function<P(int, char)> f = [&](int x, int y) {
			char &t = m[y][x];
			if (t == 'B' || t == 'W')
				return P{0, t};
			t = 'x';
			int rx = 1, ry = 0;
			P r = {1, 'N'};
			for (int i = 0; i < 4; i++) {
				int nx = x + rx, ny = y + ry;
				if (nx >= 0 && ny >= 0 && nx < w && ny < h && m[ny][nx] != 'x') {
					P x = f(nx, ny);
					r.first += x.first;
					r.second = x.second == 'C' ? 'C' :
						x.second + r.second == 'W' + 'B' ? 'C' :
						r.second == 'N' ? x.second : r.second;
				}
				swap(rx, ry *= -1);
			}
			return r;
		};
		for (int i = 0; i < h; i++)
			for (int j = 0; j < w; j++)
				if (m[i][j] == '.') {
					P r = f(j, i);
					if (r.second == 'B')
						B += r.first;
					else if (r.second == 'W')
						W += r.first;
				}
		outl(B, ' ', W);
	}
}


Measured memory_bytes: 2960
D, G = list(map(int, input().split()))
PC = [list(map(int, input().split())) for _ in range(D)]

#G点のために、

answer = 1e10

from itertools import product

for x in product([0,1], repeat=D):
  #print(x)
  
  temp_score = 0 
  temp_q = 0
  rest = None
  
  for i, _x in enumerate(x):
    if _x:
      temp_score += (i+1)*100*PC[i][0] + PC[i][1]
      temp_q += PC[i][0]
    else:
      rest = i
  #print(temp_score, temp_q, rest)
  if temp_score >= G:
    answer = min(answer, temp_q)
  
  if temp_score < G and (G-temp_score) < PC[rest][0] * (100*(rest+1)):
    answer = min(answer, temp_q + (G-temp_score)//(100*(rest+1)) + bool((G-temp_score)%(100*(rest+1))))
    

print(answer)
      
    


Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
#define int long long 
#define REP(i, s, e) for(int i = (int)(s); i < (int)(e); ++i)
#define rep(i, n) REP(i, 0, n)
using ll = int;
const int INF = 1e9;
ll SQ(ll x) {return x*x;}

signed main() {
  int n, m;
  while(cin >> n >> m) {
    if(n == 0 && m == 0) break;
    vector<int> c(m), x(n);
    rep(i, m) cin >> c[i];
    rep(i, n) cin >> x[i];
    vector<int> cur(256, INF);
    cur[128] = 0;
    rep(i, n) {
      vector<int> nxt(256, INF);
      rep(j, m) {
	rep(k, 256) {
	  int tmp = k + c[j];
	  if(tmp < 0) tmp = 0;
	  if(tmp > 255) tmp = 255;
	  nxt[tmp] = min((ll)nxt[tmp], cur[k]+SQ(x[i] - tmp));
	}
      }
      swap(cur, nxt);
    }
    int ans = INF;
    for(auto& x : cur) ans = min(ans, x);
    cout << ans << endl;
  }
  return 0;
}



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

int main() {
  string s;
  int q,t,f;
  char c;
  int reverse=0;
  cin >> s >> q;
  deque<char> deq;
  for(int i=0;i<(int)s.size();i++) deq.push_back(s[i]);
  for(int i=0;i<q;i++){
    cin >> t; reverse += t;
    if(t==2){
      cin >> f >> c;
      if((f+reverse)%2==1) deq.push_front(c);
      else deq.push_back(c);
    }
  }
  if(reverse%2==1){
    for(int i=(int)deq.size()-1;i>=0;i--){
      cout << deq[i];
    }
  }
  else{
    for(int i=0;i<(int)deq.size();i++){
      cout << deq[i];
    }
  }
  cout << endl;
}


Measured memory_bytes: 1024
#include<iostream>
using namespace std;
int main()
{
    int a,b,c,x,cnt=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a&&500*i<=x;i++)
        for (int j=0;j<=b&&100*j+500*i<=x;j++)
            for (int k=0;k<=c&&50*k+100*j+500*i<=x;k++)
                if(500*i+100*j+50*k==x) cnt++;
    cout<<cnt<<endl;
    return 0;
}

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

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)n; ++i)
#define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i)
#define each(i,c) for(__typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define all(v) v.begin(), v.end()
#define mset(a, n) memset(a, n, sizeof(a))

typedef long long ll;

const int INF = 1000000000;
const int MOD = 1000000007;

int main(int argc, char const *argv[])
{
	int x, y, z, K;
	cin >> x >> y >> z >> K;
	vector<ll> a(x), b(y), c(z);
	rep(i, a.size()) cin >> a[i];
	rep(i, b.size()) cin >> b[i];
	rep(i, c.size()) cin >> c[i];

	sort(all(a), greater<ll>());
	sort(all(b), greater<ll>());
	sort(all(c), greater<ll>());

	/* O(K^2logK) */
	vector<ll> ab, abc;
	rep(i, min((int)a.size(), K)) rep(j, min((int)b.size(), K)) ab.push_back(a[i] + b[j]);
	sort(all(ab), greater<ll>());
	rep(i, min((int)ab.size(), K)) rep(j, min((int)c.size(), K)) abc.push_back(ab[i] + c[j]);
	sort(all(abc), greater<ll>());
	// rep(i, K) cout << abc[i] << endl;

	/* O(Klog^3K) */
	vector<ll> sum;
	rep(i, a.size()) rep(j, b.size()) rep(k, c.size()) {
		if ((i+1) * (j+1) * (k+1) <= K) sum.push_back(a[i] + b[j] + c[k]);
		else break;
	}
	sort(all(sum), greater<ll>());
	// rep(i, K) cout << sum[i] << endl;

	/* O(KlogK) */
	priority_queue<tuple<ll, int, int, int>> pq;
	pq.push(make_tuple(a[0] + b[0] + c[0], 0, 0, 0));

	set<tuple<int, int, int>> st;
	rep(i, K) {
		auto e = pq.top(); pq.pop();
		cout << get<0>(e) << endl;
		// cout << get<0>(e) << ' ' << get<1>(e) << ' ' << get<2>(e) << ' ' << get<3>(e) << endl;

		int ea = get<1>(e), eb = get<2>(e), ec = get<3>(e);
		ll sum;
		tuple<int, int, int> ne;

		if (ea+1 < x) {
			sum = a[ea+1] + b[eb] + c[ec];
			ne = make_tuple(ea+1, eb, ec);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea+1, eb, ec));
				st.insert(ne);
			}
		}

		if (eb+1 < y) {
			sum = a[ea] + b[eb+1] + c[ec];
			ne = make_tuple(ea, eb+1, ec);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea, eb+1, ec));
				st.insert(ne);
			}
		}

		if (ec+1 < z) {
			sum = a[ea] + b[eb] + c[ec+1];
			ne = make_tuple(ea, eb, ec+1);
			if (st.count(ne) == 0) {
				pq.push(make_tuple(sum, ea, eb, ec+1));
				st.insert(ne);
			}
		}

	}
	return 0;
}

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

#define Int register int
#define int long long
#define MAXN 2005

template <typename T> inline void read (T &t){t = 0;char c = getchar();int f = 1;while (c < '0' || c > '9'){if (c == '-') f = -f;c = getchar();}while (c >= '0' && c <= '9'){t = (t << 3) + (t << 1) + c - '0';c = getchar();} t *= f;}
template <typename T,typename ... Args> inline void read (T &t,Args&... args){read (t);read (args...);}
template <typename T> inline void write (T x){if (x < 0){x = -x;putchar ('-');}if (x > 9) write (x / 10);putchar (x % 10 + '0');}

int n,x,val[MAXN],minn[MAXN][MAXN];

signed main(){
	read (n,x);
	for (Int i = 1;i <= n;++ i) read (val[i]);
	for (Int i = 1;i <= n;++ i){
		minn[i][i] = val[i];
		for (Int j = i + 1;j <= n;++ j) minn[i][j] = min (minn[i][j - 1],val[j]);
	}
	int ans = 0x7f7f7f7f7f7f7f;
	for (Int i = 0;i <= n;++ i){
		int res = 0;
		for (Int j = 1;j <= n;++ j){
			int k = j - i;
			if (k <= 0) res += min (minn[n + k][n],minn[1][j]);
			else res += minn[k][j];
		}
		ans = min (ans,res + i * x);
	}
	write (ans),putchar ('\n');
	return 0;
} 

Measured memory_bytes: 26248
#include <iostream>
#include <numeric>
#include <algorithm>
#include <vector>
#include <array>
#include <string>
#include <queue>
#include <cmath>
#include <iterator>
#include <math.h>
#include <cstdio>
#include <map>
#include <set>
#include <unordered_map>

using namespace std;
using lli = long long int;
using ulli = unsigned long long int;

void judge_outer(bool judge_exp,string ok = "Yes",string ng = "No"){
    if(judge_exp){
        cout << ok << endl;
    }else{
        cout << ng << endl;
    }
}


int main(void){
    int a,b,k;
    cin >> a >> b >> k;
    for(int i=a;i<b+1;i++){
        if(a <= i && i < a+k){
            cout <<i << endl;
            cerr << "a" << endl;
        }else if(b >= i && i > b-k){
            cout << i << endl;
            cerr << "b" << endl;
        }
    }
    
    return 0;
}


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

int main() {
    int n;
    string s, t, ans = "";
    cin >> n >> s >> t;
    for (int i = 0; i < n; i++) {
        ans += s[i];
        ans += t[i];
    }
    return cout << ans << "\n", 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
int main()
{
	long long mod=(1e+9)+7;
	long long n,m;
	cin>>n>>m;
	static long long sum_x,sum_y;
	vector<long long> x(n+10),y(m+10);
	for(ll i=1;i<=n;i++) cin>>x[i];
	for(ll i=1;i<=m;i++) cin>>y[i];
	for(ll i=1;i<=n;i++){
		sum_x+=(i+i-n-1)*x[i];
		sum_x%=mod;
	}
	for(ll i=1;i<=m;i++){
		sum_y+=(i+i-m-1)*y[i];
		sum_y%=mod;
	}
	cout<<(sum_x*sum_y)%mod<<endl;
}

Measured memory_bytes: 1792
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cmath>
#include<stack>
#include<map>
#include<queue>
using namespace std;
int main() {
	int n, a, b, c, ans = 0;
	cin >> n >> a >> b;
	for (int i = 0; i < n; i++) {
		cin >> c;
		if (!(a <= c && c < b))ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
char map[8][8];
void dfs(int a, int b){
  map[a][b] = '0';
  for(int i = -3; i <= 3; i++){
    if(a + i >= 0 && a + i < 8 && map[a+i][b] == '1') dfs(a+i, b);
    if(b + i >= 0 && b + i < 8 && map[a][b+i] == '1') dfs(a, b+i);
  }
}
void print_map(){
  for(int i = 0; i < 8; i++){
    for(int j = 0; j < 8; j++){
      cout << map[i][j];
    }
    cout << endl;
  }
}
int main(void){
  int n, a, b;
  cin >> n;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 8; j++){
      for(int k = 0; k < 8; k++){
        cin >> map[j][k];
      }
    }
    cin >> a >> b;
    cout << "Data " << i + 1 << ":" << endl;
    dfs(b - 1, a - 1);
    print_map();
  }
  return 0;
}

Measured memory_bytes: 1164
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

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

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt();

            if (n == 1) {
                out.println("Hello World");
            } else {
                int a = in.nextInt();
                int b = in.nextInt();

                out.println(a + b);
            }
        }

    }

    static class InputReader {
        private BufferedReader br;
        private StringTokenizer st;

        public InputReader(InputStream inputStream) {
            br = new BufferedReader(new InputStreamReader(inputStream));
            st = new StringTokenizer("");
        }

        public String nextString() {
            while (!st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(br.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextString());
        }

    }
}



Measured memory_bytes: 23252
import sys
import heapq
from operator import itemgetter
from collections import deque, defaultdict
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
MOD = 10**9 + 7

def sol():
    N, W = map(int, input().split())
    items = [tuple(map(int, input().split())) for _ in range(N)]

    dp = [float('inf')] * (10**5 + 1)
    dp[0] = 0

    for w, v in items:
        for value in range(10**5 + 1)[:: -1]:
            if value - v >= 0:
                dp[value] = min(dp[value], dp[value - v] + w)

    ans = 0
    for v in range(10**5 + 1)[:: -1]:
        if dp[v] <= W:
            ans = v
            break

    print(ans)


sol()

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

#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define rep(i, a) for (int i = 0; i < (a); i++ )
#define FOR(i, m, n) for(int i = m; i < n; i++)
 
typedef pair<int,int> P;
typedef long long ll;
 
const int INF = 1001001001;
const int MOD = 1000000007;
const double PI=acos(-1);
//----------------------------------------------------------------

vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}

int main(){
    ll N;
    cin >> N;

    auto F = prime_factorize(N);
    int ans = 0;
    for (int i=0; i<F.size(); i++) {
        int j=1;
        while(1) {
            F[i].second -= j;
            ans++;
            if (F[i].second - (j+1) <0) {
                break;
            }
            j++;
        }
    }

    cout << ans << endl;


}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = 0; i <= (n); i++)
using namespace std;
typedef long long ll;
 
const ll INF = 1LL<<62;
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; }
// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

using Graph = vector<vector<int>>;

typedef pair<int, int> P;
typedef priority_queue<int, vector<int>, greater<int>> PQ;
const int MOD = 1000000007;

int main(){
    int N,M; cin >> N >> M;
    priority_queue<pair<int, int>> pq;
    rep(i,N){
        int a; cin >> a;
        pq.push(make_pair(a, 1));
    }
    rep(i,M){
        ll b, c; cin >> b >> c;
        pq.push(make_pair(c,b));    
    }

    ll ans = 0;
    rep(i,N){
        auto p = pq.top(); pq.pop();
        ans += p.first;
        if (p.second > 1){
            pq.push(make_pair(p.first, p.second-1));
        }
    }
    
    cout << ans << endl;
}



Measured memory_bytes: 5364
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

template<class T, class S>
bool chmax(T &a, const S &b){
    if(a < b){
        a = b; return true;
    }
    return false;
}
template<class T, class S>
bool chmin(T &a, const S &b){
    if(b < a){
        a = b; return true;
    }
    return false;
}




int main(){
    long long N; int K; std::cin >> N >> K;
    long long sum(0);
    for(long long i(K), i_len(N+1); i <= i_len; ++i){
        long long a((N+1)*N/2 - (N-i+1)*(N-i)/2 - i*(i-1)/2 + 1);
        sum = (sum + a) % MOD;
        if(sum < 0) sum += MOD;
    }
    std::cout << sum << std::endl;
    return 0;
}


Measured memory_bytes: 3636
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> input() {
  int m;
  cin >> m;
  int sx, sy;
  cin >> sx >> sy;
  vector<pair<int, int>> ret;
  for (int i = 1; i < m; i++) {
    int x, y;
    cin >> x >> y;
    ret.emplace_back(x - sx, y - sy);
    sx = x;
    sy = y;
  }
  return ret;
}
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  int n;
  while (cin >> n) {
    if (n == 0) return 0;
    vector<pair<int, int>> in = input();
    set<vector<pair<int, int>>> st;
    for (int i = 0; i < 4; i++) {
      vector<pair<int, int>> nxt;
      for (auto p : in) {
        nxt.emplace_back(p.second, -p.first);
      }
      st.insert(nxt);
      reverse(nxt.begin(), nxt.end());
      for (auto &p : nxt) {
        p.first *= -1;
        p.second *= -1;
      }
      st.insert(nxt);
      swap(nxt, in);
    }
    vector<int> ans;
    for (int i = 1; i <= n; i++) {
      if (st.count(input())) {
        ans.push_back(i);
      }
    }
    for (int x : ans) {
      cout << x << '\n';
    }
    cout << "+++++" << '\n';
  }
  return 0;
}



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

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

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

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

template <class T>
inline bool chmax(T& a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

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

signed main() {
  int N, R;
  cin >> N >> R;
  if (N < 10)
    R += 100 * (10 - N);
  cout << R << endl;
}

Measured memory_bytes: 256
//#include <fsociety>
#include <cmath>
#include <deque>
#include <algorithm>
#include <iterator>
#include <list>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <unordered_set>
#include <stack>
#include <string>
#include <vector>
#include <fstream>
#include <iostream>
#include <iomanip> 
#include <stdio.h>
//end of libraries ;
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// ll lmax(ll o , ll w) {if(o>w)return o; return w;}
// ll lmin(ll o , ll w) {if(o<w)return o; return w;}
#define LNF 3999999999999999999
#define INF 999999999
#define N 3000003
#define PI 3.14159265359
#define F first
#define S second
#define pb push_back
#define ll long long
#define fcin ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
using namespace std;
int n ;
string s;
int main(){
fcin;
    cin >> n;
    cin >> s;
    for(int i = 0 ; i < s.length() ; i++){
        int x  = s[i];
        x += n;
        if(x>90){
            x-=90;
            x+=64;
        }
        s[i] = char(x);
    }
    cout << s << "\n";


}

Measured memory_bytes: 3108
#include <iostream>
#include <map>

int main(){
 int N,Q;
 std::cin>>N;

 std::map<long long,long long> m;
 long long a;
 for(int i=0;i<N;i++){
  std::cin>>a;
  m[a]++;
 }

 std::cin>>Q;


 long long ans=0;
 for(auto p:m){
  ans+=p.first*p.second;
 }

 long long b,c,tmp;
 for(int i=0;i<Q;i++){
  std::cin>>b>>c;
  tmp=m[b];
  m[b]=0;
  ans-=b*tmp;
  m[c]+=tmp;
  ans+=c*tmp;

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

 return 0;
}

Measured memory_bytes: 9536
#include <bits/stdc++.h>
#define debug(x) cout << #x << " = " << x << endl;
using namespace std;
typedef long long Long;

const int MAX_N = 2e5;
Long tree[2 * MAX_N + 5];
Long dp[MAX_N + 5];
int n;

void update(int i, Long value) {
	for (tree[i += (n + 1)] = value; i > 1; i >>= 1) {
		tree[i >> 1] = max(tree[i], tree[i xor 1]);
	}
}

Long query(int l, int r) {
	Long ret = 0LL;
	for (l += (n + 1), r += (n + 1); l < r; l >>= 1, r >>= 1) {
		if (l & 1) ret = max(ret, tree[l++]);
		if (r & 1) ret = max(ret, tree[--r]);
	}
	return ret;
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> n;
	int h[n];
	Long b[n];
	for (int i = 0; i < n; i++) cin >> h[i];
	for (int i = 0; i < n; i++) cin >> b[i];
	for (int i = 0; i < n; i++) {
		dp[h[i]] = b[i] + query(0, h[i]);
		update(h[i], dp[h[i]]);
	}
	Long answer = query(0, n + 1);
	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 7296
/*#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>

#include <boost/rational.hpp>
*/
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
using ll = long long;
using ld = long double;
using pll = pair<ll,ll>;
#define rep2(i, s, n) for (ll i = (s); i < (ll)(n); i++)
#define rep3(i, n) for (ll i = 1; i < (ll)(n+1); i++)
#define rep4(i, s, n) for (ll i = (s); i < (ll)(n+1); i++)
#define repr(i,n) for (ll i = (n-1); i>=0;i--)
#define repr3(i,n) for(ll i = (n);i>0;i--)
#define repr4(i,s,n) for(ll i = (n);i>=(s);i--)
#define stlen(s) ll s.size()-1
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define cout(n) cout<<std::fixed<<std::setprecision(n)
using Graph = vector<vector<int>>;
using Graphw = vector<vector<pair<ll,ll>>>;
using mat = vector<vector<ll>>;
using vec = vector<ll>;
#define INF1  INT_MAX
#define INF2  LLONG_MAX
const double  PI =  acos(-1);
#define MOD 1000000007
/*
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部長が32の浮動小数点数型
using Real32 = mp::number<mp::cpp_dec_float<32>>;
// 仮数部長が1024の浮動小数点数型
using Real1024 = mp::number<mp::cpp_dec_float<1024>>;
// 有理数型
using Rat = boost::rational<Bint>;
*/
const int mod = 1000000007;



int main(){

int A,B,T;
cin>>A>>B>>T;
int count=0;
for(int i=1;A*i<=T+0.5;i++){
    count+=B;
}
cout<<count<<endl;

return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <stdio.h>
#include <list>
#include <numeric>
#include <stack>
#include <queue>
#include <tuple>
#include <bitset>
#include <map>
#include <math.h>
//　ceil(a/b)   (a + (b - 1))/ b
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
typedef long long ll;
typedef pair<int,int> P;
const int inf=1000000007;
const int mod=1000000007;
int dx[] = {1,-1,0,0};
int dy[] = {0,0,1,-1};

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


// ll memo[2020][2020];
// int pascal_triangle(){
//   for(int i = 0; i < 2020; i++){
//     for(int j = 0; j < i+1; j++){
//       if(j == 0 || j == i) memo[i][j] = 1;
//       else{
// 	memo[i][j] = (memo[i-1][j-1]+memo[i-1][j]);
//       }
//     }
//   }
//   return 0;
// }


// int factrial(int n){
//   if(n == 0) return 1;
//   return n*factrial(n-1);
// }

// int divisor(int a){
//   int cnt = 0;
//   for(int i=1; i <= a; i++) if(a%i == 0) cnt++;
//   return cnt;
// }

// int comb(int n, int k){
//   return fact(n) / (fact(n-k)*fact(k));
// }

string s;

int main(){
  int N;
  cin >> N;
  if(N < 1200) cout << "ABC" << endl;
  else if(N < 2800) cout << "ARC" << endl;
  else cout << "AGC" << endl;
}
  





Measured memory_bytes: 256
#include <stdio.h>

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

	int l[n];
	int i, j;
	for (i = 0; i < n; i++) {
		scanf("%d", &l[i]);
	}

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

	int flag=0;
	int sum=0;
	for (i = 0; i < n; i++) {
		if (max == l[i] && flag != 1) {
			flag=1;
		} else  {
			sum += l[i];
		}
	}

	if (max < sum) {
		printf("Yes\n");
	} else {
		printf("No\n");
	}

	return 0;
}


Measured memory_bytes: 128
#include<stdio.h>
int main(void)
{
	int CHECK = 0;
 	char S[7];
	scanf("%s",S);
 	if((S[2] == S[3]) &&(S[4] == S[5]))
      CHECK = 1;
  	if(CHECK == 1)
      printf("Yes");
  	else
      printf("No");
}

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

int main()
{
    int a, b, c, d;
    scanf("%d%d%d%d", &a, &b, &c, &d);
    int mn = max(a, c);
    int mx = min(b, d);
    printf("%d", max(0, mx-mn));
    return 0;
}


Measured memory_bytes: 256