akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
vector<ll> g[200005];
ll value[200005]={0};
void dfs(ll pre,ll tmp,ll sum){
  value[tmp]+=sum;
  for(auto out:g[tmp]) if(out!=pre) dfs(tmp,out,value[tmp]);
}
int main(){
  IOS;
  ll n,q;
  cin>>n>>q;
  rep(i,n-1){
    ll a,b;cin>>a>>b;a--;b--;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  rep(i,q){
    ll a,b;cin>>a>>b;a--;
    value[a]+=b;
  }
  dfs(-1,0,0);
  rep(i,n){
    cout<<value[i]<<' ';
  }
  cout<<endl;
}

Measured memory_bytes: 24320
#pragma GCC optimize("Ofast")

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

using namespace std;
using namespace __gnu_pbds;

typedef
tree<pair<int, int>, null_type, less<pair<int, int>>, rb_tree_tag, tree_order_statistics_node_update> orderedSet;

#define pb push_back
#define F first
#define S second
#define all(a) (a).begin(), (a).end()

#define for1(i0, l0, r0) for (int i0 = l0; i0 < r0; ++i0)
#define for2(i0, l0, r0) for (int i0 = l0; i0 <= r0; ++i0)
#define forn(i0, n0) for (int i0 = 0; i0 < n0; ++i0)
#define forn1(i0, n0) for (int i0 = 1; i0 < n0; ++i0)
#define forr(i0, n0) for (int i0 = n0; i0 >= 0; --i0)
#define forr1(i0, r0, l0) for (int i0 = r0; i0 > l0; --i0)
#define forr2(i0, r0, l0) for (int i0 = r0; i0 >= l0; --i0)

#define Sort(a) sort(all(a))
#define Reverse(a) reverse(all(a))
#define relaxMax(a, b) a = max(a, b)
#define relaxMin(a, b) a = min(a, b)

typedef long long ll;
typedef long double ld;
#define ui unsigned int
#define ull unsigned long long

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef pair<string, string> pss;

typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<bool> vb;
typedef vector<string> vs;

typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<pdd> vpdd;

typedef vector<vi> vvi;
typedef vector<vd> vvd;
typedef vector<vll> vvll;
typedef vector<vb> vvb;

#define vpss vector<pss>
#define vvs vector<vs>
#define vvpii vector<vpii>
#define vvpll vector<vpll>
#define vpt vector<pt>
#define vvvi vector<vvi>
#define vsi vector<set<int>>
#define ss second
#define ff first

#define printvi(arr) for (int x0 : arr) cout << x0 << ' '; cout << '\n';
#define printvll(arr) for (ll x0 : arr) cout << x0 << ' '; cout << '\n';
#define printpair(pair0) cout << pair0.F << ' ' << pair0.S << '\n';
#define printvp(arr) for (auto pair0 : arr) printpair(pair0);
#define initArray(arr, N0, X0) memset(arr, X0, N0 * sizeof(int))
//mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

void init() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //cout.precision(16);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
}

void solve() {
    int n, l;
    cin >> n >> l;
    vs a(n);
    forn(i, n) cin >> a[i];
    Sort(a);
    forn(i, n) cout << a[i];
    cout << '\n';
}

bool multitest = false;

int main() {
    init();
    int t = 1;
    if (multitest) cin >> t;
    forn(i, t) solve();
}

Measured memory_bytes: 256
import math

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

k=6*10**5+1050
t=2*math.pi/k
ANS=0
for i in range(k):
    X=math.sin(t*i)
    Y=math.cos(t*i)

    ANSX=0
    ANSY=0

    for x,y in P:
        if X*x+Y*y>0:
            ANSX+=x
            ANSY+=y

    ANS=max(ANS,ANSX**2+ANSY**2)

print(math.sqrt(ANS))

Measured memory_bytes: 42884
#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<27;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-11;
const ll mod=1e9+7;
const int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};



int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,m;
	double w;
	cin>>n>>m>>w;
	vvd a(n),b(n,vd(m+1));
	for(int i=0;i<n;i++){
		double p,t,v;
		cin>>p>>t>>v;
		vd dp(1);
		dp[0]=1;
		p/=100;
		for(int j=0;j<m;j++){
			vd DP(j+2);
			for(int k=0;k<=j;k++){
				DP[k]+=(1-p)*dp[k];
				DP[k+1]+=p*dp[k];
			}
			dp=DP;
		}
		a[i]=dp;
		for(int j=0;j<=m;j++) b[i][j]=w/v+j*t;
	}
	for(int i=0;i<n;i++){
		double res=0;
		for(int j=0;j<=m;j++){
			double tmp=a[i][j];
			for(int k=0;k<n;k++) if(k!=i){
				double sum=0;
				for(int l=0;l<=m;l++) if(b[k][l]>b[i][j]+eps) sum+=a[k][l];
				tmp*=sum;
			}
			res+=tmp;
		}
		cout<<syosu(9)<<res<<endl;
	}
}


Measured memory_bytes: 3384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using V = vector<ll>;
#define _GLIBCXX_DEBUG
#define rep(i, a) for(int i = 0; i < a; i++)
#define ALL(v) v.begin(), v.end()

int main(){
    int r; cin>>r;
    if(r<1200) cout<<"ABC"<<endl;
    else if(r<2800) cout<<"ARC"<<endl;
    else cout<<"AGC"<<endl;
}


Measured memory_bytes: 256
#include <stdio.h>
 
int main(void) {
	int N,A,B,E;
	scanf("%d %d %d",&N,&A,&B);
	E=N*A;
	if(E>B){
		printf("%d",B);
	}
	else{
		printf("%d",E);
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include <string>
#include <complex>
#include <functional>
using namespace std;

long long s(long long x)
{
    long long ret = 0;
    while (x > 0) {
        ret += x % 10;
        x /= 10;
    }
    return ret;
}
 
bool compare( long long x, long long y )
{
	return (double)x / s(x) < (double)y / s(y);
}
 
int main()
{
	long long k;
 
	cin >> k;
 
	long long d = 1, cur = 0;
	for( int i = 0; i < k; i++ ) {
		long long x = cur + d;
		long long y = cur + d * 10;
		if (compare(x, y)) {
            cur = x;
        }
		else {
            cur = y;
            d *= 10;
        }
        cout << cur << endl;
    }
 
	return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
	int A, B;
	cin >> A >> B;
	if (A + B == 3) {
		cout << 3;
	}
	else if (A + B == 4) {
		cout << 2;
	}
	else if (A + B == 5) {
		cout << 1;
	}
    return 0;
}

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

public class Main{
	public static void main(String... args){ new Main().solve(); }

	public void solve(){
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int pt = 0;
		int px = 0;
		int py = 0;
		int ct = 0;
		int cx = 0;
		int cy = 0;
		int condition[][] = new int[n][2];
		for(int i=0; i<n; i++){
			ct = sc.nextInt();
			cx = sc.nextInt();
			cy = sc.nextInt();
			condition[i][0] = ct - pt;
			condition[i][1] = Math.abs(cx - px) + Math.abs(cy - py);
			pt = ct;
			px = cx;
			py = cy;
		}
		Optional<int[]> oia = Arrays.asList(condition).stream()
			.filter(a -> {
				if(((a[0] & 1) != (a[1] & 1)) || a[0] < a[1]) return true;
				return false;
			})
			.findFirst();
		if(oia.isPresent()) System.out.println("No");
		else System.out.println("Yes");
	}
}


Measured memory_bytes: 98332
#include<iostream>
#include<algorithm>
#include<math.h>
#include<string>
#include<vector>
#include<queue>
#include<deque>
using namespace std;
typedef pair<int, int>P;
typedef pair<int, pair < int, int > > PP;
typedef long long ll;
ll inf = -1;
ll mod = pow(10, 9) + 7;

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int a[33]={0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
int main(){
	int n;
	cin>>n;
	cout<<a[n];
	return 0;
}

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;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcount

#define INF 1e16

struct RangeMinQuery{
  ll dat[(1<<19)-1];
  int size;

  void init(int n_){
    size=1;
    while(size<n_) size*=2;
    for(int i=0;i<2*size-1;i++)dat[i]=INF;
  }

  void update(int k,ll a){
    k+=size-1;
    dat[k]=a;
    while(k>0){
      k=(k-1)/2;
      dat[k]=min(dat[k*2+1],dat[k*2+2]);
    }
  }

  ll subquery(int a,int b,int k,int l,int r){
    if(r<=a||b<=l)return INF;
    if(a<=l&&r<=b)return dat[k];
    else{
      return min(subquery(a,b,k*2+1,l,(l+r)/2),subquery(a,b,k*2+2,(l+r)/2,r));
    }
  }
  
  ll query(int a,int b){
    return subquery(a,b,0,0,size);
  }
};

ll n;
ll a[201010],b[201010];
vector<ll> ch;
RangeMinQuery rmq[2];

int main(){
  cin>>n;
  rep(i,n)cin>>a[i];
  rep(i,n)cin>>b[i];
  rmq[0].init(n); rmq[1].init(n);
  ll q;
  cin>>q;
  bool oc=false;
  rep(i,n)rmq[0].update(i,a[i]);
  rep(i,n)rmq[1].update(i,b[i]);
  while(q--){
    ll x;
    cin>>x;
    if(x==1||x==2){
      x--;
      ll y,z;
      cin>>y>>z;
      y--;
      if(!oc){        
        rmq[x].update(y,z);
      }else{
        rmq[x].update(y,z);
        ch.push_back(y);
      }
    }else if(x==3||x==4){
      ll y,z;
      cin>>y>>z;
      x-=3;
      y--;
      cout<<rmq[x].query(y,z)<<endl;
    }else{
      x-=5;
      ll y,z;
      cin>>y>>z;
      if(!oc){
        oc=true;
        rep(i,n){
          rmq[x].update(i,rmq[1-x].query(i,i+1));
        }
      }else{
        rep(i,ch.size()){
          rmq[x].update(ch[i],rmq[1-x].query(ch[i],ch[i]+1));
        }
        ch.clear();
      }
    }
  }
	return 0;
}

Measured memory_bytes: 14484
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size() 
#define UB upper_bound
#define LB lower_bound
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;
const int N = 2e5 + 5;

int dp[N], seg[4*N], ans[N], n, val[N];
vector <int> adj[N];

int query(int node, int s, int e, int l, int r) {
   if(l > r || (s > r) || (l > e)) return 0;
   if(s >= l && e <= r) return seg[node];
   int mid = (s+e) >> 1;
   return max(query(2*node, s, mid, l, r), query(2*node+1, mid+1, e, l, r));
}

void update(int node, int s, int e, int pos, int v) {
  if(s == e) {
    seg[node] = v; return;
  }
  int mid = (s+e) >> 1;
  if(mid >= pos) {
    update(2*node, s, mid, pos, v);
  }
  else update(2*node+1, mid+1, e, pos, v);

  seg[node] = max(seg[2*node], seg[2*node+1]);
}

void dfs(int root, int p) {
   int temp = query(1, 1, n, 1, val[root]-1);
   int x = dp[val[root]];
   dp[val[root]] = max(dp[val[root]], temp+1);
   update(1, 1, n, val[root], dp[val[root]]);
   ans[root] = seg[1];

   for(auto i : adj[root]) {
     if(i != p) {
       dfs(i, root);
     }
   }
  // cout << val[root] << " " << x << '\n';
   update(1, 1, n, val[root], x);
   dp[val[root]] = x;
}

void solve() {
   cin >> n;
   map <int, int> com;
   for(int i = 1; i <= n; i++) {
     cin >> val[i]; com[val[i]] = 0;
   }
   int cnt = 0;
   for(auto &i : com) {
      i.ss = ++cnt;
   }
   for(int i = 1; i <= n; i++) {
     val[i] = com[val[i]];
   //  cout << i << "---" << val[i] << '\n';
   }
   
   for(int i = 1; i < n; i++) {
    int x, y; cin >> x >> y;
    adj[x].pb(y); adj[y].pb(x);
   }

   dfs(1, 0);
   for(int i = 1; i <= n; i++) cout << ans[i] << '\n';
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    #ifndef ONLINE_JUDGE
      freopen("input.txt", "r", stdin);
      freopen("output.txt", "w", stdout);
    #endif
    int t = 1; // cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }
}    


Measured memory_bytes: 45320
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
#define N 8
int main()
{
    int x[N],y[N],n;
    double points=0;
    cin >> n;
    for (int i=0; i<n;i++)
    {
        cin >> x[i] >>y[i];
    }
    for (int i=0; i<n-1;i++)
    {
        for (int j=i+1; j<n;j++)
        {
            points+=sqrt(((x[i]-x[j])*(x[i]-x[j]))+((y[i]-y[j])*(y[i]-y[j])));
        }
    }
    cout.precision(11);
    cout << points * 2 / n<<endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

vector<double> v;

double calc(int start)
{
    if (start == v.size() - 1)
    {
        return v[start];
    }
    else
    {
        return (v[start] + calc(start + 1)) / 2.0;
    }
}

int main(void)
{
    int n;
    cin >> n;
    v.resize(n);

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

    sort(v.begin(), v.end(), std::greater<double>());

    printf("%lf\n",calc(0));
    return 0;
}

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

using namespace std;
#define int long long
const int maxn=200000;
vector <int> a[maxn];
bool used[maxn];
int color[maxn];
int res[maxn];
void dfs(int x,int c)
{
    color[x]=c;
    used[x]=true;
    int v;
    for(int i=0;i<a[x].size();++i)
    {
        v=a[x][i];
        if(!used[v])
        {
            dfs(v,(c+1)%2);
        }
    }
}
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    for(int i=0;i<(n-1);++i)
    {
        int x,y;
        cin>>x>>y;
        x--;y--;
        a[x].push_back(y);a[y].push_back(x);
    }
    dfs(0,0);
    vector <int> v1;
    vector <int> v2;
    for(int i=0;i<n;++i)
    {
        if(color[i])
        {
            v2.push_back(i);
        }
        else
        {
            v1.push_back(i);
        }
    }
    if(v2.size()>v1.size())
    {
        swap(v1,v2);
    }
    int c0=0,c1=0,c2=0;
    for(int i=1;i<=n;++i)
    {
        if(i%3==0)
        {
            ++c0;
        }
        if(i%3==1)
        {
            ++c1;
        }
        if(i%3==2)
        {
            ++c2;
        }
    }
    int z=1;
    int t=0;
    while(z<=n)
    {
        res[v1[t]]=z;
        z+=3;
        ++t;
    }
    z=2;
    if((v1.size()-t)>=c2)
    {
        while(z<=n)
        {
            res[v1[t]]=z;
            z+=3;
            ++t;
        }
    }
    else
    {
        t=0;
        z=2;
        while(z<=n)
        {
            res[v2[t]]=z;
            z+=3;
            ++t;
        }
    }
    z=3;
    for(int i=0;i<n;++i)
    {
        if(!res[i])
        {
            res[i]=z;
            z+=3;
        }
        cout<<res[i]<<" ";
    }
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  if (n==22) cout << "Christmas Eve Eve Eve" << endl;
  else if (n==23) cout << "Christmas Eve Eve" << endl;
  else if (n==24) cout << "Christmas Eve" << endl;
  else cout << "Christmas" << endl;
}

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

const int MAX = 100005;
pair<string, int> Q[MAX];
int head;
int tail;

void push(pair<string, int> task) {
  Q[tail++] = task;
  tail = tail % MAX;
}

pair<string, int> pop() {
  pair<string, int> x = Q[head++];
  head %= MAX;
  return x;
}

bool isEmpty() {
  return head == tail;
}

int main() {
  int n, q;
  int consumed_time {0};
  pair<string, int> finished_tasks[MAX];
  int current_index {0};
  cin >> n >> q;
  
  for (int i = 0; i < n; i++) {
    string s;
    int t;
    cin >> s >> t;
    push(make_pair(s, t));
  }

  while (!isEmpty()) {
    pair<string, int> current_task = pop();
    if (current_task.second <= q) {
      consumed_time += current_task.second;
      finished_tasks[current_index].first = current_task.first;
      finished_tasks[current_index].second = consumed_time;
      current_index++;
    } else {
      current_task.second -= q;
      push(current_task);
      consumed_time += q;
    }
  }

  for (int i = 0; i < n; i++) {
    cout << finished_tasks[i].first << " " << finished_tasks[i].second << endl;
  }
}



Measured memory_bytes: 8544
/* # */

#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <functional>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)

using namespace std;


/** Type Define **/
typedef long long int           ll;
typedef pair<int, int>          pii;
typedef pair<ll, ll>            pll;
typedef vector<string>          vs;
typedef vector<bool>            vb;
typedef vector<int>             vi;
typedef vector<long long>		vl;
typedef vector<vi>              vvi;
typedef vector<vl>				vvl;
typedef vector<char>            vch;
#define		it(x)  x.begin() 
#define		all(x)  x.begin(), x.end()
#define		pb(x)   push_back(x)
constexpr int           inf = 0x3f3f3f3f;
constexpr long long 	INF = 9123456789123456789;
constexpr long long     MOD = 1000000007LL;
/*************************************************/
void sol() {
    ll yen = 100;
    ll year = 0; 
    ll x; cin >> x;
    while (1) {
        yen += yen / 100;
        year++;
        if (yen >= x) {
            cout << year << '\n';
            return;
        }
    }
}

int main() {
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(12);
    cin.tie(nullptr);
    int T(1);
    while (T--)
        sol();


    return 0;
}

Measured memory_bytes: 3192
#include <stdio.h>
#include <string.h>
#define rep(i, a) for(int i = 0; i < a; ++i)
 
int main(void) {
  char s[250], t[250];
  int m, i, j, n, a;
  while( 1 ) {
    scanf("%s", s);
    n = strlen(s);
    if(n == 1 && s[0] == '-') break;
    scanf("%d", &m);
    rep(i, m) {
      scanf("%d", &a);
      rep(j, a) t[j] = s[j];
      t[a] = 0;
      rep(j, (n - a)) s[j] = s[j + a];
      rep(j, a) s[j + n - a] = t[j];
    }
    printf("%s\n", s);
  }
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    
    map <string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;
        mp[s]++;
    }
    
    cout << mp.size() << endl;
}


Measured memory_bytes: 19120
#define _[301][301]
N,M,i,j,t,r,C _,D _;char S _;main(v){for(scanf("%d%d",&N,&M);gets(S+i++););for(;i=j=++t<M;r+=v)for(;j>N?j=i++<N:1;++j)v=D[i][j]=fmin(D[i-1][j],D[i][j-1])+(C[i][j]=C[i-1][j-1]+(S[i][t-1]==S[j][t]));printf("%d\n",r);}

Measured memory_bytes: 1024
#include<iostream>
#include<vector>
using namespace std;
int main(){
  int n,k;
  while(1){
	cin >> n >> k;
	if(n==0&&k==0) break;
	vector<int> s;
	for(int i=0;i<k;++i){
	  int tmp; cin >> tmp;
	  s.push_back(tmp);
	}
	vector<int> b(k,0);
	for(int i=0;i<n;++i){
	  for(int j=0;j<k;++j){
		int tmp; cin >> tmp;
		b[j] += tmp;
	  }
	}
	bool ans=true;
	for(int i=0;i<k;++i){
	  //cout << s[i] << " " << b[i] << endl;
	  if(s[i]-b[i]<0){
		ans = false;
		break;
	  }
	}
	cout << (ans?"Yes":"No") << endl;
  }
  return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
#define rep(i,n) for (long long i = 0; i < (n); ++i)
const int INF = 2147483647;//int max
const int MOD = 1000000007;
using namespace std;
using ll = long long;
using P = pair<int,int>;


int main() {
    int a,b;
    cin >> a >> b;
    if(a+b >= 24){
        cout << a+b-24 << endl;
    }else{
        cout << a + b << endl; 
    }
    return 0;
}
/*
やっほい！
　　　　　　　やほほい！
　　　　+　　 　*
　　　 ∧∧　　. ∧∞∧　*
*　ヽ(=´ω｀)人(´ω｀*)ﾉ
　.～（ O x.） （ 　 O)～　+
。*　 　∪　　　　∪
*/

Measured memory_bytes: 256
N = int(input())
A = sorted(map(int, input().split()), reverse=True)
if N % 2:
    print(sum(A[: N // 2]) + sum(A[1 : N // 2 + 1]))
else:
    print(sum(A[: N // 2 - 1]) + sum(A[1 : N // 2]) + A[N // 2 - 1])


Measured memory_bytes: 31620
#include <stdio.h>

int main(void){
    int n;
    scanf("%d", &n);
    char s[n][51];
    for(int i=0; i<n; i++){
        scanf("%s", s[i]);
    }

    int i=0, c[n][26];
    for(int j=0; j<n; j++){
        for(int k=0; k<26; k++){
            c[j][k]=0;
        }
    }

    i=0;
    while(i<n){
        int j=0;
        while('a'<=s[i][j]&&s[i][j]<='z'){
            switch(s[i][j]){
                case 'a':
                    c[i][0]++;
                    break;
                case 'b':
                    c[i][1]++;
                    break;
                case 'c':
                    c[i][2]++;
                    break;
                case 'd':
                    c[i][3]++;
                    break;
                case 'e':
                    c[i][4]++;
                    break;
                case 'f':
                    c[i][5]++;
                    break;
                case 'g':
                    c[i][6]++;
                    break;
                case 'h':
                    c[i][7]++;
                    break;
                case 'i':
                    c[i][8]++;
                    break;
                case 'j':
                    c[i][9]++;
                    break;
                case 'k':
                    c[i][10]++;
                    break;
                case 'l':
                    c[i][11]++;
                    break;
                case 'm':
                    c[i][12]++;
                    break;
                case 'n':
                    c[i][13]++;
                    break;
                case 'o':
                    c[i][14]++;
                    break;
                case 'p':
                    c[i][15]++;
                    break;
                case 'q':
                    c[i][16]++;
                    break;
                case 'r':
                    c[i][17]++;
                    break;
                case 's':
                    c[i][18]++;
                    break;
                case 't':
                    c[i][19]++;
                    break;
                case 'u':
                    c[i][20]++;
                    break;
                case 'v':
                    c[i][21]++;
                    break;
                case 'w':
                    c[i][22]++;
                    break;
                case 'x':
                    c[i][23]++;
                    break;
                case 'y':
                    c[i][24]++;
                    break;
                case 'z':
                    c[i][25]++;
                    break;
            }
            j++;
        }
        i++;
    }

    int canuse[26];

    for(int j=0; j<26; j++){
        canuse[j]=c[0][j];
    }
    for(int j=1; j<n; j++){
        for(int k=0; k<26; k++){
            if(canuse[k]>c[j][k]){
                canuse[k]=c[j][k];
            }
        }
    }

    for(int j=0; j<26; j++){
        for(int k=0; k<canuse[j]; k++){
            printf("%c", 'a'+j);
        }
    }

    printf("\n");
    return 0;
}


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

int main()
{
  string c;
    int ara[26] = {},j;
    cin>>c;
    int len = c.size();
    for(int i = 0; i< len; i++)
    {
        j = 0;
        j = c[i] - 'a';
        ara[j]++;
    }
    bool ok = true;
    for(int j = 0; j<26; j++)
    {
        if(ara[j]%2!=0)
            ok = false;
    }
    if(ok == true )
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}








Measured memory_bytes: 3624
import java.util.*;
import java.io.*;
import static java.lang.System.*;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    String word = sc.nextLine();
    int count=0;
    while(true)
    {
      String s = sc.next();
      if(s.equals("END_OF_TEXT")) break;
      if(word.equals(s.toLowerCase()))
      {
        count++;
      }
    }
    out.println(count);
  }
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}


const int MOD = 1E9 + 7;
void _main() {
        int n, m; cin >> n >> m;
        vector<int> broken(m); cin >> broken;
        sort(all(broken));
        vector<int> dp(n + 1);
        dp[0] = 1;
        for (int i = 1; i <= n; i++) {
                if (binary_search(all(broken), i)) continue;
                dp[i] += dp[i - 1];
                if (i - 2 >= 0) dp[i] += dp[i - 2];
                dp[i] %= MOD;
        }

        cout << dp[n];
}



signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


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

using namespace std;
using ll = long long;

const int N = 1e5 + 123;

signed main() {
    ios_base::sync_with_stdio(false); 
    cin.tie(nullptr);
    ll n;
    cin >> n;
    ll h[N], dp[N];
    for (int i = 1; i <= n; i++) 
        cin >> h[i];
    dp[0] = dp[1] = 0;
    dp[2] = abs(h[2] - h[1]);
    for (int i = 3; i <= n; i++)
        dp[i] = min(dp[i - 2] + abs(h[i] - h[i - 2]), dp[i - 1] + abs(h[i] - h[i - 1]));
    cout << dp[n] << "\n";          
    return false;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define pb push_back
#define eb emplace_back
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;
template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}
int main(){
    ll n,k; cin >> n >> k;
    ll m = INF;
    vector<ll> a(n);
    rep(i,n) {
        cin >> a[i];
        chmin(m,a[i]);
    }
    ll cnt = 0;
    rep(i,n)if(a[i] != m)cnt++;
    cout << (cnt - 1) / (k - 1) + 1 << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<int, int>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(v) v.begin(), v.end()
#define sz(v) v.size()
#define INF 1000000009
// aよりもbが大きいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T& b) {
  if (a < b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する
// (更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T& b) {
  if (a > b) {
    a = b;  // aをbで更新
    return true;
  }
  return false;
}

vector<ll> par(100000);
vector<ll> rnk(100000);
vector<ll> diff_weight(100000);
 
void init(ll n){
  rep(i, n){
    par.at(i) = i;
    rnk.at(i) = 0;
  }
}
 
ll root(ll x){
  if(par.at(x) == x){
    return x;
  }
  else{
    ll r = root(par.at(x));
    diff_weight.at(x) += diff_weight.at(par.at(x));
    return par.at(x) = r;
  }
}

ll weight(ll x){
  root(x);
  return diff_weight.at(x);
}

ll diff(ll x, ll y){
  return weight(y) - weight(x);
}
 
bool same(ll x, ll y){
  if(root(x) == root(y)){
    return true;
  }
  else{
    return false;
  }
}
 
bool unite(ll x, ll y, ll w){
  w += weight(x); w -= weight(y); 
  x = root(x);
  y = root(y);
  if(x == y){
    return false;
  }
  if(rnk.at(x) < rnk.at(y)){
    swap(x, y);
    w = -w;
  }
  if(rnk.at(x) == rnk.at(y)){
    rnk.at(x)++;
  }
  par.at(y) = x;
  diff_weight.at(y) = w; 
  return true;
}

int main(){
  ll N, M;
  cin >> N >> M;
  init(N);
  vector<ll> L(M), R(M), D(M);
  rep(i, M){
    cin >> L.at(i) >> R.at(i) >> D.at(i);
    L.at(i)--;
    R.at(i)--;
    if(!same(L.at(i), R.at(i))){
      unite(L.at(i), R.at(i), D.at(i));
    }
    else if(diff(L.at(i), R.at(i)) != D.at(i)){
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 7296
N,M = map(int,input().split())
A = list(map(int,input().split()))

count =0
souhyou = sum(A)
for i in range(N):
    if A[i]>=souhyou/(4*M):
        count+=1

if count >=M:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 2940
using System;

namespace AtBC179
{
    class Program
    {
        static void Main(string[] args)
        {
            int count = 0;
            int n = int.Parse(Console.ReadLine());
            for (int i = 1;i < n; i++)
            {
                for (int ii = 1; ii < n; ii++)
                {
                    if (i * ii >= n)
                    {
                        break;
                    }
                    count += 1;

                }

            

            }
            Console.WriteLine(count);
            
        }
    }
}

Measured memory_bytes: 27532
m = mod = 10 ** 9 + 7

n, k = gets.to_s.split.map{|i|i.to_i}
a    = gets.to_s.split.map{|i|i.to_i}.sort

$fact = [1, 1]
$inv = [0,1]
$factinv = [1, 1]
2.upto(n+1) do |i|
  $fact.push($fact[-1] * i % m)
  $inv.push(-$inv[m % i] * (m / i) % m)
  $factinv.push($factinv[-1] * $inv[-1] % m)
end

def cmb(n,r,mod)
  return 0 if r < 0 || n < r
  $fact[n] * ($factinv[r] * $factinv[n-r] % mod) % mod
end

ans = 0

(n-k+1).times do |i|
  t = cmb( n-i-1, k-1, mod)
  mi = a[i] * t % m
  ma = a[n-(i+1)] * t % mod
  ans += (ma - mi)
  ans %= m if ans < 0 || m <= ans
end

puts ans

Measured memory_bytes: 13692
#include <cstdio>
#include <cmath>
#include <numeric>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <utility>
#include <string>

using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ul;

const int iinf = 1 << 29;
const long long linf = 1l << 61;

int main(int argc, char* argv[])
{
	int N, M;
	scanf("%d %d", &N, &M);
	int L = 1900 * M + 100 * (N - M);
	double p = pow(0.5, M);
	double b = p; //n - 1回目までに終わる確率
	double c; //n回目までに終わる確率
	double d; //n回目に終わる確率
	double s = L * p; //Sn-1
	double t; //Sn
	//d = (1 - b) * p
	//c = b + d
	//t = s + n * d
	int n = 2;
	while(true)
	{
		d = (1 - b) * p;
		c = b + d;
		t = s + L * n * d;

		double k = t - s;
		if(0 < k && k < 1e-6) break;

		n++;
		b = c;
		s = t;
	}
	printf("%d", (int)ceil(t));

	return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define FASTIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mo 1000000007
using namespace std;
int main(){
	FASTIO
	string str;
	cin>>str;
	bool flag = true;
	for(int i=0;i<str.size();i++){
		if(str[i]=='L'){
			if(!(i&1)){
				flag=false;
				break;
			}
		}else if(str[i]=='R'){
			if(i&1){
				flag=false;
				break;
			}
		}
	}
	if(flag){
		cout<<"Yes\n";
	}else{
		cout<<"No\n";
	}
	return 0;
}


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

using namespace std;

#define fRead(x)  freopen(x,"r",stdin)
#define fWrite(x) freopen (x,"w",stdout)

#define LL long long
#define ULL unsigned long long
#define ff first
#define ss second
#define pb push_back
#define INF 2e16
#define PI acos(-1.0)
#define mk make_pair
#define pii pair<int,int>
#define pll pair<LL,LL>


#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define SQR(a) ((a)*(a))
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define ROF(i,a,b) for(int i=a;i>=b;i--)
#define REP(i,b) for(int i=0;i<b;i++)
#define MEM(a,x) memset(a,x,sizeof(a))
#define ABS(x) ((x)<0?-(x):(x))

#define scanI(a) scanf("%d",&a)
#define scanI2(a,b) scanI(a) , scanI(b)
#define scanI3(a,b,c) scanI(a), scanI(b), scanI(c)
#define scanI4(a,b,c,d) scanI(a), scanI(b), scanI(c), scanI(d)

#define scanL(a) scanf("%I64d",&a)
#define scanL2(a,b) scanL(a) , scanL(b)
#define scanL3(a,b,c) scanL(a), scanL(b), scanL(c)
#define scanL4(a,b,c,d) scanL(a), scanL(b), scanL(c), scanL(d)

#define SORT(v) sort(v.begin(),v.end())
#define REV(v) reverse(v.begin(),v.end())

#define FastRead ios_base::sync_with_stdio(0);cin.tie(nullptr);

bool Check(int N,int pos) { return (bool)(N&(1<<pos)); }
int Set(int N,int pos) { return (N|(1<<pos)); }

LL BigMod(LL B,LL P,LL M){LL R=1;while(P>0){if(P%2==1){R=(R*B)%M;}P/=2;B=(B*B)%M;}return R;}

int main()
{
    string str;
    cin >> str;

    while(not str.empty())
    {
        int n = str.size();
        if(n<5){
            cout << "NO\n";return 0;
        }
        string s = str.substr(n-5,5);
        if(s=="dream" || s=="erase"){
            str.erase(str.end()-5,str.end());
            continue;
        }
        if(n<6){
            cout << "NO\n";return 0;
        }
        s = str.substr(n-6,6);
        if(s=="eraser"){
            str.erase(str.end()-6,str.end());
            continue;
        }
        if(n<7){
            cout << "NO\n";return 0;
        }
        s = str.substr(n-7,7);
        if(s=="dreamer"){
            str.erase(str.end()-7,str.end());
            continue;
        }
        cout << "NO\n";
        return 0;
    }
    cout << "YES\n";
}


Measured memory_bytes: 512
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;

// 分数の Ceil を求める関数
UInt Ceil(const UInt a, const UInt b) {
    if (a % b == 0) {
        return a / b;
    } else {
        return a / b + 1;
    }
}

int main(void) {
    Int h, a;
    cin >> h >> a;
    cout << Ceil(h, a) << endl;
    return 0;
}


Measured memory_bytes: 3628
N, M = map(int, input().split())
roads = []
for i in range(0, N):
	roads.append([])
for i in range(0, M):
	a, b = map(lambda v: int(v)-1, input().split())
	roads[a].append(b)
	roads[b].append(a)
for i in range(0, N):
	print(len(roads[i]))

Measured memory_bytes: 38384
// Package main provides
//
// File:  d.go
// Author: ymiyamoto
//
// Created on Sat Dec 22 21:27:57 2018
//
package main

import "fmt"

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

	winner := "second"
	for i := 0; i < N; i++ {
		var a int
		fmt.Scan(&a)
		if a%2 == 1 {
			winner = "first"
		}
	}
	fmt.Println(winner)
}


Measured memory_bytes: 5504
def main():
    N = int(input())
    A = [0] + [int(i) for i in input().split()] + [0]
    a = [abs(A[i] - A[i + 1]) for i in range(N + 1)]
    num = sum(a)
    print("\n".join(
        [str(num - a[i] - a[i + 1] + abs(A[i] - A[i + 2]))
         for i in range(N)]))

    return


main()


Measured memory_bytes: 20032
#include <iostream>
#include <map>
#include <queue>
#include <set>
#define F first
#define S second
using namespace std;
typedef pair<int,int> P;
typedef pair<P,P> node;
int ldx[4]={1,0,-1,0};
int rdx[4]={-1,0,1,0};
int dy[4]={0,1,0,-1};

char l[52][52];
char r[52][52];
bool sets [52][52][52][52];
int main(void){
	int w,h;
	while(cin >> w >> h,w|h){
		for(int x1=0;x1<=w+1;x1++)
			for(int y1=0;y1<=h+1;y1++)
				for(int x2=0;x2<=w+1;x2++)
					for(int y2=0;y2<=h+1;y2++)
						sets[x1][y1][x2][y2]=false;
		int plx,ply,prx,pry;
		int slx,sly,srx,sry;
		for(int x=0;x<=w+1;x++){
			l[x][0]=r[x][0]='#';
			l[x][h+1]=r[x][h+1]='#';
		}
		for(int y=0;y<=h+1;y++){
			l[0][y]=r[0][y]='#';
			l[w+1][y]=r[w+1][y]='#';
		}
		for(int y=1;y<=h;y++){
			for(int x=1;x<=w;x++){
				cin >> l[x][y];
				if(l[x][y]=='%')
					plx=x,ply=y;
				if(l[x][y]=='L')
					slx=x,sly=y;
			}
			for(int x=1;x<=w;x++){
				cin >> r[x][y];
				if(r[x][y]=='%')
					prx=x,pry=y;
				if(r[x][y]=='R')
					srx=x,sry=y;
			}
		}
		/*for(int y=0;y<=h+1;y++){
			for(int x=0;x<=w+1;x++){
				cout << l[x][y];
			}
			cout <<" " ;
			for(int x=0;x<=w+1;x++){
				cout<< r[x][y];
			}
			cout << endl;
		}*/
		queue<node> q;
		node s,g;
		s=node(P(slx,sly),P(srx,sry));
		g=node(P(plx,ply),P(prx,pry));
		q.push(s);
		sets[slx][sly][srx][sry]=true;
		while(!q.empty()){
			node cur=q.front();q.pop();
		//	cout << cur.F.F << " "<< cur.F.S << " "<< cur.S.F << " "<< cur.S.S << endl;
			if(cur == g)
				break;
			if((cur.F.F==plx&&cur.F.S==ply)||(cur.S.F==prx&&cur.S.S==pry))
				continue;
			for(int i=0;i<4;i++){
				int lnx=cur.F.F+ldx[i],lny=cur.F.S+dy[i],rnx=cur.S.F+rdx[i],rny=cur.S.S+dy[i];
				if(l[lnx][lny]=='#'&&r[rnx][rny]=='#')
					continue;
				if(l[lnx][lny]=='#')
					lnx=cur.F.F,lny=cur.F.S;
				if(r[rnx][rny]=='#')
					rnx=cur.S.F,rny=cur.S.S;
				bool lok=false,rok=false;
				if(l[lnx][lny]=='%')
					lok=true;
				if(r[rnx][rny]=='%')
					rok=true;
			//	cout << lok << rok << (lok^rok) << endl;
				node c=node(P(lnx,lny),P(rnx,rny));
			//	if(i==1|| i==3)
				//	cout << lnx << " " << lny << " " << rnx << " " << rny << endl;
				if(!sets[lnx][lny][rnx][rny]&&!(lok^rok))
					sets[lnx][lny][rnx][rny]=true,q.push(c);
			}
		}
		if(sets[plx][ply][prx][pry])
			cout << "Yes" << endl;
		else
			cout << "No" << endl;
	}
	return 0;
}

Measured memory_bytes: 9276
#include<bits/stdc++.h>
#include <array>
using namespace std;
using ULL = unsigned long long;
using UL = unsigned;
using LL = long long;
#define rep(i, n) for(UL i = 0; i < (n); i++)


struct Problem {

	void Solve() {
		UL a, b; cin >> a >> b;
		rep(i, max(a, b))
			cout << min(a, b);
		cout << endl;
	}

	
	Problem();
};
int main() {
	unique_ptr<Problem> p(new Problem());
	p->Solve();
	return 0;
}
Problem::Problem() {
	cout << fixed << setprecision(10);
}


Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	int n;
	cin>>n;
	int qwl=0,qwr=0,ans1;

	char s[105];
	cin>>s;
	for(int i=0; i<n; i++) {
		if(s[i]=='(') {
			qwl++;
		} else {
			if(qwl>0){
				qwl--;
    ans1--;
			}else{
				qwr++;
				ans1++;
			}
		}
	}
	if (ans1<1000000)
	for(int i=0;i<qwr;i++){
		cout<<'(';
	}
	cout<<s;
	for(int i=0;i<qwl;i++){
		cout<<')';
	}
	return 0;
}

Measured memory_bytes: 256
<?php
  
  $in = trim(fgets(STDIN));

switch($in) {
  case 'SUN':
    echo '7';
    break;
  case 'MON':
    echo '6';
    break;
  case 'TUE':
    echo '5';
    break;
  case 'WED':
    echo '4';
    break;
  case 'THU':
    echo '3';
    break;
  case 'FRI':
    echo '2';
    break;
  case 'SAT':
    echo '1';
    break;
}
  
  ?>

Measured memory_bytes: 3828
#include <stdio.h>
int main(void){
    int n,i,a,min,max;
    long int sum;

  scanf("%d",&n);

  i = 1;

  min = 10000000;

  max = -1000000;

  sum = 0;

  while(1){

      scanf("%d",&a);

      if(a < min){

          min = a;

      }

      if(a > max){

          max = a;

      }

      sum = sum + a;


      if(i == n)break;

     i ++;

  }

  printf("%d %d %ld\n",min,max,sum);

  return 0;

 }


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

int main(void){
  int h, w;
  scanf("%d",&h);
  scanf("%d",&w);

  vector<string> a;

  for(int i=0;i<h;i++){
    string tmp;
    cin>>tmp;
    a.push_back(tmp);
  }

  cout << string(w+2, '#') << "\n";
  for (int i=0;i<h;i++){
    cout << "#" << a[i] << "#"  << "\n";
  }
  cout << string(w+2, '#');

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define SQ(a) (a)*(a)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ll long long int 
typedef vector<ll> vi;
typedef pair<ll, ll> pi;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);	cout.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    int ans = a - b;
    ans = c - ans;
    cout << (ans < 0 ? 0 : ans) << '\n';
    return 0;
}

Measured memory_bytes: 256
#include <cassert>

#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>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// 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>
#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>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;cin>>n;
    vector<pair<int,int>> v(n);
    rep(i,0,n){
        cin>>v[i].first>>v[i].second;
    }
    Sort(v);
    rep(i,0,n){
        cout<<v[i].first<<" "<<v[i].second<<endl;
    }
}



/*
1 2 3 4 5

6
*/



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

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

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,a,b) for (i=a;i<b;i++)
#define rep2(i,a,b) for (i=a;i>=b;i--)
#define mod 1000000007
#define mod2 998244353
#define FIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define INF  1e9+5
#define f first
#define s second
#define endl '\n'
#define ll long long int
#define ii pair <int,int>
#define pll pair <ll,ll>
#define vi vector <int>
#define vl vector <ll>
#define vvi vector < vi >
#define vii vector < ii >
#define vpl vector < pll >
#define vvii vector < vii >
#define vll vector < ll >
#define vb  vector <bool>
#define pb push_back
#define mk make_pair
#define eb emplace_back
#define pg priority_queue<ll, vector<ll>, greater<ll>>
#define pq priority_queue<ll>
#define sz(a) a.size()
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define cset(a) __builtin_popcountll(a)
#define FILL(a, b, T) fill_n((T *)a, sizeof(a) / sizeof(T), b)
#define debug(x) cerr << #x << " is " << x << endl;
using namespace std;
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define pis pair<ll,pll>
#define mex 100005
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << endl;
    err(++it, args...);
}
struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }
 
    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};
// unordered_map<long long, int, custom_hash> safe_map;
// FOR VIEWERS, CODE STARTS HERE

int main()
{
    
    FIO;
    ll t, q, n, m, prev, maxx,  i, j, k1, k2, k3, k, x, y, flag, sum, cnt, ans;
    ll z;
    cin>>x>>y>>z;
    cout<<z<<" "<<x<<" "<<y<<endl;
    return 0;
} 

Measured memory_bytes: 256
MOD = 1000000007

class Factorial():
    def __init__(self,N,n,mod):
        self.N = N
        self.mod = mod
        self.factorial = [0 for _ in range(n+1)]
        self.inv = [0 for _ in range(n+1)]
        self.factorial[0] = 1
        self.inv[0] = 1
        self.factorial_ = [0 for _ in range(n+1)]
        self.factorial_[0] = N
        for i in range(n):
            self.factorial[i+1] = self.factorial[i]*(i+1)%mod
        self.inv[n] = pow(self.factorial[n],mod-2,mod)
        for i in range(n)[::-1]:
            self.inv[i] = self.inv[i+1]*(i+1)%mod
        for i in range(n):
            self.factorial_[i+1] = self.factorial_[i]*(N-i-1)%mod
    def comb(self,m,k): #組み合わせ 0<=k<=m<=n 重複組み合わせはcomb(m+k-1,k)
        return self.factorial[m]*self.inv[k]*self.inv[m-k]%self.mod
    def comb_(self,k):
        return self.factorial_[k-1]*self.inv[k]%self.mod

N,A,B = map(int,input().split())

F = Factorial(N,200010,MOD)

ans = pow(2,N,MOD) - F.comb_(A) - F.comb_(B) -1

print(ans%MOD)

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

int main(){
    int n,y;
    cin>>n>>y;
    for (int i = 0; i <=n; ++i) {//10000
        for (int j = 0; j <=n; ++j) {//5000
            if(i+j<=n && 10000*i+5000*j+1000*(n-i-j)==y){
                cout<<i<<" "<<j<<" "<<n-i-j<<endl;
                return 0;
            }
        }
    }
    cout<<"-1 -1 -1"<<endl;
    return 0;
}


Measured memory_bytes: 256