akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, o, n) for (auto i = (o); (i) < (n); ++(i))
#define REP(i, n) FOR(i, 0, n)
#define REPR(i, n) for (auto i = (n)-1; (i) >= 0; --i)
#define REPI(itr, v) for (auto itr = v.begin(); itr != v.end(); ++itr)
#define REPIR(itr, v) for (auto itr = v.rbegin(); itr != v.rend(); ++itr)
#define fi first
#define se second
#define ll long long
#define V2(name, h, w) vector<vector<int> > name((h), vector<int>(w));
int main(){
	string S; cin >> S ;
	deque<char> T; 
	REP(i, S.size()){
		char tmp;
		cin >> tmp;
		T.push_back(tmp);
	}

	REP(i, S.size()){
		REP(j, S.size()){
			if(not(S[j] == T[j])) break;
			if(j+1 == S.size()){
				cout << "Yes" << endl;
				return 0;
			}
		}	
		char tmp = T.back();
		T.pop_back();
		T.push_front(tmp);
	}

	cout << "No" << endl;
}


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

int main() {

	int sum = 0;
	string S, T;
	cin >> S >> T;


	for (int i = 0; i < S.length(); i++ ) {
		if (S[i] != T[i]) {
			sum++;
		}
	}
		cout << sum << endl;

}


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

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef long double LD;

#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define X first
#define Y second
#define pb push_back
#define make_unique(x) sort(all(x)), x.resize(unique(all(x)) - x.begin())
#define int long long

const LL mod = 1e9 + 7;


template<class T>
istream& operator >> (istream& in, vector<T>& v){ for (auto &x : v) { in >> x; } return in; }

template<class T, class U>
istream& operator >> (istream& in, pair<T, U> & v){ in >> v.X >> v.Y;return in; }

template<class T, class U>
ostream& operator << (ostream& out, pair<T, U> & v){ out << v.X << " " << v.Y;return out; }

void chkmax(int &a, int b) {
    a = max(a, b);
    return;
}

void chkmin(int &a, int b) {
    a = min(a, b);
    return;
}

LL ppow (LL x, LL s) {
    if (!s) return 1;
    if (!(s - 1)) return x % mod;
    if (s % 2) return (x * ppow (x, s - 1)) % mod;
    LL b = ppow (x, s / 2);
    return (b * b) % mod;
}

main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    //freopen("ILUXA.in", "r", stdin);
    int n, m;
    cin >> n >> m;
    cout << ((n == m) ? "Yes" : "No");
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <tuple>
#include <iomanip>


using namespace std;

typedef long long ll;

const ll INF = 1ll << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
	return f.second > s.second;
}

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


int main(void){
	int a, b;

	cin >> a >> b;

	int tmp = max(a, b);


	int ans = tmp + tmp - 1;
	
	if (a == b){
		cout << a * 2 << endl;
	}
	else {
		cout << ans << endl;
	}
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef tuple<int,int,int> T;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<T> vt;

int main() {
  int a,b,c;
  cin >>a >> b >> c;
  cout<<(a+b)*c/2<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define rep(i,s,e) for(int i=s;i<e;i++)
#define endl '\n'
lli f(lli a,lli b,lli x);
int main(){
    lli A,B,N;cin>>A>>B>>N;
    lli minimam=min(B-1,N);
    lli res=f(A,B,minimam);
    cout<<res<<endl;
}

lli f(lli a,lli b,lli x){
    lli p=(a*x)/b;
    lli q=a*(x/b);
    return p-q;
}

Measured memory_bytes: 3636
/* Bismillahir Rahmanir Rahim */
#include<bits/stdc++.h>
#include<vector>
#include<cmath>
#include<string>
#include<stdlib.h>
#define   mod          1000000007
#define   lp(i,a,b)    for(ll i=a;i<=b;i++)
#define   ll           long long int
#define   ull          unsigned long long int
#define   tst          int t;cin>>t;while(t--)
#define   pb           push_back
#define   vi(v)        vector<int>v;
#define   vl(v)        vector<ll>v;
#define   vs           vector<string>v
#define   rslt(x)      cout<<x<<endl;
#define   mp(x,y)      make_pair(x,y)
#define   yes          rslt("YES");
#define   no           cout<<"NO"<<endl;
#define   srt(v)       sort(v.begin(),v.end())
#define   rvs(v)       reverse(v.begin(),v.end());
#define   AR           ios::sync_with_stdio(false);cin.tie(0);
#define   gcd(a,b)     __gcd(a,b)
#define   lcm(a,b)     (a/gcd(a,b))*b
#define   max          1000007
#define   str          int s[200000];
#define   coutv(v)     for(auto it:v)cout<<it<<' ';cout<<endl;
#define   cinv(v)      for(auto &it:v)cin>>it;
using namespace std;
int main()
{
    ll n,x=0;
    str
    cin>>n;
    ll cnt=0;
    lp(i,0,n-1)
    cin>>s[i];
    sort(s,s+n);
    for(int i=0; i<n-2; i++)
    {
        for(int j=i+1; j<n-1; j++)
        {
            for(int k=j+1; k<n; k++)
            {
                x=0;
                if(s[i]!=s[j] && s[j]!=s[k])
                {
                    if(s[i]+s[j]>s[k])
                        x++;
                    if(s[i]+s[k]>s[j])
                        x++;
                    if(s[j]+s[k]>s[i])
                        x++;
                    if(x==3)
                        cnt++;
                }
            }
        }
    }
    cout<<cnt<<endl;

    return 0;

}



Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int mod = 1e9+7;

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> sunuke(n);
    for(int i = 0; i < n; i++){
        sunuke[i] = 0;
    }
    for(int i = 0; i < k; i++){
        int d;
        cin >> d;
        for(int j = 0; j < d; j++){
            int a;
            cin >> a;
            a--;
            sunuke[a]++;
        }
    } 
    int ans = 0;
    for(int i = 0; i < n; i++){
        if(sunuke[i] == 0) ans++;
    }
    cout << ans <<endl;
}

Measured memory_bytes: 3648
/* segment_tree.cpp
    任意のモノイドに対してセグメント木を構築する。

    モノイドXに対するセグメント木を構築するために、
        ・X上の二項演算 fx
        ・Xの単位元 ex
    を与える

    RMQ:
        auto fx = [](int x1, int x2) -> int { return min(x1, x2); };
        int ex = numeric_limits<int>::max();
        SegTree<int> rmq(n, fx, ex);


    unverified: AOJ DSL_2_A
        http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=DSL_2_A&lang=jp
 */

#include <bits/stdc++.h>
using namespace std;

/* SegTree<X>(n,fx,ex): モノイド(集合X, 二項演算fx, 単位元ex)についてサイズnで構築
    set(int i, X x), build(): i番目の要素をxにセット。まとめてセグ木を構築する。O(n)
    update(i,x): i 番目の要素を x に更新。O(log(n))
    query(a,b):  [a,b) 全てにfxを作用させた値を取得。O(log(n))
*/
template <typename X>
struct SegTree {
    using FX = function<X(X, X)>;
    int n;
    FX fx;
    const X ex;
    vector<X> dat;
    SegTree(int n_, FX fx_, X ex_) : n(), fx(fx_), ex(ex_), dat(n_ * 4, ex_) {
        int x = 1;
        while (n_ > x) {
            x *= 2;
        }
        n = x;
    }

    void set(int i, X x) { dat[i + n - 1] = x; }
    void build() {
        for (int k = n - 2; k >= 0; k--) dat[k] = fx(dat[2 * k + 1], dat[2 * k + 2]);
    }

    void update(int i, X x) {
        i += n - 1;
        dat[i] = x;
        while (i > 0) {
            i = (i - 1) / 2;  // parent
            dat[i] = fx(dat[i * 2 + 1], dat[i * 2 + 2]);
        }
    }

    // the minimum element of [a,b)
    X query(int a, int b) { return query_sub(a, b, 0, 0, n); }
    X query_sub(int a, int b, int k, int l, int r) {
        if (r <= a || b <= l) {
            return ex;
        } else if (a <= l && r <= b) {
            return dat[k];
        } else {
            X vl = query_sub(a, b, k * 2 + 1, l, (l + r) / 2);
            X vr = query_sub(a, b, k * 2 + 2, (l + r) / 2, r);
            return fx(vl, vr);
        }
    }
    /* debug */
    inline X operator[](int a) { return query(a, a + 1); }
    void print() {
        for (int i = 0; i < n; ++i) {
            cout << (*this)[i];
            if (i != n) cout << ",";
        }
        cout << endl;
    }
};

/*  gcd(a,b)
    入力：整数 a, b
    出力：aとbの最大公約数
    計算量：O(log(a)) (a>=bのとき)
*/
template <typename T>
T gcd(T a, T b) {
    if (b == 0) {
        return a;
    } else {
        return gcd(b, a % b);
    }
}

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

    using X = int;
    X ex = numeric_limits<int>::max();
    auto fx = [ex](X x1, X x2) -> X { return (x1 == ex) ? x2 : ((x2 == ex) ? x1 : gcd(x1, x2)); };
    SegTree<X> rmq(n, fx, ex);

    vector<int> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a.at(i);
        rmq.set(i, a[i]);
    }
    rmq.build();

    int ans = max(rmq.query(0, n - 1), rmq.query(1, n));
    for (int i = 1; i < n - 1; i++) {
        ans = max(ans, gcd(rmq.query(0, i), rmq.query(i + 1, n)));
    }
    cout << ans << endl;
    return 0;
}


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


int main(){
    string abcd;
    cin >> abcd;
    int n = (int)abcd.length();
    
    for(int bit=0; bit < (1<<(n-1)); bit++){
        
        string s; s.clear();
        int sum=abcd[0]-'0';
        for(int i=0; i<n; i++){
            s.push_back(abcd[i]);
            if(i==n-1){
                s.push_back('=');
            }
            else if(bit & (1<<i)){
                sum += abcd[i+1]-'0';
                s.push_back('+');
            }
            else {
                sum -= abcd[i+1]-'0';
                s.push_back('-');
            }
        }
        //cout << bitset<4>(bit) <<" "<< sum << endl;
        if(sum==7){
            s.push_back('7');
            for(int i=0; i<s.length(); i++)
                cout << s[i];
            cout << endl;
            break;
        }
        
    }
}


Measured memory_bytes: 256
import sys
import os
import itertools
from collections import deque

def main():
    if os.getenv("ENV")=='LOCAL':
        sys.stdin = open(os.path.dirname(__file__)+'/input.txt', 'r')

    A,V=map(int, input().split())
    B,W=map(int, input().split())
    T=int(input())

    if T*W+abs(A-B)<=T*V:
        print('YES')
    else:
        print('NO')

if __name__ == '__main__':
    main()


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

int main()
{
    size_t N, K;
    cin >> N >> K;

    vector<size_t> A(N);
    for (size_t &a : A)
    {
        cin >> a;
    }

    for (size_t i = K; i < N; i++)
    {
        if (A[i] > A[i - K])
        {
            cout << "Yes" << endl;
        }
        else
        {
            cout << "No" << endl;
        }
    }
}


Measured memory_bytes: 4836
using System;
namespace test{
  class program{
    static void Main()
    {
            string[] str = Console.ReadLine().Split(' ');
            int a = int.Parse(str[0]);
            int b = int.Parse(str[1]);
            int c = int.Parse(str[2]);
            if (a < b && b < c) Console.WriteLine("Yes");
            else Console.WriteLine("No");
        }
    }
}

Measured memory_bytes: 8888
x, y = list(map(int, input().split()))

price = 0
flag = False
if x == 1 :
  price += 300000
  flag = True
elif x == 2 :
  price += 200000
elif x == 3 :
  price += 100000

if y == 1 :
  price += 300000
  if flag :
    price += 400000
elif y == 2 :
  price += 200000
elif y == 3 :
  price += 100000

print(price)

Measured memory_bytes: 3316
/*
* @Author Silviase(@silviasetitech)
* For ProCon
*/

import java.util.*;
import java.lang.*;
import java.math.*;

class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        
        int n = sc.nextInt();
        int len = sc.nextInt();
        List l = new ArrayList<String>();
        for (int i = 0; i < n; i++) {
            String tmp = sc.next();
            l.add(tmp);
        }
        Collections.sort(l);
        for (int i = 0; i < l.size(); i++) {
            System.out.print(l.get(i));
            if (i == l.size()-1) {
                System.out.println("");
            }
        }

        sc.close();
    }

}





Measured memory_bytes: 25172
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstdlib>
using namespace std;
#define INF (1<<20)
int W,H;
int fie[22][22];
int dx[]={0,1,0,-1};
int dy[]={1,0,-1,0};
int solve(int x,int y,int co){

  /*   for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	if(x==j && i==y) printf("M ");
	else printf("%d ",fie[j][i]);
      }
      puts("");
    }
   printf("co=%d\n",co);
   sleep(1);
  */
  if(co >= 10) return INF;
  int ret=INF;
  for(int i=0;i<4;i++){
    for(int j=1;;j++){
      int nx = x+dx[i]*j;
      int ny = y+dy[i]*j;
      if(nx < 0 || nx > W-1 || ny < 0 || ny > H-1) break;
      if(fie[nx][ny]==3){
	//	printf("res=%d     nx %d : ny %d\n",co+1,nx,ny);
	return co+1;
      }
      if(fie[nx][ny]==1){
	if(j==1) break;
	fie[nx][ny]=0;
	//	printf("ok\n");
	ret=min(ret,solve(nx - dx[i],ny - dy[i],co+1));
	//	printf("%d ... ret=%d\n",co,ret);
	fie[nx][ny]=1;
	break;
      }
    }
  }
  //  printf("RET=%d\n",ret);
  return ret;
}
main(){
  while(1){
    int sx,sy;
    scanf("%d %d",&W,&H);
    if(!W && !H) break;
    memset(fie,0,sizeof(fie));
    for(int i=0;i<H;i++){
      for(int j=0;j<W;j++){
	scanf("%d",&fie[j][i]);
	if(fie[j][i]==2){
	  sx = j;
	  sy = i;
	}
      }
    }
    int res=solve(sx,sy,0);
    if(res == INF) puts("-1");
    else printf("%d\n",res);
  }
}

Measured memory_bytes: 1196
#define _USE_MATH_DEFINES
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <clocale>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

const int MOD = 1000000007; 
const int INF = 1000000000; //1e9
const int NIL = -1;
const long long LINF = 1000000000000000000; // 1e18
const double EPS = 1E-10;

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


int gcd(int a, int b){
    if(!b) return a;
    if(a % b) return gcd(b, a % b);
    return b;
}

int main(){
    int N, ans(0); std::cin >> N;
    std::vector<int> a(N), l(N+1), r(N+1);
    for(int i(0); i < N; ++i) std::cin >> a[i];
    for(int i(0); i < N; ++i){
        if(i) l[i+1] = gcd(l[i], a[i-1]);
        r[N-1-i] = gcd(r[N-i], a[N-i-1]);
    }
    for(int i(0); i < N; ++i) chmax(ans, gcd(l[i+1], r[i+1]));
    std::cout << ans << std::endl;
    return 0;
}


Measured memory_bytes: 1408
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
side = [0, 0]
for i in range(2):
	for j in range(len(a)-1):
		if a[j]==a[j+1]:
			side[i] = a[j]
			del a[j:j+2]
			break
print(side[0]*side[1])

Measured memory_bytes: 14252
N = int(input())
A_array = list(map(int,input().split()))

water_sum = sum(A_array) 

now_water = water_sum - sum(A_array[1::2]) * 2
ans_array = []
# print(now_water)
ans_array.append(str(now_water))
for i in range(N-1):
    now_water = A_array[i] * 2 - now_water
    ans_array.append(str(now_water))

print(" ".join(ans_array))

Measured memory_bytes: 73508
#include<iostream>
#include<string>
using namespace std;
int main(){
	string n;
	int a;
	cin>>n;
	for(int i=1;i<=n.size();i++)
	{
		a=i;
	}
	a=a-2;
	cout<<n[0]<<a<<n[a+1];
	return 0;
}

Measured memory_bytes: 256
from itertools import combinations as comb

N = int(input())
l = [tuple(map(int, input().split())) for _ in range(N)]
dist = lambda a,b:((a[0]-b[0])**2+(a[1]-b[1])**2)**0.5


def get_centers():
    ans = []
    for a, b, c in comb(l, 3):
        x1, y1 = a
        x2, y2 = b
        x3, y3 = c

        A = 2 * (x2-x1)
        B = 2 * (y2-y1)
        D = 2 * (x3-x2)
        E = 2 * (y3-y2)
        C = x1**2-x2**2+y1**2-y2**2
        F = x2**2-x3**2+y2**2-y3**2

        if B*D-A*E!=0:
            cy = (A*F-C*D)/(B*D-A*E)
            cx = -(F+E*cy)/D if D else -(C+B*cy)/A
            r = dist(a, (cx,cy))
            ans.append((cx, cy, r))

    for a, b in comb(l, 2):
        d = min(a,b)
        e = max(a,b)
        ans.append(((d[0]+e[0])/2, (d[1]+e[1])/2, dist(d,e)/2))

    return ans

if N==2:
    d = l[0]
    e = l[1]
    print(dist(d, e)/2)
else:
    ans = 10**12
    for xr, yr, r in get_centers():
        v = 0
        for x, y in l:
            v += dist((x,y),(xr,yr))<=r
        if v==N:
            ans = min(ans, r)
    print(ans)

Measured memory_bytes: 6388
#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 MOD 1000000007

typedef long long int ll;

const ll INF=(ll)1e18;
//const int INF=(1<<30);


int main(){
  string a,b;
  cin >> a >> b;

  if(a.size() > b.size()){
    cout << "GREATER" << endl;
  }else if(a.size() < b.size()){
    cout << "LESS" << endl;
  }else{
    REP(i,a.size()){
      if(a[i] > b[i]){
        cout << "GREATER" << endl;
        exit(0);
      }else if(a[i] < b[i]){
        cout << "LESS" << endl;
        exit(0);
      }
    }
    cout << "EQUAL" << endl;
  }


}



Measured memory_bytes: 256
import random
import collections

N = int(input())
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

l = prime_factorize(N)
c = collections.Counter(l)

kazu_l = [1, 1]
t = 1
for i in range(100):
    for j in range(t+2):
        kazu_l.append(t+1)
    t += 1

v = list(c.values())
ans = 0

for i in range(len(v)):
    ans += kazu_l[v[i]-1]

print(ans)

Measured memory_bytes: 9728
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s = sc.next();
        int startA = 0;
        boolean isA = false;
        int endZ = 0;
        for (int i=0; i<s.length();i++) {
            if (!isA && "A".equals(s.substring(i,i+1))) {
                startA = i;
                isA = true;
            } else if ("Z".equals(s.substring(i,i+1))) {
                endZ = i;
            }
        }
        System.out.println(endZ - startA +1);
    }
}

Measured memory_bytes: 38288
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
#define REP(i,n) for (ll i = 0; i < (n); ++i)
#define RREP(i, n) for (ll i = (n) - 1; i >= 0; --i)
#define ALL(v) (v).begin(), (v).end()
template<class T>
using reverse_priority_queue = priority_queue<T, vector<T>, greater<T>>;

struct mint{
    static const long long MOD = 998244353;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}

ll a, b, c, d;
// map<array<ll, 3>, mint> cache;
mint val[3001][3001][3];
bool flg[3001][3001][3];
mint solve(ll x, ll y, ll n){
    if(x == a && y == b){
        return (n == 0);
    }else if(y == b && (n == 0 || n == 2)){
        return 0;
    }else if(x > a && n == 0){
        return 0;
    }
    if(flg[x][y][n]){
        return val[x][y][n];
    }

    mint ret;
    if(n == 0){
        assert(x == a);
        ret = mint(x - 1).pow(y - b);
    }else if(n == 1){
        if(x > a){
            ret = y * (solve(x - 1, y, 0) + solve(x - 1, y, 1) + solve(x - 1, y, 2));
        }else{
            ret = solve(x, y - 1, 0) + (x - 1) * solve(x, y - 1, 1);
        }
    }else{
        assert(n == 2);
        ret = solve(x, y - 1, 1) + x * solve(x, y - 1, 2);
    }
    val[x][y][n] = ret;
    flg[x][y][n] = true;
    return ret;
}

int main(){
    cin >> a >> b >> c >> d;
    memset(flg, 0, sizeof(flg));
    cout << solve(c, d, 0) + solve(c, d, 1) + solve(c, d, 2) << endl;
    return 0;
}


Measured memory_bytes: 241212
/* بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ */
//codeforces
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
#define FASTIO ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define mp make_pair
#define pb push_back
#define sz(v) ((int)v.size())
#define all(v) v.begin(), v.end()
void parseArray(ll* A,ll n){ for ( ll K = 0; K < n; K++){ cin >> A[K]; } }
ll modInverse(ll a, ll b){ return 1<a ? b - modInverse(b%a, a)*b/a : 1; }
ll gcd(ll a, ll b){ return b?gcd(b, a % b):a; }
ll lcm(ll a, ll b){ return (a*b)/gcd(a, b); }
ld dist(ld x, ld y, ld a, ld b){ return sqrt((x-a)*(x-a) + (y-b)*(y-b)); }
void debug(ll* a, ll n) { for ( ll k = 0; k < n; k++ ){ cerr << a[k] << " ";} cout << "\n"; }
#define PI 3.14159265358979323846

const ll mod = 1000000007;
int main(){
	FASTIO;
	ll n, m; cin >> n >> m;
	ll sum[n + 10]; memset(sum, 0, sizeof sum);
	for ( ll k = 1; k <= n; k++ )
		sum[k] = sum[k - 1] + k;
	ll ans = 1;
	for ( ll k = m; k <= n; k++ ){
		//cout << sum[k - 1] << " " << sum[n] - sum[n - k] << endl;
		ans += sum[n] - sum[n - k] - sum[k - 1] + 1;
		ans %= mod;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 5204
// Problem : F - Distributing Integers
// Contest : AtCoder Beginner Contest 160
// URL : https://atcoder.jp/contests/abc160/tasks/abc160_f
// Memory Limit : 1024 MB
// Time Limit : 3000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

//QWsin
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,x,y) for(int i=x;i<=y;++i)
#define out(i,u) for(int i=first[u];i!=-1;i=nxt[i])
#define repvc(i,vc) for(int i=0,Sz=vc.size();i<Sz;++i)
using namespace std;
inline int read()
{
	char ch=getchar();int ret=0,f=1;
	while(ch<'0' || ch>'9') {if(ch=='-')f=-1;ch=getchar();}
	for(;ch>='0' && ch<='9';ch=getchar()) ret=ret*10+ch-'0';
	return ret*f;
}

typedef long long ll;
const int INF=1<<30;
const int MOD=1e9+7;

ll Pow(ll x,ll p){
	x%=MOD;ll res=1;
	for(;p;p>>=1,x=x*x%MOD) if(p&1) res=res*x%MOD;
	return res;
}

ll inv(ll x){return Pow(x,MOD-2);}

const int maxn=200000+10;
const int maxm=400000+10;

int first[maxn],nxt[maxm],ecnt;
struct Edge{int u,v;Edge(int u=0,int v=0):u(u),v(v){}}e[maxm];
void add_edge(int u,int v){
	nxt[ecnt]=first[u];first[u]=ecnt;e[ecnt++]=Edge(u,v);
	nxt[ecnt]=first[v];first[v]=ecnt;e[ecnt++]=Edge(v,u);
}

ll dp[maxn],ans[maxn],sz[maxn],szfac[maxn],fac_n=1;

void dfs(int u,int fa)
{
	dp[u]=1;sz[u]=1;szfac[u]=1;
	for(int i=first[u];i!=-1;i=nxt[i]){
		if(e[i].v==fa) continue;
		dfs(e[i].v,u);
		dp[u]=dp[u]*dp[e[i].v]%MOD;
		sz[u]+=sz[e[i].v];
		szfac[u]=szfac[u]*szfac[e[i].v]%MOD;
	}
	szfac[u]=szfac[u]*sz[u]%MOD;
}

void DFS(int u,int fa)
{
	ans[u]=dp[u]*fac_n%MOD*inv(szfac[u])%MOD;
	// printf("dp[%d]=%I64d,szfac[%d]=%I64d\n",u,dp[u],u,szfac[u]);
	for(int i=first[u];i!=-1;i=nxt[i])
	{
		if(e[i].v==fa) continue;
		int v=e[i].v;
		ll dpu=dp[u],dpv=dp[v];
		dp[u]=dp[u]*inv(dp[v])%MOD;
		dp[v]=dp[v]*dp[u]%MOD;
		ll szu=sz[u],szv=sz[v];
		ll szfacu=szfac[u],szfacv=szfac[v];
		szfac[u]=szfac[u]*inv(szfac[v])%MOD;
		szfac[u]=szfac[u]*inv(sz[u])%MOD;
		szfac[v]=szfac[v]*inv(sz[v])%MOD;

		sz[u]-=sz[v];sz[v]+=sz[u];
		
		szfac[u]=szfac[u]*sz[u]%MOD;
		szfac[v]=szfac[v]*szfac[u]%MOD*sz[v]%MOD;
		
		DFS(v,u);
		dp[u]=dpu;dp[v]=dpv;
		szfac[u]=szfacu;szfac[v]=szfacv;
		sz[u]=szu;sz[v]=szv;
	}
}

int main()
{
	int n;cin>>n;
	rep(i,1,n) first[i]=-1;
	rep(i,1,n) fac_n=fac_n*i%MOD;
	// cout<<fac_n<<endl;
	rep(i,1,n-1){
		int u,v;cin>>u>>v;
		add_edge(u,v);
	}
	
	dfs(1,1);
	DFS(1,1);
	rep(i,1,n) cout<<ans[i]<<endl;
	return 0;
}


Measured memory_bytes: 15360
# -*- coding: utf-8 -*-

import sys

debug = False

def log(text):
    if debug:
        print(text)

def parse_input(lines_as_string = None):

    global debug
    lines = []
    if lines_as_string is None:
        debug = False
        lines.append(input())
    else:
        debug = True
        lines = [e for e in lines_as_string.split("\n")][1:-1]

    token = lines[0].split()
    a = int(token[0])
    b = int(token[1])

    return (a, b)


def solve(a, b):




    return max(a+b, max(a-b, a*b))


def main():
    # 出力

    print("%s" % solve(*parse_input()))

if __name__ == '__main__':

    main()
	

Measured memory_bytes: 3064
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc=new Scanner(System.in);
		double x1=sc.nextDouble();
		double y1=sc.nextDouble();
		double x2=sc.nextDouble();
		double y2=sc.nextDouble();
		double dist=Math.sqrt((x1-x2)*(x1-x2)+(y1-y2)*(y1-y2));
		System.out.printf("%.8f",dist);
	}
}

Measured memory_bytes: 19140
use std::collections::HashMap;
fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
    (0..n).map(|_| read_vec()).collect()
}
fn main(){
    let n: i32 = read();
    let sub_an:Vec<i64> = read_vec();
    let mut an = sub_an.iter().fold(HashMap::new(),|mut map ,x| {
        let y = map.get(&x).map(|i| i + 1).unwrap_or(1);
        map.insert(x,y);
        map
    })
    .into_iter()
    .flat_map(|(x,y)|{
        if y >= 4{
            vec![x,x]
        } else if y>= 2 {
            vec![x]
        }else {
            vec![]
        } 
    })
    .collect::<Vec<_>>();
    an.sort();
    an.reverse();
    let ans = if an.len() >= 2{
        an[0] * an[1]
    } else{
        0
    };
    println!("{}",ans);
}

Measured memory_bytes: 12756
#pragma region Macros

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define int ll
using vi = vector<int>;
using vvi = vector<vi>;

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((ll)(x).size())
#define MAX(x) *max_element(ALL(x))
#define MIN(x) *min_element(ALL(x))

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;
}

// debug methods
// usage: debug(x,y);
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0, a1, a2, a3, a4, x, ...) x
#define debug_1(x1) cout << #x1 << ": " << x1 << endl
#define debug_2(x1, x2) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << endl
#define debug_3(x1, x2, x3) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << endl
#define debug_4(x1, x2, x3, x4) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << endl
#define debug_5(x1, x2, x3, x4, x5) cout << #x1 << ": " << x1 << ", " #x2 << ": " << x2 << ", " #x3 << ": " << x3 << ", " #x4 << ": " << x4 << ", " #x5 << ": " << x5 << endl
#ifdef _DEBUG
#define debug(...)                                                        \
    CHOOSE((__VA_ARGS__, debug_5, debug_4, debug_3, debug_2, debug_1, ~)) \
    (__VA_ARGS__)
#else
#define debug(...)
#endif

#pragma endregion

void Main() {
    int a, b;
    cin >> a >> b;
    if ((a * b) % 2 != 0) {
        cout << "Odd";
        return;
    }
    cout << "Even";
}

#pragma region main
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    Main();
    cout << flush;
}
#pragma endregion


Measured memory_bytes: 3636
# include "bits/stdc++.h"
using namespace std;
using LL = long long;
using ULL = unsigned long long;
const double PI = acos(-1);
template<class T>constexpr T INF() { return ::std::numeric_limits<T>::max(); }
template<class T>constexpr T HINF() { return INF<T>() / 2; }
template <typename T_char>T_char TL(T_char cX) { return tolower(cX); };
template <typename T_char>T_char TU(T_char cX) { return toupper(cX); };
typedef pair<LL, LL> pii;
const int vy[] = { -1, -1, -1, 0, 1, 1, 1, 0 }, vx[] = { -1, 0, 1, 1, 1, 0, -1, -1 };
const int dx[4] = { 0,1,0,-1 }, dy[4] = { 1,0,-1,0 };
int popcnt(unsigned long long n) { int cnt = 0; for (int i = 0; i < 64; i++)if ((n >> i) & 1)cnt++; return cnt; }
int d_sum(LL n) { int ret = 0; while (n > 0) { ret += n % 10; n /= 10; }return ret; }
int d_cnt(LL n) { int ret = 0; while (n > 0) { ret++; n /= 10; }return ret; }
LL gcd(LL a, LL b) { if (b == 0)return a; return gcd(b, a%b); };
LL lcm(LL a, LL b) { LL g = gcd(a, b); return a / g*b; };
# define ALL(qpqpq)           (qpqpq).begin(),(qpqpq).end()
# define UNIQUE(wpwpw)        sort(ALL((wpwpw)));(wpwpw).erase(unique(ALL((wpwpw))),(wpwpw).end())
# define LOWER(epepe)         transform(ALL((epepe)),(epepe).begin(),TL<char>)
# define UPPER(rprpr)         transform(ALL((rprpr)),(rprpr).begin(),TU<char>)
# define FOR(i,tptpt,ypypy)   for(LL i=(tptpt);i<(ypypy);i++)
# define REP(i,upupu)         FOR(i,0,upupu)
# define INIT                 std::ios::sync_with_stdio(false);std::cin.tie(0)
# pragma warning(disable:4996)

const ULL B[] = { 999999937ULL,1000000007ULL };

//aはbに含まれているか?
bool contain(string a, string b) {
	int al = a.length(), bl = b.length();
	if (al > bl)return false;

	//Bのal乗を計算
	ULL t[] = { 1 ,1 };
	for (int i = 0; i < al; i++)t[0] *= B[0];
	for (int i = 0; i < al; i++)t[1] *= B[1];

	//aとbの最初のal文字に関するハッシュ値を計算
	ULL ah[] = { 0 ,0 }, bh[] = { 0 ,0 };
	for (int i = 0; i < al; i++)ah[0] = ah[0] * B[0] + a[i];
	for (int i = 0; i < al; i++)bh[0] = bh[0] * B[0] + b[i];
	for (int i = 0; i < al; i++)ah[1] = ah[1] * B[1] + a[i];
	for (int i = 0; i < al; i++)bh[1] = bh[1] * B[1] + b[i];

	//bの場所を1つずつ進めながらハッシュ値をチェック
	for (int i = 0; i + al <= bl; i++) {
		if (ah[0] == bh[0] && ah[1] == bh[1]) {
			cout << i << endl;
		}
		if (i + al < bl) {
			bh[0] = bh[0] * B[0] + b[i + al] - b[i] * t[0];
			bh[1] = bh[1] * B[1] + b[i + al] - b[i] * t[1];
		}
	}
	return false;//一致する文字列がない
}
string s, t;

int main() {
	cin >> s >> t;
	contain(t, s);
}


Measured memory_bytes: 3216
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<ctime>
#include<map>
#include<bitset>
#include<set>
#define LL long long
#define mp(x,y) make_pair(x,y)
#define pll pair<long long,long long>
#define pii pair<int,int>
using namespace std;
inline int read()
{
	int f=1,x=0;char ch=getchar();
	while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
	while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
	return x*f;
}
int stack[20];
template<typename T>inline void write(T x)
{
	if(x<0){putchar('-');x=-x;}
    if(!x){putchar('0');return;}
    int top=0;
    while(x)stack[++top]=x%10,x/=10;
    while(top)putchar(stack[top--]+'0');
}
template<typename T>inline void pr1(T x){write(x);putchar(' ');}
template<typename T>inline void pr2(T x){write(x);putchar('\n');}
const int MAXN=2005;
const int mod=1e9+7;
int f[2*MAXN][MAXN][2],n,m,K;
int pre[MAXN];
void ad(int &x,int y){x+=y;if(x>=mod)x-=mod;}
int main()
{
	n=read();m=read();K=read();
	f[0][0][0]=1;int lim=max(n,m)<<1;
	int ans=0;
	for(int i=1;i<=lim;i++)
	{
		for(int j=0;j<=m;j++)pre[j]=(f[i-1][j][0]+f[i-1][j][1])%mod;
		for(int j=1;j<=m;j++)ad(pre[j],pre[j-1]);
		for(int j=0;j<=m;j++)
		{
			f[i][j][0]=(f[i-1][j][0]+f[i-1][j][1])%mod;
			if(j)f[i][j][1]=(pre[j-1]-(j-K>=0?pre[j-K]:0)+mod)%mod;
			if(j%(K-1)==m%(K-1)&&i*(K-1)+1-j<=n&&(i*(K-1)+1-j)%(K-1)==n%(K-1))
				ad(ans,f[i][j][1]);
		}
	}pr2(ans);
	return 0;
}


Measured memory_bytes: 62848
#include <stdio.h>
#include <math.h>

int main()
{
	int debt = 100000;
  int i, n;
  int intr;

  scanf("%d", &n);
  for (i = 0; i < n; i++) {
		intr = (int)floor(debt * 0.05);
    if (intr % 1000 > 0) {
			intr /= 1000;
      intr++;
      intr *= 1000;
    }
    debt += intr;
  }

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

  return 0;
}

Measured memory_bytes: 592
#include<cstdio>
#include<string>
#include<iostream>
using namespace std;

string str;
int length, f=1;

void doit(int li,int ri) {
	while (li <= ri) {
		if (str[li] != str[ri]) f = 0;
		li++;
		ri--;
	}
}

int main()
{
	cin >> str;
	length = str.size();
	int a = (length - 1) / 2 - 1, b = a + 2;
	doit(0, length - 1);
	doit(0, a);
	doit(b, length - 1);
	if (f == 1) printf("Yes");
	else printf("No");
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n; cin >> n;
    vector<int> l(n);
    for(int i = 0; i < n; i++) cin >> l[i];
    sort(l.begin(), l.end());
    int sum = 0; for(int i= 0; i < n-1; i++) sum += l[i];
    if(l[n-1] < sum) puts("Yes");
    else puts("No");
    return 0;
}


Measured memory_bytes: 3608
#time gap
n=int(input())
lists=list(map(int,input().split()))
if n>24:
    print(0)
else:
    timelist=[0 for i in range(13)]
    #timelist[i]ってところでi=0,1,2,....12に代入する
    for i in lists:
        timelist[i]+=1
    flag=True
    for j in range(13):
        if j==0:
            if timelist[j]>0:
                flag=False
        else:
            if timelist[j]>2:
                flag=False
    if flag:
        uselist1=[]
        uselist2_=[]
        for i in range(13):
            if timelist[i]==1:
                uselist1.append((i))
            if timelist[i]==2:
                uselist2_.append((i))
            else:
                continue
        uselist2=[]
        for j in uselist2_:
            uselist2.append(j)
            uselist2.append(24-j)
        uselist2=list(set(uselist2))
        lens=len(uselist1)
        minilist=[]
        for i in range(2**lens):
            sublist=[0]
            mini=100
            sublist=sublist+uselist2
            j=format(i,"0%ib"%lens)
            for k in range(lens):
                if j[k]=="0":
                    sublist.append(uselist1[k])
                else:
                    sublist.append(24-uselist1[k])
            sublists=sorted(sublist)
            lenss=len(sublists)
            for k in range(1,lenss):
                mini=min(mini,sublists[k]-sublists[k-1])
            mini=min(mini,24-sublists[-1],sublists[-1])
            minilist.append(mini)  
        else:
            print(max(minilist))
    if not flag:
        print(0)


Measured memory_bytes: 40560
import bisect
n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
asu=[0]*(n+1)
bsu=[0]*(m+1)
for i in range(n):
    asu[i+1]=asu[i]+a[i]
for i in range(m):
    bsu[i+1]=bsu[i]+b[i]
ans=0
cnt=0
for i in range(n+1):
    lim=k-asu[i]
    if lim<0:break
    ans=max(ans,bisect.bisect_right(bsu,lim)+i-1)
print(ans)

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

using namespace std;

int main(){
    vector<int> a(3);
    int tmp;
    for (int i=0;i<3;i++){
            cin >> a.at(i);
    }
    if(a.at(0)>a.at(1)){
        tmp = a.at(0);
        a.at(0) = a.at(1);
        a.at(1) = tmp;
    }
    if(a.at(0)>a.at(2)){
        tmp = a.at(0);
        a.at(0) = a.at(2);
        a.at(2) = tmp;
        tmp = a.at(1);
        a.at(1) = a.at(2);
        a.at(2) = tmp;
        cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;
        return 0;
    }
    if(a.at(1)>a.at(2)){
        tmp = a.at(1);
        a.at(1) = a.at(2);
        a.at(2) = tmp;
        cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;
        return 0;
    }
    cout << a.at(0) << " " << a.at(1) << " " << a.at(2) << endl;

    return 0;
}


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

int main( void )
{
    char a, b;
    cin >> a >> b;
    if ( a == 'H' )
    {
        cout << b << endl;
    }
    else
    {
        if ( b == 'H' )
        {
            cout << 'D' << endl;
        }
        else
        {
            cout << 'H' << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 100005
using namespace std;

int M = 1e9 + 7;
int n, m, d[N] = {0, 1};
bool v[N];
int main()
{
	int i, t;
	cin >> n >> m;
	while (m--) scanf("%d", &t), v[t + 1] = 1;
	for (i = 2; i <= n + 1; i++) {
		if (!v[i]) d[i] = (d[i - 1] + d[i - 2]) % M;
	}
    cout << d[n + 1] << endl;
    return 0;
}

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

#define int             long long
#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define REPR( i, m )    for( int (i) = (m); (i) >= 0; (i)-- )
#define REPONE( i, n )  FOR( i, 1, n + 1 )
#define ALL( a )        (a).begin(), (a).end()
#define MP              make_pair

typedef pair<int, int> P;

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; }

const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    bool grid[120][120];
    int N, W, H, S, T;
    while( cin >> N, N ){
        fill( grid[0], grid[120], false );

        cin >> W >> H;
        REP( i, N ){
            int x, y; cin >> x >> y;
            grid[y][x] = true;
        }
        cin >> S >> T;

        int ans = 0;
        REPONE( i, H - T + 1 ){
            REPONE( j, W - S + 1 ){
                int t = 0;
                FOR( k, i, T + i ){
                    FOR( l, j, S + j ){
                        if( grid[k][l] ) t++;
                    }
                }
                chmax( ans, t );
            }
        }

        cout << ans << endl;
    }
}



Measured memory_bytes: 3056
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <functional>
#include <utility>
#include <tuple>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define PI 4*atan(1.0)
typedef long long ll;
typedef long double ld;
using namespace std;
int dx[4]={0,0,-1,1};
int dy[4]={-1,1,0,0};
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(a+b==c || b+c==a || c+a==b)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

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

static const size_t n_max = 500000;
static int S[n_max], L[n_max], R[n_max];
static int c = 0;

void merge_sort(size_t i, size_t j) {
  if (j - i <= 1)
    return;
  size_t k = (i + j) / 2;
  merge_sort(i, k);
  merge_sort(k, j);
  std::copy(S + i, S + k, L);
  std::copy(S + k, S + j, R);
  c += j - i;
  for (size_t l = i, p = 0, q = 0;; l++) {
    if (p < k - i && q < j - k) {
      if (L[p] <= R[q])
        S[l] = L[p++];
      else
        S[l] = R[q++];
    } else if (p < k - i)
      S[l]= L[p++];
    else if (q < j - k)
      S[l] = R[q++];
    else
      break;
  }
}

int main() {
  size_t n;
  scanf("%zu", &n);
  for (size_t i = 0; i < n; i++)
    scanf("%d", S + i);
  merge_sort(0, n);
  for (size_t i = 0; i < n - 1; i++)
    printf("%d ", S[i]);
  printf("%d\n%d\n", S[n-1], c);
  return 0;
}

Measured memory_bytes: 6472
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main()
{
	int n,d,x,y,i,c=0;

	scanf("%d%d",&n,&d);

	for(i=0;i<n;i++){
		scanf("%d%d",&x,&y);
		if(sqrt(pow(x,2)+pow(y,2))<=d)
			c++;
	}
	printf("%d",c);
	return 0;
}

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

int main() {
	int n;
	cin >> n;
	string s,a,b;
	cin >> s;
	if (n % 2 == 1) {
		cout << "No";
		return 0;
	}
	rep(i, n / 2) {
		a += s[i];
		b += s[n / 2 + i];
	}
	if (a == b)cout << "Yes";
	else cout << "No";
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Linq;
using BitArray = System.Collections.BitArray;
using BigInteger = System.Numerics.BigInteger;

namespace AtCoderProject
{
    public class Program
    {
        public object Calc()
        {
            var line = consoleReader.SplitInt32();
            var R = line[0];
            var G = line[1];
            var B = line[2];
            var N = line[3];

            var num = 0;
            for (int r = 0; r <= N / R; r++)
                for (int g = 0; g <= (N - r * R) / G; g++)
                {
                    var ball = r * R + g * G;
                    var nokori = N - ball;

                    int amari;
                    var b = Math.DivRem(nokori, B, out amari);
                    if (amari == 0)
                        num++;

                }
            return num;
        }

        private readonly ConsoleReader consoleReader;
        public Program() : this(new ConsoleReader()) { }
        public Program(ConsoleReader consoleReader) { this.consoleReader = consoleReader; }
        static void Main() => Console.WriteLine(new Program().Calc());
        public static string MultiLine<T>(IEnumerable<T> source) => string.Join("\n", source);
    }

    public class ConsoleReader
    {
        public virtual string String() => Console.ReadLine(); public int Int32() => int.Parse(String()); public long Int64() => long.Parse(String()); public ulong UInt64() => ulong.Parse(String()); public double Double() => double.Parse(String()); public string[] Split() => String().Split().ToArray(); public int[] SplitInt32() => String().Split().Select(int.Parse).ToArray(); public long[] SplitInt64() => String().Split().Select(long.Parse).ToArray(); public ulong[] SplitUInt64() => String().Split().Select(ulong.Parse).ToArray(); public double[] SplitDouble() => String().Split().Select(double.Parse).ToArray(); public IEnumerable<string> Repeat(int count) { for (int i = 0; i < count; i++) yield return String(); }
        public IEnumerable<int> RepeatInt32(int count) { for (int i = 0; i < count; i++) yield return Int32(); }
        public IEnumerable<long> RepeatInt64(int count) { for (int i = 0; i < count; i++) yield return Int64(); }
        public IEnumerable<string[]> RepeatSplit(int count) { for (int i = 0; i < count; i++) yield return Split(); }
        public IEnumerable<int[]> RepeatSplitInt32(int count) { for (int i = 0; i < count; i++) yield return SplitInt32(); }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
#include <vector>
#include <numeric>
#define PI 3.14159265358979323846
#define MAXINF (1e18L)
#define INF (1e9L)
#define EPS (1e-9)
#define MOD ((ll)(1e9+7))
#define REP(i, n) for(int i=0;i<int(n);++i)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define RREP(i, n) for(int i=int(n)-1;i>=0;--i)
#define ALL(v) v.begin(),v.end()
#define FIND(v,x) (binary_search(ALL(v),(x)))
#define SORT(v) sort(ALL(v))
#define RSORT(v) sort(ALL(v));reverse(ALL(v))
#define DEBUG(x) cerr<<#x<<": "<<x<<endl;
#define DEBUG_VEC(v) cerr<<#v<<":";for(int i=0;i<v.size();i++) cerr<<" "<<v[i]; cerr<<endl
#define Yes(n) cout<<((n)?"Yes":"No")<<endl
#define YES(n) cout<<((n)?"YES":"NO")<<endl
#define pb push_back
#define fi first
#define se second
using namespace std;
template<class A>void pr(A a){cout << (a) << endl;}
template<class A,class B>void pr(A a,B b){cout << a << " "  ;pr(b);}
template<class A,class B,class C>void pr(A a,B b,C c){cout << a << " " ;pr(b,c);}
template<class A,class B,class C,class D>void pr(A a,B b,C c,D d){cout << a << " " ;pr(b,c,d);}
template<class T> inline bool chmin(T& a, T b){return a>b ? a=b, true : false;}
template<class T> inline bool chmax(T& a, T b){return a<b ? a=b, true : false;}
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll,ll> pll;

int main(void)
{
    int n,m;
    cin >> n >> m;
    vector<pii> p(m);
    REP(i, m){
        cin >> p[i].fi >> p[i].se;
    }
    int lb = 1, ub = n;
    REP(i, m){
        chmax(lb, p[i].fi);
        chmin(ub, p[i].se);
        if(lb > ub) {
            pr(0);
            return 0;
        }
    }
    pr(ub - lb + 1);
}

Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <stdio.h>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <bitset>
#include <cmath>
#define ff first
#define ss second
#define MAXN 300005
#define INF 1000000001000000001LL
#define int long long

using namespace std;

const int mod = 998244353; //1000000007;
int n, i;
double ans = 0, a[1000];

main(){
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base :: sync_with_stdio(false);
    cin.tie();
    cin >> n;

    for(i = 0; i < n; i++)
        cin >> a[i];

    sort(a, a + n);

    for(i = 1; i < n; i++){
        a[i] = (a[i] + a[i - 1]) / 2;
    }

    cout << fixed << a[n - 1];

    return 0;
}







Measured memory_bytes: 256