akhauriyash/Code-Regression huggingface dataset:
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;// (int)3e18;
const int maxn = 200010;



int main(){
        _
        unordered_map<int,int>mp;
        int n; cin >> n;
        vi a(n+2);
        rep1(i,1,n){
            cin >> a[i];
            mp[a[i]]++;
        }
        ll ans = 0;
        rep1(i,1,n){
		bool f = true;
		for (ll j = 1; j * j <= a[i]; j++) {
			if (a[i] % j == 0) {
				if (j == a[i] and mp[j] >= 2 or j != a[i] and mp[j] >= 1 or a[i]/j == a[i] and mp[a[i]/j] >= 2 or a[i]/j != a[i] and mp[a[i]/j] >= 1) {
					f = false;
					break;
				}
			}
		}
		if (f) ans++;
	}
    cout<<ans<<endl;



return 0;
}



Measured memory_bytes: 32556
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        Scanner sc = new Scanner(System.in);
        int l = sc.nextInt();
        int r = sc.nextInt();
        int pL = l % 2019;
        int pR = r % 2019;
        
        int min = Integer.MAX_VALUE;
        if(r - l >= 2019 || l <= 2019 && 2019 <= r)
        	min = 0;
        else {
        	for(int i = pL; i <= pR; i++) {
        		for(int j = pL; j <= pR; j++) {
        		    if(j == i) continue;
        			min = Math.min(min, i * j % 2019);
        		}
        	}
        }
        System.out.println(min);
    }
}


Measured memory_bytes: 23764
#include<iostream>
#include<stdlib.h>

using namespace std;
//question
// A: Kind of Refrigerator (0<= i <= A)
// B: Kind of Microwave    (0<= j <= B)
// M: Kind of Coupon
// Condition:  If you buy Xi + Yi at the same time, You can get cheaper Ci yen.

int main(void)
{
  int A, B, M;
  cin >> A >> B >> M;

  int *a = new int[A];
  int *b = new int[B];
  int *ans = new int[M];

  // Get A elements
  for(int i=0; i<A; i++) cin >> a[i];
  // Get B elements
  for(int i=0; i<B; i++) cin >> b[i];

  
  int min_a = a[0];
  int min_b = b[0];
  for(int i=0; i<A; i++) min_a = std::min(min_a, a[i]);
  for(int i=0; i<B; i++) min_b = std::min(min_b, b[i]);


  int min = min_a + min_b;
  // Get M elements
  int t,t2,t3;
  for(int i=0; i<M; i++)
	{
	  cin >> t >> t2 >> t3;
	  ans[i] = a[t-1] + b[t2-1] - t3;
	}
  
  for(int i=0; i<M; i++) min = std::min(min, ans[i]);
  
  cout << min << endl;	

  delete[] a;
  delete[] b;
  delete[] ans;
  
  return 0;
}


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

using namespace std;

#define pb push_back
#define mp make_pair
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
typedef long long LL;
typedef pair<int, int> PII;

int n;
vector<int> r[200000], b[200000];
int x, y;
int dist[200000], can[200000];
queue<int> q;
vector<PII> all;
set<PII> be;
set<int> se[200000];

int main() {
    scanf("%d", &n);
    scanf("%d%d", &x, &y), --x, --y;
    forn(i, n - 1) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        r[from].pb(to);
        r[to].pb(from);
    }
    forn(i, n - 1) {
        int from, to;
        scanf("%d%d", &from, &to), --from, --to;
        b[from].pb(to);
        b[to].pb(from);
        be.insert(mp(min(from, to), max(from, to)));
        se[from].insert(to);
        se[to].insert(from);
    }
    memset(dist, -1, sizeof dist);
    dist[y] = 0;
    q.push(y);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int to : b[v]) if (dist[to] == -1) {
            dist[to] = dist[v] + 1;
            q.push(to);
        }
    }
    memset(can, -1, sizeof can);
    can[x] = 0;
    q.push(x);
    while (!q.empty()) {
        int v = q.front();
        q.pop();
        for (int to : r[v]) if (can[to] == -1 && can[v] + 1 < dist[to]) {
            can[to] = can[v] + 1;
            q.push(to);
        }
    }
    forn(i, n) if (can[i] != -1) {
        for (int to : r[i]) {
            all.pb(mp(min(i, to), max(i, to)));
        }
    }
    sort(all.begin(), all.end());
    all.erase(unique(all.begin(), all.end()), all.end());
    for (PII x : all) {
        if (be.count(x)) {
            continue;
        }
        int mn = x.first;
        int oth = x.second;
        if (b[x.second].size() < b[x.first].size()) {
            swap(mn, oth);
        }
        bool ok = true;
        for (int to : b[mn]) {
            if (se[to].count(oth)) {
                ok = false;
                break;
            }
        }
        if (ok) {
            cout << -1 << endl;
            return 0;
        }
    }
    int ans = 0;
    forn(i, n) if (can[i] != -1) {
        ans = max(ans, dist[i]);
        for (int to : r[i]) {
            ans = max(ans, dist[to]);
        }
    }
    cout << 2 * ans << endl;
    return 0;
}


Measured memory_bytes: 67824
#include<stdio.h>
int A[101][101];
int G[101];
void Tree(int);

int main(){
  int n, i, j;
 
  scanf("%d", &n);
  for(i = 0; i < n; i++){
     for(j = 0; j < n; j++){
       scanf("%d", &A[i][j]);
    }
  }
   Tree(n);
   return 0;
}

void Tree(int n){
   int i, j, k=1;
   int X[100], cost, min, res=0;
  
  X[0] = 0;
  G[0] = 1;
  for(i = 1; i < n; i++){
    G[i] = 0;
  }
  while(1){
    cost = 2001;
    
    for(i = 0; i < k; i++){
      for(j = 0; j < n; j++){
    if(A[X[i]][j] < cost && A[X[i]][j] != -1 && G[j] != 1){
      cost = A[X[i]][j];
      min = j;
    }
      }
    }
    if(k != n){
      
      X[k] = min;
      G[min] = 1;
      res += cost;    
      k++;
    }

    else  break;

  }

  printf("%d\n", res);

  return;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i< (n); i++)
using ll = long long;
using P = pair<int, int>;
int main()
{
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  if(a+b > c+d) cout << "Left" << endl;
  else if(a+b < c+d) cout << "Right" << endl;
  else cout << "Balanced" << endl;

return 0;
}

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

int main()
{
	auto a = vector<int>(3);
	for(auto i = 0; i < 3; ++i) cin >> a[i];
	sort(a.begin(), a.end());
	cout << a[2] - a[0] << endl;
	return 0;
}

Measured memory_bytes: 256
import heapq

X,Y,A,B,C = map(int,input().split())
P = list(map(lambda x: -int(x),input().split()))
Q = list(map(lambda x: -int(x),input().split()))
R = list(map(lambda x: -int(x),input().split()))
heapq.heapify(P)
heapq.heapify(Q)
heapq.heapify(R)

for _ in range(X):
    a = heapq.heappop(P)
    heapq.heappush(R,a)

for _ in range(Y):
    a = heapq.heappop(Q)
    heapq.heappush(R,a)

s = 0
for _ in range(X+Y):
    s += heapq.heappop(R)

print(-s)

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

using namespace std;

long A[100000];
long B[100000];
long ans[100000];

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(){
    int N, M;
    cin >> N >> M;
    for(int i = 0; i < M; i++){
        cin >> A[i] >> B[i];
        A[i]--;
        B[i]--;
    }
    UnionFind UF(N);
    ans[M-1] = ((long)N*(long)(N-1))/2;
    for(int i = M-1; i >= 1; i--){
        if(UF.findSet(A[i], B[i])){
            ans[i-1] = ans[i];
        }else{
            ans[i-1] = ans[i]-(long)UF.size(A[i])*(long)UF.size(B[i]);
            UF.unionSet(A[i], B[i]);
        }
    }
    for(int i = 0; i < M; i++){
        cout << ans[i] << endl;
    }
}

Measured memory_bytes: 4096
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef list<int> li;

#define all(x) x.begin(),x.end()
#define YES out("YES")
#define NO out("NO")
#define out(x){cout << x << "\n"; return;}
#define FAST     ios_base::sync_with_stdio(false); cin.tie(NULL)
#define print(x){for(auto i:x) cout << i << " "; cout << "\n";}
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a/gcd(a,b))*b

const ll INF64=LLONG_MAX;
const int INF=INT_MAX;
const ld PI=acos(-1);//3.1415926535897932384626433
const ld E=2.71828183;
const int MOD=1e9+7;
template <typename T>
struct segment_tree{

    vector<T>tree;
    int size;
    T DEF;
    void init(int n){
        size=1;
        DEF=INF;
        while(size<n)size*=2;
        tree=vector<T>(2*size,0);
    }

    T merge(T a,T b){return a+b;}

    void set(int i,int x,T v,int lx, int rx){
        if(rx-lx==1){
            tree[x]=v;
            return;
        }
        int m=(rx+lx)/2;
        if(i<m){
            set(i,2*x+1,v,lx,m);
        }
        else{
            set(i,2*x+2,v,m,rx);
        }
        tree[x]=merge(tree[2*x+1],tree[2*x+2]);
    }
    void set(int i,T v){
        set(i,0,v,0,size);
    }
    T sum(int l,int r,int x,int lx,int rx){
        if(r<=lx || rx<=l) return 0;//change
        else if(l<=lx && rx<=r)return tree[x];
        int m=(lx+rx)/2;
        return merge(sum(l,r,2*x+1,lx,m),sum(l,r,2*x+2,m,rx));
    }
    T sum(int l,int r){
        return sum(l,r+1,0,0,size);
    }
    void print_tree(){
        for(int i=0; i<tree.size(); i++)
            cout << to_string(tree[i]) << " ";
        cout << "\n";
    }
};
vi bfs(vector<vi>adj, int src){
    queue<int>q;
    vi d(adj.size(),INF);
    q.push(src);
    d[src]=0;
    while(!q.empty()){
        int c=q.front();
        q.pop();
        for(int nbr:adj[c]){
            if(d[nbr]==INF)
                q.push(nbr);
            d[nbr]=min(d[nbr],d[c]+1);
        }
    }
    return d;
}
void read(vi& v){
    int n=v.size();
    for(int i=0; i<n; i++)
        cin >> v[i];
}
ld log (ld a,ld b){return log(b)/log(a);}
ll power(ll base, ll exp,ll M=LLONG_MAX){//(base^exp)%M
    ll res=1;
    while(exp){
        if(exp%2==1)res=((res%M)*(base%M))%M;
        base=((base%M)*(base%M))%M;
        exp/=2;
    }
    return res;
}

void solve();

int main() {
    FAST;
    int t = 1;
    // cin >> t;
    while(t--)
        solve();
}
void solve(){
    string s;
    cin >> s;
    int sum=0;
    for(char c:s)
        sum=(sum+c-'0')%9;
    if(sum%9==0) out("Yes")
    else out("No")
}

Measured memory_bytes: 3748
import sys

input = sys.stdin.readline

def calc(p1, p2):
    return ((((p1[0]-p2[0])**2) + ((p1[1]-p2[1])**2)))**0.5


def main():
    ans = 0
    N = int(input())
    l = [list(map(int, input().split())) for _ in range(N)]
    r = []
    for i in range(N-1):
        for j in range(i+1, N):
            r.append(calc(l[i], l[j]))
    ans = sum(r)*2/N
    print(f'{ans:.8f}')

if __name__ == '__main__':
    main()

Measured memory_bytes: 9452
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;
const int maxn=1e5;
int n,m;
ll k,v[maxn+8];
int a[maxn+8],ans[maxn+8];
bool vis[maxn+8];

ll read()
{
    ll x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int main()
{
    n=read();
    for (int i=1;i<=n;i++) v[i]=read(),a[i]=i;
    m=read(),k=read();
    for (int i=1;i<=m;i++)
	{
	    int x=read();
	    swap(a[x-1],a[x]);
	}
    for (int i=1;i<n;i++)
	{
	    if (vis[i]) continue;
	    int x=i,cnt=0,y;
	    while(!vis[x]) cnt++,vis[x]=1,x=a[x];
	    y=x=i;
	    for (int j=1;j<=k%cnt;j++) y=a[y];
	    ans[x]=v[y+1]-v[y],x=a[x],y=a[y];
	    while(x!=i) ans[x]=v[y+1]-v[y],x=a[x],y=a[y];
	}
    ll now=v[1];
    for (int i=1;i<=n;i++) printf("%lld.0\n",now),now+=ans[i];
    return 0;
}
	    
	    


Measured memory_bytes: 3072
from collections import defaultdict

n,m = map(int,input().split())
test=list(map(int,input().split()))

test_dict = defaultdict(int)

for j in test:
    test_dict[j] += 1

for k in range(m):
    b, c = map(int, input().split())
    test_dict[c] += b

count = 0
sum_val = 0
for l in sorted(test_dict, reverse=True):
    if n-count>0:
       sum_val += l * min(test_dict[l], n-count)
       count += min(test_dict[l], n-count)
    else:
       break
print(sum_val)

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

using namespace std;

int main(int qtd, char* nome[])
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;
    bool seven = false;
    while (n > 0){
    if (n % 10 == 7){
        seven = true;
        break;
    }
    n /= 10;
    }
    if (seven)
    cout << "Yes\n";
    else
    cout << "No\n";

    return 0;
}

Measured memory_bytes: 3604
#pragma GCC optimize("O3")
//#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld  double
#define pii pair<int,int>
#define pip pair<int,pii>
#define ppi pair<pii,int>
#define ppp pair<pii,pii>
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define ff first
#define ss second
#define warmup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const int N = 100003, mod=1e9+7;
const ll inf=(1e9+11);
int dp[N], pre[N];

signed main()
{
    warmup

    int n,k;
    cin>>n>>k;
    int a[n+1],i,j;
    for(i=1;i<=n;++i)
        cin>>a[i];

    for(i=1;i<=n;++i)
    {
        if(i==1)
            fill(dp,dp+a[i]+1,1);
        else
        {
            for(j=0;j<=k;++j)
            {
                dp[j]=pre[j]-(j-a[i]-1>=0 ? pre[j-a[i]-1]:0);
                if(dp[j]<0)
                    dp[j]+=mod;
                if(dp[j]>=mod)
                    dp[j]-=mod;
            }
        }

        pre[0]=dp[0];
        for(j=1;j<=k;++j)
        {
            pre[j]=pre[j-1]+dp[j];
            if(pre[j]>=mod)
                pre[j]-=mod;
        }
    }
    cout<<dp[k];

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include<bits/stdc++.h>
#define ll long long int
#define mod 1000000007
using namespace std;
void solve()
{
   ll n,k;
   cin>>n>>k;
   vector<ll> a(n);
   ll i,j,sum=0;
   for(i=0;i<n;i++)
        cin>>a[i];
    sort(a.begin(),a.end());
    ll ans=0;
    for(i=0;i<n-k;i++)
        ans+=a[i];
    cout<<ans;
}
int main() {
	ll t;
// 	cin>>t;
// 	while(t--)
	    solve();
	return 0;
}

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

int main(void)
{
    int n, m;
    cin >> n;
    double sum = 0;
    rep(i, n)
    {
        double x; string s;
        cin >> x >> s;
        if(s == "JPY") sum += x;
        else sum += x*380000;
    }
    printf("%.10f\n", sum);
    return 0;
}

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


int main(){
    int n ;
    cin >> n ;
    int a ;
    for (size_t i = 0; i < n; i++)
    {
        cin >> a ;
        if (a % 2 == 1)
        {
            cout << "first" << endl ;
            return 0 ;
        }
        
    }
    cout << "second" << endl ;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> P3;
typedef pair<P, P> PP;
constexpr ll MOD = ll(1e9 + 7);
constexpr int IINF = INT_MAX;
constexpr ll LLINF = LLONG_MAX;
constexpr int MAX_N = int(1e5) + 5;
constexpr double EPS = 1e-9;
constexpr int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i > 0; i--)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

int n, m;
vector<ll> a, b, c, p, cnt;

int main() {
    cin >> n >> m;
    a.resize(n);
    b.resize(n);
    c.resize(n);
    cnt.resize(n,0);
    p.resize(m);
    for(int i=0;i<m;i++){
        cin >> p[i];
    }
    for(int i=0;i<n-1;i++){
        cin >> a[i] >> b[i] >> c[i];
    }
    for(int i=0;i<m-1;i++){
        int l = p[i]-1, r = p[i+1]-1;
        if(l > r) swap(l, r);
        cnt[l]++;
        cnt[r]--;
    }
    for(int i=0;i<n-1;i++){
        cnt[i+1] += cnt[i];
    }
    ll ans = 0;
    for(int i=0;i<n-1;i++){
        ans += min(a[i]*cnt[i], b[i]*cnt[i]+c[i]);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 6780
#!/usr/bin/env python
# coding: utf-8

# In[59]:


c = []
for _ in range(3):
    c.append(list(map(int, input().split())))


# In[52]:


import numpy as np


# In[60]:


c_np = np.array(c)


# In[62]:


flag = True
for a1 in range(max(c_np[0])+1):
    b = [x - a1 for x in c_np[0]]
#     print("a1=%s"%a1, "b=%s"%b)
    a_tmp = c_np[:,0] - b[0]
#     print("i=0", "a=%s"%a_tmp)
    for i in range(2):
        a = c_np[:,i+1] - b[i+1]
#         print("i=%s"%(i+1), "a_tmp=%s"%a_tmp, "a=%s"%a)
        if np.allclose(a_tmp,a):
            a_tmp = a
        else:
            print("No")
            flag = False
            break
    else:
        continue
    break
if flag:
    print("Yes")


# In[ ]:






Measured memory_bytes: 13392
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author aajisaka
 */

#include<bits/stdc++.h>

using namespace std;

void debug_out() { cerr << endl; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

#define SPEED ios_base::sync_with_stdio(false);cin.tie(nullptr)
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define all(v) v.begin(), v.end()
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; }

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;

constexpr long double PI = 3.14159265358979323846264338327950288L;
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

class AAtCoderContestScheduling {
public:
    void solve(istream& cin, ostream& cout) {
      SPEED;
      int d; cin >> d;
      rep(i, d) {
        cout << (i%26)+1 << '\n';
      }
    }
};

signed main() {
  AAtCoderContestScheduling solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}

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

int main() {
  int a,b;
  cin >> a >> b;
  if (a == b) {
    cout << a+b << endl;
  }
  else
  {
    int max;
    if (a > b) {
      max = a;
    }
    else
    {
      max = b;
    }
    cout <<  max * 2 - 1 << endl;
  }
}


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


int main(){
    int a,b;
    string s;
    cin>>a>>b>>s;

    bool flag = true;
    rep(i,a+b+1){
        if(i < a && s[i]=='-'){
            flag = false;
            break; 
        }

        if(i == a){
            if(s[i]!='-'){
                flag = false;
                break;
            }
        }

        if(i > a && s[i]=='-'){
            flag = false;
            break;
        }
    }

    cout<<(flag ? "Yes" : "No")<<endl;

    return 0;
}


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

using namespace std;

int main() {
  int n;

  cin>>n;

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

  int cnt = 0;
  for(int i=1; i<n-1; i++){
    if((p[i-1]<p[i]&&p[i]<p[i+1]) || (p[i-1]>p[i]&&p[i]>p[i+1])) {
      cnt++;
    }
  }

  cout<<cnt<<endl;

  return 0;
}

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

#define ALL(v) (v).begin(), (v).end()
#define rep(i, n) for (ll i = 0, __##i##_length = (n); i < __##i##_length; i++)
#define rep_reverse(i, n) for (ll i = (n)-1; 0 <= i; i--)
#define FOR(i, from, to) for (ll i = (from), __##i##_end = (to); i < __##i##_end; i++)
#define FOR_REVERSE(i, from, to) for (ll i = (to)-1, __##i##_end = (from); __##i##_end <= i; i--)
#define foreach(e, v) for (const auto e : (v))
#define vfree(v) std::vector<int>().swap(v)
#define DEBUG(x) cout << #x << " = " << (x) << endl

using namespace std;
typedef int64_t ll;
typedef vector<ll> llv;
typedef vector<llv> llvv;

int main()
{
    ll N;
    cin >> N;
    llv X(N);
    llv Y(N);
    rep(i, N)
    {
        cin >> X[i] >> Y[i];
    }

    ll ans = N;
    rep(a, N)
        rep(b, N) if (a != b)
    {
        ll p = X[a] - X[b];
        ll q = Y[a] - Y[b];
        ll tmp = N;
        rep(c, N)
            rep(d, N) if (c != d && X[c] - X[d] == p && Y[c] - Y[d] == q)
                tmp--;
        ans = min(tmp, ans);
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll a, b, c, d;
int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    cin >> a >> b >> c >> d;
    a--;
    ll ans = b / c - a / c + b / d - a / d;
    ll g = __gcd(c, d);
    ll lcm = c / g * d;
    ans -= b / lcm - a / lcm;
    cout << b - a - ans;
    return 0;
}


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

using namespace std;

//FILE *fi=freopen("1.txt","r",stdin);

const long long MOD =1e9+7;

int n,k;
long long a[100001],s[100001],gt[100001],igt[100001];

long long moe(long long a,long long b)
{
    if (b==0) return 1;
    if (b%2==0) return moe((a*a)%MOD,b/2);
    return (a*moe((a*a)%MOD,b/2))%MOD;
}

long long nCk(int n,int k)
{
    return ((gt[n]*igt[k])%MOD*igt[n-k])%MOD;
}

void init()
{
    gt[0]=1;
    for (int i=1;i<=n;++i)
        gt[i]=(gt[i-1]*i)%MOD;
    igt[n]=moe(gt[n],MOD-2);
    for (int i=n-1;i>=0;--i)
        igt[i]=(igt[i+1]*(i+1))%MOD;
    for (int i=k;i<=n;++i)
    {
        s[i]=(s[i-1]+nCk(i-2,k-2))%MOD;
    }
}

void nhap()
{
    scanf("%d %d",&n,&k);
    for (int i=1;i<=n;++i)
    {
        scanf("%lld",&a[i]);
    }
    sort(a+1,a+1+n);
}

void process()
{
    long long kq=0;
    int base=n;
    for (int i=n;i>=k;--i)
    {
        kq=(kq+(s[base]*a[i])%MOD)%MOD;
        base--;
    }
    base=n;
    int vt=1;
    while (base>=k)
    {
        kq=(kq-(s[base]*a[vt])%MOD+MOD)%MOD;
        vt++;
        base--;
    }
    cout<<kq;
}

int main()
{
    nhap();
    init();
    process();
    return 0;
}


Measured memory_bytes: 2944
#include <iostream>
using namespace std;
template<int MOD> struct MInt {
  long long val;
  MInt(long long val = 0) : val(val % MOD) { if (val < 0) val += MOD; }
  MInt operator-() const { return MInt(-val); }
  MInt operator+(const MInt& n) const { return MInt(val) += n; }
  MInt operator-(const MInt& n) const { return MInt(val) -= n; }
  MInt operator*(const MInt& n) const { return MInt(val) *= n; }
  MInt operator/(const MInt& n) const { return MInt(val) /= n; }
  MInt& operator+=(const MInt& n) { val = (val + n.val) % MOD; return *this; }
  MInt& operator-=(const MInt& n) { val = (MOD + val - n.val) % MOD; return *this; }
  MInt& operator*=(const MInt& n) { val = (val * n.val) % MOD; return *this; }
  MInt& operator/=(const MInt& n) { val = (*this * n.inv()).val; return *this; }
  bool operator==(const MInt& n) { return val == n.val; }
  bool operator!=(const MInt& n) { return val != n.val; }
  MInt pow(long long n) const {
    MInt pow = val, ans = 1;
    for (long long p = n; p > 0; p >>= 1) {
      if (p & 1) ans *= pow;
      pow *= pow;
    }
    return ans;
  }
  MInt inv() const { return pow(MOD-2); }
  friend ostream& operator<<(ostream& os, const MInt& n) { os<<n.val; return os; }
  friend istream& operator>>(istream& os, MInt& n) { os>>n.val; return os; }
};
using mint = MInt<1000000007>;
// using mint = MInt<998244353>;
#define in(v) v; cin >> v;

int main() {
  mint in(M); int in(N);
  cout << M.pow(N) << endl;

  return 0;
}



Measured memory_bytes: 3088
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    ios :: sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int n, m, r;
    cin >> n >> m >> r;
    vector <int> S(r);
    for (int i = 0; i < r; ++ i) cin >> S[i], -- S[i];
    vector <vector <pair <int, int> > > g(n);
    for (int i = 0; i < m; ++ i) {
        int u, v, w;
        cin >> u >> v >> w;
        -- u, -- v;
        g[u].emplace_back(v, w);
        g[v].emplace_back(u, w);
    }
    vector <vector <int> > dis(n, vector <int> (n, 0x7fffffff));
    for (int s = 0; s < n; ++ s) {
        priority_queue <pair <int, int>, vector <pair <int, int> >, greater <pair <int, int> > > pq;
        pq.emplace(0, s);
        dis[s][s] = 0;
        while (!pq.empty()) {
            pair <int, int> p = pq.top(); pq.pop();
            int u = p.second, d = p.first;
            for (int i = 0; i < g[u].size(); ++ i) {
                int v = g[u][i].first, w = g[u][i].second;
                if (dis[s][v] > d + w) {
                    dis[s][v] = d + w;
                    pq.emplace(d + w, v);
                }
            }
        }
    }
    vector <vector <ll> > dp(r, vector <ll> (1 << r, 0x7fffffffffffffff));
    for (int i = 0; i < r; ++ i) {
        dp[i][1 << i] = 0;
    }
    for (int msk = 1; msk < (1 << r); ++ msk) {
        if (__builtin_popcount(msk) > 1) {
            for (int u = 0; u < r; ++ u) if (msk & 1 << u) {
                for (int v = 0; v < r; ++ v) if (msk & 1 << v) if (u ^ v) {
                    dp[u][msk] = min(dp[u][msk], dp[v][msk ^ 1 << u] + dis[S[u]][S[v]]);
                }
            }
        }
    }
    ll ans = 0x7fffffffffffffff;
    for (int i = 0; i < r; ++ i) {
        ans = min(ans, dp[i][(1 << r) - 1]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 896
from operator import itemgetter

n = int(input())
XLs = [list(map(int, input().split())) for i in range(n)]

for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]
    XLs[i].append(x+l)

# 右手の端の位置でソート
XLs.sort(key=itemgetter(2))

choice = -10**10
cnt = 0
for i in range(n):
    x = XLs[i][0]
    l = XLs[i][1]

    if choice <= x-l:
        choice = x+l
        cnt += 1

print(cnt)


Measured memory_bytes: 94736
/* NotQuiteMyTempo */
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define ld long double
#define io ios_base::sync_with_stdio(false); cin.tie(NULL)
  
int main() 
{ 
   int x , sum = 0;
   cin >> x;
   if(x != 0){
       int y = x / 500;
        sum += y * 1000;
       int z = x - (y * 500);
       sum += 5 * (z / 5);
   }

   cout << sum;
   
   return 0;
} 
    


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

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

// rep
//------------------------------------------
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) (x).begin(), (x).end()
#define DEBUG(x) cerr << #x << ": " << x << '\n'

int n;

VP v(20010);

signed main()
{
    cin >>  n;
    v.resize(n);
    REP(i, n){
        cin >> v[i].first >> v[i].second;
    }

    sort(ALL(v), [](PII a, PII b){
        return a.second < b.second;
    });

    // REP(i, n){
    //     // DEBUG(v[i].first);
    //     DEBUG(v[i].second);
    // }

    int now = 0;
    REP(i, n){
        if (now + v[i].first > v[i].second){
            cout << "No" << endl;
            return 0;
        }

        now += v[i].first;
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 3712
#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<cstring>
using namespace std;

const int N = 10;

int a[N + 2][N + 2], n, m, used[N + 2][N + 2];

int in(int x, int y)
{
	if (x < 0 || x >= n || y < 0 || y >= m)
		return 0;
	return 1;
}


int test(int x, int y, int k)
{
	if (a[x][y] >= k)
		return 0;
	memset(used, 0, sizeof(used));
	queue<vector<int>> Q;
	int sum = k - a[x][y];
	used[x][y] = 1;
	int l = y, r = y, u = x, d = x;
	int cnt = 1;
	for (Q.push({ x, y }); !Q.empty(); Q.pop())
	{
		auto top = Q.front();
		for (int i = top[0] - 1; i <= top[0] + 1; i++)
			for (int j = top[1] - 1; j <= top[1] + 1; j++)
			{
				if (!in(i, j))
					continue;
				if (used[i][j])
					continue;
				if (a[i][j] >= k)
					continue;
				if (i == 0 || i == n - 1 || j == 0 || j == m - 1)
					return 0;
				//printf("%d %d %d %d\n", i, j, k, a[i][j]);
				l = min(l, j);
				r = max(r, j);
				u = min(u, i);
				d = max(d, i);
				used[i][j] = 1;
				cnt++;
				sum += k - a[i][j];
				Q.push({ i, j });
			}
	}
	if (cnt != (r - l + 1)*(d - u + 1))
		return 0;
	return sum;
}

int main()
{
	for (; scanf("%d%d", &n, &m) && (n || m); )
	{
		for (int i = 0; i < n; i++)
			for (int j = 0; j < m; j++)
				scanf("%d", &a[i][j]);
		int ans = 0;
		for (int i = 1; i < n-1; i++)
			for (int j = 1; j < m-1; j++)
				for (int k = 1; k <= 9; k++)
				{
					ans = max(ans, test(i, j, k));
					//printf("i=%d j=%d k=%d   %d\n", i, j, k, test(i, j, k));
				}
		printf("%d\n", ans);
	}
}

/*


*/

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

#define rep(i, n) for(int i = 0; i < (n); ++i)
#define repr(i, n) for(int i = (n-1); i >= 0; --i)

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; }

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

const int MAX = 200005;
const int INF = 1001001001;
const int MOD = 1000000007;

using mint = modint998244353;

mint table[10][MAX];
mint table_ten[MAX];

struct S {
    mint n;
    int size;
};

struct F {
    char d;
    bool id;
};

S op(S a, S b) {
    return S{a.n * table_ten[b.size] + b.n, a.size + b.size};
}

S e() { return S{0, 0}; }

S mapping(F l, S r) {
    return (l.id)? r : S{table[l.d - '0'][r.size], r.size};
}

F composition(F l, F r) {
    if (l.id) {
        return (r.id)? l : r;
    } else {
        return l;
    }
}

F id() { return F{'0', true}; }

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

    for (int i = 1; i < 10; ++i) {
        rep(j, N) {
            table[i][j+1] = table[i][j] * 10 + i;
        }
    }

    table_ten[0] = 1;
    rep(i, N) table_ten[i+1] = table_ten[i] * 10;

    vector<S> v(N);
    rep(i, N) {
        v[i].n = 1;
        v[i].size = 1;
    }
    lazy_segtree<S, op, e, F, mapping, composition, id> st(v);

    rep(i, Q) {
        int l, r;
        char d;
        cin >> l >> r >> d;
        l--;

        st.apply(l, r, F{d, false});
        cout << st.all_prod().n.val() << endl;
    }
}

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

int main() {
  int n;
  cin >> n;
  vector<vector<pair<int, bool>>> hoge(n, vector<pair<int, bool>>(0));
  for(int i=0;i<n;i++) {
    int A;
    cin >> A;
    hoge[i].resize(A);
    for(int j=0;j<A;j++) cin >> hoge[i][j].first >> hoge[i][j].second;
  }
  int max = 0;
  for(int i=0;i<pow(2, n);i++) {
    bitset<32> kinder(i);
    bool ok = true;
    for(int j=0;j<n;j++) {
      if(kinder[j]) {
        for(int k=0;k<hoge[j].size();k++) {
          int obj = hoge[j][k].first;
          bool honest = hoge[j][k].second;
          if((kinder[obj-1] == 1 && honest) || (kinder[obj-1] == 0 && !honest)) {
            continue;
          } else {
            ok = false;
            break;
          }
        }
      }

      if(!ok) {
        break;
      }

    }

    if(ok) {
      int num = 0;
      for(int j=0;j<kinder.size();j++) {
        if(kinder[j] == 1) num++;
      }

      if(num > max) max = num;
    }
  }

  cout << max << endl;

}

Measured memory_bytes: 256
#include<iostream>
#include<math.h>
#include<algorithm>
#include<vector>
#include<map>
#include <string>
using namespace std;

int main(){
    int ans=0;

    int p[20]={};
    int n;
    bool check=false;

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

    for(int i=1;i<n-1;i++){
        if(p[i-1]<=p[i]){
            if(p[i]<=p[i+1]){
                check=true;
            }
        }
        if(p[i+1]<=p[i]){
            if(p[i]<=p[i-1]){
                check=true;
            }
        }
        if(check){
            ans++;
            check=false;
        }
    }

    cout<<ans<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int lli;
typedef unsigned long long int ulli;

using namespace std;

int main()
{
    string S;
    string T;
    cin>>S;
    cin>>T;
    
    vector<int > V;
    for(int i=0;i<S.size()-T.size() + 1;i++){
        int ct=0;
        for(int j=i;j<i + T.size();j++){
            if(S[j]!=T[j-i]){
                ct+=1;
            }
        }
        V.push_back(ct);
        
    }
    
    cout<<*min_element(V.begin(),V.end())<<"\n";
    
    return 0;
}

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

using ll = long long int;

const int MOD = 1e9 + 7;

#define MAX(a, b) ((a > b) ? a : b)
#define MIN(a, b) ((a > b) ? b : a)

template <class T>
class my_array{
  private:
    int n;
    vector<T> A;
  public:
    my_array(int k){n = k; A.resize(n);}
    ~my_array(void){};
    // input a_0, a_1, ..., a_(n-1)
    void get(void){
      for(int i = 0; i < n; i++) cin >> A.at(i);
    }
    // sort A
    void sorted(bool flag = true){
      if(flag) sort(A.begin(), A.end());
      else sort(A.begin(), A.end(), greater<T>());
    }
    // print : a_0, a_1, ... a_(n-1)
    void show(void){
      for(int i = 0; i < n - 1; i++) cout << A.at(i) << " ";
      cout << A.at(n - 1) << "\n";
    }
    int solve(int a, int b){
      if(a >= b) return 0;
      int mn_idx = 0, min = 1e9;
      for(int i = a; i < b; i++) if(min > A.at(i)){
        min = A.at(i);
        mn_idx = i;
      }
      for(int i = a; i < b; i++) A.at(i) -= min;
      return solve(a, mn_idx) + min + solve(mn_idx + 1, b);
    }
};


/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */


int main(void){
  vector<int> A(4, 0);
  for(int i = 0; i < 3; i++){
    int p, q;
    cin >> p >> q;
    A.at(p - 1)++; A.at(q - 1)++;
  }
  sort(A.begin(), A.end());
  if(A.at(0) == 1 && A.at(1) == 1&& A.at(2) == 2 && A.at(3) == 2) cout << "YES\n";
  else cout << "NO\n";
  return 0;
}

Measured memory_bytes: 256
// warm heart, wagging tail,and a smile just for you!
//                                                                     ███████████
//                                                                   ███╬╬╬╬╬╬╬╬╬╬███
//                                                                ███╬╬╬╬╬████╬╬╬╬╬╬███
//                                            ███████████       ██╬╬╬╬╬████╬╬████╬╬╬╬╬██
//                                      █████████╬╬╬╬╬████████████╬╬╬╬╬██╬╬╬╬╬╬███╬╬╬╬╬██
//                               ████████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬██╬╬╬╬╬╬╬██
//                             ████╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████████╬╬╬╬╬╬╬╬╬╬╬██
//                           ███╬╬╬█╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬███╬╬╬╬╬╬╬█████
//                         ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬████████╬╬╬╬╬██
//                       ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬╬╬╬╬███
//                     ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬██
//                 ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬████
//     █████████████╬╬╬╬╬╬╬╬██╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬██████
//   ████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬██████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████╬╬╬╬╬╬╬███████████╬╬╬╬╬╬╬╬██╬╬╬██╬╬╬██
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████╬╬╬╬╬╬╬╬╬╬╬█╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬██
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬▓▓▓▓▓▓╬╬╬████╬╬████╬╬╬╬╬╬╬▓▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬███
// ██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██████▓▓▓▓▓▓▓╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬▓▓▓▓▓▓▓██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██╬╬╬╬█████
// ███╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████████
//   ███╬╬╬╬╬╬╬╬╬╬╬╬╬█████╬╬╬╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬███╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬██
//       ██████████████  ████╬╬╬╬╬╬███████████████████████████╬╬╬╬╬██╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬╬████
//                         ███████                           █████  ███████████████████
#include "bits/stdc++.h"
using namespace std;
#define MOD 1000000007
const double EPS = 1e-9;
#define INF (1LL<<60)
#define D double
#define fs first
#define sc second
#define int long long
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define RFOR(i,a,b) for(int i = (b-1);i>=a;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ITR(itr,mp) for(auto itr = (mp).begin(); itr != (mp).end(); ++itr)
#define RITR(itr,mp) for(auto itr = (mp).rbegin(); itr != (mp).rend(); ++itr)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x)  cout << #x << " = " << (x) << endl;
#define SP << " " << 
typedef pair<int,int> P;
typedef vector<vector<P> > Graph;
typedef vector<int> vec;
typedef vector<vector<int>> mat;

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

  int n,a,b;
  cin >> n >> a >> b;

  cout << b/n*a << endl;

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

int min(int a,int b){
    return (a<b) ? a : b ;
}

int max(int a,int b){
    return (a<b) ? b : a ;
}


int main() {

    int a,b ;
    cin >> a>>b ;
  
    cout << ceil((a+b)*0.5) << endl ;

 return 0 ;
}  


Measured memory_bytes: 256
//{{{
#include<algorithm>
#include<cmath>
#include<fstream>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<random>
#include<set>
#include<sstream>
#include<sys/time.h>
#include<unordered_map>
#include<unordered_set>
#include<vector>
using ll = long long;
enum : int { M = (int)1e9 + 7 };
enum : ll { MLL = (ll)1e18L + 9 };
using namespace std;
#ifdef LOCAL
#include"rprint2.hpp"
#else
#define FUNC(name) template <ostream& out = cout, class... T> void name(T&&...){ }
FUNC(prints) FUNC(printw) FUNC(printwe) FUNC(printb) FUNC(printbe) FUNC(printd) FUNC(printde) FUNC(printdu);
#endif
template <class S, class T>
istream& operator >> (istream& in, pair<S, T>& p){ return in >> p.first >> p.second; }
template <class T>
istream& operator >> (istream& in, vector<T>& v){ for(auto& e : v){ in >> e; } return in; }
//}}}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    string l; cin >> l;
    int n = l.size();
    // margin or no
    vector<pair<ll, ll>> dp(n + 1);
    dp[0].second = 1;
    for(int i = 1; i <= n; i++){
        if(l[i - 1] == '1'){
            dp[i].first = dp[i - 1].first * 3 + dp[i - 1].second; 
            dp[i].second = dp[i - 1].second * 2; 
        }else{
            dp[i].first = dp[i - 1].first * 3;
            dp[i].second = dp[i - 1].second; 
        }
        dp[i].first %= M;
        dp[i].second %= M;
    }
    printde(dp);
    cout << (dp[n].first + dp[n].second) % M << '\n';
}


Measured memory_bytes: 2616
#include <stdio.h>
#include <algorithm>
#include <assert.h>
#include <bitset>
#include <cmath>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits.h>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <time.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>

#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
using namespace std;

#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define ldb ldouble

typedef tuple<int, int, int> t3;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;
typedef pair <ll, int> pli;
typedef pair <db, db> pdd;

int IT_MAX = 1 << 16;
const ll MOD = 1000000007;
const int INF = 0x3f3f3f3f;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
const db PI = acos(-1);
const db ERR = 1e-10;
#define szz(x) (int)(x).size()
#define rep(i, n) for(int i=0;i<n;i++)
#define Se second
#define Fi first

int main() {
	int N, M, i, j;
	scanf("%d %d", &N, &M);

	if (N > M) swap(N, M);

	if (N == 1) {
		if (M == 1) printf("1\n");
		else printf("%d\n", M - 2);
		return 0;
	}
	return !printf("%lld\n", (ll)(N - 2)*(M - 2));
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repe(i,n) for (int i = 0; i <= (n); ++i)
#define repe1(i,n) for (int i = 0; i <= (n); ++i)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x)
#define eb(k,v) emplace_back(k,v)
#define ct(res) cout << res << "\n";
#define vi vector<int>
#define vl vector<ll>
using namespace std;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const int INF = 1e9;
const ll MOD = 1000000007;
using Graph = vector<vector<int>>;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    int cnt = 0;
    for(int i=1; i<=n; i++) {
        int tmp = 0;
        for(int j=1; j<=i; j++) {
            if (i%j==0) {
                tmp++;
            }
        }
        if (i%2==1 && tmp==8) {
            cnt++;
        }
    }
    cout << cnt << "\n";
}



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

int main() {
  string s;
  int K;
  cin >> s >> K;

  set<string> strs;
  for (char c='a'; c<='z'; c++) {
    for (int pos=0; pos<s.length(); pos++) {
      pos = s.find(c, pos);
      if (pos < 0) break;
      int len = min((int)s.length()-pos, 5);
      for (int i=1; i<=len; i++) {
          strs.insert(s.substr(pos, i));
      }
    }

    if (strs.size() >= K) {
      set<string>::iterator it = strs.begin();
      for (int i=0; i<K-1; i++) {
        it++;
      }
      cout << *it << endl;
      break;
    }
  }
  return 0;
}

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

typedef long long ll;

ll solve(const vector<ll> &v) {
    ll n = v.size(), left = 0, ans = 0;
    for(int i = 0; i < n; i++) {
        ll t = v[i]+left;
        ans += t/2;
        left = !v[i]? 0 : t%2;
    }
    return ans;
    
}

int main() {
    ios_base::sync_with_stdio(false); cin.tie(0);
    int n;
    while(cin >> n) {
        vector<ll> v(n);
        for(int i = 0; i < n; i++) {
            cin >> v[i];
        }
        cout << solve(v) << '\n';
    }
    return 0;
}

Measured memory_bytes: 1024
#define _USE_MATH_DEFINES // for C++  
#include <cmath> 
#include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include <iterator>
#include <utility>
#include <set>
#include <random>
#include <map>
#include <stack>
#include <queue>
#include <list>
#include <functional>
#include <bitset>
#define LL long long

using namespace std;

int main() {
    int n, count = 0;
    bool flag = false, begin = true;
    cin >> n;
    vector<pair<int,int>> v(n);
    for (size_t i = 0; i < n; i++)
    {
        cin >> v[i].first;
        v[i].second = 0;
    }

    int i = 0;
    while (true)
    {
        if (v[i].second > 1)
        {
            flag = false;
            break;
        }
        else if (v[i].first == 2)
        {
            flag = true;
            count++;
            break;
        }
        else
        {
            i = v[i].first - 1;
            count++;
            v[i].second++;
        }
    }


    if (flag)
    {
        cout << count << endl;
    }
    else
    {
        cout << -1 << endl;
    }
}

Measured memory_bytes: 1024
#include <iostream>

using namespace std;

int N;
int C[500], S[500], F[500];

int main()
{
	cin >> N;
	for (int i = 0; i < N - 1; i++) {
		cin >> C[i];
		cin >> S[i];
		cin >> F[i];
	}
	for (int i = 0; i < N - 1; i++) {
		int t = 0;
		for (int j = i; j < N - 1; j++) {
			if (t <= S[j]) {
				t = S[j] + C[j];
			} else {
				int a = t - S[j];
				if (a % F[j] == 0) a = a / F[j];
				else a = a / F[j] + 1;
				a = F[j] * a;
				t = S[j] + a + C[j];
			}
		}
		cout << t << endl;
	}
	cout << 0 << endl;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;class Program
{
	static void Main(string[] args)
	{
        //var exStdIn = new System.IO.StreamReader( "stdin.txt" );System.Console.SetIn( exStdIn );
		var nk = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int n = nk[0], k = nk[1];
		var a = Console.ReadLine().Split().Select(long.Parse).ToArray();
		long ok = a.Max(), ng = 0;
		while(ok-ng>1){
			long mid = (ok+ng)/2;
			long cnt = 0;
			foreach (var ai in a)	
			{
				cnt+=(ai-1)/mid;
			}
			if(cnt<=k)ok = mid;
			else ng = mid;
		}
		Console.WriteLine(ok);
	}
}


Measured memory_bytes: 45472
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func out(x ...interface{}) {
	fmt.Println(x...)
}

var sc = bufio.NewScanner(os.Stdin)

func getInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := getString(), getString()

	ans := "H"
	if a == "H" && b == "D" {
		ans = "D"
	} else if a == "D" && b == "H" {
		ans = "D"
	}
	out(ans)
}


Measured memory_bytes: 640
#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "math.h"
#include "utility"
#include "string"
#include "map"
#include "unordered_map"
#include "iomanip"
#include "random"

using namespace std;
const long long int MOD = 1000000007;

int N;
long long int num[300000];
long long int sum[300000];
set<long long int>L;
set<long long int>R;
set<long long int>unused;
long long int ans;
long long int suml;
long long int sumr;

int main() {
	ios::sync_with_stdio(false);
	cin >> N;
	for (int i = 0; i < 3 * N; i++) {
		cin >> num[i];
		if (i < N)L.insert(num[i] * MOD + i);
		else unused.insert(num[i] * MOD + i);
	}
	sum[0] = num[0];
	for (int i = 1; i < 3 * N; i++) {
		sum[i] = sum[i - 1] + num[i];
	}
	suml = sum[N - 1];
	for (int i = 0; i < N; i++) {
		long long int box = *unused.begin();
		unused.erase(unused.begin());
		R.insert(box);
	}
	for (auto i : R) {
		sumr += i / MOD;
	}
	ans = suml - sumr;
	for (int i = N; i < 2 * N; i++) {
		if (num[i] > *L.begin()/MOD) {
			suml -= *L.begin()/MOD;
			suml += num[i];
			L.erase(*L.begin());
			L.insert(num[i] * MOD + i);
		}
		if (*R.rbegin() >= num[i] * MOD + i) {
			//cout << "hijiki";
			sumr -= num[i];
			R.erase(num[i] * MOD + i);
			sumr += *unused.begin() / MOD;
			R.insert(*unused.begin());
			unused.erase(unused.begin());
		}
		else unused.erase(num[i] * MOD + i);
		ans = max(ans, suml - sumr);
	//	cout << suml << " " << sumr << " " << ans << endl;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 19072