akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1001001001;
const int mINF = -1001001001;


int main() {
int a[5];
int ans = 0;
int a_max=0;
REP(i,5) {
  cin >> a[i];
  if(a[i]%10!=0) {
    a_max=max(a_max,10-a[i]%10);
    a[i]+=10-(a[i]%10);
  }
  ans += a[i];
}
ans-=a_max;
cout << ans << endl;
return 0;
}


Measured memory_bytes: 256
N = int(input())
a = list(map(int,input().split()))
x = ' '.join(map(str, a))
print(x)

for i in range(1,N):
	v = a[i]
	j = i - 1
	while j >= 0 and a[j] > v:
		a[j+1] = a[j]
		j = j - 1
	a[j+1] = v
	x = ' '.join(map(str, a))
	print(x)


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

using namespace std;

int main(){
  int a;
  int b;
  int c;
  int d;
  int count=0;
  cin >> a >> b >> c >> d;
  bool flag = true;
  bool ans=false;
  while(flag){
    if(count%2==0){
      c -= b;
    }
    else{
      a -= d;
    }
    if(a<=0){
      ans=true;
      flag=false;
    }
    if(c<=0){
      ans=false;
      flag=false;
    }
    count++;
  }
  
  if(!ans){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }
  return 0;
}


Measured memory_bytes: 3632
#include<stdio.h>
int main(void)
{
	int a,b,max,i,x;
	char s[10]="ABCDE";
	while(1){
		scanf("%d%d",&a,&b);
		if(a==0&&b==0) break;
		max=a+b; x=0;
		for(i=1;i<5;i++){
			scanf("%d%d",&a,&b);
			if(max<a+b){
				max=a+b;
				x=i;
			}
		}
		printf("%c %d\n",s[x],max);
	}
	return 0;
}

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

int main(){
  int A,B;
  cin >> A >> B;

  int plus, minus, mult;
  plus = A + B;
  minus = A - B;
  mult = A * B;
  
  int ans = max(plus,minus);
  ans = max(ans, mult);

  cout << ans;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const int INF = 100000000;
int i,j,k;
int main(){
    int n;cin>>n;
    vector<int> v(n);for(i=0;i<n;i++){cin>>v[i];}
    vector<int> v1,v2;
 
    for(i=0;i<n;i++){
        if(i%2==0){v1.push_back(v[i]);}
        else{v2.push_back(v[i]);}
    }
 
    vector<int> v1num(1000000,0),v2num(1000000,0);
    for(i=0;i<n/2;i++){
        v1num[v1[i]]++;
        v2num[v2[i]]++;
    }
 
    int v1max=0,v2max=0,maxnumber1,maxnumber2;
    for(i=0;i<n/2;i++){
        if(v1max<v1num[v1[i]]){v1max=v1num[v1[i]];maxnumber1=v1[i];}
        if(v2max<v2num[v2[i]]){v2max=v2num[v2[i]];maxnumber2=v2[i];}
    }
 
    int v1max_second=0,v2max_second=0;
    for(i=0;i<n/2;i++){
        if(v1max_second<v1num[v1[i]] && !(v1[i]==maxnumber1 && v1num[v1[i]]==v1max)){
            v1max_second=v1num[v1[i]];
        }
        if(v2max_second<v2num[v2[i]] && !(v2[i]==maxnumber2 && v2num[v2[i]]==v2max)){
            v2max_second=v2num[v2[i]];
        }
    }
 
    if(maxnumber1!=maxnumber2){cout<<(n-v1max-v2max)<<endl;}
    else{
        if(v1max>v2max){cout<<min(n-v1max-v1max_second,n-v1max-v2max_second)<<endl;}
        else{cout<<min(n-v2max-v1max_second,n-v2max-v2max_second)<<endl;}
    }
 
    return 0;
}

Measured memory_bytes: 9084
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<int,P>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#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 all(x) (x).begin(),(x).end()
int main(){
    int n,k;
    cin>>n>>k;
    vi vec(n);
    REP(i,n){
        cin>>vec[i];
    }
    int ans=0;
    REP(i,n){
        ans+=min(vec[i]*2,abs(k-vec[i])*2);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <sstream>
#include <limits>
#include <cmath>
#include <cstdlib>
using namespace std;

int block[100];

int main(){
  int T;
  while(~scanf("%d",&T)){
    for(int t=0;t<T;t++){
      int N;
      scanf("%d",&N);
      for(int i=0;i<N;i++){
	scanf("%d",block+i);
      }

      int up=0,down=0;
      for(int i=0;i+1<N;i++){
	int tmp;
	if((tmp = block[i+1]-block[i])>=0) up = max(up,tmp);
	else down = max(down,abs(tmp));
      }
    
      printf("%d %d\n",up,down);
    }
  }
}

Measured memory_bytes: 0
#include<iostream>
#include<vector>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<queue>
#include<deque>
#include<map>
#include<bitset>
using namespace std;
typedef long long ll;

#define rep(i, n) for(int i = 0;i < (n);i++)
#define repr(i, n) for(int i = (n);i >= 0;i--)
#define repf(i, m, n) for(int i = (m);i < (n);i++)

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1;} return 0;}
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1;} return 0;}
int dx[] = {0, 1, 0, -1}, dy[] = {1, 0, -1, 0};
//////////////////////////////////////////////////

const ll mod = 1e9+7;

// combination c;
// c(n, k); => nCk
struct combination {
    const int max = 10000000;
    vector<long long> fact, ifact, inv;
    combination() {
        fact.resize(max);   // i!
        ifact.resize(max);  // (i!)^(mod-2)
        inv.resize(max);    // i^(mod-2)
        fact[0] = fact[1] = 1;
        ifact[0] = ifact[1] = 1;
        inv[1] = 1;
        for (int i = 2; i < max; i++) {
            fact[i] = fact[i-1] * i % mod;
            inv[i] = mod - inv[mod%i] * (mod/i) % mod;
            ifact[i] = ifact[i-1] * inv[i] % mod;
        }
    }

    long long operator()(int n, int k) {
        if (n < k) return 0;
        if (k < 0 || k > n) return 0;
        return fact[n]*ifact[k]%mod*ifact[n-k]%mod;
    }
};

int main() {
    int r1,c1,r2,c2;
    cin >> r1 >> c1 >> r2 >> c2;
    combination c;

    ll s1, s2, s3, s4;
    // ans = s1 - s3 - s4 + s2
    s1 = c(c2+r2+2,c2+1) - 1;
    if (s1 < 0) s1 += mod;
    s2 = c(c1+r1,c1) - 1;
    if (s2 < 0) s2 += mod;
    s3 = c(c1+r2+1, c1) - 1;
    if (s3 < 0) s3 += mod;
    s4 = c(c2+r1+1, c2+1) - 1;
    if (s4 < 0) s4 += mod;
    ll ans = (s1 + s2) % mod;
    ans += mod;
    ans -= s3;
    ans %= mod;
    ans += mod;
    ans -= s4;
    ans %= mod;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 234624
n, m, c = map(int, input().split())

b = list(map(int, input().split()))
a_list = []
for i in range(n):
  a_list.append(list(map(int, input().split())))

ans = 0
for i in range(n):
  sum = 0
  for j in range(m):
    sum += a_list[i][j]*b[j]
  if sum + c > 0:    
    ans += 1

print(ans)

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

#define rep(i, n) for(int i = 0; i < n; i++)
using namespace std;

typedef long long ll;

const int INF = 1 << 30;
const ll LLINF = 1LL << 60;

int mod = 1000000007;

int main(void){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n; cin >> n;
    cout << n*n*n << endl;
    return 0;
}

Measured memory_bytes: 256
h,w,k = map(int, input().split())
ls = [list(input()) for i in range(h)]
ansls = [[0]*w for _ in range(h)]
absent = []
idx = 1
for i in range(h):
    if ls[i] == ['.']*w:
        absent.append(i)
    else:
        count=0
        for j in range(w):
            if ls[i][j] == "#":
                if count>0:
                    idx+=1
                count+=1
            ansls[i][j] = idx
        idx+=1

for i in absent:
    idx = i
    while idx in absent:
        idx+=1
    if idx>=h:
        idx = i
        while idx in absent:
            idx-=1
    ansls[i] = ansls[idx]

for l in ansls:
    print(*l)

Measured memory_bytes: 51928
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.util.InputMismatchException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            long n = in.nextLong();
            long m = in.nextLong();

            if (Math.abs(n - m) >= 2) {
                out.println(0);
                return;
            }

            long ans = 1;
            long MOD = 1_000_000_007;
            for (int i = 1; i <= n; i++) {
                ans = (ans * i) % MOD;
            }
            for (int i = 1; i <= m; i++) {
                ans = (ans * i) % MOD;
            }

            if (n == m) ans = (ans * 2) % MOD;
            out.println(ans);
        }

    }

    static class InputReader {
        BufferedReader in;
        StringTokenizer tok;

        public String nextString() {
            while (!tok.hasMoreTokens()) {
                try {
                    tok = new StringTokenizer(in.readLine(), " ");
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
            }
            return tok.nextToken();
        }

        public long nextLong() {
            return Long.parseLong(nextString());
        }

        public InputReader(InputStream inputStream) {
            in = new BufferedReader(new InputStreamReader(inputStream));
            tok = new StringTokenizer("");
        }

    }
}



Measured memory_bytes: 23124
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define INF (1<<30)
#define INFLL (1ll<<60)
typedef pair<ll, int> P;
#define MOD (1000000007ll)
#define l_ength size

void mul_mod(ll& a, ll b){
	a *= b;
	a %= MOD;
}

int main(void){
	int n,i,ans=0,cnt=1;
	ll a;
	vector<ll> v;
	cin >> n;
	for(i=0; i<n; ++i){
		cin >> a;
		v.push_back(a);
	}
	sort(v.begin(),v.end());
	v.push_back(0);
	for(i=0; i<n; ++i){
		if(v[i] == v[i+1]){
			cnt++;
		}else{
			ans += (cnt%2);
			cnt = 1;
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1400
#include <cstdlib>
#include <iostream>
#include <queue>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef unsigned long long u64;
typedef signed long long l64;
u64 over = 1000000007;

int main(void)
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  string s;
  cin >> s;
  int n = s.size();
  for (int i = (n-1)/2; i >= 0; --i) {
    if (s.substr(0, i) == s.substr(i, i)) {
      cout << i*2 << endl;
      return 0;
    }
  }
  return 0;
}


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

signed main() {
  int tHp, tAtk, aHp, aAtk;
  cin >> tHp >> tAtk >> aHp >> aAtk;
  
  bool tWin = false;
  while(true){
    aHp -= tAtk;
    if(aHp <= 0){
      tWin = true;
      break;
    }

    tHp -= aAtk;
    if(tHp <= 0){
      break;
    }
  }

  cout << ((tWin) ? "Yes" : "No") << endl;
}

Measured memory_bytes: 3652
#include <stdio.h>

int main (void)
{
    int n , k , a[100000],i , ans;

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

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

    for(i=1;k<n;i++)
        n = n-(k-1);

    printf("%d\n" , i);

}

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

struct ToUpper {
  char operator()(char c) { return toupper(c); }
};

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

  string out;
  out += a[0];
  out += b[0];
  out += c[0];

  transform(out.begin(), out.end(), out.begin(), ToUpper());

  cout << out << endl;
}


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

#define all(x) (x).begin(),(x).end()

#define MOD 1000000007

using namespace std;

int main(){
	int n,d;
	int ans;
	
	cin >> n >> d;
	
	ans=n/(2*d+1);
	if(n%(2*d+1))	ans++;
	
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()

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

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

std::string S, T;

int main()
{
  std::cin >> S >> T;

  if( S.size()+1 == T.size() && S == T.substr(0,S.size()) )
    std::cout << "Yes" << std::endl;
  else
    std::cout << "No" << std::endl;

  return 0;
}

Measured memory_bytes: 3040
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n-1);i>=0;i--)
#define FOR(i,n,m) for(int i=n;i<=(int)(m);i++)
#define RFOR(i,n,m) for(int i=(int)(n);i>=m;i--)
#define all(x) (x).begin(),(x).end()
#define sz(x) int(x.size())
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
const double PI=3.14159265358979323846;
using namespace std;
vector<int> dx={1,0,-1,0};
vector<int> dy={0,1,0,-1};
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int n;
    cin>>n;
    vector<int> vec(n+1,0);
    rep(i,n) {
        vec[i+1]=vec[i];
        char c;
        cin>>c;
        if(c=='.') vec[i+1]++;
    }
    int ans=INF;
    rep(i,n) {
        ans=min(ans,i-vec[i+1]+vec[n]-vec[i]);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{

  ll n;
  cin>>n;
  ll ans=1;
   ll mod=(ll)(1e9+7);
  ll res1,res2,res3;
  res1=res2=res3=1;
  
  for(int i=1;i<=n;i++)
  {
    res1=(res1*10)%mod;
    res2=(res2*9)%mod;
    res3=(res3*8)%mod;

    
  }
   ans=((res1%mod-2*res2%mod+mod)%mod+res3%mod)%mod;
  cout<<ans<<endl;
  
}


Measured memory_bytes: 3608
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll = long long;
using itn = int;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;

ll dp[100010];

int main() {

    int n;
    cin >> n;

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

    for (int i = 0; i < 100010; i++) {
        dp[i] = INF;
    }
    
    dp[0] = 0;
    dp[1] = abs(h[1] - h[0]);

    for (int i = 2; i < n; i++) {
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
    }

    cout << dp[n-1] << endl;

    return 0;
    
    

}

Measured memory_bytes: 1408
#include <stdio.h>
#include <vector>
#include <list>
#include <array>
#include <string>
#include <iostream>
#include <sstream>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <stdexcept>


using std::string;
using std::vector;


//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// util
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

std::vector<std::string> split(const std::string& input, char delimiter)
{
    std::istringstream stream(input);

    std::string field;
    std::vector<std::string> result;
    while (std::getline(stream, field, delimiter)) {
        result.push_back(field);
    }
    return result;
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// user func
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

void printList(const vector<int>& list) {
    // print
    for(int i = 0; i < list.size(); i++){
        printf("%d", list[i]);
        if(i != list.size() -1){
            printf(" ");
        }
    }
    printf("\n");
}



//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// logic
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int partition(vector<int>& list){
    int x = list.back();
    int i = -1;
    for(int j = 0; j < list.size() - 1; j++){
        if(list[j] <= x){
            i++;
            std::swap(list[i], list[j]);
        }
    }
    std::swap(list[i + 1], list[list.size() -1]);
    return i + 1;
}

void solve() {
    int n;
    scanf("%d", &n);
    vector<int> list(n);
    for(int i = 0; i < n; i++){
        int v;
        scanf("%d", &v);
        list[i] = v;
    }

    int r = partition(list);
    for(int i = 0; i < list.size(); i++){
        if(i == r) {
            printf("[%d]", list[i]);
        }else{
            printf("%d", list[i]);
        }
        if(i != list.size() - 1){
            printf(" ");
        }
    }
    printf("\n");
}


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


Measured memory_bytes: 3196
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x1=sc.nextInt();
		int y1=sc.nextInt();
		int x2=sc.nextInt();
		int y2=sc.nextInt();


		int x3 = x2-(y2-y1);
		int y3 = y2-(x1-x2);
		int x4=x3-(y3-y2);
		int y4=y3-(x2-x3);

		System.out.print(x3+" "+y3+" "+x4+" "+y4);
	}

}


Measured memory_bytes: 22100
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll dp[1001][1001];

int main(){
  ll n,k;
  cin>>n>>k;
  
  for(int i=0;i<=k;i++){
    dp[i][0]=1;
    for(int j=1;j<=n;j++){
      if(j-i>=0)
        dp[i][j]+=dp[i][j-i];

      if(i-1>=0)
        dp[i][j]+=dp[i-1][j];
      
      dp[i][j]%=mod;
    }
  }
  cout<<dp[k][n]<<endl;
  return 0;
}



Measured memory_bytes: 10912
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>

using namespace std;

#define lli long long int
#define REP(i,n) for(int i=0;i<n;i++)
#define DEBUG 1

lli target,n;
lli flag=0;

void calc(lli now,lli left,lli sum,lli *data)
{
	lli plus[3]={10000,5000,1000};
	if(sum > target)return;
	if(flag==1)return;
	if(now == 3){
		if(sum == target && left == 0){
			cout << data[0]<<" "<<data[1]<<" "<<data[2]<<endl;
			flag=1;
		}
		return ;
	}
	if(now == 2)
	{
		data[now]=left;
		calc(now+1,0,sum+left*plus[now],data);
	}
	else{
	for(lli i=left;i>=0;i--){
		data[now] = i;
		calc(now+1,left-i,sum + i*plus[now],data);
		data[now] = 0;
	}
	}
}

int main(){

	cin >> n>>target;

	lli data[3]={-1,-1,-1};

	calc(0,n,0,data);


	if(flag==0){
		cout<<"-1 -1 -1"<<endl;
	}

}

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

namespace ABC131D
{
    class Program
    {
        struct work
        {
            public int A;
            public int B;
        }
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());
            List<work> work_List = new List<work>();
            for (int i = 0; i < N; i++)
            {
                string[] input = Console.ReadLine().Split();
                work w = new work();
                w.A=int.Parse(input[0]);//仕事にかかる時間
                w.B=int.Parse(input[1]);//〆切時刻
                work_List.Add(w);
            }
            work_List.Sort((x, y) => x.B-y.B);//〆切時刻の早い順にソートする
            long sum = 0;
            long deadline = 0;
            bool checker= false;
            /*
            foreach (var item in work_List)
            {
                Console.WriteLine(item.A+" "+item.B);
            }
            */
            for (int i = 0; i < N; i++)
            {
                sum += work_List[i].A;
                deadline = work_List[i].B;
                if (sum>deadline)
                {
                    Console.WriteLine("No");
                    checker = false;//〆切時刻を越えてしまった
                    break;
                }
                else
                {
                    checker = true;
                }
            }
            if (checker==true)//〆切までに終わらせた
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


Measured memory_bytes: 19124
N = int(input())
S = [input() for _ in range(N)]

C_ac = 0
C_wa = 0
C_tle = 0
C_re = 0
for s in S:
    if s == 'AC':
        C_ac += 1
    elif s == 'WA':
        C_wa += 1
    elif s == 'TLE':
        C_tle += 1
    elif s == 'RE':
        C_re += 1

print(f'AC x {C_ac}')
print(f'WA x {C_wa}')
print(f'TLE x {C_tle}')
print(f'RE x {C_re}')


Measured memory_bytes: 79168
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def main():
    ab, bc, ca = get_int_list()
    print(ab * bc // 2)


if __name__ == '__main__':
    main()


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
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; }
const int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

int main(){
    ll a, b, n;
    cin >> a >> b >> n;
    ll x = min(b-1, n);
    cout << (a * x) / b - a * (x / b) << endl;
}



Measured memory_bytes: 3640
n,m=map(int,input().split())
if abs(n-m)>1: print(0)
else:
    mod=10**9+7
    def fact(n):
        ans=1
        for i in range(n):
            ans*=(i+1)
            ans%=mod
        return ans

    ans=(fact(n)*fact(m))%mod
    if n==m: print((2*ans)%mod)
    else: print(ans)

Measured memory_bytes: 8952
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<algorithm>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const int INF = 1001001001;
const double pi = acos(-1);

ll pow_mod(ll x, ll y) {
	ll res = 1;
	for (ll i = 0; i < y; i++) res = res * x % mod;
	return res;
}

int main() {
	int r;
	cin >> r;
	double ans = 2 * pi * r;
	printf("%.4f", ans);
	return 0;
}

Measured memory_bytes: 3716
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
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;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

vector<ll> A; //準備度
vector<ll> B; //必要
vector<ll> C;
int N;
int minuscnt;
ll totalminus;

int main() {

    cin >> N;
    A.resize(N);
    B.resize(N);
    C.resize(N);
    REP(i, N) { cin >> A[i]; }
    REP(i, N) { cin >> B[i]; }
    REP(i, N) { C[i] = A[i] - B[i]; }
    sort(C.begin(), C.end()); //マイナスだとまずい
    REP(i, N) {
        if(C[i] < 0) {
            minuscnt++;
            totalminus += C[i];
        }
    }
    if(minuscnt == 0) {
        cout << 0 << endl;
        return 0;
    }
    //準備をかえることができる
    ll bs = accumulate(B.begin(), B.end(), 0LL);
    ll as = accumulate(A.begin(), A.end(), 0LL);
    if(as < bs) {
        cout << -1 << endl;
        return 0;
    }
    int ans = minuscnt;
    ll sum = 0;
    int index = N - 1;
    while(sum < -totalminus) {
        ans++;
        sum += C[index];
        index--;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 2560
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class NewClassC
{
    static void Main(string[] args)
    {
        ABC_B();
    }

    static void ABC_A()
    {
        int[] arr = new int[] { 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51 };

        var line = Console.ReadLine().Trim();
        int k = Int32.Parse(line);
        Console.WriteLine(arr[k - 1]);
    }
    static void ABC_B()
    {
        var line = Console.ReadLine().Trim().Split(' ').ToArray();
        ulong h = ulong.Parse(line[0]);
        ulong w = ulong.Parse(line[1]);

        if (h == 1 || w == 1)
        {
            Console.WriteLine(1);
            return;
        }

        ulong odd = h / 2 + h % 2;
        ulong a = h - odd;

        ulong ww = w / 2 + w % 2;
        ulong aw = w - ww;

        ulong res = odd * ww + a * aw;
        Console.WriteLine(res);
    }
    static void ABC_C()
    {
        var line = Console.ReadLine().Trim().Split(' ').ToArray();
        ulong a = ulong.Parse(line[0]);
        ulong b = ulong.Parse(line[1]);
        ulong c = ulong.Parse(line[2]);

        if(c < (a + b)) Console.WriteLine("No");
        else if ((4 * a * b) < ((c - a - b) * (c - a - b))) Console.WriteLine("Yes");
        else Console.WriteLine("No");
    }
    static void ABC_D()
    {

    }
    static void ABC_E()
    {

    }
    static void ABC_F()
    {

    }
}


Measured memory_bytes: 13268
dp = [0] * 31
dp[0] = 1
dp[1] = 1
dp[2] = 2

for i in range(3, 31):
  dp[i] = dp[i-3] + dp[i-2] + dp[i-1]

while True:
  n = int(input())
  if n == 0:
    break
  p = dp[n] // 10 + bool(dp[n] % 10)
  print(p // 365 + bool(p % 365))
  


Measured memory_bytes: 5596
n,m,s=map(int,input().split())

# 所持銀が2500超えたら、2500になるまで銀貨捨てる
# 2500枚以上のDP表を作ると、かなりのメモリ消費するし、このケースでは2500枚あればどこでも行けるので意味ない
s=min(s,2500)

# 2501×nの[]行列
# 0~2500枚 × 頂点数
edge=[[[] for i in range(50*50+1)] for i in range(n)]

# (頂点, コスト)→(頂点, コスト)へ辺を渡っての遷移（頂点が変わる）
# u,v,a,bが与えられるたびに、edgeを更新
for i in range(m):
    u,v,a,b=map(int,input().split())
    
    # jは、保有銀貨枚数
    # j:a→2500なのは、jがa未満であれば、隣の頂点に行けないから
    for j in range(a,2501):
        edge[u-1][j].append((v-1,j-a,b))
        edge[v-1][j].append((u-1,j-a,b))
        
# (頂点, コスト)→(頂点, コスト)へ、その頂点に留まって両替の遷移（頂点変わらない）
# c,dが与えられるたびに、edgeを更新
for i in range(n):
    c,d=map(int,input().split())
      
    # 銀貨を捨てるのはノーコスト
    # 2500枚以上持ってたら、2500枚持ってることと同値と考える
    # range(2501)にしない理由は、2500枚あったら、両替はしないから
    for j in range(2500):
        if j+c>=2500:
            edge[i][j].append((i,2500,d))
        elif j+c<2500:
            edge[i][j].append((i,j+c,d))
        
from heapq import heappush,heappop,heapify

# dはn×2501のすべての状態の最小コストの表
d=[[float('inf')  for i in range(50*50+1)] for i in range(n)]

# 初期値。頂点0, 銀貨Sには、コスト0で到達
d[0][s]=0

pq = []
heappush(pq,(0,0,s))

while len(pq):
    # [コスト, 頂点, 銀貨数]で、コストをkeyとして、heapソートして、一番コストが低いリストを先頭に持ってくる
    _,u,g = heappop(pq)
    
    # 頂点までのコストが更新できれば更新してヒープに登録
    # edge[u][g]は、頂点u, 銀貨g枚の状態から、行ける状態のtuple(頂点, 銀貨数, コスト)を呼び出す
    # pqには、[コスト, 頂点, 銀貨数]の順で入れている
    for tuple in edge[u][g]:
        if d[tuple[0]][tuple[1]]>d[u][g]+tuple[2]:
            d[tuple[0]][tuple[1]]=d[u][g]+tuple[2]
            heappush(pq,[d[u][g]+tuple[2],tuple[0],tuple[1]])
        
# d[i]で、頂点iにおける保有銀貨数に応じたコストが入ったリストを呼び出せる
# リストの中で、一番小さいコストのやつを呼び出せば、その頂点に行ける最小コストと同値である
for i in range(1,n):
    print(min(d[i]))


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

namespace ConsoleApp12
{
    class Program
    {
        static void Main(string[] args)
        {
            var values1 = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int N = values1[0];

            int K = values1[1];

            long[] H = Console.ReadLine().Split().Select(long.Parse).ToArray();

            long attackCount = H.OrderByDescending(x => x).Skip(K).Sum();

            Console.WriteLine(attackCount);
        }
    }
}


Measured memory_bytes: 36928
m,k = map(int,input().split())
if m*k == 1:
  print(-1)
  exit()
  
if k == 0:
  ans = []
  for i in range(2**m):
    ans.append(i)
    ans.append(i)
  print(*ans)
  exit()
  
if 2**m <= k:
  print(-1)
else:
  ans = [k]
  chk = list(range(2**m))
  chk.remove(k)
  ans = ans+chk+[k]+chk[::-1]
  print(' '.join(map(str,ans)))

Measured memory_bytes: 29420
// 失敗するからこそ そこから立ち向かって行く強さがあってそんな強さが本当の強さだと私は思うから
#ifdef DAIJOBU
#include "/home/v-o_o-v/deb.h"
#define deb(x...) cerr << "[" << #x << "] = ["; _print(x)
#else
#include <bits/stdc++.h>
#define deb(x...)
#endif 

using namespace std;

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

	int n;
	cin >> n;
	long long a[n + 1];
	a[0] = 1;
	for(int i = 1; i <= n; i++)a[i] = a[i - 1] * i;
	cout << a[n] << '\n';
	return 0;
}
// Write Here



Measured memory_bytes: 3004
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	ll a, b, n;
	cin >> a >> b >> n;
	if (b <= n) n = b - 1;
	cout << a * n / b - a * (n / b) << '\n';
}

Measured memory_bytes: 3648
#include <iostream>
#define ll long long
#define pii pair<int, int>
#define fst first
#define snd second
using namespace std;

int main()
{
	ios :: sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n; cin >> n;
	if (n % 10 == 3) {cout << "bon\n";}
	else if (n % 10 == 0 || n % 10 == 1 || n % 10 == 6 || n % 10 == 8) {cout << "pon\n";}
	else {cout << "hon\n";}
	return 0;
}

Measured memory_bytes: 3588
date0=input().rstrip().split(" ")
date1=input().rstrip().split(" ")
list0=[]
list1=[]
for i in range(int(date0[1])):
  list0.append(int(date1[i]))
list0=sorted(list0)
for j in range(int(date0[1])-1):
  list1.append(list0[j+1]-list0[j])
list1.append(int(date0[0])-list0[int(date0[1])-1]+list0[0])
list1=sorted(list1,reverse=True)
print(int(date0[0])-list1[0])

Measured memory_bytes: 28080
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <string>
const long long mod = 1000000007;


int main() {
	int N;
	scanf("%d", &N);
	char*S = new char[N + 1];
	scanf("%s", S);
	int cnt = 0;
	for (char s1 = '0'; s1 <= '9'; s1++) {
		int p1 = 0;
		for (; p1 < N; p1++) {
			if (S[p1] == s1)break;
		}
		p1++;
		if (p1 == N)continue;
		for (char s2 = '0'; s2 <= '9'; s2++) {
			int p2 = p1;
			for (; p2 < N; p2++) {
				if (S[p2] == s2)break;
			}
			p2++;
			if (p2 == N)continue;
			for (char s3 = '0'; s3 <= '9'; s3++) {
				int p3 = p2;
				for (; p3 < N; p3++) {
					if (S[p3] == s3) {
						cnt++;
						break;
					}
				}
				p3++;
				if (p3 == N)continue;

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

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

using namespace std;

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

	int ans = min(a * n, b);
	cout << ans << endl;
	return 0;
}


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

int main() {
	double sum,a;
	int N;
	cin >> N;
	for(int i=0;i<N;i++){
		cin >> a;
		sum = sum + 1.0/a;
	}
	
	cout << 1.0/sum << endl;
	
}


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

public class Main {
    static StringTokenizer st;
    static BufferedReader br;  
    static PrintWriter out;
 
    public static void main(String[] args) throws IOException {
        br = new BufferedReader(new InputStreamReader(System.in));

        int R = nextInt();

        System.out.println(2* Math.PI * R);
       
    }
    
      
    public static int nextInt() throws IOException {
        return Integer.parseInt(next());
    }
    public static long nextLong() throws IOException {
        return Long.parseLong(next());
    }

    public static double nextDouble() throws IOException {
        return Double.parseDouble(next());
    }

    static String next() throws IOException {
        while (st == null || !st.hasMoreTokens())
            st = new StringTokenizer(br.readLine().trim());
        return st.nextToken();
    }
}

Measured memory_bytes: 33372
p=print
r=range
c=0
def a(i,j,k,l=0):
	global c
	p("+<"[l],i,j,k)
	c = c + 1
def b(i):a(i,i,i+1)
def d(x,i):
	a(x,3,x)
	for t in r(i,i+30):
		b(p:=t+1)
		a(q:=p+1,3,q)
		[*map(b,r(q,v:=i+31))]
		a(v,x,t,1)
		b(p)
		a(q,t,q)
p(3934)
a(0,1,3)
a(2,3,3,1)
d(0,9)
d(1,50)
for t in r(60):a(2,2,2);[t-31<s<30!=(a(8+t-s,50+s,5),a(3,5,6,1),a(2,6,2))for s in r(t)]

Measured memory_bytes: 9096
#include <stdio.h>
#include <vector>
#include <algorithm>

using namespace std;

int main(void){
	while(true){
		int a, b, c, N, i, j, t1, t2, t3, r;
		scanf("%d %d %d", &a, &b, &c);
		if(a == 0 && b == 0 && c == 0) return 0;
		scanf("%d", &N);

		vector< vector<int> > results;
		vector<int> ans(a+b+c+1, 2);

		for(i = 0;i < N;++i){
			vector<int> re;
			scanf("%d %d %d %d", &t1, &t2, &t3, &r);
			re.push_back(t1);re.push_back(t2);re.push_back(t3);re.push_back(r);
			results.push_back(re);

			if(r == 1){
				ans[t1] = 1;ans[t2] = 1;ans[t3] = 1;
			}
		}

		for(i = 0;i < N;++i){
			vector<int> re = results[i];
			if(re[3] == 0){
				if(ans[re[0]] == 1 && ans[re[1]] == 1){
					ans[re[2]] = 0;
				}else if(ans[re[1]] == 1 && ans[re[2]] == 1){
					ans[re[0]] = 0;
				}else if(ans[re[2]] == 1 && ans[re[0]] == 1){
					ans[re[1]] = 0;
				}
			}	
		}

		for(i = 1;i < a+b+c+1;++i) printf("%d\n", ans[i]);
	}
}


Measured memory_bytes: 2712
#include <bits/stdc++.h>
using namespace std;
 
#define clr(i, j)     memset(i, j, sizeof(i))
#define pb            push_back
 #define PI acos(-1)
typedef long long     ll;
 
//-*-*-*-*-*-*-*-*-
 
 
 
 
const int N=2e5+100;
//ll a[200000];
 

#define lop(i,n) for(int i=0;i<n;++i)
//ll n,m,mod;
ll prefix[20000];ll prefi[20000];
int main()
{
    ll n;cin>>n;
    vector<ll>v;
for(int i=0;i<n;i++){
    ll x,y;
   cin>>x;
   v.push_back({x});
}
sort(v.begin(),v.end());ll sum=0;
cout<<v[n/2]-v[n/2-1];

}

Measured memory_bytes: 1400
n,m,k = map(int, input().split())
flag=0
for i in range(n+1):
    for j in range(m+1):
        if n*j+m*i-2*i*j==k:
            print("Yes")
            flag=1
            break
    if flag:
        break
if not flag:
    print("No")

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

#define F first
#define S second
#define MP make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
#define lcm( a, b ) (a)/__gcd((a),(b))*(b)
#define endl '\n'

using namespace std;

typedef long long ll;
typedef pair< int, int > P;
typedef pair< ll, ll > LP;

static const int INF = INT_MAX;
static const ll LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const ll LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 200005;

const int dx[] = {0, -1, 1, 0};
const int dy[] = {-1, 0, 0, 1};

vector< int > Div( int n ) {
    vector< int > ret;
    for( int i = 1; i * i <= n; ++i ) {
        if( n % i == 0 ) {
            ret.pb( i );

            if( i * i != n ) ret.pb( n / i );
        }
    }
    sort( all( ret ) );
    return ret;
}

typedef unsigned long long ull;

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

    ull a, b;
    cin >> a >> b;
    if( a == b ) {
        cout << a << endl;

    } else if( (a & 1) && (b & 1) ) {
        ull d = (b - a) / 2;
        if( d & 1 ) {
            cout << (a ^ 1) << endl;

        } else {
            cout << a << endl;

        }
    } else if( (a & 1) && !(b & 1) ) {
        ull d = (b - 1 - a) / 2;
        if( d & 1 ) {
            cout << ((a ^ 1) ^ b) << endl;

        } else {
            cout << (a ^ b) << endl;

        }
    } else if( !(a & 1) && (b & 1) ) {
        ull d = (b - a + 1) / 2;
        cout << (d & 1) << endl;

    } else {
        ull d = (b - a) / 2;
        if( d & 1 ) {
            cout << (b ^ 1) << endl;

        } else {
            cout << b << endl;

        }
    }

    return 0;
}



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

int main(){
  string s,t;
  int N;
  cin>>N>>s>>t;
 if(s.length()==N&&t.length()==N&&N>=1&&N<=100){
     for(int i=0;i<N;i++){
         cout<<s[i]<<t[i];
     }
 }
   return 0;
   
}

Measured memory_bytes: 3608
#include "bits/stdc++.h"
#include <random>

using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007LL
#define llMAX 9223372036854775807LL
#define llMIN -9223372036854775808LL
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll n,k,x,y;

int main(){
  ll ans=0;
  ll D=5;
  cin>>D;
  vi c(26);
  vi last(26,-1);
  vvi data(D, vi(26));  // N * M の2次元配列
  ll factscore=0;


  for(ll i=0;i<26;i++){
    cin>>c[i];
  }
  for(ll i=0;i<D;i++){
    for(ll j=0;j<26;j++){
      cin>>data[i][j];
    }
  }


  ll sc=0;
  ll sct=0;
  ll maxid=-1;
  for(ll i=0;i<D;i++){
    sc=-922337203685477580LL;
    maxid=0;
    
    for(ll j=0;j<26;j++){
      ll l=i-last[j];
      sct=(l*l-l)/2*c[j];
      factscore-=sct;
      sct=data[i][j]+sct;
      if (sc<sct){
        sc=sct;
        maxid=j;
      }
    }
    factscore+=sc;
    last[maxid]=i;
    cout<<(maxid+1)<<endl;
  }

  //cout<<factscore<<endl;


  return 0;
}

Measured memory_bytes: 3716
def main():
    import sys
    from collections import defaultdict
    K,N=list(map(int,sys.stdin.readline().split()))
    AL=list(map(int,sys.stdin.readline().split()))
    diff=[AL[i]-AL[i-1] for i in range(1,N)]
    diff.append(K-AL[-1]+AL[0])
    print(K-max(diff))


main()

Measured memory_bytes: 25432
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()

#define PI acos(-1.0)
#define INF 1000000007

typedef long long ll; 
typedef pair<ll, ll> PL;

ll n, d, dp1, dp2, p, q;
ll t[1000], a[1000], b[1000], c[1000], MAX[1000], MIN[1000];

int main(){
	cin >> d >> n;
	REP(i, d){
		cin >> t[i];
	}
	REP(i, n){
		cin >> a[i] >> b[i] >> c[i];
	}
	REP(i, d){
		ll ma = -1, mi = 10000;
		REP(j, n){
			if (t[i] >= a[j] && t[i] <= b[j]){
				ma = max(c[j], ma);
				mi = min(c[j], mi);
			}
		}
		MAX[i] = ma;
		MIN[i] = mi;
	}
	dp1 = 0;
	dp2 = 0;
	REP(i, d - 1){
		p = dp1; q = dp2;
		dp1 = max(p + abs(MAX[i + 1] - MAX[i]), q + abs(MAX[i + 1] - MIN[i]));
		dp2 = max(p + abs(MIN[i + 1] - MAX[i]), q + abs(MIN[i + 1] - MIN[i]));
	}
	cout << max(dp1,dp2) << endl;
}

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

if N < 10:
    print(N)
elif 10 <= N and N < 100:
    print(9)
elif 100 <= N and N < 1000:
    print(N-90)
elif 1000 <= N and N < 10000:
    print(909)
elif 10000 <= N and N < 100000:
    print(N-9090)
elif 100000 == N:
    print(90909)

Measured memory_bytes: 3060
import java.util.*;
public class Main {
    public static void main(String [] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        long [] opt = new long[n];
        for(int i=0;i<n;i++) opt[i] = sc.nextLong();
        int q = sc.nextInt();
        for(int i=0;i<q;i++){
            long A [] = opt.clone();
            int b = sc.nextInt();
            int m = sc.nextInt();
            int e = sc.nextInt();
            for(int k=0;k<e-b;k++){
                if(b+k>n) break;
                else{
                    int r = (k+(e-m)) % (e-b);
                    int t = b+r;
                    opt[t] = A[b+k];
                }
            }
        }
        System.out.print(opt[0]);
        for(int i=1;i<n;i++) System.out.print(" "+opt[i]);
        System.out.println();
    }
}


Measured memory_bytes: 46420
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using ll = long long;
using p = pair<int,int>;
using Graph = vector<vector<int>>;
int main(int argc, const char * argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin>>n;
    set<int>d;
    int D;
    rep(i,n){
        cin>>D;
        d.insert(D);
    }
    cout<<d.size()<<endl;

    return 0;
}


Measured memory_bytes: 3668
#include <stdio.h>

int main(void)
{
	int x;		//Value x.
	int i;

	i = 1;
	while(1)
	{
		scanf("%d", &x);
		if(x == 0)
			return (0);
		printf("Case %d: %d\n", i, x);
		i++;
	}
	
	return (0);
}



Measured memory_bytes: 1956
n, k, q = map(int, input().split())
a = [int(input()) for i in range(q)]
ans = [k]*n
for i in range(len(a)):
    ans[a[i]-1] += 1
for i in range(len(ans)):
    ans[i] -= q
    if ans[i] > 0:
        print('Yes')
    else:
        print('No')


Measured memory_bytes: 56024
try:
    N, M = map(int, input().split())
    dp = [[0 for i in range(N)] for j in range(N)]

    for i in range(M):
        a, b = map(int, input().split())
        dp[a-1][b-1] += 1
        dp[b-1][a-1] += 1
    for k in range(len(dp)):
        print(sum(dp[k]))
except EOFError:
    pass

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).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; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    int A, B;
    char op;
    cin >> A >> op >> B;

    if (op == '+') cout << A + B << endl;
    else cout << A - B << endl;
    return 0;
}

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

int abs (int n) {
    if (n < 0) return -n;
    else return n;
}

int main() {
    int n, x, y; cin >> n >> x >> y;
    x--; y--;
    vector<int> ans(n);
    for (int start=0; start<n; start++) {
        for (int end=start+1; end<n; end++) {
            int d1, d2;
            d1 = end - start;
            d2 = abs(x-start) + abs(y-end) + 1;
            int dist = min(d1, d2);
            ans[dist]++;
        }
    }
    for (int i=1; i<n; i++) cout << ans[i] << endl;
}

Measured memory_bytes: 256
import Control.Applicative ((<$>))
import Control.Monad (replicateM, foldM, guard)
import Data.List (foldl', findIndices)

main :: IO ()
main = do
  n <- readLn
  nbd <- getLine
  solve nbd <$> replicateM n getLine >>= print

solve :: String -> [String] -> Int
solve nbd = foldl' f 0
  where f ct obd = case ixc of
                    (_:_) -> ct + 1
                    _ -> ct
          where ixs = map (\c -> findIndices (==c) obd) nbd
                ixc = foldM (\xs ys -> do
                                y <- ys
                                case xs of
                                 [] -> return [y]
                                 [x] -> do
                                   guard $ y > x
                                   return [y,x]
                                 (x1:x2:rs) -> do
                                   guard $ y > x1 && (y - x1) == (x1 - x2)
                                   return $ y:xs
                            ) [] ixs



Measured memory_bytes: 4532
import collections
import math 
N,A,B = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
print(sum(x[-A:])/A)
c = collections.Counter(x)
s=0
ans=0
for i in range(N-1,0,-1):
    t = s
    s+=c.get(x[i])
    if s>=A and t ==0:
        #print(c.get(x[i]))
        for j in range(A,min(c.get(x[i]),B)+1):
            #print(ans)
            ans+=math.factorial(c.get(x[i]))/(math.factorial(c.get(x[i])-j)*math.factorial(j))
        break
    elif s>=A:
        ans=math.factorial(c.get(x[i]))/(math.factorial(c.get(x[i])-(A-t))*math.factorial(A-t))
        break
print(int(ans))

Measured memory_bytes: 3444