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

int main() {
  int N;
  cin >> N;
  vector<string> S(N);
  for(int i = 0; i < N; i++){
    cin >> S.at(i);
  }
  sort(S.begin(), S.end());
  vector<string> X(0);
  for(int i = 0; i < N; i++){
    if(i == 0 || S.at(i) != S.at(i-1)) X.push_back(S.at(i));
  }
  int Xsize = X.size();
  vector<int> Xnum(Xsize,0);

  int num = 0;
  for(int i = 0; i < N; i++){
    if(i == 0 || S.at(i) == S.at(i-1) ) Xnum.at(num)++;
    else if(S.at(i) != S.at(i-1)){
      num++;
      Xnum.at(num)++;
    }
  }
  int max = 0;
  for(int i = 0; i < Xsize; i++){
    if(Xnum.at(i) > max) max = Xnum.at(i);
  }

  for(int i = 0; i < Xsize; i++){
    if(Xnum.at(i) == max) cout << X.at(i) << endl;
  }

}

Measured memory_bytes: 16756
#include <bits/stdc++.h>
#define INF 0x3f3f3f
#define PB push_back
#define F first
#define S second
#define FOR(i,k) for(int i=0; i<k; i++)
#define RFOR(i,k) for(int i=k; i>=0; i--)
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
#define DEBUGV(x) cout<<#x<<": "; for(auto &d:x) cout<<d<<" "; cout<<endl
#define DEBUGM(x) for(auto &p:x) cout<<p.F<<":"<<p.S<<" "; cout<<endl;
#define OUT(x) cout<<(x)<<endl

using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<PII> VPII;
typedef vector<VI> VVI;
typedef map<char,int> MC;
typedef map<int,int> MI;
typedef map<string,int> MS;

template<typename T, typename U> void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> void amax(T &x, U y) { if(x < y) x = y; }
VPII neighbors = {{0,1}, {1,0}, {0,-1}, {-1,0}};
PII operator+(PII &l, PII &r) { return {l.F+r.F, l.S+r.S}; }
bool IsValid(PII p, int Y, int X) { 
  return p.F >=0 && p.F < Y && p.S >=0 && p.S < X; }
bool IsPrime(int n) {
  if (n <= 1)  return false;
  if (n <= 3)  return true;
  if (n%2 == 0 || n%3 == 0) return false;
  for (int i=5; i*i<=n; i=i+6)
    if (n%i == 0 || n%(i+2) == 0)
      return false;
  return true;
}

int main() {
  int a,b,c;
  cin>>a>>b>>c;
  VI v;
  v.PB(a); v.PB(b); v.PB(c);

  int ops=0;
  while(v[0]!=v[1] || v[1]!=v[2] || v[2]!=v[0]) {
    VI v2 = v;
    sort(ALL(v2));
    if(v2[0]!=v2[1])
      v2[0]+=2;
    else {
      v2[0]++; 
      v2[1]++;
    }
    v=v2;
    ops++;
  }
  OUT(ops);
}

Measured memory_bytes: 256
#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>;

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

int h[100100][3], dp[100100][3];

int main()
{
    int n;
    cin >> n;
    rep(i, n) rep(j, 3) cin >> h[i][j];
    rep(i, n) rep(j, 3) rep(k, 3)
    {
        if (j == k)
            continue;
        chmax(dp[i + 1][k], dp[i][j] + h[i][k]);
    }
    // rep(i, n + 1)
    // {
    //     rep(j, 3) cout << dp[i][j] << " ";
    //     cout << endl;
    // }
    int ans = 0;
    rep(i, 3) ans = max(ans, dp[n][i]);
    cout << ans << endl;
    return 0;
}

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

int main(){
  int N;
  int i,j;
  int a,b,c;
  cin >> N;
  vector<vector<int>> d(N,vector<int>(3));
  cin >> d[0][0] >> d[0][1] >>d[0][2];
  for(i=1;i<N;i++){
    cin >> a >> b >> c;
    d[i][0] = max(d[i-1][1]+a,d[i-1][2]+a);
    d[i][1] = max(d[i-1][0]+b,d[i-1][2]+b);
    d[i][2] = max(d[i-1][0]+c,d[i-1][1]+c);
  }
  
  cout << max(d[N-1][0],max(d[N-1][1],d[N-1][2])) << endl;
  
  return 0;
}


Measured memory_bytes: 8776
n = gets.to_i
arr = gets.split(" ").map(&:to_i).sort

j = arr.max
k = 9999999999
div = 1000000000

if arr.include?(j/2)
    puts j.to_s + " " + (j/2).to_s
    exit
end
for i in 0..n-2 do
    if (j/2 - arr[i]).abs <= div
        div = (j/2 - arr[i]).abs
        k = arr[i]
    end
end

puts j.to_s + " " + k.to_s

Measured memory_bytes: 11904
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for(ll i = 0, i##_len = (n); i < i##_len; i++)
#define reps(i, s, n) for(ll i = (s), i##_len = (n); i < i##_len; i++)
#define rrep(i, n) for(ll i = (n) - 1; i >= 0; i--)
#define rreps(i, e, n) for(ll i = (n) - 1; i >= (e); i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) ((ll)(x).size())
#define len(x) ((ll)(x).length())

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    // ifstream in("input.txt");
    // cin.rdbuf(in.rdbuf());
    ll n;
    cin >> n;
    vector<vector<pair<ll, ll>>> g(n);
    rep(i, n - 1) {
        ll a, b;
        cin >> a >> b;
        a--; b--;
        g[a].push_back(make_pair(b, i));
        g[b].push_back(make_pair(a, i));
    }
    vector<set<ll>> color(n);
    vector<ll> ans(n - 1, -1);
    queue<ll> q;
    q.push(0);
    while(!q.empty()) {
        ll v = q.front(); q.pop();
        ll cur = 0;
        for(auto x : g[v]) {
            ll u = x.first, idx = x.second;
            if (ans[idx] != -1) continue;
            reps(i, cur, n) {
                if ((color[v].count(i) == 0) && (color[u].count(i) == 0)) {
                    cur = i + 1;
                    color[v].insert(i);
                    color[u].insert(i);
                    ans[idx] = i;
                    q.push(u);
                    break;
                }
            }
        }
    }
    ll mv = *max_element(all(ans));
    printf("%lld\n", mv + 1);
    rep(i, n - 1) printf("%lld\n", ans[i] + 1);
    return 0;
}


Measured memory_bytes: 22784
N=int(input())

x={}


for i in range(2):
    x[i] = list(map(int, input().split(' ')))


m=0
for i in range(len(x[0])):
    y=0
    s=0
    for p in range(N):
        s+=x[y][p]
        if p == i:
            y+=1
            s+=x[y][p]
    if s > m:
        m=s

print(m)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <vector>
#include <set>
#include <cassert>
#include <cstdlib>
#include <complex>
#include <cctype>
#include <cmath>
#include <ctime>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <sstream>
#include <functional>
#include <iomanip>
//#include <windows.h>  //Should be deleted when using AtCoder&POJ
using namespace std;

#define ll long long
#define pii pair<int,int>
/**==Info==
*Program:3
*Problem:Antennas on Tree
*Date:2017-8-7
*Algorithm:Teacher's BFS
*Stats:Unknown*/

bool debug=false;

vector<int> nei[100005];
int deg[100005];
int main(int argc,char* argv[]){
	int n;
	cin>>n;
	for(int i=0;i<n-1;i++){
		int a,b;
		cin>>a>>b;
		nei[a].push_back(b);
		nei[b].push_back(a);
		deg[a]++;
		deg[b]++;
	}
	int mx=0;
	for(int i=0;i<n;i++){
		mx=max(mx,deg[i]);
	}
	if(mx<=2){
		cout<<1;
		return 0;
	}
	queue<int> q;
	for(int i=0;i<n;i++){
		if(deg[i]==1){
			q.push(i);
		}
	}
	while(!q.empty()){
		int v=q.front();
		q.pop();
		int to=0;
		for(int i=0;i<nei[v].size();i++){
			to=nei[v][i];
			if(deg[to]!=1) break;
		}
		if(deg[to]==2){
			deg[to]--;
			q.push(to);
		}
	}
	
	int ans=0;
	for(int i=0;i<n;i++){
		if(deg[i]==1){
			continue;
		}
		int nm=0;
		for(int j=0;j<nei[i].size();j++){
			int to=nei[i][j];
			if(deg[to]==1) nm++;
		}
		ans+=max(0,nm-1);
	}
	
	cout<<ans;
	return 0;
}



Measured memory_bytes: 7040
import java.util.*;

class Main{
	public static void main(String[]args){
		Scanner sc = new Scanner(System.in);
		int tmp;
		for(int i = 1;;i++){
			int x = sc.nextInt();
			int y = sc.nextInt();
			if(x <= 0 && y <= 0){
				break;
			}
			else if(x > y){
				tmp = x;
				x = y;
				y = tmp;
			}
			System.out.println(x+" "+y);
		}
	}
}


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

#define all(container) container.begin(), container.end()
#define sortall(container) (sort(container.begin(), container.end()))
#define yn(cond) ((cond) ? (cout << "Yes" << endl) : (cout << "No" << endl))
#define YN(cond) ((cond) ? (cout << "YES" << endl) : (cout << "NO" << endl))

typedef long long       ll;

typedef vector<int>     vi;
typedef vector<ll>      vll;
typedef vector<double>  vd;
typedef vector<bool>    vb;
typedef vector<char>    vc;
typedef vector<string>  vs;
typedef pair<int, int>  pii;
typedef pair<ll, ll>    pll;
typedef vector<vi>		vvi;
typedef vector<vll>		vvll;
typedef vector<vd>		vvd;
typedef vector<vb>		vvb;
typedef vector<vc>		vvc;
typedef vector<vs>		vvs;
typedef vector<pii>     vpii;
typedef vector<pll>     vpll;

typedef struct edge_ {
	ll to;
	ll cost;
} edge;

typedef struct point_ {
	ll x, y;
	point_(ll x = 0, ll y = 0) : x(x), y(y) {}
} point;

template <typename T>
using mat2d = vector<vector<T>>;

constexpr double	PI = 3.14159265358979323846;
constexpr ll		INF = 1 << 15;
constexpr ll		MOD = (ll)1e9 + 7;
constexpr double	EPS = 1e-7;
constexpr int		dy4[4] = { 0, 1, 0, -1 };
constexpr int		dx4[4] = { 1, 0, -1, 0 };
constexpr int		dy8[8] = { 0, 1, 1, 1, 0, -1, -1, -1 };
constexpr int		dx8[8] = { 1, 1, 0, -1, -1, -1, 0, 1 };

template<typename T>
istream& operator >> (istream& is, vector<T>& vec) {
	for (T& x : vec) is >> x;
	return is;
}

template<typename T>
ostream& operator << (ostream& os, const vector<T>& vec) {
	for (const T& x : vec) os << x << " ";
	return os;
}

template<typename S, typename T>
istream& operator >> (istream& is, pair<S, T>& p) {
	is >> p.first >> p.second;
	return is;
}

istream& operator >> (istream& is, point& p) {
	is >> p.x >> p.y;
	return is;
}

template<typename S, typename T>
ostream& operator << (ostream& os, const pair<S, T>& p) {
	os << "{" << p.first << " : " << p.second << "}";
	return os;
}

template<typename T>
ostream& operator << (ostream& os, const set<T>& s) {
	for (const T& x : s) os << x << " ";
	return os;
}

ostream& operator << (ostream& os, const edge e) {
	os << "{to: " << e.to << ", cost: " << e.cost << "}";
	return os;
}

ostream& operator << (ostream& os, const point& p) {
	os << "(" << p.x << " " << p.y << ")";
	return os;
}

/******************************************************************************/
/**********************         Don't make WA !!         **********************/
/******************************************************************************/


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

	map<char, int> m;
	for (auto s : w) {
		m[s]++;
	}

	bool ans = true;
	for (auto mm : m)
		if (mm.second % 2 == 1)
			ans = false;

	yn(ans);

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdint>
#include<cstdlib>
template<typename T>
void fin(T const& t){ std::cout << t << std::endl; exit(0); }

int main() {
  int64_t H, W; std::cin >> H >> W;
  if(H==1 || W==1) fin(1);
  fin((H*W+1)/2);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(x,y,z) for(int x=y;x<=z;x++)
#define FORD(x,y,z) for(int x=y;x>=z;x--)
#define MSET(x,y) memset(x,y,sizeof(x))
#define FOR(x,y) for(__typeof(y.begin()) x=y.begin();x!=y.end();x++)
#define F first
#define S second
#define MP make_pair
#define PB push_back
#define SZ size()
#define M 
void RI(){}
template<typename... T>
void RI( int& head, T&... tail ) {
    scanf("%d",&head);
    RI(tail...);
}
using namespace std;
typedef long long LL;
int main()
{
	int n,m;
	RI(n,m);

	if(n%2)
	{
		REP(i,1,n/2)
		{
			if(i!=1) putchar(' ');
			printf("%d",0);
		}
		REP(i,n/2+1,n)
		{
			if(i!=1) putchar(' ');
			printf("%d",m);
		}
		puts("");
	}
	else
	{
		REP(i,1,n/2+1)
		{
			if(i!=1) putchar(' ');
			printf("%d",0);
		}
		REP(i,n/2+2,n) printf(" %d",m);
		puts("");
	}
	return 0;
}

Measured memory_bytes: 1180
n, k = map(int, input().split())
v = []
for i in range(n):
    abc = [x for x in input().split()]
    a = int(abc[0])
    b = int(abc[1])
    c = abc[2]
    if c == 'W':
        b += k
    v.append((a % (2*k), b % (2*k)))

s = [[0 for _ in range(3*k+1)] for _ in range(3*k+1)]
s2 = [[0 for _ in range(k+1)] for _ in range(k+1)]
s3 = [[0 for _ in range(k+1)] for _ in range(k+1)]

for i in range(n):
    s[v[i][1]][v[i][0]] += 1
    s[v[i][1]+k][v[i][0]+k] += 1
    s[v[i][1]+k][v[i][0]] -= 1
    s[v[i][1]][v[i][0]+k] -= 1

for i in range(3*k):
    for j in range(3*k):
        s[i+1][j] += s[i][j]
for i in range(3*k):
    for j in range(3*k):
        s[i][j+1] += s[i][j]

for i in range(3*k):
    for j in range(3*k):
        c = (i//k+j//k) % 2
        if c == 0:
            s2[i % k][j % k] += s[i][j]
        else:
            s3[i % k][j % k] += s[i][j]
res = 0

for i in range(k):
    for j in range(k):
        res = max(res, s2[i][j])
        res = max(res, s3[i][j])

print(res)


Measured memory_bytes: 138884
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define SIZE 200005
#define INF 1000000005LL
//#define INF 1e18
#define MOD 1000000007

using namespace std;
typedef long long int ll;
typedef pair <int,int> P;

const int MAX = 510000;

long long fac[MAX], finv[MAX], inv[MAX]; //n!, 1/n!, 1/n

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(ll n, ll k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

map<ll,ll> prime_factor(ll n){
  map<ll,ll> res;
  for(ll i=2;i*i<=n;i++){
    while(n%i==0){
      ++res[i];
      n /= i;
    }
  }
  if(n!=1) res[n] = 1;
  return res;
}

int main(){
  ll n,m;
  cin >> n >> m;
  COMinit();
  ll ans=1;
  map<ll,ll> M = prime_factor(m);
  for(auto p : M){
    ll k = p.second;
    ans *= COM(n+k-1,k);
    ans %= MOD;
  }
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 12160
n = int(input())
hats = list(map(int, input().split()))

mod = 1000000007

cnt = [0] * 3
ans = 1

for i in range(n):
    count = 0
    minj = 4
    for j in range(3):
        if hats[i] == cnt[j]:
            count += 1
            minj = min(minj, j)
    if count == 0:
        ans = 0
        break
    cnt[minj] += 1

    ans = ans * count % mod

print(ans)

Measured memory_bytes: 20768
import numpy as np

N = int(input())
S = np.array(list(input()))
Q = int(input())
K = list(map(int, input().split()))


D_idx = S == 'D'
M_idx = S == 'M'
C_idx = S == 'C'

num_d = D_idx.cumsum(dtype=int)
num_m = M_idx.cumsum(dtype=int)

def count_DMC(k):
  _num_d = num_d.copy()
  _num_d[k:] = _num_d[k:] - _num_d[:-k] # k個先になったらカウントを減らす
  _num_m = num_m.copy()
  _num_m[k:] = _num_m[k:] - _num_m[:-k] # 同上
  num_dm = _num_d * M_idx # 'M'の位置における'DM'の個数
  num_dm[k:] -= D_idx[:-k] * _num_m[k-1:-1]
  return (num_dm.cumsum(dtype=int) * C_idx).sum()


for k in K:
  print(count_DMC(k))

Measured memory_bytes: 82108
using System;

namespace ABC143_C
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();

            var ans = 1;
            var last = s[0];
            for (int i = 1; i < n; i++)
            {
                if (s[i] != last)
                {
                    ans++;
                    last = s[i];
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 11360
package main

import "fmt"

import "strconv"

func main() {
	for i := 1; ; i++ {
		var x int
		fmt.Scan(&x)
		if x != 0 {
			fmt.Println("Case " + strconv.Itoa(i) + ": " + strconv.Itoa(x))
		} else {
			break
		}
	}
}



Measured memory_bytes: 2136
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef pair<int, int> P;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()

void YN(bool flg){if(flg) cout << "YES" << endl; else cout << "NO" << endl;}
void Yn(bool flg){if(flg) cout << "Yes" << endl; else cout << "No" << endl;}
void yn(bool flg){if(flg) cout << "yes" << endl; else cout << "no" << endl;}

bool isPalindrome(string s) {
    string t = s;
    reverse(all(t));
    return s == t;
}

int main() {
    string s;
    cin >> s;
    
    bool can = true;
    if(!isPalindrome(s)) can = false;
    if(!isPalindrome(s.substr(0, s.length() / 2))) can = false;
    if(!isPalindrome(s.substr(s.length()/2+1))) can = false;

    Yn(can);

    return 0;
}


Measured memory_bytes: 256
N = int(input())
A = [0]*N
for i in range(N):
    A[i] = int(input())

B = [0]*N
possible = True
tot = 0
if A[0] == 0:
    for i in range(N-1):
        if A[-(i+1)] > N-i-1:
            possible = False
            break
        elif B[-(i+1)] > A[-(i+1)]:
            possible = False
            break
        elif B[-(i+1)] == A[-(i+1)]:
            B[-(i+2)] = A[-(i+1)]-1
            continue
        else:
            B[-(i+2)] = A[-(i+1)]-1
            tot += A[-(i+1)]
    if not possible:
        print(-1)
    else:
        print(tot)
else:
    print(-1)

Measured memory_bytes: 19268
#include <cstdio>

using namespace std;

char conv[256];
int n,m;

int main(){
	char c;
	char s1[2];
	char s2[2];
	while(scanf("%d",&n) && n){
		for(int i=0;i<256;i++){
			conv[i] = i;
		}
		for(int i=0;i<n;i++){
			scanf("%s %s",s1,s2);
			conv[*s1] = *s2;
		}
		scanf("%d",&m);
		for(int i=0;i<m;i++){
			scanf("%s",s1);
			printf("%c",conv[*s1]);
		}
		printf("\n");
	}
}

Measured memory_bytes: 0
#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, k, s;
  cin >> n >> k >> s;
  
  vector<int> a(n);
  if (s == (int)1e9) {
    rep(i, n) {
      if (i < k) a[i] = s;
      else a[i] = 1;
    }
  } else {
    rep(i, n) {
      if (i < k) a[i] = s;
      else a[i] = s + 1;
    }
  }
  printf("%d", a[0]);
  for (int i = 1; i < n; ++i) printf(" %d", a[i]);
  printf("\n");
  return 0;
}

Measured memory_bytes: 3848
#include <bits/stdc++.h>
using namespace std;
 
#define rep(i,n) for(int i=0;i<n;i++)
#define REP(i,s,n) for(int i=(s);i<(n);i++)
#define repr(i,n) for(int i=n-1;i>=0;i--)
#define REPR(i,s,n) for(int i=(s);i>=(n);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define Eunique(v) v.erase(unique(all(v)),v.end())
#define pvec(v) rep(i,v.size()){cout << v[i] << " ";};cout<<endl;
#define pb push_back
#define pf push_front
#define mod 1e9+7
#define m_p make_pair
 
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
typedef pair<ll,ll> pll;
typedef vector<pll> vpll;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
const double pi = acos(-1.0);
 
ll gcd(ll x, ll y) { return (y == 0) ? x : gcd(y, x % y); }
ll lcm(ll x, ll y) { return x * y / gcd(x, y); }

bool IsPrime(int num)
{
    if (num < 2) return false;
    else if (num == 2) return true;
    else if (num % 2 == 0) return false;

    double sqrtNum = sqrt(num);
    for (int i = 3; i <= sqrtNum; i += 2)
    {
        if (num % i == 0)
        {
            return false;
        }
    }
    return true;
}

int main()
{
    ll n,m;
    cin >> n >> m;
    vs a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,m) cin >> b[i];
    for(ll i=0;i<n-m+1;i++){
        for(ll j=0;j<n-m+1;j++){
            bool check=true;
            for(ll k=0;k<m;k++){
                for(ll l=0;l<m;l++){
                    if(a[i+k][j+l]!=b[k][l]) check=false;
                }
            }
            if(check){
                cout << "Yes\n";
                return 0;
            }
        }
    }
    cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
using System;

namespace AOJ.Volume0
{
    class Program0007
    {
        static void Main(string[] args)
        {
            int money = 100000;
            int weeks;

            weeks = int.Parse(Console.ReadLine());

            for (int i = 0; i < weeks; i++)
            {
                money = (int)Math.Ceiling(money * 1.05 / 1000) * 1000;
            }

            Console.WriteLine(money);
        }
    }
}

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

typedef long long ll;

ll N, K;

ll solve() {
  if (K == 0) return N * N;
  ll r = 0;
  for (ll b = K + 1; b <= N; ++b) {
    r += ((N + 1) / b) * (b - K) + max(0ll, (N + 1) % b - K);
  }
  return r;
}
int main() {
  cin >> N >> K;
  cout << solve() << endl;
  return 0;
}


Measured memory_bytes: 256
#include<stdio.h>

int main(void)
{
	int kousya[4][3][10] = { 0 };
	int building;   //棟
	int floor;   //階
	int room;   //部屋番号
	int volume;   //人数
	int i, j, k;   //くり返し用

	int info;   //入力する情報の数

	scanf("%d", &info);
	for (i = 0; i < info; i++)
	{
		scanf("%d %d %d %d", &building, &floor, &room, &volume);
		kousya[building - 1][floor - 1][room - 1] = kousya[building - 1][floor - 1][room - 1] + volume;
	}
	for (i = 0; i < 4; i++)
	{
		for (j = 0; j < 3; j++)
		{
			for (k = 0; k < 10; k++)
			{
				printf(" %d", kousya[i][j][k]);
			}
			printf("\n");
		}
		if (i != 3)
		{
			printf("####################\n");
		}
	}
	return 0;
}


Measured memory_bytes: 2124
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll INF = 1LL << 60;
const ll MOD = (int) 1e9 + 7;

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;
    for (int i = 0; i < n - 2; i++)
    {
        if (s.substr(i, 3) == "ABC") {
            ans++;
        }
    }
    cout << ans << "\n";
}

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

const int G = 2e5;
vector<int> e[G+1];
bool used[G+1];

const int yBase = 1e5;

ll nx, ny;

void dfs(int u) {
  if(used[u]) return;
  used[u] = true;
  if(u <= yBase) {
    nx++;
  } else {
    ny++;
  }

  for(auto v: e[u]) dfs(v);
}

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

  rep(i,N) {
    int x, y;
    cin >> x >> y;
    e[x].push_back(yBase+y);
    e[yBase+y].push_back(x);
  }

  ll ans = -N;
  for(int i = 1; i <= G; i++) {
    if(used[i]) continue;
    nx = ny = 0;
    dfs(i);
    ans += nx * ny;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 10240
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>

#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i <= (n); i++)
#define show(a, n) rep(i,n) {cout<<a[i]<<' ';} cout<<endl;
#define show2(a, n, m) rep(i, n) { rep(j, m) {cout << a[i][j] << ' ';} cout << endl;} 

using namespace std;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<long long, long long> pll;

const int INF = 1 << 30;
const long long INFL = 1LL << 62;
const int MOD = 1000000007;
const int MAX = 100000;
const int N = 100010;

struct edge {
	ll to, d;
	edge(ll to, ll d): to(to), d(d) {};
};

int main() {
//	cout << fixed << setprecision(15);
	int n, m, r;
	cin >> n >> m >> r;
	vector<vector<edge>> g(n);
	rep(i, m) {
		ll s, t, d;
		scanf("%lld %lld %lld", &s, &t, &d);
		g[s].push_back(edge(t, d));
	}
	vll d(n, INFL);
	d[r] = 0;
	priority_queue<pll, vector<pll>, greater<pll>> que;
	que.push(pll(0, r));
	while(!que.empty()) {
		pll p = que.top();
		que.pop();
		ll cur = p.second;
		if(d[cur] < p.first) continue;	// skip because distance is updated by other path.
		for(auto e: g[p.second]) {
			if(!(d[e.to] > d[cur] + e.d)) continue;
			d[e.to] = d[cur] + e.d;
			que.push(pll(d[cur], e.to));
		}
	}
	rep(i, n) {
		if(d[i] == INFL) printf("INF\n");
		else printf("%lld\n", d[i]);
	}
}



Measured memory_bytes: 19520
#include <bits/stdc++.h>
using namespace std;
//#define cerr if (false) cerr
#define db(x) cerr << #x << "=" << x << endl
#define db2(x, y) cerr << #x << "=" << x << "," << #y << "=" << y << endl
#define db3(x, y, z) cerr << #x << "=" << x << "," << #y << "=" << y << "," << #z << "=" << z << endl
#define dbv(v) cerr << #v << "="; for (auto _x : v) cerr << _x << ", "; cerr << endl
#define dba(a, n) cerr << #a << "="; for (int _i = 0; _i < (n); ++_i) cerr << a[_i] << ", "; cerr << endl
template <typename A, typename B>
ostream& operator<<(ostream& os, const pair<A, B>& x) {
	return os << "(" << x.first << "," << x.second << ")";
}
typedef long long ll;
typedef long double ld;
char G[1005][1005];
int main() {
	int H, W, A, B;
	scanf("%d%d%d%d", &H, &W, &A, &B);
	int x, y;
	for (x = 0; x <= H; ++x)
		for (y = 0; y <= W; ++y) {
			if (x * A + (H - x) * (W - A) == y * B + (W - y) * (H - B)) {
				goto end;
			}
		}
	end:;
	if (x > H) {
		printf("-1\n");
		return 0;
	}
	memset(G, '1', sizeof(G));
	vector<int> colCnt(W), rowCnt(H);
	for (int i = 0; i < W; ++i)
		if (i < y) colCnt[i] = B;
		else colCnt[i] = H - B;
	for (int i = 0; i < H; ++i)
		if (i < x) rowCnt[i] = A;
		else rowCnt[i] = W - A;
	for (int i = 0; i < H; ++i)
		for (int j = 0; j < W; ++j) {
			if (!colCnt[j]) continue;
			if (!rowCnt[i]) continue;
			G[i][j] = '0';
			--colCnt[j];
			--rowCnt[i];
		}
	for (int i = 0; i < H; ++i) {
		G[i][W] = '\0';
		printf("%s\n", G[i]);
	}
}


Measured memory_bytes: 2176
#include<string>
#include<vector>
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<functional>
#include<algorithm>
#include<stack>
#include<queue>
#include<deque>
#include<set>
#include<map>
#include<utility>
#include<cmath>
#include<ctime>
#include<complex>

using namespace std;

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

char lab[11][7];
string s;

void f(int i,int j){

	if(i==1 && j==1) return;
	else{

		string a="URDLURDLUR";
		int dx[]={0 ,-1,0,1, 0,-1,0};
	    int dy[]={-1, 0,0,0,-1, 0,0};

        rep(k,4){
		if(s[s.size()-1]==a[k]){

		if(lab[i+dx[k]][j+dy[k]]-'0'==1){
			s+=a[k+3];
			if(dx[k]==0 && dy[k]==0) f(i,j+1);  else f(i+2*dx[k],j+dy[k]);
		}
		else if(lab[i+dx[k+1]][j+dy[k+1]]-'0'==1){
			s+=a[k+4];
			if(dx[k+1]==0 && dy[k+1]==0) f(i,j+1);  else f(i+2*dx[k+1],j+dy[k+1]);
		}
		else if(lab[i+dx[k+2]][j+dy[k+2]]-'0'==1){
			s+=a[k+5];
			if(dx[k+2]==0 && dy[k+2]==0) f(i,j+1);  else f(i+2*dx[k+2],j+dy[k+2]);
		}
		else if(lab[i+dx[k+3]][j+dy[k+3]]-'0'==1){
			s+=a[k+6];
			if(dx[k+3]==0 && dy[k+3]==0) f(i,j+1);  else f(i+2*dx[k+3],j+dy[k+3]);
		}
		break;
		}
		}

	}

}

int main(){

	REP(i,1,9){
	if(i%2==1)
	REP(j,1,4) cin >> lab[i][j];
	else
	REP(k,1,5) cin >> lab[i][k];
	}

    s+='R';

   f(1,2);

   cout << s << endl;

   return 0;
}

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



int sc1() {int x; scanf("%d", &x); return x;}

long long sc2() {long long x; scanf("%lld", &x); return x;}

#define  gcd(a,b)         __gcd(a,b)
#define  lcm(a,b)         (a*b)/gcd(a,b)
#define  Int              sc1()
#define  LL               sc2()
#define  For(n)           for(int i=0;i<n;i++)
#define  Forj(n)          for(int j=0;j<n;j++)
#define  Fork(n)          for(int k=0;k<n;k++)
#define  For1(n)          for(int i=1;i<=n;i++)
#define  ll               long long
#define  vi               std::vector<int>
#define  vll              std::vector<ll>
#define  qui              qu
#define  pb               push_back
#define  mpsi             std::map<string, int>



ll dp[101][100001];





int main()
{
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	int n = Int, cap = Int;

	ll wi[n + 1], val[n + 1];

	For1(n) wi[i] = LL, val[i] = LL;

	for (int i = 1; i <= n; i++)
	{
		for (int j = 1; j <= cap; j++)
		{
			ll z=-1;
			if(j-wi[i]>=0) z=dp[i-1][j-wi[i]]+val[i];
			
			dp[i][j]=max(dp[i-1][j],z);
		}
	}

	cout<<dp[n][cap]<<endl;



	return 0;
}




Measured memory_bytes: 78336
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct LazySegTree{
    int n; vector<int> dat,lazy;
    //初期化
    LazySegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<int>(2*n-1,0);
        lazy=vector<int>(2*n-1,0);
    }

    void setLazy(int k, int v){
        lazy[k] = v;
        dat[k] = v;
    }

    void push(int k, int l, int r){
        if(lazy[k]!=0){
            setLazy(2*k+1,lazy[k]);
            setLazy(2*k+2,lazy[k]);
        }
        lazy[k]=0;
    }

    void fix(int k, int l, int r){
        dat[k] = dat[2*k+1]&dat[2*k+2];
    }

    ll merge(ll x, ll y){
        return x&y;
    }

    //内部的に投げられるクエリ
    void _update(int a, int b, ll x, int k, int l, int r){
        if(r<=a || b<=l) return;
        if(a<=l && r<=b){
            setLazy(k,x);
            return;
        }

        push(k,l,r);
        _update(a,b,x,2*k+1,l,(l+r)/2);
        _update(a,b,x,2*k+2,(l+r)/2,r);

        fix(k,l,r);
    }
    //[a,b)をxに更新
    void update(int a, int b, ll x){
        return _update(a,b,x,0,0,n);
    }

    //内部的に投げられるクエリ
    int _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return 1;
        if(a<=l && r<=b) return dat[k];

        push(k,l,r);
        int vl=_query(a,b,2*k+1,l,(l+r)/2);
        int vr=_query(a,b,2*k+2,(l+r)/2,r);
        return merge(vl,vr);
    }
    //[a,b)
    ll query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

const int N = 200000;
vector<int> C[N],Q[N];

int main(){
    int n,m,q;
    scanf(" %d %d %d", &n, &m, &q);

    vector<int> d(m),a(m),b(m);
    rep(i,m) scanf(" %d %d %d", &d[i], &a[i], &b[i]);

    vector<int> e(q),s(q),t(q);
    rep(i,q) scanf(" %d %d %d", &e[i], &s[i], &t[i]);

    vector<int> v;
    rep(i,m) v.pb(d[i]);
    rep(i,q) v.pb(e[i]);
    sort(all(v));
    v.erase(unique(all(v)), v.end());
    int V = v.size();

    rep(i,m){
        int idx = lower_bound(all(v), d[i])-v.begin();
        C[idx].pb(i);
    }
    rep(i,q){
        int idx = lower_bound(all(v), e[i])-v.begin();
        Q[idx].pb(i);
    }

    LazySegTree st(n+1);
    vector<bool> ans(q);
    rep(i,V){
        for(int &ID:Q[i]) ans[ID] = st.query(s[ID], t[ID]);
        for(int &ID:C[i]) st.update(a[ID], b[ID], 1);
    }
    rep(i,q) printf("%s\n", (ans[i]?"Yes":"No"));
    return 0;
}



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

typedef long long ll;

const ll INF = 1LL << 60; 

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

    int n; cin >> n;
    vector<ll> x(n),l(n);
    vector<pair<ll,ll>> p(n);
    for(int i=0;i<n;i++){
        cin >> x[i] >> l[i];
        p[i] = make_pair(x[i]+l[i],x[i]-l[i]);
    }
    sort(p.begin(),p.end());
    int ans=0;
    ll uku = -INF;
    for(int i=0;i<n;i++){
        if(uku <= p[i].second){
            ans++;
            uku = p[i].first;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3456
#include<iostream>
using namespace std;
int main()
{
  string s;
  cin >> s;
  if(s[0] == 'A')
    cout << 'T';
  else if(s[0] == 'T')
    cout << 'A';
  else if(s[0] == 'G')
    cout << 'C';
  else if(s[0] == 'C')
    cout << 'G';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <complex>
using namespace std;

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

#ifndef typeof
#define typeof __typeof__
#endif // typeof

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for(typeof((c).begin()) i = (c).begin(); i != (c).end(); i++)
#define rtr(c, i) for(typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); i++)
#define repby(i, a, b, step) for(typeof(b) i = (a); i < (b); i += (step))
#define repab(i, a, b) repby(i, (a), (b), 1)
#define rep(i, n) repab(i, 0, (n))
#define pb push_back
#define sz(c) int((c).size())


int main(int argc, char **argv)
{

  int n;

  while (cin >> n) {
    int debt = 100000;
    while (n--) {
      int interest = debt / 100 * 5;
      if (interest%1000)
        interest = (interest / 1000 + 1) * 1000;
      debt = debt + interest;
    }
    cout << debt << endl;
  }

  return 0;
}

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

int main() {
    int n;
    cin >> n;
    vector<int> ans(n - 1, 1);

    for (int c = 1; c < n; c++) {
        int ab;
        ab = n - c;
        for (int i = 2; i <= sqrt(ab); i++) {
            int cnt = 0;
            while (ab % i == 0) {
                cnt++;
                ab /= i;
            }
            ans[c-1] *= (cnt + 1);
            if (ab == 1) break;
        }
        if (ab != 1) ans[c-1] *= 2;
    }
    int answer = 0;
    for (int i = 0; i < n - 1; i++) {
        answer += ans[i];
    }
    cout << answer;
    return 0;
}

Measured memory_bytes: 7216
h,w,m = map(int,input().split())
row = [0]*(h+1)
col = [0]*(w+1)
bombs = set([])
for i in range(m):
  a,b = map(int,input().split())
  row[a] += 1
  col[b] += 1
  bombs.add((a,b))
r,c = max(row),max(col)
rcnt,ccnt = 0,0
for v in row:
  if v==r:
    rcnt += 1
for v in col:
  if v==c:
    ccnt += 1
doubled = 0
for i,j in bombs:
  if row[i]==r and col[j]==c:
    doubled += 1
if doubled==rcnt*ccnt:
  print(r+c-1)
else:
  print(r+c)

Measured memory_bytes: 133936
#include <complex>
#include <cmath>
#include <iostream>
using namespace std;
typedef complex<double> xy_t;

xy_t P[110];

double cross_product(xy_t a, xy_t b) { return (conj(a)*b).imag(); }

int main() {
  int N = 0;
  double x, y;
  cin >> N;
  for (int i=0; i<N; i++) {
    cin >> x >> y;
    P[i] = xy_t(x, y);
  }

  double sum = 0.0;
  for (int i=0; i+2<N; i++) {
    xy_t a = P[0], b = P[i+1], c = P[i+2];
    sum += cross_product(b-a, c-a)/2;
  }

  printf("%.1f\n", abs(sum));
}


Measured memory_bytes: 3280
import java.util.Scanner;

//Petting Cats
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		int T = sc.nextInt();
		while(T--!=0){
			int x1 = sc.nextInt(), y1 = sc.nextInt(), x2 = x1+sc.nextInt(), y2 = y1+sc.nextInt(), n = sc.nextInt(), res = 0;
			while(n--!=0){
				int x = sc.nextInt(),  y = sc.nextInt();
				if(x1<=x&&x<=x2&&y1<=y&&y<=y2)res++;
			}
			System.out.println(res);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

Measured memory_bytes: 12000
use std::io::Read;

fn main() {
    let mut buf = String::new();
    std::io::stdin().read_to_string(&mut buf).unwrap();

    let answer = solve(&buf);

    println!("{}", answer);
}

fn solve(input: &str) -> String {
    let mut iterator = input.split_whitespace();

    let mut x: usize = iterator.next().unwrap().parse().unwrap();
    let mut y: usize = iterator.next().unwrap().parse().unwrap();
    if (x + y) % 3 != 0 {
        return "0".to_string();
    }
    if x > y {
        let temp = x;
        x = y;
        y = temp;
    }

    if 2 * x < y {
        return "0".to_string();
    }

    let n: usize = (2 * y - x) / 3;
    let m: usize = (2 * x - y) / 3;

    let mc: ModComb = ModComb::init(n + m + 1);
    let ans = mc.calc(n + m, n);

    return ans.to_string();
}

const MOD: usize = 1_000_000_007;

struct ModComb {
    fac: Vec<usize>,
    finv: Vec<usize>,
    inv: Vec<usize>,
}

impl ModComb {
    fn init(max: usize) -> ModComb {
        let mut fac = vec![1; max];
        let mut finv = vec![1; max];
        let mut inv = vec![1; max];
        for i in 2..max {
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
        return ModComb {
            fac: fac,
            finv: finv,
            inv: inv,
        }
    }

    fn calc(&self, n: usize, k: usize) -> usize {
        if n < k {
            return 0;
        }
        return self.fac[n] * (self.finv[k] * self.finv[n - k] % MOD) % MOD;
    }
}


Measured memory_bytes: 22780
k,n=map(int,input().split())
a=list(map(int,input().split()))
ans=[0]*n
for i in range(n):
  if i!=n-1:
    ans[i]=a[i+1]-a[i]
  else:
    ans[i]=a[0]+k-a[n-1]
print(k-max(ans))

Measured memory_bytes: 26548
n = int(input())
A = list(map(int, input().split()))
x = max(A)
A.pop(A.index(max(A)))
ans = A[0]
ABS = abs(x//2-A[0])
for a in A[1:]:
    if ABS > abs(x//2-a):
        ans = a
        ABS = abs(x//2-a)
print(x,ans)

Measured memory_bytes: 14428
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    ll N,D; cin >> N >> D;
    int ans = 0;
    REP(i,N) {
        ll x,y;
        cin >> x >> y;
        if(x*x + y*y <= D*D) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3528
#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)
#define ALL(a)  (a).begin(),(a).end()
#define SUM(a)  accumulate((a).begin(),(a).end(),0)
#define SORT(a) sort(ALL(a))
#define REV(a) reverse(ALL(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
typedef long long ll;
const int INF = 999999999;
const int MOD = (int)1e9 + 7;
const int EPS = 1e-9;

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  int d;
  set<int> st;
  cin >> n;
  REP(i,n){
      cin >> d;
      st.insert(d);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 256
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <time.h>
#include <functional>

//#include "All.h"

using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

int gcd(int a, int b) {
    if (a < b) swap(a, b);
    if (b == 0) return a;
    return gcd(b, a % b);
}

ll beki(ll a, ll b) {
    ll tmp = 1;
    REP(i, b) tmp *= a;
    return tmp;
}

ll A, B, N;

int main() {
    cin >> A >> B >> N;
    ll x = min(B - 1, N);
    cout << A * x / B << endl;
}

Measured memory_bytes: 3632
#include<iostream>
#include<string>
#include<vector>
#include<stdio.h>
#include<algorithm>
#include<math.h>
#include<numeric>
#include<iomanip>
#include<deque>
#include<tuple>
#include<queue>
#include<map>
#include <cstdint>
#include<unordered_map>
#include <boost/multiprecision/cpp_int.hpp>


#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define vi vector<int>
#define all(x) (x).begin(),(x).end()
#define Endl endl
#define F first
#define S second

namespace mp = boost::multiprecision;

using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;


int main() {
	int A, B, C, D, E, F;
	cin >> A >> B >> C >> D >> E >> F;
	double concentration = 0;
	int water = 0;
	int sugar = 0;
	rep(i, 101) {
		rep(j, 101) {
			rep(k, 101) {
				rep(m, 101) {
				
					int tmpwater = 100* A*i + 100 * B*j;
					int tmpsugar = C * k + D * m;
					double maxsugar = tmpwater * E / 100.0;
					if (tmpsugar + tmpwater <= F
						&&tmpsugar+tmpwater!=0
						&&tmpsugar<=maxsugar) {
						double tmp =
							100.0 * tmpsugar / (tmpsugar+tmpwater);
						if (concentration<tmp) {
							concentration = tmp;
							water = tmpwater;
							sugar = tmpsugar;
						}

					}
				}
			}
		}
	}
	if (water == 0) {
		water = 100*A;
	}
	cout << water+sugar << " " << sugar;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>
#include <bitset>
#include <sstream>

typedef  long long ll;
#define mop 1000000007
using namespace std;

int main() {
   
    set <ll> table;
    for (ll i=0;i<=150;i++){
        table.insert(i*i);
    }
    vector < vector <ll> > v;
    ll n,d;
    cin >> n >> d;
    for (ll i=0;i<n;i++){
        vector <ll> tmp;
        for (ll j=0;j<d;j++){
            ll x;
            cin >> x;
            tmp.push_back(x);
        }
        v.push_back(tmp);
    }
    ll ans = 0;
    for(ll i=0;i<n;i++){
        for (ll j=i+1;j<n;j++){
            ll judge = 0;
            for (ll k=0;k<d;k++){
                judge += (v[i][k] - v[j][k])*(v[i][k] - v[j][k]);
            }
            if(table.find(judge) != table.end()){
                ans++;
            }
        }
    }
    cout << ans << endl;

}

Measured memory_bytes: 256
#include <iostream>

#define MAX_N 100

int N;
unsigned long int A, res=1000000000;

int main() {
    std::cin >> N;
    for (int i=0; i<N; i++) {
        std::cin >> A;
        unsigned long int tmp=0;
        while (A%2 != 1) {
            ++tmp;
            A = A/2;
        }
        res = std::min(res, tmp);
    }

    std::cout << res << std::endl;
    return 0;
}


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

#define int int64_t
#define rep(i,a,n) for(int i=(a); i<(n); ++i)
#define gsort(x,n) sort((x),(x)+(n),greater<int>())
#define all(x) (x).begin(), (x).end()
#define re(s) reverse((s).begin(),(s).end())
#define ll long long
#define setout(n,x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10)
const int INF = 0x3f3f3f3f;
const int LINF = 0x3f3f3f3f3f3f3fLL;
const int mod = 1000000007;
using namespace std;

int x[510][510];
signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n,m,q;
    cin>>n>>m>>q;
    int l,r;

    rep(i,0,m){
        cin>>l>>r;
        rep(j,r,501) ++x[l][j];
    }

    rep(i,0,q){
        int ans = 0;
        cin>>l>>r;
        
        rep(j,l,r+1){
            ans += x[j][r] - x[j][l-1];
        }
        cout<<ans<<'\n';
    }
    return 0;
}

Measured memory_bytes: 2944
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <cassert>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
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;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;

int main(void){
    int k;
    int n;
    int r = 0;
   cin >> n >> k;

    int l, i=0, a[n];
   while(cin>>l){
        a[i] = l;
        i++;
    }
    
    std::sort(a, a + n);
    rep (i, k) {
        r += a[i];
    }

    cout << r;
}

Measured memory_bytes: 3620
#include <bits/stdc++.h>
#include<math.h>
#include<algorithm> 
#define rep(i,n) for (int i = 0; i < (n) ; ++i)
using namespace std;
using ll = long long ;
using P = pair<int, int> ;
#define PI 3.14159265358979323846264338327950
#define INF 1e18
#define chmax(x, y) x = max(x, y) 
int main(){
    int h, w, m ;
    cin >> h >> w >> m ;
    vector<int> mh (h) ; 
    vector<int> mw (w) ;
    set<P> s ; 
    rep(i, m){
        int a, b ;
        cin >> a >> b ;
        a-- ; b-- ;
        mh[a]++ ;
        mw[b]++ ;
        s.insert(P(a, b)) ;
    }
    int mxh = 0 ;
    int mxw = 0 ;
    rep(i, h) if(mxh < mh[i]) mxh = mh[i] ;
    rep(i, w) if(mxw < mw[i]) mxw = mw[i] ;
    vector<int> mmh ;
    vector<int> mmw ;
    rep(i, h) if(mxh == mh[i]) mmh.push_back(i) ;
    rep(i, w) if(mxw == mw[i]) mmw.push_back(i) ;
    int sh = mmh.size() ;
    int sw = mmw.size() ;
    rep(i, sh){
        rep(j, sw){
            int nx = mmh[i] ;
            int ny = mmw[j] ;
            P np = P(nx, ny) ;
            if(!s.count(np)){
                cout << mxh + mxw << endl ;
                return 0 ;
            }
        }
    }
    cout << mxh + mxw - 1 << endl ;

}

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

unordered_set<int> primer;

bool divisor(int n){
  for(int i = 2; i * i <= n; i++){
    if(n % i == 0){
      if(primer.count(i)) return false;
      else primer.insert(i);
    }
    while(n % i == 0){
      n /= i;
    }
  }
  if(n != 1){
    if(primer.count(n)) return false;
    else primer.insert(n);
  }
  return true;
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout << setprecision(20) << fixed;
  long long N;
  cin >> N;
  bool setwise = false, pairwise = false;
  vector<int> A(N);
  bool allone = true;

  for(int i = 0; i < N; i++){
    cin >> A[i];
    if(A[i] != 1){
      allone = false;
    }
  }
  //gcd of all
  int Gcd = A[0];
  for(int i = 1; i < N; i++){
    Gcd = __gcd(A[i], Gcd);
  }
  if(Gcd == 1){
    setwise = true;
  }

  int i = 0;
  while(i < N && divisor(A[i])){
    i++;
  }
  if(i == N){
    pairwise = true;
  }
  if(allone){
    cout << "pairwise coprime" <<endl;
    return 0;
  }
  if(pairwise) cout << "pairwise coprime" <<endl;
  else if(setwise) cout << "setwise coprime" <<endl;
  else cout << "not coprime"<<endl;
}



Measured memory_bytes: 7140
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <map>
#include <utility>
#include <algorithm>
using namespace std;

int main(void){
    
    int n;
    cin>>n;
    
    int sum=0;
    
    for(int i=1; i<=n; i+=2){
        int cnt=0;
        
        for(int j=1; j<=i; j++){
            if(i%j==0){
                cnt++;
            }
            
            if(cnt>8){
                break;
            }
        }
        
        if(cnt==8){
            sum++;
        }
        
    }
    
    cout<<sum<<endl;
}


Measured memory_bytes: 256
N, L, *A = map(int, open(0).read().split())

k = -1
for i in range(N - 1):
    if A[i] + A[i + 1] >= L:
        k = i + 1
        break

if k == -1:
    print("Impossible")
else:
    print("Possible")
    for j in range(1, k):
        print(j)
    for j in reversed(range(k + 1, N)):
        print(j)
    print(k)

Measured memory_bytes: 14092