akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

# define C continue;
# define R return

# define D double
# define I insert
# define ll long long
# define ld long double

# define ull unsigned long long
# define ui unsigned int

# define pb push_back
# define pf push_front

# define vi vector < int >
# define vc vector < char >
# define vs vector < string >
# define vb vector < bool >
# define vd vector < D >
# define vll vector < ll >
# define vull vector < ull >
# define vld vector < ld >

# define vvi vector < vector < int > >
# define vvb vector < vector < bool > >
# define vvc vector < vector < char > >
# define vvll vector < vector < ll > >
# define vvd vector < vector < D > >
# define vvld vector < vector < ld > >

# define all(v) (v).begin() , (v).end()
# define allrev(v) (v).rbegin() , (v).rend()
# define allcomp(v) v.begin() , v.end() , comp
# define allrevcomp(v) v.rbegin() , v.rend() , comp

# define pii pair < int , int >
# define pll pair < ll , ll >
# define pld pair < ld , ld >
# define pDD pair < D , D >

# define vpld vector < pld >
# define vpii vector < pii >
# define vpll vector < pll >
# define vpDD vector < pDD >

# define vvpii vector < vector < pii > >
# define F first
# define S second
# define mp make_pair

# define fast ios_base::sync_with_stdio(false) ; cin.tie(0) ; cout.tie(0);
# define dist(a,b,p,q) sqrt((p-a)*(p-a) + (q-b)*(q-b))

# define pp(n) printf("%.10Lf",n);
# define line cout<<"\n";

string vow = "aeiou";

const int dxhorse[] = {-2, -2, -1, -1, 1, 1, 2, 2};
const int dyhorse[] = {1, -1, 2, -2, 2, -2, 1, -1};

const int dx[] = { -1 , 0 , 0 , 1 } ;
const int dy[] = { 0 , -1 , 1 , 0 } ;

const ld pie = 3.14159265358979 ;
const ll mod = 1e9 + 7 ;

void solve ( int test_case )
{
    ll n ; cin >> n ; 
    cout << n*n ; 
}

int main()
{
    int t = 1;
    //cin >> t;

    for ( int i=0 ; i < t ; i++ ) solve(i);
    return 0;
}


Measured memory_bytes: 256
import re
A, B = map(int, input().split())
S = input()
n_pattern = "[0-9]"
res  = "Yes"
for i in range(A+B+1):
  if i < A:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  elif i == A:
    if S[i] != "-":
      res = "No"
      break
  else:
    if re.match(n_pattern, S[i]) is None:
      res = "No"
      break
  
print(res)


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

using namespace std;

template<int MOD>
struct Modular {
  int value;
  Modular(const Modular& k) : value(k.value) {}

  template<typename V>
    Modular(const V& v) : value(v % MOD) {
      if (value < 0) {
        value += MOD;
      }
    }

  Modular() : Modular(0) {}

  Modular& operator+=(Modular const& b) { value += b.value; if (value >= MOD) value -= MOD; return *this; } 
  Modular& operator-=(Modular const& b) { value -= b.value; if (value < 0) value += MOD; return *this; }
  Modular& operator*=(Modular const& b) { value = (long long)value * b.value % MOD; return *this; }
  Modular& operator++() { return *this += 1; }
  Modular& operator--() { return *this -= 1; }
  Modular operator++(int) { return *this += 1; }
  Modular operator--(int) { return *this -= 1; }

  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }
  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) { return os << a.value; }
  friend bool operator==(Modular const& a, Modular const& b) { return a.value == b.value; }
  friend bool operator!=(Modular const& a, Modular const& b) { return a.value != b.value; }
};

template <int T, typename V>
Modular<T> mexp(Modular<T> a, V e) {
  if (a == 0) return e == 0 ? 1 : 0; 
  Modular<T> res = 1; 
  while (e) { 
    if (e & 1) 
      res *= a; 
    a *= a; 
    e >>= 1; 
  }
  return res;
}

constexpr int MOD = 1'000'000'007;

using Mint = Modular<MOD>;

const int N = 1010;

void Run() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<bool> prime(N * N, true);
  vector<int> have;
  for (int i = 2; i < N * N; ++i) {
    if (!prime[i]) {
      continue;
    }
    if (i < N) {
      have.push_back(i);
    }
    for (int j = 2 * i; j < N * N; j += i) {
      prime[j] = false;
    }
  }
  prime[1] = false;
  function<int(int, int)> Gcd = [&](int x, int y) {
    return y == 0 ? x : gcd(y, x % y);
  };
  int g = 0;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    g = gcd(g, a[i]);
  }
  vector<int> cnt(N * N, 0);
  bool bad = false;
  for (int i = 0; !bad && i < n; ++i) {
    for (int x : have) {
      if (x > a[i]) break;
      if (a[i] % x == 0 && (++cnt[x] > 1)) {
        bad = true;
        break;
      }
      while (a[i] % x == 0) {
        a[i] /= x;
      }
    }
    if (prime[a[i]] && ++cnt[a[i]] > 1) {
      bad = true;
    }
  }
  if (!bad) {
    cout << "pairwise coprime\n";
  } else if (g == 1) {
    cout << "setwise coprime\n";
  } else {
    cout << "not coprime\n";
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  Run();
  return 0;
}

Measured memory_bytes: 11344
from collections import defaultdict

N, K = map(int, input().split())
MOD = 10**9 + 7

def Stirling_second(n, k, mod):
    Stir = {i: defaultdict(int) for i in range(n + 1)}
    Stir[1][1] = 1
    for i in range(2, n+1):
        Stir[i][1] = 1
        for j in range(2, k+1):
            Stir[i][j] = (Stir[i-1][j-1] + (j * Stir[i-1][j]) % mod) % mod
    return Stir
s = Stirling_second(N, K, MOD)
ans = s[N][K]
print(ans)


Measured memory_bytes: 81492
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner stdIn = new Scanner(System.in);
        int N = stdIn.nextInt();
        int[] A = new int[N];
        for(int i = 0; i < N; i++) {
            A[i] = stdIn.nextInt();
        }
        int swapCount = 0;
        for(int i = 0; i < A.length -1; i++) {
            for(int j = A.length - 1; j > i; j--) {
                if(A[j - 1] > A[j]) {
                    int tmp = A[j - 1];
                    A[j - 1] = A[j];
                    A[j] = tmp;
                    swapCount++;
                }
            }
        }
        String delimiter = "";
        for(int a : A) {
            System.out.print(delimiter + a);
            delimiter = " ";
        }
        System.out.println();
        System.out.println(swapCount);
    }
}


Measured memory_bytes: 26356
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define pf push_front
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){return (int)s.size();}
const long long INF = 1LL << 60;

int main(){
    cout << fixed << setprecision(20);
    vc<string> s(3);
    rep(i,3){
        cin >> s[i];
        reverse(all(s[i]));
    }
    int turn = 0;
    while(1){
        if(!SIZE(s[turn])){
            if(turn == 0) cout << "A" << endl;
            else if(turn == 1) cout << "B" << endl;
            else cout << "C" << endl;
            return 0;
        }
        int x = turn;
        turn = s[turn].back() - 'a';
        s[x].pop_back();
    }
    return 0;
}


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


#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cmath>
#include <numeric>
#include <iterator>
#include <fstream>

constexpr int64_t MOD = 1000000007;

using namespace std;

class AAtCoderContestScheduling {
public:
    static void solve(std::istream &cin, std::ostream &cout) {
        int64_t D = 0;
        cin >> D;
        vector<int64_t> c_vec(26);
        for (int i = 0; i < 26; ++i) cin >> c_vec[i];
        vector<vector<int64_t>> s_vec(D, vector<int64_t>(26));
        for (int i = 0; i < D; ++i)
            for (int j = 0; j < 26; ++j) cin >> s_vec[i][j];

        for (int i = 0; i < D; ++i) {
            int64_t tmp = 100000;
            int64_t index = 0;
            for (int j = 0; j < 26; ++j) {
                if (tmp > s_vec[i][j]) {
                    tmp = s_vec[i][j];
                    index = j;
                }
            }
            cout << index + 1 << endl;
        }
    }
};


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


Measured memory_bytes: 3720
#include <cstdio>
#include <utility>
#include <cmath>
#include <algorithm>
#include <iostream>
using namespace std;

#define gcu getchar_unlocked
int in(int c){int n=0;bool m=false;if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0');return m?-n:n;}
int in() {return in(gcu());}
bool scan(int &n){int c=gcu();return c==EOF?false:(n=in(c),true);}
bool scan(char &c){c=gcu();gcu();return c!=EOF;}
//bool scan(string &s){int c;s="";
//	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#define pcu putchar_unlocked
#define vo inline void out
template <typename T>
vo(T n){static char buf[20];char *p=buf;
	if(n<0)pcu('-'),n*=-1;if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10;
	while (p!=buf)pcu(*--p);}
vo(const char *s){while(*s)pcu(*s++);}
vo(char c){pcu(c);}
template <typename head, typename... tail> vo(head&& h, tail&&... t){out(h);out(move(t)...);}
#undef vo

int main() {
	for (int e, m; (e = m = in());) {
		for (int z = cbrtf(e); z >= 0; z--) {
			int te = e - z * z * z;
			int y = (int)sqrt(te);
			int tm = z + y + te - y * y;
			if (z + y > m)
				break;
			m = min(m, tm);
		}
		out(m, '\n');
	}
}


Measured memory_bytes: 3176
#include <iostream>
#include <bitset>

using namespace std;

int main() {
    int N, l, r;
    const int MAXN = 1e5+5;
    cin >> N;
    bitset<MAXN> seats;
    for(int i = 1; i <= N; ++i) {
        cin >> l >> r;
        for(int i = l; i <= r; ++i) {
            seats.set(i);
        }
    }
    cout << seats.count() << endl;
    return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
using namespace std;

typedef vector<int> 	vi;
typedef vector<vi>		vvi;
typedef long long int	ll;
typedef pair<int, int> 	ii;
typedef vector<ii> 		vii;
typedef vector<vii>		vvii;

void dfs(vvii &adj_list, int s, vi &color){
	for(ii nbour : adj_list[s]){
		if(color[nbour.first] == -1){
			if(nbour.second % 2 == 0)
				color[nbour.first] = color[s];
			else
				color[nbour.first] = 1 - color[s];
			dfs(adj_list, nbour.first, color);
		}
	}
}

int main(){

	ios::sync_with_stdio(false);
	cin.tie(NULL);

	int n;
	cin >> n;

	vvii adj_list(n, vii());
	int u, v, w;
	for(int i = 0; i < n - 1; i++){
		cin >> u >> v >> w;
		adj_list[u - 1].push_back(make_pair(v - 1, w));
		adj_list[v - 1].push_back(make_pair(u - 1, w));
	}

	vi color(n, -1);
	color[0] = 0;
	dfs(adj_list, 0, color);
	for(int i = 0; i < n; i++)
		cout << color[i] << endl;

	return 0;
}

Measured memory_bytes: 8960
using System;
using System.Collections.Generic;
					
public class my
{
	static Stack<int> weights = new Stack<int>();
	
	public static void Main()
	{
		string t;
		
		while( null != (t= Console.ReadLine()) ) {
			var s = int.Parse(t);
			
			my.TakeWeights(s);
			
			var n = weights.Count;
			
			for(int i = 0; i < n; i++) {
				Console.Write(weights.Pop());
				
				if(i != n-1)	Console.Write(" ");
				else	Console.WriteLine();
			}
		}
	}
	
	private static void TakeWeights(int s) 
	{		
		if(s > 1023) {
			return;
		} else if(s > 511) {
			_tw(s, 512);
		} else if(s >255) {
			_tw(s, 256);
		} else if (s > 127) {
			_tw(s, 128);
		} else if (s > 63) {
			_tw(s, 64);
		} else if(s > 31) {
			_tw(s, 32);
		} else if (s > 15) {
			_tw(s, 16);
		} else if(s > 7) {
			_tw(s, 8);
		} else if(s > 3) {
			_tw(s, 4);
		} else if(s > 1) {
			_tw(s, 2);
		} else if(s > 0) {
			_tw(s, 1);
		} else if (s == 0) {
			return;
		}
	}
	private static void _tw(int s, int w) 
	{
		weights.Push(w);
		my.TakeWeights(s-w);
	}
	
	private static void Swap(int[] A, int i, int j)
	{
		int tmp = A[i];
		A[i] = A[j];
		A[j] = tmp;
	}
	
	private static int GetInt()
	{
		return int.Parse(Console.ReadLine());
	}
	
	private static int[] GetIntArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
	}

	private static int[] GetIntArray(int n)
	{
		var A = new int[n];
		var s = Console.ReadLine().Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}
	
	private static int[] GetIntArray(int n, string t)
	{
		var A = new int[n];
		var s = t.Split(' ');

		for(int i = 0; i < n; i++) {
			A[i] = int.Parse(s[i]);
		}
		return A;
	}

	private static int[] GetIntArray(char c)
	{
		return Array.ConvertAll(Console.ReadLine().Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(char c, string s)
	{
		return Array.ConvertAll(s.Split(c), int.Parse);
	}
	
	private static int[] GetIntArray(string s)
	{
		return Array.ConvertAll(s.Split(' '), int.Parse);
	}
	
	private static double[] GetDoubleArray()
	{
		return Array.ConvertAll(Console.ReadLine().Split(' '), double.Parse);
	}
	
	public static string Reverse(string s)
	{
		var c = s.ToCharArray();
		Array.Reverse(c);
		
		return new String(c);
	}
	
	private static void WriteArray(int[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}

	private static void WriteArray(long[] a)
	{
		Console.WriteLine(string.Join(" ", Array.ConvertAll( a, x=>x.ToString() ) ) );
	}
	
	private static void WriteVector(Vector v)
	{
		Console.WriteLine(string.Format("{0:f8} {1:f8}", v.X, v.Y));
	}
}

public struct Vector
{
	public double X,Y;
}

Measured memory_bytes: 9888
n=int(input())
if n==0:
    print(2)
    exit()
elif n==1:
    print(1)
    exit()
else:
    nu1=2
    nu2=1
    for i in range(n-1):
        nu3=nu1+nu2
        nu1=nu2
        nu2=nu3
print(nu3)

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

const int MAXL=500005;

char s[MAXL];
int nxt[MAXL][27],maxbit,d[20][MAXL];

int main()
{
	scanf("%s",s);
	int l=strlen(s);
	fill(nxt[l],nxt[l]+26,l+1);
	nxt[l][26]=l;
	fill(nxt[l+1],nxt[l+1]+27,l+1);
	for (int i=l-1;i>=0;i--)
	{
		int c=s[i]-'a';
		nxt[i][c]=i+1;
		for (int j=c+1;j<27;j++)
			nxt[i][j]=nxt[nxt[i][j-1]][j-1];
		for (int j=0;j<c;j++)
			nxt[i][j]=nxt[nxt[i][26]][j];
	}
	while ((1<<maxbit)<=l+2) maxbit++;
	maxbit--;
	for (int i=0;i<=l+1;i++)
		d[0][i]=nxt[i][26];
	for (int j=1;j<=maxbit;j++)
		for (int i=0;i<=l+1;i++)
			d[j][i]=d[j-1][d[j-1][i]];
	int Q;
	scanf("%d",&Q);
	while (Q--)
	{
		int l,r;
		scanf("%d%d",&l,&r);
		l--;
		for (int i=maxbit;i>=0;i--)
			if (d[i][l]<=r)
				l=d[i][l];
		puts(l==r?"Yes":"No");
	}
	return 0;
}

Measured memory_bytes: 92928
#include <stdio.h>

int buf[1000000];

int main(){
	int s;
	scanf("%d",&s);
	int cnt = 0;
	buf[cnt] = s;
	cnt++;
	while(1){
		if(buf[cnt-1]%2==0)
			buf[cnt] = buf[cnt-1]/2;
		else
			buf[cnt] = 3*buf[cnt-1]+1;
		int i;
		for(i = 0;i<cnt;i++){
			if(buf[i] == buf[cnt]){
				printf("%d\n",cnt+1);
				goto end;
			}
		}
		cnt++;
	}
end:;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define INCANT cin.tie(0), cout.tie(0), ios::sync_with_stdio(false), cout << fixed << setprecision(20);
#define int long long
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(), (x).end()
#define _overload(_1, _2, _3, name, ...) name
#define _rep(i, n) repi(i, 0, n)
#define repi(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) _overload(__VA_ARGS__, repi, _rep)(__VA_ARGS__)
#define _rev(i, n) revi(i, n, 0)
#define revi(i, a, b) for(int i = (int)(a - 1); i >= (int)(b); i--)
#define rev(...) _overload(__VA_ARGS__, revi, _rev)(__VA_ARGS__)
#define each(i, n) for(auto&& i: n)
void in(){}
template<typename F, typename... R>
bool in(F& f, R&... r){
    if(cin >> f){in(r...);return true;}
    else return false;
}
#define out(x) cout << (x)
#define space() cout << " "
#define indent() cout << '\n'
void print(){}
template<typename F, typename... R>
void print(F f, R... r){out(f), indent(), print(r...);}
#define debughead(x) cerr << "Line " << __LINE__ << ": " << #x << ": "
#define debugout(x) cerr << (x) << " "
#define debugindent() cerr << '\n'
#define debug(x) debughead(x), debugout(x), debugindent()
const int INF = 1e18, MOD = 1e9 + 7;
template<typename T>
bool chmax(T& a, T b){return (a = max(a, b)) == b;}
template<typename T>
bool chmin(T& a, T b){return (a = min(a, b)) == b;}

main(){
    INCANT;
    int n, tmp, res = 0;
    string s;
    in(n);
    int a[n], sum[n];
    rep(i, n){
        in(a[i]);
    }
    sort(a, a + n);
    rep(i, n){
        sum[i] = a[i];
        if(i){
            sum[i] += sum[i - 1];
        }
    }
    rev(i, n - 1){
        if(sum[i] * 2 < a[i + 1]){
            print(n - i - 1);
            return 0;
        }
    }
    print(n);
}


Measured memory_bytes: 1792
#include <bits/stdc++.h>
using namespace std;
int main()
{
  int n,k;
  cin>>n>>k;
  int h[n+1];
  for(int i=1;i<=n;i++) cin>>h[i];
  int dp[n+1];
  dp[1]=0;
  for(int i=2;i<=n;i++) 
  {
    dp[i]=INT_MAX;
    for(int j=i-k;j<=i-1;j++) if(j>=1) dp[i]=min(dp[i],dp[j]+abs(h[i]-h[j]));
      }
  cout<<dp[n];
}

Measured memory_bytes: 4392
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i=(a); i<(b); i++)

int main() {
  int N, K;
  cin >> N >> K;
  int a[100];
  int ans = 0;
  FOR(i, 0, N) cin >> a[i];
  sort(a, a+N, greater<int>());
  FOR(i, 0, K) ans += a[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3568
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define IFOR(i, m, n) for (ll i = n - 1; i >= m; i--)
#define REP(i, n) FOR(i, 0, n)
#define IREP(i, n) IFOR(i, 0, n)
#define FOREACH(x, a) for (auto&(x) : (a))
#define ALL(v) (v).begin(), (v).end()
#define SZ(x) ll(x.size())

const ll MOD = 1e9 + 7;

int main() {
  ll n;
  cin >> n;
  vector<ll> a(n);
  ll ans = 1;
  vector<ll> cnt(3, 0);  //各色が何人？
  REP(i, n) {
    cin >> a[i];
    ll c = 0, idx = -1;
    REP(j, 3) {
      if (cnt[j] == a[i]) {
        c++;
        idx = j;
      }
    }
    if (idx != -1) cnt[idx]++;
    (ans *= c) %= MOD;
  }

  cout << ans << endl;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(nullptr); cout.tie(0)
#define endl "\n"
#define int long long
typedef vector<int> vi;
#define all(x) x.begin(),x.end()
#define FOR(i,a,b) for(int i=(a);i<=(b);i++)
#define FORD(i,a,b) for(int i=(a);i>=(b);i--)
#define pii              pair <int,int>
#define DEBUG(x) cerr << '>' << #x << ':' << x << endl;
typedef long long ll;
//#pragma comment(linker, "/STACK:667772160")
#define in_range(x, y, r, c) ((x >= 0 && x < r && y >= 0 && y < c))

const double eps=1e-9;
const int MOD=1e9+7;
const int N=1e5+30;
const int inf = 1e17+995;

template< class T > T gcd(T a, T b) { return (b != 0 ? gcd<T>(b, a%b) : a); }
template< class T > T lcm(T a, T b) { return (a / gcd<T>(a, b) * b); }
template <typename T> T exp(T b, T p){T x = 1;while(p){if(p&1)x=(x*b);b=(b*b);p=p>>1;}return x;}
inline int ones(int n) { int res = 0; while(n && ++res) n-=n&(-n); return res; }
inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; }
void boostIO() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int32_t main() {
boostIO();
int n,k;
cin>>n>>k;
vi dp(k+1,0);
    for (int i = 0; i < n; ++i) {
        int weight,val;
        cin>>weight>>val;
        // dp[i] max current value for this weight
        for(int w_already=k-weight;w_already>=0;w_already--){
            dp[w_already+weight]=max(dp[w_already+weight],dp[w_already]+val);
        }
    }
    int answer=0;
    FOR(i,0,k)answer=max(dp[i],answer);
    cout<<answer;
}

Measured memory_bytes: 1024
#include <set>
#include <string>
#include <iostream>
#include <algorithm>

using namespace std;

int main()
{
    string S; int n;
    
    scanf("%d", &n);
    
    for(int i = 0; i < n; i++)
    {
        cin >> S;
        
        set<string> T;
        
        for(int j = 1; j < S.size(); j++)
        {
            string A = S.substr(0, j);
            string B = S.substr(j, S.size() - j);
            
            string C = A; reverse(C.begin(), C.end());
            string D = B; reverse(D.begin(), D.end());
            
            T.insert(A + B);
            T.insert(B + A);
            T.insert(A + D);
            T.insert(D + A);
            T.insert(C + B);
            T.insert(B + C);
            T.insert(C + D);
            T.insert(D + C);
        }
        
        printf("%d\n", T.size());
    }
    
    return 0;
}

Measured memory_bytes: 3276
#include<stdio.h>
int main()
{
  int a,b[10000],c,d,s,i;
  scanf("%d",&a);
  for(i=0;i<a;i++){
    scanf("%d",&b[i]);
  }
  d=a-1;
  for(i=d;i>=0;i--){
    if (i>0)printf("%d ",b[i]);
    else printf("%d",b[i]);
  }
  printf("\n");
  return 0;
}

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

int main() {

	int N, K, Q ;
	cin >> N >> K >> Q ;
	
	vector<int> scores(N, K) ;
	int A ;
	for(int i = 0 ; i < Q ; i++) {
		cin >> A ;
		++scores[A-1] ;
	}

	for(const int &i : scores) {
		cout << ( i - Q > 0 ? "Yes" : "No" ) << endl ;
	}
	return 0;
}


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


int main() {
  int N, K;
  cin >> N >> K;
  
  vector<int> d(K);
  //vector<vector<int>> A(K);
  map<int, int> As;
  for (int i = 0; i < K; i++) {
    cin >> d.at(i);

 
    for (int j = 0; j < d.at(i); j++) {
      int A;
      cin >> A;

      As[A] = 1;
    }
  }
  
  cout << N - As.size();
  
}


Measured memory_bytes: 3628
#include<stdio.h>
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using lb=long double;
using db=double;
const ll mod=1e9+7;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define INF 1e9+7
int n;
const long double pi=2*asin(1.0);
const int maxn = 2e5+2;
int main()
{
    int a,b;
    cin>>a>>b;
    if(a%3==0||b%3==0||(a+b)%3==0)
        cout<<"Possible"<<endl;
    else
        cout<<"Impossible"<<endl;
    return 0;
}


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

int main(){
 int x;
 cin >> x;
 if(400<=x && x<600){
  cout << 8 << endl;
 }else if(x<800){
  cout << 7 << endl;
 }else if(x<1000){
  cout << 6 << endl;
 }else if(x<1200){
  cout << 5 << endl;
 }else if(x<1400){
  cout << 4 << endl;
 }else if(x<1600){
  cout << 3 << endl;
 }else if(x<1800){
  cout << 2 << endl;
 }else {
  cout << 1 <<endl;
 }
 
 return 0;
}

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

int gcd(int a, int b)
{
   if (a%b == 0)
   {
       return(b);
   }
   else
   {
       return(gcd(b, a%b));
   }
}
int main() {
  int K,sum=0;
  cin>>K;
  rep(a,K){
    rep(b,K){
      rep(c,K){
      sum+=gcd(a+1,gcd(b+1,c+1));
      }
    }
  }
  cout<<sum<<endl;
}

Measured memory_bytes: 3632
a = int(input())
b = [list(map(int, input().split())) for _ in range(a)]
b = sorted(b, key=lambda x: x[1])
c = 0
for i in range(a):
    c += b[i][0]
    if c > b[i][1]:
        print("No")
        exit()
print("Yes")


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

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

using ll = long long;
using P = pair<int, int>;

const int mod = 998244353;
const int amax = 1000005;

int main(int, char**)
{
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];

    sort(a.begin(), a.end());
    vector<int> d(amax);
    rep(i,n) {
        if (d[a[i]]==2) continue; //　既に何かの倍数
        if (d[a[i]]==1) { d[a[i]] = 2; continue; } // 重複
        d[a[i]] = 1;
        for(int m=a[i]*2; m < amax; m+=a[i]) d[m]=2;
    }
    int ans = 0;
    rep(i,n) if (d[a[i]]==1) ans++;

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 8008
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(n);i++)
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
ll gcd(ll a, ll b){
  if(b==0) return a;
  else gcd(b,a%b);
}
ll lcm(ll a, ll b){
  return a/gcd(a,b)*b;
}
using Graph = vector<vector<int>>;

struct UnionFind{
  vector<int>par;
  UnionFind(int n):par(n){
    rep(i,n) par[i]=i;
  }
  int root(int x){
    if(par[x]==x)return x;
    return par[x]=root(par[x]);
  }
  
  void unite(int x, int y){
    int rx=root(x);
    int ry=root(y);
    if(rx==ry)return;
    par[rx]=ry;
  }
  bool same(int x,int y){
    int rx=root(x);
    int ry=root(y);
    return rx==ry;
  }
};


int main(){
  int n,K;
  cin >> n >> K;
  vector<ll>x(n);
  vector<ll>y(n);
  vector<ll>px(n);
  vector<ll>py(n);
  rep(i,n){
    cin >> x[i] >> y[i];
    px[i]=x[i];
    py[i]=y[i];
  }
  
  sort(x.begin(),x.end());
  sort(y.begin(),y.end());
  
  ll ans= 4e18;
  for(int i=0;i<n-1;i++){
    for(int j=i+1;j<n;j++){
      for(int k=0;k<n-1;k++){
        for(int l=k+1;l<n;l++){
          ll lx=x[i];
      	  ll rx=x[j];
          ll ly=y[k];
          ll ry=y[l];
          int sum=0;
          rep(m,n){
            if(lx<=px[m] && ly<=py[m] && px[m]<=rx && py[m]<=ry) sum++;
          }
          if(sum>=K){
            ll s=(rx-lx)*(ry-ly);
            if(ans>s)ans=s;
          }
        }
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
/*{{{*/
#include <bits/stdc++.h>
#define SZ(X) ((int)(X).size())
#define ALL(X) (X).begin(), (X).end()
#define REP(I, N) for (int I = 0; I < (N); ++I)
#define REPP(I, A, B) for (int I = (A); I < (B); ++I)
#define FOR(I, A, B) for (int I = (A); I <= (B); ++I)
#define FORS(I, S) for (int I = 0; S[I]; ++I)
#define RS(X) scanf("%s", (X))
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define CASET int ___T; scanf("%d", &___T); for(int cs=1;cs<=___T;cs++)
#define MP make_pair
#define PB emplace_back
#define MS0(X) memset((X), 0, sizeof((X)))
#define MS1(X) memset((X), -1, sizeof((X)))
#define LEN(X) strlen(X)
#define F first
#define S second
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<LL> VL;
typedef vector<PII> VPII;
typedef pair<LL,LL> PLL;
typedef vector<PLL> VPLL;
template<class T> void _R(T &x) { cin >> x; }
void _R(int &x) { scanf("%d", &x); }
void _R(int64_t &x) { scanf("%lld", &x); }
void _R(double &x) { scanf("%lf", &x); }
void _R(char &x) { scanf(" %c", &x); }
void _R(char *x) { scanf("%s", x); }
void R() {}
template<class T, class... U> void R(T &head, U &... tail) { _R(head); R(tail...); }
template<class T> void _W(const T &x) { cout << x; }
void _W(const int &x) { printf("%d", x); }
void _W(const int64_t &x) { printf("%lld", x); }
void _W(const double &x) { printf("%.16f", x); }
void _W(const char &x) { putchar(x); }
void _W(const char *x) { printf("%s", x); }
template<class T,class U> void _W(const pair<T,U> &x) {_W(x.F); putchar(' '); _W(x.S);}
template<class T> void _W(const vector<T> &x) { for (auto i = x.begin(); i != x.end(); _W(*i++)) if (i != x.cbegin()) putchar(' '); }
void W() {}
template<class T, class... U> void W(const T &head, const U &... tail) { _W(head); putchar(sizeof...(tail) ? ' ' : '\n'); W(tail...); }
#ifdef HOME
 #define DEBUG(...) {printf("# ");printf(__VA_ARGS__);puts("");}
#else
 #define DEBUG(...)
#endif
int MOD = 1e9+7;
void ADD(LL& x,LL v){x=(x+v)%MOD;if(x<0)x+=MOD;}
/*}}}*/
const int SIZE = 1e6+10;
VPII AA;
LL dp[2002][2002];
template <class T>
void maa(T& x,T y){
    if(x<y)x=y;
}
template <class T>
void mii(T& x,T y){
    if(x>y)x=y;
}
int main(){
    int N;
    R(N);
    FOR(i,1,N){
        int v;
        R(v);
        AA.PB(MP(v,i));
    }
    sort(ALL(AA),greater<PII>());
    for(int len=N-1;len>=0;len--){
        int id=N-1-len;
        for(int l=1;l+len<=N;l++){
            int r=len+l;
            maa(dp[l][r-1],dp[l][r]+(LL)AA[id].F*abs(r-AA[id].S));
            maa(dp[l+1][r],dp[l][r]+(LL)AA[id].F*abs(l-AA[id].S));
        }
    }
    LL an=0;
    FOR(i,1,N+1)maa(an,dp[i][i-1]);
    W(an);
    return 0;
}


Measured memory_bytes: 26352
#include <cstdio>
#include <cstring>

int n;
char S[10001];

int main(){
  scanf("%d", &n);
  scanf("%s", S);
  for(int i = 0; S[i]; i++){
    S[i] = 'A' + (S[i] - 'A' + n) % 26;
  }
  puts(S);

  return 0;
}


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

using namespace std;

using ll = long long;

const ll MOD = 1000000007;

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

ll calc(ll n, int x) {
    ll res = 1;
    for (int i = 0; i < x; ++i) {
        (res *= n - i) %= MOD;
        (res *= modpow(x - i, MOD - 2)) %= MOD;
    }
    return res;
}

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll n;
    int a, b;
    cin >> n >> a >> b;
    ll ans = (modpow(2, n) + MOD - 1 + 2 * MOD - calc(n, a) - calc(n, b)) % MOD;
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
using System;

namespace B___Digit_Sums
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = Console.ReadLine();
            var b = 0;
            for (var i = 0; i < n.Length; i++)
            {
                b += int.Parse(n.Substring(i, 1));
            }
            if (int.Parse(n) % b == 0)
            {
                Console.WriteLine("Yes");
            }
            else
            {
                Console.WriteLine("No");
            }
        }
    }
}

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



int main() {
    int N;
    cin>>N;
    string S;
    cin>>S;
    int count=1;
    for(int i=1;i<N;i++){
        if(S.at(i)!=S.at(i-1)){count++;}
    }
    cout<<count<<endl;
}

Measured memory_bytes: 512
import java.util.Scanner;
        
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] arrayD = new int[k];
        int[][] arrayA = new int[k][n];

        for (int i = 0; i < k; i++) {
            arrayD[i] = sc.nextInt();
            for (int j = 0; j < n; j++) {
                if (j < arrayD[i]) {
                    arrayA[i][j] = sc.nextInt();
                } else {
                    arrayA[i][j] = 0;
                }
            }
        }
        
        int[] arrayAnswer = new int[n];
        for (int i = 0; i < k; i++) {
            for (int j = 0; j < n; j++) {
                if (arrayA[i][j] != 0) {
                    arrayAnswer[arrayA[i][j] - 1] = 1;
                }
            }
        }

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

Measured memory_bytes: 46380
#include <cstdio>
#include <iostream>
#include <algorithm>
#define rep(i,n) for(int i=0; i<(n); ++i)
#define outl(x) cout<< (x) << '\n'
using namespace std;

bool G[105][105];

signed main()
{
   cin.tie(0), ios::sync_with_stdio(false);
   int N;
   cin >> N;

   rep(i, N){
      int k, u, p;
      cin >> u >> k;
      --u;

      rep(j, k){
         cin >> p;
         --p;
         G[u][p] = true;
      }
   }

   rep(i, N){
      rep(j, N){
         cout << G[i][j] << ((j+1 < N)? ' ' : '\n') ;
      }
   }

}




Measured memory_bytes: 3208
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int[] H = new int[N];
		
		for(int i=0;i<N;i++) {
			H[i] = sc.nextInt();
		}
		
		int max = 0;
		for(int i=0;i<N-1;) {
			if(H[i] < H[i+1]) {
				i++;
			}else {
				int count = 0;
				while(i<N-1 && H[i] >= H[i+1]) {
					count++;
					i++;
				}
				if(count > max)max = count;
			}

		}
		System.out.println(max);
		
		sc.close();	
	}
}

Measured memory_bytes: 49704
import java.io.*;
import java.util.*;

public class Main {
    static int gcd(int a, int b)
    {
        // Everything divides 0
        if (a == 0)
            return b;
        if (b == 0)
            return a;

        // base case
        if (a == b)
            return a;

        // a is greater
        if (a > b)
            return gcd(a-b, b);
        return gcd(a, b-a);
    }
    public static void main(String[] args) throws Exception{

        FastReader fs = new FastReader();
        out = new PrintWriter(new BufferedOutputStream(System.out));


        int k = fs.nextInt();
        
        long kP = k;
        long ans = (kP*(kP+1))/2;

        for(int i=1 ; i<=k ; i++){
            for(int j=i+1 ; j<=k ; j++){
                long calc = (long) gcd(i,j)*6;
                ans += calc;
            }
        }

        for(int i=1 ; i<=k ; i++){
            for(int j=i+1 ; j<=k ; j++){
                for(int l=j+1 ; l<=k ; l++){
                    int calc = gcd(i,j);
                    long calcF = gcd(calc,l);
                    ans += calcF*6;
                }
            }
        }
        out.println(ans);
        


        out.close();
    }
    //-----------PrintWriter for faster output---------------------------------
    public static PrintWriter out;

    //-----------MyScanner class for faster input----------
    public static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt() {
            return Integer.parseInt(next());
        }

        long nextLong() {
            return Long.parseLong(next());
        }

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------
}


Measured memory_bytes: 34376
from sys import stdin
N,M,C = stdin.readline().split()
N,M,C = int(N),int(M),int(C)
B = stdin.readline().split()
B = [int(x) for x in B]
A = [[None] * M] * N
for i in range(N):
    A[i] = stdin.readline().split()
    A[i] = [int(x) for x in A[i]]
# print(N,M,C)
# print(B)
# print(A)

ans = 0
for q in range(N):
    sum = 0
    for m in range(M):
        sum += A[q][m] * B[m]
    sum += C
    if sum > 0:
        ans += 1
print(ans)

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

int main(){
    
    while(1){
        int x, y;
        cin >> x >> y;
        if(x == 0 && y == 0) break;
        if(x < y) cout << x << " " << y << endl;
        else cout << y << " " << x << endl;
    }
    
    return 0;
}

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

#define x first
#define y second
#define mp make_pair
#define pub push_back
#define all(a) a.begin(), a.end()
#define ll long long
#define db double

using namespace std;

int n, w1, w2;
int a[2222];
int dp[2007][2007][2];
int ma[2007][2007];
int mi[2007][2007];

int main(){
	//freopen("input.txt", "r", stdin);
	cin >> n >> w1 >> w2;
	for (int i = 0; i < n; i++) cin >> a[i];
	a[n] = w1;
	a[n + 1] = w2;

	for (int j = 0; j <= n + 1; j++){
		dp[n - 1][j][0] = abs(a[j] - a[n - 1]);
		dp[n - 1][j][1] = abs(a[j] - a[n - 1]);
		ma[n - 1][j] = abs(a[j] - a[n - 1]);
		mi[n - 1][j] = abs(a[j] - a[n - 1]);
	}

	for (int i = n - 2; i >= 0; i--){
		for (int j = 0; j <= n + 1; j++){
			dp[i][j][0] = ma[i + 1][i];
			dp[i][j][1] = mi[i + 1][i];

			ma[i][j] = max(ma[i + 1][j], dp[i][j][1]);
			mi[i][j] = min(mi[i + 1][j], dp[i][j][0]);
		}
	}

	/*for (int i = n - 1; i >= 0; i--){
		for (int j = 0; j <= n + 1; j++){
			cout << i << ' ' << j << ' ' << dp[i][j][0] << ' ' << dp[i][j][1] << endl;
		}
	}*/

	cout << ma[0][n + 1];
}

Measured memory_bytes: 63104
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define int long long    // %d=>%lld
#define pb push_back
#define INF (1e9+7)
#define llINF 1e17
#define EPS 1e-9
#define pi acos(-1)

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;

int H,W,h,w;



signed main(){
    cin >> H>>W>>h>>w;

    if( H%h == 0 && W%w == 0 ){
        cout << "No"<< endl;
        return 0;
    }

    cout << "Yes"<< endl;

    for(int i = 0;i < H;i++){
        for(int j = 0;j < W;j++){
            if(i%h == 0 && j%w == 0)
                printf("%lld ", (h*w-1)*1000 -1 );
            else
                printf("%d ", -1000);
        }
        printf("\n");
    }


    return 0;
}

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


void solve(long long N, long long M, std::vector<long long> L, std::vector<long long> R){
  long long l = L[0], r = R[0];
  for (int i=1; i<M; i++) {
    if (R[i] < l || r < L[i]) {
      cout << 0 << endl;
      return;
    }
    if (l < L[i]) l = L[i];
    if (R[i] < r) r = R[i];
    if (r < l) {
      cout << 0 << endl;
      return;
    }
  }
  cout << r - l + 1 << endl;
}

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


Measured memory_bytes: 1792
#include<iostream>
//#include<string>
//#include <math.h>
using namespace std;
int main() 
{ 
	long long x,compInt = 100,years=0;
	cin>>x;
	while(compInt<x){
		years++;
		compInt += (compInt*0.01);
	}
	cout<<years;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define rep(i, n) for(int i= 0; i < (n); i++)
using ll= long long int;
using namespace std;
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; }
ll mod= 1e9 + 7;


int main() {
  int n;
  cin >> n;
  ll ans=0;
  for(int a=1;a<=n;a++){
    ans+=(n-1)/a;
  }
  cout << ans << endl;
}


Measured memory_bytes: 3632
from fractions import gcd

n = int(input())
a = [int(i) for i in input().split()]
l,r = [0],[0]
for i in range(1,n):
    l.append(gcd(l[i-1],a[i-1]))
    r.append(gcd(r[i-1],a[-i]))
r = r[::-1]
ans = 0

for i in range(n):
    ans = max(ans,gcd(l[i],r[i]))
print(ans)


Measured memory_bytes: 16112
/*
If you want to aim high, aim high
Don't let that studying and grades consume you
Just live life young
******************************
What do you think? What do you think?
1st on Billboard, what do you think of it
Next is a Grammy, what do you think of it
However you think, I’m sorry, but shit, I have no fucking interest
*******************************
Higher, higher, even higher, to the point you won’t even be able to see me
https://www.a2oj.com/Ladder16.html
*******************************
NEVER DO 300IQ CONTESTS EVER
300IQ AS WRITER = EXTRA NONO
*/
import java.util.*;
import java.io.*;
import java.math.*;

   public class Main
   {
      public static void main(String omkar[]) throws Exception
      {
         BufferedReader infile = new BufferedReader(new InputStreamReader(System.in));  
         StringTokenizer st = new StringTokenizer(infile.readLine());
         long N = Long.parseLong(st.nextToken());
         //wtf
         String input = st.nextToken();
         input = input.charAt(0)+input.substring(2);
         int val = Integer.parseInt(input);
         BigInteger res = new BigInteger(N+"");
         res = res.multiply(new BigInteger(val+""));
         res = res.divide(new BigInteger("100"));
         System.out.println(res.longValue());
      }
   }

Measured memory_bytes: 38656
import math
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
dif = list(x-y for x,y in zip(a,b))
cnt = 0
for d in dif:
    if d>0:
        cnt += d
    else:
        cnt += math.ceil(d/2)
if cnt <= 0:
    print('Yes')
else:
    print('No')


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

using namespace std;

void Main() {
    int x, a, b;
    cin >> x >> a >> b;
    cout << (abs(x - a) < abs(x - b) ? "A" : "B") << endl;
}

int main() {
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3564
#include<bits/stdc++.h>
using namespace std;
int main()           //Allah is Almighty
{
       int i;
       int c=0,d=0,e=0,f=0;
       int n;
       cin>>n;
       char a[1000];
       for(i=0;i<n;i++)
       {
              cin>>a[i];
              if(a[i]=='P')
              {
                     c++;
              }
              else if(a[i]=='W')
              {
                     d++;
              }
              else if(a[i]=='G')
              {
                     e++;
              }
              else if(a[i]=='Y')
              {
                     f++;
              }
       }
       if(c!=0 && d!=0 && e!=0 && f!=0)
       {
              cout<<"Four"<<endl;
       }
       else
              cout<<"Three";
       // ans=c+d+e+f;
       return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int main(){


    int n;
    cin >> n;
    for(int i = 0;i <= n/4;i++){
        for(int j = 0;j <= n/7;j++){


            
            
            if (4*i+7*j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;


    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstring>
using namespace std;
int t,n;
string s1,s2,s;
int n1,n2; 
int main()
{
	cin>>s1>>s2;
	cin>>n1>>n2;
	cin>>s;
	if(s==s1)n1--;
	else n2--;
	cout<<n1<<" "<<n2<<endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
//解説AC
//参考:https://qiita.com/drken/items/fd4e5e3630d0f5859067#5-%E9%81%8E%E5%8E%BB%E5%95%8F%E7%B2%BE%E9%81%B8-10-%E5%95%8F
 int findSumOfDigits(int n) {
  int sum = 0;
  while (n > 0) { // n が 0 になるまで
    sum += n % 10;
    n /= 10;
  }
  return sum;
}
int main(){
int n,a,b;

cin>>n>>a>>b;
int ans=0;
for (size_t i = 0; i <= n; i++)
{   int m=i;//int sum=0;
    int sum=findSumOfDigits(i);
   /* while(m>=10)
    {
        sum+=m%10;
        m/=10;

    }*/
    if(a<=sum&&sum<=b)
    {
        ans+=i;
    }
    
    
}
cout<<ans<<endl;
return 0;

}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
 
int main(){
  char str[256];
  char put[256];
  int  a,b,i,n, length;
     
  scanf("%d ", &n);
     
  while(n--){
    for(a = 0; a < 256; a++)
      str[a] = 0;
     
    fgets(put, sizeof(put), stdin);
         
    length = strlen(put);
         
    for(a = 1; a < 26; a += 2){
      if(a%13==0)
	continue;
      for(b = 0; b < 26; b++){
	for(i = 0; i < length; i++){
	  if(put[i] >= 'a' && put[i] <= 'z')
	    str[i] = ((a * (put[i] - 'a') + b) % 26) + 'a';
	  else
	    str[i] = put[i];
	}
	if(strstr(str,"that")||strstr(str,"this")){
   printf("%s", str);
	  goto fin;
	}
      }
    }
  fin:;
  }
  return 0;
}

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

int main(){
  int n,sum=0;
  cin>>n;
  vector<int> d;
  for(int i=0; i<n; i++){
    int x;
    cin>>x;
    d.push_back(x);
  }
  for(int i=0; i<n; i++){
    for(int j=i+1; j<n; j++){
      sum += d[i]*d[j];
    }
  }
  cout<<sum;
}

Measured memory_bytes: 256
n, m = map(int , input().split())
h = list(map(int, input().split()))

links = [[] for i in range(n)]

for i in range(m):
    a, b = map(int, input().split())
    links[a-1].append(b-1)
    links[b-1].append(a-1)

ans = 0

for i in range(n):
    judge = 0
    for to in links[i]:
        if h[i] <= h[to]:
            judge += 1
    if not judge:
        ans += 1
print(ans)

Measured memory_bytes: 29332
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if (n == 1 || n == 2 || n == 3 || n == 5 || n == 6 || n == 9 || n == 10 || n == 13 || n == 17) cout << "No";
    else cout << "Yes";
}


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

int main() {
  int A, B, N;
  cin >> N >> A >> B;

  if (A*N < B) {
    cout << A*N << endl;
  }
  // ここにプログラムを追記
  else {
  	cout << B << endl;
  }
}

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

#ifdef LOCAL
#define debug(var) cerr << (#var) << " = " << (var) << endl;
#else
#define debug(var)
#endif

void init() {
  ios_base::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);
}

void solve() {
  long long n, k; scanf("%lld%lld", &n, &k);
  n %= k;
  printf("%lld", min(n, k-n));
}

int main() {
  init();
  int t = 1; //scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}


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

int main(){
    int N,x;
    cin>>N>>x;
    int a[1000];
    for(int i=0;i<N;i++){
        cin>>a[i];
    }
    sort(a,a+N);
    int i=0,cnt=0;
    while(x-a[i]>=0&&i<N){
        x-=a[i];
        i++;
        cnt++;
    }

    if(cnt==N){
        if(x) cout<<cnt-1<<endl;
        else cout<<cnt<<endl;
    }else cout<<cnt<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>

main(){
    int N;
    scanf("%d", &N);
    int f=N/1000;
    int s=N/10%10;
    int t=N/100%10;
    int th=N%10;
    if(f==s && f==t && s==t){
        printf("Yes");
    }else  if(s==t && s==th && t==th){
        printf("Yes");
    }
    else
        printf("No");
}


Measured memory_bytes: 128