akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size)
#define MOD 1000000007
const long long mod = 1e9+7;
typedef vector<long long> Vl;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<Vl> VVl;
typedef pair<int, int> PII;
typedef long long ll;

int main(){
    int n,a,b;
    string s;
    cin >>n >> a;
    cout << n*n -a << endl;
    return 0;
} 

Measured memory_bytes: 256
N=int(input())
pairs=[]

if N%2==0:
    for j in range(N//2):
        pairs.append([j+1,N-j])
else:
    for j in range(N//2):
        pairs.append([j+1,N-j-1])
    pairs.append([N])
ans=[]
for i in range(len(pairs)):
    for j in range(len(pairs[i])):
        for k in range(len(pairs)):
            if i!=k:
                for l in range(len(pairs[k])):
                    if pairs[i][j]<pairs[k][l]:
                        ans.append([pairs[i][j],pairs[k][l]])
                    else:
                        ans.append([pairs[k][l],pairs[i][j]])

ans=sorted(ans,key=lambda x: x[1])
ans=sorted(ans,key=lambda x: x[0])
print(len(ans)//2)
for i in range(len(ans)):
    if i%2==0:
        print(*ans[i])
        


Measured memory_bytes: 4760
import Control.Monad

solve :: [Int] -> IO ()
solve [h, w] = do
    replicateM_ h (putStrLn $ replicate w '#')
    putStrLn ""

main :: IO ()
main = getContents >>= mapM_ solve . takeWhile (\[h, w] -> h /= 0 || w /= 0) . map (map read . words) . lines

Measured memory_bytes: 4132
/*Code by Codercjh*/
#include<bits/stdc++.h>
#define fr(i,a,b) for(int i=(a);i<=(b);++i)
#define rf(i,a,b) for(int i=(a);i>=(b);--i)
#define min(a,b) (a<b?a:b)
#define max(a,b) (a>b?a:b)
using namespace std;
typedef long long ll;
template<typename T>
inline void read(T &x){
	char c=getchar();T fh=0;bool f=false;
	while(!isdigit(c))f|=(c=='-'),c=getchar();
	while(isdigit(c))fh=(fh<<1)+(fh<<3)+(c^48),c=getchar();
	x=f?-fh:fh;
	return;
}
const int mod=1e9+7;
int n,k;
ll qp(ll a,ll b){
	ll s=1;
	while(b){
		if(b&1)s=(s*a)%mod;
		a=(a*a)%mod;b>>=1;
	}
	return s;
}
ll ans,a[200005];
int main(){
    read(n),read(k);
	rf(i,k,1){
		ll tmp=qp(k/i,n);
		fr(j,2,k/i)tmp-=a[i*j];
		while(tmp<0)tmp+=mod;
		a[i]=tmp;
		ans=(ans+a[i]*i)%mod;
	}
	cout<<ans;
	return 0;
}


Measured memory_bytes: 4380
#include<iostream>
#include<cstdio>
#include<cmath>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
#include<cstring>
#include<string>
using namespace std;
int main(){
	int a,b;
	cin>>a>>b;
	if(a%b)cout<<a/b+1;
	else cout<<a/b; 
}


Measured memory_bytes: 256
s = input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s: # s に何か残りがあればTrue
    print("NO")
else:
    print("YES")

"""
# =>わからなかった
s = input()
list = ['dream', 'dreamer', 'erase', 'eraser']
# print(s)

for j in range(22):
    for i in range(len(list)):
#        print(list[i])
#        print(s[-5:])
#        print(s[-7:])
#        print(s)
        if s[-5:] == list[i]:
            s = s.rstrip(list[i])
            if s == "":
                print("YES")
                exit()
        elif s[-7:] == list[i]:
            s = s.rstrip(list[i])
#            print(s)
            if s == "":
                print("YES")
                exit()
        else:
            pass
if s:
    print("NO")
"""


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

struct team{
	int index, points, rank;
};

bool descending_team_with_point(const team& l_team, const team& r_team){
	return l_team.points > r_team.points;
}

bool ascending_team_with_index(const team& l_team, const team& r_team){
	return l_team.index < r_team.index;
}

int main(){
	int n, i, a, b, c, d;
	team arr[101];
	
	for(i=0;i<101;i++){
		arr[i].index = i;
		arr[i].points = 0;
	}

	std::cin >> n;
	for(i=n*(n-1)/2;i--;){
		std::cin >> a >> b >> c >> d;
		if(c>d)arr[a].points+=3;
		else if(c<d)arr[b].points+=3;
		else arr[a].points++, arr[b].points++;
	}

	std::sort(arr+1, arr+n+1, descending_team_with_point);
	int prev_value = -1, rank = 0;
	for(i=1;i<=n;i++){
		if(arr[i].points != prev_value){
			rank = i;
		}
		
		arr[i].rank = rank;
		
		prev_value = arr[i].points;
	}
	std::sort(arr+1, arr+n+1, ascending_team_with_index);

	for(i=1;i<=n;i++){
		std::cout << arr[i].rank << std::endl;
	}
}

Measured memory_bytes: 1180
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
input = sys.stdin.readline
#文字列のときはうまく行かないのでコメントアウトすること
sys.setrecursionlimit(2147483647)

def main():
  k, n = map(int, input().split())
  A = list(map(int, input().split()))
  A.sort()
  result = 0
  for i in range(n-1):
    result = max(result, A[i+1]-A[i])
  ans = max(result, (k+A[0])-A[n-1])
  print(k-ans)

if __name__ == '__main__':
  main()

Measured memory_bytes: 27708
#include "iostream"
#include "cmath"
using namespace std;
int main()
{
	int a[3], max=0;
	for (int i = 0; i < 3; i++)
	{
		cin >> a[i];
	}
	for (int i = 1; i < 3; i++)
	{
		for (int j = 0; j < i; j++)
		{
			if (a[j] > a[i])
			{
				swap(a[j], a[i]);
			}
		}
	}
	cout << a[0] + a[1] + a[2]*10 << endl;
}

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

// @@ !! LIM()

int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout << setprecision(20);

  ll N; cin >> N;
  vector<ll> A(N);
  for (ll i = 0; i < N; i++) {
    cin >> A.at(i);
    if (A.at(i) == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  ll ans = 1;
  for (ll i = 0; i < N; i++) {
    double x = (double)ans * (double)(A.at(i));
    if (x > 1e18) {
      cout << -1 << endl;
      return 0;
    }
    ans *= A.at(i);
    if (ans > (ll)(1e18)) {
      cout << -1 << endl;
      return 0;
    }
  }
  cout << ans << endl;
  

  return 0;
}



Measured memory_bytes: 3988
using System.Linq;
using System.Collections.Generic;
using System;

public class P
{
    public int[] a { get; set; }
}

public class Hello
{
    public static void Main()
    {
        var ps = new List<P>();
        string[] line = Console.ReadLine().Trim().Split(' ');
        var h = int.Parse(line[0]);
        var w = int.Parse(line[1]);
        var map = new int[h, w];
        for (int i = 0; i < h; i++)
        {
            line = Console.ReadLine().Trim().Split(' ');
            for (int j = 0; j < w; j++) map[i, j] = int.Parse(line[j]);
        }
        print1(map, h, w, ps);
        print2(map, h, w, ps);
        var pc = ps.Count();
        Console.WriteLine(pc);
        if (pc > 0)
            foreach (var x in ps)
                Console.WriteLine(string.Join(" ", x.a));
    }
    public static void print2(int[,] map, int h, int w, List<P> ps)
    {
        for (int i = 0; i < w - 1; i++)
            if (map[h - 1, i] % 2 == 1)
            {
                var pp = new P();
                pp.a = new int[] { h, i + 1, h, i + 2 };
                ps.Add(pp);
                map[h - 1, i + 1]++;
            }
    }
    public static void print1(int[,] map, int h, int w, List<P> ps)
    {
        for (int i = 0; i < h - 1; i++)
            for (int j = 0; j < w; j++)
                if (map[i, j] % 2 == 1)
                {
                    var pp = new P();
                    pp.a = new int[] { i + 1, j + 1, i + 2, j + 1 };
                    ps.Add(pp);
                    map[i + 1, j]++;
                }
    }
}


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

using namespace std;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a, 0, sizeof a)
#define minus(a) memset(a, -1, sizeof a)
#define watch(a) { std::cout << #a << " = " << a << "\n"; }
template<class T1, class T2> inline bool minimize(T1 &a, T2 b) { return b < a && (a = b, 1); }
template<class T1, class T2> inline bool maximize(T1 &a, T2 b) { return a < b && (a = b, 1); }
template<class T, class V> istream& operator>> (istream& ist, pair<T, V>& p) { return ist >> p.first >> p.second; }
template<class T> ostream& operator<< (ostream& ost, pair<T, T>& p) { return ost << p.first << ", " << p.second; }
template<class T> istream& operator>> (istream& ist, vector<T>& vs) { for(auto& e: vs) ist >> e; return ist; }

typedef long long ll;
int const inf = INT_MAX / 2;

template<class T> using PQ_G = priority_queue<T, vector<T>, greater<T>>;

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

int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> F(H, vector<char>(W));
  rep(i, H) rep(j, W) cin >> F[i][j];
  vector<vector<pair<int, int>>> G(H * W);
  rep(y, H) rep(x, W) {
    rep(k, 2) {
      int const ny = y + dy[k], nx = x + dx[k];
      if (ny < 0 || ny >= H || nx < 0 || nx >= W) continue;
      G[y * W + x].emplace_back(F[ny][nx] == '#', ny * W + nx);
    }
  }
  PQ_G<tuple<int, int, int, int>> pq;
  vector<vector<vector<int>>> dist(H, vector<vector<int>>(W, vector<int>(2, inf)));
  dist[0][0][F[0][0] == '#'] = F[0][0] == '#';
  pq.emplace(F[0][0] == '#', 0, 0, F[0][0] == '#');
  while(!pq.empty()) {
    auto t = pq.top(); pq.pop();
    int cost, y, x, col; tie(cost, y, x, col) = t;
    for(auto const& e: G[y * W + x]) {
      int const ncol = e.first, ny = e.second / W, nx = e.second % W;
      int const add_cost = col == 0 && ncol == 1;
      if (dist[ny][nx][ncol] <= dist[y][x][col] + add_cost) continue;
      dist[ny][nx][ncol] = dist[y][x][col] + add_cost;
      pq.emplace(dist[ny][nx][ncol], ny, nx, ncol);
    }
  }
  cout << min(dist[H - 1][W - 1][0], dist[H - 1][W - 1][1]) << "\n";
}


Measured memory_bytes: 1408
//#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops")
//#pragma GCC target("avx,avx2")
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")

//# include <x86intrin.h>
# include <bits/stdc++.h>

# include <ext/pb_ds/assoc_container.hpp>
# include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;
 
template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define _USE_MATH_DEFINES_
#define ll long long
#define ld long double
#define Accepted 0
#define pb push_back
#define mp make_pair
#define sz(x) (int)(x.size())
#define every(x) x.begin(),x.end()
#define F first
#define S second
#define lb lower_bound
#define ub upper_bound
#define For(i,x,y)  for (ll i = x; i <= y; i ++) 
#define FOr(i,x,y)  for (ll i = x; i >= y; i --)
#define SpeedForce ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
// ROAD to...                                                                                                                                                                                                                Red

void setIn(string s) { freopen(s.c_str(),"r",stdin); }
void setOut(string s) { freopen(s.c_str(),"w",stdout); }
void setIO(string s = "") {
	// cin.exceptions(cin.failbit); 
	// throws exception when do smth illegal
	// ex. try to read letter into int
	if (sz(s)) { setIn(s+".in"), setOut(s+".out"); } // for USACO
}

const double eps = 0.000001;
const ld pi = acos(-1);
const int maxn = 1e7 + 9;
const int mod = 1e9 + 7;
const ll MOD = 1e18 + 9;
const ll INF = 1e18 + 123;
const int inf = 2e9 + 11;
const int mxn = 1e6 + 9; 
const int N = 6e5+5;                                         
const int M = 22;
const int pri = 997;
const int Magic = 2101;

const int dx[] = {-1, 0, 1, 0};
const int dy[] = {0, -1, 0, 1};
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
 
int rnd (int l, int r) {
	return uniform_int_distribution<int> (l, r)(gen);
}

int main () {
	SpeedForce;
	
	int n, x, t;
	cin >> n >> x >> t;
	cout << (n+x-1)/x * t << '\n';
	
	return Accepted;
}

// B...a


Measured memory_bytes: 3656
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		while(input.hasNext()){
			String N = input.next();
			
			if(isPalindrom(N)){
				System.out.println("Yes");
			} else {
				System.out.println("No");
			}
		}

	}
	
	private static boolean isPalindrom(String s){
		for(int i = 0, j = s.length() -1; i < j; ++i, --j){
			if(s.charAt(i) != s.charAt(j)){
				return false;
			}
		}
			
		return true;
	}

}


Measured memory_bytes: 22740
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_map>
#include <map>
#define rep(i, a) for (int i = 0; i < (a); i++)
using namespace std;
using ll = long long int;

int main(){
  int a, b, c;
  cin >> a >> b >> c;
  
  if (a == b && b == c) {
    cout << 1 << endl;
  }
  
  else if (a != b && b != c && c != a) {
    cout << 3 << endl;
  }
  else {
    cout << 2 << endl;
  }
  return 0;
}


Measured memory_bytes: 384
import sys
from collections import deque

input = sys.stdin.readline


def main():
    X = input().rstrip()

    stack = deque()
    for x in X:
        if len(stack) == 0:
            stack.append(x)
        else:
            if x == "S":
                stack.append(x)
            else:
                if stack[-1] == "S":
                    stack.pop()
                else:
                    stack.append(x)
    ans = len(stack)

    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;


signed main() {

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

    string s1, s2;
    cin >> s1 >> s2;
    int ans = 0;
    for(int i = 0 ; i < 3; i++) {
        if(s1[i] == s2[i]) ans ++;
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include"stdio.h"
#include"stdlib.h"
#include"string.h"
#include"algorithm"
#include"queue"
using namespace std;
struct mmm
{
	int x,y;
}vv;
int dir[4][2] = {0,-1,-1,0,0,1,1,0};
char xx[1005][1005];
int bb[11][2];
queue <mmm> qq;
int vis[1005][1005];
int bfs(char t)
{
	int sum = 0;
	int pl = 0;
	while(!qq.empty())
	{
		vv = qq.front();
		int x0 = vv.x;
		int y0 = vv.y;
		//printf("%d %d %d\n",x0,y0,vis[x0][y0]);
		qq.pop();
		if(xx[x0][y0] == t && !pl)
		{
			sum = vis[x0][y0];
			pl = 1;
		}
		for(int i = 0;i < 4;i++)
		{
			int xt = x0 + dir[i][0];
			int yt = y0 + dir[i][1];
			if(xx[xt][yt] != '#' && xx[xt][yt] != 'X' && vis[xt][yt] == -1)
			{
				vis[xt][yt] = vis[x0][y0] + 1;
				vv.x = xt;
				vv.y = yt;
				qq.push(vv);
			}
		}
	}
	return sum;
}
int main()
{
	int a,b,c,d,x1,y1,sum;
	while(~scanf("%d %d %d",&a,&b,&c))
	{
	//	if(a == 0 && b == 0)
	//	break;
		memset(xx,'#',sizeof(xx));
		getchar();
		for(int i = 1;i <= a;i++)
		{
			for(int j = 1;j <= b;j++)
			{
				xx[i][j] = getchar();
				if(xx[i][j] == 'S')
				{
					x1 = i;
					y1 = j;
				}
				else if(xx[i][j] != 'X')
				{
					bb[xx[i][j] - '0'][0] = i;
					bb[xx[i][j] - '0'][1] = j;
				}
			}
			getchar();
		}
		bb[0][0] = x1;
		bb[0][1] = y1;
		sum = 0;
		for(int i = 1;i <= c;i++)
		{
			vv.x = bb[i-1][0];
			vv.y = bb[i-1][1];
			memset(vis,-1,sizeof(vis));
			vis[vv.x][vv.y] = 0;
			qq.push(vv);
			sum += bfs(i + '0');
		}
		printf("%d\n",sum);
	}
	return 0;
}

Measured memory_bytes: 5992
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define REP(i, n) FOR(i, 0, n)
#define FOR(i, a, b) for (ll i = a; i < b; i++)
#define ALL(a) (a).begin(), (a).end()
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll, ll> pii;
const ll INF = 1LL << 58;
const ll MOD = 1000000007;
typedef vector<pii> vpii;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return true;
    }
    return false;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return true;
    }
    return false;
}

/* a と b の最大公約数を返す関数 */
long long GCD(long long a, long long b)
{
    if (b == 0)
        return a;
    else
        return GCD(b, a % b);
}

/* a と b の最小公倍数を求める */
long long LCM(long long a, long long b)
{
    long long g = GCD(a, b);
    return a / g * b;
}

signed main()
{
    int N;
    cin >> N;
    int mean = 0;
    vi X(N);
    REP(i, N)
    {
        cin >> X.at(i);
        mean += X.at(i);
    }
    mean /= N;
    int ans = 0;
    REP(i, N)
    {
        ans += (X.at(i) - mean) * (X.at(i) - mean);
    }
    int ans2 = 0;
    mean += 1;
    REP(i, N)
    {
        ans2 += (X.at(i) - mean) * (X.at(i) - mean);
    }
    ans = min(ans, ans2);
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.*
import java.util.Collections.min


fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)

    var N: Long
    N = sc.nextLong()
    var M: Long
    M = sc.nextLong()
    var R: Long
    R = sc.nextLong()
    val r = Array((R).toInt()){0L}
    for (i in 0 until R) {
        r[(i).toInt()] = sc.nextLong()
    }
    val A = Array((M).toInt()){0L}
    val B = Array((M).toInt()){0L}
    val C = Array((M).toInt()){0L}
    for (i in 0 until M) {
        A[(i).toInt()] = sc.nextLong()
        B[(i).toInt()] = sc.nextLong()
        C[(i).toInt()] = sc.nextLong()
    }
    solve1(N, M, R, r, A, B, C)
}

const val INF = (1e15).toLong()

fun solve1(N: Long, M: Long, R: Long, r: Array<Long>, A: Array<Long>, B: Array<Long>, C: Array<Long>) {
    val mat = Array(N.toInt()) { Array(N.toInt()) { INF } }

    for (i in mat.indices) {
        mat[i][i] = 0
    }

    for (i in A.indices) {
        val a = A[i].toInt() - 1
        val b = B[i].toInt() - 1
        mat[a][b] = C[i]
        mat[b][a] = C[i]
    }

    for (k in mat.indices) for (i in mat.indices) for(j in mat.indices) {
        mat[i][j] = Math.min(mat[i][j], mat[i][k] + mat[k][j])
    }

    val dp = Array(1 shl R.toInt()) { Array(R.toInt()) { INF } }

    for (i in r.indices) {
        dp[1 shl i][i] = 0
    }

    for (s in 0 until (dp.size - 1)) {
        for (i in r.indices) {
            if ((s shr i) and 1 == 0) {
                continue
            }

            for (j in r.indices) {
                if (i == j) {
                    continue
                }
                val t = s or (1 shl j)
                dp[t][j] = dp[t][j].coerceAtMost(dp[s][i] + mat[r[i].toInt() - 1][r[j].toInt() - 1])
            }
        }
    }

    println(min(dp.last().asList()))
}



Measured memory_bytes: 110724
#include <stdio.h>

int main(void)
{
	int a, b;

	scanf("%d %d", &a, &b);

	if (a < b)
	{
		printf("a < b\n");
	}

	if (a > b)
	{
		printf("a > b\n");
	}

	if (a == b)
	{
		printf("a == b\n");
	}

	return 0;
}


Measured memory_bytes: 2132
#include <bits/stdc++.h>
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) {if(a<b) a=b;}
#define chmin(a, b) {if(a>b) a=b;}
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;

ll N;
double x[1111], y[1111], r[1111];
vector<pair<ll, double>> g[1111];
double di[1111];

void dijkstra() {
  ll clr[1111]={};
  ll i;
  for(i=0; i<N; i++) {
    di[i]=INF;
  }
  di[0]=0;
  
  priority_queue<pair<double, ll>> q;
  q.push({-di[0], 0});
  
  while(q.size()) {
    pair<double, ll> f=q.top(); q.pop();
    ll u=f.second;
    if(-f.first>di[u]) continue;
    clr[u]=1;
    
    for(i=0; i<g[u].size(); i++) {
      pair<ll, double> h=g[u][i];
      
      if(clr[h.first]) continue;
      if(di[h.first]<=di[u]+h.second) continue;
      
      di[h.first]=di[u]+h.second;
      q.push({-di[h.first], h.first});
    }
    
  }
  
  
}

int main(void) {
  cin >> x[0] >> y[0] >> x[1] >> y[1];
  cin >> N;
  ll i, j;
  
  
  for(i=2; i<N+2; i++) {
    cin >> x[i] >> y[i] >> r[i];
  }
  
  N+=2;
  for(i=0; i<N; i++) {
    for(j=i+1; j<N; j++) {
      double a=x[i]-x[j];
      double b=y[i]-y[j];
      double d=max(0.0, sqrt(a*a+b*b)-r[i]-r[j]);
      g[i].push_back({j, d});
      g[j].push_back({i, d});
    }
  }
  
  dijkstra();
  printf("%.12f\n", di[1]);
  
}


Measured memory_bytes: 22676
n = int(input())
s = 0
m = 1*10**9+1
for _ in range(n):
    ai, bi = map(int, input().split())
    s += ai
    if ai > bi:
        if m > bi:
            m = bi

print(0) if m == 1*10**9+1 else print(s-m)

Measured memory_bytes: 3060
#include <set>
#include <map>
#include <cmath>
#include <ctime>
#include <bitset>
#include <string>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iomanip>
#include <iostream>
#include <algorithm>
#define PR pair
#define fi first
#define se second
#define mk make_pair
#define pb push_back
#define REP(i, x, y)   for(int i = (int)(x); i <= (int)(y); i++)
#define FOR(i, x, y)   for(int i = (int)(x); i <  (int)(y); i++)
#define PER(i ,x, y)   for(int i = (int)(x); i >= (int)(y); i--)
#define CH	         ch = getchar()
#define Exit(...)    printf(__VA_ARGS__), exit(0)
#define dln()        fprintf(stderr,"\n")
#define dprintf(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
typedef double	  db;
typedef long long LL;
typedef vector<int> VI;
typedef vector<VI > VII;
typedef PR<int,int> PII;
typedef vector<PII> VPI;
const	int inf=2e9;
const	LL Inf=1e10;
const	int P=1e9+7;
const	int N=2005;

inline LL IN(){
	LL x = 0;
	int ch = 0, f = 0;
	for (CH; ch != -1 && (ch < 48 || ch > 57); CH) f = (ch == '-');
	for (; ch >= 48 && ch <= 57; CH) x = (x << 1) + (x << 3) + ch - '0';
	return f ? (-x) : x;
}
template<typename T> inline int chkmin(T &a, const T &b){if(b < a) return a = b, 1; return 0;}
template<typename T> inline int chkmax(T &a, const T &b){if(b > a) return a = b, 1; return 0;}

void renew(int &x, const int &y){
	x += y;
	if(x >= P) x -= P;
	if(x <  0) x += P;
}

int Pow(int x, int y, int p){
	int a = 1;
	for (; y; y >>= 1, x = (LL)x * x %p) if(y & 1) a=(LL)a * x%p;
	return a;
}

int n, m, K, F[N << 1][N], maxd, ans;

int main(){
	scanf("%d%d%d", &n, &m, &K);
	maxd = (n + m) / (K - 1) + 1;
	REP(i, 1, K - 1) F[1][i] = 1;
	REP(i, 1, maxd) REP(j, 0, n) REP(k, 0, K - 1) if(j + k <= n) renew(F[i + 1][j + k], F[i][j]);
	REP(i, 1, maxd) REP(j, 0, n)if(F[i][j] && j % (K - 1) == n % (K - 1)){
		int k = i * (K - 1) + 1 - j;
		if(0 <= k && k <= m && k % (K - 1) == m % (K - 1))
			renew(ans, F[i][j]);
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

int main() {

	int n;
	cin >> n;
	vector<int> x(n+1, 0);
	for (int i = 1; i < n+1; i++) {
		cin >> x[i];
	}
	int m;
	cin >> m;
	vector<int> a(m+1, 0);
	for (int i = 1; i < m+1; i++) {
		cin >> a[i];
	}

	int kariposi = 0;
	for (int i = 1; i < m+1; i++) {
		kariposi = x[a[i]]+1;
		for (int j = 1; j < n+1; j++) {
			if (kariposi == x[j] || kariposi == 2020) {
				kariposi--;
				break;
			}
		}
		x[a[i]] = kariposi;
	}

	for (int i = 1; i < n+1; i++) {
		cout << x[i] << endl;
	}
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define N 200009
using namespace std;

int n,a[N],lg[N];
struct node{ int x,y; }f[2][18][N];
bool operator <(node u,node v){ return u.x<v.x; }
struct itv{ int l,r,k; };
bool operator <(itv u,itv v){ return a[u.k]>a[v.k]; }
priority_queue<itv> Q;
int getmin(int x,int y,int z){
	z^=(x&1);
	int k=lg[y-x+1];
	return min(f[z][k][x],f[z][k][y-(1<<k)+1]).y;
}
void ins(int l,int r){
	if (l<r) Q.push((itv){l,r,getmin(l,r,0)});
}
int main(){
	scanf("%d",&n);
	int i,j,k,x,y;
	for (i=1; i<=n; i++){
		scanf("%d",&a[i]);
		f[i&1][0][i]=(node){a[i],i};
		f[i&1^1][0][i]=(node){n+1,i};
	}
	for (i=2; i<=n; i++) lg[i]=lg[i>>1]+1;
	for (i=0; i<2; i++)
		for (j=1; j<=17; j++)
			for (k=1; k<=n; k++){
				f[i][j][k]=f[i][j-1][k];
				if (k+(1<<j-1)<=n) f[i][j][k]=min(f[i][j][k],f[i][j-1][k+(1<<j-1)]);
			}
	ins(1,n);
	itv u;
	while (!Q.empty()){
		u=Q.top(); Q.pop();
		x=u.k; y=getmin(x,u.r,1);
		printf("%d %d ",a[x],a[y]);
		ins(u.l,x-1); ins(x+1,y-1); ins(y+1,u.r);
	}
	return 0;
}


Measured memory_bytes: 59896
# -*- coding: utf-8 -*-
import numpy as np

n,m = map(int, input().split())
graph = [[0 for i in range(n)] for j in range(n)]
graph = np.array(graph)

for i in range(m):
    a,b = map(int, input().split())
    graph[a-1,b-1] = 1
    graph[b-1,a-1] = 1

used = [False]*n
used[0] = True

def DFS(v,used):
    if all(used):
        return 1
    ans = 0
    for i in range(n):
        if used[i]:
            continue
        if graph[i,v] == 0:
            continue
        used[i] = True
        ans += DFS(i,used)
        used[i] = False
    return ans
  
print(DFS(0,used))

Measured memory_bytes: 12436
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#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 FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())

int n;
int a[100];

void init() {

}

void input() {
  cin >> n;
  REP(i, n) cin >> a[i];
}

void solve() {
  sort(a, a+n);
  int res = accumulate(a, a+n, 0);
  res -= a[n-1]/2;
  cout << res << endl;
}

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


Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Extentions;

class IO
{
    int idx;
    string[] input;

    public IO(TextReader reader)
    {
        input = reader.ReadToEnd().Split(new[] { " ", Environment.NewLine },
            StringSplitOptions.RemoveEmptyEntries);
    }

    T Get<T>(Func<string, T> parser) => parser(input[idx++]);

    public string S => Get(s => s);
    public char C => Get(char.Parse);
    public int I => Get(int.Parse);
    public long L => Get(long.Parse);
    public double F => Get(double.Parse);
    public decimal D => Get(decimal.Parse);
    public BigInteger B => Get(BigInteger.Parse);

    T[] Gets<T>(int n, Func<string, T> parser)
        => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray();

    public string[] Ss(int n) => Gets(n, s => s);
    public char[] Cs(int n) => Gets(n, char.Parse);
    public int[] Is(int n) => Gets(n, int.Parse);
    public long[] Ls(int n) => Gets(n, long.Parse);
    public double[] Fs(int n) => Gets(n, double.Parse);
    public decimal[] Ds(int n) => Gets(n, decimal.Parse);
    public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse);

    public void Write<T>(params T[] xs) => WriteLine(string.Join(" ", xs));
    public void Write(params object[] xs) => WriteLine(string.Join(" ", xs));
}

static class Extentions
{
}

static class Program
{
    public static void Main()
    {
        var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" };
#if !DEBUG
        sw.AutoFlush = false;        
#endif
        SetOut(sw);
        Solve(new IO(In));
        Out.Flush();
    }

    static void Solve(IO io)
    {
        var a = io.I;
        var b = io.I;

        if (a % 3 == 0 || b % 3 == 0 || (a + b) % 3 == 0) io.Write("Possible");
        else io.Write("Impossible");
    }
}

Measured memory_bytes: 11220
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)

int main(){
    int n,s;
    while(cin>>n,n){
        cin>>s;
        int mins=s,maxs=s,sum=s;
        rep(i,n-1){
            cin>>s;
            mins = min(mins,s);
            maxs = max(maxs,s);
            sum += s;
        }
        cout<<(sum-maxs-mins)/(n-2)<<endl;
    }
    return 0;
}

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

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    char c;
    cin >> c;
    if('A' <= c && c <= 'Z') cout << 'A' << endl;
    else cout << 'a' << endl;
    return 0;
}

Measured memory_bytes: 3644
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int ordena(const void * a, const void * b) {
    int x = (*(int *) a);
    int y = (*(int *) b);
    if (x < y) {
        return -1;
    }
    if (x > y) {
        return 1;
    }
    return 0;
}

int number[100000005];

int main() {
    int n;
    scanf("%d", &n);

    for (int i = 0; i < n; i++) {
        scanf("%d", &number[i]);
    }
    qsort(number, n, sizeof(number[0]), ordena);

    printf("%d\n", number[n-1]-number[0]);


    return 0;
}


Measured memory_bytes: 128
X, Y = map(int, input().split())
if 4*X - Y < 0 or Y - 2*X < 0:
  print("No")
else:
  if (4*X-Y)%2 != 0 or (Y-2*X)%2 != 0:
    print("No")
  else:
    print("Yes")

Measured memory_bytes: 9180
"""
author : dokueki
"""
import math
n = int(input())
f = 0
for i in range(1,10):
    if (n/i)-math.floor(n/i)==0 and (n//i) in range(1,10):
        f+=1
if f>0:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);



int main() {
    ios_base::sync_with_stdio(false); 

    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll ans1=0,s1=0,ans2=0,s2=0;
    rep(i,n) {
        if (i%2==0) {
            if (s1+a[i]<=0) {
                ans1+=1-(s1+a[i]);
                s1=1;
            } else s1+=a[i];
        } else {
            if (s1+a[i]>=0) {
                ans1+=1+(s1+a[i]);
                s1=-1;
            } else s1+=a[i];
        }
        if (i%2==1) {
            if (s2+a[i]<=0) {
                ans2+=1-(s2+a[i]);
                s2=1;
            } else s2+=a[i];
        } else {
            if (s2+a[i]>=0) {
                ans2+=1+(s2+a[i]);
                s2=-1;
            } else s2+=a[i];
        }
    }
    ll ans=(ans1<ans2)?ans1:ans2;
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main(void) {
  int n, m;
  cin >> n >> m;
  int res = n * 2 - 1;
  res = max(res, n + m);
  res = max(res, m*2-1);
  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Main {

    public static void main(String[] args) {

    	Main main=new Main();

    	main.run();

    }

    void run() {

    	Scanner sc=new Scanner(System.in);

    	Set<Integer> set=new TreeSet<Integer>();
    	
    	for(int i=0;i<3;i++) {
    		int buf=sc.nextInt();
    		
    		set.add(buf);
    	}
    	
    	int result=set.size();
    	
    	System.out.println(result);
    }
}


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

int main(){

  int N,K,tmp,d;
  cin >> N >> K ;
  int count = N;
  // vector<int> d(K);
  vector<int> A(N+1,0);

  for(int i = 0;i < K;i++){
    cin >> d;
    for(int j = 0;j < d;j++){
      cin >> tmp;
      if(A.at(tmp) == 0){
        count--;
        A.at(tmp)++;
      }else{
        A.at(tmp)++;
      }
    }
  }

  cout << count <<endl;

}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
//double pi=3.1415926535898;
//double pi=acos(-1.0);
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define rep(i,a,b) for(int i=a;i<=int(b);++i)
#define lop(i,n)   for(int i=0;i<int(n);i++)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define pii        pair<int,int>
#define pis        pair<int,string>
#define vi         vector<int>
#define F          first
#define S          second
//#define max(a,b) a<b?b:a  __builtin_popcount;
//#define min(a,b) a<b?a:b  freopen("output.txt","w",stdout),freopen("input.txt","r",stdin);
const ll M  = 1e9+7 ;
const int N = 50500;
//const int X = 0x7f7f7f7f;
const double eps = 1e-4;
//////////////////////    Hi    ^_^  hack me if you can :P


int main()
{
    int s,k,ans=0;
    cin>>k>>s;
    lop(i,k+1)
    lop(j,k+1)
    if((s-(i+j)<=k)&&(s-(i+j)>=0) )
        ans++;
    cout<<ans;
}
/*

https://ideone.com/goT6Vy//http:
codeforces.com/problemset/problem/466/D

, vector < pair <int,int > >, greater <pair <int, int> >
http://codeforces.com/contest/295/submission/17929453
freopen("output.txt","w",stdout);
freopen("input.txt","r",stdin);

ll pwmod(ll a, ll n, ll mod)
{
    ll ret = 1;
    while (n)
    {
        if (n & 1) ret = ret * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return ret;
}

for (int i=0; i<n; i++)            Hi    ^_^  hack me if you can :P

int mx[]= {0,0,1,-1, 1,1,-1,-1};
int my[]= {1,-1,0,0, 1,-1,1,-1};
bool inside (int i,int j){return (i>=0 && i<n && j>=0 && j<m);}

typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

void gcd(LL n,LL m,LL &d,LL &xx,LL &yy)
{
    if(!m)
    {
        d=n;
        xx=1;
        yy=0;
    }
    else
    {
        gcd(m,n%m,d,yy,xx);
        yy-=xx*(n/m);
    }
}

int getm(int l,int r)
{
    if(l>r)
        return N;
    if(l==r)
        return 0;
    if(l==r-1)
        return s[l] != s[r];
    if(s[l]==s[r])
        return getm(l+1,r-1);
    else
        return 1+min(getm(l+1,r),getm(l,r-1));
}

int BIT[si], a[si], n;
void update(int x, int delta)
{
    for(; x <= N; x += x&-x)
        BIT[x] += delta;
}
int query(int x)
{
    int sum = 0;
    for(; x > 0; x -= x&-x)
        sum += BIT[x];
    return sum;
}

#define sc(x)      scanf("%d",&x)
#define scl(x)     scanf("%lld",&x)
#define pr(x)      printf("%d ",x)
#define prl(x)     printf("%lld ",x)
#define prln(x)    printf("%d\n",x)
#define prlln(x)   printf("%lld\n",x)
#define scd(x)     scanf("%lf",&x)
#define prd(x)     printf("%.10f\n",x)


*/


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

int main(){
    int H,W;
    
    while(1){
        cin >> H  >> W;
        if ( H==0 && W==0) break;
        
        for ( int i = 0; i < H; i++){
            for ( int j = 0; j < W;j++){
                if (i==0 || i ==H-1 || j==0 || j==W-1){
                    cout << "#";
                }   else{
                    cout <<".";
                }
             }
            cout<<"\n";
        }
        cout << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3088
#include <stdio.h>
#include <math.h>
int main (void){
        int a,b,c,x,ans=0,use_a,use_b,use_c;
        scanf("%d",&a);
        scanf("%d",&b);
        scanf("%d",&c);
        scanf("%d",&x);

        use_a=x/500;
        use_b=(x%500)/100;
        use_c=(x%100)/50;
        while(1) {
                if (a>=use_a&&b>=use_b&&c>=use_c) {
                        //printf("%d %d %d\n",use_a,use_b,use_c );
                        ans++;
                }
                if (use_b>=1) {
                        use_b--;
                        use_c+=2;
                }else if(use_a>=1) {
                        use_a--;
                        use_b=(x-500*use_a)/100;
                        use_c=(x%100)/50;
                        //printf("分解\n");
                } else{
                        break;
                }
        }

        printf("%d\n",ans );
        return 0;
}


Measured memory_bytes: 128
#include<stdio.h>

int main(){
	int a,b,ans;
	char op;

	while(1){
	scanf("%d %c %d",&a,&op,&b);

	if(op == '+') ans = a + b;
	if(op == '-') ans = a - b;
	if(op == '*') ans = a * b;
	if(op == '/') ans = a / b;
	if(op == '?') break;
	printf("%d\n",ans);
	}
	return 0;
}

Measured memory_bytes: 600
#include <iostream>
 
int main() {
  int n;
  std::cin >> n;
 
  long min = 1000001;
  long max = -1000001;
  long sum = 0;
   
  for (int i = 0; i < n; i++) {
    long num;
    std::cin >> num;
    if (num > max) max = num;
    if (num < min) min = num;
    sum += num;
  }
 
  std::cout << min << " " << max << " " << sum << std::endl;
 
  return 0;
} 


Measured memory_bytes: 3104
import sys
input = sys.stdin.readline

n,x,y = map(int,input().split())
x,y = x-1,y-1

cnt = [0]*(n-1)

for i in range(n):
    for j in range(i+1,n):
        mi = min(j-i,abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-y))
        #print(i,j,mi)
        cnt[mi-1] += 1

print(*cnt,sep="\n")



Measured memory_bytes: 47708
import java.util.Scanner;

public class Main {
	void run() {
		Scanner sc = new Scanner(System.in);
		
		int a = sc.nextInt();
		int b = sc.nextInt();
		System.out.println((a + b) % 24);
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}


Measured memory_bytes: 20820
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;

int main(void) {
	int n;
	cin >> n;
	vector<long long> a(n+1), b(n);
	for(int i = 0; i < n+1; ++i) cin >> a[i];
	for(int i = 0; i < n; ++i) cin >> b[i];
	
	long long n_kill = 0;
	for(int i = 0; i < n; ++i) {
		long long n_kill_1 = min(a[i], b[i]);
		a[i] -= n_kill_1;
		b[i] -= n_kill_1;
		long long n_kill_2 = min(a[i+1], b[i]);
		a[i+1] -= n_kill_2;
		b[i] -= n_kill_2;
		n_kill += n_kill_1 + n_kill_2;
	}

	cout << n_kill << endl;

	return 0;
}


Measured memory_bytes: 1792
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <valarray>
#include <vector>

#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#define repeat(i,n)     for(int i=0; i<(n); ++i)
#define repeat1(i,n)    for(int i=1; i<=(n); ++i)
#define range(i,l,r)    for(int i=(l); i<(r); ++i)

using namespace std;
typedef long long llint;

int iin();
llint   lin();
double  fin();

int main() {
    int n = iin();
    llint   cnt = 1;
    vector<int> vt(n), va(n);

    repeat(i, n) {
        vt[i] = iin();
    }
    repeat(i, n) {
        va[i] = iin();
    }

    if(n == 1) {
        if(vt[0] != va[0])  printf("0\n");
        else    printf("1\n");
        return 0;
    }
    else if(n == 2) {
        if(vt[1]!=va[0] || (vt[0]>va[1] && vt[0]!=vt[1])
                        || (vt[0]<va[1] && va[0]!=va[1])) {
            printf("0\n");
        }
        else {
            printf("1\n");
        }
        return 0;
    }
    else {
        if((va[0]!=va[1] && vt[0]!=va[0])
                || (vt[n-1]!=vt[n-2] && vt[n-1]!=va[n-1])) {
            printf("0\n");
            return 0;
        }
        range(i, 1, n-1) {
            if(vt[i]!=vt[i-1] && va[i]!=va[i+1] && vt[i]!=va[i]) {
                cnt = 0;
            }
            if((vt[i]!=vt[i-1] && vt[i]>va[i])
                    || (va[i]!=va[i+1] && vt[i]<va[i])) {
                cnt = 0;
            }
            if(vt[i]==vt[i-1] && va[i]==va[i+1]) {
                cnt *= min(vt[i], va[i]);
                cnt %= 1000000007;
            }
        }
        printf("%lld\n", cnt);
    }

    return 0;
}

//////////////////////////////////////////////////////////////////////////////

int iin() {
    int x;
    scanf("%d", &x);
    return  x;
}

llint lin() {
    llint x;
    scanf("%lld", &x);
    return  x;
}

double fin() {
    double  x;
    scanf("%lf", &x);
    return x;
}


Measured memory_bytes: 1152
#include <algorithm>  
#include <iostream>  
#include <sstream>  
#include <string>  
#include <cstring>
#include <vector>  
#include <queue>  
#include <set>  
#include <map>  
#include <cstdio>  
#include <cstdlib>  
#include <cctype>  
#include <cmath>  
#include <list>  
#include <cassert>
#include <ctime>
#include <climits>
using namespace std;  

#define PB push_back  
#define MP make_pair  
#define SZ(v) ((int)(v).size())  
#define FOR(i,a,b) for(int i=(a);i<(b);++i)  
#define REP(i,n) FOR(i,0,n)  
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)  
#define REPE(i,n) FORE(i,0,n)  
#define FORSZ(i,a,v) FOR(i,a,SZ(v))  
#define REPSZ(i,v) REP(i,SZ(v))  
typedef long long ll;
typedef unsigned long long ull;
ll gcd(ll a,ll b) { return b==0?a:gcd(b,a%b); }

const int MAXN = 10;

int n;
int a[MAXN];


void run() {
	scanf("%d", &n); REP(i, n) scanf("%d", &a[i]);
	int numtot = 1, numodd = 1;
	REP(i, n) {
		numtot *= 3;
		numodd *= a[i] % 2 == 0 ? 2 : 1;
	}
	printf("%d\n", numtot - numodd);
}

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<utility>
#include<algorithm>
#include<map>
#include<cmath>
typedef long long ll;
#define PB	push_back
#define FOR(n)			for(int i = 0; i < n; ++i)
#define RFOR(n)			for(int i = n; i >= 0; --i)
#define FORR(start,end) for(int i = start; i < end; ++i)
#define COUT(n)			cout << n << " " << flush
#define vi(v)			vector<int> v
#define vii(v)			vector<pair<int,int>> v
#define mii(m)			map<int, int> m
#define msi(m)			map<string, int, less<>> m
#define mmsi(m)			multimap<string, int, less<>> m
#define mkp(a,b)		make_pair(a,b)
#define ALL(obj)		obj.begin(), obj.end()
#define PI 3.141592
#define MOD 1e9+7
using namespace std;

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

	if (s == "SUN")
		cout << 7 << endl;
	else
		if (s == "MON")
			cout << 6 << endl;
		else if (s == "TUE")
			cout << 5 << endl;
		else if (s == "WED")
			cout << 4 << endl;
		else if (s == "THU")
			cout << 3 << endl;
		else if (s == "FRI")
			cout << 2 << endl;
		else if (s == "SAT")
			cout << 1 << endl;

	return 0;
}

Measured memory_bytes: 256
n = int(input())
adjc_list = [[] for _ in range(n)]
INF = 99999999999999999999
V = [ele for ele in range(n)]
S = []
d = [INF] * n
p = [ele for ele in range(n)]

for i in range(n):
    tmp = [int(ele) for ele in input().split()]
    for j in range(1, tmp[1]*2, 2):
        v = tmp[j+1]
        w = tmp[j+2]
        adjc_list[i].append([w, v])
    adjc_list[i].sort()


def my_dijkstra_solver():
    root = 0  # given
    # 1. 初期化
    d = [INF] * n
    d[root] = 0
    VS = V

    # 2. 以下の処理を、S = Vになるまで繰り返す
    while VS:
        # 2.1. V-S の中から、 d[u] が最小である頂点 u を選択する。
        u = VS[0]
        for i in VS:
            if d[i] < d[u]:
                u = i

        S.append(u)  # 2.2. u を S に追加する.

        # 2.3. u に隣接し, かつ V-S に属するすべての頂点 v に対する以下の値を更新する
        VS.remove(u)
        for w, v in adjc_list[u]:
            if v in VS:
                if d[u] + w < d[v]:
                    d[v] = d[u] + w
                    p[v] = u  # 親をどこかで使うのはわかるが一旦忘れよう

    for i, cost in enumerate(d):
        print(i, cost)


if __name__ == "__main__":
    my_dijkstra_solver()



Measured memory_bytes: 6124
#include<cstdio>
#include<climits>
#include<algorithm>
using namespace std;
int main()
{
	int time[101][101],cost[101][101],n,m,i,j,k,a,b,c,d;
	while(scanf("%d%d",&n,&m),m)
	{
		for(i=0;i<101;++i)for(j=0;j<101;++j)time[i][j]=cost[i][j]=INT_MAX/2;
		for(i=0;i<n;++i)scanf("%d%d%d%d",&a,&b,&c,&d),cost[a][b]=cost[b][a]=c,time[a][b]=time[b][a]=d;
		for(k=1;k<=m;++k)for(i=1;i<=m;++i)for(j=1;j<=m;++j)
			time[i][j]=min(time[i][j],time[i][k]+time[k][j]),
			cost[i][j]=min(cost[i][j],cost[i][k]+cost[k][j]);
		scanf("%d",&k);
		for(i=0;i<k;++i)
		{
			scanf("%d%d%d",&a,&b,&c);
			printf("%d\n",c?time[a][b]:cost[a][b]);
		}
	}
	return 0;
}

Measured memory_bytes: 844
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
const int N=5e5+5;
char s[N];int res,n,sum;
int main(){
	scanf("%s",s+1),res=n=strlen(s+1);
	fp(i,1,n)if(s[i]=='S')++sum;
		else if(sum)--sum,res-=2;
	printf("%d\n",res);
	return 0;
}

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

typedef long long ll;
#define PB push_back

int main() {
	ios_base::sync_with_stdio(false); cin.tie(0);
	int n; cin >> n;
	string s; cin >> s;
	string a;
	string b;
	for (int i = 0; i < n / 2; ++i) {
		a += s[i];
	}
	for (int i = n / 2; i < n; ++i) {
		b += s[i];
	}
	if (a == b) cout << "Yes";
	else cout << "No";
}



Measured memory_bytes: 256
#include <cstdio>
#include <limits>
#include <cmath>
#include<iostream>
#include<string>
#include <vector>
#include<algorithm>
using namespace std;


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

	sort(s.begin(),s.end());
	sort(t.rbegin(), t.rend());
	if (s < t) {
		cout << "Yes" << endl;
	}
	else
		cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#define debug_interval ','
#define dump_interval ' '
#define debug_toggle 1

//{
#pragma GCC optimize ("O3","unroll-loops")
#pragma GCC target ("avx")
#include<bits/stdc++.h>
using namespace std;
#define hi cerr<<"hi"<<endl;
#define int long long
#define INT_MAX LLONG_MAX
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep1(i,n) for(int i=1;i<=(n);i++)
#define pb push_back
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define fi first
#define se second
#define mp make_pair
#define rev reverse
#define dans dump(ans)
#define MOD 1000000007
#define amp(v,n) (v).count(n)?v[n]++:v[n]=1
#define sysp system("pause")
#define PI acos(-1)

//{
inline int toInt(string s){int v;istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x){ostringstream sout;sout<<x;return sout.str();}
template<class...A> inline void dump(){cout<<endl;}
template<class...A> inline void dump_rest() {cout<<endl;}
template<class T, class...A> inline void dump_rest(const T& first, const A&... rest){cout<<dump_interval<<first;dump_rest(rest...);}
template<class T,class...A> inline void dump(const T&first,const A&...rest){cout<<first;dump_rest(rest...);}
template<class...A> inline void debug(){cerr<<endl;}
template<class...A> inline void debug_rest() {cerr<<endl;}
template<class T, class...A> inline void debug_rest(const T& first, const A&... rest){cerr<<debug_interval<<first;debug_rest(rest...);}
template<class T,class...A> inline void debug(const T&first,const A&...rest){if(debug_toggle)cerr<<first,debug_rest(rest...);}
//}

typedef vector<int>vint;
typedef pair<int,int>pint;
typedef vector<pint>vpint;

template<typename A,typename B>inline void chmin(A &a,B b){if(a>b)a=b;}
template<typename A,typename B>inline void chmax(A &a,B b){if(a<b)a=b;}
template<int m>class mint{private:int i;public:mint() : i(0){}mint(int i): i((i%m+m)%m){}mint operator+(const mint& o){return o.i+i;}mint operator*(const mint& o){return o.i*i;}mint operator-(){return -i;}operator int() {return i;}};

//}

set<string> aa;

main(){
	string s;
	cin>>s;
	string p="AKIHABARA";
	if(s=="AKIHABARA"||s=="AKIHABAR"||s=="AKIHABRA"||s=="AKIHABR"||s=="AKIHBARA"||s=="AKIHBAR"||s=="AKIHBRA"||s=="AKIHBR"||s=="KIHABARA"||s=="KIHABAR"||s=="KIHABRA"||s=="KIHABR"||s=="KIHBARA"||s=="KIHBAR"||s=="KIHBRA"||s=="KIHBR")dump("YES");
	else dump("NO");
}


Measured memory_bytes: 256