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

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define repb(i, n) for (ll i = (n)-1; i >= 0; i--)
#define rep(i, n) repd(i, 0, n)

using namespace std;

using ll = long long;
using ul = unsigned long long;
ll mod = 1000000007;

int main() {
source:
    ll a, b, k;
    cin >> a >> b >> k;
    ll move = a - max(0LL, a - k);
    a = max(0LL, a - k);
    k -= move;
    b = max(0LL, b - k);
    cout << a << " " << b << endl;
    return 0;
}



Measured memory_bytes: 256
#include <stdio.h>
#include <cstdio>
#include <iostream>
#include <iomanip>
#include <queue>
#include <set>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <complex>

int main(){
  long long int N;
  scanf("%lld", &N);

  long long int ans1, ans2=-1, tmp;
  ans1 = (N/108)*100;
  tmp = N%108;
  for(long long int i = 0; i < 100; i++){
    if((i*108)/100 == tmp){
      ans2 = i;
      break;
    }
  }

  if(ans2 == -1){
    std::cout << ":(" << std::endl;
  }
  else{
    std::cout << ans1 + ans2 << std::endl;
  }

  return 0;
}


Measured memory_bytes: 256
use std::io::{stdin, Read};
use std::str::FromStr;


fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin.bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to token")
}


fn main() {

    let a: String = read();
    let b: String = read();
    let input: &String = &(a + &b);
    let c: f64 = input.parse().unwrap();

    if c.sqrt() as u64 * c.sqrt() as u64 == c as u64 {
        println!("Yes");
    } else {
        println!("No")
    }
}

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

int fibonacci(int n);

int F[45];

int main(){
	int n; cin>>n;
	cout<<fibonacci(n)<<endl;
}

int fibonacci(int n){
	F[0] = F[1] = 1;
	for(int i=2;i<=n;i++)
		F[i] = F[i-1]+F[i-2];
	return F[n];
}

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

const int MOD = 1e9 + 7;
const int N = 3e5;
char st[N];
int F[N], nxt[N];
int su, ans, n;
void ADD(int &t, int d)
{
    t += d;
    if (t >= MOD) t -= MOD;
}
int main()
{
    scanf("%s", st + 1);
    n = strlen(st + 1);
    for (int i = 1, j = 1; i <= n; ++ i)
    {
        j = max(j, i);
        while (j < n && st[j + 1] != st[j])
            j ++;
        for (int k = i; k <= j; ++ k) nxt[k] = j;
        i = j;
    }
    if (nxt[1] == n)
    {
        printf("%d\n", 1);
        return 0;
    }
    F[0] = 1;
    for (int i = 1; i <= n; ++ i)
    {
        ADD(F[i], F[i - 1]);
        ADD(F[nxt[i] + 1], F[i - 1]);
    }
    for (int i = n, su = 0; i >= 1; -- i)
    {
        if (su % 3 == 0) ADD(ans, F[i]);
        su += st[i] - 'a' + 1;
    }
    printf("%d\n", ans);
}


Measured memory_bytes: 1152
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include<cmath>
#include<climits>
#include<ctime>
#include<cstring>
#include<numeric>

#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define dump(a) (cerr << #a << "=" << (a) << endl)
#define DUMP(list) cout << "{ "; for(auto nth : list){ cout << nth << " "; } cout << "}" << endl;

using namespace std;


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


  int N, W;
  int x[105][2];
  int ans[105][10002];

  cin >> N >> W;
  rep(i, N){
    cin >> x[i][0] >> x[i][1];
  }

  rep(i, N+1){
    rep(j, W+1){
      if(i == 0 || j == 0){
        ans[i][j] = 0;
      } else if (j - x[i-1][1] < 0){
        ans[i][j] = ans[i-1][j];
      } else {
        ans[i][j] = max(ans[i-1][j-x[i-1][1]] + x[i-1][0], ans[i-1][j]);
      }

      // cout << ans[i][j]  << " " << i << " " << j << endl;
    }
  }

  cout << ans[N][W] << "\n";


}


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

int main(){
	int num,i,j,max,tmp,flag;
	int cnt[100],ans[100];

	memset(cnt,0,sizeof(cnt));

	while(scanf("%d",&num) != EOF){
		cnt[num-1]++;
	}

	max = -1;
	flag = 0;
	for(i = 0;i < 100;i++){
		if(max < cnt[i]){
			memset(ans,0,sizeof(ans));
			ans[0] = i+1;
			max = cnt[i];
			flag = 1;
		}else if(max == cnt[i]){
			ans[flag] = i+1;
			for(j = flag;j > 0;j--){
				if(ans[j] < ans[j-1]){
					tmp = ans[j];
					ans[j] = ans[j-1];
					ans[j-1] = tmp;
				}else{
					break;
				}
			}
			flag++;
		}
	}

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

	return 0;
}

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

#define rep(i, n) for(int i=0; i < n; i++)
#define reps(i, n) for(int i=1; i <= n; i++)
#define INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
using ll=long long;

long mod=1e9+7;


int main() {
  int n;cin>>n;
  double ans=0;
  rep(i,n){
    double x;string u;cin>>x>>u;
    if(u=="BTC")x*=380000;
    ans+=x;
  }
  cout<<setprecision(10)<<ans<<endl;
}



Measured memory_bytes: 256
def solve(a, b, c):
    l = 0; r = a;
    for i in range(80):
        t = l // 60
        p = 60*t + c
        if l <= p <= r:
            print(p)
            exit()

        l = r + b
        r = l + a

    print(-1)

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

Measured memory_bytes: 7724
#include<bits/stdc++.h>
using namespace std;
int main(){
    string s;
    bool f1 = false, f2 = false;
    cin >> s;
    int len = s.size();
    for(int i = 0; i < len; i++) {
        if(s[i] == 'C') f1=true;
        if(f1 && s[i] == 'F') f2 = true;
    }   
    if(f1 && f2) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args) {
		NewGraph g = new NewGraph();
		g.loadAdjList();
		g.topSort();
	}
}

class NewGraph {
	private int totalVertex;
	private int totalEdge;
	LinkedList<LinkedList<Integer>> adjList;
	//adjacency list of edges
	public NewGraph() { totalVertex = 0; }
	public void loadAdjList() {
		Scanner in = new Scanner(System.in);
		totalVertex = in.nextInt();
		totalEdge = in.nextInt();
		adjList = new LinkedList<LinkedList<Integer>>();
		for(int i = 0; i < totalVertex; i ++) {
			LinkedList<Integer> tmp = new LinkedList<Integer>();
			adjList.add(tmp);
		}
		
		for(int i = 0; i < totalEdge; i++) {
			int base = in.nextInt();
			int end = in.nextInt();
			adjList.get(base).add(end);
		}
		
		in.close();
	}
	
	public void topSort() {
		Stack<Integer> stack = new Stack<>();
		
		boolean[] visted = new boolean[totalVertex];
		
		for (int i = 0; i < totalVertex; i ++) {
			if (visted[i] == false) {
				topSortRecur(i, visted, stack);
			}
		}
		
		while(stack.isEmpty() == false) {
			System.out.println(stack.pop());
		}
	}
	
	public void topSortRecur(int tgt, boolean[] visted, Stack<Integer> stack) {
		visted[tgt] = true;
		List<Integer> tgtlist = adjList.get(tgt);
		for(int i = 0; i < tgtlist.size(); i++) {
			if (visted[tgtlist.get(i)] == false) {
				topSortRecur(tgtlist.get(i), visted, stack);
			}
		}
		
		stack.push(tgt);
	}
}


Measured memory_bytes: 71400
#include<bits/stdc++.h>
using namespace std;
using ull=unsigned long long;
#define mod 1000000007
#define mod2 998244353 
#define PI 3.14159265
#define ll long long
#define ld long double
#define pi pair<ll,ll>
#define pb push_back
#define vi vector<ll>
#define sz size()
#define setbits(x)  __builtin_popcount(x)
#define fi first
#define se second
#define lz length()
#define all(x) (x).begin(),(x).end()
#define scf(x) scanf("%lld",&x)
#define rep(i,n) for(ll i=0;i<n;i++)
const int INF = (int)1e9;
const ll IINF=1LL<<62;
const int maxn=10000005;

//int divr[maxn];
/**/
/*void divisor()
{for(int i=2;i<sqrt(maxn);i++)
     {
          if(!divr[i])
          {
               for(int j=i*i;j<maxn;j+=i)if(!divr[j])divr[j]=i;     
          }
     }
     for(int i=1;i<maxn;i++)if(!divr[i])divr[i]=i;
}*/
 
/*const int N=1000005;
ll n;
struct line {
    long long m, c;
    long long eval(long long x) { return m * x + c; }
    long double intersectX(line l) { return (long double) (c - l.c) / (l.m - m); }
};
vector<pair<pi,ll>> rect;
deque<line> dq;
*/
/*ll modexpo(ll a,ll b)
{
     ll ans=1LL;
     while(b>0)
     {
          if(b&1)ans=(ans*a)%mod;
          a=(a*a)%mod;
          b>>=1;
     }
     return ans;
}
*/
int main(){
     ll n;
     cin>>n;
     ll K=0;
     while(1LL*K*(K-1)/2<n)K++;
     if(1LL*K*(K-1)/2!=n){cout<<"No";return 0;}
     int num=1;
     vector<int> vec[K+1];
     for(int i=1;i<=K;i++){
          for(int j=i+1;j<=K;j++){
               vec[i].pb(num);vec[j].pb(num);num++;
          }
     }
     cout<<"Yes\n";
     cout<<K<<"\n";
     for(int i=1;i<=K;i++){
          cout<<vec[i].sz<<" ";
          for(auto it:vec[i]){
               cout<<it<<" ";
          }
          cout<<"\n";
     }
}
 
 
 
 
 

























Measured memory_bytes: 4456
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;

int main(){
    long long n, a, b;
    cin >> n >> a >> b;

    vector<long long> x(n);

    for(long long i = 0; i < n; i++){
        cin >> x[i];
    }

    vector<long long> dp(n);
    dp[0] = 0;

    for(long long i = 1; i < n; i++){
        dp[i] = dp[i-1] + min(a*abs(x[i]-x[i-1]), b);
    }

    cout << dp[n-1] << endl;
    return 0;
}

Measured memory_bytes: 4852
#include<iostream>
#include<variant>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<stack>
#include<queue>
#include<climits>
#include<set>

using namespace std;

int main() {
	int x = 0;
	cin >> x;
	long long int cnt = 0;
	for (int i = 1; i < x; i++) {
		cnt += x / i;
		if (x%i == 0)cnt--;
	}
	cout << cnt;
	return 0;
}

Measured memory_bytes: 3628
n = int(input())
s = []
for _ in range(n):
    s.append(input())
a = 0
b = 0
ans = 0
same = 0
for i in s:
    flg = False
    if i[0]=='B':
        flg = True
        b += 1
    if i[-1]=='A':
        a += 1
        if flg:
            same += 1
    for j in range(len(i)-1):
        if i[j:j+2]=='AB':
            ans += 1
ans += min(a, b)
if a == b == same > 0:
    ans -= 1
print(ans)

Measured memory_bytes: 3700
#include <algorithm>
#include <bitset>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
using ll = long long;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repk(i, k, n) for (int i = k; i < n; i++)
#define MOD 1000000007
#define INF INT32_MAX / 2
#define PIE 3.14159265358979323

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;
}
template <class T>
T GCD(T a, T b) {
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}
template <class T>
inline T LCM(T a, T b) {
    return (a * b) / GCD(a, b);
}

using namespace std;
//#inculude <bits/stdc++.h>
#define int long long

signed main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i], a[i] *= 2;
    int x = 0;
    rep(i, n) {
        if (i % 2 == 0)
            x += a[i];
        else
            x -= a[i];
    }
    x /= 2;
    rep(i, n) {
        cout << x << endl;
        x = a[i] - x;
    }
}

Measured memory_bytes: 4060
# include <iostream>
# include <algorithm>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
constexpr long long MOD = 1000000000 + 7;
constexpr long long INF = 1e17 - 10;
const double PI = acos(-1);
typedef pair<LL, LL> Pll;
typedef pair<LL, LL> Vec2;
LL h, w, n, m, s, t, ans = 0, a[10000000], b[10000000], num = 1, sum = 0, dp[3200][3200] = {};
string str;
int main() {
	cin >> n >> m;
	m /= 1000;
	while (m>-1) {
		t = a[0]; s = 0;
		while (t>-1) {
			if (m + t + s == n) {
				cout << s << " " << t << " " << m << endl;
				return 0;
			}
			t -= 2;
			s ++;
		}
		m -= 5;
		a[0]++;
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
	return 0;
}

Measured memory_bytes: 2304
#include <bits/stdc++.h>
typedef long long ll;
#define _GLIBCXX_DEBUG
#define int long long
using namespace std;
#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPR(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = a; i <= (ll)(b); i++)
#define FORD(i, a, b) for (ll i = a; i >= (ll)(b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MAXIN(x) max_element(ALL(x)) - v.begin();
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 10000007
#define MAXR 100000
#define PI 3.14159265358979323846
using namespace std;

signed main() {
    int a, b, c, k;
    cin >> a >> b >> c >> k;

    int nn = k - a;
    if (nn < 0) {
        cout << k << endl;
        return 0;
    }
    nn -= b;
    if (nn >= 0) {
        cout << (int)a - nn << endl;
    } else {
        cout << (int)a << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
int main(){
    int n,m;
    cin >> n >> m;
    int cnt=0;
    vector<ll> h(n);
    vector<bool> hantei(n,true);
    
    rep(i,n){
        cin >> h[i];
    }
    rep(i,m){
        int a,b;
        cin >> a >> b;
        a--; b--;
        if(h[a]>h[b]) hantei[b] = false;
        else if(h[a] < h[b]) hantei[a] = false;
        else{
            hantei[a] = false;
            hantei[b] = false;
        }
        
    }
    rep(i,n){
        if(hantei[i] == true) cnt++;
    }
    cout << cnt <<endl;
}

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

int main() {
	string s;
	cin >> s;
	sort(s.begin(), s.end());
	int tam = s.size(), cont = 1;
	for(int i = 0; i < tam-1; i++) {
		if(s[i] != s[i + 1]) cont++;
	}
	if(cont == 2) cout << "Yes";
	else cout << "No";
	return 0;
}

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

using namespace std;

int main() {
  int N;
  
  cin >> N;
  
  if (N == 3 || N == 5 || N == 7) {
    cout << "YES" << endl;
  } else {
    cout << "NO" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 256
//
// Binary Indexed Tree
//
// verified:
//   AOJ Course DSL_2_B Range Query - Range Sum Query (RSQ)
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_B&lang=jp
//

#include <iostream>
#include <vector>
using namespace std;



template <class Abel> struct BIT {
    vector<Abel> dat[2];
    Abel UNITY_SUM = 0;						// to be set
    
    /* [1, n] */
    BIT(int n) { init(n); }
    void init(int n) { for (int iter = 0; iter < 2; ++iter) dat[iter].assign(n + 1, UNITY_SUM); }
    
    /* a, b are 1-indexed, [a, b) */
    inline void sub_add(int p, int a, Abel x) {
        for (int i = a; i < (int)dat[p].size(); i += i & -i)
            dat[p][i] = dat[p][i] + x;
    }
    inline void add(int a, int b, Abel x) {
        sub_add(0, a, x * -(a - 1)); sub_add(1, a, x); sub_add(0, b, x * (b - 1)); sub_add(1, b, x * (-1));
    }
    
    /* a is 1-indexed, [a, b) */
    inline Abel sub_sum(int p, int a) {
        Abel res = UNITY_SUM;
        for (int i = a; i > 0; i -= i & -i) res = res + dat[p][i];
        return res;
    }
    inline Abel sum(int a, int b) {
        return sub_sum(0, b - 1) + sub_sum(1, b - 1) * (b - 1) - sub_sum(0, a - 1) - sub_sum(1, a - 1) * (a - 1);
    }
    
    /* debug */
    void print() {
        for (int i = 1; i < (int)dat[0].size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};



int main() {
    int N, Q; cin >> N >> Q;
    BIT<long long> bit(N);
    for (int query = 0; query < Q; ++query) {
        int type; cin >> type;
        if (type == 0) {
            int s, t; long long x; cin >> s >> t >> x;
            bit.add(s, t+1, x);
        }
        else {
            int s, t; cin >> s >> t;
            cout << bit.sum(s, t+1) << endl;
        }
    }
}


Measured memory_bytes: 4388
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <queue>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <fstream>
#include <stdio.h>
#include <complex>
#include <cstdint>
#include <tuple>
#include <regex>
#include <numeric>

#define M_PI       3.14159265358979323846

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef pair<int, PII> TIII;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;

//container util

//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define MOD 998244353
#define SQ(x) ((x)*(x))

char start[4][3] = { "SS", "SW", "WS", "WW" };

int main() {
	int n;
	string s, ans;
	cin >> n >> s;
	s += s[0];
	REP(i, 4) {
		string tmp_ans(start[i]);
		FOR(j, 1, n+1) {
			int x = 0;
			x ^= (tmp_ans[j] == 'S');
			x ^= (s[j] == 'o');
			if (!x) tmp_ans += tmp_ans[j - 1];
			else tmp_ans += (tmp_ans[j - 1] == 'S') ? "W" : "S";
		}
		if (tmp_ans.substr(0, 2) == tmp_ans.substr(n, 2)) {
			ans = tmp_ans;
			break;
		}
	}
	if (ans == "")cout << -1 << endl;
	else cout << ans.substr(0, n) << endl;
	return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
typedef long long li;
#define MOD 998244353
#define rep(i,n) for(int i=0;i<(n);i++)
#define df 0
template<class T> void print(const T& t){ cout << t << "\n"; }
template<class T, class... Ts> void print(const T& t, const Ts&... ts) { cout << t; if (sizeof...(ts)) cout << " "; print(ts...); }
// Container コンテナ型, map以外
template< template<class ...> class Ctn,class T>
std::ostream& operator<<(std::ostream& os,const Ctn<T>& v){
  auto itr=v.begin();
  while(itr!=v.end()){
    if(itr!=v.begin())cout << " ";
    cout << *(itr++);
  }
  return os;
}
struct modint{
  li num;

  modint(li a=0){
    num=(a%MOD+MOD)%MOD;
  }
  modint operator+(modint a) {return{(num+a.num)%MOD};} 
  modint operator-(modint a) {return{((num-a.num)%MOD+MOD)%MOD};}
  modint operator*(modint a) {return{num*a.num%MOD};}
  modint inv(modint a);
  modint operator/(modint a) {return {*this*inv(a)};}
  modint operator+=(modint a) {
    (num+=a.num)%=MOD;
    return *this;
  } 
  modint operator*=(modint a) {
    (num*=a.num)%=MOD;
    return *this;
  } 
};
modint inv(modint a){
    // unordered_map 必須 O(1)
    static unordered_map<li,modint> f;
    f[1]=1;
    if(f.find(a.num)!=f.end())return f[a.num];
    modint m=MOD%a.num;
    return f[a.num]=(modint)(MOD/a.num*(-1))*inv(m);
}

std::ostream& operator<<(std::ostream& os, const modint& m){
  // ここでストリームに obj を書き込みます。
  li a=m.num;
  a%=MOD;
  a+=MOD;
  a%=MOD;
  cout << a;
  return os;
}

std::istream& operator>>(std::istream& os,modint& m){
  // ここでストリームに obj を書き込みます。
  li a; cin >>a;
  m=a;
  return os;
}

int main(){
  int n,s; cin >>n >>s;
  vector<int> a(n); for(int& x:a) cin >>x;
  vector<modint> c(s+1);
  c[0]=1;
  rep(i,n){
    rep(_j,s+1){
      int j=s-_j;
      c[j]*=2;
      if(j-a[i]>=0) c[j]+=c[j-a[i]];
    }
    if(df)print(c);
  }
  print(c[s]);
}


Measured memory_bytes: 3624
/*        ~ABC 171~
 *    code by kazalika   */
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

const ll N = 2e6 + 6, mod = 1e9 + 7;

ll pw(ll a, ll b) {
  if (!b) return 1;
  if (b & 1) return (pw(a, b - 1) * a) % mod;
  ll v = pw(a, b / 2);
  return (v * v) % mod;
}

ll inv(ll x) {
  return pw(x, mod - 2);
}

ll fact[N], invf[N];

ll mult(ll a, ll b) {
  a %= mod, b %= mod;
  return (a * b) % mod;
}

ll cnk(ll n, ll k) {
  return mult(fact[n], mult(invf[n - k], invf[k]));
}

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

  fact[0] = 1;
  invf[0] = inv(1);
  for (int i = 1; i < N; ++i) {
    fact[i] = (fact[i - 1] * i) % mod;
    invf[i] = inv(fact[i]);
  }

  ll k, ans = 0;
  string s;
  cin >> k >> s;
  ll n = s.size();
  for (int i = 0; i <= k; ++i) {
    ll vl = mult(mult(pw(26, i), cnk(k - i + n - 1, n - 1)), pw(25, k - i));
    ans = (ans + vl) % mod;
  }
  cout << ans;

}

Measured memory_bytes: 35512
import sys
sys.setrecursionlimit(10**6)
# 連結成分
# UF tree

N,M = map(int,input().split())
n_component = N

root = list(range(N+1))
depth = [0] * (N+1)

def find_root(x):
  y = root[x]
  if x == y:
    return x
  z = find_root(y)
  root[x] = z
  return z

def merge(x,y):
  global n_component
  xx = find_root(x)
  yy = find_root(y)
  if xx == yy:
    return
  n_component -= 1
  if depth[xx] >= depth[yy]:
    root[yy] = xx
    depth[xx] += 1
  else:
    root[xx] = yy
    depth[yy] += 1
  
for _ in range(M):
  x,y,z = [int(x) for x in input().split()]
  merge(x,y)

answer = n_component
print(answer)

Measured memory_bytes: 9844
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>

#include <algorithm>
#include <bitset>
#include <complex>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#include <cassert>
#include <functional>

typedef long long ll;
using namespace std;

#ifndef LOCAL
#define debug(x) ;
#else
#define debug(x) cerr << __LINE__ << " : " << #x << " = " << (x) << endl;

template<typename T1, typename T2>
ostream &operator<<(ostream &out, const pair<T1, T2> &p) {
  out << "{" << p.first << ", " << p.second << "}";
  return out;
}

template<typename T>
ostream &operator<<(ostream &out, const vector<T> &v) {
  out << '{';
  for (const T &item : v) out << item << ", ";
  out << "\b\b}";
  return out;
}
#endif

#define mod 1000000007 //1e9+7(prime number)
#define INF 1000000000 //1e9
#define LLINF 2000000000000000000LL //2e18
#define SIZE 200010


int main() {
  int N, D, A;
  pair<int,int> Ms[SIZE];

  scanf("%d%d%d", &N, &D, &A);

  for (int i=0; i<N; i++) {
    int X, H;
    scanf("%d%d", &X, &H);
    Ms[i] = {X, H};
  }

  sort(Ms, Ms+N);

  queue<pair<ll,int>> que;
  ll sum = 0, ans = 0;

  for (int i=0; i<N; i++) {
    while(que.size() && que.front().first < Ms[i].first) {
      sum -= que.front().second;
      que.pop();
    }

    Ms[i].second -= sum;

    int att = max(0, (Ms[i].second + A - 1) / A);
    ans += att;

    debug(Ms[i].first);
    debug(att);

    sum += (ll)att * A;
    que.push({(ll)Ms[i].first + D * 2, att * A});
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 5120
S=input()

WB=['1' if i%2==1 else '0' for i in range(len(S))]

answb,ansbw=0,0
for i in range(len(S)):
  if S[i]!=WB[i]:
    answb+=1
  else:
    ansbw+=1
print(min(answb,ansbw))

Measured memory_bytes: 4084
n,m = map(int,input().split())
hi = [int(i) for i in input().split()]
#ab = [[int(i) for i in input().split()] for j in range(m)]

ab = [[] for i in range(n+1)]

for i in range(m):
    a,b = map(int,input().split())
    ab[a].append(b)
    ab[b].append(a)
    
ans = 0    

for i in range(1,n+1):
    jibun = hi[i-1]
    flag = True
    #print(len(ab[i]))
    #exit()
    for j in range(len(ab[i])):
        if jibun <= hi[ab[i][j]-1]:
            flag = False
            break
    if flag == True:
        ans += 1
        
print(ans)

Measured memory_bytes: 94492
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int a = sc.nextInt();
		// スペース区切りの整数の入力

      if(a>999){
  System.out.println("ABD");

}else{
      System.out.println("ABC");

}
    
	}
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#include<cstdio>
using namespace std;
int main()
{
      std::ios::sync_with_stdio(false);
      int n;
      int flag=0;
      cin >> n;
      while(n)
      {
            int temp=n%10;
            if (temp==7)
            {
                  flag=1;
                  break;
            }
            n=n/10;
      }
      if (flag==1) cout << "Yes" << endl;
      else cout << "No" << endl;
     return 0;
}


Measured memory_bytes: 3640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;

public class Main {

    //グローバル変数を定義

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

    void run() {
        Scanner sc = new Scanner(System.in);
        int N = sc.nextInt();
        int[] array = new int[N];
        int sum =0;

        for(int i=0; i<N; i++){
            array[i] = sc.nextInt();
            sum+=array[i]-1;
        }


        System.out.println(sum);
    }
}


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

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = Integer.parseInt(sc.next());
		int[] d = new int[N];
		for(int i = 0; i < N; i++) {
			d[i] = Integer.parseInt(sc.next());
		}
		sc.close();
		Arrays.sort(d);
		int count = 1;
		int bottom = d[N - 1];
		for(int i = N - 2; i >= 0; i--) {
			if(d[i] < bottom) {
				bottom = d[i];
				count++;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
	using namespace std;
	
	int main(){
		int n;
		cin >> n;
		if(1200<=n && n<2800){
			cout << "ARC" << endl;
		}
		if(n<1200 && n>=0){
			cout << "ABC" << endl;
		}
		if (n>=2800 && n<=4208){
			cout << "AGC" << endl;
		}
	}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

    int N, A, B, C;
    int[] len;
    int min = Integer.MAX_VALUE;

    void solve() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();
        C = sc.nextInt();
        len = new int[N];

        for (int i = 0; i < N; i++) {
            len[i] = sc.nextInt();
        }
        calcMinMP(0, 0,0, 0, 0);
        System.out.print(min);
    }

    // Aの長さがlenA、 Bの長さがlenB、Cの長さがlenC、MP が curMP の時、
    // curIndex 以降の材料を使って算出した最小の MP をグローバル変数の curMP に入れる。
    void calcMinMP(int curIndex, int curMP, int lenA, int lenB, int lenC) {
        // 最後の len[i] まで処理したので、ここで最小値を計算してreturnする。脱出条件。
        if (curIndex == N) {
            if (Math.min(Math.min(lenA, lenB), lenC) > 0) {
                int MP = (Math.abs(A - lenA) - 10) + (Math.abs(B - lenB) - 10) + (Math.abs(C - lenC) - 10);
                min = Math.min(MP + curMP, min);
                return;
            }
            else {
                return;
            }
        }

        // まだ処理すべきlen[i]があるので、次に行く。
        calcMinMP(curIndex + 1, curMP + 10, lenA + len[curIndex], lenB, lenC);
        calcMinMP(curIndex + 1, curMP + 10, lenA, lenB + len[curIndex], lenC);
        calcMinMP(curIndex + 1, curMP + 10, lenA, lenB, lenC + len[curIndex]);
        calcMinMP(curIndex + 1, curMP, lenA, lenB, lenC);
    }

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

Measured memory_bytes: 24516
#include <stdio.h>
#include <string.h>
void q1()
{
	char t[200];
	char s[200];
	int i,j,k;
	int ssize;
	int tsize;
	scanf("%s%s",s,t);
	ssize=strlen(s);
	tsize=ssize;
	for(i=0;i<tsize;i++)
	{
		j=i;k=0;
		while(k!=ssize)
		{
			if(s[j]!=t[k])
			{
				break;
			}
			k++;
			j++;
			if(j==tsize)
			{
				j=0;
			}
		}
		if(k==ssize)
		{
			printf("Yes");
			return;
		}
	}
	printf("No");
}
int main()
{
	q1();
	return 0;
} 

Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iomanip>
#include<math.h>
const double PI=acos(-1.0);
using namespace std;
int main(){
    int r;
    double ans;
    cin>>r;
    ans=2*PI*r;
    cout<<fixed<<setprecision(20)<<ans;
    return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define DUMP(v) REP(aa, (v).size()) { cout << v[aa]; if (aa != v.size() - 1)cout << " "; else cout << endl; }
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
ll max(ll a, int b) { return max(a, ll(b)); }
ll max(int a, ll b) { return max(ll(a), b); }
ll min(ll a, int b) { return min(a, ll(b)); }
ll min(int a, ll b) { return min(ll(a), b); }


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a, b;
	cin >> a >> b;
	vector<string> ans(100);
	REP(i, 100) {
		ans[i] = string(100, '.');
		REP(j, 50)ans[i][j] = '#';
	}
	a--;
	REP(i, 50) {
		REP(j, 25) {
			if (a == 0)goto hoge;
			ans[i*2][j * 2] = '.';
			a--;
		}
	}
hoge:b--;
	REP(i, 50) {
		REP(j, 25) {
			if (b == 0)goto fuga;
			ans[i*2][j * 2+50+1] = '#';
			b--;
		}
	}
fuga:;
	cout << 100 << " " << 100 << endl;
	REP(i, 100)cout << ans[i] << endl;
}


Measured memory_bytes: 256
s = list(str(input()))
import sys
if s[0] != 'A':
    print('WA')
    sys.exit()
s.remove('A')
s2 = s[1:-1]
if s2.count('C') != 1:
    print('WA')
    sys.exit()
s.remove('C')
low = list(map(str.lower, s))
if low != s:
    print('WA')
    sys.exit()
print('AC')

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

int main(){
  long long int a, b, c, k;
  cin >> a >> b >> c >> k;
  if(k <= a){
    cout << k << endl;
    return 0;
  }
  else if(k <= a+b){
    cout << a << endl;
    return 0;
  }
  else{
    cout << a - (k-a-b) << endl;
    return 0;
  }
}


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

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

bool chkmax(int &x,int y){return x<y?x=y,true:false;}
bool chkmin(int &x,int y){return x>y?x=y,true:false;}

ll readint(){
	ll x=0,f=1; char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}

const int cys=1000000007;
ll n,m,k;
char a[2005][2005];

ll mod(ll x){return x>=cys?x-cys:x;}

ll qpow(ll x,ll p){
	ll ret=1;
	for(;p;p>>=1,x=x*x%cys) if(p&1) ret=ret*x%cys;
	return ret;
}

struct matrix{
	ll a[3][3];
	matrix(){memset(a,0,sizeof(a));}
	matrix operator*(const matrix c)const{
		matrix ret;
		for(int i=1;i<=2;i++) for(int j=1;j<=2;j++) for(int k=1;k<=2;k++) ret.a[i][j]=mod(ret.a[i][j]+a[i][k]*c.a[k][j]%cys);
		return ret;
	}
}s,c;

int main(){
	n=readint(); m=readint(); k=readint();
	for(int i=1;i<=n;i++) scanf("%s",a[i]+1);
	int lr=0,ud=0;
	for(int i=1;i<=n;i++) if(a[i][1]=='#'&&a[i][m]=='#') lr++;
	for(int i=1;i<=m;i++) if(a[1][i]=='#'&&a[n][i]=='#') ud++;
	int x=0,y=0,z=0;
	for(int i=1;i<=n;i++) for(int j=1;j<=m;j++) if(a[i][j]=='#') x++;
	if(lr&&ud) return printf("1\n"),0;
	else if(!lr&&!ud) return printf("%lld\n",qpow(x,k-1)),0;
	if(lr){
		z=lr;
		for(int i=1;i<=n;i++) for(int j=1;j<m;j++) if(a[i][j]==a[i][j+1]&&a[i][j]=='#') y++;
	}
	else{
		z=ud;
		for(int i=1;i<n;i++) for(int j=1;j<=m;j++) if(a[i][j]==a[i+1][j]&&a[i][j]=='#') y++;
	}
	s.a[1][1]=1,s.a[1][2]=1;
	c.a[1][1]=x,c.a[1][2]=0,c.a[2][1]=cys-y,c.a[2][2]=z;
	ll p=k-1;
	for(;p;p>>=1,c=c*c) if(p&1) s=s*c;
	printf("%lld\n",s.a[1][1]);
	return 0;
}

Measured memory_bytes: 2176
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,0,n)
#define all(v) v.begin(), v.end()
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
struct edge {
  int to;
  ll cost;
  edge(int to, ll cost) : to(to), cost(cost) {}
};
vector<vector<edge> > G;
vector<ll> Du, Dv;
set<int> leaves;
int N, u, v;
void dfs(int tmp, int par, ll cost, vector<ll>& D) {
  if(par != -1) {
    D[tmp] = D[par] + cost;
  }
  for(auto ne: G[tmp])
    if(ne.to != par)
      dfs(ne.to, tmp, ne.cost, D);
  if(G[tmp].size() == 1) leaves.insert(tmp);
}
int main() {
  cin >> N >> u >> v;
  u--; v--;
  G = vector<vector<edge> >(N);
  Du = vector<ll>(N);
  Dv = vector<ll>(N);
  vector<int> A(N-1), B(N-1);
  rep(i, N-1) {
    cin >> A[i] >> B[i];
    A[i]--; B[i]--;
    G[A[i]].push_back(edge(B[i], 1));
    G[B[i]].push_back(edge(A[i], 1));
  }
  dfs(u, -1, 0, Du);
  dfs(v, -1, 0, Dv);
  ll ans = 0;
  for(int leaf: leaves) {
    if(Du[leaf] < Dv[leaf]) {
      ans = max(Dv[leaf]-1, ans);
    }
  }
  cout << ans << endl;
  return 0;
}


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

using namespace std;

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

  int n, l;
  cin >> n >> l;
  vector<string> vec(n);
  for (auto &v : vec) cin >> v;
  sort(vec.begin(), vec.end());
  string res;
  for (auto &v : vec) {
    res += v;
  }
  cout << res << endl;

  return 0;
}



Measured memory_bytes: 256
// #define DEBUGGING
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()

template <typename T> using V = vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T, typename U> using P = pair<T, U>;
using ll = int64_t;
using PLL = P<ll, ll>;

template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return max(low, min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { t = clamp(t, low, high); }

namespace init__ {

struct InitIO {
    InitIO() {
        cin.tie(nullptr);
        ios_base::sync_with_stdio(false);
        cout << fixed << setprecision(30);
    }
} init_io;

}

#ifdef DEBUGGING
#include "../debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

template <typename T>
T make_v(T init) { return init; }

template <typename T, typename... Tail>
auto make_v(T init, size_t s, Tail... tail) {
#define rec make_v(init, tail...)
    return V<decltype(rec)>(s, rec);
#undef rec
}

ll calc(ll h0, ll w0, ll h1, ll w1) { return abs(h0 - h1) + abs(w0 - w1); }

int main() {
    ll H, W;
    cin >> H >> W;
    V<PLL> lr(H);
    const PLL invalid(-1, -1);
    for(ll i = 0; i < H; i++) {
        string S;
        cin >> S;
        PLL p = invalid;
        for(ll j = 0; j < W; j++) if(S[j] == 'B') {
            p.first = j;
            break;
        }
        for(ll j = W - 1; 0 <= j; j--) if(S[j] == 'B') {
            p.second = j;
            break;
        }
        lr[i] = p;
    }

    ll ans = 0;
    for(ll i = 0; i < H; i++) {
        if(lr[i] == invalid) continue;
        ll hi = i, li, ri;
        tie(li, ri) = lr[i];
        for(ll j = i; j < H; j++) {
            if(lr[j] == invalid) continue;
            ll hj = j, lj, rj;
            tie(lj, rj) = lr[j];
            chmax(ans,
                  calc(hi, li, hj, rj),
                  calc(hi, ri, hj, lj));
        }
    }

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



Measured memory_bytes: 3240
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  vector<int> p(n);
  for (int i=0;i<n;i++){
    cin >> p.at(i);
  }
  
  int c=0;
  vector<int> tmp(3);
  for (int i=0;i<n-2;i++){
    tmp.at(0)=p.at(i);
    tmp.at(1)=p.at(i+1);
    tmp.at(2)=p.at(i+2);
    sort(tmp.begin(),tmp.end());
    if(tmp.at(1)==p.at(i+1))c++;
  }
  
  cout <<c<<endl;

}

Measured memory_bytes: 256
package main

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

func main() {
	sc := NewScanner()
	A := sc.NextInt()
	B := sc.NextInt()

	for i := 1; i <= 100000; i++ {
		if i*8/100 == A && i*10/100 == B {
			fmt.Println(i)
			return
		}
	}
	fmt.Println(-1)
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


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

#define REP(i, m, n) for (int i = (m); i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define rrep(i, x) for (int i = ((int)(x)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define pb push_back
#define mp make_pair
typedef long long ll;
const ll INF = 1LL << 60;
const ll mod = 1e9 + 7;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}

ll modpow(ll a, ll p)
{
    if (p == 0)
        return 1;
    if (!(p % 2))
    {
        ll halfP = p / 2;
        ll half = modpow(a, halfP);
        return half * half % mod;
    }
    else
    {
        return a * modpow(a, p - 1) % mod;
    }
}

ll comb(int a, int b)
{
    if (b > a - b)
        return comb(a, a - b);
    ll ansMul = 1;
    ll ansDiv = 1;
    for (int i = 0; i < b; i++)
    {
        ansMul *= a - i;
        ansDiv *= i + 1;
        ansMul %= mod;
        ansDiv %= mod;
    }
    ll ans = ansMul * modpow(ansDiv, mod - 2) % mod;
    return ans;
}

/*
int num = 200010;
vector<ll> fact(num), ifact(num);
fact[0] = 1;
fact[1] = 1;
for (int i = 2; i < num; i++) {
    fact[i] = fact[i-1] * i;
    fact[i] %= mod;
}
for (int i = 0; i < num; i++) {
    ifact[i] = modpow(ifact[i], mod-2);
    ifact[i] %= mod;
}
*/

int main() {
    int N, H; cin >> N >> H;
    vector<int> a(N), b(N);
    int maxa = 0;
    rep(i, N) {
        cin >> a[i] >> b[i];
        maxa = max(maxa, a[i]);
    }
    b.pb(maxa);
    sort(all(b));
    int id = lower_bound(all(b), maxa) - b.begin();
    id = N - id;
    sort(rall(b));
    ll sums = 0;
    int i = 0;
    while (sums < H) {
        if (i == id) {
            i += ((H - sums) + (maxa - 1)) / maxa;
            break;
        }
        sums += b[i++];
    }

    cout << i << endl;
    return 0;
}

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

int N,i;
int64_t h[110],x[110],y[110];
int cx,cy;
int64_t memo=-1,H;
int main(){
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  cin >> N;
  for(i = 0;i < N;i++){
    cin >> x[i] >> y[i] >> h[i];
  }

  for(cx = 0;cx <= 100;cx++){
    for(cy = 0;cy <= 100;cy++){
      memo = -1;
      for(i = 0;i < N;i++){
        if(h[i] == 0)continue;
        H = abs(x[i]-cx) + abs(y[i]-cy) + h[i];// 1以上
        if(memo == -1){
          memo = H;
        }else{
          if(memo != H){
            goto E;
          }
        }
      }
      memo = H;
      for(i = 0;i < N;i++){
        if(h[i] != 0)continue;
        if(H - abs(x[i]-cx) - abs(y[i]-cy) < 0)continue;
        H = abs(x[i]-cx) + abs(y[i]-cy) + h[i];
        if(memo != H){
          goto E;
        }
      }
      cout << cx <<" "<< cy <<" "<< H << endl;
      return 0;
      E:;
    }
  }
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <numeric>
#include <string.h>
#define rep(i, x) for (int i = 0; i < (int)(x); i++)
#define repn(i, x) for (int i = 1; i <= (int)(x); i++)
#define repr(i, x) for (int i = ((int)(x) - 1); i >= 0; i--)
#define reprn(i, x) for (int i = ((int)(x)); i > 0; i--)
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long int64;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const int INF = 1<<29;
const long long  INFL = 1e18;
const int MOD = 1000000007;
void solve() {
	int n; cin >> n;
	map<string, int> es;
	int64 ans = 0;
	rep (i, n) {
		string s; cin >> s;
		//文字列をソートする　
		sort(all(s));
		//mapを利用して、出現回数を管理
		//初回出現時は0,以降出現回数をカウントし、出力する
		ans += es[s];
		es[s]++;
	}
	cout << ans << endl;
	return;
}

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

Measured memory_bytes: 11136
import numpy as np
N = int(input())
A = list(map(int, input().split()))
a = []
ans = 0

for i in range(N):
    a.append(A[i]-i-1)

# 平均値ではなく、中央値を使う
b = int(np.median(a))

for i in range(N):
    ans += abs(b-a[i])

print(ans)


Measured memory_bytes: 34224
using System;
public class Hello{
    public static void Main(){
        long N = long.Parse(Console.ReadLine());
        
        string[] input = Console.ReadLine().Split(' ');
        long[] Nums = new long[N];
        for(int x = 0;x < N;x++){
            Nums[x] = long.Parse(input[x]);
        }
        int count = 0;
        while(true){
            for(int i = 0;i < N;i++){
                if(Nums[i] % 2 == 0 && Nums[i] != 0){
                    Nums[i] /= 2;
                }else{
                    Console.WriteLine(count);
                    return;
                }
                
            }
            count++;
        }
       
    }
}


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

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define POW(n) ((n)*(n))
#define ALL(a) (a).begin(),(a).end()
#define cerr if(false) cerr
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
 
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<unsigned long long> vull;

void solve(long long N, vector<long long> A){
	ll ans = 0;

	for(int i=1;i<=N;++i){
		ll pair = ((A[i-1] + A[i])/2)*2;		
		ans += pair / 2;

		if(pair == 0)continue;

		pair -= A[i-1]; A[i-1] = 0;
		A[i] -= pair;
	}

	// REP(i,N+1){
	// 	cout << A[i] << endl;
	// }

	cout << ans << endl;
}



int main(){	
	ios::sync_with_stdio(false);
	long long N;
	cin >> N;
	vector<long long> A(N+1);
	A[0] = 0;
	for(int i = 1 ; i <= N+1+1; i++){
		cin >> A[i];
	}
	solve(N, A);
	return 0;
}


Measured memory_bytes: 1792
#include <iostream>
#include <iomanip>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <tuple>

using namespace std;
typedef long long ll;

#define MAX_N 10000
int a[MAX_N];

int main() {

  // -----------------------------
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  // input

  int N;
  cin >> N;
  
  string S;
  cin >> S;

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

  int cnt = 0;

  for (int i = 0; i < N - 2; i++) {
    if (S[i] == 'A' && S[i+1] == 'B' && S[i+2] == 'C') {
      cnt++;
    }
  }

  cout << cnt << endl;
  
  return 0;
  
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
using namespace std;
int yakusuu(int a,int b){
    if(b%a==0)return a;
    else return yakusuu(b%a,a);
    
}
int main(){
    int N,X,x[100000],baisuu,k,b=0,a=0;
    cin>>N>>X;
    cin>>x[0];
    x[0]-=X;
    if(x[0]<0)x[0]*=-1;
    //baisuu=x[0];
    for(int i=1;i<N;i++){
        cin>>x[i];
        x[i]-=X;
        if(x[i]<0)x[i]*=-1;
        //if(baisuu>x[i])baisuu=x[i];
    }
    baisuu=yakusuu(x[0],x[1]);
    for(int i=2;i<N&&baisuu!=1;i++){
        b=yakusuu(x[i-1],x[i]);
        baisuu=yakusuu(b,baisuu);
    }
    /*for(int i=0;i<N;i++){
        x[i]%=baisuu;
        if(x[i]==0)a++;
        if(a==N){
            cout<<baisuu<<endl;
            return 0;
        }
    }
    for(int i=0;i<N,baisuu!=1;i++){
        if(x[i]==0);
        else if(yakusuu(baisuu,x[i])==1){
            b=1;
            cout<<b<<endl;
            return 0;
        }
        else {
            baisuu=yakusuu(baisuu,x[i]);
            for(int i=0;i<N;i++){
                x[i]%=baisuu;
            }
        }
    }*/
    cout<<baisuu<<endl;
    return 0;
}


Measured memory_bytes: 640
import java.util.Scanner;

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

    primeNumbers[0] = 0;
    primeNumbers[1] = 0;
    primeNumbers[2] = 1;
    primeNumbers[3] = 1;
    primeNumbers[4] = 0;
    for (int i = 5; i < 1000000; i++) {
      for (int j = 2; j*j <= i; j++) {
        if (i % j == 0) {
          primeNumbers[i] = 0;
          break;
        } else {
          primeNumbers[i] = 1;
        }
      }
    }

    while (sc.hasNext()) {
      int primeNumber = 0;
      int n = sc.nextInt();

      for (int i = 0; i <= n; i++) {
        primeNumber += primeNumbers[i];
      }

      System.out.println(primeNumber);
    }
  }
}

Measured memory_bytes: 25008