akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
ll fast_expo(ll x,ll p)
{if(p==0) return 1;
else if(p%2==0){ ll t=fast_expo(x,p/2)%MOD;return (t*t)%MOD;} else return (x*(fast_expo(x,p-1))%MOD)%MOD;}
char a[1005][1005];
ll dp[1005][1005];
int main()
{
     int h,w;
     cin>>h>>w;
     dp[0][0]=1;
     for(int i=0;i<h;i++)
     {
          for(int j=0;j<w;j++)
          {
               cin>>a[i][j];
          }
     }
     for(int j=1;j<w;j++)
     {
          if(a[0][j]=='.')
               dp[0][j]=dp[0][j-1];
     }
     for(int i=1;i<h;i++)
     {
          if(a[i][0]=='.')
               dp[i][0]=dp[i-1][0];
     }
     for(int i=1;i<h;i++)
     {
          for(int j=1;j<w;j++)
          {
               if(a[i][j]=='#')
               dp[i][j]=0;
               else
               {
                    dp[i][j]=(dp[i][j]+dp[i-1][j]+dp[i][j-1])%MOD;
               }
          }
     }
     cout<<dp[h-1][w-1];
}


Measured memory_bytes: 9088
//#include <tourist>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <iomanip>
#include <limits>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
//setprecision(15)有効数字15桁
//-std=c++14
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b)
{
    return a * b / gcd(a, b);
}
struct edge {
    int to, cost;
};
ll n, k;
vector<ll> a;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>k;
    ll dp[n+1][k+1];//i番目の子供までにjこ配る場合の数
    for(int i=0;i<n;i++){
        ll temp;
        cin>>temp;
        a.push_back(temp);
    }
    for(int i=0;i<=k;i++){
        dp[0][i]=0;
    }
    dp[0][0]=1;
    ll sum[k+2];
    for(int i=1;i<=n;i++){
        sum[0]=dp[i-1][0];
        for(int j=0;j<=k;j++){
            if(j>0){
                sum[j]=sum[j-1]+dp[i-1][j];
                sum[j]%=MOD;
            }
            if(a[i-1]>=j)
            dp[i][j]=sum[j];
            else{
                dp[i][j]=sum[j]-sum[j-a[i-1]-1];
                if(dp[i][j]<0){
                    dp[i][j]+=MOD;
    }
            }
        }
    }
    if(dp[n][k]<0){
        dp[n][k]+=MOD;
    }
    cout << dp[n][k]<< "\n";
    /*
    for(int i=0;i<=n;i++){
        for(int j=0;j<=k;j++){
            cout<<dp[i][j]<<" ";
        }
        cout<<"\n";
    }
    */
}



Measured memory_bytes: 80000
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .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 ; $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, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

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

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

const M: usize = 1_000_000_007;

fn main() {
    input! {
        s: chars,
    }

    let mut dp = vec![vec![0; 4]; s.len() + 1];
    dp[0][0] = 1_usize;

    for i in 1..s.len() + 1 {
        for j in 0..4 {
            let c = s[i - 1];
            if c == '?' {
                dp[i][j] += 3 * dp[i - 1][j];
                if j > 0 {
                    dp[i][j] += dp[i - 1][j - 1];
                }
            } else {
                dp[i][j] += dp[i - 1][j];
                if j > 0 && c == "ABC".chars().nth(j - 1).unwrap() {
                    dp[i][j] += dp[i - 1][j - 1];
                }
            }
            dp[i][j] %= M;
        }
    }
    println!("{}", dp[s.len()][3]);
}


Measured memory_bytes: 10492
#include <bits/stdc++.h>
using namespace std;
int N, M; 
int a[50], b[50];
bool graph[50][50]; // 連結であるかどうか
bool vis[50]; // 訪れたかどうか

void dfs(int x) {
  if(vis[x]) return; // 無限ループを抜け出すため
  
  vis[x] = true;
  for (int i=0;i<N;i++) {
    if (graph[x][i] == false) continue;
    if (vis[i] == true) continue;
    dfs(i);
  }
}
  

int main() {
  cin >> N >> M;
  int ans = 0;
  for (int i=0;i<M;i++) {
    cin >> a[i] >> b[i];
    a[i]--, b[i]--;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true; // 指定された部分がつながる
  }
  
  for (int i=0;i<N;i++) vis[i] = false;
  for (int i=0;i<M;i++) {
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = false;
    for (int i=0;i<N;i++) vis[i] = false;
    dfs(0);
    bool connected = false;
    for (int j=0;j<N;j++) if (vis[j]==false) connected = true;
    if (connected) ans++;
    graph[a[i]][b[i]] = graph[b[i]][a[i]] = true;
  }
  cout << ans << endl; 
}
  
  

Measured memory_bytes: 256
#include <iostream>
#include <vector>

using namespace std;

int main() {
  int n, m; cin >> n >> m;
  vector<int> sum(n+1, 0);
  for (int i = 0; i < m; i++) {
    int l, r; cin >> l >> r;
    l--; r--;
    sum[l]++; sum[r+1]--;
  }
  for (int i = 0; i < n; i++) {
    sum[i+1] += sum[i];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sum[i] == m) { ans++; }
  }
  cout << ans << endl;

  return 0;
}

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

int main(){
    string S;
    long long K;
    cin>>S>>K;
    char ans='1';
    for(int i=0;i<min((long long)S.size(),K);i++){
        if (S.at(i)!='1'){
            ans=S.at(i);
            break;
        }
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<string.h>
using namespace std;
int main()
{
    /*
    string s,t,u;
    int a,b;
    scanf("%s%s",&s,&t);
    scanf("%d%d",&a,&b);
    getchar();
    scanf("%s",&u);
    if(u==s){a--;}
    else if(u==t){b--;}
    printf("%d %d\n",a,b);
    */
    char s[105];
    scanf("%s",s);
    int l=strlen(s);
    for(int i=0;i<l;i++)
    printf("x");
    printf("\n");

}

Measured memory_bytes: 256
#if !defined(__clang__) && defined(__GNUC__)
#include <bits/stdc++.h>
#else
#include <cstdlib>
#include <climits>
#include <iostream>
#include <cstdint>
#include <vector>
#include <string>
#include <complex>
#include <bitset>
#include <queue>
#include <deque>
#include <stack>
#include <utility>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <regex>
#endif //  !defined(__clang__) && defined(__GNUG__)
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/multi_array.hpp>
#include <boost/optional.hpp>
#include <boost/math/common_factor_rt.hpp>

using namespace std;

int main()
{
    int64_t N, C;
    std::cin >> N >> C;

    boost::multi_array<int64_t, 2> D(boost::extents[C][C]);

    for (auto p = D.data(); p < (D.origin() + D.num_elements()); ++p) {
        std::cin >> *p;
    }

    boost::multi_array<int64_t, 2> c(boost::extents[N][N]);
    for (auto p = c.data(); p < (c.origin() + c.num_elements()); ++p) {
        std::cin >> *p;
    }

    // iva[grp:0-2][col0:29]

    boost::multi_array<int64_t, 2> iwa(boost::extents[3][C]);

    for (int64_t g = 0; g < 3; ++g) {                  //3
        for (int64_t col = 0; col < C; ++col) {        // 30
            for (int64_t x = 0; x < N; ++x) {          // 500
                for (int64_t y = 0; y < N; ++y) {      // 500
                    if ((x+1 + y+1) % 3 == g) {
                        iwa[g][col] += D[c[y][x]-1][col];
                    }
                }
            }
        }
    }

    int64_t min_iwa = INT64_MAX;

    for (int64_t p = 0; p < C; ++p) {
        for (int64_t q = 0; q < C; ++q) {
            for (int64_t r = 0; r < C; ++r) {
                if (p == q || q == r || r == p) {
                    continue;
                }
                min_iwa = std::min(min_iwa, iwa[0][p] + iwa[1][q] + iwa[2][r]);
            }
        }
    }

    std::cout << min_iwa << std::endl;

    return 0;
}


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

int main()
{
  int n;
  cin >> n;
  int i;
  vector<int> a(n);
  for(i = 0; i < n; i++)
  {
    cin >> a.at(i);
  }
  int s = 0;
  for(i = 0; i < n; i++)
  {
    if(a.at(i) % 2 == 1)
    {
      s = 1;
      break;
    }
  }
  if(s == 1)
  {
    cout << "first" << endl;
  }
  else
  {
    cout << "second" << endl;
  }
}

Measured memory_bytes: 640
using System;
class Program
{
	static void Main(string[] args)
	{
		string[] input = Console.ReadLine().Split(' ');
      	int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		int c = int.Parse(input[2]);
      	if(a * b <= c){
          Console.WriteLine(a*b);
        }else{
          Console.WriteLine(c);
        }
	}
}

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

int main(){
    int a, b, c, d;

    cin >> a >> b >> c >> d;
    if(abs(a - c) <= d)
        cout << "Yes" << endl;
    else if (abs(a - b) <= d && abs(b - c) <= d)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
#define int long long
typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000000000000;

int A[200010],B[200010],num[200010];
int N,M,W,C,D,E,G,K;
int ans,ans2,sum,sum2,cnt,cnt2,Max=0,Min=INF;
string S,T;
vector<int> V;
set<int> U;
map<int,int> H;
bool F,Q[200010];

signed main(){
	cin>>N;
	int f=1;
	int n=0;
	for(int i=1;i<=9;i++){
		int g=(int)pow(3,i);
		REP(j,g){
			string s;
			int b=1;
			int r[5]={};
			REP(k,i){
				if((j/b)%3==0){
					s+="3";
				}
				else if((j/b)%3==1){
					s+="5";
				}
				else{
					s+="7";
				}
				b*=3;
			}
			REP(k,s.size()){
				if(s[k]=='3'){
					r[0]=1;
				}
				else if(s[k]=='5'){
					r[1]=1;
				}
				else{
					r[2]=1;
				}
			}
			if(r[0]==1&&r[1]==1&&r[2]==1){
				if(stoll(s)<=N){
					ans++;
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}


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

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(;;){
			int n=sc.nextInt();
			if(n==0)
				break;
			int d2=0;
			for(int d=2; n/d>0; d*=2)
				d2+=n/d;
			int d5=0;
			for(int d=5; n/d>0; d*=5)
				d5+=n/d;
			println(min(d2, d5)+"");
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

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

int main() {
	char s[1000001];
	int len;
	int loop;
	int k;

	scanf("%s", s);
	scanf("%d", &k);
	len = strlen(s);

	for (loop = 0; loop < len; loop++) {
		if (loop == len - 1) {
			int slen = s[loop];
			slen += k;
			while (slen > 'z') slen -= 26;
			s[loop] = slen;
		}
		else if ('z' - s[loop] < k&&s[loop]!='a') {
			k -= 'z' - s[loop] + 1;
			s[loop] = 'a';
		}
	}

	printf("%s\n", s);

	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); i++)
#define REP2(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
const long long INF = numeric_limits<long long>::max();
int main()
{
    vector<int> v( 3 );
    for( auto &x : v )
    {
        cin >> x;
    }
    int K;
    cin >> K;
    sort( begin( v ), end( v ) );
    int res{};
    REP( i, K )
    {
        res = v[ 2 ] * 2;
        v[ 2 ] = res;
    }
    cout << v[ 0 ] + v[ 1 ] + res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <deque>
#include <numeric>
#include <algorithm>
using namespace std;

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

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

	sort(V.begin(), V.end(), greater<int>());

	double ans = (double)(V.at(N-1)+V.at(N-2))/2.0;
	for(int i=N-3; i>=0; i--) {
		ans = (double)(ans + V.at(i)) /2.0;
	}
	printf("%.20f\n",ans);
	
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <array>
#include <vector>
#include <functional>
#include <unordered_map>
#include <map>
#include <numeric>
#include <limits>
#include <utility>
#include <queue>
#include <random>
using namespace std;

int main(){
	char s[19];

	cin >> s;

	s[5] = ' ';
	s[13] = ' ';

	cout << s;

	return 0;
}

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

using namespace std;

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

	int m = s.size(), n = t.size();
	int dp[m+1][n+1];
	memset(dp, 0, sizeof(dp));

	for(int i=1;i<=m;i++){
		for(int j=1;j<=n;j++){
			if(s[i-1] == t[j-1]){
				dp[i][j] = dp[i-1][j-1] + 1;
			}
			else{
				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
			}
		}
	}

	string res(dp[m][n], ' ');
	int i=m, j=n, k=dp[m][n]-1;

	while(i>0 && j>0){
		if(s[i-1] == t[j-1]){
			res[k] = s[i-1];
			i--;
			j--;
			k--;
		}
		else{
			if(dp[i-1][j] > dp[i][j-1]){
				i--;
			}
			else{
				j--;
			}
		}
	}
	cout << res;
	return 0;
}

Measured memory_bytes: 38756
/*input
39
RBRBGRBGGBBRRGBBRRRBGGBRBGBRBGBRBBBGBBB
*/
#include "bits/stdc++.h"
#define ll long long
using namespace std;
map<char,int> mp[5000];
int main()
{
	ll ans=0;
	int n;
	string s;
	cin>>n>>s;
	for(int i=n-1;i>=0;i--)
	{
		mp[i]['R']=mp[i+1]['R'];
		mp[i]['G']=mp[i+1]['G'];
		mp[i]['B']=mp[i+1]['B'];
		mp[i][s[i]]++;
	}
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			if(s[i]!=s[j])
			{
				int k=2*j-i;
				if(k<n&&(s[k]!=s[i]&&s[k]!=s[j]))
				{
					ans--;
				}
				if((s[i]=='R'||s[j]=='R')&&(s[i]=='B'||s[j]=='B'))
				{
					ans+=mp[j+1]['G'];
				}
				else if((s[i]=='R'||s[j]=='R')&&(s[i]=='G'||s[j]=='G'))
				{
					ans+=mp[j+1]['B'];
				}
				else if((s[i]=='G'||s[j]=='G')&&(s[i]=='B'||s[j]=='B'))
				{
					ans+=mp[j+1]['R'];
				}
			}
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4400
from collections import defaultdict
from math import gcd
import time
import sys
from collections import Counter
import itertools
import math
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
start = time.time()
N, M = map(int, input().split(' '))
H = list(map(int, input().split(' ')))

Hdata = [1]*N

for i in range(M):
    A, B = map(int, input().split(' '))
    if H[A-1] != H[B-1]:
        ind = A if H[A-1] < H[B-1] else B
        Hdata[ind-1] = 0
    else:
        Hdata[A-1] = Hdata[B-1] = 0


print(sum(Hdata))


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

int main(){
    int n=0;
    vector<int> var;
    cin >> n;
    if(n==1){
        cout << 1<<endl;
        return 0;
    }
    for(int i=1;i<=n;i++){
        var.push_back(i);
        //cout << i;
    }
    int flag=0;
    int max=n*100+n*10+n;
    int min=111;
    for(int i=min;i<=max;i++){
        int num100 = i/100;
        int num10 = (i-(num100*100))/10;
        int num = i-(num100*100+num10*10);
          // cout << num100 <<num10<<num<<endl;
        if(find(var.begin(),var.end(),num100) != var.end()){
            if(find(var.begin(),var.end(),num10) != var.end()){
                if(find(var.begin(),var.end(),num) != var.end()){
                    flag++;
                }
            }
        }
    }
    cout << flag<<endl;
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(){
  string s,t;
  int a,b;
  cin>>s>>t;
  a=t.size();
  for(int i=0;i<s.size();i++){
    b=t.size();
    for(int j=0;j<t.size()&&i+t.size()<=s.size();j++){
      if(s[i+j]==t[j]) b--;
    }
    a=min(a,b);
  }
  cout<<a<<"\n";
  return 0;
}

Measured memory_bytes: 3584
#include <bits/stdc++.h>
//For ordered_set
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define MOD 1000000007
#define test int t; cin>>t; while(t--)
#define init(arr,val) memset(arr,val,sizeof(arr))
#define loop(i,a,b) for(int i=a;i<b;i++)
#define loopr(i,a,b) for(int i=a;i>=b;i--)
#define loops(i,a,b,step) for(int i=a;i<b;i+=step)
#define looprs(i,a,b,step) for(int i=a;i>=b;i-=step)
#define ull unsigned long long int
#define ll long long int
#define P pair
#define PLL pair<long long, long long>
#define PII pair<int, int>
#define PUU pair<unsigned long long int, unsigned long long int>
#define L list
#define V vector
#define D deque
#define ST set
#define MS multiset
#define M map
#define UM unordered_map
#define mp make_pair
#define pb push_back
#define pf push_front
#define MM multimap
#define F first
#define S second
#define IT iterator
#define RIT reverse_iterator
#define FAST ios_base::sync_with_stdio(false);cin.tie();cout.tie();
#define FILE_READ_IN freopen("input.txt","r",stdin);
#define FILE_READ_OUT freopen("output.txt","w",stdout);
#define all(a) a.begin(),a.end()
using namespace std;
// For ordered_set
using namespace __gnu_pbds;
template <typename T>
using ord_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
const ll maxn = 1e5;
const ll inf = 1e9;
const double pi = acos(-1);

void solve()
{
    int n; cin >> n;
    set<string> name;
    loop(i,0,n)
    {
        string s; cin >> s;
        name.insert(s);
    }

    cout << name.size() << "\n";

}

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

Measured memory_bytes: 19216
A=[]
Y=[]
for i in range(5):
    x = int(input())
    y = x % 10
    if y != 0:
        x = x + (10-y)
    A.append((y,x))

B = sorted(A)
sum = 0
flag = 0
#print(B)
for i in range(len(B)):
    y,x = B[i]
    sum += x
    if flag == 0:
        if y != 0:
            sum -= 10-y
            flag = 1

print(sum)


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

int main() {
    int A, B, T;
    cin >> A >> B >> T;

    int cnt = T / A;
    cout << cnt * B << endl;


  return 0;
}


Measured memory_bytes: 256
//#pragma GCC optimize("Ofast")
//#pragma GCC optimize ("unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define fi first
#define se second
#define pii pair<int,int>
#define int long long
#define endl '\n'
#define pll pair<long long,long long>
//#define LONGLONG_MAX 10000000000000000
using namespace std;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n,k;
    cin>>n>>k;
    double a[n];
    for(int i=0;i<n;i++){
        double x;
        cin>>x;
        a[i]=(x+1)/2;
    }
    queue<double>q;
    double ans=0,x=0;

    for(int i=0;i<n;i++){
        q.push(a[i]);
        x+=a[i];
        if(q.size()>k){
            x-=q.front();
            q.pop();
        }
        if(q.size()==k)ans=max(ans,x);
    }
    cout<<fixed<<setprecision(10)<<ans;
    return 0;
}

Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    long long x,y;
    long long z;
    cin >> x >> y;
    long long A = x * y;
    if (A < 0){
        if (x < 0){
            if (abs(x) <= abs(y)){
                z = x + y + 1;
            }
            else {
                z = - x - y + 1;
            }
        }
        else {
            if (abs(x) >= abs(y)){
                z = x + y + 1;
            }
            else {
                z = - x - y + 1;
            }
        }
    }
    else {
        if (y > x){
            z = y - x;
        }
        else {
            if (x == 0){
                z = abs(y) + 1;
            }
            else if (y == 0){
                z = abs(x) + 1;
            }
            else {
                z = x - y + 2;
            }
        }
    }
    cout << z << endl;
}

Measured memory_bytes: 3672
#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 k, x;
  cin >> k >> x;

  vector<int> ans;
  for (int i = x - k + 1; i <= x + k - 1; i++) {
    ans.push_back(i);
  }

  rep(i, 2 * k - 1) printf("%d%c", ans[i], i == 2 * k - 2 ? '\n' : ' ');
  return 0;
}

Measured memory_bytes: 256
N = int(input())
pin = [[0, 0] for i in range(N)]
front = [0 for i in range(N)]
for i in range(N):
    X, L = map(int, input().split())
    pin[i][1] = X - L
    pin[i][0] = X + L
    front[i] = X - L
pin.sort()
ans = 1
i = 1
tmp = pin[0][0]
while i < N:
    if pin[i][1] < tmp:
        i += 1
    else:
        ans += 1
        tmp = pin[i][0]
        i += 1
print(ans)

Measured memory_bytes: 24068
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int h = sc.nextInt();
    int a = sc.nextInt();
    int ans = 0;
    while(h>0){
      h -= a;
      ans++;
    }
    System.out.println(ans);
  }
}


Measured memory_bytes: 21844
var GET=(function(){function f(s){return new g(s);}function g(s){this._s=s.trim().split("\n");this._y=0;}g.prototype.a=function(f){var s=this._s, y=this._y, r;if(typeof s[y]==="string")s[y]=s[y].split(" ").reverse();r=s[y].pop();if(!s[y].length)this._y++;return f?r:+r;};g.prototype.l=function(f){var s=this._s[this._y++].split(" ");return f?s:s.map(a=>+a);};g.prototype.m=function(n,f){var r=this._s.slice(this._y,this._y+=n).map(a=>a.split(" "));return f?r:r.map(a=>a.map(a=>+a));};g.prototype.r=function(n,f){var r=this._s.slice(this._y,this._y+=n);return f?r:r.map(a=>+a);};return f;})();
var o=GET(require("fs").readFileSync("/dev/stdin","utf8"));
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill(0).map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill(0).map(x=>"+r+")";return eval(r);}

console.log(main());
function main(){
  var n = o.a();
  var k = o.a();
  var q = o.a();
  var a = o.r(q);
  var b = xArray(0,n);
  for(var i = 0; i < q; i++){
    b[a[i]-1]++;
  }
  var ans = [];
  for(var i = 0; i < n; i++){
    var s = "No";
    if(k+b[i]>q)s = "Yes";
    ans.push(s);
  }
  return ans.join("\n");
}

Measured memory_bytes: 27816
#include<functional>
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<string>
#include<cstdio>
#include<vector>
#include<bitset>
#include<cmath>
#include<ctime>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
using namespace std;
const int inf=2147483647,dx[]={-1,0,1,0},dy[]={0,-1,0,1};// 上 左 下 右
const int N=100005,M=1000005,K=200005,mod=1000000007;
const long long llinf=9223372036854775807ll;
//int & long long
int h,n,a,s;
int main(){
	cin>>h>>n;
	for(int i=1;i<=n;i++)
		cin>>a,s+=a;
	if(s>=h)
		cout<<"Yes";
	else cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int a,b,c,s;
  scanf("%d %d %d",&a,&b,&c);
  s=a-b;
  
  if (s<c){
    printf("%d\n",c-s);
  }else{
    printf("0\n");
  }
  
  return 0;
}

Measured memory_bytes: 128
# -*- coding: utf-8 -*-
"""
C - Next Prime
https://atcoder.jp/contests/abc149/tasks/abc149_c

"""
import sys

import numpy as np
from bisect import bisect_left

limit = 10**5 + 10

sieve = np.ones(limit, dtype=bool)
sieve[0] = sieve[1] = 0
sieve[2*2::2] = 0
for i in range(3, int(len(sieve)**0.5)+1, 2):
    if sieve[i]:
        sieve[i*i::i] = 0
primes = [i for i, x in enumerate(sieve) if x]


def main(args):
    X = int(input())
    print(primes[bisect_left(primes, X)])


if __name__ == '__main__':
    main(sys.argv[1:])


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

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

void solver() {
  long long a, b;
  cin >> a >> b;

  long long gcdab = gcd(a, b);
  long long ans = (a * b) / gcdab;

  cout << ans << "\n";
}

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


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
#define M 1000100
#define INF 0x3f3f3f3f
typedef long long ll;
ll a, b;
char op;
int main() {
    scanf("%lld %c%lld", &a, &op, &b);
    if (op == '+')
    	printf("%lld\n", a + b);
    else
    	printf("%lld\n", a - b);
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	string s;
	cin >> n >> s;
	
	int p = 0, q = n - 1;
	int ans = 0;
	while (p < q) {
		while (s[p] == 'R') p++;
		while (s[q] == 'W') q--;
		if (!(p < q)) break;
		else ans++;
		p++;
		q--;
	}
	cout << ans << endl;

    return 0;
}

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

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = mod * mod;
const int INF_N = 1e+9;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define all(v) (v).begin(),(v).end()
typedef pair<ll, ll> LP;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-12;
const ld pi = acos(-1.0);
//typedef vector<vector<ll>> mat;
typedef vector<int> vec;

//繰り返し二乗法
ll mod_pow(ll a, ll n, ll m) {
	ll res = 1;
	while (n) {
		if (n & 1)res = res * a%m;
		a = a * a%m; n >>= 1;
	}
	return res;
}

struct modint {
	ll n;
	modint() :n(0) { ; }
	modint(ll m) :n(m) {
		if (n >= mod)n %= mod;
		else if (n < 0)n = (n%mod + mod) % mod;
	}
	operator int() { return n; }
};
bool operator==(modint a, modint b) { return a.n == b.n; }
modint operator+=(modint &a, modint b) { a.n += b.n; if (a.n >= mod)a.n -= mod; return a; }
modint operator-=(modint &a, modint b) { a.n -= b.n; if (a.n < 0)a.n += mod; return a; }
modint operator*=(modint &a, modint b) { a.n = ((ll)a.n*b.n) % mod; return a; }
modint operator+(modint a, modint b) { return a += b; }
modint operator-(modint a, modint b) { return a -= b; }
modint operator*(modint a, modint b) { return a *= b; }
modint operator^(modint a, int n) {
	if (n == 0)return modint(1);
	modint res = (a*a) ^ (n / 2);
	if (n % 2)res = res * a;
	return res;
}

//逆元(Eucledean algorithm)
ll inv(ll a, ll p) {
	return (a == 1 ? 1 : (1 - p * inv(p%a, a)) / a + p);
}
modint operator/(modint a, modint b) { return a * modint(inv(b, mod)); }

const int max_n = 1 << 18;
modint fact[max_n], factinv[max_n];
void init_f() {
	fact[0] = modint(1);
	for (int i = 0; i < max_n - 1; i++) {
		fact[i + 1] = fact[i] * modint(i + 1);
	}
	factinv[max_n - 1] = modint(1) / fact[max_n - 1];
	for (int i = max_n - 2; i >= 0; i--) {
		factinv[i] = factinv[i + 1] * modint(i + 1);
	}
}
modint comb(int a, int b) {
	if (a < 0 || b < 0 || a < b)return 0;
	return fact[a] * factinv[b] * factinv[a - b];
}
using mP = pair<modint, modint>;

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




void solve() {
    int N; cin >> N;
    ll sum = 0;
    vector<ll> a(N);
    rep(i, N){
        cin >> a[i];
        sum ^= a[i];
    }
    rep(i, N){
        ll res = sum ^ a[i];
        cout << res;
        if(i != N-1) cout << " ";
        else cout << endl;
    }
}

signed main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  //cout << fixed << setprecision(10);
  //init_f();
  //init();
  //int t; cin >> t; rep(i, t)solve();
  solve();
//   stop
    return 0;
}


Measured memory_bytes: 8984
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[] c = new int[m];
        int[] t = new int[n + 1];
        for(int i = 0; i < m; i++) c[i] = sc.nextInt();
        Arrays.fill(t, 1000000);
        t[0] = 0;
        for(int i = 0; i < m; i++){
            for(int j = c[i]; j <= n; j++){
                t[j] = Math.min(t[j], t[j - c[i]] + 1);
            }
        }
        System.out.println(t[n]);
    }
}


Measured memory_bytes: 26924
#include <bits/stdc++.h>
 
//LIFE IS NOT A PROBLEM TO BE SOLVED
 
#define rep(i,a,b) for( int i = (int) a; i < (int) b; i++ )
#define F first
#define S second
#define pb push_back
#define debug(a) cout << #a << " = " << a << endl;
#define debug2(a,b) cout << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debugP(a) cout << a.F << " " << a.S << endl;
#define debugV(v, n) { rep( i, 0, n ) { if(i) printf(" "); printf("%d", v[i]); } printf("\n"); }
#define debugM(mat,n,m) rep( i, 0, n ){ rep( j, 0, m ) { if(j) printf(" "); printf("%d", mat[i][j]); } printf("\n"); }
 
using namespace std;
 
typedef long long int ll;
typedef pair<int,int> ii;
 
 
int main(){
	
	int a, b;
	cin >> a >> b;
	if(max(a, b)>=10){
		puts("-1");
	}else{
		cout << a*b << '\n';
	}
	
	
	
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <functional>
using namespace std;
int a, b, c, d;
int main() {
	cin >> a >> b >> c >> d;
	int x = a + b, y = c + d;
	cout << (x < y ? "Right" : (x == y ? "Balanced" : "Left")) << endl;
	return 0;
}

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

int main() {
  int A, B, C, D;
  cin >> A >> B >> C >> D;

  if ((A + B) == (C + D)) {
    cout << "Balanced" << endl;
  } else if ((A + B) < (C + D)) {
    cout << "Right" << endl;
  } else if ((A + B) > (C + D)) {
    cout << "Left" << endl;
  }
}

Measured memory_bytes: 256
// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define stoi stoll
using pii = pair<int,int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define all(c) begin(c), end(c)
#define rall(c) rbegin(c), rend(c)
#define fore(x, c) for(auto &&x : c)
#define rep(i, a, n) for(int i = a, i##len = (int)(n); i < i##len; ++i)
#define rrep(i, a, n) for(int i = (int)(n - 1); i >= a; --i)
#define sz(c) ((int)c.size())
#define contains(c, x) (c.find(x) != end(c))
#define inseg(l, x, r) ((l) <= (x) && (x) < (r))
#define dump(...)
#define pb push_back
#define eb emplace_back
#define _ 0
const signed INF_ = 1001001001; const long long INF = 1001001001001001001LL;
const int DX[9] = {0,1,0,-1,1,1,-1,-1,0}, DY[9] = {-1,0,1,0,-1,1,1,-1,0};
template<class T> ostream& operator<<(ostream &os, const vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) os<<*i<<(i==end(v)-1?"":" ");return os;}
template<class T> istream& operator>>(istream &is, vector<T> &v) {
  for (auto i = begin(v); i != end(v); i++) is>>*i;return is;}
template<class T,class U> istream& operator>>(istream &is, pair<T,U> &p) {
  is>>p.first>>p.second;return is;}
template<class T, class U> bool chmax(T &a, const U &b){return a<b?a=b,1:0;}
template<class T, class U> bool chmin(T &a, const U &b){return a>b?a=b,1:0;}
template <class T> void psum(T& c) {partial_sum(begin(c), end(c), begin(c));}
template<class T> using heap = priority_queue<T, vector<T>, greater<T>>;
struct before_main_function {
  before_main_function() {
      cin.tie(nullptr); ios::sync_with_stdio(0);
      cout << setprecision(15) << fixed;
  }
} before_main_function;
// clang-format on
//------------------8<------------------------------------8<--------------------

signed main() {
  int H, W, K;
  cin >> H >> W >> K;
  vvi A(H, vi(W));
  rep(i, 0, H) rep(j, 0, W) {
    char x;
    cin >> x;
    if (x == '#') {
      A[i][j] = 1;
    }
  }
  vector<vector<int>> ans;
  int pre = 0;
  rep(i, 0, H) {
    int cnt = accumulate(all(A[i]), 0LL);
    if (cnt == 0) {
      if (sz(ans))
        ans.push_back(ans.back());
      else
        pre++;
    } else {
      vi tmp;
      int t = 0;
      rep(j, 0, W) {
        static int idx = 1;
        if (A[i][j] == 0) {
          if (sz(tmp))
            tmp.push_back(tmp.back());
          else
            t++;
        } else {
          rep(k, 0, t + 1) tmp.push_back(idx);
          t = 0;
          idx++;
        }
      }
      rep(k, 0, pre + 1) ans.push_back(tmp);
      pre = 0;
    }
  }
  assert(sz(ans) == H);
  for (auto &v : ans) cout << v << endl;
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 2176
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <cmath>
#include <queue>
#include <map>
#define ll long long
#define out(a) printf("%d",a)
#define ln printf("\n")
const int N=1e5+50;
const int MOD=1e9+7;
const int inf=0x7f7f7f7f;
using namespace std;
int n,x;
char s[N];
int a[N];
double num=0;
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
	  scanf("%d",&a[i]);
    }
    sort(a+1,a+n+1);
    num=a[1];
    for (int i=2;i<=n;i++)
      num=(double)(num+a[i])/2;
    printf("%.6lf",num);
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
bool dislike[10];
bool ok(int x)
{
	while(x)
	{
		int d = x%10;
		if(dislike[d])
			return false;
		x/=10;
	}
	return true;
}
int main()
{
	int n,k;
	cin>>n>>k;
	for (int i = 0; i < k; ++i)
	{
		int x;
		cin>>x;
		dislike[x] = true;
	}
	for (int i = n; ; ++i)
	{
		if(ok(i))
		{
			cout<<i<<"\n";
			break;
		}
	}
	return 0;
}

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

using namespace std;

int main(){

    int N;
    string S;
    char *c_ptr;
    int flg=1;

    cin >> N;
    cin >> S;
    c_ptr = (char *)malloc(sizeof(char) * (N));
    c_ptr = (char *)S.c_str();


    for(int i=0; i<N/2; i++){
        if(c_ptr[i]!=c_ptr[i+N/2]){
            flg=0;
        }
    }

    if(N%2==1){
        flg=0;
    }

    if(flg==1){
        cout << "Yes" <<endl;
    } else {
        cout << "No" <<endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

ll mod_pow(ll x, ll n, const ll &p) {
  ll ret = 1;
  while(n > 0) {
    if(n & 1) (ret *= x) %= p;
    (x *= x) %= p;
    n >>= 1;
  }
  return ret;
}

int main(){
  ll n;
  cin >> n;
  vector<int> a(n);
  rep(i,n){cin>>a[i];}
  vector<int> b(n);
  b=a;
  sort(b.begin(),b.end());
  
  if(n%2==1){
    int cnt=2;
    if(b[0]!=0){ cout << 0 << endl; return 0; }
    for(int i=1; i<n; i++){
      if(b[i]!=cnt){ cout << 0 << endl; return 0; }
      if(i%2==0){cnt+=2;} 
    }
  } else {
    int cnt=1;
    for(int i=0; i<n; i++){
      if(b[i]!=cnt){ cout << 0 << endl; return 0; }
      if(i%2==1){cnt+=2;} 
    }
  }
  
  cout << mod_pow(2, n/2, mod) << endl;
  return 0;
}


Measured memory_bytes: 1024
#python3
def main():
    n, m = map(int, input().split())
    a = [int(i) for i in input().split()]
    s = sum(a)
    c = 0
    for i in range(n):
        if 4*m*a[i] < s:
            c += 1
    ans = n - c
    print('Yes') if ans >= m else print('No')
main()

Measured memory_bytes: 3060
#include <vector>
#include <iostream>

using namespace std;

int main() {
    int n;
    cin >> n;
    int m = 1e9;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        m = min(__builtin_ctz(a), m);
    }
    cout << m << endl;
}

Measured memory_bytes: 3580
n=int(input())
s=list(map(int,input().split()))
a=list(map(int,input().split()))
uselist=[0 for _ in range(n)]
cnt=0
for i in range(n):
    if cnt!=s[i]:
        cnt=s[i]
        uselist[i]=cnt
    else:
        continue

###
uselist1=[0 for _ in range(n)]
count=0
for i in range(n):
    if count!=a[n-1-i]:
        count=a[n-1-i]
        uselist1[n-1-i]=count
    else:
        continue

###
flag=True
anslist=[0 for _ in range(n)]
for i in range(n):
    if uselist[i]!=0 and uselist1[i]!=0:
        if uselist[i]!=uselist1[i]:
            flag=False
            break
        else:
            anslist[i]=uselist[i]
    elif uselist[i]!=0 and uselist1[i]==0:
        anslist[i]=uselist[i]
    elif uselist[i]==0 and uselist1[i]!=0:
        anslist[i]=uselist1[i]
    else:
        continue
for i in range(n):
    if anslist[n-1-i]>a[n-1-i]:
        flag=False
        break

        
        
ans=1
checker=0
index=0
i=1
if flag:
    anslist.append(0)
    anslist.insert(0,0)
    while i<=n:
        if index==0 and anslist[i]!=0:
            checker=anslist[i]
            i+=1
            
        elif index==0 and anslist[i]==0:
            index+=1
            i+=1
            
        elif index!=0 and anslist[i]!=0:
            checker=min(checker,anslist[i])
            use=1
            for _ in range(index):
                use=(use*checker)%(10**9+7)
            ans=(ans*(use))%(10**9+7)
            checker=anslist[i]
            index=0
            i+=1
        elif index!=0 and anslist[i]==0:
            index+=1
            i+=1
    print(ans%(10**9+7))
if not flag:
    print(0)

Measured memory_bytes: 18752
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ll n,k;
    cin>>n>>k;
    ll p[n];
    for(ll i=0;i<n;i++){
        cin>>p[i];
    }
    sort(p,p+n);
    ll sum=0;
    for(ll i=0;i<k;i++){
        sum+=p[i];
    }
    cout<<sum<<endl;
}


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

int main() {
    int a,b,h;
    cin >> a>>b >>h;
    cout << (a+b)*h/2 <<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <array>
#include <cmath>
#include <iomanip>
using namespace std;
int main(){
    int a,b,c;
    cin >> a >> b >> c;
    string ans = "win";
    if(a+b+c > 21){
        ans = "bust";
    }
    cout << ans << endl; 
    return 0;
}
    



Measured memory_bytes: 256
n = gets.chomp.to_i
d = gets.split.map(&:to_i)
m = gets.chomp.to_i
t = gets.split.map(&:to_i)
hd = Hash.new(0)
ht = Hash.new(0)
d.each do |e|
  hd[e] += 1
end
t.each do |e|
  ht[e] += 1
end
ht.each do |k,v|
  if hd[k] < v
    puts 'NO'
    exit
  end
end
puts 'YES'


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

using namespace std;

int main(void){
  int n;
  vector<double> x(10);
  string u[10];

  cin >> n;
  for(int i = 0; i < n; i ++)
    cin >> x.at(i) >> u[i];

  double sum = 0;
  for(int i = 0; i < n; i ++){
    if(u[i] == "JPY")
      sum += x.at(i);
    else
      sum += x.at(i) * 380000;
  }

  cout << sum << endl;

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define mp(a,b) make_pair(a,b)
#define pb(x) push_back(x)
const ll mod = 1e9 + 7;
ll inf = 1e16;
#define fastio ios_base::sync_with_stdio(false); cin.tie(NULL)



int main()
{
   fastio;
   ll n;
   cin>>n;
   ll arr[n];
   for(ll i=0;i<n;++i){
   	cin>>arr[i];
   }
   ll dp[n];
   dp[0]=0;
   dp[1] = abs(arr[1]-arr[0]);
   for(ll i=2;i<n;++i){
   	  dp[i] = min(dp[i-1]+abs(arr[i]-arr[i-1]), dp[i-2]+abs(arr[i]-arr[i-2]));
   }
	 cout<<dp[n-1]<<endl;
	return 0;
}



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

bool isFourCard(int cards[5]){
	bool res = true;

	for (int i = 1; i < 4; i++){
		if (cards[i] != cards[i + 1])res = false;
	}

	if (res)return true;

	res = true;

	for (int i = 0; i < 3; i++){
		if (cards[i] != cards[i + 1])res = false;
	}

	return res;
}

bool isFullHouse(int cards[5]){
	if (cards[0] == cards[1] && cards[2] == cards[3] && cards[3] == cards[4])return true;
	if (cards[0] == cards[1] && cards[1] == cards[2] && cards[3] == cards[4])return true;

	return false;
}

bool isStraight(int cards[5]){
	bool res = true;

	for (int i = 0; i < 4; i++){
		if (cards[i] + 1 != cards[i + 1])res = false;
	}

	if (cards[0] == 1 && cards[1] == 10 && cards[2] == 11 && cards[3] == 12 && cards[4] == 13)res = true;

	return res;
}


bool isThreeCard(int cards[5]){
	for (int i = 0; i < 3; i++){
		if (cards[i] == cards[i + 1] && cards[i + 1] == cards[i + 2])return true;
	}

	return false;
}

int Pair(int cards[5]){
	int cnt = 0;

	for (int i = 0; i < 4; i++){
		if (cards[i] == cards[i + 1])cnt++;
	}

	return cnt;
}

int main(){

	int cards[5];

	while (std::cin >> cards[0]){
		
		for (int i = 1; i < 5; i++){
			char a;
			std::cin >> a >> cards[i];
		}

		std::sort(cards, cards + 5);

		if (isFourCard(cards)){
			std::cout << "four card" << std::endl;
			continue;
		}

		if (isFullHouse(cards)){
			std::cout << "full house" << std::endl;
			continue;
		}

		if (isStraight(cards)){
			std::cout << "straight" << std::endl;
			continue;
		}

		if (isThreeCard(cards)){
			std::cout << "three card" << std::endl;
			continue;
		}

		if (Pair(cards) == 2){
			std::cout << "two pair" << std::endl;
			continue;
		}

		if (Pair(cards) == 1){
			std::cout << "one pair" << std::endl;
			continue;
		}

		if (Pair(cards) == 0){
			std::cout << "null" << std::endl;
			continue;
		}
	}
	return 0;
}

Measured memory_bytes: 1180
using System;
using System.Collections.Generic;
using static System.Console;
using System.Linq;

class Program
{
    static int f(int x) {
        if (x % 2 == 0) return x / 2;
        return 3 * x + 1;
    }

    static void Main(string[] args) {
        var s = Int32.Parse(Console.ReadLine());
        var Numlist = new List<int>();
        Numlist.Add(s);

        int Result;
        for(Result = 2; ;Result++) {
            int tmp = f(Numlist.Last());
            if (Numlist.Contains(tmp))
                break;
            Numlist.Add(tmp);
        }

        Console.WriteLine(Result);
               
        Console.ReadLine();
    }
}


Measured memory_bytes: 13152
#include<bits/stdc++.h>
#define pb push_back
#define mp make_pair
typedef long long int ll;
using namespace std;

ll x;

int main(){
  cin >> x;
  for(ll i=-300;i<=300;i++){
    for(ll j=-300;j<=300;j++){
      if (i*i*i*i*i - j*j*j*j*j == x){
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }  
  return 0;
}
  

Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);
		int i,a,b;
		for(i=0; i<7; i++) {
			a = sc.nextInt();
			b = sc.nextInt();
			System.out.println(a-b);
			}
		}
	}

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

int main(){
    int sat;
    sat=0;
    int N;
    cin >> N;

    int A[N];
    int B[N];
    int C[N-1];

    for (int i = 0;i<N;i++) cin >> A[i];
    for (int i = 0;i<N;i++) cin >> B[i];
    for (int i = 0;i<N-1;i++) cin >> C[i];

    for (int i = 0;i<N-1;i++){
        sat+=B[A[i]-1];
        if (A[i+1]==A[i]+1){
            sat+=C[A[i]-1];
        }
    }
    sat+=B[A[N-1]-1];
    cout << sat << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  
  vector<int> cont1(n);
  vector<int> cont2(n);
  
  for(int i = 0 ; i < n ; i++){
    cin >> cont1.at(i);
  }
  for(int i = 0 ; i < n ; i++){
    cin >> cont2.at(i);
  }
  
  int ans = 0;
  for(int i = 0 ; i < n ; i++){
    if(cont1.at(i) > cont2.at(i)){
      ans += cont1.at(i) - cont2.at(i);
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;

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

    vector<int64_t> a(n + 1);
    for (auto&& aa : a) {
        cin >> aa;
    }

    vector<int64_t> b(n);
    for (auto&& bb : b) {
        cin >> bb;
    }

    int64_t ans = 0;
    int64_t rem = 0;
    for (auto i : irange(0L, n)) {
        auto k = min(a[i], b[i]);
        ans += k;

        auto k2 = min(a[i + 1], b[i] - k);
        ans += k2;
        a[i + 1] -= k2;
    }

    cout << ans << endl;
}

Measured memory_bytes: 1792