akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;
 
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        StringBuilder Newfile = new StringBuilder(); //????????´?????????????????????
      //H??¨W?????\?????????????????????????????§???  
        while (true) {
            String[] array = sc.nextLine().split(" ");
            int H = Integer.parseInt(array[0]);
            int W = Integer.parseInt(array[1]);
            if (H == 0 && W == 0) break ;
      //????????¢?????¢???????¨???????????????¶ HxW
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    if((i+j)%2 == 0)         //i??¨j???2????????????????????¨"#"??????????????????
                        Newfile.append("#");
                    else                      //i??¨j???2???????????????????????¨"."??????????????????
                        Newfile.append(".");

                }
                Newfile.append("\n");
            }
            Newfile.append("\n");
             
        }
       //StringBuilder????????????????????????????????????????????????????????????
        System.out.print(Newfile);
        
        sc.close();
    }
}

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

int main() {
	string s,a="";
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='?'){
			a+='D';
		}
		else
		a+=s[i];
	}
	cout<<a<<endl;
	return 0;
}


Measured memory_bytes: 3844
import java.util.*;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    long h = sc.nextLong();
    long w = sc.nextLong();
    if (h == 1 || w == 1) {
      System.out.println(1);
      return;
    }
    long num;
    if (h % 2 != 0 && w % 2 != 0) {
      num = h * w / 2 + 1;
    } else {
      num = h * w / 2;
    }
    System.out.println(num);
  }
}


Measured memory_bytes: 21972
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int n = Integer.parseInt(sc.next());
		
		int[] yen = new int[n];
		
		for(int i = 0; i < n; i++) {
			yen[i] = Integer.parseInt(sc.next());
		}
		
		Arrays.sort(yen);
		
		yen[n-1] = yen[n-1]/2;
		
		System.out.println(Arrays.stream(yen).sum());
	}
}

Measured memory_bytes: 26836
// Nurbakyt Madibek
// Look at my code! IT'S AWESOME

#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>
#include <ctime>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <cassert>
#include <unordered_map>
#include <bitset>
#include <unordered_set>

using namespace std;

#define pb push_back
#define pp pop_back
#define f first
#define s second
#define mp make_pair
#define sz(a) (int)((a).size())
#ifdef _WIN32
#  define I64 "%I64d"
#else
#  define I64 "%lld"
#endif
#define fname "."

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair < int, int > pi;
typedef pair < int, ull > pu;

const int inf = (int)1e9 + 123;
const ll infl = (ll)1e18 + 123;
const double eps = 1e-9;

const int MAX_N = (int)2e5 + 5;
const int mod = (int)1e9 + 7;

int H, W, h, w;
int a[505][505];
ll sum[505][505];

void solve(int H, int W, int h, int w) {
    if (H % h == 0 && W % w == 0) {
        cout << "No\n";
        return;
    }
    for (int i = 0; i < H; i++)
        for (int j = 0; j < W; j++) {
            if (i % h == 0 && j % w == 0)
                a[i][j] = 1000 * (h * w - 1) - 1;
            else
                a[i][j] = -1000;
            
            sum[i][j] = sum[i - 1][j] + sum[i][j - 1] - sum[i - 1][j - 1] + a[i][j];
            
            if (i + 1 >= h && j + 1 >= w) {
                ll res = sum[i][j];
                if (i - h >= 0)
                    res -= sum[i - h][j];
                if (j - w >= 0)
                    res -= sum[i][j - w];
                if (i - h >= 0 && j - w >= 0)
                    res += sum[i - h][j - w];
//                assert(res < 0);
            }
        }
    assert(sum[H - 1][W - 1] > 0);
    cout << "Yes\n";
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++)
            cout << a[i][j] << ' ';
        cout << endl;
    }
}

int main() {
#ifdef DEBUG
    freopen("input.txt", "r", stdin);
#endif  
    cin >> H >> W >> h >> w;
    solve(H, W, h, w);
    //    for (int i = 1; i <= 100; i++)
//        for (int j = 1; j <= 100; j++)
//            for (int i2 = 1; i2 <= i; i2++)
//                for (int j2 = 1; j2 <= j; j2++)
//                    solve(i, j, i2, j2);
    return 0;
}


Measured memory_bytes: 4736
#include <cstring>
#include <cstdio>
#define MOD 924844033
int dp[2005][2005][2];
int main()
{
	// freopen("AGC005-D.in", "r", stdin);
	int n, k, cur = 0;
	scanf("%d%d", &n, &k);
	dp[0][0][0] = 1;
	for (int i = 0; i < k << 1; i++)
	{
		for (int j = i; j < n; j += k << 1)
		{
			int nxt = cur ^ 1;
			memset(dp[nxt], 0, sizeof(dp[nxt]));
			dp[nxt][0][0] = 1;
			for (int x = 1; x <= n; x++)
			{
				dp[nxt][x][0] = (dp[cur][x][0] + dp[cur][x][1]) % MOD;
				if (j >= k)
					(dp[nxt][x][0] += dp[cur][x - 1][0]) %= MOD;
				if (j + 2 * k < n)
				{
					(dp[nxt][x][1] += dp[cur][x - 1][0]) %= MOD;
					(dp[nxt][x][1] += dp[cur][x - 1][1]) %= MOD;
				}
				else if (j + k < n)
				{
					(dp[nxt][x][0] += dp[cur][x - 1][0]) %= MOD;
					(dp[nxt][x][0] += dp[cur][x - 1][1]) %= MOD;
				}
			}
			cur ^= 1;
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++)
	{
		int res = dp[cur][i][0];
		for (int j = 1; j <= n - i; j++)
			res = (long long)res * j % MOD;
		(ans += (i & 1 ? -1 : 1) * res) %= MOD;
	}
	printf("%d\n", (ans + MOD) % MOD);
	return 0;
}


Measured memory_bytes: 128
#include<bits/stdc++.h>
#define Tp template<typename Ty>
#define Ts template<typename Ty,typename... Ar>
#define Reg register
#define RI Reg int
#define Con const
#define CI Con int&
#define I inline
#define W while
#define N 500000
#define Gmax(x,y) (x<(y)&&(x=(y)))
using namespace std;
int n,H=1,T=0,a[N+5],q[N+5],vis[N+5];string s;
int main()
{
	RI i,k;cin>>s,n=s.length()+1,s="%"+s+"%",s[1]=='<'&&(q[++T]=1),s[n-1]=='>'&&(q[++T]=n);
	for(i=2;i^n;++i) s[i-1]=='>'&&s[i]=='<'&&(q[++T]=i);W(H<=T) k=q[H++],
		s[k-1]=='>'&&(Gmax(a[k-1],a[k]+1),!vis[k-1]&&(vis[q[++T]=k-1]=1)),
		s[k]=='<'&&(Gmax(a[k+1],a[k]+1),!vis[k+1]&&(vis[q[++T]=k+1]=1));
	long long ans=0;for(i=1;i<=n;++i) ans+=a[i];return printf("%lld",ans),0;
}

Measured memory_bytes: 6680
#include<bits/stdc++.h>
typedef long long int ll;
typedef long double ld;
#define pb push_back
#define ff first
#define ss second
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
int main()
{
    char ch;
    cin>>ch;
    if(ch>='A' and ch<='Z')
        cout << "A";
    else if(ch>='a' and ch<='z')
        cout << "a";
}

Measured memory_bytes: 3624
#include<stdio.h>
#include<string.h>
int main()
{
    int n,i,d;
    char S[100000];
    gets(S);
    d=strlen(S);
    for(i=0; i<d; i++)
    {
        if(i%2==0)
        {
            if(S[i]=='R'||S[i]=='U'||S[i]=='D')
            {
                continue;
            }
            else
            {
                break;
            }
        }
        else
        {
            if(S[i]=='L'||S[i]=='U'||S[i]=='D')
            {
                continue;
            }
            else
            {
                break;
            }
        }
    }
    if(i==d)
    {
        printf("Yes\n");
    }
    else
    {
        printf("No\n");
    }
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  long long n;
  cin>>n;
  long long shou=LLONG_MAX;
  for(long long i=sqrt(n);i>=1;--i){
    if(n%i==0)shou=min(shou,n/i-1+i-1);
  }
  cout<<shou<<endl;
  return 0;
}


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

int main() {
  string s;
  cin >> s;
  int size = s.size();
  int zero = 0;
  int one  = 0;
  for (int i = 0; i < size; i++) {
    if (s[i] == '0')
      zero++;
    else
      one++;
  }
  cout << 2 * min(zero, one) << endl;
}

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

int main(){
    int N,ans=0;
    cin>>N;
    vector<int> a(N);
    for(int i=0;i<N;i++){
        cin>>a.at(i);
        ans += a.at(i)-1;
    }
    cout<<ans<<endl;
}


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


string to_s(int n){
	string s;
	do{s+='0'+n%10,n/=10;}while(n);
	reverse(s.begin(),s.end());
	return s;
}



int main(){
	int n,ans=1<<30;
	cin>>n;
	for(int i=0;i<2*n;i++){
		string s(to_s(i));
		string t(s.begin(),s.end());
		reverse(t.begin(),t.end());
		if(s==t && abs(i-n)<abs(ans-n)){
			ans=i;
		}
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 1212
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = (int)(n); i >= 0; i--)
#define SORT(c) sort((c).begin(),(c).end())
#define REVERSE(c) reverse((c).begin(),(c).end())
#define REVSORT(c) SORT(c);REVERSE(c)
#define ALL(x) (x).begin(),(x).end()
const long long MOD = 1000000007;
typedef long long ll;

int main(){
	string S;
	ll K;
	cin >> S >> K;
	char ans = '1';
	for(int i = 0; i < S.length(); i++){
		if(S[i] == '1'){
			if(i == K - 1){
				break;
			} else {
				continue;
			}
		} else {
			ans = S[i];
			break;
		}
	}
	cout << ans << endl;
}

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

#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
typedef pair<int,int> pii;
#define mkp make_pair
int INF=INT_MAX/2;
int m,n;
vector<vector<pii>> v;
vector<vector<int>> vv;
vector<int> used;
bool foo(int a){
    // cout<<"a "<<a<<endl;
    if(used[a]==1) return false;
    if(used[a]==2) return true;
    used[a]=1;
    for(int x:vv[a]){
        // cout<<"x "<<x<<endl;
        if(!foo(x)){
            used[a]=0;
            return false; 
        }
    }
    used[a]=2;
    return true;
}
int main(){
    cin>>m>>n;
    used=vector<int>(m,0);
    v=vector<vector<pii>>(m,vector<pii>(n,pii(0,INF)));
    rep(i,m){
        int K;
        cin>>K;
        rep(j,K){
            int a,b;
            string s;
            cin>>a>>s>>b;
            if(s==">="){
                v[i][a-1].first=max(v[i][a-1].first,b);
            }
            else{
                v[i][a-1].second=min(v[i][a-1].second,b);
            }
        }
    }
    vv=vector<vector<int>>(m);
    rep(i,m){
        rep(j,m){
            bool f=false;
            rep(k,n){
                if(v[i][k].first>v[j][k].second) f=true;
            }
            if(f){
                // cout<<i<<" "<<j<<endl;
                vv[i].push_back(j);
            }
        }
    }
    // return 0;
    bool f=true;
    rep(i,m){
        if(!foo(i)) f=false;
    }
    if(f) cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}

Measured memory_bytes: 1356
#include <bits/stdc++.h>
//#include <ext/pb_ds/tree_policy.hpp>
//#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
//using namespace __gnu_pbds;
//template<typename key, typename val>
//using ordered_tree =
//  tree<key, val, greater<>, rb_tree_tag, tree_order_statistics_node_update>;
typedef long long int64;
typedef complex<double> comp;
const double pi = 3.14159265358979323846;
const int inf = (int)1e+9 + 2;
const int64 inf64 = (int64)1e+18 + 2;
const double dinf = 1e+20;
const int mod = /*1'000'000'007;//*/998244353;
const int base = 2187;
const double eps = 1e-8;
const int N = 200'000;
const int LOGN = 19;

int n, m, k;

int64 pw(int64 a, int64 b) {
  int64 res = 1;
  while (b) {
    if (b & 1) {
      res *= a;
      res %= mod;
    }
    a *= a;
    a %= mod;
    b >>= 1;
  }
  return res;
}

void solve(int test) {
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    if (i == 0 && x != 0) {
      cout << "0\n";
      return;
    }
    ++mp[x];
  }
  if (mp[0] != 1) {
    cout << "0\n";
  } else {
    int prev = -1, val = 1;
    int64 ans = 1;
    for (auto& pr : mp) {
      if (pr.first != prev + 1) {
        cout << "0\n";
        return;
      }
      ans *= pw(val, pr.second);
      ans %= mod;
      prev = pr.first;
      val = pr.second;
    }
    cout << ans << '\n';
  }
}

void precalc() {
}

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);
  precalc();
  int test = 1;
  //cin >> test;
  //auto start = chrono::high_resolution_clock::now();
  for (int i = 1; i <= test; ++i) {
    solve(i);
  }
  //cerr << chrono::duration_cast<chrono::milliseconds>(chrono::high_resolution_clock::now() - start).count() << '\n';
  return 0;
}


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

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

using namespace std;


int main (void) 
{

  /* Variable_Proclamation */
  int K, S;    // input
  int ans;  // output

  int x, y, z;    // subscript
  int comp;
  int count;


  /* Input, Array_Proclamation */
  cin >> K >> S;


  /* Initialize */
  ans = 0;
  count = 0;


  /* Calculation */
  for(x=0; x<=K; x++)
  {
    for(y=0; y<=K; y++)
    {
      z = S -(x+y);
      if(z >= 0 && z <= K)
      {
        count++;
      }
    }
  }
  

  /* Output */
  cout << count << endl;


  return 0;

}


Measured memory_bytes: 256
from collections import defaultdict
d = defaultdict(int)

h,w,n = map(int, input().split())
a = [0]*n
b = [0]*n
for i in range(n):
    a[i],b[i] = map(int, input().split())
    a[i] -= 1; b[i] -= 1
    
## 左上のマスを(0,0)とする
## 正方形の左上のマスを(j,i)とする

for x in range(n):
    for k in range(3):
        for l in range(3):
            i = a[x]-k ; j = b[x]-l
            if i<0 or i+3>h or j<0 or j+3>w:
                continue
            d[(j,i)] += 1

ans =[0]*10
for k,v in d.items():
    ans[v] += 1
ans[0] = (h-2)*(w-2)-sum(ans)

for i in range(10):
    print(ans[i])


Measured memory_bytes: 174816
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

typedef long long int ll;

class House {
private:
    ll * floors[3];
    ll floor_1[10];
    ll floor_2[10];
    ll floor_3[10];
    
public:
    House() {
        floors[0] = floor_1;
        floors[1] = floor_2;
        floors[2] = floor_3;
        for(int i=0; i<3; i++) {
            for(int j=0; j<10; j++) {
                floors[i][j] = 0;
            }
        }
    }
    
    void ApplyRecord(int f, int r, ll v) {
        floors[f-1][r-1] += v;
    }
    
    void Print() {
        for(int i=0; i<3; i++) {
            for(int j=0; j<10; j++) {
                cout << " " << floors[i][j];
            }
            cout << endl;
        }
    }
};

int main() {
    ll n;
    House houses[4];
    cin >> n;
    
    for(ll i=0; i<n; i++) {
        int b, f, r;
        ll v;
        cin >> b >> f >> r >> v;
        houses[b-1].ApplyRecord(f, r, v);
    }
    
    for(int i=0; i<4; i++) {
        houses[i].Print();
        if(i != 4-1) {
            cout << "####################" << endl;
        }
    }
    
    return 0;
}



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

l = [0]*(n-k+1)
l[0] = sum(a[:k])
for i in range(k,n): l[i-k+1] = l[i-k] + a[i] - a[i-k]
for i in range(1,n-k+1):
  if l[i-1] < l[i]: print("Yes")
  else: print("No")

Measured memory_bytes: 31688
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#define lli long long int
#define uli unsigned long long int
#define inf 999999999999999999
#define rep(i,n,m) for(lli i=(lli)(n);i<(lli)(m);++i)
#define reep(i,n,m) for(int i=(int)(n);i<=(int)(m);++i)
#define per(i,m,n) for(lli i=(int)(m)-1;i>=(int)(n);--i)
#define st(n) sort(n.begin(), n.end())
#define rev(n) reverse(n.begin(),n.end())
#define ou(S) cout << S << endl
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  if(b/a>=c)ou(c);
  if(b/a<c)ou(b/a);
}

Measured memory_bytes: 256
#include"bits/stdc++.h"
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
typedef pair<int, int> P;
int rcnt[200006];
int dp[200006];
set<P>S;

signed main() {
	string s; cin >> s;
	int n = s.size();
	for (int i = 0; i < n; i++) {
		int l = s[i] - 'a';
		rcnt[i + 1] += 1 << l;
	}
	for (int i = 0; i <= n; i++) {
		rcnt[i + 1] ^= rcnt[i];
	}
	for(int i=1;i<=n;i++) {
		S.insert(P(rcnt[i], i));
	}
	queue<P>Q;
	fill(dp, dp + n + 1, 1e9);
	dp[0] = 0;
	Q.push(P(0, 0));
	while (!Q.empty()) {
		P np = Q.front(); Q.pop();
		int i = np.second;
		if (dp[i] < np.first)continue;

		int now = rcnt[i];
		vector<P>V;
		auto it = S.lower_bound(P(now, i));
		for (; it != S.end(); it++) {
			P p1 = *it;
			int e = it->second;
			if (it->first != now)break;
			if (dp[e] > dp[i] + 1) {
				dp[e] = dp[i] + 1;
				Q.push(P(dp[e], e));
				V.push_back(p1);
			}
		}
		rep(j, 26) {
			int now2 = now ^ (1 << j);
			it = S.lower_bound(P(now2, i));
			for (; it != S.end(); it++) {
				P p1 = *it;
				int e = it->second;
				if (it->first != now2)break;
				if (dp[e] > dp[i] + 1) {
					dp[e] = dp[i] + 1;
					Q.push(P(dp[e], e));
					V.push_back(p1);
				}
			}
		}
		rep(j, V.size()) {
			S.erase(S.find(V[j]));
		}
		//		M.erase(M.lower_bound(now));
	}
	cout << dp[n] << endl;
}


Measured memory_bytes: 23928
#include <iostream>

using namespace std;

int main(){
    long long h;
    long long w;
    cin >> h >> w;
    while(1){
        if(h == 1 || w == 1){
            cout << 1 << endl;
            break;
        }
        else{
            cout << (h * w + 1) / 2 << endl;
            break;
        }
    }
}

Measured memory_bytes: 256
N, W = map(int, input().split())

INF = 10**11 + 1
dp = [[INF]*(10**5 + 1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(N):
  w, v = map(int, input().split())
  for j in range(10**5 + 1):
    dp[i+1][j] = min(dp[i][j], dp[i][max(0, j-v)] + w)

ans = 0
    
for i, x in enumerate(dp[-1]):
  if x <= W:
    ans = i

print(ans)

Measured memory_bytes: 152820
#include<cstdio>
#include<vector>
#include<string>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<ctime>

using namespace std;

char s[15];
vector<char> ans;
int main()
{
	while(~scanf("%s",s)){
	    int len=strlen(s);
	    for(int i=0;i<len;i++){
		    if(s[i]=='1'||s[i]=='0') ans.push_back(s[i]);
		    else {
		    	if(ans.empty())continue;
		    	ans.pop_back();
			}
		}
		for(int i=0;i<ans.size();i++){
			printf("%c",ans[i]);
		}
		printf("\n");
	}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0;i<(n);++i)
#define per(i, n) for(int i=(n)-1;i>=0;--i)
#define repa(i, n) for(int i=1;i<(n);++i)
#define foreach(i, n) for(auto &i:(n))
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) (x).begin(), (x).end()
#define bit(x) (1ll << (x))
using ll = long long;
//const ll MOD = (ll)1e9+7;
const ll MOD = 998244353;
const int INF = (ll)1e9+7;
const ll INFLL = (ll)1e18;
using namespace std;
template<class t>
using vvector = vector<vector<t>>;
template<class t>
using vvvector = vector<vector<vector<t>>>;
template<class t>
using priority_queuer = priority_queue<t, vector<t>, greater<t>>;
template<class t, class u> bool chmax(t &a, u b){if(a<b){a=b;return true;}return false;}
template<class t, class u> bool chmin(t &a, u b){if(a>b){a=b;return true;}return false;}

#ifdef DEBUG
#define OUTPUT(x) (output(x), output("\n"))
#else
#define OUTPUT(x) (void)0
#endif

ll modpow(ll x, ll b){
	ll res = 1;
	while(b){
		if(b&1)res = res * x % MOD;
		x = x * x % MOD;
		b>>=1;
	}
	return res;
}

ll modinv(ll x){
	return modpow(x, MOD-2);
}

bool was_output = false;
template<class t>
void output(t a){
	if(was_output)cout << " ";
	cout << a;
	was_output = true;
}
void outendl(){
	was_output = false;
	cout << endl;
}

ll ans;
int func(ll a, ll b){
	if(b==1){
		return a;
	}
	ll num = 0;
	if(a>=5){
		ans += b / 2 * 2;
		num = func(a*2-9, b/2);
	}else{
		ans += b / 2;
		num = func(a*2, b/2);
	}
	if(b&1){
		++ans;
		num += a;
		if(num>=10){
			++ans;
			return num - 9;
		}
	}
	return num;
}
int main(){
	int m;
	cin >> m;
	ll d = 0;
	rep(i, m){
		ll a, b;
		cin >> a >> b;
		ll num = func(a, b);
		if(i)++ans;
		d += num;
		if(d>=10){
			++ans;
			d -= 9;
		}
	}
	cout << ans << endl;
	return 0;
}


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

typedef long long ll;

#define REP(i, n) for(int i=0; i<(n); i++)
#define REPS(i, n) for(int i=0; i<=(n); i++)
#define FOR(i, a, b) for(int i=a; i<(b); i++)
#define FORS(i, a, b) for(int i=a; i<=(b); i++)
// for container x
#define ALL(v) (v).begin(),(v).end()
#define RALL(v) (v).rbegin(),(v).rend()
#define SIZE(v) ((ll)(v).size())
#define MAX(v) *max_element(ALL(v))
#define MIN(v) *min_element(ALL(v))
#define UNIQUE(v) v.erase(unique(ALL(v)), v.end())

struct cww{cww(){ios::sync_with_stdio(false);cin.tie(0);}}star;
#pragma endregion

int main(){
    ll n;
    cin >> n;
    vector<ll> v(n+1, 2);
    v[0]=1;
    FORS(i, 2, n){
        for(int j=2*i; j<=n; j+=i){
            v[j]++;
        }
    }
    ll ans = 0;
    FORS(i, 1, n) ans+=v[i]*i;
    cout << ans-1 << endl;
    return 0;
}

Measured memory_bytes: 81340
if !ENV['RUBY_THREAD_VM_STACK_SIZE']
    exec({'RUBY_THREAD_VM_STACK_SIZE'=>'100000000'},'/usr/bin/ruby',$0)
end
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

def max(a,b)
    return a>b ? a : b
end
N,M=get_i
$g=Array.new(N){nil}
M.times do|i|
    x,y=get_i
    x-=1
    y-=1
    $g[x]=[] if $g[x].nil?
    $g[x].push(y)
end

$dp=Array.new(N,-1)
def memo(v)
    return $dp[v] if $dp[v]!=-1
    return 0 if $g[v].nil? or $g[v]==[]
    res=0
    $g[v].each do|l|
      res=max(res,memo(l)+1)
    end
    $dp[v]=res
    return $dp[v]
end
ans=0
N.times do|i|
    ans=max(ans,memo(i))
end
puts ans

Measured memory_bytes: 107188
#include<iostream>
#include<stack>
using namespace std;
int main(){
    int l; cin>>l;
    stack<int> s;
    int n,cat[101]={};
    for(int i=1;i<=l;++i){
	cin>>n;
	if(n>0){
	    s.push(n);
	    if(cat[n]==1){
		printf("%d\n",i);
		return 0;
	    }
	    cat[n]=1;
	}else{
	    if(s.empty()){
		printf("%d\n",i);
		return 0;
	    }
	    n=-n;
	    if(s.top()!=n){
		printf("%d\n",i);
		return 0;
	    }
	    cat[n]=0;
	    s.pop();
	}
    }

    printf("OK\n");
    return 0;
}	   


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

int main(){
    int64_t a, b, c, d;
    vector<int64_t> x;
    cin >> a >> b >> c >> d;
    x.push_back(a*c);
    x.push_back(a*d);
    x.push_back(b*d);
    x.push_back(b*c);
    sort(x.begin(), x.end());
    reverse(x.begin(), x.end());
    cout << x.at(0);


}

Measured memory_bytes: 3628
a, b, c = map(int, input().split())
ans = 0
if a == b == c and a % 2 == 0:
    print(-1)
else:
    while a % 2 == 0 and b % 2 == 0 and c % 2 == 0:
        total = a + b + c
        a = (total - a) / 2
        b = (total - b) / 2
        c = (total - c) / 2
        ans += 1
    print(ans)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int H,A,B,N,R,M,K,X,Y,Z,C;
  string S,T,U;
  int N_tmp=0;
  cin >> N;
  
  if(N / 100 == 7){
          cout << "Yes" << endl;
          return 0;
  }


  N_tmp = N % 100;
  
  if(N_tmp / 10 == 7){
              cout << "Yes" << endl;
          return 0;
  }

  N_tmp = N % 10;

  if(N_tmp / 1 == 7){
              cout << "Yes" << endl;
          return 0;
  }

  cout << "No" << endl;
  
  


}

Measured memory_bytes: 3628
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cinttypes>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;

int main() {
//  freopen("../Console/1.txt", "rb", stdin);
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);

  string S;
  cin >> S;

  int i = 0, j = S.size() - 1;
  int result = 0;

  while (i < j) {
    int left_cnt = 0;
    while (i < j && S[i] == 'x') {
      ++left_cnt;
      ++i;
    }

    int right_cnt = 0;
    while (i < j && S[j] == 'x') {
      ++right_cnt;
      --j;
    }

    if (left_cnt > 0 || right_cnt > 0) {
      if (i < j || (i == j && S[i] != 'x')) {
        result += abs(left_cnt - right_cnt);
      }
      continue;
    }

    if (i >= j) {
      continue;
    }

    if (S[i] != S[j]) {
      cout << -1 << '\n';
      return 0;
    }

    ++i;
    --j;
  }

  cout << result << '\n';

  return 0;
}


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

#define ll long long int
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()
using namespace std;


int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	ll a,b;
	cin >> a >> b;
	vector<ll> aso;
	vector<ll> taso;
	vector<ll> bso;
	vector<ll> tbso;
	if(a != 1)taso.push_back(a);
	if(b != 1)tbso.push_back(b);
	rep(i,2,sqrt(a)){
		bool ok=true;
		if(a%i == 0){
			rep(j,0,aso.size()){
				if(i%aso[j]==0) ok = false;
			}
			if(ok) aso.push_back(i);
				taso.push_back(a/i);
		}
	}
	rep(i,0,taso.size()){
		bool ok = true;
		rep(j,0,aso.size()){
			if(taso[i]%aso[j]==0) ok = false;
		}
		if(ok) aso.push_back(taso[i]);
	}
	rep(i,2,sqrt(b)){
		bool ok=true;
		if(b%i == 0){
			rep(j,0,bso.size()){
				if(i%bso[j]==0) ok = false;
			}
			if(ok) bso.push_back(i);
			tbso.push_back(b/i);
		}
	}
	rep(i,0,tbso.size()){
		bool ok = true;
		rep(j,0,bso.size()){
			if(tbso[i]%bso[j]==0) ok = false;
		}
		if(ok) bso.push_back(tbso[i]);
	}
	int ans=1;
	/*
	rep(i,0,aso.size()){
		cout << aso[i] << " ";
	}
	cout << endl;
	
	rep(i,0,bso.size()){
		cout << bso[i] << " ";
	}
	cout << endl;
*/
	auto aitr = aso.begin();
	auto bitr = bso.begin();
	while(aitr != aso.end() && bitr != bso.end()){
		if(*aitr == *bitr){
			ans++;
			aitr++;
			bitr++;
		}else if(*aitr>*bitr){
			bitr++;
		}else{
			aitr++;
		}
	}
	cout << ans << endl;
}


Measured memory_bytes: 384
#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 N 100005
#define MOD 1000000007
#define dd double
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i,a,b) for(int i=a;i<b;i++)
#define rep1(i,b) for(int i=1;i<=b;i++)
#define pb push_back
#define mp make_pair
#define clr(x) x.clear()
#define sz(x) ((int)(x).size())
#define F first
#define S second
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>ordered_set;
string s;
int n;
int dp[100001][13];
int go(int i,int x)
{
    if(i==n)
        {
            if(x%13==5)
                return 1;
            else
                return 0;
        }
    if(dp[i][x]!=-1)
            return dp[i][x];
    int ans=0;
    if(s[i]=='?')
        {
           for(int j=0;j<10;j++)
                {   int temp=10*x;
                    temp+=(j);
                    temp%=13;
                    ans=(ans+go(i+1,temp))%1000000007;
                }
              dp[i][x]=ans;  
             return ans;   
        }
    else
        {   int temp=10*x;
            temp+=(s[i]-'0');
            temp%=13;
            ans=(go(i+1,temp))%1000000007;
            dp[i][x]=ans;
            return ans;
        }    
}

//string s;

int main() {

ios_base::sync_with_stdio(false);
cin.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--){
        memset(dp,-1,sizeof(dp));
        cin>>s;
        n=s.size();
        cout<<go(0,0)<<" ";  
    }



return 0;
}

Measured memory_bytes: 13392
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (int)(n); i ++)
#define irep(i,n) for (int i = (int)(n) - 1;i >= 0;--i)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;// = 998244353;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

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

    int N; cin >> N;
    vector<ll> A(N);
    rep(i,N) cin >> A[i];

    ll ans = 0;
    for (int i = 1;i < N; ++i) {
        if (A[i] >= A[i - 1]) continue;
        ans += A[i - 1] - A[i];
        A[i] = A[i - 1];
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 4780
#include<stdio.h>
#include<stdlib.h>

typedef unsigned int uint;

static inline uint popcnt(uint n){
  uint s=n;
  s=(s&0x55555555)+((s&0xAAAAAAAA)>>1);
  s=(s&0x33333333)+((s&0xCCCCCCCC)>>2);
  s=(s&0x0F0F0F0F)+((s&0xF0F0F0F0)>>4);
  s=(s&0x00FF00FF)+((s&0xFF00FF00)>>8);
  s=(s&0x0000FFFF)+((s&0xFFFF0000)>>16);
  return s;
}

void run(void){
  const uint mod=1000000007;
  uint n;
  scanf("%u",&n);
  uint *a=(uint *)calloc(n,sizeof(uint));
  uint i,j;
  for(i=0;i<n;i++){
    for(j=0;j<n;j++){
      uint x;
      scanf("%u",&x);
      if(x) a[i]|=1<<j;
    }
  }
  uint *dp=(uint *)calloc(1<<n,sizeof(uint));
  dp[0]=1;
  for(i=1;i<(1<<n);i++){
    uint k=popcnt(i)-1;
    uint local=0;
    for(uint bit=a[k]&i;bit;bit-=bit&-bit){
      local+=dp[i^(bit&-bit)];
      if(local>=mod) local-=mod;
    }
    dp[i]=local;
  }
  printf("%d\n",dp[(1<<n)-1]);
}

int main(void){
  run();
  return 0;
}


Measured memory_bytes: 8320
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size1,init=nil,size2=-1) #size2に二次元配列時の最初の要素数、size1に次の配列の大きさ、initに初期値を投げることでその配列を返す
  if size2==-1
    return Array.new(size1){init}
  else
    return Array.new(size2){Array.new(size1){init}}
  end
end

puts 2*Math::PI*gets.to_i

Measured memory_bytes: 14288
use std::io;
use std::str::FromStr;

fn input<T:FromStr>() -> T {
    let mut line: String = String::new();
    io::stdin().read_line(&mut line);
    line.trim().parse().ok().unwrap()
}

fn main() {
    let s: String = input();
    let mut s: Vec<char> = s.chars().collect();
    let q: u64 = input();
    let mut flag = true;
    let mut head: Vec<char> = Vec::new();
    let mut tail: Vec<char> = Vec::new();
    for _ in 0..q {
        let query: String = input();
        let query: Vec<char> = query.split_whitespace().map(|s| s.chars().next().unwrap()).collect();
        if query[0] == '1' {
            flag = !flag;
        } else {
            if query[1] == '1' && flag || query[1] == '2' && !flag {
                head.push(query[2]);
            } else {
                tail.push(query[2]);
            }
        }
    }
    head.reverse();
    head.append(&mut s);
    head.append(&mut tail);
    if !flag {
        head.reverse();
    }
    for c in head {
        print!("{}", c);
    }
    println!();
}


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

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;
int main(){
  int r;
  cin >> r;
  if(r < 1200){
	cout << "ABC" << endl;
  }
  else if(r < 2800){
	cout << "ARC" << endl;
  }
  else{
	cout << "AGC" << endl;
  }
  return 0;
}


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

int main() {
  int H, W, D; cin >> H >> W >> D;
  map<int, pair<int, int>> M;
  for (int i = 0; i < H; i++) {
    for (int j = 0; j < W; j++) {
      int A; cin >> A;
      A--;
      M[A] = make_pair(i, j);
    }
  }
  int Q; cin >> Q;
  vector<pair<int, int>> q(Q);
  for (int i = 0; i < Q; i++) {
    int L, R; cin >> L >> R;
    L--; R--;
    q.at(i) = make_pair(L, R);
  }
  vector<long long> C(H*W);
  for (int i = 0; i < D; i++) {
    for (int j = i; j < H*W; j += D) {
      if (j == i) continue;
      C.at(j) = C.at(j-D);
      C.at(j) += abs(M[j-D].first - M[j].first);
      C.at(j) += abs(M[j-D].second - M[j].second);
    }
  }
  for (int i = 0; i < Q; i++) {
    cout << C.at(q.at(i).second) - C.at(q.at(i).first) << endl;
  }
}

Measured memory_bytes: 8192
package main

import "fmt"

func main() {
	m := make(map[int]int)
	var tmp int
	for i := 0; i < 3; i++ {
		fmt.Scan(&tmp)
		m[tmp]++
	}
	for k, v := range m {
		if v == 1 {
			fmt.Println(k)
			break
		}
	}
}


Measured memory_bytes: 512
#include <iostream>
#include <algorithm>
#include <string>
#include <map>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
int n;
string s[100010];
map<string,ll> mp;
int main()
{
  cin >> n;
  rep(i,n) cin >> s[i];
  rep(i,n) sort(s[i].begin(), s[i].end());
  
  rep(i,n) mp[s[i]]++;

  ll res = 0;
  for(auto itr=mp.begin();itr!=mp.end();++itr){
    res += (itr->second)*(itr->second - 1)/2;
  }
  cout << res << "\n";
  return 0;
}


Measured memory_bytes: 18176
def hyoji(l):
    for i in range(len(l)):
        if i != len(l) - 1:
            print(l[i], end = ' ')
        else:
            print(l[i])

n = int(input())
A = list(map(int, input().split()))

c = 0
for j in range(len(A)):
    for k in range(len(A) - 1, j, -1):
        if A[k] < A[k - 1]:
            A[k], A[k - 1] = A[k-1], A[k]
            c += 1
hyoji(A)
print(c)


Measured memory_bytes: 5604
N,X,Y=map(int,input().split())
ans=[0]*N
X-=1
Y-=1

for i in range(N-1):
    for j in range(i+1,N):
        ans[min(j-i,abs(j-Y)+abs(i-X)+1)]+=1

ans.pop(0)
for i in ans:
    print(i)

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

int main(void){
    int i,n,m;
    int a[6];
    char b[100];
    for(i=0;i<6;i++){
        scanf("%d",&a[i]);
    }
    scanf("%s",b);
    for(i=0;i<strlen(b);i++){
        if(b[i]=='E'){
            n=a[0];
            a[0]=a[3];
            a[3]=a[5];
            m=a[2];
            a[2]=n;
            a[5]=m;
        }
        if(b[i]=='N'){
            n=a[0];
            a[0]=a[1];
            a[1]=a[5];
            m=a[4];
            a[4]=n;
            a[5]=m;
        }
        if(b[i]=='S'){
            n=a[0];
            a[0]=a[4];
            a[4]=a[5];
            m=a[1];
            a[1]=n;
            a[5]=m;
        }
        if(b[i]=='W'){
            n=a[0];
            a[0]=a[2];
            a[2]=a[5];
            m=a[3];
            a[3]=n;
            a[5]=m;
        }
    }
    printf("%d\n",a[0]);
    return 0;
}


Measured memory_bytes: 1856
#include <algorithm>
#include <bits/stdc++.h>
#include <bitset>
#include <cassert>
#include <cstring>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <set>
#include <stack>
#include <utility>
#include <vector>
using namespace std;
#define REP(i, n) for (int64_t i = 0; i < (int64_t)n; i++)
#define REP_FOR(i, a, b) for (int64_t i = (int64_t)a; i < (int64_t)b; i++)
#define REP_REV(i, a, b) for (int64_t i = (int64_t)a; i > (int64_t)b; i--)
#define FORALL(v) (v).begin(), (v).end()
#define mp(a, b) make_pair(a, b)
#define eb(x) emplace_back(x)
#define F first
#define S second
typedef long long ll;
typedef long double ld;
typedef pair<int64_t, int64_t> pii;
typedef pair<ll, ll> pll;
typedef pair<ld, ld> pdd;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<int64_t> vii;
typedef vector<vii> vvii;
const ll mod = 1e9 + 7;
const int64_t infi = 1147483600;
const ll infl = 4e18 + 5;
const char EOL = '\n';
//cout << fixed << setprecision(17) << res << endl;
const ll MOD = 998244353;
 
int main() {
    string s, t, u;
    ll a, b;
    cin >> s >> t >> a >> b >> u;
    if (u == s) a--; else b--;
    cout << a << " " << b << endl;
}


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

int main()
{
    string a;
    cin >> a;
    
    if(a[0]== a[1] && a[0] == a[2] && a[1] == a[2]){
        cout << "No" << endl; 
    }else{
        cout << "Yes" <<endl;
    }

}

Measured memory_bytes: 256
import java.util.Scanner;
import static java.lang.System.out;
public class Main{
  static Scanner sc=new Scanner(System.in);

   public static void main(String[] args){
      int N = sc.nextInt();
      int sqrt = (int)Math.sqrt(N);
      out.println((int)Math.pow(sqrt,2));

    
  } 
}

Measured memory_bytes: 25940
#include <bits/stdc++.h>
// #include <iostream>
// #include <vector>
// #include <map>
// #include <algorithm>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())

template<typename T>
T mod(T a, T b){
    return (a + b) % b;
}

template<typename T>
T gcd(T a, T b){
    if (b == 0) return a;
    return gcd(b, a % b);
}

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

// n を素因数分解
map<ll, ll> factor(ll n){
    map<ll, ll> mp;
    for (ll i = 2; i*i <= n; i++) {
        while (n % i == 0) {
            mp[i]++;
            n /= i;
        }
    }

    if (n > 1) {
        mp[n]++;
    }

    return mp;
}

// 文字列に "hoge" が含まれているか
// string str = "hogepiyo";
// if (str.find("hoge") != string::npos) {
//     cout << "文字列が含まれています" << endl;
// }

// char to string
// char c = 'a';
// string str = {c};

void solve(){
    char c;
    cin >> c;

    if (c == 'A') {
        cout << 'T' << endl;
    }else if (c == 'C') {
        cout << 'G' << endl;
    } else if (c == 'T') {
        cout << 'A' << endl;
    } else {
        cout << 'C' << endl;
    }

    return;
}

int main(int argc, char const* argv[])
{
    solve();
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
  int n , count = 0 ,nin;
  scanf("%d",&n);
  
  int l[n] , t[n];
  
  for(int i = 0;i < n;i++){
    scanf("%d %d",&l[i],&t[i]);
  }
  
  for(int i = 0;i < n;i ++){
    nin =t[i]-l[i]+1;
    count += nin;
  }
  
  printf("%d",count);
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define fix20 cout << fixed << setprecision(20)
#define YES cout << "Yes" << endl
#define NO cout << "No" << endl
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define MOD 1000000007
#define all(vec) vec.begin(), vec.end()

int main(){
    long n;
    cin >> n;
    set<long> st1;
    st1.insert(n-1);
    st1.insert(n);
    for(long i=2;i<=sqrt(n-1)+1;i++){
        if((n-1) % i == 0) {
            st1.insert(i);
            st1.insert((n-1)/i);
        }
    }
    for(long i=2;i<=sqrt(n)+1;i++){
        if(n % i != 0) continue;
        long tmp = n/i;
        while(tmp % i == 0) tmp /= i;
        if(tmp == 1 || (tmp % i) == 1) st1.insert(i);
    }
    long ans = st1.size();
    if(st1.count(1)) ans--;
    cout << ans << endl;
}

Measured memory_bytes: 256
from itertools import product

S = input()

s = 0
for bits in product((False, True), repeat=len(S) - 1):
    buf = S
    for i in range(len(bits)):
        if bits[i]:
            sep = len(S) - (i + 1)
            buf = buf[:sep] + ' ' + buf[sep:]
    s += sum(map(int, buf.split()))

print(s)


Measured memory_bytes: 3060
k = int(input())
hoge = [1, 9, 30, 76, 141, 267, 400, 624, 885, 1249, 1590, 2208, 2689, 3411, 4248, 5248, 6081, 7485, 8530, 10248, 11889, 13687, 15228, 17988, 20053, 22569, 25242, 28588, 31053, 35463, 38284, 42540, 46581, 50893, 55362, 61824, 65857, 71247, 76884, 84388, 89349, 97881, 103342, 111528, 120141, 128047, 134580, 146316, 154177, 164817, 174438, 185836, 194157, 207927, 218812, 233268, 245277, 257857, 268182, 288216, 299257, 313635, 330204, 347836, 362973, 383709, 397042, 416448, 434025, 456967, 471948, 499740, 515581, 536073, 559758, 583960, 604833, 633651, 652216, 683712, 709065, 734233, 754734, 793188, 818917, 846603, 874512, 909496, 933081, 977145, 1006126, 1041504, 1073385, 1106467, 1138536, 1187112, 1215145, 1255101, 1295142, 1342852, 1373253, 1422195, 1453816, 1502376, 1553361, 1595437, 1629570, 1691292, 1726717, 1782111, 1827492, 1887772, 1925853, 1986837, 2033674, 2089776, 2145333, 2197483, 2246640, 2332104, 2379085, 2434833, 2490534, 2554600, 2609625, 2693919, 2742052, 2813988, 2875245, 2952085, 3003306, 3096024, 3157249, 3224511, 3306240, 3388576, 3444609, 3533637, 3591322, 3693924, 3767085, 3842623, 3912324, 4027884, 4102093, 4181949, 4270422, 4361548, 4427853, 4548003, 4616104, 4718640, 4812789, 4918561, 5003286, 5131848, 5205481, 5299011, 5392008, 5521384, 5610705, 5739009, 5818390, 5930196, 6052893, 6156139, 6239472, 6402720, 6493681, 6623853, 6741078, 6864016, 6953457, 7094451, 7215016, 7359936, 7475145, 7593865, 7689630, 7886244, 7984165, 8130747, 8253888, 8403448, 8523897, 8684853, 8802826, 8949612, 9105537, 9267595, 9376656, 9574704, 9686065, 9827097, 9997134, 10174780, 10290813, 10493367, 10611772, 10813692]
print(hoge[k-1])

Measured memory_bytes: 9328
#include <iostream>
#define MAX 100000
using namespace std;
typedef long long LL;

int n,k;
LL T[MAX];

int check(LL P) {
	int i=0;
	for(int j=0; j<k; j++) {
		LL s=0;
		while(s+T[i]<=P) {
			s+=T[i];
			i++;
			if(i==n)  return n;
		}
	}
	return i;
}

int solve() {
	LL left=0;
	LL right=100000*10000;
	while(right-left>1) {
		LL mid=(right+left)/2;
		LL t=check(mid);
		if(t>=n)  right=mid;
		else left=mid;
	}
	return right;
}


int main() {
	cin >> n >> k;
	for(int i=0; i<n; i++)  cin>>T[i];
	LL ans=solve();
	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 3864
h, w = map(int, input().split())

grid = [['x'] * (w + 2)]

for _ in range(h):
    new_row = list(input())
    new_row.insert(0, 'x')
    new_row.append('x')
    grid.append(new_row)
grid.append(['x'] * (w + 2))

for i in range(1, h + 1):
    for j in range(1, w + 1):
        if grid[i][j] == '.':
            mine_num = 0
            for krow in range(-1, 2):
                for kcol in range(-1, 2):
                    if grid[i + krow][j + kcol] == '#':
                        mine_num += 1
            grid[i][j] = str(mine_num)

for i in range(1, h + 1):
    print(''.join(grid[i][1:w + 1]))

Measured memory_bytes: 3188
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;

int main() {
	ll N;
	cin >> N;
	vector<ll> v(N);
	for (int i = 0;i < N;i++) {
		cin >> v[i];
	}
	sort(v.begin(), v.end());
	ll before = -1;
	ll ans = 0;
	for (int i = 0;i < N;i++) {
		ll now = v[i];
		if (now == before)
			continue;
		ll count = upper_bound(v.begin(), v.end(), now) - lower_bound(v.begin(), v.end(), now);
		if (count < now)
			ans += count;
		else
			ans += count - now;
		before = now;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>

using namespace std;

#define pb push_back
#define mp make_pair
#define ll long long
#define ull unsigned ll
#define db double
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PII pair<int, int>

string str;
int n, a, b;

int main() {
    cin >> n >> a >> b;
    cin >> str;
    int j = 0, o = 0;
    for (int i = 0; i < n; i++) {
        if (str[i] == 'a') {
            if (j + o < a + b) {
                j++;
                cout << "Yes\n";
            } else {
                cout << "No\n";
            }
        } else if (str[i] == 'b') {
            if (j + o < a + b && o < b) {
                o++;
                cout << "Yes\n";
            } else {
                cout << "No\n";
            }
        } else {
            cout << "No\n";
        }
    }
}

Measured memory_bytes: 896
#include <stdio.h>
int main()
{
	int i, x;
	i = 1;
	while (1) {
		scanf("%d", &x);
		if (x != 0) {
			printf("Case %d: %d\n", i, x);
			i++;
		}
		else {
			break;
		}
	}
	return 0;
}

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

namespace agc030_a
{
    class Program
    {
        static void Main(string[] args)
        {
            var text = Console.ReadLine();
            var n = int.Parse(text);
            text = Console.ReadLine();
            var list = text.Split(' ').Select(x => int.Parse(x)).ToList();

            var count = 0;
            for(int i = 0; i < n - 2; i++)
            {
                var item1 = list[i];
                var item2 = list[i + 1];
                var item3 = list[i + 2];

                var items = new List<int>();
                items.Add(item1);
                items.Add(item2);
                items.Add(item3);

                items = items.OrderBy(x => x).ToList();

                if (item2 == items[1]){
                    count++;
                }
            }

            Console.WriteLine(count.ToString());

        }
    }
}


Measured memory_bytes: 13396
package main

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

var nextString func() string

func init() {
	nextString = newReadString(os.Stdin)
}

func main() {
	n := nextInt()
	fmt.Println([]string{"No", "Yes"}[toInt(judge(n))])
}

func toInt(ok bool) int {
	if ok {
		return 1
	}
	return 0
}

func judge(n0 int) bool {
	n := n0
	cnt := 0
	for n != 0 {
		cnt += n % 10
		n /= 10
	}
	if cnt != 0 && n0%cnt == 0 {
		return true
	}
	return false
}

func nextInt() (result int) {
	result, _ = strconv.Atoi(nextString())
	return
}

func newReadString(ior io.Reader) func() string {
	r := bufio.NewScanner(ior)
	r.Buffer(make([]byte, 1024), int(1e+11))
	r.Split(bufio.ScanWords)

	return func() string {
		if !r.Scan() {
		}
		return r.Text()
	}
}


Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_map>

namespace ABC171
{
  class D
  {
  public:
    D() = default;
    ~D() = default;


    void Run()
    {
      int N, Q;
      std::cin >> N;

      constexpr int MAX_NUM = 100001;
      static int A[MAX_NUM] = {};
      static int B[MAX_NUM] = {};
      static int C[MAX_NUM] = {};

      long long sum = 0;
      std::unordered_map<int, int> A_map = {};
      for (int i = 0; i < N; ++i)
      {
        int A = 0;
        std::cin >> A;
        if (A_map.count(A) > 0)
        {
          A_map.at(A) += 1;
        }
        else
        {
          A_map.insert( std::make_pair(A, 1));
        }
        sum += A;
      }

      std::cin >> Q;
      for (int i = 0; i < Q; ++i)
      {
        std::cin >> B[i];
        std::cin >> C[i];
      }

      for (int i = 0; i < Q; ++i)
      {
        if (A_map.count(B[i]) > 0 && A_map.at(B[i])>0 )
        {
          int count = A_map.at(B[i]);
          A_map.at(B[i]) = 0;
          long long dif = C[i] - B[i];
          sum += (dif * count);
          if (A_map.count(C[i]) > 0)
          {
            A_map.at(C[i]) += count;
          }
          else
          {
            A_map.insert(std::make_pair(C[i], count));
          }
        }
        else
        {
          // 無いので変更なし
        }

        // 現在値の出力
        std::cout << sum << std::endl;
      }
    }
  };


}



int main()
{

  ABC171::D prob;
  prob.Run();

  return 0;
}

Measured memory_bytes: 7116
int main(){
int a, b;
scanf("%d%d", &a, &b);
if(a >= -1000 && b <= 1000){
if(a < b){
printf("a < b\n");
}
else if(a > b){
printf("a > b\n");
}
else if(a == b){
printf("a == b\n");
}
}
return 0;
}

Measured memory_bytes: 580
n=int(input())
i=0
L=[]


while i<n:
    card=input().split( )
    suit=card[0]
    number=int(card[1])

    if suit == "H":
        number = number +13
    elif suit == "C":
        number = number +26
    elif suit == "D":
        number = number +39
    L.append(number)
    i+=1

for j in range(52):
    k=j+1
    if not k in L:
        if int(j/13)==0:
            print(f"S {(j%13)+1}")
        elif int(j/13)==1:
            print(f"H {(j%13)+1}")
        elif int(j/13)==2:
            print(f"C {(j%13)+1}")
        elif int(j/13)==3:
            print(f"D {(j%13)+1}")



Measured memory_bytes: 5616