akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod 1000000007
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b,int m) {
    if (b==0) return 1;
    ll c = power(a,b>>1,m);
    c = (c*c)%m;
    if (b&1) return (c*a)%m;
    return c;
}
ll powerwithoutmod(ll a,ll b) {
    if (b==0) return 1;
    ll c = powerwithoutmod(a,b>>1);
    c = (c*c);
    if (b&1) return (c*a);
    return c;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

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

const int N = (int)1e5+5;
const int Q = 301;
const int logN = 16;

void solve() {
    ll n,a,b;
    cin>>n>>a>>b;
    if (a==0) {
        cout<<0;
    }
    else if (b==0) {
        cout<<n;
    }
    else {
        ll ans = (n/(a+b))*a;
        n %= (a+b);
        if (n>a) ans += a;
        else ans += n;
        cout<<ans;
    }

}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        cout<<"\n";
    }
}


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

int n, m, a, b;
int mp[1010][1010];

int main() {
    cin >> n >> m >> a >> b;
    rep(i, 1, b) {
        rep(j, 1, a) {
            mp[i][j] = 1;
        }
    }
    rep(i, b + 1, n) {
        rep(j, a + 1, m) {
            mp[i][j] = 1;
        }
    }
    rep(i, 1, n) {
        rep(j, 1, m) printf("%d", mp[i][j]);
        puts("");
    }
    return 0;
}


Measured memory_bytes: 5120
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
const int N=2e3+5;
int a[N],b[N],n,m;
vector<int>evens,arr;
int odd1,odd2;
int main()
{
    scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++){
        scanf("%d",&a[i]);
        if(a[i]%2==0){
            evens.pb(a[i]);
        }
        else{
            if(odd1==0){
                odd1=a[i];
            }
            else if(odd2==0){
                odd2=a[i];
            }
            else{
                printf("Impossible\n");
                return 0;
            }
        }
    }
    if(m==1){
        if(a[1]==1){
            printf("1\n");
            printf("1\n");
            printf("1\n");
            return 0;
        }
        printf("%d\n",a[1]);
        printf("2\n");
        printf("%d %d\n",a[1]-1,1);
        return 0;
    }
    if(odd1){
        arr.pb(odd1);
    }
    for(auto&x:evens){
        arr.pb(x);
    }
    if(odd2){
        arr.pb(odd2);
    }
    for(auto&x:arr){
        printf("%d ",x);
    }
    printf("\n");
    arr[0]--;
    arr[arr.size()-1]++;
    if(arr[0]<=0){
        arr.erase(arr.begin());
    }
    printf("%d\n",arr.size());
    for(auto&x:arr){
        printf("%d ",x);
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
    public static void main(String[] args ) {
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int[] a = new int[100];
        for(int i = 0; i < n; i++)
            a[i] = scanner.nextInt();

        for(int i = n - 1; i >= 0; i--) {
            System.out.print(a[i]);
            if (i != 0) System.out.print(" ");
        }
        System.out.println();
    }
}



Measured memory_bytes: 26248
N = int(input())
L = list(map(int, input().split()))
c = 0
if N == 1 or N ==2 :
  c == 0
else:
  for i in range(0, N-2):
    for j in range(i+1, N-1):
      for k in range(j+1, N):
        if L[i] != L[j] and L[j] != L[k] and L[k] != L[i] :
          l = [L[i], L[j], L[k]]
          ld = sorted(l, reverse=True)
          if ld[0] < ld[1] + ld[2]:
            c = c + 1

print(c)

Measured memory_bytes: 9208
#include <iostream>
#include <string>

using namespace std;

int main() {

  string str;
  string temp;
  int JOIcount,IOIcount;

  string::size_type index;


  while(getline(cin,str)) {

    index=0;
    JOIcount=0;
   
    temp=str;

    while(index<str.length()) {

      index=temp.find("JOI");

      if(index==string::npos) break;

      temp=temp.substr(index+1,temp.length());

      JOIcount++;

    }

    index=0;
    IOIcount=0;

    temp=str;

    while(index<str.length()) {

      index=temp.find("IOI");

      if(index==string::npos) break;

      temp=temp.substr(index+1,temp.length());

      IOIcount++;

    }

    cout << JOIcount << "\n" << IOIcount << endl;
    
  }

  return 0;

}

Measured memory_bytes: 0
#pragma GCC optimize("O3")
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <bits/stdc++.h>

#define DEBUG
#ifdef DEBUG
    #define IFD(...) __VA_ARGS__
    #define IFN(...)
    #define L cout<<__LINE__<<"\n";
    #define PRINT(...) __VA_ARGS__ cout<<__LINE__<" : "<<#__VA_ARGS__<<"\n"
    #define PRT(x) cout<<__LINE__<<" : "<<#x<<" = "<<x<<"\n"
#else // DEBUG
    #define IFD(...)
    #define IFN(...) __VA_ARGS__
    #define L
    #define PRINT(...) __VA_ARGS__
    #define PRT(x)
#endif // DEBUG

#define it iterator
#define rit reverse_iterator
#define mp make_pair
#define mems(a,b) memset(a,b,sizeof(a))
#define mem0(a) mems(a,0)
#define mem1(a) mems(a,1)
#define mem255(a) mems(a,255)
#define halt exit(0)
#define all(c) (c).begin() , (c).end()
#define sz(c) ((long long)((c).size()))
#define phb push_back
#define ppb pop_back
#define phf push_front
#define ppf pop_front
#define fort0(i,a,b) for(ll i=a,i##_TO=b;i<i##_TO;i++)
#define for0(i,n) fort0(i,0,n)
#define fort1(i,a,b) for(ll i=a,i##_TO=b;i<=i##_TO;i++)
#define for1(i,n) fort1(i,1,n)
#define ford(i,a,b) for(ll i=a,i##_TO=b;i>=i##_TO;i--)

using namespace __gnu_pbds;
using namespace std;

#define int ll

typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

template
<
    class key,
    class val=null_type,
    class comp=less<key>
>
using ord_set=tree
<
    key,
    val,
    comp,
    rb_tree_tag,
    tree_order_statistics_node_update
>;

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int a,b;
    cin>>a>>b;
    cout<<(a<=8&&b<=8?"Yay!":":(");
}


Measured memory_bytes: 256
def partition(A, p, r):
    x = A[r]
    i = p - 1
    for j in range(p, r + 1):
        if A[j] <= x:
            i += 1
            A[i], A[j] = A[j], A[i]
    return i

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

index = partition(A, 0, N - 1)

for i in range(N):
    if i == index:
        print('[{0}]'.format(A[i]), end='')
    else:
        print(A[i], end='')
    if i < N - 1:
        print(' ', end='')

print()



Measured memory_bytes: 16392
#include <iostream>
#include <algorithm>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<iomanip>
#define sqr(x) (x)*(x)
using namespace std;
int n,m,i,j,mx,smi=1e9,num[100005],ans;
int main()
{
	cin>>n>>m;
	for (i=1;i<=n;i++) cin>>num[i];
	for (i=1;i<=n;i++)
	{
		if (num[i]-smi>mx)
		{
			mx=num[i]-smi;
			ans=0;
		}
		if (num[i]-smi==mx) ans++;
		smi=min(smi,num[i]);
	}
	cout<<ans;
	return 0;
}

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

using namespace std;

int main() {
	string S;
	cin >> S;
	sort(S.begin(), S.end());
	if ((S[0] == S[1] && S[2] == S[3]) && (S[1]!=S[2])) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

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

#if ((_WIN32 || __WIN32__) && __cplusplus < 201103L)
#define lld I64d
#else
#define lld lld
#endif

//{{{
using namespace std;
typedef long long LL;
typedef vector<int> VI;
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define clr(a, b) memset(a, b, sizeof(a))
// clang-format off
#define debug(args...) {vector<string> _v = split(#args, ','); err(_v.begin(), args); cerr<<endl;}
vector<string> split(const string& s, char c) {vector<string> v; stringstream ss(s); string x; while
(getline(ss, x, c)) v.push_back(x); return v;} void err(vector<string>::iterator) {}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a, Args... args)
{cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << ", "; err(++it, args...);}
// clang-format on
//}}}

const int N = 5e5 + 10;
const int mod = 1e9 + 7;

int n, m;
LL dp[N];

LL func(int n, int m)
{
    if (dp[n] != -1) return dp[n];
    if (n == 0) return 1;
    if (n == 1) return (m - 1) % mod;

    LL v1 = (n - 1) * func(n - 2, m - 2);
    LL v2 = (m - 1) * func(n - 1, m - 1);
    return dp[n] = (v1 + v2) % mod;
}

LL f1[N];
LL f2[N];

int main()
{
#ifdef LOCAL
    freopen("in", "r", stdin);
    // freopen("out", "w", stdout);
#endif

    f1[1] = 1;
    for (int i = 2; i <= 5e5; i++) f1[i] = f1[i - 1] * i % mod;

    f2[0] = 1;
    f2[1] = 1;
    for (int i = 2; i <= 5e5; i++) f2[i] = f2[mod % i] * (mod - mod / i) % mod;
    for (int i = 2; i <= 5e5; i++) f2[i] = f2[i - 1] * f2[i] % mod;

    while (cin >> n >> m)
    {
        LL ans = f1[m];
        ans = (ans * f2[m - n]) % mod;
        clr(dp, -1);
        LL v = func(n, m);
        // debug(v);
        ans = (ans * v) % mod;
        cout << ans << endl;
    }

    return 0;
}


Measured memory_bytes: 26980
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> pip;
typedef pair<pll, pll> P;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//
 
int N;
vector<int> g[212345], rg[212345];
vector<int> sinc[212345];
bool done[212345], cycle[212345];
vector<int> vs;
int an;
int num[212345], tmp[212345];
 
void dfs(int v) {
	done[v] = true;
	REP(i, g[v].size()) if (!done[g[v][i]]) dfs(g[v][i]);
	vs.push_back(v);
}
 
void rdfs(int v, int k) {
	done[v] = true;
	sinc[k].push_back(v);
	REP(i, rg[v].size()) if (!done[rg[v][i]]) rdfs(rg[v][i], k);
}
 
void scc() {
	REP(i, N) if (!done[i]) dfs(i);
	
	memset(done, 0, sizeof(done));
	
	an = 0;
	for (int i = (int)vs.size() - 1; i >= 0; i--) {
		if (!done[vs[i]]) rdfs(vs[i], an++);
	}
}
 
// 閉路頂点st, a_st = kとする
bool solve(int st, int k) {
	num[st] = k;
	
	queue<int> que;
	que.push(rg[st][0]);
	
	while (!que.empty()) {
		int u = que.front(); que.pop();
		
		set<int> ss;
		REP(i, g[u].size()) ss.insert(num[g[u][i]]);
		int g = 0;
		while (ss.find(g) != ss.end()) g++;
		
		if (num[u] != -1) return num[u] == g;
		
		num[u] = g;
		que.push(rg[u][0]);
	}
	
	return true;
}
 
int main() {
	cin >> N;
	REP(i, N) {
		int p; scanf("%d", &p);
		p--;
		g[p].push_back(i);
		rg[i].push_back(p);
	}
	
	scc();
	
	REP(i, an) if (sinc[i].size() > 1) {
		REP(j, sinc[i].size()) {
			cycle[sinc[i][j]] = true;
		}
	}
	
	memset(num, -1, sizeof(num));
	
	queue<int> que;
	REP(i, N) if (g[i].size() == 0) {
		num[i] = 0;
		if (!cycle[rg[i][0]]) que.push(rg[i][0]);
	}
	
	while (!que.empty()) {
		int u = que.front(); que.pop();
		
		set<int> ss;
		REP(i, g[u].size()) ss.insert(num[g[u][i]]);
		
		int g = 0;
		while (ss.find(g) != ss.end()) g++;
		
		if (!cycle[rg[u][0]]) que.push(rg[u][0]);
	}
	
	
	int v = -1;
	REP(i, N) if (cycle[i]) { v = i; break; }
	
	set<int> ss;
	REP(i, g[v].size()) {
		int to = g[v][i];
		if (!cycle[to]) ss.insert(num[g[v][i]]);
	}
	
	copy(num, num + N, tmp);
	
	bool ans = false;
	
	int g = 0;
	while (ss.find(g) != ss.end()) g++;
	ans |= solve(v, g);
	
	g++;
	
	copy(tmp, tmp + N, num);
	while (ss.find(g) != ss.end()) g++;
	ans |= solve(v, g);
	
	puts(ans ? "POSSIBLE" : "IMPOSSIBLE");
	
	return 0;
}

Measured memory_bytes: 38768
#include<iostream>

using namespace std;

int main() {
	int n;
	long long p = 1, mod = 1000000007;
	cin >> n;

	for (int i = 1; i <= n; i++) {
		p *= i;
		p %= mod;
	}

	cout << p << endl;
	return 0;
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
    long long int N;cin>>N;
    vector<string> s(N);
    for(int i=0;i<N;i++){
        cin>>s[i];
    }

    for(int i=0;i<N;i++){
        sort(s[i].begin(),s[i].end());
    }
    sort(s.begin(),s.end());
    long long int ans=0;
    long long int count=1;
    for(int i=0;i<N-1;i++){
        if(s[i]==s[i+1]){
            count++;
        }
        else{
            ans=ans+((count*(count-1))/2);
            count=1;
        }
    }
    ans=ans+((count*(count-1))/2);
    cout<<ans;
    return 0;
}

Measured memory_bytes: 7296
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = sc.nextInt();
        int b = sc.nextInt();

        int res = 0;
        for (int i = 1; i <= n; i++) {
            int sum = sumDigits(i);
            if (a <= sum && sum <= b) res += i;
        }

        System.out.println(res);
    }

    private static int sumDigits(int num) {
        int sum = 0;// 10進数の各桁の和
        while (num > 0) {
            sum += (num % 10);
            num /= 10;
        }

        return sum;
    }
}


Measured memory_bytes: 22612
#include <bits/stdc++.h>
#define For(i, a, b) for(int i=(a); i<(b); i++)
#define rFor(i, a, b) for(int i=(a)-1; i>=(b); i--)
#define rep(i, n) For(i, 0, n)
#define rrep(i, n) rFor(i, n, 0)
using namespace std;

int main(){
  int n = 100010;
  bool prime[n];
  rep(i, n) prime[i] = true;
  prime[0] = prime[1] = false;
  For(i, 2, n)if(prime[i])for(int j=i*2; j<n; j+=i) prime[j] = false;
  int s[n+1];
  rep(i, n+1) s[i] = 0;
  rep(i, n){
    s[i+1] += s[i];
    if(i%2==1 && prime[i] && prime[(i+1)/2]) s[i+1]++;
  }
  int q; cin >> q;
  rep(i, q){
    int l, r; cin >> l >> r;
    cout << s[r+1] - s[l] << endl;
  }
}

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

int main()
{
	int S,h,m,s;
	cin>>S;

	h = S / 3600;
	m = (S % 3600) / 60;
	s = S-3600*h-m*60;

	cout<<h<<':'<<m<<':'<<s<<'\n';
	
	return 0;
}

Measured memory_bytes: 1160
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cstdlib>
#include <vector>
using namespace std;
#define N 140050
typedef long long ll;
int mid;
int ch[N][2],siz[N],val[N][2],n;
struct A {
	ll x,y;
};
vector<A>t[N];
bool cmp1(const A &x,const A &y) {return x.x < y.x;}
bool cmp2(const A &x,const A &y) {return x.y < y.y;}
void dfs(int x) {
	t[x].clear();
	if(!ch[x][0]) {
		siz[x]=1;
		t[x].push_back((A){0,0}); return ;
	}
	dfs(ch[x][0]);
	dfs(ch[x][1]);
	int ls=ch[x][0],rs=ch[x][1];
	siz[x]=siz[ls]+siz[rs];
	int v0=val[x][0],v1=val[x][1];
	if(siz[ls]>siz[rs]) swap(ls,rs),swap(v0,v1);
	sort(t[ls].begin(),t[ls].end(),cmp2);
	sort(t[rs].begin(),t[rs].end(),cmp1);
	int lim0=t[ls].size(),lim1=t[rs].size();
	int i,j=0;ll mn=1ll<<60;
	for(i=lim0-1;i>=0;i--) {
		while(j<lim1&&t[ls][i].y+t[rs][j].x+v0+v1<=mid) {
			mn=min(mn,t[rs][j].y);
			j++;
		}
		if(j) {
			t[x].push_back((A){t[ls][i].x+v0,mn+v1});
		}
	}
	sort(t[ls].begin(),t[ls].end(),cmp1);
	sort(t[rs].begin(),t[rs].end(),cmp2);
	j=0; mn=1ll<<60;
	for(i=lim0-1;i>=0;i--) {
		while(j<lim1&&t[ls][i].x+t[rs][j].y+v0+v1<=mid) {
			mn=min(mn,t[rs][j].x);
			j++;
		}
		if(j) {
			t[x].push_back((A){mn+v1,t[ls][i].y+v0});
		}
	}
}
int main() {
	scanf("%d",&n);
	int i,x,y;
	for(i=2;i<=n;i++) {
		scanf("%d%d",&x,&y);
		if(ch[x][0]) ch[x][1]=i,val[x][1]=y;
		else ch[x][0]=i,val[x][0]=y;
	}
	int l=0,r=1<<30;
	while(l<r) {
		mid=(l+r)>>1;
		dfs(1);
		if(t[1].empty()) l=mid+1;
		else r=mid;
	}printf("%d\n",l);
}


Measured memory_bytes: 26104
#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  multiset<int> S;
  int q;
  cin >> q;
  while (q--) {
    int op, x;
    cin >> op >> x;
    if (op == 0) {
      S.insert(x);
      cout << S.size() << endl;
    } else if (op == 1) {
      cout << S.count(x) << endl;
    } else if (op == 2) {
      S.erase(x);
    } else {
      int l = x, r;
      cin >> r;
      auto left = S.lower_bound(l);
      auto right = S.upper_bound(r);
      for (auto it = left; it != right; it++) {
        cout << *it << endl;
      }
    }
  }
}


Measured memory_bytes: 12340
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda :sys.stdin.readline().rstrip()
def resolve():
    a,b,k=map(int,input().split())
    # a,a+1,...,a+k-1とb-k+1,...,b
    if(a+k-1>=b-k+1):
        for i in range(a,b+1):
            print(i)
    else:
        for i in range(a,a+k):
            print(i)
        for i in range(b-k+1,b+1):
            print(i)
resolve()

Measured memory_bytes: 38384
import kotlin.math.abs
import kotlin.math.absoluteValue

fun main() {
    val (x, k, d) = nextLongList()
    val a = x.absoluteValue.div(d).coerceAtMost(k)
    var current = x.absoluteValue - a.times(d)
    repeat(k.minus(a).rem(2).toInt()) {
        if (current > 0) {
            current -= d
        } else {
            current += d
        }
    }
    println(abs(current))
}

// # Utils
// ## Input
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun nextList() = next().split(" ")
fun nextIntList() = next().split(" ").map(String::toInt)
fun nextLongList() = next().split(" ").map(String::toLong)
fun nextDoubleList() = next().split(" ").map(String::toDouble)

// ## Array
inline fun <reified T> sizedArray(size: Int, default: T) = Array(size) { default }
inline fun <reified T> sized2DArray(row: Int, column: Int, default: T) = Array(row) { Array(column) { default } }

// ## mod^-1
//    [NOTE] CANNOT use this for 0, mod, 2mod, 3mod ...(return wrong value)
fun modinv(num: Long, mod: Long): Long {
    var a = num
    var b = mod
    var u = 1L
    var v = 0L
    while (b > 0) {
        val t = a.div(b)
        a -= t * b
        a = b.also { b = a } // swap a and b
        u -= t * v
        u = v.also { v = u } // swap u and v
    }
    u %= mod
    if (u < 0) u += mod
    return u
}

Measured memory_bytes: 36696
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    ll N, T, ans;
    cin >> N >> T;
    vector<ll> a(N + 1);
    for (int i = 0; i < N; i++) cin >> a[i];
    a[N] = LINF;
    ans = 0;
    for (int i = 0; i < N; i++) ans += min(T, a[i+1] - a[i]);

    cout << ans << '\n';
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
int a[100];
int b[100];
int main(){
    int n,m;
    cin>>n>>m;
    for(int j=0;j<m;j++){
        cin>>a[j];
        cin>>b[j];
    }
    int sum=0;
    for(int i=1;i<n+1;i++){
        sum=0;
        for(int k=0;k<m;k++){
            if(a[k]==i||b[k]==i){
              sum++;
            }
        }
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 256
//A
#include<iostream>
#include<string>
#include<algorithm>    
#include<cmath>
#include<map>
#include<vector>
#include<math.h>
#include<stdio.h>
#include<stack>
#include<queue>
#include<tuple>
#include<cassert>
#include<set>
#include<functional>
//#include<bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#define rep(i, x) for(ll i = 0; i < x; i++)
#define rep2(i, x) for(ll i = 1; i <= x; i++)
#define all(a) (a).begin(),(a).end()
using ll = long long;
using ld = long double;
using namespace std;
const ll INF = 1000000000000000000;
const ll mod = 1000000007;
const ld pi = 3.141592653589793238;

bool isprime(int p) {
	if (p == 1) return false;
	for (int i = 2; i < p; i++) {
		if (p % i == 0) return false;
	}
	return true;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (a % b == 0)return b;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	return a / gcd(a, b) * b;
}
ll keta(ll n) {
	ll res = 0;
	while (n >= 1) {
		res += n % 10; n /= 10;
	}
	return res;
}
ll modpow(ll x, ll y) {
	ll res = 1;
	while (y) {
		if (y % 2) { res *= x; res %= mod; }
		x = x * x % mod; y /= 2;
	}
	return res;
}
ll nCk(ll n, ll k) {
	ll a = 1, b = 1;
	for (int h = n - k + 1; h <= n; h++) { a *= h; a %= mod; }
	for (int h = 1; h <= k; h++) { b *= h; b %= mod; }
	return a * modpow(b, mod - 2) % mod;
}
//printf("%.10f\n", n);

ll test[1234567];
signed main() {
	ios::sync_with_stdio(false);
	std::cin.tie(nullptr);
	
	string s, t;
	ll n, m, a = 0, b = 0, c = 0, cnt = 0, ans = 0;
	cin >> s; n = s.size();
	if (s[n - 1] == 's') { cout << s << "es" << endl; }
	else { cout << s << 's' << endl; }
	return 0;
}

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a>=13){
    cout << b << endl;
  }else if(6<=a&&a<=12){
    cout << b/2 << endl;
  }else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
# -*- coding: utf-8 -*-
"""
Created on Sat Sep 19 13:06:46 2020

@author: Admin
"""

n=int(input())
l=[]
flag=0
for i in range(n):
    a,b=input().split()
    w=[int(a),int(b)]
    l.append(w)
for i in range(len(l)-2):
    if l[i][0]==l[i][1] and l[i+1][0]==l[i+1][1] and l[i+2][0]==l[i+2][1]:
        print('Yes')
        flag=1
        break
if flag==0:
    print('No')

Measured memory_bytes: 9196
import { count } from 'console';

process.stdin.resume();
process.stdin.setEncoding('utf8');

// 標準入力取込
let gInput = '';
process.stdin.on('data', (chunk) => (gInput += chunk));
process.stdin.on('end', () => main(gInput.split(/\r?\n/)));

// 解答
function main(inputs: string[]): void {
  const [a, b, h, m] = inputs[0].split(' ').map(Number);

  const hRad = ((60 * h + m) / (60 * 12)) * 2 * Math.PI;
  const mRad = (m / 60) * 2 * Math.PI;

  console.log(Math.sqrt(Math.pow(a, 2) + Math.pow(b, 2) - 2 * a * b * Math.cos(hRad - mRad)));
}


Measured memory_bytes: 30184
#include<bits/stdc++.h>
using namespace std;
const int MAX = 100001;

int main() {
    int n, m, x;
    int c[MAX];
    m = 0;  
    scanf("%d", &n);
    fill(c,c+MAX,0);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &x);    
        c[x]++;
        c[x+1]++;
        c[x-1]++;
    }
    int mi=1;
    for (int i = 1; i < MAX; i++) {
        if(c[i] > c[mi]) mi = i;
    }
    printf("%d\n", c[mi]);
    
    return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
#define vsort(vec) sort(vec.begin(), vec.end())
#define vreverse(vec) reverse(vec.begin(), vec.end())
using ll =long long;
const ll INF =99999999999;

//最大公約数
ll gcd(ll a, ll b){
   if (a%b==0){
       return(b);
   }else{
       return(gcd(b,a%b));
   }
}
//最小公倍数
ll lcm(ll a, ll b){
   return a*b/gcd(a,b);
}

//素数判定
ll isprime(ll n){
  bool prime=true;
  for(int i=2;i<n;i++){
    if(n%i==0){
      prime=false; break;
    }
  }
if(prime){cout<<n<<" is prime"<<endl;
         }else{cout<<n<<" is not prime"<<endl;}

}
//階乗　20くらいが限界
ll factorial(ll n){
  ll a=1;ll b=n;
  for(int i=0;i<n;i++){
    a*=b;
    b--;
  }
  return a;
}

//組み合わせ　nCr
ll comb(ll a,ll b){
  ll c;
  c=factorial(a)/(factorial(a-b)*factorial(b));
  return c; 
}




//10億7。　　　100000007
//2*2行列 H*W
//vector<vector<int>> vec(H,vector<int>(W));
//for(int i=0;i<H;i++){
//for(int j=0;j<W;j++){
//cin>>vec[i][j];
//  }
//}

//文字列→数列
//string S;int A=atoi(S.c_str());
//数列→文字列
//int A;string S=to_string(A);
//数字判定　isdigit(a)
//pair宣言　pair<int,int> p(5,7);
//ソート　sort(vec.begin(),vec.end());



int main(){
cout<<fixed<<setprecision(10);

  
char X,Y;cin>>X>>Y;
  if(X<Y){
    cout<<'<'<<endl;}
  else if(X==Y){
cout<<'='<<endl;
  }else if(X>Y){
    cout<<'>'<<endl;
  }
  
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<map>
#include<set>
#define N (998244353)
using namespace std;
typedef long long ll;
typedef pair<int,ll> P;

ll kaijo[200010];
void init() {
	kaijo[0] = 1;
	for (ll i = 1;i <= 200000;i++)kaijo[i] = (kaijo[i - 1] * i) % N;
}
 
ll inv(ll x,ll power) {
	ll res = 1;
	ll k = power;
	ll y = x;
	while (k) {
		if (k & 1)res = (res*y) % N;
		y = (y%N*y%N) % N;
		k /= 2;
	}
	return res;
}
 
ll Comb(ll n, ll k) {
	if (n < 0 || k < 0 || (n - k) < 0)return 0;
	ll b = kaijo[n];
	ll c = kaijo[n - k];
	ll d = kaijo[k];
	ll cd = (c*d) % N;
	return ((b%N)*(inv(cd,N-2)) % N) % N;
}

int main(void){
    init();
    ll n,m,k;
    cin>>n>>m>>k;
    ll ans = 0;
    for(ll i=0;i<=k;i++){
        ll tmp = Comb(n-1,n-1-i);
        ll tmp1 = inv(m-1,n-1-i);
        tmp1 = (m*tmp1)%N;
        tmp = (tmp*tmp1)%N;
        ans = (ans+tmp)%N;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 5236
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		Integer[] len = new Integer[n];
		for ( int i = 0; i < n; i++ ) {
			len[i] = in.nextInt();
		}
		Arrays.sort(len);

		int cnt = 0;
		for ( int e1 = 0; e1 < n - 2; e1++ ) {
			for ( int e2 = e1 + 1; e2 < n - 1; e2++ ) {

				int d = len[e1] + len[e2];
				int i = Arrays.binarySearch(len, d);
				i = i >= 0 ? i : ~i;

				while(i == n || len[i]>= d) {
					i--;
				}
				i++; // OK範囲の直後を求めた
				cnt += Math.max(i - e2 - 1, 0);
			}
		}
		System.out.println(cnt);
		in.close();
	}
}

Measured memory_bytes: 44688
#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

struct E{
  int to,co;
  E(int to = 0,int co = 0) : to(to),co(co){}
};

int main(){
  int n,m;cin >> n >> m;
  vector<vector<E>> G(n);
  set<int> cand;
  if(m == 0) {
    cout << "Yes" << endl;
    return 0;
  }
  rep(i,m){
    int l,r,dist;cin >> l >> r >> dist;
    --l;--r;
    cand.insert(l);
    cand.insert(r);
    G[l].emplace_back(r,dist);
    G[r].emplace_back(l,-dist);
  }

  vector<int> pos(100005,-INF);
  queue<int> q;
  for(auto v:cand){
    if(pos[v] != -INF) continue;
    q.push(v);
    pos[v] = 0;
    while(!q.empty()){
      int v = q.front();q.pop();
      for(E e:G[v]){
        if(pos[e.to] == -INF){
          pos[e.to] = pos[v] + e.co;
          q.push(e.to);
        }else{
          if(pos[e.to] == pos[v] + e.co) continue;
          else{
            // printf("%d %d\n",e.to,pos[e.to]);
            // printf("%d %d\n",v,pos[v]);
            // rep(i,5) cout << pos[i] << endl;
            cout << "No" << endl;
            return 0;
          }
        }
      }
    }

  }
  cout << "Yes" << endl;
}

Measured memory_bytes: 17404
// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
using namespace std;

int main(){
    int N, K, X, Y; cin >> N >> K >> X >> Y;
    int sum = 0;
    
    if(N < K){
        sum = N * X;
    }else{
        sum = K * X + (N - K) * Y;
    }
    
    cout << sum << endl;
}

// GCC reference:
//   https://gcc.gnu.org/

// C++ language references:
//   https://cppreference.com/
//   https://isocpp.org/
//   http://www.open-std.org/jtc1/sc22/wg21/

// Boost libraries references:
//   https://www.boost.org/doc/



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

int main()
{  string s,t;
   cin>>s>>t;
   for(int i=0;i<s.size();i++)
   {
       if(s[i]!=t[i])
       {cout<<"No";exit(0);}

   }
   cout<<"Yes";
}

Measured memory_bytes: 3628
# in  5, Alice  2, left  1, Borys  4, right  1, between  1 => Arice win
# in 53, Alice 23, left 22, Borys 42, right 16, between 18 => Borys win
# in  2, Alice  1, left  0, Borys  2, right  0, between  0 => Borys win

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

#print N, A, B

# 'Alice'
# 'Borys'
# 'Draw'

if ((A - B -1) % 2) == 0:
    print 'Borys'
else:
    print 'Alice'


Measured memory_bytes: 2568
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
using namespace std;
using ll = long long;
    
int main(){
  int n;
  cin >> n;
  int ans = 1;
  while(true){
    bool can = false;
    if(2*ans > n) can = true;
    if(can) break;
    ans *= 2;
  }
  cout << ans << endl;
  return 0;
}

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

int main() {
    int N, M, X;
    cin >> N >> M >> X;
    vector<int> C(N);
    vector<vector<int>> A(N, vector<int>(M, 0));
    for (int i = 0; i < N; i++) {
        cin >> C[i];
        for (int j = 0; j < M; j++) cin >> A[i][j];
    }
    int inf = 100000000;
    int ans = inf;
    for (int i = 0; i < (1<<N); i++) {
        int cand = 0;
        vector<int> uds(M, 0);
        for (int j = 0; j < N; j++) {
            if (((i>>j)&1)==0) continue;
            cand += C[j];
            for (int k = 0; k < M; k++) uds[k] += A[j][k];
        }
        bool check = true;
        for (int j = 0; j < M; j++) {
            if (uds[j] < X) {
                check = false;
                break;
            }
        }
        if (check) ans = min(ans, cand);
    }
    if (ans < inf)cout << ans << endl;
    else cout << -1 << endl;
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int>l(n);
  rep(i,n) cin >> l[i];
  sort(l.begin(), l.end());
  int sum = 0;
  rep(i,n-1) sum += l[i];
  if(l[n-1] < sum) puts("Yes");
  else puts("No");
  return 0;
}


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

#define rep(i,x,y) for(int i=(x);i<(y);++i)
#define debug(x) #x << "=" << (x)

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#define print(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define print(x)
#endif

const int inf=1e9;
const int64_t inf64=1e18;
const double eps=1e-9;

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){
    os << "[";
    for (const auto &v : vec) {
    	os << v << ",";
    }
    os << "]";
    return os;
}

void solve(){
    string s;
    cin >> s;
    vector<bool> memo(s.size()+1),done(s.size()+1);
    function<bool(int)> rec=[&](int i){
        if(done[i]) return memo[i];
        done[i]=true;
        if(i==s.size()) return memo[i]=true;
        bool res=false;
        if(s.substr(i,5)=="dream") res|=rec(i+5);
        if(s.substr(i,7)=="dreamer") res|=rec(i+7);
        if(s.substr(i,5)=="erase") res|=rec(i+5);
        if(s.substr(i,6)=="eraser") res|=rec(i+6);
        return memo[i]=res;
    };
    if(rec(0)) cout << "YES" << endl;
    else cout << "NO" << endl;
}

int main(){
    std::cin.tie(0);
    std::ios::sync_with_stdio(false);
    cout.setf(ios::fixed);
    cout.precision(10);
    solve();
    return 0;
}


Measured memory_bytes: 2384
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
using namespace std;

int main(){
    long int N,A,B;
    cin>>N>>A>>B;
    long int c,d,e;
    c=N/(A+B);
    d=N%(A+B);
    e=c*A+min(d,A);
    cout<<e<<endl;
    return 0;
}

Measured memory_bytes: 256
#pragma comment(linker, "/STACK:10240000")
#include <bits/stdc++.h>

using namespace std;

int main ()
{
    int n, m;
    scanf ("%d%d", &n, &m);
    m /= 1000;
    int x = -1, y = -1, z = -1;
    bool flag = false;
    for (int i = 0; i <= n; i ++)
    {
        for (int j = 0; j + i <= n; j ++)
        {
            int t = n - i - j;
            if (i * 10 + j * 5 + t == m)
            {
                flag = true;
                x = i;  y = j;  z = t;
                break;
            }
        }
        if (flag)
        {
            break;
        }
    }
    printf ("%d %d %d\n", x, y, z);
    return 0;
}


Measured memory_bytes: 256
$_=<>;chop;
s/LR/L_R/g;
@s=split/_/,$_;
for(@s){
    $L=y/L/L/;
    $R=y/R/R/;
    $l=((0|(1+$L)/2)+(0|$R/2));
    $r=((0|(1+$R)/2)+(0|$L/2));
    s/RL/rl/;
    s/L|R/0/g;
    s/(.)/$1 /g;
    s/r l/$r $l/;
    print;
}




Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
#define ALL(A) (A).begin(),(A).end()

int a[26];

int main(void){
	string s;
	cin >> s;
	for(int i=0;i<s.size();i++){
			a[(int)s[i]-'a']++;
	}
	vector<int> v;
	if(s.size()==26){
		for(int i=24;i>=0;i--){
			if(s[i]<s[i+1]){
				for(int j=0;j<i;j++)cout << s[j];
				for(int j=i+1;j<26;j++){
					if(s[i]<s[j])v.push_back(s[j]);
				}
				sort(ALL(v));
				cout << (char) v[0] << endl;
				return 0;
			}
		}
		cout << -1 << endl;
		return 0;
	}else{
		for(int i=0;i<26;i++){
			if(a[i]==0){
				cout << s << (char)('a' + i) << endl;
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
/*
对应原理
若解药好吃的大于等于c-1则可以把带毒药的好吃的全部吃掉
1 2 3
tp
ta
tp
ta
tp
反正b是一定会吃掉的(ans=b)，并且还会顺便吃掉min(b,c) ans+=
如果吃完之后，c还有剩下的则吃掉min(a,c)
如果吃完之后，c还有剩下的，则再吃掉一个
*/
#include<bits/stdc++.h>
#define MAXN 100005
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
using namespace std;
typedef long long ll;
const ll INF=1e18;
ll a,b,c;
int main()
{
//    freopen("c://duipai//939cdata.txt", "r", stdin);
//    freopen("c://duipai//939cwa.txt", "w", stdout);
    while(~scanf("%lld %lld %lld",&a,&b,&c))
    {
//        string str;
//        cin>>str;
//        cout<<str<<endl;
        ll ans=b;
        ll minm=min(b,c);
        ans+=minm;
        c-=minm;
        if(c)
        {
            minm=min(a,c);
            ans+=minm;
            c-=minm;
            if(c)
            {
                ans++;
            }
        }
        printf("%lld\n",ans);
    }
}
/*
*/


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

int main () {
    int m,f,r;
    for (int i=0;i<50;i++) {
        cin >> m >> f >> r;
        if ( m + f >= 80 && m!=-1 && f!=-1 ) {
            cout << "A" << endl;
        } else if ( m + f >= 65 && m + f < 80 && m!=-1 && f!=-1 ) {
            cout << "B" << endl;
        } else if ( m + f >= 50 && m + f < 65 && m!=-1 && f!=-1 ) {
            cout << "C" << endl;
        } else if ( m + f >= 30 && m + f < 50 && m!=-1 && f!=-1 ) {
            if ( r >= 50 ) {
                cout << "C" << endl;
            } else {
                cout << "D" << endl; 
            }
        } else if ( m + f < 30 && m + f >=0 && m!=-1 && f!=-1 ) {
            cout << "F" << endl;
        } else if ( m!=-1 && f==-1 ) {
            cout << "F" << endl;
        } else if ( m==-1 && f!=-1 ) {
            cout << "F" << endl;
        } else if ( m == -1 && f == -1 && r == -1 ) {
            break;
        }
    }
}


Measured memory_bytes: 3076
#include <cstdio>

int main(){
    long long n, d;
    long long x, y;
    int ans = 0;
    scanf("%lld%lld", &n, &d);
    d = d * d;
    while(n--){
        scanf("%lld%lld", &x, &y);
        if(x * x + y * y <= d)
            ++ans;
    }
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 1736
#include<bits/stdc++.h>
#define rg register
#define il inline
using namespace std;
const int mod=1e9+7;
#define _ 310
int n, m, f[_][_][_], cnt[_], ans;
struct Node{int l, x;}c[_][_];
int main(){
	scanf("%d%d", &n, &m);
	int l, r, x;
	for(int i=1; i<=m; ++i){
		scanf("%d%d%d", &l, &r, &x);
		c[r][++cnt[r]]=(Node){l, x};
	}

	f[0][0][0]=1;

	for(int i=0; i<=n; ++i)
		for(int j=0; j<i||!j; ++j)
			for(int k=0; k<j||!k; ++k){
				for(int t=1; t<=cnt[i]; ++t)
					if((j>=c[i][t].l)+(k>=c[i][t].l)!=c[i][t].x-1){
						f[i][j][k]=0;
						break;
					}
				
				if(!f[i][j][k])continue;
				(f[i+1][i][j]+=f[i][j][k])%=mod;
				(f[i+1][j][k]+=f[i][j][k])%=mod;
				(f[i+1][i][k]+=f[i][j][k])%=mod;
			}

	for(int j=0; j<n; ++j)
		for(int k=0; k<j||!k; ++k)
			(ans+=f[n][j][k])%=mod;
	printf("%d", ans);
}


Measured memory_bytes: 113664
#include <stdio.h>
#include <math.h>

int main(void){
  int n, k;
  scanf("%d %d", &n, &k);
  double c = pow(k - 1, n - 1);
  k *= c;
  n = (int) k;
  printf("%d\n", n);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define fileio freopen("in.in", "r", stdin),freopen("out.out", "w", stdout);
#define ll long long int
#define FF first
#define SS second
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<long long int,long long int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define pss printf
#define MOD 1000000007
#define INF 1e18
#define eps 0.00001
#define endl '\n'
#define debug(n1) cout<<n1<<endl
const int N = 1e5;  // limit for array size
ll n;  // array size

int main(){
	string s;cin>>s;
	int c;cin>>c;
	string ans="";
	for(int i=0;i<s.length();i+=c){
		ans+=s[i];
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int times = sc.nextInt();
		
		for(int i = 0; i < times; i++){
			int[] nums = new int[3];
			for(int j=0; j < nums.length; j++){
				nums[j]=sc.nextInt();
			}
			if(isCRight(nums[0],nums[1],nums[2]) || isCRight(nums[1], nums[2],nums[0]) || isCRight(nums[2], nums[0],nums[1])){
				System.out.println("YES");
			}else{
				System.out.println("NO");
			}
		}
	}
	
	private static boolean isCRight(int a, int b, int c){
		return a*a + b*b ==c *c;
	}
}

Measured memory_bytes: 12000
#include<stdio.h>

int main()
{
    int a,b,c;
    scanf("%d%d%d",&a,&b,&c);
    if(a+b==c||b+c==a||a+c==b){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }


    return 0;
}


Measured memory_bytes: 128
N = int(input())
A = list(map(int, input().split()))
i = 0
ans = 0
while i < N:
    j = i
    while j < N-1 and A[j]<=A[j+1]:
        j += 1
    k = i
    while k < N-1 and A[k]>=A[k+1]:
        k += 1
    ans += 1
    i = max(j, k) + 1
print(ans)


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

int main(){
    int n;cin >>n;
    vector<int> vec(n);
    rep(i,n) cin >> vec[i];
    sort(all(vec),greater<int>());
    int ans =0;
    int tmp=INF;
    rep(i,n) {
        if(vec[i]<tmp){
            ans +=1;
            tmp = vec[i];
        }
    }
    cout << ans << endl;
    
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace ABC
{
    class ABC167A
    {
        const string FILE = "/tmp/data.txt";

        static void Main(string[] args)
        {
#if DEBUG
            Console.SetIn(new StreamReader(FILE));
#endif
            var s = Console.ReadLine();
            var t = Console.ReadLine();

            var result = (s.Length + 1 == t.Length)                && t.StartsWith(s)                ? "Yes" : "No";
            Console.WriteLine(result);

#if DEBUG
            Console.WriteLine();
#endif
        }
    }
}


Measured memory_bytes: 26224
#include <bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) begin(a),end(a)
#define MS(m,v) memset(m,v,sizeof(m))
#define D10  fixed<<setprecision(10)
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> P;
typedef long long ll;
const ll INF = 114514810;
const ll MOD = 1000000007;
const double EPS = 1e-8;
const double PI = acos(-1.0);
struct edge
{
	int from, to, cost;
	bool operator < (const edge& e) const { return cost < e.cost; }
	bool operator >(const edge& e) const { return cost > e.cost; }
};
int dx[] = { -1, 0, 0, 1 }; int dy[] = { 0, -1, 1, 0 };
bool valid(int x, int y, int h, int w) { return (x >= 0 && y >= 0 && x < h&&y < w); }
///*************************************************************************************///
///*************************************************************************************///
///*************************************************************************************///

int main()
{
	int n, m;
	cin >> n >> m;
	int g[30][30];
	REP(i, n)REP(j, n) g[i][j] = (i == j ? 0 : INF);
	REP(i, m)
	{
		int a, b, c, d;
		scanf("%d,%d,%d,%d", &a, &b, &c, &d);
		a--; b--;
		g[a][b] = c;
		g[b][a] = d;
	}
	REP(k, n)REP(i, n)REP(j, n) g[i][j] = min(g[i][j], g[i][k] + g[k][j]);
	int a, b, c, d; 
	scanf("%d,%d,%d,%d", &a, &b, &c, &d);
	a--; b--;
	cout << c - d - g[a][b] - g[b][a] << endl;
	return 0;
}

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

using namespace std;

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

  int N;
  cin >> N;
  string S;
  cin >> S;

  int result = 0;
  for (int base = 0; base < N; ++base) {
    auto* str = &S[base];
    const auto len = N - base;
    vector<int> matched(len);
    int lookup = 0;
    for (int offset = 1; offset < len;) {
      for (; offset + lookup < len && str[offset + lookup] == str[lookup];
           ++lookup) {
      }
      if (lookup <= offset) {
        result = max(result, lookup);
      }
      matched[offset] = lookup;
      if (lookup <= 1) {
        lookup = 0;
        ++offset;
        continue;
      }
      int offset0 = 1;
      for (; offset0 < lookup; ++offset0) {
        auto lookup0 = matched[offset0];
        auto offset1 = offset + offset0;
        if (static_cast<int>(matched.size()) <= offset1 ||
            offset + lookup <= offset1 + lookup0) {
          break;
        }
        if (offset0 + lookup0 <= offset1) {
          result = max(result, lookup0);
        }
        matched[offset1] = lookup0;
      }
      offset += offset0;
      lookup -= offset0;
    }
  }

  cout << result << endl;
}


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

// Requires lazy_tag
template<typename Q>
struct segment_tree{
	segment_tree(): segment_tree(0){}
	segment_tree(int n): segment_tree(vector<Q>(n)){}
	segment_tree(const vector<Q> &v): n((int)v.size()){ // O(n)
		log = __lg(n + 1) + 1;
		size = 1 << log;
		val = vector<Q>(size << 1);
		copy(v.begin(), v.end(), val.begin() + size);
		for(int i = size - 1; i >= 1; -- i) update(i);
	}
	void update(int p, Q x){ // O(log n)
		assert(0 <= p && p < n);
		p += size;
		val[p] = x;
		for(int i = 1; i <= log; ++ i) update(p >> i);
	}
	Q query(int p){ // O(log n)
		assert(0 <= p && p < n);
		return val[p + size];
	}
	Q query(int l, int r){ // O(log n)
		assert(0 <= l && l <= r && r <= n);
		Q sml{}, smr{};
		l += size, r += size;
		for(; l < r; l >>= 1, r >>= 1){
			if(l & 1) sml = sml + val[l ++];
			if(r & 1) smr = val[-- r] + smr;
		}
		return sml + smr;
	}
	Q query_all(){ return val[1]; } // O(1)
	template<typename F> int partition_point_pref(int l, F f){ // O(log n)
		assert(0 <= l && l <= n);
		if(l == n) return n;
		l += size;
		Q sm{};
		do{
			while(~l & 1) l >>= 1;
			if(!f(sm + val[l])){
				while(l < size){
					l = l << 1;
					if(f(sm + val[l])) sm = sm + val[l ++];
				}
				return l - size;
			}
			sm = sm + val[l ++];
		}while((l & -l) != l);
		return n;
	} // f(sum[l, r)) is T, T, ..., T, F, F, ..., F, returns max r with T
	template<typename F> int partition_point_suff(int r, F f){ // O(log n)
		assert(0 <= r && r <= n);
		if(r == 0) return 0;
		r += size;
		Q sm{};
		do{
			-- r;
			while (r > 1 && r & 1) r >>= 1;
			if(!f(val[r] + sm)){
				while(r < size){
					r = r << 1 | 1;
					if(f(val[r] + sm)) sm = val[r --] + sm;
				}
				return r + 1 - size;
			}
			sm = val[r] + sm;
		}while((r & -r) != r);
		return 0;
	} // f(sum[l, r)) is F, F, ..., F, T, T, ..., T, returns min l with T
	int n, size, log;
	vector<Q> val;
	void update(int i){ val[i] = val[i << 1] + val[i << 1 | 1]; }
};

struct Q{ // Monoid (Query type) / Default constructor yields the identity
	int val = 0;
	Q operator+(const Q &x) const{
		return {max(val, x.val)};
	} // Monoid operator, always merges adjacent intervals
};

int main(){
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(ios::badbit | ios::failbit);
	int n, k;
	cin >> n >> k;
	segment_tree<Q> tr(300001);
	for(auto rep = 0; rep < n; ++ rep){
		int x;
		cin >> x;
		int p = tr.query(max(0, x - k), min(300001, x + k + 1)).val;
		tr.update(x, {p + 1});
	}
	cout << tr.query_all().val << "\n";
	return 0;
}

/*

*/

////////////////////////////////////////////////////////////////////////////////////////
//                                                                                    //
//                                   Coded by Aeren                                   //
//                                                                                    //
////////////////////////////////////////////////////////////////////////////////////////

Measured memory_bytes: 8480
#include <iostream>
#include <vector>
#include<algorithm>
#include<iomanip>
#include<queue>
#include<map>
#include<bitset>
#include<math.h>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for(int i=m;i<(int)(n);i++)
typedef pair<int,int> pint;
typedef long long ll;
const int inf   = 1e9+7;
const ll  longinf = 1LL<<60;
const int mod=1e9+7;
int dx[4]={1,0,-1,0}, dy[4]={0,1,0,-1};

struct LazySegmentTree{
  int sz=1;
  vector<ll> node,lazy;
  LazySegmentTree(int n){
    while(sz<n)sz*=2;
    node.resize(2*sz-1,0);
    lazy.resize(2*sz-1,0);
    }
  
  void eval(int k,int l,int r){
    if(lazy[k]){
      node[k]+=lazy[k];
      if(r-l>1){
        lazy[2*k+1]+=lazy[k]/2;
        lazy[2*k+2]+=lazy[k]/2;
        }
      lazy[k]=0;
      }
    }
  
  void add(ll x,int a,int b,int k,int l,int r){
    eval(k,l,r);
    if(b<=l||r<=a)return;
    if(a<=l&&r<=b){
      lazy[k]+=x*(r-l);
      eval(k,l,r);
      return;
      }
    add(x,a,b,2*k+1,l,(l+r)/2);
    add(x,a,b,2*k+2,(l+r)/2,r);
    node[k]=node[2*k+1]+node[2*k+2];
    }
  
  ll get(int a,int b,int k,int l,int r){
    eval(k,l,r);
    if(b<=l||r<=a)return 0;
    if(a<=l&&r<=b)return node[k];
    ll vl=get(a,b,2*k+1,l,(l+r)/2);
    ll vr=get(a,b,2*k+2,(l+r)/2,r);
    return vl+vr;
    }
  
  void add(ll x,int a,int b){
    add(x,a,b,0,0,sz);
    }
  ll get(int a,int b){
    return get(a,b,0,0,sz);
    }  
  
  };

int main(){
  int n;cin>>n;
  LazySegmentTree lst(n);
  int q;cin>>q;
  rep(i,q){
    int t;cin>>t;
    if(!t){
      int a,b,x;
      cin>>a>>b>>x;
      lst.add(x,a-1,b);
      }
    else{
      int a,b;
      cin>>a>>b;
      cout<<lst.get(a-1,b)<<endl;
      }
    }
  return 0;
  }


Measured memory_bytes: 7064