akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
typedef pair<int, int> P;
int main()
{
    ll a, b, x;
    cin >> a >> b >> x;

    ll ans = ((b - a + (a % x)) / x);
    if (a % x == 0) ans++;
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define all(vec) vec.begin(), vec.end()
using namespace std;
using ll = long long;
using P = pair<int, int>;
constexpr ll INF = (1LL << 30) - 1LL;
constexpr ll LINF = (1LL << 60) - 1LL;
constexpr ll MOD = 1e9 + 7;
template <typename T> void chmin(T &a, T b) { a = min(a, b); }
template <typename T> void chmax(T &a, T b) { a = max(a, b); }
int c[1010][1010];
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < d; j++) {
            for (int k = 0; k * d + i <= 1000; k++) {
                for (int l = 0; l * d + j <= 1000; l++) {
                    if (k % 2 == 0) {
                        if (l % 2 == 0) {
                            c[k * d + i][l * d + j] = 0;
                        } else {
                            c[k * d + i][l * d + j] = 1;
                        }
                    } else {
                        if (l % 2 == 0) {
                            c[k * d + i][l * d + j] = 2;
                        } else {
                            c[k * d + i][l * d + j] = 3;
                        }
                    }
                }
            }
        }
    }
    string s = "RYGB";
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            cout << s[c[i + j][i - j + 500]];
        }
        cout << "\n";
    }
}

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

using namespace std;

int main(){
	int n, a,  b;
	cin >> n >> a >> b;
	string str;
	cin >> str;
	int j = 0, o = 0;
	for(auto x: str){
		if((j + o) < (a + b) && x != 'c'){
			if(x == 'a'){
				j++;
				cout << "Yes\n";
			}
			else if(o < b){
				o++;	
				cout << "Yes\n";
			}
			else cout << "No\n";
		}
		else cout << "No\n";
		
	}
}




Measured memory_bytes: 3756
/* monkukui 競技プログラミング用のテンプレート  (ここから) */
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
using ll = long long int;
using lnt = long long int;
using Graph = vector<vector<int>>;
using Wgraph = vector<vector<pair<int, long long int>>>;
constexpr long long int INF = 1001001001001001LL;
constexpr long long int MOD = 1000000007LL;
constexpr double PI = 3.1415926535897932;
constexpr long long int di[] = {-1, 0, 1, 0, -1, 1, 1, -1};
constexpr long long int dj[] = {0, 1, 0, -1, 1, 1, -1, -1};

template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
inline void yes(){ cout << "yes" << endl; }
inline void Yes(){ cout << "Yes" << endl; }
inline void YES(){ cout << "YES" << endl; }
inline void no(){ cout << "no" << endl; }
inline void No(){ cout << "No" << endl; }
inline void NO(){ cout << "NO" << endl; }
inline void possible(){ cout << "possible" << endl; }
inline void Possible(){ cout << "Possible" << endl; }
inline void POSSIBLE(){ cout << "POSSIBLE" << endl; }
inline void impossible(){ cout << "impossible" << endl; }
inline void Impossible(){ cout << "Impossible" << endl; }
inline void IMPOSSIBLE(){ cout << "IMPOSSIBLE" << endl; }

#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = 1; i <= (n); i++)
#define DREP(i,n) for(int i = (n)-1; i >= 0; i--)
#define SREP(i,s,t) for(int i = s; i < t; i++)
#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()
#define PB push_back

/* monkukui 競技プログラミング用のテンプレート (ここまで)*/

lint dp[310][310][310];

int main(){
  
  lint n, K; cin >> n >> K;
  vector<lint> h(n + 1, 0);
  for(int i = 0; i < n; i++) cin >> h[i + 1];
  for(int i = 0; i < 310; i++)
    for(int j = 0; j < 310; j++)
      for(int k = 0; k < 310; k++)
        dp[i][j][k] = INF;

  dp[0][0][0] = 0;
  for(int i = 0; i < n; i++) {
    for(int j = 0; j < n; j++) {
      for(int k = 0; k <= K; k++) {
        if(dp[i][j][k] == INF) continue;
        
        // むし
        if(k != K) dp[i + 1][j][k + 1] = min(dp[i + 1][j][k + 1], dp[i][j][k]);

        // とる
        lint cost = 0;
        lint pre_h = h[j];
        lint cur_h = h[i + 1];
        if(cur_h > pre_h) cost = cur_h - pre_h;
        dp[i + 1][i + 1][k] = min(dp[i + 1][i + 1][k], dp[i][j][k] + cost);
      }
    }
  }
  
  lint ans = INF;
  for(int j = 0; j <= n; j++) {
    for(int k = 0; k <= K; k++) {
      ans = min(ans, dp[n][j][k]);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 232960
def s1(i):
    print("?", *[(i+j)%(2*N)+1 for j in range(N)])
    return 1 if input() == "Red" else 0

def s2(k, i):
    if (i-k) % (2*N) < N:
        print("?", *sorted([(k+j+N)%(2*N)+1 for j in range(N-1)] + [i+1]))
    else:
        print("?", *sorted([(k+j)%(2*N)+1 for j in range(N-1)] + [i+1]))
    return 1 if input() == "Red" else 0

N = int(input())
ANS = [-1] * (2*N)
if s1(0):
    r = 0
    b = N
else:
    b = 0
    r = N
while abs(r - b) > 1:
    m = (r+b) // 2
    if s1(m):
        r = m
    else:
        b = m

if r < b:
    ANS[r] = 1
    ANS[r+N] = 0

else:
    ANS[b] = 0
    ANS[b+N] = 1

k = max(r, b)
for i in range(2*N):
    if ANS[i] >= 0: continue
    ANS[i] = s2(k, i)

print("!", "".join(["R" if a else "B" for a in ANS]))


Measured memory_bytes: 3532
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        String a = sc.nextLine();
        String[] b = a.split(" ");
        int numA = Integer.parseInt(b[0]);
        int numB = Integer.parseInt(b[1]);
        int numC = Integer.parseInt(b[2]);
        if(numA + numB >= numC){
            System.out.println("Yes");
        } else {
            System.out.println("No");
        }
    }
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,n;
	int vis[200];
	int a[200];
	memset(vis,0,sizeof(vis));
	scanf("%d%d",&x,&n);
	for(int i = 1;i <= n;i++){
		scanf("%d",&a[i]);
		vis[a[i]] = 1;
	}
	sort(a + 1,a + 1 + n);
	int dd = x;
	int now = 0;
	for(int i = 1;i <= 200;i++){
		int tmp = abs(i - x);
		if(!vis[i]&&tmp < dd){
			now = i;
			dd = tmp;
		}
	}
	printf("%d\n",now);
	return 0;
}

Measured memory_bytes: 3728
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(a) int((a).size())

int main()
{
    ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	string s;
	cin>>s;
	string s5 = s;
	reverse(all(s5));
	if(s!=s5) {cout<<"No";return 0;}
	ll n = sz(s);
	ll i = n/2;
	string s1 = s.substr(0, i);
	string s2 = s.substr(i+1);
	string s3 = s1,s4=s2;
    reverse(all(s3));
    reverse(all(s4));
    if(s1 == s3 && s2 == s4) cout<<"Yes";
    else cout<<"No";
}

Measured memory_bytes: 256
import itertools
import math

n = int(input())

xy = []

for i in range(n):
    a,b = map(int,input().split(" "))
    xy.append((a,b))
count = 0
res = 0.0
for v in itertools.permutations(list(range(0,n))):
    count += 1
    pre = v[0]
    for i in v[1:]:
        res += math.sqrt((xy[pre][0] - xy[i][0])**2 + (xy[pre][1] - xy[i][1])**2)
        pre = i
print(res/count)

Measured memory_bytes: 73756
#%%
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

ans = 1
n, p = map(int, input().split())
l = factorization(p)
s = []
for i in range(len(l)):
    for j in range(l[i][1]//n):
        ans *= l[i][0]

print(ans)

#%%


Measured memory_bytes: 3188
#include "bits/stdc++.h"
using namespace std;
typedef long long li;

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

    li n;
    cin >> n;
    string x = "abcdefghijklmnopqrstuvwxyz";

    n--;

    li offset = 0;
    li unit = 26;
    for (int length = 1; length < 17; ++length) {
        li ub = offset + unit;
        if (n < ub) {
            li nn = n - offset;
            string ans = string(length, 'a');
            for (int i = 0; i < length; ++i) {
                ans[length - 1 - i] = x[nn %  26];
                nn /= 26;
            }
            cout << ans << endl;
            return 0;
        }
        offset = ub;
        unit *= 26;
    }

    return 0;
}

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


int main(void) {
	char x[1000] = "";
	int sum;
	
	do {
		sum = 0;
		scanf("%s", x);
		for (int i = 0; i < strlen(x); i++) {
			sum += (x[i] - '0');
		}
		if (sum < 1) break;
		printf("%d\n", sum);
		
		
		
	} while (true);
	
	return 0;
}

Measured memory_bytes: 2576
/*
ID: learnin7
TASK: test
LANG: C++                 
*/
/* LANG can be C++11 or C++14 for those more recent releases */
#include<bits/stdc++.h>

/*  Macros from Endagorion */
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;


int main(){
        
    ios_base::sync_with_stdio(0);
    
    //ofstream fout ("test.out");
    //ifstream fin ("test.in");
    //fin >> a >> b;
    //fout << a+b << endl;
    int a,b;
  	cin>>a>>b;
  	cout<<a*b<<endl;
    return 0;
}



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

#include <iostream>
#include <fstream>
//<editor-fold desc="definitions">
#include <bits/stdc++.h>
#define se cout << "test ok" << endl;
#define sp << " " <<
#define enl "\n"
using namespace std;
using ll=long long;
using ld=long double;
using vi = vector<int>;
using vii = vector<vector<int>>;
using vl = vector<ll>;
using vll = vector<vector<ll>>;
using vlll = vector<vector<vector<ll>>>;
using vc = vector<char>;
using vcc = vector<vector<char>>;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
ll mod = ll(1e9)+7;
ll inf = ll(1e18);
void bl(bool b, ostream& out=cout){ out << (b ? "Yes" : "No") << endl; }
void bl2(bool b, ostream& out=cout){ out << (b ? "YES" : "NO") << endl; }
template<typename T> inline bool chmax(T &a, T b){ if(a<b){a=b; return true;} return false; }
template<typename T> inline bool chmin(T &a, T b){ if(a>b){a=b; return true;} return false; }
int dx[] = {1, 0, -1, 0, 1, -1, 1, -1};
int dy[] = {0, 1, 0, -1, 1, -1, -1, 1};

#ifndef INCLUDE_DEBUG_HPP
#define INCLUDE_DEBUG_HPP

#include <iostream>
#include <vector>
#include <map>
using namespace std;

namespace dbg {
    using ll = long long;

    class Debug {
    public:
        Debug(){}
        template<typename T>
        void vd(vector<T> vec);
        template<typename T>
        void vd2(vector<vector<T>> vec);
        template<typename T>
        void ad(T *arr, ll n);
        template<typename T, size_t N>
        void ad2(T (&arr)[N], ll n);
        template<typename T>
        void md(T mp);
    };

    template<typename T>
    void Debug::vd(vector<T> vec) {
        for (auto vv : vec) cout << vv << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::vd2(vector<vector<T>> vec) {
        for (auto vv : vec) {
            for (auto vvv : vv) cout << vvv << " ";
            cout << endl;
        }
    }

    template<typename T>
    void Debug::ad(T *arr, ll n) {
        for (int i = 0; i <= n; i++) cout << arr[i] << " ";
        cout << endl;
    }

    template<typename T, size_t N>
    void Debug::ad2(T (&arr)[N], ll n) {
        for (int i = 0; i <= N; i++) for (int j = 0; j <= n; j++) cout << arr[i][j] << " ";
        cout << endl;
    }

    template<typename T>
    void Debug::md(T mp) {
        cout << "key : value" << endl;
        for (auto const &m : mp) cout << m.first << " : " << m.second << endl;
        cout << endl;
    }

}

#endif //INCLUDE_DEBUG_HPP

dbg::Debug debug;
//</editor-fold>

class AAC {
public:
	void solve(std::istream& in, std::ostream& out) {
	    string s;
	    in >> s;

	    if(s[1] == 'R') out << "ABC" << enl;
	    else out << "ARC" << enl;
	}
};


int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
	AAC solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod= int(1e9)+7;
using P = pair<ll,ll>;
using ld=long double;

int main(){
    vector<bool>ch(26,true);
    string s;cin >>s;
    ll n=s.size();
    for (int i = 0; i < n; ++i) {
        ch[s[i] - 'a'] = false;
    }
    for (int i = 0; i < 26; ++i) {
        if(ch[i]){
            cout <<(char)(i+'a')<<endl;
            return 0;
        }
    }
    puts("None");
    return 0;
}

Measured memory_bytes: 512
import java.io.*;

public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		 BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		 String input = in.readLine();
		 String numbers[] = input.split(" ");
		 int a = Integer.parseInt(numbers[0]);
		 int b = Integer.parseInt(numbers[1]);
		 int c = Integer.parseInt(numbers[2]);
		 
		 if(a < b && b < c){
			 System.out.println("Yes");
		 }
		 else{
			 System.out.println("No");
		 }

	}

}

Measured memory_bytes: 17084
// -*- coding:utf-8-unix -*-

use proconio::input;

fn main() {
    input! {
        n: u32,
        d: i64,
    }

    let distance = d * d;
    let mut ans = 0;
    for _i in 0..n {
        input! {
            x: i64,
            y: i64,
        }
        if x * x + y * y <= distance {
            ans += 1;
        }
    }
    println!("{}", ans);
}


Measured memory_bytes: 4968
// C - Not so Diverse
#include <bits/stdc++.h>
using namespace std;
#define rp(i,s,e) for(int i=(s);i<(e);++i)
int C[200000];

int main(){
	int N,K; cin>>N>>K;
	rp(i, 0, N){ int a; cin>>a; C[a-1]++; }
	sort(C, C+N);
	int c = 0;
	rp(i, 0, N-K) c += C[i];
	cout<< c <<endl;
}

Measured memory_bytes: 1024
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>

using namespace std;

#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define rep(i, n) for (ll i = 0; i < (n); ++i)

using ll = long long;
using ull = unsigned long long;
using P = pair<ll, ll>;
using vll = vector<ll>;
using vP = vector<P>;
using vvll = vector<vector<ll>>;
using vvP = vector<vector<P>>;

const ll INF = 1LL << 32;

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

  const ll mod = 1000000007;

  ll len = (ll)str.size();
  ll dp[len][2];

  dp[0][0] = 2;
  dp[0][1] = 1;

  for (ll i = 1; i < len; i++) {
    if (str[i] == '0') {
      dp[i][0] = dp[i - 1][0];
      dp[i][1] = (dp[i - 1][1] * 3) % mod;
    } else {
      dp[i][0] = (dp[i - 1][0] * 2) % mod;
      dp[i][1] = (dp[i - 1][0] + (dp[i - 1][1] * 3) % mod) % mod;
    }
  }

  cout << (dp[len - 1][0] + dp[len - 1][1]) % mod << endl;

  return 0;
}


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

using namespace std;
 
int main() {
    int k=0;
    char a[100];
    cin >> a;
    int size = strlen(a);
    for(int i=0; i < size/2 ; i++){
        if(a[i] != a[size - i-1]){
                k++;
        }
    }
    cout <<  k <<endl;
}

Measured memory_bytes: 256
# @uthor : Kaleab Asfaw
from sys import stdin, stdout
# Fast IO
# from math import gcd

def input():
	a = stdin.readline()
	if a[-1] == "\n": a = a[:-1]
	return a
def print(*argv, end="\n", sep=" "):
	n = len(argv)
	for i in range(n):
		if i == n-1: stdout.write(str(argv[i]))
		else: stdout.write(str(argv[i]) + sep)
	stdout.write(end)
# Others
mod = 10**9+7
def lcm(x, y): return (x * y) / (gcd(x, y))
def fact(x, mod=mod):
	ans = 1
	for i in range(1, x+1): ans = (ans * i) % mod
	return ans
def arr2D(n, m, default=0):
	lst = []
	for i in range(n): temp = [default] * m; lst.append(temp)
	return lst
def sortDictV(x): return {k: v for k, v in sorted(x.items(), key = lambda item : item[1])}

def solve(n, lst):
	map1 = {}
	for i in lst:
		if map1.get(i) == None: map1[i] = 1
		else: map1[i] += 1
	for i in range(1, n+1):
		if map1.get(i) == None: print(0)
		else: print(map1.get(i))

n = int(input())
lst = list(map(int, input().split()))
solve(n, lst)

Measured memory_bytes: 118724
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = s; i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) cout << ( (n) ? "Yes":"No") << endl;
#define CFYN(n) cout << ( (n) ? "YES":"NO") << endl;
using ll = long long;
using ull = unsigned long long;

int main(void)
{
    IOS
    int n, i;
    cin >> n >> i;

    cout << n - i + 1 << endl;
    
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int N = scanner.nextInt();
		int K = scanner.nextInt();
		int P[] = new int[N];
		int count = 0;
		for (int i = 0; i < K; i++) {
			int d = scanner.nextInt();
			for (int j = 0; j < d; j++) {
				int A = scanner.nextInt();
				P[A-1] += 1;
			}
		}

		for (int i = 0; i < N; i++) {
			if (P[i] == 0) {
				count += 1;
			}
		}
		System.out.println(count);
	}
}

Measured memory_bytes: 46264
#pragma GCC optimize("Ofast")  
#include<bits/stdc++.h>
using namespace std;

#define ll 				long long
#define eb 				emplace_back
const long long 		MOD = 1e9 + 7;
#define rep(i,n) 		for (int (i) = 0; (i) < (n); (i)++) 
#define REP(i,k,n)  	for (int (i) = (k); (i) <= (n); (i)++) 
#define REPR(i,k,n) 	for (int (i) = (k); (i) >= (n); (i)--)
#define watch(x) 		cout << (#x) << " = " << (x) << endl
#define t(x)			int x; cin >> x; while(x--)

int main()
{
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ios_base::sync_with_stdio(false); cin.tie(nullptr);
	
	/*---- continue Coding ;----*/

	string s;
	cin >> s;
	int a = 0;
	for (int i = 0; i < s.size(); i++) {
		if (s[i] == '+')
			a++;
		else
			a--;
	}
	cout << a << endl;
	
	/*---- break ;----*/

	cerr<<"Execution time: "<<(float)clock()/CLOCKS_PER_SEC<<" secs"<<endl; 
	return 0;
}

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

#define faster  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);

#define sq(x)   (x)*(x)
#define PI      acos(-1.0)
#define all(x) x.begin(),x.end()
#define nl      '\n'

typedef long long int ll;
typedef unsigned long long int  llu;


int main()
{
	faster;
	string s;
	int a,b,c,ans=0;
	cin>>s;
	if(s[0]=='R')ans++;
	if(s[1]=='R')ans++;
	if(s[2]=='R')ans++;
	if(ans==0)cout<<ans<<nl;
	else{
		if(s[1]=='S')cout<<"1"<<nl;
		else cout<<ans<<nl;
	}
	return 0;
}


Measured memory_bytes: 3604
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <map>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <numeric>
#include <utility>

#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; i++)
template<class T> bool chmax(T &a, const T &b) {if (a < b) {a = b; return 1;} return 0; }
template<class T> bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0; }

typedef long long ll;
using namespace std;

const ll INF = 1145148103643641919ll;

int main() {
    
    ll n, W;
    cin >> n >> W;
    vector<ll> w(n, 0), v(n, 0);
    int vmax = 0;
    REP(i, n) {
        cin >> w[i] >> v[i];
        vmax += v[i];
    }

    vector<vector<ll>> dp(n + 1, vector<ll>(vmax + 2, INF));
    dp[0][0] = 0;

    REP(i, n) {
        REP(u, vmax + 1) {
            if (u - v[i] >= 0)
                dp[i+1][u] = min(dp[i][u], dp[i][u - v[i]] + w[i]);
            else
                dp[i+1][u] = dp[i][u];
        }
    }

    for (int u = vmax + 2; u--;) {
        if (dp[n][u] <= W) {
            cout << u << endl;
            return 0;
        }
    }

}

Measured memory_bytes: 80256
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = 0
# for i in range(1,n):
#     ans = 
t = s
mod = 10**9+7
for i in range(n-1):
    t -= a[i]
    ans += a[i]*t
    ans %= mod

print(ans)



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

#include <bits/stdc++.h>
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REP(i, n) FOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

using namespace std;

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

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

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
    os << "{ ";
    REP(i, vec.size()) {
        os << vec[i] << " ";
    }
    os << "}";

    return os;
}

ll pow_mod(ll a, ll p) {
    ll res = 1;
    while(p) {
        if (p & 1) res = (res * a) % MOD;
        a = (a * a) % MOD;
        p >>= 1;
    }

    return res;
}


ll mod_inv(ll a, ll m) {
    ll b = m, u = 0, v = 1;
    while(a) {
        ll t = b / a;
        swap(b -= t * a, a);
        swap(u -= t * v, v);
    }

    return (u % m + m) % m;
}

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

void d_err() {
    cerr << endl;
}

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


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

const int a = 0, c = 1, g = 2, t = 3;


bool isvalid(int s0, int s1, int s2, int s3) {
    if(s3 == c) {
        // *agc
        if (s1 == a && s2 == g) return false;

        // ag*c
        if (s0 == a && s1 == g) return false;

        // a*gc
        if (s0 == a && s2 == g) return false;

        // *gac
        if (s1 == g && s2 == a) return false;
    }

    if(s3 == g) {
        // *acg
        if (s1 == a && s2 == c) return false;
    }

    return true;
}


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

    ll dp[N - 2][4][4][4];
    memset(dp, 0, sizeof(dp));

    REP(i, 4) REP(j, 4) REP(k, 4) {
        if (isvalid(-1, i, j, k)) dp[0][i][j][k] = 1;
    }

    REP(i, N - 3) {
        REP(j, 4) REP(k, 4) REP(l, 4) {

            ll tmp = 0;

            REP(m, 4) {
                if (isvalid(m, j, k, l)) tmp = (tmp + dp[i][m][j][k]) % MOD;
            }

            dp[i+1][j][k][l] += tmp;
        }
    }
    
    cout << fixed << setprecision(20);

    ll ans = 0;
    REP(i, 4) REP(j, 4) REP(k, 4) {
        ans = (ans + dp[N-3][i][j][k]) % MOD;
    }

    cout << ans << endl;

}


Measured memory_bytes: 256
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun nextPermutation(array: MutableList<Int>): Boolean {
    var tmp = 0
    for (i in array.size-2 downTo 0) {
        if (array[i] < array[i+1]) {
            for (j in array.size-1 downTo i+1) {
                if (array[j] > array[i]) {
                    tmp = array[i]
                    array[i] = array[j]
                    array[j] = tmp

                    val tmpArray = array.takeLast(array.size-(i+1)).sorted()
                    tmpArray.forEachIndexed { index, e ->
                        array[i+1+index] = e
                    }

                    return true
                }
            }
        }
    }

    return false
}

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val adj = Array(n) { mutableSetOf<Int>() }
    for (i in 0 until m) {
        val u = sc.nextInt() - 1
        val v = sc.nextInt() - 1
        adj[u].add(v)
        adj[v].add(u)
    }
    var p = (0 until n).toMutableList()
    var ans = 0
    do {
        if (p[0] != 0) continue
        var ok = true
        for (i in 1 until n) {
            if (!adj[p[i]].contains(p[i - 1])) {
                ok = false
                break
            }
        }
        if (ok) ans++
    } while (nextPermutation(p))
    println(ans)
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 39300
#include <stdio.h>

typedef struct {
  int value;              //数字(1~9)
  char shape;              //形(S,H,C,D)
} card;

void BubbleSort(card C[], int N)
{
  int i = 0, j, flag;
  card tmp;

  for(i = 0; i < N; i++){
    flag = 0;
    for(j = N - 1; j >= i + 1; j--){
      if(C[j].value < C[j-1].value){
        tmp = C[j];
        C[j] = C[j-1];
        C[j-1] = tmp;
        flag = 1;
      }
    }
  }
}

void SelectionSort(card C[], int N)
{
  int i, j, minj;
  card tmp;
  for(i = 0; i < N; i++){
    minj = i;
    for(j = i; j < N; j++){
      if(C[j].value < C[minj].value){
        minj = j;
      }
    }

    if(minj != i){      //iとminjが異なり実際に交換が行われた回数
      tmp = C[i];
      C[i] = C[minj];
      C[minj] = tmp;
    }
  }
}

int main(void)
{
  int n, i, flag = 0;
  card c1[36], c2[36];

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf(" %c%d", &c1[i].shape, &c1[i].value);
  	c2[i] = c1[i];
  }

  BubbleSort(c1 ,n);
  SelectionSort(c2, n);

  for(i = 0; i < n; i++){
      printf("%c%d", c1[i].shape, c1[i].value);
      if(i < n-1){
        printf(" ");
      }
      if(c1[i].shape != c2[i].shape){
        flag++;
      }
  }
  printf("\n");
  printf("Stable\n");

  for(i = 0; i < n; i++){
      printf("%c%d", c2[i].shape, c2[i].value);
      if(i < n-1){
        printf(" ");
      }
  }


  if(flag == 0){
    printf("\n");
    printf("Stable\n");
  }
  else{
    printf("\n");
    printf("Not stable\n");
  }

  return 0;

}



Measured memory_bytes: 2092
//#include <tourist>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = 1e9;
const ll LINF = ll(1e18) + 1;
const int MOD = 1000000007;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define rep(i, n) for (int i = 0; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define debug(v)          \
    cout << #v << ":";    \
    for (auto x : v)      \
    {                     \
        cout << x << ' '; \
    }                     \
    cout << endl;
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
//cout<<fixed<<setprecision(15);有効数字15桁
//-std=c++14
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
int n, m;
vector<int> a;
double d;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> d;
    double h=d/3;
    cout<<fixed<<setprecision(15);
    double ans=h*h*h;
    cout << ans << "\n";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef double dd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef pair<ll , ll> lli;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
typedef vector<lli> vlli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define in insert
#define f0(b) for(int i=0;i<(b);i++)
#define f00(b) for(int j=0;j<(b);j++)
#define f1(b) for(int i=1;i<=(b);i++)
#define f11(b) for(int j=1;j<=(b);j++)
#define f2(a,b) for(int i=(a);i<=(b);i++)
#define f22(a,b) for(int j=(a);j<=(b);j++)
#define sf(a) scanf("%lld",&a)
#define sff(a,b) scanf("%lld %lld", &a , &b)
#define pf(a) printf("%lld\n",a)
#define pff(a,b) printf("%lld %lld\n", a , b)
#define PI 3.14159265359
#define bug printf("**!\n")
#define mem(a , b) memset(a, b ,sizeof(a))
#define front_zero(n) __builtin_clzll(n)
#define back_zero(n) __builtin_ctzll(n)
#define total_one(n) __builtin_popcountll(n)

const ll mod = (ll)998244353;
const ll maxn = (ll)2e5+5;
const int nnn = 1048590;
const int inf = numeric_limits<int>::max()-1;
//const ll INF = numeric_limits<ll>::max()-1;
const ll INF = 1e18;

ll dx[]={0,1,0,-1};
ll dy[]={1,0,-1,0};
ll dxx[]={0,1,0,-1,1,1,-1,-1};
ll dyy[]={1,0,-1,0,1,-1,1,-1};


void solve(){
	ll n, x , y;
	cin >> n >> x >> y;
	vector < ll > v[n+5];
	ll dis[n+5][n+5];
	mem(dis , -1);
	v[x].pb(y);
	v[y].pb(x);
	for(ll i = 2; i <= n; i++)v[i].pb(i-1) , v[i-1].pb(i);
	ll ans[n+5];
	mem(ans , 0);
	for(ll i = 1; i <= n; i++){
		queue < ll > q;
		q.push(i);
		dis[i][i] = 0;
		while(!q.empty()){
			ll s = q.front();
			q.pop();
			for(auto u : v[s]){
				if(dis[i][u] == -1) dis[i][u] = dis[i][s]+1 , q.push(u) , ans[dis[i][u]]++;
			}
		}
	}
	for(ll i = 1; i <= n-1; i++) cout << ans[i]/2 << '\n';
	return;
}


int main() {
   
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    ll T;
    T=1;
   // cin >> T;
    //scanf("%lld",&T);
    ll CT = 0;
    //work();
    while(T--){
    	//cout << "Case " << ++CT <<": " ;
    	//printf("Case %lld: ",++CT);
		solve();
	}
    
    return 0;
}


Measured memory_bytes: 31744
#include <stdio.h>

int main(void){
 int W,H,x,y,r;

 scanf("%d%d%d%d%d",&W,&H,&x,&y,&r);

 if(x+r<=W && x-r>=0 && y+r<=H && y-r>=0){printf("Yes\n");}
 else{printf("No\n");}
 return 0;
}

Measured memory_bytes: 584
import java.util.Scanner;

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

		int n = sc.nextInt();
		int d = sc.nextInt();

		int[][] x = new int[n][d];
		for (int i = 0; i < x.length; i++) {
			for (int j = 0; j < x[i].length; j++) {
				x[i][j] = sc.nextInt();
			}
		}

		int cnt = 0;
		for (int i = 0; i < x.length - 1; i++) {
			for (int j = i + 1; j < x.length; j++) {
				if (isInteger(calcDistance(x[i], x[j]))) {
					cnt++;
				}
			}
		}

		System.out.println(cnt);

		sc.close();
	}

	static double calcDistance(int[] a, int[] b) {
		double sum = 0;
		for (int i = 0; i < a.length; i++) {
			sum += Math.pow(a[i] - b[i], 2.0);
		}
		return Math.sqrt(sum);
	}

	static boolean isInteger(double d) {
		return d == (int) d;
	}
}


Measured memory_bytes: 22100
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cctype>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(int i=0;i<(n);i++)
#define loop(i,a,n) for(i=a;i<(n);i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int,int> pii;

int f(string s){
    int ret = 0;
    rep(i,s.size())ret += s[i] - '0';
    return ret;
}

int main(void) {
    int i,j;
    int n;
    cin >> n;
    string s = to_string(n);
    if(n%f(s)==0)cout << "Yes" << endl;
    else cout << "No" << endl;


}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
// #include <boost/multiprecision/cpp_int.hpp> 

#define gc getchar//_unlocked
#define pc putchar//_unlocked
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pp pair<int,int>
#define ppl pair<ll,ll>
#define bigint boost::multiprecision::cpp_int
#define finp ios_base::sync_with_stdio(0);cin.tie(0);
#define bc __builtin_popcountll
#define afor(i,a,b) for(int i=a;i<=b;++i)
#define bfor(i,a,b) for(int i=a;i>=b;--i)
#define vi vector<int>
#define vpp vector<pp>
#define vll vector<ll>
#define fr first
#define se second

using namespace std;
using namespace __gnu_pbds;

char putnb[20];
void putn(ll n) {if(!n)pc('0');if(n<0)pc('-'),n=0-n;int pi=0;while(n)putnb[pi++]=(n%10)+'0',n/=10;while(pi)pc(putnb[--pi]);}
void sci(int *x) {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x = (int)((((*x)<<1) + ((*x)<<3)) + c - 48);}
void scll(ll *x)  {register char c = gc();*x = 0;for(; (c<48)||(c>57);c = gc());for(; (c>47)&&(c<58);c = gc())*x =  (ll)((((*x)<<1) + ((*x)<<3)) + c - 48);}
ll fp(ll a,ll b,ll c) {if(b==0)return 1%c; if(b==1)return a%c; ll ret=fp(a,b/2,c); ret=(ret*ret)%c; if(b&1)ret=(ret*a)%c; return ret;}

const ll mod=1e9 +7;
const ll mod2=1999999973;
const ll inf=1e18;
const int infs=1e9 + 1000;
const int N=100000;
const long double PI = acos(-1);

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

int dp1[10005][105];//prefix
int dp2[10005][105];
int n;

int main()
{
  finp;
  cin>>n;

  afor(i,1,10001)dp2[i][0] = infs;

  afor(i,1,n)
  {
    int col;
    cin>>col;
    afor(j,0,10001)dp1[j][i] = dp2[j][i] = infs;
    //no change
    dp1[col][i] = min(dp1[col-1][i-1],dp2[col+1][i-1]);
    dp2[col][i] = min(dp1[col-1][i-1],dp2[col+1][i-1]);
    //change
  
    afor(j,1,10000)
    {
      if(j == col)continue;
      dp1[j][i] = min(dp1[j-1][i-1]+1,dp2[j+1][i-1]+1);
      if(dp1[j][i] > infs)dp1[j][i] = infs;
      dp2[j][i] = dp1[j][i];
    }

    afor(j,1,10000)dp1[j][i] = min(dp1[j-1][i],dp1[j][i]);
    bfor(j,10000,1)dp2[j][i] = min(dp2[j+1][i],dp2[j][i]);
  }

  cout<<dp1[10000][n];
  
return 0;
}

Measured memory_bytes: 8448
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<vector<int>> gr(n, vector<int>());
  rep(i, n){
    int u, k;
    cin >> u >> k;
    u--;
    rep(j, k){
      int a;
      cin >> a;
      a--;
      gr.at(u).push_back(a);
    }
  }
  vector<int> ans(n, -1);
  ans.at(0) = 0;
  queue<int> q;
  q.push(0);
  while(!q.empty()){
    int now = q.front(); q.pop();
    for(auto i : gr.at(now)){
      if(ans.at(i) == -1){
        ans.at(i) = ans.at(now)+1;
        q.push(i);
      }
    }
  }
  rep(i, n){
    cout << i+1 << " " << ans.at(i) << endl;
  }
  return 0;
}


Measured memory_bytes: 3164
#include <bits/stdc++.h>
#include <stdlib.h>
using namespace std;
int min(int x,int y) {
  int m = x;
  if (y < x) {
    m = y;
  }
  return m;
}
int main() {
  int n,x,y;
  cin >> n >> x >> y;
  //最短距離＝min(j-i,橋を通る２通り)
  vector<int> num(n-1,0);//itojの最短距離がnであるものの個数
  for(int i = 1; i <= n; i++) {
    for(int j = n; j > i; j--) {
      int mind;
      mind = min(j-i, abs(j-y)+1+abs(x-i));
      num.at(mind-1) ++;
    }
  }
  for(int k = 0; k < n-1; k++) {
    cout << num.at(k) << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
#define max(p,q)((p)>(q)?(p):(q))
#define min(p,q)((p)<(q)?(p):(q))

int main(){
	ll n;
	scanf("%lld",&n);
	ll ans=1e10;
	rep(i,0,n){
		ll t;
		scanf("%lld",&t);
		ans=min(ans,log2(t&-t));
	}
	printf("%lld",ans);
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define radhey krishna
#define endl "\n"
int main(){
	#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
#endif
       ios_base::sync_with_stdio(false);
       cin.tie(0);
       cout.tie(0);

	int a , b, c , k, cnt = 0;
	cin>>a>>b>>c>>k;
	while(a>=b){
		cnt +=1;
		b *= 2; 
	}  
	while(b>=c){
		cnt +=1;
		c *=2;
	}
	if(cnt <= k){
    cout<<"Yes"<<endl;
	}
	else{
		cout<<"No"<<endl;
	}
	return 0;
}
	

Measured memory_bytes: 3644
#include <stdio.h>
int main()
{
  int H,W,i,n;
  while(1)
  {
    scanf("%d %d",&H,&W);
    if(H==0 && W==0) break;
    for(i=1;i<=H;i++)
    {
      for(n=1;n<=W;n++)
      {
        printf("#");
      }
      printf("\n");
    }
    printf("\n");
  }
  return 0;
}

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

typedef long long int ll;
typedef pair<ll, ll> p_ll;
typedef vector<pair<ll, ll>> vec_p; //vector<pair<ll, ll>> pairs(n) ,pairs.at(i) = make_pair(i*i, i)

#define ture ture
#define flase false
#define falg flag

#define REP(i, x) for (ll i = 0; i < (ll)(x); i++)
#define REPS(i, x) for (ll i = 1; i <= (ll)(x); i++)
#define RREP(i, x) for (ll i = ((ll)(x)-1); i >= 0; i--)
#define RREPS(i, x) for (ll i = ((ll)(x)); i > 0; i--)
#define all(x) (x).begin(), (x).end()

const ll MOD = pow(10, 9) + 7;
const ll LLINF = pow(2, 61) - 1;//llの最大9*10^18
const int INF = pow(2, 30) - 1;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

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

    ll N;
    string S;
    cin >> N;
    ll ans = 1;
    ll count_max = 0;

    REPS(i,N){
        ll tmp=i;
        ll count = 0;
        while (tmp % 2 == 0)
        {
            tmp /= 2;
            count++;
        }
        if(count_max<count){
            count_max = count;
            ans = i;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(){
    int a = 0;
    int b = 0;
    int sum = 0;
    while(scanf("%d %d",&a,&b)!= EOF){
        int counter = 0;
        sum = a + b;
        while (sum != 0) {
            sum = sum / 10;
            counter++;
        }
        printf("%d\n",counter);
    }
    return (0);
}

Measured memory_bytes: 600
#include <bits/stdc++.h>
#define endl '\n'
#define f first
#define s second
#define point complex<double>
#define pi acos(-1)
#define ld long double
using namespace std;
typedef long long ll;
const int xd=1e6;
const ll mod=1e9+7;
double dot(point a,point b)
{
    return (conj(a)*b).real();
}
double cross(point a,point b)
{
    return (conj(a)*b).imag();
}


ll fact[1000006], inv[1000006];

ll fp(ll base, ll exp)
{
    if (exp == 0)
        return 1;
    ll ans = fp(base, exp / 2);
    ans = (ans * ans) % mod;
    if (exp % 2 != 0)
        ans = (ans * (base % mod)) % mod;
    return ans;
}

void calcFacAndInv(ll n)
{
    fact[0] = inv[0] = 1;
    for (ll i = 1; i <= n; i++)
    {
        fact[i] = (i * fact[i - 1]) % mod;
        inv[i] = fp(fact[i], mod - 2);
    }
}

ll ncr(ll n, ll r)
{
    return ((fact[n] * inv[r]) % mod * inv[n - r]) % mod;
}

ll npr(ll n, ll r)
{
    return (fact[n] * inv[n - r]) % mod;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
calcFacAndInv(10000);
int n,b,r;
ll ansb,ansa;
cin>>n>>b;
r=n-b;
for(int i=1;i<=b;i++){
        if(r+1<i){
            cout<<0<<endl;
            continue;
        }
ansb=ncr(b-1,i-1)%mod;
ansa=ncr(r+1,i)%mod;
cout<<(ansb*ansa)%mod<<endl;;
}

    return 0;
}


Measured memory_bytes: 2432
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using pll = pair<ll, ll>;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(i) begin(i), end(i)

const int INF = 0x3fffffff;
const ll MINF = 0x7fffffffffff;
const ld DINF = numeric_limits<ld>::infinity();
const int MOD = 1000000007;
const int MODD = 998244353;
const ld EPS = 1e-9;
const ld PI = 3.1415926535897932;

template<class T> bool chmin(T &a, const T &b){ if(a > b){ a = b; return 1; } else return 0; }
template<class T> bool chmax(T &a, const T &b){ if(a < b){ a = b; return 1; } else return 0; }
template<class T> auto min(const T& a){ return *min_element(all(a)); }
template<class T> auto max(const T& a){ return *max_element(all(a)); }

ll gcd(ll a, ll b){ while(b){ ll c = b; b = a % b; a = c; } return a; }
ll lcm(ll a, ll b){ if(!a || !b) return 0; return a * b / gcd(a, b); }
ll pow_mod(ll n,ll k,ll m){ll r = 1;for(; k > 0;k >>= 1) {if (k & 1) r = (r * n) % m; n = (n * n) % m;}return r;}

//ここから。
int main(){
    int sx,sy,tx,ty;
    cin >> sx >> sy >> tx >> ty;
    rep(i,tx-sx) cout << 'R';
    rep(i,ty - sy) cout << 'U';
    rep(i,tx-sx) cout << 'L';
    rep(i,ty - sy + 1) cout << 'D';
    rep(i,tx-sx + 1) cout << 'R';
    rep(i,ty - sy + 1) cout << 'U';
    cout << "LU";
    rep(i,tx-sx + 1) cout << 'L';
    rep(i,ty - sy + 1) cout << 'D';
    cout << 'R' << endl;
}

Measured memory_bytes: 256
let () =
  let alphbets = Array.init 26 (fun x -> x + 97 |> Char.chr ,0) in
  let set_dic str dic =
    String.iter
      (fun c ->
         match c with
         | 'a'..'z' | 'A'..'Z' ->
           let lc = Char.lowercase c in
           let i = Char.code lc - 97 in
           dic.(i) <- (fun x -> fst x,snd x + 1) dic.(i)
         | _ -> ())
      str;
    dic
  in 
  let buf = Buffer.create 1028 in
  try
    while true do
      Buffer.add_string buf (read_line ());
    done
  with End_of_file ->
    set_dic (Buffer.contents buf) alphbets
    |> Array.iter (fun x -> Printf.printf "%c : %d\n" (fst x) (snd x))

Measured memory_bytes: 2296
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int m;
    cin >> m;
    cout << 48 - m << endl;
    
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#include <regex>
#include <map>
#include <set>
#include <iomanip>

using namespace std;
#define int long long

signed main(){
    int N,A;
    cin >> N >> A;
    
    cout << N*N-A << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;
 int main() {
	int x, y;
   cin >> x >> y;
 
	if (x == 2 || y == 2) 
   {
		cout << "No" << endl;
	}
	else if ((x==4||x==6||x==9||x==11)&&(y == 4 || y == 6 || y == 9 || y == 11)) 
   {
		cout << "Yes" << endl;
	}
	else if ((x == 1 || x == 3 || x == 5 || x == 7 || x == 8 || x == 10 || x == 12)
         && (y == 1 || y == 3 || y == 5 || y == 7 || y == 8 || y == 10 || y == 12))
   {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

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

typedef long long ll;
typedef long double Double;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

// chmax, chmin
template <class T> inline bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T> inline bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}

long long dp[30000];

void solve(long long H, long long N, std::vector<long long> A,
           std::vector<long long> B) {
    for(int i = 0 ; i < 30000 ; i++)
        dp[i] = 1e18;
    dp[0] = 0;
    for(int i = 0 ; i < N ; i++){
        for(int j = 0 ; j <= H ; j++){
            dp[j+A[i]] = min(dp[j+A[i]], dp[j] + B[i]);
        }
    }
    long long ans = 1e18;
    for(int i = H ; i < 30000 ; i++){
        ans = min(ans, dp[i]);
    }
    cout << ans << endl;


}

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


Measured memory_bytes: 512
N, D = map(int, input().split())
import math
X = []
for i in range(N):
    array = list(map(int, input().strip().split()))
    X.append(array)
var = 0
for i in range(N-1):
  for k in range(N-1-i):
    s = 0
    for j in range(D):      
      s = s + (X[i+1+k][j] - X[i][j])*(X[i+1+k][j] - X[i][j])
    if math.sqrt(s) - (int(math.sqrt(s))) ==0:
      var = var+1
print(var)

Measured memory_bytes: 3064
n, a, b = map(int, input().split())
if (b - a) % 2 == 0:
  print((b - a) // 2)
else:
  print(min(b - 1, n - a, a + (b - a - 1) // 2, n - b + 1 + (b - a - 1) // 2))

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

using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define FILL(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define FILL2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
int __stoi(string s){ return atoi(s.c_str()); }
ll sum(ll a[],ll N){ return accumulate(a,a+N,0LL);}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a/gcd(a,b)*b;}
template<class T> void chmax(T& a, T b){ if(a<b){a=b;} }
template<class T> void chmin(T& a, T b){ if(a>b){a=b;} }




int main(){
    string s; cin>>s;
    if(s=="ABC"){ cout << "ARC\n"; }
    else{ cout << "ABC\n"; }
    
}

Measured memory_bytes: 3600