akhauriyash/Code-Regression huggingface dataset:
# import copy
N, M, Q = [eval(v) for v in input().strip().split(" ")]

a_list, b_list, c_list, d_list = [], [], [], []

for k in range(Q):
    a, b, c, d = [eval(v) for v in input().strip().split(" ")]
    a_list.append(a)
    b_list.append(b)
    c_list.append(c)
    d_list.append(d)

max_value = 0

def calc_score(complete_A):
    score = 0
    for i in range(Q):
        if complete_A[b_list[i]] - complete_A[a_list[i]] == c_list[i]:
            score += d_list[i]
    return score

def search(A, M, depth, a_list, b_list, c_list, d_list, max_value, count):
    # print("%s: %s" % (depth, A))
    # count += 1
    # if count > 20:
    #     exit(0)
    if depth > 0:
        last_A = A[-1]
        for k in range(last_A, M + 1):
            # next_A = copy.deepcopy(A)
            # next_A.append(k)
            next_A = A + [k]
            max_value = search(next_A, M, depth - 1, a_list, b_list, c_list, d_list, max_value, count)
    else:
        value = calc_score(A[1:])
        if value > max_value:
            max_value = value
    return max_value

count = 0
A = [1]
print(search(A, M, N + 1, a_list, b_list, c_list, d_list, max_value, count))

Measured memory_bytes: 9220
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long int ll;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    int x; cin >> x;
    for(int i=x;i>=1;i--){
        for(int j=2;j<=x;j++){
            for(int k=2;k<=10;k++){
                if(pow(j,k)==i){
                    cout << i << endl;
                    return 0;
                }
            }
        }
    }
    cout << 1 << endl;
}


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

using namespace std;

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
#define ll long long int
#define mod 1000000007
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define prec(n) fixed << setprecision(n)
#define maxpq priority_queue<int>
#define minpq priority_queue<int, vector<int>, greater<int>>
#define PI 3.1415926535897932384626
#define INF 1000000000
#define bits(n) __builtin_popcount(n)


void solve()
{
    ll n;
    cin>>n;
    ll a[n];
    for(int i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll pref[n];
    pref[0]=a[0];
    for(int i=1;i<n;i++)
    {
        pref[i]=pref[i-1]+a[i];
    }
    ll res=0;
    for(int i=0;i<n-1;i++)
    {
        res=(res+((a[i]%mod)*((pref[n-1]-pref[i])%mod))%mod)%mod;
    }
    cout<<res;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input1.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output1.txt", "w", stdout);
#endif

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}


Measured memory_bytes: 6684
#include <bits/stdc++.h>
#define BIT(n) (1LL << (n))
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPB(i, n) for (int i = 0; i < BIT(n); i++)
#define REPS(i, x) for (int i = 1; i <= (int)(x); i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define FORA(i, n) for (auto &&i : n)
#define FORS(i, m, n) for (int i = m; i <= n; i++)
#define DEBUG(x) cerr << #x << ": " << x << "\n"
#define PRINTALL(V)                                                            \
  for (auto v : (V)) {                                                         \
    cerr << v << " ";                                                          \
  }                                                                            \
  cerr << "\n";
#define ALL(v) v.begin(), v.end()
#define fst first
#define snd second
#define mp make_pair
#define pb push_back
#define epb emplace_back
#define int long long
using namespace std;
template < class T > bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template < class T > using vec = std::vector< T >;
template < class T > void print(const T &x) { cout << x << "\n"; }
const int MOD = 1000000007, INF = 1061109567, INF2 = INF * INF;
const double EPS = 1e-10, PI = acos(-1.0);
const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
struct edge {
  int from, to, cost;
};
int N, M;
vec< vec< int > > G, Grev;
vec< edge > E;
vec< int > d;
vec< bool > visited[3];
void dfs(int id, int type) {
  visited[type][id] = true;
  FORA(e, type == 0 ? G[id] : Grev[id]) {
    if (!visited[type][e])
      dfs(e, type);
  }
}
signed main() {
  cin.tie(0), ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  cin >> N >> M;
  G.resize(N, vec< int >());
  Grev.resize(N, vec< int >());
  REP(i, M) {
    int p, q, r;
    cin >> p >> q >> r;
    p--, q--;
    //   r *= -1;
    G[p].pb(q);
    Grev[q].pb(p);
    edge Eele = {p, q, r};
    E.pb(Eele);
  }
  d.resize(N, -INF2);
  d[0] = 0;
  //到達判定を忘れていた。退化している。
  visited[0].assign(N, false);
  dfs(0, 0);
  visited[1].assign(N, false);
  dfs(N - 1, 1);
  visited[2].assign(N, false);
  REP(i, N) { visited[2][i] = visited[0][i] && visited[1][i]; }
  // PRINTALL(visited[2]);
  REP(i, 2 * N) {
    FORA(e, E) {
      bool flg = chmax(d[e.to], d[e.from] + e.cost);
      if (flg && i >= N - 1) {
        //        print("inf");
        d[e.to] = INF2;
        // return 0;
      }
    }
  }
  if (d[N - 1] == INF2) {
    print("inf");
  } else {
    print(d[N - 1]);
  }
}

/*
http://drken1215.hatenablog.com/entry/2019/02/16/075900
負閉路検出用の配列を用意しておいて、N
回目の更新で更新された箇所にフラグを立てて、そこから到達できるところすべてにフラグを立てることで、負閉路による影響を受けるところをすべて求めることができる
(editorial)

N 回目の更新で更新された箇所に -INF を入れておいて、さらに追加で N 回伝播する
(わかりやすい)

到達用配列を用意して、1から到達できる点の集合とNから到達できる点の集合の積集合を取る。
*/

Measured memory_bytes: 512
#include <algorithm>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <map>
#include <memory>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iomanip>
using namespace std;

typedef long long ll;

#define sz size()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(c) (c).begin(), (c).end()
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define per(i,a,b) for(ll i=(b-1);i>=(a);--i)
#define clr(a, b) memset((a), (b) ,sizeof(a))
#define ctos(c) string(1,c)
#define print(x) cout<<#x<<" = "<<x<<endl;

#define MOD 1000000007

int main(void) {
  ll a,b;
  cin>>a>>b;
  if(a+b==15){
    cout << "+" << endl;
    return 0;
  }
  if(a*b==15){
    cout << "*" << endl;
    return 0;
  }
  cout << "x" << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#define PI 3.14159265359
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pai;
typedef pair<ll, ll> pal;
const int MOD = 1e9+7;
const ll LLINF = 1e18;


int main(){
	int n;
	cin >> n;
	vector<int> d(n);
	for (int i = 0; i < n; i++) cin >> d[i];
	sort(d.begin(), d.end());
	d.erase(unique(d.begin(), d.end()), d.end());
	cout << d.size() << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;

int euler(int num){

	 int ret = num;

	 for(int i = 2; i*i <= num;  i++){
			if(num%i == 0) {
				  ret  = ret/i*(i-1);
				  while(num%i == 0)num /= i;
			}
	  }
	  if(num != 1) ret = ret/num*(num-1);
	  return ret;
}

int main(){

	ll* table = new ll[1000001];
	ll* num_tagaini_so = new ll[1000001];

	for(int i = 2; i <= 1000000; i++){
		num_tagaini_so[i] = euler(i);
	}

	table[1] = 2;

	for(int i = 2; i <= 1000000; i++){
		table[i] = table[i-1] + num_tagaini_so[i];
	}

	int Q;
	scanf("%d",&Q);

	int tmp;

	for(int loop = 0; loop < Q; loop++){
		scanf("%d",&tmp);
		printf("%lld\n",table[tmp]);
	}

	return 0;
}

Measured memory_bytes: 18776
#include <iostream>
#include <cmath>

using namespace std;

int main() {
	int n, k;
	cin >> n >> k;
	for (int i = 0; i < n; i++) {
		int temp;
		cin >> temp;
	}
	cout << int(ceil(double(n - 1) / double(k - 1))) << endl;
	return 0;
}



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

typedef pair<int,int> P;
const int INF=100000000;

int ans=0,H,W,N,sx,sy,ssx,ssy;
char cheese[]={'0','1','2','3','4','5','6','7','8','9'},town[1000][1000];
int dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
int d[1000][1000];

void bfs(){
  queue<P> que;
  sx=ssx; sy=ssy;
  for(int c=1;c<=N;c++){
    //??¬???1???cheese??????????????¢?´¢
    for(int i=0;i<H;i++)
      for(int j=0;j<W;j++) d[i][j]=INF;

    que.push(P(sx,sy));
    d[sx][sy]=0;

    while(que.size()){
      P p=que.front(); que.pop();
      if(town[p.first][p.second]==cheese[c]) {
        sx=p.first; sy=p.second;
        ans+=d[p.first][p.second];
        break;
      }
      for(int i=0;i<4;i++){
        int nx=p.first+dx[i],ny=p.second+dy[i];
        if(0<=nx && nx<H && 0<=ny && ny<W && town[nx][ny]!='X' && d[nx][ny]==INF){
          que.push(P(nx,ny));
          d[nx][ny]=d[p.first][p.second]+1;
        }
      }
    }
    while(!que.empty()) que.pop();

  }

  return ;
}

int main(){
  scanf("%d %d %d",&H,&W,&N);
  for(int i=0;i<H;i++) scanf("%s",&town[i]);

  for(int i=0;i<H;i++){
    for(int j=0;j<W;j++){
      if(town[i][j]=='S'){
        ssx=i; ssy=j;
        goto OUT;
      }
    }
  }
  OUT:

  bfs();

  printf("%d\n",ans);

  return 0;
}

Measured memory_bytes: 6092
N, = map(int, input().split())
G = [set() for _ in range(N+1)]
for i in range(N-1):
    A, B = map(int, input().split())
    G[A].add(B)
    G[B].add(A)

path = []
stack = [1]
vs = set()
while stack:
    v = stack.pop()
    if v > 0:
        vs.add(v)
        path.append(v)
        for u in G[v]:
            if u in vs:
                continue
            if u == N:
                stack = []
                path.append(u)
                break
            stack += [-v, u]
    else:
        path.pop()

x = path[-(-len(path)//2)]

stack = [1]
vs = set()
while stack:
    v = stack.pop()
    vs.add(v)
    for u in G[v]:
        if u in vs:
            continue
        if u == x:
            continue
        stack.append(u)
x = len(vs)-1
y = N - 2 - x
if x>y:
    print("Fennec")
else:
    print("Snuke")


Measured memory_bytes: 82080
N = int(input())
info =[list(map(int, input().split())) for _ in range(N)]
info.sort(key=lambda x: x[2], reverse=True)

for cx in range(101):
    for cy in range(101):
        candidate_h = info[0][2] + abs(info[0][0] - cx) + abs(info[0][1] - cy)
        for i in range(1, N):
            x, y, h = info[i]
            if max(candidate_h - abs(x - cx) - abs(y - cy), 0) != h:
                break
        else:
            print("{} {} {}".format(cx, cy, candidate_h))
            exit()


Measured memory_bytes: 3064
#pragma target("avx")
#include<bits/stdc++.h>
using ll = int_fast64_t;
using P = std::pair<ll,ll>;
using V = std::vector<ll>;
template<typename T> using pq = std::priority_queue<T>;
template<typename T> using rpq = std::priority_queue<T, std::vector<T>, std::greater<T>>;

#define rep(i,b,e) for(ll i=b; i<e; i++)
#define be(vec) vec.begin(),vec.end()
#define print(vec) printf("[ ");for(auto &i:vec)printf("%ld ",i);puts("]");
#define scan(vec) for(auto &i:vec)scanf("%ld",&i)
#define fi first
#define se second

const int MOD = 1e9+7;
const ll INF = 1e18;
int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int main(){
	int n, m;
	scanf("%d %d", &n, &m);
	V a(n, 1), red(n, 0);
	red[0] = 1;
	rep(i, 0, m){
		int x, y;
		scanf("%d %d", &x, &y);
		a[x-1]--;
		a[y-1]++;
		if(red[x-1]) red[y-1] = 1;
		if(a[x-1]==0) red[x-1] = 0;
	}
	ll ans = 0;
	for(ll i: red) ans += i;
	printf("%ld\n", ans);
	return 0;
}


Measured memory_bytes: 1792
import bisect
n = int(input())
li = sorted(list(map(int, input().split())))
ans = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        ans += bisect.bisect_left(li, li[i] + li[j]) - j - 1
print(ans)

Measured memory_bytes: 3188
#include <iostream>
#include <array>
#include <string>
using namespace std;
using Int = int64_t;
static const Int MOD = 1e9 + 7;
int main() {
    Int N, ans = 1;
    string S;
    cin >> N >> S;
    array<Int, 26> cnt {};
    for (char c : S) cnt[c - 'a']++;
    for (auto i : cnt) ans = (ans * (i + 1)) % MOD;
    cout << ans - 1<< endl;
}


Measured memory_bytes: 512
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long int


int main(){
    ll n,w;
    cin>>n>>w;
    ll value[n];
    ll weight[n];
    for(int i=0;i<n;i++){
        cin>>weight[i];
        cin>>value[i];
    }
    ll dp[n][w+1] = {0};
    for(ll i=0;i<n;i++){
        dp[i][0] = 0;
    }
    for(ll i=0;i<n;i++){
        for(ll j=1;j<=w;j++){
            if(i == 0){
                if(weight[i] > j){
                    dp[i][j] = 0;
                }else{
                    dp[i][j] = value[i];
                }
                continue;
            }
            if(j - weight[i] >= 0){
                dp[i][j] = max(dp[i-1][j],value[i] + dp[i-1][j - weight[i]]);
            }else{
                dp[i][j] = dp[i-1][j];
            }
        }
    }
    cout<<dp[n-1][w]<<endl;
    return 0;
}

Measured memory_bytes: 81640
#include <iostream>
#define _USE_MATH_DEFINES
#include <cmath> 

int main(int argc, const char * argv[]) {
    double r;
    std::cin >> r;
    double s = M_PI * r * r;
    double l = 2.0 * M_PI * r;
    std::cout << std::fixed << s << " " << l << " " << std::endl;
    return 0;
}

Measured memory_bytes: 3276
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }

#define X real()
#define Y imag()

using namespace std;
using namespace __gnu_pbds;

template<class T> using ordered_set = tree<T,null_type,less<T>,rb_tree_tag,tree_order_statistics_node_update>;
using ll  = long long;

using point = complex<double>;


void err(istream_iterator<string> it) {cerr << endl;}
template<typename T, typename... Args>void err(istream_iterator<string> it, T a, Args... args) {cerr << *it << " = " << a << endl;err(++it, args...);}

const int N = 1e5 + 50;
const double EPS = 1e-8;
const long long mod = 1e9 + 7;

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



int dp[N],h[N] , k;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int n ;
    cin >> n >> k;
    for(int i = 0; i < n; ++i)
            cin >> h[i],dp[i] = 2e9;
    // state : pos
    // trans : dp[pos] = min(dp[pos - 1] , dp[pos - 2] )
    // base  : dp[0] = 0 , dp[1] = abs(h[1]-h[0]);

    dp[0] = 0;
    dp[1] = abs(h[1]-h[0]);
    for(int pos = 2; pos < n; ++pos){
        for(int j = 1; j <= min(k,pos); ++j){
            dp[pos] = min(dp[pos] , dp[pos - j] + abs(h[pos] - h[pos - j]));
        }
    }

    cout << dp[n - 1] << '\n';
    return 0;
}


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

#define ll long long

ll read(){
    char c= getchar(); ll f = 1, ret = 0;
    for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
    for(; isdigit(c); c = getchar()) ret = ret*10 + c - '0';
    return ret*f;
}
void write(ll x) {
    if(x < 0) putchar('-'), x = -x;
    if(x > 9) write(x / 10);
    putchar(x%10 + '0');
}
#define nl puts("")
#define bs putchar(' ')
const int maxn = 305;
char s[maxn][maxn];
int a[maxn][maxn];
int h, w, k, ord;
signed main(){
    h = read(), w = read(), k =  read();
    for(int i = 1; i <= h; i++) scanf("%s", s[i] + 1);
    for(int i = 1; i <= h; i++) {
        int tmp = 0;
        for(int j = 1; j <= w; j++) {
            if(s[i][j]=='#') {
                ord++;
                tmp = ord;
            }
            a[i][j] = tmp;
        }
        tmp = 0;
        for(int j = w; j >= 1; j--) {
            if(a[i][j] == 0) a[i][j] = a[i][j+1];
        }
    }
    for(int j = 1; j <= w; j++) {
        for(int i = 2; i <= h; i++) {
            if(a[i][j] == 0) a[i][j] = a[i-1][j];
        }
        for(int i = h; i >= 1; i--) {
            if(a[i][j] == 0) a[i][j] = a[i+1][j];
        }
    }
    for(int i = 1; i <= h; i++) {
        for(int j = 1; j <= w; j++) {
            write(a[i][j]), bs;
        }
        nl;
    }
    return 0;
}

Measured memory_bytes: 1152
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void _main()
{
    array<string, 3> s;
    rep(i, 0, 3) cin >> s[i];
    for (const string& i : s)
    {
        cout << i[0];
    }
    cout << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
long long a,b,c;
int x,y;
long long my_max()
{
	if(x>y)
	{
		if(c*2>a)
			return (x-y)*a;
		else
			return (x-y)*c*2;
	}
	else
	{
		if(c*2>b)
			return (y-x)*b;
		else
			return (y-x)*c*2;
	}
}
int main()
{
	long long s=0;
	scanf("%lld %lld %lld %d %d",&a,&b,&c,&x,&y);
	if(a+b>c*2)
		s+=min(x,y)*2*c+my_max();
	else
		s+=x*a+y*b;
	printf("%lld",s);
	return 0;
}

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

int main() {
    ll n,m;
    cin>>n>>m;
    ll sum=0;
    rep(i,m){
        ll a;
        cin>>a;
        sum+=a;
    }
    if(sum>n){
        cout<<-1<<endl;
    }else{
        cout<<n-sum<<endl;
    }
}


Measured memory_bytes: 3596
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//人数の入力
		int N = sc.nextInt();
		//キャンディーの合計
		int sum = 0;
		//何個キャンディーをあげるか
		for(int i = 1; i <= N; i++) {
			sum += i;
		}
		System.out.println(sum);
	}

}


Measured memory_bytes: 22868
#include<iostream>
using namespace std;
long long lcm(long long m, long long n)
{
  long long mm=m,nn=n;
  while (m>0&&n>0){
    n = n % m;
    if (n>0)
      m = m % n;
  }
  if (n==0)
    return mm/m*nn;
  else
    return nn/n*mm;
}
int main()
{
  int n,i;
  long long t,res=1;
  cin >> n;
  for(i=0;i<n;i++){
    cin >> t;
    res=lcm(res,t);
  }
  cout << res << endl;
  return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;

class program{

  static void Main(){
    int N = int.Parse(Console.ReadLine());
    string S= Console.ReadLine();
    char nowColor='!';
    int count=N;
    for(int i=0;i<N;i++){
      if(i!=0){
        if(nowColor==S[i]){
          count--;
        }
      }
      nowColor=S[i];
    }
    Console.WriteLine(count);
  }
}

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


void solve(long long N, std::vector<std::string> s, long long M, std::vector<std::string> t){
    int max = 0;
    int cnt;
    for (int i = 0; i < N; i++) {
        cnt = 0;
        for (int j = 0; j < N; j++) {
            if (s[i] == s[j]) {
                cnt += 1;
            }
        }
        for (int k = 0; k < M; k++) {
            if (s[i] == t[k]) {
                cnt -= 1;
            }
        }
        if (max < cnt) {
            max = cnt;
        }
    }
    cout << max<< endl;
}

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


Measured memory_bytes: 256
#include<stdio.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#define rep(i,N) for(int i=0;i<(int)N;i++)
const char letters[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
char query[129];
static inline int IN(void)
{
  int x=0,f=0,c=getchar();while(c<48||c>57){f^=c==45,c=getchar();}
  while(c>47&&c<58){x=x*10+c-48,c=getchar();}return f?-x:x;
}
static inline int ask(void){printf("? %s\n",query);fflush(stdout);return IN();}
int main(void)
{
  int l=0,len=0,mid=0,r=0,total=0,diff[62];char pw[129];
  rep(i,62){rep(j,128){query[j]=letters[i];}query[128]=0;diff[i]=128-ask();total+=diff[i];}
  rep(i,62)
  {
    if(len==0){len=diff[i];rep(j,diff[i])pw[j]=letters[i];}
    else
    {
      l=0;
      rep(k,diff[i])
      {
        r=len;
        while(l<r)
        {
          mid=(l+r+1)/2;
          rep(j,mid)query[j]=pw[j];
          rep(j,diff[i]-k)query[mid+j]=letters[i];
          query[mid+diff[i]-k]=0;
          if(ask()==total-mid-diff[i]+k)l=mid;else r=mid-1;
        }
        len++;rep(j,len-l){pw[len-j]=pw[len-j-1];}pw[l]=letters[i];
      }
    }
  }
  pw[len]=0;printf("! %s\n",pw);return fflush(stdout),0;
}

Measured memory_bytes: 3784
import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner scan = new Scanner(System.in);

		int a = scan.nextInt();
		int b = scan.nextInt();
		String ans;

		if(a<=0){
			if(b >=0){
				ans = "Zero";
			}else{
				if((a+b)%2==0){
					ans = "Negative";
				}else{
					ans = "Positive";
				}
			}
		}else{
			ans ="Positive";
		}

		System.out.println(ans);

	}

}


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

#define int long long
const int MAXN = 2e3 + 100 ; 
const int MAXH = 4e6 + 100 ; 
const int Mod = 1e9 + 7 ;

int fact[MAXH] ;

void Pre(){
	fact[0] = 1 ; 
	for(int i = 1 ; i < MAXH ; i ++)fact[i] = fact[i - 1] * i % Mod ; 
}
int power(int n , int m = Mod - 2){
	if(! m)return  1 ; 
	if(m % 2)	return power(n , m - 1) * n % Mod ; 
				return power(n * n % Mod , m / 2) ; 
}
int choose(int n , int m){
	if(n > m)return 0 ; 
	return fact[m] * power(fact[n]) % Mod * power(fact[m - n]) % Mod ; 
}
int dp[MAXN][MAXN] ; 
int32_t main(){ 
	ios_base::sync_with_stdio(0) ; 
	cin . tie(0) ; cout . tie(0) ; 
	
	Pre() ; 
	int n , k ;  cin >> n >> k ; 
	if(k == 1)return cout << 1 << '\n' , 0 ; 
	dp[0][0] = 1 ; 
	for(int i = 0 ; i <= n ; i ++){
		for(int j = i + (i == 0) ; j <= n ; j ++){
			if(i > 0)dp[i][j] += dp[i - 1][j] ; 
			if(j > 0)dp[i][j] += dp[i][j - 1] * choose(k - 2 , j * (k - 1) + i - 1) % Mod ;
			dp[i][j] %= Mod ; 
		}
	}
	cout << dp[n][n] * fact[n] % Mod << '\n' ; 

}


Measured memory_bytes: 54528
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <set>
#include <sstream>

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,j) FOR(i,0,j)
#define mp std::make_pair

typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int,int> P;
typedef std::pair<int,P> State;

const int INF = 1001001001;

// S N E W(南北東西)
const int dx[8] = {0, 0, 1, -1, 1, 1, -1, -1}, dy[8] = {1, -1, 0, 0, 1, -1, 1, -1};

int N, M;

std::vector<int> ts;

std::string toString(int n){
    std::stringstream ss;
    ss << n;
    return ss.str();
}

std::string toT(int h, int m){
    if(m < 10){
        return toString(h) + ":0" + toString(m);
    }
    return toString(h) + ":" + toString(m);
}

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

    REP(i, N){
        int h, m;
        std::cin >> h >> m;;

        ts.push_back(h*60 + m);
    }

    std::cin >> M;

    REP(i, M){
        int h, m;
        std::cin >> h >> m;

        ts.push_back(h*60 + m);
    }

    std::sort(ts.begin(), ts.end());
    ts.erase(std::unique(ts.begin(), ts.end()), ts.end());

    REP(i, (int)ts.size()){
        int minutes = ts[i];
        if(i == (int)ts.size()-1){
            std::cout << toT(minutes/60, minutes%60) << std::endl;
        }else{
            std::cout << toT(minutes/60, minutes%60) << " ";
        }
    }
}

Measured memory_bytes: 1244
#include<bits/stdc++.h>
using namespace std;
int dx[]={-1,1,0,0};
int dy[]={0,0,-1,1};
#define ull unsigned long long int
#define ll long long int
#define MAX 1000000007
//1e9+7
#define pll pair<ll,ll>
#define pii pair<int,int>
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define FO ifstream fin("a.in");ofstream fout("a.out");
#define TEST ll t;cin>>t;while(t--)
ll sizes[100001];
ll arr[100001];

bool ok=true;
ll A[100001];
pll B[100001];

ll root(ll i){
    while(i!=arr[i]) i=arr[i];
    return(i);
}
void Union(ll i,ll j){
    ll root_i=root(i),root_j=root(j);
    if(root_i==root_j) return;
    if(sizes[root_i]>sizes[root_j]) swap(root_i,root_j);
    sizes[root_j]+=sizes[root_i];
    arr[root_i]=arr[root_j];
    return;
}
bool prime[10000];
vector<ll> v;
void era(){
    memset(prime,true,sizeof prime);
    for(ll p=2;p*p<=10000;p++){
        if(prime[p]){

            for(ll q=p*p;q<=10000;q+=p){
                prime[q]=false;
            }
        }
    }

    return;
}

int main(){
    IO

    ll N,Q;
    string S;
    cin>>N>>Q>>S;
    S=' '+S;
    ll dp[N+1];
    memset(dp,0,sizeof dp);
    for(ll i=1;i<=N;i++){
        dp[i]=dp[i-1];
        if(S[i]=='C' && S[i-1]=='A') dp[i]++;
    }
    while(Q--){
        ll l,r,ans=0;
        cin>>l>>r;
        cout<<dp[r]-dp[l]<<"\n";
    }


    return(0);
}

Measured memory_bytes: 1772
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
typedef pair<long long, long long> P;
bool pairCompare(const P& firstElof, const P& secondElof)
{
    return firstElof.first < secondElof.first;
}
int main() {
    long long res = 0;
    long long N, M; cin >> N >> M;
    vector<P> stores(N);
    for (long long i = 0;i < N;i++) {
        cin >> stores[i].first >> stores[i].second;
    }
    sort(stores.begin(), stores.end(), pairCompare);
    for (long long i = 0;i < N;i++) {
        if(M > stores[i].second) {
            res += stores[i].first*stores[i].second;
            M -= stores[i].second;
        } else {
            res += stores[i].first*M;
            M = 0;
        }
    }
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 1792
N=int(input())
*A,=map(int,input().split())

i1=len([i for i in A if i%2!=0])
i4=len([i for i in A if i%4==0])
i2=min(1,N-i1-i4)

# print(i1,i2,i4)
print('Yes' if (i1+i2-1)<=i4 else 'No')

Measured memory_bytes: 19964
import java.util.Scanner;

public class Main {

    public static String converter(String number, int base, int dest){
        return Integer.toString(Integer.parseInt(number, base), dest);
    }

    private static int converter(String number, int dest){
        return converter(number, 10, dest).length();
    }
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String s = scanner.next();
        int dest = scanner.nextInt();
        System.out.println(converter(s, dest));
    }
}

Measured memory_bytes: 22612
#include<iostream>
#include<string>
#include<cstring>
#include<cstdio>
#include<cmath>
#include <utility>
#include<cstdlib>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<functional>
#include<algorithm>
#define ms0(a) memset(a,0,sizeof(a))
#define ms1(a) memset(a,-1,sizeof(a))
#define pb(a) push_back(a)
using namespace std;
typedef long long  ll;
//typedef __int64  ll;
const double Eps = (double)0.5;
const int M = 1e9 + 7;
const int N = 1e5 + 5;
const double PI = acos(-1.0);

struct S{
    int i,j;
}s[N];

int st[N][10];

//set<pair<int, int> > s;
map<pair<int, int>, int> mp;
ll asr[10];
int h,w,n;

void check(int x, int y)
{
    int ok = 1;
    int cnt = 0;
    for(int j = 0; j< 3; j++)
    {
        for(int k = 0; k<3; k++)
        {
            int u = x + j;
            int v = y + k;
            if( u < 1 || u > h || v < 1 || v > w)
            {
                ok = 0;
                break;
            }
            map<pair<int, int>, int>::iterator it;
            it = mp.find(make_pair(u,v));
            if(it != mp.end())
            {
                cnt++;
                int z = j*3 + k;
                if(!st[it->second][z])
                {
                    st[it->second][z] = 1;
                }
                else
                {
                    ok = 0;
                    break;
                }
            }
        }
        if(ok == 0)
            break;
    }
    if(ok)
        asr[cnt]++;
}

int main()
{
    cin>>h>>w>>n;
    for(int i=0; i<n ;i++)
    {
        scanf("%d%d",&s[i].i, &s[i].j);
        mp[make_pair(s[i].i, s[i].j)] = i;
        //mp.insert(make_pair(s[i].i, s[i].j), i);
        //s.insert(make_pair(s[i].i, s[i].j));
    }
    for(int i=0; i<n; i++)
    {
        int x = s[i].i;
        int y = s[i].j;
        for(int i= -2; i<= 0; i++)
        {
            for(int j = -2; j<=0; j++)
            {
                check(x+i, y+j);
            }
        }
    }
    ll re = 0;
    for(int i=1; i<= 9; i++)
        re += asr[i];
    asr[0] = (ll)(h-2)*(w-2) - re;
    for(int i=0; i<= 9; i++)
        printf("%lld\n",asr[i]);
    return 0;
}


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

using namespace std;

int main(){
  int n, k;
  long long x[51], y[51];
  long long rect_area = 1;
  rect_area = rect_area << 62;
  cin >> n >> k;
  for (int i=0;i<n;i++) {
    long long xx, yy;
    cin >> xx >> yy;
    x[i] = xx;
    y[i] = yy;
  }
  for (int g=0;g<n;g++) {
    for (int h=g;h<n;h++) {
      for (int i=0;i<n;i++) {
	for (int j=i+1;j<n;j++) {
	  long long xmin, xmax, ymin, ymax;
	  if (x[g] < x[h]) {
	    xmin = x[g];
	    xmax = x[h];
	  } else {
	    xmin = x[h];
	    xmax = x[g];
	  }
	  if (y[i] < y[j]) {
	    ymin = y[i];
	    ymax = y[j];
	  } else {
	    ymin = y[j];
	    ymax = y[i];
	  }
	  int points_in_rect = 0;
	  for (int m=0;m<n;m++) {
	    if (xmin <= x[m] && x[m] <= xmax && ymin <= y[m] && y[m] <= ymax) {
	      points_in_rect++;
	    }
	  }
	  if (points_in_rect >= k) {
	    long long area_tmp = (xmax - xmin) * (ymax - ymin);
	    rect_area = area_tmp < rect_area?area_tmp:rect_area;
	  }
	}
      }
    }
  }
  
  cout << rect_area << endl;
  return(0);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define M 1000000007
#define ll long long int
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define debug1(x) cout<<#x<<" "<<x<<endl;
#define debug2(x,y) cout<<#x<<" "<<x<<"   "<<#y<<" "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" "<<x<<"   "<<#y<<" "<<y<<"   "<<#z<<" "<<z<<endl;
#define present(c,x) ((c).find(x) != (c).end())
#define null NULL
#define mp make_pair
#define sz(x)	(ll)x.size()
#define fi first
#define se second
#define boost ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define inf 1e18
#define flush fflush(stdout);
//#define endl '\n'
//unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
//shuffle (foo.begin(), foo.end(), std::default_random_engine(seed));
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<ll, null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update>
ll modpower(ll a,ll b,ll c)
{
	ll res=1;
	while(b)
	{
		if(b&1LL)
			res=(res*a)%c;
		a=(a*a)%c;
		b>>=1;
	}
	return res;
}
//-------------------------------Template--Above-----------------------------------------------

int main()
{
	boost

	    ll n,x,t;cin>>n>>x>>t;
	    if(n%x==0){
            cout<<t*(n/x)<<endl;
	    }
	    else{
            cout<<t*((n/x)+1)<<endl;
	    }
	return 0;
}


Measured memory_bytes: 3648
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <string.h>
#include <vector>
#include <functional>
#include <queue>
#include <unordered_set>
#include <climits>
#include <set>
#include <list>
#include <cmath>
#include <map>

using namespace std;
typedef long long ll;

int main()
{
	int N, T;
	int A[3001];
	int B[3001];
	cin >> N >> T;
	for(int i = 1; i <= N; i++){
		cin >> A[i] >> B[i];
	}
	
	const int N_MAX = 3001;
	const int T_MAX = 3001;
	static ll DP[N_MAX][T_MAX][2]; // 3次元目は、「最後に食べる料理」を既に予約したか否か
	for(int i = 0; i < N_MAX; i++){
		for(int j =0; j < T_MAX; j++){
			DP[i][j][0] = 0;
			DP[i][j][1] = 0;
		}
	}
	
	for(int n = 1; n <= N; n++){
		for(int t = 0; t < T; t++){
			DP[n][t][0] = DP[n-1][t][0];
			if(t -A[n] >= 0){
				DP[n][t][0] = max(DP[n][t][0], DP[n-1][t-A[n]][0]+B[n]);
			}
			
			DP[n][t][1] = max(DP[n-1][t][0]+B[n], DP[n-1][t][1]);
			if(t -A[n] >= 0){
				DP[n][t][1] = max(DP[n][t][1], DP[n-1][t-A[n]][1]+B[n]);
			}
		}
	}
	cout << DP[N][T-1][1] << endl;
	
	return 0;
}

Measured memory_bytes: 140928
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;
typedef pair<ll,ll> pll;
const ll mod=1e9+7;
//const ll mod=998244353;
const ll inf=1e18;

int main() {
  ll n,m,l;
  cin >> n >> m >> l;
  mat d(n,vec(n,inf));
  for(ll i=0;i<n;i++) d[i][i]=0;
  for(ll i=0;i<m;i++) {
    ll a,b,c;
    cin >> a >> b >> c;
    a--;
    b--;
    d[a][b]=c;
    d[b][a]=c;
  }
  for(ll k=0;k<n;k++) {
    for(ll i=0;i<n;i++) {
      for(ll j=0;j<n;j++) {
        d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
      }
    }
  }
  mat ans(n,vec(n,inf));
  for(ll i=0;i<n;i++) {
    for(ll j=0;j<n;j++) {
      if(d[i][j]<=l) {
        ans[i][j]=min(1LL,d[i][j]);
      }
    }
  }
  for(ll k=0;k<n;k++) {
    for(ll i=0;i<n;i++) {
      for(ll j=0;j<n;j++) {
      ans[i][j]=min(ans[i][j],ans[i][k]+ans[k][j]);
      }
    }
  }
  ll q;
  cin >> q;
  while(q--) {
    ll f,t;
    cin >> f >> t;
    f--;t--;
    if(ans[f][t]==inf) {
      cout << -1 << endl;
    }
    else {
      cout << max(0LL,ans[f][t]-1) << endl;
    }
  }
}

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

int main()
{
	int n;
	scanf("%d",&n);
	int now = 100000;
	for(int i = 0; i < n; i++)
	{
		now = now * 105 / 100;
		if(now % 1000 != 0)
		{
			now = (now / 1000 + 1) * 1000;
		}
	}
	printf("%d\n",now);
	return 0;
}

Measured memory_bytes: 1020
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

const ll mod = 1e9 + 7;
const ll inf = 1e18;

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

    // input
    ll N;
    cin >> N;

    string A, B, C;
    cin >> A >> B >> C;

    ll count = 0;
    FOR(i, 0, N){
        char a = A[i];
        char b = B[i];
        char c = C[i];

        if(a==b && b==c){
            continue;
        }
        else if(a==b || b==c || c==a){
            count++;
        }
        else{
            count += 2;
        }
    }

    p(count);
    
    return 0;
}

Measured memory_bytes: 256
import java.io.PrintWriter;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		PrintWriter out = new PrintWriter(System.out);
		//String S = sc.next();
		//int N = Integer.parseInt(sc.next());
		//out.println();
		// ArrayList<String> list = new ArrayList<String>();
		// list.stream().sorted().distinct();
		int N = Integer.parseInt(sc.next());
		int M = Integer.parseInt(sc.next());
		int cnt =1;
		for(int i=0;i<N;i++){
			cnt *=100;
		}
      	if(M==100){
        	out.println(cnt*M+cnt);
        }else{
			out.println(cnt*M);
        }
          out.flush();	
	}
}

Measured memory_bytes: 21844
#include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>

using namespace std;

int main(){
	stack<int> st;
	int n,ans;

	while(cin >> n){
		if(n != 0){
			st.push( n );
		}else{
			ans = st.top();
			cout << ans << endl;
			st.pop();
		}
	}
}

Measured memory_bytes: 1196
def main():
    n, m = map(int, input().split())
    
    A = []
    for _ in range(n):
        A.append(list(map(int, input().split())))

    b = []
    for _ in range(m):
        b.append(int(input()))

    for x in range(n):
        ans = 0
        for y in range(m):
            hoge = A[x][y] * b[y]
            ans += hoge
        print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 8008
#include<bits/stdc++.h>
using namespace std;
const int MOD=1e9+7;
int main()
{
	int n;
	cin>>n;
	long long a=1,b=1,c=1;
	for(int i=1;i<=n;i++)
	{
		a=a*10%MOD;
		b=b*9%MOD;
		c=c*8%MOD;
	}
	
	a=(a-b%MOD+MOD)%MOD;
	a=(a-b%MOD+MOD)%MOD;
	a=(a+c%MOD+MOD)%MOD;
	cout<<a<<endl;
	
	return 0;
} 

Measured memory_bytes: 3600
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#include <functional>
using namespace __gnu_pbds;  
using namespace std;

typedef tree<long long, null_type, less<long long>, rb_tree_tag, 
             tree_order_statistics_node_update> 
    new_data_set; 
//defines
typedef long long ll;
typedef long double ld;

ll a,b,c,m,n,k;

ll t=1;

void solve()
{
    cin>>n;
    while(n--)cout<<"ACL";
 if(t>0)cout<<"\n";
}

int32_t main()
{
#ifdef ONPC
    freopen("input.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
   
   //cin>>t;
    while(t--)
    {
        solve();
    }
  //cout<<sum;
        
    return 0;
}

Measured memory_bytes: 3572
#include<iostream>
#include<string>
#include <algorithm>
#include <cstdlib>
using namespace std;

int main(){
  string w, s;
  int cnt =0;
  cin >> w;
  while(1){
      cin >> s;
      if(s=="END_OF_TEXT")break;
      transform (s.begin (), s.end (), s.begin (), ::tolower);
      if(w == s) ++cnt;
  }
  cout << cnt <<endl;
  return 0;
}


Measured memory_bytes: 3112
A = []
for i in range(3):
    l = list(map(int, input().split()))
    A.append(l)
N = int(input())
b = [int(input()) for i in range(N)]


judge = [[0, 0, 0], [0, 0, 0], [0, 0, 0]]

for b_i in b:
    for i in range(3):
        for j in range(3):
            if b_i == A[i][j]:
                judge[i][j] = 1

bool = False

for i in range(3):
    if judge[i][0] == 1 and judge[i][1] == 1 and judge[i][2] == 1:
        print('Yes')
        bool = True
        break
    elif judge[0][i] == 1 and judge[1][i] == 1 and judge[2][i] == 1:
        print('Yes')
        bool = True
        break
    elif judge[0][0] == 1 and judge[1][1] == 1 and judge[2][2] == 1:
        print('Yes')
        bool = True
        break
    elif judge[0][2] == 1 and judge[1][1] == 1 and judge[2][0] == 1:
        print('Yes')
        bool = True
        break

if bool == False:
    print('No')

Measured memory_bytes: 3064
#include <cstdio>
#include <cmath>
#include <algorithm>
#define repi(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)

constexpr int MAX_N = 100000;

int n;
int a[MAX_N];
int ma;

int main()
{
  scanf( "%d", &n );
  rep( i, n )
    scanf( "%d", a+i ), ma = std::max( ma, a[i] );

  int r = 0;
  rep( i, n )
  {
    if( fabs(r-(double)ma/2.0) > fabs(a[i]-(double)ma/2.0) )
      r = a[i];
  }

  printf( "%d %d\n", ma, r );

  return 0;
}

Measured memory_bytes: 512
n=int(input())
a=list(map(int,input().split()))

icnt=[0]*n
for i in range(n):
    icnt[a[i]]+=1

yn=""
if n%2==0:
    for i in range(n):
        if i%2==0:
            if icnt[i]!=0:
                yn="NO"
                break
        else:
            if icnt[i]!=2:
                yn="NO"
                break
else:
    for i in range(n):
        if i==0:
            if icnt[i]!=1:
                yn="NO"
                break
        elif i%2==0:
            if icnt[i]!=2:
                yn="NO"
                break
        else:
            if icnt[i]!=0:
                yn="NO"
                break
if yn=="NO":
    print(0)
else:
    n2=n//2
    p=10**9+7
    print(pow(2,n2,p))

Measured memory_bytes: 13880
#![allow(non_snake_case,unused_imports,dead_code)]
use std::io::Read;
use std::cmp::max;
use std::cmp::min;
use std::str::FromStr;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::BinaryHeap;
use std::cmp::Ordering;

use proconio::input;
use proconio::marker::{Chars,Usize1,Isize1};

fn comp_f64(a: &f64, b: &f64) -> Ordering {
    if a < b {
        return Ordering::Less;
    } else if a > b {
        return Ordering::Greater;
    }
    Ordering::Equal
}

fn main() {

    input!{
        mut S:Chars,
        mut K:usize,
    }

    let N = S.len();

    for i in 0..N{
        let s = S[i];
        let k = ('a' as usize +26 - s as usize) % 26;
        if K >= k{
            K -= k;
            S[i] = 'a';
        }
    }
    K %= 26;
    S[N-1] = ((S[N-1] as u8 - 'a' as u8 + K as u8)%26 + 'a' as u8) as char;
    
    let mut ans = Chars2String(&S);
    println!("{}",ans);
}

fn Chars2String(C:&Vec<char>) -> String{
    let mut ret = String::new();
    for &c in C{
        ret.push(c);
    }
    ret
}

Measured memory_bytes: 2780
#A to Z string
s = input()
judge_a = 0
judge_z = 0
a = 0
z = 0

for i in range(len(s)):
    if s[i] == "A" and judge_a == 0:
        a = i
        judge_a = 1
    if s[len(s)-1-i] == "Z" and judge_z == 0:
        z = len(s)-i
        judge_z = 1

print(z-a)

Measured memory_bytes: 3512
N = int(input())
A = [int(s) for s in input().split()]
kotae = 0
nanika=True
while nanika==True:
  count = 0
  for i in range(N):
    if A[i] % 2 == 0:
      count += 1
  if count == N:
    for i in range(N):
      A[i] //= 2
    kotae += 1
  else:
    nanika=False
print(kotae)

Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cmath>
#include<cstdio>
#include<tuple>
#include<bitset>
#include<map>

using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
#define ALL(x) x.begin(),x.end()
using P=pair<int,int>;
using lint=long long;
using ll=long long;
const lint inf=1e18+7;
const int MOD=1000000007;
signed main(){
  int n,k;cin>>n>>k;
  vector<int> p(n);
  rep(i,n)cin>>p[i];
  sort(p.begin(),p.end());
  int res=0;
  rep(i,k){
    res+=p[i];
  }
  cout<<res<<"\n";
  return 0;
}


Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; (i) < (n); ++ (i))
#define loop(i,a,n) for (int i = (a); (i) < (n); ++ (i))
#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF (int)1e9
#define MOD 0
//#define int ll
using namespace std;
typedef vector<long long> vl;

signed main() {
  double r;
  cin.tie(0);
  ios::sync_with_stdio(false);
  cin >> r;
  cout << 2*r*3.14159265 << endl;
}


Measured memory_bytes: 3788
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long A,B,C,D;
    cin>>A>>B>>C>>D;
    int a=C,b=D;
    if(a<b){
        long long tmp;
        tmp=b;
        b=a;
        a=tmp;
    }
    long long r=a%b;
    while(r!=0){
    a=b;
    b=r;
    r=a%b;
    }
    cout<<B-B/C-B/D+B/((C*D)/b)-((A-1)-(A-1)/C-(A-1)/D+(A-1)/((C*D)/b));
}


Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static void main(String[]srgs) {
	Scanner scan=new Scanner(System.in);
	int a=scan.nextInt();
	int b=scan.nextInt();
	int c=scan.nextInt();
	int lon=0;
	
	List<Integer>list=new ArrayList<Integer>();
	int count=0;
	for(int i=a;i<=b;i++) {
		if(i<a+c||i>b-c) {
			list.add(i);
			count++;
		}
	}
	for(int i=0;i<count;i++) {
		System.out.println(list.get(i));
	}
	scan.close();
}
}

Measured memory_bytes: 21716
#include <iostream>
#include <string>
#define rep(i, n)for(int i=0; i<n; i++)
using ll = long long int;
using namespace std;

int main() {
	string s;
	int a[26]={};
	while(cin>>s)
	rep(i, s.length()){
		if(s[i]>='a' && s[i]<='z') a[s[i]-'a']++;
		else if(s[i]>='A' && s[i]<='Z') a[s[i]-'A']++;
	}
	rep(i, 26){
		cout << (char)('a'+i) << " : " << a[i] << endl;
	}
	return 0;
}


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

int main () 
{
    int N;
    std::cin >> N;
    
    int X[N];
    int S[N];
    for (int i = 0; i < N; i++) 
    {
        std::cin >> X[i];
        S[i] = X[i];
    }
    
    sort(S, S+N);
    
    int lc, rc;
    lc = S[ (N/2) - 1];
    rc = S[ N / 2 ];
    
    int ans[N];
    for (int i = 0; i < N; i++) 
    {
        if ( X[i] <= lc )
        {
            ans[i] = rc;
        }
        else if (X[i] >= rc)
        {
            ans[i] = lc;
        }
    }
    
    for (int i = 0; i < N; i++) 
    {
        std::cout << ans[i] << std::endl;
    }
    
    return 0;
}

Measured memory_bytes: 4480
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <set>
using namespace std;
#define int long long
#define REP(i, a, b) for(int i = a; i <= b; ++i)
#define PER(i, a, b) for(int i = a; i >= b; --i)

inline int read() {
	int x = 0, flag = 1; char ch = getchar();
	while(!isdigit(ch)) {
		if(ch == '-') flag = -1;
		ch = getchar();
	}
	while(isdigit(ch)) {
		x = x * 10 + ch - '0';
		ch = getchar();
	}
	return x * flag;
}

const int mod = 1e9 + 7;
int f[100], g[100][2], H, W, K, dp[100][1001];

int calc(int x) {
	return x < 0 ? 1 : f[x];
} 

signed main() {
	H = read(); W = read(); K = read();
	f[0] = g[1][0] = g[1][1] = 1; f[1] = 2;
	REP(i, 2, 88) g[i][0] = g[i - 1][0] + g[i - 1][1], g[i][1] = g[i - 1][0];
	REP(i, 2, 88) f[i] = g[i][0] + g[i][1];
	if(W == 1) {
		cout << 1 << endl;
		return 0;
	}
	dp[1][1] = f[W - 2];
	if(W < 3) dp[1][2] = 1;
	else dp[1][2] =  f[W - 3];
	REP(i, 2, H)
		REP(j, 1, W) {
			dp[i][j] = (dp[i - 1][j] * calc(j - 2) % mod * calc(W - j - 1) % mod + 
						dp[i - 1][j - 1] * calc(j - 3) % mod * calc(W - j - 1) % mod+ 
						dp[i - 1][j + 1] * calc(j - 2) % mod * calc(W - j - 2)) % mod;
		}
	printf("%lld\n", dp[H][K]);
	return 0;
}
 

Measured memory_bytes: 640
# coding: utf-8
# Your code here!
import math
A,B,H,M = map(int,input().split())

#ラジアン角で三角関数へ渡す

h_theta = (360/12)*H + (30/60)*M
m_theta = (360/60)*M

print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(math.radians(abs(h_theta-m_theta)))))


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

using ll = long long;
const ll mod = LLONG_MAX;

string s,t;
int main(){
  cin>>s>>t;
  if(s.size()>t.size()){
    cout<<"GREATER"<<endl;
    return 0;
  }else if(s.size()<t.size()){
    cout<<"LESS"<<endl;
    return 0;
  }else{
    for(int i=0;i<s.size();i++){
      int a=s[i]-'0';
      int b=t[i]-'0';
      if(a>b){
        cout<<"GREATER"<<endl;
        return 0;
      }
      if(a<b){
        cout<<"LESS"<<endl;
        return 0;
      }

    }
  }
  cout<<"EQUAL"<<endl;

}


Measured memory_bytes: 764