akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define dbg(x) cerr << #x << ": " << x << endl;
#define dbg2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define dbg3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define dbgB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

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 (b<a) { a = b; return 1; } return 0; }

template<typename T>
void print1(T begin, T end) {
	while (begin != end) {
		cerr << (*begin) << " ";
		*begin++;
	}
	cerr << endl;
}

template<typename T>
void print2(T Array, int height, int width) {
	for (int i = 0; i < height; i++) {
		for (int j = 0; j < width; j++) {
			cerr << " " << Array[i][j];
		}
		cerr << endl;
	}
}

void print() { std::cerr << endl; }
template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
	std::cerr << head << " ";
	print(std::forward<Tail>(tail)...);
}

template<class T>
void Add(T &a, const T &b, const T &mod=1000000007) {
	int val = ((a % mod) + (b % mod)) % mod;
	if (val < 0) { val += mod; }
	a = val;
}

template <typename X, typename T> auto vectors(X x, T a) { return vector<T>(x, a); }
template <typename X, typename Y, typename Z, typename... Zs> auto vectors(X x, Y y, Z z, Zs... zs) { auto cont = vectors(y, z, zs...); return vector<decltype(cont)>(x, cont); }

// ------------------------------------------------------------------------------------------

int N;
const int maxV = 222222;
vector<int> G[maxV]; // 頂点情報のみのグラフ

// treeDFS(親, 現在地, 根から現在地までの距離, 根からの最大の距離, 根から最大の距離となる頂点
void treeDFS(int from, int current, int dist, int &maxDist, int &maxVertex) {
    // 距離と終点を更新
    if (dist > maxDist) {
        maxDist = dist;
        maxVertex = current;
    }

    for (auto to : G[current]) {
        // 逆流を防ぐ
        if (to == from) continue;
        treeDFS(current, to, dist + 1, maxDist, maxVertex);
    }
}

int getTreeDiameter() {
    int start = 0, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
    start = end, end = 0, maxDist = 0;
    treeDFS(-1, start, 0, maxDist, end);
		return maxDist;
}

signed main() {
	cin >> N;
	rep (i, N-1) {
		int a, b;
		cin >> a >> b;
		a--, b--;
		G[a].push_back(b);
		G[b].push_back(a);
	}

	int dia = getTreeDiameter();
	// int dia;
	// cin >> dia;
	
	dbg(dia)
	dia++;
	puts(dia % 3 == 2 ? "Second" : "First");


	return 0;
}

Measured memory_bytes: 27392
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
#define ll  long long 
  vector<ll>to[1000005];
int main(){
  ll a;cin>>a;
  for(ll b=sqrt(a);b>0;b--){
    if(a%b==0){
      cout<<a/b+b-2;
      return 0;
    }
  }
}


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

#define forn(i, s, f) for (int i = (s); i <= (f); ++i)
#define for1(i, s, f) for (int i = (s); i >= (f); --i)

using namespace std;

long long n, a, b;

long long l, r;

int main()
{
    cin >> n >> a >> b;
//    if (a > b || (n == 1 && a != b))
//    {
//        cout << 0;
//        return 0;
//    }
//    if (a == b)
//    {
//        cout << n;
//        return 0;
//    }
    l = ((n - 1) * a) + b;
    r = ((n - 1) * b) + a;
    cout << max(0ll, (r - l + 1));
}


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

using namespace std;

int a[100010];
long long ans;

int main()
{
    int n,i,t=1e9,num=0;
    cin >> n;
    for(i=0; i<n; i++)
    {
        scanf("%d",&a[i]);
        if(a[i]<0) num++;
        if(t>abs(a[i])) t=abs(a[i]);
        ans+=abs(a[i]);
    }
    if(num%2!=0) ans-=2*t;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<stdio.h>  
#include<math.h> 
#include<stdlib.h>
int a[105][105],b[10000+50];  
   
int main ()  
{  
    int h,w;  
    int wanglianhua=100; 
    while(scanf("%d %d",&h,&w)!=EOF)  
    {  
        int i,j,t,k=0;  
        scanf("%d",&t);  
        for(i=0;i<t;i++)  
            scanf("%d",&b[i]);  
        for(i=0;i<h;i++)  
        {  
            if(i%2==0)  
                for(j=0;j<w;j++)  
                {  
                    a[i][j]=k+1;  
                    b[k]--;  
                    if(b[k]==0)  
                        k++;  
                }  
            if(i%2==1)  
                for(j=w-1;j>=0;j--)  
                {  
                    a[i][j]=k+1;  
                    b[k]--;  
                    if(b[k]==0)  
                        k++;  
                }  
        }  
        for(i=0;i<h;i++)  
        {  
            for(j=0;j<w-1;j++)  
                printf("%d ",a[i][j]);  
            printf("%d\n",a[i][w-1]);  
        }  
    }  int wang_lianhua=200; 
}  

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define For(i,a,b) for(i=a;i<b;i++)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define mod 1000000007

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll euclidean_gcd(ll a, ll b) {
  if(a<b) return euclidean_gcd(b, a);
  ll r;
  while ((r=a%b)){a=b;b=r;}
  return b;
}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

void printmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  For(i,0,H+2){
    For(j,0,W+2){cout<<a[i*(W+2)+j];}
    cout<<endl;
  }
}
void inputmap(vector<ll>& a,ll H,ll W){
  ll i,j;
  string ss;
  For(i,1,H+1){
    cin>>ss;
    For(j,1,W+1){
      if(ss[j-1]=='#'){
        a[i*(W+2)+j]=1;
      }else{
        a[i*(W+2)+j]=0;
      }
    }
  }
}


int main(){
  int i,N,x,ans=0;
  cin>>N;
  vector<int> c(13,0);
  rep(i,N){
    cin>>x;
    c[x/400]++;
  }
  x=0;
  rep(i,13){
    if(i<8&&c[i]>0){x++;}
    else{ans+=c[i];}
  }
  if(x==0){x++;ans--;}
  cout<<x<<" "<<x+ans<<endl;
  return 0;
}


Measured memory_bytes: 256
//============================================================================
// Name        : atcoder.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include <iostream>
using namespace std;
string S1,S2,S3;
int main(){

	cin>>S1>>S2>>S3;

	for (int j=0;j<1;j++){
		S1[ j ]=toupper(S1[ j ]);
	}
	for (int j=0;j<1;j++){
		S2[ j ]=toupper(S2[ j ]);
	}
	for (int j=0;j<1;j++){
		S3[ j ]=toupper(S3[ j ]);
	}





	cout<<S1[0]<<S2[0]<<S3[0]<<endl;
	return 0;
}


Measured memory_bytes: 256
#!/usr/bin/env python3

import sys

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return


def main():
    n = read(int)
    as_ = read_list(int)

    buka = [0] * (n + 1)
    for i, a in enumerate(as_):
        buka[a] += 1

    for i in range(1, n + 1):
        print(buka[i])

if __name__ == "__main__":
    main()


Measured memory_bytes: 32180
#include<iostream> 
using namespace std;
int main() 
{ 
  pair<int,int> t, a; 
  cin>>t.first>>t.second; 
  cin>>a.first>>a.second; 
  int x=(t.first+a.second-1)/a.second; 
  int y=(t.second+a.first-1)/t.second; 
  if(x>=y) cout<<"Yes"; 
  else
   	cout<<"No"; 
  return 0; 
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define N 3
using namespace std;
struct Graph{
	char r, c;
	string m;
	int cnt;
	bool ok(){
		bool ans = 1;
		for(int i=0; i<N*N; i++)
			ans &= (m[i] == (i+1) % (N*N));
		return ans;
	}
	void get(){
		for(int i=0; i<N; i++)
		for(int j=0; j<N; j++){
			cin >> cnt;
			m.push_back(cnt);
			if(cnt == 0) r = i, c = j;
		}
		cnt = 0;
	}
	bool go(int i, int j){
		int r1=i+r, c1=j+c;
		if(!legal(r1, c1)) return 0;
		m[r*N+c] = m[r1*N+c1];
		m[r1*N+c1] = 0;
		r = r1, c = c1;
		cnt++;
		return 1;
	}
	bool legal(int r1, int c1){
		return (r1>=0 && r1<N && c1>=0 && c1<N);
	}
};
queue <Graph> Q;
map <string , bool> V;
int bfs(){
	int cmd[4][2]={{1,0}, {-1,0}, {0,1}, {0,-1}};
	Graph t0,t1;
	while(!Q.empty()){
		t0 = Q.front();
		Q.pop();
		if(t0.ok()) return t0.cnt;
		for(int i=0; i<4; i++){
			t1 = t0;
			if(t1.go(cmd[i][0], cmd[i][1]))
				if(!V[t1.m])
					Q.push(t1), V[t1.m] = 1;
		}
	}
	return -1;
}
int main()
{	
	Graph a; a.get();
	Q.push(a);
	V[a.m] = 1;
	cout << bfs() << endl;
	return 0;
}



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

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    int ans = 0;
    for (int i = 1; i < n - 1; i++)
        if (a[i-1] < a[i] && a[i] < a[i+1] || a[i+1] < a[i] && a[i] < a[i-1])
            ans++;
    cout << ans << endl;
    return 0;
}

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

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

    int n, m;
    cin >> n >> m;
    vector<set<int>> r(n + 1);
    deque<int> ans;
    set<int> s;

    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        if (!i)
        {
            ans.push_back(a);
            ans.push_back(b);
            s.insert(a);
            s.insert(b);
        }
        if (s.find(b) == s.end())
            r[a].insert(b);
        if (s.find(a) == s.end())
            r[b].insert(a);
    }

    while (r[ans.back()].size())
    {
        int a = *r[ans.back()].begin();
        s.insert(a);
        ans.push_back(a);
        for (auto x : r[a])
        {
            if (s.count(x))
                r[a].erase(x);
        }
    }
    for (auto x : r[ans.front()])
    {
        if (s.count(x))
            r[ans.front()].erase(x);
    }

    while (r[ans.front()].size())
    {
        int a = *r[ans.front()].begin();
        s.insert(a);
        ans.push_front(a);
        for (auto x : r[a])
        {
            if (s.count(x))
                r[a].erase(x);
        }
    }
    cout << ans.size() << endl;
    for (auto x : ans)
        cout << x << ' ';
    cout << endl;

    return 0;
}


Measured memory_bytes: 15360
from collections import deque
H, W = map(int, input().split())
A = [list(input()) for _ in range(H)]
sharps = []
for h, line in enumerate(A):
    sharps += [[h, w, 0] for w, p in enumerate(line) if p == '#']

q = deque(sharps)
while q:
    i, j, score = q.popleft()
    for mi, mj in [[-1, 0], [1, 0], [0, -1], [0, 1]]:
        ni = i + mi
        nj = j + mj
        if ni < 0 or H <= ni or nj < 0 or W <= nj or A[ni][nj] == '#':
            continue
        A[ni][nj] = '#'
        q.append([ni, nj, score+1])
print(score)

Measured memory_bytes: 185320
#define _USE_MATH_DEFINES
#include <math.h>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdlib>

using namespace std;

int main() {
    
    int H,A;
    cin >> H >> A;
    int out = H/A;
    if(H%A != 0) out++;
    cout << out << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    string o, e;

    cin >> o >> e;

    int len = int(o.size()) + int(e.size());
    char pass[len];

    for (int i = 0; i < e.size(); i++) {
        pass[i * 2] = o.at(i);
        pass[i * 2 + 1] = e.at(i);
    }   
    if (o.size() > e.size()) {
        pass[len - 1] = o.at(o.size() - 1);
    }   

    for (int i = 0; i < len; i++) {
        cout << pass[i];
    }   
    cout << endl;


    

}

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

using namespace std;

int main(){
  int N, W;
  cin >> N >> W;
  vector< pair<int,int> > vec(N);
  for(int i = 0; i < N; i++) cin >> vec[i].first >> vec[i].second;
  
  vector<int> dp(W+1, -1);
  dp[0] = 0;
  
  for(int i = 0; i <= W; i++){
    if(dp[i] == -1) continue;
    for(int j = 0; j < N; j++)
      if(i+vec[j].second <= W)
        dp[i+vec[j].second] = max(dp[i+vec[j].second], dp[i]+vec[j].first);
  }
  int ans = 0;
  for(int i = 0; i <= W; i++) ans = max(ans, dp[i]);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1236
#include<bits/stdc++.h>
#define N 100005
using namespace std;
int n,m,s,t,f[N][3];
vector<int>a[N];
bool b[4][N];
struct data{
	int x,v,id;
};
queue<data>Q;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		a[x].push_back(y);
	}
	scanf("%d%d",&s,&t);
	for(int i=1;i<=n;i++)
		for(int j=0;j<=2;j++)f[i][j]=1e9;
	Q.push((data){s,0,0});
	while(!Q.empty()){
		data now=Q.front();Q.pop();
		int x=now.x,v=now.v,id=now.id;
		if(f[x][id]<=v)continue;
		f[x][id]=v;
		for(int i=0;i<(int)a[x].size();i++)Q.push((data){a[x][i],v+1,(id+1)%3});
	}
	if(f[t][0]==1e9)puts("-1");
	else printf("%d\n",f[t][0]/3);
	return 0;
}

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

using namespace std;
const long long INF = 1LL <<60;

int main(void){
  string s,t;
  cin>>s;
  cin>>t;
  long s_len=s.length();
  long t_len=t.length();
  long dp[s_len+1][t_len+1];
  int i,j,k;
 
  for(j=0;j<=t_len;j++){
    dp[0][j]=0;
  }
  
  for(i=0;i<s_len;i++){
    dp[i+1][0]=0;
    for(j=0;j<t_len;j++){
      if(s[i]==t[j]){
        dp[i+1][j+1]=dp[i][j]+1;
      }
      else{
        if(dp[i+1][j]>dp[i][j+1]){
          dp[i+1][j+1]=dp[i+1][j];
        }
        else{
          dp[i+1][j+1]=dp[i][j+1];
        }
      }
    }
  }   
  
  i=s_len;
  j=t_len;
  string res="";
  while(i>0 && j>0){
    if(dp[i][j-1]==dp[i][j]){
      j--;
    }
    else if(dp[i-1][j]==dp[i][j]){
      i--;
    }
    else{
      res=s[i-1]+res;
      i--;j--;
    }
  }
  
  cout<<res<<endl;
  return 0;
}

Measured memory_bytes: 70656
#include <bits/stdc++.h>
template<class T> inline bool chmin(T&a, T b){if(a > b){a = b; return true;}else{return false;}}
template<class T> inline bool chmax(T&a, T b){if(a < b){a = b; return true;}else{return false;}}
#define ll long long
#define double long double
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=1;i<=(n);i++)
#define mod (ll)(1e9+7)
#define inf (ll)(3e18+7)
#define pi (double) acos(-1.0)
#define P pair<int,int>
#define PiP pair<int,pair<int,int>>
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
using namespace std;

const int MAX = 710000;
long long fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int 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;
    }
}
 
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

long long PAR(int n, int k){
    if(n < k)return 0;
    if(n < 0 || k < 0)return 0;
    return fac[n] * finv[n-k] % mod;
}

int main() {
    int n, m;
    cin >> n >> m;
    COMinit();
    ll ans = PAR(m, n) * PAR(m, n) % mod;
    ll k = -1;
    for(int i = 1; i <= n; i++){
        ll now = k;
        now = now * COM(n, i) % mod;
        now = now * PAR(m, i) % mod;
        now = now * PAR(m-i, n-i) % mod;
        now = now * PAR(m-i, n-i) % mod;
        ans = (ans + now + mod) % mod;
        k *= -1;
    }
    cout << ans << endl;
}

Measured memory_bytes: 20272
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		String s = sc.next();
		String reg = "^[0-9]{" + a + "}-[0-9]{" + b + "}$";
		if(s.matches(reg)) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

	}

}


Measured memory_bytes: 21972
#include<stdio.h>
int main(void) {
    int a, b, c, k,result;
    scanf("%d %d %d %d", &a, &b, &c, &k);
    if (k <= a) {
        result = k;
    }
    else if ((k > a) && (k <= a + b)) {
        result = a;
    }
    else {
        result = a - (k - a - b);
    }
    printf("%d", result);
    return 0;


}

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

int main(){
    int cnt;
    int x,y,a;
    while(1){
        cnt = 0;
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x < y) swap(x,y);
        while(y!=0){
            x %= y;
            a = x;
            x = y;
            y = a;
            cnt++;
        }
        cout << x << " " << cnt << endl;
    }
}

Measured memory_bytes: 1164
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
#define rep(i, n) for (int i = 0, i##_len = (int)(n); i < i##_len; i++)
#define ALL(v) (v).begin(), (v).end()
#define PUTS(x) cout << (x) << endl;
vector<Int> IntsIn(int n) {
    auto v = vector<Int>(0);
    for (int i = 0; i < n; i++) {
        Int a;
        cin >> a;
        v.push_back(a);
    }
    return v;
}
int main() {
    Int n;
    cin >> n;
    auto v = IntsIn(n);
    sort(ALL(v));
    Int ans = 0;
    Int s = 0;
    rep(i, n) {
        auto &a = v[i];
        if (i == 0) {
            s = a;
        } else {
            if (2 * s >= a) {
                ans++;
            } else {
                ans = 0;
            }
            s += a;
        }
    }
    PUTS(ans + 1);
}


Measured memory_bytes: 1400
N = gets.chomp.to_i
a = Array.new(N+1)
str = gets.split
for i in 0..N do
    a[i] = str[i].to_i
end
b = Array.new(N)
str = gets.split
for i in 0...N do
    b[i] = str[i].to_i
end

max = 0
n = 0
for i in 0...N do
    if b[i] > a[i]
        max += a[i]
        n = b[i] - a[i]
        if n > a[i+1]
            max += a[i+1]
            a[i+1] = 0
        else
            max += n
            a[i+1] -= n
        end
    else
        max += b[i]
        n = 0
    end
end

puts max

Measured memory_bytes: 15380
//include
//------------------------------------------
#include <bits/stdc++.h>
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> P;
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);
const long long INF = 1000000007;
//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;
// chmax chmin
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

int main(void){
    int a,b,c,d; cin >> a >> b >> c >> d;
    cout << max(a*b, c*d) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define pb          push_back
#define vi          vector<int>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define endl        "\n"
#define fast        ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define int         long long int
#define mod         1000000007
#define test        int t;cin>>t;while(t--)
#define REP(i,a,b)  for(int i=a,i<=b;i++)
#define MAXN        200001

int32_t main(){
    
    int n;
    cin>>n;
    int arr[n],temp[n];

    set<int>s;
    for(int i=0;i<n;i++){
        cin>>arr[i];
        temp[i]=arr[i];
    }

    sort(temp,temp+n);
    int mx1=temp[n-1],mx2=temp[n-2];

    // cout<<mx1<<" "<<mx2<<endl;
    for(int i=0;i<n;i++){
        if(arr[i]==mx1)
            cout<<mx2<<endl;
        else
            cout<<mx1<<endl;
    }
    return 0;
}

Measured memory_bytes: 6756
v,e=map(int,input().split())
#隣接行列
INF=float('inf')
D=[[INF]*v for index2 in range(v)]
for index3 in range(v):
    D[index3][index3]=0
for index1 in range(e):
    s,t,d=map(int,input().split())
    D[s][t]=d
    #D[t][s]=d


def warshall_floyd():
    global D

    #kがこの位置でなければならない
    for k in range(v):
        for i in range(v):
            for j in range(v):
                D[i][j]=min(D[i][j],D[i][k]+D[k][j])
    
    return D

ans=warshall_floyd()
for index4 in range(v):
    if ans[index4][index4]<0:
        print('NEGATIVE CYCLE')
        break
else:
    for index5 in range(v):
        List=[]
        for index6 in range(v):
            if ans[index5][index6]==INF:
                List.append('INF')
            else:
                List.append(ans[index5][index6])
        print(*List)


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

int main(void) {
	
	int a, b;
	string s;

	cin >> a >> b >> s;

	for (int i = 0; i < a+b+1; i++) {
		if (i == a) continue;
		if (s[a] != '-' ||( s[i] < '0' || s[i] > '9')) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

Measured memory_bytes: 256
//
// Created by Hideaki Imamura on 2020-03-27.
//
# include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef pair <ll, ll> l_l;
typedef pair<int, int> i_i;

template<class T>
inline bool chmax(T &a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}

# define EPS (1e-7)
# define INF (1e9)
# define PI (acos(-1))
//const ll mod = 1000000007;

int N, K;

int main() {
    cin >> N >> K;
    if ((N - 1) * (N - 2) / 2 < K) cout << -1 << endl;
    else {
        cout << N - 1 + (N - 1) * (N - 2) / 2 - K << endl;
        for (int i = 2; i <= N; ++i) cout << 1 << " " << i << endl;
        int a = 2;
        int b = 3;
        for (int i = 0; i < (N - 1) * (N - 2) / 2 - K; ++i) {
            cout << a << " " << b << endl;
            b = (b + 1) % N;
            if (b == 1) {
                b = a + 2;
                a = a + 1;
            } else if (b == 0) b = N;
        }
    }
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long n,d;
    cin>>n>>d;
    long long count=0;
    while(n--){
          long long x,y;
          cin>>x>>y;
          if(sqrt(x*x+y*y)<=d){
              count++;
          }

    }
    cout<<count<<endl;
    return 0;
}

Measured memory_bytes: 3644
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<iostream>
#define LL long long
using namespace std;
const LL inf=(LL)9e18;
LL a[200010],n,x,ans=inf;
int main()
{
	scanf("%lld %lld",&n,&x);
	for(LL i=1;i<=n;i++) scanf("%lld",&a[i]),a[i]+=a[i-1];
	for(LL k=1;k<=n;k++)
	{
		LL cost=3,sum=0;
		for(LL i=n;i>=1;i-=k)
		{
			sum+=(a[i]-a[max(0LL,i-k)])*max(5LL,cost),cost+=2;
			if(sum>ans) break;
		}
		ans=min(ans,sum+(k+n)*x);
	}
	printf("%lld",ans);
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <utility>

using namespace std;

int partition(vector<int>& a, int p, int r) {
    int x = a[r];
    int i = p - 1;
    for (int j = p; j <= r - 1; ++j) {
        if (a[j] <= x) {
            i = i + 1;
            swap(a[i], a[j]);
        }
    }
    swap(a[i + 1], a[r]);
    return i+1;
}

int main()
{
    int n;
    cin >> n;
    int x;
    vector<int> a;
    for (int i = 0; i < n; ++i) {
        cin >> x;
        a.push_back(x);
    }
    int q = partition(a, 0, n - 1);
    cout << a[0];
    for (int i = 1; i < n; ++i) {
        if (i == q) {
            cout << " [" << a[i] << "]";
        }
        else {
            cout << " " << a[i];
        }
    }
    cout << endl;
}



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

const long long INF = 1LL << 60;
long long h[100010];
long long dp[100010];
long long rec(int i) {
    if(dp[i] < INF) return dp[i];
    if(i == 0) return 0;
    long long res = INF;
    res = min(res, rec(i-1) + abs(h[i] - h[i-1]));
    if(i > 1) res = min(res, rec(i-2) + abs(h[i] - h[i-2]));
    return dp[i] = res;
}

int main() {
    int N; cin >> N;
    for(int i = 0; i < N; ++i) cin >> h[i];
    for(int i = 0; i < N; ++i) dp[i] = INF;
    
    cout << rec(N-1) << endl;
}


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

#define ll long long
using namespace std;

int main(){
    int n;
    cin>>n;
    vector <int> l(2*n);
    for(int i=0;i<2*n;i++)
        cin>>l[i];
    ll sum = 0;
    sort(l.begin(),l.end());
    for(int i=0;i<2*n;i++){
        if(i%2==0)
            sum+=l[i];
    }    
    cout<<sum<<endl;
    
    return 0;
}

Measured memory_bytes: 256
import sys

n, m, k = map(int, sys.stdin.readline().split())
ab = [tuple(map(int, sys.stdin.readline().split())) for _ in range(m)]
cd = [tuple(map(int, sys.stdin.readline().split())) for _ in range(k)]
friend = [[] for _ in range(n+1)]
for a, b in ab:
    friend[a].append(b)
    friend[b].append(a)
block = [[] for _ in range(n+1)]
for c, d in cd:
    block[c].append(d)
    block[d].append(c)

root = list(range(n+1))
size = [1] * (n + 1)
height = [1] * (n + 1)

def find_root(u):
    v = root[u]
    if v == u:
        return u 
    w = find_root(v)
    root[u] = w 
    return w 

def unite(u, v):
    ru = find_root(u)
    rv = find_root(v)
    if ru != rv:
        if height[ru] >= height[rv]:
            root[rv] = ru 
            height[ru] = max(height[ru], height[rv] + 1)
            size[ru] += size[rv]
        else:
            root[ru] = rv 
            size[rv] += size[ru]

def main():
    for u in range(1, n+1):
        for v in friend[u]:
            unite(u, v)

    for u in range(1, n+1):
        find_root(u)

    for u in range(1, n+1):
        ru = root[u]
        cnt = size[ru] - 1  - len(friend[u])
        for v in block[u]:
            if root[v] == ru:
                cnt -= 1
        yield cnt

if __name__ == '__main__':
    ans = main()
    print(*ans, sep=' ')

Measured memory_bytes: 61820
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
int per10(int x) {
    return x * 0.1;
}
int per8(int x) {
    return x * 0.08;
}
int main() {
    int A, B;
    cin >> A >> B;
    int ans = 0;
    for (int i = 1; i <= 1000000; ++i) {
        if (per8(i) == A && per10(i) == B) {
            ans = i;
            break;
        }
        else if (per8(i) > A || per10(i) > B) {
            ans = -1;
            break;
        }
    }
    cout << ans << endl;
}


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

using namespace std;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    long long a, b, c, k;
    cin >> a >> b >> c >> k;
    long long ans = a - b;
    if(k & 1)
        ans *= -1;
    cout << ans << '\n';
    return 0;
}

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

using namespace std;


typedef long long ll;

int N;
vector<int> P, Q;

void solve(){
    vector<int> v;
    for (int i = 0; i < N; i++) v.push_back(i);
    int i = 0;
    int a, b;
    do{
        if(v == P) a = i;
        if(v == Q) b = i;
        i++;
    }while(next_permutation(v.begin(), v.end()));
 
    cout << max(a, b) - min(a, b) << endl;
}


int main(){

    cin >> N;
    for (int i = 0; i < N; i++)
    {
        int p;
        cin >> p;
        P.push_back(p - 1);
    }

    for (int i = 0; i < N; i++)
    {
        int q;
        cin >> q;
        Q.push_back(q - 1);
    }
    

    solve();

    return 0;

}

Measured memory_bytes: 256
for _ in [0]*int(input()):
    s=input()
    a='NA'
    if s[:2]==">'" and s[-1]=='~' and '#' in s:
        s=s[2:-1].split('#')
        a=[a,'A'][set(s[0])==set(s[1])=={'='} and len(set(s))==1]
    elif s[:2]=='>^' and s[-2:]=='~~':
        s=s[2:-2]
        a=['NA','B'][len(s)==2*s.count('Q=') and len(s)>0]
    print(a)

Measured memory_bytes: 7528
#include<bits/stdc++.h>
  #define f(i,a,b) for(int i=a;i<b;i++)
  #define ll long long
  #define vll vector<long long>
  #define mll map<ll,ll>
  #define pll pair<long long,long long>
  #define pb(x) push_back(x)
  #define F first
  #define S second
  #define print(v) for(auto it:v)cout<<it<<" "
  #define mod 1000000007   //10^9 +7
  #define sorty(v) sort(v.begin(),v.end())
  #define it(v) v.begin(),v.end()
using namespace std;  

int main() {
  int A,B,flag=0;
  cin>>A>>B;
vll ar;
f(i,0,10)ar.pb(B*10+i);
f(i,0,10){
  int a=ar[i]*0.08;
  if(a==A){
    cout<<ar[i];
    flag=1;
    break;
  }
}
if(flag==0)cout<<-1;
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(void){
	int i,j,flg,flg2,c;
	char n[5];
	cin>>n;
	flg2=0;
	for(i=0;i<2;i++){
		flg=1;
		for(j=i+1;j<=i+2;j++){
			if(n[i]!=n[j]){
				flg=0;
				break;
			}
		}
		if(flg==1) flg2=1;
	}
	if(flg2==1) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

def make_divisors(n):  # nの約数を列挙
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)
    divisors.sort(reverse=True)
    return divisors

N, M = lr()
primes = make_divisors(M)
answer = 1
for p in primes:
    if p * N <= M:
        answer = p
        break
print(answer)
# 10

Measured memory_bytes: 3064
#include <stdio.h>
#include <string.h>
int main(void){
    // Your code here!
    int cnt;
    char s[4];
    scanf("%s",s);
    if(strcmp(s,"SUN")==0) cnt=7;
    if(strcmp(s,"MON")==0) cnt=6;
    if(strcmp(s,"TUE")==0) cnt=5;
    if(strcmp(s,"WED")==0) cnt=4;
    if(strcmp(s,"THU")==0) cnt=3;
    if(strcmp(s,"FRI")==0) cnt=2;
    if(strcmp(s,"SAT")==0) cnt=1;
    printf("%d\n",cnt);
    return 0;
    
}


Measured memory_bytes: 128
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<cmath>
#include<list>
#include<stack>
#include<queue>
#include<cctype>
#include<iomanip>
#include<functional>
#include<numeric>
#include<map>
#include<set>
#define EPS 1e-10
using namespace std;
typedef long long llong;
int main() {
	int a, b, c;
	while (cin >> a >> b >> c) {
		int x[11];
		for (int i = 1; i < 11; i++)x[i] = 1;
		x[a] = x[b] = x[c] = 0;
		int me = a + b;
		int cnt = 0;
		for (int i = 1; i <= 20-me; i++) {
			if (x[i])cnt++;
		}
		double p = (double)cnt / 7;
		if (p >= 0.500)cout << "YES" << endl;
		else cout << "NO" << endl;
	}
	return 0;
}

Measured memory_bytes: 3096
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<pll,ll> ppll;
typedef pair<ll,pll> plpl;
#define rep(i,n) for(int i=0; i<((int)n); i++)
#define REP(i,n) for(int i=0; i<=((int)n); i++)
#define srep(i,a,n) for(int i=a; i<((int)n); i++)
#define SREP(i,a,n) for(int i=a; i<=((int)n); i++)
#define rrep(i,n) for(int i=n-1; i>=0; i--)
#define RREP(i,n) for(int i=n; i>=0; i--)
#define INF 1000000000
const int mod = INF+7;

int main(){
  int N;
  cin >> N;
  if(N%2==1){
    printf("%f\n", (double)(N+1)/2/N);
  }
  else{
    printf("%f\n", (double)N/2/N);
  }
}


Measured memory_bytes: 256
n = int(input())
p = [int(i) for i in input().split()]
ans = 0

for i in range(1,n-1):
    if p[i] < p[i+1] and p[i] > p[i-1]:
        ans += 1
    elif p[i] > p[i+1] and p[i] < p[i-1]:
        ans += 1

print(ans)

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

int main(){
  int n;
  const int max_n = 2*1e5;
  cin >> n;
  int a[max_n + 1];
  for(int i = 0; i < n; i++) cin >> a[i];

  vector<int> dp(2*1e6, 0);
  for(int i = 0; i < n; i++){
    int now = a[i];
    if(dp[now] != 0) {
      dp[now] ++;
      // continue;
      now = 1e7;
    }
    while(now <= 1e6){
      // if(dp[now] == 1) break;
      dp[now] ++;
      now += a[i];
    }
  }
  int ans = 0;
  for(int i = 0; i < n; i++){
    if(dp[a[i]] == 1) ans ++;
  }

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

Measured memory_bytes: 11920
H, W = map(int, input().split())
maze = [list(input()) for i in range(H)]
dp = [[float('inf')]*W for i in range(H)]
dp[0][0] = 0

for y in range(H):
    for x in range(W):
        if y == 0 and x == 0:
            continue
        
        if x >= 1:
            if maze[y][x - 1] == "." and maze[y][x] == "#":
                dp[y][x] = min(dp[y][x - 1] + 1, dp[y][x])
            else:
                dp[y][x] = min(dp[y][x - 1], dp[y][x])
        
        if y >= 1:
            if maze[y - 1][x] == "." and maze[y][x] == "#":
                dp[y][x] = min(dp[y - 1][x] + 1, dp[y][x])
            else:
                dp[y][x] = min(dp[y - 1][x], dp[y][x])

if maze[0][0] == "#":
    print(dp[-1][-1] + 1)
else:
    print(dp[-1][-1])

Measured memory_bytes: 3188
#include<bits/stdc++.h>
#define ll long long
#define F first
#define S second
using namespace std;

const int N = 1e5 + 100 , mod = 1e9 + 7;
int n , par[N];
ll mem[N][3];
bool leaf[N];
vector<int> adj[N];

void parents(int u , int v){
	par[v] = u;
	int vis = 0;
	for(auto x : adj[v]){
		if(x == u) continue;
		parents(v ,x);
		vis ++;
	}
	leaf[v] = (vis? 0 : 1);
}

ll dpfs(int t , int u , int c){
	if( leaf[u] ) 	return ( c ? 2 : 1);
	ll &ret = mem[u][c];
	if( ret != -1 ) return ret;
	ll b=1 , w=1;
	for( auto x : adj[u]){
		if(x == t) continue;
		b = (b * (c ? dpfs(u , x , 0):0))%mod;
		w = (w * dpfs(u , x , 1))%mod;
	}
	return ret = (w + b)%mod;
}

int main(){
	memset(mem , -1 , sizeof mem);
	scanf("%d" , &n );
	for(int i=1 ; i<n ; i++){
		int u , v;
		scanf("%d%d" , &u , &v);
		adj[u].push_back(v);
		adj[v].push_back(u);
	}
	parents(1 , 1);
	printf("%lld" , dpfs(1 , 1 , 1));
}


Measured memory_bytes: 15488
#include<bits/stdc++.h>
using namespace std;
const int MAX = 2e5;
int height[MAX];
int memo[MAX];
int n;

int dp(int idx){
    if(idx >= n){
        return 2e9;
    }
    if(idx == n-1){
        return 0;
    }
    int& res = memo[idx];
    if(res != 2e9){
        return res;
    }
    int mn = min(dp(idx+1) + abs(height[idx] - height[idx+1]), dp(idx+2) + abs(height[idx] - height[idx+2]));
    return res = min(res, mn);
}

int main(){
    for(int i = 0; i < MAX; i++) memo[i] = 2e9;
    scanf("%d", &n);
    for(int i = 0; i < n; i++){
        scanf("%d", &height[i]);
    }
    printf("%d", dp(0));
    return 0;
}


Measured memory_bytes: 8084
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
constexpr int INF = 1 << 30;
constexpr int MOD = 1e9 + 7;

int n,m,a;

int main() {
  cin.tie(0); ios_base::sync_with_stdio(false);
  cin >> n >> m;

  priority_queue<int> pq;
  REP(i,n) {
    cin >> a;
    pq.push(a);
  }
  REP(i,m) {
    int t = pq.top(); pq.pop();
    t >>= 1;
    pq.push(t);
  }
  long ans = 0;
  while(pq.size()) {
    ans += pq.top();
    pq.pop();
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 892
s = input()
max_count = 0
count = 0

for i in range(len(s)):
    if s[i] in ['A', 'C', 'G', 'T']:
        count += 1
    else:
        if count > max_count:
            max_count = count
            count = 0

print(max(max_count, count))


Measured memory_bytes: 2940
import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.typecons;
import std.numeric, std.math;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;
	auto a = RDR.ARR;

	long least = long.max;
	foreach (i; 0..201)
	{
		long x = cast(long)i - 100;
		long cost;
		foreach (e; a)
		{
			cost += (e - x)^^2;
		}
		least = min(least, cost);
	}
	
	writeln(least);
	stdout.flush();
	//readln();
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
     
     
//#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define ll long long
#define sd(x) scanf("%d",&x)
#define sld(x) scanf("%lld",&x)
#define pld(x) printf("%lld\n",x)
#define pd(x) printf("%d\n",x)
     
     
int main(){

	int p,q,r;
	sd(p); sd(q); sd(r);

	int max = p;
	if(max < q)max = q;
	if(max < r)max = r;

	pd(p+q+r - max);              
           
     
     
        
    return 0;
}


Measured memory_bytes: 256
(function main() {
  const lines = require('fs').readFileSync('/dev/stdin', 'utf8').trim().split('\n');
  const n1 = Number(lines.shift());
  const arr1 = lines.shift().split(' ').map(Number);
  const n2 = Number(lines.shift());
  const arr2 = lines.shift().split(' ').map(Number);

  const solve = memoization(function(i, m) {
    if (m == 0) return true;
    if (i >= n1) return false;
    return solve(i + 1, m) || solve(i + 1, m - arr1[i]);
  });

  arr2.map(m => solve(0, m) ? 'yes' : 'no').forEach(res => console.log(res));
})();

function memoization(f) {
  var cache = {};
  function innerFunc(...param) {
    let c = cache[param];
    // console.log(cache);
    if (typeof c !== 'undefined') {return c;}
    return cache[param] = f(...param);
  }
  return innerFunc;
}



Measured memory_bytes: 25300
#include <iostream>
#include <vector>
#include <queue>
#include <utility>
#include <cstdio>

using namespace std;

int main() {
  	int h, w;
	cin >> h >> w;
  
  	vector<vector<int>> ar(h, vector<int>(w, -1));
  	queue<pair<int, int>> que;
  	for (int i=0; i<h; i++) {
      	for (int j=0; j<w; j++) {
          	char ch;
            cin >> ch;
            if (ch == '#') {
		        que.push(make_pair(i, j));
              	ar[i][j] = 0;
            }
        }
    }
	
  	int max = 0;
    while(!que.empty()){
		auto i = que.front().first;
      	auto j = que.front().second;
      	que.pop();
      	//printf("[%d,%d]: %d\n", i, j, ar[i][j]);
      
      	int dist = ar[i][j] + 1;
      	bool found = false;
      	if (0<=i-1 && ar[i-1][j]==-1) {
        	que.push(make_pair(i-1, j));
          	ar[i-1][j] = dist;
			found = true;
        }
      	if (i+1<h && ar[i+1][j]==-1) {
        	que.push(make_pair(i+1, j));
          	ar[i+1][j] = dist;
			found = true;
        }
      	if (0<=j-1 && ar[i][j-1]==-1) {
        	que.push(make_pair(i, j-1));
          	ar[i][j-1] = dist;
			found = true;
        }
      	if (j+1<w && ar[i][j+1]==-1) {
        	que.push(make_pair(i, j+1));
          	ar[i][j+1] = dist;
			found = true;
        }
      	
      	if (found){
        	if (max < dist) {
            	max = dist;
            }
        }
    }
  
  	cout << max << endl;
}

Measured memory_bytes: 12160
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <numeric>
#include <set>
#include <queue>
using namespace std;
typedef long long ll;

void solve() {
int a,b;cin>>a>>b;
  cout<<a*b;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	//int t; cin >> t;
	//while (t--)
		solve();


}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
 
using namespace std;
 
 
const int INF = 1e9 + 5;
 
int main(){
 
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
 
    int N, K ;
 
    cin >> N >> K;
 
    vector<int> vi(N);
 
    for(int i = 0; i < N; ++i){
        cin >> vi[i];
    }
 
 
 
    /*
 
    vector<int> dp(K+1, INF);
    dp[0] = 0;
    cout << "bye" << "\n";
 
    for(int i = 1; i < N ; ++i){
        
        dp[ i % (K+1)] = INF;
        for(int j = i-1 ; j >= max(i-K, 0); --j ){
            // dp[i % (K +1)] = INF;
 
            dp[i % (K+1)] = min (dp[i % (K+1)] , abs(vi[i] - vi[j]) + dp[j % (K+1)]);
            // cout << " i is " << i << " and dp of " << i % (K+1) << " is " << dp[i % (K+1)] << "\n";
        }
    }
 
*/
 
    vector<int> dp(N,INF);
    dp[0] = 0;
 
    for(int i = 0; i < N ; ++i){
        
        for(int j = i+1; j <= i+K; ++j){
            if (j < N) {
                dp[j ] =  min(dp[j ]  , abs(vi[i] - vi[j]) + dp[i]);
            }
        }
    }
 
 
 
/*
    
    for(int i : dp){
        cout << i << " ";
    }
    cout << "\n";
*/
    
 
    cout << dp[ (N-1)] << "\n";
    
    return 0;
}

Measured memory_bytes: 1024
using System;
using System.Linq;
using System.IO;
using System.Collections.Generic;
using static System.Math;

class P
{
  static int[] Input(){
    return Console.ReadLine().Split().Select(int.Parse).ToArray();
  }
  static void Main()
  {
    int[] NK = Input();
    int N = NK[0];
    int[] A = Input();
    long R = 0;
    int mnx = 1000000000;
    for(int i=0;i<N-1;i++){
      if (A[i]<0){
        A[i] *= -1;
        A[i+1] *= -1;
      }
      R += A[i];
      mnx = Min(A[i], mnx);
    }
    var sw = new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false};
    Console.SetOut(sw);
    if (A[N-1]<0){
      mnx = Min(A[N-1]*(-1), mnx);
      Console.WriteLine(R-A[N-1] - 2*mnx);
    }else{
      Console.WriteLine(R+A[N-1]);
    }
    Console.Out.Flush();
  }
}


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

int main() {
    string N;
    
    //標準入力
    cin >> N;

    string ans;
    
    //7が含まれてるかを確認
    if(N[0] == '7' || N[1] == '7' || N[2] == '7') {
        ans = "Yes";
    }
    else{
        ans = "No";
    }
    
    //表準出力
    cout << ans << endl;
}


Measured memory_bytes: 3620
#include<queue>
#include<cstdio>
#include<vector>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXM = 200000;
const int MAXN = 300000;

int N, M;
struct edge{
	int u, v, c;
}edges[MAXM + 5];
bool operator < (edge a, edge b) {
	return a.c < b.c;
}
vector<int>G[MAXN + 5];
void addedge(int u, int v) {
	G[u].push_back(v);
	G[v].push_back(u);
}
int vcnt, fa[MAXN + 5], con[MAXN + 5], vis[MAXN + 5];
int dis[MAXN + 5];
int Find(int x) {
	if( fa[x] == x ) return x;
	return fa[x] = Find(fa[x]);
}
void Union(int x, int y) {
	int fx = Find(x), fy = Find(y);
	if( fx != fy ) fa[fx] = fy;
}
void bfs(int s) {
	for(int i=0;i<=vcnt;i++) dis[i]=-1;
	//memset(dis,-1,sizeof dis);
	queue<int>que; que.push(s);
	dis[s] = 0;
	while( !que.empty() ) {
		int f = que.front(); que.pop();
		for(int i=0;i<G[f].size();i++) {
			if( dis[G[f][i]] == -1 ) {
				dis[G[f][i]] = dis[f] + 1;
				que.push(G[f][i]);
			}
		}
	}
}
int main() {
	while(~scanf("%d%d", &N, &M)){
        for(int i=0;i<=2*N;i++) G[i].clear();
        edges[M+1].u=edges[M+1].v=edges[M+1].c=0;
        //memset(edges,0,sizeof edges);
        for(int i=1;i<=M;i++)
            scanf("%d%d%d", &edges[i].u, &edges[i].v, &edges[i].c);
        sort(edges+1, edges+M+1);
        vcnt = N; int lst = 1;
        for(int i=2;i<=M+1;i++) {
            if( edges[i].c != edges[i-1].c ) {
                for(int j=lst;j<i;j++) {
                    fa[edges[j].u] = edges[j].u;
                    fa[edges[j].v] = edges[j].v;
                    con[edges[j].u] = con[edges[j].v] = 0;
                    vis[edges[j].u] = vis[edges[j].v] = false;
                }
                for(int j=lst;j<i;j++)
                    Union(edges[j].u, edges[j].v);
                for(int j=lst;j<i;j++) {
                    if( fa[edges[j].u] == edges[j].u )
                        if( con[edges[j].u] == 0 )
                            con[edges[j].u] = (++vcnt);
                    if( fa[edges[j].v] == edges[j].v )
                        if( con[edges[j].v] == 0 )
                            con[edges[j].v] = (++vcnt);
                }
                for(int j=lst;j<i;j++) {
                    if( !vis[edges[j].u] ) {
                        addedge(edges[j].u, con[Find(edges[j].u)]);
                        vis[edges[j].u] = true;
                    }
                    if( !vis[edges[j].v] ) {
                        addedge(edges[j].v, con[Find(edges[j].v)]);
                        vis[edges[j].v] = true;
                    }
                }
                lst = i;
            }
        }
        bfs(1);
        if( dis[N] == -1 ) puts("-1");
        else printf("%d\n", dis[N] / 2);
	}
}


Measured memory_bytes: 24192