akhauriyash/Code-Regression huggingface dataset:
// #include <bits/stdc++.h>
#include <iostream>
#include <cmath>
#include <string>
#include <vector>
#include <array>
#include <map>

#define fo(i, n) for (i = 0; i < n; i++)
#define PI 3.1415926535897932384626

// using namespace std;
// using std::array;
using std::cin;
using std::cout;
using std::endl;
// using std::map;
// using std::multimap;
// using std::multiset;
// using std::set;
using std::string;
using std::vector;

int32_t randint(int32_t l, int32_t u)
{
    return l + (rand() % u);
}

template <typename T>
void readarray(T *arr, size_t l)
{
    int32_t i;
    fo(i, l)
    {
        std::cin >> arr[i];
    }
}
template <typename T>
vector<T> readvector(size_t l)
{
    vector<T> vec;
    size_t i;
    T a;
    for (i = 0; i < l; i++)
    {
        cin >> a;
        vec.push_back(a);
    }
    return vec;
}
template <typename T>
void readmatrix(int32_t rows, int32_t columns, std::vector<std::vector<T>> &matrix)
{
    int32_t num;
    int32_t i, j;
    int32_t arr[columns];
    fo(i, rows)
    {
        matrix[i] = std::vector<int32_t>(columns);
        fo(j, columns)
        {
            cin >> num;
            matrix[i][j] = num;
        }
    }
}

template <typename T>
void printarray(T *arr, size_t l, std::string sep = " ")
{
    size_t i;
    fo(i, l)
    {
        if (i == l - 1)
        {
            std::cout << arr[i];
        }
        else
        {
            std::cout << arr[i] << sep;
        }
    }
    std::cout << std::endl;
}

template <typename T>
void printvector(std::vector<T> vec, std::string sep = " ")
{
    size_t i;
    for (i = 0; i < vec.size(); i++)
    {
        if (i == vec.size() - 1)
        {
            std::cout << vec[i];
        }
        else
        {
            std::cout << vec[i] << sep;
        }
    }
    std::cout << std::endl;
}
template <typename T>
void display(T x)
{
    cout << x << endl;
}
template <typename T, typename U>
void display(T x, U y)
{
    cout << x << " " << y << endl;
}
std::string solve(string num)
{
    int sum = 0;
    for (auto ch : num)
    {
        sum += ch - 48;
    }
    if (sum % 9 == 0)
    {
        return "Yes";
    }
    return "No";
}

int main()
{
    int32_t n_test_cases = 1;
    // cin >> n_test_cases;
    while (n_test_cases--)
    {
        int32_t i, j, k, a, b, c, l, m, n, x, t;
        string num;
        cin >> num;
        display(solve(num));
    }
    return 0;
}

Measured memory_bytes: 3376
#include <bits/stdc++.h>
#define all(vec) vec.begin(),vec.end()
#define mp make_pair
using namespace std;
using ll=long long;
using P=pair<ll,ll>;
const ll INF=1LL<<30;
const ll LINF=1LL<<60;
const double eps=1e-5;
const ll MOD=1e9+7;
template<typename T>void chmin(T &a,T b){a=min(a,b);};
template<typename T>void chmax(T &a,T b){a=max(a,b);};
ll dp[1010][20010];
int main(){
    int n;cin>>n;
    vector<pair<P,P>> v;
    for(int i=0;i<n;i++){
        ll w,s,vv;cin>>w>>s>>vv;
        v.push_back(mp(P(w+s,vv),P(w,s)));
    }
    sort(all(v));
    for(int i=0;i<n;i++){
        ll vv=v[i].first.second,w=v[i].second.first,s=v[i].second.second;
        for(int j=0;j<=20000;j++){
            chmax(dp[i+1][j],dp[i][j]);
            if(j<=s)chmax(dp[i+1][j+w],dp[i][j]+vv);
        }
    }
    ll ans=0;
    for(int j=0;j<=20000;j++)ans=max(ans,dp[n][j]);
    cout<<ans<<endl;
}   


Measured memory_bytes: 157824
#include <stdio.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <memory.h>
#include <set>
#define fio ios::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll _pow(ll a, ll b) {
	ll ans = 1;
	for (ll i = 0; b >> i; i++) {
		if ((b >> i) & 1) ans *= a;
		a *= a;
	}
	return ans;
}
int n, cnt1, cnt2, cnt3;
int main(void) {
	cnt1 = cnt2 = cnt3 = 0;
	scanf("%d", &n);
	int A, B; scanf("%d %d", &A, &B);
	for (int i = 0; i < n; i++) {
		int x; scanf("%d", &x);
		if (x <= A) cnt1++;
		else if (A < x && x <= B) cnt2++;
		else cnt3++;
	}
	printf("%d\n", min(cnt1, min(cnt2, cnt3)));
	return 0;
}

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

int main(){
    int n,k;
    cin>>n>>k;
    if((n-2)*(n-1)<2*k){
        cout<<-1;
    }else{
        int e=0;
        int flag=0;
        cout<<(n*(n-1))/2-k<<endl;
        for(int j=1; j<n; j++){
            cout<<1<<" "<<j+1<<endl;
        }
        for(int i=1; i<n-1; i++){
            if(flag==1)break;
            for(int j=i+1; j<n; j++){
                if(2*e>=(n-1)*(n-2)-2*k){
                    flag=1;
                    break;
                }
                cout<<i+1<<" "<<j+1<<endl;
                e++;
            }
        }
    }


    return 0;
}

Measured memory_bytes: 256
//

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
// const int INF = 2147483647;
// const ll INF = 9223372036854775807;
// const ll MOD = 1e9 + 7;

int main() {
	ll A, V, B, W, T;
	cin >> A >> V >> B >> W >> T;

	if (W >= V) {
		cout << "NO" << endl;
		return 0;
	}

	if (abs(A - B) <= T * (V - W)) {
		cout << "YES" << endl;
	} else {
		cout << "NO" << endl;
	}

	return 0;
}

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

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(), (x).end()

using namespace std;

template <typename T> T &chmin(T &a, const T &b) {return a = min(a, b);}
template <typename T> T &chmax(T &a, const T &b) {return a = max(a, b);}

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

const int INF = 1e9;
const ld eps = 1e-9, pi = acos(-1.0);

int main(){
  int r, d, x;
  cin >> r >> d >> x;
  REP(i, 10) { x = x*r-d; cout << x << endl; }
  return 0;
}

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

using namespace std;

#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

ll N, ans = 0;

void dfs(ll x, ll a, ll b, ll c){
    if(N < x) return ;
    if(a && b && c) ans++;
    dfs(x*10+3, 1, b, c);
    dfs(x*10+5, a, 1, c);
    dfs(x*10+7, a, b, 1);
}

int main(){

    cin >> N;

    dfs(0, 0, 0, 0);

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <algorithm>
#include <utility>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <functional>
#include <numeric>
#include <complex>
#include <iomanip>
#include <set>

using namespace std;

#define bitcount(n) __builtin_popcount(n)

#define debug(n) cout << n << endl;

#define PREC(n) setprecision(n)
#define DOTPREC(n) fixed << setprecision(n)

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;

#define fst first
#define scd second
#define PB push_back
#define MP make_pair
#define rep(i,x) for(int i=0;i<(x);++i)
#define rep1(i,x) for(int i=1;i<=(x);++i)
#define rrep(i,x) for(int i=(x)-1;i>=0;--i)
#define rrep1(i,x) for(int i=(x);i>=1;--i)
#define FOR(i,a,x) for(int i=(a);i<(x);++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()

#define omajinai ios::sync_with_stdio(false); cin.tie(0)

template<typename T> bool chmax(T&a,T b) { if(a < b) {a = b; return true;} return false;}
template<typename T> bool chmin(T&a,T b) { if(a > b) {a = b; return true;} return false;}

const int inf = 1e9;
const ll linf = 3e18;
const double eps = 1e-9;

const ll MOD = 1000000007;

ll N, x;

int main(void)
{
    cin >> N >> x;
    if (x == 1 || x == (2 * N - 1)) {
        debug("No");
        return 0;
    }

    debug("Yes");


    set<ll> available;
    rep1(i, 2 * N - 1) {
        available.insert(i);
    }

    available.erase(x);

    ll r, l;
    if (x == (2 * N - 2)) {
        r = 2 * N - 1;
        l = x - 1;
    }
    else {
        r = 1;
        l = x + 1;
    }

    available.erase(l);
    available.erase(r);

    rep1(i, 2 * N - 1) {
        if (i == N) {
            debug(x);
            continue;
        }
        else if (i == N - 1) {
            debug(l);
            continue;
        }
        else if (i == N + 1) {
            debug(r);
            continue;
        }
        ll ans = *available.begin();
        debug(ans);
        available.erase(ans);
    }

    return 0;
}


Measured memory_bytes: 10880
#include <bits/stdc++.h>
#define INF 1000000000
using namespace std;

int main()
{
  long long N, M;
  cin >> N >> M;
  long long a, lcm = 1;
  int a_two = -1;
  for (long long i = 0; i < N; ++i)
  {
    cin >> a;
    a /= 2;
    if (lcm % a != 0)
    {
      lcm = (lcm * a) / __gcd(lcm, a);
    }
    int cnt = 0;
    while (a % 2 == 0)
    {
      cnt += 1;
      a /= 2;
    }
    if (a_two == -1)
    {
      a_two = cnt;
    }
    else if (cnt != a_two)
    {
      cout << 0 << endl;
      return 0;
    }
    if (lcm > M)
    {
      cout << 0 << endl;
      return 0;
    }
  }
  long long tolerance = lcm * 2;
  long long start = lcm;
  cout << (M - start) / tolerance + 1 << endl;
}


Measured memory_bytes: 256
// Aizu Vol-1 0190: Eleven Puzzle
// 2017.8.23 bal4u@uu
// ???????????¢?´¢??????????????\??????????????§??¶????????§??????
// ????????????????????????16?????????????????§??§???OK???
// 1????????????????????§8??????4??????????????§4096????????¶??????

#include <stdio.h>

#define MAX 500000
typedef unsigned long long UL;

typedef struct { UL s; char m; } HASH;
typedef struct { UL s; char b1, b2; } QUE;
#define HASHSIZ 900001ULL
HASH hash[HASHSIZ + 5], *hashend = hash + HASHSIZ;
QUE Q[MAX + 5], *top, *end, *qmax = Q + MAX;

int lookup(UL s)
{
	HASH *p = hash + s % HASHSIZ;
	while (p->s) {
		if (p->s == s) return p->m;
		if (++p == hashend) p = hash;
	}
	return -1;
}

int insert(UL s, char m)
{
	HASH *p = hash + s % HASHSIZ;
	while (p->s) {
		if (p->s == s) return 0;
		if (++p == hashend) p = hash;
	}
	p->s = s, p->m = m;
	return 1;
}

int move[13][5] = {
	/*  0 */{ 2, -1 },
	/*  1 */{ 2, 5, -1 },
	/*  2 */{ 0, 1, 3, 6, -1 },
	/*  3 */{ 2, 7, -1 },
	/*  4 */{ 5, -1 },
	/*  5 */{ 1, 4, 6, 9, -1 },
	/*  6 */{ 2, 5, 7, 10, -1 },
	/*  7 */{ 3, 6, 8, 11, -1 },
	/*  8 */{ 7, -1 },
	/*  9 */{ 5, 10, -1 },
	/* 10 */{ 6, 9, 11, 12, -1 },
	/* 11 */{ 7, 10, -1 },
	/* 12 */{ 10, -1 } };

UL swap(UL s, int p1, int sp)
{
	UL n1;
	p1 = (12 - p1) << 2, sp = (12 - sp) << 2;
	n1 = (s >> p1) & 0xf;
	s &= ~(0xfULL << p1);
	s |= (n1 << sp);
	return s;
}

int sach(UL s, int b1, int b2, int mode, int step, int lim)
{
	int i, j, x, b[2];
	UL s2;

	top = end = Q;
	end->s = s, end->b1 = b1, end->b2 = b2, end++, end->s = 0, end++;
	while (top < end) {
		s = top->s, b[0] = top->b1, b[1] = top->b2, top++;
		if (!s) { step++, end->s = 0, end++; continue; }
		if (step > lim) break;
//	printf("%#15llx, b1 %2d, b2 %2d, step %2d\n", s, b[0], b[1], step);
		for (i = 0; i < 2; i++) {
			for (j = 0; (x = move[b[i]][j]) >= 0; j++) {
				if (x == b[0] || x == b[1]) continue;
				s2 = swap(s, x, b[i]);
				if (mode) { if (lookup(s2) >= 0) return step; }
				else if (!insert(s2, step)) continue;
				end->s = s2;
				if (i) end->b1 = b[0], end->b2 = x;
				else   end->b1 = x, end->b2 = b[1];
				end++;
			}
		}
	}
	return step;
}

int main()
{
	int i, ans, p, b1, b2;
	UL s;
	int lim = 16;

	s = 0x123456789ab0ULL, insert(s, 0);
	sach(s, 0, 12, 0, 1, lim);
	while (1) {
		b1 = -1;
		for (s = i = 0; i < 13; i++) {
			scanf("%d", &p);
			if (i == 0 && p < 0) return 0;
			if (!p) { if (b1 < 0) b1 = i; else b2 = i; }
			s = (s << 4) | p;
		}
		if ((ans = lookup(s)) < 0) {
			if ((ans = sach(s, b1, b2, 1, 1, 4)) > 4) ans = -1;
			else ans += lim;
		}
		printf(ans < 0 ? "NA\n" : "%d\n", ans);	
	}
	return 0;
}

Measured memory_bytes: 22364
//BISMILLAHIR RAHMANIR RAHIM
#include <bits/stdc++.h>
#define mem(a, b) (memset(a, b, sizeof(a)))
#define pb push_back
#define mk make_pair
#define ff first
#define ss second
#define PI acos(-1)
#define INF 2147483647
#define MOD 1000000007
#define MAX 200005
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
typedef vector<ii> vii;
typedef priority_queue<int,vector<int>,greater<int> > PQ;

int Set(int mask, int pos){return mask = mask | (1<<pos);}
bool check(int mask, int pos){return (bool)(mask & (1<<pos));}

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

    ll a, b, c, d, x, y;

    cin>>a>>b>>c>>d;

    ll ans = max(a * d, b * d);
    ans = max(ans, max(a * c, b * c));

    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 3648
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_map>
#include<climits>
#include<cstdlib>
#include<cmath>
#include<string>
#include<iomanip>

using namespace std;

#define INF 1 << 29
#define LL long long int

LL const MOD = 1000000007;

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

    LL n;
    cin >> n;
    if(n == 1){
        cout << "Hello World" << endl;
    }else{
        LL a,b;
        cin >> a >> b;
        cout << a+b << endl;
    }
    
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int main(void)
{
	int n,c;
	scanf("%d",&n);

	for(c=1;c<=n;c++){
		
		if((int)c%3==0||
		   (int)c%10==3||(int)c/10==3||
		   (int)c%100==3||(int)c/100==3||(int)c%100/10==3||(int)c%100%10==3||
		   (int)c%1000==3||(int)c/1000==3||(int)c%1000%100%10==3||(int)c%1000%100/10==3||(int)c%1000/100%10==3||(int)c%1000/100/10==3){
		printf(" %d",c);
		}
	}
printf("\n");
return 0;
}

Measured memory_bytes: 600
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;

public class Main {
	public static void main(String[] args) {
		InputReader in = new InputReader(System.in);
		PrintWriter out = new PrintWriter(System.out);

		String s = in.nextToken();

		int a = s.indexOf('A');
		int z = s.lastIndexOf('Z');

		out.println(z-a+1);
		//for (int i = 1 ; i <= m; i++) {
		//	out.println(ans[i]);
		//}
		out.flush();
	}

	// ----------------------

	static class InputReader {
		private InputStream stream;
		private byte[] buf = new byte[1024];
		private int curChar;
		private int numChars;

		public InputReader(InputStream stream) {
			this.stream = stream;
		}

		private int next() {
			if (numChars == -1)
				throw new InputMismatchException();
			if (curChar >= numChars) {
				curChar = 0;
				try {
					numChars = stream.read(buf);
				} catch (IOException e) {
					throw new InputMismatchException();
				}
				if (numChars <= 0)
					return -1;
			}
			return buf[curChar++];
		}

		public char nextChar() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z')) {
				return (char) c;
			}
			throw new InputMismatchException();
		}

		public String nextToken() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			StringBuilder res = new StringBuilder();
			do {
				res.append((char) c);
				c = next();
			} while (!isSpaceChar(c));
			return res.toString();
		}

		public int nextInt() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			int sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			int res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c-'0';
				c = next();
			} while (!isSpaceChar(c));
			return res*sgn;
		}

		public long nextLong() {
			int c = next();
			while (isSpaceChar(c))
				c = next();
			long sgn = 1;
			if (c == '-') {
				sgn = -1;
				c = next();
			}
			long res = 0;
			do {
				if (c < '0' || c > '9')
					throw new InputMismatchException();
				res *= 10;
				res += c-'0';
				c = next();
			} while (!isSpaceChar(c));
			return res*sgn;
		}

		public double nextDouble() {
			return Double.valueOf(nextToken());
		}

		public boolean isSpaceChar(int c) {
			return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
		}

		//public interface SpaceCharFilter {
		//	public boolean isSpaceChar(int ch);
		//}
	}
	// template
	static int gcd(int n, int r) { return r == 0 ? n : gcd(r, n%r);  }
	static long gcd(long n, long r) { return r == 0 ? n : gcd(r, n%r);  }

	static <T> void swap(T[] x, int i, int j) { T t = x[i]; x[i] = x[j]; x[j] = t;  }
	static void swap(int[] x, int i, int j) { int t = x[i]; x[i] = x[j]; x[j] = t;  }
}


Measured memory_bytes: 10316
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
  cin>>n;
  multiset<int>d;
  multiset<int> :: iterator itr;
  int a[n];
  for(int i=0;i<n;i++)
  {
    int f;cin>>f;
   d.insert(f);
  }
  int i=0;
  for(itr=d.begin();itr!=d.end();itr++)
  {
  a[i]=*itr;
    i++;
  }
  cout<<a[n/2]-a[n/2-1];
}

Measured memory_bytes: 5376
#include <cstdio>
#include <algorithm>

using namespace std;

const int MAXN = 2e3 + 10;

int cnt[MAXN];

int main() {
    int n, x, y;
    scanf("%d%d%d", &n, &x, &y);// don't forget &
    for (int i = 1; i <= n; i++) {
        for (int j = i + 1; j <= n; j++) {
            int w = j - i;
            w = min(w, abs(i - x) + 1 + abs(y - j));
            cnt[w]++;
        }
    }
    for (int i = 1; i <= n - 1; i++) {
        printf("%d\n", cnt[i]);
    }
    return 0;
}


Measured memory_bytes: 128
#include <stdio.h>
 
using namespace std;
 
int main(){
    int a,b;
    double a_d,b_d;
    scanf("%d %d",&a,&b);
    a_d = static_cast<double>(a);
    b_d = static_cast<double>(b);
    printf("%d %d %.5f\n",a/b,a%b,a_d/b_d);
}


Measured memory_bytes: 2732
#include <iostream>
using namespace std;
int main(void){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    if(a+b>c+d)cout<<"Left"<<endl;
    else if(a+b<c+d)cout<<"Right"<<endl;
    else cout<<"Balanced"<<endl;
    return 0;
}


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

int main(){
    int c[3][3];
    for (int i = 0; i < 3; i++){
        for (int j = 0; j < 3; j++){
            cin >> c[i][j];
        }
    }
    if ((c[0][0] - c[0][1] == c[1][0] - c[1][1]) &&
        (c[1][0] - c[1][1] == c[2][0] - c[2][1]) &&
        (c[0][1] - c[0][2] == c[1][1] - c[1][2]) &&
        (c[2][1] - c[0][1] == c[2][2] - c[0][2])){
        cout << "Yes" << endl;
        }
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define pii pair<int,int>
#define vi  vector<int>
#define vii vector<pair<int,int>>
#define vll vector<lli>
#define pb  push_back
#define mp  make_pair
#define ss  second
#define ff  first
#define all(x) x.begin(),x.end()
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define testcase() int t;cin>>t;while(t--)
const lli mod = 1000000007;
const int maxn = 1e6+9;
lli b_ex(lli n,lli a){lli res=1;while(n){if(n%2==1)res*=a;n>>=1;a=a*a;}return res;}
lli ncr(lli n,lli k){lli ans=1;if(k>n-k)k=n-k;for(lli i=1;i<=k;i++){ans*=(n-i+1),ans=ans/i;}return ans;}
lli power(lli a , lli n){lli ans = 1;while(n){if(n % 2)ans = (ans * a) % mod;n /= 2;a = (a * a) % mod;}return ans;}
lli set_bits(lli n)
{
    int c=0;
    if(n==0)return 0;
    while(n)
    {
        if((n&1)==1)
        {
           cout<<c<<" ";
        }
        c++;
        n=n>>1;
    }
    return c;
}
lli lcm(lli a,lli b)
{
    lli ans=(a*b)/(__gcd(a,b));
    return ans;
}
///------------------ALWAYS lli-----TEMP TSF99--------------------------------------------------------------------------------------///
int main()
{
    string a;cin>>a;
    int n=a.size();
    int ans=0;
    int c=0;
    for(int i=0;i<n;i++)
    {
        if(a[i]=='S')
        {
            ans=max(ans,c);
            c=0;
        }
        else c++;
    }
    ans=max(ans,c);
    cout<<ans<<endl;
}


Measured memory_bytes: 3624
import java.util.*;
import java.io.*;
public class Main {
    static long mod=1000000007L;
    public static void main(String args[]) {
        Scanner input=new Scanner(System.in);
        int n=input.nextInt();
        long k=input.nextLong();
        long arr[][]=new long[n][n];
        for(int i=0;i<n;i++) {
            for(int j=0;j<n;j++) {
                arr[i][j]=input.nextLong();
            }
        }
        long res[][]=new long[n][n];
        power(arr, res, k);
        long sum=0;
        for(int i=0;i<n;i++) {
            for(int j=0;j<n;j++) {
                sum+=res[i][j];
                sum%=mod;
            }
        }
        System.out.println(sum);
    }
    public static void power(long arr[][], long res[][], long n) {
        if(n==1) {
            for(int i=0;i<arr.length;i++) {
                for(int j=0;j<arr.length;j++) {
                    res[i][j]=arr[i][j];
                }
            }
            return;
        }
        power(arr,res,n/2);
        multiply(res,res,res);
        if(n%2==1) {
            multiply(res,arr,res);
        }
    }
    
    static void multiply(long a[][], long b[][], long res[][])  { 
        long mul[][] = new long[a.length][a.length]; 
        for (int i = 0; i < a.length; i++) { 
            for (int j = 0; j < a.length; j++)  { 
                mul[i][j] = 0; 
                for (int k = 0; k < a.length; k++) {
                    mul[i][j] += a[i][k] * b[k][j]; 
                    mul[i][j]%=mod;
                }
            } 
        }
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a.length; j++) {
                res[i][j] = mul[i][j]; 
            }
        }
    } 
}


Measured memory_bytes: 29968
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0; i<n; i++)
typedef long long ll;
typedef long long unsigned int llu;
ll mod = 1000000007;
ll INF = 1000000009;

struct problems{
    int point;
    int number;
    int bonus;
};

int a[11];

void base2(int x, int d){
    rep(i,d){
        a[i] = x%2;
        x = x/2;
    }
}

void solve(){
    int d,g;
    cin >> d >> g;
    vector<problems> v;
    rep(i,d){
        struct problems p;
        p.point = (i+1)*100;
        cin >> p.number >> p.bonus;
        v.emplace_back(p);
    }

    /*
    制約が弱い。問題の難易度は100~1000, 問題数はそれぞれ100問以下。
    各問題を、「全部解く」「全部解かない」により場合分けし、残りの点数を大きいものから順に取っていく
    */

    int ans = INF;
    int i = 0;
    //base2(7,4);
    //cout << a[0] << " " << a[1] << " " << a[2] << endl;
    rep(i,pow(2,d)){
        int sum=0;
        int maxproblem=0;
        int numberofproblem = 0;
        base2(i, d);
        rep(j,d){
            if(a[j]==1) {
                sum += (v[j].point)*(v[j].number) + v[j].bonus;
                numberofproblem += v[j].number;
            }
            else maxproblem=j;
        }
        //cout << "i:" << i << ", maxproblem" << maxproblem << endl;
        int rest;
        rest = g - sum;
        if(rest>0){
        if(rest<=(v[maxproblem].point)*(v[maxproblem].number-1)) {
            int tmp = rest / v[maxproblem].point;
            if(rest%v[maxproblem].point==0){
                numberofproblem += tmp;
            }
            else{
                numberofproblem += tmp + 1;
            }
        }
        else{
            numberofproblem = INF;
        }
        }
        //cout << numberofproblem << endl;
        ans = min(ans, numberofproblem);
    }
    cout << ans << endl;
}

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


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD=1000000007;
#define INF 1LL<<30
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()

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

    ll ans=0;
    map<int,int> m;
    rep(i,n){     
        ans+=m[i-a[i]];
        m[a[i]+i]++;
    }

    cout<<ans<<endl;

}


Measured memory_bytes: 21024
package main

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

var sc = bufio.NewScanner(os.Stdin)

func main() {
	//sc.Split(bufio.ScanWords)
	for sc.Scan() {
		s := strings.Split(sc.Text(), " ")
		n1, _ := strconv.Atoi(s[0])
		n2, _ := strconv.Atoi(s[1])
		fmt.Printf("%d\n", len(strconv.Itoa(n1+n2)))
	}
}



Measured memory_bytes: 1076
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>

using ll = long long;

using namespace std;

int main() {
    int x, y, z;
    cin >> x >> y >> z;
    swap(x, y);
    swap(x, z);
    cout << x << ' ' << y << ' ' << z << '\n';
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<queue>
#include<sstream>
using namespace std;
typedef long long LL;
const int INF = 0x3f3f3f3f;


int main()
{
	long long a;
	cin >> a;
	long long ans = 0,ans1 = 0;
	for(int i = 1;i <= sqrt(a);i++){
		if(a % i == 0){
			ans = i;
			ans1 = a/i;
		}
	}
	cout << ans + ans1 - 2<< endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#define fi first
#define se second
#define pb push_back
#define max(a,b) ((a)>(b)?(a):(b))
#define min(a,b) ((a)<(b)?(a):(b))
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
#define L(i,u) for (int i=head[u]; i!=0; i=edge[i].nxt)
#define abs(a) ((a)>0 ? (a) : -(a))
#define INF 0x3f3f3f3f
using namespace std;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
typedef long long ll;
typedef long double ld;
int n,a,b;

inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=10*x+c-'0'; c=getchar();} x*=f;
}
inline ll gcd(ll a, ll b) {return (!b) ? a : gcd(b,a%b);}
int main() {
	read(n);
	rep(i,1,3500) rep(j,1,3500) {
		ll x=(ll)n*i*j,y=(ll)4*i*j-n*j-n*i;
	//	ll GCD=gcd(x,y); x/=GCD; y/=GCD;
		if (x*y>0&&x%y==0) {printf("%d %d %lld",i,j,x/y); return 0;}
	}
}

Measured memory_bytes: 256
def solve():
  N, M, K = map(int,input().split())
  AA = list(map(int,input().split()))
  BB = list(map(int,input().split()))
  A_max = 0
  AAs = [0]*N
  AAs[0] = AA[0]
  if K>=AAs[0]:
    A_max = 1
  for i in range(1,N):
    AAs[i] = AAs[i-1] + AA[i]
    if K>=AAs[i]:
      A_max+=1
  BBs = [0]*M
  BBs[0] = BB[0]
  BM = M
  for i in range(1,M):
    BBs[i] = BBs[i-1] + BB[i]
  Book_max = 0
  for i in range(A_max+1):
    b_max = 0
    if i == 0:
      B_time = K
    else:
      B_time = K - AAs[i-1]
    for j in range(BM-1,-1,-1):
      #print(i,j,A_max,b_max,B_time,BM)
      if B_time>=BBs[j]:
        b_max = j+1
        BM = b_max
        break
    if Book_max<b_max+i:
      Book_max = b_max+i
  print(Book_max) 
solve()

Measured memory_bytes: 47392
a,b = map(int, input().split())
A = 0
B = 0

for i in range(0,a):
    A = A + (10 ** i) * b

for i in range(0,b):
    B = B + (10 ** i) * a

if a <= b:
    print(B)
else:
    print(A)

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

using namespace std;

typedef long long ll;

const int INF = 1e9;

int main()
{
  int ch = -1;
  while ((ch = getchar()) != EOF) {
    if (!isalpha(ch)) { putchar(ch); }
    else if (isupper(ch)) { putchar(tolower(ch)); }
    else { putchar(toupper(ch)); }
  }
  return 0;
}

Measured memory_bytes: 1072
#include <bits/stdc++.h>
using namespace std;
int main(){
    string S,T,s,cusso;
    cin>>S>>T;
    int ans=INT_MAX,t=T.size(),n=S.size();
    int crw=0;
    for(int i=0;i<n;i++){
        if(i==(n-t)+1)
           break;
        for(int j=i;j<(i+t);j++){
            s+=S[j];
        }
        for(int j=0;j<t;j++){
            if(s[j]!=T[j])    
                ++crw;
        }
        ans=min(ans,crw);
        crw=0;
        s="";
    }    
    cout<<ans<<endl;
}

Measured memory_bytes: 3588
#include "bits/stdc++.h"
using namespace std;

//template
typedef long long int ll;
#define rep(i,n) for(ll i=0;i<n;i++)
#define rep1(i,n) for(ll i=1;i<n;i++)
#define repr(i,n) for(ll i=n;i>0;i--)
#define all(v) v.begin(),v.end()
#define in cin>>
#define out cout<<
#define en <<endl
const ll INF = 10000000000000;

int main()
{
	ll x;
	in x;
	ll h, m, s;
	h = x / 3600;
	m = x % 3600 / 60;
	s = x % 60;
	out h << ":" << m << ":" << s en;
}



Measured memory_bytes: 3084
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
int main() {
    int n, m; cin >> n >> m;
    vector<vector<int> > adj(3*n);
    while (m--) {
        int u, v; cin >> u >> v; u--; v--;
        for (int k = 0; k < 3; k++) adj[3*u+k].push_back(3*v+(k+1)%3);
    }
    int s, t; cin >> s >> t;
    s--; t--;
    priority_queue<pair<int, int> > pq;
    pq.push({0, 3*s});
    int dist[3*n];
    const int INF = 1<<30;
    fill(dist, dist+3*n, INF);
    dist[3*s] = 0;
    while (!pq.empty()) {
        int d = -pq.top().first, u = pq.top().second;
        pq.pop();
        if (d > dist[u]) continue;
        for (int v : adj[u]) {
            if (d+1 < dist[v]) {
                dist[v] = d+1;
                pq.push({-d-1, v});
            }
        }
    }
    cout << (dist[3*t] == INF ? -1 : dist[3*t]/3) << endl;
}


Measured memory_bytes: 17792
from collections import defaultdict
import math
import sys
input=sys.stdin.readline
MOD=10**9+7
N=int(input())

def powmod(a,p):
  if p==0:
    return 1
  else:
    pow2=powmod(a,p//2)
    if p%2==0:
      return (pow2**2)%MOD
    else:
      return (a*pow2**2)%MOD

ratio_dic=defaultdict(int)
zero2_num=0

for i in range(N):
  A,B=map(int,input().split())
  if A==0 and B==0:
    zero2_num+=1
  elif A==0:
    ratio_dic[(0,1)]+=1
  elif B==0:
    ratio_dic[(1,0)]+=1
  elif B>0:
    AB_gcd=math.gcd(A,B)
    Arat=A//AB_gcd
    Brat=B//AB_gcd
    #print(A,B,Arat,Brat)
    ratio_dic[(Arat,Brat)]+=1
  else:
    AB_gcd=math.gcd(A,B)
    Arat=-A//AB_gcd
    Brat=-B//AB_gcd    
    #print(A,B,Arat,Brat)
    ratio_dic[(Arat,Brat)]+=1
#print(zero2_num,ratio_dic)

answer=1
checked_set=set()
for k,v in list(ratio_dic.items()):
  if k in checked_set:
    continue
  
  a,b=k
  #(a,b)<=>(ainv,binv)
  if a>0:
    ainv,binv=-b,a
  else:
    ainv,binv=b,-a
    
  num_k1=ratio_dic[(a,b)]
  num_k2=ratio_dic[(ainv,binv)]
  answer*=powmod(2,num_k1)+powmod(2,num_k2)-1
  answer%=MOD
  #print(k,(ainv,binv),num_k1,num_k2)
  
  checked_set.add((a,b))
  checked_set.add((ainv,binv))
  
print((zero2_num+answer-1)%MOD)

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

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define rep(pos, len) for(int pos=0;pos<len;pos++)
#define repp(pos, len) for(int pos=1;pos<=len;pos++)

#define INF 987654321
#define IINF 2987654321987654321
#define MOD 1000000007

const int MAXN = 2e5 + 50;
const int LOGN = 18;
int n, k, p[MAXN];
void readInput() {
	scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i++)
		scanf("%d", &p[i]);
}

int mn[MAXN][LOGN], mx[MAXN][LOGN];
int log_2[MAXN];
void makeSparseTable() {
	for(int i = 1; i <= n; i++)
		mn[i][0] = mx[i][0] = p[i];
	for(int x = 1; x < LOGN; x++) {
		for(int i = 1; i <= n; i++) {
			int t = i+(1<<(x-1));
			mn[i][x] = (t <= n) ? min(mn[i][x-1], mn[t][x-1]) : mn[i][x-1];
			mx[i][x] = (t <= n) ? max(mx[i][x-1], mx[t][x-1]) : mx[i][x-1];
		}
	}

	for(int x = 0; x < LOGN; x++) {
		for(int i = (1<<x); i < (1<<(x+1)); i++) {
			if(i >= MAXN) break;
			log_2[i] = x;
		}
	}
}

int head[MAXN], tail[MAXN];
void preprocess() {
	head[1] = 1;
	for(int i = 2; i <= n; i++)
		head[i] = (p[i] > p[i-1]) ? head[i-1] : i;
	tail[n] = n;
	for(int i = n-1; i >= 1; i--)
		tail[i] = (p[i] < p[i+1]) ? tail[i+1] : i;
}


int rangeMin(int l, int r) {
	int d = log_2[r-l+1];
	return min(mn[l][d], mn[r-(1<<d)+1][d]);
}

int rangeMax(int l, int r) {
	int d = log_2[r-l+1];
	return max(mx[l][d], mx[r-(1<<d)+1][d]);
}


void solve() {
	vector<pii> rlist;
	for(int s = 1; s+k-1 <= n; s++) {
		int l = s, r = s+k-1;
		int low = l, high = min(tail[l], r), lend = -1;
		while(low <= high) {
			int mid = (low + high) / 2;
			if(rangeMin(mid, r) == p[mid]) {
				low = mid+1;
			} else {
				lend = mid;
				high = mid-1;
			}
		}

		low = max(head[r], l), high = r;
		int rend = -1;
		while(low <= high) {
			int mid = (low + high) / 2;
			if(rangeMax(l, mid) == p[mid]) {
				high = mid-1;
			} else {
				rend = mid;
				low = mid+1;
			}
		}

		//printf("sort [%d,%d]: changes [%d,%d]\n", l, r, lend, rend);

		rlist.emplace_back(lend, rend);
	}

	sort(rlist.begin(), rlist.end());
	rlist.erase(unique(rlist.begin(), rlist.end()), rlist.end());
	printf("%d\n", (int)rlist.size());
}


int main() {
	readInput();
	makeSparseTable();
	preprocess();
	solve();
}

Measured memory_bytes: 33652
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
 ll n;
 cin>>n;
 double p[n];
 for(ll i=0;i<n;i++) cin>>p[i];
 double dp[n][n+1];
 for(ll i=0;i<=n;i++) dp[n-1][i]=0;
 dp[n-1][0]=1-p[n-1];
 dp[n-1][1]=p[n-1];
 for(ll i=n-2;i>=0;i--){
  for(ll j=0;j<=n;j++){
    if(j) dp[i][j]=p[i]*dp[i+1][j-1]+(1-p[i])*dp[i+1][j];
    else dp[i][j]=(1-p[i])*dp[i+1][j];
  }
 }
 double ans=0;
 for(ll i=n/2+1;i<=n;i++) ans+=dp[0][i];
 cout.precision(12);
 cout<<ans<<endl;
 return 0;
}

Measured memory_bytes: 70528
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))

N = ri()
S1 = rls()
S2 = rls()
mode = None
mode_p = None
ans = 0
mod = 10**9 + 7

i = 0
while(i < N):
    if(S1[i] == S2[i]):
        if(mode is None):
            mode = "c"
        else:
            mode_p = mode
            mode = "c"
    else:
        i += 1
        if(mode is None):
            mode = "r"
        else:
            mode_p = mode
            mode = "r"
    
    if(mode_p is None):
        ans = 3 if mode == "c" else 6
    else:
        if(mode_p == "c"):
            ans = ans*2%mod
        elif(mode == "r"):
            ans = ans*3%mod
    i += 1

print(ans)


Measured memory_bytes: 3064
import bisect
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()

#各BがCのどこに挿入できるか
BtoC = [0]*N
for i in range(N):
    BtoC[i] = N - bisect.bisect_right(C,B[i])

#累積和
s = [0]*N
for i in range(N):
    i = N-1-i
    if i == N-1:
        s[i] = BtoC[i]
        continue
    s[i] = s[i+1]+BtoC[i]
res = 0
for a in A:
    ind = bisect.bisect_right(B,a)
    res += s[ind] if ind <= N-1 else 0
print(res)

Measured memory_bytes: 24540
#include <bits/stdc++.h>
using namespace std;
#define mayu return 0;
int main() {
  int H, W;
  cin >> H >> W;
  vector<vector<char>> table(2*H, vector<char>(W));
  for(int i = 0; i < H; i++) {
    for(int j = 0; j < W; j++) {
      cin >> table[2*i][j];
    }
    table[2*i + 1] = table[2*i];
  }
  for(int i = 0; i < 2*H; i++) {
    for(int j = 0; j < W; j++) {
      cout << table[i][j];
    }
    cout << endl;
  }
  mayu;
}

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

#define N 36

typedef struct node{
  char value;
  int num;
}Node;

int isStable(Node *, Node *, int);
void BubbleSort(Node *, int);
void SelectionSort(Node *, int);

Node C[N], C1[N];
char c[3];
int n;

int main()
{

  int i;

  scanf("%d", &n);

  for(i=0; i<n; i++){
    scanf("%s", c);

    C[i].value = c[0];
    C[i].num = atoi(&c[1]);
    C1[i] = C[i];

  }

  for(i=0; i<n-1; i++){
    BubbleSort(C, n);
    printf("%c%d ", C[i].value, C[i].num);
  }
 
  printf("%c%d\n", C[i].value, C[i].num);
  printf("Stable\n");

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

  printf("%c%d\n", C1[i].value, C1[i].num);

  if(isStable(C, C1, n) == 0) printf("Not stable\n");
  else printf("Stable\n");
 
  return 0;
}


int isStable(Node *C, Node *C1, int n){

  int i;

  for(i=0; i<n; i++){
    if(C[i].value != C1[i].value) return 0;
  }

  return 1;

}

void BubbleSort(Node *C, int n){

  int i, j;
  Node tmp;

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

void SelectionSort(Node *C1, int n){

  int i, j, minj;
  Node tmp;

   for(i=0; i<=n-1; i++){
     minj = i;
     for(j=i; j<=n-1; j++){
       if(C1[j].num < C1[minj].num){
	 minj = j;
       }
     }     
     tmp = C1[i];
     C1[i] = C1[minj];
     C1[minj] = tmp;
   }
}

Measured memory_bytes: 608
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <climits>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#define NDEBUG
#include <assert.h>
using namespace std;
const int INF=INT_MAX/4;
/*
Status:Writing
Type:Problemset/HB
Problem ID:Atcoder ARC B
Author:XIZCM
*/
int n;
vector<int> nei[100005];
int dis[100005],rdis[100005];
void bfs(int start,int d[]){
	fill(d,d+100005,INF);
	d[start]=0;
	queue<int> q;
	q.push(start);
	while(!q.empty()){
		int t=q.front();
		q.pop();
		for(int i=0;i<nei[t].size();i++){
			int u=nei[t][i];
			if(d[u]>d[t]+1){
				d[u]=d[t]+1;
				q.push(u);
			}
		}
	}
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n-1;i++){
		int a,b;
		scanf("%d%d",&a,&b);
		a--;
		b--;
		nei[a].push_back(b);
		nei[b].push_back(a);
	}
	bfs(0,dis);
	bfs(n-1,rdis);
	int s=0,f=0;
	for(int i=0;i<n;i++){
		if(dis[i]>rdis[i]){
			s++;
		}
		else{
			f++;
		}
	}
	puts(f>s?"Fennec":"Snuke");
	return 0;
}


Measured memory_bytes: 6656
#include <iostream> // {{{
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <cstdio> // }}}

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

using namespace std;

int main() {
    int n;
    cin >> n;
    int i;
    for(i=0;i*i <= n;i++);
    i--;
    cout << i*i << endl;
    return 0;
}


Measured memory_bytes: 384
/* Bismillahirrahmanirrahim */
/* Author : Jehian Norman Saviero (@Reiva5) */
#include <bits/stdc++.h>
 
// MACROS SAMPAH
#define Jehian using
#define Norman namespace
#define Saviero std
 
Jehian Norman Saviero;
 
// MACROS TYPE
typedef long l;
typedef unsigned long long ll;
typedef unsigned long ul;
typedef unsigned long long ull;
typedef double ld;
typedef pair<int,int> pi;
typedef pair<l,l> pl;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<l> vl;
typedef vector<ll> vll;
 
// MACROS FOR PRINT
#define nl printf("\n")
#define sp printf(" ")
 
// MACROS FOR ATTRIBUTE
#define fi first
#define se second
 
// MACROS FOR FUNCTION AND METHOD
#define eb emplace_back
#define mp make_pair
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define ALL(x) (x).begin(), (x).end()
#define ALLN(x,n) (x), (x)+(n)
#define CUBE(x) (SQR(x)*(x))
#define SET(x,y) for (int _qwe = sizeof(x)/sizeof(x[0]); _qwe; ) x[--_qwe] = (y)
#define SQR(x) ((x)*(x))
#define SSORT(x,sz) sort(ALLN(x,sz))
#define RESET(x) memset((x), 0, sizeof(x))
#define VSORT(x) sort(ALL(x))
 
// MACROS READ INPUT
#define sci(x) scanf("%d", &x)
#define scl(x) scanf("%ld", &x)
#define scll(x) scanf("%lld", &x)
#define scul(x) scl(x)
#define scull(x) scll(x)
 
int main() {
	ll H, N;
	scll(H), scll(N);
	ll tot = 0;
	for (int i = 0; i < N; ++i) {
		ll tmp;
		scll(tmp);
		tot += tmp;
	}
	puts(H <= tot ? "Yes" : "No");
	return 0;
}

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

count_list = [0] * (N+1)
count = 0
for n in range(N-1):
    if (S[n] == 'A' and S[n+1] == 'C'):
        count += 1
    count_list[n+2] = count

ans = []
for q in range(Q):
    l, r = map(int, input().split())
    ans.append(count_list[r] - count_list[l])

for q in range(Q):
    print(ans[q])


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

int main() {
    int n;
    cin >> n;
    vector<int> p(n);
    for(int i=0;i<n;i++){
        cin >> p.at(i);
    }
    sort(p.begin(),p.end());
    int total=0;
    for(int i=0;i<n-1;i++){
        total += p.at(i);
    }
    total += p.at(n-1)/2;
    cout << total << endl;
}

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

int main(){
    string S; cin >> S;
    if (S=="hi" || S=="hihi" || S=="hihihi" || S=="hihihihi" || S== "hihihihihi"){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
void write(char);

int main() {
	int m, f, r, sum;

	while (true) {
		cin >> m >> f >> r;
		if (m == -1 && f == -1 && r == -1) break;
		sum = m + f;
		if (m == -1 || f == -1)	write('F');
		else if (sum >= 80)	write('A');
		else if (sum >= 65)	write('B');
		else if (sum >= 50)	write('C');
		else if (sum >= 30) {
			if (r >= 50)	write('C');
			else write('D');
		}
		else write('F');
	}

	return 0;
}

void write(char c) {
	cout << c << endl;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
int s[50];
int main()
{
  int n, m;
  cin >> n >> m;
  for (int i = 0;i<m;i++){
    int a, b;
    cin >> a >> b;
    s[a]++, s[b]++;
  }
  for (int i = 0; i++ < n;)
    cout << s[i] << endl;
}



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

// #include <boost/algorithm/string/join.hpp>
// using boost::algorithm::join;
//
// #include "boost/multi_array.hpp"
// boost::multi_array<int, 3> dp;
// dp.resize(boost::extents[10][9][8]);
//
// #include <boost/multiprecision/cpp_dec_float.hpp>  // quite slowly
// #include <boost/multiprecision/cpp_int.hpp>
// namespace mp = boost::multiprecision; // mp::log10
// using bigint = boost::multiprecision::cpp_int;
// using rational = mp::cpp_rational;  // double d = static_cast<double>(r);

typedef long long ll;
typedef unsigned long long ull;
//typedef long double ld;

typedef map<int, int> mii;
typedef pair<int, int> pii;
typedef pair<double,double> pdd;
typedef set<int> si;
typedef set<ll> sll;
typedef vector<int> vi;
typedef vector<pair<int, int > > vii;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<vi> vvi;
typedef vector<vii> vvii;
typedef vector<vll> vvll;

//constexpr ll MOD = 1e9+7;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/4;
constexpr int INF=inf<int>;
constexpr ll LINF=inf<ll>;

#define Sort(x) sort(begin(x),end(x))
#define Reverse(x) reverse(begin(x),end(x))
#define ABS(a,b) ((a)<(b)?(b)-(a):(a)-(b))
#define nbit(n) (1ull<<(n))
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...) _ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n) for(int i=n-1;i>=0;--i)
#define REPA(i,v) REP(i,(v).size())

// sort(begin(x), end(x), greater<ll>());
// lower_bound(a.begin(), a.end(), val): a[i] ≥ valである最左の位置
// upper_bound(a.begin(), a.end(), val): a[i] > valである最左の位置

// Returns minimum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmin(T& a, T b) {
  if (a > b) {
    a = b;
  }
  return a;
}

// Returns maximum of a and b.
// If a is less b, a is set to b.
template<typename T>
T chmax(T& a, T b) {
  if (a < b) {
    a = b;
  }
  return a;
}

template <typename T>
void dumpContents(const T& v, const string& msg)
{
  cerr << "### " << msg << " ###\n";
  for (const auto& x : v) {
    cerr << x << " ";
  }
  cerr << endl;
}

struct before_main_function {
  before_main_function() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<setprecision(20)<<fixed;
#define endl "\n"
  }
} before_main_function;

// ========== end of template ==========

int main(int argc, char** argv) {
  ll K, N;
  cin >> K >> N;
  vll A(N);
  for (auto& a : A) {
    cin >> a;
  }

  ll ret = A[0] + K - A[N-1];
  REP(i, 1, N) {
    chmax(ret, A[i]-A[i-1]);
  }

  cout << (K-ret) << endl;

  return 0;
}

/* vim: set expandtab shiftwidth=2 softtabstop=2 : */


Measured memory_bytes: 1792
import java.util.*;

public class Main {
	public static void main(String[] args) {
		// practice contest

		Scanner sc = new Scanner(System.in);
		String S = sc.next();
		// char[] array = new char[4];
		// for (int i = 0; i < array.length; i++) {
		// array[i] = S.charAt(i);
		// }
		char[] array = S.toCharArray();
		Arrays.sort(array);

		if ((array[0] == array[1]) && (array[2] == array[3]) && (array[0] != array[2])) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}

		Arrays.sort(array);
		// for()
		// if(array[i])

	}
}


Measured memory_bytes: 21844
#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <climits>
#include <cassert>
#include <algorithm>
#include <utility>

using namespace std;
using Int = long long int;
using UInt = unsigned long long int;
using VI = vector<long long int>;
using VVI = vector<vector<long long int> >;


int main(void) {
    string s;
    cin >> s;
    string first = s.substr(0, 4);
    string second = s.substr(4, 8);
    cout << first << " " << second << endl;
    return 0;
}


Measured memory_bytes: 3540
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;

struct Node {
	int pos;
	int height;
	std::map<int, int> connects;
};

Node nodes[100010];
int n;	//节点个数 
int m;	//

int main()
{
	scanf("%d%d", &n, &m);
	for (int i = 1 ; i <= n ; i++) {
		scanf("%d", &(nodes[i].height));
	}
	
	for (int i = 0 ; i < m ; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		if (nodes[a].connects.find(b) == nodes[a].connects.end()) {
			nodes[a].connects[b] = 1;
			nodes[b].connects[a] = 1;
		} else {
			nodes[a].connects[b]++;
			nodes[b].connects[a]++;
		}
	}
	
	int count = 0;
	for (int i = 1 ; i <= n ; i++) {
		std::map<int, int>::iterator iConnect;
		
		bool isAccepted = true;
		for (iConnect = nodes[i].connects.begin() ; 
			iConnect != nodes[i].connects.end() ; 
			iConnect++) {
//			if (iConnect->second > 1)
//				continue;
			int newId = iConnect->first;
			if (nodes[i].height <= nodes[newId].height) {
				isAccepted = false;
				break;
			}
		}
		
		if (isAccepted) {
			count++;
		}
	}
	printf("%d\n", count);

	return 0;
}


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

int main() {
  int n;
  cin >> n;
  vector<int> A(n);
  rep(i, n) cin >> A[i];
  int num = 0;
  rep(i, n) num ^= A[i];
  rep(i, n) {
    int ans;
    ans = num ^ A[i];
    cout << ans << ' ';
  }
  return 0;
}


Measured memory_bytes: 4008
#include <stdio.h>
#include<math.h>
#include<string.h>

int main(void){
    int K,X;
    scanf("%d %d",&K,&X);
    for(int i=-K+X+1;i<K+X-1;i++){
        if(-1000000<=i && i<=1000000)printf("%d ",i) ;
    }
    if( -1000000<=K+X-1 && K+X-1<=1000000)printf("%d",K+X-1) ;
    
    return 0;    
}


Measured memory_bytes: 128
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#define PI 3.1415926535
int dim;


void Koch(double, double, double, double, int);


int main(){
  int i;
  double x1=0,y1=0,x2=100,y2=0;
  
  scanf("%d",&dim);

  printf("%1.8f %1.8f\n",x1,y1);
  
  if(0<=dim || dim<=6){
    Koch(x1,y1,x2,y2,dim);
  }
  
  printf("%1.8f %1.8f\n",x2,y2);
  
  return 0;
}





void Koch(double x1, double y1, double x2, double y2, int dim)
{
  double x3=0, y3=0, x4=0, y4=0, x5=0, y5=0;
  double s , c;
  
  if(dim != 0){
    s = sin(PI/3);
    c = cos(PI/3);



  x3 = ( 2*x1 +   x2 ) / 3;
  y3 = ( 2*y1 +   y2 ) / 3;
  x5 = (   x1 + 2*x2 ) / 3;
  y5 = (   y1 + 2*y2 ) / 3;
  x4 = x3 + (x5-x3)*c + (y5-y3)*s;
  y4 = y3 - (x5-x3)*s + (y5-y3)*c;
  Koch( x1, y1, x3, y3, dim-1 );
  printf("%1.8f %1.8f\n",x3,fabs(y3));
  Koch( x3, y3, x4, y4, dim-1 );
  printf("%1.8f %1.8f\n",x4,fabs(y4));
  Koch( x4, y4, x5, y5, dim-1 );
  printf("%1.8f %1.8f\n",x5,fabs(y5));
  Koch( x5, y5, x2, y2, dim-1 );
}
  return;
}

Measured memory_bytes: 640