akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
  
using namespace std;
using namespace __gnu_pbds;
 
#define ll long long
#define uint unsigned int
#define ull  unsigned long long
#define pb push_back
#define mk make_pair
#define ins insert
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define X first
#define Y second
#define umap unordered_map
#define speed() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define setvalue(d,s,e,n) for(int qwe = s; qwe < e; ++qwe) d[qwe] = n
#define mset multiset
#define pqueue priority_queue
   
template<class T> using oset=tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
        
const int  N = 2e5 + 314;
const int INF = 1e9;
const double PI = acos(-1);
const int MOD = 1e9 + 7;
const double eps = 1e-9;
void solve(){
    int n, m , x;
    cin >> n >> m >> x;
    map <int,int> mp;
    int c1 = 0,c2 = 0;
    int f;
    for(int i = 1; i <= m; ++i){
        cin >> f;
        mp[f] = 1;
    }
    int y = x;
    while(y > 0) {
        y --;
        c1 += mp[y];
    }
    y = x;
    while(y < n) {
        y ++;
        c2 += mp[y]; 
    }
    cout << min(c1,c2);
        
}
int main(){
    speed();
    int t = 1;
    // cin >> t;
    while(t--)solve();
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

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

  int n, k;
  cin >> n >> k;
  vector<int> hs(n);
  int count = 0;
  for (int i = 0; i < n; i++) {
    cin >> hs[i];
    if (hs[i] >= k) count++;
  }
  cout << count << endl;
}

Measured memory_bytes: 640
ab=raw_input().split()
a=int(ab[0])
b=int(ab[1])
num=1
if a <=0 and b>=0:
    print 'Zero'
elif a>0:
    print 'Positive'
elif (b-a)%2==0:
    print 'Negative'
else:
    print'Positive'

Measured memory_bytes: 2692
#include <bits/stdc++.h>
using namespace std;
  #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  #define int long long
  #define endl "\n"
  #define all(v) v.begin(),v.end()
  #define double long double
  #define trace1(x)                cerr<<#x<<": "<<x<<endl
  #define trace2(x, y)             cerr<<#x<<": "<<x<<" | "<<#y<<": "<<y<<endl
  #define trace3(x, y, z)          cerr<<#x<<":" <<x<<" | "<<#y<<": "<<y<<" | "<<#z<<": "<<z<<endl
  #define trace4(a, b, c, d)       cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<endl
  #define trace5(a, b, c, d, e)    cerr<<#a<<": "<<a<<" | "<<#b<< ": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<endl
  #define trace6(a, b, c, d, e, f) cerr<<#a<<": "<<a<<" | "<<#b<<": "<<b<<" | "<<#c<<": "<<c<<" | "<<#d<<": "<<d<<" | "<<#e<< ": "<<e<<" | "<<#f<<": "<<f<<endl
  #define cases int testcases;cin>>testcases; while(testcases--)
  const int N = 200005;



int32_t main()
{


    IOS



  int a,b,c,k;
  cin >> a >> b >> c >> k;

  while(b <=a)
  {
    b*= 2;
    k--;
  }

  while(c <=b)
  {
    c *= 2;
    k--;
  }

  if(k >= 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }






    return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <math.h>
int main(void){
   int a,b,d,r;
   double f;
   scanf("%d %d",&a,&b);
   d=a/b;
   r=a%b;
   f=(double)a/b;
   printf("%d\n",d);
   printf("%d\n",r);
   printf("%f\n",f);
   return 0; 
}


Measured memory_bytes: 2104
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e18;
typedef long long ll;
typedef vector<ll> vl;
#define rp(i, f, t) for (int i = f; i < t; i++)
#define pr(i, f, t) for (int i = t - 1; i >= f; i--)
#define ca(n, a) rp(ca_i, 0, n) cout << a[ca_i] << ((ca_i == n - 1) ? "\n" : " ")
#define za(n, a) rp(za_i, 0, n) a[za_i] = 0
#define be(a) a.begin(), a.end()
int main()
{
    ll n, k;
    cin >> n >> k;
    if (n > k)
    {
        cout << min(n % k, llabs(n % k - k)) << endl;
    }
    if (n == k)
    {
        cout << 0 << endl;
    }
    if (n < k)
    {
        cout << min(n, llabs(n - k)) << endl;
    }
}

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

int main() {
  int N, M,a,b;
  cin >> N >> M;
  vector<vector<int>> v(N+1);
  for(int i=0;i<M;i++) {
    cin >> a >> b;
    v[a].push_back(b);
  }
  for(int i=1;i<=N;i++) {
    int sum=0;
    
    for(int y=1;y<=N;y++) {
      if (y == i ) sum += v[y].size();
      else
        for(int x : v[y]) {
          if (x == i) sum += 1;
        }
    }
    cout << sum << endl;
  }
  
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"


int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		vector<vector<int>>on(N, vector<int>(40));
		vector<string>names;
		for (int i = 0; i < N; ++i) {
			string name; cin >> name;
			names.push_back(name);
			int m; cin >> m;
			for (int j= 0; j < m; ++j) {
				int d; cin >> d;
				on[i][d] = true;
			}
		}
		vector<int>scores(N);
		for (int i = 0; i < 40; ++i) {
			int sum = 0;
			for (int j = 0; j < N; ++j) {
				if (on[j][i])sum++;
			}
			int point = N - sum + 1;
			for (int j = 0; j < N; ++j) {
				if (on[j][i])scores[j] += point;
			}
		}
		string ans = "";
		int amin = 10000000;
		for (int i = 0; i < N; ++i) {
			if ((amin>scores[i]) || ((amin == scores[i]) && ans>names[i])) {
				amin = scores[i];
				ans = names[i];
			}
		}
		cout <<amin<<" "<< ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3192
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using static MyIO;


public class B
{
	public static void Main()	
	{
		int N = GetInt();
		int[] a = new int[N+1];
		for(int i = 1; i <= N; i++)
			a[i] = GetInt();

		int[] cost = new int[N+1];  // cost[1] = 0
		for(int i = 2; i <= N; i++)
			cost[i] = -1;
		int currentBtn = 1;
		while(true)
		{
			int nextBtn = a[currentBtn];
			if(cost[nextBtn] != -1)
				break;
			cost[nextBtn] = cost[currentBtn] + 1;
			currentBtn = nextBtn;
		}

		Console.WriteLine(cost[2]);
	}
}


public static class MyIO
{
	private static string[] args = null;
	private static int num = -1;
	private static int used = -1;

	private static string getArg()
	{
		if(used == num)
		{
			args = Console.ReadLine().Split(' ');
			num = args.Length;
			used = 0;
		}
		return args[used++];
	}

	public static int GetInt(){ return int.Parse(getArg()); }
	public static long GetLong(){ return long.Parse(getArg()); }
	public static double GetDouble(){ return double.Parse(getArg()); }
	public static string GetString(){ return getArg(); }
}


Measured memory_bytes: 17324
a, b, c, d = list(map(int, input().split()))

ans = []

ans.append(a*c)
ans.append(a*d)
ans.append(b*c)
ans.append(b*d)

ans.append(c*a)
ans.append(c*b)
ans.append(d*a)
ans.append(d*b)

print(max(ans))

Measured memory_bytes: 9180
def resolve():
    a, b, c, d = map(int, input().split())
    ans = [a * c, b * d]
    if (a <= 0) ^ (0 <= b):
        ans.append(b * c)
        ans.append(a * d)
    else:
        ans.append(0)
    if (c <= 0) ^ (0 <= d):
        ans.append(b * c)
        ans.append(a * d)
    else:
        ans.append(0)
    print(max(ans))


if __name__ == '__main__':
    resolve()


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


int main(){
    int N;
    cin >> N;
    map<int, int> A;
    for(int ii=0; ii<N; ii++){
        int a;
        cin >> a;
        A[a]++;
    }

    vector<vector<int>> B;
    for(auto& a : A){
        B.push_back({a.first, a.second});
    }
    sort(B.begin(), B.end(), [](const vector<int>& a, const vector<int>& b){
        return a[0] < b[0];
    });

    if((B.size()==1) && ((B[0][0]^B[0][0])==B[0][0])){
        cout << "Yes" << endl;
        return 0;
    }
    if((B.size()==2) && ((B[0][0]^B[1][0])==B[1][0]) && (B[0][1]*2 == B[1][1])){
        cout << "Yes" << endl;
        return 0;
    }
    if((B.size()==3) && ((B[0][0]^B[1][0])==B[2][0]) && (B[0][1] == B[1][1]) && (B[0][1]==B[2][1])){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 9012
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(i, a) for(int i = 0; i < (int)(a); i++)
#define all(v) v.begin(), v.end() 
#define mp make_pair
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define fi first
#define se second
#define sq(x) ((x) * (x))

template<class T> T gcd(T a, T b){ return ((b == 0) ? a : gcd(b, a % b)); }

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//freopen("input.in", "r", stdin);
	//freopen("output.out", "w", stdout);
	ll h, w, n;
	cin >> h >> w >> n;
	map<pi, ll> m;
	map<pi, int> vis; //to not count anything twice
	vector<ll> cnt(10, 0);
	vi a(n), b(n);
	rep(i, n){
		cin >> a[i] >> b[i];
		m[mp(a[i], b[i])]++;
	}
	rep(i, n){
		for(int j = a[i] - 2; j <= a[i]; j++){
			for(int k = b[i] - 2; k <= b[i]; k++){
				//check if it is a valid square (and not visited)
				if(!(j >= 1 && k >= 1 && (j + 2) <= h && (k + 2) <= w && !vis[mp(j, k)])) continue;
				//count
				int num = 0;
				repn(l, j, j + 3) repn(p, k, k + 3) if(m[mp(l, p)]) num++;
				vis[mp(j, k)] = 1;
				cnt[num]++;
			}
		}
	}
	ll tot = 0;
	repn(i, 1, 10) tot += cnt[i];
	cnt[0] = (ll)(1LL * ((h - 2) * (w - 2)) - tot);
	rep(i, 10) cout << cnt[i] << endl;
	return 0;
}
/*
Things to look out for:
	- Integer overflows
	- Array bounds
	- Special cases
Be careful!
*/


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

int main(void){

	int n;
	while(cin >> n, n !=0){
	vector<vector<int>> ok(n,vector<int>(31));
	bool f = true;
	for(int i=0;i<n;i++){
		int m;cin >> m;
		for(int j=0;j<m;j++){
			int a;cin >> a;
			ok[i][a] = 1;
		}
	}


	vector<set<int>> st(n);
	for(int i=0;i<n;i++)st[i].insert(i);

	for(int i=0;i<31;i++){
		vector<int> vec;
		for(int j=0;j<n;j++){
			if(ok[j][i] == 1)vec.push_back(j);
		}

		for(int k=0;k<vec.size();k++){
			for(int j=k+1;j<vec.size();j++){
				st[vec[k]].insert(st[vec[j]].begin(),st[vec[j]].end());
				st[vec[j]].insert(st[vec[k]].begin(),st[vec[k]].end());
			}
		}

		for(int j=0;j<n;j++){
			//cout << st[j].size() << endl;
			if(st[j].size() == n){
				cout << i << endl;
				f = false;
				goto END;
			}
		}
	}
END:
	if(f)cout << -1 << endl;
}
	return 0;
}

//????????????

Measured memory_bytes: 1340
a = int(input())
b = int(input())
c = int(input())
x = int(input())

ans = 0

for i in range(a+1):
  for j in range(b+1):
    for k in range(c+1):
      if 500 * i + 100 * j + 50 * k  == x:
        ans += 1

print(ans)

Measured memory_bytes: 3060
#include <iostream>

using namespace std;

int euler_phi(int n){
	int res = n;
	for(int i=2;i*i<=n;i++){
		if(n % i == 0){
			res = res / i * (i - 1);
			for(;n%i==0;n/=i);
		}
	}
	if(n != 1) res = res / n * (n - 1);
	return res;
}

const int N = 1000000;
long long dat[N+1], t, n;

int main(){
	dat[0] = 1;
	for(int i=1;i<=N;i++) dat[i] = dat[i-1] + euler_phi(i);
	cin >> t;
	for(int i=0;i<t;i++){
		cin >> n;
		cout << dat[n] << endl;
	}
	return 0;
}

Measured memory_bytes: 8968
#include <iostream>
#define REP(i, n) for (int i = 0; i < (n); i++)
using namespace std;

void solve(std::string S){
    bool ans = true;
    string tmp = S.substr(2, S.size() - 3);
    int countC = 0;
    REP(i, tmp.size())
        if (tmp[i] == 'C') countC++;
    if (S[0] != 'A') ans = false;
    else if (countC != 1) ans = false;
    else {
        S.erase(0, 1);
        S.erase(S.find("C"), 1);
        REP(i, S.size())
            if (!(islower(S[i]))) ans = false;
    }

    if (ans) cout << "AC" << '\n';
    else cout << "WA" << '\n';
}

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    std::string S;
    std::cin >> S;
    solve(S);
    return 0;
}


Measured memory_bytes: 256
import std.stdio;
import std.algorithm;
import std.array;
import std.conv;
import std.string;
import std.uni;

void main()
{
    int[dchar] b;
    for (dchar c = 'a'; c <= 'z'; c++)
        b[c] = 0;
    while (!stdin.eof)
    {
        auto a = readln.strip;
        foreach (i; a)
        {
            if (i.isAlpha)
                b[i.toLower] += 1;
        }
    }
    for (dchar c = 'a'; c <= 'z'; c++)
        writeln(c, " : ", b[c]);
}



Measured memory_bytes: 2480
#include <bits/stdc++.h>
using namespace std;
// not solved
int main() {
  int A, B, C, X, cnt;
  cin >> A >> B >> C >> X;
  for (int i = 0; i < A + 1; i++) {
    for (int j = 0; j < B + 1; j++) {
      for (int k = 0; k < C + 1; k++) {
        if (500 * i + 100 * j + 50 * k == X) {
          cnt++;
        }
      }
    }
  }
  cout << cnt << endl;
}



Measured memory_bytes: 256
#include<iostream>
#include<map>
#include<vector>
#include<utility>
using namespace std;
 
#define REP(i,n) for(int i=0;i<n;i++)
 
int another(int c) { return c == 0 ? 1 : 0; }
 
void dfs(map<int, vector<pair<int, int> > >& graph, map<int, int>& colors, int v, int current) {
    colors[v] = current;
 
    if (graph.count(v) == 0) return;
 
    auto children = graph[v];
    for (auto c: children) {
        int node = c.first;
        int dist = c.second;
 
        if (colors.count(node) != 0) continue;
        else {
            colors[node] = -1;
        }
 
        if (dist % 2 == 0) {
            dfs(graph, colors, node, current);
        }
        else {
            dfs(graph, colors, node, another(current));
        }
    }
}
 
int main() {
    int n;
    cin >> n;
    int _u, _v, _w;
    auto graph = map<int, vector<pair<int, int>>>();
    while(cin >> _u >> _v >> _w) {
        if (graph.count(_u) == 0) {
            graph[_u] = vector<pair<int, int> >(0);
        }
        if (graph.count(_v) == 0) {
            graph[_v] = vector<pair<int, int> >(0);
        }
        graph[_u].push_back(pair<int, int>(_v, _w));
        graph[_v].push_back(pair<int, int>(_u, _w));
    }
    auto colors = map<int, int>();
 
    dfs(graph, colors, 1, 1);
 
    REP(i, n) {
        cout << colors[i+1] << endl;
    }
}

Measured memory_bytes: 22016
def digitsum(n):
    res = 0
    for i in range(5):
        res += (n//10**i)%10
    return res
n,a,b=map(int,input().split())
res=0
for i in range(1,n+1):
    if a<=digitsum(i)<=b:
        res += i
print(res)

Measured memory_bytes: 3060
n,m,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
before=0
after=0
for i in range(x):
    if i in a:
        before+=1
for j in range(x+1,n):
    if j in a:
        after+=1
print(min(before,after))

Measured memory_bytes: 3064
import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)
    val n = scanner.nextInt()
    val k = scanner.nextInt()
    val array = DoubleArray(n+1)

    var max = 0.0
    var preSumE = 0.0

    for (i in 1..n) {
        val value = scanner.nextInt()
        val currentE = if (value == 1) 1.0 else value.toDouble()/2 + 0.5
        array[i] = currentE
        if (i <= k) {
            max += currentE
            preSumE += currentE
        } else {
            val currentSumE = preSumE - array[i-k] + currentE
            if (max < currentSumE) max = currentSumE
            preSumE = currentSumE
        }
    }

    println(max)
}

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

int main()
{
    int k,x;
    cin >> k >> x;
    int sum = 500 * k;
    if( sum >= x )
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }

    return 0;
}



Measured memory_bytes: 256
#pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << endl;
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;

void chmin(ll &a, ll b) {
    if (a > b) a = b;
}

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

    int n;
    cin >> n;

    vll x(n), y(n), p(n);
    REP(i, n) cin >> x[i] >> y[i] >> p[i];

    vll ans(n + 1, INF);

    auto dfs = [&](auto &&f, int cnt, int m, vll &pre) -> void {
        if (m == n) {
            ll sum = 0;
            REP(i, n) sum += pre[i] * p[i];
            chmin(ans[cnt], sum);
            return;
        }

        // x
        vll d1 = pre;
        REP(i, n) chmin(d1[i], abs(x[i] - x[m]));
        f(f, cnt + 1, m + 1, d1);

        // y
        vll d2 = pre;
        REP(i, n) chmin(d2[i], abs(y[i] - y[m]));
        f(f, cnt + 1, m + 1, d2);

        // none
        f(f, cnt, m + 1, pre);
    };

    vll dist(n);
    REP(i, n) dist[i] = min(abs(x[i]), abs(y[i]));
    dfs(dfs, 0, 0, dist);

    for(auto e: ans) print(e);
}


Measured memory_bytes: 3684
using System;

public class P
{
    public int h { get; set; }
    public int w { get; set; }
}

public class hello
{
    public static void Main()
    {
        while (true)
        {
            string[] line = Console.ReadLine().Trim().Split(' ');
            var h = int.Parse(line[0]);
            var w = int.Parse(line[1]);
            if (h == 0 && w == 0) break;
            var res = getAns(h, w);
            Console.WriteLine("{0} {1}", res.h, res.w);
        }
    }
    public static P getAns(int h, int w)
    {
        var t = h * h + w * w;
        var defmin = int.MaxValue; var resh = 0; var resw = 0;
        for (int i = 1; i <= 149; i++)
            for (int j = i + 1; j <= 150; j++)
            {
                var te = i * i + j * j;
                var def = te - t;
                if (def == 0 && i > h) { defmin = def; resh = i; resw = j; goto end; }
                if (def > 0 && def < defmin) { defmin = def; resh = i; resw = j; }
            }
        end:;
        var ret = new P { h = resh, w = resw };
        return ret;
    }
}


Measured memory_bytes: 7864
#include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
int main(){
    ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    rep(i,0,(1<<n)-1){cout<<i<<':';rep(j,0,n)if(i&(1<<j))cout<<' '<<j;cout<<endl;}
}


Measured memory_bytes: 3208
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N=2e5+5;
int a[N],b[N];
signed main(){
	int n,sum=1,x;
	cin>>n;
	for(int i=0;i<=n;++i)
		cin>>a[i];
	for(int i=n;i>=0;--i)
		b[i]=b[i+1]+a[i];
	if(!n) return cout<<(a[0]==1?"1":"-1"),0;
	if(a[0]) return cout<<"-1",0;
	//cout<<1<<endl;
	int res=1;
	for(int i=1;i<=n;++i){
		res=min(res*2,b[i]);
		//cout<<res<<" "<<b[i]<<endl;
		if(res<a[i]) return cout<<"-1",0;
		sum+=res;res-=a[i];
	}
	cout<<sum;
	return 0;
}

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

int main(void)
{
    int x; cin>>x;
    bool dp[110000];
    dp[0]=true;
    rep(i,x)rep(j,6) if(dp[i]==true) dp[i+100+j]=true;
    cout<<dp[x]<<endl;
    return 0;
}

Measured memory_bytes: 3688
#include <stdio.h>  /*入出力*/
#include <stdlib.h> /*標準ライブラリ*/
#include <string.h> /*文字列*/
#include <math.h>   /*計算*/
#include <assert.h> /*確認*/
#include <ctype.h>  /*文字操作*/
#include <stdbool.h>/*bool型*/
#include <limits.h> /*限界*/

#define rep(i, n) for(int  i = 0; i < (n); i++)
#define max(a,b) ((a>b)?a:b)
#define ABS(a) (((a)>(0))?a:-(a))
#define LL long long
#define MOD 1000000007//10^9+7(素数)

//abc 160 C

int main(void)
{
  long N;
  long K;
  long save;
  long ans = 0;
  long count[200000];
  scanf("%ld %ld", &K, &N);
  for (long i = 0; i < N; i++) {
    scanf("%ld", &count[i]);
  }
  save = count[0];
  for (long i = 0; i < N; i++) {
    if (i != N-1) {
      count[i] = count[i+1]-count[i];
    }else{
      count[i]= K - count[i] + save;
    }
  }
  for (long i = 0; i < N; i++) {
    if (count[i] > ans) {
      ans = count[i];
    }
  }
  printf("%ld\n",K - ans );
  return 0;
}


Measured memory_bytes: 1664
#include <stdio.h>//??????????????????????????¢???????????????????????°
int main(void)
{
	char c[1201]={0};
	int al[257]={0};
	int i=0;

	while (scanf("%c", &c[i]) != EOF)
	{
		//scanf("%c", &c[i]);
		/*if (c[i]=='\n')
		{
			break;
		}*/
		i+=1;
	}

	for (i=0;i<1201;i++)
	{
		if(c[i] >= 'a' && c[i] <= 'z') al[c[i]]+=1;
		else if (c[i] >= 'A' && c[i] <= 'Z') al[c[i]-'A'+'a']+=1;
	}

	for (i='a';i<='z';i++)
	{
		printf("%c : %d\n", i, al[i]);
	}
	return 0;
}

Measured memory_bytes: 540
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cwchar>
#include <cwctype>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <codecvt>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize("Ofast")
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll INF=(1LL<<60);
const ld pi=acosl((ld)1);
const ll mod = 1000000007;
const int dx[4]={0,1,0,-1};
const int dy[4]={1,0,-1,0};
const int ddx[8]={1,0,-1,-1,-1,0,1,1};
const int ddy[8]={1,1,1,0,-1,-1,-1,0};
#define endn "\n"

void solve(){
    ll h,w;cin>>h>>w;
    char map[h][w];
    rep(i,h)rep(j,w)cin>>map[i][j];
    queue<pair<ll,pair<ll,ll>>>que;
    rep(i,h)rep(j,w){
        if(map[i][j]=='#')que.push(make_pair(0,make_pair(i,j)));
    }
    ll ans=0;
    while(!que.empty()){
        auto p=que.front().second;
        ll depth=que.front().first+1;
        ans=max(ans,depth-1);
        que.pop();
        rep(k,4){
            ll x=p.first+dx[k];
            ll y=p.second+dy[k];
            if(x<0 or x>=h or y<0 or y>=w)continue;
            if(map[x][y]=='#')continue;
            map[x][y]='#';
            que.push(make_pair(depth,make_pair(x,y)));
        }
    }
    cout<<ans<<endl;
}

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout<<fixed;
	cout<<setprecision(30);
	solve();
}


Measured memory_bytes: 25396
#include<iostream>
#include<cstring>
using namespace std;
int s,t,q,fl;
char a[500010];
string s0;
int main()
{
    int i,t1,t2,t3;
    char s1;
    s=200001;
    cin>>s0;
    t=s+s0.size()-1;
    for(i=0;i<s0.size();i++) a[i+s]=s0[i];
    cin>>q;
    while(q--)
    {
        cin>>t1;
        if(t1==1) fl=1-fl;
        else
        {
            cin>>t2>>s1;
            t3=(fl^(t2-1));
            if(t3==0) a[--s]=s1;
            else a[++t]=s1;
        }
    }
    if(fl==0) for(i=s;i<=t;i++) cout<<a[i];
    else for(i=t;i>=s;i--) cout<<a[i];
    //system("pause");
    return 0;
}
    


Measured memory_bytes: 1024
program main
integer(8)::a(4),i,c,j,p
	read*,a
	do j = 1,4
		c =0
		p = (j-1)*3+1
		if (p == 10) p = 9
		do i = 1,4
			if(a(i) == p) c = 1
		enddo
		if(c == 0)then
			print "(a)","NO"
			stop
		endif
	enddo
	
	print"(a)","YES"

end program main

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
typedef long long ll;
using namespace std;
int main(void){
    int n,y;
    cin>>n>>y;
    for(int i=0;i<=n;i++){
        for(int j=0;j<=n-i;j++){
            int k=n-(i+j);
            int num=10000*i+5000*j+1000*k;
            if(num==y){
                cout<<i<<" "<<j<<" "<<k<<endl;
                return 0;
            }
        }
    }
    cout<<-1<<" "<<-1<<" "<<-1<<endl;
    return 0;
}

Measured memory_bytes: 256
// Problem: C - Step
// Contest: AtCoder - AtCoder Beginner Contest 176
// URL: https://atcoder.jp/contests/abc176/tasks/abc176_c
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <algorithm>
#include <cmath>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>

#define fastio  ios_base::sync_with_stdio(false); cin.tie(0);

using namespace std;

int main()
{
	int n;
	cin>>n;
	vector<int> arr(n);
	for(auto&e: arr) cin>>e;
	
	auto cpy = arr;
	int last = arr[0];
	for(int a=1;a<n;a++)
	{
		if(arr[a] < last) arr[a] = last;
		else last = arr[a];
	}
	
	unsigned long long pk,pk2;
	pk = pk2 = 0;
	
	for(auto&e: arr) pk += e;
	for(auto&e: cpy) pk2 += e;
	
	//int pk = accumulate(arr.begin(), arr.end(), 0);
	//int pk2 = accumulate(cpy.begin(), cpy.end(), 0);
	
	//for(auto &e : arr) cerr << e  << " ";
	cout << pk - pk2;
	
	return 0;
}


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

using namespace std;

void bubbleSort(int A[], int Amod[], int N) {

}

int main() {
	int i = 0;
	int A[10];
	int Amod10[10];
	int flag = 0;//10で割ったあまりが0があるかないか
	int stay = 0;//待ち時間
	int time = 0;//時間
	for (int i = 0; i < 5; ++i) {
		cin >> A[i];
		Amod10[i] = A[i] % 10;
		if (Amod10[i] == 0) {
			++flag;//0がある
		}
	}
	if (flag == 5) {
		flag= 4;
	}
	//sortする
	bool sortflag = 1;
	for (i = 0; sortflag; ++i) {
		sortflag = false;
		for (int j = 4; j >= i + 1; --j) {
			if (Amod10[j] < Amod10[j - 1]) {
				//交換
				swap(Amod10[j], Amod10[j - 1]);
				swap(A[j], A[j - 1]);
				sortflag = 1;
			}

		}
	}

		swap(Amod10[flag], Amod10[4]);
		swap(A[flag], A[4]);




	
	for (i = 0; i <4; ++i) {
		stay +=10- Amod10[i];
	}
	stay = 10 * flag - stay;
	stay = abs(stay);
	//cout <<"stay"<< stay << endl;
	
	for (i = 0; i < 5; ++i) {
		time += A[i];
	}
	time += stay;
	
	//cout << "flag" << flag << endl;
	cout << time << endl;
}


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

int main()
{
    int N;
    scanf("%d", &N);
    vector<int> A(N + 1);
    map<int, int> count;
    int even = 0;
    int ans;
    for (int i = 1; i <= N; i++) {
        scanf("%d", &A[i]);
        count[A[i]]++;
    }
    ans = count.size();
    if (ans % 2 == 0) ans--;
    printf("%d\n", ans);
    return 0;

    for (int i = 1; i <= N; i++) {
        if (count[i] > 0 && count[i] % 2 == 0) {
            even++;
        }
    }
    if (even % 2 == 1) {
        //偶数個ある数が奇数個あったらどれかは消しきれない
        ans--;
    }
    printf("%d\n", ans);
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define fi first
#define se second
#define mp make_pair
#define itrfor(itr,A) for(auto itr = A.begin(); itr !=A.end();itr++)
template <class T> using reversed_priority_queue = priority_queue<T, vector<T>, greater<T> >;
typedef long long llong;
char moji[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
char moji2[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
char moji3[10]={'0','1','2','3','4','5','6','7','8','9'};
#define Sort(a) sort(a.begin(),a.end());
#define Reverse(a) reverse(a.begin(),a.end());
#define print(a) cout << a << endl;
#define MOD llong(1e9+7)
#define MAX int(2 * 1e5 +5)
#define debug(x)  cout << #x << " = " << (x) << endl;
#define pi acos(-1.0)
#define int llong
#define INF llong(1e17)

signed main(){
    int n;
    cin >> n;
    int id[n] = {};
    REP(i,n){
        int tmp; cin >> tmp;
        id[tmp] = i+1;
    }
    set<int> S;
    S.insert(0);
    S.insert(n+1);
    int res = 0;
    FOR(i,1,n+1){
        S.insert(id[i]);
        auto itr = S.find(id[i]);
        auto itr1 = next(itr);
        auto itr2 = prev(itr);
        res += i * (*itr - *(itr1) ) * ( *(itr2) - *(itr)  );

    }

    cout << res << endl;
}


Measured memory_bytes: 11136
n=int(input())

ans = 10000000

for i in range(1,n//2+2):
    memo = 0
    first = str(i)
    second = str(n-i)
    for j in first:
        memo += int(j)
    for j in second:
        memo += int(j)
    ans = min(memo,ans)

print(ans)

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

void read(int &x) {
    x=0;int f=1;char ch=getchar();
    for(;!isdigit(ch);ch=getchar()) if(ch=='-') f=-f;
    for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';x*=f;
}
 
void print(int x) {
    if(x<0) putchar('-'),x=-x;
    if(!x) return ;print(x/10),putchar(x%10+48);
}
void write(int x) {if(!x) putchar('0');else print(x);putchar('\n');}

#define lf double
#define ll long long
#define end puts("No"),exit(0)

const int maxn = 1e5+10;
const int inf = 1e9;
const lf eps = 1e-8;

int l[maxn],r[maxn],head[maxn],tot,vis[maxn],n,m,col[maxn],rt,val[maxn];
struct edge{int to,nxt;}e[maxn<<1];

void add(int u,int v) {e[++tot]=(edge){v,head[u]},head[u]=tot;}
void ins(int u,int v) {add(u,v),add(v,u);}

void dfs(int x,int fa,int c) {
    if(vis[x]&&c!=col[x]) end;
    if(vis[x]&&fa&&(l[x]<l[fa]-1||r[x]>r[fa]+1)) end;
    if(!vis[x]) l[x]=l[fa]-1,r[x]=r[fa]+1,col[x]=c;
    for(int v,i=head[x];i;i=e[i].nxt)
	if((v=e[i].to)!=fa) {
	    dfs(v,x,c^1);
	    l[x]=max(l[x],l[v]-1);
	    r[x]=min(r[x],r[v]+1);
	}
    if(l[x]>r[x]) end;
}

void dfs2(int x,int fa) {
    if(!fa) val[x]=l[x];
    else if(val[fa]-1>=l[x]) val[x]=val[fa]-1;
    else val[x]=val[fa]+1;
    for(int v,i=head[x];i;i=e[i].nxt) if((v=e[i].to)!=fa) dfs2(v,x);
}

int main() {
    read(n);for(int i=1,x,y;i<n;i++) read(x),read(y),ins(x,y);
    read(m);
    for(int i=1,x,y;i<=m;i++) {
	read(x),read(y);if(i==1) rt=x;
	col[x]=abs(y)&1;l[x]=r[x]=y;vis[x]=1;
    }
    dfs(rt,0,col[rt]);
    // for(int i=1;i<=n;i++) printf("lr :: %d %d\n",l[i],r[i]);
    dfs2(rt,0);
    puts("Yes");for(int i=1;i<=n;i++) write(val[i]);
    return 0;
}


Measured memory_bytes: 11008
# coding: utf-8

N = list(input())
l1 = [2,4,5,7,9]
l2 = [0,1,6,8]
l3 = 3

#print(N[-1])
if int(N[-1]) in l1:
    print('hon')
elif int(N[-1]) in l2:
    print('pon')
else:
    print('bon')

Measured memory_bytes: 9180
#include<iostream>
using namespace std;
int main(){
	long long a[8]={0,1,2,4,8,16,32,64};
	long long n;
	cin>>n;
	for(int i=7;i;i--){
		if(a[i]<=n){
			cout<<a[i]<<endl;
			return 0;
		}
	}
}

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

using namespace std;

const int NMAX = 100000 + 5;
int A[NMAX];

int main()
{
    ios_base :: sync_with_stdio(false);

    int N, L, T;
    cin >> N >> L >> T;

    long long int tr = 0;
    for (int i = 1; i <= N; ++ i) {
        cin >> A[i];
        int w;
        cin >> w;

        if (w == 1) {
            tr += (A[i] + T) / L;
            A[i] += T;
            A[i] %= L;
        }
        else {
            if (T > A[i]) {
                int t = T - A[i] - 1;
                tr -= t / L + 1;
            }

            A[i] = (A[i] - T) % L;
            if (A[i] < 0)
                A[i] += L;
        }
    }

    sort(A + 1, A + N + 1);

    tr %= N;
    if (tr < 0)
        tr += N;

    rotate(A + 1, A + tr + 1, A + N + 1);
    for (int i = 1; i <= N; ++ i)
        cout << A[i] << '\n';
    return 0;
}


Measured memory_bytes: 1664
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
template <class T> void chmin(T &a, const T &b) noexcept { if (b < a) a = b; }
template <class T> void chmax(T &a, const T &b) noexcept { if (a < b) a = b; }
void print() { cout << "\n"; }
template <class T, class... Args>
void print(const T &x, const Args &... args) { cout << x << " "; print(args...);}
void debug_out() { cout << "\n"; }
template <class T, class... Args>
void debug_out(const T &x, const Args &... args) { cout << x << " "; debug_out(args...);}
#ifdef _DEBUG
  #define debug(...) debug_out(__VA_ARGS__)
#else
  #define debug(...) 
#endif

template<typename T>
struct BIT {
  int n;
  vector<T> d;
  BIT(int n=0):n(n),d(n+1) {}
  void add(int i, T x=1) {
    assert(i < n);
    for (i++; i <= n; i += i&-i) { //LSB:i&(-i)
      d[i] += x;
    }
  }
  T sum(int i) {
    assert(i < n);
    T x = 0;
    for (i++; i; i -= i&-i) {
      x += d[i];
    }
    return x;
  }
  T sum(int l, int r) { //[l,r)
    assert(l < n);
    assert(r <= n);
    return sum(r-1) - sum(l-1);
  }
};

int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  std::cout << std::fixed << std::setprecision(15);
  int n, k;
  cin >> n >> k;
  vector<ll> a(n), s(n+1,0);
  rep(i,n) {
    cin >> a[i];
    s[i+1] += s[i] + a[i];
  }
  vector<ll> b(n+1), comp(n+1);
  rep(i,n+1) {
    ll j = i;
    b[i] = s[i] - k*j;
    comp[i] = b[i];
  }
  sort(all(comp)); //zaatu
  comp.erase(unique(all(comp)), comp.end());
  BIT<ll> tree(n+1);
  rep(i,n+1) {
    b[i] = lower_bound(all(comp), b[i]) - comp.begin();
    assert(b[i] < n+1);
  }
  ll ans = 0;
  rep(i,n+1) {
    ans += tree.sum(0,b[i]+1);
    tree.add(b[i]);
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 8192
#include<bits/stdc++.h>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define mod 1000000007
#define pb push_back  


int main()
{
   IOS
   
   ll N,W,i,w;
   cin>>N>>W;
   
   ll weight[N+1],value[N+1];
   for(i=1;i<=N;i++)
   {
   	cin>>weight[i]>>value[i];
   }
   
   ll dp[N+1][W+1];
   memset(dp,0,sizeof(dp));
   
   for(i=0;i<=N;i++)
   {
   	for(w=0;w<=W;w++)
   	{
   		if(i==0 || w==0)
   		{
   			dp[i][w]=0;
   		}
   		else
   		{
   			ll op1=0,op2=0;
   		  if(w>=weight[i])
   		  { op1 = dp[i-1][w-weight[i]]+value[i];}
   		   
   		   op2 = dp[i-1][w];
   		  
   		  dp[i][w] = max(op1,op2);
   		}
   	}
   }
   cout<<dp[N][W]<<endl;
   

}

Measured memory_bytes: 82536
#include <algorithm>
#include <array>
#include <cmath>
#include <iostream>
using namespace std;

#define int long long
int A, B, C, D, hoge;
int gcd(int n, int m)
{
    if (m > n) {
        int tmp = m;
        m = n;
        n = tmp;
    } else if (m == n) {
        return n;
    }
    return gcd(n - m, m);
}

int f(int x)
{
    int c = static_cast<int>(x / C);
    int d = static_cast<int>(x / D);
    int cd = static_cast<int>(x / hoge);
    int ans = x - c - d;
    ans += cd;
    return ans;
}
signed main()
{
    cin >> A >> B >> C >> D;
    int fuga = static_cast<int>(C / gcd(C, D));
    hoge = fuga * D;
    cout << f(B) - f(A - 1) << endl;
}

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

int main() {
	long long		a,b,c,i,j,k,n,m,y,ans = -1;
	string	str;
	
	cin >> n;
	
	vector<int>	x(n);
	for(i=0;i<n;i++) cin >> x[i];
	
	int pp;
	for(int p=1;p<=100;p++) {
		j = 0;
		for(i=0;i<n;i++) {
			j += (x[i]-p)*(x[i]-p);
		}
		if (ans == -1) {
			ans = j;
			pp = p;
		}
		if (ans > j) {
			ans = j;
			pp = p;
		}
	}
	
	cout << ans << endl;


}


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

int main(void){
    int N, K, ans=1e9+1;
    std::cin >> N >> K;
    std::vector<int> H(N);
    for (int i=0; i<N; ++i){
        std::cin >> H.at(i);
    }

    std::sort(H.begin(), H.end());

    for (int i=0; i<N-K+1; ++i){
        ans = std::min(ans, H.at(i + K - 1) - H.at(i));
    }

    std::cout << ans << std::endl;

    return 0;
}


Measured memory_bytes: 3780
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <tuple>
#include <stdlib.h>
using namespace std;
typedef long long int ll;

int main()
{
	int a, b, c;
	string s;
	cin >> a >> b;
	if (a<10 && b<10)cout << a*b;
	else cout << -1;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<string>
using namespace std;
typedef long long ll;
int main()
{
	int N;
	cin>>N;
	int num=N/1000;
	int x=N%1000;
	if(x!=0)
	num++;
	num=num*1000;
	int yu=num-N;
	int ans=0;
	ans=yu;
	cout<<ans<<endl;
} 

Measured memory_bytes: 3596
import math

def check(n):
  if n==2:
    return True
  if n%2==0:
    return False
  sqrt=int(math.sqrt(n))
  for i in range(3,sqrt):
    if n%i==0:
      return False
  return True

x=int(input())
while True:
  if check(x):
    print(x)
    break
  x+=1

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



int main() 
{
  ll N; cin>>N;
  ll num0=0,num1=0,num2=0;
  rep(i,N)
  {
    ll a; cin>>a;
    if(a%4==0) {num2+=1; continue;}
    if(a%2==0) {num1+=1; continue;}
    num0+=1;
  }
  //cout<<num0<<" "<<num1<<" "<<num2<<endl;
  if(num0==0) {cout<<"Yes"<<endl; return 0;}
  if(num2==0) {cout<<"No"<<endl; return 0;}
  if(num1!=0)
  {
    if(num0<=num2) {cout<<"Yes"<<endl; return 0;}
    cout<<"No"<<endl; return 0;
  }
  if(num0<=num2+1) {cout<<"Yes"<<endl; return 0;}
  cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
W,H,m,c[10][11];
DP[11][10][10][10][51];//cà[yÀW][xÀW][¶[][E[][_fcÊ]
#define Update(tgt,val) ((val)>(tgt)?tgt=(val):0)
CalcO(o,x,y){//_fcÊÌvZ
	if(c[x][y]>0){
		o+=c[x][y];
		if(o>m)
			o=m;
	}
	return o;
}
CalcF(f,x,y){//càÌvZ
	if(c[x][y]<0)
		f+=c[x][y];
	return f;
}
main(){
	int x,y,range,d,dx,f,o,xl,xr,fn,on,f0;
	for(;scanf("%d%d",&W,&H),W;){
		scanf("%d%d%d",&f0,&m,&o);
		for(y=1;y<=H;y++)
			for(x=0;x<W;x++)
				scanf("%d",&c[x][y]);
		f0++;//cà0ÅàDPÍ1ÆµÄANAÉÈéÌðh®
		for(y=0,x=0;x<W;x++)
			DP[y][x][x][x][o]=f0;
		y=0;
		for(x=0;x<W;x++){
			for(o=m;o>1;o--){
				if(f=DP[y][x][x][x][o]){
					//ºÖ@é
					fn=CalcF(f,x,y+1);
					on=CalcO(o-1,x,y+1);
					Update(DP[y+1][x][x][x][on],fn);
				}
			}//o
		}//x
		for(y=1;y<H;y++){
			for(range=0;range<W;range++){//¶EÉ@éL³
				for(o=m;o>1;o--){
					for(d=0;d<2;d++){//»ÝÊuxð³¹é
						for(xl=0;xl<W-range;xl++){//¶[
							for(dx=0;dx<=range;dx++){//xÏÊ
								xr=xl+range;
								x=d?xl+dx:xr-dx;
								if(f=DP[y][x][xl][xr][o]){
									//ºÖ@é
									fn=CalcF(f,x,y+1);
									on=CalcO(o-1,x,y+1);
									Update(DP[y+1][x][x][x][on],fn);
									if(y>0){
										if(x>0){
											if(x==xl){//¶Ö@é
												fn=CalcF(f,x-1,y);
												on=CalcO(o-1,x-1,y);
												Update(DP[y][x-1][x-1][xr][on],fn);
											}else{//¶ÖiÞ
												Update(DP[y][x-1][xl][xr][o-1],f);
											}
										}
										if(x<W-1){
											if(x==xr){//EÖ@é
												fn=CalcF(f,x+1,y);
												on=CalcO(o-1,x+1,y);
												Update(DP[y][x+1][xl][x+1][on],fn);
											}else{//EÖiÞ
												Update(DP[y][x+1][xl][xr][o-1],f);
											}
										}
									}
								}
							}//dx
						}//xl
					}//d
				}//o
			}//range
		}//y
		fn=0;
		for(x=0;x<W;x++){
			for(o=m;o>0;o--){
				f=DP[H][x][x][x][o];
				if(f>fn)
					fn=f;
			}
		}
		printf(fn?"%d\n":"NA\n",f0-fn);
		memset(DP,0,sizeof(DP));
	}
	//puts("");
	exit(0);
}

Measured memory_bytes: 0
package main

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

type TupleInt struct {
	first  int
	second int
}

func main() {
	sc := NewScanner()
	S := sc.Next()
	if S == "A"{
		fmt.Println("T")
	}
	if S == "T"{
		fmt.Println("A")
	}
	if S == "C"{
		fmt.Println("G")
	}
	if S == "G"{
		fmt.Println("C")
	}


}
func min(a int, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a int, b int) int {
	if a < b {
		return b
	}
	return a
}

type SortInterFace []TupleInt

func (s SortInterFace) Len() int {
	return len(s)
}
func (s SortInterFace) Less(i, j int) bool {
	return s[i].first < s[j].first
}
func (s SortInterFace) Swap(i, j int) {
	s[i], s[j] = s[j], s[i]
}

type Scanner struct {
	r   *bufio.Reader
	buf []byte
	p   int
}

func NewScanner() *Scanner {
	rdr := bufio.NewReaderSize(os.Stdin, 1000)
	return &Scanner{r: rdr}
}
func (s *Scanner) Next() string {
	s.pre()
	start := s.p
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			break
		}
	}
	result := string(s.buf[start:s.p])
	s.p++
	return result
}
func (s *Scanner) NextLine() string {
	s.pre()
	start := s.p
	s.p = len(s.buf)
	return string(s.buf[start:])
}
func (s *Scanner) NextInt() int {
	v, _ := strconv.Atoi(s.Next())
	return v
}
func (s *Scanner) NextInt64() int64 {
	v, _ := strconv.ParseInt(s.Next(), 10, 64)
	return v
}

func (s *Scanner) NextFloat() float64 {
	v, _ := strconv.ParseFloat(s.Next(), 64)
	return v
}

func (s *Scanner) NextIntArray() []int {
	s.pre()
	start := s.p
	result := []int{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 0)
			result = append(result, int(v))
			start = s.p + 1
		}
	}

	return result
}
func (s *Scanner) NextInt64Array() []int64 {
	s.pre()
	start := s.p
	result := []int64{}
	for ; s.p < len(s.buf)+1; s.p++ {
		if s.p == len(s.buf) || s.buf[s.p] == ' ' {
			v, _ := strconv.ParseInt(string(s.buf[start:s.p]), 10, 64)
			result = append(result, v)
			start = s.p + 1
		}
	}
	return result
}

func (s *Scanner) NextMap() map[int]bool {
	s.pre()
	start := s.p
	mp := map[int]bool{}
	for ; s.p < len(s.buf); s.p++ {
		if s.buf[s.p] == ' ' {
			v, _ := strconv.Atoi(string(s.buf[start:s.p]))
			mp[v] = true
			start = s.p + 1
		}
	}
	v, _ := strconv.Atoi(string(s.buf[start:s.p]))
	mp[v] = true

	return mp
}

func (s *Scanner) pre() {
	if s.p >= len(s.buf) {
		s.readLine()
		s.p = 0
	}
}
func (s *Scanner) readLine() {
	s.buf = make([]byte, 0)
	for {
		l, p, e := s.r.ReadLine()
		if e != nil {
			panic(e)
		}
		s.buf = append(s.buf, l...)
		if !p {
			break
		}
	}
}


Measured memory_bytes: 640
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author champon
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 9e18
#define ceill(a, b) (a+b-1)/b
#define ok cout << "ok" << endl;
#define sp << " " <<
ll mod = 1e9+7;
void ans(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void ans2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(b<a){a=b; return true;} return false; }
template<typename A, size_t N, typename T> void Fill(A (&array)[N], const T &val){fill((T*)array, (T*)(array+N), val);}
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

class debug
{
public:
    template<typename T> void vdeb(T vec);
    template<typename T1, typename T2> void adeb(T1 *arr, T2 n);
    template<typename T> void mdeb(T mp);
};

#endif //INCLUDE_DEBUG_HPP

template<typename T> void debug::vdeb(T vec)
{
    cout << "#vector set debug" << endl;
    for(auto vv : vec) cout << vv << " ";
    cout << endl;
}

template<typename T1, typename T2> void debug::adeb(T1 *arr, T2 n)
{
    cout << "#adebug" << endl;
    for(int i=0; i<=n; i++) cout << arr[i] << " ";
    cout << endl;
}

template<typename T> void debug::mdeb(T mp)
{
    cout << "#map pair debug" << endl;
    for(auto const& m : mp) cout << m.first sp m.second << endl;
}
debug dbg;

class ATwoRectangles {
public:
	void solve(std::istream& in, std::ostream& out)
	{
	    int a, b, c, d;
	    in >> a >> b >> c >> d;
	    if(a*b >= c*d) out << a*b << endl;
	    else out << c*d << endl;
	}
};


int main() {
	ATwoRectangles solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int long long
using namespace std;
int32_t main()
{
    int n,d,as=0 ; cin>>n>>d ;
    while(n--)
    {
        int x,y ; cin>>x>>y ;
        double dd=sqrt(x*x+y*y) ;
        if(dd<=d*1.0) as++ ;
    }
    cout<<as<<endl ;
}


Measured memory_bytes: 3680
MOD = 10 ** 9 + 7
N, M = list(map(int, input().split()))
B = [True] * (N + 1)
D = [1] + [0] * N
for _ in range(M):
    a = int(input())
    B[a] = False
for i in range(N):
    for j in range(i + 1, min(N, i + 2) + 1):
        if B[j]:
            D[j] = (D[j] + D[i]) % MOD
print(D[N])


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

int main(){
  long double l;
  cin >> l;
  
  l /= 3;
  
  cout << fixed << setprecision(7);
  cout << l*l*l << endl;
  
  return 0;
  
}

Measured memory_bytes: 256