akhauriyash/Code-Regression huggingface dataset:
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

struct Matrix(size_t height, size_t width)
{
    long M;
    long[width][height] arr;

    this(long[width][height] arr, long M = 0) {
        this.arr = arr;
        this.M = M;
    }

    pure nothrow @nogc
    Matrix!(height, rhs_width) opBinary(string op, size_t rhs_width)(Matrix!(width, rhs_width) rhs) {
        static if (op == "*") {
            long[rhs_width][height] res;
            foreach (y; 0..height) {
                foreach (x; 0..rhs_width) {
                    foreach (i; 0..width) {
                        auto s = this.arr[y][i] * rhs.arr[i][x];
                        if (this.M) s %= this.M;
                        res[y][x] += s;
                        if (this.M) res[y][x] %= this.M;
                    }
                }
            }
            return Matrix!(height, rhs_width)(res, this.M);
        } else {
            static assert(0, "Operator "~op~" not implemented");
        }
    }

    pure nothrow @nogc
    Matrix!(height, width) opBinary(string op)(long n) {
        static if (op == "^^" && height == width) {
            long[width][height] rr;
            foreach (i; 0..width) rr[i][i] = 1;
            auto r = Matrix!(height, width)(rr, M);
            auto x = this;
            while (n) {
                if (n%2 == 1) r = r * x;
                x = x * x;
                n /= 2;
            }
            return r;
        } else {
            static assert(0, "Operator "~op~" not implemented");
        }
    }
}

Matrix!(h, w) matrix(size_t h, size_t w)(long[w][h] arr, long M = 0)
{
    return Matrix!(h, w)(arr, M);
}

void main()
{
    auto labm = readln.split.to!(long[]);
    auto L = labm[0];
    auto A = labm[1];
    auto B = labm[2];
    auto M = labm[3];

    long[18] CS;
    if (A < 10) CS[0] = (10-A-1)/B+1;
    foreach (i; 1..18) {
        auto dm = 10L^^(i+1)-1-A;
        if (dm < 0) continue;
        auto last = B*(L-1);
        CS[i] = ((dm > last) ? last : dm)/B+1;
        foreach (j; 0..i) CS[i] -= CS[j];
        if (dm >= last) break;
    }

    long[3][1] xss = [[0, A, 1]];
    auto xs = matrix(xss, M);

    foreach (i, d; CS) {
        long[3][3] cm = [
            [(10L^^(i+1)%M).to!long, 0, 0],
            [1L, 1, 0],
            [0L, B, 1]
        ];
        auto m = matrix(cm, M);
        m = m^^d;
        xs = xs * m;
    }
    writeln(xs.arr[0][0]);
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<math.h>
#include<cmath>
#include<stack>
//#include<stdlib.h>
using namespace std;
int main() {
	vector<int>out(0);
	int n, max, min, on = -1, l=0;
	vector<int>p(200,0);
	while (true)
	{
		cin >> n >> min >> max;
		if (n == 0) { break; }
		out.push_back(0);
		on++;
		for (int a = 0; a < n; a++) { cin >> p[a]; }
		for (int a = min-1 ; a < max; a++) {
			if (l <= p[a] - p[a + 1]) { l = p[a] - p[a + 1]; out[on] = a+1; }
		}
		for (int a = 0; a < n; a++) {  p[a]=0; }
		n = 0; min = 0; max = 0; l = 0;
	}
	for (int a = 0; a < on+1; a++) { cout << out[a]<<endl; }
	return 0;
}


Measured memory_bytes: 3144
#include<stdio.h>
int main()
{
	int n,m,c=0;

	scanf("%d%d",&n,&m);

	for(int i=1;i<n;i++)
		c+=n-i;
	for(int i=1;i<m;i++)
		c+=m-i;

	printf("%d",c);
	return 0;
}

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

int main(){
	int n;
	cin >> n;
	vector<int> o(100005,0),e(100005,0);
	for(int i=0; i<n; i++){
		int v;
		cin >> v;
		if(i%2==1) o[v]++;
		else e[v]++;
	}

	int i = max_element(e.begin(), e.end()) - e.begin();
	int j = max_element(o.begin(), o.end()) - o.begin();
	if(i != j) cout << n-e[i]-o[j] << endl;
	else{
		sort(e.begin(), e.end(), greater<int>());
		sort(o.begin(), o.end(), greater<int>());
		int an = min(n-e[0]-o[1], n-e[1]-o[0]);

		cout << an << endl;
	}

	return 0;
}

Measured memory_bytes: 4016
#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
#define MAX_WORDS 1201

int main(void){
    int i,sum;
    int alphabet[26]={0};
    char str[MAX_WORDS];
    while ( fgets(str, MAX_WORDS, stdin) != NULL ){
        i = 0;
        while ( str[i] != '\0' ){
            if ( isalpha(str[i]) ){
                alphabet[ tolower(str[i]) - 'a' ]++;
            }
            i++;
        }
    }
    for ( i = 0 ; i < 26 ; i++ ){
        printf("%c : %d\n", i+'a', alphabet[i]);
    }
    return 0;
}


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


signed main(){
   int n;
   cin >>n;
   int s[n],a[n],b[n];
   for(int i=0;i<n;i++)cin >>a[i];
   for(int i=0;i<n;i++)cin >>b[i];
   for(int i=0;i<n;i++)s[i]=a[i]-b[i];
   sort(s,s+n);
  
   int t=0;
   int al=0;
   while(t<n&&s[t]<0){
       al+=s[t];
       t++;
   }
 //cerr << t <<s[1];
   if(al==0)cout <<0;
   else{
       int y=1;
       
       while(n>=y&&s[n-y]>0 && al<0){
           al+=s[n-y];
           y++;
       }
       if(al>=0)cout <<t+y-1;
       else cout <<-1;
   }



    return 0;
}

Measured memory_bytes: 2560
import java.math.BigDecimal;
import java.math.MathContext;
import java.math.RoundingMode;
import java.util.Scanner;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        BigDecimal a;
        a = new BigDecimal(sc.next());
        BigDecimal b;
        b = new BigDecimal(sc.next());
        BigDecimal c;
        c = new BigDecimal(sc.next());

        final Solver solver = new Solver();
        solver.solve(a, b, c);
    }
}

class Solver {
    static final String YES = "Yes";
    static final String NO = "No";
    private static final BigDecimal SQRT_DIG = new BigDecimal(150);
    private static final BigDecimal SQRT_PRE = new BigDecimal(10).pow(SQRT_DIG.intValue());

    /**
     * Private utility method used to compute the square root of a BigDecimal.
     *
     * @author Luciano Culacciatti
     * @url http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal
     */
    private static BigDecimal sqrtNewtonRaphson(BigDecimal c, BigDecimal xn, BigDecimal precision) {
        BigDecimal fx = xn.pow(2).add(c.negate());
        BigDecimal fpx = xn.multiply(new BigDecimal(2));
        BigDecimal xn1 = fx.divide(fpx, 2 * SQRT_DIG.intValue(), RoundingMode.HALF_DOWN);
        xn1 = xn.add(xn1.negate());
        BigDecimal currentSquare = xn1.pow(2);
        BigDecimal currentPrecision = currentSquare.subtract(c);
        currentPrecision = currentPrecision.abs();
        if (currentPrecision.compareTo(precision) <= -1) {
            return xn1;
        }
        return sqrtNewtonRaphson(c, xn1, precision);
    }

    /**
     * Uses Newton Raphson to compute the square root of a BigDecimal.
     *
     * @author Luciano Culacciatti
     * @url http://www.codeproject.com/Tips/257031/Implementing-SqrtRoot-in-BigDecimal
     */
    public static BigDecimal bigSqrt(BigDecimal c) {
        return sqrtNewtonRaphson(c, new BigDecimal(1), new BigDecimal(1).divide(SQRT_PRE));
    }

    public void solve(BigDecimal a, BigDecimal b, BigDecimal c) {
        MathContext mc = new MathContext(30);

        BigDecimal diff = bigSqrt(a).add(bigSqrt(b)).subtract(bigSqrt(c));

        if (diff.abs(mc).compareTo(new BigDecimal("0.0000000000000000000000000000000000000000000000000001")) < 0) {
            System.out.println(NO);
            return;
        }

        if (diff.compareTo(new BigDecimal(0)) < 0) {
            System.out.println(YES);
        } else {
            System.out.println(NO);
        }
    }
}



Measured memory_bytes: 26708
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll,ll>;
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,m,n) for(int (i)=(m);(i)<(n);(i)++)
const ll INF = 1LL<<60;
const ll MOD = 1e9+7;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n; cin>>n;
    vector<double> x(n),y(n);
    rep(i,n)cin>>x[i]>>y[i];
    vector<int> per;rep(i,n)per.push_back(i);
    double sum = 0;
    ll cnt = 0;
    do{
        rep(i,n-1){
            double dx = x[per[i]]-x[per[i+1]];
            double dy = y[per[i]]-y[per[i+1]];
            sum+=sqrt(dx*dx+dy*dy);
        }
        cnt++;
    }while(next_permutation(per.begin(),per.end()));
    cout<<setprecision(12)<<sum/cnt<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
typedef long long ll;
#define rep(i,a,n) for (int i=a;i<n;i++)
ll mod;
int n;
ll powmod(ll a,ll b) {ll res=1;a%=mod; for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}

ll ipw2[10100],ipw3[10100],fac[10100],fnv[10100];
int main() {
  scanf("%d%lld",&n,&mod);
	fac[0]=1;
	rep(i,1,10000) fac[i]=fac[i-1]*i%mod;
	rep(i,0,10000) fnv[i]=powmod(fac[i],mod-2),ipw2[i]=powmod(2,mod-1-i),ipw3[i]=powmod(3,mod-1-i);
	int s=0;
	rep(i,0,n+1) rep(j,0,n-i+1) s=(s+fnv[i]*fnv[j]%mod*fnv[3*n-3*i-2*j]%mod*ipw3[i]%mod*ipw2[j])%mod;
  printf("%d\n",s*fac[3*n]%mod);
}

Measured memory_bytes: 512
w, h, n = map(int, input().split())
arr = [[int(i) for i in input().split()] for j in range(n)]
x1, y1, x2, y2 = 0, 0, w, h

for x, y, a in arr:
    if a == 1:
        x1 = max(x1, x)
    elif a == 2:
        x2 = min(x2, x)
    elif a == 3:
        y1 = max(y1, y)
    elif a == 4:
        y2 = min(y2, y)

print(max(x2-x1, 0) * max(y2-y1, 0))


Measured memory_bytes: 3064
#include<stdio.h>
#include<stdlib.h>
int main(){
  
  int i;
  int s[6];
  int n[3]={0};
  int m;
  for(i=0;i<10;i++){
    fgets(s,6,stdin);
    //atoi(s);
    if(n[2]<atoi(s)){
      n[2]=n[1];
      if(n[1]<atoi(s)){
	n[1]=n[0];
	if(n[0]<atoi(s)){
	  n[0]=atoi(s);
        }
	else{
	  n[1]=atoi(s);
	}
      }
      else{
	n[2]=atoi(s);
      }
    }
  }
  printf("%d\n%d\n%d\n",n[0],n[1],n[2]);
  return 0;
}

Measured memory_bytes: 532
#include<iostream>

using namespace std;

int main()
{
  int a,b;

  cin>>a;
  cin>>b;

  if(a==b)
    {
      cout<<"a == b";
    }
  else if(a>b)
    {
      cout<<"a > b";
    }
  else
    {
      cout<<"a < b";
    }

  cout<<'\n';

  return 0;
}



Measured memory_bytes: 3024
#include <stdio.h>

int main(void)
{
    int x, i;
    char buf[256];
    i = 1;
    while (1)
    {
        fgets(buf, 256, stdin);
        buf[255] = '\0';
        sscanf(buf, "%d", &x);
        if (!x) break;
        printf("Case %d: %d\n", i++, x);
    }

    return 0;
}



Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
#define UF_RANK 0 // 1/0: rankによる経路圧縮をする/しない
#define UF_SIZE 1 // 1/0: 連結成分のサイズを記録する/しない

struct UnionFind{
  vector<int> root;
#if (UF_RANK==1)
  vector<int> rank;
#endif
#if (UF_SIZE==1)
  vector<int> size;
#endif

  UnionFind(int N): root(N)
#if (UF_RANK==1)
                  , rank(N)
#endif
#if (UF_SIZE==1)
                  , size(N,1)
#endif
  { iota(root.begin(), root.end(), 0); }

  int find(int a){
    if(root.at(a)==a){
      return a;
    }
    else{
      return root.at(a)= find(root.at(a));
    }
  }

  void unify(int a, int b){
    int r_a= find(a);
    int r_b= find(b);
#if (UF_RANK==1)
    if(r_a != r_b){
      if(rank.at(r_a) < rank.at(r_b)){
        root.at(r_a)= r_b;
        #if (UF_SIZE==1)
        size.at(r_b)+= size.at(r_a);
        #endif
        return;
      }
      else{
        root.at(r_b)= r_a;
        #if (UF_SIZE==1)
        size.at(r_a)+= size.at(r_b);
        #endif
        if(rank.at(r_a)==rank.at(r_b)) rank.at(r_a)++;
        return;
      }
    }
#else
    if(r_a != r_b){
      root.at(r_b)= r_a;
      #if (UF_SIZE==1)
      size.at(r_a)+= size.at(r_b);
      #endif
      return;
    }
#endif
  }
  
  bool are_comrade(int a, int b){
    return find(a)==find(b);
  }

#if (UF_SIZE==1)
  int get_size(int a){
    return size.at(find(a));
  }
#endif
};

int main(){
  int N,M,K;
  cin >> N >> M >> K;

  UnionFind uf(N);
  vector<int> offset(N,1); // ans.at(i)= (iが属する連結成分のサイズ)- 1(自分自身)- (#iの友人)- (#iと同じ連結成分に属してブロック関係にある人)
                           //          = uf.get_size(i)        - offset.at(i)
  int buf1,buf2;
  for(int i_f=0; i_f<M; i_f++){
    cin >> buf1 >> buf2;
    buf1--; buf2--; // 1-indexed -> 0-indexed
    uf.unify(buf1, buf2);
    offset.at(buf1)++;
    offset.at(buf2)++;
  }
  for(int i_b=0; i_b<K; i_b++){
    cin >> buf1 >> buf2;
    buf1--; buf2--; // 1-indexed -> 0-indexed
    if(uf.are_comrade(buf1, buf2)){
      offset.at(buf1)++;
      offset.at(buf2)++;
    }
  }
  
  for(int i=0; i<N-1; i++){
    cout << uf.get_size(i)- offset.at(i) <<" ";
  }
  cout << uf.get_size(N-1)- offset.at(N-1) << endl;
}

Measured memory_bytes: 2432
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int main(){
	fastio;
	rb(i,1,5){
		int ai;
		cin>>ai;
		if(!ai){
			cout<<i;
		}
	}
	return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    ll a,b;
    cin >> a >> b;
    cout << 6-a-b << endl;

    return 0;
}

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

int main(){
  int n;
  cin >> n;
  map<string,int> dic;
  rep(i,n){
    string s;
    cin >> s;
    dic[s]++;
  }
  vector<pair<int,string>> ans(dic.size());
  int i=0;
  for( auto p : dic ){
    ans.at(i).first = p.second;
    ans.at(i).second = p.first;
    i++;
  }
  
  sort(ans.begin(),ans.end());
  reverse(ans.begin(),ans.end());
  
  int check = ans.at(0).first;
  i=0;
  vector<string> a;
  while( check == ans.at(0).first ){
    a.push_back(ans.at(i).second);
    if( i == ans.size()-1 ) break;
    check = ans.at(i+1).first;
    i++;
  }
  reverse(a.begin(),a.end());
  for(int i=0;i<a.size();i++){
    cout << a.at(i) << endl;
  }

  return 0;
}


Measured memory_bytes: 30068
#include <stdio.h>

int main()
{
  int k,a,b,x = 0; scanf ("%d %d %d",&k,&a,&b);
  while (x <= b){
    if (a <= x){
puts("OK");
      return 0;
    }
	x += k;
  }
  puts("NG");
  return 0;
}


Measured memory_bytes: 1632
num = int(input())
l = [ x for x in input().split()]

num = int(input())

for i in range(num):
    a, b = [int(x) for x in input().split()]
    l[a:b] = list(reversed(l[a:b]))


for i in range(len(l)):
    print(l[i],end="")
    if i < len(l)-1:
        print(" ",end="")

print()



Measured memory_bytes: 5980
#include<stdio.h>
int main(void)
{
	int n,a,b;
	scanf("%d",&n);
	if(n==2){
		scanf("%d %d",&a,&b);
		printf("%d\n",a+b);
	}
	if(n==1){
		printf("Hello World\n");
	}
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(ll i = 0; i < (ll)(x); i++)
#define rrep(i,x) for(ll i = (ll)(x)-1;0 <= i; i--)
#define reps(i,x) for(ll i = 1; i < (ll)(x)+1; i++)
#define rreps(i,x) for(ll i = (ll)(x); 1 <= i; i--)
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<ll>>> vvvl;
const ll INF = numeric_limits<ll>::max()/4;
const int n_max = 1e5+10;
void print() {
    cout << endl;
}

template <class Head, class... Tail>
void print(Head&& head, Tail&&... tail) {
    cout << head;
    if (sizeof...(tail) != 0) cout << ' ';
    print(forward<Tail>(tail)...);
}

template <class T>
void print(vector<T> &vec) {
    for (auto& a : vec) {
        cout << a;
        if (&a != &vec.back()) cout << ' ';
    }
    cout << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
    for (auto& vec : df) {
        print(vec);
    }
}

template<class T, class U>
void print(pair<T,U> &p){
    print(p.first, p.second);
}

int main(){
    ll n,x; cin >> n >> x;
    auto mod = [](ll a, ll m){
        return (a + m - 1) % m + 1;
    };

    bool ok = true;
    if(x == 1 || x == 2*n - 1)ok = false;

    vector<ll> ans(2 * n -1);
    ll m = 2 * n - 1;

    x += m;

    rep(i,m){
        ans[i] = mod(x - (n - 1 - i), m);
    }

    cout << (ok ? "Yes" : "No") << endl;
    if(ok)print(ans);
}

Measured memory_bytes: 3072
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		
		int ans = -1;
		
		for (int i = 1; i <= 1000; i++) {
			int _8Percent = (int) (i * 0.08);
			int _10Percent = (int) (i * 0.1);
			
			if (_8Percent == a && _10Percent == b) {
				ans = i;
				break;
			}
		}
		
		System.out.println(ans);
		
		sc.close();
	}

}


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

int main() {
	char c;
	cin >> c;
	string ans;
	if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o') {
		ans = "vowel";
	} else {
		ans = "consonant";
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<math.h>
#define PA 3.1415926535
int main()
{
    double a, b, c,C;
    double S, L, h;
    double rad;
    scanf("%lf %lf %lf",&a,&b,&C);
    rad = C * 2 * PA / 360;
    S = a * b * sin(rad) / 2;
    h = 2 * S / a;
    c = sqrt(a*a + b*b - 2 * a*b*cos(rad));
    L = a + b + c;
    printf("%lf %lf %lf\n",S,L,h);
    return 0;
}


Measured memory_bytes: 2040
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define all(x) x.begin(),x.end()
#define rep(i,j,n) for (long long i = j; i < (long long)(n); i++)
#define _GLIBCXX_DEBUG
#define MOD 1000000007
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; }
//name[i][j]-> vvl name(i,vl(j))
//map<int,int>mp
//余りを切り上げる =>  (a + b - 1) / b 

signed main(){
	string s; cin>>s;
	ll n=s.size();
	ll a=0,b=0;
	rep(i,0,n){
		if(s[i]=='1')a++;
		else b++;
	}
	cout<<2*min(a,b)<<endl;
	
	
	return 0;
}

Measured memory_bytes: 3704
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ll long long
#define P pair<int,int>
#define PI 3.141592653589793
const int INF = 1001001001;
const ll MX = 1e18;
const int mod = 1000000007;

int main() {
	int n;
	cin >> n;
	vector<int> a(n), b(n);
	rep(i, n) cin >> a[i];
	b = a;
	sort(b.rbegin(), b.rend());
	rep(i, n) {
		if (a[i] == b[0]) cout << b[1] << endl;
		else cout << b[0] << endl;
	}
}


Measured memory_bytes: 4736
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
ll dp[2][4];
int now = 0;
int t[3];
ll p2[32];

int main() {
	ll x, a, b;
	cin >> x >> a >> b;
	if (a >= b) {
		cout << "delicious" << endl;
	}
	else if (b - a <= x) {
		cout << "safe" << endl;
	}
	else {
		cout << "dangerous" << endl;
	}
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define x first
#define y second
using namespace std;
using ll = long long;
using ld = long double;

int main() {
#ifdef LC
    assert(freopen("input.txt", "r", stdin));
#endif
    ios::sync_with_stdio(0), cin.tie(0);
	
	int n;
	cin >> n;
	set<int> s;
	for (int x, i = 0; i < n; ++i) {
		cin >> x;
		s.insert(x);
	}
	if (n == (int)s.size()) {
		cout << "YES\n";
	} else {
		cout << "NO\n";
	}

	return 0;
}


Measured memory_bytes: 9600
#include <bits/stdc++.h>
 
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
 
using namespace std;
#define ll long long
#define ull unsigned long long
#define rep(i,n,N) for(int i=n;i<=N;++i)
#define rap(i,n,N) for(int i=n;i>=N;--i)
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define fi first
#define se second
#define ff fi.fi
#define fs fi.se
#define sf se.fi
#define ss se.se
#define lc (id<<1)
#define rc ((id<<1)|1)
#define db(x) cout << ">>>>>> " << #x << " -> " << x << endl
#define all(x) x.begin(),x.end()
#define pii pair<int,int> 
#define pll pair<ll,ll>
#define plll pair<ll,pll>
#define piii pair<int,pii>
#define piiii pair<pii,pll>
#define psi pair<string,int>
#define endl '\n'
const int MAX = 1e3+5;
const ll MAX2 = 11;
const ll MOD = 1010205047;
const ll MOD2 = 1000005329;
const ll INF = 2e18;
const int dr[]={1,0,-1,0,1,1,-1,-1,0};
const int dc[]={0,1,0,-1,1,-1,1,-1,0};
const double pi = acos(-1);
const double EPS = 1e-9;
const int block = 200;

int n,k,ans,x[MAX];

 
int main(){
//	cout<<fixed<<setprecision(10);
//	freopen("input.txt", "r", stdin);
//	freopen("output.txt","w",stdout);
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    cin>>n>>k;
    rep(i,1,n)cin>>x[i];
    sort(x+1,x+1+n);
    rep(i,1,k)ans+= x[i];
    cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3652
n,p = map(int, input().split())
s = input()

if(p==2)|(p==5):
    ans = 0
    for i in range(n):
        tmp = int(s[i])
        if(tmp%p == 0):
            ans += (i+1)

    print(ans)
    exit()

ans = 0
tmp = 0
rem = [0] * p
rem[0] = 1
for i in range(n):
    tmp = (tmp + int(s[-1 * (i+1)]) * pow(10, i, p)) % p
    ans += rem[tmp]
    rem[tmp] += 1

print(ans)

Measured memory_bytes: 41308
#include<iostream>
#include<vector>
#include<string>
#include <algorithm>
#include <queue>
#include <climits>
#include<cmath>

bool sort_pair( std::pair< int, int > origin, std::pair< int, int > another )
{
    return origin.first < another.first;
}

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

    int count = 1;
    int c = a;

    if( b == 1 )
    {
        std::cout<< 0;
        return 0;
    }
    while( 1 )
    {
        if( b <= c )
        {
            std::cout<< count;
            return 0;
        }

        c += a - 1;
        count += 1;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  long a, b, c=0, d=0, e, f, g, h, n;
  cin >> n >> a >> b;
  if((b-a)%2==0) co((b-a)/2);
  else if(b-a==1) co(min(b-1, n-a));
  else{
    if(b-1>n-a){
      c+=n-b;
      c++;
      c+=(b-a-1)/2;
      co(c);
    }
    else{
      c+=a-1;
      c++;
      c+=(b-a-1)/2;
      co(c);
    }
  }
      
                    
  
  return 0;
}


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



int n;
int x;


int main(){
	cin >> n >> x;
	if (x == 1 || x == 2*n-1){
		puts("No");
		return 0;
	}
	set<int> s;
	for (int i = 1; i <= 2*n-1; i++){
		s.insert(i);
	}
	int len = 2 * n - 1;
	if (x > 2){
		s.erase(x);
		s.erase(1);
		s.erase(x + 1);
		s.erase(2);
		puts("Yes");
		int MED = len / 2;
		for (int i = 0; i < 2*n-1; i++,puts("")){
			if (i == MED){
				printf("%d", x);
				continue;
			}
			if (i == MED - 1){
				printf("%d", 1);
				continue;
			}
			if (i == MED + 1){
				printf("%d", x + 1);
				continue;
			}
			if (i == MED + 2){
				printf("%d", 2);
				continue;
			}
			printf("%d", (*s.begin()));
			s.erase(s.begin());
		}
	}
	else{
		s.erase(x);
		s.erase(1);
		s.erase(x + 1);
		s.erase(x+2);
		int MED = len / 2;
		puts("Yes");
		for (int i = 0; i < 2*n-1; i++,puts("")){
			if (i)printf(" ");
			if (i == MED){
				printf("%d", x);
				continue;
			}
			if (i == MED - 1){
				printf("%d", x+1);
				continue;
			}
			if (i == MED + 1){
				printf("%d", 1);
				continue;
			}
			if (i == MED + 2){
				printf("%d", x+2);
				continue;
			}
			printf("%d", (*s.begin()));
			s.erase(s.begin());
		}
	}
	return 0;
}

Measured memory_bytes: 11008
#include <bits/stdc++.h>
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef pair<int, int> pi;
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MKP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
 
const int INF = 999999;
const double EPS = 1e-10;
const double PI = acos(-1.0);
const ll MOD = 1000000007;

char S[128];
ll K;
int main(){
    cin >> S >> K;
    if(S[0]=='1'){
        bool f = false;
        REP(i,strlen(S)){

            if(S[i] != '1'){
                    cout<< S[i] << endl;
                    break;
            
            }else if (i == K - 1){
                cout << '1' << endl;
                break;
            }else{
            }
        }
    }else{
        cout << S[0] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
//g++  5.4.0

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

#define ff first
#define ss second
#define int long long
#define pb push_back
#define pii pair< int,int >
#define fast ios::sync_with_stdio(0) , cin.tie(0) , cout.tie(0) ;


signed main()
{
    fast;
    string s , t;
    cin >> s >> t;
    
    int ns = (int)(s.size());
    int nt = (int)(t.size());
    
    int dp[ ns+1 ][ nt+1 ] ;
    memset( dp,0,sizeof(dp) );
    for(int i=1 ; i<=ns ; i++ )
    {
        for(int j=1 ; j<=nt ; j++ )
        {
            if( s[i-1] == t[j-1] )
                dp[i][j] = dp[i-1][j-1] + 1;
            else
                dp[i][j] = max( dp[i-1][j] , dp[i][j-1] );
        }
    }
    
    string ans;
    int cur_a = ns;
    int cur_b = nt;
    
    while( !( cur_a == 0 && cur_b == 0 ) )
    {
        if( cur_a && cur_b )
        {
            if( dp[ cur_a ][ cur_b ] == dp[ cur_a-1 ][ cur_b-1 ] + 1 && s[ cur_a-1 ] == t[ cur_b-1 ] )
            {
                ans += s[ cur_a-1 ];
                cur_a--;
                cur_b--;
            }
            else if( dp[ cur_a ][ cur_b ] == dp[ cur_a-1 ][ cur_b ] )
                cur_a--;
            else
                cur_b--;
        }
        else 
            break;
    }
    if( (int)(ans.size()) != dp[ns][nt] )
        while(1);
    reverse( ans.begin() , ans.end() );
    cout << ans;
}





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

int main()
{
	int a, b, c, d, e, k;
	cin >> a >> b >> c >> d >> e >> k;
	if (e - a > k)
	{
		cout << ":(";
	}
	else
	{
		cout << "Yay!";
	}
}


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

int main()
{
    int n;
    vector<int> l;
    cin >> n;
    l.resize(n);
    for(int i=0; i<n; i++) cin >> l[i];

    sort(l.begin(),l.end());

    int sum(0);
    for(int i=0; i<n-1; i++){
        sum += l[i];
    }

    if(sum > l[n-1]) cout << "Yes" << endl;
    else cout << "No" << endl;

    return 0;
}

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

int main(){
	long long A, B, K;
	cin >> A >> B >> K;
	if (K < A){
		cout << A-K << " " << B;
	}
	else if (K<(A + B)){
		cout << "0 " << A + B - K;
	}
	else{
		cout << "0 " << "0";
	}
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef  long long ll;
using vll=vector<ll>;
using vvll=vector<vll>;
using vi=vector<int>;
using vvi=vector<vector<int>>;
using vb=vector<bool>;
using pii=pair<int,int>;
using vpii=vector<pair<int,int>>;
using plli=pair<ll,int>;
using vplli=vector<pair<ll,int>>;
using pllll=pair<ll,ll>;
using vpllll=vector<pair<ll,ll>>;

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

//pow(llpow,modpow)
template<class T> ll llpow(ll x,T n){ll ans=1;if(x==0)ans=0;while(n){if(n&1)ans*=x;x*=x;n>>=1;}return ans;}
long long modpow(long long a, long long n, long long mod) {long long res = 1;while (n > 0) {if (n & 1) res = res * a % mod;a = a * a % mod;n >>= 1;}return res;}
//最大公約数
template<class T> inline T gcd(T x,T y){if(y==0)return x; else {return gcd(y,x%y);}}
//最小公倍数
template<class T> inline T lcm(T x,T y){return x/gcd(x,y)*y;}
//逆元
long long modinv(long long a, long long m) {long long b = m, u = 1, v = 0;while (b) {long long t = a / b;a -= t * b; swap(a, b);u -= t * v; swap(u, v);}u %= m;if (u < 0) u += m;return u;}

#define rep(i, begin_i, end_i) for (ll i = (ll)begin_i; i < (ll)end_i; i++)
//試験導入
#define irep(i, end_i, begin_i) for (ll i = (ll)begin_i-1; i >= (ll)end_i; i--)

long long INF = 1LL<<60;
int main( ){
    int n;
    cin>>n;
    vi a(n);
    rep(i,0,n)cin>>a[i];
    int cnt=0;
    rep(i,0,n){
        if((i+1)%2&&(a[i]%2))cnt++;
    }
    cout<<cnt<<endl;
    return 0;
}




Measured memory_bytes: 3624
import Queue
blockpos = [[[0,0], [0,1], [1,0], [1,1], [2,0], [2,1], [3,0], [3,1]], [[0,0], [0,1], [0,2], [0,3], [1,0], [1,1], [1,2], [1,3]]]
dxy = [[0,1], [1,0], [0,-1], [-1,0]]
q = Queue.Queue()
W, H = 0, 0

def checker(xs, ys, xg, yg, field, color):
  if color == 0:
    return False
  global W, H
  x = xs
  y = ys
  while True:
    if x == xg and y == yg:
      return True
    for dx, dy in dxy:
      if x+dx < 1 or y+dy < 1 or x+dx > W or y+dy > H:
        continue
      if field[x+dx][y+dy] == color:
        field[x+dx][y+dy] = 0
        q.put([x+dx, y+dy])
    if q.empty():
      return False
    x, y = q.get()


while True:
  # input
  W, H = map(int, raw_input().split())
  if W==0 and H==0:
    break
  field = [[0 for i in range(H+1)] for j in range(W+1)]
  xs, ys = map(int, raw_input().split())
  xg, yg = map(int, raw_input().split())
  n = int(raw_input())
  for i in range(n):
    c, d, x, y = map(int, raw_input().split())
    for dx, dy in blockpos[d]:
      field[x+dx][y+dy] = c
  result = checker(xs, ys, xg, yg, field, field[xs][ys])
  if result:
    print "OK"
  else:
    print "NG"

Measured memory_bytes: 7172
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
const int INF = 2147483647;
const ll MOD = 1000000007;

using namespace std;

int main() {
  int n;
  string s;
  cin >> n >> s;
  if (n == 26) {
    cout << s << endl;
    return 0;
  }
  REP(i, s.length()) {
    char a = ((s[i] - 'A' + n) % 26) + 'A';
    cout << a;
  }
  cout << endl;
}


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

int main() {
    int H, A;
    cin >> H >> A;
    int ans;
    if (H%A != 0) ans = H/A+1;
    else ans = H/A;
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
import java.io.*;
import java.math.*;
import java.util.*;
public class Main {
	public static void main(String[] args) { 
		/*First ever A, last ever Z */
		FastScanner I = new FastScanner(); //Input
		OutPut O = new OutPut(); //Output
		int N = I.nextInt();
		String S = I.next();
		int ans = 0;
		int x = 0;
		for (int i = 0; i < N; i++) {
			x+=S.charAt(i)=='I'?1:-1;
			ans=max(ans,x);
		}
		O.pln(ans);
	}
	public static double max(double a, double b) {return Math.max(a, b);}
	public static double min(double a, double b) {return Math.min(a, b);}
	public static long min(long a, long b) {return Math.min(a,b);}
	public static long max(long a, long b) {return Math.max(a,b);}
	public static int min(int a, int b) {return Math.min(a,b);}
	public static int max(int a, int b) {return Math.max(a,b);}
	public static long abs(long x) {return Math.abs(x);}
	public static long ceil(long num, long den) {long ans = num/den; if (num%den!=0) 
	ans++; return ans;}
	public static long GCD(long a, long b) {
		if (a==0||b==0) return max(a,b);
		return GCD(min(a,b),max(a,b)%min(a,b));
	}
	public static long FastExp(long base, long exp, long mod) {
		long ans=1;
		while (exp>0) {
			if (exp%2==1) ans*=base;
			exp/=2;
			base*=base;
			base%=mod;
			ans%=mod;
		}
		return ans;
	}
	public static long ModInv(long num,long mod) {return FastExp(num,mod-2,mod);}
	public static int pop(long x) { //Returns number of bits within a number
		int cnt = 0;
		while (x>0) {
			if (x%2==1) cnt++;
			x/=2;
		}
		return cnt;
	}
	static class FastScanner {
		BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
		StringTokenizer st=new StringTokenizer("");
		String next() {
			while (!st.hasMoreTokens())
				try {
					st=new StringTokenizer(br.readLine());
				} catch (IOException e) {
					e.printStackTrace();
				}
			return st.nextToken();
		}
		int nextInt() {return Integer.parseInt(next());}
		long nextLong() {return Long.parseLong(next());};
		double nextDouble() {return Double.parseDouble(next());}
	}
	static class OutPut{
		PrintWriter w = new PrintWriter(System.out);
		void pln(double x) {w.println(x);w.flush();}
		void pln(boolean x) {w.println(x);w.flush();}
		void pln(int x) {w.println(x);w.flush();}
		void pln(long x) {w.println(x);w.flush();}
		void pln(String x) {w.println(x);w.flush();}
		void pln(char x) {w.println(x);w.flush();}
		void pln(StringBuilder x) {w.println(x);w.flush();}
		void pln(BigInteger x) {w.println(x);w.flush();}
		void p(int x) {w.print(x);w.flush();}
		void p(long x) {w.print(x);w.flush();}
		void p(String x) {w.print(x);w.flush();}
		void p(char x) {w.print(x);w.flush();}
		void p(StringBuilder x) {w.print(x);w.flush();}
		void p(BigInteger x) {w.print(x);w.flush();}
		void p(double x) {w.print(x);w.flush();}
		void p(boolean x) {w.print(x);w.flush();}
	}
}


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

int main() {
    ll a, v, b, w, t;
    cin >> a >> v >> b >> w >> t;

    if (abs(b - a) <= t * v - t * w)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}


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

int main(void){
  const ll MINUSINF = -1e11;
  const ll INF = 1e11;
  int A, B;
  int Q;
  cin >> A >> B;
  cin >> Q;
  ll s[A+2], t[B+2];
  s[0] = MINUSINF; s[A+1] = INF;
  t[0] = MINUSINF; t[A+1] = INF;
  for(int i=1; i<=A; i++) cin >> s[i];
  for(int i=1; i<=B; i++) cin >> t[i];
  
  for(int i=0; i<Q; i++) {
    ll x;
    cin >> x;
    ll *lA, *rA;
    rA = upper_bound(s, s+A, x);
    lA = rA - 1;
    
    ll *lB, *rB;
    rB = upper_bound(t, t+B, x);
    lB = rB - 1;
    
    ll ans = 0;
    ans = abs(x-*lA) + abs(*lA-*lB); //lA -> lB
    ans = min(ans, abs(x-*lA) + abs(*lA-*rB)); //lA -> rB

    ans = min(ans, abs(x-*rA) + abs(*rA-*lB)); //rA -> lB
    ans = min(ans, abs(x-*rA) + abs(*rA-*rB)); //rA -> rB

    ans = min(ans, abs(x-*lB) + abs(*lB-*lA)); //lB -> lA
    ans = min(ans, abs(x-*lB) + abs(*lB-*rA)); //lB -> rA

    ans = min(ans, abs(x-*rB) + abs(*rB-*lA)); //rB -> lA
    ans = min(ans, abs(x-*rB) + abs(*rB-*rA)); //rB -> rA
    
    printf("%lld\n", ans);
//    cout << ans << endl;
    
//    cout << "x: " << x << ", lA: " << *lA << ", rA: " << *rA << endl;
  }
  return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
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;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;
const db pi = acos(-1.0L);

int main(){
  ll r;
  cin >> r;
  cout << r * r * 3 << endl;
}

Measured memory_bytes: 256
function Main(input){
	var temp = input.split(" ");
	var A = parseInt(temp[0]);
	var B = parseInt(temp[1]);
	var C = parseInt(temp[2]);

	var count = Math.floor(B/A);
	if(count > C) count = C;
	console.log(count);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 11468
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
const int inf = 1e9+7;
const int INF = 1e18+7;
//26

//2000000
priority_queue<P, vector<P>, greater<P> > q1[2];
priority_queue<P> q2[2];
struct st{int x, y, c;};
vector<st> vec;
vector<P> X, Y;
//int XX[400000], YY[400000];
signed main(){
	int n, d;
	scanf("%lld%lld", &n, &d);
	rep(i,n){
		int x, y, c;
		scanf("%lld%lld%lld", &x, &y, &c);
		vec.push_back((st){x, y, c});
		X.push_back(P(c, x));
		Y.push_back(P(c, y));
	}
	sort(all(X));sort(all(Y));
	
	int ans = 0, cnt1 = 0, cnt2 = 0, dd = 0;
	while(cnt1 < n or cnt2 < n){
		P p;int f;
		if(cnt2 == n){p = X[cnt1];cnt1++;f = 0;}
		else if(cnt1 == n){p = Y[cnt2];cnt2++;f = 1;}
		else if(X[cnt1] < Y[cnt2]){p = X[cnt1];cnt1++;f = 0;}
		else {p = Y[cnt2];cnt2++;f = 1;}
		dd = p.fi;
		
		q1[f].push(P(p.se, p.fi));
		q2[f].push(P(p.se, p.fi));
		rep(i,2){
			while(!q1[i].empty() and dd-d > q1[i].top().se)q1[i].pop();
			while(!q2[i].empty() and dd-d > q2[i].top().se)q2[i].pop();
		}
		int tmp[2] = {0, 0}, mx = -1, mn = -1;
		rep(i,2){
			if(!q2[i].empty())mx = q2[i].top().fi;
			if(!q1[i].empty())mn = q1[i].top().fi;
			if(mx != -1 and mn != -1)tmp[i] = mx-mn;
		}
		ans = max(ans, tmp[0]*tmp[1]);
		//printf("%lld %lld\n", p.fi, p.se);
	}
	//cout << p;
	//printf("%lld ", p);
	//if(f == 0)
	printf("%lld\n", ans);
	return 0;
}






Measured memory_bytes: 35460
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using static System.Console;
using static System.Math;
using static MyIO;
using static MyUtil;

public class C { public static void Main() => (new Solver()).Solve(); }

public class Solver
{
	public void Solve()
	{
		var S = GetString();
		long N = S.Length;

		var code = S.Select(x => (long)(x - '0')).ToArray();
		var dp = new long[N + 1, 2];
		for(long i = 0; i <= N; i++)
		{
			for(long j = 0; j < 2; j++)
				dp[i, j] = long.MaxValue / 2;
		}
		dp[1, code[0]] = 0;
		dp[1, code[0] ^ 1] = 1;
		for(int i = 1; i < N; i++)
		{
			for(int j = 0; j < 2; j++)
			{
				if((j ^ 1) == code[i])
					chmin(ref dp[i + 1, j ^ 1], dp[i, j]);
				else
					chmin(ref dp[i + 1, j ^ 1], dp[i, j] + 1);
			}
		}
		WriteLine(Min(dp[N, 0], dp[N, 1]));
	}
}

public static class MyIO
{
	private static string[] args = new string[0];
	private static int cnt = 0;
	private static IEnumerable<string> getArgs(long N) => Range(0, N).Select(_ => getArg());
	private static string getArg()
	{
		if(cnt == args.Length) { args = Console.ReadLine().Split(); cnt = 0; }
		return args[cnt++];
	}

	public static int GetInt() => int.Parse(getArg());
	public static long GetLong() => long.Parse(getArg());
	public static double GetDouble() => double.Parse(getArg());
	public static decimal GetDecimal() => decimal.Parse(getArg());
	public static string GetString() => getArg();
	public static char GetChar() => getArg()[0];
	public static int[] GetInts(long N) => getArgs(N).Select(int.Parse).ToArray();
	public static long[] GetLongs(long N) => getArgs(N).Select(long.Parse).ToArray();
	public static double[] GetDoubles(long N) => getArgs(N).Select(double.Parse).ToArray();
	public static decimal[] GetDecimals(long N) => getArgs(N).Select(decimal.Parse).ToArray();
	public static string[] GetStrings(long N) => getArgs(N).ToArray();
}

public static class MyUtil
{
	public static void chmax<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) < 0) x = y; }
	public static void chmin<T>(ref T x, T y) where T : IComparable<T> { if(x.CompareTo(y) > 0)	x = y; }
	public static void swap<T>(ref T x, ref T y) { T tmp = x; x = y; y = tmp; }
	public static long rightShift(long x, long y) => (x >> (int)y);
	public static long leftShift(long x, long y) => (x << (int)y);
	public static bool contains(long s, long x) => (rightShift(s, x) & 1L) == 1L;
	public static long gcd(long x, long y) => (y == 0) ? x : gcd(y, x % y);
	public static long lcm(long x, long y) => (x / gcd(x,y)) * y;	
	public static IEnumerable<int> Range(long start, long count) => Enumerable.Range((int)start, (int)count);
	public static void Sort(this List<string> source) => source.Sort(StringComparer.Ordinal);
}


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

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

using ll = long long;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  ll K; std::cin >> K;
  std::unordered_map<int,int> mod;
  int s = 7, ans = 1;
  s = s%K;
  mod[s%K] = 1;
  while(1) {
    if ( s == 0 ) {
      std::cout << ans << std::endl;
      return 0;
    }
    s = (10*s+7)%K;
    ans++;
    if ( mod.count(s) != 0 ) break;
    mod[s] = 1;
  }
  std::cout << -1 << std::endl;
  return 0;
}



Measured memory_bytes: 42656
#include <algorithm>
#include <cctype>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>
using namespace std;
using ll = long long;
#define fst first
#define snd second

/* clang-format off */
template <class T, size_t D> struct _vec { using type = vector<typename _vec<T, D - 1>::type>; };
template <class T> struct _vec<T, 1> { using type = vector<T>; };
template <class T, size_t D> using vec = typename _vec<T, D>::type;
template <class T> vector<T> make_v(size_t size, const T& init) { return vector<T>(size, init); }
template <class... Ts> auto make_v(size_t size, Ts... rest) { return vector<decltype(make_v(rest...))>(size, make_v(rest...)); }
/* clang-format on */

int main() {
  string S;
  while (cin >> S) {
    bool res = true;
    res &= S[0] == 'A';
    res &= !!islower(S[1]);
    int C = 0;
    for (int i = 2; i < S.size() - 1; i++) {
      if (S[i] == 'C') {
        ++C;
      } else {
        res &= !!islower(S[i]);
      }
    }
    res &= C == 1;
    res &= !!islower(S.back());
    cout << (res ? "AC" : "WA") << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (N, K): (usize, usize) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };
    let H: Vec<i64> = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        line.split_whitespace()
            .map(|x| x.parse().unwrap())
            .collect()
    };

    let h = {
        let mut h = H.clone();
        h.insert(0, 0);
        h
    };
    const INF: i64 = 1_000_000_000_000;
    let M = N - K;
    let mut dp = vec![vec![INF; N + 1]; M + 1];
    dp[0][0] = 0;
    for i in 1..(N + 1) { for k in (1..(M + 1)).rev() { dp[k][i] = (0..i).map(|j| dp[k - 1][j] + std::cmp::max(0, h[i] - h[j])).min().unwrap(); } }
    let ans = *dp[M].iter().min().unwrap();

    println!("{}", ans);
}

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
const int ma=1e9;
main()
{
    int n,q;cin>>n>>q;
    vector<vector<int>> g(n);
    rep(i,n-1)
    {
        int a,b;cin>>a>>b;--a,--b;
        g[a].emplace_back(b);
        g[b].emplace_back(a);
    }
    vector<long long> val(n);
    rep(i,q)
    {
        int s,t;cin>>s>>t;s--;
        val[s]+=t;
    }
    auto dfs=[&](auto dfs,int u,int p)->void
    {
        for(int v:g[u])if(v!=p)
        {
            val[v]+=val[u];
            dfs(dfs,v,u);
        }
    };
    dfs(dfs,0,-1);
    rep(i,n)cout<<val[i]<<(i==n-1?'\n':' ');
    return 0;
}

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

#define FASTIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

#define endl '\n'
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second

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

/*追加部分*/



/*main関数*/

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

    cout << (a*b%2 != 0 ? "Odd" : "Even") << endl;

return 0;
}

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

int main() {
	int N;
	cin>>N;
	int a,flag=0;
	while(N>0)
	{
		a=N%10;
		if(a==7)
		{
			flag=1;
			break;
		}
		N/=10;
	}
	if(flag)
	cout<<"Yes\n";
	else
	cout<<"No\n";

	return 0;
}

Measured memory_bytes: 3604
H,W = map(int,input().split())
G=[input() for _ in range(H)]
A_u=[[0 for _ in range(W)] for _ in range(H)]
A_d=[[0 for _ in range(W)] for _ in range(H)]
A_r=[[0 for _ in range(W)] for _ in range(H)]
A_l=[[0 for _ in range(W)] for _ in range(H)]
for h in range(H):
  for w in range(1,W):
    if G[h][w-1] == '.':
      A_r[h][w] = A_r[h][w-1]+1
  for w in range(W-2,-1,-1):
    if G[h][w+1] == '.':
      A_l[h][w] = A_l[h][w+1]+1
for w in range(W):
  for h in range(1,H):
    if G[h-1][w] == '.':
      A_d[h][w] = A_d[h-1][w]+1
  for h in range(H-2,-1,-1):
    if G[h+1][w] == '.':
      A_u[h][w] = A_u[h+1][w]+1
ans=0
for h in range(H):
  for w in range(W):
    if G[h][w] == '.':
      ans = max(ans,A_r[h][w]+A_l[h][w]+A_d[h][w]+A_u[h][w]+1)
print(ans)

Measured memory_bytes: 210752
#include<stdio.h>

int main(void) {
	unsigned int	iA, iB;
	//a,bを入力
	scanf("%d %d", &iA, &iB);
	//a,bの和が2で割り切れないとき、切り上げた答えを出力
	if ((iA + iB) % 2 != 0) {
		printf("%d", (iA + iB + 1)/2);
	}
	//そうでなければそのままの結果を出力
	else {
		printf("\n%d\n", (iA + iB)/2);
	}
	return 0;
}

Measured memory_bytes: 1672
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
using namespace std;
typedef long long LL;
const int MAX=1e9;
const int N=1e6;
const int MOD=1e9+7;
int add (int x,int y)   {x=x+y;return x>=MOD?x-MOD:x;}
bool o[N];
int n,m;
int f[N];
int main()
{
	memset(o,false,sizeof(o));
	scanf("%d%d",&n,&m);
	for (int u=1;u<=m;u++)	{int x;scanf("%d",&x);o[x]=true;}
	f[0]=1;
	for (int u=1;u<=n;u++)
	{
		f[u]=f[u-1];
		if (u>=2) f[u]=add(f[u],f[u-2]);
		if (o[u]) f[u]=0;
	}
	printf("%d\n",f[n]);
	return 0;
}	

Measured memory_bytes: 3456