akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Math;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            A();
        }

        static void A()
        {
            var N = ReadInt();
            var A = ReadInt();
            Println(N * N - A);
        }


        static List<long> ReadLines(long n)
        {
            var l = new List<long>();
            for (long i = 0; i < n; i++)
            {
                l.Add(ReadLong());
            }
            return l;
        }

        static IEnumerable<int> Range(int start, int stop)
        {
            if (start < 0 || stop < 0 || start > stop || (start <= 0 && stop <= 0))
                return new List<int>();

            return Enumerable.Range(start, stop - start);
        }

        static bool IsDigit(string str)
        {
            var i = 0;
            return int.TryParse(str, out i);
        }

        static int SumDigits(long num)
        {
            return num.ToString().Select(x => x.ToString()).Sum(int.Parse);
        }

        static int[] ToIntArray(string str)
        {
            return str.Select(x => x.ToString()).Select(int.Parse).ToArray();
        }

        static long Gcd(long a, long b) => b == 0 ? a : Gcd(b, a % b);
        static long Lcm(long a, long b) => a / Gcd(a, b) * b;

        static bool IsPrime(int x)
        {
            if (x <= 1 || (x != 2 && x % 2 == 0)) return false;
            if (x == 2) return true;

            for (int i = 3; i < x; i += 2)
                if (x % i == 0) return false;

            return true;
        }

        static string Read() => Console.ReadLine();
        static int ReadInt() => int.Parse(Read());
        static long ReadLong() => long.Parse(Read());

        static List<string> ReadSplit() => Read().Split().ToList();
        static List<int> ReadSplitInt() => Read().Split().Select(int.Parse).ToList();
        static List<long> ReadSplitLong() => Read().Split().Select(long.Parse).ToList();

        static void Print(object value) => Console.Write(value.ToString());
        static void Println(object value) => Console.WriteLine(value.ToString());

        static string Join<T>(IEnumerable<T> list) => string.Join("", list);
    }

    public static class MyExtensions
    {
        public static string Slice(this string str, int start = 0, int stop = 0)
        {
            if (start > str.Length || stop > str.Length || start < 0 || stop < 0)
                return "";

            if (stop == 0) stop = str.Length;
            return str.Substring(start, stop - start);
        }
    }
}


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

using namespace std;

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using cd = complex<ld>;

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

  int n;
  ll a, b;
  cin >> n >> a >> b;
  ll res = 0;
  vector<ll> p(n);
  for (ll& x : p) {
    cin >> x;
  }
  for (int i = 1; i < n; i++) {
    res += min(b, (p[i] - p[i - 1]) * a);
  }
  cout << res;
  return 0;
}

Measured memory_bytes: 3988
#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>
#define rep(i,a,n) for(ll i =(a);i<(n);i++)
#define urep(i,a,n) for(ll i = (a);i>=(n);i--)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q;
string S,T;
ll ans;
ll x[1000000];
ll y[1000000];
ll v[1000000];
ll a[1000000];
ll acopy[1000000];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
int main() {
	cin>>N;
	rep(i,0,N){
		cin>>a[i];
		acopy[i]=a[i];
	}
	sort(acopy,acopy+N);
	ll WAcount=0;
	rep(i,0,N){
		if(a[i]!=acopy[i])WAcount++;
	}
	if(WAcount==0){
			cout<<0<<endl;
			return 0;
		}
	cin>>Q;
	rep(i,0,Q){
		ll x,y;
		cin>>x>>y;
		x--;y--;
		if(a[x]==acopy[x])WAcount++;
		if(a[y]==acopy[y])WAcount++;
		swap(a[x],a[y]);
		if(a[x]==acopy[x])WAcount--;
		if(a[y]==acopy[y])WAcount--;
		if(WAcount==0){
			cout<<i+1<<endl;
			return 0;
		}
	}
	cout<<-1<<endl;
	return 0;
}



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

//g++ -g -o yourexe yourfile.cpp
//./yourexe < yourinput.in > youroutput.out

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

#define M 998244353

#define ll long long
#define ld long double
#define vi vector<ll>
#define pi pair<ll, ll>
#define vii vector<pi>
#define vvi vector<vi>
#define pb push_back
#define endl "\n"

#define REP(i, s, e) for (ll i = s; i < e; i++)
#define RREP(i, s, e) for (ll i = s; i > e; i--)

#define all(v) v.begin(), v.end()
#define part(v, s, e) v.begin() + s, v.begin() + e
#define print(v) for (auto i: v) cout << i << " ";

int main() {
    ll n, w;
    cin >> n >> w;
    vii arr(n);
    ll v = 0;
    REP(i, 0, n) {
        cin >> arr[i].first >> arr[i].second;
        v += arr[i].second;
    }
    vvi dp(n, vi (v+1, w+1));
    dp[0][0] = 0;
    dp[0][arr[0].second] = arr[0].first;
    REP(i, 1, n) {
        ll a = 0, b = arr[i].first;
        REP(j, 0, i) {
            REP(k, 0, v+1) {
                if (dp[j][k] + b <= w)
                    dp[i][arr[i].second + k] = min(dp[i][arr[i].second + k], b + dp[j][k]);
                dp[i][k] = min(dp[i][k], dp[j][k]);
            }
        }
    }
    //cout << dp[n-1][90] << endl;
    ll ans = 0;
    REP(i, 0, v+1) {
        if (dp[n-1][i] <= w)
            ans = max(ans, i);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 79864
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <sys/timeb.h>
#include <fstream>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;



int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n;
	cin >> n;
	int d, x;
	cin >> d >> x;
	vi a(n);
	rep(i, n)cin >> a[i];

	int c = 0;
	rep(i, n) {
		int t = 1;
		while (t <= d) {
			c++;
			t += a[i];
		}
	}

	cout << x+c << endl;

	return 0;
}


Measured memory_bytes: 256
n,m,q=map(int,input().split())
arr=[list(map(int,input().split())) for i in range(q)]
ans=0
for i1 in range(1,m+1):
    for i2 in range(i1,m+1):
        for i3 in range(i2,m+1):
            for i4 in range(i3,m+1):
                for i5 in range(i4,m+1):
                    for i6 in range(i5,m+1):
                        for i7 in range(i6,m+1):
                            for i8 in range(i7,m+1):
                                for i9 in range(i8,m+1):
                                    for i10 in range(i9,m+1):
                                        tmp=0
                                        arrs=[0,i1,i2,i3,i4,i5,i6,i7,i8,i9,i10]
                                        for a,b,c,d in arr:
                                            if arrs[b]-arrs[a]==c:
                                                tmp+=d
                                        ans=max(ans,tmp)
print(ans)

                                        

Measured memory_bytes: 72016
N, W =map(int,input().split())
 
INF = 10**10
#dp = [[INF]*100000]*(N*100)#余分に
dp = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range (N):
    dp[i][0] =0
for j in range (W+1):
    dp[0][j] =0
    

for i in range (N):
    v, w = map(int,input().split())
    for j in range (W+1):
        if j-w>=0:
            dp[i+1][j] = max(dp[i][j],dp[i][j-w]+v)
        else:
            dp[i+1][j] = dp[i][j]


print(dp[N][W])


Measured memory_bytes: 25940
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(int (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(int (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(int (i) = 1; (i) < (n); ++(i))
#define rrep1(i,n) for(int (i) = (n) - 1; (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

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

int main()
{
    ll n,ans = 0;
    cin >> n;
    vector<ll> a(n + 1),b(n);
    rep0(i, n + 1)cin >> a[i];
    rep0(i, n)cin >> b[i];
    rep0(i, n){
        if (a[i] >= b[i]) {
            ans += b[i];
        }else{
            if (a[i] + a[i + 1] <= b[i]) {
                ans += a[i] + a[i + 1];
                a[i + 1] = 0;
            }else{
                a[i + 1] -= b[i] - a[i];
                ans += b[i];
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>

char CompareCharacter(char* a_acS);

int main(void) {
	static char s_acS[100001];

	//文字列Sに入る英小文字を入力
	scanf("%s", s_acS);
	//Sに現れない最も早い英小文字を調べ、出力
	if (CompareCharacter(s_acS) != 0x30) {
		printf("%c\n", CompareCharacter(s_acS));
	}
	//文字列Sにすべての英小文字が使われているときNoneを出力
	else {
		printf("None\n");
	}
	return 0;
}

/**********
*	文字列Sに使われている英小文字を確認し、使われていない最も早い文字を調べる関数
*	*a_acS 文字列S
**/
char CompareCharacter(char* a_acS) {
	int i,j;				//カウントの変数
	char acChar[27];		//a～zまでの英小文字の配列
	char cAlp = 0x30;		//使われていない最も早い英小文字を戻り値として返す変数

	//a～zまでの英小文字の配列を作る
	for (i = 0;i < 27;i++) {
		acChar[i] = 0x61 +(char)(0x01*i);
	}
	//文字列Sに使われている英小文字をa～zの英小文字配列から取り除く
	for (i = 0;a_acS[i] != 0x00;i++) {
		for (j = 0;j < 26;j++) {
			if (a_acS[i] == acChar[j]) {
				acChar[j] = 0x30;
			}
			else {}
		}
	}
	//a～zの英小文字配列の取り除かれなかった最も早い英小文字を戻り値にする
	for (i = 0;(cAlp == 0x30 )&& i < 26;i++) {
		cAlp = acChar[i];
	}
	return(cAlp);
}

Measured memory_bytes: 1780
#include "bits/stdc++.h"

using namespace std;

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

#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define pb push_back

string fie[8]={};


int main(){
    int n;
    cin>>n;
    rep(loop,n){
        int x,y;
        rep(i,8) cin>>fie[i];
        
        cin>>x>>y;
        x--;y--;
        queue<pii> que;
        que.push(pii(y,x));
        while(que.size()){
            int X=que.front().second;
            int Y=que.front().first;
            fie[Y][X]='0';
            que.pop();
            
            int dx[]={3,2,1, 0,0,0, -3,-2,-1, 0,0,0};
            int dy[]={0,0,0, 3,2,1, 0,0,0, -3,-2,-1};
            
            
            rep(i,12){
                if( 0<=Y+dy[i] && Y+dy[i]<8  &&  0<=X+dx[i] && X+dx[i]<8 ){
                    if(fie[ Y+dy[i] ][ X+dx[i] ]=='1'){
                        que.push(pii(Y+dy[i],X+dx[i]));
                    }
                }
            }
        }
        cout<<"Data "<<loop+1<<":"<<endl;
        rep(i,8){
            rep(j,8){
                cout<<fie[i][j];
            }
            cout<<endl;
        }

    }
}

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

typedef unsigned long long ll;

const long long MOD = 1000000007;
long long modpow(long long a, long long n, long long m)
{
    long long ans = 1;
    while (n)
    {
        if (n & 1)
        {
            ans = (ans * a) % m;
        }
        a = (a * a) % m;
        n >>= 1;
    }
    return ans;
}
long long combi(long long n, long long a)
{
    long long ans = 1, ans1 = 1;
    for (long long i = n - a + 1; i <= n; i++)
    {
        ans *= i % MOD;
        ans %= MOD;
    }

    for (long long i = 2; i <= a; i++)
        ans1 = (ans1 * i) % MOD;
    ans1 = modpow(ans1, MOD - 2, MOD);
    return ((ans % MOD) * ans1) % MOD;
}

void dfs(string s, char mx, ll N)
{
    if (s.length() == (size_t)N)
    {
        cout << s.c_str() << endl;
    }
    else
    {
        for (char c = 'a'; c <= mx; c++)
        {
            dfs(s + c, ((c == mx) ? (char)(mx) : mx), N);
        }
    }
}

int bfs(int a, int b, int h, int w, char tmp[][101])
{
    int ans[101][101] = {0};
    char c[101][101] = {0};
    queue<pair<int, int>> s;

    for (int i = 0; i <= h; i++)
    {
        for (int j = 0; j <= w; j++)
        {
            c[i][j] = tmp[i][j];
        }
    }

    s.push(make_pair(a, b));

    while (s.size() > 0)
    {

        pair<int, int> tmp = s.front();
        s.pop();
        c[tmp.first][tmp.second] = '#';
        for (int i = -1; i <= 1; i++)
        {
            for (int j = -1; j <= 1; j++)
            {
                if (tmp.first + i < 1 || tmp.first + i > h)
                {
                    continue;
                }
                if (tmp.second + j < 1 || tmp.second + j > w)
                {
                    continue;
                }
                if (i != 0 && j != 0)
                {
                    continue;
                }
                if (i == 0 && j == 0)
                {
                    continue;
                }
                if (c[tmp.first + i][tmp.second + j] == '#')
                {
                    continue;
                }
                c[tmp.first + i][tmp.second + j] = '#';
                if (ans[tmp.first + i][tmp.second + j] == 0)
                {
                    ans[tmp.first + i][tmp.second + j] = ans[tmp.first][tmp.second] + 1;
                }
                else
                {
                    ans[tmp.first + i][tmp.second + j] = min(ans[tmp.first + i][tmp.second + j], ans[tmp.first][tmp.second] + 1);
                }
                s.push(make_pair(tmp.first + i, tmp.second + j));
            }
        }
    }

    int asd = 0;

    for (int i = 1; i <= h; i++)
    {
        for (int j = 1; j <= w; j++)
        {
            asd = max(a, ans[i][j]);
        }
    }

    return asd;
}

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

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

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

    ll ans = 1900 * m + (n - m) * 100;
    ans = ans * (1 << m);

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


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

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

	string l = s;
	string r;
	int ret = 0;
	for (int i = 1; i < n; ++i) {
		char last = l.back();
		if (r.find(last) == string::npos) {
			r.push_back(l.back());
		}
		l.pop_back();

		int count = 0;
		for (int j = 0; j < r.size(); ++j) {
			char c = r[j];
			if (l.find(c) != string::npos) {
				++count;
			}
		}


		if (ret < count) {
			ret = count;
		}
	}
	
	cout << ret << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <string.h>
#include <string>
#include <set>
using namespace std;
#define mp make_pair
#define pb push_back
#define ll long long
#define ii pair<int, int>
#define vi vector<int>
#define vii vector<ii>
#define vll vector<ll>
#define maxn 100010
#define mod 1000000007
#define int long long

template<typename T>
void trace(                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               T a){
	cout << a << "\n";
}

template<typename T, typename... Args>
void trace(T a, Args... args){
	cout << a << " ";
	trace(args...);
}

int f[257];
int last[257];
// int soms[257];
int s[maxn];

ll fp(ll x, ll y){
	if(!y) return 1;
	if(y&1) return x * fp(x,y-1) % mod;
	return fp(x*x%mod, y>>1);
}

int32_t main(){
	int n;
	cin >> n;
	string s;
	cin >> s;
	for(int i = 0; i < 26; i++) f['a'+i] = 0;
	for(int i = 0; i < n; i++){
		f[s[i]]++;
		// trace(s[i], f[s[i]]);
	}
	ll ans = 1;
	for(char i = 0; i < 26; i++) ans = ans * (f['a'+i]+1) % mod;
	ans = (ans -1 + mod) % mod;
	cout << ans << '\n';

	return 0;
}


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

int main() {
  string str;
  cin >> str;
  int q;
  cin >> q;

  string command, str2;
  int a, b;
  for (int i = 0; i < q; i++) {
    cin >> command >> a >> b;

    if (command == "print") {
      cout << str.substr(a, b - a + 1) << endl;
    } else if (command == "reverse") {
      string str3 = str.substr(a, b - a + 1);
      reverse(str3.begin(), str3.end());
      str = str.substr(0, a) + str3 + str.substr(b + 1, str.size() - a - 1);
    } else if (command == "replace") {
      cin >> str2;
      str = str.substr(0, a) + str2 + str.substr(b + 1, str.size() - a - 1);
    }
  }
}


Measured memory_bytes: 3196
#include <bits/stdc++.h>
#define RI register int
typedef long long LL;

#define FILEIO(name) freopen(name".in", "r", stdin), freopen(name".out", "w", stdout);

using namespace std;

char buf[1000000], *p1 = buf, *p2 = buf;
inline char gc() {
  if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, 1000000, stdin);
  return p1 == p2 ? EOF : *(p1++);
}
template <class T> inline void read(T &n) {
  n = 0; RI ch = gc(), f;
  while ((ch < '0' || ch > '9') && ch != '-') ch = gc();
  f = (ch == '-' ? ch = gc(), -1 : 1);
  while (ch >= '0' && ch <= '9') n = n * 10 + (ch ^ 48), ch = gc();
  n *= f;
}

int main() {
  
#ifdef LOCAL
  FILEIO("a");
#endif

  LL a, b, n; cin >> a >> b >> n;
  LL x = min(n, b - 1);
  cout << (a * x) / b - a * (x / b) << endl;

  return 0;
}

// created by Daniel yuan


Measured memory_bytes: 3600
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(){
  char *o = malloc(50 * sizeof(char)), *e = malloc(50 * sizeof(char));
  scanf("%s", o);
  scanf("%s", e);
  for(int i = 0;i < strlen(o); ++i){
    printf("%c",o[i]);
    if (i < strlen(e)) printf("%c", e[i]);
  }
  return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace  std;
int main(){
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    freopen("error.txt", "w", stderr);
    #endif        
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if((a+d-1)/d>=(b+c-1)/b)cout<<"Yes";
    else cout<<"No";




    
} 












































Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
const ll INF = 1LL << 60;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(void){
    int n;
    cin >> n;
    vector<int> h(n);
    rep(i,n) cin >> h[i];

    // dp table
    ll dp[100010];

    // initialize dp table
    rep(i,100010) dp[i] = INF;

    dp[0] = 0;

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

    cout << dp[n-1] << endl;
    
    return 0;
}


Measured memory_bytes: 1408
import java.util.Scanner; 

class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
       int N = sc.nextInt();

       for(int i =1; i<=10 ; i++){
           if(N <= 1000*i){
               System.out.println(1000*i-N);
               break;
           }
       }
        }

    }


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

int main()
{
	int S;
	cin >>S;
	int L=0,R=0;
	L=S/100;
	R=S%100;
	
	if(L>=1&&L<=12&&R>=1&&R<=12){
		cout << "AMBIGUOUS"<< endl;
	}
	else if(L>=0&&R>=1&&R<=12){
		cout << "YYMM"<< endl;
	}
	else if(R>=0&&L>=1&&L<=12){
		cout << "MMYY"<< endl;
	}
	else {
		cout << "NA" <<endl;
	}

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), i##_max = (b); i < i##_max; ++i)
#define RFOR(i, a, b) for (int i = (b)-1, i##_min = (a); i >= i##_min; --i)
#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define RREP(i, n) for (int i = (n)-1; i >= 0; --i)
#define ALL(obj) (obj).begin(), (obj).end()

using namespace std;
using vi = vector<int>;
using vd = vector<double>;
using i64 = int64_t;

constexpr int INF = 1 << 30;
constexpr int MOD = 1000000007;

template <typename T>
void print(vector<T> &v) {
  REP(i, v.size()) {
    if (i) cout << " ";
    cout << v[i];
  }
  cout << endl;
}

int main() {
  int n;
  cin >> n;
  string x, y;
  REP(i, n) {
    cin >> x >> y;
    auto xs = x.size();
    auto ys = y.size();
    x = ' ' + x;
    y = ' ' + y;
    vector<vi> dp(xs + 1, vi(ys + 1, 0));
    FOR(xi, 1, xs + 1) {
      FOR(yi, 1, ys + 1) {
        if (x[xi] == y[yi])
          dp[xi][yi] = dp[xi - 1][yi - 1] + 1;
        else
          dp[xi][yi] = max(dp[xi - 1][yi], dp[xi][yi - 1]);
      }
    }
    cout << dp[xs][ys] << endl;
  }
}


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

int main(){
	int ans = 0;
	int countc = 0;
	int countl = 0;
	string S;
	cin >> S;
	vector<char> moji(S.size());
	for (int i = 0; i < S.size(); i++)
		moji.at(i) = S.at(i);
	if (moji.at(0) == 'A')
		ans++;
	for (int i = 2; i < moji.size()-1; i++){
		if (moji.at(i) == 'C')
			countc++;
	}
	if (countc == 1)
		ans++;
	if (ans == 2){
		for (int i = 0; i < moji.size(); i++){
			if (moji.at(i) >= 'A' && moji.at(i) <= 'Z')
				countl++;
		}
		if (countl == 2)
			ans++;
	}

	if (ans == 3)
		cout << "AC" << endl;
	else
		cout << "WA" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
int main(void) {
  int n, t;
  cin >> n >> t;
  vector<int> a(n), b(n);
  rep(i, n) cin >> a[i] >> b[i];
  vector<vector<int>> v(n + 1, vector<int>(t + 1));
  rep(j, t) v[0][j] = 0;
  vector<vector<int>> w(n + 1, vector<int>(t + 1));
  rep(j, t) w[0][j] = 0;

  rep(i, n) rep(j, t + 1) {
    if(a[i] > j) {
      v[i + 1][j] = v[i][j];
      if(j > 0) {
        w[i + 1][j] = max(w[i][j], v[i][j - 1] + b[i]);
      } else {
        w[i + 1][j] = w[i][j];
      }
    } else {
      v[i + 1][j] = max(v[i][j], v[i][j - a[i]] + b[i]);
      w[i + 1][j] = max(max(w[i][j], w[i][j - a[i]] + b[i]),
                        v[i][j - 1] + b[i]);
    }
  }
  cout << w[n][t] << endl;
  return 0;
}

Measured memory_bytes: 70912
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using pint = pair<int, int>;
using plint = pair<lint, lint>;
struct fast_ios { fast_ios(){ cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(20); }; } fast_ios_;

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)


void solve(long long n){
    string s = to_string(n);
    REP(i, 3){
        if (s[i] == '1') { s[i] = 'x'; }
        if (s[i] == '9') { s[i] = '1'; }
        if (s[i] == 'x') { s[i] = '9'; }
    }
    cout << s << endl;

}

int main(){

    long long n;
    scanf("%lld",&n);
    solve(n);
    return 0;
}



Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ll long long int
#define int ll
//#define slld(t) scanf("%lld",&t)
//#define sd(t) scanf("%d",&t)
//#define pd(t) printf("%d\n",t)
//#define plld(t) printf("%lld\n",t)
#define vec vector < int >
#define vecp vector < pair < int , int > >
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define pii pair < int , int >
#define pll pair < ll , ll > 
#define debug(x)   cerr<<#x<<": "<<x<<endl
#define mod  1000000007
#define N   200005
#define MAX 300005
#define mod1 1000000007
#define mod2 998244353
#define bitcnt __builtin_popcountll
#define PI acos(-1)
//#define endl "\n"
#define inf 1e+15
int a[N] , val[N] = {0};
vec ans;
signed main(){
  fast;
  int m  , sum;
  cin>>m;
  for(int i = 1 ; i<=m ; i++)  cin>>a[i];

  for(int i = m ; i>= 1 ; i--){
  	  int j = i;
  	  sum = 0;
  	  while(j<=m)
  	  	sum += val[j] , j+=i;
  	  if(sum%2 == a[i]) val[i] = 0;
  	  else val[i] = 1 , ans.pb(i);
  }

  cout << ans.size() << endl;
  if(ans.size() > 0)
  	for(int i = ans.size() - 1 ; i>= 0 ; i--)
  		cout << ans[i] << " ";

}
  


Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
int main() {
    int x, y, d;
    int counter = 0;
    bool can_put = true;
    cin >> y >> x >> d;

    string s[y];

    for(int i = 0; i < y; i++) {
        cin >> s[i];
    }

    for(int i = 0; i < y; i++) {
        for(int j = 0; j < x - d + 1; j++) {
            for(int k = 0; k < d; k++) {
                if(s[i][j + k] != '.') {
                    can_put = false;
                }
            }
            if(can_put == true) {
                counter++;
            } else {
                can_put = true;
            }
        }
    }

    for(int i = 0; i < y - d + 1; i++) {
        for(int j = 0; j < x; j++) {
            for(int k = 0; k < d; k++) {
                if(s[i + k][j] != '.') {
                    can_put = false;
                }
            }
            if(can_put == true) {
                counter++;
            } else {
                can_put = true;
            }
        }
    }
    cout << counter<<endl;
    return 0;
}


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

const int N = 2e+3 + 5;
long long int a[N], isf[N], ans, dp[N][N];
vector<pair<long long int, int>> v;
int n;

long long int solve(int i, int j)
{
    if (i == (int)v.size())
        return 0;
    if (dp[i][j] == -1)
    {
        int i1 = v[i].second;
        int k = n - 1 - (i - j);
        dp[i][j] = max((long long)abs(i1 - j) * v[i].first + solve(i + 1, j + 1), (long long)abs(i1 - k) * v[i].first + solve(i + 1, j));
    }
    return dp[i][j];
}

int main()
{
    memset(dp, -1, sizeof(dp));
    cin >> n;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        v.push_back(make_pair(a[i], i - 1));
    }
    sort(v.begin(), v.end(), greater<pair<long long int, int>>());
    // for (int j = 0; j < n; j++)
    // {
    //     int maxi = 0;
    //     int k = v[j].second;
    //     for (int i = 1; i <= n; i++)
    //     {
    //         if (isf[i] == 0)
    //         {
    //             if (maxi == 0)
    //                 maxi = i;
    //             if (abs(i - k) > abs(maxi - k))
    //                 maxi = i;
    //         }
    //     }
    //     cout << k << " " << maxi << "\n";
    //     ans += (long long)abs(maxi - k) * a[k];
    //     isf[maxi] = 1;
    // }
    ans = solve(0, 0);
    cout << ans;
}

Measured memory_bytes: 35276
import java.util.*;

public class Main {
	final int INF = Integer.MAX_VALUE / 2;
	private void doit(){
		Scanner sc = new Scanner(System.in);
		while(true){
			int n = sc.nextInt();
			int m = sc.nextInt();
			if(n == 0 && m == 0) break;
			int [] nlist = new int[n];
			int [] mlist = new int[m];
			for(int i=0; i < m; i++){
				mlist[i] = sc.nextInt();
			}
			for(int i = 0; i < n; i++){
				nlist[i] = sc.nextInt();
			}
			int [][] dp = new int[n+1][256];
			for(int i=0; i <= n; i++){
				for(int j=0; j < 256; j++){
				dp[i][j] = INF;
				}
			}
			dp[0][128] = 0;
			for(int i=0; i < n; i++){
				for(int j=0; j < 256;j++){
					//if(dp[i][j] == INF) continue;
					
					for(int k=0; k < m; k++){
						int ind = j +mlist[k];
						if(ind < 0) ind = 0;
						if(ind > 255) ind = 255;
						
						int diff = ind - nlist[i];
						int value = dp[i][j] + (diff * diff);
						dp[i+1][ind] = Math.min(dp[i+1][ind], value);
						//System.out.println("dp=" + dp[i+1][ind] + " " + (i+1));
					}
				}
			}
//			for(int i=0; i <= n; i++){
//				for(int j=0; j < 255; j++){
//					if(dp[i][j] == INF){
//						System.out.print("INF ");
//					}
//					else{
//						System.out.print(dp[i][j] + " ");
//					}
//					
//				}
//				System.out.println();
//			}
			int ans = INF;
			for(int i=0; i < 256; i++){
				ans = Math.min(ans, dp[n][i]);
			}
			System.out.println(ans);
		}
	}

	public static void main(String[] args) {
		Main obj = new Main();
		obj.doit();
	}
}

Measured memory_bytes: 39000
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const double PI2 = 8.0 * atan(1.0);

#define REP(i,n)	for(int i=0;i<(int)n;++i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define FOR(i,s,n)	for(int i=s;i<(int)n;++i)

int n;
int a[100];

int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> a[i];
	sort(a, a + n);
	int res = 0;
	REP(i, n - 1) res += a[i + 1] - a[i];
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 256
X = int(input())

if 400 <= X and X <= 599:
    print('8')
elif 600 <= X and X <= 799:
    print('7')
elif 800 <= X and X <= 999:
    print('6')
elif 1000 <= X and X <= 1199:
    print('5')
elif 1200 <= X and X <= 1399:
    print('4')
elif 1400 <= X and X <= 1599:
    print('3')
elif 1600 <= X and X <= 1799:
    print('2')
elif 1800 <= X and X <= 1999:
    print('1')


Measured memory_bytes: 9120
program abc119d
  implicit none
  integer a, b, q, i
  integer(8), dimension(:), allocatable :: s, t, x, ans
  integer(8), parameter :: inf = 10_8**11

  read *, a, b, q
  allocate(s(a), t(b), x(q), ans(q))
  read *, s, t, x
  s = [-inf, s, inf]
  t = [-inf, t, inf]
  do concurrent (i = 1:q)
     block
       integer si, ti
       integer(8) s_west, s_east, t_west, t_east, d(4)
       si = bsrch(s, x(i))
       ti = bsrch(t, x(i))
       s_west = x(i) - s(si - 1)
       s_east = s(si) - x(i)
       t_west = x(i) - t(ti - 1)
       t_east = t(ti) - x(i)
       d(1) = merge(s_west, t_west, s_west > t_west)
       d(2) = merge(s_east, t_east, s_east > t_east)
       d(3) = merge(s_west + t_east * 2, s_west * 2 + t_east, s_west > t_east)
       d(4) = merge(t_west + s_east * 2, t_west * 2 + s_east, t_west > s_east)
       ans(i) = minval(d)
     end block
  end do
  do i = 1, q
     print '(i0)', ans(i)
  end do
contains
  pure integer function bsrch(ary, v)
    integer(8), intent(in) :: ary(:), v
    integer low, mid, high

    low = lbound(ary, 1)
    high = ubound(ary, 1)

    do while (low < high)
       mid = low + (high - low) / 2
       if (ary(mid) < v) then
          low = mid + 1
       else
          high = mid
       end if
    end do
    bsrch = low
  end function bsrch
end program abc119d


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

int main(){
    int k, n; cin >> k >> n;
    vector<int> num(n);
    for (int i=0; i<n; i++){
        cin >> num.at(i);
    }
    int min_dis=999999999;
    int temp_dis=0;
    for (int i=0; i<n; i++){
        if (i!=0){//初回じゃないとき
            temp_dis=0;
            temp_dis+=k-num.at(i);
            temp_dis+=num.at(i-1);
        } else {//初回のとき
            temp_dis=0;
            temp_dis+=num.at(num.size()-1)-num.at(i);
        }
        min_dis=min(min_dis, temp_dis);
    }
    cout << min_dis << endl;
    return 0;
}

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

using namespace std;

string vowels = "aeiou";

int main() {
	char c;
	cin >> c;

	string ans = vowels.find(c) == string::npos ? "consonant" : "vowel";
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main (void){
    int N;
    int K;
    int Q;
    int S[100000];
    int a=1;
    int b=1;
    int c=0;
    int d=1;

    scanf("%d %d %d",&N,&K,&Q);
    for(a;a<N+1;a++){
        S[a] = K;
    }
    for(b;b<Q+1;b++){
        scanf("%d",&c);
        S[c] +=1;
    }
    for(d;d<N+1;d++){
        if(S[d]-Q<=0){
            printf("No\n");
        }else if(S[d]-Q>0){
            printf("Yes\n");
        }
    }
        return 0;
}

Measured memory_bytes: 896
# coding:utf-8

import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
import itertools


#sys.setrecursionlimit(10**7)
#N, Q = map(int, input().split())
#G = [list(input()) for i in range(H)]
#INF = V * 10001
#A = [int(i) for i in input().split()]
#AB = [list(map(int, input().split())) for _ in range(K)]


N, M = map(int, input().split())
H = [int(i) for i in input().split()]
AB = [list(map(int, input().split())) for i in range(M)]
#s={AB[0][0]}
A = [0]*N
ans = 0
#print(H)


for i in range(M):
    #s.add(AB[i][0])
    #s.add(AB[i][1])
    #print(AB[i][0]-1, AB[i][1]-1)
    #print(H[AB[i][0]-1], H[AB[i][1]-1])
    if(H[AB[i][0]-1]==H[AB[i][1]-1]):
        A[AB[i][0]-1] =-1
        A[AB[i][1]-1] =-1
    elif(H[AB[i][0]-1]<H[AB[i][1]-1]):
        A[AB[i][0]-1] =-1
    else:
        A[AB[i][1]-1] =-1

#print(A)
#print(s)
ans = A.count(0)
#ans += N-len(s)


print(ans)


Measured memory_bytes: 99504
#include <bits/stdc++.h>
#include <vector>
#include <string>

using namespace std;

vector<string> split(const string &s, char delim) {
  vector<string> elems;
  string item;
  for (char ch: s) {
    if (ch == delim) {
      if (!item.empty()) {
        elems.push_back(item);
      }
      item.clear();
    }
    else {
      item += ch;
    }
  }
  if (!item.empty()) {
    elems.push_back(item);
  }
  return elems;
}

string to_str_with_zero(int i, int w) {
  ostringstream sout;
  sout << std::setfill('0') << std::setw(w) << i;
  string s = sout.str();
  return s;
}

int letter_to_int(char c) {
  return tolower(c) - 'a';
}

bool array_equal(vector<int> a1, vector<int>a2) {
  if (a1.size() != a2.size()) {
    return false;
  }
  for (int i=0; i<a1.size(); i++) {
    if (a1.at(i) != a2.at(i)) {
      return false;
    }
  }
  return true;
}

int gcd(int a, int b) {
  if (a == b) {
    return a;
  }
  else if (a > b) {
    return gcd(a - b, b);
  }
  else {
    return gcd(a, b - a);
  }
}

long nCr(int n, int r) {
    long ans = 1;
    for (int i = n; i > n - r; --i) {
        ans = ans*i;
    }
    for (int i = 1 ; i < r + 1; ++i) {
        ans = ans / i;
    }
    return ans;
}

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m; 
    if (u < 0) u += m;
    return u;
}

int main() {
  std::cout << std::setprecision(9);
  int divisor = 1000000007;
  int k;
  cin >> k;
  string s;
  cin >> s;
  
  long long c1 = 1;
  long long c2 = s.size();
  long long ans = 0;
  long long pow = 1;
  for (int i=0; i<k+1; i++) {
    ans *= 26;
    ans %= divisor;
    if (i > 0) {
      pow *= 25;
      pow %= divisor;
    }
    ans += (c1 * pow) % divisor;
    ans %= divisor;
    c1 = c2;
    c2 *= i + s.size() + 1;
    c2 %= divisor;
    c2 *= modinv(i + 2, divisor);
    c2 %= divisor;
  }
  cout << ans << endl;
}

Measured memory_bytes: 5284
n = gets.to_i
s = gets.chomp

max = 0
x = []
for i in 0...n do
    y = []
    x.push(s[i])
    for j in i+1...n do
        y.push(s[j])
    end
    xy = x & y
    if xy.count > max
        max = xy.count
    end
end

puts max


Measured memory_bytes: 1788
N=gets.to_i
a=gets.chomp.split.map(&:to_i)
b=gets.chomp.split.map(&:to_i)
ans=0
0.upto(N-1) do |i|
  if a[i] <= b[i]
    ans+=a[i]
    b[i]-=a[i]
    a[i]=0
    if a[i+1] <= b[i]
      ans+=a[i+1]
      b[i]-=a[i+1]
      a[i+1]=0
    else
      ans+=b[i]
      a[i+1]-=b[i]
      b[i]=0
    end
  else
    ans+=b[i]
    a[i]-=b[i]
    b[i]=0
  end
end
puts ans

Measured memory_bytes: 17692
MOD = 1_000_000_007

class Combination
  def initialize
    @fact = (1..10**5*2+1).to_a
    @fact.each_with_index do |e, idx|
      @fact[idx] = @fact[idx] * @fact[idx-1] % MOD if idx > 0
    end
  end

  def choose(n, r)
    return 0 if not (0 <= r and r <= n)
    return 1 if r == 0 or r == n
    fact(n) * inverse( fact(r) * fact(n-r) )
  end

  def fact(n)
    @fact[n-1]
  end

  def inverse(x)
    pow(x, MOD-2)
  end

  def pow(x, n)
    ans = 1
    while n > 0
      ans = ans * x % MOD if n.odd?
      x = x * x % MOD
      n >>= 1
    end
    ans
  end
end

lines = $stdin.read
array = lines.split("\n")
H,W,A,B = array[0].split(" ").map(&:to_i)

@comb = Combination.new
ans = 0

max_n1,max_n2 = 0,0

for i in B...W
  n1,r1 = H-A-1+i,i
  #max_n1 = [n1,max_n1].max
  #puts max_n1
  ans1  = @comb.choose(n1,r1) % MOD

  h,w   = A-1,W-1-i
  n2,r2 = h+w,w
  #max_n2 = [n2,max_n2].max
  #puts max_n2
  ans2  = @comb.choose(n2,r2) % MOD

  ans += ans1*ans2%MOD
end

puts ans%MOD

Measured memory_bytes: 3452
#include <iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<limits>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
using namespace std;


int main()
{
    int n;
    cin>>n;
    vector<int> a(n);
    for (int i = 0; i < n; i++)
    {
        cin>>a.at(i);
    }
    sort(a.begin(),a.end());
    reverse(a.begin(), a.end());
    int64_t com=a.at(0);
    for (int i = 1; i < n/2; i++)
    {
        com+=a.at(i)*2;
    }
    if (n%2==1)
    {
        com+=a.at(n/2);
    }
    cout<<com<<endl;



    

    return 0;
}

Measured memory_bytes: 4048
coord = []


def compress_y():
    global coord
    for y in range(len(coord)):
        if all(c == '.' for c in coord[y]):
            coord = coord[:y] + coord[y + 1:]
            return True
    return False


def compress_x():
    global coord
    for x in range(0, len(coord[0])):
        if all(row[x] == '.' for row in coord):
            for y in range(len(coord)):
                coord[y] = coord[y][:x] + coord[y][x + 1:]
            return True
    return False


def main():
    global coord
    h, w = map(int, input().split())
    coord = [list(input()) for _ in range(h)]
    while compress_y():
        pass
    while compress_x():
        pass

    for row in coord:
        print(''.join(row))


if __name__ == '__main__':
    main()


Measured memory_bytes: 3188
#include <cmath>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <iostream>
using namespace std;
typedef long long LL;
const int MaxN = 105;
LL dp[MaxN][4];
int main(){
	int n,k;
	cin >> n >> k;
	dp[1][1] = 1; dp[k][1] = 1;
	for(int i = 1; i <= n; i++){
		dp[i][0] += dp[i-1][1];
		dp[i][1] += dp[i-1][0];
		if(i-k >= 0) dp[i][1] += dp[i-k][0];
	}
	LL ans = 0;
	for(int i = 1; i <= n; i++) ans += dp[i][1];
	cout<<ans<<endl;
	return 0;
}


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

int main(){
    char s[20];
    char t[21];
    int ans=0;

    scanf("%s ",s);
    scanf(" %s ",t);

    for(int i=0;i<strlen(s);++i){
        if(s[i]!=t[i]){
            ans+=1;
            break;
        }

}
    if(ans==0){
        printf("Yes\n");
    }else {
        printf("No\n");
    }


    return 0;

}


Measured memory_bytes: 1632
using System;

namespace ITP1_4_C
{
    class Program
    {
        static void Main()
        {
            while (true)
            {
                string[] x = Console.ReadLine().Split(' ');
                int a = int.Parse(x[0]);
                int b = int.Parse(x[2]);
                
                if (x[1] == "+") 
                {
                    Console.WriteLine(a + b);
                }
                else if (x[1] == "-")
                {
                    Console.WriteLine(a - b);
                }
                else if (x[1] == "*")
                {
                    Console.WriteLine(a * b);
                }
                else if (x[1] == "/")
                {
                    Console.WriteLine(a / b);
                }
                else
                {
                    break;
                }
            }
        }
    }
}


Measured memory_bytes: 18008
#include <bits/stdc++.h>
 
#define ll long long
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll,ll>
#define ff first
#define ss second
 
using namespace std;
 
const double pi = acos(-1);
const int N = 1e6 + 6, mod = 998244353, M = 1e7 + 7;
const ll MAX = 5e18;
 
int r;
 
int main()
{
    cin >> r;
    printf("%.9f", 2 * pi * r);
    return 0;
}


Measured memory_bytes: 3724
#include <iostream>
#include <vector>
#include <utility>
#include <tuple>
#include <map>
#include <algorithm>
using Int = long long;
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
int main()
{
    string A, B, C; cin >> A >> B >> C;
    if (A.back() == B.front() && B.back() == C.front())
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val cards = (0 until n).map {
        val (suit, number) = readLine()!!.split(' ')
        suit to number.toInt()
    }

    val mergeSorted = mergeSort(cards)
    val quickSorted = quickSort(cards)

    (0 until n).all {
        mergeSorted[it].first == quickSorted[it].first
    }.run {
        println(if (this) "Stable" else "Not stable")
    }

    quickSorted.forEach { println("${it.first} ${it.second}") }
}

private fun mergeSort(cards: List<Pair<String, Int>>): List<Pair<String, Int>> {

    val mutableList = cards.toMutableList()
    val leftList = Array(cards.size / 2 + 2) { "" to 0 }
    val rightList = Array(cards.size / 2 + 2) { "" to 0 }

    fun merge(left: Int, mid: Int, right: Int) {
        val leftSize = mid - left
        for (i in 0 until leftSize) {
            leftList[i] = mutableList[left + i]
        }
        leftList[leftSize] = "" to Int.MAX_VALUE

        val rightSize = right - mid
        for (i in 0 until rightSize) {
            rightList[i] = mutableList[mid + i]
        }
        rightList[rightSize] = "" to Int.MAX_VALUE

        var l = 0
        var r = 0

        for (i in left until right) {
            if (leftList[l].second <= rightList[r].second) {
                mutableList[i] = leftList[l++]
            } else {
                mutableList[i] = rightList[r++]
            }
        }

    }

    fun sort(left: Int, right: Int) {
        if (left + 1 < right) {
            val mid = (left + right) / 2
            sort(left, mid)
            sort(mid, right)
            merge(left, mid, right)
        }
    }

    sort(0, cards.size)

    return mutableList
}

private fun quickSort(cards: List<Pair<String, Int>>): MutableList<Pair<String, Int>> {

    val mutableList = cards.toMutableList()

    fun partition(p: Int, r: Int): Int {
        val x = mutableList[r]
        var i = p - 1

        for (j in p until r) {
            if (mutableList[j].second <= x.second) {
                i++
                val t = mutableList[i]
                mutableList[i] = mutableList[j]
                mutableList[j] = t
            }
        }

        val t = mutableList[i + 1]
        mutableList[i + 1] = mutableList[r]
        mutableList[r] = t

        return i + 1
    }

    fun sort(p: Int, r: Int) {
        if (p < r) {
            val q = partition(p, r)
            sort(p, q - 1)
            sort(q + 1, r)
        }
    }

    sort(0, cards.lastIndex)

    return mutableList
}


Measured memory_bytes: 90260
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
int n,a,dp[500][500],ans,dx[]={1,-1,0,0},dy[]={0,0,1,-1},nx,ny,A,B,fl[500][500];
void f(int x,int y){
    queue<P> que;
    fl[x][y]=1;
    que.push({x,y});
    ans+=dp[x][y];
    //cout<<" "<<dp[x][y]<<endl;
    while(que.size()){
        P q=que.front();
        que.pop();
        for(int i=0;i<4;i++){
            nx=q.first+dx[i],ny=q.second+dy[i];
            if(0<=nx&&nx<n&&0<=ny&&ny<n&&dp[q.first][q.second]+(fl[q.first][q.second]==0)<dp[nx][ny]){
                dp[nx][ny]--;
                que.push({nx,ny});
            }
        }
    }
    return ;
}
int main(void){
    cin>>n;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            dp[i][j]=min(min(i,n-i-1),min(j,n-j-1));
        }
    }
    /*
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<dp[i][j];
        }
        cout<<endl;
    }*/
    for(int i=0;i<n*n;i++){
        cin>>a;
        A=(a-1)/n;
        B=(a-1)%n;
        //cout<<A<<" "<<B<<endl;
        f(A,B);
        
        /*
        for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<dp[i][j];
        }
        cout<<endl;
    }
    */
        
        
    }
    /*
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            cout<<dp[i][j];
        }
        cout<<endl;
    }*/
    cout<<ans<<endl;
}


Measured memory_bytes: 5584
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# FileName: 	C
# CreatedDate:  2020-08-22 13:23:10 +0900
# LastModified: 2020-08-22 13:37:55 +0900
#


import os
import sys
# import numpy as np
# import pandas as pd


def main():
    n, m = map(int, input().split())
    stairs = [0]*(n+1)
    stairs[0] = 1
    for _ in range(m):
        a = int(input())
        stairs[a] = -1
    for i in range(n-1):
        if stairs[i] == -1:
            continue

        if stairs[i+1] == -1:
            pass
        else:
            stairs[i+1] += stairs[i]

        if stairs[i+2] == -1:
            pass
        else:
            stairs[i+2] += stairs[i]
    if stairs[n-1] != -1:
        print((stairs[n-1]+stairs[n])%1000000007)
    else:
        print(stairs[n]%1000000007)


if __name__ == "__main__":
    main()


Measured memory_bytes: 468436