akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long;
const int mod = 1000000007;
struct mint {
  ll x; // typedef long long ll;
  mint(ll x=0):x((x%mod+mod)%mod){}
  mint operator-() const { return mint(-x);}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this;}
  mint operator+(const mint a) const { return mint(*this) += a;}
  mint operator-(const mint a) const { return mint(*this) -= a;}
  mint operator*(const mint a) const { return mint(*this) *= a;}
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }
};

int main() {
  ll n,k;
  cin >> n >> k;
  vector<ll> vec(n);
  bool b=0;
  rep(i,n){
      cin >> vec[i];
      if(vec[i]>=0) b=1;
  }
  mint ans=1;
  sort(vec.begin(),vec.end());
  reverse(vec.begin(),vec.end());
  if(b==0&&k%2==1){
      rep(i,k) ans*=vec[i];
      cout << ans.x << endl;
      return 0;
  }
  if(n==k){
      rep(i,n) ans*=vec[i];
      cout << ans.x << endl;
      return 0;
  }
  vector<ll> p,m;
  for(ll x:vec){
      if(x>=0) p.push_back(x);
      else m.push_back(x);
  }
  if(!m.empty())reverse(m.begin(),m.end());
  ll pnow=0,mnow=0;
  if(k%2==1){
      ans*=p[pnow];
      pnow++;
      k--;
  }
  while(k>=2){
      ll x=0,y=0;

      if(!p.empty()){
          if(p.size()-2>=pnow)x=p[pnow]*p[pnow+1];

      }
      if(!m.empty()){
          if(m.size()-2>=mnow)y=m[mnow]*m[mnow+1];

      }

      if(x>=y){
          ans*=p[pnow];
          ans*=p[pnow+1];
          pnow+=2;
          k-=2;
      }
      else{
          ans*=m[mnow];
          ans*=m[mnow+1];
          mnow+=2;
          k-=2;
      }

  }

  
  cout << ans.x << endl;
}

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

int main(){
  int n, m;
  cin >> n >> m;
  cout << n*(n-1)/2+m*(m-1)/2 << endl;;
  return 0;
}


Measured memory_bytes: 3596
s=gets.chomp
a=[0]*2019
a[0]=1
e=1
o=0
x=0
s.size.times{|i|
	d=s[i].to_i
	o=(o-d*e)%2019
	x+=a[o]
	a[o]+=1
	e=e*202%2019
}
p x

Measured memory_bytes: 14728
#include <bits/stdc++.h> 
#include <string> 
using namespace std; 
  
// Function which return string by concatenating it. 
string repeat(string s, int n) 
{ 
    // Copying given string to temparory string. 
    string s1 = s; 
  
    for (int i=1; i<n;i++) 
        s += s1; // Concatinating strings 
  
    return s; 
} 
  
// Driver code 
int main() 
{ 
    string s = "ACL"; 
    int n;
  cin >> n;
    cout << repeat(s, n) << endl;; 
    return 0; 
} 

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

typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(c) (c).begin(), (c).end()
#define uniq(c) c.erase(unique(all(c)), (c).end())
#define _1 first
#define _2 second
#define pb push_back
#define INF 1145141919
#define MOD 1000000007

long long N;
signed main() {
  ios::sync_with_stdio(false); cin.tie(0);
  cin >> N;
  long long mx = sqrt(N), m = 1LL<<60;
  for (long long x=1; x<=mx; x++) {
    long long y = N/x;
    if (x*y != N) continue;
    m = min(m, 1LL+(int)log10(y));
  }
  cout << m << "\n";
  return 0;
}


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

#define pb push_back
#define int int64_t

const int M = pow(10,9)+7;

vector <int> calc(int indegree[] , int n) {
    vector<int>ans;
    for(int i=1;i<=n;i++) {
        if(indegree[i] == 0) {
            ans.pb(i);
        }
    }
    return ans;
}

int solve(vector< vector<int> >&adj , int n , int s , vector <int> &maxi) {
    int count = 0;
    for(auto x:adj[s]) {
        if(maxi[x] == -1)
            count = max(count , (solve(adj , n , x , maxi) + 1) % M);
        else 
            count = max(count , ( maxi[x] + 1) % M);
    }
    maxi[s] = count;
    return maxi[s];
    
}

int32_t main() {
	int n , m , i , j , k , l;
	cin >> n >> m;
	vector<vector<int>>adj(n+1);
	int in[n+1]={0};
	for(i=1;i<=m;i++) {
	    cin >> j >> k;
	    adj[j].pb(k);
	    in[k]++;
	}
	vector <int> zero = calc(in , n) , maxi(n+1 , -1);
	int ans = 0;
	for(auto x:zero) {
	    ans = max(ans , solve(adj , n , x , maxi))%M;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 15104
#include <math.h>
#include <bits/stdc++.h>
#include <deque>
#include <string>
#include <vector>
#include <algorithm>
#define ll long long int
#define l long double
#define pi 3.14159265358979323846
#define mod 1000000007
#define vali 1000000000000000000
using namespace std;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,k,cnt=0;
    cin>>n>>k;
    for(int i=0;i<n;i++)
    {
        ll x;
        cin>>x;
        if(x>=k)
        cnt++;
    }
    cout<<cnt<<endl;
}

Measured memory_bytes: 3608
#include<iostream>
using namespace std;
int check(int s,int b[],int e)
{
    int v,j;
    while(s!=0)
    {
        v=s%10;
        for(j=0;j<e;j++)
        {
           if(b[j]==v)
           {
               return 1;
           }
        }
        s=s/10;
    }
    return 0;
}
int main()
{
    int N,K,i,x,z;
    cin>>N>>K;
    int a[K];
    for(i=0;i<K;i++)
    {
        cin>>a[i];
    }
    x=N;
    while(1)
    {
        z=check(x,a,K);
        if(z==0)
        {
           break;
        }
        else
        {
            x++;
        }
    }
    cout<<x<<endl;
}


Measured memory_bytes: 3604
#include <iostream>

int main()
{
    int H, W;
    while (1) {
        std::cin >> H >> W;
        if (H == 0 || W == 0)
            break;
        char c = '#';
        for (int i = 0; i < H; i++) {
            for (int j = 0; j < W; j++) {
                c = ((i+j)%2 == 0) ? '#' : '.';
                std::cout << c;
            }
            std::cout << std::endl;
        }
        std::cout << std::endl;
    }
}

Measured memory_bytes: 3056
#include<stdio.h>

int main(){
    int N;
    while(~scanf("%d",&N)){
        int sum = 0;
        if(N < 10) sum = N;
        else if(N<100) sum = 9;
        else if(N<1000) sum = 9+(N-100+1);
        else if(N<10000) sum = 9+900;
        else if(N<100000) sum = 9 + 900 + (N-10000+1);
        else sum = 90909;

        printf("%d\n",sum);
    }
}


Measured memory_bytes: 128
//
//  main.cpp
//  at
//
//  Created by 黄道煜 on 2018/8/18.
//  Copyright © 2018年 黄道煜. All rights reserved.
//

#include <iostream>
#include <cstdio>
using namespace std;

int n, sum;

int main()
{
    scanf("%d", &n);
    for(int i=1; i<=n; i++)
    {
        int ans=0;
        if(i%2==0) continue;
        for(int j=1; j<=i; j++)
        {
            if(i%j==0) ans++;
        }
        if(ans==8) sum++;
    }
    printf("%d\n", sum);
}


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

#define INF 1e18
#define REP(i, n) for (int i=0; i<n; i++)
#define print(x) cout << x << endl
#define debug(x) cout << #x << " = "<< x << endl

const double PI=3.141592653589793238462643383279502884197169399375105820974944;

typedef long long ll;

using namespace std;

void solve() {
    int K, X;
    cin >> K >> X;

    if (K*500 >= X) print("Yes");
    else print("No");
}

signed main() {
    solve();
}


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

#if DEBUG && !ONLINE_JUDGE
    #include "/home/tushar_garg/Desktop/cpp/debug.h"
#else
    #define dbg(x...)
#endif

typedef     long long                            ll; 
typedef     pair<ll, ll>                         pl; 
typedef     vector<ll>                           vl;
typedef     vector<char>                         vc;
typedef     vector<bool>                         vb; 
typedef     vector<vl>                           vvl; 
typedef     vector<pl>                           vll; 
typedef     map<ll, ll>                          dict; 
typedef     map<ll, ll, greater <ll> >           sdict; 
typedef     map<char, ll>                        mcl;
typedef     priority_queue<ll>                   pqi;
typedef     priority_queue<pl>                   pqii;
typedef     priority_queue<ll, vl, greater<ll>>  pqmini;

#define rep(i, a, n) for (auto i=(a)-((a)>(n)); i!=(n)-((a)>(n)); i+=1-2*((a)>(n)))
#define trav(i, a) for(auto &i:a)
#define fi first 
#define se second 
#define mp make_pair 
#define pb push_back
#define eb emplace_back
#define flash ios_base::sync_with_stdio(false),cin.tie(nullptr),cout.tie(nullptr)
#define QuickSilver cin.exceptions(cin.failbit),setprecision(12),cout.precision(12);
#define fill(a, b) memset(a, b, sizeof(a)
#define get(a) rep(i,0,sz(a))cin>>a[i];
#define sz(a) (ll)(a.size())
#define all(a) a.begin(), a.end()
#define mod 1000000007

struct FT{
    int n; vector<ll> t;
    FT(int m) : n(m), t(m,0){}
    void update(int p, ll val){
        for(;p<n;p|=p+1) t[p]=max(t[p], val);
    }
    long long query(int p){
        long long val=0;
        for(;p>0;p&=p-1) val=max(val,t[p-1]);
        return val;
    }
};

int main(){
	flash; QuickSilver;
	int n; cin>>n;
	vl h(n); get(h); 
	vl a(n); get(a);
	FT s(n);
	rep(i,0,n) s.update(h[i]-1, a[i]+s.query(h[i]));
	cout<<s.query(n)<<"\n";
	return 0;
}

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

using namespace::std;

long h[300001];
long w[300001];



int main(){
    long n,res=0,i,j,hi,wi,H,W,M,x,y,a=0,b=0,ko=1;
    set<pair<long,long>> s;
    vector<long> numx,numy;
    cin >> H >> W >> M;
    for(i=0;i<M;i++){
        cin >> hi >> wi;
        s.insert(make_pair(hi,wi));
        h[hi]++;
        w[wi]++;
    }
    for(i=0;i<=H;i++) if(a < h[i]) a = h[i];
    for(i=0;i<=W;i++) if(b < w[i]) b = w[i];
    
    for(i=0;i<=H;i++) if(a == h[i]) numx.push_back(i);
    for(i=0;i<=W;i++) if(b == w[i]) numy.push_back(i);

    for(i=0;i<numx.size()&&ko==1;i++){
        for(j=0;j<numy.size()&&ko==1;j++){
            x = numx.at(i);
            y = numy.at(j);
            ko = s.count(make_pair(x,y));
            res = a + b - ko;
        }
    }
    cout << res;
}


Measured memory_bytes: 34964
#include<stdio.h>

int main()
{
  short n,i;
  char k;
  int score[100];
  int max,min,sum;

  while(1){
    k = 0;
    sum = 0;

    scanf("%hd",&n);
    if(n == 0){
      break;
    }

    for(i = 0;i < n;i++){
      scanf("%d",&score[i]);

      if(k == 0){
        min = score[i];
        max = score[i];
        k = 1;
      }
      else{
        if(score[i] > max){
          max = score[i];
        }
        else if(score[i] < min){
          min = score[i];
        }
      }

      sum = sum + score[i];
    }

    sum = sum - (max + min);
    sum = sum / (n-2);

    printf("%d\n",sum);
  }

  return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

int gcd(int a, int b){
   if (a%b == 0) return(b);
   else return(gcd(b, a%b));}

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);
  REP(i, m) cin >> b[i];
  vector<vector<int>> a(n, vector<int>(m));
  REP(i, n){
    REP(j, m) cin >> a[i][j];
  }
  int ans = 0;
  REP(i, n){
    int now = c;
    REP(j, m){
      now += a[i][j] * b[j];
    }
    if (now > 0) ans++;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 3668
#include <bits/stdc++.h>
using namespace std; 
int n,m;

int main() {
    //freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin>>n>>m;
	for(int i=0;i<m;i++){
		int a;
		cin>>a;
		n-=a;
	}
	if(n>0){
		cout<<"No"<<endl;
	}
	else cout<<"Yes"<<endl;
    return 0; 
}/*
*/

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

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

A.sort()

if N==2:
    print(str(A[1]-A[0])+'\n'+str(A[1])+' '+str(A[0]))
    

else:
    ans_li=[]
    mainus = [x for x in A if x<0]
    plus = [x for x in A if x>=0]
    
    if len(plus)<2:
        before_result=A[-1]
        for i in range(N-1):
            ans_li.append(str(before_result)+' '+str(A[i]))
            before_result = before_result - A[i]
        print(str(before_result))
        for a in ans_li:
            print(a)
    elif len(mainus)<2:
        before_result=A[0]
        for i in range(N-1)[1:]:
            ans_li.append(str(before_result)+' '+str(A[i]))
            before_result = before_result - A[i]
        ans_li.append(str(A[-1])+' '+str(before_result))
        before_result = A[-1]-before_result
        print(str(before_result))
        for a in ans_li:
            print(a)
    else:
        before_result=mainus[0]
        for i in range(len(plus)-1):
            ans_li.append(str(before_result)+' '+str(plus[i]))
            before_result = before_result - plus[i]
        mainus[0] = before_result
        for i in range(len(mainus)):
            ans_li.append(str(plus[-1])+' '+str(mainus[i]))
            plus[-1] = plus[-1]-mainus[i]
        print(str(plus[-1]))
        for a in ans_li:
            print(a)

Measured memory_bytes: 67516
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <queue>
#include <deque>

#define AS(a) (sizeof(a)/sizeof(a[0]))
using namespace std;
long long int MOD = 1000000007;

int main() {
  int X;
  cin >> X;
  int ans = 0;
  int now = 0;
  for(int i = 0; i < X; i++) {
    now += i+1;
    if(now >= X) {
      ans = i+1;
      break;
    }
  }
  cout << ans << endl;


}


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

int main() {
  int a, b, c;
  std::cin >> a>>b>>c;
  int d=10*b +c;
  if (d%4==0) {
    std::cout << "YES" << '\n';/* code */
  }
  else{
    std::cout << "NO" << '\n';
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define rep(i,n) for(ll i=0;i<(n);i++)
#define init(a,i) for(int k=0;k<(i);k++)(a)[k]=0
#define in(a,i) for(int k=0;k<(i);k++)cin>>(a)[k]
#define all(a)  (a).begin(),(a).end()
#define el(a) (a).end()-(a).begin()
#define mod 1000000007
#define inf 2147483647
#define range(x,a,b) (a)<=x&&x<=(b)
int main(){
	int n;
	cin>>n;
	if(n%10==3){
		cout<<"bon";
		return 0;
	}
	if(n%10==0||n%10==1||n%10==6||n%10==8){
		cout<<"pon";
		return 0;
	}
	cout<<"hon";
	return 0;
}

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

double pi(void){
    return atan(1.0) * 4.0;
}

void circle(double r){
    printf("%f %f\n", pi() * pow(r, 2), 2 * pi() * r);
}

int main(void){
    double r = 0;
    scanf("%lf", &r);
    circle(r);

    return 0;
}



Measured memory_bytes: 2044
import sys
import math
import bisect

def main():
    a, b = map(int, (input().split()))
    ans = False
    for i in range(1, 4):
        if a * b * i % 2 == 1:
            ans = True
    if ans:
        print('Yes')
    else:
        print('No')

if __name__ == "__main__":
    main()


Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define F first
#define S second
#define forn(i, n) for (int i = 0; i < (int)n; i++)
#define pb push_back
#define fastIO ios::sync_with_stdio(0), cin.tie(0);
#define endl '\n'
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
int main() {
#ifdef LOCAL
    // freopen("in.txt", "r", stdin);
    // freopen("out.txt", "w", stdout);
#else
    fastIO;
#endif
    int n;
    string s;
    cin >> n >> s;
    int x = 0;
    int mx = 0;
    forn(i, n) {
        if (s[i] == 'I') {
            x++;
        } else {
            x--;
        }
        mx = max(mx, x);
    }
    cout << mx << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    // Your code here!
    int n,sum;
    int a[100];
    sum=0;
    cin>>n;
    for (int i=0;i<n;i++) cin>>a[i];
    sort(a,a+n,greater<int>());
    for (int i=0;i<n;i++){
        if (i%2==0){
            sum+=a[i];
        }
        else{
            sum-=a[i];
        }
    }
    cout<<sum<<endl;
}


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

int main(){
  int N;
  cin>>N;
  if(N<105) cout<<0<<endl;
  else if(N<135) cout<<1<<endl;
  else if(N<165) cout<<2<<endl;
  else if(N<189) cout<<3<<endl;
  else if(N<195) cout<<4<<endl;
  else cout<<5<<endl;
}


Measured memory_bytes: 256
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
typedef long long ll;
// #include<C:\Users\J\Desktop\AC\athead.h>
#define showa(v) for(int iii = 0; iii < v.size(); iii++){ cout << v[iii] << " ";} cout << endl;
#define show(iiii) cout << iiii << endl; 
#define shows(iiiii) cout << iiiii << " ";
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include <cmath>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <set>
#include <deque>
#include <numeric>
#include<tuple>
#include <utility>
#include <map>
#include <cassert>
#include<unordered_set>
using namespace std;

bool sosu(int n){
    bool flag = true;
    for(int i = 2; i < sqrt(n)+1; i++){
        if(n%i == 0){
            flag = false;
            break;
        }
    }
    return flag;
}

 
int main(){
    int n;
    cin >> n;
    vector<int> a(n+10);
    rep(i,n){
        cin >> a[i];
    }
    bool res = true;
    unordered_set<int> u;
    rep(i,n){
        auto buf = u.insert(a[i]);
        if(!buf.second){
            res = false;
            break;
        }
    }
    if(res){
        cout << "YES" << endl;
    }
    else{
        cout << "NO" << endl;
    }
}

Measured memory_bytes: 9288
// </> : towhid1zaman

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

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int maxn = 2000100;

int main(){
        _ios;

	string n;
	cin>>n;
	bool ok=false;
	for(int i=0; i<n.size(); i++){
		if(n[i] == '7'){
			ok=true;
			break;
		}

	}
	if(ok) cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

return 0;
}



Measured memory_bytes: 3640
#pragma GCC optimize("Ofast")
#define _USE_MATH_DEFINES
#include "bits/stdc++.h"

using namespace std;

using u8 = uint8_t;
using u16 = uint16_t;
using u32 = uint32_t;
using u64 = uint64_t;
using i8 = int8_t;
using i16 = int16_t;
using i32 = int32_t;
using i64 = int64_t;

constexpr char newl = '\n';
constexpr double eps = 1e-10;

#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define F0R(i,b) FOR(i,0,b)
#define RFO(i,a,b) for (int i = ((b)-1); i >=(a); i--)
#define RF0(i,b) RFO(i,0,b)
#define fi first
#define se second
#define debug(x) cout << #x << ": " << x << '\n';
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()

template<typename T1, typename T2> inline void chmin(T1& a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1& a, T2 b) { if (a < b) a = b; }
template<class T> void Print(vector<T> v) {
  F0R(i, v.size()) {
    cout << v[i] << ' ';
  }
  cout << newl;
}

#if 1


// INSERT ABOVE HERE
signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N;
  cin >> N;
  vector<i64> ls(N);
  F0R(i, N) {
    cin >> ls[i];
  }
  int r = 0;
  F0R(i, N) {
    FOR(j, i + 1, N) {
      FOR(k, j + 1, N) {
        if (ls[i] != ls[j] && ls[i] != ls[k] && ls[j] != ls[k] && ls[i] < ls[j] + ls[k] && ls[j] < ls[i] + ls[k] && ls[k] < ls[i] + ls[j]) {
          //cout << (i + 1) << ',' << (j + 1) << ',' << (k + 1) << newl;
          r++;
        }
      }
    }
  }
  cout << r;
}
#endif


Measured memory_bytes: 3656
N=int(input())
import math
ans=0
for i in range(1,int(math.sqrt(N-1))+1):
  if (N-1)%i==0:
    ans+=2
    i+=1
  else:
    i+=1
ans-=1

if int(math.sqrt(N-1))==math.sqrt(N-1):
  ans-=1
for i in range(2,int(math.sqrt(N))+1):
  if N%i==0:
    temp=N
    while temp%i==0:
      temp=temp/i
    if temp%i==1:
      ans+=1
      i+=1
    else:
      i+=1
ans+=1
print(ans)
               

Measured memory_bytes: 9208
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n - 1; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i <= n; i++)
#define FORR(i, m, n) for(int i = m; i >= n; i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define VSORTR(v) sort(v.rbegin(), v.rend());
#define ALL(v) (v).begin(),(v).end()
 
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using P = pair<ll, ll>;

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

    ll x, a;
    cin >> x >> a;

    if(x < a) cout << 0 << endl;
    else cout << 10 << endl;
    return 0;
}

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

void solve(int TestCase) {
    constexpr int MOD = 998244353;
    int n, s;
    cin >> n >> s;
    auto A = vector<int>(n);
    for(auto& x : A)
        cin >> x;
    
    auto dp = vector<vector<long long>>(n, vector<long long>(3001));
    auto sum = vector<long long>(3001);
    for(auto i = 0; i < n; ++i)
    {
        dp[i][A[i]] = i+1;
        for(auto j = A[i] + 1; i && j < s+1; ++j)
        {
            dp[i][j] = sum[j - A[i]];
        }

        for(auto j = 0; j < s+1; ++j)
        {
            sum[j] = (sum[j] + dp[i][j]) % MOD;
        }
    }

    long long ret = 0;
    for(auto i = 0; i < n; ++i)
    {
        ret = (ret + dp[i][s] * (n - i) % MOD) % MOD;
    }

    cout << ret << endl;
}
 
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
 
    int t = 1;
    //cin >> t;
    for(auto i = 1; i <= t; ++i) {
    //    cout << "Case #"<< i << ": ";
        solve(i);
    }
}

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

vector<int> P;
int n;

void init() {
  for (int i = 0; i < n; i++)
    P[i] = i;
}
int root(int c) {
  if (P[c] == c)
    return c;
  return (P[c] = root(P[c]));
}
bool is_same_set(int a, int b) { 
  return root(a) == root(b); 
}
void unite(int a, int b) { 
  P[root(a)] = root(b);
}

int main() {
  int q;
  cin >> n >> q;
  P = vector<int>(n);
  init();
  for (int i = 0; i < q; i++) {
    int kind, x, y;
    cin >> kind >> x >> y;
    if (kind)
      cout << (is_same_set(x, y) ? 1 : 0) << endl;
    else
      unite(x, y);
  }
}



Measured memory_bytes: 3180
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <functional>
#include <bitset>
#include <numeric>
#include <cassert>
#include <random>
using namespace std;
using ll = long long;

int main() {
	ll n, x, d; cin >> n >> x >> d;
	if (d == 0) {
		if (x == 0) cout << 1 << endl;
		else cout << n + 1 << endl;
		return 0;
	}
	if (d < 0) {
		x = -x;
		d = -d;
	}
	map<ll, vector<pair<ll, ll>>> r;
	r[0].emplace_back(0, d);
	ll left = 0, right = 0;
	for (int i = 0; i < n; i++) {
		left += i;
		right += n - i - 1;
		r[(i + 1)*x % d].emplace_back((i + 1)*x + d*left, (i + 1)*x + d*(right + 1));
	}
	for (auto &p : r) {
		auto &v = p.second;
		sort(v.begin(), v.end(), [&](auto &a, auto &b) {
			return a.second < b.second;
		});
	}
	for (auto &p : r) {
		auto &v = p.second;
		for (int j = (int)v.size() - 2; j >= 0; j--) {
			if (v[j].second > v[j + 1].first) {
				v[j].second = v[j + 1].first;
				if (v[j].first > v[j].second) {
					v[j].first = v[j].second;
				}
			}
		}
	}
	ll ans = 0;
	for (auto &p : r) {
		auto &v = p.second;
		for (int j = 0; j < (int)v.size(); j++) {
			if (v[j].first >= v[j].second) continue;
			ans += (v[j].second - v[j].first) / d;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 22144
import java.lang.Math.*

fun main(args: Array<String>) {
    var (we,he,n) = readLine()!!.split(" ").map(String::toInt)
    var ws = 0
    var hs = 0
    for(i in 0 until n){
        var (w,h,v) = readLine()!!.split(" ").map(String::toInt)
        when(v){
            1 -> ws = max(ws,w)
            2 -> we = min(we,w)
            3 -> hs = max(hs,h)
            4 -> he = min(he,h)
        }
    }
    println(max((we - ws),0) * max((he - hs),0))
}

Measured memory_bytes: 37944
N, L = map(int, input().split())

aji_total = int(N * L + N * (N-1) / 2)
aji_min = L
aji_max = L + N - 1

ans = 0
if aji_min >= 0:
  ans = aji_total - aji_min
elif aji_max >= 0:
  ans = aji_total
else:
  ans = aji_total - aji_max

print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s, st;
	while(cin >> s){
		if(s=="-")
			break;
		int m, h;
		int len = s.size();
		cin >> m;
		for(int i=1; i<=m; i++){
			cin >> h;
			s = s.substr(h, len-h) + s.substr(0, h); // 后面 h~len-1的字符串拼接上前面0~h-1的字符串 
		}
		cout << s << endl;
	}
	return 0;
}


Measured memory_bytes: 3172
import java.util.*;

class Main {
        public static void main(String args[]) {
                try (Scanner sc = new Scanner(System.in)) {
                        String s1 = sc.next(), s2 = sc.next();
                        int[][] dp = new int[s1.length()+1][s2.length()+1];
                        for (int i = 0; i < s1.length() + 1; i++) {
                                for (int j = 0; j < s2.length() + 1; j++) {
                                        dp[i][j] = 1 << 20;
                                        if (i == 0) {
                                                dp[i][j] = j;
                                        }
                                        if (j == 0) {
                                                dp[i][j] = i;
                                        }
                                }
                        }
                        dp[0][0] = 0;
                        for (int i = 1; i < s1.length() + 1; i++) {
                                for (int j = 1; j < s2.length() + 1; j++) {
                                        if (s1.charAt(i-1) == s2.charAt(j-1)) {
                                                dp[i][j] = dp[i-1][j-1];
                                        } else {
                                                dp[i][j] = dp[i-1][j-1] + 1;
                                        }
                                        dp[i][j] = Math.min(dp[i][j],Math.min(dp[i-1][j], dp[i][j-1]) + 1);
                                }
                        }
                        System.out.println(dp[s1.length()][s2.length()]);
                }
        }
}

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

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(itr,v) for(auto &(itr):(v))
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<bool> vb;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m; assert(b>=0); for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a*b/gcd(a,b);}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;

// ━━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…
// .｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋.｡.:( ^ω^)・ﾟ＋
// ・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・‥…━━━☆・

int P, Q, a, n, res;
double d;

void rec(int l, int r, int p, int m, double s) {
	if (l==r) {
		res += (d-eps<s && s<d+eps);
		return;
	}
	repst(i,m,a) {
		if (p*i>a) break;
		if (s+1./i<d+eps) rec(l+1,r,p*i,i,s+1./i);
	}
}

signed main() {
	while (1) {
		cin >> P >> Q >> a >> n;
		if (P==0) break;
		res = 0, d = 1.*P/Q;
		repst(r,1,n) rec(0,r,1,1,0);
		cout << res << ln;
	}
}


Measured memory_bytes: 3040
//↓template↓

#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
#define all(n)  n.begin(),n.end()
#define rall(n) n.rbegin(),n.rend()
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const double pi = acos(-1);
const ll SIZE = 1 << 17;
int dx[] = { 1,0,-1,0 }, dy[] = { 0,1,0,-1 }, alp[30];
ll fac[200005], finv[200005], inv[200005];
vector<ll>dij;
struct edge { ll to, cost; };
vector<vector<edge> >G;

ll mod_pow(ll a, ll b) {
	ll res = 1, mul = a;
	for (int i = 0; i < 31; ++i) {
		if (b >> i & 1) {
			res *= mul;
			res %= MOD;
		}
		mul = (mul * mul) % MOD;
	}

	return res;
}

void addedge(int from, int to, int cost) {
	G[from].push_back({ to,cost });
	G[to].push_back({ from,cost });
}


template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }

template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}

template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T &t, const V &v) { t = v; }

template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T &t, const V &v) {
	for (auto &e : t) fill_v(e, v);
}

//↑template↑




int a, b, u[2005][2005], d[2005][2005], r[2005][2005], l[2005][2005], lamp[2005][2005], ans;
char k[2005][2005];
int main() {

	cin >> a >> b;
	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			cin >> k[i][j];
			if (k[i][j] != '#') {
				if (i == 0) { u[i][j] = 1; }
				if (i == a - 1) { d[i][j] = 1; }
				if (j == 0) { l[i][j] = 1; }
				if (j == b - 1) { r[i][j] = 1; }
			}
		}
	}


	for (int i = 0; i < a; ++i) {
		for (int j = 0; j < b; ++j) {
			if (k[i][j] != '#') {
				if (i != 0) { u[i][j] = u[i - 1][j] + 1; }
				if (j != 0) { l[i][j] = l[i][j - 1] + 1; }
			}
		}
	}

	for (int i = a - 1; i >= 0; --i) {
		for (int j = b - 1; j >= 0; --j) {
			if (k[i][j] != '#') {
				if (i != a - 1) { d[i][j] = d[i + 1][j] + 1; }
				if (j != b - 1) { r[i][j] = r[i][j + 1] + 1; }
			}
		}
	}

	for (int i = 0; i < a; ++i) { for (int j = 0; j < b; ++j) { ans = max(ans, u[i][j] + d[i][j] + l[i][j] + r[i][j] - 3); } }
	cout << ans << endl;

}

Measured memory_bytes: 69888
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(int i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

ll n, k, a[200010];

int main(){
    cin.tie(0); ios::sync_with_stdio(false);
    
    cin >> n >> k;
    zep(i, 0, n)cin >> a[i];
    
	if(n == k){
		ll ans = 1;
		zep(i, 0, n){
			ans *= (MOD + a[i]) % MOD; ans %= MOD;
		} 
		print(ans) return 0;
	}

    vector<ll> u, v;
    zep(i, 0, n){
    	if(a[i] > 0){
    		u.push_back(a[i]);
    	}else{
    		v.push_back(-a[i]);
    	}
    }
    
    sort(u.begin(), u.end());
    sort(v.begin(), v.end());
    
	if(k % 2 == 1 && v.size() == n){
		ll ans = 1;
		zep(i, 0, k){
			ans *= MOD - v[i]; ans %= MOD;
		}
		print(ans) return 0;
	}

	ll ans = 1;
	for(ll i = 0; i < k; i++){
		ll U = u.size(), V = v.size();

		if(i == k - 1){
			ans *= u.back(); ans %= MOD; u.pop_back();
			continue;
		}

		if(U < 2 || (V >= 2 && u[U - 1] * u[U - 2] < v[V - 1] * v[V - 2])){
			ans *= ((MOD - v[V - 1]) % MOD * (MOD - v[V - 2]) % MOD) % MOD; ans %= MOD;
			v.pop_back(); v.pop_back();
			i++;
			continue;
		}

		ans *= u.back(); ans %= MOD; u.pop_back();
	}
	
	print(ans)

    return 0;
}


Measured memory_bytes: 6888
parseInt(x) = parse(Int, x)
parseBigInt(x) = parse(BigInt, x)
parseFloat(x) = parse(Float64, x)
parseBigFloat(x) = parse(BigFloat, x)
parseMap(x::Array{SubString{String},1}) = map(parseInt, x)

function main()
    n=parseInt(readline())
    ans=0
    a,b=0,0
    double=0
    for i in 1:n
        s=chomp(readline())
        for j in 1:length(s)-1
            if s[j:j+1]=="AB"
                ans+=1
            end
        end
        if s[end]=='A' && s[1]=='B'
            double+=1
        elseif s[end]=='A'
            a+=1
        elseif s[1]=='B'
            b+=1
        end
    end
    if double>0 && a+b==0
        ans+=double-1
    else
        ans+=double+min(a,b)
    end
    println(ans)
end
main()

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

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

  if ((a + b) / 2 * 2 == (a + b)) {
    cout << (a + b) / 2 << endl;
  } else {
    cout << (a + b) / 2 + 1 << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
static const int MAX = 10000;
static const int INFTY = (1<<20);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n;
vector<pair<int,int> > adj[MAX];

void dijkstra(){
  priority_queue<pair<int,int> > PQ;
  int color[MAX];
  int d[MAX];
  for(int i=0;i<n;i++){
    d[i] = INFTY;
    color[i] = WHITE;
  }

  d[0] = 0;
  PQ.push(make_pair(0,0));
  color[0] = GRAY;

  while(!PQ.empty()){
    pair<int,int> f = PQ.top(); PQ.pop();
    int u = f.second;
    color[u] = BLACK;

    if(d[u] < f.first *(-1)) continue;

    for(int j=0;j<adj[u].size();j++){
      int v = adj[u][j].first;
      if(color[v] == BLACK) continue;
      if(d[v] > d[u] + adj[u][j].second){
	d[v] = d[u] + adj[u][j].second;
	PQ.push(make_pair(d[v]*(-1),v));
	color[v] = GRAY;
      }
    }
  }

  for(int i=0;i<n;i++){
    cout << i << " " << (d[i] == INFTY ? -1 : d[i]) << endl;
  }
}

int main(){
  int k,u,v,c;

  cin >> n;
  for(int i=0;i<n;i++){
    cin >> u >> k;
    for(int j=0;j<k;j++){
      cin >> v >> c;
      adj[u].push_back(make_pair(v,c));
    }
  }

  dijkstra();

  return 0;
}



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

class Main {
  public static void main(String[] args) {
    var scanner = new Scanner(System.in);
    var N = scanner.nextInt();
    var M = scanner.nextInt();
    var height = new int[N+1];
    var good = new int[N+1];
    Arrays.fill(good, 1);
    good[0] = 0;
    for(int i = 1; i <= N; i++) {
      height[i] = scanner.nextInt();
    }
    for(int i = 1; i <= M; i++) {
      var v = scanner.nextInt();
      var w = scanner.nextInt();
      if(height[v] <= height[w]) good[v] = 0;
      if(height[w] <= height[v]) good[w] = 0;
    }
    var target = Arrays.stream(good).sum();
	System.out.println(target);
  }
}


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

int main() {
    int n;
    cin >> n;
    long long x = n/500, res = 0;
    n %= 500;
    res = (x*1000);
    x = n/5;
    n %= 5;
    res += (x*5);
    cout << res << "\n";
    return 0;    
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
using namespace std;
using ll = long long;
using vll = vector<ll>;

double snk(ll n) {
	ll nn = n;
	ll s = 0;
	while (nn > 0) {
		s += nn % 10;
		nn /= 10;
	}
	return double(n) / s;
}

ll nextdig(ll n) {
	ll nn = n;
	ll s = 1;
	while (nn > 0) {
		s *= 10;
		nn /= 10;
	}
	return s;
}

bool clear(ll n, ll d) {
	ll nn = n;
	double snkn = snk(n);
	ll lim = nextdig(n);
	bool b(true);
	while (nn < lim) {
		nn += d;
		if (snk(nn) < snkn) {
			b = false;
			break;
		}
	}
	return b;
}

int main() {
	int K;
	cin >> K;
	vll v(1, 1);
	ll a = 1;
	ll d = 1;
	while (v.size() < K) {
		ll n = 1;
		while (1) {
			ll aa = a + n * d;
			if (clear(aa, d)) {
				v.emplace_back(aa);
				a = aa;
				d = n * d;
				break;
			}
			++n;
		}
	}
	for (int i(0); i < v.size(); ++i) {
		cout << v[i] << "\n";
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod=1000000007;
ll r1,r2,c1,c2;
ll n;
ll fac[2000005],inv[2000005];
inline void read(ll &x)
{
	ll f;char c;
	for (f=1,c=getchar();c<'0'||c>'9';c=getchar()) if(c=='-') f=-1;
	for (x=0;c<='9'&&c>='0';c=getchar()) x=x*10+(c&15);x*=f;
}
inline ll mx(ll _x,ll _y)
{
	return _x>_y?_x:_y;
}
inline ll qpow(ll a,ll b)
{
	ll rest=1;
	while(b)
	{
		if(b&1) rest=(rest*a)%mod;
		b>>=1;
		a=(a*a)%mod;
	}
	return rest;
}
inline ll C(ll n,ll m)
{
	return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
inline ll xigema(ll n,ll m){
	ll rest=0;
	for(ll i=1;i<=m;i++) rest=(rest+C(n+i+1,i+1))%mod;
	return ((rest-m)%mod+mod)%mod;
}
int main()
{
	read(r1);read(c1);read(r2);read(c2);
	n=mx(r2,c2)*2+1;
	fac[0]=1;
	for(ll i=1;i<=n;i++) 
		fac[i]=fac[i-1]*i%mod;
	inv[n]=qpow(fac[n],mod-2);
	for(ll i=n-1;i>=0;i--) 
		inv[i]=inv[i+1]*(i+1)%mod;
	printf("%lld\n",((xigema(r2,c2)-xigema(r1-1,c2)-xigema(r2,c1-1)+xigema(r1-1,c1-1))%mod+mod)%mod);
	return 0;
}


Measured memory_bytes: 31488
import java.util.*;
public class Main
{
	public static void main(String [] args)
	{
		Scanner sc= new Scanner(System.in);
		int N = sc.nextInt();
		int dp[]=new int[3];
		int [] cost = new int [3];
		for(int i=0;i<N;i++)
		{
		int new_dp [] =new int[3];
			for(int j=0;j<3;j++)
			{
				cost[j]=sc.nextInt();
			}
			
			
			
			for(int j=0;j<3;j++)
			{
			
				for(int k=0;k<3;k++)
				{
					if(j!=k)
					{
						new_dp[k]=Math.max(new_dp[k],cost[k]+dp[j]);
					}
				}
			}
			
			dp=new_dp;
			
			
		}
		
		System.out.println(Math.max(dp[2],Math.max(dp[0],dp[1])));
	}
}

Measured memory_bytes: 59832
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <numeric>
#include <array>
#include <cmath>
#include <memory>
using namespace std;
#define DEB(variable) cout << #variable << '=' << variable << endl

#define FOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin); (LoopVariable) < (numberOFend); (LoopVariable)++)
#define DEFOR(LoopVariable,numberOFbegin,numberOFend) for (long long int LoopVariable = (numberOFbegin)-1; (LoopVariable) >= (numberOFend); (LoopVariable)--)
#define REP(LoopVariable,numberOFend) for(long long int LoopVariable = 0;(LoopVariable)<(numberOFend);LoopVariable++)

using llint = long long int;

constexpr long long int linf = numeric_limits<long long int>::max()-5;
constexpr long long int inf= numeric_limits<int>::max()-5;
constexpr long long int mod = 1000000007;

int main(){

    
    llint a,b,c;
    cin >> a >> b >> c;
    cout<<c<<" "<<a<<" "<<b<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <limits>
#include <unordered_map>
#include <map>
#define REP(i,n) for(long (i)=0;(i)<(n);(i)++)
#define REPI(i,a,b) for(long (i)=(a);(i)<(b);(i)++)
#define INF numeric_limits<double>::infinity()
constexpr long MOD = 1e9 + 7;
using namespace std;
using P = pair<long, long>;
using VI = vector<long>;

char hoge[150];

int main() {
    string s;
    cin >> s;
    
    REP(i,s.size()) {
        hoge[s[i]] = 1;
    }
    
    if (s.size() != 26) {
        int m = -1;
        for (char c = 'a'; c <= 'z'; c++) {
            if (!hoge[c]) {
                m = c;
                break;
            }
        }
        cout << s << char(m) << endl;
        return 0;
    }
    
    if (s == "zyxwvutsrqponmlkjihgfedcba") {
        cout << -1 << endl;
        return 0;
    }
    
    vector<char> v;
    REP(i,s.size()) {
        v.push_back(s[i]);
    }
    next_permutation(v.begin(), v.end());
    int i = 0;
    while (v[i] == s[i]) {
        cout << s[i];
        i++;
    }
    cout << v[i] << endl;
}



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

using namespace std;
typedef long long ll;
typedef pair< int , int > P;
typedef tuple<int, int, int> T;
    
int main(){
    vector<int> x(5);

    rep(i,5){
        cin>>x[i];
        if(x[i]==0){
            cout<<i+1;
        }
    }
}

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


int main() {
    int H,W;
    cin >> H >> W;
    vector<vector<char>> V(H+2,vector<char>(W+2));
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            cin >> V.at(i).at(j);
        }
    }

    int cnt=0;
    for(int i=1;i<=H;i++){
        for(int j=1;j<=W;j++){
            if(V.at(i).at(j)=='#' && V.at(i-1).at(j)!='#' && V.at(i+1).at(j)!='#' && V.at(i).at(j-1)!='#' && V.at(i).at(j+1)!='#'){
                cnt++;
                break;
            }
        }    
    }
    if(cnt) cout << "No" << endl;
    else cout << "Yes" << endl;
}

Measured memory_bytes: 256
#include<iostream>

typedef unsigned long long ULL;
using namespace std;

int main(){
    ULL L,R;
    ULL i,j;
    ULL min = 0;
    ULL LOOP_POINT = 2020*2;

    min = 2020 * 2;
    cin >> L >> R;
    for(i=0; i<LOOP_POINT && L + i < R ;i++){
        for(j=i+1; j < LOOP_POINT && L + j <= R; j++){
            if( min > ((i+L) % 2019) * ((j+L) % 2019) % 2019){
                min =((i+L) % 2019) * ((j+L) % 2019) % 2019;
            }
            if( min == 0 ){
                break;
            }
        }
    }
    cout << min << endl;
}


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

int main() {
    int a,b,c,d;cin>>a>>b>>c>>d;
    int ans;
    while(a>0||c>0){
        c-=b;
        if(c<=0){
            ans=0;
            break;
        }
        a-=d;
        if(a<=0){
            ans=1;
            break;
        }
    }
    if(ans==1)cout<<"No"<<endl;
    else cout<<"Yes"<<endl;

	return 0;
}

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

int main() {
  int a, b, c, k;
  cin >> a >> b >> c >> k;
  int ans;
  if(k < a) {
    ans = k;
  } else if(k <= a+b) {
    ans = a;
  } else {
    ans = a - (k-a-b);
  }
  cout << ans << endl;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 2e5 + 5;
const int INF = 0x3f3f3f3f;
template <class T>
bool gmax(T &a, T b) { return a < b ? a = b, 1 : 0; }
template <class T>
bool gmin(T &a, T b) { return a > b ? a = b, 1 : 0; }
int nxt[MAX];
int dp[MAX];
int path[MAX];
int to[MAX];
char str[MAX];
int main() {
    while (~scanf("%s", str))
    {
        int len = strlen(str);
        for (int j = 0; j < 26; j++)
            nxt[j] = len;
        for (int i = 0; i <= len; i++)
            dp[i] = INF;
        dp[len + 1] = 0;
        for (int i = len - 1; i >= 0; i--)
        {
            nxt[str[i] - 'a'] = i;
            for (int j = 0; j < 26; j++)
            {
                if (gmin(dp[i], dp[nxt[j] + 1] + 1))
                {
                    path[i] = j;
                    to[i] = nxt[j] + 1;
                }
            }
        }
        int i = 0;
        while (i < len)
        {
            printf("%c", path[i] + 'a');
            i = to[i];
        }
        putchar('\n');
    }
    return 0;
}


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

int main(){
    int h, w, k;
    cin>>h>>w>>k;
    string c[h];
    rep(i, h){
        cin>>c[i];
    }

    deque<int> qh;
    deque<int> qw;

    rep(i, h) qh.push_back(0);
    int ans=0;
    int numh=0, numw=0;
    while(!(qh.empty())){
        if(numh!=0){
            qh.pop_back();
            qh.push_back(1);
        }
        numh++;

        for(int i=qh.size(); i<h; i++) qh.push_back(0);
        rep(i, w) qw.push_back(0);
        numw=0;
        while(!(qw.empty())){
            int sum=0;
            if(numw!=0){
                qw.pop_back();
                qw.push_back(1);
            }
            numw++;

            for(int i=qw.size(); i<w; i++) qw.push_back(0);
            rep(i, h)rep(j, w){
                if(c[i][j]=='#'){
                    if(qh[i]!=1 && qw[j]!=1) sum++;
                } 
            }
            // rep(i, qw.size()) cout<<qw[i]<<" ";
            // cout<<"qw"<<endl;
            while(qw.back()==1){
                qw.pop_back();
                if(qw.empty()) break;
            }
            if(sum==k) ans++;
        }

        // rep(i, qh.size()) cout<<qh[i]<<" ";
        // cout<<"qh"<<endl;
        while(qh.back()==1){
            qh.pop_back();
            if(qh.empty()) break;
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3628