akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define int long long


signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int n,k; cin >> n >> k;
    vector<int> x(n);
    for(int i = 0;i < n;i ++){
        cin >> x.at(i);
    }

    if(n == 1){
        cout << x.at(0) << endl;
        return 0;
    }

    for(int i = 0;i < n;i ++){
        if(x.at(i) == 0){
            n --;
            k --;
            x.erase(x.begin()+i);
        }
    }

    int r = 0,l = 0;

    for(int i = 0;i < n;i ++){
        if(x.at(i) < 0) l ++;
        if(x.at(i) >= 0) r ++;
    }

    int ans = 100000000000;

    for(int i = 0;i < k+1;i ++){
        if(l+i < n && l-k+i+1 >= 0 && x.at(l+i) >= 0 && x.at(l-k+i+1) < 0){
            int m = min(x.at(l+i)*2 + abs(x.at(l-k+i+1)), x.at(l+i) + abs(x.at(l-k+i+1)) * 2 );
            ans = min(ans,m);
        }
    }

    if(r >= k) ans = min(x.at(l+k-1),ans);
    if(l >= k) ans = min(abs(x.at(l-k)),ans);

    cout << ans << endl;



}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int M=1e3+5;
char mp[M][M];
bool vis[M][M];
struct node
{
    int x,y,w;
    bool operator <(const node &nd)const
    {
        return w>nd.w;
    }
};
int dir[4][2]= {1,0,0,1,-1,0,0,-1};
priority_queue<node>q;
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    node st;
    scanf("%d%d",&st.x,&st.y);
    st.w=0;
    q.push(st);
    node ed;
    scanf("%d%d",&ed.x,&ed.y);
    for(int i=1; i<=n; i++)
    {
        scanf("%s",&mp[i][1]);
    }
//    for(int i=1;i<=n;i++)
//    {
//        for(int j=1;j<=m;j++)
//        {
//            putchar(mp[i][j]);
//        }
//        puts("");
//    }

    while(!q.empty())
    {
        node a=q.top();
        q.pop();
        if(vis[a.x][a.y]) continue;
        vis[a.x][a.y]=1;
        if(a.x==ed.x&&a.y==ed.y)
        {
            printf("%d",a.w);
            return 0;
        }
        for(int i=0; i<4; i++)
        {

            node b;
            b.x=a.x+dir[i][0];
            b.y=a.y+dir[i][1];
            b.w=a.w;
            if(b.x<1||b.x>n||b.y<1||b.y>m||vis[b.x][b.y]||mp[b.x][b.y]=='#')
            {
                continue;
            }
            q.push(b);
        }
        for(int i=-2; i<=2; i++)
        {
            for(int j=-2; j<=2; j++)
            {
                node b;
                b.x=a.x+i;
                b.y=a.y+j;
                b.w=a.w+1;
                if(b.x<1||b.x>n||b.y<1||b.y>m||vis[b.x][b.y]||mp[b.x][b.y]=='#')
                {
                    continue;
                }
                q.push(b);
            }
        }
    }
    puts("-1");
    return 0;
}


Measured memory_bytes: 6692
#include <iostream>
#include <vector>
#define B 20
#define S 19

using namespace std;

int getmonthdays(int _year,int _month)
{
  if(_year%3 == 0 ||_month%2 != 0)
    return B;
  return S;
}

int getyeardays(int _year)
{
  if(_year % 3 == 0)
    return (20*10);
  else
    return (20*5+19*5);
}

int main(void)
{
  int monthdays;
  int y,m,d;
  int n;
  cin>>n;
  while(n--)
  {
    int daycount = 0;
    cin>>y>>m>>d;
    monthdays = getmonthdays(y,m);
    daycount += monthdays - d + 1;
    d = 1;m += 1;
    while(m<11)
    {
      monthdays = getmonthdays(y,m);
      daycount += monthdays;
      m+=1;
    }
    m = 1;y += 1;
    while(y != 1000)
      daycount += getyeardays(y++);
    cout<<daycount<<endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<vector>
#include<cstring>
#include<string>
#include<queue>
#include<cstdio>
#include<cstdlib>
#include<cmath>
using namespace std;

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

typedef long long ll;

#define MAX 100

int w, h;
int t[MAX][MAX];

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

bool destroy(int x, int y){
  if(t[y][x] == 0) return false;
  t[y][x] = 0;
  rep(i, 8){
    int nx = x + dx[i], ny = y + dy[i];
    if(nx < 0 || w <= nx || ny < 0 || h <= ny) continue;
    destroy(nx, ny);
  }
  return true;
}

void solve(){
  int res = 0;
  rep(i,h) rep(j,w) if(destroy(j,i)) res++;
  cout << res << endl;
}
int main(){
  while(cin >> w >> h){
    if( w==0 && h ==0) break;
    rep(i, h) rep(j, w) cin >> t[i][j];
    solve();
  }
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
const lli mod=1e9+7;
const lli pINF=LLONG_MAX;
const lli nINF=-LLONG_MAX;
void fast() {std::ios::sync_with_stdio(false);cin.tie(NULL);}
lli power(lli a,lli b){lli ans=1;while(b!=0){ if(b%2==1){ans*=a;}b/=2;a*=a;} return ans;}
lli invmod(lli a) {return pow(a,mod-2);}
#define vi vector<int>
#define vlli vector<lli>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define si(n) scanf("%d",&n)
#define sli(n) scanf("%lld",&n)
#define printi(n) printf("%d\n",n)
#define printli(n) printf("%lld\n",n)
#define all(vi) (vi.begin(),vi.end())
#define forn(i,n) for(int i=0;i<n;i++)
void print(int a[],int n){for(int i=0;i<n;i++) cout<<a[i]<<" ";}
int a[100005];

int main() 
{
    int n;
    si(n);
    
    for(int i=1;i<=n;i++) si(a[i]);
    
    int curr=1,x=0,steps=0;
    
    for(int i=1;i<=n;i++){
        curr=a[curr];
        if(curr==2) {x=1;break;}
        steps++;
    }
    
    if(x==1){
        cout<<steps+1<<endl;
    }
    else cout<<"-1"<<endl;
	return 0;
}

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

int main(){
	int x;
	cin>>x;
	if(x>1799){
		cout<<"1"<<endl;
	}
	else if(x>1599){
		cout<<"2"<<endl;
	}
	else if(x>1399){
		cout<<"3"<<endl;
	}
	else if(x>1199){
		cout<<"4"<<endl;
	}
	else if(x>999){
		cout<<"5"<<endl;
	}
	else if(x>799){
		cout<<"6"<<endl;
	}
	else if(x>599){
		cout<<"7"<<endl;
	}
	else {
	
		cout<<"8"<<endl;
	}
}

Measured memory_bytes: 3612
N = int(input())
A = {}
# 2, 5 , sum has to be >= 18 for both
for _ in range(N):
  a = round(float(input())*10**9)
  #print(a)
  pow2 = 0
  pow5 = 0
  while a % 2 == 0 and pow2 < 18:
    pow2 += 1
    a //= 2
  while a % 5 ==0 and pow5 < 18:
    pow5 += 1
    a //= 5
  if (pow2, pow5) not in A:
    A[(pow2, pow5)] = 0
  A[(pow2, pow5)] += 1
  #print(a, pow2, pow5)
#print(A)
ans = 0
for p1, c1 in A.items():
  for p2, c2 in A.items():
    if p1[0] + p2[0] < 18 or p1[1] + p2[1] < 18:
      continue
    if p1 == p2:
      ans += c1 * (c1 - 1)
    else:
      ans += c1 * c2
print(ans // 2)
    


Measured memory_bytes: 70764
N = int(input())
S = [int(input()) for _ in range(N)]

score = sum(S)

if score % 10 != 0:
  print(score)
  exit()

T = list(filter(lambda x: x % 10 != 0, S))
minus = min(T, default=-1)

if minus == -1:
  print(0)
  exit()

print(score - minus)

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

int main(){
	string o,e;
	cin>>o>>e;

	int mx = o.length()+e.length();
	int odd = 0;
	int even = 0;
	for(int i=0;i<mx;i++){
		if((i+1)%2) cout<<o[odd++];
		else cout<<e[even++];
	}
}

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

const int MAXN = 100010;
struct coin {
	long long a, b;
};
coin v[MAXN];

bool cmp(coin& c1, coin& c2) {
	return c1.a - c1.b < c2.a - c2.b;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int x,y,z;
	cin >> x >> y >> z;
	int n = x + y + z;
	long long ans = 0;
	for(int i = 0; i < n; ++i){
		int a, b, c;
		cin >> a >> b >> c;
		v[i] = {a-c, b-c};
		ans += c;
	}
	sort(v, v+n, cmp);
	priority_queue<long long> s1, s2;
	long long t = 0;
	long long t1[n], t2[n];
	for(int i = 0; i < n; ++i){
		s1.push(-v[i].b);
		t += v[i].b;
		if(s1.size() > y) {
			t += s1.top();
			s1.pop();
		}
		if(s1.size() == y) 	t1[i] = t;
		else t1[i] = -1e15;

	}
	t = 0;
	for(int i = n-1; i >= 0; --i){
		s2.push(-v[i].a);
		t += v[i].a;
		if(s2.size() > x) {
			t += s2.top();
			s2.pop();

		}
		if(s2.size() == x) t2[i] = t;
		else t2[i] = -1e15;

	}
	long long can = -1e16;

	for(int i = 0; i < n-1; ++i) can = max(can, t1[i] + t2[i+1]);
	if(x == 0) can = max(can, t1[n-1]);
	if(y == 0) can = max(can, t2[0]);

	cout << ans + can << endl;


}


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

int main(){
  string str,s;
  cin>>str;
  for(int i=0;i<str.length();i++){
    switch(str[i]){
    case 'B':s=s.substr(0,s.length()-1);break;
    default :s+=str[i];break;
    }
  }
  cout<<s<<endl;
}


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

typedef vector<long long int> vec;
typedef vector<vec> mat;

int main() {
    int N; cin >> N;
    mat v(N, vec(N));
    for (auto &i : v) for (auto &j : i) cin >> j;
    long long int ans = 0;
    for (int i = 0; i < N - 1; i++) for (int j = i + 1; j < N; j++) ans += min(v[i][j], v[j][i]);
    cout << ans << endl;
}

Measured memory_bytes: 3216
#include<stdio.h>

int big(int a, int b){
	if(a > b) return a;
	else return b;
}

int main(){
	int a, b, c;
	scanf("%d %d %d", &a, &b, &c);
	
/*
	if(a == b || b == c || c == a){
		printf("Yes\n");
		return 0;
	}
*/
	
	if(2 * big(a, big(b, c)) == a + b + c){
		printf("Yes\n");
		return 0;
	}
	else{
		printf("No\n");
		return 0;
	}
}

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

const int64_t MOD = 1e9+7;
void add(int64_t& a, int64_t b){
    a = (a+b) % MOD;
}
void mul(int64_t& a, int64_t b){
    a = a*b % MOD;
}

int main(){
    int N, K;
    cin >> N >> K;

    static int64_t dp[51][52][2600] = {0};
    dp[0][0][0] = 1;
    for(int i=0; i<N; i++){
        for(int a=0; a<=N; a++) for(int k=0; k<=K; k++){
            if(dp[i][a][k] == 0) continue;
            int k2 = k + 2*a;
            // そのまま
            add(dp[i+1][a][k2], dp[i][a][k]);
            // 数iを過去の場所に、場所iが空き
            add(dp[i+1][a][k2], dp[i][a][k] * a);
            // 数iを過去の場所に、場所iに過去の数を
            if(a > 0) add(dp[i+1][a-1][k2], dp[i][a][k] * a * a);
            // 数iを保留、過去の数を場所iに
            add(dp[i+1][a][k2], dp[i][a][k] * a);
            // 数iを保留、場所iが空き
            add(dp[i+1][a+1][k2], dp[i][a][k]);
        }
        // cerr << "\n" << i << "----\n";
        // for(int a=0; a<=N; a++) for(int k=0; k<=K; k++) if(dp[i+1][a][k]) cerr << a<<k << " " << dp[i+1][a][k] << endl;
    }

    cout << dp[N][0][K] << endl;
    return 0;
}


Measured memory_bytes: 51840
import java.util.Scanner;

public class Main {


	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		
		System.out.println(H*W-h*W-H*w+h*w);
	}
}

Measured memory_bytes: 22608
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define deb(x) cerr<<#x<<x<<"\n"
#define nax (int)(1e5+2)
using namespace std;
int main(){
   ll h,w;
   cin>>h>>w;
   ll a = h*w;
   a = (a+1);
   a = a/2;
   if(a > (ll)1e18){
		assert(false);
   }
   if(w != 1 && h !=1)
	cout<<a;
	else
		cout<<1;
   
    return 0;
}


Measured memory_bytes: 256
let exps_base_n_less_than x n =
  let rec aux acc =
    if acc <= x then acc :: (aux @@ ( * ) n acc)
    else [] in
  aux @@ ( * ) n n

let exp_less_than_dec x =
  let rec exps n =
    if n = 1 then [1]
    else exps_base_n_less_than x n @ exps @@ pred n
  in
  List.filter (fun n -> n <= x) @@ exps x
  |> List.sort compare
  |> List.rev

let main () =
  let x = Scanf.scanf "%d" (fun x -> x) in
  exp_less_than_dec x
  |> List.hd
  |> print_int

let () = main ()


Measured memory_bytes: 2432
def gcd(a,b):
    if b==0 or a == 0  : return a + b
    return gcd(b, a%b)
N = int(input())
d1 = {}
d2 = {}
zero = 0
for _ in range(N):
    A,B = map(int, input().split())
    if A == 0 and B == 0 :
        zero += 1
        continue
    d = gcd(abs(A), abs(B))
    A,B = A//d, B//d
    if B < 0 or (B==0 and A < 0):
        A,B = -A,-B
    if A > 0 :
        if (A,B) not in d1:d1[(A,B)]=0
        d1[(A,B)]+=1
    else :
        if (A,B) not in d2:d2[(A,B)] = 0
        d2[(A,B)] += 1
ret = []
for (x,y),count in d1.items():
    if (-y, x) in d2 :
        ret.append((count, d2[(-y,x)]))
    else :
        ret.append((count, 0))
for (x,y),count in d2.items():
    if (y,-x) not in d1:
        ret.append((count, 0))
mod = 10 ** 9 + 7
ans = 1
for p,q in ret:
    if q == 0 :
        ans *= 2**p
        ans %= mod
    else :
        ans *= (2**p + 2**q -1 )
        ans %= mod
print( (ans - 1 + zero + mod) % mod )

Measured memory_bytes: 59432
n=int(input())
a=list(map(int,input().split()))
w=0
for i in range(n-1):
    if i%2==0:
        w-=a[i]
    else:
        w+=a[i]
x=[a[-1]-w]
for i in range(n-1):
    x.append((a[i]-x[-1]//2)*2)
print(' '.join(map(str, x)))


Measured memory_bytes: 19088
#include<map>
#include<iostream>
#include<deque>
#include<algorithm>
#include<string>
#include<cctype>
#include<iomanip>
#include<vector>
#include<queue>
#include<math.h>
#include<bitset>
#include<random>
#include<cstdint>
 
using namespace std;
#define REP(i,b,e) for(ll i=(ll)b;i<(ll)e;i++)
#define rep0(i,n) REP(i,0ll,n)
#define rep1(i,n) REP(i,1ll,n+1)
 
#define shosu setprecision(17)
 
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<char,P> Q;
ll longinf=(1ll<<60);
int main(){
      ll N;
      cin>>N;
      ll x[N];
      ll A,B;
      cin>>A>>B;
      rep0(i,N) cin>>x[i];
      ll ans=0;
      rep0(i,N-1){
            ans+=min(B,A*(x[i+1]-x[i]));
      }
      cout<<ans<<endl;
      return 0;
}

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

int main() {
	ios::sync_with_stdio(0); cin.tie(0);
	char S[100];

	cin >> S;
	if(S[0] == 'S') cout << "Cloudy";
	else if(S[0] == 'C') cout << "Rainy";
	else cout << "Sunny";
	return 0;
}


Measured memory_bytes: 256
import java.text.DecimalFormat;
import java.util.stream.LongStream;
import java.util.stream.IntStream;
import java.io.*;
import java.util.*;

public class Main {
    
    public static void main(String[] args) {
        FastScanner sc = new FastScanner();
        PrintWriter out = new PrintWriter(System.out);
        
        AtCoder problem = new AtCoder(sc);
        problem.solve(out);
        
        out.flush();
    }
    
}

class AtCoder {
    final int A,B;
    AtCoder(FastScanner sc) {
        A = sc.nextInt();
        B = sc.nextInt();
    }

    void solve(PrintWriter out) {
        out.println(Math.max(A*B, Math.max(A+B, A-B)));
    }
    
}

// https://qiita.com/p_shiki37/items/a0f6aac33bf60f5f65e4
class FastScanner {
    
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;
    
    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        } else {
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }
    
    private int readByte() {
        if (hasNextByte()) {
            return buffer[ptr++];
        } else {
            return -1;
        }
    }
    
    private static boolean isPrintableChar(int c) {
        return 33 <= c && c <= 126;
    }
    
    public boolean hasNext() {
        while (hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++;
        }
        return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while (isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }
    
    public long nextLong() {
        if (!hasNext()) {
            throw new NoSuchElementException();
        }
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while (true) {
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            } else if (b == -1 || !isPrintableChar(b)) {
                return minus ? -n : n;
            } else {
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }
    
    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) {
            throw new NumberFormatException();
        }
        return (int) nl;
    }
    
    public double nextDouble() {
        return Double.parseDouble(next());
    }
}


Measured memory_bytes: 23252
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;

public class Main {
	static List<Integer> path;

	public static void main(String[] args) throws Exception {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] sa = br.readLine().split(" ");
		int n = Integer.parseInt(sa[0]);
		int m = Integer.parseInt(sa[1]);
		int[] a = new int[m];
		int[] b = new int[m];
		int[] c = new int[m];
		int[][] ab = new int[n][n];
		for (int i = 0; i < n; i++) {
			Arrays.fill(ab[i], 100000000);
		}
		for (int i = 0; i < m; i++) {
			sa = br.readLine().split(" ");
			a[i] = Integer.parseInt(sa[0]) - 1;
			b[i] = Integer.parseInt(sa[1]) - 1;
			c[i] = Integer.parseInt(sa[2]);
			ab[a[i]][b[i]] = c[i];
			ab[b[i]][a[i]] = c[i];
		}
		br.close();

		for (int k = 0; k < n; k++) {
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (i == j) {
						ab[i][j] = 0;
						ab[j][i] = 0;
					} else {
						ab[i][j] = Math.min(ab[i][j], ab[i][k] + ab[k][j]);
						ab[j][i] = ab[i][j];
					}
				}
			}
		}

		int ans = 0;
		for (int k = 0; k < m; k++) {
			boolean flg = false;
			hen:
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					int ak = a[k];
					int bk = b[k];
					if (ab[i][j] == ab[i][ak] + c[k] + ab[bk][j]) {
						flg = true;
						break hen;
					}
				}
			}
			if (!flg) {
				ans++;
			}
		}
		System.out.println(ans);
	}
}


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

vector<int> vector_plus(vector<int> &arr1,vector<int> &arr2,int &m){
    vector<int> result(m+1);
    for(int i=0;i<m+1;i++){
        result.at(i) = arr1.at(i) + arr2.at(i);
    }
    return result;
}

bool x_check(vector<int> arr,int x,int m){
    bool flag = true;
    for(int i=1;i<m+1;i++){
        if(arr.at(i) < x){
            flag = false;
            break;
        }
    }
    return flag;
}

int main(){
    int n,m,x;
    cin >> n >> m >> x;
    vector<vector<int>> array(n,vector<int>(m+1));
    for(int i=0;i<n;i++){
        for(int j=0;j<m+1;j++){
            cin >> array.at(i).at(j);
        }
    }
    vector<int> money(0);
    for(int tmp = 0; tmp < ( 1 << 12); tmp++){
        bitset<12> s(tmp);
        vector<int> arr(m+1);
        for(int i=0;i<n;i++){
            if(s.test(i)){
                arr = vector_plus(arr,array.at(i),m);
            }
        }
        //for(int j=0;j<arr.size();j++) cout << arr.at(j) << " ";
        //cout << endl;
    if(x_check(arr,x,m)){
        money.push_back(arr.at(0));
    }
    }
    //for(int i=0;i<money.size();i++) cout << money.at(i) << endl;
    if(money.size() < 1){
        cout << -1 << endl;
    }else{
        int min = 2147483647 ;
        for(int i=0;i<money.size();i++){
            if(min > money.at(i)){
                min = money.at(i);
            }
        }
        cout << min << endl;
    }

}



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

int main() {
	while (1) {
		int n; cin >> n;
		if (n == 0) return 0;
		vector<vector<int> > sche(30);
		for (int i = 0; i < n; ++i) {
			int t; cin >> t;
			for (int j = 0; j < t; ++j) {
				int d; cin >> d;
				sche[d-1].push_back(i);
			}
		}
		vector<vector<int> > maps(n);
		for (int i = 0; i < n; ++i) {
			maps[i].push_back(i);
		}
		int ans = -1;
		for (int i = 0; i < 30; ++i) {
			vector<int> tmp1, tmp2;
			for (int j : sche[i]) {
				tmp2.clear();
				set_union(tmp1.begin(), tmp1.end(), maps[j].begin(), maps[j].end(), inserter(tmp2, end(tmp2)));
				swap(tmp1, tmp2);
			}
			if (tmp1.size() == n) {
				ans = i+1;
				break;
			}
			for (int j : sche[i]) {
				maps[j] = tmp1;
			}
		}
		cout << ans << endl;
	}
}


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


bool check_consistece(int row, int col, const std::vector<std::pair<int, int>> &pos) {
    for (auto && pair : pos) {
        if (pair.second == col || std::abs(pair.first - row) == std::abs(pair.second - col)) {
            return false;
        }
    }
    return true;
}


bool queen_pos(int row, int col, std::vector<std::pair<int, int>>& pos) {
    if (row == 8) {
        return true;
    }

    bool exists = false;
    for (auto p : pos) {
        exists |= p.first == row;
    }
    if (!exists) {
        if (!check_consistece(row, col, pos)) {
            return false;
        }
        pos.emplace_back(row, col);
    }
    for (int i = 0; i < 8; i++) {
        if (queen_pos(row + 1, i, pos)) {
            return true;
        }
    }
    if (!exists) {
        pos.erase(pos.end() - 1);
    }
    return false;
}


int main() {
    int k;
    std::cin >> k;
    std::vector<std::pair<int, int>> pos;
    for (int i = 0; i < k; i++) {
        int r, c;
        std::cin >> r >> c;
        pos.emplace_back(std::make_pair(r, c));
    }

    for (int i = 0; i < 8; i++) {
        if (queen_pos(0, i, pos)) {
            break;
        }
    }

    std::vector<std::vector<char>> res(8, std::vector<char>(8, '.'));
    for (auto&& p : pos) {
        res[p.first][p.second] = 'Q';
    }

    for (int r = 0; r < 8; r++) {
        for (int c = 0; c < 8; c++) {
            std::cout << res[r][c];
        }
        std::cout << std::endl;
    }
}



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

#define MAX_INT 0x3f3f3f3f 
#define precision(x) setprecision(x)
#define boost ios_base::sync_with_stdio(false);         cin.tie(NULL);

int main()
{
    boost;
    int n,k;
    cin >> n >>  k;
   	vector<int> v;
   	for(int i=0;i<n;i++)
   	{
   		int p;
   		cin >> p;
   		v.push_back(p);
   	}
   	vector<int> dp(n);
   	dp[0]=0;
   	for(int i=1;i<n;i++)
   	{
   		dp[i]=MAX_INT;
   		for(int j=max(0,i-k);j<i;j++)
   		{
   			dp[i]=min(dp[i],dp[j] + abs(v[i]-v[j]));
   		}
   	}
   	cout << dp[n-1] << "\n";
}

Measured memory_bytes: 1144
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>

int main(void){

    int N, K;

    scanf("%d%d", &N, &K);

    int D[K];

    for(int i = 0; i < K; i++){
        scanf("%d", &D[i]);
    }

    while(true){
        int t = N;
        int f = 0;
        while(t > 0){
            int k = t % 10;
            for(int j = 0; j < K; j++){
                if(k == D[j]){
                    f = 1;
                    break;
                }
            }
            if(f == 1){
                break;
            }else{
                t /= 10;
            }
        }
        if(f == 1){
            N++;
        }else{
            break;
        }
    }

    printf("%d\n", N);

    return 0;
}

Measured memory_bytes: 1696
#include <iostream>
using namespace std;
#include <iomanip>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
typedef long long ll;
typedef long double ld;

int main()
{
    long x;
    cin>>x;
    
    long coin500=(x-(x%500))/500;
    x-=coin500*500;

    long coin5=(x-(x%5))/5;
    
    cout<<coin500*1000+coin5*5<<endl;

    return 0;
}

Measured memory_bytes: 256
import itertools
n,m = map(int,input().split())
k = []
s = []
for i in range(m):
    temp = list(map(int,input().split()))
    k.append(temp[0])
    s.append(temp[1:])
p = list(map(int,input().split()))

oz = [[1,0]]*n
z = list(itertools.product(*oz))
ans = 0
for i in z:
    ad = True
    for j in range(m):
        cnt = 0
        for l in s[j]:
            if i[l-1] == 1:
                cnt += 1
        if not cnt%2 == p[j]:
            ad = False
            break
    if ad:
        ans += 1
print(ans)

Measured memory_bytes: 3188
def make_divisors(n):
    div=[]
    for i in range(1,-int(-n**0.5//1)):
        if n%i==0:
            div.append(i)
            div.append(n//i)
    if n%(n**0.5)==0:
        div.append(int(n**0.5))
    return div

n=int(input())
ans=[]
for i in range(1,n+1,2):
    if len(make_divisors(i))==8:
        ans.append(i)
print(len(ans))

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=m-1; i>=n; i--)
#define SORT(v,n) do{sort(v,v+n);reverse(v,v+n);}while(0)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x,n/2)%MOD;
  return x%MOD*POW(x,n-1)%MOD;
}

ll POW2(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW2(x*x,n/2);
  return x*POW2(x,n-1);
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll KAI2(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI2(m-1);
}

ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll COM2(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI2(m)/KAI2(n)/KAI2(m-n);
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}

ll ORD(ll x,ll n)
{
  if(x==0)return INF;
  if(x%n!=0)return 0;
  return 1+ORD(x/n,n);
}

int main()
{
  string s;
  ll c=0,d;
  cin >> s;
  rep(i,s.length()){
    if((s[i]=='0'&&i%2==0)||(s[i]=='1'&&i%2==1))c++;
  }
  d=s.length()-c;
  printf("%lld",min(c,d));
}

Measured memory_bytes: 512
// 4
#include <cstdio>
#include <iostream>
#include <string>
#include <vector>

class ModSum {
 private:
  long N;
  long answer;

 public:
  ModSum() {
    std::scanf("%ld", &N);
    answer = (N * (N - 1)) / 2;
    std::printf("%ld\n", answer);
  }
};

int main() {
  ModSum ms;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f;
const ll mod = 998244353LL;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
int red, green, blue, k;

void solve()
{
    scanf("%d%d%d%d", &red, &green, &blue, &k);
    int cnt = 0;
    while (green <= red)
        green <<= 1, cnt++;
    while (blue <= green)
        blue <<= 1, cnt++;
    if (cnt > k)
        puts("No");
    else
        puts("Yes");
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

Measured memory_bytes: 3764
//

fun main() {
    abc170b()
}

fun abc170b() {
    val (x, y) = readLine()!!.split(" ").map { it.toInt() }
    for (i in 0..x) {
        val z = x - i
        if (i * 2 + z * 4 == y) {
            println("Yes")
            return
        }
    }
    println("No")
}


Measured memory_bytes: 36404
#define _USE_MATH_DEFINES
  
#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>
#include <queue>
  
using namespace std;

void solution() {
    string s;
    long long x;
    cin >> x;
    x--;

    while (x > 0) {
        s.push_back(x % 26 + 'a');
        x /= 26;
        x--;
    }
    if (x == 0) {
        s.push_back('a');
    }
    reverse(s.begin(), s.end());
    cout << s << endl;
}
  
/*-------------------*/
      
int main()
{
#ifdef Files
    freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    /*Test*/
    //freopen("input.txt", "w", stdout);
      
    double OcZ2X = clock();
#else
    //freopen("joke.in", "r", stdin);
    //freopen("joke.out", "w", stdout);
#endif
      
/*
　　     　 　          ∧_,,∧　　　
    　            ♪　  (・ω・)　♪
               ＿＿＿＿○＿＿つヾ＿＿＿＿＿
             /δ⊆・⊇ 。/†: :† /δ ⊆・⊇｡ /|
            |￣￣￣￣￣￣￣￣￣￣￣￣￣ | |
            |　　　*/solution();/* 　　| |
            |　　　　　　　　　　　　　 |
*/
       
#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}

Measured memory_bytes: 3640
local n,k=io.read("n","n")
local v={}
for i=1,n do
    v[i]=io.read("n")
end

local m=math.min(n,k)
local answer=0
for i=0,m do
    for j=0,m-i do
        local t={}
        local sum=0
        for l=1,i do
            table.insert(t,v[l])
            sum=sum+v[l]
        end
        for l=n-j+1,n do
            table.insert(t,v[l])
            sum=sum+v[l]
        end
        table.sort(t)
        for l=1,math.min(k-i-j,#t) do
            if t[l]<0 then
                sum=sum-t[l]
            end
        end
        answer=math.max(answer,sum)
    end
end
print(answer)

Measured memory_bytes: 2776
import java.util.Scanner;


public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		int input[] = new int[3];
		
		Scanner sc = new Scanner(System.in);
		
		for(int i = 0; i < 3; i++){
			input[i] = sc.nextInt();
		}
		
		int order[][] = {{0,1,2},{0,2,1},{1,0,2},{1,2,0},{2,1,0},{2,0,1}};
		
		int result = Integer.MAX_VALUE;
		for(int i = 0; i < order.length; i++){
			int tmpTotal = 0;
			int prev = input[order[i][0]];
			
			for(int j = 1; j < 3; j++){
				tmpTotal += Math.abs(prev - input[order[i][j]]);
			}
			
			result = Math.min(result, tmpTotal);
		}
		
		System.out.println(result);
	}

}


Measured memory_bytes: 21716
#include <stdio.h>
#define _USE_MATH_DEFINES
#include <math.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
    int n;
    scanf("%d", &n);
    vector<bool> vbDivide(1000001,false);
    vector<int> viNum(n);
    for(int i = 0; i < n; i++){
        scanf("%d", &viNum[i]);
    }
    sort(viNum.begin(), viNum.end());
  
    for(int i = 0; i < n - 1; i++){
        if(viNum[i+1] == viNum[i] && !vbDivide[viNum[i]]){
            for(int j = 1; j * viNum[i] <= 1000000; j++){
                vbDivide[j * viNum[i]] = true;
            }
        }
    }
  
    for(int i = 0; i < n; i++){
        if(!vbDivide[viNum[i]]){
            for(int j = 2; j * viNum[i] <= 1000000; j++){
                vbDivide[j * viNum[i]] = true;
            }
        }
    }
    int nCount = 0;
    for(int i = 0; i < n ; i++){
        if(!vbDivide[viNum[i]]){
            nCount++;
        }
    }
    printf("%d", nCount);
    
    return 0;
}


Measured memory_bytes: 3664
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int N = 302;

ll n;
ld dp[N][N][N];

ld daj(ll i,ll j,ll k){
  if(i<0||j<0||k<0) return 0;
  if(dp[i][j][k]!=-1) return dp[i][j][k];
  return dp[i][j][k] = ld(ld(n)/ld(i+j+k))+daj(i-1,j,k)*ld(ld(i)/ld(i+j+k))+daj(i+1,j-1,k)*ld(ld(j)/ld(i+j+k))+daj(i,j+1,k-1)*ld(ld(k)/ld(i+j+k));
}

int main(){
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(15);
  cout << fixed;
  cin >> n;
  ll a=0,b=0,c=0;
  for(int i=1; i<=n; i++){
    ll x;
    cin >> x;
    a+=(x==1);
    b+=(x==2);
    c+=(x==3);
  }
  for(int i=0; i<=n; i++){
    for(int j=0; j<=n; j++){
      for(int k=0; k<=n; k++){
        dp[i][j][k]=-1;
      }
    }
  }
  dp[0][0][0]=0;
  cout << daj(a,b,c) << endl;
}


Measured memory_bytes: 430464
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long l, r;
    cin >> l >> r;
    
    r = min(r, l+4038);
    int ans = 2018;
    for(long long i=l; i<=r; i++){
        for(long long j= i+1; j<=r; j++){
          int x = i * j % 2019;
          ans = min(ans, x);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2 //1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) max(x,y)-min(x,y)
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int, int>;
typedef vector<int> vit;

//最大公約数
lol gcd(lol x, lol y){
  if(x < y) swap(x, y);
  lol r = x % y;
  while(r != 0){
    x = y;
    y = r;
    r = x % y;
  }
  return y;
}

//最小公倍数
lol lcm(lol x, lol y){
  lol a = x * y;
  return (a / gcd(x, y));
}

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  int n, m, x;
  cin >> n >> m >> x;
  lol c[n + 5], a[n + 5][m + 5];
  rep(i, n){
    cin >> c[i];
    rep(j, m){
      cin >> a[i][j];
    }
  }

  lol ans = INF, nasu[m + 5];
  rep(bit, (1 << n)){
    lol sum = 0;
    rep(i, m){
      nasu[i] = 0;
    }
    
    rep(i, n){
      if(bit & (1 << i)){
	sum += c[i];
	rep(j, m){
	  nasu[j] += a[i][j];
	}
      }
    }
    bool out = false;
    rep(i, m){
      if(nasu[i] < x){
	out = true;
      }
    }
    if(!out){
      ans = min(ans, sum);
    }
  }
  cout << (ans == INF ? -1 : ans) << '\n';
  return 0;
}


Measured memory_bytes: 3652
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
typedef long long ll;
typedef pair<int,int> pint;

typedef pair<double,int> pdl;
double x[1005],y[1005],r[1005];
vector<pdl> vp[1005];
double d[1005];
double INF=1000100010001000;
int n;
int dijkstra(int st){
    priority_queue<pdl,vector<pdl>,greater<pdl> > pq;
    rep(i,n+3) d[i]=INF;
    d[st]=0;
    pq.push(make_pair(0,st));
    while(!pq.empty()){
        pdl pi=pq.top();pq.pop();
        int t=pi.second;
        if(d[t]<pi.first) continue;
        for(vector<pdl>::iterator it=vp[t].begin();it!=vp[t].end();++it){
            if(d[it->second]>d[t]+it->first){
                d[it->second]=d[t]+it->first;
                pq.push(make_pair(d[it->second],it->second));
            }
        }
    }
}
int main(){
    double xs,ys,xt,yt;
    cin>>xs>>ys>>xt>>yt;
    cin>>n;
    rep(i,n) cin>>x[i]>>y[i]>>r[i];
    rep(i,n){
        double ds0=(x[i]-xs)*(x[i]-xs)+(y[i]-ys)*(y[i]-ys);
        double ds1=(x[i]-xt)*(x[i]-xt)+(y[i]-yt)*(y[i]-yt);
        vp[0].pb(max(0.0,sqrt(ds0)-r[i]),i+1);
        vp[i+1].pb(max(0.0,sqrt(ds0)-r[i]),0);
        vp[n+1].pb(max(0.0,sqrt(ds1)-r[i]),i+1);
        vp[i+1].pb(max(0.0,sqrt(ds1)-r[i]),n+1);
    }
    rep(i,n)FOR(j,i+1,n){
        if(i==j) continue;
        double ds0=(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]);
        vp[i+1].pb(max(0.0,sqrt(ds0)-(r[i]+r[j])),j+1);
        vp[j+1].pb(max(0.0,sqrt(ds0)-(r[i]+r[j])),i+1);
    }
    dijkstra(0);
    double st=(xt-xs)*(xt-xs)+(yt-ys)*(yt-ys);
    cout<<fixed<<setprecision(12)<<min(sqrt(st),d[n+1])<<endl;
    return 0;
}

Measured memory_bytes: 22548
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000+5;
const int mod = 1000000007;
char maze[maxn][maxn];
long long dp[maxn][maxn];
int main(int argc, char const *argv[])
{
	int n, m; scanf("%d %d\n", &n, &m);
	memset(dp, 0, sizeof dp);
	for(int i = 0; i < n; i++){
		for(int j = 0; j < m; j++){
			scanf("%c", &maze[i][j]);
		}	
		scanf("\n");
	}
	bool set = true;
	for(int i = 0; i < n; i++){
		if(maze[i][0] == '#') set = false;
		if(set) dp[i][0] = 1;
		else dp[i][0] = 0;
	}
	set = true;
	for(int i = 0; i < m; i++){
		if(maze[0][i] == '#') set = false;
		if(set) dp[0][i] = 1;
		else dp[0][i] = 0;
	}
	for(int i = 1; i < n; i++){
		for(int j = 1; j < m; j++){
			if(maze[i][j] == '#') continue;
			dp[i][j] += dp[i][j-1] + dp[i-1][j];
			if(dp[i][j] > mod) dp[i][j] -= mod;
		}	
	}


	
	printf("%lld\n", dp[n-1][m-1] % mod);

	return 0;
}

Measured memory_bytes: 12556
"""
N = int(input())
A, B = map(int,input().split())
A = list(map(int,input().split())) ## 横一列
A = [int(input()) for _ in range(N)] ## 縦一列
lst = [list(map(int,input().split())) for i in range(M)] ## 二次元
"""

S = input()

if S == 'Sunny':
  ans = 'Cloudy'
elif S == 'Cloudy':
  ans = 'Rainy'
else:
  ans ='Sunny'
  
print(ans)

Measured memory_bytes: 2940
import java.util.Scanner;
 
public class Main {
 
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int X = sc.nextInt();
    int Y = sc.nextInt();
    int Z = sc.nextInt();
    System.out.println(Z + " " + X + " " + Y);
  }
}

Measured memory_bytes: 21460
import java.util.Scanner;

class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);

        int n = scan.nextInt();
        
        int a[] = new int[n];
        

        for (int i =0; i<n; i++) {
            a[i] = scan.nextInt();
           

            
        }

        for(int i = n-1 ; i>=0 ; i--){
            if(i<n-1){
                System.out.print(" ");
            }
            System.out.print(a[i]);
        }
        System.out.println("");
    }

}


Measured memory_bytes: 26356
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int dua[35];

int main() {
 int n, k;
 dua[0] = 1;
 double ans = 0;
 for (int i = 1; i <= 31; i++) dua[i] = dua[i - 1] * 2;
 cin >> n >> k;
 for (int i = 1; i <= n; i++) {
  int x = 0, bil = 1;
  while (bil < (double) k / i) bil *= 2, x++;
  //cout << x << endl;
  ans += (1.0 / dua[x]);
 }
 ans /= n;
 printf("%.9f\n", ans);
}

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

int main() {
  int r, d,x; cin >> r >> d >> x;
  ll ans = x;
  rep(i,10){
    ans = r*ans - d;
    cout << ans << endl;
  }
}


Measured memory_bytes: 256
fn main() {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  let mut s: Vec<&str> = buf.split_whitespace().collect();

  if s[0] > s[1] {
    println!(">");
  }else if s[0] == s[1]{
    println!("=");
  }else{
    println!("<");
  }
}


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

int main(void) {
    double a1, b1, r, ans;
    int a, b, h, m;
    cin >> a >> b >> h >> m;
    a1 = (((double)h+(double)m/60.0) / 12.0) * 2.0 * 3.14159265358979;
    b1 = ((double)m / 60.0) * 2.0 * 3.14159265358979;
    //cout << a1 << " " << b1 << endl;
    if (a1 != 0.0 && b1 != 0.0)r = max(a1,b1) - min(a1, b1);
    else r = max(a1,b1);

    ans = (double)a * (double)a + (double)b * (double)b - 2.0 * (double)a * (double)b * cos(r);
    cout << fixed << setprecision(15) << sqrt(ans) << endl;
    return 0;
}

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

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();
            int[] Nninn = new int[input[0]];
            int Kpoint = input[1];
            int Mondaisuu = input[2];
           
            for (int i = 0; i < Mondaisuu; i++)
            {
                int Z = int.Parse(Console.ReadLine());
                Nninn[Z - 1] += 1;
            }
            for(int j = 0; j < Nninn.Length ; j++)
            {
                if (Nninn[j] > Mondaisuu - Kpoint)
                {
                    Console.WriteLine("Yes");
                }
                else
                {
                    Console.WriteLine("No");
                }
            }
        }
    }
}

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

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//typedef pair<ll, ll> P;
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
const int mod = 1000000007;


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

    rep(i, n - 1) {
        int a;
        cin >> a;
        a--;
        count[a]++;
    }

    for (int c : count) cout << c << ' ';
}



Measured memory_bytes: 4048
#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<tuple>
#include<string.h>
#include <numeric> 
#include<unordered_map>
using namespace std; 
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define pp(...) "\033[94m [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define pp1(...) "\033[1;47;35m" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "]\033[0m"
#define dg(x) debug() << pp1(x)
#define dg1(x) debug() << "[line : " << __LINE__ <<"]"<< pp(x)
#define dg2(x,y) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y)
#define dg3(x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(x) pp(y) pp(z)
#define dg4(w,x,y,z) debug() << "[line : " << __LINE__ <<"]"<< pp(w) pp(x) pp(y) pp(z)
template<typename T> void db(T x ){ debug() <<">>> " <<  x; }
template<typename T> void db(T x , T y){ debug() <<">>> " <<  x <<" , "<< y; }
template<typename T> void db(T x , T y , T z){ debug() <<">>> "<< x <<" , "<< y <<" , "<< z; }
template<typename T> void db(T x , T y , T z , T a){ debug() <<">>> "<< x <<" , " << y <<" , "<< z <<" , "<< a; }
#define int long long
#define all(x) x.begin() , x.end()
#define clr(x , y) memset(x , y , sizeof x);
#define sz(x) (int)x.size()

const int Mod = 1e9 + 7;
const int inf = 1e18;

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(3*n);
  for(int i = 0; i < 3*n; i++) {
    cin >> a[i];
  }
  vector<int>Maxx(3*n,0);
  vector<int>Minn(3*n,inf);
  multiset<int> mst;
  int maxSum = 0;
  for(int i = 0;i < n; i++) {
    mst.insert(a[i]);
    maxSum += a[i];
  }
  Maxx[n - 1] = maxSum;
  for(int i = n; i < 2*n; i++) {
    int M = *mst.begin();
    if(a[i] > M) {
      maxSum -= M;
      maxSum += a[i];
      mst.erase(mst.find(M));
      mst.insert(a[i]);
    }
    Maxx[i] = maxSum;
  }
  mst.clear();
  int minSum = 0;
  for(int i = 3*n - 1; i >= 2*n; i--) {
    mst.insert(a[i]);
    minSum += a[i];
  } 
  Minn[2*n] = minSum;
  for(int i = 2*n - 1; i >= n; i--) {
    int M = *mst.rbegin();
    if(a[i] < M) {
      minSum -= M;
      minSum += a[i];
      mst.erase(mst.find(M));
      mst.insert(a[i]);
    }
    Minn[i] = minSum;
  }
  dg1(Maxx);dg1(Minn);
  int ans = -inf;
  for(int i = n - 1; i <= 2*n - 1; i++) {
    ans = max(ans , Maxx[i] - Minn[i + 1]);
  }
  cout << ans << '\n';
}

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

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

  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }

  int max1 = 0, max2 = 0, m;

  for (int i = 0; i < n; i++) {
    max1 = max(max1, a.at(i));
    if (max1 == a.at(i)) {
      m = i;
    }
  }

  for (int i = 0; i < n; i++) {
    if (i == m){
      continue;
    }
    max2 = max(max2, a.at(i));
  }

  for (int i = 0; i < n; i++) {
    if (i == m){
      cout << max2 << endl;
    }
    else {
      cout << max1 << endl;
    }
  }
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int a,b,c,k,x{0};
    cin>>a>>b>>c>>k;
    if(k<a)
    {
        x=k;
    }
    else
    {
        x=a;
    }

    if(k-a-b>0)
    {
        x+=(k-a-b)*(-1);
    }
    cout<<x<<endl;
}


Measured memory_bytes: 3628