akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
using ll = long long ;
using P = pair<int,int> ;
using pll = pair<long long,long long>;
constexpr int INF = 1e9;
constexpr long long LINF = 1e17;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979323846;

int main(){
    int n;
    cin >> n;
    map<string,int> mp;
    mp["WA"] = 0;
    mp["AC"] = 0;
    mp["TLE"] = 0;
    mp["RE"] = 0;
    rep(i,n){
        string s;
        cin >> s;
        mp[s] ++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    return 0;
}

Measured memory_bytes: 3640
# input
n = int(input())
enemy = [int(i) for i in input().split()]
heros = [int(i) for i in input().split()]
defeat = 0

# main
for i in range(n):
  if enemy[i] > heros[i]:
    defeat += heros[i]
  else:
    defeat += enemy[i]
    extra = heros[i] - enemy[i]
    if extra >= enemy[i+1]:
      defeat += enemy[i+1]
      enemy[i+1] = 0
    else:
      defeat += extra
      enemy[i+1] -= extra

# output
print(defeat)    
      

Measured memory_bytes: 18624
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<string>
#include<algorithm>
#include<cmath>
//#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
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;}
template <class T> inline T gcd(T a, T b) {if(a==0) return b; return gcd(b%a,a);}
template <class T> inline T lcm(T a, T b) {return a * b / gcd(a,b);}
template <class T> inline T sum(vector<T> &vec) {T res=0; for (int i = 0; i < vec.size(); i++) res += vec[i]; return res;}
template <class T> inline T mpow(T a, T b) {if(b==0)return 1; T c = mpow(a,b/2);if(b%2==1)return c*c*a; return c*c;}
const int INF = 1 << 30;
const long long INFLL = 1LL << 60;
typedef pair<int, int> P;

#define REP(i,n) for (int (i)=0;(i)<(n);(i)++)
#define FOR(i,n) for (int (i)=0;(i)<(n);(i)++)
#define REPB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define FORB(i,n) for (int (i)=((n)-1);(i)>=0;(i)--)
#define SORT(A) sort((A).begin(),(A).end())

bool comp(const P & a, const P & b) {
    if (a.first > b.first) {
        return true;
    } else if (a.first == b.first && a.second <= b.second) return true;
    return false; 
}

int main() {
    
    ll H, N; cin >> H >> N;
    vll A(N), B(N);
    FOR(i,N) cin >> A[i] >> B[i];

    vector<pair<ll,ll> > C(N);
    FOR(i,N) C[i] = make_pair(A[i],B[i]);
    sort(C.begin(),C.end());

    vector<ll> dp(30000,1e9);
    dp[0] = 0;
    FOR(i,N) {
        FOR(j,H+1e4+1) {
            if (j - C[i].first >= 0) chmin(dp[j],dp[j-C[i].first]+C[i].second);
        }
    }
    //FOR(i,H+10) {cout << dp[i] << " ";} cout << endl;

    ll res = 1e9;
    for (int j = H; j <= H + 1e4; j++) {
        chmin(res,dp[j]);
    }
    cout << res << endl;
}


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

int main(){
    int n,m;
    cin >> n >> m;
    int e[n][n];
    tuple<int,int,int> edge[m];
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            if(i==j) e[i][j] = 0;
            else e[i][j] = 1000000;
        }
    }
    for(int i=0; i<m; i++){
        int a,b,c;
        cin >> a >> b >> c;
        e[a-1][b-1] = c;
        e[b-1][a-1] = c;
        edge[i] = make_tuple(a-1,b-1,c);
    }
    int d[n][n];
    for(int i=0; i<n; i++){
        for(int j=0; j<n; j++){
            d[i][j] = e[i][j];
        }
    }
    for(int k=0; k<n; k++){
        for(int i=0; i<n; i++){
            for(int j=0; j<n; j++){
                d[i][j] = min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
    int ans = 0;
    for(int i=0; i<m; i++){
        if(d[get<0>(edge[i])][get<1>(edge[i])] < get<2>(edge[i])) ans++;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 384
# AtCoder

N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

sm = sum(b)
cnt = 0

for i in range(1, N):
    if a[i-1]+1 == a[i]:
        aidx = a[i]-1
        cnt += c[aidx-1]
print(sm+cnt)


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}

int main()
{
  ll A;
  cin >> A;
  if (A < 1200)
  {
    cout << "ABC" << endl;
  }else{
    cout << "ARC" << endl;
  }
  return 0;
}

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

int main() {
    int N, M, C;
    cin >> N >> M >> C;

    int A[N][M], B[M];

    for (int i = 0; i < M; i++) cin >> B[i];

    for (int i = 0; i < N; i++) {
        for (int j = 0; j < M; j++) {
            cin >> A[i][j];
        }
    }

    int x = 0;

    for (int i = 0; i < N; i++) {
        int y = 0;

        for (int j = 0; j < M; j++) {
            y += A[i][j] * B[j];
        }

        if (y + C > 0) {
            x++;
        }
    }

    cout << x << endl;
}

Measured memory_bytes: 256
N, A, B,  = map(int,input().split())
s = 0
ans = 0
for i in range(1,N+1):
    P = str(i)
    for j in range(len(P)):
        s += int(P[j])
    if A <= s <= B:
        ans += i
        
    s = 0
print(ans)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i,n,k) for(ll i=(n);i<(k);i++)
#define ALL(a)  (a).begin(),(a).end()
const ll MOD=1000000007;
ll n,ans=0;
ll one=1;
void Main(){
    cin>>n;
    vector<ll> l(n);
    For(i,0,n)cin>>l.at(i);
    ll bit[n+10][100]={};
    For(i,0,n){
        For(j,0,64){
            bit[i+1][j]=bit[i][j]+(l[i]/(one<<j)%2);
            //cout<<bit[i][j]<<" ";
        }
        //cout<<endl;
    }
    For(i,0,n-1){
        For(j,0,64){
            int t;
            if(l[i]/(one<<j)%2==0){
                t=bit[n][j]-bit[i+1][j];
            }
            else{
                t=n-1-i-(bit[n][j]-bit[i+1][j]);
            }
            //cout<<(one<<j)*t<<" ";
            ans+=(one<<j)%MOD*t%MOD;
            ans%=MOD;
        }
        //cout<<endl;
    }
    cout<<ans<<endl;
}
int main(){
    Main();
    return 0;
}


Measured memory_bytes: 236928
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {

        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();
        int L = scanner.nextInt();

        int minZeroDiff = Integer.MAX_VALUE;

        int allSum = 0;

        for(int i=1; i<=N; i++){

            int taste = L + i - 1;

            if(Math.abs(taste) < Math.abs(minZeroDiff)){
                minZeroDiff = taste;
            }

            allSum += taste;
        }

        int trueTaste = allSum - minZeroDiff;

        System.out.println(trueTaste);
    }
}


Measured memory_bytes: 20948
import java.util.Scanner;
import java.util.ArrayList;

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

    //input
    int n = sc.nextInt();
    int k = sc.nextInt();
    ArrayList<Integer> intArray = new ArrayList<Integer>();
    for(int i = 0; i < n; i++){
      intArray.add(sc.nextInt());
    }

    //output
    //find smallest value
    int total = 0;
    for(int i = 0; i < k; i++){ //repeat k times
      int smallestInt = intArray.get(0);
      int smallestIntLocation = 0;
      for(int j = 0; j < intArray.size(); j++){
        if( intArray.get(j) < smallestInt ){
          smallestInt = intArray.get(j);
          smallestIntLocation = j;
        }
      }
      total += smallestInt;
      intArray.remove(smallestIntLocation);
    }
    System.out.println(total);

  }
}


Measured memory_bytes: 30832
#define INF 10000000000
#define MOD 1000000007

#if 1   // use_templates

#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <algorithm>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;

#define rep(i, up) for (ll i = 0; i < up; ++i)
#define repp(i, up) for (ll i = 0; i <= up; ++i)
#define rrep(i, lo, up) for (ll i = lo; i < up; ++i)
#define rrepp(i, lo, up) for (ll i = lo; i <= up; ++i)
#define eep(i, lo, up) for ((i) = (lo); (i) < (up); ++(i))
#define eepp(i, lo, up) for ((i) = (lo); (i) <= (up); ++(i))


ll gcd(ll a, ll b);

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

#endif  // end of use_templates


int main()
{
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    sort(a.begin(), a.end(), greater<ll>());
    ll k = 1;
    ll result = 0;
    result += a[0];
    ++k;
    for (ll i = 1; k < n; ++i) {
        result += a[i];
        ++k;
        if (k >= n) {
            break;
        }
        result += a[i];
        ++k;
    }
    cout << result << endl;
    return 0;
}


Measured memory_bytes: 4460
$N=<>;
map{*I=-$_;<>=~$",vec($I,$`-1,8)=$'+49for 1..<>}1..$N;
printf sort{$b-$a}map{
	$t=$_;
	map{$i=0;$i--,/2/&&($t|=$$i)for$t=~/./g}1..5;
	$_=$t;
	!/3/*y/2//
}glob'{0,2}'x$N;


Measured memory_bytes: 5148
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
using namespace std;
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define INF 1145141919810364364
#define int long long
#define all(vec) vec.begin(),vec.end()
#define P pair<int,int>
#define S second
#define F first

int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
int lcm(int x, int y) {
	return x / gcd(x, y)*y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x%i == 0)return false;
	}
	return true;
}
int kai(int x, int y) {
	int res = 1;
	for (int i = x - y + 1; i <= x; i++) {
		res *= i; res %= mod;
	}
	return res;
}
int mod_pow(int x, int y, int m) {
	int res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

int comb(int x, int y) {
	if (y > x)return 0;
	return kai(x, y) * mod_pow(kai(y, y), mod - 2, mod) % mod;
}

int h, w;
string a[1010];
queue<pair<P, int>> que;
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };
int ans;

signed main() {
	cin >> h >> w;
	for (int i = 0; i < h; i++){
		cin >> a[i];
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#')que.push({ {i,j},0 });
		}
	}
	while (!que.empty()) {
		pair<P, int> p = que.front(); que.pop();
		ans = p.second;
		int x = p.first.first, y = p.first.second;
		for (int i = 0; i < 4; i++) {
			int tx = x + dx[i], ty = y + dy[i];
			if (tx < 0 || h <= tx || ty < 0 || w <= ty || a[tx][ty] == '#')continue;
			a[tx][ty] = '#';
			que.push({ { tx,ty },p.second + 1 });
		}
	}
	cout << ans << endl;
}

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


int main() {
  int n, l;
  cin >> n >> l;
  vector<string> s(n);
  rep(i, n) cin >> s[i];

  sort(s.begin(), s.end());
  rep(i, n) cout << s[i];
  cout << endl;
}



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

int main() {
    int h, m, s;
    cin >> s;
    h = s / 3600;
    m = s / 60 - h * 60;
    s = s - m * 60 - h * 3600;
    cout << h <<":"<< m <<":"<< s << endl;
    return 0;
}



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

#define fi  first
#define se  second
#define mp  make_pair
#define pb  push_back

typedef long long ll;
typedef queue <int> qi;
typedef vector <int> vi;
typedef vector <ll> vll;
typedef map <ll, ll> mll;
typedef map <int, int> mii;
typedef pair <int, int> pii;
typedef map <char, int> mci;
typedef map <char, char> mcc;
typedef map <string, int> msi;
typedef pair <string, int> psi;
typedef map <string, string> mss;
typedef unsigned long long ull;

const ll mod = 10e9+7;
const double eps = 1e-11;
const double PI = 2 * acos(0.0);

int main() {
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    cout << min(a, b) + min(c, d) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mo 1000000007
using namespace std;
int main(){
	FASTIO
	string str;
	map<string,string> m;
	m["Sunny"]="Cloudy";
	m["Cloudy"]="Rainy";
	m["Rainy"]="Sunny";
	cin>>str;
	cout<<m[str]<<'\n';
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <cstring>
#include <map>
#include <queue>
#include <cmath>
#include <complex> // complex<double> a(1.2 , 2.3);// real(): 1.2, imag()2.3
using namespace std;

#define MOD 1000000007
#define ll long long
#define ld long double
#define FOR(i,a,b) for(ll i=(ll)a;i<(ll)b;i++)
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define mp make_pair
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define rmsame(a) sort(all(a)),a.erase(unique(all(a)), a.end())
#define rmvector(a,b) rep(i,a.size())rep(j,b.size())if(a[i]==b[j]){a.erase(a.begin()+i);i--;break;}
template<typename X> bool exist(vector<X> vec, X item){return find(all(vec), item)!=vec.end();}
ll gcd(ll a, ll b){if(b==0)return a;return gcd(b,a%b);}
ll lcm(ll a, ll b){return a/gcd(a,b)*b;}



char o(int i){
  if(i) return '+';
  else return '-';
}

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

  string s; cin >> s;
  
  rep(i,2)rep(j,2)rep(k,2){
    ll a = (s[0]-'0');
    if(i) a += (s[1]-'0');
    else a-= (s[1]-'0');
    if(j) a += (s[2]-'0');
    else a-= (s[2]-'0');
    if(k) a += (s[3]-'0');
    else a-= (s[3]-'0');
    if(a == 7){
      cout << s[0] << o(i) << s[1] << o(j) << s[2] << o(k) << s[3] << "=7" << endl;

      
      return 0;
    }
  }
  
    
  
  
  
  //cout << fixed << setprecision(16) << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int INF=1000010000;
int main() {
  cout << fixed << setprecision(9);
  int n;cin >> n;
  vector<double> p(n+1);
  for(int i=1; i<=n; i++) cin >> p[i];
  vector<vector<double>> dp(n+1,vector<double>(n+1,0));
  dp[0][0]=1.0;
  for(int i=0; i<n; i++){
    for(int j=0; j<n; j++){
      dp[i+1][j+1]+=dp[i][j]*p[i+1];
      dp[i+1][j]+=dp[i][j]*(1-p[i+1]);
    }
  }
  double ans=0;
  for(int i=n/2+1; i<=n; i++){
    ans+=dp[n][i];
  }
  cout << ans << endl;
  return 0;
}

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

#define fr(i,n) for(int i = 0; i<n; i++)
#define sz(v) (int)(v.size())
#define prin(a) cout << #a << " = " << a << endl
#define all(v) (v).begin(),(v).end()
typedef long long ll;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	
	set<string> st;
	
	int n;
	cin >> n;
	
	fr(i,n){
		string s;
		cin >> s;
		st.insert(s);
	}
	
	cout << sz(st) << endl;
}

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

int main()
{
    int N, X;
    cin >> N >> X;
    int M[N];
    int mini = 1005, sum = 0;
    for(int i = 0; i < N; ++i){
        cin >> M[i];
        mini = min(mini, M[i]);
        sum += M[i];
    }

    cout << N + (X - sum)/mini << endl;
    return 0;
}

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


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

using namespace std;

typedef long long ll;

const ll INF = 1e15;
const ll MOD = 1e9 + 7;  

int main(){
    int N;
    cin >> N;
    vector<int> a(N);
    for(int i = 0; i < N; i++) cin >> a[i];
    sort(a.begin(),a.end(),greater<>());
    ll ans = 0;
    for(int i = 0; i <= (N+1)/2 - 1; i++) ans += a[i];
    ans += ans;
    ans -= a[0];
    if(N % 2 == 1) ans -= a[(N+1)/2-1];  
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3984
from itertools import accumulate

N = int(input())

A = list(map(int, input().split()))

f = list(accumulate(A))

b = list(accumulate(A[::-1]))
# print(f)

b = b[::-1]

# print(b)
ans_list = []
for i in range(0, N-1):

    ans_list.append(abs(f[i]-b[i+1]))

print(min(ans_list))




Measured memory_bytes: 103120
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include<string.h>
#define F(i,a,n) for(int i=a; i<n; i++)


int main(){
    int n;
    scanf("%d",&n);
    printf("%lf\n",(double)n*M_PI*2);
    return 0;
}


Measured memory_bytes: 1748
import math
n, m = map(int, input().split())

def divisor(m):
    ans = []
    for i in range(1, int(math.sqrt(m)) + 1):
        if m % i == 0:
            ans.append(i)
            ans.append(m // i)

    return sorted(ans)


divs = divisor(m)
j = len(divs) - 1
while True:
    if divs[j] * n <= m:
        print(divs[j])
        break
    j -= 1


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int N,K;
  cin>>N>>K;
  map<int,int> A;
  rep(i,0,N){
    int X;
    cin>>X;
    if(A.count(X))
      A.at(X)++;
    else
      A[X]=1;
  }
  int ans=0;
  if(A.size()>K){
    vi B(A.size());
    int j=0;
    int C=A.size()-K;
    for(auto p:A){
      int k=p.first,v=p.second;
      B[j++]=v;
    }
    sort(ALL(B));
    rep(i,0,C){
      ans+=B[i];
    }
  }
  cout<<ans;
  }


Measured memory_bytes: 14336
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

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

	map<int, int> m;
	rep(i,n){
		int a;
		cin >> a;
		m[a]++;
	}

	int ma;
	cin >> ma;
	bool f = true;
	rep(i,ma){
		int a;
		cin >> a;
		if(m[a] == 0){
			f = false;
		}else{
			m[a]--;
		}
	}
	cout << (f ? "YES" : "NO") << endl;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long K,N,ans;
    cin >> K >>N;
    ans = 0;
    vector<long long> houses(N);
    for(int i =0;i<N;i++){
        cin >> houses[i];
    }
    for(int i =0;i<N-1;i++){
        ans=max(ans,houses[i+1]-houses[i]);
    }
    ans = max(ans,houses[0]+K-houses[N-1]);
    cout << K-ans;
}

Measured memory_bytes: 1792
//
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
int main(int argc, char const *argv[])
{
	vector<pair<int,int> > pair(5);
	int time[5];
	cin>>time[0]>>time[1]>>time[2]>>time[3]>>time[4];

	for (int i = 0; i < 5; ++i)
	{
		pair[i] = make_pair(0,time[i]);
		if(pair[i].second % 10 == 0){
			pair[i].first = 10;
		}else{
			pair[i].first = pair[i].second % 10;
		}
	}
	sort(pair.begin(),pair.end());
	int sum = 0;
	for (int i = 0; i < 5; ++i)
	{
		if(i>0){pair[i].second += 10 - pair[i].first;}
		sum += pair[i].second;
	}
	cout << sum << endl;
	return 0;
}

Measured memory_bytes: 256
'''
N人の「正直者」、「不親切な人」のすべての組み合わせを生成し、
正直者の証言が組み合わせに矛盾していないか確認する. 
矛盾していない組み合わせの正直者の最大数が解答.
組み合わせは bit で表現している. Nビット用意し、
1が立っていると正直者、0だと不親切な人. 
この組み合わせ状況と正直者の証言が矛盾しないか確認する.
'''
N = int(input())

evidences = [[] for _ in range(N)]
for i in range(N):
    A = int(input())
    for _ in range(A):
        x, y = map(int, input().split())
        evidences[i].append((x - 1, y))

result = 0
for i in range(1, 2 ** N):
    consistent = True
    for j in range(N):
        if (i >> j) & 1 == 0:
            continue
        for x, y in evidences[j]:
            if (i >> x) & 1 != y:
                consistent = False
                break
        if not consistent:
            break
    if consistent:
        result = max(result, bin(i)[2:].count('1'))
print(result)

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
#define PI 3.14159265358979
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repp(i, s, e) for(int i = (s); i <= (e); ++i)
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define FAST_IO() ios::sync_with_stdio(0); cin.tie(0)
template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) { for (auto x : v) os << x << " "; return os << "\n"; }
template<class U, class V>
ostream& operator<<(ostream &os, const pair<U, V> &p) { return os << "(" << p.first << "," << p.second << ")";}
 
const ll MAXN = 1e6;
ll A, B, D; 

ll gcd(ll a, ll b) {
    return b == 0 ? a : gcd(b, a%b);
}

int main() {
    cin >> A >> B;
    D = gcd(A, B);
    vector<bool> isp(MAXN + 1, true);
    vector<ll> primes;
    isp[0] = isp[1] = false;
    for(ll i = 2; i <= MAXN; ++i) {
        if(isp[i]) {
            primes.push_back(i);
            for(ll j = i * i; j <= MAXN; j += i) {
                isp[j] = false; 
            }
        }
    }
    ll cnt = 1;
    for(ll &x : primes) {
        if(D % x == 0) ++cnt;
        while(D % x == 0) D /= x;
    }
    if(D != 1) ++cnt;
    cout << cnt << "\n";
}

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

using namespace std;

int main(){
  vector<int> x(5);
  int k = 0;
  for( int i = 0; i < 5; ++i ){
    cin >> x[i];
  }
  cin >> k;
  sort(x.begin(), x.end());
  if( x[4]-x[0] > k ){
    cout << ":(" << endl;
  }else{
    cout << "Yay!" << endl;
  }
  return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<string>
#include<queue>
#include<vector>
#include<functional>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<numeric>
#include<limits>
#include<iterator>

#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i,n) for(int i=0; i<n; i++)
#define INF (1<<20)

using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<ll, char> plc;

map<ll, ll> m;
ll a[100010];

int main()
{
	int n;
	ll ans = 0,num1 = 0,num2 = 0;

	cin >> n;
	rep(i, n) {
		cin >> a[i];
		m[a[i]]++;
	}

	sort(a,a+n);
	reverse(a, a + n);
	rep(i, n) {
		if (m[a[i]] >= 4) {
			ans = max(ans, a[i] * a[i]);
		}

		if (m[a[i]] >= 2 && num1 == 0) {
			num1 = a[i];
			m[a[i]] = 0;
		}
		else if (m[a[i]] >= 2 && num1) {
			num2 = a[i];
			break;
		}
	}
	cout << max(ans, num1*num2) << endl;
	return 0;
}

Measured memory_bytes: 7296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef string str;
static const long long INF = 1LL<<58;
static const long long MOD = (ll)1e9+7;

#define endl "\n"
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i, n) for(ll i=0;i<n;i++)
#define SZ(v) (ll)((v).size())
#define WHOLE(v) (v).begin(), (v).end()
#define ASC(v) sort((v).begin(), (v).end())
#define DESC(v) sort((v).rbegin(), (v).rend())
#define INV(v) reverse((v).begin(), (v).end())
#define FOLDL(src, dst, lambda) partial_sum((src).begin(), (src).end(), (dst).begin(), lambda)
#define FOLDR(src, dst, lambda) INV(src);partial_sum((src).begin(), (src).end(), (dst).begin(), lambda);INV(dst)
#define CUMSUML(src, dst) FOLDL(src, dst, [](auto a, auto b) {return a+b;})
#define CUMSUMR(src, dst) FOLDR(src, dst, [](auto a, auto b) {return a+b;})
#define ACCUM(v, d0, lambda) accumulate((v).begin(), (v).end(), d0, lambda)
#define SUM(v, d0) ACCUM(v, d0, [](auto a, auto b) {return a+b;})
#define ERASE(v, i) v.erase(v.begin() + i)
#define UNIQ(v) ASC(v);v.erase(unique(v.begin(), v.end()), v.end())

template <typename T>void debug(T t) {cerr << t << endl;}
template <typename T, typename ...Args>void debug(T t, Args ...args) {cerr << t << " ";debug(args...);}
template <typename T>void out(T t) {cout << t << endl;}
template <typename T, typename ...Args>void out(T t, Args ...args) {cout << t << " ";out(args...);}

class Graph {
    Graph(){}
public:
    ll N;
    vector<vector<ll> > mat;
    Graph(ll sz) {
        N = sz;
        mat.assign(sz, vector<ll>(sz));
        REP(i, N){
            REP(j, N) 
                mat[i][j] = INF;
            mat[i][i] = 0;
        }
    }
    void warshall_floyd() {
        REP(i,N)REP(j,N)REP(k,N)
            mat[j][k] = min(mat[j][k], mat[j][i]+mat[i][k]);
    }
};

void solve() {
    ll N, M, R;
    cin >> N >> M >> R;
    vll r(R);
    for(auto &v:r) {cin >> v;v--;}
    Graph g(N);
    REP(i, M) {
        ll a, b, c;
        cin >> a >> b >> c;
        a--;b--;
        g.mat[a][b] = c;
        g.mat[b][a] = c;
    }
    ll ans = INF;
    g.warshall_floyd();
    ASC(r);
    do{
        ll tmp = 0;
        for(int i = 1; i < r.size(); i++) {
            tmp += g.mat[r[i]][r[i-1]];
        }
        ans = min(ans, tmp);
    }while(next_permutation(WHOLE(r)));
    out(ans);
}

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


Measured memory_bytes: 640
#include <stdio.h>
int main() {
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
if(a<=b && b<=c){
printf("%d %d %d\n",a,b,c);
}else if(b<=c && c<=a){
printf("%d %d %d\n",b,c,a);
}else if(c<=a && a<=b){
printf("%d %d %d\n",c,a,b);
}else if(a<=c && c<=b){
printf("%d %d %d\n",a,c,b);
}else if(c<=b && b<=a){
printf("%d %d %d\n",c,b,a);
}else if(b<=a && a<=c){
printf("%d %d %d\n",b,a,c);
}
return 0;
}


Measured memory_bytes: 2040
//25
#include<iostream>
#include<cmath>
#include<algorithm>

using namespace std;

int main(){
  for(int n;cin>>n,n;){
    long long b[90000];
    for(int i=0;i<n*(n+1)/2;i++){
      cin>>b[i];
    }
    int a=sqrt(double(b[0])*b[1]/b[n])+.5;
    cout<<a<<endl;
    int c[250];
    for(int i=0;i<n;i++){
      c[i]=b[i]/a;
    }
    sort(c,c+n);
    for(int i=0;i<n;i++){
      cout<<c[i]<<((i==n-1)?'\n':' ');
    }
  }
  return 0;
}

Measured memory_bytes: 1436
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <cmath>
#include <cstdio>

using namespace std;

typedef long long ll;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) for (int i = 0; i < (n); ++i)

int main(int argc, char **argv)
{
    string S;
    cin >> S;
    int a, b;
    a = atoi(S.c_str()) / 100;
    b = atoi(S.c_str()) % 100;
    if (a > 0 && a < 13 && b > 0 && b < 13) cout << "AMBIGUOUS" << endl;
    else if (a > 0 && a < 13) cout << "MMYY" << endl;
    else if (b > 0 && b < 13) cout << "YYMM" << endl;
    else cout << "NA" << endl;
    return 0;
}


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

int main() {

	using namespace std;

	int N, X, T;
	cin >> N >> X >> T;

	int add;
	if (N % X == 0) {
		add = 0;
	}
	else {
		add = 1;
	}

	cout << ((N / X) + add) * T << endl;

	return 0;

}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <numeric>
#include <map>
#include <iomanip>
#include <limits.h>

using namespace std;    
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
const bool DEBAG = false;

int main(){

    string s;
    cin >> s;

    if(s[0] == 'S'){
        cout << "Cloudy" << endl;
    }

    if(s[0] == 'C'){
        cout << "Rainy" << endl;
    }

    if(s[0] == 'R'){
        cout << "Sunny" << endl;
    }

}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
#include<cctype> 
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
 
int main(){
 
  int N,K,i;
  int ans=0;
  cin >> N >> K;
  int l[N];
  int m[K];
  rep(i,N){
    cin >> l[i];
  }
  sort(l,l+N);
  for(i=N-1;i>=N-K;i--){
    ans+=l[i];
  }
  cout << ans << endl;
  return 0;
}
 

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

string s;
string t;

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

    sort(s.begin(),s.end());
    sort(t.rbegin(),t.rend());

    if(s < t)
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

int main(){
  ll x;
  cin>>x;
  ll ans=(((x-1)/11)+1)*2;
  if((x-11*((ans-1)/2)-1)%11<=5) ans--;
  cout<<ans<<endl;
  return 0;
}




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

using namespace std;

typedef struct Item
{
   int a;
   int b;
   bool operator>(const Item& tgt) const
   {
      return (a + b) > (tgt.a + tgt.b);
   }
}Item;

int main(){
   int n;
   cin >> n;
   Item *score = new Item[n];
   for(int i=0;i<n;i++){
      int a,b;
      cin >> a >> b;
      score[i].a = a;
      score[i].b = b;
   }
   sort(score, score + n, greater<Item>());

   long ans = 0;
   for(int i=0;i + 1<n;i+=2){
      ans += score[i].a;
      ans -= score[i+1].b;
   }
   if(n%2 == 1){
      ans += score[n-1].a;
   }
   cout << ans << endl;

   /*
   for(int i=0;i<n;i++){
      cout << "a: " << score[i].a << " b:" << score[i].b << endl;
   }
   */
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int main(){
  int S;
  cin >> S;
  int a = S%100, b=S/100;
  if(a==0 && b==0) cout << "NA" << endl;
  else if((a == 0 || a >= 13) && 1 <= b && b <= 12) cout << "MMYY" << endl;
  else if((b == 0 || b >= 13) && 1 <= a && a <= 12) cout << "YYMM" << endl;
  else if(1 <= a && a <= 12 && 1 <= b && b <= 12) cout << "AMBIGUOUS" << endl;
  else cout << "NA" << endl;
  return 0;
}


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

#define all(v) v.begin(), v.end()
#define rep(i, n) REP(i, 0, n)
#define REP(i, x, n) for (int i = x; i < n; i++)
#define REPE(i, x, n) for (int i = x; i <= n; i++)
#define OP(x) cout << x << endl;
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }
template<class T> void chmax(T& a, T b) { if(a > b) a = b; }
template<class T> void chmin(T& a, T b) { if(a < b) b = a; }
typedef long long ll;

int main() {
    int x, y, z; cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << " " << y << " " << z << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
#define fi first
#define se second
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define SZ(x) (int)(x).size()
#define endl '\n'
#define FOR(a, b, c) for (auto a = (b); (a) < (c); ++(a))
#define F0R(a, b) FOR (a, 0, (b))
#define CEIL(a, b) ((a) + (b)-1) / (b)
template <class T>
bool ckmin(T& a, const T& b) {
  return a > b ? a = b, true : false;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, true : false;
}
#ifndef DEBUG
#define DEBUG 0
#endif
#define dout \
  if (DEBUG) std::cerr
#define dvar(...) " [" << #__VA_ARGS__ ": " << mt(__VA_ARGS__) << "] "
template <typename T>
struct IsC {
  template <typename C>
  static char test(typename C::const_iterator*);
  template <typename C>
  static int test(...);
  static const bool value = sizeof(test<T>(0)) == sizeof(char);
};
template <>
struct IsC<string> {
  static const bool value = false;
};
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(ostream&, const C&);
template <typename T1, typename T2>
ostream& operator<<(ostream&, const pair<T1, T2>&);
template <typename... T> using TS = tuple_size<tuple<T...>>;
template<size_t idx, typename... T>
typename enable_if<TS<T...>::value == idx + 1, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return o << ", " << get<idx>(t) << ')';
}
template<size_t idx, typename... T>
typename enable_if<0 < idx && idx + 1 < TS<T...>::value, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << ", " << get<idx>(t), t);
}
template<size_t idx = 0, typename... T>
typename enable_if<1 < TS<T...>::value && !idx, ostream&>::type
operator<<(ostream& o, const tuple<T...>& t) {
  return operator<<<idx + 1>(o << '(' << get<idx>(t), t);
}
template<typename T>
ostream& operator<<(ostream& o, const tuple<T>& t) {
  return o << get<0>(t);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2>& p) {
  return o << mt(p.fi, p.se);
}
template <typename C>
typename enable_if<IsC<C>::value, ostream&>::type operator<<(
    ostream& o, const C& c) {
  o << '[';
  for (auto it = c.cbegin(); it != c.cend(); ++it)
    o << *it << (next(it) != c.cend() ? ", " : "");
  return o << ']';
}
template <typename T>
void tprint(vector<vector<T>>& v, size_t width = 0, ostream& o = cerr) {
  if (!DEBUG) return;
  for (const auto& vv : v) {
    for (const auto& i : vv) o << setw(width) << i;
    o << endl;
  }
}

void solve() {
    int n, k;
    cin >> n >> k;

    vi a(n);
    F0R(i, n) cin >> a[i];

    FOR(i, k, n) {
        cout << (a[i - k] < a[i] ? "Yes\n" : "No\n");
    }
}

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

    int tc = 1;
    FOR(i, 1, tc + 1) {
        //cout << "Case #" << i << ": ";
        solve();
    }
}



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

int main() {
    int N;
    cin >> N;
    vector<int> A(N-1);
    for (int i = 0; i < N-1; i++) {
        cin >> A.at(i);
    }

    vector<int> buka(N);
    for (int i = 0; i < N; i++) {
        buka.at(i) = 0;
    }

    for (int i = 0; i < N-1; i++) {
        buka.at(A.at(i)-1)++;
    }

    for (int i = 0; i < N; i++) {
        cout << buka.at(i) << endl;
    }
}

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

using namespace std;
using namespace __gnu_pbds; 
  
#define ll long long
#define X first
#define Y second
#define all(x) x.begin(), x.end()
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
	enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int mod = (int)1e9 + 7;
const int MX = (int)1e5 + 10;

void add_self(int &x, int y){x += y; if(x >= mod) x -= mod;}
void sub_self(int &x, int y){x -= y; if(x < 0) x += mod;}
void mul(int &x, int y){x = x * 1LL * y % mod;}

int main(){

	cin.tie(0); cout.tie(0);
	ios_base::sync_with_stdio(0);

	int n;
	cin >> n;
	vector<int> a(n);
	unordered_map<int, int> mp;
	for(auto &x : a){
		cin >> x;
		mp[x]++;
	}	

	ll res = 0;
	for(auto &p : mp){
		int x, y;
		tie(x, y) = p;
		res += y * (y - 1LL) / 2;
	}

	// cout << res << endl;

	for(auto &x : a){
		int cnt = mp[x];
		cout << res - (cnt - 1) << "\n";
	}

	
	return 0;
}

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

int main(){
    int n,a;
    cin>>n>>a;
    vector<list<int> > l(n);
    while(a--){
        int y,t;
        cin>>y>>t;
        if(y==0){
            int x;
            cin>>x;
            l[t].push_back(x);
        }
        else if(y==1){
            for(auto it=l[t].begin();it!=l[t].end();it++){
                if(it!=l[t].begin()){
                    cout<<" ";
                }
                cout<<*it;
            }
            cout<<endl;
        }
        else{
            int s;
            cin>>s;
            l[s].splice(l[s].end(),move(l[t]));
            l[t].clear();
        }
    }
    return 0;
}


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

int main() {
  int N,cnt=0;
  int num[N];
  int flag=0;
  
  cin >> N;
  for (int i=0; i<N; i++){
    cin >> num[i];
  }
  while(flag==0){
    for (int i=0; i<N; i++){
      if (num[i]%2!=0){
        flag=1;
        break;
      }else{
        num[i]/=2;
      }
    }
    if(flag==0) cnt++;
  }
  cout << cnt << endl;
}


Measured memory_bytes: 3644
#include <bits/stdc++.h>
#define ll long  long
#define ld long double
#define mod 1000000007
#define max_char 128
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define lbd lower_bound
#define ubd upper_bound
#define PI 3.141592653589793238
#define pf push_front
#define all(x) x.begin(),x.end()
#define input(arr,n) for(ll c1=0;c1<n;c1++)cin>>arr[c1];
#define rep(i,a,n) for( ll i=a ; i<n ; i++)
#define mems(x, y) memset(x, y, sizeof(x))
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;


int main()
{
    fastio
	ll n;
	cin>>n;
	cout<<2*PI*n<<"\n";
	return 0;
}

Measured memory_bytes: 3804
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>
#include<bitset>

using namespace std;

#define ll long long int

ll const MOD = 1000000007;
ll const INF = (long long int)1 << 61;

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

    ll a = 0;
    ll b = 0;

    for(int i = 0; i < str.size(); i++){
        if(str[i] == '0'){
            a++;
        }else{
            b++;
        }
    }

    cout << min(a,b)*2 << endl;
    
    
    return 0;
}

Measured memory_bytes: 512
#include <iostream>
#include <string>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <cctype>
#define rep(i,a,b) for(int (i)=(a);i<(b);i++)
#define INF 1000000000
using namespace std;
bool debug=false;

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


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;
 
public class Main {
	public static void main(String[] args){
 
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		ArrayList<String> sortedList = new ArrayList<>();
		Map<String, Integer> map = new HashMap<>();
		long ans = 0;
		
		for(int i = 0; i < N; i++) {
			char[] c = sc.next().toCharArray();
			Arrays.sort(c);
			sortedList.add(String.valueOf(c));
 
			String s = sortedList.get(i);
			if(map.containsKey(s)) {
				int num = map.get(s) + 1;
				ans += num;
				map.put(s, num);
			}else {
				map.put(s, 0);		
			}
		}
 
		System.out.println(ans);
		sc.close();
	}
 
}

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

using namespace std;

#define rep(i,m,n) for(int (i)=(int)(m);i<(int)(n);i++)
#define rep2(i,m,n) for(int (i)=(int)(n)-1;i>=(int)(m);i--)
#define REP(i,n) rep(i,0,n)
#define REP2(i,n) rep2(i,0,n)
#define FOR(i,c) for(decltype((c).begin())i=(c).begin();i!=(c).end();++i)
#define ll long long
#define ull unsigned long long
#define all(hoge) (hoge).begin(),(hoge).end()
#define en '\n'
template <class T> using vec = vector<T>;
template <class T> using vvec = vector<vec<T>>;
typedef pair<ll, ll> P;
constexpr long long INF = 1LL << 60;
constexpr int INF_INT = 1 << 25;
constexpr long long MOD = (ll) 1e9 + 7;
typedef vector<ll> Array;
typedef vector<Array> Matrix;
constexpr int loose = 0;
constexpr int tight = 1;


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

struct Edge {
	ll to, cap, rev;
	Edge(ll _to, ll _cap, ll _rev) {
	to = _to; cap = _cap; rev = _rev;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

void add_edge(Graph& G, ll from, ll to, ll cap, bool revFlag, ll revCap) {
	G[from].push_back(Edge(to, cap, (ll)G[to].size()));
	if (revFlag)G[to].push_back(Edge(from, revCap, (ll)G[from].size() - 1));
}

ll black[101010];
ll white[101010];

void dfs(Graph& g, int v, int p){
	black[v] = 1;
	white[v] = 1;
	for(auto e:g[v]){
		if(e.to==p) continue;
		dfs(g,e.to, v);
		(white[v] *= (black[e.to]+white[e.to])%MOD) %= MOD;
		(black[v] *= white[e.to]) %= MOD;//黒に遷移できるのは白の時だけ
	}
}

void solve(){
	ll n;
	cin>>n;
	Graph g(n);
	REP(i,n-1){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		add_edge(g,x,y,1,true,1);
	}

	dfs(g,0,-1);
	cout<<(white[0]+black[0])%MOD<<en;
}

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

    solve();
    return 0;
}

Measured memory_bytes: 17792
# util functions

# debug
$debugFlag = ( ARGV[0] != nil )
p "==== DEBUG MODE ====" if $debugFlag

def pd(str)
  p str if $debugFlag
end

def printd(str)
  print str if $debugFlag
end

# input
inputs = []
lc = 0
while l = $stdin.gets do
  if false
    inputs << l.chomp.split(" ").map(&:to_s)
  else
    inputs << l.chomp.split(" ").map(&:to_i)
  end
  lc += 1
end

xx = inputs[0][2]
yy = inputs[0][3]

arrA = inputs[1]
arrB = inputs[2]

maxA = arrA.max
minB = arrB.min


# input check
if $debugFlag
  p "--- INPUT (begin) ---"
  inputs.each do |l_i|
    p l_i
  end
  p "--- INPUT (end) ---"
  print "\n"
end

# body
if $debugFlag
end

if maxA < minB and maxA > xx and minB <= yy
  puts "No War"
else
  puts "War"
end


Measured memory_bytes: 3836
using namespace std;
#include<string>
#include<cmath>
#include<list>
#include <map>
#include <unordered_map>
#include <set>
#define ll long long
#define ld long double
#define ull unsigned long long
#define ml map<ll,ll>
#define pb push_back
#define mp make_pair
#define ppl pair<ll,ll>
#define F first
#define S second
#define fio ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)

#define fr(i,a,b) for(ll i=a;i<b;i++)
#define ffr(i,a,b) for(ll i=a;i>=b;i--)
#include<bits/stdc++.h>
#include<vector>
#define vl vector<ll>
#define PI 3.141592654
const ll N = 1e9 + 7;
#include<iterator>
#define EPSILON numeric_limits<double>::epsilon()



// vector<bool> visited;
// vector<vl> v;
// ll cnt[2];

// void dfs(ll pnt, ll col) {
// 	visited[pnt] = true;
// 	cnt[col]++;
// 	fr(i, 0, v[pnt].size()) {
// 		if (!visited[v[pnt][i]])dfs(v[pnt][i], !col);
// 	}
// }



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

void solve() {
	int x; cin >> x;
	if (x)cout << 0;
	else cout << 1;
}






int main() {
	fio;
#ifndef ONLINE_JUDGE
	// for getting input
	freopen("input.txt", "r", stdin);
	//for writing output
	freopen("jout.txt", "w", stdout);
#endif
	//precompute();
	ll t;
	if (1)
		t = 1;
	else
		cin >> t;
	while (t--) {

		//cout << "Case #" << h << ": ";
		solve();
		//h++;
		cout << '\n';
	}
	return 0;
}

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

int main()
{
    int N, A, mx;
    cin >> N;
    mx = 10000;
    for (int i = 0; i < N; i++)
    {
        cin >> A;
        int j;
        for (j = 0;; j++)
        {
            if (A % 2 == 0)
            {
                A /= 2;
            }
            else
            {
                break;
            }
        }
        mx = min(mx, j);
    }
    cout << mx << endl;
}


Measured memory_bytes: 256
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]

dic = Counter(S)

tmp = max(dic.values()) # ここ重要！
ans = [key for key, value in dic.items() if value == tmp]

# もうちょいかっこいい書き方があるはず。リストを1行1str出力 and 最後に改行しないように
"""
for key in sorted(ans):
    print(key, end="")
    print("")
"""


ans.sort()
print(*ans, sep="\n")


# print(*ans, sep="\n") かっこいい書き方

Measured memory_bytes: 108496
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <climits>
#include <cmath>
#include <unordered_map>

using namespace std;

typedef long long ll;

int main(void) {
  int A, B, T;
  cin >> A >> B >> T;
  cout << (T / A) * B << endl;
}


Measured memory_bytes: 764
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;

const int N=100005;
int n,ans[N];
struct Node{
	int a;
	int id;
}node[N];

inline int read(){
	int s=0,t=1;
	char c=getchar();
	while((c>'9'||c<'0')&&c!='-')c=getchar();
   	if(c=='-')t=-1,c=getchar();
   	while(c>='0'&&c<='9')s=s*10+c-'0',c=getchar();
   	return s*t;
}

bool cmp(Node p,Node q){
	return p.a<q.a; 
}

int main(void){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",&node[i].a),node[i].id=i;
	sort(node+1,node+1+n,cmp);
	for(int i=1;i<=n;i++)
	printf("%d ",node[i].id);
}


Measured memory_bytes: 1536
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <bitset>
#include <climits>
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#define RFOR(i,a,b) for (int i=(a)-1;i>=(b);i--)
#define ll long long
#define ull unsigned long long
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin>>n;
  vector<int> a(n);
  REP(i,n){
      cin>>a[i];
  }
  sort(a.begin(),a.end());
  int ans = accumulate(a.begin(),a.end(),0);
  REP(i,n){
      if(ans % 10 != 0 || ans == 0)break;
      if(a[i] % 10 == 0)continue;
      ans -= a[i];
  }
  if(ans%10 == 0)cout << 0 << endl;
  else cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256