akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define mp make_pair
#define all(a) begin(a),end(a)
#define FOR(x,val,to) for(int x=(val);x<int((to));++x)
#define FORE(x,val,to) for(auto x=(val);x<=(to);++x)
#define FORR(x,arr) for(auto &x: arr)
#define FORS(x,plus,arr) for(auto x = begin(arr)+(plus); x != end(arr); ++x)
#define FORREV(x,plus,arr) for(auto x = (arr).rbegin()+(plus); x !=(arr).rend(); ++x)
#define REE(s_) {cout<<s_<<'\n';exit(0);}
#define GET(arr) for(auto &i: (arr)) sc(i)
#define whatis(x) cerr << #x << " is " << (x) << endl;
#define e1 first
#define e2 second
#define INF 0x7f7f7f7f
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
typedef std::vector<std::string> vs;
typedef int64_t ll;
typedef uint64_t ull;
#define umap unordered_map
#define uset unordered_set
using namespace std;
using namespace __gnu_pbds;

#ifdef _WIN32
#define getchar_unlocked() _getchar_nolock()
#define _CRT_DISABLE_PERFCRIT_LOCKS
#endif
template<class L, class R> ostream& operator<<(ostream &os, map<L, R> P) { for(auto const &vv: P)os<<"("<<vv.first<<","<<vv.second<<")"; return os; }
template<class T> ostream& operator<<(ostream &os, set<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class T> ostream& operator<<(ostream &os, vector<T> V) { os<<"[";for(auto const &vv:V)os<<vv<<","; os<<"]"; return os; }
template<class L, class R> ostream& operator<<(ostream &os, pair<L, R> P) { os<<"("<<P.first<<","<<P.second<<")"; return os; }
inline int fstoi(const string &str){auto it=str.begin();bool neg=0;int num=0;if(*it=='-')neg=1;else num=*it-'0';++it;while(it<str.end()) num=num*10+(*it++-'0');if(neg)num*=-1;return num;}
inline void getch(char &x){while(x = getchar_unlocked(), x < 33){;}}
inline void getstr(string &str){str.clear(); char cur;while(cur=getchar_unlocked(),cur<33){;}while(cur>32){str+=cur;cur=getchar_unlocked();}}
template<typename T> inline bool sc(T &num){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){if(c == EOF) return false;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; return true;}template<typename T, typename ...Args> inline void sc(T &num, Args &...args){ bool neg=0; int c; num=0; while(c=getchar_unlocked(),c<33){;} if(c=='-'){ neg=1; c=getchar_unlocked(); } for(;c>47;c=getchar_unlocked()) num=num*10+c-48; if(neg) num*=-1; sc(args...); }
template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; //s.find_by_order(), s.order_of_key() <- works like lower_bound
template<typename T> using ordered_map = tree<T, int, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define N 1000001

int main(){
    ios_base::sync_with_stdio(0);cin.tie(0);
    ll m,d;
    sc(m,d);
    ll ret = 0;
    FORE(i,1,m){
        FORE(x,22,d){
            if(x%10 >= 2 && x/10 >= 2 && (x%10)*(x/10) == i){
                ++ret;
            }
        }
    }
    cout << ret << '\n';
}



Measured memory_bytes: 256
import sys

input_methods=['clipboard','file','key']
using_method=0
input_method=input_methods[using_method]

IN=lambda : map(int, input().split())
mod=1000000007

#+++++

def main():
	#a = int(input())
	b , c = IN()
	al=list(IN())
	a=b-sum(al)
	ret = a if a >= 0 else -1
	return ret
	#s = input()
	
	
	
#+++++
isTest=False

def pa(v):
	if isTest:
		print(v)
		
def input_clipboard():
	import clipboard
	input_text=clipboard.get()
	input_l=input_text.splitlines()
	for l in input_l:
		yield l

if __name__ == "__main__":
	if sys.platform =='ios':
		if input_method==input_methods[0]:
			ic=input_clipboard()
			input = lambda : ic.__next__()
		elif input_method==input_methods[1]:
			sys.stdin=open('inputFile.txt')
		else:
			pass
		isTest=True
	else:
		pass
		#input = sys.stdin.readline
			
	ret = main()
	if ret is not None:
		print(ret)

Measured memory_bytes: 68104
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);
		
		long n = sc.nextLong();
		
		if(n % 2 == 1) {
			System.out.println(0);
			return;
		}

		long numOfTwo = n / 2;
		long numOfFive = 0;
		
		long fives = 5;
		while(true) {
//			System.out.println("1 divid by "+ fives);
			long tmp = n / 2 / fives;
			
			if(tmp == 0) {
				break;
			}
			
			numOfFive += tmp;
			fives *= 5;
		}
		
		long twos = 2;
		while(true) {
//			System.out.println("2 divid by "+ twos);
			long tmp = n / 2 / twos;
			
			if(tmp == 0) {
				break;
			}
			
			numOfTwo += tmp;
			twos *= 2;
		}
//		System.out.println(numOfTwo + " " + numOfFive);
		
		System.out.println(Math.min(numOfFive, numOfTwo));
	}

}


Measured memory_bytes: 24148
N,K = map(int,input().split())
A = list(map(int,input().split()))

from collections import Counter
import numpy as np
c = Counter(A)

no = len(c.most_common())
numlist = []
for label, num in c.most_common():
    numlist.append(num)

diff = no - K
ans = 0
if(diff > 0):
    ans = np.sum(numlist[-diff:])
    
print(ans)

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

using namespace std;
typedef long long LL;

int main(){
  int n, m;
  cin >> n >> m;
  cout << (n-1)*(m-1) << endl;

  return 0;
}


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

int n,mini;
int A[36],B[36];
char a[36],b[36];

string check(){
  for(int i=0;i<n;i++){
    if(a[i]==b[i]&&A[i]==B[i])continue;
    return "Not stable";
  }
  return "Stable";
}

int main(){
  cin>>n;

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

  for(int i=0;i<n-1;i++){
    for(int j=n-1;j>i;j--){
      if(A[j]<A[j-1]){
	swap(a[j],a[j-1]);
	swap(A[j],A[j-1]);
      }
    }
  }

  for(int i=0;i<n-1;i++){
    mini=i;
    for(int j=i+1;j<n;j++){
      if(B[j]<B[mini])mini=j;
    }
    swap(b[i],b[mini]);    
    swap(B[i],B[mini]);
  }

  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<a[i]<<A[i];
  }
  cout<<endl<<"Stable"<<endl;
  for(int i=0;i<n;i++){
    if(i)cout<<' ';
    cout<<b[i]<<B[i];
  }
  cout<<endl<<check()<<endl;
  return 0;
}

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

#define REP(i,n) for(int i = 0; i < (int)(n); i++)
typedef long long ll;
typedef pair<int, int> pint;
template <class T> inline void chmax(T &a, const T b) { a = max(a, b); }
template <class T> inline void chmin(T &a, const T b) { a = min(a, b); }
template <class T> void pp(T v, int n) { REP(i,n) cout<<v[i]<< ' '; cout << endl; }

void inline TorF(bool tf, const string &trueMessage, const string &falseMessage) { 
  cout << (tf ? trueMessage : falseMessage) << endl;
}
void inline YESNO(bool tf) { TorF(tf, "YES", "NO"); }
void inline YesNo(bool tf) { TorF(tf, "Yes", "No"); }

int main() {
  int N; cin>>N;
  int K; cin>>K;
  int ans = 0;
  REP(i,N) {
    int h; cin>>h;
    if(h >= K) ans++;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <numeric>
#include <stack>
#include <string>
#include <utility>
#include <vector>

// using namespace std;

using ll = long long;

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

void Main() {
  std::string s;
  std::cin >> s;

  if (((s[0] == s[1] && s[2] == s[3]) || (s[0] == s[2] && s[1] == s[3]) ||
       (s[0] == s[3] && s[1] == s[2])) &&
      (!(s[0] == s[1] && s[1] == s[2] && s[2] == s[3]))) {
    std::cout << "Yes" << std::endl;
  } else {
    std::cout << "No" << std::endl;
  }
}

int main() {
  std::cout << std::fixed << std::setprecision(15);
  Main();
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
#include <map>
#include <set>
using namespace std;
typedef long long ll;
#define rep(i,s,n)for(ll i = s;i<n;i++)
#define repe(i,s,n)for(ll i = s;i<=n;i++)

int main() {
	ll N; cin >> N;
	ll minV = 1 << 21;

	for (ll A = 1; A*A <= N; A++) {
		if (N % A != 0) {
			continue;
		}
		ll B = N / A;

		ll digit_A = 0;
		ll a = A;
		while (a != 0) {
			digit_A++;
			a /= 10;
		}
		ll digit_B = 0;
		while (B != 0) {
			digit_B++;
			B /= 10;
		}
		minV = min(minV, max(digit_A, digit_B));
	}
	cout << minV << endl;

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define pb push_back
#define fi first`
#define se second
const int N=1e5+500;
void solve()
{
	string s;
	cin>>s;
	map<char,ll> lol;
	for(auto i:s)
		lol[i]=1;
	cout<<(lol.size()==1?"No":"Yes");

}

int main()
{


    // ios_base::sync_with_stdio(false);
    // cin.tie(NULL);
    int t = 1;
    // cin >> t;
    while(t--)
    {
        solve();
        // cout << endl;
    }

}




Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<math.h>
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	if (a > b) {
		cout << 2 * a - 1 << endl;
	}
	else if (b > a){
		cout << 2 * b - 1 << endl;
	}
	else {
		cout << a + b << endl;
	}
	return 0;
}

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

typedef long long ll;
typedef pair<ll, ll> P;

const ll mod =  1000000007;  //出力は (ans % mod + mod) % mod  (負の剰余を正にする)
const int inf = 1e9;
const long long INF = 1LL << 60;   // INF = 1152921504606846976
const double PI = 3.1415926535897932;

int main()
{
    string s; cin >> s;
    if(s == "AAA" || s == "BBB") cout << "No";
    else cout << "Yes";
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int W,H,i,j,x;
    while(1){
        scanf("%d %d",&H,&W);
        if(H==0){
            break;
        }
        for(i=0;i<H;i++){
            x = i;
            for(j=0;j<W;j++){
                x++;
                if(x%2==1){
                    printf("#");
                }else{
                    printf(".");
                }
            }
        printf("\n");
        }
    printf("\n");
    }
return 0;
}


Measured memory_bytes: 2080
//Coded by Abhijay Mitra
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <cstdio>
#include <numeric>
#include <cstring>
#include <numeric>
#include <vector>
#include <iterator> 
#include <map>
#include <set>
#include <climits>
#include <queue>
#include <iomanip>
#include <cmath>
#include <stack>
#include <cctype>
#include <bitset>
// #include <bits/stdc++.h>
#define double long double
#define int long long int
#define ll int
#define ibs ios_base::sync_with_stdio(false)
#define cti cin.tie(0)
#define bp __builtin_popcount
#define pb push_back
#define res(v) v.resize(unique(v.begin(), v.end()) - v.begin());
#define cnt_res(v) std::distance(v.begin(),std::unique(v.begin(), v.end())); 
#define timer cerr << "Time elapsed : " << 1.0 * clock() / CLOCKS_PER_SEC << " sec \n";
using namespace std;
const int N=2e6+10;
const int inf = /*0x3f3f3f3f*/2e18+10;
// const ll M = 998244353 ; // Mulo
// const int M = 1e9+7 ; // Mulo
const double Pi = 3.14159265;
#define F first
#define S second
int a,b,c,d;
map<int,int>m;
int f(int n){
  if(n==1)return d;
  if(n==0)return 0;
  if(m.count(n))return m[n];
  vector<int>A={a,b,c};
  vector<int>p={2,3,5};
  int cost=inf;
  for(int i=0;i<3;i++){
    int x=A[i];
    int F=p[i];
    if((n%F)==0){
      cost=min(cost,x+f(n/F));
    }
    else{
      int lo=n/F*F,hi=n/F*F+F;
      cost=min(cost,x+f(hi/F)+d*(hi-n));
      cost=min(cost,x+f(lo/F)+d*(n-lo));
    }
  }
  if(n<inf/d)
  return m[n]=min(cost,n*d);
  return m[n]=cost;
}
void solve(){
  int n;m.clear();
  cin>>n>>a>>b>>c>>d;
  cout<<f(n);
}
int32_t main()
{
  ibs;cti;
  // solve()
  /*,cout<<"\n"*/;
  // cout<<"\n";
  int xx=0;
  int t;cin>>t;while(t--){/*xx++;cout<<"Case "<<xx<<":\n"*/;solve();cout<<"\n";}
  return 0;
}

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

char in[120];
pair<pair<string,int>,int> p[110];
int main(){
  int a;scanf("%d",&a);
  for(int i=0;i<a;i++){
int t;scanf("%s%d",in,&t);
string tmp=in; p[i]=make_pair(make_pair(in,-t),i);
}
std::sort(p,p+a);
for(int i=0;i<a;i++)printf("%d\n",p[i].second+1);
}
  
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)
#define all(c) c.begin(),c.end()
#define rall(c) c.rbegin(),c.rend()
#define vi vector<int>
#define vl vector<ll>
#define pll pair<ll,ll>
#define vpll vector<pll>

int main(){
  int n;
  cin>>n;
  vector<string> s(n);
  rep(i,n)cin>>s[i];
  sort(all(s));
  int ans=1;
  string ini=s[0];
  rep(i,n){
    if(ini!=s[i]){
      ans++;
      ini=s[i];
    }
  }
  cout<<ans<<endl;
  
}




Measured memory_bytes: 9596
#include <bits/stdc++.h>
#define rep2(i, n, m) for (int i = m; i < (int)(n); i++)
#define rep(i, n) rep2(i, n, 0)
#define all(x) (x).begin(), (x).end()
#define SZ(x) ((int)(x).size())
using namespace std;
using ll = long long;  //
template <typename T>
T sq(T x) {
  return x * x;
}
signed main() {
  int N;
  cin >> N;
  vector<ll> T(N);
  vector<ll> A(N);
  rep(i, N) { cin >> T.at(i) >> A.at(i); }
  ll taka = T.at(0);
  ll aoi = A.at(0);
  rep(i, N) {
    ll tmp_taka = taka / T.at(i);
    ll tmp_aoi = aoi / A.at(i);
    if (taka % T.at(i) != 0) {
      tmp_taka++;
    }
    if (aoi % A.at(i) != 0) {
      tmp_aoi++;
    }
    ll tmp = max(tmp_taka, tmp_aoi);
    taka = tmp * T.at(i);
    aoi = tmp * A.at(i);
  }
  cout << taka + aoi << endl;
  return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<tuple>
using namespace std;
typedef long long ll;
typedef unsigned int ui;
const ll mod = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
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 Per(i,sta,n) for(int i=n-1;i>=sta;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++)
typedef long double ld;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<ll, ll> LP;

string s;

void solve(){
    cin >> s;
    if(s=="AAA" || s=="BBB"){
        cout << "No" << endl; 
    }
    else{
        cout << "Yes" << endl;
    }
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(50);
    solve();
}

Measured memory_bytes: 256
n = int(input())

a = [int(i) for i in input().split()]
a.append(0)
a.insert(0,0)

cost =0
for i in range(1,len(a)):
    cost += abs(a[i-1] - a[i])

for i in range(1,len(a)-1):
    if a[i-1] < a[i] < a[i+1]:
        ans = cost
    elif a[i-1] > a[i] > a[i+1]:
        ans = cost
    else:
        ans = cost - abs(a[i-1] - a[i]) - abs(a[i] - a[i+1]) + abs(a[i-1] - a[i+1])
    print(ans)

Measured memory_bytes: 20640
class Solution:
    def solve(self, A: int, B: int, C: int) -> str:

        return min(B // A, C)


if __name__ == '__main__':

    # standard input
    A, B, C = map(int, input().split())

    # solve
    solution = Solution()
    print(solution.solve(A, B, C))


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

int main() {
  int H, W;

  std::cin >> H >> W;

  std::vector<std::vector<int>> Ss_in_eachR(H+2, {0});
  std::vector<std::vector<int>> Ss_in_eachC(W+2, {0});

  for (int i=1; i<H+1; i++) {
    for (int j=1; j<W+1; j++) {
      char c;
      std::cin >> c;
      if (c == '#') {
        Ss_in_eachR[i].push_back(j);
        Ss_in_eachC[j].push_back(i);
      }
    }
    Ss_in_eachR[i].push_back(W+1);
  }
  for (int j=1; j<W+1; j++) {
    Ss_in_eachC[j].push_back(H+1);
  }

  std::vector<std::vector<int>> CountR(H+1, std::vector<int>(W+1, 0));

  for (int i=1; i<H+1; i++) {
    for (int j=1; j<Ss_in_eachR[i].size(); j++) {
      auto l = Ss_in_eachR[i][j-1];
      auto r = Ss_in_eachR[i][j];

      for (int c=l+1; c<r; c++) {
        CountR[i][c] = r-l-1;
      }
    }
  }

  // for (int i=1; i<H+1; i++) {
  //   for (int j=1; j<W+1; j++) {
  //     std::cerr << ' ' << CountR[i][j];
  //   }
  //   std::cerr << std::endl;
  // }
  // std::cerr << std::endl;

  std::vector<std::vector<int>> CountC(H+1, std::vector<int>(W+1, 0));

  for (int j=1; j<W+1; j++) {
    for (int i=1; i<Ss_in_eachC[j].size(); i++) {
      auto t = Ss_in_eachC[j][i-1];
      auto b = Ss_in_eachC[j][i];

      for (int r=t+1; r<b; r++) {
        CountC[r][j] = b-t-1;
      }
    }
  }

  // for (int i=1; i<H+1; i++) {
  //   for (int j=1; j<W+1; j++) {
  //     std::cerr << ' ' << CountC[i][j];
  //   }
  //   std::cerr << std::endl;
  // }
  // std::cerr << std::endl;

  int ans = 0;

  for (int i=1; i<H+1; i++) {
    for (int j=1; j<W+1; j++) {
      ans = std::max(ans, CountR[i][j] + CountC[i][j] - 1);
    }
  }

  std::cout << ans << std::endl;

  return 0;
}


Measured memory_bytes: 65792
#include <iostream>
#include <vector>
#include <climits>
#define INF (LLONG_MAX>>2)
using namespace std;

typedef long long ll;

class edge{
public:
  int to;
  int weight;
  edge(int to, int weight){
    this->to = to;
    this->weight = weight;
  }
};

void bellmanFord(int, int, vector<edge>*);

int main(){
  int v, e, r;
  cin >> v >> e >> r;

  vector<edge> graph[v];

  int from, to, weight;
  for(int i=0; i<e; i++){
    cin >> from >> to >> weight;
    graph[from].push_back(edge(to, weight));
  }

  bellmanFord(r, v, graph);

  return 0;
}

void bellmanFord(int start, int n, vector<edge>* graph){
  ll d[n];
  for(int i=0; i<n; i++) d[i] = INF;
  d[start] = 0;

  bool neg=false;
  for(int i=0; i<n; i++){
    for(int v=0; v<n; v++){
      for(int k=0; k<graph[v].size(); k++){
        edge e = graph[v][k];
        if(d[v]!=INF && d[e.to] > d[v]+e.weight){
          d[e.to] = d[v]+e.weight;
          if(i==n-1) neg=true;
        }
      }
    }
  }

  if(neg) cout << "NEGATIVE CYCLE" << endl;
  else{
    for(int i=0; i<n; i++){
      if(d[i]==INF) cout << "INF" << endl;
      else cout << d[i] << endl;
    }
  }
}



Measured memory_bytes: 3124
#coding: utf-8
import math
import heapq
import bisect
import numpy as np
from collections import Counter
#from scipy.misc import comb

N = int(input())
A = list(map(int, input().split()))
A.sort()

ans = 0
for key, value in Counter(A).items():
    if key <= value:
        ans += (value - key)
    else:
        ans += value

print(ans)

Measured memory_bytes: 26692
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
def ism():return map(str,input().split())
def isl():return list(map(str,input().split()))

n = ii()
s = list(input())
ans = 1
for i in range(1,n):
    if s[i] != s[i-1]:
        ans += 1
print(ans)

Measured memory_bytes: 4084
n,m=map(int,input().split())

lmax,rmin=0,10**5
for _ in range(m):
  l,r=map(int,input().split())
  lmax=max(lmax,l)
  rmin=min(rmin,r)

if rmin>=lmax:
  print(rmin-lmax+1)
else:
  print(0)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
#define  re(i,j,n) for(li i=(j);i<(n);i++)
#define  rep(i,n) re(i,0,(n))
#define  red(i,n) for(li i=n;i>0;i--)
#define  all(a) begin(a),end(a)
#define  pb(a) push_back(a)
using namespace std;
//namespace mp = boost::multiprecision;
typedef long int li;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<li> vli;
typedef vector<string> vs;


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


Measured memory_bytes: 256
// Package main provides
//
// File:  b.go
// Author: ymiyamoto
//
// Created on Wed Jan  9 23:21:55 2019
//
package main

import "fmt"

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

func main() {
	var N, K int
	fmt.Scan(&N, &K)

	arr := make([]int, N)
	for i := range arr {
		fmt.Scan(&arr[i])
	}

	dp := make([]int, N)
	for i := range arr {
		if i == 0 {
			continue
		}
		min := 1 << 60
		for j := 1; j <= K; j++ {
			if i-j >= 0 {
				n := dp[i-j] + abs(arr[i]-arr[i-j])
				if n < min {
					min = n
				}
			}
		}
		dp[i] = min
	}

	fmt.Println(dp[N-1])
}


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

long long int L[105];
int main() {
    int N;
    cin >> N;

    L[0]=2;
    L[1]=1;

    for(int i=2; i<=N; i++) {
        L[i]=L[i-1]+L[i-2];
    }
    cout << L[N] << endl;
}


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

using namespace std;

template <class T>inline T updmax(T& a, T b) {return a = max(a, b);}
template <class T>inline T updmin(T& a, T b) {return a = min(a, b);}

class Solution {
public:
	void solve() {
		int n;
		cin >> n;
		vector<int> a(n, 0);
		for(int i=0; i<n; i++)cin >> a[i];
		int ret = 0;
		for(int i=0; i < n; i++){
			for(int j=i+1; j < n; j++){
				ret += a[i] * a[j];
			}
		}
		cout << ret << "\n";
		
		return;
	};
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	Solution solution;
	solution.solve();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define COUT(x) cout<<(x)<<endl
#define dump(x)  cout << #x << " = " << (x) << endl;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
using M = map<int,int>;
using PQ = priority_queue<int>;
using PQG = priority_queue<int, vector<int>, greater<int>>;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

int main() {
  int a,b,k;
  cin >> a >> b >> k;
  set<int> s;

  REP(i,k) {
    if (a+i > b) break;
    s.insert(a+i);
  }
  REP(i,k) {
    if (b-i < a) break;
    s.insert(b-i);
  }

  for(int x: s) COUT(x);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(a, b) printf(a, b);
#define c(s) cout << (s) << endl;
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define YES cout << "YES" << endl;
#define NO cout << "NO" << endl;
#define cyn(c) cout << (c ? "Yes" : "No") << endl;
#define cYN(c) cout << (c ? "YES" : "NO") << endl;
#define pyn(c) printf("%s\n", c ? "Yes" : "No");
#define pYN(c) printf("%s\n", c ? "YES" : "NO");
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<LL, LL> P;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int w,h,n,x,y,a,X1=0,X2,Y1=0,Y2;
    cin>>w>>h>>n;
    X2=w; Y2=h;
    rep(i,n){
        cin>>x>>y>>a;
        if(a==1){
            X1 = max(X1,x);
        }else if(a==2){
            X2 = min(X2,x);
        }else if(a==3){
            Y1 = max(Y1,y);
        }else{
            Y2 = min(Y2,y);
        }
    }
    if(X2>X1&&Y2>Y1){
        c((X2-X1)*(Y2-Y1));
    }else{
        c(0);
    }
}


Measured memory_bytes: 256
#include<cstdio>
#include <iostream>
#include<sstream>
#include<fstream>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<complex>
#include <cstring>
#include<vector>
#include<list>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<bitset>
#include<numeric>
#include<limits>
#include<climits>
#include<cfloat>
#include<functional>
#include<iterator>
#include <random>
#define inf  1000000000
#define mod  1073741824
#pragma GCC optimization ("O3")
using namespace std;
const int N = 100*1000+5;
#define all(x) begin(x),end(x)
int main()
{
   
    // freopen("input.txt","r",stdin);
    // freopen("output.txt","w",stdout);
    //ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    int n,m;
    cin >> n >> m;
    if(n == m)
        cout << "Yes\n"; 
    else
        cout << "No\n";
    return 0;
}


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

#define ll long long

int main() {
  ll N;
  cin >> N;
  
  if (N == 1) {
    cout << 0 << endl;
    return 0;
  }
  
  ll M = N;
  int count = 0;
  for (ll i = 2; i * i <= N; i++) {
    if (i * i == N && count == 0) {
      cout << 1 << endl;
      return 0;
    }
    ll j = i;
    while (M % j == 0) {
      count++;
      M /= j;
      j *= i;
    }
    
    while (M % i == 0) {
      M /= i;
    }
  }
  if (M > N / M) count++;
  cout << count << endl;
  
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define rep(i,n) for (int (i) = 0; (i) < (n); i++)
#define ll long long
using namespace std;
int main() {
  int x,a,b; cin >>x>>a>>b;
  if(b <= a){
    cout << "delicious";
  }
  else if(b <= a+x){
    cout << "safe";
  }
  else{
    cout << "dangerous";
  }
}

Measured memory_bytes: 3648
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        int[][] array = new int[m][2];
        
        for (int i = 0; i < m; i++) {
            int cost = sc.nextInt();
            int k = sc.nextInt();
            
            // 集合s (ex. 1011 = bit0,1,3を含む集合)
            int s = 0;
            for (int j = 0; j < k; j++) {
                int e = sc.nextInt() - 1;
                
                // e番目のbitを立てる
                int bit = 1<<e;
                s |= bit;
            }
            
            array[i][0] = s;
            array[i][1] = cost;
        }
        
        // dp[s] = 集合sに至るまでの最小コスト
        long[] dp = new long[1<<n];
        Arrays.fill(dp, 1001001001001001001L);
        dp[0] = 0;
        for (int s = 0; s < 1<<n; s++) {
            for (int i = 0; i < m; i++) {
                // t = 集合sからi番目の鍵を使って行ける集合
                int t = s | array[i][0];
                int cost = array[i][1];
                
                // 最小コストの更新
                dp[t] = Math.min(dp[t], dp[s] + cost);
            }
        }
        
        // 演算順位に注意
        if (dp[(1<<n) - 1] == 1001001001001001001L) {
            System.out.println(-1);
        } else {
            System.out.println(dp[(1<<n) - 1]);
        }
    }
}


Measured memory_bytes: 32068
N = int(input())
nums = []
for i in range(N):
    A,B= list(map(int,input().split(" ")))
    nums.append((A,B))

ans = 0
c = 0
nums = nums[::-1]
for temp in nums:
    if (temp[0] + c) % temp[1] != 0:
        ad = temp[1] - ( (temp[0] + c) % temp[1])
        ans += ad
        c += ad
print(ans)


Measured memory_bytes: 54104
#include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <cstring>

using namespace std;

#define f first
#define s second
#define pb push_back
#define mp make_pair
#define ll long long
#define pii pair < int, int >
#define pll pair < long long, long long>
#define ull unsigned long long
#define vi vector < int >
#define vll vector < long long >
#define sz(a) (int)a.size()
#define forit(it, s) for(__typeof(s.begin()) it = s.begin(); it != s.end(); it++)
#define all(a) a.begin(), a.end()
#define sqr(x) ((x) * (x))
#define fname "searching"

const int inf = (int)1e9;
const ll INF = (ll)1e18;
const double eps = 1e-9;
const double pi = acos(-1.0);
const int mod = (int)1e9 + 7;

int n, m;
vi v[100];
vector<pii> e;
int u[100];

void clear(){
    for(int i = 0; i < n; ++i) u[i] = 0;
}

int edge(int num, int from){
    return from == e[num].f ? e[num].s : e[num].f;
}

void dfs(int x, int cur){
    u[x] = 1;
    for(int i = 0; i < sz(v[x]); ++i){
        if(v[x][i] == cur) continue;
        int to = edge(v[x][i], x);
        if(!u[to]) dfs(to, cur);
    }
}

bool check(){
    for(int i = 0; i < n; ++i)
        if(!u[i]) return 0;
    return 1;
}

int solve(){
    cin >> n >> m;
    for(int i = 0, x, y; i < m; ++i){
        cin >> x >> y;
        --x, --y;
        v[x].pb(sz(e));
        v[y].pb(sz(e));
        e.pb(mp(x, y));
    }
    int cnt = 0;

    // for(int i = 0; i < sz(e); ++i){
    //     cout << i << ": " << e[i].f << " - " << e[i].s << "\n";
    // }

    // for(int i = 0; i < n; ++i){
    //     cout << i << ": ";
    //     for(int j = 0; j < sz(v[i]); ++j){
    //         cout << v[i][j] << " ";
    //     }
    //     cout << "\n";
    // }

    for(int i = 0; i < sz(e); ++i){
        clear();
        dfs(0, i);
        if(!check()) cnt++;
    }
    return cnt;
}

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

    cout << solve() << "\n";
    
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
  int n,F[44],i;
  scanf("%d",&n);
  F[0] = 1;
  F[1] = 1;
  for(i=2;i<=n;i++){
    F[i] = F[i-1] + F[i-2];
  }
  printf("%d\n",F[n]);

  return 0;
}





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

int main()
{
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0 && x % 3 != 0 && x % 5 != 0) {
      cout << "DENIED\n";
      return 0;
    }
  }
  cout << "APPROVED\n";
  return 0;
}


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

#define rep(X,N) for(ll X = 0LL; X < (N); X++)
#define PI (acos(-1.0))
#define MODN 1000000007
#define MODN2 998244353
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

bool next(vector<int> &v){

    int size = v.size();

    rep(i, size){
        v[i]++;

        if(v[i] == 2){
            v[i] = -1;

            if(i == size - 1) return false;
        }else{
            return true;
        }
    }

    return false;
}

int main(){

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

    rep(i, n){
        cin >> a[i];
    }

    vector<int> diff(n, -1);

    int ans = 0;

    do{

        bool tmp = false;
        rep(i, n){
            if((a[i] + diff[i]) % 2 == 0){
                tmp = true;
                break;
            }
        }

        if(tmp) ans++;
    }while(next(diff));

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
mod io{
    use std::io::*;
    pub fn read<T: ::std::str::FromStr>()->T{
        let stdin=stdin();
        let ret=stdin.lock().bytes().map(|c|c.unwrap()as char)
        .skip_while(|c|c.is_whitespace())
        .take_while(|c|!c.is_whitespace())
        .collect::<String>().parse().ok().unwrap();
        ret
    }
}
use io::read;
fn main(){println!("{}",read::<i32>().pow(2)/4)}


Measured memory_bytes: 4352
#include<bits/stdc++.h>
#define enld '\n'
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1000000007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ios::sync_with_stdio(false);
// cin.tie(nullptr);
// ---------------------------------------------------------------------------

int main(){
    int N;
    cin >> N;
    vector<int> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    int k = 1 + N%2;
    vector<vector<ll>> dp(N+1, vector<ll> (4,-INF));
    dp[0][0] = 0;
    for(int i=0; i<N; i++){
        for(int j=0; j<k+1; j++){
            chmax(dp[i+1][j+1],dp[i][j]);
            ll now = dp[i][j];
            if((i+j)%2 == 0) now += A[i];
            chmax(dp[i+1][j],now);
        }
    }
    cout << dp[N][k] << enld;
    return 0;
}

Measured memory_bytes: 18044
#![allow(unused_imports)]
#![allow(unused_macros)]
use std::cmp::{ min, max };

macro_rules! ewriteln {
    ($($args:expr),*) => { let _ = writeln!(&mut std::io::stderr(), $($args),*); };
}
macro_rules! trace {
    ($x:expr) => { ewriteln!(">>> {} = {:?}", stringify!($x), $x) };
    ($($xs:expr),*) => { trace!(($($xs),*)) }
}
macro_rules! put {
    ($x:expr) => { println!("{}", $x) };
    ($x:expr, $($xs:expr),*) => { print!("{} ", $x); put!($($xs),*) }
}

const M: i64 = 10000;

fn main() {
    let mut sc = Scanner::new();
    let n: usize = sc.cin();
    let k: usize = sc.cin();

    let mut plan = vec![None; n];
    for _ in 0..k {
        let a: usize = sc.cin();
        let b: usize = sc.cin();
        plan[a - 1] = Some(b - 1);
    }

    let mut memo = vec![vec![vec![0; 3]; 3]; n + 2];
    // memo[d][a0][a1] = `d-1 日目に a0, d 日目に a1 を食べる方法`

    match (plan[0], plan[1]) {
        (Some(a), Some(b)) => {
            memo[1][a][b] = 1
        },
        (Some(a), None) => {
            for b in 0..3 {
                memo[1][a][b] = 1;
            }
        },
        (None, Some(b)) => {
            for a in 0..3 {
                memo[1][a][b] = 1;
            }
        },
        (None, None) => {
            for a in 0..3 {
                for b in 0..3 {
                    memo[1][a][b] = 1;
                }
            }
        }
    }
        // trace!(&memo[1]);

    for d in 2..n {
        match plan[d] {
            Some(c) => {
                for a in 0..3 {
                    for b in 0..3 {
                        if a == b && b == c { continue }
                        memo[d][b][c] += memo[d-1][a][b];
                        memo[d][b][c] %= M;
                    }
                }
            },
            None => {
                for a in 0..3 {
                    for b in 0..3 {
                        for c in 0..3 {
                            if a == b && b == c { continue }
                            memo[d][b][c] += memo[d-1][a][b];
                            memo[d][b][c] %= M;
                        }
                    }
                }
            }
        }
        // trace!(&memo[d]);
    }

    let mut ans = 0;
    for a in 0..3 {
        for b in 0..3 {
            ans = (ans + memo[n-1][a][b]) % M;
        }
    }
    put!(ans);
}

use std::io::{self, Write};
use std::str::FromStr;
use std::collections::VecDeque;

struct Scanner { stdin: io::Stdin, buffer: VecDeque<String>, }
impl Scanner {
    fn new() -> Scanner { Scanner { stdin: io::stdin(), buffer: VecDeque::new() } }
    fn cin<T: FromStr>(&mut self) -> T {
        while self.buffer.len() == 0 {
            let mut line = String::new();
            let _ = self.stdin.read_line(&mut line);
            for w in line.split_whitespace() {
                self.buffer.push_back(String::from(w));
            }
        }
        self.buffer.pop_front().unwrap().parse::<T>().ok().unwrap()
    }
}



Measured memory_bytes: 5040
#include <bits/stdc++.h>
#include<float.h>
using namespace std;
# define ll long long int
#define mm 1000000007
#define pb push_back
int main(){
	ios::sync_with_stdio(false);
  	cin.tie(0); cout.tie(0);
  	ll t,n,i,ans=0,count=0;
  	cin>>n;
	t = n;
	while(t!=0){
		count++;
		t=t/10;
	}  
	if(count%2 == 0){
		for(i = count - 1 ; i>0;i-=2){
			ans  += pow(10,i-1)*9;
			// cout<<pow(9,i)<<" "<<ans<<endl;
		}
	}else{
		ans = n - pow(10,count-1) + 1;
		for(i = count - 2 ; i>0;i-=2){
			ans  += pow(10,i-1)*9;
		}
	}
	cout<<ans;
}

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

public class Main {
    static MyReader in = new MyReader();

    public static void main(String[] args) {
        int N = in.i();

        ArrayList<Integer>[] edge = new ArrayList[N];
        Arrays.setAll(edge, i -> new ArrayList<>());
        for (int i = 1; i < N; i++) {
            int a = in.i() - 1;
            int b = in.i() - 1;
            edge[a].add(b);
            edge[b].add(a);
        }

        int[] c = in.ii(N);
        Arrays.sort(c);

        IntQueue q = new IntQueue(N);
        q.push(0);

        int[] d = new int[N];
        for (int i = N - 1; i >= 0; i--) {
            int v = q.pop();
            d[v] = c[i];
            for (int u : edge[v]) {
                if (d[u] == 0) {
                    q.push(u);
                }
            }
        }

        long M = 0;
        for (int i = 0; i < N - 1; i++) {
            M += c[i];
        }

        StringBuilder sb = new StringBuilder();
        sb.append(M).append('\n');
        for (int i = 0 ; i < N; i++) {
            sb.append(d[i]).append(' ');
        }
        System.out.println(sb);
    }
}

class IntQueue {
    final int MAX;
    int[] array;
    int head = 0;
    int tail = 0;
    int count = 0;

    IntQueue(int N) {
        MAX = N;
        array = new int[N];
    }

    void push(int n) {
        array[tail] = n;
        if (++tail == MAX) tail = 0;
        count++;
    }

     int pop() {
        int n = array[head];
        if (++head == MAX) head = 0;
        count--;
        return n;
    }

    boolean isEmpty() {
        return count == 0;
    }
}

class MyReader extends BufferedReader {
    char[] cbuf = new char[1024];
    int head = 0;
    int tail = 0;

    MyReader() {
        super(new InputStreamReader(System.in));
    }

    char next() {
        if (head == tail) {
            try {
                tail = super.read(cbuf, 0, cbuf.length);
            } catch (IOException e) {
                e.printStackTrace();
            }
            head = 0;
        }
        return cbuf[head++];
    }

    int i() {
        int k = next() - '0';
        boolean minus = k == -3;
        int n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    int[] ii(final int N) {
        int[] a = new int[N];
        for (int j = 0; j < a.length; j++) a[j] = i();
        return a;
    }

    long l() {
        int k = next() - '0';
        boolean minus = k == -3;
        long n = minus ? 0 : k;
        while (0 <= (k = next() - '0') && k <= 9) n = 10 * n + k;
        return minus ? -n : n;
    }

    char[] s(final int N) {
        char[] s = new char[N];
        for (int i = 0; i < N; i++) {
            s[i] = next();
        }
        next();
        return s;
    }

    public int read(char[] cbuf) {
        int i;
        char c;
        for (i = 0; (c = next()) != ' ' && c != '\n'; i++) cbuf[i] = c;
        return i;
    }

    public String readLine() {
        try {
            return super.readLine();
        } catch (IOException e) {
            return null;
        }
    }
}


Measured memory_bytes: 38584
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <queue>
using namespace std;
typedef long long int ll;

struct Edge{
	int to,rev; ll cap;
	Edge(int to,ll cap,int rev):to(to),cap(cap),rev(rev){}
};
// ここの値に注意！！
const int N=20500;
const ll INF=1e9;
vector<Edge> g[N];
int level[N]; 
int iter[N];
void add_edge(int s,int t,ll c){
	g[s].push_back(Edge(t,c,g[t].size()));
	g[t].push_back(Edge(s,0,g[s].size()-1));
}
void bfs(int s){
	memset(level,-1,sizeof(level));
	queue<int> q;
	level[s]=0;
	q.push(s);
	while(q.size()){
		int v=q.front(); q.pop();
		for(auto &e:g[v]){
			if(e.cap>0&&level[e.to]<0){
				level[e.to]=level[v]+1;
				q.push(e.to);
			}
		}
	}
}
ll dfs(int v,int t,ll f){
	if(v==t)return f;
	for(int &i=iter[v];i<g[v].size();i++){
		Edge &e=g[v][i];
		if(e.cap>0&&level[v]<level[e.to]){
			int d=dfs(e.to,t,min(f,e.cap));
			if(d>0){
				e.cap-=d;
				g[e.to][e.rev].cap+=d;
				return d;
			}
		}
	}
	return 0;
}
ll max_flow(int s,int t){
	ll flow=0;
	while(1){
		bfs(s);
		if(level[t]<0)return flow;
		memset(iter,0,sizeof(iter));
		int f;
		while((f=dfs(s,t,INF))>0){
			flow+=f;
		}
	}
}

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

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int h,w; cin >> h >> w;
	int s=h*w*2,t=h*w*2+1;
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			cin >> fi[i][j];
		}
	}
	for(int i=0;i<h;i++){
		for(int j=0;j<w;j++){
			int p=i*w+j; int q=p+h*w;
			if(fi[i][j]=='X'){
				if(i==0||i==h-1||j==0||j==w-1){
					cout << -1 << endl;
					return 0;
				}
				add_edge(s,p,INF);
				add_edge(p,q,INF);
			}else{
				add_edge(p,q,1);
			}
			if(i==0||i==h-1||j==0||j==w-1){
				add_edge(q,t,INF);
			}
			for(int k=0;k<4;k++){
				int nx=dx[k]+i,ny=dy[k]+j;
				if(0<=nx&&nx<h&&0<=ny&&ny<w){
					add_edge(q,nx*w+ny,INF);
				}
			}
		}
	}
	cout << max_flow(s,t) << endl;
}



Measured memory_bytes: 3584
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n;
  cin >> n;
  int t[101];
  int sum = 0;

  for(int i=1; i<=n; i++) {
    cin >> t[i];
    sum += t[i];
  }

  int m;
  cin >> m;
  for(int i=0; i<m; i++) {
    int p, x;
    cin >> p >> x;
    int tmp = t[p] - x;
    cout << (sum - tmp) << endl;
  }
  return 0;
}

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

int main()
{
	string str;
    cin>>str;
    int min_absolute_diff=INT_MAX;
    for(int i=0 ; i<str.length()-2 ; ++i)
    {
        min_absolute_diff=min(abs(stoi(str.substr(i,3))-753),min_absolute_diff);
    }
    cout<<min_absolute_diff<<endl;
	return 0;
}

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

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

    string s, t;
    cin >> s >> t;
    
    int rs[26], rt[26];
    rep(i,26){
        rs[i] = rt[i] = -1;
    }
    string ans = "Yes";
    rep(i, s.size()){
        if(rs[s[i] - 'a'] < 0){
            rs[s[i] - 'a'] = t[i] - 'a';
        }else{
            if(rs[s[i] - 'a'] != t[i] - 'a'){
                ans = "No";
                break;
            }
        }
        
        if(rt[t[i] - 'a'] < 0){
            rt[t[i] - 'a'] = s[i] - 'a';
        }else{
            if(rt[t[i] - 'a'] != s[i] - 'a'){
                ans = "No";
                break;
            }
        }
    }
    
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 916
#include<bits/stdc++.h>
using namespace std;
int main(void){
    int n,k;
    cin>>n>>k;
    int *arr=new int[n];
    for(int i=0;i<n;i++)
    cin>>arr[i];
    int dp[k+1]={0};
    for(int i=1;i<=k;i++){
        for(int j=0;j<n;j++){
            if(i-arr[j]>=0){
                if(dp[i-arr[j]]==0)
                dp[i]=1;
                else if(dp[i-arr[j]]==1){
                    if(dp[i]!=1)
                    dp[i]=2;
                }
                else if(dp[i-arr[j]]==2)
                dp[i]=1;
            }
        }
    }
    if(dp[k]==1)
    cout<<"First"<<endl;
    else
    cout<<"Second"<<endl;
}

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

using int32 = int_fast32_t;
using int64 = int_fast64_t;

const int32 INF = 1e9;
const int32 MOD = 1e9+7;
const int64 LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES\n" : "NO\n"  )
#define Yes(n) cout << ((n) ? "Yes\n" : "No\n"  )
#define POSSIBLE cout << ((n) ? "POSSIBLE\n" : "IMPOSSIBLE\n"  )
#define ANS(n) cout << (n) << "\n"
#define REP(i,n) for(int64 i=0;i<(n);++i)
#define FOR(i,a,b) for(int64 i=(a);i<(b);i++)
#define FORR(i,a,b) for(int64 i=(a);i>=(b);i--)
#define ALL(obj) (obj).begin(),(obj).end()
#define pii pair<int32,int32>
#define pll pair<int64,int64>
#define pb(a) push_back(a)

template<int64 mod>
struct ModInt{
  int64 x;
  constexpr ModInt(int64 y = 0):x((y%mod+mod)%mod){}
  constexpr ModInt& operator+=(const ModInt& a){
    if((x += a.x) >= mod) x -= mod;
    return *this;
  }
  constexpr ModInt& operator-=(const ModInt& a){
    if((x -= a.x) < 0)x += mod;
    return *this;
  }
  constexpr ModInt& operator*=(const ModInt& a){
    x = x * a.x % mod;
    return *this;
  }
  constexpr ModInt& operator/=(const ModInt& a){
    *this *= a.inv();
    return *this;
  }
  constexpr ModInt operator-() const {
    return ModInt(-x);
  }
  constexpr ModInt operator+(const ModInt& a) const {
    return ModInt(*this) += a;
  }
  constexpr ModInt operator-(const ModInt& a) const {
    return ModInt(*this) -= a;
  }
  constexpr ModInt operator*(const ModInt& a) const {
    return ModInt(*this) *= a;
  }
  constexpr ModInt operator/(const ModInt& a) const {
    return ModInt(*this) /= a;
  }
  constexpr ModInt operator++(){
    *this += ModInt(1);
    return *this;
  }
  constexpr ModInt operator++(int){
    ModInt old = *this;
    ++*this;
    return old;
  }
  constexpr ModInt operator--(){
    *this -= ModInt(1);
    return *this;
  }
  constexpr ModInt operator--(int){
    ModInt old = *this;
    --*this;
    return old;
  }
  constexpr bool operator==(const ModInt& a) const {
    return x == a.x;
  }
  constexpr bool operator!=(const ModInt& a) const {
    return x != a.x;
  }
  constexpr ModInt pow(int64 r) const {
    if(!r)return 1;
    ModInt res = pow(r>>1);
    res *= res;
    if(r & 1) res *= *this;
    return res;
  }
  constexpr ModInt inv() const {
    return pow(mod-2);
  }
  friend istream& operator>>(istream& is, ModInt& a){
    int64 t;
    is >> t;
    a = ModInt(t);
    return is;
  }
  friend ostream& operator<<(ostream& os, const ModInt& a){
    return os << a.x;
  }
};
using mint = ModInt<MOD>;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int32 n;
    cin >> n;
    vector<mint> fact(n+1,1);
    REP(i,n)fact[i+1] = fact[i] * (i+1);
    ANS(fact[n]);
    return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <cstdio>
#include <stack>
#include <queue>
#include <vector>
#define ll long long
const int N=1e6+10;
using namespace std;
int x;
int ifprime(int x){
    int flag=1;
    for(int i=2;i<=sqrt(x);i++){
        if(x%i==0)
            flag=0;
    }
    if(flag==1) return true;
    else   return false;
}

int main() {
cin>>x;
for(int i=x;i>0;i++){
    if(ifprime(i)){
        cout<<i<<endl;
        return 0;
    }
}
    return 0;
}

Measured memory_bytes: 256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
#define ll long long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
static const ll MAX = 1000000000000000;
static const int NIL = -1;
using namespace std;
const long double EPS = 0.0000000001;
const long double PI = (acos(-1));
const int MOD = 1000000007;

int main() {
  int n, m;
  cin >> n >> m;
  // even + even = even ---> ok
  // odd + odd = even ---> ok
  // odd + even = odd ---> ng
  int ans = n * (n - 1) / 2 + m * (m - 1) / 2;
  cout << ans << endl;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define REP(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
#define FORR(i, a, b) for(int i=(b)-1; i>=(a); --i)

#define DEBUG(x) cout<<#x<<": "<<x<<'\n'
#define DEBUG_VEC(v) cout<<#v<<":";REP(i, v.size())cout<<' '<<v[i];cout<<'\n'
#define ALL(a) (a).begin(), (a).end()

#define CHMIN(a, b) a=min((a), (b))
#define CHMAX(a, b) a=max((a), (b))

const ll MOD=1000000007ll;
// const ll MOD=998244353ll;
#define FIX(a) ((a)%MOD+MOD)%MOD

const double EPS=1e-11;
#define EQ0(x) (abs((x))<EPS)
#define EQ(a, b) (abs((a)-(b))<EPS)

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	int ans=1e9;
	REP(i, n+1){
		int tmp=i, cnt=0;
		while(tmp>0){
			cnt+=tmp%6;
			tmp/=6;
		}
		tmp=n-i;
		while(tmp>0){
			cnt+=tmp%9;
			tmp/=9;
		}
		ans=min(ans, cnt);
	}
	cout<<ans<<'\n';
	return 0;
}


Measured memory_bytes: 256