akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define pb push_back
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))//memset only use to initialize 0 or -1 no other number.
#define pii pair<int,int>
#define pll pair<ll,ll>
#define INF 1e9
#define INFL 1e18
#define mod 1000000007
//#define mod 998244353
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
using namespace __gnu_pbds; 
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> os;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> os_pair;

ll power(ll x,ll n){ll res =1;while(n>0){if(n%2==1){res=res*x;}x=x*x;n=n/2;}return res;}
ll powm(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

//cout<< fixed << setprecision(10)

int main()
{
	fast;
	int n,i,j;
	cin>>n;
    string s[n];
    int x=0,y=0,z=0,a=0;
    for(i=0;i<n;i++)
    {
    	cin>>s[i];
    	if(s[i]=="AC")
    	x++;
    	if(s[i]=="WA")
    	y++;
    	if(s[i]=="TLE")
    	z++;
    	if(s[i]=="RE")
    	a++;
	}
	cout<<"AC x "<<x<<"\n";
	cout<<"WA x "<<y<<"\n";
	cout<<"TLE x "<<z<<"\n";
	cout<<"RE x "<<a<<"\n";
    
}

Measured memory_bytes: 6776
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
#include <vector>
#include <numeric>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <queue>
using ll =long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vs = vector<string>;
using vvs = vector<vs>;


ll mod = 1000000000 + 7;

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

    ll R, S, P;
    cin >> R >> S >> P;

    string T;
    cin >> T;

    ll sum = 0;
    vector<char> hist(N, 'a');

    for(ll i=0; i<N; i++){
        if(T.at(i) == 'r') {
            if (i - K >= 0) {
                if (hist.at(i - K) != 'p') {
                    hist.at(i) = 'p';
                    sum += P;
                }
                else {
                    if (i + K < N) {
                        if (T.at(i + K) == 's') {
                            hist.at(i) = 's';
                        } else {
                            hist.at(i) = 'r';
                        }
                    }
                }
            }
            else {
                hist.at(i) = 'p';
                sum += P;
            }
        }
        else if(T.at(i) == 's'){
            if(i-K >= 0) {
                if (hist.at(i - K) != 'r') {
                    hist.at(i) = 'r';
                    sum += R;
                } else {
                    if (i + K < N) {
                        if (T.at(i + K) == 'p') {
                            hist.at(i) = 'p';
                        } else {
                            hist.at(i) = 's';
                        }
                    }
                }
            }
            else {
                    hist.at(i) = 'r';
                    sum += R;
                }
        }
        else{
            if(i-K >= 0){
                if(hist.at(i-K) != 's'){
                    hist.at(i) = 's';
                    sum += S;
                }
                else{
                    if (i + K < N) {
                        if (T.at(i + K) == 'r') {
                            hist.at(i) = 'r';
                        }
                        else {
                            hist.at(i) = 'p';
                        }
                    }
                }
            }
            else{
                hist.at(i) = 's';
                sum += S;
            }
        }
    }

    cout << sum << endl;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<string>

using namespace std;

int main(){
    string kk;
    cin >> kk;
    bool chk1, chk2;
    chk1 = chk2 = false;
    for(int i=0;i<kk.length();i++){
        if(!chk1&&kk[i] == 'C')
            chk1 = true;
        else if(chk1 && kk[i] =='F')
            chk2 = true;
    }
    if(chk2)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}


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

int main()
{
    double x1, y1, x2, y2, q;
    
    cin >> x1 >> y1 >> x2 >> y2;

    q = sqrt(pow(x2-x1,2) + pow(y2-y1,2));
    cout << fixed << setprecision(5) << q << endl;
    
    return 0;
}



Measured memory_bytes: 3296
// Try AtCoder
// author: Leonardone @ NEETSDKASU

fn main() {
    let mut stdin = String::new();
    std::io::Read::read_to_string(&mut std::io::stdin(), &mut stdin).unwrap();
    let mut stdin = stdin.split_whitespace();
    let mut get = || stdin.next().unwrap();
    macro_rules! get {
        ($t:ty) => (get().parse::<$t>().unwrap());
        () => (get!(i64));
    }
    
    let n = get!(usize);
    let s = get().as_bytes();
    let mut ans = 0;
    let mut last = b' ';
    for i in 0 .. n {
        if s[i] != last {
            ans += 1;
        }
        last = s[i];
    }
    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
const ll mod=1000000007;
const int MAX_N = 1000;         // n の最大値

// nCk を取得
void f(int res , string s){
     if(res==0){
       cout << s << endl;}
   else{
     for(char c='a'; c<='c'; c++){
        f(res -1, s + c);}
   }
}
double nCk(int n, int k) {
double res=1.0;
for(int i=0; i<n; i++){
res*=0.5;}
for(int i=0; i<k; i++){
res*=(double)(n-i);
res/=(double)(k-i);
}
return res;}

int main() {
int N;
cin>>N;
int a[N]={};
int ca=0;
int d=0;
int u=0;
int ma=0;
int mi=0;
for(int i=0; i<N; i++){
cin>>a[i];}
for(int i=0; i<N-1; i++){
ma=max(ma,a[i]);
mi=min(mi,a[i]);
if(d==0&&a[i]>a[i+1]){
ca+=a[i]-mi;
d++;
ma=0;
mi=a[i+1];}
else if(a[i]<a[i+1]){
d=0;}}
ma=max(ma,a[N-1]);
if(d==0){
ca+=a[N-1]-mi;}
cout<<ca<<endl;}


Measured memory_bytes: 3636
#include<bits/stdc++.h>
#define rep(i, n) for(int (i)=0 ;i <(n); ++(i))
#define REP(i,m,n) for(int (i) = (m); (i) <= (n); ++(i))
#define yorn(f) puts((f)?"Yes":"No")
#define YORN(f) puts((f)? "YES":"NO")
typedef long long ll;
using namespace std;

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

  bool f = false;
  if(s<t) f = true;
  yorn(f);
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using static Input;

public class Prog
{
    public struct Pair { public int x, y; public Pair(int x, int y) { this.x = x; this.y = y; } }
    public static void Solve()
    {
        int N = NextInt();
        int[] A = LineInt();
        string ans = "Yes";
        int sum = 0;
        for (int i = 0; i < N; i++) sum ^= A[i];
        if (sum != 0) ans = "No";
        Console.WriteLine(ans);
    }
    public static void Main()
    {
        var sw = new System.IO.StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
    public static long RepPow(long x, long p, long m = 1000000007)
    {
        if (p == 0) return 1;
        if (p == 1) return x % m;
        long b = RepPow(x, p / 2, m) % m;
        if (p % 2 == 0) { return (b * b) % m; }
        else { return (x * ((b * b) % m)) % m; }
    }
}
public class Input
{
    public const long MOD = 1000000007;
    public const int INF = 1000000007;
    private static Queue<string> q = new Queue<string>();
    private static void Confirm() { if (q.Count == 0) foreach (var s in Console.ReadLine().Split(' ')) q.Enqueue(s); }
    public static int NextInt() { Confirm(); return int.Parse(q.Dequeue()); }
    public static long NextLong() { Confirm(); return long.Parse(q.Dequeue()); }
    public static string NextString() { Confirm(); return q.Dequeue(); }
    public static double NextDouble() { Confirm(); return double.Parse(q.Dequeue()); }
    public static int[] LineInt() { return Console.ReadLine().Split(' ').Select(int.Parse).ToArray(); }
    public static long[] LineLong() { return Console.ReadLine().Split(' ').Select(long.Parse).ToArray(); }
    public static string[] LineString() { return Console.ReadLine().Split(' ').ToArray(); }
    public static double[] LineDouble() { return Console.ReadLine().Split(' ').Select(double.Parse).ToArray(); }
    public long Abs(long a, long b) => Math.Abs(a - b);
}


Measured memory_bytes: 20576
#include <bits/stdc++.h>
using namespace std;
using ll = long long ;
using P = pair<ll, ll>;
using Vec = vector<ll>;
#define FOR(i, m, n) for(ll (i) = (m); (i) < (n); (i)++)
#define FORN(i, m, n) for(ll (i) = (m); (i) <= (n); (i)++)
#define FORR(i, m, n) for(ll (i) = (m); (i) >= (n); (i)--)
#define rep(i, n) FOR(i, 0, n)
#define repn(i, n) FORN(i, 1, n)
#define repr(i, n) FORR(i, n, 0)
#define repnr(i, n) FORR(i, n, 1)
#define co(n) cout << (n) << endl
#define cosp(n) cout << (n) << ' '
#define setp(n) cout << fixed << setprecision(n);
#define all(s) (s).begin(), (s).end()
#define pb push_back
#define mp make_pair
#define fs first
#define sc second

const ll INF = 1e9+1;
const ll LINF = 1e18+1;
const ll MOD = 1e9+7;
//const ll MOD = 998244353;
const double PI = acos(-1);
const double EPS = 1e-9;

int main(void){
	ll n;
	cin >> n;
	ll a = n%10;
	ll b = n/100;
	if(a == b) puts("Yes");
	else puts("No");

	return 0;
}


Measured memory_bytes: 256
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n
    
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return
        
        # 根のparentsはそのグループの要素数 * (-1) がはいる
        if self.parents[x] > self.parents[y]:
            x, y = y, x

        # 要素数の大きい方に小さい方をくっつける        
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())



N, M = map(int, input().split())
uf = UnionFind(N)
ans = 1

for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    uf.union(a, b)
    ans = max(ans, uf.size(a))

print(ans)


Measured memory_bytes: 76996
#ifdef DEBUG_IS_VALID
#define DEB 1 
#define _LIBCPP_DEBUG 0
#else
#define DEB 0
#define NDEBUG
#endif

#include <bits/stdc++.h>
using namespace std;

#define ALL(g) (g).begin(),(g).end()
#define REP(i, x, n) for(int i = x; i < n; i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i, x, n) for(int i = x; i >= n; i--)
#define rrep(i, n) RREP(i,n,0)
#define pb push_back
#define fi first
#define se second
#pragma GCC optimize ("-O3")

using namespace std;

#define DUMPOUT cout
#define dump(...) if(DEB) DUMPOUT<<"  "<<#__VA_ARGS__<<" :["<<__LINE__<<":"<<__FUNCTION__<<"]"<<endl<<"    "; if(DEB) dump_func(__VA_ARGS__)
template<typename T1,typename T2>ostream& operator << (ostream& os, pair<T1,T2> p){cout << "(" << p.first << ", " << p.second << ")"; return os;}
template<typename T>ostream& operator << (ostream& os, vector<T>& vec) { os << "{"; for (int i = 0; i<vec.size(); i++) os << vec[i] << (i + 1 == vec.size() ? "" : ", "); os << "}"; return os; }
template<typename T>ostream& operator << (ostream& os, set<T>& st){cout << "{"; for(auto itr = st.begin(); itr != st.end(); itr++) cout << *itr << (next(itr)!=st.end() ? ", " : ""); cout << "}"; return os;}
template<typename T1,typename T2>ostream& operator << (ostream& os, map<T1,T2> mp){cout << "{"; for(auto itr = mp.begin(); itr != mp.end(); itr++) cout << "(" << (itr->first) << ", " << (itr->second) << ")" << (next(itr)!=mp.end() ? "," : ""); cout << "}"; return os; }

void dump_func(){DUMPOUT << endl;}
template <class Head, class... Tail>void dump_func(Head&& head, Tail&&... tail){ DUMPOUT << head; if (sizeof...(Tail) == 0) { DUMPOUT << " "; } else { DUMPOUT << ", "; } dump_func(std::move(tail)...);}
template<class T> inline bool chmax(T& a,T const& b){if(a>=b) return false; a=b; return true;}
template<class T> inline bool chmin(T& a,T const& b){if(a<=b) return false; a=b; return true;}

using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vp = vector<Pl>;
using vvp = vector<vp>;

const int INF = 1<<29;
const long long LINF=1LL<<59;

const string YES = "YES";
const string NO = "NO";
void yn(bool ok){
  cout << (ok ? YES : NO) << endl;
}

void solve(long long N, std::vector<long long> p){
  auto chk = [&](const vl& x){
    bool res = true;
    rep(i,N-1) res &= (x[i]<x[i+1]);
    return res;
  };
  bool ok = chk(p);
  rep(i,N-1) REP(j,i+1,N){
    swap(p[i],p[j]);
    ok |= chk(p);
    swap(p[i],p[j]);
  }
  yn(ok);
}

int main(){
  std::cout << std::fixed << std::setprecision(15);
  long long N;
  scanf("%lld",&N);
  std::vector<long long> p(N);
  for(int i = 0 ; i < N ; i++){
    scanf("%lld",&p[i]);
  }
  solve(N, std::move(p));
  return 0;
}


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

int main() {
  int N, M;
  cin >> N;
  vector<string>s(N);
  for(int i=0; i<N; i++)cin >> s.at(i);
  cin >> M;
  vector<string>t(M);
  for(int i=0; i<M; i++)cin >> t.at(i);
  
  int red =0;
  int blue=0;
  int money = 0;
  sort(s.begin(), s.end());
  sort(t.begin(), t.end());
  
  for(int i=0; i<N; i++){
    for(int j=0; j<N; j++){
      if(s.at(i)==s.at(j))blue++;
    }
    for(int j=0; j<M; j++){
      if(s.at(i)==t.at(j))red++;
    }
    money = max(money, blue-red);
    red=0; blue=0;
  }
  
  cout << money << endl;
}

Measured memory_bytes: 3636
using System;
class Program {
  static void Main(string[] args) {
    int n = int.Parse(Console.ReadLine());
    int all = 0;
    int biggest = 0;
    int num_buffer;
    for (int cnt = 0; cnt < n; cnt++) {
      num_buffer = int.Parse(Console.ReadLine());
      all += num_buffer;
      if (biggest < num_buffer) biggest = num_buffer;
    }
    all -= biggest / 2;
    Console.WriteLine(all);
  }
}

Measured memory_bytes: 13140
#include <stdio.h>

int main(void)
{
	int x, n[26];
	char c;
	
	for(x = 0; x < 26; x++){
		n[x] = 0;
	}
	
	while((c = getchar()) != EOF){
		if(('A' <= c) && (c <= 'Z')){
			n[c-'A']++;
		}else if(('a' <= c) && (c <= 'z')){
			n[c-'a']++;
		}
	}
	
	for(x = 0; x < 26; x++){
		printf("%c : %d\n", x+'a', n[x]);
	}
	
	return(0);
}



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

using namespace std;

int main(){

  string s;
  cin>>s;
  
  int cnt_a=200010;
  int cnt_z=0;


  for(int i=0; i<s.size(); i++){
    
    if(s[i]=='A') cnt_a=min(cnt_a, i);
    else if(s[i]=='Z') cnt_z=max(cnt_z, i);
  }

  cout<<cnt_z - cnt_a +1 <<endl;
}


Measured memory_bytes: 3772
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial, log, log10, log2
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
from datetime import datetime as dt

def main():
  n = int(readline())
  x = [0] *n
  y = [0]*n
  for i in range(n):
    x[i], y[i] = map(int, readline().split())
  dis = [[0 for i in range(n)]for j in range(n)]
  total = 0
  for i in range(n):
    for j in range(i+1,n):
      total += 2*((x[i]-x[j])**2+(y[i]-y[j])**2)**0.5
  print(total/n)
  
  
  
  
if __name__ == '__main__':
  main()

Measured memory_bytes: 14296
#include <bits/stdc++.h>
using namespace std;
const int maxn=2e5+10;
typedef long long ll;
int a[maxn],b[maxn];
signed main()
{
    int k,n;
    while(~scanf("%d%d",&k,&n))
    {
        scanf("%d",&a[1]);
        for(int i=2;i<=n;i++)
        {
            scanf("%d",&a[i]);
            b[i-1]=a[i]-a[i-1];
        }
        int sum=0;
        b[n]=k+a[1]-a[n];
        int maxx=0;
        for(int i=1;i<=n;i++)
        {
            maxx=max(maxx,b[i]);
            sum+=b[i];
        }
        sum-=maxx;
        printf("%d\n",sum);
    }
    return 0;
}

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

public class Main {

	final static long MOD = 1000000007;
	public static String[] Ws = null;
	public static int wsIndx = 0;
	public static BufferedReader in = null;
	public static void main(String[] args) throws Exception {
		solution(args);
		if(in!=null){
			in.close();
		}
	}

	public static void solution(String[] args) throws Exception{

		int A=nextInt();
		int B=nextInt();
		int C=nextInt();


		String ans = "No";

		if(A<=C&&C<=B)
			ans="Yes";
		
		System.out.println(ans);

	}

	public static boolean isPalindromicStr(String s) {
		int h = 0;
		int t = s.length() - 1;
		while (h <= t) {
			if (s.charAt(h) != s.charAt(t)) {
				break;
			}
			h++;
			t--;
		}
		if (h > t) {
			return true;
		}
		return false;
	}
	public static String[] toStringArray(String s) {
		String[] tmp = new String[s.length()];
		char[] c = s.toCharArray();
		for (int i = 0; i < tmp.length; i++) {
			tmp[i] = String.valueOf(c[i]);
		}
		return tmp;
	}

	public static void check() throws Exception{
		if(in == null){
			in = new BufferedReader(new InputStreamReader(System.in));
		}
		if(Ws==null || Ws.length<=wsIndx){
			Ws = in.readLine().split(" ");
			wsIndx=0;
		}
	}
	public static int nextInt()throws Exception{
		check();
		return Integer.parseInt(Ws[wsIndx++]);
	}

	public static long nextLong()throws Exception{
		check();
		return Long.parseLong(Ws[wsIndx++]);
	}

	public static String nextString()throws Exception{
		check();
		return Ws[wsIndx++];
	}

	public static int[] nextInts()throws Exception{
		check();
		int[] tmp = new int[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Integer.parseInt(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static long[] nextLongs()throws Exception{
		check();
		long[] tmp = new long[Ws.length];
		for(int i=0;i<tmp.length;i++){
			tmp[i]=Long.parseLong(Ws[i]);
		}
		wsIndx=Ws.length;
		return tmp;
	}

	public static String[] nextStrings()throws Exception{
		check();
		wsIndx=Ws.length;
		return Ws;
	}


}


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

int n, a[2005], ans = 0;

int main(){
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	sort(a+1, a+1+n);
	for(int i = 1; i <= n; i++)
		for(int j = i+1; j <= n; j++)
			for(int k = j+1; k <= n; k++) {
				if(a[i]+a[j] > a[k]) ans++;
				else break;
			}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 256
import copy
def bs(array):
    for i in range(len(array)-1):
        for c in range(len(array)-1, i,-1):
            if array[c][1] < array[c-1][1]:
                swap = array[c]
                array[c] = array[c-1]
                array[c-1] = swap
    return array
def ss(array):
    for i in range(len(array)):
        minj = i
        for c in range(i+1,len(array)):
            if array[minj][1] > array[c][1]:
                minj = c
        swap = array[i]
        array[i] = array[minj]
        array[minj] = swap
    return array
def isStable(ar1,ar2):
    flag = 0
    for (x,y) in zip(ar1,ar2):
        if x != y:
            flag = 1
            break
    if flag == 0:
        print('Stable')
    else:
        print('Not stable')


n = input()
arr = [[i[0],int(i[1])] for i in input().split()]
arr1 = copy.deepcopy(arr)
arr2 = copy.deepcopy(arr)

bsarr = bs(arr2)
ssarr = ss(arr1)
print(' '.join([''.join([ x[0], str(x[1]) ]) for x in bsarr]))
print('Stable')
print(' '.join([''.join([ x[0], str(x[1]) ]) for x in ssarr]))
isStable(bsarr,ssarr)

Measured memory_bytes: 8264
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;






int main(void) 
{
	int N;
	cin >> N;
	int n=0;
	for (int i=0; i< N; i++) {
		int l,r;
		cin >> l >> r;
		n += (r - l) +1;
	}

	cout << n << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define pb push_back
#define ll long long int
#define pii pair<int,int>
#define mii map<int,int>
#define f first
#define s second
#define mp make_pair
using namespace std;
 
int main() 
{
	int n,r,rr;
  cin>>n>>r;
   if(n<10)
     rr=100*(10-n)+r;
  else
      rr=r;
   cout<<rr<<"\n";
	return 0;
}

Measured memory_bytes: 256
#ifdef __APPLE__
#include<cassert>
#include<iostream>
#include<iomanip>
#include<ctime>
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>
#include<queue>
#include<stack>
#include<string>
#include<cstring>
#include<sstream>
#include<map>
#include<set>
#include<stdio.h>
#include<string.h>
#include<math.h>
#include <cstring>
#include <cctype>
#include <list>
#include <cmath>
#include <limits>
#include <iomanip>
#include <bitset>
#include <numeric>
#include <climits>
#else
#include<bits/stdc++.h>
#endif  // __APPLE__
using namespace std;
typedef pair<int,int>   PII;
typedef vector<PII>     VPII;
typedef vector<int>     VI;
typedef vector< VI > 	VVI;
typedef long long int LL;
typedef  unsigned long long int ULL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define SET(a,b) memset(a,b,sizeof(a))
#define LET(x,a) __typeof(a) x(a)
#define ALL(c) (c).begin(),(c).end()
#define si(n) scanf("%d",&n)
#define dout(n) printf("%d\n",n)
#define sll(n) scanf("%lld",&n)
#define lldout(n) printf("%lld\n",n)
#define fast_io ios_base::sync_with_stdio(false);cin.tie(NULL)
#define REP(i,a,b) for(int i = (int)a; i < (int)b; i++)
#define ROUNDOFFINT(d) d = (int)((double)d + 0.5)	//Round off d to nearest integer
//#define FLUSHN while(gu()!='\n')
//#define FLUSHS while(gu()!=' ')
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define trace(...)
#endif
int a[10];
bool ok(int n)
{
    bool ok=true;
    while(n)
    {
        if(a[n%10])
            ok=false;
        n/=10;
    }
    return ok;
}
int main()
{
    //fr;fw;
    fast_io;
    int n,k;
    cin>>n>>k;
    REP(i,0,k)
    {
        int x;
        cin>>x;
        a[x]=1;
    }
    while(1)
    {
        if(ok(n++))
        {
            cout<<n-1<<endl;
            return 0;
        }
    }
    return 0;
}

Measured memory_bytes: 256
//by Judge
#include<bits/stdc++.h>
#define Rg register
#define fp(i,a,b) for(Rg int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(Rg int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(Rg int i=head[u],v=e[i].to;i;v=e[i=e[i].nxt].to)
#define Go(u) for(Rg int &i=cur[u],v=e[i].to;i;v=e[i=e[i].nxt].to)
#define ll long long
using namespace std;
const int inf=1e9+7;
const int M=2e5+3;
typedef int arr[M];
#ifndef Judge
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
#endif
char buf[1<<21],*p1=buf,*p2=buf;
inline int read(){ int x=0,f=1; char c=getchar();
	for(;!isdigit(c);c=getchar()) if(c=='-') f=-1;
	for(;isdigit(c);c=getchar()) x=x*10+c-'0'; return x*f;
} char sr[1<<21],z[20];int CCF=-1,Z;
inline void Ot(){fwrite(sr,1,CCF+1,stdout),CCF=-1;}
inline void print(int x,char chr='\n'){
	if(CCF>1<<20)Ot();if(x<0)sr[++CCF]=45,x=-x;
	while(z[++Z]=x%10+48,x/=10);
	while(sr[++CCF]=z[Z],--Z);sr[++CCF]=chr;
} int n,m,tot,S,T,ans,pat=1; map<int,int> E[M];
arr p,q,a,b,head,cur,d;
struct Edge{ int to,flow,nxt; }e[M<<2];
inline void add(int u,int v,int w){
	e[++pat]=(Edge){v,w,head[u]},head[u]=pat;
	e[++pat]=(Edge){u,0,head[v]},head[v]=pat;
} queue<int> Q;
inline bool bfs(){
	memset(d,0,sizeof(d)),d[S]=1;
	while(Q.size()) Q.pop();
	for(Q.push(S);Q.size();){
		int u=Q.front(); Q.pop();
		go(u) if(!d[v]&&e[i].flow){
			Q.push(v),d[v]=d[u]+1;
			if(v==T) return true;
		}
	} return false;
}
inline int Min(int x,int y){ return x<y?x:y; }
int dinic(int u,int flow){
	if(u==T) return flow; int rest=flow,k;
	Go(u) if(d[v]==d[u]+1&&e[i].flow)
		k=dinic(v,Min(rest,e[i].flow)),
		e[i].flow-=k,e[i^1].flow+=k,rest-=k;
	return flow-rest;
}
int main(){ n=read();
	fp(i,1,n) p[i]=read()+1;
	fp(i,1,n) q[i]=read()+1;
	fp(i,1,n) if(!a[i]){ ++tot; Rg int now=i;
		do a[now]=tot,now=p[now]; while(!a[now]);
	}
	fp(i,1,n) if(!b[i]){ ++tot; Rg int now=i;
		do b[now]=tot,now=q[now]; while(!b[now]);
	}
	S=0,T=++tot;
	fp(i,1,n){
		if(p[i]==q[i]){
			if(i==p[i]) continue; ++ans;
			++E[a[i]][b[i]],++E[b[i]][a[i]];
		} else{ ++ans;
			if(i==p[i]) ++E[S][b[i]];
			else if(i==q[i]) ++E[a[i]][T];
			else ++E[a[i]][b[i]];
		}
	}
	fp(i,S,T) for(auto e: E[i])
		add(i,e.first,e.second);
	for(;bfs();ans-=dinic(S,inf))
		memcpy(cur,head,(n+2)<<2);
	return !printf("%d\n",ans);
}

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

int area(int d) {
    int i, x, y, s;
        s = 0;
        x = 600;
        i = 1;
        for(i = 1; d * i <= 600 - d; i++){
            y = (d * i) * (d * i);
            s += d * y;
        }
        
        
    return s;
    }

int main(void){
    int d;
    while(scanf("%d", &d) != EOF) {
       printf("%d\n", area(d));
    }
    return 0;
}


Measured memory_bytes: 3204
#[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 ) * } } ; }
#[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 , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

fn main() {
    input! {
        n: u64
    }

    println!("{}", if n % 2 == 0 {n} else {n*2});
}

Measured memory_bytes: 4352
# Xとx_iを同一視する。
n, m, x, y = map(int, input().split())
x_list = [int(_) for _ in input().split()]
x_list.append(x)
y_list = [int(_) for _ in input().split()]
y_list.append(y)
x_max = max(x_list)
y_min = min(y_list)
if x_max < y_min:
    print("No War")
else:
    print("War")


Measured memory_bytes: 3060
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int mod=998244353;
struct point{
	int x,y;
	point(){};
}p[210];

int n;
ll pw[210],ans;
point operator - (point a,point b){
	point ret;
	ret.x=a.x-b.x;
	ret.y=a.y-b.y;
	return ret;
}
ll cross(point a,point b){
	return a.x*b.y-a.y*b.x;
}
ll cross(point a,point b,point c){
	return abs(cross(a-c,b-c));
}
void solve(){
	cin>>n;pw[0]=1;
	for(int i=1;i<=n;++i){
		cin>>p[i].x>>p[i].y;
		pw[i]=pw[i-1]*2%mod;
	}
	ans=pw[n]-1-n;
	for(int i=1;i<=n;++i)
		for(int j=i+1;j<=n;++j){
			int cnt=0;
			for(int k=j+1;k<=n;++k)if(cross(p[i],p[j],p[k])<=0)++cnt;
			(ans+=mod-pw[cnt])%=mod;
		}
	printf("%lld\n",ans);
}
int main(){
	solve();
	
	return 0;
} 

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

#define ln                '\n'
#define all(dat)           dat.begin(), dat.end()
#define loop(i, to)        for (int i = 0; i < to; ++i)
#define cont(i, to)        for (int i = 1; i <= to; ++i)
#define circ(i, fr, to)    for (int i = fr; i <= to; ++i)
#define foreach(i, dat)    for (__typeof(dat.begin()) i = dat.begin(); i != dat.end(); ++i)

typedef long long          num;

using namespace std;

const int nsz = 14;
int n;
num k, p = 1, f[nsz + 5] = {1}, dp[nsz + 5][127], ans;
string s;
vector<int> cur, ds, dat;
vector<vector<int>> ps;

void dfs1(int i = 0, int lst = 0, int sum = 0) {
    if (sum > k)  return;
    if (i == n) {
        if (sum == k) {
            num tmp = 1;
            loop (i, cur.size()) {
                tmp *= cur[i] + 1;
            }
            if (tmp < p) {
                num cnt = 1, del = f[n];
                loop (i, cur.size() - 1) {
                    if (cur[i + 1] != cur[i]) {
                        del /= f[cnt];
                        cnt = 0;
                    }
                    ++cnt;
                }
                del /= f[cnt];
                ans += del;
            } else if (tmp == p) {
                ps.push_back(cur);
            }
        }
        return;
    }
    circ (d, lst, 9) {
        cur.push_back(d);
        dfs1(i + 1, d, sum + d);
        cur.pop_back();
    }
}

void dfs2(int me, int id = 0, vector<int> cur = {}) {
    if (id && cur[id - 1] < dat[id - 1]) {
        num cnt = 1, del = f[n - id];
        loop (i, ps[me].size() - 1) {
            if (ps[me][i + 1] != ps[me][i]) {
                del /= f[cnt];
                cnt = 0;
            }
            ++cnt;
        }
        del /= f[cnt];
        ans += del;
        return;
    } else if (id && cur[id - 1] > dat[id - 1])  return;
    if (ps[me].empty())  return;
    loop (i, ps[me].size()) {
        if (i && ps[me][i] == ps[me][i - 1])  continue;
        int tmp = ps[me][i];
        ps[me].erase(ps[me].begin() + i);
        cur.push_back(tmp);
        dfs2(me, id + 1, cur);
        cur.pop_back();
        ps[me].insert(ps[me].begin() + i, tmp);
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin >> s;
    n = (int) s.size();
    cont (i, n) {
        f[i] = f[i - 1] * i;
    }
    loop (i, s.size()) {
        k += s[i] ^ 48;
        p *= (s[i] ^ 48) + 1;
        dat.push_back(s[i] ^ 48);
        ds.push_back(s[i] ^ 48);
    }
    sort(all(ds));
    dp[0][0] = 1;
    loop (i, n) {
        circ (j, 0, i * 9) {
            circ (d, 0, 9) {
                dp[i + 1][j + d] += dp[i][j];
            }
        }
    }
    loop (i, k) {
        ans += dp[n][i];
    }
    dfs1();
    loop (i, ps.size()) {
        dfs2(i);
    }
    cout << ans << ln;
}



Measured memory_bytes: 3264
#include<bits/stdc++.h>
using namespace std;
#define Fast ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define int unsigned long long
typedef vector<int>Vl;
typedef pair<int,int>pii;
typedef vector<pii>Vll;
typedef vector<pair<int,pii> >Vlll;
typedef priority_queue<int>PQL;
typedef map<int,int>M;
#define S second
#define F first
#define mp make_pair
#define ms(x,y) memset(x,y,sizeof(x))
#define pb push_back
#define sl(n) cin>>n
#define pl(n) cout<<n
const int mod=1e9+7;
const int sze=1e5+2;
const int inf= (int)(1000000000000000000);
void solve()
{
 long double a,b;
 sl(a);sl(b);
 int x=(1.0*a*b);
 cout<<x<<endl;
}
 
signed main(){
   int test=1;
   //sl(test);
   while(test--){
      solve();
 
   }
  return 0;
}


Measured memory_bytes: 3728
#include <iostream>
#include <complex>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <ctime>
#include <cstdlib>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <cmath>
#include <bitset>
#include <cassert>
#include <queue>
#include <stack>
#include <deque>
#include <random>
#include <iomanip>
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
const ll MOD=1000000007;
const ll MAX_N=500010;
const ll INF=999999999999;

int main(){
    ll n;
    cin>>n;
    string s;
    cin>>s;
    vector<ll> E(n,0);
    vector<ll> W(n,0);
    if(s[0]=='W') W[0]=1;
    if(s[n-1]=='E') E[n-1]=1;
    for(ll i=1;i<n;i++){
        if(s[i]=='W') W[i]=1;
        W[i]+=W[i-1];
    }
    for(ll i=n-2;i>=0;i--){
        if(s[i]=='E') E[i]=1;
        E[i]+=E[i+1];
    }
    ll ans=INF;
    for(ll i=0;i<n;i++){
        ans=min(ans,W[i]+E[i]-1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 5380
#include <iostream>
#include <cstdlib>
#include <list>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
 
int main(void)
{
    int N, X, L[10000];
 
    cin >> N >> X;
    for (auto i = 0; i < N; ++i) 
    {
        cin >> L[i];
    }

    int d = 0;
    int n = 1;
    for (auto i = 0; i < N; ++i)
    {
        d = d + L[i];
       // cout << d << endl;
        if (d > X) break;
        ++n;
    }

    cout << n << endl;
    
    return 0;
}


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

using namespace std;

int dp[101][101][5],w,h;

int func(int i, int j, int p){
  if(i>w || j>h)return 0;
  if(i==w && j==h)return 1;
  if(dp[i][j][p]>0)return dp[i][j][p];

  int res=0;
  if(p==1)res=func(i,j+1,3);
  else if(p==2)res=func(i+1,j,4);
  else if(p==3)res=func(i+1,j,2)+func(i,j+1,3); 
  else if(p==4)res=func(i+1,j,4)+func(i,j+1,1);
  else if(p==0)res=func(i,j+1,3)+func(i+1,j,4);

  return dp[i][j][p]=res%100000;
}

int main(void){

  while(cin >> w >> h,w|h){
    for(int i=0;i<=w;i++)
      for(int j=0;j<=h;j++)
	for(int p=0;p<5;p++)
	dp[i][j][p]=0;

    cout << func(1,1,0) << endl;
  }

  return 0;
}

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

#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) cin>>aa;(p).push_back(aa);
#define vecpl2(p) long long a	b;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));
#define doublece(a,b) cout<<(a)<<' '<<(b)<<endl;
#define pairs(s) vector<pair<int,int>> (s);
#define pairsl(s) vector<pair<ll,ll>> (s);
#define pairss(s) vector<pair<string,string>> (s);
#define pairsp(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairspl(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsps(s) int aa,bb;cin>>aa>>bb;(s).push_back(make_pair(aa,bb));
#define pairsREV(s) (s).push_back(make_pair(bb,aa));
#define pairslREV(s) (s).push_back(make_pair(bb,aa));
#define pairssREV(s) (s).push_back(make_pair(bb,aa));
#define MOD 1000000007

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

	double ans;
	if (N%2==0) {
		ans = N / 2;
	}
	else {
		ans = N / 2 + 1;
	}
	ce(ans/N)
    return 0;
}



Measured memory_bytes: 256
/*calculated in advance*/a[101]={0,0,0,61,230,865,3247,12185,45719,171531,643550,2414454,9058467,33985227,127504505,478366600,794717734,733354121,261943303,776803305,580025381,51688048,44657419,737209731,604119499,159693437,858533109,639056669,549054109,996291083,531294469,23314687,783022045,855462856,649970414,68697295,409213624,604356692,88638656,978442997,534833116,763737161,785892908,123883652,639213333,181836645,998121103,124885216,501575626,39816123,113468411,799008836,775465589,256852905,664630886,971550783,751629411,51018086,702530485,725438992,696683714,792638194,221791721,149602322,414054379,986519078,981760191,305799096,515140586,406959393,975058685,245601370,324759692,673385295,191483611,570246669,427196161,781042769,569725155,842176273,25328739,847501730,206282374,353770801,323137024,371653459,940737264,123820509,915711339,847205021,252858375,718889563,866398347,738390145,133009077,333099663,170591295,329869205,616680192,597534442,388130742};main(n){scanf("%d",&n);printf("%d",a[n]);}

Measured memory_bytes: 1720
#include<iostream>
#include<numeric>
#include<math.h>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<iomanip>
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,from,to) for(int i=from;i<to;i++)
#define repd(i,from,till) for(int i=from;i>=till;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define mod 1e9+7
#define inf1 1e18+1
#define pie 3.14159265358979323846
#define N 100005
using namespace std;

void solve(){
	int n;
	cin>>n;
	int a,b;
	cin>>a>>b;
	cout<<min(n*a,b)<<endl;
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <string>
#include <cstring>
#include <queue>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <map>
#include <numeric>
#include <functional>
#include <cmath>
#include <cassert>
#include <string>
#include <iostream>

using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, ll> PL;
const ll mod = 1000000007;
const ll MOD = 1000000007;
const ll INF = 1LL << 60;
#define PI (acos(-1))

ll lcm(ll a, ll b)
{
    return a * b / __gcd(a, b);
}
vector<ll> divisor(ll n)
{
    vector<ll> ret;
    for (ll i = 1; i * i <= n; i++)
    {
        if (n % i == 0)
        {
            ret.push_back(i);
            if (i * i != n)
                ret.push_back(n / i);
        }
    }
    sort(begin(ret), end(ret));
    return (ret);
}

const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];
// テーブルを作る前処理
void COMinit()
{
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++)
    {
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
// 二項係数計算
ll COM(ll n, ll k)
{
    if (n < k)
        return 0;
    if (n < 0 || k < 0)
        return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll solve()
{
    
    ll a,b,h;
    cin >> a >> b >> h;
    cout << (a + b) * h / 2 << endl;

    return 0;
}

int main()
{
    //cout.precision(10);
    ios::sync_with_stdio(false);
    cin.tie(0);

    solve();
}


Measured memory_bytes: 256
def main():
    N, M = map(int, input().split())
    root_dict = dict()
    ans = [0] * N
    remaining_set = {i for i in range(2, N+1, 1)}
    for i in range(1, N+1, 1):
        root_dict[i] = set()
    for i in range(M):
        AB = list(map(int, input().split()))

        root_dict[AB[0]].add(AB[1])
        root_dict[AB[1]].add(AB[0])

    next_nodes = dict()
    next_nodes[1] = root_dict[1].copy()
    
    org_node = 1
    while(next_nodes):
        next_next_nodes = dict()
        if(len(remaining_set) == 0):
            break
        for org_node, nodes in next_nodes.items():
            for node in nodes:

                if(node in remaining_set):
                    ans[node-1] = org_node
                    remaining_set.remove(node)
                    if(node in next_next_nodes):
                        next_next_nodes.clear(node)
                    next_next_nodes_set = root_dict[node].intersection(remaining_set).difference(nodes)
                    if(len(next_next_nodes_set) != 0):
                        if(node in next_next_nodes):
                            next_next_nodes[node] = next_next_nodes[node].union(next_next_nodes_set)
                        else:
                            next_next_nodes[node] = next_next_nodes_set.copy()
                else:
                    continue
        next_nodes = next_next_nodes.copy()
    
    if(len(remaining_set) != 0):
        print("No")
    else:
        for i in range(N):
            if(i==0):
                print("Yes")
            else:
                print(ans[i])
    



main()

Measured memory_bytes: 95616
#include <bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define pii pair < int , int >
#define F first
#define S second
#define int long long
#define sync ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#pragma GCC optimize ("Ofast")
using namespace std;
/// khodaya komak kon
/// ya navid navid
const int N=1e6+10,M=21,mod=1e9+7;
ll a[N];
map <int,int> mp;
int32_t main(){
    ll n;
    cin >> n;
    ll ans=0;
    vector <int> b;
    for (int i=1;i<=n;i++){
        cin >> a[i];
        b.pb(a[i]);
    }
    sort(b.begin(),b.end());
    for (int i=1;i<=n;i++){
        mp[b[i-1]]=i;
    }
    for (int i=1;i<=n;i++){
        a[i]=mp[a[i]];
    }
    for (int i=1;i<=n;i++){
        if (a[i]%2!=i%2){
            ans++;
        }
    }
    cout << ans/2;
}


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

int h, w, k;
int ans = 0;
char c[6][6];

void judge(int wi, int hi, int h_b, int w_b)
{
    int black = 0;
    if(hi == -1 && wi == -1)
    {
        char c_cp[6][6];
        for(int i=0; i<h; i++)
        {
            for(int j=0; j<w; j++)
            {
                c_cp[i][j] = c[i][j];
            }
        }
        for(int i=0; i<w; i++)
        {
            if(w_b & 1 << i)
            {
                for(int j=0; j<h; j++)
                {
                    c_cp[j][i] = 'r';
                }
            }
        }
        for(int i=0; i<h; i++)
        {
            if(h_b & 1 << i)
            {
                for(int j=0; j<w; j++)
                {
                    c_cp[i][j] = 'r';
                }
            }
        }
        for(int i=0; i<h; i++)
        {
            for(int j=0; j<w; j++)
            {
                if(c_cp[i][j] == '#') black++;
            }
        }
        if(black == k)
        {
            for(int i=0; i<h; i++)
            {
                for(int j=0; j<w; j++)
                {
  //                  cout << c_cp[i][j];
                }
 //               cout << endl;
            }
            ans++;
//            cout << endl;
        }
    }
    else if(hi == (h-1) && wi == (w-1))
    {
        judge(-1, -1, h_b, w_b);
        h_b += 1 << hi;
        judge(-1, -1, h_b, w_b);
    }
    else if(wi == (w-1) && hi == -1)
    {
        judge(wi, hi+1, h_b, w_b);
        w_b += 1 << wi;
        judge(wi, hi+1, h_b, w_b);
    }
    else if(wi == (w-1))
    {
        judge(wi, hi+1, h_b, w_b);
        h_b += 1 << hi;
        judge(wi, hi+1, h_b, w_b);
    }
    else
    {
        judge(wi+1, hi, h_b, w_b);
        w_b += 1 << wi;
        judge(wi+1, hi, h_b, w_b);
    }
    return;
}

int main() {
    int black = 0;
    int h_b = 0;
    int w_b = 0;
    string s;
    cin >> h >> w >> k;
    for(int i=0; i<h; i++)
    {
        cin >> s;
        for(int j=0; j<w; j++)
        {
            c[i][j] = s[j];
            if(c[i][j] == '#') black++;
        }
    }
    judge(0, -1, 0, 0);
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 3604
#include<bits/stdc++.h>
#define int long long
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

using D=double;
struct edge{
    int u,v;
    double cost;
    bool operator<(edge &e){
        return cost<e.cost;
    }
};

class UnionFind
{
 public:
    vector<int> par,sz;
    UnionFind(int N):par(N),sz(N){
        for(int i=0;i<N;i++){
            par[i]=i; sz[i]=1;
        }
    }
    int find(int x){
        if(par[x]==x) return x;
        return par[x]=find(par[x]);
    }
    void unite(int x,int y){
        x=find(x); y=find(y);
        if(x==y) return;
        if(sz[x]<sz[y]) swap(x,y);
        par[y]=x;
        sz[x]+=sz[y];
    }
    bool same(int x,int y){ return find(x)==find(y); }
    int size(int x){ return sz[find(x)]; }
    bool root(int x){ return par[x]==x; }
};

void solve(int N)
{
    vector<D> x(N),y(N),z(N),r(N);
    for(int i=0;i<N;i++) cin>>x[i]>>y[i]>>z[i]>>r[i];
    
    auto dist=[&](int i,int j)
    {
        D dx=x[i]-x[j];
        D dy=y[i]-y[j];
        D dz=z[i]-z[j];
        D d=sqrt(dx*dx+dy*dy+dz*dz);
        return max(0.0,d-(r[i]+r[j]));
    };
    vector<edge> es;
    for(int i=0;i<N-1;i++) for(int j=i+1;j<N;j++){
        es.push_back({i,j,dist(i,j)});
        // cout<<i<<' '<<j<<' '<<dist(i,j)<<endl;
    }
    sort(es.begin(),es.end());

    UnionFind tree(N);
    D ans=0;
    for(edge e:es){
        if(!tree.same(e.u,e.v)){
            tree.unite(e.u,e.v);
            ans+=e.cost;
        }
    }
    printf("%.3f\n",ans);
}
signed main()
{
    while(true){
        int N; cin>>N;
        if(N==0) break;
        solve(N);
    }    
    return 0;
}


Measured memory_bytes: 3324
n, A, B, C = map(int, input().split())
l = [int(input()) for _ in range(n)]


def recur(i, a, b, c):
    if n == i:
        if a < 1 or b < 1 or c < 1:
            return 10 ** 18
        return abs(A-a) + abs(B-b) + abs(C-c)
    return min([
        recur(i + 1, a, b, c),
        recur(i + 1, a + l[i], b, c) + (10 if a > 0 else 0),
        recur(i + 1, a, b + l[i], c) + (10 if b > 0 else 0),
        recur(i + 1, a, b, c + l[i]) + (10 if c > 0 else 0)
    ])


print(recur(0, 0, 0, 0))


Measured memory_bytes: 3064