akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
 
#define ll long long
#define pb push_back
#define fori(a,b) for(int i=a;i<b;i++)
#define forj(a,b) for(int j=a;j<b;j++)
#define ford(b,a) for(int i=b;i>=a;i--)
typedef pair<int, int> pi;
#define PI 3.14159265359
#define vi vector<int>
long long mod=1000000007;
//int count=INT_MAX;
 
struct hash_pair { 
    template <class T1, class T2> 
    size_t operator()(const pair<T1, T2>& p) const
    { 
        auto hash1 = hash<T1>{}(p.first); 
        auto hash2 = hash<T2>{}(p.second); 
        return hash1 ^ hash2; 
    } 
};

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int testcases=1;
    //cin>>testcases;
    //cout<<t;
    //scanf("%d",&t);
    //int t=testcases;
    while(testcases--){
        string s,t;
        cin>>s>>t;
        int n=s.size();
        int m=t.size();
        int ans=n;
        int c=0;
        fori(0,n-m+1){
            c=0;
            forj(0,m){
                if(s[i+j]!=t[j]) c++;
            }
            ans=min(c,ans);
        }
        cout<<ans;
    }               

    return 0;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef long double ld;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define FOR(i,l,r) for(ll i=(l); i<(r); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
const ll INF = 1LL << 60;
const int inf = 1001001001;
const ll mod = 1000000007;
using pp=pair<ll,ll>;
 
// union by size + path having
class UnionFind {
public:
   vector <ll> par; // 各元の親を表す配列
   vector <ll> siz; // 素集合のサイズを表す配列(1 で初期化)
 
   // Constructor
   UnionFind(ll sz_): par(sz_), siz(sz_, 1LL) {
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
   }
   void init(ll sz_) {
       par.resize(sz_);
       siz.assign(sz_, 1LL);  // resize だとなぜか初期化されなかった
       for (ll i = 0; i < sz_; ++i) par[i] = i; // 初期では親は自分自身
  }
 
   // Member Function
   // Find
   ll root(ll x) { // 根の検索
      while (par[x] != x) {
           x = par[x] = par[par[x]]; // x の親の親を x の親とする
       }
       return x;
  }
 
   // Union(Unite, Merge)
   bool unite(ll x, ll y) {
       x = root(x);
       y = root(y);
       if (x == y) return false;
       // merge technique（データ構造をマージするテク．小を大にくっつける)
       if (siz[x] < siz[y]) swap(x, y);
       siz[x] += siz[y];
       par[y] = x;
       return true;
  }
 
  bool same(ll x, ll y) { // 連結判定
       return root(x) == root(y);
  }
 
  ll size(ll x) { // 素集合のサイズ
      return siz[root(x)];
  }
};
 
ll modpow(ll x, ll n) {
   x = x%mod;
   if(n==0) return 1;  //再帰の終了条件
 
   else if(n%2==1) {
       return (x*modpow(x, n-1))%mod;  //nが奇数ならnを1ずらす
   }
   else return modpow((x*x)%mod, n/2)%mod;  //nが偶数ならnが半分になる
}
 
ll com(ll n, ll k) {
   ll x = 1;
   for(int i=n-k+1; i<=n; i++) {
      x = x*i%mod;
   }
 
   ll y = 1;
   for(int i=1; i<=k; i++) {
       y = y*i%mod;
   }
   y = modpow(y, mod-2);
 
   return x*y%mod;
}
 
bool is_prime(const unsigned n){
   switch(n){
       case 0: // fall-through
       case 1: return false;
       case 2: // fall-through
       case 3: return true;
  } // n > 3 が保証された
 
   if(n % 2 == 0 || n % 3 == 0) return false;
   // n は 2 と 3 のいずれの倍数でもないことが保証された
   // これより n は (6の倍数)-1 か (6の倍数)+1 である
 
   // 6の倍数前後の数を使って試し割りをする
   for(unsigned i = 5; i * i <= n; i += 6) {
       if(n % i     == 0) return false; // (6の倍数)-1
       if(n % (i+2) == 0) return false; // (6の倍数)+1
   }
 
   return true;
}
 
int digsum(int n) {
   int res = 0;
   while(n > 0) {
       res += n%10; //ここをres++;に変えたら桁数を求める関数になる
       n /= 10;
   }
   return res;
}
vector<ll> divisor(ll n){
   vector<ll> ret;
   for(ll i = 1 ; i*i <= n ; i++){
       if(n%i == 0){
           ret.push_back(i);
           if(i*i != n) ret.push_back(n/i);
       }
   }
   sort(ret.begin(),ret.end());
   return ret;
}
 
int main(){
  
  ll n;
  cin >> n;
  ll a,b;
  rep(i,n){
    ll x;
    cin >> x;
    chmax(a,x);
    chmin(b,x);
  }
  cout << a-b << endl;
}

Measured memory_bytes: 3632
def warikire(n,r):
    if r==1:
        return n+1
    else:
        return n//r+1
a,b,x=map(int,input().split())
if a==0:
    print(warikire(b,x))
else:
    print(warikire(b,x)-warikire(a-1,x))

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
int main(){
int sum=0;
short q;
cin>>q;
int t[q];
for(int i=0;i<q;i++){
	cin>>t[i];
	sum+=t[i];
}
short d;
cin>>d;
int p[d],x[d];
for(int i=0;i<d;i++){
cin>>p[i]>>x[i];
}
int j;
for(int i=0;i<d;i++){
	for(int j=0;j<q;j++){
	if(p[i]==j+1){
		sum-=t[j];
	    sum+=x[i];
	    cout<<sum<<endl;
        sum-=x[i];
         sum+=t[j];
       
	}
}
}
}


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


int main(){
	int a,b,c;
	cin>>a>>b>>c;
	
	if(a==b && b!=c || a==c && c!=b ||b==c && c!=a)
		cout<<"Yes";
	else
		cout<<"No";
		
	return 0;	
}

Measured memory_bytes: 256
// I SELL YOU...! 
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<chrono>
#include<iomanip>
#include<map>
#include<set>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
void init_io(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(10);
}
signed main(){
  init_io();
  ll n,cnt=0,d,tmp,num;
  cin >> d >> n;
  for(int i=1;;i++){
    tmp = i;
    num = 0;
    while(tmp%100==0){
      tmp /= 100;
      num++;
    }
    if(num==d){
      cnt++;
      if(cnt==n){
        cout <<i<<endl;
        break;
      }
    }
  }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define ll long long int
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define all(in) in.begin(), in.end()
using namespace std;
typedef pair<int, int>pii;
typedef pair<ll,ll>pll;
typedef pair<double,double>pdd;
using namespace std;
#define MAX  999999
int main(){
	double tiya,rize;
	while(cin>>tiya>>rize){
		 if(tiya<35.5&&rize<71)
			cout<<"AAA"<<endl;
		else if(tiya<37.5&&rize<77)
			cout<<"AA"<<endl;
		else if(tiya<40&&rize<83)
			cout<<"A"<<endl;
		else if(tiya<43.0&&rize<89)
			cout<<"B"<<endl;
		else if(tiya<50&&rize<105)
			cout<<"C"<<endl;
		else if(tiya<55&&rize<116)
			cout<<"D"<<endl;
		else if(tiya<70&&rize<148)
			cout<<"E"<<endl;
		else cout<<"NA"<<endl;
	}
}

Measured memory_bytes: 3140
#include<cstdio>
#include<vector>
#include<algorithm>
using namespace std;

const int NMAX = 100000;
const int QMAX = 100000;
int V[QMAX + 1], D[QMAX + 1], C[QMAX + 1];
int query[12][NMAX + 1][12];
int ans[NMAX + 1];

vector<int> g[NMAX + 1];

int main(){
	int N, M; scanf("%d%d", &N, &M);
	for (int i = 0; i < M; i++){
		int a, b; scanf("%d%d", &a, &b);
		g[a].push_back(b);
		g[b].push_back(a);
	}

	int Q; scanf("%d", &Q);
	for (int i = 1; i <= Q; i++) scanf("%d%d%d", V + i, D + i, C + i);
	for (int i = 1; i <= Q; i++) query[0][V[i]][D[i]] = i;

	for (int it = 0; it <= 10; it++){
		for (int u = 1; u <= N; u++) for (int i = 0; i <= 10; i++) ans[u] = max(ans[u], query[it][u][i]);
		for (int u = 1; u <= N; u++) for (int i = it + 1; i <= 10; i++) if (query[it][u][i]){
			for (int v : g[u]) query[it + 1][v][i] = max(query[it + 1][v][i], query[it][u][i]);
		}
	}

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

Measured memory_bytes: 61568
n=int(input())
def ceil(a,b):
    ret = -(-a//b)
    if ret%2==0:
        return ret
    else:
        return ret+1

print(0)
first=input()
if first=="Vacant":
    exit()

l=0
r=n

while abs(l-r)>5:
    nxt = ceil(l+r,2)
    print(nxt)
    ans=input()
    if ans=="Vacant":
        exit()
    if ans==first:
        l=nxt
    else:
        r=nxt


for i in range(l,r):
    print(i)
    ans=input()
    if ans=="Vacant":
        exit()

Measured memory_bytes: 38852
import java.util.*;

public class Main {

    public Main() {
        Scanner scan = new Scanner(System.in);
        String S = scan.next();
        String T = scan.next();
        for(int i=0;i<S.length();i++){
            if(S.charAt(i) != T.charAt(i)){
                System.out.println("No");
                return;
            }
        }
        System.out.println("Yes");
    }

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


Measured memory_bytes: 35608
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <queue>
#include <map>
using namespace std;
#define ll long long
#define rep(i, s, n) for(int i = s; i < n; i++)

int main() {
    ll a, b, c;
    cin >> a >> b >> c;
    
    ll tmp = c-a-b;
    if(tmp*tmp > 4*a*b && tmp > 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    return 0;
}

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

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

  if(a > b) swap(a, b);
  if(b > c) swap(b, c);
  if(a > b) swap(a, b);
  
  cout<<a<<" "<<b<<" "<<c<<endl;
  return 0;
}



Measured memory_bytes: 3084
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
vector<pair<long long, long long> > prime_factorize(long long n) {
    vector<pair<long long, long long> > res;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p != 0) continue;
        int num = 0;
        while (n % p == 0) { ++num; n /= p; }
        res.push_back(make_pair(p, num));
    }
    if (n != 1) res.push_back(make_pair(n, 1));
    return res;
}
int n;
map<ll, int> sisu;
long long rec(map<long long, int>::iterator p, long long mul){
    if (p == sisu.end()) {
        if (mul == 1) return 1;
        else return 0;
    }
    long long res = 0;
    for (int i = 0; i < p->second + 1; ++i) {
        if(mul % (i+1) != 0) continue;
        res += rec(++p, mul / (i+1));
        --p;
    }
    return res;
}
int main(){
    cout << fixed << setprecision(10);
    cin >> n;
    for(int i = 2; i <= n; i++){
        auto ps = prime_factorize(i);
        for(auto it : ps){
            sisu[it.first] += it.second;
        }
    }
    cout << rec(sisu.begin(), 75) << endl;
    return 0;
}

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

using namespace std;

#define rep(i, a) for (int (i) = 0; (i) < (int) (a); (i)++)
#define reps(i, a, b) for (int (i) = (int) (a); (i) < (int) (b); (i)++)
#define MP(a, b) make_pair((a), (b))
#define pb(a) push_back((a))
#define all(v) (v).begin(), (v).end()
#define PRINT(f) if((f)){cout << (YES) << endl;}else{cout << NO << endl;}
#define YES "YES"
#define NO "NO"

int sum[100001];
unordered_map<int, int> m;
int N, M;

int main()
{
	cin >> N >> M;
	rep(i, N) {
		int t;
		cin >> t;
		sum[i+1] = (sum[i] + t) % M;
	}
	m.insert(MP(0, 1));
	long long res = 0;
	reps(i, 1, N+1) {
		if (m.find(sum[i]) == m.end()) {
			m.insert(MP(sum[i], 1));
		} else {
			int t = m.at(sum[i]);
			res += t;
			m.erase(m.find(sum[i]));
			m.insert(MP(sum[i], t+1));
		}
	}
	cout << res << endl;
}


Measured memory_bytes: 3980
N,M = map(int,input().split())
Q = []
for i in range(M):
    a,b = map(int,input().split())
    Q.append((a,b))
Q.sort()
for i in range(M):
    a,b = Q[i]
    Q[i] = (b,a)
Q.sort()
B = 0
ans = 0
for i in range(M):
    b,a = Q[i]
    if a >= B:
        B = b
        ans += 1
print(ans)

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

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

    int sum = 0;
    int num = 0;
    for (int i = 0; i < N.size(); i++)
    {
        num = (int)(N.at(i) - '0');
        sum += num;
    }

    cout << ((sum % 9 ==0)? "Yes" : "No") << endl;

    return 0;
}

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

void solve(string s, string t)
{
    map<char, vector<int>> positions;
    for (int i = 0; i < (int)s.size(); i++)
    {
        positions[s.at(i)].push_back(i + 1);
    }

    for (int i = 0; i < (int)t.size(); i++)
    {
        if (positions.count(t.at(i)) == 0)
        {
            cout << -1 << endl;
            return;
        }
    }

    int64_t res = 0, p = 0;
    for (int i = 0; i < (int)t.size(); i++)
    {
        auto it = upper_bound(positions.at(t.at(i)).begin(), positions.at(t.at(i)).end(), p);
        if (it == positions.at(t.at(i)).end())
        {
            int p_n = positions.at(t.at(i)).at(0);
            res += (s.size() - p) + p_n;
            p = p_n;
        }
        else
        {
            int p_n = *it;
            res += p_n - p;
            p = p_n;
        }
    }
    cout << res << endl;
}

int main()
{
    string s, t;
    cin >> s >> t;
    solve(move(s), move(t));
    return 0;
}


Measured memory_bytes: 1216
import java.io.*;
import java.util.*;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long K;
        K = sc.nextLong();
        List<Long> p = new ArrayList<>();
        for(int i = 0 ; i < N ; i++){
                p.add(sc.nextLong());
        }

        final Solver solver = new Solver();
        solver.solve(N, K, p);
    }
}

class Solver {
    public void solve(long N, long K, List<Long> p) {
        double ans = -1.0;
        double sum = 0;
        for (int i = 0; i < N; i++) {
            long v = p.get(i);
            sum += (double) sum(v) / v;

            if (i >= K - 1) {
                if (ans < sum) {
                    ans = sum;
                }
                long u = p.get((int) (i - (K - 1)));
                sum -= (double) sum(u) / u;
            }
        }

        System.out.println(ans);
    }

    public long sum(Long to) {
        return to * (to + 1) / 2;
    }
}



Measured memory_bytes: 88772
import sys
import collections
input = sys.stdin.readline

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

countL = []
countR = []
for i in range(N):
  countL.append(i - A[i])
  countR.append(i + A[i])

countL = collections.Counter(countL)
countR = collections.Counter(countR)

ans = sum([countL[i] * countR[i] for i in countL.keys()])
print(ans)

Measured memory_bytes: 62376
#include <bits/stdc++.h>
using namespace std;
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);cout.precision(20);}} fast;

/* define */
#define FOR(I,X,Y) for(long long (I)=(X);(I)<(Y);(I)++)
#define REP(I,X,Y) for(long long (I)=(Y)-1;(I)>=(X);(I)--)
#define ALL(X) (X).begin(),(X).end()
#define pb push_back
#define COUNT(V,X) (upper_bound((V).begin(),(V).end(),X)-lower_bound((V).begin(),(V).end(),X))
#define debug(x) cerr<<#x<<':'<<x<<endl;
#define DEBUG(v) cerr<<#v<<':';for(auto xXx:v)cerr<<xXx<<' ';cerr<<endl;
#define Yes(X) if(X){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define YES(X) if(X){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define ctoi(C) (C-'0')
#define pow2(x) ((long long)((long long)1<<x))

/* alias */
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<long long>;
using vll = vector<vector<long long>>;
using pi = pair<int,int>;
using pl = pair<long long,long long>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

/* const */
const long long dx[] = {1,0,-1,0};
const long long dy[] = {0,1,0,-1};
const long long dx8[] = {1,1,0,-1,-1,-1,0,1};
const long long dy8[] = {0,1,1,1,0,-1,-1,-1};
const long long dx9[] = {1,1,0,-1,-1,-1,0,1,0};
const long long dy9[] = {0,1,1,1,0,-1,-1,-1,0};
const int INF = 1000000007;
const long long LINF = 1000000000000000007;

/* func */
template <typename T> inline bool chmin(T& a, const T& b) {if (a > b) a = b; return a > b;}
template <typename T> inline bool chmax(T& a, const T& b) {if (a < b) a = b; return a < b;}
long long max(long long x,int y){return max(x,(long long)y);}
long long max(int x,long long y){return max((long long)x,y);}
long long min(long long x,int y){return min(x,(long long)y);}
long long min(int x,long long y){return min((long long)x,y);}

/* liblary */



/* main */

signed main(){
	int N;
	cin >> N;
	ld x;
	string u;
	ld ans = 0;
	FOR(i,0,N){
		cin >> x >> u;
		cerr << x << ' ' << u << endl;
		if(u == "JPY")ans += x;
		else ans += 380000*x;
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define rep2(i, s, n) for (ll i = s; i < (ll)(n); i++)
#define repr(i, n) for (ll i = n; i >= 0; i--)
#define fi first
#define sc second
#define pb push_back
#define COUT(x) cout << (x) << endl
#define COUTF(x) cout << setprecision(15) << (x) << endl
#define ENDL cout << endl
#define DF(x) x.erase(x.begin())  // 先頭文字削除
#define ALL(x) x.begin(), x.end()
#define SORT(x) sort(ALL(x))
#define REVERSE(x) reverse(ALL(x))
#define ANS cout << ans << endl
#define RETURN(x)    \
  cout << x << endl; \
  return 0
clock_t CLOCK;
#define START_TIMER CLOCK = clock()
#define SHOW_TIMER cerr << "time: " << (ld)(clock() - CLOCK) / 1000000 << endl
#define init() \
  cin.tie(0);  \
  ios::sync_with_stdio(false)
#define debug(x) cerr << "[debug] " << #x << ": " << x << endl;
#define debugV(v)                       \
  cerr << "[debugV] " << #v << ":";     \
  rep(i, v.size()) cerr << " " << v[i]; \
  cerr << endl;
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using mll = map<ll, ll>;
using qll = queue<ll>;
using P = pair<ll, ll>;

constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr ld PI = 3.141592653589793238462643383279;
ll get_digit(ll x) {
  return to_string(x).size();
}

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

ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

vector<P> factorize(ll n) {
  vector<P> result;
  for (ll i = 2; i * i <= n; ++i) {
    if (n % i == 0) {
      result.pb({i, 0});
      while (n % i == 0) {
        n /= i;
        result.back().second++;
      }
    }
  }
  if (n != 1) {
    result.pb({n, 1});
  }
  return result;
}

vll divisor(ll n) {
  vll ret;
  for (ll i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  SORT(ret);
  return (ret);
}

signed main() {
  init();
  ll N, K;
  cin >> N >> K;
  vll A(N), F(N);
  rep(i, N) cin >> A[i];
  rep(i, N) cin >> F[i];

  SORT(A);
  REVERSE(A);
  SORT(F);
  ll l = -1;
  ll r = 0;
  rep(i, N) {
    r = max(r, A[i] * F[i]);
  }

  while (r - l > 1) {
    ll c = (l + r) / 2;
    ll count = 0;
    rep(i, N) {
      ll temp = 0;
      ll sa = A[i] * F[i] - c;
      if (sa < 0) continue;
      temp += sa / F[i];
      if (sa % F[i] != 0) temp++;
      count += min(temp, A[i]);
    }
    if (count <= K)
      r = c;
    else
      l = c;
  }
  COUT(r);

  return 0;
}

Measured memory_bytes: 6352
N = int(input())
S = input()

X = ""
Y = S[1:]

leader = S[0]
num_x = 0
num_y = Y.count("E")

num = num_y

for i in range(1, N):
    
    X_new = leader
    
    if X_new == "W":
        num_x += 1
    
    leader = S[i]
    
    if leader == "E": 
        num_y -= 1
    
    num = min(num, num_x+num_y)
    
print(num)

Measured memory_bytes: 3700
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int dp[100001];
vector<int> adj[100001];
ll dfs(int s)
{
    if (s < 1)
        return 0;
    if (dp[s] != -1)
        return dp[s];
    if (adj[s].size() == 0)
    {
        dp[s] = 0;
    }
    else
    {
        for (auto it = adj[s].begin(); it != adj[s].end(); it++)
        {
            dp[s] = max((ll)dp[s], 1 + dfs(*it));
        }
    }

    return dp[s];
}

int main()
{

    int v;
    int e;
    cin >> v;
    cin >> e;
    for (int i = 0; i <= v; i++)
    {
        dp[i] = -1;
    }
    for (int i = 1; i <= e; i++)
    {
        int a;
        int b;
        cin >> a;
        cin >> b;
        adj[a].push_back(b);
    }

    for (int i = 1; i <= v; i++)
    {
        if (dp[i] == -1)
        {
            dfs(i);
        }
    }

    int *ma;
    ma = max_element(dp, dp + (v + 1));
    cout << *ma << "\n";
}

Measured memory_bytes: 7424
#include <stdio.h>
#include <math.h>
 
int main()
{
    double x1, y1, x2, y2;
     
    scanf("%lf%lf%lf%lf", &x1, &y1, &x2, &y2);
    printf("%.8lf\n", hypot(x1-x2, y1-y2));
    return 0;
}


Measured memory_bytes: 2144
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#define LLINF 9223372036854775807
#define MOD ll(1e9+7)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cerr<<#x<<": "<<x<<endl

map<ll,ll> counter(const string &v){
    map<ll,ll> cnt;
    for(int i=0;i<v.size();i++){
        cnt[v[i]] += 1;
    }
    return cnt;
}


int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    map<ll,ll> mp = counter(s);
    ll ans = 1;
    for(auto itr = mp.begin(); itr != mp.end(); ++itr) {
        ans *= (itr->second+1);
        ans %= MOD;
    }
    cout << (ans-1+MOD)%MOD << endl;
    return 0;
}


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

int main() {
  
  int N;
  cin >> N;
  int a = 0;
  int mini = 1000;
  
  for (int i = 0; i < N; i++){
    
    int x;
    cin >> x;
    
    
   while(x % 2 == 0){
     a  = a + 1;
     x = x / 2;
   }
   
    //ここでのxの値はしっかり2で割り続けた値
    
    if (mini > a){
      mini = a;
    }
    
    a = 0;
   
   }
  
  cout << mini << endl;
    

 }

Measured memory_bytes: 3576
#include<cstdio>
#include<string>
#include<iostream>
using namespace std;
int main(){
    string str;
    /*改行が行われるまで、文字列を入力する*/
    getline(cin,str);
    for(int i=0;i<str.size();i++){
        if(str[i]>='a' && str[i]<='z') printf("%c",str[i]-('a'-'A'));
        else if(str[i]>='A' && str[i]<='Z') printf("%c",str[i]+('a'-'A'));
        else cout << str[i];
    }
    cout << endl;
}


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

#define REP(i,n) for(int i=0; i<int(n); i++)
#define FOR(i,m,n) for(int i=int(m); i<int(n); i+=2)
#define ALL(obj) (obj).begin(),(obj).end()
#define VI vector<int>
#define VC vector<char>
#define FOREACH(x,a) for(auto& (x) : (a) )
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	vector<string> v;
	REP(i, h) {
		string a;
		cin >> a;
		bool b = false;
		REP(i, w) {
			if (a[i] == '#') b = true;
		}
		if (b == true) v.push_back(a);
	}
	VI vi;
	REP(i, w) {
		int n = v.size();
		REP(j, v.size()) {
			if (v[j][i] == '.') n--;
		}
		if (n == 0) vi.push_back(i);
	}
	REP(i, v.size()) {
		REP(j, w) {
			bool a = true;
			REP(k, vi.size()) {
				if (vi[k] == j) a = false;
			}
			if (a) {
				cout << v[i][j];
			}
		}
		cout << endl;

	}
	return 0;
}

Measured memory_bytes: 764
#include <iostream>
#include <iomanip>
#include <vector>
#include <utility>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <string.h>
#include <deque>
#define REP(i,j,n) for(int i=j;i<n;i++)
#define SORT(x) sort(x.begin(),x.end())

using namespace std;

int main() {
	int n, min, ans;
	bool start = true;
	cin >> n;
	for (int i = 1; i < n; i++) {
		int x, y;
		if (start) {
			cin >> x >> y;
			ans = y - x;
			(x < y) ? min = x : min = y;
			start = false;
		}
		else {
			cin >> x;
			if (ans < x - min) ans = x - min;
			if (min > x)min = x;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3084
#include <iostream>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <algorithm>
#include <numeric>
#include <fstream>
#include <iomanip>

typedef long double ld;
typedef long long ll;
const ll INF = (ll)1e18 + 1;
const ll MOD = 1e9 + 7;

// Split
namespace util {

std::vector< std::string > split(std::string s, char delimiter)
{
  std::vector< std::string > vs;
  std::string sub;
  for (auto c : s) {
    if (c == delimiter) vs.push_back(sub), sub.clear();
    else sub += c;
  }
  vs.push_back(sub);
  return vs;
}

} // namespace util

// Minimum, Maximum
template<class T> T minimum(T head, T tail) { return std::min(head, tail); }
template<class H, class... T> H minimum(H head, T... tail) { return std::min(head, minimum(tail...)); }
template<class T> T maximum(T head, T tail) { return std::max(head, tail); }
template<class H, class... T> H maximum(H head, T... tail) { return std::max(head, maximum(tail...)); }

// Output
template<class T, class S> std::ostream& operator <<(std::ostream& os, std::pair<T, S> p)
{
  return os << "(" << p.first << " " << p.second << ")";
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< T > v)
{
  for (ll i = 0; i < (ll)v.size(); i++){ os << " [" << i << "]" << v[i]; if (i % 10 == 9) os << std::endl; }
  //os << v[0]; for (ll i = 1; i < (ll)v.size(); i++){ os << " " << v[i]; }
  return os;
}

template<class T, class S> std::ostream& operator <<(std::ostream& os, std::map< T, S > m)
{
  ll i = 0; for (auto p : m){ os << " [" << i << "]" << p.first << "->" << p.second; i++;}
  return os;
}

template<class T> std::ostream& operator <<(std::ostream& os, std::vector< std::vector<T> > vv)
{
  for (auto& vec : vv){ os << vec << std::endl; }
  os << "--------" << std::endl;
  return os;
}

void print(){ std::cout << std::endl; }
template<typename H> void print(H&& head){ std::cout << head << std::endl; }
template<typename H, typename... T> void print(H&& head, T&&... tail){
  std::cout << head << " ", print(std::forward<T>(tail)...);
}

// GCD, LCM
ll gcd(ll a, ll b) {
  while (b != 0) { a %= b; std::swap(a, b); }
  return a;
}
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }

// DIGNUM
std::vector<ll> dignum(ll x) {
  if (x == 0) return {0};
  std::vector<ll> res;
  while (x) {
    res.push_back(x % 10);
    x /= 10;
  }
  std::reverse(res.begin(), res.end());
  return res;
}

// FAIL
void fail(){ print(-1); std::exit(0); }
//void fail(){ print("No"); std::exit(0); }

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

  ll N, M;
  std::cin >> N >> M;

  std::vector< ll > vh(N, 0LL);
  std::vector< ll > vcheck(N, 1LL);
  for (ll i = 0; i < N; i++) {
    std::cin >> vh[i];
  }
  for (ll i = 0; i < M; i++) {
    ll A, B;
    std::cin >> A >> B;
    A--; B--;
    if (vh[A] >= vh[B]) vcheck[B] = 0LL;
    if (vh[B] >= vh[A]) vcheck[A] = 0LL;
  }

  ll ans = std::accumulate(vcheck.begin(), vcheck.end(), 0LL);
  print(ans);

  return 0;
}


Measured memory_bytes: 4796
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int main(){
    int N; cin>>N;
    vector<vector<int> > a(N,vector<int> (3,0));
    for(int i = 0; i < N; i++)
	for(int j = 0; j < 3; j++)
	    cin>>a[i][j];
    vector<vector<int> > dp(N, vector<int>(3, 0));
    dp[0][0] = a[0][0]; dp[0][1] = a[0][1]; dp[0][2] = a[0][2];
    for(int i = 1; i < N; i++){
	for(int j = 0; j < 3; j++){
	    for(int k = 0; k < 3; k++){
		if(j!=k){
		    dp[i][j] = max(dp[i][j], dp[i-1][k] + a[i][j]);
		}
	    }
	}
    }
    cout<<max(dp[N-1][0],max(dp[N-1][1], dp[N-1][2]))<<endl; 
}


Measured memory_bytes: 11136
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<string>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<cctype>
#include<sstream>
using namespace std;
#define rep(i, j) for(int i = 0; i < j; i++)
#define f(i, k, j) for(int i = k; i < j; i++)
#define P pair<int, int>
const int INF = (1 << 26);
const int MAX_N = 102;

void disp();
int dp[MAX_N][MAX_N], n;

int main(){
    string s;
    char ch;
    int t[MAX_N][MAX_N];

    for(n=0;cin>>s;n++){
        stringstream ss(s);
        for(int j=0;;j++){
            ss>>t[n][j];
            if(!(ss>>ch)) break;
        }
    }

    memset(dp, -1, sizeof(dp));
    dp[0][0] = t[0][0];

    int i = 0;
    for( ; i < n / 2; i++){
        for(int j = 0; j <= i; j++){
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][j] + t[i + 1][j]);
            dp[i + 1][j + 1] = max(dp[i + 1][j + 1], dp[i][j] + t[i + 1][j + 1]);
        }
    }
    for( ; i < n; i++){
        for(int j = 0; j < n-i; j++){
            dp[i][j] = max(dp[i - 1][j] + t[i][j], dp[i - 1][j + 1] + t[i][j]);
        }
    }

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

void disp(){
    rep(i, n){
        rep(j, 15){
            cout <<dp[i][j] <<", ";
        }
        cout <<endl;
    }
    cout <<endl;
}

Measured memory_bytes: 1312
#include <cstdio>
#include <cmath>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <algorithm>
#include <set>
#include <map>
#include <list>
#include <deque>
#include <vector>
#include <string>
#include <bitset>
#define y0 y3487465
#define y1 y8687969
#define j0 j1347829
#define j1 j234892
#define next asdnext
#define prev asdprev
#define INF 1000000000
#define kaigyou <<"\n"
#define pb push_back
#define pf push_front
#define mp make_pair
#define endl "\n"
#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP_R(i,n) for(int i=((int)(n)-1);i>=0;--i)
#define FOR(i,m,n) for(int i=((int)(m));i<(int)(n);++i)
#define FOR_R(i,m,n) for(int i=((int)(m)-1);i>=(int)(n);--i)
#define ALL(v) (v).begin(),(v).end()
typedef long long int lli;
using namespace std;

int main()
{
  int H,W;
  int h,w;
  
  
  cin >> H >> W;
  cin >> h >> w;

  cout << (H*W-H*w-W*h+h*w) kaigyou;
  

}


Measured memory_bytes: 256
/* created   : 2019-08-11 23:12:13
 * accepted  : 2019-08-11 23:12:13
 * author    : landcold7
 */
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#ifndef LOCAL
#define trace(...)
#endif
typedef long long ll;

void solve() {
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    string s = to_string(i);
    if ((int) s.size() % 2 == 1) {
      ans++;
    }
  }
  cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<ll,ll> p2;
ll func(ll n){
	return n*n*n*n*n;
}
void solve(){
	ll n;
	cin>>n;
	for(ll i=(-1000);i<=1000;i++)
	for(ll j=(-1000);j<=1000;j++)
	if(func(i)-func(j)==n){
		cout<<i<<" "<<j;
		exit(0);
	}
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll qc=1;
    for(ll i=1;i<=qc;i++)
    solve();
}


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

using namespace std;
typedef long long ll;
typedef double dd;
#define all(v) v.begin(),v.end()
#define endl "\n"
#define clr(n, r) memset(n,r,sizeof(n));

void fast() {

    cin.tie(0);
    cin.sync_with_stdio(0);
}

ll n, m;


int main() {
    fast();
    int n;cin>>n;
    ll arr[n];
    for (int i = 0; i < n; ++i) {
        cin>>arr[i];
    }
    ll ans=1e18;
    for (ll j = -100; j <=100 ; ++j) {
        ll sum=0;
        for (int i = 0; i < n; ++i) {
        sum+=(powl(arr[i]-j,2));
        }
        ans=min(ans,sum);
    }
    cout<<ans;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define Cout2(x, y) cout << (x) << " " << (y) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = 1e9;
const double pi = acos(-1.0);

bool Check(string s) {
	bool flag = sz(s) >= 6;
	bool d = false, l = false, u = false;
	for (auto c : s) {
		if (isdigit(c))d = true;
		if (islower(c))l = true;
		if (isupper(c))u = true;
	}
	if (d + l + u != 3)flag = false;
	return flag;
}

int main() {
	string s; cin >> s;
	puts(Check(s) ? "VALID" : "INVALID");
}


Measured memory_bytes: 3200
#include <iostream>
#include <stdio.h>
#include <cmath>
using namespace std;

typedef long long LL;
LL a[234567];
LL pre[234567];

int main() {
    int n;
    scanf("%d",&n);
    for (int i=1;n>=i;i++) {
        scanf("%lld",&a[i]);
        pre[i] = pre[i-1] + a[i];
    }
    LL ans= abs( (pre[n]-pre[1]) - (pre[1]) );
    for (int i=2;n-1>=i;i++) {
        ans = min(ans, (LL)abs((pre[n] - pre[i]) - (pre[i]) ) );
    }
    cout<<ans<<endl;
}



Measured memory_bytes: 3328
N, W = list(map(int, input().split()))
dp = [[0]*(W+1) for _ in range(N+1)]
for i in range(N):
    w, v = list(map(int, input().split()))
    for j in range(W+1):
        if j + w <= W:
            dp[i+1][j+w] = max(dp[i+1][j+w], dp[i][j] + v)
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
print(max(dp[N]))

Measured memory_bytes: 152568
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
#include <cassert>
#include <functional>
#include <string>
#include <sstream>
#include <cctype>
using namespace std;

int main(){
  int N; cin >> N;
  vector<int> T(N);
  for(int i = 0; i < N; i++) cin >> T[i];
  int M; cin >> M;
  vector<pair<int, int>> PX(M);
  for(int i = 0; i < M; i++) cin >> PX[i].first >> PX[i].second;
  
  int sum = 0;
  for(int i = 0; i < N; i++) sum += T[i];
  for(int i = 0; i < M; i++) cout << sum - T[PX[i].first - 1] + PX[i].second << endl;
}


Measured memory_bytes: 256
import sys
INF = 1 << 60
MOD = 10**9 + 7 # 998244353
sys.setrecursionlimit(2147483647)
input = lambda:sys.stdin.readline().rstrip()
def resolve():
    a, b = input().split()
    a = int(a)
    s, t = b.split('.')
    b = int(s + t)
    print(a * b // 100)
resolve()

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

int main(){
  string s;
  int64_t K;
  cin >> s >> K;
  int diff;
  for(int i=0;i<s.size()-1;i++){
    if(s.at(i)=='a'){
      cout << s.at(i);
    }else{
      diff='z'-s.at(i)+1;
      if(K>=diff){
        cout << 'a';
        K-=diff;
      }else{
        cout << s.at(i);
      }
    }
  }
  K%=26;
  cout << static_cast<char>(((s.back()-'a')+K)%26+'a') << endl;
  return 0;
}


Measured memory_bytes: 3760
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
 
#define sl(x) scanf("%ld", &x)
#define ss(x) scanf("%s", x)
#define pl(x) printf("%ld\n", x)
#define ps(x) printf("%s\n", x)
 
#define INF 100000000000
#define MOD 1000000007
 
#define min(a,b) (((a)<(b))?(a):(b))
#define max(a,b) (((a)>(b))?(a):(b))

int compare_long(const void *a, const void *b) {
	return *(long*)a - *(long*)b;
}

int main() {
	long N;
	long i, j;
	long A[100010];
	long check[100010] = {0};
	long ans;
	long f = 0;
	
	sl(N);
	for(i=0;i<N;i++) {
		sl(A[i]);
		check[A[i]]++;
	}
	
	if(N % 2) {
		if(check[0] != 1) f = 1;
		for(i=2;i<N;i+=2) {
			if(check[i] != 2) f = 1;
		}
	} else {
		for(i=1;i<N;i+=2) {
			if(check[i] != 2) f = 1;
		}
	}
	
	if(f) {
		pl(0);
		return 0;
	}
	
	ans = 1;
	for(i=0;i<N/2;i++) {
		ans = (ans * 2) % MOD;
	}
	
	pl(ans);
	
	return 0;
}

Measured memory_bytes: 1792
//#include <bits/stdc++.h>
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;


#include "boost/multiprecision/cpp_int.hpp"
#include "boost/multiprecision/cpp_dec_float.hpp"
namespace mp = boost::multiprecision;
typedef mp::cpp_int LL;
typedef mp::number<mp::cpp_dec_float<1024>> DD;// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)

 
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
typedef pair<dd,dd> d_d;
ll inf=(ll)1E16;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define rrep(i,r,l) for(ll i=r;i>=l;i--)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define fi first
#define se second
#define endl "\n"  //インタラクティブで消す！！！！！！！！！！！！！！！！！！！！！
#define SORT(v) sort(v.begin(),v.end())
#define ERASE(v) v.erase(unique(v.begin(),v.end()),v.end())
#define POSL(v,x) (lower_bound(v.begin(),v.end(),x)-v.begin())
#define POSU(v,x) (upper_bound(v.begin(),v.end(),x)-v.begin())
template<class T,class S>
inline bool chmax(T &a, S b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}
template<class T,class S>
inline bool chmin(T &a, S b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

void mod_print(ll k){
    ll P=1000;
    rep(y,1,P){
        ll x=mod(y*k);
        if(x+P>=i_7){
            x-=i_7;
        }
        if(abs(x)<=P){
            //cout<<x<<"/"<<y;
            cout<<setprecision(5)<<(dd)x/(dd)y;
            return;
        }
    }
    cout<<"nun"<<endl;
}
#define all(c) c.begin(),c.end()
//////////////////////////


int main(){fastio
    string s;ll k;cin>>s>>k;
    ll n=s.size();
    ll dp[n][n][k+1];memset(dp,0,sizeof(dp));
    rep(i,0,n-1)dp[i][i][0]=1;
    rep(i,0,n-2){
        if(s[i]==s[i+1])dp[i][i+1][0]=2;
        else{
            if(k!=0)dp[i][i+1][1]=2;
            dp[i][i+1][0]=1;
        }
    }
    rep(len,2,n){
        rep(l,0,n-1){
            ll r=l+len-1;
            if(r>=n)continue;
            rep(t,0,k){
                chmax(dp[l][r][t],dp[l][r-1][t]);
                chmax(dp[l][r][t],dp[l+1][r][t]);
                if(s[l]==s[r]){
                    chmax(dp[l][r][t],dp[l+1][r-1][t]+2);
                }else{
                    if(t-1>=0)chmax(dp[l][r][t],dp[l+1][r-1][t-1]+2);
                }
            }
        }
    }
    /*
    rep(t,0,k){
        rep(i,0,n-1){
            rep(j,0,n-1){
                cout<<dp[i][j][t]<<" ";
            }cout<<endl;
        }cout<<endl;
    }
    */
    ll ans=0;
    rep(i,0,n-1)rep(j,i,n-1)rep(t,0,k)chmax(ans,dp[i][j][t]);
    cout<<ans<<endl;
    
    return 0;
}





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

#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
#define size_t unsigned long long
#define ll long long
#define rep(i,a) for(int i=0;i<(a);i++)
#define repr(i,a) for(int i=(int)(a)-1;i>=0;i--)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(int)(b)-1;i>=a;i--)
#define ALL(a) a.begin(), a.end()
using namespace std;
int si() { int x; scanf("%d", &x); return x; }
long long sl() { long long x; scanf("%lld", &x); return x; }
string ss() { string x; cin >> x; return x; }
void pi(int x) { printf("%d ", x); }
void pl(long long x) { printf("%lld ", x); }
void pd(double x) { printf("%.15f ", x); }
void ps(const string &s) { printf("%s ", s.c_str()); }
void br() { putchar('\n'); }

const int MOD = 1e9 + 7;

struct mint {
    int n;
    mint(int n_ = 0) : n(n_) {}
};

mint operator+(mint a, mint b) { a.n += b.n; if (a.n >= MOD) a.n -= MOD; return a; }
mint operator-(mint a, mint b) { a.n -= b.n; if (a.n < 0) a.n += MOD; return a; }
mint operator*(mint a, mint b) { return (long long)a.n * b.n % MOD; }
mint &operator+=(mint &a, mint b) { return a = a + b; }
mint &operator-=(mint &a, mint b) { return a = a - b; }
mint &operator*=(mint &a, mint b) { return a = a * b; }

typedef pair<int, int> P;

const int N = 1e5+5;
string s;
vector<int> v[N];
int n;
int a;
P p[N];

int main () {
  cin >> n;
  rep(i,n) {
    cin >> a;
    p[i] = P(a,i);
  }
  SORT(p, n);
  rep(i,n) cout << p[i].second + 1 << " ";
  br();
}


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

#include<cstdio>
#define r(i,n) for(int i=0;i<n;i++)


int main(void){
    int a,b,x;
    cin>>x>>a>>b;

    abs(x-a) >abs(x-b) ? cout<<"B"<<endl : cout<<"A"<<endl;






return 0;

}


Measured memory_bytes: 256
#include<stdio.h>
#include<stdlib.h>

struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL

Node root;

Node find(Node u, int k){

  while(u!=NIL && k != u->key){
    if(k < u->key) u =u->left;
    else u = u->right;
  }
  return u;
}

void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;

  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;

  while( x != NIL ){
    y = x;
    if(z->key < x->key ) {
      x= x->left;
    } else {
      x = x->right;
    }
  }

  z->parent = y;
  if( y ==NIL ){
    root = z;
  } else {
    if(z->key < y->key ){
      y->left = z;
    } else {
      y->right = z;
    }
  }
}



void inorder(Node u) {

  if( u == NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}

void preorder(Node u){
  if(u == NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}


int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);

  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if(com[0] == 'f'){
      scanf("%d",&x);
      Node t = find(root, x);
      if(t!= NIL)printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    }
  }

  return 0;
}

Measured memory_bytes: 19364
n = int(input())
fs = []
for _ in range(n):
    r = list(input())
    r = [ord(s) - ord("a") for s in r]    
    fs.append(r)
sym = [[0]*n for i in range(n)]
cnt = 0
# di,dj とdi+1,dj+1が同値
# dj側は0で固定して良い
for di in range(n):
    for i in range(n):
        for j in range(n):
            sym[(i+di)%n][j] = fs[i][j]
    flg = True
    for i in range(n):
        for j in range(i+1,n):
            if sym[i][j] != sym[j][i]:
                flg = False
                break
    if flg:
        cnt += n
print(cnt)


Measured memory_bytes: 75020
package main

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

func main() {
	sc := NewScanner()

	n := sc.NextInt()
	m := sc.NextInt()

	mi := 1
	mx := n
	for i := 0; i < m; i++ {
		l := sc.NextInt()
		r := sc.NextInt()
		if mi < l {
			mi = l
		}
		if mx > r {
			mx = r
		}
	}
	if (mx - mi + 1) < 0 {
		fmt.Printf("%+v\n", 0) // output for debug
		return
	}
	fmt.Printf("%+v\n", mx-mi+1) // output for debug
}

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) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			result = append(result, v)
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	result = append(result, v)

	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: 3328
#pragma comment(linker, "/STACK:256000000")
#pragma GCC optimize("O3")

#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <string>
#include <assert.h>
#include <set>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <random>
#include <map>
#include <bitset>

#define sz(a) (int)((a).size())
#define all(a) (a).begin(), (a).end()
#define pb push_back
#define eb emplace_back
#define mp make_pair

#define X first
#define Y second

using namespace std;

mt19937 rng(time(NULL));

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using ld = long double;
using vb = vector<bool>;

const ll MOD = 998244353;

ll sqr(ll a) {
	return a * a;
}

ll powmod(ll a, ll x, ll p = MOD) {
	if (x <= 0) return 1;
	if (x % 2 == 0) return sqr(powmod(a, x >> 1, p)) % p;
	else return (a * powmod(a, x - 1, p)) % p;
}

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

int32_t main() {
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);

	int N;
	cin >> N;

	vector<ll> fact(1, 1);
	for (int i = 1; i <= N; i++) fact.pb((fact.back() * i) % MOD);

	vector<ll> ofact(N + 1);
	ofact[N] = powmod(fact[N], MOD - 2, MOD);
	for (int i = N - 1; i >= 0; i--) ofact[i] = (ofact[i + 1] * (i + 1)) % MOD;

	ll ans = 0;
	ll pw2 = 2;

	for (int i = 0; i < N / 2; i++) {
		ans += ((pw2 * fact[N]) % MOD) * ((ofact[i] * ofact[N - i]) % MOD);
		ans %= MOD;
		pw2 *= 2;
		if (pw2 >= MOD) pw2 -= MOD;
	}

	cout << (powmod(3, N) - ans + MOD) % MOD << endl;

	return 0;
}

Measured memory_bytes: 158296
a, b, h, m = map(int, input().split())
import math
lca = 360 * (h + (m / 60)) /12
lcb = 360 * m / 60
if lca > lcb:
    if lca - lcb < 180:
        ctw = a**2 + b**2 - 2 * a * b * math.cos(math.radians(lca - lcb))
    else:
        lcx = 360 - (lca - lcb)
        ctw = a**2 + b**2 - 2 * a * b * math.cos(math.radians(lcx))
else:
    if lca - lcb < 180:
        ctw = a**2 + b**2 - 2 * a * b * math.cos(math.radians(lcb - lca))
    else:
        lcx = 360 - (lcb - lca)
        ctw = a**2 + b**2 - 2 * a * b * math.cos(math.radians(lcx))
c = math.sqrt(ctw)
print(c)

Measured memory_bytes: 62592