akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using P = pair<int,int>;

int main() {
	int X, A;
	cin >> X >> A;
	int ans = 10;
	if (X < A){
		ans = 0;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3596
/*

  _    _ _      _ _      _ _     _____ ____________ 
 | |__| | | _ _| | | _ _| | | __|__ / |__ /__ /__  |
 | '_ \_  _| ' \_  _| ' \_  _(_-<|_ \ ||_ \|_ \ / / 
 |_.__/ |_||_||_||_||_||_||_|/__/___/_|___/___//_/  

*/

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define db1(x) cout << #x << "=" << x << '\n'
#define db2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << '\n'
#define db3(x, y, z) cout << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << '\n'
#define rep(i, k, n) for (int i = k; k < n ? i < n : i > n; k < n ? i += 1 : i -= 1)
#define si(x) scanf("%d", &x)
#define sl(x) scanf("%lld", &x)
#define ss(x) scanf("%s", x)
#define pi(x) printf("%d\n", x)
#define pl(x) printf("%lld\n", x)
#define ps(x) printf("%s\n", x)
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for (auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define F first
#define S second
#define pb push_back
#define ll long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pl> vpl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;

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

int mpow(int base, int exp);
void ipgraph(int n,int m);
void dfs(int u, int par);
const int mod = 1000000007;
const int N = 3e5, M = N, OO = 1e9 + 7;
const ll LLOO = 1e18 + 7;
//=======================

vi g[N];
int a[N];

void solve()
{
    int d,t,s;
    si(d);
    si(t);
    si(s);
    int dada = t*s;
    if (dada >= d) puts("Yes");
    else puts("No");
}

int main()
{
    // uncomment if file :
    // freopen("in","r",stdin);
    // freopen("out","w",stdout);
    int t = 1;
    // si(t); // uncomment if testcases
    while (t--)
        solve();
    return 0;
}

int mpow(int base, int exp)
{
    base %= mod;
    int result = 1;
    while (exp > 0)
    {
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

void ipgraph(int n, int m)
{
    int u, v;
    while (m--)
    {
        scanf("%d %d", &u, &v);
        g[u - 1].pb(v - 1);
        g[v - 1].pb(u - 1);
    }
}

void dfs(int u, int par)
{
    for (int v : g[u])
    {
        if (v == par)
            continue;
        dfs(v, u);
    }
}


Measured memory_bytes: 10800
using System;

namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();

            int n = int.Parse(s);
            int x = n / 3600;
            int y = n % 3600 / 60;
            int z = n % 3600 % 60;

            Console.WriteLine(x+":"+y+":"+z);
        }
    }
}

Measured memory_bytes: 9180
N = input()
N = input()
N = N.split(' ')
N = list(map(lambda Ni: int(Ni), N))

count = 0
temp = 0
for i, Ni in enumerate(N):
    is_last_Ni = i >= len(N) - 1
    if is_last_Ni:
        count = max(temp, count)
        break

    right = N[i + 1]
    is_right_less_than_Ni = Ni >= right
    if is_right_less_than_Ni:
        temp += 1
    else:
        count = max(temp, count)
        temp = 0

print(count)


Measured memory_bytes: 14228
#include <bits/stdc++.h>
#include<math.h>
#include <iostream>
#include <vector>
#include <queue>

using namespace std;

int main() {
  string x;
  cin>>x; 
  int a=0;
  int b=0;
  for (int i = 0; i < x.size(); i++) {
    if(x.at(i)=='A'){
      a=i;
      break;
    }
  }
  for (int i = 0; i < x.size(); i++) {
    if(x.at(i)=='Z'){
      b=i;
    }
  }
  
    cout<<b-a+1<<endl;
  
 
}









Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
int main() {
	int a, b, c, x, y, z, ans = 0;
	scanf("%d%d%d", &a, &b, &c);
	while(1) {
		if(a%2==1 || b%2==1 || c%2==1) break;
		if(ans == 1e7) {
			ans = -1;
			break;
		}
		x = b+c;
		y = a+c;
		z = a+b;
		
		a = x/2;
		b = y/2;
		c = z/2;
		ans++;
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
# -*- coding: utf-8 -*-

def get_input() -> tuple:
    """
    標準入力を取得する.

    Returns:\n
        tuple: 標準入力
    """
    S = input()
    T = input()

    return S, T


def main(S: str, T: str) -> None:
    """
    メイン処理.

    Args:\n
        S (str): 英子文字からなる文字列(2 <= |S| <= 100)
        T (str): 英子文字からなる文字列(|S| = |T|)
    """
    # 求解処理
    N = len(S)
    ans = "No"
    for i in range(N):
        if S[-i:] + S[:-i] == T:
            ans = "Yes"
            break

    # 結果出力
    print(ans)


if __name__ == "__main__":
    # 標準入力を取得
    S, T = get_input()

    # メイン処理
    main(S, T)


Measured memory_bytes: 9072
// 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, deque<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 N, M, S;
  cin >> N >> M >> S;
  const int MX = 50 * 50;
  vector<vector<vector<pair<pii, int>>>> G(
      N, vector<vector<pair<pii, int>>>(MX + 1));
  rep(i, 0, M) {
    int u, v, a, b;
    cin >> u >> v >> a >> b;
    u--, v--;
    rep(j, 0, MX + 1) {
      if (j - a >= 0) {
        G[u][j].push_back({{v, j - a}, b});
        G[v][j].push_back({{u, j - a}, b});
      }
    }
  }
  vi C(N), D(N);
  rep(i, 0, N) { cin >> C[i] >> D[i]; }
  rep(i, 0, N) {
    rep(j, 0, MX + 1) { G[i][j].push_back({{i, min(MX, j + C[i])}, D[i]}); }
  }

  heap<pair<int, pii>> q;
  vvi dist(N, vi(MX + 1, INF));
  dist[0][min(MX, S)] = 0;
  q.push({0, {0, min(MX, S)}});
  while (sz(q)) {
    int d;
    pii v;
    tie(d, v) = q.top();
    q.pop();
    if (d > dist[v.first][v.second]) continue;
    for (auto e : G[v.first][v.second]) {
      pii w = e.first;
      if (chmin(dist[w.first][w.second], dist[v.first][v.second] + e.second)) {
        q.emplace(dist[w.first][w.second], w);
      }
    }
  }

  rep(i, 1, N) {
    int ans = INF;
    rep(j, 0, MX + 1) { chmin(ans, dist[i][j]); }
    cout << ans << endl;
  }
  return (0 ^ _ ^ 0);
}



Measured memory_bytes: 30228
#include<iostream>
using namespace std;
int main(){
	int N;
	long int max,min;
	long int A;
	cin>>N;
	cin>>A;
	max=A;
	min=A;
	for(int i=1;i<N;i++){
		cin>>A;
		if(A<min)min=A;
		if(A>max)max=A;
	}
	cout<<max-min<<endl;
	return 0;
}

Measured memory_bytes: 256
import math

a, b, h, m = map(int, input().split())
angle = ((h * 60 + m) / 720 - m / 60) * math.pi * 2  # 角度(ラジアン)
ans = math.sqrt(a*a + b*b - 2*a*b*math.cos(angle))  # 余弦定理
print(ans)

Measured memory_bytes: 9412
n = int(input())
a = list(map(int,input().split()))

def find(a,flag):
	c = 0
	s = 0
	for i in range(n):
		if flag and s + a[i] > 0:
			flag = False
			s = s + a[i]
		elif flag:
			c = c + abs(s + a[i])+1
			flag = False
			s = 1
		elif not flag and s + a[i] < 0:
			flag = True
			s = s + a[i]
	#		print((s,f,c))
		else:
			c = c + abs(s+a[i])+1
			flag = True
			s = -1
	return c

cplus = find(a,True)
cmin = find(a,False)
print(min(cplus,cmin))


Measured memory_bytes: 14468
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<iomanip>
#include<vector>
#include<queue>
#include<deque>
#include<string>
#include<utility>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<set>
#include<map>
#include<bitset>
#include<stack>
#include<ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,int> pli;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef vector<pli> vpli;

inline ll read(){
    ll Hashimoto=0;
	bool Kanna=1;
    char I_Love=getchar();
    while(I_Love<'0'||I_Love>'9'){
        if(I_Love=='-')Kanna=0;
        I_Love=getchar();
    }
    while(I_Love>='0'&&I_Love<='9'){
        Hashimoto=Hashimoto*10+I_Love-'0';
        I_Love=getchar();
    }
    return (Kanna?Hashimoto:-Hashimoto);
}
template<typename T1,typename T2> inline void Umax(T1 &a,T2 b){
	if(a<b)a=b;
}
template<typename T1,typename T2> inline void Umin(T1 &a,T2 b){
	if(a>b)a=b;
}

#define I_Love_Hashimoto_Kanna main
#define fastio ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define filein(s) freopen(s,"r",stdin);
#define fileout(s) freopen(s,"w",stdout);
#define file freopen("I_Love_Hashimoto_Kanna.out","w",stdout);
#define RE cout<<"I_Love_Hashimoto_Kanna"<<endl;
#define Tone(Kanna) cout<<Kanna<<endl;
#define Tall(Hashimoto,Kanna) for(int I_Love=0;I_Love<(Kanna);++I_Love)cout<<Hashimoto[I_Love]<<(I_Love==(Kanna)-1?"\n":" ");
#define FOR(I_Love,Hashimoto,Kanna) for(int I_Love=Hashimoto;I_Love<(Kanna);++I_Love)
#define MP(Hashimoto,Kanna) make_pair(Hashimoto,Kanna)
#define REV(Kanna) reverse(Kanna.begin(),Kanna.end());
#define SORT(Kanna) sort(Kanna.begin(),Kanna.end());
#define UNIQUE(Kanna) Kanna.erase(unique(Kanna.begin(),Kanna.end()),Kanna.end());
#define inf (1000000000)
#define linf (1000000000000000000ll)
#define mod (1000000007)

int a,b,c;

int I_Love_Hashimoto_Kanna() {
	//完全想清楚了再开始写。
	//写不顺、不知道怎么写、很乱的时候，停下来好好想想。
	//做得慢总比做不出好。
	fastio;
	cin>>a;
	int cur=10,ans=0;
	while(1){
		if(a>=cur){
			ans+=cur-(cur/10);
		}
		else {
			ans+=max(0,a+1-cur/10);
			break;
		}
		cur*=100;
	} 
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
Dice=[int(i) for i in input().split()]
words=input()
for word in words:
    if word=='N':
        num=Dice[0]
        Dice[0]=Dice[1]
        Dice[1]=Dice[5]
        Dice[5]=Dice[4]
        Dice[4]=num
    if word=='E':
        num=Dice[0]
        Dice[0]=Dice[3]
        Dice[3]=Dice[5]
        Dice[5]=Dice[2]
        Dice[2]=num
    if word=='W':
        num=Dice[0]
        Dice[0]=Dice[2]
        Dice[2]=Dice[5]
        Dice[5]=Dice[3]
        Dice[3]=num
    if word=='S':
        num=Dice[0]
        Dice[0]=Dice[4]
        Dice[4]=Dice[5]
        Dice[5]=Dice[1]
        Dice[1]=num
print(Dice[0])
    

Measured memory_bytes: 7720
#include <iostream>

using namespace std;

void solve()
{
	char field[11][12];
	char a;
	while(cin >> a)
	{
		for(int i = 0; i < 11; ++i)
		{
			for(int j = 0; j < 12; ++j)
			{
				field[i][j] = '0';
			}
		}
		field[1][1] = a;
		for(int i = 2; i < 9; ++i)
		{
			cin >> field[1][i];
		}
		for(int i = 2; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				cin >> field[i][j];
			}
		}
		for(int i = 1; i < 9; ++i)
		{
			for(int j = 1; j < 9; ++j)
			{
				if(field[i][j] == '1')
				{
					if(field[i][j + 1] == '1' && field[i + 1][j] == '1' && field[i + 1][j + 1] == '1')
					{
						cout << "A" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 2][j] == '1' && field[i + 3][j] == '1')
					{
						cout << "B" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i][j + 2] == '1' && field[i][j + 3] == '1')
					{
						cout << "C" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 1][j - 1] == '1' && field[i + 2][j - 1] == '1')
					{
						cout << "D" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j + 1] == '1' && field[i + 1][j + 2] == '1')
					{
						cout << "E" << endl;
					}
					else if(field[i + 1][j] == '1' && field[i + 1][j + 1] == '1' && field[i + 2][j + 1] == '1')
					{
						cout << "F" << endl;
					}
					else if(field[i][j + 1] == '1' && field[i + 1][j] == '1' && field[i + 1][j - 1] == '1')
					{
						cout << "G" << endl;
					}
					break;
				}
			}
		}
	}
}

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

Measured memory_bytes: 0
def cmb(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result
mod = 10**9 + 7
n, k = map(int, input().split())
cnt = 0
for i in range(1, k + 1):
    if i <= n - k + 1:
        print(cmb(n - k + 1, i) * cmb(k - 1, i - 1) % mod)
    else:
        print(0)


Measured memory_bytes: 49756
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define reg register
#pragma GCC optimize(3)
#pragma GCC optimize("02")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#define _inline __inline__ __attribute__((always_inline))
using namespace std;
class complex{
public:
    inline char gc(){
        static const signed IN_LEN=1<<18|1;
        static char buf[IN_LEN],*s,*t;
        return (s==t)&&(t=(s=buf)+fread(buf,1,IN_LEN,stdin)),s==t?-1:*s++;
    }
    template <typename _Tp> _inline complex & operator >> (_Tp &x){
        static char ch,sgn; ch=gc(),sgn=0;
        for(;!isdigit(ch);ch=gc()){if(ch==-1)return *this;sgn|=ch=='-';}
        for(x=0;isdigit(ch);ch=gc())x=x*10+(ch^'0');
        sgn&&(x=-x); return *this;
    }
}inc;
int n,r;
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	inc>>n>>r;
	if(n<10) printf("%d\n",r+100*(10-n));
	else printf("%d\n",r);
	return 0;
}


Measured memory_bytes: 256
// stdin
macro_rules! stdin {
    () => {{
        use std::io::Read;
        let mut s = String::new();
        std::io::stdin().read_to_string(&mut s).unwrap();
        s
    }};
}

// input
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

// Test
macro_rules! test {
    ($($input:expr => $output:expr),* $(,)*) => {
        #[test]
        fn solve_test() {
            $(
                assert_eq!(solve($input), $output);
            )*
        }
    };
}

test! {
r"12 4
" => r"4",

r"20 15
" => r"0",

r"20 30
" => r"0"
}

fn solve(src: &str) -> String {
    input! {
        source=src,
        a:i32,
        b:i32,
//        s:String,
//        a:[i32;n],
    }
    let a: i32 = a;
    let b: i32 = b;

    let ans = a - b * 2;
    if ans > 0 {
        return format!("{}", ans);
    }
    return format!("{}", 0);
}


fn main() {
    println!("{}", solve(&stdin!()));
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int i,N, M,sum=0;
  int a[1001];
  int count=0;
  cin >> N >> M;
 
  for(i=0;i<N;i++){
    cin >> a[i];
    sum += a[i];
  }
  
  for(i=0;i<N;i++){
    if(a[i] >= (double)sum/(4*M)){
      count += 1;
    }
  }
 
  if(count >= M){
      cout << "Yes" << endl;
  }else{
    cout << "No" << endl;
  }
}


Measured memory_bytes: 256
import sys
L, R = map(int, input().split())
ans = []

def calc_mod(x, y):
    return x * y % 2019

left = L % 2019
right = R % 2019

if R-L > 2019:
    print(0)
    sys.exit(0)

elif left > right:
    print(0)
    sys.exit(0)

elif left==0 or right==0:
    print(0)
    sys.exit(0)

for i in range(left, right):
    for j in range(i+1, right+1):
        x = calc_mod(i, j)
        if x==0:
            print(0)
            sys.exit(0)
        ans.append(x)

print(min(ans))

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



int main(){
  int d, t, s; cin >> d >> t >> s;
  if(d <= t*s) cout << "Yes\n";
  else cout << "No\n";
  return 0;
}


Measured memory_bytes: 3628
#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 a, b, h; cin >> a >> b >> h;
    cout << (a+b)*h/2 << 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: 7680
#include <bits/stdc++.h>
using namespace std;

int main() {
  long long N,A,B;
  cin >> N >> A >> B;
  long long P = N%(A + B);
  if (P >= A)
    cout << A*(N/(A + B)) + A << endl;
  else
    cout << A*(N/(A + B)) + P << endl;
   
    
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long ul;
typedef unsigned int ui;
typedef pair<int,int> P;
typedef pair<ll,ll> LP;
#define All(v) (v).begin(),(v).end()
#define Rep(i,n) for(int i = 0; i < (int)n; i++)
#define Reps(i,n) for(int i = 1; i <= (int)n; i++)
#define For(i,m,n) for(int i = m; i < n; i++)
#define Fors(i,m,n) for(int i = m; i <= n; i++)
#define Inf 2e9
#define F first
#define S second
#define pb push_back
#define mp make_pair
struct speed{speed(){cin.tie(); ios::sync_with_stdio(false); cout << fixed << setprecision(18);}}speed;

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

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

ll lcm(ll a, ll b){
    return a*b/gcd(a,b);
}


int main (){
    ll w,h,x,y;
    cin >> w >> h >> x >> y;
    cout << w/2.0*h << " ";
    if(x == w/2.0 && y == h/2.0){
        cout << 1 << "\n";
    }else{
        cout << 0 << "\n";
    }
}

Measured memory_bytes: 256
n,k = map(int,input().split())
d = []
A = []
cnt = []
ans = 0

for i in range(k):
    tmp = int(input())
    tmp2 = list(input().split())
    d.append(tmp)
    A.append(tmp2)
    
for i in range(k):
    for j in range(d[i]):
        if A[i][j] not in cnt:
            cnt.append(A[i][j])

ans = n - len(cnt)
print(ans)

Measured memory_bytes: 9352
// Copyright 2020 yaito3014
#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  int A, B;
  cin >> A >> B;
  if (A == 1)A = 14;
  if (B == 1)B = 14;
  cout << (A == B ? "Draw" : A > B ? "Alice" : "Bob") << endl;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

li a[100100];

int main() {
    li n, x;
    cin >> n >> x;
    rin{cin >> a[i];}
    li res = 0;
    rep(i, n - 1) {
        li now = a[i] + a[i + 1];
        if (now > x) {
            if ((now - x) <= a[i + 1]) {
                a[i + 1] -= now - x;
                res += now - x;
            } else {
                res += now - x;
                a[i] -= now - x - a[i + 1];
                a[i + 1] = 0;
            }
        }
    }
    cout << res << endl;

    return 0;
}

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

int main() {
    string T;
    cin >> T;
    int S = T.size();
    rep(i, S) {
        if(T.at(i) == '?') {
            T.at(i) = 'D';
        }
    }

    cout << T << endl;
    return 0;
}

Measured memory_bytes: 3756
#include <bits/stdc++.h>
using namespace std;
int main() {
long long N,A,B,C;
cin>>N>>A>>B>>C;
string a[N]={};
string b[N]={};
int death=0;
for(int i=0;i<N;i++){
cin>>b[i];}
for(int i=0;i<N-1;i++){
if(b[i]=="AB"){
if(A==0&&B==0){
death++;}
if(A>B||(A==B&&b[i+1]!="AC")){
a[i]="B";
B++;
A--;}
else{
a[i]="A";
A++;
B--;}}
if(b[i]=="AC"){
if(A==0&&C==0){
death++;}
if(A>C||(A==C&&b[i+1]!="AB")){
a[i]="C";
C++;
A--;}
else{
a[i]="A";
A++;
C--;}}
if(b[i]=="BC"){
if(B==0&&C==0){
death++;}
if(C>B||(C==B&&b[i+1]!="AC")){
a[i]="B";
B++;
C--;}
else{
a[i]="C";
C++;
B--;
}}}
if(b[N-1]=="AB"){
if(A==0&&B==0){
death++;}
if(A>B){
a[N-1]="B";
B++;
A--;}
else{
a[N-1]="A";
A++;
B--;}}
if(b[N-1]=="AC"){
if(A==0&&C==0){
death++;}
if(A>C){
a[N-1]="C";
C++;
A--;}
else{
a[N-1]="A";
A++;
C--;}}
if(b[N-1]=="BC"){
if(B==0&&C==0){
death++;}
if(C>B){
a[N-1]="B";
B++;
C--;}
else{
a[N-1]="C";
C++;
B--;
}}
if(death!=0){
cout<<"No"<<endl;}
else{
cout<<"Yes"<<endl;
for(int i=0;i<N;i++){
cout<<a[i]<<endl;}}}


Measured memory_bytes: 9840
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <string.h>
using namespace std;

int main(void) {
	int A, B, T, answer;
  	cin >> A >> B >> T;
  	answer = (T / A) * B;
  	cout << answer << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max(a,b)-min(a,b))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1; rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)n,(int)n)
#define nHr(n,r) nCr((int)(n+r+1),(int)r)
#define sankaku(x) ((1+x)*x)/2
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,result=0;
  int a[LIMIT2]={0},b[LIMIT2]={0};
  char s[LIMIT1];

  scanf("%lld",&n);
  rep(i,n+1) scanf("%d",&a[i]);
  rep(i,n) scanf("%d",&b[i]);
  rep(i,n){
	if(a[i]>=b[i]){
      a[i] -= b[i];
      result += b[i];
    }else{
      b[i] -= a[i];
      result += a[i];
      a[i] = 0;
      if(a[i+1]<b[i]){
        result += a[i+1];
        a[i+1]=0;
      }else{
        result += b[i];
        a[i+1] -= b[i];
      }
    }
  }
  printf("%lld",result);
  return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<string>

using namespace std;

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

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

	cout << "Balanced" << endl;

	return 0;
}

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

bool isPalindrome(string const & s, int start, int end)
{
	int i = start;
	int j = end;
	if ( i > j ) return false;
	do
	{
		// cout << i << " " << j << endl;
		if (s.at(i) != s.at(j)) return false;
		i++;
		j--;
	}
	while ( i <= j );
	return true;
}

int main()
{
	string s;
	cin >> s;
	int n = s.size();

	bool isStrongPalindrome = isPalindrome(s, 0, n-1) && isPalindrome(s, 0 , (n-1)/2-1) && isPalindrome(s, (n+3)/2-1 , n-1);
	cout << ( isStrongPalindrome ? "Yes" : "No" )<< endl;
}

Measured memory_bytes: 256
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T
import qualified Data.Vector.Unboxed as VU

main :: IO ()
main = do
  let
    unsafeBinaryMinInt :: (Int -> Bool) -> (Int, Int) -> Int
    unsafeBinaryMinInt p = check
      where
        check :: (Int, Int) -> Int
        check ij@(i, _) | p i       = i
                        | otherwise = search ij
        search :: (Int, Int) -> Int
        search = snd . until ((==) <$> succ . fst <*> snd) halve
          where
            halve :: (Int, Int) -> (Int, Int)
            halve (i, j) | p m       = (i, m)
                         | otherwise = (m, j)
              where
                m = (i + j) `div` 2
  [_, k] <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  as <- map (subtract 1 . unsafeTextToInt) . T.words <$> T.getLine :: IO [Int]
  let
    as' = VU.fromList as :: VU.Vector Int
    p :: Int -> Bool
    p i = (<= k) . VU.sum . VU.map (`div` i) $ as'
  print $  unsafeBinaryMinInt p (1, 10 ^ 9)

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 18828
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
#define rep(var, n) for (int var = 0; var < (n); ++var)
#define ALL(c) (c).begin(), (c).end()

int main() {
  //
  int n;
  cin >> n;
  vi w(n);
  rep(i, n) cin >> w[i];
  // sort(ALL(w));

  int sum = 0;
  rep(i, n) sum += w[i];

  int ans = sum;
  int s1 = 0;
  for (int i = 0; i < n; i++) {
    s1 += w[i];
    int s2 = sum - s1;
    ans = min(ans, abs(s2 - s1));
  }
  cout << ans <<endl;
  return 0;
}


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


long long gcd(long long a,long long b){
	if(a==0 || b==0){
		return max(a,b);
	}
	else if(a%b==0 || b%a==0){
		return min(a,b);
	}
	
	long long q;
	bool pro =true;
	while(pro){
		q=a%b;
		a=b;
		b=q;
		if(a%b==0){
			return q;
			pro=false;
		}
	}
}

signed main(){
	int A,B,C,D;
    cin>>A>>B>>C>>D;
    int l=C/gcd(C,D)*D;
    cout<<B-(B/C+B/D-B/l)-(A-1-((A-1)/C+(A-1)/D-(A-1)/l))<<endl;
	//cout<<gcd(C,D)<<endl;
    return 0;
}



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

using namespace std;
using ll = long long;

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

  int n;
  cin >> n;
  map<string, int> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    m[s]++;
  }
  cout << "AC x " << m["AC"] << endl;
  cout << "WA x " << m["WA"] << endl;
  cout << "TLE x " << m["TLE"] << endl;
  cout << "RE x " << m["RE"] << endl;

  return 0;
}


Measured memory_bytes: 3664
#include <stdio.h>
#define ll long long
#define rep(i,l,r)for(ll i=l;i<r;i++)

ll b[20][5];

int main(){
	ll h;
	while(scanf("%lld",&h),h){
		rep(i,0,h)rep(j,0,5)scanf("%lld",&b[i][j]);
		ll ans=0,flag=1;
		while(flag){
			flag=0;
			//消滅
			rep(i,0,h)rep(j,0,3){
				if(b[i][j]!=-1&&b[i][j]==b[i][j+1]&&b[i][j+1]==b[i][j+2]){
					flag=1;
					ll temp=b[i][j];
					rep(k,j,5){
						if(b[i][k]!=temp)break;
						ans+=temp;
						b[i][k]=-1;
					}
				}
			}
			//落下
			rep(j,0,5){
				ll crr=h-1;
				for(int i=h-1;i>=0;i--)if(b[i][j]!=-1)b[crr--][j]=b[i][j];
				while(crr>=0)b[crr--][j]=-1;
			}
		}
		printf("%lld\n",ans);
	}
}


Measured memory_bytes: 2032
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cfloat>
#include <complex>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits.h>
#include <list>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <string.h>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define int long long
#define ll long long
#define P pair<int,int>
#define prique(T) priority_queue<T,vector<T>,greater<T>>
#define all(V) V.begin(),V.end()
#ifdef int
constexpr int INF = LLONG_MAX / 10;
#else
constexpr int INF = INT_MAX / 10;
#endif
constexpr double eps = 1e-9;
template <class T, class U>
inline bool chmax(T& lhs, const U& rhs) {
	if (lhs < rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
template <class T, class U>
inline bool chmin(T& lhs, const U& rhs) {
	if (lhs > rhs) {
		lhs = rhs;
		return 1;
	}
	return 0;
}
using namespace std;
inline ll gcd(ll a, ll b) {
	while (b) {
		ll c = a;
		a = b; b = c % b;
	}
	return a;
}
inline ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
bool isprime(ll n) {
	if (n == 1)return false;
	for (int i = 2; i * i <= n; i++) {
		if (n % i == 0)return false;
	}
	return true;
}
ll mypow(ll a, ll b) {
	if (!b)return 1;
	if (b & 1)return mypow(a, b - 1) * a;
	ll memo = mypow(a, b >> 1);
	return memo * memo;
}
ll modpow(ll a, ll b, ll m) {
	if (!b)return 1;
	if (b & 1)return modpow(a, b - 1, m) * a % m;
	ll memo = modpow(a, b >> 1, m);
	return memo * memo % m;
}
signed main() {
	int a, b, c;
	cin >> a >> b >> c;
	cout << c << " " << a << " " << b << endl;
	return 0;
}

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

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

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;


int main(){
  int H, W, M;
  cin >> H >> W >> M;
  
  
  
  vector<int> Hi(H, 0);
  vector<int> Wi(W, 0);
  set<pair<int,int>> bom;
  for(int i = 0; i<M; i++){
    int h,w;
    cin >> h >> w;
    Hi[h-1]++;
    Wi[w-1]++;
    bom.insert(make_pair(h-1,w-1));
  }
  
  
  int max_h = 0;
  int max_w = 0;
  
  for(int i = 0; i<H; i++){
    max_h = max(max_h, Hi[i]);
  }
  for(int i = 0; i<W; i++){
    max_w = max(max_w, Wi[i]);
  }
  
  
  
  vector<int> X(0);
  vector<int> Y(0);
  
  for(int i = 0; i<H; i++){
    if(Hi[i] == max_h){
      X.push_back(i);
    }
  }
  for(int i = 0; i<W; i++){
    if(Wi[i] == max_w){
      Y.push_back(i);
    }
  }
  
  const int xx = X.size();
  const int yy = Y.size();
  
  if(xx*yy>M){
    cout << max_h+max_w << endl;
    return 0;
  }
  else{    
    for(auto p: X){
      for(auto q: Y){
        if(bom.find(make_pair(p,q))==bom.end()){
          cout << max_h+max_w << endl;
          return 0;
        }
      }
    }
  }
  cout << max_h+max_w-1 << endl;
  return 0;
}

      
      
       





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

 public class Main{
// taking inputs
static BufferedReader s1;
static BufferedWriter out;
static String read() throws IOException{String line="";while(line.length()==0){line=s1.readLine();continue;}return line;}
static int int_v (String s1){return Integer.parseInt(s1);}
static long long_v(String s1){return Long.parseLong(s1);}
static int[] int_arr() throws IOException{String[] a=read().split(" ");int[] b=new int[a.length];for(int i=0;i<a.length;i++){b[i]=int_v(a[i]);}return b;}
static long[] long_arr() throws IOException{String[] a=read().split(" ");long[] b=new long[a.length];for(int i=0;i<a.length;i++){b[i]=long_v(a[i]);}return b;}
static void assign(){s1=new BufferedReader(new InputStreamReader(System.in));out=new BufferedWriter(new OutputStreamWriter(System.out));}
static long Modpow(long a,long p,long m){long res=1;while(p>0){if((p&1)!=0){res=(res*a)%m;}p >>=1;a=(a*a)%m;}return res;}
static long Modmul(long a,long b,long m){return ((a%m)*(b%m))%m;}
static long ModInv(long a,long m){return Modpow(a,m-2,m);}
static long nck(int n,int r,long m){if(r>n){return 0l;}return Modmul(f[n],ModInv(Modmul(f[n-r],f[r],m),m),m);}
static long[] f;
//......................................@uthor_Alx..............................................

   public static void main(String[] args) throws  IOException{
	        		  assign();
	        		  	int k=int_v(read());
	        		  	int s=read().length();
	        		  	f=new long[k+s+5];
	        		  	f[0]=1l;
	        		  	long mod=(long)1e9+7;
	        		  	for(int i=1;i<=k+s+4;i++){
	        		  		f[i]=Modmul(f[i-1],(long)i,mod);
	        		  	}
	        		  	long res=Modpow(26l,k+s,mod);
	        		  	for(int i=0;i<s;i++){
	        		  		res-=Modmul(Modpow(25l,k+s-i,mod),nck(k+s,i,mod),mod);
	        		  		res%=mod;
	        		  	}
	        		  	res=(res+mod)%mod;
	        		  	out.write(res+"");
                      	out.flush();
	}
}
	       


Measured memory_bytes: 69024
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))

def main():
    mod=10**9+7
    from collections import defaultdict
    dd = defaultdict(int)
    
    S=input()
    N=len(S)
    f=1
    for i in range(N):
        dd[S[i]]+=1
        if dd[S[i]]==2:
            f=0
            
    if f==1:
        print("yes")
    else:
        print("no")

main()


Measured memory_bytes: 38384
import itertools
import math
k = int(input())
# めんどくさいので最初に8クイーンが成立するパターンを計算しといて、入力にマッチするパターンを出力する
lis = [x for x in range(8)]
permutations_lis = itertools.permutations(lis)
ans = []
for zahyo in permutations_lis:
  #クイーンi は x,y = i,zahyo[i]にいる
  #nC2でabs(x1-x2)=abs(y1-y2) を検証
  ok =0
  for i in range(7):
    for j in range(i+1,8):
      if abs(i-j) != abs(zahyo[i]-zahyo[j]):
        ok += 1
      else: break
  if ok == 28:
    ans.append(zahyo)
    #print(ok,zahyo)
#print(len(ans))
input_zahyo = [-1] * 8
for i in range(k):
  x,y = map(int,input().split())
  input_zahyo[x] = y
for zahyo in ans:
  ok = 0
  for j in range(8):
    if input_zahyo[j] != -1 and zahyo[j] == input_zahyo[j]:
      ok += 1
  #print(ok,zahyo,input_zahyo)
  if ok == k:
    for i in range(8):
      for j in range(8):
        if zahyo[i] == j: print("Q",end="")
        else: print(".",end="")
      print("")
    exit()


Measured memory_bytes: 5748
#include <bits/stdc++.h>
using namespace std;
int read();
int n;
int p[400005], fa[400005];
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }

struct P {
    long long s[2], i;
    P operator+(P a) { return (P){s[0] + a.s[0], s[1] + a.s[1], i}; }
    bool operator<(P a) const {
        if (s[0] * a.s[1] == s[1] * a.s[0])
            return (s[0] == a.s[0]) ? (s[1] == a.s[1] ? i < a.i : s[1] < a.s[1])
                                    : s[0] < a.s[0];
        return s[0] * a.s[1] < s[1] * a.s[0];
    }
    bool operator==(P a) const {
        return s[0] == a.s[0] && s[1] == a.s[1] && i == a.i;
    }
} t[400005];

struct Q {
    priority_queue<P> q1, q2;
    void ins(P t) { q1.push(t); }
    void del(P t) { q2.push(t); }
    P top() {
        while (!q1.empty() && !q2.empty() && q1.top() == q2.top())
            q1.pop(), q2.pop();
        return q1.top();
    }

} q;

int main() {
    n = read();
    for (int i = 2; i <= n; ++i) p[i] = read();
    for (int i = 1; i <= n; ++i) t[i].s[read()] = 1, t[i].i = fa[i] = i;
    for (int i = 2; i <= n; ++i) q.ins(t[i]);
    long long res = 0;
    for (int i = 2; i <= n; ++i) {
        P u = q.top(), v = t[find(p[u.i])];
        if (v.i != 1) q.del(v);

        q.del(u), res += v.s[1] * u.s[0], v = v + u, fa[u.i] = fa[v.i];
        t[u.i] = u, t[v.i] = v;

        if (v.i != 1) q.ins(v);
    }

    printf("%lld\n", res);
    return 0;
}
const int _SIZE = 1 << 22;
char ibuf[_SIZE], *iS = ibuf, *iT = ibuf;
#define gc                                                         \
    (iS == iT ? iT = ((iS = ibuf) + fread(ibuf, 1, _SIZE, stdin)), \
     (iS == iT ? EOF : *iS++) : *iS++)
int read() {
    int x = 0, f = 1;
    char c = gc;
    while (!isdigit(c)) f = (c == '-') ? -1 : f, c = gc;
    while (isdigit(c)) x = x * 10 + c - '0', c = gc;
    return x * f;
}

Measured memory_bytes: 31592
import java.io.InputStream;
import java.io.PrintStream;
import java.util.Arrays;
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    resolve(System.in, System.out);
  }

  static void resolve(InputStream is, PrintStream pw) {
    Scanner sc = new Scanner(is);
    int n = Integer.parseInt(sc.next());
    int m = Integer.parseInt(sc.next());
    int a[] = new int[n];
    float total = 0;
    for (int i = 0; i < n; i++) {
      a[i] = Integer.parseInt(sc.next());
      total += a[i];
    }
    float border = total / (4 * m);
    Arrays.sort(a);
    boolean ok = true;
    for (int i = 0; i < m; i++) {
      int ai = a[n - 1 - i];
      if (ai < border) {
        ok = false;
        break;
      }
    }
    pw.println(ok ? "Yes" : "No");
  }
}


Measured memory_bytes: 23764
<?php
  fscanf(STDIN, "%d %d", $h, $a);
     $ans = 0;  

	for($i=1; $i<=$h; $i++){
      $ans = $i;
      if($h - ($i * $a) <= 0){
        break;
      }
    }
  echo $ans;
  ?>

Measured memory_bytes: 4728
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<map>
#include<queue>
#include<deque>
#include<iomanip>
#include<tuple>
#include<cassert>
using namespace std;
typedef long long int LL;
typedef pair<int,int> P;
typedef pair<LL,int> LP;
const int INF=1<<30;
const LL MAX=1e9+7;

void array_show(int *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%d%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(LL *array,int array_n,char middle=' '){
	for(int i=0;i<array_n;i++)printf("%lld%c",array[i],(i!=array_n-1?middle:'\n'));
}
void array_show(vector<int> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%d%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}
void array_show(vector<LL> &vec_s,int vec_n=-1,char middle=' '){
	if(vec_n==-1)vec_n=vec_s.size();
	for(int i=0;i<vec_n;i++)printf("%lld%c",vec_s[i],(i!=vec_n-1?middle:'\n'));
}

int main(){
	int n,m;
	int i,j,k;
	int a,b,c;
	cin>>a>>b>>c;
	swap(a,b);
	swap(a,c);
	cout<<a<<" "<<b<<" "<<c<<endl;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
dp = [0] * (N + 1)
for _ in range(M):
    a = int(input())
    dp[a] = -1
dp[0] = 1
dp[1] = 1 if dp[1] != -1 else 0
for i in range(2, N + 1):
    if dp[i] == -1:
        dp[i] = 0
        continue
    dp[i] = dp[i-2] + dp[i-1]
print(dp[N] % 1000000007)


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

using namespace std;

#define pb push_back
#define mk make_pair
#define mod 1000000007
#define ff first
#define ss second

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

ll modpow(ll a, ll b){

    ll ans=1;
    while(b){
        if(b&1){
            ans=(ans*a)%mod;
        }
        a=(a*a)%mod;
        b=b/2;
    }
    return ans;
}

ll fct[100010];

ll dp[100010];

int main(){

    cin.tie(0);
    ios::sync_with_stdio(false);

    fct[0] = 1;

    for(int i = 1; i < 100010; i++) {
        fct[i] = (fct[i-1] * i)%mod;
    }

    dp[1] = 1;

    for(int i = 2; i < 100010; i++) {
        dp[i] = (i * dp[i-1] + fct[i-1])%mod;
    }

    int n;
    cin>>n;

    vector<ll> inp(n);

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

    if(n == 2) {
        cout<<inp[1] - inp[0]<<endl;
        return 0;
    }

    int n1 = n-1;

    vector<ll> coef(n+5);

    if(n1 == 2) {

        coef[1] = 1;
        coef[2] = 3;

    } else {

        ll tmp = fct[n1];
        tmp = (tmp * modpow(2, mod - 2))%mod;

        for(int i = 1; i < n1; i++) {
            ll tmp1 = (i*fct[i])%mod;

            tmp1 = (tmp1 * tmp)%mod;

            coef[i] = tmp1;

            tmp = (tmp * modpow(i + 2, mod - 2))%mod;
        }

        coef[n1] = dp[n1];
    }

    // for(int i = 0; i < n; i++) {
    //     cout<<coef[i]<<" ";
    // }
    // cout<<endl;

    ll ft1 = fct[n1];

    ll ans = 0;

    for(int i = 0; i < n; i++) {
        if(i == n-1) ft1 = 0;
        ll co = (coef[i] - ft1)%mod;

        ans = (ans + co*inp[i])%mod;
    }

    if(ans < 0) ans+=mod;

    cout<<ans<<endl;

}


Measured memory_bytes: 3964