akhauriyash/Code-Regression huggingface dataset:
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip> // setprecision
#include <complex> // complex
#include <math.h> 
#include <climits> 
#include <assert.h>
#include <random>
#define rep(i,n) for(int i=0; i<(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;
constexpr ll INF = 1e18;
constexpr int inf = 1e9;
constexpr ll mod = 1'000'000'007;
constexpr ll mod2 = 998244353;
const double PI = 3.1415926535897932384626433832795028841971;
const int dx[8] = {1, 0, -1, 0,1,1,-1,-1};
const int dy[8] = {0, 1, 0, -1,1,-1,1,-1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
// ---------------------------------------------------------------------------



int main(){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int L,R,D;
  cin >> L >> R >> D;
  int cnt = 0;
  for(int i=L; i<=R; i++){
    if(i%D == 0) cnt++;
  }
  cout << cnt << "\n";
  return 0;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
int main()
{
  ll n, ans = 0;
  cin >> n;
  vector<pair<ll, ll>> a;
  for (ll i = 2; i * i <= n; i++)
  {
    if (n % i != 0)
      continue;
    ll e = 0;
    while (n % i == 0)
    {
      e++;
      n /= i;
    }
    a.push_back({i, e});
  }
  if (n != 1)
    a.push_back({n, 1});
  for (auto p : a)
  {
    for (int i = 1;; i++)
    {
      if (p.second >= i * (i + 1) / 2)
        ans++;
      else
        break;
    }
  }
  cout << ans;
}


Measured memory_bytes: 3628
import sys, math
input = sys.stdin.readline
rs = lambda: input().strip()
ri = lambda: int(input())
rl = lambda: list(map(int, input().split()))
mod = 10**9 + 7

a = rs()

if 'a' <= a <= 'z':
	print('a')
else:
	print('A')
	

Measured memory_bytes: 61900
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>

using namespace std;

int main() {

    int n;
    cin >> n;

    int sz = n%10;

    if (sz == 2 or sz== 4 or sz == 5 or sz == 7 or sz==9 ) cout << "hon" << endl;
    else if( sz==0 or sz == 1 or sz == 6 or sz ==8) cout << "pon" << endl;
    else cout << "bon" << endl;

    return 0;
}


Measured memory_bytes: 3600
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;
using vec=vector<ll>;
using mat=vector<vec>;
using pvec=vector<datas>;
using pmat=vector<pvec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)

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

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

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

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

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

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

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

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,N,k,a,b,ba,bb;
  cin>>N;
  cin>>ba>>bb;
  rep1(i,N){
    cin>>a>>b;
    k=max((a+ba-1)/a,(b+bb-1)/b);
    ba=k*a;
    bb=k*b;
  }
  cout<<ba+bb<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define il inline
#define vd void
typedef long long ll;
il ll gi(){
	ll x=0,f=1;
	char ch=getchar();
	while(!isdigit(ch)){
		if(ch=='-')f=-1;
		ch=getchar();
	}
	while(isdigit(ch))x=x*10+ch-'0',ch=getchar();
	return x*f;
}
int main(){
#ifdef XZZSB
	freopen("in.in","r",stdin);
	freopen("out.out","w",stdout);
#endif
	int n=gi(),m=gi(),k=gi();
	for(int i=1;i<=n;++i){
		for(int j=1;j<=m;++j){
			if((((i-j+m)/k)&1)==0&&(((i+j)/k)&1)==0)putchar('R');
			if((((i-j+m)/k)&1)==0&&(((i+j)/k)&1)==1)putchar('Y');
			if((((i-j+m)/k)&1)==1&&(((i+j)/k)&1)==0)putchar('G');
			if((((i-j+m)/k)&1)==1&&(((i+j)/k)&1)==1)putchar('B');
		}
		puts("");
	}
	return 0;
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define REP(i,n) for(int i = 1; i < n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vb = vector<bool>;
using vc = vector<char>;
using vcc = vector<vc>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



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

  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int T = ceil(c,b);
  int A = ceil(a,d);
  YesorNo(T <= A);
}

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

static const int N = 1000;

int lcs(string X, string Y) {
	int c[N + 1][N + 1];
	int m = X.size();
	int n = Y.size();
	int maxl = 0;
	X = ' ' + X;
	Y = ' ' + Y;
	for (int i = 0; i <= m; ++i) c[i][0] = 0;
	for (int j = 1; j <= n; ++j) c[0][j] = 0;

	for (int i = 1; i <= m; ++i) {
		for (int j = 1; j <= n; ++j) {
			if (X[i] == Y[j]) {
				c[i][j] = c[i - 1][j - 1] + 1;
			}
			else {
				c[i][j] = max(c[i - 1][j], c[i][j - 1]);
			}
			maxl = max(maxl, c[i][j]);
		}
	}
	return maxl;
}

int main() {
	string s1, s2;
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		cin >> s1 >> s2;
		cout << lcs(s1, s2) << endl;
	}
}


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

vector<int> forintinput(int n) {
	vector<int> x;
	for(int i = 0;i < n;i++){
		int ia;
		cin >> ia;
		x.push_back(ia);
	}
	return x;
}
int main(){
	ll n;
	cin >> n;
	int ans = 0;
	for(int i = 1;i < n;i++){
		if(double(n) / double(i) >= 1){
			ans += (n-1) / i;
		}
	}
	cout << ans << endl;
}

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

int main()
{
	long long x;
    cin >> x;
    
    int u=0,v=0;
    for(long long i = -1000000 ;i<=1000000;i++)
    {
        long long b = pow(i,5);
        long long a = (pow(x + b , 0.2));
        
        if(pow(a,5) - b == x )
        {
            u = a , v = i;
            break;
        }
    }
    
    cout << u << " " << v << endl;
	return 0;
}

Measured memory_bytes: 4232
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define lb lower_bound
#define ub upper_bound
#define endl '\n'
#define mod 1000000007
#define tol(s) transform(s.begin(),s.end(),s.begin(),::tolower)
#define tou(s) transform(s.begin(),s.end(),s.begin(),::toupper)
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define all(x) (x).begin(), (x).end()
void make_unique(vector<ll> vec)
{
sort(all(vec));
vec.resize(unique(all(vec)) - vec.begin());
}
bool isPrime(long long n)
{
 
    if (n <= 1)
        return false;
 
 
    for (long long i = 2; i <= sqrt(n); i++)
        if (n % i == 0)
            return false;
 
    return true;
}

int main() 
{   ios;
    int t=1;
    //cin>>t;
    //cin.ignore(numeric_limits<streamsize>::max(),'\n');
    while(t--)
    {ll pos,sum=0,ans=0,x,y,z,k,h,c,n,t,m,i,j,flag=0,count=0,moves=0;
     string s;
     cin>>s;
      for(i=0;i<s.length();i++)
      {
          sum+=s[i]-'0';
      }
      if(sum%9==0)
      cout<<"Yes"<<endl;
      else
      cout<<"No"<<endl;
    
    }
	return 0;
}


Measured memory_bytes: 3800
#include <bits/stdc++.h>
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define REP(i, n) for(int i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(int i = s, i##_l = (e); i < i##_l; i++)
#define LLI long long int
#define _min(a, b) ((a < b) ? a : b)
#define _max(a, b) ((a < b) ? b : a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a) ? 1 : -1)
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380

std::vector<bool> IsPrime;

void sieve(size_t max) {
    if(max + 1 > IsPrime.size()) {      // resizeで要素数が減らないように
        IsPrime.resize(max + 1, true);  // IsPrimeに必要な要素数を確保
    }
    IsPrime[0] = false;  // 0は素数ではない
    IsPrime[1] = false;  // 1は素数ではない

    for(size_t i = 2; i * i <= max; ++i)          // 0からsqrt(max)まで調べる
        if(IsPrime[i])                            // iが素数ならば
            for(size_t j = 2; i * j <= max; ++j)  // (max以下の)iの倍数は
                IsPrime[i * j] = false;           // 素数ではない
}
int main() {
    cout << fixed << setprecision(10);
    int x;
    cin >> x;
    sieve(1000000);

    while(true) {
        if(IsPrime[x]) {
            cout << x;
            return 0;
        }
        x++;
    }
    return 0;
}


Measured memory_bytes: 384
import java.util.*;

class Main {
  public static void main(String args[]) {
    Scanner sc = new Scanner(System.in);
    int n;
    int x;
    String[] s;
    Integer[] numbers;
    int sum;
    int numAnswers = 0;
    while (true) {
      s = sc.nextLine().split(" ");
      n = Integer.parseInt(s[0]); 
      x = Integer.parseInt(s[1]); 
      if (n == 0 && x == 0) {
        break;
      }
      numbers = new Integer[n];
      for (int i = 0; i < n; i++) {
        numbers[i] = i + 1;
      }
      Combinations<Integer> combinations = new Combinations<Integer>(numbers, 3);
      Iterator<List<Integer>> iterator = combinations.iterator();
      while(iterator.hasNext()) {
        List<Integer> p = iterator.next();
        sum = p.get(0) + p.get(1) + p.get(2);
        if (sum == x) {
          numAnswers++;
        }
      }
      System.out.println(numAnswers);
      numAnswers = 0;
    }
  }
}

class Combinations<T> implements Iterator{

  private List<List<T>> combinations;
  private List<T> list;
  private int[] index;
  private boolean[] visited;
  private int r;
  private Iterator<List<T>> iterator;

  public Combinations(T[] array, int r){
    this.list = Arrays.asList(array);
    this.index = new int[r];
    this.visited = new boolean[array.length];
    this.combinations = new ArrayList<List<T>>();
    this.r = r;
    this.compute(0);
    this.iterator = this.combinations.iterator();
  }

  private void compute(int n){
    if(n == r){
      List<T> combination = new ArrayList<T>();
      for(int i = 0;i < this.index.length;i++){
        combination.add(list.get(index[i]));
      }
      combinations.add(combination);
    }
    else{
      for(int i = 0;i < this.list.size();i++){
        if(n == 0 || !this.visited[i] && index[n - 1] < i){
          this.visited[i] = true;
          this.index[n] = i;
          this.compute(n + 1);
          this.visited[i] = false;
        }
      }
    }
  }

  public List<List<T>> getCombinations(){
    return this.combinations;
  }

  public int count(){
    return this.combinations.size();
  }

  public List<T> next(){
    return this.iterator.next();
  }

  public boolean hasNext(){
    return this.iterator.hasNext();
  }

  public Iterator<List<T>> iterator(){
    return this.iterator;
  }

  public void remove(){
  }
}

Measured memory_bytes: 108720
import java.util.*;
import java.math.*;

class Main{
  public static void main(String args[]){
    Scanner sc = new Scanner(System.in);
    BigInteger a = sc.nextBigInteger();
    BigInteger b = sc.nextBigInteger();
    int c = a.compareTo(b);
    if(c<0){
      System.out.println("LESS");
    }else if(c==0){
      System.out.println("EQUAL");
    }else{
      System.out.println("GREATER");
    }
  }
}

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

using namespace std;
using p=pair<int,int>;
typedef long long ll;

int main() {
  int a;
  cin >>a;
  int k;
  k=a+a*a+a*a*a;
  cout << k << endl;

  return 0;

}



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

int main(){
	int n;
	cin >> n;

	int array[n];
		
	for(int i = 0; i < n; ++i)
		cin >> array[i];

	int flag, oflag;
	int num = 1;

	if(n != 1 && num != 2){
		if(array[0] - array[1] == 0){
			oflag = 0;
		}else if(array[0] - array[1] > 0){
			oflag = -1;
		}else{
			oflag = 1;
		}

		for(int i = 0; i < n - 1; ++i){
			if(array[i] - array[i + 1] == 0){
				flag = 0;
			}else if(array[i] - array[i + 1] > 0){
				flag = -1;
			}else{
				flag = 1;
			}

			if(abs(flag - oflag) == 2){
				++num;
				if(array[i + 1] - array[i + 2] == 0){
					oflag = 0;
				}else if(array[i + 1] - array[i + 2] > 0){
					oflag = -1;
				}else{
					oflag = 1;
				}
			}else if(flag != 0){
				oflag = flag;
			}
		}
	}
		
	cout << num << "\n";

	return 0;
}

Measured memory_bytes: 640
#include<stdio.h>
#define Max 10000

int main(){
  int i, j, num[Max];
  for(i=0;i<Max;i++){
    scanf("%d",&num[i]);
    if(num[i]==0) break;
  }

  for(j=0;j<i;j++) printf("Case %d: %-d\n",j+1,num[j]);
  
  return 0;
}



Measured memory_bytes: 2044
#include <iostream>
using namespace std;
typedef long long LL;
const int N = 10000 + 10;
int n;
LL a[N], b[N], s1 = 0, s2 = 0;
int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i ++)
        scanf("%lld", &a[i]), s1 += a[i];
    for (int i = 1; i <= n; i ++)
        scanf("%lld", &b[i]), s2 += b[i];

    LL c1 = 0, c2 = 0;
    for (int i = 1; i <= n; i ++) {
        if (a[i] > b[i]) {
            c2 += a[i] - b[i];
        } else {
            LL d = b[i] - a[i];
            if (d%2 == 0) c1 += d/2;
            else c1 += (d+1)/2, c2 ++;
        }
    }
    printf("%s\n", c1 >= c2 ? "Yes" : "No");
}

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

int main(){
  int N;
  cin>>N;
  long long int A[N];
  int count = 0;
  long long int m=1000000000;
  long long int S=0;
  for(int i=0;i<N;i++){
    cin>>A[i];
    if(A[i]<0){
      count++;
    }
    m = min(m,abs(A[i]));
    S += abs(A[i]);
  }
  if(count%2 == 0){
    cout << S << endl;
  }
  else{
    cout << S-2*m << endl;
  }
}
  

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

const int nm = 1e5;
int n, a[nm], l[nm + 2] = { (int) 1e9 + 1 };

int main() {
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	fill(l + 1, l + n + 1, -1);
	for (int i = 0; i < n; ++i) {
		int inf = 0, sup = n;
		while (sup - inf > 1) {
			int mid = (inf + sup) / 2;
			if (l[mid] >= a[i])
				inf = mid;
			else
				sup = mid;
		}
		l[inf + 1] = a[i];
	}

	for (int i = n; i >= 0; --i)
		if (l[i] >= 0) {
			cout << i << endl;
			return 0;
		}
}


Measured memory_bytes: 4400
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include <vector>
#include <list>
#include <string>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <climits>
#include <map>
#include <math.h>
#include <queue>
#include <stack>
#include <set>
using namespace std;

int main() {
	string str = "CODEFESTIVAL2016";
	string s;
	cin >> s;
	int c = 0;
	for (int i = 0; i < 16; i++)
	{
		if (s[i] != str[i]) { c++; }
	}
	cout << c << endl;
	return 0;
}



Measured memory_bytes: 256
#include <complex>
#include <cstdio>
#include <iostream>
#include <vector>
#define X real()
#define Y imag()
#define EPS 1e-10
using namespace std;
typedef complex<double> P;
typedef pair<P,P> L;
typedef vector<P> Poly;

double cross(P a, P b){
  return a.X*b.Y - a.Y*b.X;
}

double area(Poly p){
  int n = p.size();
  double s = 0;
  for(int i = 1; i < n-1; ++i){
    s += cross(p[i]-p[0],p[i+1]-p[0])/2;
  }
  return s;
}

int main(){
  int n;
  cin >> n;
  double x, y;
  Poly p(n);
  for(int i = 0; i < n; ++i){
    cin >> x >> y;
    p[i] = P(x,y);
  }
  printf("%.1lf\n", area(p));
}

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

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;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 INF 999999999
#define M_PI 3.14159265358979323846
#define ALL(X) (X).begin(),(X).end()

#ifdef __LOCAL
    #define DBG(X) cout << #X << " = " << (X) << endl;
    #define SAY(X) cout << (X) << endl;
#else
    #define DBG(X)
    #define SAY(X)
#endif

#ifdef __LOCAL
    #include <filesystem>
    namespace fs = std::filesystem;
#endif

using namespace std;

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

int dx[]={1, 0, -1, 0, 0};
int dy[]={0, 1, 0, -1, 0};
const int INT_INF = (int)(2e9);
const ll  LL_INF = (ll)(2e18);
const int NIL = -1;
static mt19937 _g(time(nullptr));
 
std::string pad(int num){ char buffer[4]; std::snprintf(buffer, sizeof(buffer), "%03d", num); return buffer;}
inline ll randint(ll a, ll b) { ll w = (_g() << 31LL) ^ _g(); return a + w % (b - a + 1); }
inline void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); };
template<typename T> inline T sign(T x) { return T(x > 0) - T(x < 0); }
template<typename T, typename S> inline ostream& operator<<(ostream& os, const pair<T, S> p) { cout << "[" << p.first << ";" << p.second << "]"; return os; }
template<typename T> inline ostream& operator<<(ostream& os, const vector<T>& v) { for (auto el : v) cout << el << " "; return os; }
template<typename T> inline T fetch() { T ret; cin >> ret; return ret; }
template<typename T> inline vector<T> fetch_vec(int sz) { vector<T> ret(sz); for (auto& elem : ret) cin >> elem; return ret; }

int N;
vector<int> L;

int input(){
    fast_io();
    #ifdef __LOCAL
        fs::path p = __FILE__;
        fs::path input,output;
        input = output = p.parent_path();
        input += string("/input/") + string(p.stem()) + string(".txt");
        output += string("/output/") + string(p.stem()) + string(".txt");
        freopen(input.c_str(), "r", stdin);
        freopen(output.c_str(), "w", stdout);
    #endif
    cin >> N;
    L = fetch_vec<int>(N);
    return 0;
}

int solve(){
    input();
    int ML = *max_element(ALL(L));
    int SL = accumulate(ALL(L),0) - ML;
    if(SL>ML) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;    
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from itertools import accumulate #list(accumulate(A))
from collections import deque

N, K = mi()
D = li()

r = [i for i in range(10) if i not in D]

if r[0]==0:
    que = deque(r[1:])
else:
    que = deque(r)

i = 0
while True:
    for num in r:
        new = que[i]*10 + num
        que.append(new)
    if que[-1] >= 10**6:
        break
    i += 1

ind = bisect.bisect_left(que, N)
#print(que)
#print(ind)
print(que[ind])

Measured memory_bytes: 51804
#include <algorithm>
#include <cmath>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <utility>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define loop(i, x, n) for (int i = (x); i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define int long long
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1e18;
template<typename T> void cmax(T &a, T b) { a = max(a, b); }
template<typename T> void cmin(T &a, T b) { a = min(a, b); }

signed main() {
  int n;
  cin >> n;
  vector<int> dp(100005, INF);
  dp[0] = 0;
  vector<int> six, nine;
  int tmp = 6;
  while (tmp <= 100000) six.push_back(tmp), tmp *= 6;
  tmp = 9;
  while (tmp <= 100000) nine.push_back(tmp), tmp *= 9;

  rep(i, 100001) {
    cmin(dp[i + 1], dp[i] + 1);
    rep(j, six.size()) if (i + six[j] <= 100000) cmin(dp[i + six[j]], dp[i] + 1);
    rep(j, nine.size()) if (i + nine[j] <= 100000) cmin(dp[i + nine[j]], dp[i] + 1);
  }
  cout << dp[n] << endl;
  return 0;
}


Measured memory_bytes: 1024
n, m = map(int, input().split())
x = list(map(int, input().split()))

if n >= m:
    print(0)
    exit()

diff = m - n
dist_list = []
x.sort()
for i in range(len(x) - 1):
    distance = x[i+1] - x[i]
    dist_list.append(distance)

dist_list.sort()
ans = sum(dist_list[0:diff])

print(ans)


Measured memory_bytes: 13960
import sys
input = sys.stdin.readline
from math import sqrt

def main():
	n, D = map(int, input().strip().split())
	s = [[] for _ in range(n)]
	for i in range(n):
		s[i] = list(map(int, input().strip().split()))
	ans = 0
	for i in range(n-1):
		for j in range(i+1, n):
			d = 0
			for k in range(D):
				d += (s[i][k] - s[j][k])**2
			dist = sqrt(d)
			if int(dist) == dist:
				ans += 1
	print(ans)
if __name__ == '__main__':
	main()


Measured memory_bytes: 38512
#include "bits/stdc++.h"
 
typedef long long ll;
#define int ll
#define fi first
#define se second
#define SORT(a) sort(a.begin(),a.end())
#define rep(i,n) for(int i = 0;i < (n) ; i++) 
#define REP(i,n) for(int i = 0;i < (n) ; i++) 
#define MP(a,b) make_pair(a,b)
#define pb(a) push_back(a)
#define INF LLONG_MAX/2
 
using namespace std;
int MOD = 1000000007;

signed main(){
    int a,b ;
    cin >> a >> b ;
    if(b%a == 0)cout << a+b << endl;
    else cout << b-a << endl;


    
    
    return 0;   
}
// g++ -std=c++14 code1.cpp
// rm -r -f test;oj dl https://ddcc2019-final.contest.atcoder.jp/tasks/ddcc2019_final_a
// rm -r -f test;oj dl http://abc118.contest.atcoder.jp/tasks/abc118_a

Measured memory_bytes: 256
/*Shivam Bhalla */
	  /* f2016941@pilani.bits-pilani.ac.in */



	  #include <iostream>
	  #include <cstdio>
	  #include <cstring>
	  #include <cstdlib>
	  #include <cctype>
	  #include <algorithm>
	  #include <map>
	  #include <vector>
	  #include <list>
	  #include <set>
	  #include <queue>
	  #include <deque>
	  #include <stack>
	  #include <iostream>
	  #include <string>
		#include <string.h>
	  #include <cmath>
	  #include <cassert>
	  #include <bits/stdc++.h>
	  #define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL)
	  using namespace std;
	  long long maxv = 1e9;

int main(){
	int N;
	cin>>N;
	vector<long long>arr(N+1);
	vector<long long>hero(N);
	for(int i=0;i<=N;i++)
		cin>>arr[i];
	for(int i=0;i<N;i++)
		cin>>hero[i];
	long long total=0;
	for(int i=0;i<N;i++){
		if(arr[i]>=hero[i])
			total+=hero[i];
		else{
			total+=arr[i];
			hero[i]=hero[i]-arr[i];
			if(arr[i+1]>=hero[i]){
				total+=hero[i];
				arr[i+1]-=hero[i];
			}
			else{
				total+=arr[i+1];
				arr[i+1]=0;
			}
		}
	}
	cout<<total;	
	return 0;
}


Measured memory_bytes: 1920
N,K = map(int,input().split())
A = list(map(int,input().split()))

Ad = {x:0 for x in set(A)}
if len(set(A)) <= K:
    print(0)
else:
    count = 0
    for a in A:
        Ad[a] += 1
    Ad = sorted(Ad.items(), key=lambda x:x[1])
    for i in range(len(set(A))-K):
        count += Ad[i][1]
    print(count)


Measured memory_bytes: 54476
#include<iostream>
#include<algorithm>
#include<cmath>
#define N 1001
#define M 100000007

using namespace std;

typedef long long ll;

ll dp[N][N];

void init(){
  for(int i=0; i<N; ++i){
    dp[i][0] = 1;
    dp[0][i] = 1;
  }
  for(int i=1; i<N; ++i){
    for(int j=i; j<N; ++j){
      dp[i][j] = (dp[i][j-1] + dp[i-1][j]) % M;
      dp[j][i] = (dp[j][i-1] + dp[j-1][i]) % M;
    }
  }
}

int main(){
  int n, m, x, y;
  int x1, y1, x1_, y1_, x2, y2;
  int ax, ay, bx, by;
  ll ans;

  init();
  cin >> n >> m >> x1 >> y1 >> x2 >> y2;

  if(x1 < x2) x1_ = x1 + n;
  else x1_ = x1 - n;
  if(y1 < y2) y1_ = y1 + m;
  else y1_ = y1 - m;

  ax = abs(x1 - x2);
  ay = abs(y1 - y2);
  bx = abs(x1_ - x2);
  by = abs(y1_ - y2);
  x = min(ax, bx);
  y = min(ay, by);

  ans = dp[x][y];
  if(ax == bx && ax != 0) ans *= 2;
  if(ay == by && ay != 0) ans *= 2;

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

Measured memory_bytes: 8988
#include<stdio.h>
int main()
{
    int a,b;
    int m,c;
    while(scanf("%d %d",&a,&b)!=EOF){
        m=a+b;
        c=0;
        for(;;){
            c++;
            if((m/=10)==0)break;
        }
        printf("%d\n",c);
    }
    return 0;
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#include <string>
//#define local
#ifdef local
#include "dbg-macro/dbg.h"
#endif
#define ll long long
#define pi (acos(-1))
#define rep(i, n) for (unsigned long long i = 0; i < (unsigned long long)(n); ++i)
using namespace std;
std::vector<unsigned ll> genprimevec(const unsigned ll N);


int main()
{

int n;
cin>>n;
vector<unsigned ll> vec(n);
rep(i,n){
	cin>>vec[i];
}
unsigned ll ans=0;
for(int cur=1;cur!=n;++cur){
	if(vec[cur-1]>vec[cur]){
ans+=vec[cur-1]-vec[cur];
vec[cur]=vec[cur-1];
	}
}
cout<<ans<<endl;

    return 0;
}

ll extgcd(ll a, ll b, ll &x, ll &y)
{
    if (b == 0)
    {
        x = 1, y = 0;
        return a;
    }
    ll d = extgcd(b, a % b, y, x);
    y -= a / b * x;
    return d;
}


std::vector<unsigned ll> genprimevec(const unsigned ll N)
{
    std::vector<bool> is_prime(N + 1);
    for (unsigned ll i = 0; i <= N; i++) { is_prime[i] = true; }
    std::vector<unsigned ll> P;
    for (unsigned ll i = 2; i <= N; i++)
    {
        if (is_prime[i])
        {
            for (unsigned ll j = 2 * i; j <= N; j += i) { is_prime[j] = false; }
            P.emplace_back(i);
        }
    }
    return P;
}


Measured memory_bytes: 4836
import java.util.Scanner;

public class Main{
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int H = sc.nextInt();
            int W= sc.nextInt();
            if (H == 0 && W == 0) {
                break;
            }else{
                for(int i = 0;i < H;i++){
                    for(int j = 0;j < W;j++){
                        if(i==0 || i == H-1) {
                            System.out.printf("#");
                        }else if(j==0 || j == W-1){
                            System.out.printf("#");
                        }else{
                            System.out.printf(".");
                        }
                    }
                    System.out.printf("\n");
                }
                System.out.printf("\n");
            }
        }
    }
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,M;
ll A[101010];
ll mo=1000000007;

const int MAT=3;
struct Mat { ll v[MAT][MAT]; };
Mat mulmat(Mat& a,Mat& b,int n=MAT) {
	ll mo2=4*mo*mo;
	int x,y,z; Mat r;
	FOR(x,n) FOR(y,n) r.v[x][y]=0;
	FOR(x,n) FOR(z,n) FOR(y,n) {
		r.v[x][y] += a.v[x][z]*b.v[z][y];
		if(r.v[x][y]>mo2) r.v[x][y] -= mo2;
	}
	FOR(x,n) FOR(y,n) r.v[x][y]%=mo;
	return r;
}

Mat powmat(ll p,Mat a,int n=MAT) {
	int i,x,y; Mat r;
	FOR(x,n) FOR(y,n) r.v[x][y]=0;
	FOR(i,n) r.v[i][i]=1;
	while(p) {
		if(p%2) r=mulmat(r,a,n);
		a=mulmat(a,a,n);
		p>>=1;
	}
	return r;
}

ll modpow(ll a, ll n = mo-2) {
	ll r=1;
	while(n) r=r*((n%2)?a:1)%mo,a=a*a%mo,n>>=1;
	return r;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>M;
	FOR(i,M) cin>>A[i];
	
	Mat P,Q,C;
	ZERO(P.v);
	ZERO(C.v);
	
	P.v[0][0]=1;
	P.v[1][0]=P.v[1][1]=1;
	P.v[2][0]=P.v[2][2]=1;
	P.v[2][1]=2;
	
	Q=P;
	Q.v[0][2]++;
	Q.v[1][2]++;
	Q.v[2][2]++;
	
	C.v[0][0]=C.v[1][1]=C.v[2][2]=1;
	
	int pre=1;
	FOR(i,M) {
		Mat R=powmat(A[i]-pre,Q);
		C=mulmat(C,R);
		C=mulmat(C,P);
		pre=A[i]+1;
	}
	Mat R=powmat(N-pre,Q);
	C=mulmat(C,R);
	
	
	cout<<(C.v[2][0]+C.v[2][1]+C.v[2][2])%mo<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <iomanip>
#include <queue>
#include <deque>
#include <map>
#include <unordered_map>
#define rep(i,n) for(int i=0;i<n;i++)
#define repn(i,n) for(int i=1;i<=n;i++)
#define repr(e,x) for(auto& e:x)
using namespace std;
typedef long long ll;

ll x;

int main(){
    cin>>x;

    ll ans=x/11*2;
    ll m=x%11;
    if(m!=0){
        if(m<=6) ans++;
        else ans+=2;
    }

    cout<<ans<<endl;
}

Measured memory_bytes: 256
#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<ll, ll>;

void solve(long long x) {
    cout << 1 - x << endl;
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long x;
    scanf("%lld", &x);
    solve(x);
    return 0;
}


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

int main()
{
	int N;cin>>N;
	int cnt = 0;
	for (int i = 0; i < N; i++)
	{
		char c;cin>>c;
		if(c=='R')cnt++;
	}

	if(cnt > N-cnt)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;

	return 0;
}

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

using namespace std;
typedef long long ll;

int cnt[4010][4010];

int f(int a, int b, int c, int d) {
  return cnt[c][d] + cnt[a][b] - cnt[c][b] - cnt[a][d];
}

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

  for (int i = 0; i < n; i++) {
    int x, y;
    char c;
    cin >> x >> y >> c;
    x %= 2 * K;
    if (c == 'W') y += K;
    y %= 2 * K;
    x++; y++;
    cnt[x][y]++;
    cnt[x + 2 * K][y]++;
    cnt[x][y + 2 * K]++;
    cnt[x + 2 * K][y + 2 * K]++;
  }

  for (int i = 0; i <= 4 * K; i++) {
    for (int j = 1; j <= 4 * K; j++) {
      cnt[i][j] += cnt[i][j - 1];
    }
  }
  for (int j = 0; j <= 4 * K; j++) {
    for (int i = 1; i <= 4 * K; i++) {
      cnt[i][j] += cnt[i - 1][j];
    }
  }

  int ans = 0;
  for (int i = 0; i < 2 * K; i++) {
    for (int j = 0; j < 2 * K; j++) {
      ans = max(ans, f(i, j, i + K, j + K) + f(i + K, j + K, i + 2 * K, j + 2 * K));
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 62976
package main

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

var sc = bufio.NewScanner(os.Stdin)

func Scan() string {
	sc.Scan()
	return sc.Text()
}
func iScan() int {
	n, _ := strconv.Atoi(Scan())
	return n
}
func fScan() float64 {
	n, _ := strconv.ParseFloat(Scan(), 64)
	return n
}
func stringToInt(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}
func SScan(n int) []string {
	a := make([]string, n)
	for i := 0; i < n; i++ {
		a[i] = Scan()
	}
	return a
}
func iSScan(n int) []int {
	a := make([]int, n)
	for i := 0; i < n; i++ {
		a[i] = iScan()
	}
	return a
}
func abs(x int) int {
	if x < 0 {
		x = -x
	}
	return x
}
func larger(a, b int) int {
	if a < b {
		return b
	} else {
		return a
	}
}
func smaller(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}
func max(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x < a[i] {
			x = a[i]
		}
	}
	return x
}
func min(a []int) int {
	x := a[0]
	for i := 0; i < len(a); i++ {
		if x > a[i] {
			x = a[i]
		}
	}
	return x
}
func sum(a []int) int {
	x := 0
	for _, v := range a {
		x += v
	}
	return x
}
func fSum(a []float64) float64 {
	x := 0.
	for _, v := range a {
		x += v
	}
	return x
}

var mod int = 1000000007

func main() {
	buf := make([]byte, 0)
	sc.Buffer(buf, mod)
	sc.Split(bufio.ScanWords)
	n := iScan()
	x := iScan()
	t := iScan()
	fmt.Println(t * ((n + x - 1) / x))
}


Measured memory_bytes: 1772
#include <stdio.h>
#include <string.h>

void display_ans(char *string)
{
    for (int i = 0; string[i] != '\0'; i++)
    {
        printf("%c", string[i]);
    }
}

int main(void)
{
    int a, b;
    char string_a[9];
    char string_b[9];
    int i;
    scanf("%d %d", &a, &b);

    for (i = 0; i < b; i++)
    {
        string_a[i] = a + '0';
    }
    string_a[i] = '\0';
    for (i = 0; i < a; i++)
    {
        string_b[i] = b + '0';
    }
    string_b[i] = '\0';

    if (strcmp(string_a, string_b) > 0)
    {
        display_ans(string_b);
    }
    else if (strcmp(string_a, string_b) < 0)
    {
        display_ans(string_a);
    }
    else if (strcmp(string_a, string_b) == 0)
    {
        display_ans(string_a);
    }
    return (0);
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 10;

int n , a [ maxn ] , b [ maxn ] , a_number [ maxn ] , b_number [ maxn ];
void judge ( int* m , int* t );
int ji_suan ( int* t , int number );
 
int main ( void )
{
	cin >> n;
	for ( int i = 1 ; i <= n ; i++ ) {
		cin >> a [ i ];
	}
	for ( int i = 1 ; i <= n ; i++ ) {
		cin >> b [ i ];
	}
	judge ( a , a_number );
	judge ( b , b_number );
	int chu_shi = n - 1;
	int sum = 1;
	while ( chu_shi != 1 ) {
		sum *= chu_shi;
		chu_shi--;
	}
	cout << abs ( ji_suan ( a_number , sum ) - ji_suan ( b_number , sum ) );
	return 0;
}

void judge ( int* m , int* t )
{
	t [ 1 ] = m [ 1 ] - 1;
	for ( int i = 2 ; i <= n ; i++ ) {
		t [ i ] = m [ i ] - 1;
		for ( int j = 1 ; j < i ; j++ ) {
			if ( m [ j ] < m [ i ] ) {
				t [ i ]--;
			}
		}
	}
}

int ji_suan ( int* t , int number )
{
	int sum = 0;
	for ( int i = 1 ; i <= n ; i++ ) {
		sum += number * t [ i ];
		if ( n - i != 0 ) {
			number = number / ( n - i );
		} else {
			number = 1;
		}
	}
	return sum;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <ctime>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <cassert>
#include <bitset>
#include <list>
#include <cstdio>
#include <stdio.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <cmath>
#include <tuple>
#include <cassert>
#include <array>
#include <iomanip>

using namespace std;
using pii = pair<int, int>;
using ti = tuple<int, int, int>;

const double eps=1e-14;
const int mod = 1e9 + 7;
const int inf = ((1<<30));
const long long linf = (1LL<<60);

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    string s;
    cin >> s;
    int ans = 0;
    for(int i=1; i<n-1; i++)
    {
        int num = 0;
        string left = s.substr(0,i);
        string right = s.substr(i);
        set<char> mp;
        for(int j=0; j<left.size(); j++) mp.insert(left[j]);
        for(auto itr=mp.begin(); itr!=mp.end(); itr++)
        {
            for(int k=0; k<right.size(); k++)
            {
                if(*itr == right[k])
                {
                    num++;
                    break;
                }
            }
        }
        ans = max(ans, num);
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
using namespace std;


int main() {
    int N, K;
    scanf("%d %d", &N, &K);
    /*一人なら答えは0 */
    if(K==1){
        printf("0\n");
        return 0;
    }
    /*二人以上なら、K-1人に1個配り、残りの一人にN-(K-1)個配る。答えはN-(K-1)-1 = N-K個 */
    else{
        printf("%d\n", N-K);
        return 0;
    }
}

Measured memory_bytes: 128
n=int(input())
data=[]
for i in range(n):
    X,Y,H=map(int,input().split())
    data.append([H,X,Y])
data.sort(reverse=True)
for i in range(101):
    for j in range(101):
        H=abs(data[0][1]-i)+abs(data[0][2]-j)+data[0][0]
        for k in range(1,n):
            if max(H-abs(data[k][1]-i)-abs(data[k][2]-j),0)==data[k][0]:
                continue
            else:
                break
        else:
            print(str(i), str(j), str(H))



Measured memory_bytes: 9164
"use strict";
    
const main = arg => {
    arg = arg.split("\n");
    const N = parseInt(arg[0].split(" ")[0]);
    const L = parseInt(arg[0].split(" ")[1]);
    const S = arg.slice(1, N + 1);
    
    console.log(S.sort().join(""));
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 7500
#include<stdio.h>
int main (){
	int A,B,C,D=0;
	scanf("%d",&A);
	scanf("%d",&B);
	scanf("%d",&C);

	if(A==5&&B==5){
		if(C==7)
			D=1;
	}

	if(A==5&&B==7){
		if(C==5)
			D=1;
	}

	if(A==7&&B==5){
		if(C==5)
			D=1;
	}

	if(D==0)
		printf("NO");
	else
		printf("YES");

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<iomanip>
#include<string>
#include<set>
#include<vector>
#include<utility>
#include<queue>
#include<algorithm>
#include<functional>
using namespace std;
#define LL long long
#define MOD 100000
#define inf 1999999999
#define ALL(x) (x).begin(), (x).end()
#define Pi pair<int, int>
#define Vi vector<int>

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

int n, p[100], tmp = 0;

int main() {
	cin >> n;
	rep(i, n) {
		cin >> p[i];
		if (p[i] != i + 1)tmp++;
	}
	if (tmp == 0 || tmp == 2)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}



Measured memory_bytes: 256
import java.util.*;
import java.io.*;
import java.math.*;
public class Main {
   public static void main(String args[]) throws IOException {
        Scanner input=new Scanner(System.in);
        long a=input.nextLong();
        float b=input.nextFloat();
        System.out.println(solve(a,b));
    }
   public static long solve(long a,float b) {
       BigDecimal A=new BigDecimal(""+a);
       BigDecimal B=new BigDecimal(""+b);
       BigDecimal C=A.multiply(B);
       return C.longValue();
   }
}


Measured memory_bytes: 40020
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
  int N;
  cin >> N;
  vector<int> sub(N, 0);
  for (int i = 1; i < N; i++) {
    int a;
    cin >> a;
    sub[a - 1]++;
  }
  for (int s : sub) {
    cout << s << endl;
  }
  return 0;
}

Measured memory_bytes: 3976
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define INF 2 << 29

int dp[110000] = {};
int solve(int n) {
	//base case
	if (!n) return 0;
	if (dp[n]) return dp[n];

	int res = n;

	for (int i = 1; i <= n; i *= 6) res = min(res, solve(n - i) + 1);
	for (int i = 1; i <= n; i *= 9) res = min(res, solve(n - i) + 1);

	return dp[n] = res;
	
}

int main(){
	int n;
	cin >> n;
	cout << solve(n) << endl;
}



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

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

const ll MOD = 1e9 + 7;

int main()
{
    int n, m;
    cin >> n >> m;

    if(abs(n - m) > 1) {
        cout << 0 << endl;
        return 0;
    }

    ll ans = 1;
    if(n == m) {
        rep(i, n) {
            ans *= (n - i);
            ans %= MOD;
        }
        rep(i, m) {
            ans *= (m - i);
            ans %= MOD;
        }
        ans *= 2;
        ans %= MOD;
    } else {
        rep(i, n) {
            ans *= (n - i);
            ans %= MOD;
        }
        rep(i, m) {
            ans *= (m - i);
            ans %= MOD;
        }
    }

    cout << ans << endl;

    return 0;
}


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

int main() {
  int n,W;
  cin>>n>>W;
  int dp[110][10010];
  int w[110],v[110];
  for(int i=0;i<n;i++) cin>>v[i]>>w[i];
  for(int i=0;i<=W;i++) dp[0][i]=0;
  for(int i=0;i<n;i++){
    for(int j=0;j<=W;j++){
      if(j>=w[i]) dp[i+1][j]=max(dp[i][j],dp[i][j-w[i]]+v[i]);
      else dp[i+1][j]=dp[i][j];  
    }
  }
  cout<<dp[n][W]<<endl;
  return 0;
}


Measured memory_bytes: 7048
#include <iostream>
#include<string>
#include<cmath>
#include<algorithm>
#include<cctype>
#include<queue>
#include<stack>
#include<stdio.h>
#include<vector>
#include<set>
#include<map>
#include<iomanip>
#define rep(i,n) for(int long long i=0;i<n;i++)
typedef int long long ll;
using namespace std;
    ll s[100001];
int main(){

    ll n;
    cin>>n;

    rep(i,n){
        ll a;
        cin>>a;
        s[a]++;
    }
    
    ll mx=-(1e+18);
    ll ans=0;
    
   // for(ll i=0;i<s.size()-2;i++){
    for(int i=0;i<100001-3;i++){
        ll mi=s[i]+s[i+1]+s[i+2];
        if(mi>mx){
            ans=i+1;
            mx=mi;
        }
    }
    
    cout<<s[ans-1]+s[ans+1]+s[ans]<<endl;
    
    
    
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)

#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()

int n;
string s[125252];
char buf[525252];
int g[125252][26][26];
int add[125252];

struct node{
  node *par;
  node *to[26];
  int size, subsize[26];
  int end;
  char c;
  node(){
    par=NULL;
    REP(i,26)to[i]=NULL;
    size=1;
    REP(i,26)subsize[i]=0;
    end=0;
    c='#';
  }
  node(char c):c(c){
    par=NULL;
    REP(i,26)to[i]=NULL;
    size=1;
    REP(i,26)subsize[i]=0;
    end=0;
  }
};

node *tail[125252];

int main(){
  scanf("%d",&n);
  REP(i,n){
    scanf("%s",buf);
    s[i] = string(buf);
  }
  node *root = new node();
  REP(i,n){
    // trie
    string &t = s[i];
    int m = t.size();
    node *cur = root;
    REP(j,m){
      char c = t[j];
      int cid= c-'a';
      if(cur->to[cid]==NULL){
        cur->to[cid] = new node(c);
        cur->to[cid]->par = cur;
      }
      cur->size += 1;
      cur->subsize[cid] += 1;
      cur = cur->to[cid];
    }
    cur->size += 1;
    cur->end += 1;
    tail[i] = cur;
  }
  REP(i,n){
    // go up
    string &t = s[i];
    int m = t.size();
    node *cur = tail[i];
    FORR(j,0,m){
      cur = cur->par;
      add[i] += cur->end;
      char c = t[j];
      int cid= c-'a';
      REP(x,26)if(x!=cid){
        g[i][x][cid] += cur->subsize[x];
      }
    }
  }
  // query
  int q;
  scanf("%d",&q);
  while(q--){
    int k;
    char po[35];
    scanf("%d%s",&k,po);
    --k;
    int rev[35];
    REP(i,26)rev[po[i]-'a']=i;
    int ans = 0;
    REP(i,26)REP(j,26){
      if(rev[i]<rev[j])ans+=g[k][i][j];
    }
    printf("%d\n",ans+add[k]+1);
  }
  return 0;
}


Measured memory_bytes: 312320
a,b,k = map(int,input().split())
turn = 1
for i in range(k):
    if turn%2 == 1:
        if a%2 == 0:
            a //= 2
            b += a
        else: #a%2 == 1:
            a -= 1
            a //= 2
            b += a
    else: #turn == 2:
        if b%2 == 0:
            b //= 2
            a += b
        else: #a%2 == 1:
            b -= 1
            b //= 2
            a += b
    turn += 1
print(a,b)

Measured memory_bytes: 9144
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class Main {
    public static void main(String[] args) throws IOException {
        BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
        String line = null;
        List<Integer> num = new ArrayList<Integer>();
        while ((line = in.readLine()) != null) {
            String[] strs = line.split("\\s+");
            for (int i = 0; i < 5; i++) {
                num.add(Integer.parseInt(strs[i]));
            }
            Collections.sort(num, Collections.reverseOrder());
            for (int i = 0; i < 4; i++) {
                System.out.print(num.get(i) + " ");
            }
            System.out.println(num.get(4));
        }
    }
}



Measured memory_bytes: 24520
#include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define mod 1000000007
int main()
{
    unsigned long long n,i,j,k,a,b,c,d,e;
    cin>>n;
    unsigned long long arr[n],ans=0;
    for(i=0; i<n; i++)
        cin>>arr[i];
    for(i=0; i<60; i++)
    {
        k=0;
        for(j=0; j<n; j++)
        {
            c=arr[j];
            for(int p=0;p<i;p++)c/=2;
            if(c%2)
                k++;
        }
        d=1;
        for(int p=0;p<i;p++)d*=2;
        d%=mod;
        e=((k)*(n-k));
        e%=mod;
        ans+=d*e;
        ans%=mod;
    }
    cout<<ans<<'\n';
    return 0;
}

Measured memory_bytes: 2560
N,K = map(int,input().split())
a = input()
res = ''
S = [el for el in a]
if S[K-1] == 'A':
  S[K-1] = 'a'
elif S[K-1] == 'B':
  S[K-1] = 'b'
elif S[K-1] == 'C':
  S[K-1] = 'c'
for el in S:
  res += el
print(res)

Measured memory_bytes: 3064