akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
using Graph = vector<vector<Edge>>;
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
const ll MOD = 1000000007;
const ll nmax = 8;
const ll INF = 1e9;
bool graph[nmax][nmax];
vector<vector<ll>> dist = vector<vector<ll>>(nmax, vector<ll>(nmax, INF));
void warshall_floyd(ll n)
{
    for (size_t i = 0; i < n; i++)
    {
        for (size_t j = 0; j < n; j++)
        {
            for (size_t k = 0; k < n; k++)
            {
                dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]);
            }
        }
    }
}

class UnionFind
{
public:
    vector<ll> Parent;

    UnionFind(ll N)
    {
        Parent = vector<ll>(N, -1);
    }
    ll find(ll A)
    {
        if (Parent[A] < 0)
            return A;
        return Parent[A] = find(Parent[A]);
    }

    ll size(ll A)
    {
        return -Parent[find(A)];
    }

    bool Union(ll A, ll B)
    {
        A = find(A);
        B = find(B);
        if (A == B)
        {
            return false;
        }
        if (size(A) < size(B))
            swap(A, B);

        Parent[A] += Parent[B];
        Parent[B] = A;

        return true;
    }
};

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

ll lcm(ll a, ll b)
{
    ll g = gcd(a, b);
    return a / g * b;
}

ll mulMod(ll a, ll b)
{
    return (((a % MOD) * (b % MOD)) % MOD);
}

ll powMod(ll a, ll p)
{
    if (p == 0)
    {
        return 1;
    }
    else if (p % 2 == 0)
    {
        ll half = powMod(a, p / 2);
        return mulMod(half, half);
    }
    else
    {
        return mulMod(powMod(a, p - 1), a);
    }
}

ll ceil(ll a, ll b)
{
    return (a + b - 1) / b;
}

void solve(long long N, std::vector<long long> A)
{
    ll ans = 0;
    ll tmp = 0;

    for (int i = 0; i < N - 1; i++)
    {
        if (A[i] % 2 == 0)
        {
            ans += A[i] / 2;
        }
        else
        {
            if (A[i + 1] != 0)
            {
                ans += (A[i] + 1) / 2;
                A[i + 1]--;
            }
            else
            {
                ans += A[i] / 2;
            }
        }
    }
    ans += A[N - 1] / 2;
    cout << ans << endl;

    // for (int i = 0; i < N; i++)
    // {
    //     if (A[i] != 0)
    //     {
    //         tmp += A[i];
    //         continue;
    //     }
    //     else
    //     {
    //         ans += tmp / 2;
    //         tmp = 0;
    //     }
    // }
    // ans += tmp / 2;
    // cout << ans << endl;
}

int main()
{
    long long N;
    scanf("%lld", &N);
    std::vector<long long> A(N);
    for (int i = 0; i < N; i++)
    {
        scanf("%lld", &A[i]);
    }
    solve(N, std::move(A));
    return 0;
}


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

int main(){
  int n;
  cin >> n;
  vector<int>d(n);
  for(int i = 0; i<n; i++) cin >> d.at(i);
  int ans = 0;
  for(int i = 0; i<n; i++){
    for(int j = i+1; j<n; j++) ans += d.at(i) * d.at(j);
  }
  cout << ans << endl;
}

Measured memory_bytes: 3652
n = int(input())
a = list(map(int, input().split()))

b = []
count = 0
for i in a:
    if i < 0:
        count += 1
    b.append(abs(i))

if count % 2:
    print(sum(b) - 2 * min(b))
else:
    print(sum(b))

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

int main() {
  ll n, k; cin >> n >> k;
  ll ans = 0;
  for (ll i = k; i<=n+1; i++) {
    ll sum_mi = (i+1)*i/2 - i;
    ll sum_ma = (n+1)*n/2 - (n-i+1)*(n-i)/2;
    ans += sum_ma - sum_mi + 1;
  }
  cout << ans % 1000000007 << endl;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define all(obj) obj.begin(), obj.end()
#define debug(x) cerr << #x << ":" << x << "\n"
#define vdebug(vec) cerr << #vec << ":"; for (auto e : vec) cerr << e << " "; cout << "\n"
#define vvdebug(vv) cerr << #vv << ":\n"; for (auto vec : vv) { for (auto e : vec) cerr << e << " "; cerr << endl; }
#define YN(f) cout << (f ? "YES" : "NO") << endl
#define Yn(f) cout << (f ? "Yes" : "No") << endl
#define yn(f) cout << (f ? "yes" : "no") << endl
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;

static int MOD = 1000000007;

ll modadd(ll x, ll y) {
	int xp = x % MOD;
	if (x < 0) x += MOD;
	int yp = y % MOD;
	if (y < 0) y += MOD;
	return (x + y) % MOD;
}

ll modsub(ll x, ll y) {
	return modadd(x, -y);
}

ll modmul(ll x, ll y) {
	return x * y % MOD;
}

// power(mod) x^n
ll modpow(ll x, ll n) {
	ll res = 1;
	while (n > 0) {
		if (n & 1) res = modmul(res, x);
		x = modmul(x, x);
		n >>= 1;
	}
	return res;
}

// inverse(mod) x^(-1)
ll inv(ll x) {
	return modpow(x, MOD - 2);
}

ll moddiv(ll x, ll y) {
	return modmul(x, inv(y));
}

// factorial(mod) n!
ll fact(ll n) {
	ll res = 1;
	while (n > 1) {
		res = modmul(res, n);
		n--;
	}
	return res;
}

// permutation(mod) nPr
ll permu(ll n, ll r) {
	if (r < 0 || n < r) return 0;
	else {
		ll res = fact(n);
		res = moddiv(res, fact(n - r));
		return res;
	}
}

// combination(mod) nCr
ll combi(ll n, ll r) {
	ll res = permu(n, r);
	res = moddiv(res, fact(r));
	return res;	
}

ll myfact(int n, int k) {
	ll res = 1;
	rep(i, k) {
		res = modmul(res, n - i);
	}
	return res;
}

ll mycombi(int n, int r) {
	ll res = 1;
	res = moddiv(myfact(n, r), myfact(r, r));
	return res;
}

int main () {
	int n, a, b; cin >> n >> a >> b;
	// debug(n); debug(a); debug(b);
	ll ans = modpow(2, n) - 1;
	ll x = mycombi(n, a);
	ll y = mycombi(n, b);
	// debug(x); debug(y);
	ans = modsub(ans, modadd(x, y));	
	cout << ans << endl;
}

Measured memory_bytes: 256
//AtCoder 4522 - Frog 1

#include <bits/stdc++.h>

using namespace std;

#define endl "\n"
typedef long long int lli;

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

int n,k;

lli memo[100001];
lli dp(int pos, vector<int> &v){
	if(pos == v.size()-1)
		return 0;

	if(memo[pos] != -1)
		return memo[pos];

	lli ans = dp(pos+1,v)+abs(v[pos+1]-v[pos]);
	for(int i=2; i<=k; i++)
		if(pos+i < v.size())
			ans = min(ans, dp(pos+i,v)+abs(v[pos+i]-v[pos]));

	return memo[pos] = ans;
}

int main(){
	cin >> n >> k;
	vector<int> v(n);
	for(auto &x:v) cin >> x;

	memset(memo, -1, sizeof(memo));
	cout << dp(0, v) << endl;

	return 0;
}


Measured memory_bytes: 9216
#include <iostream>
#include <algorithm>
using namespace std;
long long f[100001],w[1000],v[1000];
int n,W;
int main()
{
    cin>>n>>W;
    for (int i=0;i<n;++i) cin>>w[i]>>v[i];
    for (int i=0;i<n;++i){
        for (int j=W;j>=w[i];--j){
            f[j]=max(f[j],f[j-w[i]]+v[i]);
        }
    }
    cout<<f[W];
}


Measured memory_bytes: 1024
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

int main() {
    long long n, c;
    cin >> n >> c;

    vector<long long> x(n), v(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> v[i];
    }

    vector<long long> l0(n + 1, 0), l1(n + 1, 0);
    l0[1] = v[n - 1] - (c - x[n - 1]);
    l1[1] = v[n - 1] - 2 * (c - x[n - 1]);
    for (int i = 2; i <= n; i++) {
        l0[i] = l0[i - 1] + (c - x[n - i + 1]) + v[n - i] - (c - x[n - i]);
        l1[i] = l1[i - 1] + 2 * (c - x[n - i + 1]) + v[n - i] - 2 * (c - x[n - i]);
    }

    vector<long long> l0_max(n + 1, 0), l1_max(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        l0_max[i] = max(l0_max[i - 1], l0[i]);
        l1_max[i] = max(l1_max[i - 1], l1[i]);
    }

    vector<long long> r0(n + 1, 0), r1(n + 1, 0);
    r0[1] = v[0] - x[0];
    r1[1] = v[0] - 2 * x[0];
    for (int i = 2; i <= n; i++) {
        r0[i] = r0[i - 1] + x[i - 2] + v[i - 1] - x[i - 1];
        r1[i] = r1[i - 1] + 2 * x[i - 2] + v[i - 1] - 2 * x[i - 1];
    }

    vector<long long> r0_max(n + 1, 0), r1_max(n + 1, 0);
    for (int i = 1; i <= n; i++) {
        r0_max[i] = max(r0_max[i - 1], r0[i]);
        r1_max[i] = max(r1_max[i - 1], r1[i]);
    }

    long long res = 0;
    for (int i = 0; i <= n; i++) {
        res = max(res, max(l0_max[i] + r1_max[n - i], l1_max[i] + r0_max[n - i]));
    }

    cout << res << endl;
}


Measured memory_bytes: 8064
#include <bits/stdc++.h>
using namespace std;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    vector <vector <int> > G(n);
    for(int i = 0; i < n; ++i){
        string v;
        cin >> v;
        for(int j = 0; j < n; ++j){
            if(v[j] == '1'){
                G[i].push_back(j);
                G[j].push_back(i);
            }
        }
    }
    int best = 0, resBest = 0, trt = 0;
    bool isBip = 1;
    for(int g = 0; g < n; ++g)
    {
        queue <int> Q;
        vector <int> vis(n);
        vector <int> dist(n);
        vector <int> color(n);
        Q.push(g);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            vis[v] = 1;
            for(int u : G[v]){
                if(!vis[u]){
                    dist[u] = dist[v] + 1;
                    if(dist[u] > dist[best]){
                        best = u;
                    }
                    vis[u] = 1;
                    Q.push(u);
                    color[u] = dist[u]&1;
                }
                if((color[u] == color[v]) && vis[u] && vis[v])isBip = 0;
            }
        }
        if(dist[best] > resBest){
            trt = g;
            resBest = dist[best];
        }
    }
        queue <int> Q;
        vector <int> vis(n);
        vector <int> dist(n);
        Q.push(trt);
        while(!Q.empty()){
            int v = Q.front();
            Q.pop();
            vis[v] = 1;
            for(int u : G[v]){
                if(!vis[u]){
                    dist[u] = dist[v] + 1;
                   if(dist[u] > dist[best]){
                        best = u;
                    }
                    vis[u] = 1;
                    Q.push(u);
                }
            }
        }

    if(isBip){
        cout << dist[best] + 1 << '\n';
    }
    else cout <<"-1\n";
}

Measured memory_bytes: 640
# coding: utf-8
# Your code here!

from collections import defaultdict

N = int(input())
X = []
for _ in range(N):
    X.append(list(map(int, input().rstrip().split(' '))))

max_count = 0
d = defaultdict(lambda: defaultdict(int))
for i in range(N):
    for j in range(i+1, N):
        d[X[i][0] - X[j][0]][X[i][1] - X[j][1]] += 1
        max_count = max(max_count, d[X[i][0] - X[j][0]][X[i][1] - X[j][1]])
        d[X[j][0] - X[i][0]][X[j][1] - X[i][1]] += 1
        max_count = max(max_count, d[X[j][0] - X[i][0]][X[j][1] - X[i][1]])
        
print(N - max_count)

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

int main(){
    int n;
    cin >> n;
    vector <string>Name = {};
    vector <int>Number = {};
    int i;
    for(i = 0;i < n;i++){
        string s;
        cin >> s;
        int j;
        for(j = 0;j < Name.size();j++){
            if(s == Name.at(j)){
                Number.at(j)++;
                break;
            }
        }
        if(j == Name.size()){
            Name.push_back(s);
            Number.push_back(1);
        }
    }
    int m;
    cin >> m;
    for(i = 0;i < m;i++){
        string t;
        cin >> t;
        int j;
        for(j = 0;j < Name.size();j++){
            if(t == Name.at(j)){
                Number.at(j)--;
                break;
            }
        }
        if(j == Name.size()){
            Name.push_back(t);
            Number.push_back(-1);
        }
    }
    
    int max = 0;
    for(i = 0;i < Number.size();i++){
        if(max < Number.at(i)){
            max = Number.at(i);
        }
    }

    cout << max << endl;

}

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

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static int Calc(int n) {
        long ans = 1;
        int mod = (int)1e9 + 7;
        for (int i = 2; i <= n; i++) {
            ans = (ans * i) % mod;
        }
        return (int)ans;
    }

    static void Main() {
        int n = ReadInt();
        Console.WriteLine(Calc(n));
    }
}

Measured memory_bytes: 11092
S = input()
ans = 0
for i in range(len(S)):
    for j in range(len(S)-i):
        ACGT = True
        for k in range(len(S)-i-j):
            if S[i:len(S)-j][k] != 'A' and S[i:len(S)-j][k] != 'G' and S[i:len(S)-j][k] != 'C' and S[i:len(S)-j][k] != 'T':
                ACGT = False
                break
        if ACGT and len(S)-i-j > ans:
            ans = len(S)-i-j
print(ans)


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

const int N = 40;
const int LMT = 17;
const int MOD = 1e9 + 7;

int pwr[N+5];
int dp[N+1][1<<LMT];
int x,y,z,n;

void prec() {
	pwr[0] = 1;
	for(int i = 1;  i <= N ; i++) {
		pwr[i] = (10ll * pwr[i-1]) % MOD;
	}
	memset(dp,-1,sizeof dp);
}

int solve(int sisa,int msk) {
	if(sisa == 0) return 0;
	int &ret = dp[sisa][msk];
	if(ret != -1) return ret;
	ret = 0;
	for(int i = 1 ; i <= 10 ; i++) {
		int zz = z - i;
		int yz = zz + y;
		int xyz = yz + x;
		if(zz >= 0 && (msk & (1<<zz)) > 0 && (msk & (1<<yz)) > 0 && (msk & (1<<xyz)) > 0)
			ret = (ret + pwr[sisa-1]) % MOD;
		else {
			int nexMask = msk << i;
			nexMask &= ((1<<LMT) - 1);
			nexMask |= 1;
			ret = (ret + solve(sisa-1,nexMask)) % MOD;
		}
	}
	return ret;
}

int main() {
	prec();
	cin >> n >> x >> y >> z;
	cout << solve(n,1) << endl;
	return 0;
}

Measured memory_bytes: 21248
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
int main(){
	int t,d,ta,tb,da,db;
	cin>>t>>d>>ta>>tb>>da>>db;
	double mi=inf;
	int sa=0;
	while(sa<=d){
		int sb=0;
		while(sa+sb<=d){
			double q=(double)(ta*sa+tb*sb)/(sa+sb);
			if(mi>abs(t-q))mi=abs(t-q);
			sb+=db;
		}
		sa+=da;
	}
	printf("%.6f\n",mi);
}

Measured memory_bytes: 1196
// luogu-judger-enable-o2
#include <bits/stdc++.h>
using namespace std;
int main()
{
    long long x,a,b,c,ans=0;
    cin>>a>>b>>c>>x;
    for(int i=0;i<=a;i++)
        for(int j=0;j<=b;j++)
            for(int z=0;z<=c;z++)
			{
                int k=i*500+j*100+z*50;
                if(k==x)
                   ans++;
                if(k>x)
                   break;
            }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
package main
import (
	"fmt"
	"math"
)

func main(){
	var n int
	fmt.Scan(&n)
	a := make([]int, n)
	for i:=0; i<n; i++{
		var _a int
		fmt.Scan(&_a)
		a[i] = _a
	}
	b := make([]int, n)
	for i:=0; i<n; i++{
		var _b int
		fmt.Scan(&_b)
		b[i] = _b
	}
	for i:=1; i<=4; i++{
		mincofusukii(a, b, i)
	}
}

func mincofusukii(a []int, b []int, c int){
	var ans float64
	if c<4{
		for i:=0; i<len(a); i++{
			ans+=math.Pow(math.Abs(float64(a[i])-float64(b[i])), float64(c))
		}
		ans = math.Pow(ans, 1.0/float64(c))
	}else{
		for i:=0; i<len(a); i++{
			ans = math.Max(ans, math.Abs(float64(a[i])-float64(b[i])))
		}
	}
	fmt.Println(ans)
}


Measured memory_bytes: 1188
#include <iostream>
#include <vector>
#include <unordered_map>

std::vector<int> to[200005];
std::unordered_map<unsigned int, unsigned long> counter_map;
std::unordered_map<unsigned int, unsigned long> score_map;

void dfs(int node, int parent, unsigned long current) {
  if (counter_map.count(node) != 0) {
    current += counter_map.at(node);
  }
  score_map.at(node) = current;
  const std::vector<int>& children = to[node];
  // childrenがいない末端から進んでいく
  for (size_t i = 0; i < children.size(); ++i) {
    const int& child = children.at(i);
    if (child == parent) {
      continue;
    }
    dfs(child, node, current);
  }
}

int main() {
  unsigned int N, Q;
  std::cin >> N >> Q;

  for (unsigned int i = 0; i < N - 1; ++i) {
    unsigned int a, b;
    std::cin >> a >> b;
    a -= 1;
    b -= 1;
    to[a].push_back(b);
    to[b].push_back(a);
  }

  for (unsigned int i = 0; i < Q; ++i) {
    unsigned int p, x;
    std::cin >> p >> x;
    p -= 1;
    if (counter_map.count(p) == 0) {
      counter_map.emplace(p, x);
    } else {
      counter_map.at(p) += x;
    }
  }

  for (unsigned int i = 0; i < N; ++i) {
    score_map.emplace(i, 0);
  }

  dfs(0, -1, 0);

  for (unsigned int i = 0; i < N; ++i) {
    std::cout << score_map.at(i);
    if (i != N - 1) {
      std::cout << " ";
    }
  }
  std::cout << std::endl;

  return 0;
}


Measured memory_bytes: 45256
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int count = 0;
        for(int i = 0; i < n; i++){
            int m = s.nextInt();
            boolean result = isprime(m);
            if(result == true){
                count++;
            }
        }
        System.out.println(count);
    }
    public static Boolean isprime(int x){
        if(x == 2){
            return true;
        }else if(x < 2 || x % 2 == 0){
            return false;
        }else{
            for(int i = 3; i <= Math.sqrt(x);i += 2){
                if(x % i == 0){
                    return false;
                }
            }
        }
        return true;
    }
}


Measured memory_bytes: 40932
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		while(true){
			int n = sc.nextInt();
			int r = sc.nextInt();
			if((n|r)==0)break;
			int p, c, t;
			LinkedList<Integer> list = new LinkedList<Integer>();
			for(int i=0;i<n;i++){
				list.add(i+1);
			}
			for(int i=0;i<r;i++){
				p = sc.nextInt();
				c = sc.nextInt();
				for(int j=0;j<c;j++){
					t = list.get(n-p-c+1);
					list.remove(n-p-c+1);
					list.add(t);
				}
			}
			System.out.println(list.get(n-1));
		}
	}
}

Measured memory_bytes: 33000
#include <iostream>
#include <algorithm>
#include <vector>
#include <string.h>
#include <string>
#include <cmath>

using namespace std;

bool isPali(int a) {
  string s = to_string(a);
  string s1 = s;
  reverse(begin(s1), end(s1));
  return s1 == s;
}

int main() {
  int a, b;
  cin >> a >> b;
  int res = 0;
  while (a <= b) {
    if (isPali(a)) 
      ++res;
    ++a;
  }
  cout << res;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define boost  ios_base::sync_with_stdio(0);
#define N 1000
#define ll long long int
#define pb push_back
#define f first
#define s second
#define fo(i,a,b) for(i = a; i < b; i++)
#define foe(i, a,b) for(i = a; i <= b; i++)
#define tc long long int t; cin >> t; while(t--)
#define vect vector <ll>
#define pll pair<ll,ll>
#define vpll vector<pair<ll,ll>>

ll lcs(string s, string s2, ll n, ll n2){
	if(n == 0 || n2 == 0){
		return 0;
	}
	if(s[n] == s2[n2])
		return 1+lcs(s,s2,n-1,n2-1);
	else
		return max(lcs(s,s2,n-1,n2),lcs(s,s2,n,n2-1));
}
string lcsdp(string s, string s2, ll n, ll n2){
	ll dp[n+1][n2+1];
	ll i,j;
	foe(i,0,n){
		foe(j,0,n2){
			if(i == 0 || j == 0)
				dp[i][j] = 0;
			else if(s[i-1] == s2[j-1]){
				dp[i][j] = 1+dp[i-1][j-1];
			}
			else
				dp[i][j] = max(dp[i-1][j],dp[i][j-1]);

		}
	}
  string res="";
   i=n,j=n2;
   while (i > 0 && j > 0)
   {
      if (s[i-1] == s2[j-1])
      {
          res+=s[i-1]; // Put current character in result
          i--; j--;
      }
      // If not same, then find the larger of two and
      // go in the direction of larger value
      else if (dp[i-1][j] > dp[i][j-1])
         i--;
      else
         j--;
   }
   reverse(res.begin(),res.end());
   return res;
}
int main(){
	boost;
	string str1,str2;
	ll n,n2;
	cin >> str1>> str2;
	n = str1.length();
	n2 = str2.length();
	cout << lcsdp(str1,str2,n,n2) <<endl;


	return 0;
}


Measured memory_bytes: 70656
using System;
using System.Collections.Generic;
using System.Linq;
namespace ITP1_5_C
{
    class Problem
    {

        public static List<string[]> getinputdata (){

            List<string[]> list_temp = new List<string[]>();
            string strdata = Console.ReadLine ();

            while (strdata!=null) {

                string[] s_temp = strdata.Split (' ');

                list_temp.Add (s_temp);

                strdata = Console.ReadLine ();

            }
            return list_temp;
        }

        public static string DrawChess (int h,int w,ref bool flg){

            string s = string.Empty;
            
            //????±?????????°??????????????????
            for (int j = 0; j < h; j++)
            {

                //?\???°????????´???(#????????????)
                if(flg){

                    s+=RectanaleDraw(w,flg) +Environment.NewLine;

                    flg=false;

                    //??¶??°????????´???(.????????????)
                }else{
                    
                    s+=RectanaleDraw(w, flg) +Environment.NewLine;

                    flg=true;
                }

            }

           // s += Environment.NewLine;

            return s;
        }

        public static string  RectanaleDraw (int w,bool chkflg){

            string s1 = "";
            for (int j = 0; j < w; j++)
            {
                if (chkflg)
                {
                    s1 += "#";
                    chkflg = false;
                }
                else
                {
                    
                    s1 += ".";
                    chkflg = true;
                
                }

            }
            return s1;

        }


        public static void Main (string[] args)
        {
            List<string[]> list_result = new List<string[]>();
            list_result = getinputdata ();


            int H;
            int W;

            //????±????rec??°????????????
            for (int i = 0; i < list_result.Count-1; i++)
            {

                bool flg = true;
                H = int.Parse(list_result[i][0]);
                W = int.Parse(list_result[i][1]);

                if (H != 0 && W != 0)
                {

                    Console.WriteLine(DrawChess(H, W, ref flg));

                }
            }
          
        }
    }
}

Measured memory_bytes: 9468
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling, digitDP//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal ,RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vl flag, D; vpll path;
//***********//
int main() { 
	MOD = 998244353;
	ll S;
	cin >> N >> S;
	vl A(N);
	for (i = 0; i < N; i++) {
		cin >> A[i];
	}
	vector<vll> dp(N + 1, vll(S + 1,vl(3,0)));
	dp[0][0][0] = 1;
	for (i = 0; i < N; i++) {
		for (j = 0; j <= S; j++) {
			if (j == S) {
				(dp[i + 1][S][2] += dp[i][S][2]) %= MOD;
				(dp[i + 1][S][2] += dp[i][S][1]) %= MOD;
				(dp[i + 1][S][1] += dp[i][S][1]) %= MOD;
			}
			else {
				(dp[i + 1][j][1] += dp[i][j][1]) %= MOD;
				(dp[i + 1][j][1] += dp[i][j][0]) %= MOD;
				(dp[i + 1][j][0] += dp[i][j][0]) %= MOD;
			}
			if (j + A[i] <= S) {
				if (j + A[i] == S) {
					(dp[i + 1][j + A[i]][2] += dp[i][j][0]) %= MOD;
					(dp[i + 1][j + A[i]][2] += dp[i][j][1]) %= MOD;
				}
				(dp[i + 1][j + A[i]][1] += dp[i][j][0]) %= MOD;
				(dp[i + 1][j + A[i]][1] += dp[i][j][1]) %= MOD;
			}
		}
	}
	cout << dp[N][S][2];
}

Measured memory_bytes: 493056
#pragma GCC optimize ("O2")
#pragma GCC target ("avx2")
//#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int CM = 1 << 17, CL = 12;
char cn[CM + CL], * ci = cn + CM + CL, * owa = cn + CM, ct;
const ll ma0 = 1157442765409226768;
const ll ma1 = 1085102592571150095;
const ll ma2 = 71777214294589695;
const ll ma3 = 281470681808895;
const ll ma4 = 4294967295;
inline int getint() {
	if (ci - owa > 0) {
		memcpy(cn, owa, CL);
		ci -= CM;
		fread(cn + CL, 1, CM, stdin);
	}
	ll tmp = *(ll*)ci;
	int dig = 68 - __builtin_ctzll((tmp & ma0) ^ ma0);
	tmp = tmp << dig & ma1;
	tmp = tmp * 10 + (tmp >> 8) & ma2;
	tmp = tmp * 100 + (tmp >> 16) & ma3;
	tmp = tmp * 10000 + (tmp >> 32) & ma4;
	ci += 72 - dig >> 3;
	return tmp;
}


const int dm = 1400000;
char dn[dm], * di = dn;
const int MAX = 20000;
class unko {
public:
	char C[MAX * 7 + 10], *K[MAX + 10];
	constexpr unko() : C(), K() {
		auto di = C + 3;
		C[0] = '0';
		C[0] = ' ';
		C[0] = '\n';
		K[0] = C;
		K[1] = di;
		rep1(i, MAX) {
			int X = i;
			int keta = 0;
			char c[10] = {};
			while (X) {
				*(c + keta) = '0' + X % 10;
				X /= 10;
				keta++;
			}
			for (int j = keta - 1; j >= 0; j--)* di++ = (*(c + j));
			*di++ = ' ';
			*di++ = '\n';
			K[i + 1] = di;
		}
	}
};
constexpr unko f;
inline void putint(int X) {
	if (X > 20000) {
		int ue = X / 10;
		for (auto i = f.K[ue]; *i != ' '; i++) *di++ = *i;
		*di++ = '0' + X % 10;
		*di++ = ' ';
	}
	else for (auto i = f.K[X]; *i != '\n'; i++)* di++ = *i;
}

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


	int N = getint(), K = getint();

	int A[200001];
	rep(i, N) A[i] = getint();
	ll owa = ll(N) * N;

	rep(p, K) {
		int B[200001] = {};
		rep(i, N) {
			B[max(0, i - A[i])]++;
			B[min(N, i + A[i] + 1)]--;
		}
		ll kei = B[0];
		A[0] = B[0];
		rep1(i, N - 1) {
			kei += (A[i] = A[i - 1] + B[i]);
		}
		if (kei == owa) break;
	}

	rep(i, N) putint(A[i]);
	fwrite(dn, 1, di - dn, stdout);

	Would you please return 0;
}

Measured memory_bytes: 7376
#include <iostream>
#include <map>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>

using namespace std;
#define int long long

#define fr(s,n,i) for(int i=s;i<n;i++)
#define fr_(s,n,i) for(int i=s;i>=n;i--)
#define srt(v) sort(v.begin(), v.end())
#define upr(v, aim, ind) int ind; ind=(int)distance(v.begin(), upper_bound(v.begin(),v.end(), aim));
#define sz(v) (int)v.size()
#define ers(v, i) v.erase(v.begin() + i)
#define swp(v, i, j) int buf = v[j]; v[j] = v[i]; v[i] = buf;
#define shout(a) cout << a << endl;
#define dshout(a) printf("%.16f\n", a);
#define vi vector<int>
#define iinp(a) int a; cin >> a;
#define sinp(a) string a; cin >> a;
#define dinp(a) double a; cin >> a;

int MOD = 1000000007;

void solve();

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

void solve(){
    iinp(N)
    double ans=0;
    fr(0,N,i){
        dinp(x)sinp(u) 
        if(u == "JPY"){
            ans += x;
        } else {
            ans += 380000*x;
        }
    }
    dshout(ans)
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <queue>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

#define REP(i,n) for(int i=0;i<(int)(n);i++)

using namespace std;

typedef double Weight;

const double INF = 1e+10;
int N;

struct Edge{
  int src, dest; Weight weight;
  bool operator < (const Edge &rhs) const {return weight < rhs.weight;}
};

struct UnionFind {
  vector<int> p;
  UnionFind (int n) { p.assign(n, -1); }
  int root(int x) { return p[x] < 0 ? x : p[x] = root(p[x]); }
  void merge(int x, int y) { if (root(x) != root(y)) p[root(y)] = x; }
};

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

Edges kruskal(Edges &es) {
	sort(es.begin(), es.end()); 
	UnionFind uf(N);
	Edges res;
	REP(i, es.size()) {
		Edge e = es[i];
		if(uf.root(e.src) != uf.root(e.dest)) {
			uf.merge(e.src, e.dest);
			res.push_back(e);
		}
	}
	return res;
}

int main() {
  int n,m;
  cin>>n>>m;
  vector<int> x(n);
  vector<int> y(n);
  REP(i,n)cin>>x[i]>>y[i];
  Edges g;
  double wsum = 0;
  REP(i,m){
    int p,q;
    cin>>p>>q;
    --p;--q;
    int dx = x[p]-x[q];
    int dy = y[p]-y[q];
    g.push_back({p,q,40000-sqrt(dx*dx+dy*dy)});
    wsum += sqrt(dx*dx+dy*dy);
  }
  N = n;
  auto trr = kruskal(g);
  for(auto e:trr)
    wsum -= 40000-e.weight;
  cout << setprecision(8) << fixed << wsum << endl;
  return 0;
}

Measured memory_bytes: 2144
H,W=map(int,input().split())
S=[list(input())for _ in range(H)]

from collections import deque
def bfs(h,w,sy,sx,gy,gx,S):
    maze=[[10**9]*(W)for _ in range(H)]
    maze[sy-1][sx-1]=0
    que=deque([[sy-1,sx-1]])
    while que:
        y,x=que.popleft()
        for i,j in [(1,0),(0,1),(-1,0),(0,-1)]:
            nexty,nextx=y+i,x+j
            if 0<=nexty<h and 0<=nextx<w:
                dist1=S[nexty][nextx]
                dist2=maze[nexty][nextx]
            else:
                continue
            if dist1!='#':
                if dist2>maze[y][x]+1:
                    maze[nexty][nextx]=maze[y][x]+1
                    que.append([nexty,nextx])
    return maze[gy-1][gx-1]+1

A=0
for s in S:
    A+=s.count('.')

B=bfs(H,W,1,1,H,W,S)
if B>10**9:
    ans=-1
else:
    ans=A-B
print(ans)

Measured memory_bytes: 9404
// B
#include <stdio.h>
#include <stdlib.h>

int main(void){
	int n;
	long d;
	scanf("%d %ld", &n, &d);
	long x, y;
	int sum = 0;
	d *= d;
	for(int i = 0; i < n; i++){
		scanf("%ld %ld", &x, &y);
		if(x * x + y * y <= d)sum++;
	}
	printf("%d\n", sum);
	return 0;
}


Measured memory_bytes: 2152
const input = require("fs").readFileSync("/dev/stdin", "utf8").split("\n");

const N = input[0]

result = 'No'
for (i = 1; i <= 9; i++) {
    for (j = 1; j <= 9; j++) {
        if (i * j == N) {
            result = 'Yes'
        }
    }
}

console.log(result)


Measured memory_bytes: 7372
import math
n, d = map(int, input().split())
x_list = [list(map(int, input().split())) for _ in range(n)]
ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        if math.sqrt(sum([(y - z) ** 2 for y, z in zip(x_list[i], x_list[j])])).is_integer():
            ans += 1
print(ans)

Measured memory_bytes: 3064
s = list(input())
l = len(s)
key = ['k', 'e', 'y', 'e', 'n', 'c', 'e']

# 'keyence' or 'keyence___'
ans_1 = True
for i in range(7):
    if s[i] == key[i]:
        pass
    else:
        ans_1 = False
if ans_1:
    print('YES')
    exit()
else:
    if l == 7:
        print('N0_1')
        exit()

# '___keyence'
ans_2 = True
for i in range(7):
    if s[l-7+i] == key[i]:
        pass
    else:
        ans_2 = False
if ans_2:
    print('YES')
    exit()

# 'k...___...e'
idx = 0
for i in range(7):
    if s[i] == key[i]:
        pass
    else:
        idx = i-1
        break
for i in range(6-idx):
    if s[l-6+idx+i] == key[idx+1+i]:
        pass
    else:
        print('NO')
        exit()
print('YES')

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

struct RollingHashUnit_MT {
    using hash_t = uint_fast64_t;
    const hash_t Mod = ((hash_t)1 << 61) - 1;
    const hash_t Mask30 = ((hash_t)1 << 30) - 1, Mask31 = ((hash_t)1 << 31) - 1;
    const hash_t Base = 1007;
    constexpr hash_t mul(hash_t a, hash_t b) const {
        hash_t au = a >> 31, ad = a & Mask31, bu = b >> 31, bd = b & Mask31, mid = au * bd + bu * ad;
        return (2 * au * bu + (mid >> 30) + ((mid & Mask30) << 31) + ad * bd);
    }
    constexpr hash_t mod(hash_t a) const { a = (a >> 61) + (a & Mod); return a < Mod ? a : a - Mod; }
};

template<class RollingHashUnit>
struct RollingHash {
    using hash_t = typename RollingHashUnit::hash_t;
    const RollingHashUnit rhunit = RollingHashUnit();
    vector<hash_t> hash, power;
    template<class String> void build(const String& s) {
        int n = s.size();
        hash.resize(n + 1); hash[0] = 0;
        power.resize(n + 1); power[0] = 1;
        for (int i = 0; i < n; ++i) {
            hash[i + 1] = rhunit.mod(rhunit.mul(hash[i], rhunit.Base) + (hash_t)s[i]);
            power[i + 1] = rhunit.mod(rhunit.mul(power[i], rhunit.Base));
        }
    }
    hash_t get(int l, int r) { return rhunit.mod(hash[r] - rhunit.mul(hash[l], power[r - l]) + 3 * rhunit.Mod); }
    hash_t concat(hash_t h1, hash_t h2, int h2_len) { return rhunit.mod(rhunit.mul(h1, power[h2_len]) + h2); }
};

int main() {
    string T, P;
    cin >> T >> P;

    RollingHash<RollingHashUnit_MT> rh_t, rh_p;
    rh_t.build(T); rh_p.build(P);
    for (int i = 0; i + (int)P.size() <= (int)T.size(); ++i) {
        if (rh_t.get(i, i + P.size()) == rh_p.get(0, P.size())) {
            cout << i << endl;
        }
    }
}



Measured memory_bytes: 19824
#include <iostream>
#include <deque>
#include <algorithm>
using namespace std;

deque<int> riffle_shuffle(const deque<int>& card, int c){
	deque<int> A, B, C;
	int n = card.size();
	for(int i=0 ; i<n ; i++ ){
		if( i < n/2 )
			B.push_back( card[i] );
		else
			A.push_back( card[i] );
	}
	while( 1 ){
		if( A.empty() && B.empty() )
			break;
		for(int i=0 ; i<c ; i++ ){
			if( A.empty() )
				break;
			C.push_back( A[0] );
			A.pop_front();
		}
		for(int i=0 ; i<c ; i++ ){
			if( B.empty() )
				break;
			C.push_back( B[0] );
			B.pop_front();
		}
	}
	return C;
}

int main(){
	int n, r, c;
	deque<int> a;
	for(int i=0 ; i<9 ; i++)
		a.push_back(i);
	riffle_shuffle( a , 3 );
	while( cin >> n ){
		cin >> r;
		deque<int> card;
		for(int i=0 ; i<n ; i++ ){
			card.push_back(i);
		}
		for(int i=0 ; i<r ; i++ ){
			cin >> c;
			card = riffle_shuffle( card , c );
		}
		cout << card[card.size()-1] << endl;
	}
}

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

int main() {
    int A, N;
    cin >> N >> A;
    
    if (N % 500 == 0){
        cout << "Yes" << endl;
    }
    else if (N % 500 <= A){
        cout << "Yes" << endl;
    }
    else if (N % 500 > A){
        cout << "No" << endl;
    }
    
    
    
}


Measured memory_bytes: 256
import sys
cnt=0
n=int(input())
A = list(map(int,sys.stdin))

def insertionSort(A,n,g):
  global cnt
  for i in range(g,n):
    v=A[i]
    j=i-g
    while j>=0 and A[j]>v:
      A[j+g]=A[j]
      j=j-g
      cnt+=1
    A[j+g]=v
  return A

m=1
G=[1]
while G[m-1]*3+1<=n:
  G.append(G[m-1]*3+1)
  m+=1
G=sorted(G, reverse=True)

for i in G:
  A=insertionSort(A,n,i)

print(m)
print(*G)
print(cnt)
print('\n'.join(map(str,A)))


Measured memory_bytes: 125976
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
    input!{
        n: usize
    }
    println!("{}", n * (n + 1) / 2);
}


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

#define M 200010
#define MAXX 999999999999999
#define PI 3.14159265358979323846
#define ep emplace_back
#define mk make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

typedef long long int lli;
typedef unsigned long long int ulli;
typedef pair<int,int> PII;
typedef pair<lli,lli> PLL;

int parent[M];
int sizee[M];

int root(int x)
{
   while(parent[x]!=x)
   {
      parent[x] = parent[parent[x]];
      x = parent[x];
   }
   return x;
}

void Union(int A,int B)
{
   int root_A = root(A);
   int root_B = root(B);
   
   if(root_A==root_B)
   return;

   if(root_A<root_B)
   {
     parent[root_A]=root_B;
     sizee[root_B]+=sizee[root_A];
   }
   else
   {
     parent[root_B]=root_A;
     sizee[root_A]+=sizee[root_B];
   }
}

int main()
{
   ios_base::sync_with_stdio(false);
   cin.tie(NULL);
   
//   freopen("input.txt","rt",stdin);

   int n,m;
   cin>>n>>m;
   
   for(int i=1;i<=n;i++)
   {
      parent[i] = i;
      sizee[i] = 1;
   }

   for(int i=0;i<m;i++)
   {
      int u,v;
      cin>>u>>v;
      Union(u,v);
   }
     
   vector<int> all_res;
   for(int i=1;i<=n;i++)
   {
      if(parent[i]==i)
      {
         all_res.ep(sizee[i]);
      }
   }
   
   int ans = 0;
   while(true)
   {
      vector<int> temp;
      for(int i=0;i<(int)all_res.size();i++)
      {
         int x = all_res[i];
//         cout<<all_res[i]<<" ";
         if(x>0)
         {
            x--;
            temp.ep(x);
         }
      }
      
      int len = (int)temp.size();
      if(len>1)
      {
         all_res.clear();
         all_res = temp;
         ans++;
      }
      else if(len == 1)
      {
         ans += (temp[0]+1);
         break;
      }
      else
         break;
         
      temp.clear();
//      cout<<"  ans = "<<ans<<"\n";
   }
   
   cout<<ans<<"\n";
}


Measured memory_bytes: 6912
#include<stdio.h>

int main(){

	int N = 0;
	int count = 1;
	scanf("%d",&N);

	int a[N];
	for(int i=0; i<N; i++){
		scanf("%d",&a[i]);
	}

	for(int j=0; j<100002; j){
		if(a[j] == 2){
			printf("%d",count);		
			return 0;
		}else{
			j = a[j]-1;
			if(count > N){
				printf("-1");
				return 0;
			}
		}
		count ++;
	}

}

Measured memory_bytes: 512
import java.util.*; import java.io.*; import java.math.*;
public class Main{
	//Don't have to see. start------------------------------------------
	static class InputIterator{
		ArrayList<String> inputLine = new ArrayList<String>(1024);
		int index = 0; int max; String read;
		InputIterator(){
			BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
			try{
				while((read = br.readLine()) != null){
					inputLine.add(read);
				}
			}catch(IOException e){}
			max = inputLine.size();
		}
		boolean hasNext(){return (index < max);}
		String next(){
			if(hasNext()){
				return inputLine.get(index++);
			}else{
				throw new IndexOutOfBoundsException("There is no more input");
			}
		}
	}
	static HashMap<Integer, String> CONVSTR = new HashMap<Integer, String>();
	static InputIterator ii = new InputIterator();//This class cannot be used in reactive problem.
	static PrintWriter out = new PrintWriter(System.out);
	static void flush(){out.flush();}
	static void myout(Object t){out.println(t);}
	static void myerr(Object t){System.err.print("debug:");System.err.println(t);}
	static String next(){return ii.next();}
	static boolean hasNext(){return ii.hasNext();}
	static int nextInt(){return Integer.parseInt(next());}
	static long nextLong(){return Long.parseLong(next());}
	static double nextDouble(){return Double.parseDouble(next());}
	static ArrayList<String> nextStrArray(){return myconv(next(), 8);}
	static ArrayList<String> nextCharArray(){return myconv(next(), 0);}
	static ArrayList<Integer> nextIntArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Integer> ret = new ArrayList<Integer>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Integer.parseInt(input.get(i)));
		}
		return ret;
	}
	static ArrayList<Long> nextLongArray(){
		ArrayList<String> input = nextStrArray(); ArrayList<Long> ret = new ArrayList<Long>(input.size());
		for(int i = 0; i < input.size(); i++){
			ret.add(Long.parseLong(input.get(i)));
		}
		return ret;
	}
	static String myconv(Object list, int no){//only join
		String joinString = CONVSTR.get(no);
		if(list instanceof String[]){
			return String.join(joinString, (String[])list);
		}else if(list instanceof ArrayList){
			return String.join(joinString, (ArrayList)list);
		}else{
			throw new ClassCastException("Don't join");
		}
	}
	static ArrayList<String> myconv(String str, int no){//only split
		String splitString = CONVSTR.get(no);
		return new ArrayList<String>(Arrays.asList(str.split(splitString)));
	}
	public static void main(String[] args){
		CONVSTR.put(8, " "); CONVSTR.put(9, "\n"); CONVSTR.put(0, "");
		solve();flush();
	}
	//Don't have to see. end------------------------------------------
	static void solve(){//Here is the main function
		ArrayList<Integer> one = nextIntArray();
		int X = one.get(0);
		int A = one.get(1);
		int B = one.get(2);
		if(A + X < B){
			myout("dangerous");
		}else if(A - B >= 0){
			myout("delicious");
		}else{
			myout("safe");
		}
	}
	//Method addition frame start



	//Method addition frame end
}


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

int main() {
  string s;
  cin >> s;
  string ans;
  for (int i = 0; i < s.size(); ++i) {
    if (s.at(i) == '0') {
      ans += '0';
    }
    if (s.at(i) == '1') {
      ans += '1';
    }
    if (s.at(i) == 'B' && ans.size() > 0) {
      ans.erase(ans.size() - 1, 1);
    }
  }
  cout << ans << endl;
}


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

using namespace std;
typedef long long ll;

#define REP(i, n) for (ll i = 0; i < (ll)(n); i++)
#define REPD(i, n) for (ll i = (ll)(n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i <= (b); i++)
#define FORD(i, a, b) for (ll i = (a); i >= (b); i--)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))
#define INF 1000000000000
#define MOD 1000000007
#define PB push_back
#define MP make_pair
#define F first
#define S second

void solve() {
  int N, K, max = 0, max_index = 0, sum = 0;
  double ans = 0.0;
  cin >> N >> K;
  vector<int> p(N);
  vector<int> a(K);
  REP(i, N) { cin >> p[i]; }
  REP(i, K) { sum += p[i]; }
  max = sum;
  max_index = K - 1;
  FOR(i, K, N - 1) {
    sum = sum - p[i - K] + p[i];
    if (max == sum) {
    } else if (max < sum) {
      max = sum;
      max_index = i;
    }
  }
  REP(i, K) { ans += (p[max_index - i] + 1) / 2.0; }
  // cout << fixed << ans << endl;
  printf("%.7lf\n", ans);
}

signed main() {
  solve();

  return 0;
}

Measured memory_bytes: 1792
x, k, d = map(int, input().split())

x = abs(x)
kk = x // d
amari = x % d

if kk >= k:
    ans = (kk - k) * d + amari
elif (k - kk) % 2 == 1:
    ans = abs(amari - d)
else:
    ans = amari

print(ans)

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

using namespace std;

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

    if(n > 81)
    {
        cout << "No" << endl;
        return 0;
    }

    vector<int> divisors;
    for(int i = 1; i <= 9; ++i)
    {
        for(int j = 1; j <= 9; ++j)
        {
            divisors.push_back(i*j);
        }
    }

    for(int x : divisors)
    {
        if(x == n)
        {
            cout << "Yes" << endl;
            return 0;
        }
    }

    cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>

using namespace std;

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

    int d = a / b;
    int r = a % b;
    double f = (double)a / (double)b;

    printf("%d %d %f", d, r, f);

    return 0;
}


Measured memory_bytes: 3188
#include<stdio.h>
#include<stdlib.h>
#define MAX 2000001
#define VMAX 10000

int main(){
	unsigned short *A, *B;
	
	int C[VMAX+ 1];
	int n, i, j;
	scanf("%d",&n);
	
	A=malloc(sizeof(short) * n+1);
	B=malloc(sizeof(short) * n+1);
	
	for ( i=0;i<=VMAX;i++)C[i]=0;
	
	for(i=0;i<n;i++){
		scanf("%hu",&A[i+1]);
		C[A[i+1]]++;
	}
	
	for(i=1;i<=VMAX;i++)C[i]=C[i]+C[i-1];
	
	for(j=1;j<=n;j++){
		B[C[A[j]]]=A[j];
		C[A[j]]--;
	}
	
	for(i=1;i<=n;i++){
		if(i>1)printf(" ");
		printf("%d",B[i]);
	}
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 9628
#include <bits/stdc++.h>                                                                             
using namespace std;                                                                                 
using ll = long long;                                                                                
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }              
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }              
                                                                                                     
int main() {                                                                                         
  int n;                                                                                             
  cin >> n;                                                                                          
  int hyaku = n / 100;                                                                               
  int ju = (n / 10) % 10;                                                                            
  int ichi = n % 10;                                                                                 
  if (hyaku == 7 || ju == 7 || ichi == 7) {                                                          
    cout << "Yes" << endl;                                                                           
  } else {                                                                                           
    cout << "No" << endl;                                                                            
  }                                                                                                  
  return 0;                                                                                          
}                     

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

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

  string s;
  cin >> s;

  if (s[2] == s[3] && s[4] == s[5]) cout << "Yes\n";
  else cout << "No\n";

  return (0);
}


Measured memory_bytes: 3636