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

#define MAX 100000
#define MAX_E 100000

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

ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

int main(){
	int k;
	cin>>k;
	ll ans=0;
	for(int i=1;i<=k;i++){
		for(int j=1;j<=k;j++){
			for(int l=1;l<=k;l++){
				ans+=gcd(gcd(i,j),l);
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

int n, a, b, m = 1000000;
int x[100];

int main()
{
	cin >> n;

	for (int i = 0; i < n; i++)
		cin >> x[i];

	sort(x, x + n);

	a = x[0], b = x[n - 1];

	for (int j = a; j <= b; j++) {
		int t = 0;

		for (int i = 0; i < n; i++)
			t += (x[i] - j) * (x[i] - j);

		m = min(m, t);
	}

	cout << m << endl;

	return 0;
}

Measured memory_bytes: 256
N, Y = map(int, input().split())

for i in range(0, N+1)[::-1]:
  for j in range(0, N-i+1)[::-1]:
    k = N - i - j
    if 10000*i + 5000*j + 1000*k == Y:
      print(i, j, k)
      exit()
print(-1, -1, -1)



Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PP;
#define MOD 1000000007
//#define MOD 998244353
#define INF 2305843009213693951
//#define INF 810114514
#define PI 3.141592653589
#define setdouble setprecision
#define REP(i,n) for(ll i=0;i<(n);++i)
#define OREP(i,n) for(ll i=1;i<=(n);++i)
#define RREP(i,n) for(ll i=(n)-1;i>=0;--i)
#define all1(i) begin(i),end(i)
#define GOODBYE do { cout << "0" << endl; return 0; } while (false)
#define MM <<" "<<
#define Endl endl
#define debug false
#define debug2 false


int main(void){
    
    ll N,a;
    vector<ll> A;
    cin >> N;
    REP(i,N){
        cin >> a;
        A.push_back(a);
    }
    ll Ans=0;
    REP(i,N-1){
        if(A[i]>A[i+1]){
            Ans+=A[i]-A[i+1];
            A[i+1]=A[i];
        }
    }
    cout << Ans << endl;
    return 0;
}



Measured memory_bytes: 5364
#include <iostream>

int main(){
    char a, b;
    std::cin >> a >> b;

    if(a < b){
        std::cout << "<" << std::endl;
    }else if(a > b){
        std::cout << ">" << std::endl;
    }else{
        std::cout << "=" << std::endl;
    }

    return 0;
}

Measured memory_bytes: 256
# https://onlinejudge.u-aizu.ac.jp/problems/GRL_1_B
# 単一始点最短経路（負の重みをもつ辺を含む）

# 初期化、入力の処理
INF = float('inf')
edges = []
V, E, r = map(int, input().split())

for i in range(E):
    s, t, d = map(int, input().split())
    edges.append({"s": s, "t": t, "d": d})

# ベルマンフォード法
ds = [INF for i in range(V)]
ds[r] = 0
i = 0
while True:
    i = i + 1
    update = False
    for j in range(E):
        edge = edges[j]
        if ds[edge["s"]] != INF and ds[edge["t"]] > ds[edge["s"]] + edge["d"]:
            if i == V - 1:
                print("NEGATIVE CYCLE")
                exit()

            ds[edge["t"]] = ds[edge["s"]] + edge["d"]
            update = True
    if not update:
        break

for i in range(V):
    print(ds[i] if ds[i] != INF else "INF")



Measured memory_bytes: 6340
#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int>>;
#define _GLIBCXX_DEBUG
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for(int i = (s); i < (int)(n); i++)
#define chmin(x, y) x = min(x, y)
typedef long long ll;
const int INF = 1001001001;
const int mod = 1000000007;

int main() {
    int v[3][3];
    rep(i, 3) {
        rep(j, 3) { cin >> v[i][j]; }
    }
    int N;
    cin >> N;
    vector<int> b(N);
    rep(i, N) cin >> b[i];

    rep(k, N) {
        int atari = b[k];
        rep(i, 3) {
            rep(j, 3) {
                if(atari == v[i][j]) {
                    v[i][j] = -1;
                }
            }
        }
    }
    rep(i, 3) {
        if(v[i][0] == -1 && v[i][1] == -1 && v[i][2] == -1) {
            cout << "Yes" << endl;
            return 0;
        } else if(v[0][i] == -1 && v[1][i] == -1 && v[2][i] == -1) {
            cout << "Yes" << endl;
            return 0;
        }
    }
    if(v[0][0] == -1 && v[1][1] == -1 && v[2][2] == -1) {
        cout << "Yes" << endl;
        return 0;
    }
    if(v[0][2] == -1 && v[1][1] == -1 && v[2][0] == -1) {
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
A = input().split(" ")

B = int(A[0])
C = int(A[1])
Blis = list(A[0])
Clis = list(A[1])
# print(B)
# print(C)
# print(Blis)
# print(Clis)

NUM = B
kazu = 0
while NUM <= C:
    NUMlis = list(str(NUM))
    if NUMlis[0] == NUMlis[4] and NUMlis[1] == NUMlis[3]:
        kazu += 1
    NUM += 1
print(kazu)


Measured memory_bytes: 3060
#include <bits/stdc++.h>
#define MP make_pair
#define PB push_back
#define int long long
#define st first
#define nd second
#define rd third
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define RE(i, n) FOR(i, 1, n)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define REP(i, n) for(int i = 0;i <(n); ++i)
#define VAR(v, i) __typeof(i) v=(i)
#define FORE(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
template<typename TH> void _dbg(const char* sdbg, TH h) { cerr<<sdbg<<"="<<h<<"\n"; }
template<typename TH, typename... TA> void _dbg(const char* sdbg, TH h, TA... t) {
  while(*sdbg != ',')cerr<<*sdbg++; cerr<<"="<<h<<","; _dbg(sdbg+1, t...);
}
#ifdef LOCAL
#define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#define debugv(x) {{cerr <<#x <<" = "; FORE(itt, (x)) cerr <<*itt <<", "; cerr <<"\n"; }}
#else
#define debug(...) (__VA_ARGS__)
#define debugv(x)
#define cerr if(0)cout
#endif
#define next ____next
#define prev ____prev
#define left ____left
#define hash ____hash
typedef long long ll;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<pair<int, int> > VPII;
typedef vector<pair<ll, ll> > VPLL;

template<class C> void mini(C&a4, C b4){a4=min(a4, b4); }
template<class C> void maxi(C&a4, C b4){a4=max(a4, b4); }
template<class T1, class T2>
ostream& operator<< (ostream &out, pair<T1, T2> pair) { return out << "(" << pair.first << ", " << pair.second << ")";}
template<class A, class B, class C> struct Triple { A first; B second; C third;
  bool operator<(const Triple& t) const { if (st != t.st) return st < t.st; if (nd != t.nd) return nd < t.nd; return rd < t.rd; } };
template<class T> void ResizeVec(T&, vector<int>) {}
template<class T> void ResizeVec(vector<T>& vec, vector<int> sz) {
  vec.resize(sz[0]); sz.erase(sz.begin()); if (sz.empty()) { return; }
  for (T& v : vec) { ResizeVec(v, sz); }
}
typedef Triple<int, int, int> TIII;
template<class A, class B, class C>
ostream& operator<< (ostream &out, Triple<A, B, C> t) { return out << "(" << t.st << ", " << t.nd << ", " << t.rd << ")"; }
template<class T> ostream& operator<<(ostream& out, vector<T> vec) { out<<"("; for (auto& v: vec) out<<v<<", "; return out<<")"; }

    
int32_t main() {

  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(10);
  cerr << fixed << setprecision(10);
  cin.tie(0);
  //double beg_clock = 1.0 * clock() / CLOCKS_PER_SEC;
  
  int n;
  cin>>n;
  int last_sign = -1;
  int res = 0;
  int lst = -1;
  RE (i, n) {
    int a;
    cin>>a;
    if (lst == a) { continue; }
    if (lst == -1) {
      lst = a;
      continue;
    }
    int gr = a > lst;
    if (last_sign != -1 && gr != last_sign) {
      lst = a;
      res++;
      last_sign = -1;
    } else {
      lst = a;
      last_sign = gr;
    }
  }
  cout<<res + 1<<endl;
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  return 0;
}


Measured memory_bytes: 768
// kyopro.cpp : このファイルには 'main' 関数が含まれています。プログラム実行の開始と終了がそこで行われます。
//
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define rep(N) for(int i=0;i<N;i++)
#define rep2(N1,N2) for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)
#define rep3(N1,N2,N3)for(int i=0;i<N1;i++)for(int j=0;j<N2;j++)for(int k=0;k<N3;k++)

void yn(bool b) {
	if (b)printf("yes\n");
	else printf("no\n");
}

void Yn(bool b) {
	if (b)printf("Yes\n");
	else printf("No\n");
}

void YN(bool b) {
	if (b)printf("YES\n");
	else printf("NO\n");
}

int main(){
	string S;
	cin >>S;
	int N;
	N = S.size();
	bool flag = 1;
	rep((N - 1) / 4) {
		if (S[i] != S[(N - 1)/2 -1- i])
			flag = 0;
	}
	rep(N / 4) {
		if (S[(N + 3) / 2 + i-1] != S[N-1 - i])
			flag = 0;
	}
	rep(N / 2) {
		if (S[i] != S[N-1 - i])
			flag = 0;
	}

	Yn(flag);
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int n;
    cin>>n;
    double num[n],sum=0,ans;
    for(int i=0;i<n;i++){
        cin>>num[i];
        sum=sum+(1/num[i]);
        //cout<<sum<<endl;
    }
    ans=1/sum;
    cout<<ans;
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <cmath>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <complex>
#include <string.h>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <iomanip>
#include <sys/time.h>
#include <tuple>
#include <random>
using namespace std;

#define endl '\n'
#define ALL(v) (v).begin(), (v).end()
#define RALL(v) (v).rbegin(), (v).rend()
#define UNIQ(v) (v).erase(unique((v).begin(), (v).end()), (v).end())

typedef long long ll;
typedef long double ld;
typedef pair<double, double> P;
typedef tuple<int, int, int> T;
typedef vector< vector<ld> > matrix;
struct pairhash {
public:
    template<typename T, typename U>
    size_t operator()(const pair<T, U> &x) const {
	size_t seed = hash<T>()(x.first);
	return hash<U>()(x.second) + 0x9e3779b9 + (seed<<6) + (seed>>2);
    }
};
const int inf = 1e9 + 9;
const ll mod = 1e9 + 7;
const double eps = 1e-8;
const double pi = acos(-1);

int n;
string c;

int solve() {
    int r = 0;
    for (int i = 0; i < n; i++) {
        if (c[i] == 'R')
            r++;
    }
    if (r == 0) return 0;
    int res = inf;
    int cnt = 0;
    for (int i = 0; i < r; i++) {
        if (c[i] == 'R') cnt++;
        res = min(res, i+1-cnt+r-(i+1));
    }
    return res;
}

void input() {
    cin >> n >> c;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);

    input();
    cout << solve() << endl;
}


Measured memory_bytes: 3464
#include <iostream>
#include<string>
using namespace std;
int main(int argc, char const *argv[])
{
    int n;
    string s;
    cin>>n>>s;
    if (count(s.cbegin(), s.cend(), 'R') > count(s.cbegin(), s.cend(), 'B'))
    {
        cout << "Yes";
    }
    else
    {
        cout << "No";
    }
    return 0;
}


Measured memory_bytes: 888
// Author: Vamsi Krishna Reddy Satti
// With love for Competitive Programming!
 
#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
using namespace std;

string to_string(const string& s) { return '"' + s + '"'; }
void debug_out() { cout << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cout << " " << to_string(H);
    debug_out(T...);
}
#ifdef LOCAL
    #define debug(...) cout << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
    #define debug(...) 3
#endif
 
#define cin_exception cin.exceptions(cin.failbit);
#define cout_precision cout.setf(ios::fixed); cout.precision(15);
#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
using ll = int64_t; using ld = long double;
 
// -----------------------------------------------------------------------------

const int K = 5e3 + 5;
int k, q, d[K];

void solve() {
    cin >> k >> q;
    for (int i = 0; i < k; ++i) {
        cin >> d[i];
    }
    for (int i = 0; i < q; ++i) {
        int n, x, m; cin >> n >> x >> m;
        --n;
        int q = n / k, r = n % k;
        auto v = [&](int i) {
            if (i < r) return q + 1;
            else return q;
        };
        ll ans = 0, a_end = x, y = 0;
        for (int i = 0; i < k; ++i) {
            if (d[i] % m == 0) ans += v(i);
            y += d[i] % m;
            if (i == r - 1) a_end += y;
        }
        a_end += q * y;
        ans += a_end / m - x / m;
        cout << n - ans << '\n';
    }
}


int main() {
    fast_io; cin_exception;
    int t = 1; // cin >> t;
    for (int i = 0; i < t; ++i) {
        solve();
    }
}


Measured memory_bytes: 384
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Hassan El Desouky
 */

#include <iostream>
#include <fstream>

#include "bits/stdc++.h"

using namespace std;
#define el '\n'
#define F first
#define S second
#define FOR(i,a,b) for(int i = a; i <= b; ++i)
#define FORD(i,a,b) for(int i = a; i >= b; --i)
#define RI(i,n) FOR(i,1,n)
#define REP(i,n) FOR(i,0,(n)-1)
#define SQR(x) (x)*(x)
typedef long long ll;
typedef pair<int, int>	pii;
typedef pair<ll, ll>	pll;
typedef long double ld;
typedef vector<int>		vi;
typedef vector<pii>		vpii;
const double EPS = 1e-9;
const int N = 1e3+2, M = 2e5+5, OO = 0x3f3f3f3f;
//int dx[] = {1,-1,0,0} , dy[] = {0,0,1,-1}; // 4 Direction
//int dx[] = {1,-1,0,0,1,1,-1,-1}, dy[] = {0,0,1,-1,1,-1,1,-1}; // 8 Directio
/* int dx[] = {1,-1,1,-1,2,2,-2,-2} , dy[] = {2,2,-2,-2,1,-1,1,-1}; */ // Knight Direction
/* int dx[] = {2,-2,1,1,-1,-1} , dy[] = {0,0,1,-1,1,-1}; */ // Hexagonal Direction


class ANChildrenAndCandiesABCEdit {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        in >> n;
        out << n*(n+1)/2 << el;
	}
};


int main() {
	ANChildrenAndCandiesABCEdit solver;
    ios::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr);
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#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()
template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
  os << "{";
  rep(i, v.size()) { if(i) os << ", "; os << v[i]; }
  return os << "}";
}
const int inf = 1e9+7;
const ll longinf = 1LL<<60;
const ll mod = 1e9+7;
int main() {
  int N, K;
  cin >> N >> K;
  vector<int> P(N);
  vector<double> Q(1001);
  rep(i, N) cin >> P[i];
  Q[1] = 1;
  rep(i, 1001) if(i > 1) Q[i] = Q[i-1]*(i-1)/i + 1;
  double tmp = 0;
  rep(i, K) tmp += Q[P[i]];
  double ans = tmp;
  rep(i, N-K) {
    tmp -= Q[P[i]];
    tmp += Q[P[i+K]];
    ans = max(tmp, ans);
  }
  cout << setprecision(20) << ans << endl;
  return 0;
}


Measured memory_bytes: 1024
import java.io.{InputStream, OutputStream, PrintStream}
import java.util.Scanner

object Main {

  def main(args: Array[String]): Unit = {
    val solver = new Solver(System.in, System.out)
    solver.solve()
  }

  class Solver(in: InputStream, out: OutputStream) {
    lazy val input = new Scanner(in)

    lazy val output = new PrintStream(out)

    def solve(): Unit = {
      val n = input.nextLine().toInt

      output.println {
        1.until(n).map { i =>
          val a = i
          val b = n - i
          (a.toString + b.toString).split("").filter(_ != "").map(_.toInt).sum
        }.min
      }
    }

  }

}


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

void solve(long long N, std::set<long long> d){
    cout << d.size() << endl;
}

int main(){
    long long N;
    cin >> N;
    set<long long> d;
    long long tmp;
    for(int i = 0; i < N; ++i){
        cin >> tmp;
        d.insert(tmp);
    }
    solve(N, std::move(d));
    return 0;
}


/*

void solve(long long N, std::vector<long long> d){
    sort(d.begin(), d.end());
    d.erase(unique(d.begin(), d.end()), d.end());
    cout << d.size() << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> d(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&d[i]);
    }
    solve(N, std::move(d));
    return 0;
}

*/

Measured memory_bytes: 256
from collections import defaultdict
# d = defaultdict(int)で0で初期化
# d = defaultdict(lambda: 100)で100で初期化
import sys
sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n, m = map(int, input().split())
es = [defaultdict(int) for _ in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    es[a][b] += 1
    es[b][a] += 1
    if es[a][b] == 2:
        es[a].pop(b)
        es[b].pop(a)

def dfs(v, p, r):
    for i in es[v]:
        if i != p:
            es[i].pop(v)
            es[v].pop(i)
            if i == r:
                return - 1
            else:
                return dfs(i, v, r)
    return - 2

for i in range(n):
    if es[i]:
        if dfs(i, -1, i) == -2:
            print("NO")
            exit()
print("YES")
        


Measured memory_bytes: 190336
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<int,P> PP;

vector<PP> v;
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main()
{
	
	int n;
	vector<P> v;
	cin >> n;
	rep(i,n){
		int a,b;
		cin >> a >> b;
		v.push_back(P(b,a));
	}
	sort(v.begin(),v.end());
	int now = 0;
	rep(i,n){
		now += v[i].se;
		if(now>v[i].fi){
			cout << "No" << endl;
			return 0;
		}
	}
	cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 2420
#include <iostream>
using namespace std;
int main() {
    int n;
    cin >> n;
    long long a[n];
    for (int i=0; i<n; i++) {
        cin >> a[i];
        if (a[i] == 0) {
            cout << 0 << endl;
            return 0;
        }
    }
    long long p = 1;   
    for (int i=0; i<n; i++) {
        if (a[i] > 1000000000000000000/p) {
            cout << -1 << endl;
            return 0;
        } else {
            p *= a[i];
        }
    }
    cout << p << endl;
}

Measured memory_bytes: 4408
#include <bits/stdc++.h>
using namespace std;
#define rep(i,a) for(int i=0;i<a;i++)
#define mp make_pair
#define pb push_back
#define ll __int64
#define __int64 long long
#define P pair<int,int>
#define PP pair<P,int>

int v,e;
ll g[111][111];
const ll INF=1e15;

ll dist[111][111];

int main(){
    cin>>v>>e;
    rep(i,v)rep(j,v)if(i!=j)dist[i][j]=INF;

    rep(i,e){
        int a,b;
        ll c;
        cin>>a>>b>>c;
        dist[a][b]=c;
        //dist[b][a]=c;
    }
    rep(i,v){
        rep(j,v){
            rep(k,v)
                if(dist[j][i]!=INF&&dist[i][k]!=INF)dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k]);
        }
    }
    rep(i,v){
        if(dist[i][i]<0){
            cout<<"NEGATIVE CYCLE"<<endl;
            return 0;
        }
    }
    rep(i,v){
        rep(j,v){
            if(dist[i][j]==INF)
                cout<<"INF";
            else cout<<dist[i][j];
            if(j==v-1)cout<<endl;
            else cout<<" ";
        }
    }

    return 0;
}



Measured memory_bytes: 3200
#include<iostream>
#include<algorithm>
#include<functional>
#include<cmath>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<deque>
using namespace std;
#define ll long long
const int mod = 1000000007;
const int MOD = 998244353;
const ll INF = 1000000000000000000;


int main()
{
	int N;
	cin >> N;
	ll ans = 0;
	map<string, int> mp;
	for (int i = 0; i < N; i++) {
		string S;
		cin >> S;
		sort(S.begin(), S.end());
		ans += mp[S];
		mp[S]++;
	}
	cout << ans << endl;
}

Measured memory_bytes: 11440
/**         srijan_de
 _____      _ _              ______     
/  ___|    (_|_)             |  _  \    
\ `--. _ __ _ _  __ _ _ __   | | | |___ 
 `--. \ '__| | |/ _` | '_ \  | | | / _ \
/\__/ / |  | | | (_| | | | | | |/ /  __/
\____/|_|  |_| |\__,_|_| |_| |___/ \___|
            _/ |                         
           |__/       08.04.2020     **/
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
#include    <bits/stdc++.h>  
using       namespace       std;
using       lli=            long long  int;
using       ulli=           unsigned long long int;
using       ld=             long double;
#define     mem(a,val)      memset( a,  val,  sizeof(a) )
#define     b_s             binary_search
#define     u_b             upper_bound
#define     l_b             lower_bound
#define     nl              cout<<endl
#define     pb              push_back
#define     pf              push_front
#define     ppb             pop_back
#define     ppf             pop_front
#define     in              insert
#define     fi              first
#define     se              second
#define 	pqueue			priority_queue
const lli   MOD=            (int)1e9 + 7;
const lli   MOD1=           (int)1e9 + 9;
const lli   MOD2=           998244353;
const ld    pi=             atan2(0, -1);
const ld    eps=            1e-9;
lli         tests=          1;
template<class x,class y>x max(x a,y b){return (a>b)?a:b;}
template<class x,class y>x min(x a,y b){return (a<b)?a:b;}
template<class x,class y>x log(x n,y r){return (n>r-1)?1+log(n/r,r):0;}

///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
int32_t main() 
{
	auto start = clock();
	ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);	
	#ifndef ONLINE_JUDGE	
//	freopen("input.txt","r",stdin);
//	freopen("output.txt","w",stdout);
	#endif
//	cout<<fixed;
//	cout<<scientific;
//	cout<<fixed<<setprecision(12);
	//cin>>tests;
	for(lli test=1;test<=tests;test++) 
	{
//		cout<<"Case #"<<test<<": ";
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
		
		lli n,sum=0;
		cin>>n;
		for(lli i=1;i<=n;i++)
		{
			for(lli j=1;j<=n;j++)
			{
				for(lli k=1;k<=n;k++)
				{
					sum+=__gcd(__gcd(i,j),k);
				}
			}
				
		}
		cout<<sum;
		
		
		
		
		
		
		
		
		
		
		
		
		
		
		
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.
	}
	cerr<<endl<<endl<<endl<< "Time : " << double(clock() - start) / CLOCKS_PER_SEC <<endl;
	return 0;
}
///.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.'.


Measured memory_bytes: 3804
#include <stdio.h>

int main(void) {
	long h;
	int n,a;
	
	scanf("%ld %d",&h,&n);
	while(n--){
		scanf("%d",&a);
		h = h-a;
	}
	
	if(h>0)
		printf("No");
	else
		printf("Yes");
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


signed main(){
  cin.tie(0);	
  ios::sync_with_stdio(false);
  map<int,int> mp;
  int n;
  cin>>n;
  rep(i,n){
    int num;
    cin>>num;
    mp[num]++;
  }
  cin>>n;
  rep(i,n){
    int num;
    cin>>num;
    mp[num]--;
    if(mp[num]<0){cout<<"NO"<<endl;return 0;}
  }
  cout<<"YES"<<endl;

  return 0;
}

Measured memory_bytes: 12800
using System;
using System.Linq;

namespace ConsoleApp1
{
	class Program
	{
		static void Main(string[] a_asArgs)
		{
			int[] l_aiABCD = Console.ReadLine().Split(' ').Select(a => int.Parse(a)).ToArray();

			if (Math.Abs(l_aiABCD[0] - l_aiABCD[2]) <= l_aiABCD[3])
			{
				Console.WriteLine("Yes");
			}
			else if (Math.Abs(l_aiABCD[0] - l_aiABCD[1]) <= l_aiABCD[3] && Math.Abs(l_aiABCD[1] - l_aiABCD[2]) <= l_aiABCD[3])
			{
				Console.WriteLine("Yes");
			}
			else
			{
				Console.WriteLine("No");
			}
		}
	}
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define debug(x) cerr << #x << " " << x << '\n'
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pli = pair<ll,int>;
const int INF = 0x3f3f3f3f, N = 2e5 + 5;
const ll LINF = 1e18 + 5;
constexpr int mod = 1e9 + 7;
int h, w, n;
ll fac[N], inv[N], dp[N];
ll powmod(ll a,ll b) 
{
	a %= mod;
	ll ans = 1;
	while(b)
	{
		if(b&1) ans = ans*a%mod;
		a = a*a%mod;
		b >>= 1;
	}
	return ans;
}
void init(int n)
{
	fac[0] = 1;
	for(int i=1;i<=n;i++) fac[i] = fac[i-1]*i%mod;
	inv[n] = powmod(fac[n],mod-2);
	for(int i=n-1;i>=0;i--) inv[i] = inv[i+1]*(i+1)%mod;
}
ll comp(ll a,ll b)
{
	if(a<b||b<0||a<0) return 0;
	return fac[a]*inv[b]%mod*inv[a-b]%mod;
}
struct node
{
	int r, c;
	bool operator < (const node& x) { return r+c < x.r+x.c; } 
}p[N];
int main()
{
 	ios::sync_with_stdio(false);
 	cin.tie(0);
 	cin >> h >> w >> n;
 	for(int i=1; i<=n; i++)
 		cin >> p[i].r >> p[i].c;
 	p[0].r = 1, p[0].c = 1;
 	p[++n].r = h;
 	p[n].c = w;
	init(h+w-2);
	sort(p+1, p+n+1);
	dp[0] = 1;
	for(int i=1; i<=n; i++)
	{
		dp[i] = comp(p[i].r+p[i].c-2, p[i].r-1);
		for(int j=1; j<i; j++)
		{
			if(p[j].r>p[i].r || p[j].c>p[i].c) continue;
			dp[i] = (dp[i] - comp(p[i].r-p[j].r+p[i].c-p[j].c, p[i].r-p[j].r)*dp[j]%mod + mod)%mod;
		}
	}
	ll ans = dp[n];
	ans = (ans + mod)%mod;
	cout << ans;
	return 0;
}


Measured memory_bytes: 4480
#include <cstdio>
#include <cstring>
using namespace std;
#pragma warning (disable : 4996)

char s[100001];
int main()
{
	scanf("%s", s + 1);
	int n = strlen(s + 1);
	for (int i = 1; i <= n; i++)
		if (i & 1)
			putchar(s[i]);
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <ctime>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <vector>

using namespace std;

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

int main() {
  string a;
  cin >> a;
  if (a.length() < 4) nope();
  if (a[0] == 'Y' && a[1] == 'A' && a[2] == 'K' && a[3] == 'I') {
    puts("Yes");
  } else {
    nope();
  }
  return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
    int c1,c5,c10,c50,c100,c500,x;
	scanf("%d %d %d %d %d %d",&c1,&c5,&c10,&c50,&c100,&c500);
	x=1*c1+5*c5+10*c10+50*c50+100*c100+500*c500;
	if (x>=1000){
	    printf("1\n");
	}
	else {
	    printf("0\n");
	}
	return 0;
}

Measured memory_bytes: 1012
#include <bits/stdc++.h>
#include <numeric>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rep1(i,n) for (int i = 1; i <= n; ++i)
template<typename T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> inline T intceil(T a, T b) { return (a + (b - 1)) / b; }
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
const long long MOD = 1e9+7;
#define precout(val) cout << std::fixed << std::setprecision(20) << val;
const string alphabet = "abcdefghijklmnopqrstuvwxyz";
const int dy[4] = { 0, 1, 0, -1 };
const int dx[4] = { 1, 0, -1, 0 };

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

  int n; cin >> n;
  if(n == 0) {
    cout << "pon" << endl;
    return 0;
  }

  int a = n % 10;
  if(a == 2 || a == 4 || a == 5 || a == 7 || a == 9) {
    cout << "hon" << endl;
  } else if(a == 3) {
    cout << "bon" << endl;
  } else if(a == 0 || a == 1 || a == 6 || a == 8) {
    cout << "pon" << endl;
  }
  return 0;
}


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

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

    while(1)
    {
        C-=B;
        A-=D;

        if(C<=0){
            cout << "Yes" << endl;
            break;
        }
        else if(A<=0){
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}

Measured memory_bytes: 3632
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//#include <ext/pb_ds/detail/standard_policies.hpp>
#include<set>
#include<map>
#include <unordered_map>
#include <unordered_set>
#include<list>
#include<iomanip>
#include<cmath>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<sstream>
#include<iostream>
#include<fstream>
#include<algorithm>
#include<numeric>
#include<utility>
#include<functional>
#include<stdio.h>
#include<assert.h>
#include<memory.h>
#include<bitset>
#include<math.h>
#include <strings.h>



#define f first
#define s second
#define mp make_pair
#define pb push_back
#define lp(i,a,n) for(int i=a;i<=n;++i)
#define lpd(i,a,n) for(int i=a;i>=n;--i)
#define mem(a,b) memset(a,b,sizeof a)
#define all(v) v.begin(),v.end()
#define println(a) cout <<(a) <<endl
#define sz(x) ((int)(x).size())
#define readi(x) scanf("%d",&x)
#define read2i(x,y) scanf("%d%d",&x,&y)
#define read3i(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define mod 1000000007
#define eps 1e-8
#define infi 1000000000
#define infll 1000000000000000000ll
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef set<int> si;
typedef map<int,int> mii;

const int N = 300002;


int n,a,b,ans[N];


bool check(int a,int b) {
    return a == 1 && b != n;
}



int main(){
    
    scanf("%d%d%d",&n,&a,&b);
    
    if(a+b-1 > n || 1ll*a*b < n || a > n || b > n)
        return printf("-1\n"), 0;

    
    
    while (n > 0) {
        int x = min(a, n - b + 1);
        lp(i, n-x+1, n) printf("%d ",i);
        n -= x, --b;
    }

    
    
    
    lp(i, 1, n) printf("%d ", ans[i]);
    printf("\n");
    return 0;
}



/*

 5 3
 1 3
 1 5
 3 6
 4 4
 2 6
 1 5 3
 1 5 4
 1 1 1

 */
//freopen("output.txt","w",stdout);
//freopen("input.txt","r",stdin);
//ios::sync_with_stdio(0);cin.tie(0);

Measured memory_bytes: 2176
#include <bits/stdc++.h>
// #include <boost/multiprecision/cpp_int.hpp>
// using i128 = boost::multiprecision::int128_t;
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using ld = long double;
using V = vector<int>;
using Vll = vector<ll>;
using Vld = vector<ld>;
using Vbo = vector<bool>;
using VV = vector<V>;
using VVll = vector<Vll>;
using VVld = vector<Vld>;
using VVbo = vector<Vbo>;
using VVV = vector<VV>;
using VVVll = vector<VVll>;
using P = pair<int, int>;
using Pll = pair<ll, ll>;
using Pld = pair<ld, ld>;
#define rep2(i, m, n) for(int i=int(m); i<int(n); ++i)
#define drep2(i, m, n) for(int i=int(m)-1; i>=int(n); --i)
#define rep(i, n) rep2(i, 0, n)
#define drep(i, n) drep2(i, n, 0)
#define all(a) a.begin(), a.end()
struct fast_ios { fast_ios(){ cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;
template<typename T> inline int sz(T &x) { return x.size(); }
template<typename T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; }
template<typename T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; }
template<typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.first >> p.second; return is; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &p) { os << "(" << p.first << ", " << p.second << ")"; return os; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (auto &e : v) is >> e; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { for (auto &e : v) os << e << " "; return os; }
template<typename T> inline int count_between(vector<T> &a, T l, T r) { return lower_bound(all(a), r) - lower_bound(all(a), l); } // [l, r)
inline int fLog2(const int x) { return 31-__builtin_clz(x); } // floor(log2(x))
inline int fLog2(const ll x) { return 63-__builtin_clzll(x); }
inline int cLog2(const int x) { return (x == 1) ? 0 : 32-__builtin_clz(x-1); } // ceil(log2(x))
inline int cLog2(const ll x) { return (x == 1) ? 0 : 64-__builtin_clzll(x-1); }
inline int popcount(const int x) { return __builtin_popcount(x); }
inline int popcount(const ll x) { return __builtin_popcountll(x); }
const int INF  = 1<<30;
const ll INFll = 1ll<<62;
const ld EPS   = 1e-10;
const ld PI    = acos(-1.0);
const int MOD  = int(1e9)+7;
// const int MOD  = 998244353;


int main() {
  int n, m; cin >> n >> m;
  V deg(n);
  rep(_, m) {
    int u, v; cin >> u >> v;
    --u, --v;
    ++deg[u];
    ++deg[v];
  }

  rep(i, n) if (deg[i]&1) {
    cout << "NO\n";
    return 0;
  }
  cout << "YES\n";
  return 0;
}


Measured memory_bytes: 3724
#include <stdio.h>

int main(void) {
	
	int a,b,c,d,x,y;
	
	scanf("%d\n",&a);
	scanf("%d\n",&b);
	scanf("%d\n",&c);
	scanf("%d\n",&d);	
	
	x=(a+b+c+d)/60;
	y=(a+b+c+d)-60*x;
	
	printf("%d\n%d\n",x,y);
	
	
	return 0;
}

Measured memory_bytes: 600
c = [list(map(int, input().split())) for _ in range(3)]

if c[0][0]+c[1][1] != c[0][1]+c[1][0]:
  print("No")
  exit()
if c[0][1]+c[1][2] != c[0][2]+c[1][1]:
  print("No")
  exit()
if c[1][0]+c[2][1] != c[1][1]+c[2][0]:
  print("No")
  exit()
if c[1][1]+c[2][2] != c[1][2]+c[2][1]:
  print("No")
  exit()
print("Yes")

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

int main() {
  int a , b;
  
  cin >> a >> b ;
  
  if ( ( a + b ) / 2 + 1 == ( a + b + 1 ) / 2 ){
    cout << ( a + b) / 2 + 1 << endl;
  }
  
  else {
    cout << ( a + b ) / 2 << endl; 
  }
  
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int N,i,min,count=1;
    int P[200001];
    
    scanf("%d",&N);
    for(i = 1; i <= N; i++){
        scanf("%d",&P[i]);
    }
    
    min = P[1]; //初期化
    
    for(i = 2; i <= N; i++){
        if(P[i] <= min){
            count++;
            min = P[i];
        }
    }
    printf("%d\n",count);
    return 0;
}


Measured memory_bytes: 896
use std::io::*;
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("filed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

fn main() {
    let n:usize = read();
    let a:usize = read();
    let b:usize = read();
    if a > b {
        println!("0");
    } else if n == 1 {
        println!("{}", if a == b {1} else {0});
    } else {
        println!("{}", (n-2) * (b - a) + 1);
    }
}


Measured memory_bytes: 2060
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

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

  ll count = 0;
  set<ll> ans;
  if (n > 2)
  {
    ans.insert(n - 1);
  }

  ans.insert(n);
  for (ll i = 2; i * i <= n - 1; i++)
  {
    if ((n - 1) % i == 0)
    {
      ans.insert(i);
      ans.insert((n - 1) / i);
    }

    if (i * i == n - 1)
    {
      ans.insert(i);
    }
  };

  for (ll i = 2; i * i <= n; i++)
  {
    if (n % i != 0)
      continue;

    ll tmp = n / i;
    while (tmp % i == 0)
    {
      tmp = tmp / i;
    }

    if (tmp % i == 1)
      ans.insert(i);
  }

  cout << ans.size() << endl;
  return 0;
}


Measured memory_bytes: 256
N = int(input())
C = []
S = []
F = []

for i in range(N-1):
  c,s,f = map(int,input().split())
  C.append(c)
  S.append(s)
  F.append(f)

# 時刻xで駅iにいて,最短で向かった場合の駅Nへの到着時刻
def time(i,x):
  if i == N:
    return x
  else:
    # 直近の列車の出発時刻tを求める
    a = int(-(-x//F[i-1]))
    t = max(a*F[i-1],S[i-1])
    return time(i+1,t+C[i-1])

for i in range(N):
  print(time(i+1,0))

Measured memory_bytes: 3572
#include <stdio.h>
 
int main(void){
    char ch;
    int alpha[26]={0},i;
    while(scanf("%c",&ch)!=EOF){
        if('A'<=ch && ch<= 'Z'){
            alpha[ch-'A']++;
        }
        else if('a'<=ch && ch<= 'z'){
            alpha[ch-'a']++;
        }
    }
    for(i=0;i<26;i++){
        printf("%c : %d\n",'a'+i,alpha[i]);
    }
    return 0;
}

Measured memory_bytes: 540
#include <stdio.h>

int main(void){
    int a,b,c;

    scanf("%d",&a);
    scanf("%d",&b);
   
    if(a == 0)c = 1;
    else if(a == 1)c = 100;
    else if(a == 2)c = 10000;
    
    if(b == 100)c = c * (b + 1);
    else c = c * b;
    
    printf("%d\n",c);
    return 0;
}


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

void main()
{
    auto nk = readln.split.to!(long[]);
    auto N = nk[0];
    ulong K = nk[1];
    long[31] rs;
    foreach (_; 0..N) {
        auto ab = readln.split.to!(long[]);
        ulong A = ab[0];
        auto B = ab[1];
        if ((A&K) == A) rs[30] += B;
        foreach (i, ref r; rs) {
            if (
                (K&(1L<<i)) &&
                !(A&(1L<<i)) &&
                (((K>>(i+1))&(A>>(i+1))) == (A>>(i+1)))
            ) {
                r += B;
            }
        }
    }
    long r;
    foreach (ref rr; rs) r = max(r, rr);
    writeln(r);
}

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

#define endl "\n"
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define REP(i, n) for(int i = 0; i < n; i++)
using Graph = vector<vector<int>>;

int main(){
    int n,m;
    cin>>n>>m;
    int a,b;
    Graph G(n);
    for(int i=0;i<m;i++){
        cin>>a>>b;
        G[a-1].push_back(b-1);
        G[b-1].push_back(a-1);
    }

    vector<int> dist(n,-1);
    queue<int> que;

    dist[0] = 0;
    que.push(0);

    while(!que.empty()){
        int v = que.front();
        que.pop();

        for(int nv : G[v]){
            if(dist[nv] != -1) continue;
            dist[nv] = v;
            que.push(nv);
        }
    }

    bool ok = true;
    for(int i=0;i<n;i++){
        if(dist[i] == -1) ok = false;
    }

    if(ok){
        cout<<"Yes"<<endl;
        for(int i=1;i<n;i++) cout<<dist[i]+1<<endl;
    }
    else cout<<"No"<<endl;
}

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

int main() {
  char b;
  cin >> b;
  switch (b) {
    case 'A':
      cout << 'T' << endl;
      break;
    case 'C':
      cout << 'G' << endl;
      break;
    case 'G':
      cout << 'C' << endl;
      break;
    case 'T':
      cout << 'A' << endl;
      break;
  }
  return 0;
}

Measured memory_bytes: 888
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")    
using namespace std;
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
#define lli long long int
#define uli unsigned long long int
#define INF 999999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(50) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 998244353
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,H,W,M,K,L,R,N,num=0,sum=0,flag=0;string S,T;
  cin >> N >> K;
  DV(dp,lli,N,K+100,0);//dp[i][j]:=i番目まで見たとき，和がjにすることができる区間数
  Vec(P,lli,N,0);
  rep(i,0,N)cin >> P[i];
  if(P[0]<=K)dp[0][P[0]]=1;
  rep(i,0,N)dp[i][0]=1;
  rep(i,1,N)rep(j,0,K+1){
    if(j+P[i]<=K&&j)dp[i][j+P[i]]=(dp[i][j+P[i]]+dp[i-1][j])%mod;
    else if(j+P[i]<=K&&!j)dp[i][j+P[i]]=(dp[i][j+P[i]]+dp[i-1][j]+1)%mod;
    dp[i][j]=(dp[i][j]+dp[i-1][j])%mod;
  }
  /*rep(i,0,N){
    rep(j,0,K+1)cout << dp[i][j] << " ";
    Out("");
  }*/
  rep(i,0,N)sum+=dp[i][K];
  Out(sum%mod);
}

Measured memory_bytes: 73088
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include <numeric>

#define LL long long
#define MOD 1000000007

using namespace std;


/*
LL GCD(LL a, LL b) {
	if (a < b) GCD(b, a);
	LL r;
	while ((r = a%b)) {
		a = b;
		b = r;
	}
	return b;
}
*/


LL A[100000];

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

	LL A, B, K;
	cin >> A >> B >> K;

	for (int i = 1; i <= K; i++) {
		if (i % 2 == 1) {
			if (A % 2 == 1) 
				A--;
			B += A / 2;
			A /= 2;
		}
		else {
			if (B % 2 == 1) 
				B--;
			A += B / 2;
			B /= 2;
		}
	}

	cout << A << " " << B << endl;
	cin >> A;

}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using vi=vector<int>;
using vvi=vector<vi>;
using vs=vector<string>;
using msi=map<string,int>;
using mii=map<int,int>;
//using pii=pair<int,int>;
using vlai=valarray<int>;
using ll=long long;
using pii=pair<ll,ll>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF 1e9
#define EPS 1e-9
#define MOD (1e9+7)
void get(){}template<class H,class...T>void get(H&h,T&...t){cin>>h;get(t...);}
#define dcl(...) int __VA_ARGS__;get(__VA_ARGS__);

int main(){
    dcl(n,m);
    vector<set<int>> edge(n+1);
    rep(i,m){
        dcl(s,t);
        edge[s].insert(t);
        edge[t].insert(s);
    }
    vi perm(n);
    iota(all(perm),1);
    int ans=0;
    do{
        bool ok=true;
        rep(i,n-1){
            if(edge[perm[i]].find(perm[i+1])==edge[perm[i]].end()){
                ok=false;
                break;
            }
        }
        if(ok)ans++;
    }while(next_permutation(perm.begin()+1,perm.end()));
    cout<<ans<<endl;
}


Measured memory_bytes: 256
import math as m

def vol(a,b,x,d):
    if a**2*b / 2 < x:
        return a**2*b - 1/2*a**3 * m.tan(m.radians(d))
    else:
        return 1/2*a*b**2 * m.tan(m.radians(90-d))

a, b, x = map(int, input().split())

if a**2*b == x:
    print(0)
    exit()

res = x
d_max = 90
d_min = 0
while res > 10e-8:
    d = (d_max+d_min)/2
    if vol(a,b,x,d) - x > 0:
        d_min = d
    else:
        d_max = d
    res = abs(x - vol(a,b,x,d))

print(d)

Measured memory_bytes: 3188
#include <iostream>

using namespace std;


int main(){
  float h;
  while(cin>>h){
    if(h<=48.0) cout<<"light fly";
    else if(h<=51.0) cout<<"fly";
    else if(h<=54.0) cout<<"bantam";
    else if(h<=57.0) cout<<"feather";
    else if(h<=60.0) cout<<"light";
    else if(h<=64.0) cout<<"light welter";
    else if(h<=69.0) cout<<"welter";
    else if(h<=75.0) cout<<"light middle";
    else if(h<=81.0) cout<<"middle";
    else if(h<=91.0) cout<<"light heavy";
    else cout<<"heavy";
    cout<<endl;
  }
  return 0;
}

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

int main()
{
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  int cnt = 0;
  for (int i=0; i<=100; i++) {
    if ((i>=a && i<=b) && (i>=c && i<=d)) cnt++;
  }
  if (cnt > 0) cnt--;
  cout << cnt << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N_MAX 10000

int main(void){
  int num;
  int i;
  int a[N_MAX];
  double max=-1000000,min=1000000,sum=0;

  scanf("%d",&num);

  for(i=0;i<num;i++){
    scanf("%d",&a[i]);
    if(a[i]<min){
      min=a[i];
    }
    if(a[i]>max){
      max=a[i];
    }
    sum+=a[i];
  }
  
  printf("%.0f %.0f %.0f\n",min,max,sum);
  return 0;
}

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

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

#define pb push_back
#define rep(i, n) for(int i = 0; i < (n); i++)
#define FOR(i, a, n) for(int i = a; i < (n); i++)
#define mod (ll)(1e9+7)
#define int ll

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

signed main() {
	ll n, f[101][11], p[101][11], ans = INT_MIN;
  cin >> n;
  rep(i, n) {
    rep(j, 10) {
      cin >> f[i][j];
    }
  }
  rep(i, n) {
    rep(j, 11) {
      cin >> p[i][j];
    }
  }
  for(int i = 1; i < 1 << 10; i++) {
    ll ch = 0;
    rep(j, n) {
      ll count = 0;
      rep(k, 10) {
        if ((i&(1<<k)) && f[j][k]) count++;
      }
      ch += p[j][count];
    }
    if (ans < ch) ans = ch;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
N,K=(int(x) for x in input().split())
A=list(map(int, input().split()))
if K<=N:
    s=1
    for i in range(K):
        s=A[s-1]
    print(s)
else:
    s=1
    S={1}
    iloop=1
    while A[s-1] not in S:
        S.add(A[s-1])
        s=A[s-1]
        iloop=iloop+1
    p=s
    loop=1
    while A[s-1] != p:
        loop=loop+1
        s=A[s-1]
    g=(K-iloop)%loop+iloop
    s=1
    for i in range(g):
        s=A[s-1]
    print(s)

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

using namespace std;
using ll = long long;

const int MOD = 1000000007;
int N;
ll dp[105][4][4][4] = {0};

ll solve() {
  dp[0][1][1][1] = 1;
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        for (int l = 0; l < 4; l++) {
          ll num = 0;
          if (l == 0 && k == 3 && j == 2) continue;
          if (l == 0 && k == 2 && j == 3) continue;
          if (l == 2 && k == 0 && j == 3) continue;
          for (int m = 0; m < 4; m++) {
            if (m == 0 && k == 2 && j == 3) continue;
            if (m == 0 && l == 2 && j == 3) continue;
            num = (num + dp[i][k][l][m]) % MOD;
          }
          dp[i + 1][j][k][l] = (dp[i + 1][j][k][l] + num) % MOD;
        }
      }
    }
  }
  ll res = 0;
  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 4; j++) {
      for (int k = 0; k < 4; k++) {
        res = (res + dp[N][i][j][k]) % MOD;
      }
    }
  }
  return res;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N;
  cout << solve() << '\n';
  return 0;
}


Measured memory_bytes: 256
while True:
    n, x = map(int, input().split())
    if n + x == 0:
        break
    c = 0
    for i in range(1, n+1):
        for j in range(i+1, n+1):
            for k in range(j+1, n+1):
                if i+j+k == x:
                    c += 1
    print(c)


Measured memory_bytes: 5592
def p_d():
    N = int(input())
    AB = [tuple(map(int, input().split())) for _ in range(N)]
    AB.sort(key=lambda x: x[1])
    n = 0
    for a, b in AB:
        n += a
        if n > b:
            print("No")
            exit()
    print("Yes")
    
p_d()

Measured memory_bytes: 81372