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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

// Vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size();
  s << "[";
	for (int i = 0; i < len; i++) {
    if (i > 0) s << ", ";
		s << v[i];
  }
  s << "]";
  return s;
}

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

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

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

  int n;
  cin >> n;
  vector<int> xs(n);
  vector<int> x_to_count(n + 1);
  for (int i = 0; i < n; i++) {
    cin >> xs[i];
    x_to_count[xs[i]]++;
  }

  vector<int> count_to_sum(n + 1);
  for (int x = 1; x <= n; x++) {
    for (int c = 1; c <= x_to_count[x]; c++) {
      count_to_sum[c]++;
    }
  }

  if (DEBUG) cout << "count_to_sum: " << count_to_sum << endl;

  vector<int> k_to_count(n + 1, 0);
  int current_sum = 0;
  for (int c = 1; c <= n; c++) {
    current_sum += count_to_sum[c];
    // cout << current_sum / c << endl;
    k_to_count[current_sum / c] = c;
  }

  for (int k = n - 1; k >= 1; k--) {
    UpdateMax(k_to_count[k], k_to_count[k + 1]);
  }

  int current_output = n;
  for (int k = 1; k <= n; k++) {
    cout << k_to_count[k] << endl;
  }
}

Measured memory_bytes: 5632
#include <iostream>
#include <cstring>
#include <cstdio>
#define maxn 1005
#define LL long long

using namespace std;

LL a,b;

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

int main()
{
    cin >> a>> b;
    cout <<a*b/gcd(a,b);

    return 0;
}


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

#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for (int i = x; i < n; i++)
#define OP(m) cout << m << endl
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;

int main()
{
    char x, y;
    cin >> x >> y;
    if (x < y)
        OP("<");
    else if (x > y)
        OP(">");
    else
        OP("=");
    return 0;
}

Measured memory_bytes: 256
#pragma comment (linker, "/STACK:256000000")
 
#define _USE_MATH_DEFINES
#define _CRT_NO_DEPRECEATE
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <string>
#include <cstring>
#include <vector>
#include <utility>
#include <algorithm>
#include <functional>
#include <set>
#include <map>
#include <cmath>
#include <queue>
#include <memory.h>
#include <sstream>
#include <cassert>
#include <ctime>
#include <complex>
#include <bitset>

//#include <random>
 
using namespace std;
 
 
double PI = 3.1415926535897932384626433832795;
long double EPS = 1e-12;
 
typedef unsigned int uint32;
typedef long long int64;
typedef unsigned long long uint64;
const int MOD = 1e9 + 7;
const int BASE = 1327; 
typedef pair<int64, int64> pii;
const int MAXN = 500;
const int64 LINF = 2e18; 
const int LN = 30;
int n, q, m, l;

int mas[MAXN];
string st;
int mod = 1e9 + 7;
int sum[MAXN][MAXN];
int cur[MAXN];
int a[MAXN], b[MAXN];
int d[MAXN][MAXN];
int c;
inline int mul(int a, int b)
{
	return (a * (int64) b) % mod;
}

inline int add(int a, int b)
{
	a += b;
	if (a >= mod)
		a -= mod;
	return a;
}

inline int sub(int a, int b)
{
	a -= b;
	if (a < 0)
		a += mod;
	return a;
}

int fun(int id, int c)
{
	if (id == n)
	{
		if (c != 0)
			return 0;
		else
			return 1;
	}
	if (d[id][c] != -1)
		return d[id][c];
	int ans = 0;
	for(int i = 0; i <= c; ++i)
	{
		ans = add(ans, mul(sub(sum[i][b[id]], sum[i][a[id] - 1]), fun(id + 1, c - i)));
	}
	return d[id][c] = ans;
}

void solve()
{
	cin >> n >> c;
	for(int i = 0; i < n; ++i)
		cin >> a[i];
	for(int i = 0; i < n; ++i)
		cin >> b[i];

	for(int i = 1; i <= 400; ++i)
	{
		cur[i] = 1;	
	}
	for(int j = 1; j <= 400; ++j)
			sum[0][j] = add(sum[0][j - 1], cur[j]);
	for(int i = 1; i <= c; ++i)
	{
		for(int j = 1; j <= 400; ++j)
		{
			cur[j] = mul(cur[j], j);	
		}
		for(int j = 1; j <= 400; ++j)
			sum[i][j] = add(sum[i][j - 1], cur[j]);
	}
	memset(d, -1, sizeof d);
	cout << fun(0, c);

}
 

int main()
{
    ios_base::sync_with_stdio(false); cin.tie(0);
#ifdef _MY_DEBUG
    freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout);
#else
    //freopen(TASK ".in", "rt", stdin); freopen(TASK ".out", "wt", stdout);
#endif
    srand(1313);
	
	int t = 1;
	//scanf("%d", &t);
	for(int i = 0; i < t; ++i)
	{
		solve();
	}
	
    return 0;
}      

Measured memory_bytes: 2048
import java.util.Scanner;

class Main{
	public static void main(String[] args) {
		try(Scanner sc = new Scanner(System.in)){
			int num = sc.nextInt();
			for(int i = 1; i <= num ; i++ ) {
				if(i%3 == 0) {
					System.out.print(" " + i);
				}
				else for(int j = i; 0<j ; j /= 10) {
					if(j%10 == 3) {
						System.out.print(" " + i);
						break;
					}
				}
			}
			System.out.println();
		}
	}
}


Measured memory_bytes: 28400
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <tuple>
using namespace std;
typedef long long ll;
typedef tuple<int, int, char, ll, string> T;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    vector<T> vec;
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        int v, w;
        char t;
        ll d;
        string s;
        cin >> v >> w >> t >> d >> s;
        vec.push_back(T(v, w, t, d, s));
    }
    sort(vec.begin(), vec.end());
    for(int i = 0; i < n; i++)
    {
        //constでアクセスするのめんどい
        cout << get<0>(vec[i]) << " " << get<1>(vec[i]) << " " << get<2>(vec[i]) << " " << get<3>(vec[i]) << " " << get<4>(vec[i]) << endl;
    }
    return 0;
}




Measured memory_bytes: 10988
#include <cstdio>
#include <vector>
#include <queue>

using namespace std;

int d[100000];
int p[100000];
vector <int> v[100000];

int main() {
    int n, m, i;
    queue <int> q;
    
    scanf("%d %d", &n, &m);
    
    for (i = 0; i < n - 1 + m; i++) {
        int x, y;
        
        scanf("%d %d", &x, &y);
        
        d[y - 1]++;
        v[x - 1].push_back(y - 1);
    }
    
    for (i = 0; i < n; i++) {
        if (d[i] == 0) break;
    }
    
    q.push(i);
    
    while (!q.empty()) {
        int x = q.front();
        
        q.pop();
        
        for (i = 0; i < v[x].size(); i++) {
            int y = v[x][i];
            
            d[y]--;
            
            if (d[y] == 0) {
                p[y] = x + 1;
                q.push(y);
            }
        }
    }
    
    for (i = 0; i < n; i++) printf("%d\n", p[i]);
    
    return 0;
}


Measured memory_bytes: 7040
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <cmath>
#include <queue>
#include <numeric>
#include <climits>
#include <iterator>
#include <iomanip>
#include <stack>
#include <bitset>
#include <functional>
using namespace std;
const constexpr int INF = 1e9;
//typedef std::pair<std::string,double> P;
 
 
typedef long long ll;
typedef vector<int> VI;
    
vector<pair<int, int> > vp;
 
struct Less {
    bool operator()(const pair<int, int>& x, const pair<int, int>& y) const {
        return x.first > y.first;
    }
};
#define FOR(i, a, n) for (ll i = (ll)a; i<(ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
 
//グラフの隣接リスト
VI g[200010];
//頂点の入次数を管理
int h[100010];
ll N, K;
string s;
int arr[26];
int main(void) {
    cin >> s;
    for(int i=0; i<s.size(); ++i){
        arr[(s[i]-'a')]++;
    }
    if(s=="zyxwvutsrqponmlkjihgfedcba"){
        cout << -1 << endl;
        return 0;
    }
    if(s.size()<=25){
        cout << s;
        for(int i=0; i<26; ++i){
            if(arr[i]!=1) {
                cout << (char)('a'+i) << endl;
                break;
            }
        }
    }else{
        vector<char> can;
        int i=25;
        can.push_back(s[s.size()-1]);
        while(s[i-1]>s[i]){
            i--;
            can.push_back(s[i]);
        }
        i--;
        sort(can.begin(), can.end());
        for(int l=0; l<can.size(); ++l){
            if(s[i]<can[l]){
                cout << s.substr(0, i) << can[l] << endl;
                return 0;
            }
        }
        
    }
	return 0;
}

Measured memory_bytes: 4992
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define db double
#define pint pair<int,int>
#define mk(x,y) make_pair(x,y)
#define fir first
#define sec second
#define Rep(x,y,z) for(int x=y;x<=z;x++)
#define Red(x,y,z) for(int x=y;x>=z;x--)
using namespace std;
char buf[1<<12],*p1=buf,*p2=buf,nc;int ny;
inline char gc() {return p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<12,stdin),p1==p2)?EOF:*p1++;}
//inline char gc(){return getchar();}
inline int read(){
	int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;
	for(x=nc-48;nc=gc(),47<nc&&nc<58&&nc!=EOF;x=(x<<3)+(x<<1)+(nc^48));return x*ny;
}inline int read1(){int x=0;for(ny=1;nc=gc(),(nc<48||nc>57)&&nc!=EOF;)if(nc==45)ny=-1;if(nc<0)return nc;x=nc-48;return x*ny;}
int n,m,k;vector<int>s,t;
int main(){
	n=read(),m=read(),k=read();
	Rep(i,1,n)s.push_back(read1());Rep(i,1,m)t.push_back(read1());
	reverse(s.begin(),s.end()),reverse(t.begin(),t.end());
	Rep(i,1,m+k+5)s.push_back(0);Rep(i,1,n+k+5)t.push_back(0);
	Red(i,n+m-1,0){
		if(s[i]==1&&t[i]==1){
			s[i]=t[i]=0,s[i+1]++,t[i+1]++;
			int j=i+1;
			for(int li=k-1;li;j++){
				if(s[j]==2)s[j+1]++,s[j]=0;
				else if(t[j]==2)t[j+1]++,t[j]=0;
				else if(s[j]==1&&t[j]==1)s[j+1]++,t[j+1]++,s[j]=t[j]=0,li--;
				else break;
			}if(s[j]==2)s[j]=0,s[j+1]++;
			if(t[j]==2)t[j]=0,t[j+1]++;
		}
	}while(s.back()==0)s.pop_back();while(t.back()==0)t.pop_back();
	reverse(s.begin(),s.end()),reverse(t.begin(),t.end());
	for(int i=0,l=s.size();i<l;i++)cout<<s[i];puts("");
	for(int i=0,l=t.size();i<l;i++)cout<<t[i];
}




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

int dp[100001] = {};

int solve(int n) {
    if (n == 0) return 0;
    if (dp[n] != 0) return dp[n];

    int ans = 114514;
    int r = 1;
    while (n >= r) {
        ans = min(ans, solve(n - r) + 1);
        r *= 6;
    }
    r = 9;
    while (n >= r) {
        ans = min(ans, solve(n - r) + 1);
        r *= 9;
    }

    return dp[n] = ans;
}

int main() {
    int n;
    cin >> n;
    cout << solve(n) << endl;
    return 0;
}

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

using namespace std;

#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
using ll = long long;
using Pair = pair<int, int>;
const ll mod = 1e9 + 7;

template<typename T>
void print_vec(vector<T>& v)
{
  for(const auto& e: v) {
    cout << e << " ";
  }
  cout << endl;
}
template<typename T>
void print_2dvec(vector<vector<T>>& m)
{
  for(const auto& v: m) {
    for(const auto& e: v) {
      cout << e << " ";
    }
    cout << endl;
  }
}

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

int main(int argc, char const* argv[])
{
  int n, d, a;
  cin >> n >> d >> a;
  vector<Pair> p(n);
  REP(i, n) cin >> p[i].first >> p[i].second;
  sort(ALL(p));

  ll ans = 0;
  BIT<ll> bit(n+1);
  REP(i, n) {
    ll x = p[i].first;
    ll h = p[i].second;
    h -= bit.sum(i);
    if (h <= 0) continue;
    ll num = (h+a-1) / a;
    ans += num;
    ll damage = num * a;
    bit.add(i, damage);
    int rx = min(x+2*d, 1001001001ll);
    int j = upper_bound(p.begin(), p.end(), Pair(rx+1, -1)) - p.begin();
    bit.add(j, -damage);
  }
  cout << ans << endl;

  return 0;
}

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

int main() {
	int X;
	cin >> X;

	int ans;
	if(X >= 400 && X < 600) ans = 8;
	else if(X >= 600 && X < 800) ans = 7;
	else if(X >= 800 && X < 1000) ans = 6;
	else if(X >= 1000 && X < 1200) ans = 5;
	else if(X >= 1200 && X < 1400) ans = 4;
	else if(X >= 1400 && X < 1600) ans = 3;
	else if(X >= 1600 && X < 1800) ans = 2;
	else if(X >= 1800 && X < 2000) ans = 1;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 3628
import java.io.PrintStream;
import java.util.Scanner;
public class Main {
	final static PrintStream so = System.out;
	final static Scanner sc = new Scanner(System.in);

	public static void main(String[] args) {
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] =sc.nextInt();
		}
		
		int minSum = Integer.MAX_VALUE;
		for (int i = -100; i <= 100; i++) {
			
			int tempSum = 0;
			for (int j = 0; j < n; j++) {
				tempSum += (i-a[j]) * (i-a[j]);
			}
			minSum = Math.min(tempSum, minSum);
		}
		so.println(minSum);
	}
}


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

int main(){
	int N;
	cin >> N;
	vector <int> A(N);
	bool isOK = true;
	for (int i = 0; i < N; i++){
		cin >> A.at(i);
		if (A.at(i) % 2 == 1) continue;
		else{
			if (A.at(i) % 3 == 0 || A.at(i) % 5 == 0) continue;
			else{
				isOK = false;
				break;
			}
		}
	}
	if (isOK) cout << "APPROVED" << endl;
	else cout << "DENIED" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep0(i,n) for (int i = 0; i < (n); ++i)
#define rep1(i,n) for (int i = 1; i < (n); ++i)
#define REP(i,a,b) for (int i = a; i < (b); ++i)
#define mREP(i,a,b) for (int i = a; i > (b); --i)
#define all(x) (x).begin(),(x).end()
const int INF = 1000000007;
typedef long long ll;
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 gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }

int main(){
  vector<int>a(5);
  rep0(i,5)cin >> a[i];
  vector<int>all = {0,1,2,3,4};
  int solve = INF;
  do{
    int ans = 0;
    rep0(j,5){
      while(ans % 10 != 0)ans++;
      ans += a[all[j]];
    }
    solve = min(solve,ans);

  }while(next_permutation(all.begin(),all.end()));

  cout << solve << endl;
  return 0;
}

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

using namespace std;
#define ll long long
#define pb push_back
#define vi vector<int>
#define vp vector<pair<int, int>>
#define vll vector<long long>
#define inf 1000000100
#define infll 1LL << 50

int main()
{
    string s;
    cin >> s;
    cout << s[0] << s.size() - 2 << s[s.size()-1] << endl;
}

Measured memory_bytes: 256
n,m= list(map(int, input().split()))
li=[list(map(int,input().split())) for _ in range(m)]
hub1=set()
hub2=set()
for i in li:
    if n in i:
        hub1.add(sum(i)-n)
    if 1 in i:
        hub2.add(sum(i)-1)
if hub1&hub2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

Measured memory_bytes: 64400
while str = STDIN.gets

  break if str == "\n"

  seq = [str.to_f]

  (1..9).each do |i|
    seq.push(i % 2 == 1 ? seq[i - 1] * 2.0 : seq[i - 1] / 3.0)
  end

  puts seq.inject(:+)

end

Measured memory_bytes: 8676
#include <iostream>
#include <string>
#include <vector>
#include <deque>
#include <queue>
#include <algorithm>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#define vv(a, b, c, d) vector<vector<d> >(a, vector<d>(b, c))
#define vvi vector<vector<int> >
#define vvl vector<vector<ll> >
#define vll vector<ll>
#define rep(c, a, b) for(ll c=a;c<b;c++)
#define re(c, b) for(ll c=0;c<b;c++)
#define all(obj) (obj).begin(), (obj).end()
typedef long long int ll;
typedef long double ld;
using namespace std;

int main(int argc, char const *argv[]) {
  ll n;std::cin >> n;
  string s;std::cin >> s;
  ll ans = 0;
  for(int i=0;i<n-2;i++){
    if(s[i]=='A'&&s[i+1]=='B'&&s[i+2]=='C') ans++;
  }
  std::cout << ans << '\n';
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long LL;
typedef vector<ll>VI;
typedef vector<bool>VB;
typedef pair<ll,ll>P;
typedef pair<double,double>P_D;
#define VV(T) vector<vector<T>>
#define PI 3.1415926535897932384626433832795
#define rep(i, n) for (ll i = 0; i < (ll)n; i++)
#define reprev(i, n) for (ll i = (ll)n - 1; i >= 0; i--)
#define bitrep(bit,A) for(int bit=A; ;bit=(bit-1)&A)
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) (ll)((a).size())
#define c_max(a, b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define chmax(x,a) x=max(x,a)
#define chmin(x,a) x=min(x,a)
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define SORT(c) stable_sort(ALL(c))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100//5
#define MAX2 200100
#define MAX_6 1001001//6
#define MAX_7 10010010//7
#define SENTINEL 2000000000//9
#define NIL -1
const int MOD = 1000000007;
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define Endl '\n'
inline ll GCD(ll a,ll b){return b?GCD(b,a%b):a;}
inline ll lcm(ll a,ll b){return a*b/GCD(a,b);}
using Edge=pair<int,ll>;
using Graph=vector<vector<int> >;//ll or Edge
using Edge=pair<int,ll>;
const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// sort_reverse...greater<ll>()
// g++ -o a a.cpp -Wall -lm -std=c++17

//https://img.atcoder.jp/arc091/editorial.pdf
int main(){
    ll n,k;cin>>n>>k;
    if(k==0){
        cout<<n*(n-1)+n<<endl;
        return 0;
    }
    ll ans=0;
    for(int b=k+1;b<=n;b++){
        int p=(n+1)/b, r=n-p*b;
        ans+=p*c_max(0,b-k)+c_max(0,r-k+1);
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3500
#define _USE_MATH_DEFINES
#define INF 0x3f3f3f3f

#include <iostream>
#include <cstdio>
#include <sstream>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <queue>
#include <stack>
#include <limits>
#include <map>
#include <string>
#include <cstring>
#include <set>
#include <deque>
#include <bitset>
#include <list>
#include <cctype>
#include <utility>
  
using namespace std;
  
typedef long long ll;
typedef pair <int,int> P;
typedef pair <int,P> PP;
  
static const double EPS = 1e-8;
  
static const int tx[] = {0,1,0,-1};
static const int ty[] = {-1,0,1,0};

int main(){
  int n;
  while(~scanf("%d",&n)){
    map<int,int> freq;
    for(int i=0;i<n;i++){
      int num;
      scanf("%d",&num);
      for(int div=1;div*div<=num;div++){
	if(num % div == 0){
	  freq[div]++;
	  if(div != (num/div)) freq[num/div]++;
	}
      }
    }
    for(map<int,int>::iterator it = freq.begin();
	it != freq.end();
	it++){
      if(it->second >= n){
	printf("%d\n",it->first);
      }
    }
  }
}

Measured memory_bytes: 1200
X = input()

if X == "A":
    print("A")
elif X == "B":
    print("A")
elif X == "C":
    print("A")
elif X == "D":
    print("A")
elif X == "E":
    print("A")
elif X == "F":
    print("A")
elif X == "G":
    print("A")
elif X == "H":
    print("A")
elif X == "I":
    print("A")
elif X == "J":
    print("A")
elif X == "K":
    print("A")
elif X == "L":
    print("A")
elif X == "N":
    print("A")
elif X == "M":
    print("A")
elif X == "O":
    print("A")
elif X == "P":
    print("A")
elif X == "Q":
    print("A")
elif X == "R":
    print("A")
elif X == "S":
    print("A")
elif X == "T":
    print("A")
elif X == "U":
    print("A")
elif X == "V":
    print("A")
elif X == "W":
    print("A")
elif X == "X":
    print("A")
elif X == "Y":
    print("A")
elif X == "Z":
    print("A")
else:
    print("a")


Measured memory_bytes: 9192
def main():
    N, K = list(map(int, input().split()))
    A = list(map(lambda x: int(x) - 1, input().split()))
    B = [-1] * N
    B[0] = K
    c = 0
    k = K
    while k:
        c = A[c]
        k -= 1
        if B[c] != -1:
            k %= (B[c] - k)
        B[c] = k
    return c + 1

print(main())


Measured memory_bytes: 32372
#include<stdio.h>

int main(void){
    int a,b;
	scanf("%d %d",&a,&b);
	if(a<b){
		printf("a < b\n");
	}
	else if(a>b){
		printf("a > b\n");
		}
	else{
		printf("a == b\n");
	}
    return 0;
}

Measured memory_bytes: 580
#include<iostream>
#include<cstdio>
using namespace std;
void swap(int &c1, int &c2){
	int tmp;
	tmp=c1;c1=c2;c2=tmp;
}

int main(){
	char ch1,ch2;
	int cup[3] = {1,0,0};
	while(scanf("%c,%c%*c", &ch1, &ch2) != EOF){
		swap(cup[ch1-'A'], cup[ch2-'A']);
	}
	for(int i=0;i<3;i++){
		if(cup[i])printf("%c\n", 'A'+i);
	}
	return 0;
}

Measured memory_bytes: 1144
#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,e,pas[100009],l,r;
string s;
int main(){
	ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	cin>>s;
	s.insert(0,"0");
	a=s.size()-1;
	l=a+1;r=a+1;
	for(b=a; b>=1; b--){
		if(s[b]=='R'){
			if((l-b+1)%2==0){
				pas[l-1]++;
			}else{
				pas[l]++;
			}
		}
		if(s[b]=='L'){
			l=b;
		}else{
			r=b;
		}
	}
	l=0;r=0;
	for(b=1; b<=a; b++){
		if(s[b]=='L'){
			if((b-r+1)%2==0){
				pas[r+1]++;
			}else{
				pas[r]++;
			}
		}
		if(s[b]=='L'){
			l=b;
		}else{
			r=b;
		}
	}
	for(b=1; b<=a; b++) cout<<pas[b]<<" ";
	return 0;
}

Measured memory_bytes: 1104
import sys
input = sys.stdin.readline

import sys
sys.setrecursionlimit(500000)
N, Q = map(int, input().split())
E = [[] for _ in range(N+1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    E[a].append(b)
    E[b].append(a)
C = [0] * (N+1)
for _ in range(Q):
    p, x = map(int, input().split())
    C[p] += x
Ans = [0] * (N+1)
def dfs(v, p, a):
    a += C[v]
    Ans[v] = a
    for u in E[v]:
        if u!=p:
            dfs(u, v, a)
dfs(1, 0, 0)
print(" ".join(map(str, Ans[1:])))


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

int main () {
    ll l, r;
    cin >> l >> r;
    ll Min = 2019;
    for(ll i = min(l, r); i < max(l, r); i++) {
        for(ll j = i + 1; j <= max(l, r); j++) {
            Min = min((i * j) % 2019, Min);
            if (Min == 0) {
                cout << 0 << endl;
                return 0;
            }
        }
    }
    cout << Min << endl;

}


Measured memory_bytes: 3620
S = input()
if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
else:
    print(1)


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

bool div(int a){
    
    if(a == 1){
        return true;
    }else if(a % 2 == 0){
        return div(a/2);
    }else if(a % 3 == 0){
        return div(a/3);
    }else if(a % 5 == 0){
        return div(a/5);
    }else{
        return false;
    }
    
}

int main(int argc, const char * argv[]) {

    
    
    while(true){
        int m;
        cin >> m;
        if(m==0){
            break;
        }
        
        int n;
        cin >> n;
        
        int count = 0;
        for(int i=m;i<=n;i++){
            if(div(i)){
                count++;
            }
        }
        
        cout << count << endl;
    }
    

    
    return 0;
}

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

using namespace std;

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

int n, k;

void solve0()
{
	if (n == 1) {
		cout << k / 2;
		cout << endl;
		return;
	}
	cout << k / 2 << " ";
	rep(i, n-2) {
		cout << k << " ";
	}
	cout << k << endl;
}

inline void sub(vector<int>& v, int& pos)
{
	if (v[pos] == 1) {
		v[pos] = 0;
		pos--;
	} else {
		v[pos]--;
		for (int i = pos+1; i < n; i++) v[i] = k;
		pos = n-1;
	}
}

void solve1()
{
	vector<int> res(n, k / 2 + 1);
	long long a = n / 2;
	int pos = n-1;
	while (a--) {
		sub(res, pos);
	}
	for (int i = 0; i < pos; i++) {
		cout << res[i] << " ";
	}
	cout << res[pos] << endl;
}

int main()
{
	cin >> k >> n;
	if (k % 2) solve1();
	else solve0();
}


Measured memory_bytes: 3456
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
const ll INF = 1LL<<60;


int main()
{
  ll N;cin>>N;
  ll h,max=0,keep=0,hoge=0;
  for(ll i=0;i<N;i++){
    cin>>h;
    if(h<=keep){
      hoge++;
      chmax(max,hoge);
    }else{
      chmax(max,hoge);
      hoge=0;
    }
    keep=h;
  }
  cout<<max<<endl;
  return 0;
}


Measured memory_bytes: 256
// In The Name Of God
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define int long long
#define ll long long
#define for2(a,b,c) for(int (a) = (b); (a) < (c); (a)++)
#define setp cout << fixed << setprecision(15)
#define endl "\n"
#define minit(a,b) a = min(a,b)
#define maxit(a,b) a = max(a,b)
#define PII pair<int,int>
#define Vec vector<int>
#define error(x) cerr << #x << " = " << (x) << endl;
#define all(x) (x).begin() , (x).end()


int32_t main(){
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    int q; cin >> q;
    while(q--){
        int a,b; cin >> a >> b;
        if(a > b)swap(a,b);
        int ans = 0;

        int st = 0;
        int en = a;
        while(st != en-1){
            int mid = (st+en)/2;
            if(mid*(b+1) < a*b) st = mid;
            else en = mid;
        }
        ans += st;
        ans += a-1-st;


        en = b-(a-1-st);
        st = 0;

        while(st != en-1){
            int mid = (st+en)/2;
            if(mid >= a+1){
                if( ((mid+(a+1))/2)*((mid+(a+1)+1)/2) < a*b ){
                    st = mid;
                }else en = mid;
            }else
            if(mid*(a+1) < a*b) st = mid;
            else en = mid;
        }
        ans += st;
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 256
// finish date: 2019/06/09

#include <bits/stdc++.h>

using namespace std;

#define FOR(i, a, b) for(int (i)=a;(i)<(b);(i)++)
#define rep(i, n)  FOR(i,0,n)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<double> vd;
typedef vector<vector<double>> vvd;
typedef vector<vector<vector<double>>> vvvd;
typedef vector<bool> vb;
typedef vector<vector<bool>> vvb;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vector<char>> vvc;
typedef pair<int, int> pii;
typedef pair<ll, int> pli;
typedef pair<ll, pair<int, int>> plii;
const int bigmod = 998244353;
const int INF = 1050000000;
const long long INFll = 100000000000000000;


int main() {
    int P, Q, R;
    cin >> P >> Q >> R;
    cout<<P+Q+R-max({P,Q,R})<<endl;


    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<vector>
#include<queue>

using namespace std;

int main(){
    int N; 
    cin >> N;
    long a[N];
    for(int i =0; i<N; i++){
        cin >> a[i];
    }
    long ans = 0;
    for(int i=0; i<N; i++){
        for(int j=i+1; j<N;j++){
            ans += a[i] * a[j];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
/*{{{*/
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>

typedef long long ll;

#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define FORR(i,a,b) for(ll i=b-1;i>=a;i--)

#define DEBUG(x) cout<<#x<<": "<<x<<endl

using namespace std;
/*}}}*/

int main() {
  string s;
  cin >> s;
  ll ca = 0;
  ll cb = 0;
  REP(i,s.length()){
    if(i%2==0 && s[i]=='0') ca++;
    else if(i%2==1 && s[i]=='1') ca++;
    else cb++;
  }
  cout << s.length() - max(ca,cb)<< endl;
  return 0;
}


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

int main() {
  long long int n;
  cin >> n;
  vector<long long int> city(n + 1);
  for (int i = 0; i < n + 1; i++) {
    cin >> city.at(i);
  }
  vector<long long int> sol(n);
  for (int i = 0; i < n; i++) {
    cin >> sol.at(i);
  }
  
  long long int ans = 0;
  for (int i = 0; i < n; i++) {
    if (sol.at(i) < city.at(i)) {
      ans += sol.at(i);
      continue;
    }
    
    if (sol.at(i) >= city.at(i)) {
      ans += city.at(i);
      sol.at(i) -= city.at(i);
      
      if (sol.at(i) < city.at(i+1)) {
        ans += sol.at(i);
        city.at(i+1) -= sol.at(i);
        continue;
      }
      
      if (sol.at(i) >= city.at(i+1)) {
        ans += city.at(i+1);
        city.at(i+1) = 0;
        continue;
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define put(i) cout<<fixed<<i<<endl
using namespace std;
using ll = long long;

int main(){
    int ans = 0;
    int n; cin >> n;
    string s; cin >> s;

    for(int i = 1; i < n-1; i++){
        set<char> a, b;
        for(int j = 0; j < i; j++){
            a.insert(s[j]);
        }
        for(int j = i; j < n; j++){
            b.insert(s[j]);
        }
        int cnt = 0;
        for(auto x:a){
            auto it = b.find(x);
            if(it != b.end()){ cnt++;}
        }

        ans = max(ans, cnt);
    }
    put(ans);
}

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

int main(){
  int N;
  std::cin >> N;

  std::unordered_map<std::string, long long> s_map;

  for(int i = 0; i < N; i++){
    std::string S;
    std::cin >> S;
    std::sort(S.begin(), S.end());
    s_map[S] = s_map[S]+1;
  }

  long long ans = 0;
  for(auto&& it: s_map){
    long long n = it.second;
    ans += n*(n-1)/2;
  }

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

  return 0;
}



Measured memory_bytes: 10660
/************************************************************LET US BREAK BAD!****************************************************************/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp>
#define ll long long int
#define ld long double
#define pb push_back
#define pll pair<ll, ll> 
#define vi vector<int>
#define vl vector<ll> 
#define vvl vector< vector<ll> > 
#define vvi vector< vector<int> >
#define vlp vector< pair<ll, ll> >
#define vllp vector<pair<ll, ll>, ll > 
#define mll map<ll, ll> 
#define rep(i,a)  for(ll i=0; i< a; i++)
#define rep1(i,a)   for(ll i = 1; i< a; i++)
#define foi(i, a, b)    for(ll i = a; i<b ; i++)
#define fod(i, a, b)    for(ll i = a; i>=b ; i--)
#define mp make_pair
#define fst first
#define sec second
#define ff first.first
#define fs first.second
#define pi pair<int, int>
#define ppi pair<pair<int, int>, int>
#define max3(a, b, c)   max(max(a, b), c)
#define min3(a, b, c)   min(min(a, b), c)
#define MAX 1000001
#define MOD 1000000007
// #define MOD 998244353
#define endl "\n"
#define INF (ll)1e18
#define s(v) v.size()
#define e(v) v.empty()
#define bscount(x) __builtin_popcountll(x)
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;
using namespace __gnu_pbds;

ll gcd(ll a, ll b){if(b==0)return a;return gcd(b, a%b);}
ll lcm(ll a, ll b){return a*b/gcd(a, b);}
ll fexp(ll a, ll b){ll ans = 1;while(b){if(b&1) ans = ans*a%MOD; b/=2;a=a*a%MOD;}return ans;}
ll inverse(ll a, ll p){return fexp(a, p-2);} 
void ingraph(vvl& graph, ll m){ll x, y;rep(i, m){cin>>x>>y;x--, y--;graph[x].pb(y);graph[y].pb(x);}}
ll modify(ll n){ll res = n;res%=MOD;res+=MOD;res%=MOD;return res;}

int main(){
	//#ifndef ONLINE_JUDGE
	//    freopen("../input.txt", "r", stdin);
	//    freopen("../output.txt", "w", stdout);
	//#endif
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	ll t;
	// cin>>t;
	t = 1;
	while(t--){
	   ll n, d;
	   cin>>n>>d;
	   ll ans = 0;
	   ll x, y;
	   rep(i, n){
	   	cin>>x>>y;
	   	if(x*x+y*y<=d*d){
	   		ans++;
	   	}
	   	// cout<<ans<<endl;
	   } 
	   cout<<ans<<endl;
	}
return 0;
}


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

using namespace std;
using llong = long long;
using ldbl = long double;
using lpair = pair<llong, llong>;

#define ALL(x) x.begin(), x.end()

const llong inf = 1100100100100100ll;
const llong mod = 1e9+7;

int main() {
	llong r;
	cin >> r;
	cout << r*r*3 << endl;

	return 0;
}

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

using namespace std;

const int mod = 1e9 + 7;
const int maxn = 305;
typedef pair<int, int> pii;

vector<pii> qe[maxn];
int dp[maxn][maxn][maxn];
int n;

int perform(int r, int g, int b){
  int i = max(r, max(g, b));
  int & ans = dp[r][g][b];
  if(ans != -1){
    return ans;
  }
  ans = 0;
  for(pii q : qe[i]){
    int ct = 0;
    if(r >= q.first) ct++;
    if(g >= q.first) ct++;
    if(b >= q.first) ct++;
    if(ct != q.second) return ans;
  }
  if(i == n){
    ans = 1;
    return 1;
  }
  ans += perform(i+1, g, b); ans %= mod;
  ans += perform(r, i+1, b); ans %= mod;
  ans += perform(r, g, i+1); ans %= mod;
  return ans;
}

int main(){
  cin >> n;
  memset(dp, -1, sizeof(dp));
  int m;cin >> m;
  for(int i=0;i<m;i++){
    int l,r,x; cin >> l >> r >> x;
    qe[r].push_back(pii(l,x));
  }
  cout << perform(0, 0, 0) << "\n";
}


Measured memory_bytes: 111104
from math import floor
from fractions import gcd
N,M = map(int,input().split())

def prime_decomposition(n):
  i = 2
  d = {2:0}
  while i * i <= n:
    while n % i == 0:
      n //= i
      if i not in d:
          d[i] = 0
      d[i] += 1
    i += 1
  if n > 1:
    if n not in d:
        d[n] = 1
  return d
A = list(map(int,input().split()))
for i in range(N):
    A[i] //= 2

l = A[0]
for i in range(1,N):
    l = (l*A[i])//gcd(l,A[i])
    if l>M:
        break
ans = floor((M/l+1)/2)
n = prime_decomposition(l)[2]
p2 = 2**n
for i in range(N):
    if A[i]%p2 != 0:
        ans = 0
        break
print(ans)


Measured memory_bytes: 89580
#include<bits/stdc++.h>
#define forinc(i,a,b) for(int i=a;i<=b;++i)
#define forout(i,a,b) for(int i=a;i>=b;--i)
#define forv(a,b) for(auto &a:b)
#define pii pair<int,int>
#define fi first
#define se second
#define sz(s) (int)(s.size())
#define pb push_back
#define int long long
char inchar() {char c=getchar();while(c==' '||c=='\n') c=getchar();return c;}
#define inchar inchar()
#define in ({int x=0;int c=getchar(),n=0;for(;!isdigit(c);c=getchar()) n=(c=='-');for(;isdigit(c);c=getchar()) x=x*10+c-'0';n?-x:x;})
#define bit(x,i) ((x>>i)&1)
#define batbit(x,i) (x|(1ll<<i))
#define tatbit(x,i) (x&~(1ll<<i))
#define task "atB"
using namespace std;
const int N=2e5+5;
int a[N],s[N];
main()
{
    ///freopen(task".inp","r",stdin);
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n;
    cin>>n;
    forinc(i,1,n)
    {
        cin>>a[i];
        s[i]=s[i-1]+a[i];
    }
    int z,tong=INT_MAX;
    forinc(i,1,n)
    {
        if(tong>abs(s[n]-2*s[i]))
        {
            tong=abs(s[n]-2*s[i]);
            z=i;
        }
    }
    cout<<tong;

}


Measured memory_bytes: 3328
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
typedef long long ll;
namespace mp = boost::multiprecision;
using Mint = mp::cpp_int;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i,a,b) for(int i = int(a); i < int(b); i++)
#define all(v) v.begin(), v.end()
#define uni(v) v.erase(unique(all(v)), v.end())
#define sort_g(v) sort(all(v), greater<int>())
#define dump(x) cerr << #x << ' ' << '=' << ' ' << x << endl

int main() {
    int N, K;
    cin >> N >> K;
    vector<int> L(N);
    rep(i, N) cin >> L.at(i);

    sort_g(L);
    int sum = 0;
    rep(i, K) {
        sum += L.at(i);
    }

    cout << sum << endl;
}

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

int main(){
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	string s,t;
	cin>>s>>t;
	for(int i=0;i<(int)s.size();i++){
		if(s[i] != t[i]){
			cout<<"No";
			return 0;
		}
	}
	cout<<"Yes";
	
	return 0;
}


Measured memory_bytes: 3580
#include<bits/stdc++.h>
using namespace std;
int main()
{

    int i,j,k,l,m,n,p,x,t;
    cin>>n>>m;
    t=m;
    vector<int>v;
    for(i=0;i<n;i++)
    {
        cin>>x;
        v.push_back(x);
    }
     for(i=1;i<n;i++)
    {
     p=(v[i]-v[i-1]);
     if(p>m)
        t=t+m;
     else
        t=(t+p);
    }
    cout<<t<<endl;
    return 0;
}


Measured memory_bytes: 1400
#include<iostream>
#include <cstddef>
#include<set>
#include<stack>
#include <deque>
#include<queue>
#include<utility>
#include<vector>
#include<map>
#include<cmath>
#include<cstring>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#define  ll  long long
#define ull unsigned long long
#define  sl(a)  scanf("%lld",&a)
#define  si(a)  scanf("%d",&a)
#define mem(n,m) memset(n,m,sizeof(n))
#define PI acos(-1)
#define pb    push_back
#define pf    push_front
#define vll   vector<ll>
#define pll   pair<ll,ll>
#define mp  make_pair
#define vpll vector< pair <ll,ll> >
#define vplpll vector<pair<ll,pair<ll,ll> > >
#define mp make_pair
#define all(v) v.begin(),v.end()
#define S(X) ( (X) * (X) )
#define forab(i, a, b) for(i = a; i <= b; i++)
#define forn(i, n) for(i = 0; i < n; i++)
#define print(a,b) printf("Case %lld: %lld\n",a,b)
using namespace std;
ll powd(ll a,ll b){if(b==1){return a;}if(b%2==1){return powd(a,b-1)*a;}else{ll x=powd(a,b/2); return x*x;}}
ll powm(ll a,ll b,ll m){if(b==0){return 1;}if(b==1){return a%m;}if(b%2==1){return ((powm(a,b-1,m)%m)*(a%m))%m;}else{ll x=powm(a,b/2,m); return ((x%m)*(x%m))%m;}}
ll gcd(ll a,ll b){if(a==0){return b;}return gcd(b,a%b);}
vector<string>v;
string s;
int main()
{
    ll n;
    sl(n);
    ll l;
    sl(l);
    for(ll i=0;i<n;i++)
    {
        cin>>s;
        v.pb(s);
    }
    sort(all(v));
    string s1;
    for(ll i=0;i<n;i++)
    {
        s1+=v[i];
    }
    cout<<s1<<endl;
    return 0;
}


Measured memory_bytes: 3732
N = int(input())
A = list(map(int,input().split()))
A.sort()
A.reverse()
if A.count(0) > 0:
    print(0)
else:
    ans = A[0]
    flag = 0
    for i in range(1,N):
        ans *= A[i]
        if ans > 10**18:
            flag += 1
            print(-1)
            break
    if flag == 0:
        print(ans)


Measured memory_bytes: 21772
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
 
static const double EPS = 1e-8;
static const double PI = 4.0 * atan(1.0);
static const ll INF = 1023456789;
 
#define REP(i,n)	for(int i=0;i<n;++i)
#define REPR(i,n)	for(int i=n-1;i>=0;--i)
#define FOR(i,s,n)	for(int i=s;i<n;++i)
#define FORR(i,s,n)	for(int i=n-1;i>=s;--i)
#define ALL(c)		(c).begin(),(c).end()
#define CLEAR(v)	memset(v,0,sizeof(v))
#define MP(a,b)		make_pair((a),(b))
#define ABS(a)		((a)>0?(a):-(a))
#define F			first
#define S			second

ll n, m;
string s[100], t[100];
 
int main(int argc, char **argv) {
	cin >> n;
	REP(i, n) cin >> s[i];
	cin >> m;
	REP(i, m) cin >> t[i];
	ll res = 0;
	REP(i, n) {
		ll cnt = 0;
		REP(j, n) if (s[j] == s[i]) ++cnt;
		REP(j, m) if (t[j] == s[i]) --cnt;
		res = max(res, cnt);
	}
	cout << res << endl;
	return 0;
}
 

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

// boost
#include <boost/multiprecision/cpp_int.hpp>
using boost::multiprecision::cpp_int;

using ll = long long;
using ld = long double;

using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vb = vector<bool>;
using vs = vector<string>;
using vld = vector<ld>;
using vvld = vector<vld>;

typedef pair<ll, ll> P;

#define bit(n) (1LL << (n))

//#define int long long

#define all(v) v.begin(), v.end()

#define rep(i, n) for (ll i = 0; i < n; i++)
#define REP(i, n) for (ll i = 1; i < n; i++)

#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define FORm(i, m) for (auto i = m.begin(); i != m.end(); i++)

template <class T>
inline void chmax(T& a, T b) {
  a = std::max(a, b);
}
template <class T>
inline void chmin(T& a, T b) {
  a = std::min(a, b);
}

#define mod (ll)(1e9 + 7)
// #define mod (998244353ll)

const long long INF = 1LL << 60;

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

  string s;
  string t;
  cin >> s >> t;

  ll ans = INF;
  for (int i = 0; i <= s.size() - t.size(); i++) {
    ll cnt = 0;
    rep(j, t.size()) {
      if (s[i + j] != t[j]) {
        cnt++;
      }
    }
    chmin(ans, cnt);
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3676
import java.util.*;
public class Main{
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int x = sc.nextInt();
    int y = sc.nextInt();
    int z = sc.nextInt();
    int count = 0;
    x -= 2 * z;
    while(x >= y){
      count++;
      x -= y+z;
    }
    System.out.println(count);
  }
}


Measured memory_bytes: 22612
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define INF 999999999

int n;
int p[64], t[64];

int memo[64][4];

int search(int idx, int prevStock) {
	int answer = INF + n - idx;
	int zikoku;
	int i;
	int prevPos;
	int cost;
	if (idx > n) return 0;
	if (memo[idx][prevStock]) return ~memo[idx][prevStock];

	zikoku = t[idx - 1] + (prevStock + 1) * p[idx - 1];
	prevPos = 0;
	cost = 0;
	for (i = 0; i < 3 && idx + i <= n; i++) {
		int deltaCost = abs(p[idx + i] - prevPos);
		int nextZikoku = zikoku + (i + 1) * deltaCost;
		cost += deltaCost;
		if (nextZikoku <= t[idx + i]) {
			if (idx + i + 1 <= n && INF + n - (idx + i + 1) < answer) answer = INF + n - (idx + i + 1);
			if (idx + i + 1 > n || t[idx + i] + (i + 1 + 1) * p[idx + i] <= t[idx + i + 1]) {
				int candidate = search(idx + i + 1, i + 1);
				if (candidate < INF) candidate += cost + p[idx + i];
				if (candidate < answer) answer = candidate;
			}
		} else {
			break;
		}
		prevPos = p[idx + i];
		zikoku = t[idx + i];
	}

	return ~(memo[idx][prevStock] = ~answer);
}

int main(void) {
	while (scanf("%d", &n) == 1 && n > 0) {
		int i;
		int answer;
		p[0] = 0;
		t[0] = 0;
		for (i = 1; i <= n; i++) {
			if (scanf("%d%d", &p[i], &t[i]) != 2) return 1;
		}
		memset(memo, 0, sizeof(memo));
		answer = search(1, 0);
		if (answer < INF) {
			printf("OK %d\n", answer);
		} else {
			printf("NG %d\n", INF + n - answer);
		}
	}
	return 0;
}



Measured memory_bytes: 2052
#include<cstdio>
#define re register int
using namespace std;
char ch[1000];
int main()
{
	int n;
	scanf("%d",&n);
	scanf("%s",ch+1);
	int m=n/2;
	if(n%2) {printf("No");return 0;}
	for(re i=1,j=m+1;i<=m&&j<=n;i++,j++)
	{
		if(ch[i]!=ch[j]) {printf("No");return 0;}
	}
	printf("Yes");
}

Measured memory_bytes: 128
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long double ld;

void print(ld x) {
    cout << fixed << setprecision(10) << x / (2 * M_PI) * 360 << endl;
}

int main() {
    ld a, b, x;
    cin >> a >> b >> x;
    if (x >= a * a * b / 2) {
        x = a * a * b - x;

        ld c = 2 * x / (a * a);
        ld h = 2 * x / (sqrt(a * a + c * c) * a);
        print(asin(h / a));
    } else {
        ld c = 2 * x / (a * b);
        ld h = 2 * x / (sqrt(b * b + c * c) * a);
        print(asin(h / c));
    }
    return 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>

using namespace std;
typedef long long ll;

int main(){
    ll n;
    cin >> n;
    vector<bool> exist(n * 100 + 1, false);
    exist.at(0) = true;
    for(int i = 0; i < n; ++i){
        ll s;
        cin >> s;
        for(int j = exist.size() - 1; j >= 0; --j){
            if(exist.at(j)){
                exist.at(j + s) = true;
            }
        }
    }

    ll ans = 0;
    for(int j = 0; j < exist.size(); ++j){
        if(j % 10 != 0 && exist.at(j)){
            ans = j;
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 632
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int lg(ll a) {
  int ret = 0;
  while (a) {
    a /= 10ll;
    ret ++;
  }
  return ret;
}
int F(ll a, ll b) {
  int c = lg(a);
  int d = lg(b);
  return max(c, d);
}
int main () {
  ll N;
  cin >> N;
  int ans = 100;
  for (ll i = 1ll; i * i <= N; i ++) {
    if (N % i == 0) {
      ans = F(i, N / i);
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 3516
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>

using namespace std;
using uint = unsigned;

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

    /* code */
    uint n, m;
    int c, tmp;
    vector<int> B;

    cin >> n >> m >> c;

    for(uint i = 0; i < m; i++) {
        cin >> tmp;
        B.push_back(tmp);
    }

    uint cnt = 0;
    for(uint j = 0; j < n; j++) {
        vector<int> A;
        for(uint i = 0; i < m; i++) {
            cin >> tmp;
            A.push_back(tmp);
        }
        if (inner_product(A.cbegin(), A.cend(), B.cbegin(), int(0)) > -c) {
            cnt++;
        }
    }
    cout << cnt << endl;
    /* code end */

    return 0;
}

Measured memory_bytes: 256
# author:  Taichicchi
# created: 27.09.2020 23:09:20

import sys

N, T = map(int, input().split())

t = list(map(int, input().split()))

ans = 0

for i in range(1, N):
    ans += min(T, t[i] - t[i - 1])

ans += T

print(ans)


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

int main() {
  string N; cin >>N;
  bool flag=false;
  if (N[0]==N[2]) flag=true;
  cout <<(flag ? "Yes":"No") <<endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

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

	void solve() {
		Scanner sc = new Scanner(System.in);
		int a = Integer.parseInt(sc.next());
		int b = Integer.parseInt(sc.next());
		int k = Integer.parseInt(sc.next());
		sc.close();
		List<Integer> list = new ArrayList<>();
		for(int i=Math.min(a, b);i>0;i--) {
			if(a%i==0&&b%i==0)list.add(i);
		}
		System.out.println(list.get(k-1));
	}
}



Measured memory_bytes: 21844
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<string>
#include<cstring>
#include<climits>
#include<algorithm>
#include<vector>
#include<cmath>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<deque>
#include<tuple>
#include<list>
#include<unordered_map>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vii vector<int>
#define vll vector<ll>
#define lb lower_bound
#define pb push_back
#define mp make_pair
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep2(i,a,b) for(ll i=a;i<b;i++)
#define repr(i,n) for(ll i=n-1;i>=0;i--)
#define all(x) x.begin(),x.end()
// #define int ll
using namespace std;
const int INF (1 << 30);
const ll LLINF (1LL << 55LL);
const int MOD = 1000000007;
const int MAX = 510000;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    ll a,b;
    cin>>a>>b;
    b--;
    if(b%(a-1)==0) cout<<b/(a-1)<<endl;
    else cout<<b/(a-1)+1<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e4 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
int check(string s){
	for(int i = 0;i < s.size()/2;i++){
		if(s[i] != s[s.size()-i-1]) return 0;
	}
	return 1;
}
int main(){     	
	string s;
	cin >> s;
	int f = 0;
	int l = s.size();
	if(check(s)) f++;
	else{
		printf("No\n");
		return 0;
	}
	string t = s.substr(0,(l-1)/2);
	if(check(t)) f++;
	else{
		printf("No\n");
		return 0;
	}
	string t1 = s.substr((l+3)/2-1,l-(l+3)/2+1);
	if(check(t1)) f++;
	else{
		printf("No\n");
		return 0;
	}
	printf("Yes\n");
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e16;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll a,b;

int main(){
	cin >> a >> b;
	if(a+b<10)cout << a+b << endl;
	else cout << "error" << endl;
}

Measured memory_bytes: 256