akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[200010];
struct edge{int to,cost;};
int gcd(int a,int b){
	if(b==0)return a;
	return gcd(b,a%b);
}
int lcm(int a,int b){
	return a/gcd(a,b)*b;
}
bool prime(int a){
	if(a==1)return false;
	for(int i=2;i*i<=a;i++){
		if(a%i==0)return false;
	}
	return true;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){//線分の交差判定
	double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
	double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
	double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
	double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
	return tc*td<0&&ta*tb<0;
}
void init_fact(int n){
	kaijo[0]=1;
	for(int i=1;i<=n;i++){
		kaijo[i]=kaijo[i-1]*i;
		kaijo[i]%=MOD;
	}
}
int modpow(int a,int b){
	if(b==0)return 1;
	if(b%2)return modpow(a,b-1)*a%MOD;
	int memo=modpow(a,b/2);
	return memo*memo%MOD;
}
int comb(int a,int b){
	return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int g(int x){
	x=modpow(x,MOD-2);
	return x;
}
signed main(){
	int a,b;
	cin>>a>>b;
	cout<<max({a+b,a-b,a*b});
	return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
#include <memory>
#include <regex>
using namespace std;



int main()
{
	long long int x, y;
	cin >> x >> y;
	int ans = 0;
	while (x <= y) {
		x *= 2;
		ans++;
	}
	cout << ans  << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
int compare(const void *a,const void *b){
    return *(int*)b-*(int*)a;
}

int main(){
    int n,y;
    scanf("%d%d",&n,&y);
    for (int i=0; i<=n; i++) {
        for (int j=0; j<=n-i; j++) {
            int k = n-i-j;
            if (i*1000 + j*5000 + k*10000==y) {
                printf("%d %d %d",k,j,i);
                return 0;
            }
        }
    }
    puts("-1 -1 -1");
    return 0;
}

Measured memory_bytes: 2092
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<cmath>
using namespace std;
#define REP(i, limit) for(int i=0; i< limit; ++i)
#define FOR(i, j, limit) for(int i=j; i< limit; ++i)
#define DUMP(a) REP(d,a.size()){cout<<a[d];if(d!=a.size()-1)cout<<" ";else cout<<endl;}
#define ECHO(x) cout<<x<<endl;
#define MEMSET(a, n, x) REP(i, n) a[i]=x;
#define ARRIN(a, n) REP(i, n) cin>>a[i];
#define LL long long
int INF = 2147483647;
LL LINF = 9223372036854775807;
LL MOD = 1000000007;
typedef pair<int, int>P;
typedef pair<LL, LL>PL;
typedef vector<int> vi;
typedef vector<LL> vl;


int main(){
  int a, b, c;
  cin>>a>>b>>c;
cout<<min({a+b, b+c, c+a})<<endl;

  return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Cell {
	Cell next;
	Cell prev;
	int data;

	public Cell(int data) {
		this.data = data;
	}
}

class DoubleLinkedList {
	Cell senti;

	public DoubleLinkedList() {
		Cell cell = new Cell(-1);
		this.senti = cell;
		senti.next = senti;
		senti.prev = senti;
	}
	public void insert(int data) {
		Cell cell = new Cell(data);
		senti.next.prev = cell;
		cell.next = senti.next;
		senti.next = cell;
		cell.prev = senti;
	}
	public Cell search(int data) {
		Cell cell = senti.next;
		while(cell != senti) {
			if(cell.data == data) {
				return cell;
			}
			cell = cell.next;
		}
		return senti;
	}
	public void delete(int data) {
		Cell cell = search(data);
		if(cell != senti) {
			cell.prev.next = cell.next;
			cell.next.prev = cell.prev;
		}
	}
	public void deleteFirst() {
		senti.next.next.prev = senti;
		senti.next = senti.next.next;
	}
	public void deleteLast() {
		senti.prev.prev.next = senti;
		senti.prev = senti.prev.prev;
	}
}

public class Main {
	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		int n = Integer.parseInt(br.readLine());
		DoubleLinkedList linkedList = new DoubleLinkedList();
		for (int i = 0; i < n; i++) {
			String[] s = br.readLine().split(" ");
			if(s[0].equals("insert")) {
				int a = Integer.parseInt(s[1]);
				linkedList.insert(a);
			} else if (s[0].equals("delete")) {
				int a = Integer.parseInt(s[1]);
				linkedList.delete(a);
			} else if (s[0].equals("deleteFirst")) {
				linkedList.deleteFirst();
			} else {
				linkedList.deleteLast();
			}
		}
		for(Cell cell = linkedList.senti.next; cell != linkedList.senti; cell = cell.next) {
			if(cell.next == linkedList.senti) {
				System.out.println(cell.data);
			} else {
				System.out.print(cell.data + " ");
			}
		}
	}
}


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

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

    vector<string> s(2);
    rep(i, 0, a) s[0] += to_string(b);
    rep(i, 0, b) s[1] += to_string(a);

    sort(s.begin(), s.end());

    cout << s[0] << endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))

def split_even_or_odd(vv, n, start):
    res = {}
    for i in range(start,n,2):
        v = vv[i]
        if not v in res.keys(): res[v] = 1
        else: res[v] += 1
    return res

def find_fs(target):
    maxk1 = maxv1 = 0
    for k, v in target.items():
        if maxv1 < v:
            maxk1, maxv1 = k, v
    maxk2 = maxv2 = 0
    for k, v in target.items():
        if maxv2 < v and maxk1 != k:
            maxk2, maxv2 = k, v
    return (maxk1, maxv1), (maxk2, maxv2)

def main():
    n = II()
    vv = MII()
    ee = split_even_or_odd(vv, n, 0)
    oo = split_even_or_odd(vv, n, 1)

    e1kv, e2kv = find_fs(ee)
    o1kv, o2kv = find_fs(oo)

    minv = 10**5
    if e1kv[0] != o1kv[0]:
        minv = min(minv, n - (e1kv[1] + o1kv[1]))
    else:
        minv = min(minv, n - (e1kv[1] + o2kv[1]))
        minv = min(minv, n - (e2kv[1] + o1kv[1]))
    print(minv)

if __name__ == '__main__':
    main()


Measured memory_bytes: 18016
#include<iostream>
#include<vector>
#include<algorithm>
#include<map>
using namespace std;

int main(void){
    int n,m;
    cin >> n >> m;
    vector<string> M = vector<string>(n);
    for(int i = 0; i < n; i++){
        cin >> M[i];
    }

    vector<int> rows = vector<int>(n, 0);
    vector<int> cols = vector<int>(m, 0);
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(M[i][j] == '#'){
                rows[i] = 1;
                break;
            }
        }
    }

    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            if(M[j][i] == '#'){
                cols[i] = 1;
                break;
            }
        }
    }

    for(int i = 0; i < n; i++){
        if(rows[i]){
            for(int j = 0; j < m; j++){
                if(cols[j]) cout << M[i][j];
            }
            cout << endl;
        }
    }

    return 0;
}


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

using namespace std;

#define DUMP(x) std::cerr << (#x) << " = " << (x) << "\n"
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define REP(i, k, n) for (int i = (k); i < (int)(n); ++i)
#define ALL(r) r.begin(), r.end()
#define YES puts("YES")
#define Yes puts("Yes")
#define NO puts("NO")
#define No puts("No")
#define IMP puts("IMPOSSIBLE")
#define Imp puts("Impossible")
#define imp puts("impossible")
#define M1 puts("-1")
#define pb push_back

template <typename T>
ostream &operator<<(ostream &os, vector<T> &v)
{
    os << "{";
    rep(i, v.size()) os << v[i] << (i == (int)v.size() - 1 ? "" : ", ");
    os << "}";
    return os;
}
template <typename T>
T dup(T x, T y)
{
    return (x + y - 1) / y;
};
template <typename A, size_t N, typename T>
inline void arrayFill(A (&array)[N], const T &val) { std::fill((T *)array, (T *)(array + N), val); }
struct in
{
    const size_t n = 0;
    in() = default;
    in(size_t n) : n(n){};
    template <typename T>
    operator T()
    {
        T ret;
        cin >> ret;
        return ret;
    }
    template <typename T>
    operator vector<T>()
    {
        assert(n != 0);
        vector<T> ret(n);
        for (auto &x : ret)
            cin >> x;
        return ret;
    }
};

using ll = int64_t;
using vint = vector<int32_t>;
using vvint = vector<vint>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vstr = vector<string>;
using pint = pair<int32_t, int32_t>;
using pll = pair<ll, ll>;
using setint = set<int32_t>;
using setstr = set<string>;
using qint = queue<int32_t>;
using qpint = queue<pint>;

constexpr std::int32_t INF = 1001001001;
constexpr std::int64_t LINF = 1001001001001001001;

void Main()
{
    int n = in();
    vint a = in(n);
    vint b;
    b.reserve(n);
    for (int i = n - 1; i >= 0; i -= 2)
        b.pb(a[i]);
    for (int i = (n % 2); i < n; i += 2)
        b.pb(a[i]);
    rep(i, n) cout << b[i] << (i == n - 1 ? "\n" : " ");
}

int main()
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3712
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int i = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int i = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define MP make_pair
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1 << 30;
const ll LINF = 1LL << 61;
const int MOD = 1e9 + 7;

int main() {
    ll A, B, C;
    cin >> A >> B >> C;
    ll res = LINF;
    res = min(res, (A - A / 2) * B * C - ((A / 2) * B * C));
    res = min(res, (B - B / 2) * A * C - ((B / 2) * A * C));
    res = min(res, (C - C / 2) * B * A - ((C / 2) * B * A));
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

char map[255][255];
int count,n;

void tate();
void yoko();
void naname1();
void naname2();

main(){
  int i, j;

  while(1){
    scanf("%d", &n);
    if(n==0) break;
    getchar();

    for(i=0;i<n;i++){
      for(j=0;j<n;j++){
	scanf("%c", &map[i][j]);
      }
      getchar();
    }

    count=0;

    tate();
    yoko();
    naname1();
    naname2();

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


void tate(){
  int i, j, sum;

  for(j=0;j<n;j++){
    sum=0;
    for(i=0;i<n;i++){
      if(map[i][j]=='0') sum=0;
      if(map[i][j]=='1'){
	sum++;
      }
      if(count<sum) count=sum;
    }
  }
}

void yoko(){
  int i, j, sum;

  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<n;j++){
      if(map[i][j]=='0') sum=0;
      if(map[i][j]=='1'){
      sum++;
      }
      if(count<sum) count=sum;
    }
  }
}

void naname1(){
  int i, j, sum;


  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<=i;j++){
      if(map[j][i-j]=='0') sum=0;
      if(map[j][i-j]=='1'){
	sum++;
      }
      if(count<sum) count=sum;
    }
  }

  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<=i;j++){
      if(map[n-j-1][n-i+j-1]=='0') sum=0;
      if(map[n-j-1][n-i+j-1]=='1'){
	sum++;
      }
      if(count<sum) count=sum;
    }
  }
}

void naname2(){
  int i, j, sum;


  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<=i;j++){
      if(map[j][n-i-1+j]=='0') sum=0;
      if(map[j][n-i-1+j]=='1'){
	sum++;
      }
      if(count<sum) count=sum;
    }
  }
  
  for(i=0;i<n;i++){
    sum=0;
    for(j=0;j<=i;j++){
      if(map[n-i-1+j][j]=='0') sum=0;
      if(map[n-i-1+j][j]=='1'){
	sum++;
      }
      if(count<sum) count=sum;
    }
  }
}

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

int main() {
  //ここにコードを書いてください。
  char c;
  cin >> c;
  
  if ((c=='a') || (c == 'i') || (c == 'u') || (c == 'e') || (c == 'o')) {
    cout << "vowel" << endl;
  }
  else {
    cout << "consonant" << endl;
  }
}


Measured memory_bytes: 256
using System;
using System.Collections.Generic;

namespace ForAtCoder
{
    class Program
    {
        static void Main()
        {
            string[] input_a = Console.ReadLine().Split(' ');

            int n = int.Parse(input_a[0]);
            int m = int.Parse(input_a[1]);

            List<string> h_s = new List<string>();
            h_s.AddRange(Console.ReadLine().Split(' '));

            List<int> h = new List<int>();

            for (int i = 0; i < n; i++)
            {
                h.Add(int.Parse(h_s[i]));
            }

            List<int> disposed = new List<int>();

            for (int i = 0; i < m; i++)
            {
                string[] ab_s = Console.ReadLine().Split(' ');

                int a = int.Parse(ab_s[0]);
                int b = int.Parse(ab_s[1]);

                int sa = int.Parse(h_s[a - 1]) - int.Parse(h_s[b - 1]);

                if (sa > 0)
                {
                    disposed.Add(b);
                }
                else if (sa < 0)
                {
                    disposed.Add(a);
                }
                else
                {
                    disposed.Add(a);
                    disposed.Add(b);
                }
            }

            var dispose = new HashSet<int>(disposed);

            Console.WriteLine((n - dispose.Count).ToString());
        }
    }

}


Measured memory_bytes: 37996
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,a,b=INTM()
    print(min(n*a,b))
if __name__ == '__main__':
    do()

Measured memory_bytes: 3060
# include <bits/stdc++.h>
typedef long long lint;
using namespace std;

lint gcd(lint x, lint y) {
  if(x == 0) { return y; }
  else { return gcd(y%x,x); }
}

lint lcm(lint x, lint y) { return x/gcd(x,y)*y; }

lint C(lint n, lint k) {
  if(n == k) { return 1; }
  else if(n < k) { return 0; }
  else if(k == 0) { return 1; }
  else if(k == 1) { return n; }
  else return C(n-1,k-1) + C(n-1,k);
}

lint P(lint n, lint k) {
  if(k == 1) { return n; }
  return (n*(P(n-1,k-1)%1000000007)%1000000007);
}


int main() {
  lint a,v,b,w,t; cin >> a >> v >> b >> w >> t;
  
  if(t*(v-w) >= abs(a-b)) { cout << "YES" << endl; }
  else { cout << "NO" << endl; }
  return 0;
}


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

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

const int INF=1<<29;

int main(){
	int n,m,r; cin>>n>>m>>r;
	int s[8];
	rep(i,r) cin>>s[i], s[i]--;
	int d[200][200];
	rep(u,n) rep(v,n) d[u][v]=(u==v?0:INF);
	rep(i,m){
		int u,v,c; cin>>u>>v>>c; u--; v--;
		d[u][v]=d[v][u]=c;
	}

	rep(k,n) rep(i,n) rep(j,n) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);

	int ans=INF;
	int p[]={0,1,2,3,4,5,6,7};
	do{
		int tmp=0;
		rep(i,r-1) tmp+=d[s[p[i]]][s[p[i+1]]];
		ans=min(ans,tmp);
	}while(next_permutation(p,p+r));
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 384
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
int dp[1005][1005];
using namespace std;
int main()
{	
	int n,m;
	string s;
	cin>>n>>m;
	vector<string>v;
	for(int i=0;i<n;i++){
	cin>>s;
	v.push_back(s);
	}
	for(int i=0;i<m;i++)
	{
		if(v[0][i]=='.')
		dp[0][i] = 1;
		else break;
	}
	for(int i=0;i<n;i++)
	{
		if(v[i][0]=='.')
		dp[i][0] = 1;
		else break;
	}
	for(int i=1;i<n;i++)
	{
		for(int j=1;j<m;j++)
		{
			if(v[i][j]=='.'){
			dp[i][j] = dp[i-1][j] + dp[i][j-1];
			dp[i][j] %= mod;
			}
		}
	}
	cout<<dp[n-1][m-1]<<endl;
}

Measured memory_bytes: 8448
from heapq import heappush, heappop
from itertools import permutations, accumulate, combinations
from math import pi, ceil, floor
import numpy as np
from collections import defaultdict, deque
from operator import itemgetter
from bisect import bisect_left, bisect_right, insort_left, insort_right
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10 ** 6)
# MOD = 10 ** 9 + 7
# INF = float("inf")


def total_check(sugar, water, lim):
    if sugar + water <= lim:
        return True
    else:
        return False


def concentration(sugar, water, lim_sugar):
    if sugar / (sugar + water) <= lim_sugar / (lim_sugar + 100):
        return True
    else:
        return False


def main():
    a, b, c, d, lim_sugar, lim = map(int, input().split())
    water_list = []
    for i in range(lim // (100 * a) + 1):
        for j in range(lim // (100 * b) + 1):
            water_list.append(100 * i * a + 100 * j * b)
    water_list = sorted(list(set(water_list)))
    sugar_list = []
    for i in range(lim // c + 1):
        for j in range(lim // d + 1):
            sugar_list.append(i * c + j * d)
    sugar_list = sorted(list(set(sugar_list)))
    c = 0
    ans = (100 * a, 0)
    for w in water_list:
        for s in sugar_list:
            if w == 0 and s == 0: continue
            if total_check(s, w, lim) and concentration(s, w, lim_sugar):
                if c < s * 100 / (s + w):
                    c = s * 100 / (s + w)
                    ans = (s+w, s)
    print(*ans)



if __name__ == '__main__':
    main()


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

#define rep(i, n)for((i) = 0;(i) < (n);++(i))

int main(void){
	int i, j, q, n;
	scanf("%d", &q);
	rep(i, q){
		printf("Case %d:\n", i + 1);
		scanf("%d", &n);
		for(int t = 10;t--;){
			n = (n * n / 100) % 10000;
			printf("%d\n", n);
		}
	}
}

Measured memory_bytes: 3144
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define rep(i,m,n) for(int (i)=(m);(i)<(n);++(i))
#define rrep(i,m,n) for(int (i)=(n)-1;(i)>=(m);--(i))
#define all(x) (x).begin(),(x).end()
#define out(y,x,h,w) (y)<0||(x)<0||(y)>=(h)||(x)>=(w)
constexpr ll INF = (ll)1e9;
constexpr ll mod = (ll)1e9 + 7;
constexpr double PI = 3.1415926535897932;
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;
}
inline void init() {
	cin.tie(nullptr); cout.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

int main() {
	init();

	int N; cin >> N;
	vector<ll>vec(N);
	ll x = 0;
	rep(i, 0, N) {
		int a, b; cin >> a >> b;
		vec[i] = a + b;
		x += b;
	}
	sort(all(vec), greater<ll>());
	ll ans = 0;
	rep(i, 0, N) {
		ans += vec[i];
		++i;
	}
	ans -= x;
	cout << ans << "\n";

	return 0;
}

Measured memory_bytes: 3976
#include <stdio.h>

int main(void){
	int sum = 0;
	int mode = 0;
	int current = 0;
	int c;
	while(1){
		c = getchar();
		if(c == EOF){break;}
		if('0' <= c && c <= '9'){
			mode = 1;
			current = current * 10 + c - '0';
		}else if(mode){
			sum += current;
			mode = 0;
			current = 0;
		}

	}
	printf("%d\n",sum);

	return 0;
}

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



int main() {
	int n;
	cin >> n;
	vector<string> str1(n);
	for(int i=0; i<n; i++){
		cin >> str1.at(i);
	}
	int m;
	cin >> m;
	vector<string> str2(m);
	for(int i=0; i<m; i++){
		cin >> str2.at(i);
	}

	map<string, int> count;
	for(int i=0; i<n; i++){
		if(count.find(str1.at(i)) == count.end()){
			count[str1.at(i)] = 1;
		}else{
			count[str1.at(i)]++;
		}
	}
	for(int i=0; i<m; i++){
		if(count.find(str2.at(i)) == count.end()){
			continue;
		}else{
			count[str2.at(i)]--;
		}
	}
	int ans = 0;
	string str;
	for(auto iter = count.begin(); iter != count.end(); iter++){
		if(iter->second > ans){
			ans = iter->second;
			str = iter->first;
		}
	}
	cout << ans << endl;

}


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

typedef long long int   ll;
#define cases           int t;cin>>t;while(t--)
#define FIO             ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define scan(n)         scanf("%d",&n)
#define pb              push_back
#define vi              vector<int>
#define ii              pair<int,int>

using namespace std;

int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    while(a>0 && c>0){
        c-=b;
        if(c<=0)break;
        a-=d;
    }
    if(c<=0)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 3636
n=int(input())
ans=0
s=dict()
s[n]=0
for i in range(1,int(n**0.5)+1):
  if n%(i+1)==0:
    if i+1 not in s:
      s[i+1]=0
    if n//(i+1) not in s:
      s[n//(i+1)]=0
s=list(s.items())
for i,j in s:
  if i==1:
    continue
  l=n
  while l%i==0:
    l//=i
  if l%i==1:
    ans+=1
d=dict()
k=n-1
for i in range(1,int((n-1)**0.5)+1):
  t=0
  while k%(i+1)==0:
    k//=(i+1)
    t+=1
  if t>0:
    if i+1 not in d:
      d[i+1]=t
    else:
      d[i+1]+=t
if k>1:
  if k not in d:
    d[k]=1
  else:
    d[k]+=1
d=list(d.items())
m=1
for p,root in d:
  m*=(root+1)
print(ans+m-1)

Measured memory_bytes: 4088
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#include <cstring>
#include <set>
#include <map>
#define rep(i, m, n) for (int i = m; i < n; i++)
#define repr(i, n) for (int i = n; i >= 0; i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout << #x << ": " << x << endl
#define SORT(v, n) sort(v, v + n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

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

ll n, a[10]={}, b;

int main()
{
    for(int i=0; i<10; i++){
        cin>>a[i];
    }
    sort(a,a+10);
    reverse(a,a+10);
    for(int i=0; i<3; i++){
        cout<<a[i]<<endl;
    }
    
}

Measured memory_bytes: 3152
using System;
using System.Linq;
using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ir = new Resolver(new ConsoleReader());
            Console.WriteLine(ir.Resolve());
        }
    }

    public class Resolver
    {
        IInputReader InputReader { get; }
        public List<string> Messages { get; set; } = new List<string>();

        int[] ls;

        public void ParseLines(){
            ls = InputReader.ReadLine().Split(' ').ToList().Select(x => int.Parse(x)).ToArray();
        }


        public string Resolve()
        {
            var result = Math.Sqrt((ls[0] + ls[1] + ls[2]) * (-ls[0] + ls[1] + ls[2]) * (ls[0] - ls[1] + ls[2]) * (ls[0] + ls[1] - ls[2])) / 4;

            return result.ToString();
        }



        public Resolver(IInputReader inputReader)
        {
            InputReader = inputReader;
            ParseLines();
        }

    }

    public interface IInputReader
    {
        string ReadLine();
    }

    class ConsoleReader : IInputReader
    {
        string IInputReader.ReadLine()
        {
            return Console.ReadLine();
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            var d = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);

            int[] count = new int[N - 1];
            int sum = 0;
            
            for(int i = 0; i < N-1; i++)
            {
                for(int j = i+1; j < N; j++)
                {
                    count[i] = d[i] * d[j];
                    sum += count[i];
                }
            }
            Console.WriteLine(sum);

        }

    }
}

Measured memory_bytes: 13140
#[allow(dead_code)]
fn is_whitespace(c: &char) -> bool {
    c.is_whitespace()
}

#[allow(dead_code)]
fn is_eol(c: &char) -> bool {
    ['\r', '\n'].contains(c)
}

#[allow(unused_macros)]
macro_rules! input {
    ($var:ident, $($r:tt)*) => {
        input_inner!{$var, $($r)*}
    };

    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        #[allow(unused_mut, unused_variables, bare_trait_objects)]
        let mut next = move |f: &Fn(&char)->bool| -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|f(&c))
                .take_while(|c|!f(&c))
                .collect()
        };
        input_inner!{next, $($r)*};
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; eol ]) => {
        $next(&is_eol).split(' ').map(|x| x.parse::<$t>().unwrap()).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, parser) => {
        $next
    };

    ($next:expr, $t:ty) => {
        $next(&is_whitespace).parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap, HashSet};

#[allow(dead_code)]
struct Edge {
    from: usize,
    to: usize,
}

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;
#[allow(dead_code)]
const M: usize = 1_000_000_007;

fn main() {
    input! {
        mut n: chars,
    }

    n.reverse();
    n.push('0');
    let mut dp = vec![vec![1 << 60; 2]; n.len() + 1];
    dp[0][0] = 0;

    for i in 0..n.len() {
        for j in 0..2 {
            let d = (n[i] as u8 - '0' as u8) as usize + j;
            if d > 9 {
                dp[i + 1][1] = min(dp[i + 1][1], dp[i][j]);
            } else {
                dp[i + 1][0] = min(dp[i + 1][0], dp[i][j] + d);
                dp[i + 1][1] = min(dp[i + 1][1], dp[i][j] + 10 - d);
            }
        }
    }
    println!("{}", dp[n.len()].iter().min().unwrap());
}


Measured memory_bytes: 47348
import sys

#fin = open("test.txt", "r")
fin = sys.stdin

n = int(fin.readline())
d = {}

for i in range(n):
	op, str = fin.readline().split()
	if op == "insert":
		d[str] = 0
	else:
		if str in d:
			print("yes")
		else:
			print("no")

Measured memory_bytes: 37680
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
#include <vector>
using namespace std;

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,a,b) for(int i=a;i<b;i++)
#define PB push_back
#define SORT(v) sort(v.begin(), v.end())
#define REVSORT(v) sort(v.begin(), v.end(), std::greater<int>())

typedef long long ll;

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	int n, a, b;
	char c;
	int d = 0, e = 0;
	cin >> n >> a >> b;
	rep(i, 0, n){
		cin >> c;
		if (c == 'c')cout << "No" << endl;
		if (c == 'a'){
			if (d < a + b){
				cout << "Yes" << endl;
				d++;
			}
			else cout << "No" << endl;
		}
		if (c == 'b'){
			if (d < a + b && e < b){
				cout << "Yes" << endl;
				d++;
				e++;
			}
			else cout << "No" << endl;
		}
	}


	return 0;
}


Measured memory_bytes: 640
from math import pi, atan2

def andrange(a, b):
    if a == (0, 0) or b == (0, 0): return (0, 0)
    if a == (0, 1): return b
    if b == (0, 1): return a
    if a[0] > b[0]: a, b = b, a
    if b[1] < a[1]: return b
    if b[0] < a[1]: return (b[0], a[1])
    if b[1] < a[0] + 1: return (0, 0)
    if b[1] < a[1] + 1: return (a[0], b[1] - 1)
    return a

def calcrange(P, Q):
    c = atan2(P[1]-Q[1], P[0]-Q[0]) / (2*pi)
    if c > 0: return (c, c+0.5)
    else: return (c+1, c+1.5)

N = int(input())
X = []
for _ in range(N):
    x, y = map(int, input().split())
    X.append((x, y))

A = [(0, 1) for _ in range(N)]

for i in range(N):
    for j in range(N):
        if i != j:
            A[i] = andrange(A[i], calcrange(X[i], X[j]))

for a in A:
    print("{:.15f}".format(a[1] - a[0]))

Measured memory_bytes: 3444
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;

#if 0
#define DEBUG(x) do{cerr << #x << "=" << x << endl;}while(0);
#else
#define DEBUG
#endif

int main(){
	int n;
	cin >> n;
	vector<int> a(n);

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

	long double p = 1.0;

	for(int i=0; i<n; ++i){
		p *= a[i];
	}

	long double x = 0;
	long double y = p;
	for(int i=0; i<n; ++i){
		x += p / a[i];
	}

	
	cout.precision(8);

	cout << y/x << endl;

	return 0;
}


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

class Main
{
    public static void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int H = sc.nextInt();
        int W = sc.nextInt();
        
        while (H != 0 || W != 0) {
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    System.out.printf("#");
                }
                System.out.printf("\n");
            }
            System.out.printf("\n");
            
            H = sc.nextInt();
            W = sc.nextInt();
        }
    }
}

Measured memory_bytes: 58792
#include <iostream>
#include<sstream>
#include<string>
#include<vector>
#include <cmath>
#include <limits>
#include <queue>
#include<algorithm>
#include<cstring>
#include <cstdlib>
#include <cstdio>
#include <set>
#include <iomanip>
#include <map>
#include <stack>
#include <memory>
#include <numeric>
#include <type_traits>
 
using namespace std;
 
#define rep(i,n) for (int (i)=0;(i)<(n);i++)
typedef long long ll;
const int maxV = 1e5;


bool is_prime(const unsigned n){
    switch(n){
        case 0: // fall-through
        case 1: return false;
        case 2: // fall-through
        case 3: return true;
    } // n > 3 が保証された

    if(n % 2 == 0 || n % 3 == 0) return false;
    // n は 2 と 3 のいずれの倍数でもないことが保証された
    // これより n は (6の倍数)-1 か (6の倍数)+1 である

    // 6の倍数前後の数を使って試し割りをする
    for(unsigned i = 5; i * i <= n; i += 6) {
        if(n % i     == 0) return false; // (6の倍数)-1
        if(n % (i+2) == 0) return false; // (6の倍数)+1
    }

    return true;
}

 
int main() {
    int q;
    cin >> q;
    int l[q], r[q];
    rep(i,q){
      cin >> l[i] >> r[i];
    }
    bool prime[maxV+1];
    for(int i = 1; i <= maxV; i++){
      if (is_prime(i)) prime[i] = true;
    }
    int dp[maxV+1]; dp[0] = 0;
    for(int i = 1; i <= maxV; i++){
      if (i%2 == 1){
        if (prime[i] && prime[((i+1)/2)]){
          dp[i] = dp[i-1]+1;
        }
        else dp[i] = dp[i-1];
      }
      else dp[i] = dp[i-1];
    }

    rep(i,q){
      cout << dp[r[i]]-dp[l[i]-1] << endl;
    }
    

    return 0;
}

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

double P,E,T;
int K,R,L;

double calc(int cnt, double l, double r) {
    //printf("cnt:%d, l:%f, r:%f\n", cnt, l, r);
    if (r < T - E) return 0.0;
    if (l > T + E) return 0.0;
    if (T - E <= l && r <= T + E) return 1.0;

    double m = (l + r) / 2.0;
    if (cnt == K) {
        //printf("cnt == K, m = %f\n", m);
        return T-E <= m && m <= T+E ? 1.0 : 0.0;
    }

    double res = 0.0;
    if (m <= T) {
        res += calc(cnt + 1, m, r) * (1.0 - P); // ?????????????????????
        res += calc(cnt + 1, l, m) * P;
    } else {
        res += calc(cnt + 1, m, r) * P;
        res += calc(cnt + 1, l, m) * (1.0 - P);
    }
    return res;
}

int main() {
    cin >> K >> R >> L;
    cin >> P >> E >> T;

    printf("%.6f\n",calc(0, R, L));

    return 0;
}

Measured memory_bytes: 3280
#include <iostream>
#include <algorithm>
using namespace std;
pair <int,int> v[200010];
int main()
{
    int n,h,i,cnt=0;
    cin>>n>>h;
    for(i=1; i<=2*n; i++)
    {
        cin>>v[i].first>>v[i+1].first;
        v[i+1].second=1;
        i++;
    }
    sort(v+1,v+2*n+1);
    n=2*n;
    for(i=n; i>=1; i--)
    {
        if(v[i].second==1)
        {
            h-=v[i].first;
            cnt++;
        }
        else
            while(h>0)
            {
                h-=v[i].first;
                cnt++;
            }
        if(h<=0)
        {
            cout<<cnt;
            return 0;
        }
    }
    return 0;
}


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

int main(){
  int a, b, k;
  cin >> a >> b >> k;
  vector<int> d;
  for(int i = a ; i > 0 ; --i){
    if(a % i == 0 && b % i == 0){
      d.emplace_back(i);
    }
  }
  cout << d[k - 1] << endl;
  return 0;
}

Measured memory_bytes: 256
def main():
    n = int(input())
    x = list(map(int,input().split()))
    s = sorted(x)
    m1 = s[n//2-1]
    m2 = s[n//2]
    for i in x:
        if i <= m1:
            print(m2)
        else:
            print(m1)

if __name__ == '__main__':
    main()


Measured memory_bytes: 93652
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var str = ReadLine();
        var dp = new long[str.Length+1, 2];
        dp[0, 1] = 1;
        for (var i = 1; i <= str.Length; i++)
        { if (str[i - 1] == '1')
                dp[i, 1] += 2 * dp[i - 1, 1] % Input.MOD;
            else dp[i, 1] += dp[i - 1, 1];
            if (str[i - 1] =='1')
            {
                dp[i, 0] += dp[i -1, 1];
                dp[i, 0] %= Input.MOD;
            }
            dp[i, 0] += dp[i - 1, 0] * 3;
            dp[i, 0] %= Input.MOD;
           
        }
        WriteLine((dp[str.Length, 0] + dp[str.Length, 1]) % Input.MOD);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[] ar1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => num).ToArray();
    public static long[] arL1D(int n)
        => Enumerable.Repeat(0, n).Select(_ => numL).ToArray();
    public static string[] strs(int n)
        => Enumerable.Repeat(0, n).Select(_ => read).ToArray();
    public static int[][] ar2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => ar).ToArray();
    public static long[][] arL2D(int n)
        => Enumerable.Repeat(0, n).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public static string[] Make<T1, T2>(out T1 v1, out T2 v2)
    {
        var r = read.Split(' ');
        v1 = getValue<T1>(r[0]);
        v2 = getValue<T2>(r[1]);
        return r;
    }
    public static string[] Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3)
    {
        var r = Make(out v1, out v2);
        v3 = getValue<T3>(r[2]);
        return r;
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public const int MOD = 1000000007;
}


Measured memory_bytes: 12896
def iroha_and_haiku(A: int, B: int, C: int) -> bool:
    return [5, 5, 7] == sorted([A, B, C])


if __name__ == "__main__":
    A, B, C = map(int, input().split())
    yes = iroha_and_haiku(A, B, C)
    print('YES' if yes else 'NO')


Measured memory_bytes: 2940
#include<bits/stdc++.h>
#include<map>
using namespace std;
typedef long long int lli;
typedef long long ll;
#define mod 10000000007
int main()
{
  ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   cout.tie(NULL);
   lli s,w;
   cin>>s>>w;
   if(w>=s)
   cout<<"unsafe"<<"\n";
   else
   cout<<"safe"<<"\n";
}

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

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(a) (a).begin(), (a).end()
#define SZ(x) ((int)(x).size())
#define IN(x, a, b) x >= a and x < b

using namespace std;
using ll = long long;

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;
}
template <typename T> constexpr T INF = numeric_limits<T>::max() / 2;
#pragma endregion

const int MAX = 5100000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

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

  int X, Y;
  cin >> X >> Y;
  if ((2 * Y - X) % 3 != 0) {
    cout << 0 << endl;
    return 0;
  }
  int x = (2 * Y - X) / 3;
  int y = Y - 2 * x;

  COMinit();
  cout << COM(x + y, y) << endl;

  return 0;
}

Measured memory_bytes: 119808
s = input()
li = [s[i] for i in range(len(s))]
li2 = [s[i] for i in range(len(s))]
count1 = 0
count2 = 0
l = len(s) - 1
if len(s) >= 2:
    for j in range(len(s) - 1):
        if li[j + 1] == "0" and li[j] == "0":
            li[j + 1] = "1"
            count1 += 1
        elif li[j + 1] == "1" and li[j] == "1":
            li[j + 1] = "0"
            count1 += 1
    while l >= 1:
        if li2[l - 1] == "0" and li2[l] == "0":
            li2[l - 1] = "1"
            count2 += 1
        elif li2[l - 1] == "1" and li2[l] == "1":
            li2[l - 1] = "0"
            count2 += 1
        l -= 1
print(min([count1, count2]))

Measured memory_bytes: 4860
N, M = gets.chop.split.map(&:to_i)
lines = []
while line = gets
  lines << line.chomp.split(' ')
end

hash = {}
#{1: [ture, 0]}

lines.each do |p|
  hash[p[0]] ||= [false, 0]

  if hash[p[0]][0]
    next
  else
    if p[1] == 'WA'
      hash[p[0]][1] += 1
    else
      hash[p[0]][0] = true
    end
  end
end

ac = 0
wa = 0

hash.each do |i|
  if i[1][0]
    ac += 1
    wa += i[1][1]
  end
end

print ac, ' ', wa


Measured memory_bytes: 35580
#include<stdio.h>
 int main(void)
 {
     int r,D,x[11],i;

     scanf("%d%d%d",&r,&D,&x[0]);

     for(i=1;i<=10;i++){
       x[i]=(r*x[i-1])-D;
         printf("%d\n",x[i]);
     }

     return 0;
 }


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

int main() {
  int N, L;
  cin >> N >> L;
  vector <string> S(N);

  for(int i = 0; i < N; i++) {
    cin >> S[i];
  }

  sort(S.begin(), S.end());

  for(int i = 0; i < N; i++) {
    cout << S[i];
  }

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<string>
using namespace std;
string s,s1;
int ln;
int main()
{
    cin>>s>>s1;
    ln=s.size()-1;
    for ( int i=0;i<=ln;i++){
        char ch;
        ch=s[ln];
        s.erase(s.begin()+ln);
        s.insert(s.begin(),ch);
        if (s.compare(s1)==0){
            cout<<"Yes"<<endl;
            return 0;
        }
    }
    cout<<"No"<<endl;
    return 0;
}


Measured memory_bytes: 256
from itertools import permutations

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    n=len(d[0])
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    return d

INF = float("inf")

N,M,R=[int(x) for x in input().split()]
r=[int(x)-1 for x in input().split()]

route_list=[[INF]*N for _ in range(N)]

for i in range(M):
    a,b,c=[int(x) for x in input().split()]
    route_list[a-1][b-1]=c
    route_list[b-1][a-1]=c

wa_list=warshall_floyd(route_list)
ans=30**9

for perm in permutations(r):
    #print(perm)
    cur = sum(wa_list[v][u] for v, u in zip(perm, perm[1:]))
    ans = min(ans, cur)

print(ans)

Measured memory_bytes: 4664
x = int(input())

from itertools import product
tot_comb = [el for el in product(list(range(-120, 121)), list(range(-120, 121))) if el[0]!=el[1]]
tot_comb += [(0,0)]
num_dict = {el[0]**5 - el[1]**5: el for el in tot_comb}
pair = num_dict[x]
print(pair[0], pair[1])

Measured memory_bytes: 15724
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii =  pair<int, int>;
using pll =  pair<long long, long long>;
constexpr char ln =  '\n';
constexpr long long MOD = 1000000007LL;
constexpr long long INF = 1000000009LL;
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define fo(i, j, n) for(int i=(j); i<(n); i++)
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }


int main() { 
   int n; ll a, b; cin >> n >> a >> b;
   vector<ll> x(n);
   rep(i, n) cin >> x[i];

   ll res = 0;
   rep(i, n-1){
       res += min((x[i+1]-x[i])*a, b);
   }
   cout << res << ln;
}

Measured memory_bytes: 1024
#include<iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int N,A=0,Z=0;
string str[10000],a[10000],z[10000],T;
int main(){
	cin>>N;
	for(int i=0;i<N;++i){
		cin>>str[i];
		a[i]=str[i];
		z[i]=str[i];
		for(int j=0;j<str[i].size();++j){
			if(str[i][j]=='?'){
				a[i][j]='a';
				z[i][j]='z';
			}
		}
	}
	cin>>T;
	for(int i=0;i<N;++i){
		if(T>a[i]&&T>z[i])++A;
		if(T<a[i]&&T<z[i])++Z;
	}
	for(int i=A+1;i<=N-Z;++i){
		cout<<i<<" ";
	}
	cout<<N-Z+1<<endl;
	return 0;
}


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

using i64 = long long int;

struct Edge{
    int from, to, dist, enemy;
};

struct Node{
    int num, money, cost;
    bool operator<(const Node& obj)const{
        return cost > obj.cost;
    };
};

int mini[102][102]; // mini[money][num]

int main(){
    int n, m, l;
    while(cin >> n >> m >> l, n != 0){
        vector<Edge> graph[103];
        for(int i=0;i<m;++i){
            int a, b, d, e;
            cin >> a >> b >> d >> e;
            graph[a].push_back((Edge){a, b, d, e});
            graph[b].push_back((Edge){b, a, d, e});
        }

        for(int i=0;i<=100;++i){
            for(int j=0;j<=100;++j){
                mini[i][j] = INT_MAX;
            }
        }

        mini[l][1] = 0;
        priority_queue<Node> que;
        que.push((Node){1, l, 0});

        while(!que.empty()){
            Node curr = que.top(); que.pop();
            if(curr.num == n){
                cout << curr.cost << endl;
                break;
            }

            for(auto e : graph[curr.num]){
                if(curr.money >= e.dist && mini[curr.money-e.dist][e.to] > curr.cost){
                    mini[curr.money-e.dist][e.to] = curr.cost;
                    que.push((Node){e.to, curr.money-e.dist, curr.cost});
                }
                if(mini[curr.money][e.to] > curr.cost + e.enemy){
                    mini[curr.money][e.to] = curr.cost + e.enemy;
                    que.push((Node){e.to, curr.money, curr.cost+e.enemy});
                }
            }
        }
    }

    return 0;
}



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

void main()
{
    auto ts = readln.split.to!(long[]);
    auto I = ts[0];
    auto O = ts[1];
    auto J = ts[3];
    auto L = ts[4];

    auto K = O + I/2*2 + J/2*2 + L/2*2;
    auto r = I%2 + J%2 + L%2;
    if (r == 3) {
        K += 3;
    } else if (r == 2 && I > 0 && J > 0 && L > 0) {
        K += 1;
    }

    writeln(K);
}

Measured memory_bytes: 2732
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <climits>

using namespace std;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)

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

#define MOD 1000000007

int tens_mod(int numdig) {
  switch (numdig % 6) {
  case 0:
    return 1;
  case 1:
    return 10;
  case 2:
    return 9;
  case 3:
    return 12;
  case 4:
    return 3;
  case 5:
    return 4;
  }
  return 0;
}

int main() {
  string s;
  cin >> s;
  reverse(s.begin(), s.end());

  vector<vector<int>> dp(s.length(), vector<int>(13, 0));

  if (s[0] == '?') {
    for (int i = 0; i < 10; i++) {
      dp[0][i] = 1;
    }
  } else {
    dp[0][s[0]-'0'] = 1;
  }

  for (int i = 1; i < s.length(); i++) {
    if (s[i] == '?') {
      for (int j = 0; j < 10; j++) {
        for (int k = 0; k < 13; k++) {
          int mod = ((tens_mod(i)*j) % 13 + k) % 13;
          dp[i][mod] = (dp[i][mod] % MOD) + (dp[i-1][k] % MOD);
        }
      }
    } else {
      for (int k = 0; k < 13; k++) {
        int mod = ((tens_mod(i)*(s[i]-'0')) % 13 + k) % 13;
        dp[i][mod] = (dp[i][mod] % MOD) + (dp[i-1][k] % MOD);
      }
    }
  }
  cout << dp[s.length()-1][5] % MOD << endl;
  return 0;
}


Measured memory_bytes: 8960
#include<bits/stdc++.h>
#define gc getchar
#define rint register int
#define rep(i,u,z) for(rint i=u;i<=z;++i)
#define reb(i,u,z) for(rint i=u;i>=z;--i)
#define inf 0x7fffffff

using namespace std;
typedef long long ll;

inline int readint(){
	int rt=0,sign=1;
	char ch=gc();
	while(ch<'0'||ch>'9'){
		if(ch=='-')sign=-1;
	    ch=gc();
	}
	while(ch>='0'&&ch<='9'){
		rt=(rt<<3)+(rt<<1)+(ch&15);
		ch=gc();
	}
	return rt*sign;
}
int main(){
	int n=readint();
	int maxn=0,tot=0,p;
	rep(i,1,n){
		p=readint();
		if(maxn<p)maxn=p;
		tot+=p;
	}
	printf("%d",tot-maxn/2);
	return 0;
}

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

int main() {
  char N[200010] = { '\0' };
  int i = 0,ans =0;

  scanf("%s",N);

  while(N[i] != '\0'){
      ans += (N[i]- '0') % 9;
      i++;
  }

  if(ans % 9 == 0){
    printf("Yes\n");
  }else{
    printf("No\n");
  }

  return 0;
}


Measured memory_bytes: 1768