akhauriyash/Code-Regression huggingface dataset:
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

typedef vector<VI> Adj;
struct Matching2 { // for bipartite graph
    vector<int>matchM, matchW, use;
    int ans;
    bool dfs(const Adj &G, int v) {
	if (use[v]) return false;
	use[v] = true;
	for (int i=0; i<(int)G[v].size(); i++) {
	    int u = G[v][i];
	    if (matchW[u] == -1 || dfs(G, matchW[u])) {
		matchM[v] = u;
		matchW[u] = v;
		return true;
	    }
	}
	return false;
    }
    Matching2(const Adj &G, int sizeM, int sizeW): matchM(sizeM, -1), matchW(sizeW, -1), ans(0) {
	for (int i=0; i<sizeM; i++) {
	    use = vector<int>(sizeM, 0);
	    if (dfs(G, i)) ans++;
	}
    }
};
int N;
int A[111];
int B[111];
int C[111];
int D[111];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) scanf("%d%d", A+i, B+i);
    REP (i, N) scanf("%d%d", C+i, D+i);

    Adj G(N);
    REP (i, N) REP (j, N) {
	if (A[i] < C[j] && B[i] < D[j]) {
	    G[i].push_back(j);
	}
    }

    Matching2 M(G, N, N);
    printf("%d\n", M.ans);

}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 256
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1, (len(p)-1)):
  if (p[i - 1] < p[i] and p[i] < p[i + 1]) or (p[i - 1] > p[i] and p[i] > p[i + 1]):
    count += 1
    
print(count)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define ll long long
#define for(in1,in2,in3) for (int in1 = in2; in1 < in3; in1++)
#define inf 1e9
#define mp make_pair
#define pb push_back
#define f first
#define s second
using namespace std;

int mx,x,y,z,t,u,v,ans,n,m,o;
string s1,s2,ans1;

int main() {
	cin >> s1;
	if (s1[3] == s1[2] && s1[4] == s1[5]) cout << "Yes\n"; else cout << "No\n";
}

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

using namespace std;
// #define int long long
mt19937 rnd(time(0));
typedef long long ll;
typedef long double ld;

// #define _GLIBCXX_DEBUG
#define f first
#define s second
#define pb push_back
#define pii pair<int, int> 
#define vi vector<int>
#define int ll

int f(int x) {
    if (x < 2)
        return 1;
    return x * f(x - 2);
}

void solve(){
    // cout << (ld) 1000000000000000000LL / 124999999999999995LL << endl;
    int n;
    cin >> n;
    if (n % 2)
        cout << 0 << endl;
    else {
        int k = 5;
        int ans = 0;
        int z = 0;
        for (int i = k; i <= n; i *= k, z++) {
            ans += n / i / 2;
        }
        cout << ans  << endl;
    }
}

signed main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    int t = 1;
    while(t--){
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define pb push_back
#define pf push_front
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
typedef long long ll;
typedef pair<char, char> c_c;
typedef pair<int, int> i_i;
typedef pair<ll, ll> l_l;
const ll INF = 1000000007;
const ll LLINF = 1000000000000000007LL;

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

    int n;
    cin >> n;
    vector<ll> a(n);
    vector<ll> cnt1(60);
    rep(i, n) cin >> a[i];
    rep(i, n){
        bitset<60> bit(a[i]);
        for(int j=0; j<60; j++){
            if(bit.test(j)) cnt1[j]++;
        }
    }
    ll ans = 0;
    for(int i=0; i<60; i++){
        ans += ((cnt1[i]*(n-cnt1[i])%INF)*((1LL<<i)%INF))%INF;
        ans %= INF;
    }

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

Measured memory_bytes: 2560
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define repr_inv(i,a,b) for(int i=(int)(a);i>=(int)(b);i--)
#define rep(i,n) repr(i,0,n)
#define INF 10^9
#define INFLL 4000000000000000000
using namespace std;
struct pos{
	long long x, y;
};
int main(void)
{
	int n, k, count;

	long long area, min=INFLL;

	cin>>n>>k;

	vector<struct pos> x_sort(n), y_sort(n);

	rep(i, n){
		cin>>x_sort[i].x>>x_sort[i].y;
	}
	stable_sort(x_sort.begin(), x_sort.end(), [](const pos&x, const pos&y){ return x.y<y.y; });
	y_sort=x_sort;
	stable_sort(x_sort.begin(), x_sort.end(), [](const pos&x, const pos&y){ return x.x<y.x; });

	min=INFLL;
	rep(i, n){
		rep(j, n){
			rep(l, n){
				rep(m, n){
					count=0;
					rep(p, n){
						if(i!=l&&j!=m&&x_sort[p].x>=x_sort[i].x&&x_sort[p].x<=x_sort[l].x&&x_sort[p].y>=y_sort[j].y&&x_sort[p].y<=y_sort[m].y) count++;
					}
					if(count>=k){
						area=abs(x_sort[i].x-x_sort[l].x)*abs(y_sort[j].y-y_sort[m].y);
						if(min>area) min=area;
					}
				}
			}
		}
	}
	cout<<min<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
using namespace std;
int main()
{
    int n,i;
    cin>>n;
    vector<int>a(n+1);
    vector<int>b(n+1);
    vector<int>c(n+1);
    int dp[n+1][3]={0};
    for(i=1;i<=n;i++)
    {
        cin>>a[i];
        cin>>b[i];
        cin>>c[i];
    }
    dp[1][0]=a[1];
    dp[1][1]=b[1];
    dp[1][2]=c[1];
    for(i=2;i<=n;i++)
    {
        dp[i][0]=a[i]+max(dp[i-1][1],dp[i-1][2]);
        dp[i][1]=b[i]+max(dp[i-1][0],dp[i-1][2]);
        dp[i][2]=c[i]+max(dp[i-1][1],dp[i-1][0]);
    }
    cout<<max(dp[n][0],max(dp[n][1],dp[n][2]));
    return 0;
}


Measured memory_bytes: 5596
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>

using namespace std;
using ll = long long;

void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }

#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Vec2(T, n, m, xs, x0) vector<vector<T>> xs(n, vector<T>(m, x0))
#define Sum(a) accumulate(Range(a), 0)
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) for(const auto &e : xs) cout << e << " "; cout << "\n"
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")

// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, n);
    Cins(int, n, h);
    
    int a = -1;
    int ans = 0;
    For(i, n){
        if(a <= h[i]){
            ans ++;
            a = h[i];
        }
    }
    Cout(ans);
    
}


Measured memory_bytes: 256
class Main
{
	public static void main(String[] args)
	{
		for (int i = 1; i <= 9; ++i)
		{
			for (int j = 1; j <= 9; ++j)
			{
				System.out.println(i + "x" + j + "=" + i * j);
			}
		}
	}
}

Measured memory_bytes: 24120
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007

int n, k, cnt[100005], sz, cur, ans;
vector<pair<int,int> > vp;
priority_queue<pair<int,int> > pq;
signed main(){
	cin >> n >> k;
	for(int i = 1 ; i <= n ; i ++){
		int t, d;
		cin >> t >> d;
		pq.push({d, t - 1});
	}
	for(int i = 1 ; i <= k ; i ++){
		pair<int,int> now = pq.top(); pq.pop();
		cnt[now.second] ++;
		cur += now.first;
		vp.push_back(now);
		sz += (cnt[now.second] == 1);
	}
	ans = sz*sz + cur;
	while(k --){
		if(cnt[vp[k].second] > 1){
			while(pq.size()){
				pair<int,int> now = pq.top(); pq.pop();
				if(!cnt[now.second]){
					cur = cur - vp[k].first + now.first;
					sz ++; cnt[now.second] ++; cnt[vp[k].second] --;
					ans = max(ans, sz*sz + cur);
					break;
				}
			}
		}
	}
	cout << ans;
}


Measured memory_bytes: 5616
import java.util.Scanner;

public class Main 
{
	public static void main(String[] args)
	{
		Scanner scanner = new Scanner(System.in);
		
		for(;;)
		{
			String in = scanner.next();
			if(in.equals("0"))
			{
				break;
			}
			
			int sum = 0;
			for(int i=0; i<in.length(); i++)
			{
				char c = in.charAt(i);
				sum += c - '0';
			}
			
			System.out.println(sum+"");
		}
	}
}

Measured memory_bytes: 26036
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vi = vector<int>;
using vvi = vector<vi>;
#define ote(x) cout<<(x)<<endl
#define all(x) (x).begin(),(x).end()
#define rp(i,s,e) for(int i=(s);i<(e);++i)

int main(){
	string S; cin>>S;
	int n = 'z'-'a';
	vi A(n+1);
	// map<char,int> M;
	rp(i, 0, S.size()){
		// M[S[i]]++;
		A[S[i]-'a']++;
	}
	int ix = -1;
	rp(i, 0, A.size()){
		// printf("%c %d %d\n",i+'a',i,A[i]);//
		if(A[i] <= 0){
			ix = i;
			break;
		}
	}
	if(ix < 0) puts("None");
	else printf("%c\n",ix+'a');
}


Measured memory_bytes: 512
/*
// Author -> Preeyadarshee Dev
//
// train hard win easy :D
// nik is love
// nik is motivation
//
// do modulo operations very carefully
// try to avoid binary search, use linear search preferrably to make calculations easier
// always make your custom binary search and watch out for overflows
// read the problems carefully
*/
/*
*/
#include <bits/stdc++.h>
#define mp                    make_pair
#define pb                    push_back
#define ll                   long long
#define ss                       second
#define ff                        first
#define fr(i,a,b)   for(ll i=a;i<b;i++)
#define f(i,n)                fr(i,0,n)
#define rf(i,b,a) for(ll i=b-1;i>=a;i--)
#define r(i,n)                rf(i,n,0)
#define inf                   1000000007
#define eps                  0.000000000000001
#define endl                       '\n'
#define sz(a)                int((a).size())
#define all(c)               (c).begin(),(c).end()
#define tr(c,i)              for(typeof(c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x)         ((c).find(x) != (c).end())
#define cpresent(c,x)        (find(all(c),x) != (c).end())
#define pi                   pair<int,int>
#define PI                   3.141592653589793238462643383279502884197169399375105820974944592307816406286
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef pair<int,int> ii;
typedef vector< int > vi;
typedef vector< vi > vvi;
int dx[8]={1,-1,0,0,-1,-1,1,1};
int dy[8]={0,0,-1,1,-1,1,-1,1};
vector<int> adj[100010];
vector<int> vis(100010,0);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    //ifstream fin;
    //ofstream fout;
    //fin.open("input.txt");
    //fout.open("output.txt");
    //let's fuck dp
    int num;
    cin>>num;
    string str=to_string(num);
    if(str[0]==str[1]||str[1]==str[2]||str[2]==str[3])
    {
        cout<<"Bad"<<endl;
        return 0;
    }
    cout<<"Good"<<endl;
}



Measured memory_bytes: 2944
#include<iostream>
#include<algorithm>
using namespace std;
const int N=2e5+2;
int ar[N];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j,k,l,mod,lef,rig,mid,ans=0;
	cin>>n>>mod;
	lef=0;
	rig=n;
	for(i=1;i<=n*2;i++){
		cin>>ar[i];
	}
	sort(ar+1,ar+1+2*n);
	while(rig>lef){
		mid=(lef+rig)/2;
		i=2*mid+1;
		j=2*n;
		bool cac=true;
		while(j>i){
			if(ar[j]+ar[i]<mod){
				cac=false;
				break;
			}
			j--;
			i++;
		}
		if(cac){
			rig=mid;
		}
		else{
			lef=mid+1;
		}
	}
	//cout<<rig<<endl;
	i=2*rig;
	j=1;
	while(i>j){
		ans=max(ans,ar[j]+ar[i]);
		j++;
		i--;
	}
	i=2*rig+1;
	j=2*n;
	while(j>i){
		ans=max(ans,ar[j]+ar[i]-mod);
		j--;
		i++;
	}
	cout<<ans;
}

Measured memory_bytes: 1024
import sys
sys.setrecursionlimit(10 ** 6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1
def II(): return int(input())

def MI(): return map(int, input().split())
def MI1(): return map(int1, input().split())

def LI(): return list(map(int, input().split()))
def LI1(): return list(map(int1, input().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]

def printlist(lst, k='\n'): print(k.join(list(map(str, lst))))
INF = float('inf')

def solve():
    a, b = MI()

    tap = 1
    ans = 0
    while 1:
        if tap >= b:
            print(ans)
            break
        tap += a - 1
        ans += 1



if __name__ == '__main__':
    solve()


Measured memory_bytes: 3064
def main():
    nvertices, nedges = map(int, input().split())
    INF = float('inf')
    W = [[0 if i == j else INF for i in range(nvertices)] for j in range(nvertices)]
    for i in range(nedges):
        u, v, w = map(int, input().split())
        W[u][v] = w

    for k in range(nvertices):
        for i in range(nvertices):
            for j in range(nvertices):
                W[i][j] = min(W[i][j], W[i][k] + W[k][j])

    for i in range(nvertices):
        if W[i][i] < 0:
            print("NEGATIVE CYCLE")
            return

    for lst in W:
        print(" ".join(map(lambda e: str(e) if e < INF else "INF", lst)))


main()

Measured memory_bytes: 8220
#include <iostream>
using namespace std;
int main(){long p,q;while(cin>>p>>q){int j,i=0,c=0,pr[80];pr[0]=p;while(p*=10,c++==i&&p){cout<<(char)(p/q+'0');for(i=0;i<c;i++)if(p%q==pr[i]){cout<<endl;for(j=0;j<c;j++)cout<<(j<i?' ':'^');break;}pr[c]=p%=q;}if(c==1)cout<<'0';cout<<endl;}}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#include <string>

using namespace std;

int main()
{
    int n;
    int ac = 0, wa = 0, tle = 0, re = 0;
    cin >> n;
    for(int i = 0; i < n; i++){
        string s;
        cin >> s;
        if(s == "AC") ac++;
        else if(s == "WA") wa++;
        else if(s == "TLE") tle++;
        else re++;
    }
    cout << "AC x " << ac << endl;
    cout << "WA x " << wa << endl;
    cout << "TLE x " << tle << endl;
    cout << "RE x " << re << endl;
}

Measured memory_bytes: 3616
#include <bits/stdc++.h>
using namespace std;
 
int main(){
    string s;
    cin>>s;
    int w;
    cin>>w;
    for(int i = 0;i<s.size();i++){
        if(i%w==0){
            cout<<s.at(i);
        }
    }
        
}


Measured memory_bytes: 3548
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define irep(i, n) for (int i = (n); i >= 0; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = 1 << 30;
 
int main() {
  int x; cin >> x;
  if (x >= 30) cout <<"Yes" << endl;
  else cout << "No" << endl;
  return 0;
}

Measured memory_bytes: 3628
from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(x) for x in stdin.readline().rstrip().split()]
max_node = [0] * (N+1)
for i in range(N-1,-1,-1):
    max_node[i] = max_node[i+1]+A[i+1]


ans = 1
node = 1
for i in range(N+1):
    node -= A[i]
    if (i < N and node <= 0) or node < 0:
        print(-1)
        exit(0)
    node = min(node*2,max_node[i])
    ans += node
print(ans)

Measured memory_bytes: 20160
time_list = [int(input()) for i in range(5)]
ans = 0
min_rem = 10
for time in time_list:
    if time % 10 == 0:
        ans += time
    else:
        ans += (time // 10 + 1) * 10
        if min_rem > time % 10:
            min_rem = time % 10
if min_rem == 10:
    print(ans)
else:
    print(ans - (10 - min_rem))

Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

using namespace std;

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

/*
    freopen("input","r",stdin);
    freopen("output","w",stdout);
*/

typedef vector<int> VI;
typedef vector<VI> VVI;

bool FindMatch(int i, const VVI &w, VI &mr, VI &mc, VI &seen) {
  for (int j = 0; j < w[i].size(); j++) {
    if (w[i][j] && !seen[j]) {
      seen[j] = true;
      if (mc[j] < 0 || FindMatch(mc[j], w, mr, mc, seen)) {
        mr[i] = j;
        mc[j] = i;
        return true;
      }
    }
  }
  return false;
}

int BipartiteMatching(const VVI &w, VI &mr, VI &mc) {
  mr = VI(w.size(), -1);
  mc = VI(w[0].size(), -1);
  
  int ct = 0;
  for (int i = 0; i < w.size(); i++) {
    VI seen(w[0].size());
    if (FindMatch(i, w, mr, mc, seen)) ct++;
  }
  return ct;
}

int RX[110], RY[110], BX[110], BY[110];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    int N;
    cin >> N;
    for (int i = 0;i < N;i++) cin >> RX[i] >> RY[i];
    for (int i = 0;i < N;i++) cin >> BX[i] >> BY[i];
    vector<int> tmp(N, 0);
    vector<vector<int> > w(N, tmp);
    for (int i = 0;i < N;i++) {
    	for (int j = 0;j < N;j++) {
    		if (RX[i] < BX[j] && RY[i] < BY[j]) w[i][j] = 1;
    	}
    }
    vector<int> mr, mc;
    cout << BipartiteMatching(w, mr, mc) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<math.h>

typedef  long long ll;

#define rep(i,a,n) for(ll (i)=(a);(i)<(n);(i)++)
#define rrep(i,a,n) for(ll (i)=(a);(i)>=(n);(i)--)

#define INF ll 1 << 60
#define MOD 1000000007


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 gcd(long long int a,long long int b){
    long long int r;
    if(a < b){
        int tmp;
        tmp = a;
        a = b;
        b = tmp;
    }
    while(r = a % b){
        a = b;
        b = r;
    }
    return a;
}


void ys(){
    cout << "Yes" << endl;
}

void yb(){
    cout << "YES" << endl;
}

void ns(){
    cout << "No" << endl;
}

void nb(){
    cout << "NO" << endl;
}

int dig(int d){
    int ans = 1;
    if(d == 0) return ans;
    while(d != 0){
        d--;
        ans*=100;
    }
    return ans;
}

ll divisors(ll n) {
    vector<ll> res;

    for(ll i = 1; i*i <= n; ++i) {
        if(n % i != 0) continue;
        res.push_back(i-1);
        if(n/i == i) continue;
        res.push_back((n/i)-1);
    }

    ll ans = 0;

    rep(i,0,res.size()){
        if(res[i] != 0)
        if(n/res[i] == n%res[i]) ans += res[i];
    } 
    return ans;
}

void solve(void){
   vector<int> a (3);
   rep(i,0,3)cin >> a[i];
   sort(a.begin(),a.end());
   cout << a[2]*10+a[1]+a[0];

}

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n;
    cin>>n;
    vector<ll> a(n);
    ll val=0;
    for(ll i=0;i<n;i++)
  {
    cin>>a[i];
    val=val^a[i];
  }
  for(ll i=0;i<n;i++)
  cout<<(val^a[i])<<" ";
  
  cout<<"\n";
    
}

Measured memory_bytes: 4688
words = lambda t : list(map(t, input().split()))
n = int(input())
s = input()

if n % 2 != 0:
    print("No")
else:
    ans = True
    for i in range(n//2):
        #print(i,n//2 +1, s[i], s[n//2+i])
        if s[i] != s[n//2 + i]:
            ans = False
            break
    if ans:
        print("Yes")
    else:
        print("No")


Measured memory_bytes: 2940
#include <iostream>
#include <sstream>
#include <stdio.h>
#include<vector>
#include<climits>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<functional>
#include <numeric>
#include <map>
#define FORi(N) for(int i=0;i<N;++i)
#define FORj(N) for(int j=0;j<N;++j)
#define FORk(N) for(int k=0;k<N;++k)
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
ll gcd(ll m,ll n){
  if(n==0)return abs(m);
  return(gcd(n,m%n));
}
void putYN(bool b){
  if(b){
    cout<<"YES"<<endl;
  }else{
    cout<<"NO"<<endl;
  }
}
int main(){
  ll X,Y,Z,K;
  cin>>X>>Y>>Z>>K;
  vector<ll> A(X),B(Y),C(Z);
  vector<pair<ll,int>> ABC;
  FORi(X){
    cin>>A[i];
    ABC.push_back(make_pair(A[i],1));
  }
  FORi(Y){
    cin>>B[i];
    ABC.push_back(make_pair(B[i],2));
  }
  FORi(Z){
    cin>>C[i];
    ABC.push_back(make_pair(C[i],3));
  }
  sort(A.rbegin(),A.rend());
  sort(B.rbegin(),B.rend());
  sort(C.rbegin(),C.rend());
  vector<ll> ans;
  FORi(X){
    FORj(Y){
      FORk(Z){
        if((i+1)*(j+1)*(k+1)<=K)ans.push_back(A[i]+B[j]+C[k]);
        else break;
      }
    }
  }
  sort(ans.rbegin(),ans.rend());
  ll s = K;
  if(s>ans.size())s=ans.size();
  FORi(s){
    cout<<ans[i]<<endl;
  }
  //cout<<time<<endl;
  return 0;
}


Measured memory_bytes: 1532
#include<stdio.h>

#define N 100

void bubbleSort(int A[], int n);

int main()
{
  int i, n, A[N];
  
  scanf("%d", &n);
  
  for(i = 0; i < n; i++) scanf("%d", &A[i]);
  
  bubbleSort(A, n);
  
  return 0;
}

void bubbleSort(int A[], int n)
{
  int i, j, temp, a = 0;

  if(n != 1){
    for(i = 0; i < n; i++){
      for(j = (n - 1); j > 0; j--){
	if(A[j] < A[j-1]){
	  temp = A[j-1];
	  A[j-1] = A[j];
	  A[j] = temp;
	  a++;
	}
      }
    }
  }
  for(i = 0; i < n; i++){
if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n%d\n", a);

  return 0;
}

Measured memory_bytes: 604
N, W = map(int, input().split())
wv = [tuple(map(int, input().split())) for _ in range(N)]
w = [0]*(N+1) # 商品番号とのズレが嫌だったのでこっちも1足しといた
v = [0]*(N+1)
for i in range(N):
    w[i+1], v[i+1] = wv[i]

dp = [[0]*(W+1) for _ in range(N+1)]

for i in range(1,N+1):
    for j in range(W+1):
        if j < w[i]:
            dp[i][j] = dp[i-1][j]
        else:
            dp[i][j] = max(dp[i-1][j], dp[i-1][j-w[i]] + v[i])

print(dp[N][W])


Measured memory_bytes: 120556
N = int(input())
L = list(map(int, input().split()))

Ans = 0

sum_L = L[0]

l = len(L)

for i in L[1:]:
    Ans += sum_L*i%(10**9+7)
    sum_L += i
Ans = Ans%(10**9+7)
print(Ans)

Measured memory_bytes: 31400
#include <stdio.h>

int main(){

	int A,B,C,D,E,F;

	scanf("%d %d %d %d %d %d",&A,&B,&C,&D,&E,&F);

	A*=100;
	B*=100;

	int i,j,k,m;

	int ans1=0;
	int ans2=0;

	for(i=0;A*i<=F;i++){
		for(j=0;(A*i)+(B*j)<=F;j++){
			int x=(A*i)+(B*j);
			for(k=0;(A*i)+(B*j)+(C*k)<=F;k++){
				for(m=0;(A*i)+(B*j)+(C*k)+(D*m)<=F;m++){
					int y = (C*k)+ (D*m);
					if(x*E>=100*y && x+y<=F){
						if(ans2*(x+y) <= ans1*y){
						ans1=x+y;
						ans2=y;
						}
					}
				}
			}
		}
	}

	printf("%d %d\n",ans1,ans2);

	return 0;
}

Measured memory_bytes: 128
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

void dfs (int x, int p, const vvi &g, vi &a, vector<char> &win)
{
    for (int dest : g[x]) if (dest != p)
        dfs(dest, x, g, a, win);

    win[x] = 0;
    for (int dest : g[x]) if (dest != p)
        win[x] |= (!win[dest] && a[dest] < a[x]);
}

void solve (int n)
{
    vi a(n);
    vvi g(n);
    forn (i, n) cin >> a[i];
    forn (i, n - 1)
    {
        int x, y;
        cin >> x >> y;
        --x, --y;
        g[x].pb(y);
        g[y].pb(x);
    }

    vector<char> win(n);
    int ans = 0;
    vi res;
    forn (i, n)
    {
        dfs(i, -1, g, a, win);
        if (win[i])
            res.pb(i + 1);
    }

    forn (i, sz(res))
        cout << res[i] << " \n"[i + 1 == sz(res)];
}

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

    int n;
    while (cin >> n)
        solve(n);
}


Measured memory_bytes: 896
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Atcoder
{
	class Program
	{
		static void Main(string[] args)
		{
			var fLine = Console.ReadLine().Split(' ');
			List<int> tmpList = new List<int>();
			for (int i = 0; i < fLine.Length; i++)
			{
				tmpList.Add(int.Parse(fLine[i]));
			}
			tmpList = tmpList.OrderByDescending(x => x).ToList();

			var left = int.Parse((tmpList[0].ToString() + tmpList[1].ToString()));
			Console.Write(left + tmpList[2]);

		}
	}
}


Measured memory_bytes: 13396
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#define N 400400
#define pii pair<int, int>
using namespace std;

int n, m;
bool vis[N];
pii p[N];
long long sum[N];

int main() {
#ifdef isLOCAL
    freopen("work.in", "r", stdin);
    freopen("work.out", "w", stdout);
#endif

    cin >> n;
    long long s1 = 0, s2 = 0;
    for (int i = 1, u, v; i <= n; ++i) {
        scanf("%d%d", &u, &v);
        s1 += u, s2 += v;
        p[++m] = make_pair(u, i);
        p[++m] = make_pair(v, i);
    }
    sort(p + 1, p + m + 1);
    long long ans = min(s1, s2);
    for (int i = 1; i <= n + 2; ++i)
        sum[i] = sum[i - 1] + p[i].first;

    for (int i = 1; i <= n; ++i) {
        if (vis[p[i].second]) return cout << min(ans, sum[n]) << endl, 0;
        vis[p[i].second] = 1;
        if (p[i].second == p[n + 1].second) ans = min(ans, sum[n + 2] - p[n + 1].first - p[i].first);
        else ans = min(ans, sum[n + 1] - p[i].first);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 5248
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<int, int> P;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
 
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;}

const int NM = 1e5+10;
ll dp[NM][3];

int main() {
    int n; cin >> n;
    ll h[NM][3];
    rep(i, n) {
        rep(j, 3) {
            cin >> h[i][j];
        }
    }

    for(int i=0; i<n; i++) {
        for(int d=0; d<3; d++){
            for(int p=0; p<3; p++) {
                if(d == p) continue;
                chmax(dp[i+1][d], dp[i][p] + h[i][d]);
            }
        }
    }
    ll ans;
    rep(i, 3){
        ans = max(ans, dp[n][i]);
    }
    cout << ans << endl;

}

Measured memory_bytes: 4992
import java.util.*;

	public class Main {
  		public static void main(String[] args){
    
    	Scanner sc = new Scanner(System.in);
    	int A= sc.nextInt();
    	int B = sc.nextInt();
    	
    	for(int i = 1 ; i <= 1000 ; i++){
      		if((int)(i*0.08) == A && (int)(i*0.1) == B){
        		System.out.println(i);
        		return;
      		}
    	}
 
    	System.out.println(-1);
    
  }
}

Measured memory_bytes: 35748
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main()
{
  int x;
  rep(i, 5)
  {
    cin >> x;
    if (!x)
    {
      cout << i + 1;
      return 0;
    }
  }
}


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

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

using ll = long long;

const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const int INF = 1<<30;
const ll mod = 1000000007LL;

int main() {
  ll N,M;
  cin>>N>>M;
  map<ll,ll> m;
  for(ll i = 0; i < M; i++){
    ll x,y;
    cin>>x>>y;
    m[x]++;
    m[y]++;
  }
  bool can = true;
  for(auto x:m) {
    if(x.second%2!=0) can = false;
  }
  if(can) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
}

Measured memory_bytes: 5632
#include <bits/stdc++.h>
using namespace std;
#define int long long

class Dijkstra {
private:
  struct edge {
    int to, cost;
  };

  const int INF = 1e18;

  int V;
  vector<vector<edge>> G;
  vector<int> d;

  void add_edge(int from, int to, int cost) {
    G[from].push_back({to, cost});
  }

  void do_dijkstra(int s) {
    using P = pair<int, int>;
    priority_queue<P, vector<P>, greater<P>> que;
    fill(d.begin(), d.end(), INF);
    d[s] = 0;
    que.push(P(0, s));

    while (!que.empty()) {
      P p = que.top();
      que.pop();
      int v = p.second;
      if (d[v] < p.first)
        continue;
      for (int i = 0; i < G[v].size(); i++) {
        edge e = G[v][i];
        if (d[e.to] > d[v] + e.cost) {
          d[e.to] = d[v] + e.cost;
          que.push(P(d[e.to], e.to));
        }
      }
    }
  }

public:
  Dijkstra(int V) : V(V), G(V, vector<edge>()), d(V) {}

  void addEdge(int from, int to, int cost) { return add_edge(from, to, cost); }
  void dijkstra(int s) { return do_dijkstra(s); }
  int get(int v) { return d[v]; }
};

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

  Dijkstra dij(N);

  for (int i = 0; i < N; i++) {
    int u, k;
    cin >> u >> k;
    while (k--) {
      int v, c;
      cin >> v >> c;
      dij.addEdge(u, v, c);
    }
  }

  dij.dijkstra(0);

  for (int i = 0; i < N; i++) {
    cout << i << " " << dij.get(i) << endl;
  }
  return 0;
}



Measured memory_bytes: 3124
#include <stdio.h>

#define MAX 10000
#define NIL -1

struct Node {int p, l, r;};
struct Node T[MAX];
int n;

void preParse(int u) {
  if(u == NIL) return;
  printf(" %d",u);
  preParse(T[u].l);
  preParse(T[u].r);
}

void inParse(int u) {
  if(u == NIL) return;
  inParse(T[u].l);
  printf(" %d",u);
  inParse(T[u].r);
}


void postParse(int u) {
  if(u == NIL) return;
  postParse(T[u].l);
  postParse(T[u].r);
  printf(" %d",u);
}

int main(void) {
  int i, v, l, r, root;
  scanf("%d",&n);
  for(i=0; i<n; i++) {
    T[i].p = NIL;
  }
  
  for(i=0; i<n; i++) {
    scanf("%d %d %d",&v,&l,&r);
    T[v].l = l;
    T[v].r = r;
    if(l != NIL) T[l].p = v;
    if(r != NIL) T[r].p = v;
  }
  
  for(i=0;i<n;i++) if(T[i].p == NIL) root = i;
  
  printf("Preorder\n");
  preParse(root);
  printf("\n");

  printf("Inorder\n");
  inParse(root);
  printf("\n");

  printf("Postorder\n");
  postParse(root);
  printf("\n");

  return 0;
}


Measured memory_bytes: 2048
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (ll i = 0; i < n; i++)
#define rrep(i, n) for (ll i = n - 1; i >= 0; i--)
#define Rep(i, r, n) for (ll i = r; i < n; i++)
#define RRep(i, r, n) for (ll i = n - 1; i <= r; i--)
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define int long long
#define pb push_back
const int dx[] = {0, -1, 0, 1};
const int dy[] = {1, 0, -1, 0};
const int MOD = (1000000007);
//const int MOD = (998244353);
//const int INF = (1 << 30)-1;
const int INF = (1LL << 60)-1;
const double EPS = (1 >> 30);

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

using Graph = vector<vector<pair<int, int>>>;

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    //---------------------------------------------
    
    
    int x,y;
    cin>>x>>y;
    int ans=0;
    if(x==1){
        ans+=300000;
    }
    else if(x==2){
        ans+=200000;
    }
    else if(x==3){
        ans+=100000;
    }
    if(y==1){
        ans+=300000;
    }
    else if(y==2){
        ans+=200000;
    }
    else if(y==3){
        ans+=100000;
    }
    if(x==y&&x==1){
        ans+=400000;
    }
    cout<<ans<<endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> v1(n), v2(m);
    rep(i, 0, n)
    {
        int a, b;
        cin >> a >> b;
        v1[i] = {a, b};
    }
    rep(i, 0, m)
    {
        int a, b;
        cin >> a >> b;
        v2[i] = {a, b};
    }
    rep(i, 0, n)
    {
        int mini = INT_MAX, index = 0;
        // cout << "etud" << i << endl;
        rep(j, 0, m)
        {
            int dis = abs(v1[i].first-v2[j].first)+abs(v1[i].second-v2[j].second);
            // cout << dis << maxi << endl;
            if (dis < mini)
            {
                // cout << j << endl;
                mini = dis;
                index = j;
            }
        }
        cout << index + 1 << endl;
    }
    // cout << "a";
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
using namespace std;
#define rep(i,n) for(int i = 0;i<n;i++)
const long long MOD = 1000000007LL;
const string alpha = "abcdefghijklmnopqrstuvwxyz";
int main(){
    int n,d;
    cin >> n >> d;
    int x[n][d];
    rep(i,n){
        rep(j,d){
            cin >> x[i][j];
        }
    }
    int ans = 0;
    double dist;
    for(int i = 0;i<n-1;i++){
        for(int j = i+1;j<n;j++){
            dist = 0;
            for(int k = 0;k<d;k++){
                dist+=pow(abs(x[i][k]-x[j][k]),2);
            }
            dist = sqrt(dist);
            if(ceil(dist)==floor(dist)) ans++;
        }
    }
    cout << ans << endl;
}

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

using namespace std;

template <typename T>
T maximum(const T* arr, int n) {
  if (n == 0)
    return numeric_limits<T>::min();

  return max(*arr, maximum(arr + 1, n - 1));
}

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

  long long candidates[] = {a * c, a * d, b * c, b * d};
  cout << maximum(candidates, 4) << '\n';
  return 0;
}

Measured memory_bytes: 3192
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define INF (1e9)
#define N 1005
using namespace std;
 
string s[N],s1[N],s2[N],s3[N];
set<char> S;
int n,num;
int d[N],p;
int var[N];
 
int get_num(string str){
  if('a'<=str[0]&&str[0]<='z')return var[(int)str[0]];
  int res=0;
  rep(i,str.size())res=res*10+str[i]-'0';
  return res;
}
 
void solve(){
  int f=0,cnt=50000000;
  while(1){
    cnt--;
    if(cnt==0)break;
    if(s[p]=="ADD"){
      int var2=get_num(s2[p]);
      int var3=get_num(s3[p]);
      if(var2+var3>=16){
    f=1;
    break;
      }
      var[(int)s1[p][0]]=var2+var3;
    }
    if(s[p]=="SUB"){
      int var2=get_num(s2[p]);
      int var3=get_num(s3[p]);
      if(var2-var3<0){
    f=1;
    break;
      }
      var[(int)s1[p][0]]=var2-var3;
    }
    if(s[p]=="SET"){
      int var2=get_num(s2[p]);
      var[(int)s1[p][0]]=var2;
    }
    if(s[p]=="IF"){
      int var1=get_num(s1[p]);
      int var2=get_num(s2[p]);
      if(var1!=0){
    if(d[var2]==INF){
      f=1;
      break;
    }
    p=d[var2];
    continue;
      }
    }
    if(s[p]=="HALT"){
      f=1;
      break;
    }
    p++;
    if(p==n){
      f=1;
      break;
    }
  }
  if(f){
    set<char>::iterator ite=S.begin();
    while(ite!=S.end()){
      cout<<(*ite)<<"="<<var[(int)(*ite)]<<endl;
      ite++;
    }
  }else cout<<"inf"<<endl;
}
 
void add(char c){
  if('a'<=c&&c<='z')S.insert(c);
}
 
int main(){
  cin>>n;
  rep(i,N)d[i]=INF;
  rep(i,n){
    cin>>num;
    d[num]=i;
    cin>>s[i];
    if(s[i]=="HALT")continue;
    cin>>s1[i]>>s2[i];
    if(s[i]=="ADD"||s[i]=="SUB")cin>>s3[i],add(s3[i][0]);
    add(s1[i][0]);
    add(s2[i][0]);
  }
  solve();
  return 0;
}

Measured memory_bytes: 3192
import java.util.Scanner;

//Differential
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		double min = Integer.MAX_VALUE;
		double max = Integer.MIN_VALUE;
		while(sc.hasNext()){
			double x = sc.nextDouble();
			min = Math.min(min, x);
			max = Math.max(max, x);
		}
		System.out.println(max-min);
	}
}

Measured memory_bytes: 27724
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int INF = (1<<30);
const ll INFLL = (1ll<<60);
const ll MOD = (ll)(1e9+7);

#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

void add_mod(ll& a, ll b){
	a = (a<MOD)?a:(a-MOD);
	b = (b<MOD)?b:(b-MOD);
	a += b;
	a = (a<MOD)?a:(a-MOD);
}

int ufr[225816],ufp[225816];

void ufinit(int n){
	int i;
	for(i=0; i<n; ++i){
		ufr[i] = 1;
		ufp[i] = i;
	}
}

int ufind(int x){
	if(ufp[x] != x){
		ufp[x] = ufind(ufp[x]);
	}
	return ufp[x];
}

void unionf(int x, int y){
	x = ufind(x);
	y = ufind(y);
	if(x==y){
		return;
	}
	if(ufr[x] > ufr[y]){
		ufp[y] = x;
		ufr[x] += ufr[y];
	}else{
		ufp[x] = y;
		ufr[y] += ufr[x];
	}
}

int main(void){
	int n,m,x,y,z,i,ans=0;
	cin >> n >> m;
	ufinit(n*2);
	for(i=0; i<m; ++i){
		cin >> x >> y >> z;
		unionf(x,y+n*(z%2));
		unionf(x+n,y+n*(1-(z%2)));
	}
	for(i=0; i<n; ++i){
		if(ufind(i)==ufind(i+n)){
			cout << -1 << endl;
			return 0;
		}else if(i==ufind(i)){
			++ans;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1792
import java.util.*;

class Point{
	double x,y;
	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
}

public class Main {
	Scanner sc = new Scanner(System.in);
	public void input() {
		Point a = new Point(0.0, 0.0);
		Point b = new Point(100.0, 0.0);
		int n = sc.nextInt();
		System.out.printf("%.8f %.8f\n",a.x,a.y);
		koch(n, a, b);
		System.out.printf("%.8f %.8f\n",b.x,b.y);
	}
	public void koch(int n, Point a, Point b) {
		if(n == 0) return;
		Point s, t, u;
		
		s = new Point(0.0, 0.0);
		t = new Point(0.0, 0.0);
		u = new Point(0.0, 0.0);
		double th = Math.PI * 60.0 / 180.0;
		s.x = (2.0 * a.x + 1.0 * b.x) / 3.0;
		s.y = (2.0 * a.y + 1.0 * b.y) / 3.0;
		t.x = (1.0 * a.x + 2.0 * b.x) / 3.0;
		t.y = (1.0 * a.y + 2.0 * b.y) / 3.0;
		u.x = (t.x - s.x)*Math.cos(th) - (t.y - s.y)*Math.sin(th) + s.x;
		u.y = (t.x - s.x)*Math.sin(th) + (t.y - s.y)*Math.cos(th) + s.y;
		
		koch(n-1, a, s);
		System.out.printf("%.8f %.8f\n",s.x,s.y);
		koch(n-1, s, u);
		System.out.printf("%.8f %.8f\n",u.x,u.y);
		koch(n-1, u, t);
		System.out.printf("%.8f %.8f\n",t.x,t.y);
		koch(n-1, t, b);
	}
	
	public static void main(String[] args) {
		Main obj = new Main();
		obj.input();
	}
}



Measured memory_bytes: 40836
n = int(input())
S = []
for _ in range(2):
    s = str(input())
    S.append(s)

count = 0
mod = (10**9) +7

if S[0][0] == S[1][0]:
    ans = 3
else:
    ans = 6

while count < n-1:
    if (S[0][count] == S[1][count]) and (S[0][count+1] == S[1][count+1]):
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif S[0][count] == S[1][count]:
        ans = ans * 2
        ans = ans % mod
        count += 1
    elif count >= n-2:
        break
    elif S[0][count+2] == S[1][count+2]:
        ans = ans
        count += 2
    else:
        ans = ans * 3
        ans = ans % mod
        count += 2
print(ans)
    
         

Measured memory_bytes: 3064
<?php

list($a, $b) = LineIO::read();

$a = intval($a);
$b = intval($b);

// 上3桁
$ah = intval($a / 100);
$bh = intval($b / 100);

// 下2桁
$a2 = $a - $ah * 100;
$b2 = $b - $bh * 100;

$n = 0;

// 上2桁の反転
$ak_rev = intval(substr(strrev($ah), 1, 2));
$bk_rev = intval(substr(strrev($bh), 1, 2));

if ($ak_rev >= $a2)
{
    $n++;
}

$n = $n + ($bh - $ah) + 1 - 2;

if ($bk_rev <= $b2)
{
    $n++;
}

LineIO::write($n);


class LineIO
{
    public static function read() {
        return explode(' ', trim(fgets(STDIN)));
    }

    public static function write($str = '') {
        echo $str . PHP_EOL;
    }
}


Measured memory_bytes: 4728
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define VVVI vector<vector<vector<ll>>>
#define VVVVI vector<vector<vector<vector<ll>>>>
#define REP(i,n) for(ll i=0,_n=(n);(i)<(ll)_n;++i)
#define REPR(i,n) for(ll i=(ll)(n)-1;0<=(i);--i)
#define RANGE(i,a,b) for(ll i=(ll)a,_b=(ll)(b);(i)<_b;++i)
#define RANGER(i,a,b) for(ll i=(ll)(b)-1,_a=(ll)(a);(_a)<=i;--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
#define FI first
#define SE second
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template<typename T>void maxUpdate(T& a, T b) {a = max(a, b);}
template<typename T>void minUpdate(T& a, T b) {a = min(a, b);}
string YN(bool v) { return v ? "Yes":"No"; }

#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N,M,W,H;
	while(cin>>N) {
		VI a(N);
		REP(i, N) cin>>a[i];
		map<ll, ll> h;
		ll ans = 0;
		ll sum = 0;
		h[0] = 1;
		REP(i, N) {
			sum += a[i];
			ans += h[sum];
			h[sum]++;
		}
		
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 14336
from collections import Counter
from itertools import combinations
from bisect import bisect_left

N = int(input())
L = Counter(map(int, input().split()))

S = sorted(L.keys())

count = 0
for i, j in combinations(range(len(S) - 1), 2):
  for k in range(j + 1, bisect_left(S, S[i] + S[j])):
    count += L[S[i]] * L[S[j]] * L[S[k]]

print(count)

Measured memory_bytes: 9460
import itertools

a, b, c, d = map(int, list(str(input())))

def plusMinus(zeroIchi):
    if zeroIchi ==0:
        return "-"
    else:
        return "+"

listN = [0, 1]
for i in itertools.product(listN, repeat=4):
    sum=a
    if i[0] == 0:
        sum-=b
    else:
        sum+=b
    if i[1] == 0:
        sum-=c
    else:
        sum+=c
    if i[2] == 0:
        sum-=d
    else:
        sum+=d
    if sum == 7:
        print(str(a)+plusMinus(i[0])+str(b)+plusMinus(i[1])+str(c)+plusMinus(i[2])+str(d)+"=7")
        break
    

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M = 1e9+7;
const int N = 1e5+5;

ll f[N],sum[N];
int a[N];

inline ll qpow(ll a,ll b){
	ll res = 1;
	while(b){
		if(b & 1) res = (res*a)%M;
		a = (a*a)%M;
		b >>= 1;
	}
	return res%M;
}
inline ll inv(ll a){return qpow(a,M-2);}

void table(int n,int k){
	if(k == 0) for(int i = 0;i <= n;++i) f[i] = 1;
	else{
		for(int i = 0;i <= k;++i) f[i] = 1;
		for(int i = k+1;i <= n;++i) f[i] = ((f[i-1]*i)%M)*inv(i-k)%M;
	}
	return ;
}

int main()
{
    int n,k;
    scanf("%d%d",&n,&k);
    table(n,k-2);
    
	for(int i = 1;i <= n;++i) scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	
	sum[0] = 0;
	for(int i = 1;i <= n;++i) sum[i] = sum[i-1]+a[i];
	
	if(k == 1){printf("0\n");return 0;}
	else if(k == n){printf("%d\n",a[n]-a[1]);return 0;}
	else{
		ll ans = 0;
		for(int i = k-2;i <= n-2;++i){
			ll t1 = (sum[n]-sum[i+1])%M;
			ll t2 = (sum[n-i-1])%M;
			ans = (((t1-t2)%M*f[i]%M)+ans)%M;
		}
		printf("%lld\n",(ans+M)%M);
	}
    return 0;
}


Measured memory_bytes: 2176
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
//max=({});


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


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

#define Int int_fast64_t
#define pll pair<Int,Int>
template<class T> using pql = priority_queue<T,vector<T>>;
template<class T> using pq = priority_queue<T,vector<T>,greater<T>>;
#define LL(n) Int n; cin >> n;
#define RP(n) for (Int i = 0; i < n; i++)
#define REP(n,i) for (Int i = 0; i < n; i++)

struct node{
    int to;
    int length;
};

vector<vector<node>> to;
vector<int> flag;
vector<int> c;


void dfs(int from) {
    for (auto z : to.at(from)) {
        int next = z.to;
        int length = z.length;
        if (flag.at(next) == 0) {
            flag.at(next) = 1;
            if (length % 2 == 0) {
                c.at(next) = c.at(from);
            } else {
                c.at(next) = 1 - c.at(from);
            }
            dfs(next);
        }
    }
}

int main(void){
    string s, t;
    cin >> s >> t;
    int a , b;
    map<string,int> mp;
    cin >> mp[s] >> mp[t];
    string k;
    cin >> k;
    mp[k]--;
    cout << mp[s] << " " << mp[t] << endl;
}

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

#define INF 1.1e9
#define LINF 1.1e18
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define BIT(x,n) bitset<n>(x)
#define PI 3.14159265358979323846

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

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

struct TopologicalSort {
	int n;
	vector< vector<int> > G;
	vector<int> flg,order;

	enum { YET,VISITED,DONE };

	TopologicalSort() {}
	TopologicalSort(int sz):n(sz),G(sz),flg(sz),order(0) {};

	void add_edge(int u,int v) {
		G[u].push_back(v);
	}

	bool dfs(int v) {
		flg[v]=VISITED;
		for(auto u:G[v]) {
			if(flg[u]!=DONE&&(flg[u]==VISITED||!dfs(u))) return false;
		}
		flg[v]=DONE;
		order.push_back(v);
		return true;
	}

	vector<int> topological_sort() {
		fill(flg.begin(),flg.end(),0);

		for(int v=0;v<n;v++) {
			if(flg[v]==YET&&!dfs(v)) return {};
		}
		reverse(order.begin(),order.end());

		return order;
	}
};


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

	int v,e;cin>>v>>e;
	TopologicalSort tsort(v);

	REP(i,e) {
		int a,b;cin>>a>>b;
		tsort.add_edge(a,b);
	}
	auto order=tsort.topological_sort();
	for(auto u:order) cout<<u<<endl;

	return 0;
}



Measured memory_bytes: 3756