akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
// Custom Header {{{
#define all(x)      x.begin(), x.end()
#define rep(i,n)    for (i64 i = 0; i < (n); ++i)
#define reps(i,s,t) for (i64 i = (s); i <= (t); ++i)
#define repr(i,s,t) for (i64 i = (s); i >= (t); --i)
#define LF          '\n'

#ifdef DBG
#define trace(...) _trace(#__VA_ARGS__, __VA_ARGS__);
#else
#define trace(...)
#endif

using namespace std;
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template<class T, class U>inline bool chmax(T &a, const U &b){return b>a ? (a=b,1) : 0;}
template<class T, class U>inline bool chmin(T &a, const U &b){return b<a ? (a=b,1) : 0;}
constexpr int INF  = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;

template<class T>
ostream& operator<< (ostream &os, const vector<T> &vec) {
    rep(i, vec.size()) os << vec[i] << (i+1 == vec.size() ? "" : " ");
    return os;
}

template<class T, class U>
ostream& operator<< (ostream &os, const pair<T, U> &p) {
    return os << p.first << ' ' << p.second;
}

template <class T>
void _trace(const char *s, T&& x)
{
    clog << '{';
    while(*s != '\0' && *s != ',') clog << *(s++);
    clog << ":" << setw(3) << x << '}' << endl;
}

template <class Head, class... Tail>
void _trace(const char *s, Head&& head, Tail&&... tail)
{
    clog << '{';
    while(*s != ',') clog << *(s++);
    clog << ":" << setw(3) << head << "}, ";
    for (++s; !isgraph(*s); ++s);
    _trace(s, std::forward<Tail>(tail)...);
}
// }}}

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

    string s;
    cin >> s;

    int ans = 0;
    rep(i, s.length()) {
        reps(j, 1, s.length()) {
            string t = s.substr(i, j);
            if (all_of(all(t), [](char c) { return (c == 'A' || c == 'C' || c == 'G' || c == 'T'); }))
                chmax(ans, t.length());
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <string>
#include <algorithm>
#include <set>
#include <vector>
#include <map>
#include <list>
#include <stack>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <queue>
#define REP(i, n) for(i=0; i<n; i++)
#define REPR(i, n) for(i=n; i>=0; i--)
#define FOR(i, m, n) for(i=m; i<n; i++)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define INF 1000000000
#define MOD 1000000007LL
#define MAX 100005
#define NIL -1
#define WHITE 0
#define GRAY 1
#define BLACK 2
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PA;
typedef priority_queue<ll> PQ;
typedef pair<double, double> doup;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll a[200000];

int main() {
    ll i, n;
    cin >> n;
    ll l=0, r=0;
    for(i=0; i<n; i++) {
        cin >> a[i];
    }
    ll ans=0;
    ll sum=0;
    for(l=0; l<n; l++) {
        while(r<n && (sum^a[r])==(sum+a[r])) {
            sum+=a[r];
            r++;
        }
        ans+=r-l;
        if(l==r) r++;
        else sum-=a[l];
    }
    
    cout << ans << endl;
}


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

using namespace std;

int main()
{
	long long n, a;
	cin >> n >> a;
	vector<long long> x(n);
	for (auto&& xi : x) cin >> xi;
	vector<vector<vector<long long>>> dp(51, vector<vector<long long>>(51, vector<long long>(2501, 0)));
	long long count = 0;
	dp[0][0][0] = 1;
	for (auto i = 1ll; i <= n; i++)
		for (auto j = 0ll; j <= i; j++)
			for (auto k = 0ll; k <= 2500ll; k++)
			{
				if (j > 0 && k >= x[i-1]) dp[i][j][k] = dp[i-1][j-1][k-x[i-1]];
				if (i > j) dp[i][j][k] += dp[i-1][j][k];
				if (i == n && j > 0 && j*a == k) count += max(0ll, dp[i][j][k]);
			}
	cout << count << endl;
	return 0;
}


Measured memory_bytes: 52224
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
	ll i, n;
	string s, s1;
	cin >> n;
	cin >> s >> s1;
	for( i = 0; i < n; i ++ ){
		cout << s[i] << s1[i];
	}
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long a = sc.nextLong();
        long b = sc.nextLong();
        if(a == 0){
            System.out.println("0");
        }else{
            long t = n / (a + b);
            long m = n % (a + b);
            long sum = t * a + Long.min(a, m);
            System.out.println(sum);
        }
    }
}

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

int main() {
  int R;
  cin>>R;
  
  if(R<1200){
    cout<<"ABC"<<endl;
  }
  else if(1200<=R && R<2800){
    cout<<"ARC"<<endl;
  }
  else{
    cout<<"AGC"<<endl;
  }
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();

        if(b>=a)
        {
            System.out.print("unsafe");
        }
        else
        {
            System.out.print("safe");
        }

    }
}

Measured memory_bytes: 35700
#include <iostream>

int main() {
    int64_t N, D, X, Y, cnt = 0LL;
    std::cin >> N >> D;
    for (int i = 0; i < N; i++) {
        std::cin >> X >> Y;
        if (X * X + Y * Y <= D * D) cnt++;
    }
    std::cout << cnt << std::endl;
}

Measured memory_bytes: 3596
import java.util.*;
import java.util.function.*;
import java.lang.*;
import java.math.*;
import java.io.*;


public class Main {
    static long divCeil(long a, long b){
        return (a+b-1)/b;
    }
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String N = sc.next();

        long digitSum = 0;
        for(int i=0; i<N.length(); i++) digitSum += (N.charAt(i)-'0');

        System.out.println(digitSum%9==0 ? "Yes" : "No");
        
    }
}


Measured memory_bytes: 40204
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#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 INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b,c;
	ll ans;

	cin >> a >> b >> c;
	if (a + b >= c)cout << "Yes" << endl;
	else cout << "No" << endl;



	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
char mi[105][105];
int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<n;i++)
        scanf("%s",mi[i]);
    for(int i=0;i<=n+1;i++)
    {
        for(int j=0;j<=m+1;j++)
        {
            if(i==0||i==n+1)
                printf("#");
            else if(j==0||j==m+1)
                printf("#");
            else
                printf("%c",mi[i-1][j-1]);
        }
        printf("\n");
    }
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <iostream>
#include <random>
#include <set>
#include <sstream>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
typedef long double LD;
using namespace std;
const int INF = 2147483647;
const int INF2 = 0x3f3f3f3f;
const ll INF64 = 1e18;
const double INFD = 1e30;
const double EPS = 1e-9;
const double PI = acos(-1);
const int MOD = 998244353;
template <typename T>
inline T read() {
    T X = 0, w = 0;
    char ch = 0;
    while (!isdigit(ch)) {
        w |= ch == '-';
        ch = getchar();
    }
    while (isdigit(ch)) X = (X << 3) + (X << 1) + (ch ^ 48), ch = getchar();
    return w ? -X : X;
}
const int MAXN = 200005;
int n, m, k;
int dr[4] = {1, 0, -1, 0};
int dc[4] = {0, 1, 0, -1};
int dr2[8] = {1, 1, 1, -1, -1, -1, 0, 0};
int dc2[8] = {1, 0, -1, 1, 0, -1, 1, -1};
int CASE = 1;
int arr[MAXN];
int a[MAXN];
int main() {
#ifdef LOCALLL
    freopen("in", "r", stdin);
    freopen("out", "w", stdout);
#endif
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &arr[i]);
        a[arr[i]]++;
    }
    ll ans = 0;
    for (int i = 1; i <= n; i++) {
        ans += (ll)a[i] * (a[i] - 1) / 2;
    }
    for (int i = 0; i < n; i++) {
        ll t = ans - a[arr[i]] + 1LL;
        printf("%lld\n", t);
    }
    return 0;
}

Measured memory_bytes: 3712
months, d = map(int, input().split())

ans_count = 0

for month in range(4, months + 1):
    for i in range(1, d + 1):
        if i <= 9:
            continue

        a, b = map(int, str(i))

        if a <= 1 or b <= 1:
            continue

        if a * b == month:
            ans_count += 1

print(ans_count)

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(false);
	cout.tie(NULL);
	cin.tie(NULL);

	string str;
	cin >> str;

	int begin = 0;
	int end = str.length() - 1;
	int answer = 0;

	while (begin <= end)
	{
		if (str[begin] != str[end]) answer++;
		begin++;
		end--;
	}
	
	cout << answer << endl;
	return 0;
}


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

#define rep(i, n) rep2(i, 0, n)
#define rep2(i, m, n) for (ll i = m; i < (n); i++)

using ll = long long;
using pii = pair<int, int>;
using Vi = vector<int>;


int main() {
  int a,b,c,d;
  cin >> a >>b>>c>>d;
  if(a+b>c+d) cout << "Left" << endl;
  if(a+b==c+d) cout << "Balanced" << endl;
  if(a+b<c+d) cout << "Right" << endl;
  
}
      

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

int main()
{
    long long int n,k;
    cin>>n>>k;
    vector<long long int > a;

    for(long long int i=0;i<n;i++)
    {
        long long int x;
        cin>>x;
        a.push_back(x);
    }
       bool dp[k+1];  
       for(long long int i=0;i<=k;i++)
         dp[i]=false;

         for(long long int i=0;i<=k;i++)
         {
            for(long long int j=0;j<a.size();j++)
            {
                if(i>=a[j] && !dp[i-a[j]])
                 dp[i]=true;
            }
         }
     if(dp[k])
      cout<<"First";
     else
      cout<<"Second"; 

         return 0;
}

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

using namespace std;

typedef long long ll;

const int MOD = 1000000007;

int main(){
  ll n,k;
  cin >> n >> k;
  ll ans = 0;
  for(ll i = k;i <= n + 1;i++){
    ll L = i * ( i - 1 ) / 2;
    ll R = (n * (n + 1) - ( n - i ) * ( n - i + 1)) / 2;
    ans = (ans % MOD + (R - L + 1) % MOD) % MOD;
  }
  cout << ans;
}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
using namespace std;
 
int main(){
  int N;
  cin >> N;
  
  int counter =0;
  for(int i=1 ; i<=N; ++i){
    if(to_string(i).size() % 2 == 1) counter++;
  }
  
  cout << counter << endl;
}

Measured memory_bytes: 256
import bisect,collections,copy,heapq,itertools,math,string
import sys
def S(): return sys.stdin.readline().rstrip()
def M(): return map(int,sys.stdin.readline().rstrip().split())
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LS(): return list(sys.stdin.readline().rstrip().split())
n = I()
s = S()
k = I()
c = s[k-1]
ans = ''
for x in s:
    if x == c:
        ans += x
    else:
        ans += '*'
print(ans)

Measured memory_bytes: 74624
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
#include<cstdlib>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(x) (x).begin(),(x).end()


pair<long long int,int> getans(long long int a) {
	if (a == 0) {
		return make_pair(0, 0);
	}
	else if (a == 1) {
		return make_pair(1, 0);
	}

}

int main() {
	while (1) {
		int n; cin >> n;
		if (!n)break;
		vector<int>ls;
		for (int i = 0; i < n; ++i) {
			int l; cin >> l;
			ls.push_back(l);
		}
		long double maxH =999999999;
		int anss, ansa, ansc;
		for (int s = 0; s < 16; ++s) {
			for (int a = 0; a < 16; ++a) {
				for (int c = 0; c < 16; ++c) {
					vector<int>rs(n+1);
					rs[0] = s;
					for (int i = 0; i < n; ++i) {
						rs[i + 1] = (rs[i] * a + c) % 256;
					}

					long double  H = 0;
					vector<int>os(256);
					for (int i = 0; i < n; ++i) {
						
						os[(ls[i] + rs[i+1]) % 256]+=1 ;
					}
					for (int i = 0; i < 256; ++i) {
						if (os[i])
							H -= os[i] / static_cast<long double>(n) * log(os[i] / static_cast<long double>(n));
					}
					if (H < maxH-0.00000001) {
						maxH = H;
						anss = s;
						ansa = a;
						ansc = c;
					}
				}
			}
		}
		cout << anss << " " << ansa << " " << ansc << endl;
	}
	
	return 0;
}

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

int main() {
  int a, b, c, x;
  cin >> a >> b >> c >> x;
  int ans = 0;
  for (int i = 0; i <= a; ++i) {
    for (int j = 0; j <= b; ++j) {
      for (int k = 0; k <= c; ++k) {
        int sum = (500 * i) + (100 * j) + (50 * k);
        if (sum == x) {
          ++ans;
        }
      }
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>

int main () {
	int n, a, b;
	scanf("%d %d %d", &n, &a, &b);
	
	
	int allSum = 0;
	for (int i = 1; i <= n; i++) {
		int digitSum = 0;
		int temp = i;
		while (temp != 0) {
			digitSum = digitSum + temp % 10;
			temp /= 10;
		}
		if (digitSum >= a && digitSum <= b) {
			allSum += i; 
		}
	}
	
	printf("%d", allSum);
	
	return 0;
}

Measured memory_bytes: 1708
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n, k;
	cin >> n >> k;
	int pos = -1;
	rep(i, n){
		int in;
		cin >> in;
		if(in == 1) pos = i;
	}
	int ans = 1001001001;
	rep(i, k){
		int llim = pos - i, rlim = pos - i + (k-1);
		if(n <= rlim || llim < 0) continue;
		int l = llim + 1, r = n - rlim;
		int kd = k-1;
		int add = 1;
		add += (l-1+kd-1)/kd;
		add += (r-1+kd-1)/kd;
		// cerr << i << " "<< l << " "<< r << " " << add << endl;
		ans = min(ans, add);
	}
	cout << ans << endl;
	return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

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

#define rep(a,n) for(ll a = 0;a < n;a++)

static const ll INF = 1e15;
static const ll mod = 1e9+7;

template<typename T>
static inline void chmin(T& ref, const T  value) {
    if (ref > value) ref = value;
}

template<typename T>
static inline void chmax(T& ref, const T value) {
    if (ref < value) ref = value;
}

struct RollingHash {
	typedef long long int_type;
	typedef pair<int_type, int_type> hash_type;

	int_type base1;
	int_type base2;
	int_type mod1;
	int_type mod2;

	vector<int_type> hash1;
	vector<int_type> hash2;
	vector<int_type> pow1;
	vector<int_type> pow2;

	RollingHash(const vector<ll>& s) : base1(1009), base2(1007), mod1(1000000007), mod2(1000000009) {
		init(s);
	}

	void init(const vector<ll>& s) {
		int n = s.size();
		hash1.assign(n + 1, 0);
		hash2.assign(n + 1, 0);
		pow1.assign(n + 1, 1);
		pow2.assign(n + 1, 1);
		for (int i = 0; i < n; i++) {
			hash1[i + 1] = ((hash1[i] + s[i] % mod1) % mod1) * base1 % mod1;
			hash2[i + 1] = ((hash2[i] + s[i] % mod2) % mod2) * base2 % mod2;
			pow1[i + 1] = pow1[i] * base1 % mod1;
			pow2[i + 1] = pow2[i] * base2 % mod2;
		}
	}

	hash_type get(int l, int r) const {
		int_type t1 = ((hash1[r] - hash1[l] * pow1[r - l] % mod1 + mod1) % mod1 + mod1) % mod1;
		int_type t2 = ((hash2[r] - hash2[l] * pow2[r - l] % mod2 + mod2) % mod2 + mod2) % mod2;
		return make_pair(t1, t2);
	}

	RollingHash::hash_type concat(hash_type h1, hash_type h2, int h2_len) {
		return make_pair((h1.first * pow1[h2_len] + h2.first) % mod1,
			(h1.second * pow2[h2_len] + h2.second) % mod2);
	}

	int LCP(const RollingHash& other, int l1, int r1, int l2, int r2) {
		int len = min(r1 - l1, r2 - l2);
		int low = -1, high = len + 1;
		while (high - low > 1) {
			int mid = (low + high) / 2;
			if (get(l1, l1 + mid) == other.get(l2, l2 + mid)) low = mid;
			else high = mid;
		}
		return (low);
	}
};

int main() {
	// a[i] ^ x, a[i+1] ^x
	// b[i]      , b[i+1]
	// (a[i] ^ x) ^ (a[i+1] ^ x) = b[i] ^ b[i+1]
	// a[i] ^ a[i+1] = b[i] ^ b[i+1]
	// 必要条件
	//かつ a[i] ^ x == b[i] となるxを取る。これは任意の数字を取れるので、
	//必要条件を満たすkを求めてから決めればよい。
	ll n;
	cin >> n;
	vector<ll> as(n), bs(n);
	rep(i, n) cin >> as[i];
	rep(i, n) cin >> bs[i];
	vector<ll> axor(n), bxor(n);
	rep(i, n) {
		axor[i] = as[(i + 1) % n] ^ as[i];
		bxor[i] = bs[(i + 1) % n] ^ bs[i];
	}
	axor.insert(axor.end(), axor.begin(), axor.end());
	bxor.insert(bxor.end(), bxor.begin(), bxor.end());
	RollingHash h1(axor), h2(bxor);
	P hash2 = h2.get(0, n);
	ll sum = 0;
	vector<P> ans;
	for (int i = 0; i < n; i++) {
		auto hash1 = h1.get(i, i + n);
		if (hash1 == hash2) {
			int k = i;
			ll x = as[k] ^ bs[0];
			ans.emplace_back(k, x);
		}
	}
	for (auto a : ans) {
		cout << a.first << " " << a.second << endl;
	}
	return 0;
}


Measured memory_bytes: 43924
#include <bits/stdc++.h>
#define ll long long
#define ls id << 1
#define rs id << 1 | 1
#define mem(array, value, size, type) memset(array, value, ((size) + 5) * sizeof(type))
#define memarray(array, value) memset(array, value, sizeof(array))
#define fillarray(array, value, begin, end) fill((array) + (begin), (array) + (end) + 1, value)
#define fillvector(v, value) fill((v).begin(), (v).end(), value)
#define pb(x) push_back(x)
#define st(x) (1LL << (x))
#define pii pair<int, int>
#define mp(a, b) make_pair((a), (b))
#define Flush fflush(stdout)
#define vecfirst (*vec.begin())
#define veclast (*vec.rbegin())
#define vecall(v) (v).begin(), (v).end()
#define vecupsort(v) (sort((v).begin(), (v).end()))
#define vecdownsort(v, type) (sort(vecall(v), greater<type>()))
#define veccmpsort(v, cmp) (sort(vecall(v), cmp))
using namespace std;
const int N = 500050;
const int inf = 0x3f3f3f3f;
const ll llinf = 0x3f3f3f3f3f3f3f3f;
const int mod = 998244353;
const int MOD = 1e9 + 7;
const double PI = acos(-1.0);
clock_t TIME__START, TIME__END;
void program_end()
{
#ifdef ONLINE
    printf("\nTime used: %.6lf(s)\n", ((double)TIME__END - TIME__START) / 1000);
    system("pause");
#endif
}
ll sum, a[N], ans;
int n;

inline void solve()
{
    cin >> n;
    for (int i = 1; i <= n; ++i)
        scanf("%lld", &a[i]), (sum += a[i])%=MOD;
    // sum -= a[1];
    for (int i = 1; i <= n; ++i)
    {
        sum -= a[i];
        sum = (sum + MOD) % MOD;
        ans += a[i] * sum % MOD;
        ans %= MOD;
    }
    cout << ans << endl;
}

int main()
{
    TIME__START = clock();
    int Test = 1;
    // scanf("%d", &Test);
    while (Test--)
        solve();
    TIME__END = clock();
    program_end();
    return 0;
}

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

int main(void){
  int N, K; cin >> N >> K;
  long long score=0,score2=0;
  vector<int> A(N+1,0);
  for(int i=1; i<=N; ++i){
    cin >> A[i];
    if(i<K)
      score2 += A[i];
    else
      score2 = (score2-A[i-K])+A[i];
    if(i>K){
      if(score2 > score)
        cout << "Yes" << endl;
      else
        cout << "No" << endl;
    }
    score = score2;
  }
  return 0;
}


Measured memory_bytes: 4048
#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)cin>>a[i];
	sort(a,a+n);
	int sum=0;
	for(int i=0;i<k;i++)sum+=a[i];
	cout<<sum<<"\n";
	return 0;
}

Measured memory_bytes: 3620
#include<iostream>
#include<cstdio>

using namespace std;

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


int main(){
		
	long long sum = 0;
	
	int k; cin >> k;

	for (int a = 1; a <= k; ++a)
		for (int b = 1; b <= k; ++b)
			for (int c = 1; c <= k; ++c)
				sum = sum + gcd(gcd(a,b),c);

	cout << sum << endl;

}


Measured memory_bytes: 3568
#include <bits/stdc++.h>
#define GET_REP(_1, _2, _3, NAME, ...) NAME
#define rep(...) GET_REP(__VA_ARGS__, irep, _rep)(__VA_ARGS__)
#define rep1(...) GET_REP(__VA_ARGS__, irep1, _rep1)(__VA_ARGS__)
#define _rep(i, n) irep (i, 0, n)
#define _rep1(i, n) irep1(i, 1, n)
#define irep(i, a, n) for (int i = a; i < (int)(n); ++i)
#define irep1(i, a, n) for (int i = a; i <= (int)(n); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep1(i, n) for (int i = (int)(n); i >= 1; --i)
#define allrep(X, x) for (auto &&X : x)
#define all(x) (x).begin(), (x).end()
#ifdef LOCAL
  #include "../../Lib/cout_container.hpp"
  #define debug(x) cerr << #x " => " << x << endl
#else
  #define debug(x) 0
#endif
using lint = long long;
constexpr int    INF  = 1 << 30;
constexpr lint   INFL = 1LL << 62;
constexpr int    MOD  = (int)1e9 + 7;
constexpr double EPS  = 1e-9;
using namespace std;
namespace { struct INIT { INIT() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } INIT; }

int main(void) {
  int n, k, q;
  cin >> n >> k >> q;
  vector<int> a(q);
  rep (i, q) cin >> a[i];
  vector<int> ans(n + 1, k - q);
  rep (i, q) ++ans[a[i]];
  rep1 (i, n) cout << (ans[i] > 0 ? "Yes" : "No") << "\n";
  return 0;
}

Measured memory_bytes: 1408
// May this submission get accepted!

#pragma GCC optimize ("O3")
#pragma GCC target ("tune=native")
#pragma GCC target ("avx")

#include <bits/stdc++.h>

// 汎用マクロ
#define ALL_OF(x) (x).begin(), (x).end()
#define REP(i,n) for (long long i=0, i##_len=(n); i<i##_len; i++)
#define RANGE(i,is,ie) for (long long i=(is), i##_end=(ie); i<=i##_end; i++)
#define DSRNG(i,is,ie) for (long long i=(is), i##_end=(ie); i>=i##_end; i--)
#define STEP(i, is, ie, step) for (long long i=(is), i##_end=(ie), i##_step = (step); i<=i##_end; i+=i##_step)
#define UNIQUE(v) do { sort((v).begin(), (v).end()); (v).erase(unique((v).begin(), (v).end()), (v).end()); } while (false)
template<class T> bool chmax(T &a, const T &b) { if (a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) {a = b; return true;} return false; }
#define INF 0x7FFFFFFF
#define LINF 0x7FFFFFFFFFFFFFFFLL
#define Yes(q) ((q) ? "Yes" : "No")
#define YES(q) ((q) ? "YES" : "NO")
#define Possible(q) ((q) ? "Possible" : "Impossible")
#define POSSIBLE(q) ((q) ? "POSSIBLE" : "IMPOSSIBLE")
#define DUMP(q) cerr << "[DEBUG] " #q ": " << (q) << " at " __FILE__ ":" << __LINE__ << endl
#define DUMPALL(q) do { cerr << "[DEBUG] " #q ": ["; REP(DUMPALL_ITR, (q).size()) { cerr << (q)[DUMPALL_ITR] << (DUMPALL_ITR == DUMPALL_ITR_len-1 ? "" : ", "); } cerr << "] at " __FILE__ ":" << __LINE__ << endl; } while (false)
template<class T> T gcd(T a, T b) { if (a < b) std::swap(a, b); while (b) std::swap(a %= b, b); return a; }
template<class T> T lcm(const T a, const T b) { return a / gcd(a, b) * b; }

// gcc拡張マクロ
#define popcount __builtin_popcount
#define popcountll __builtin_popcountll

// エイリアス
#define DANCE_ long
#define ROBOT_ unsigned
#define HUMAN_ signed
using  ll = DANCE_ HUMAN_ DANCE_;
using ull = DANCE_ ROBOT_ DANCE_;
using  ld = long double;
using namespace std;

// モジュール

// 処理内容
int main() {
    
    // インタラクティブ問題では除去した方がいいかも
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll t1, t2; cin >> t1 >> t2;
    ll a1, a2; cin >> a1 >> a2;
    ll b1, b2; cin >> b1 >> b2;

    ll da = a1 * t1 + a2 * t2;
    ll db = b1 * t1 + b2 * t2;
    if (da == db) {
        cout << "infinity" << endl;
        return 0;
    }
    
    ll d1 = (a1 - b1) * t1;
    ll d2 = (a2 - b2) * t2;
    ll dn = d1 + d2;

    if ((d1 > 0) == (dn > 0)) {
        cout << 0 << endl;
        return 0;
    }
    
    if (d1 > 0) {
        d1 *= -1;
        d2 *= -1;
    }
    
    ll ans1 = abs(d1 / dn);
    ll ans2 = abs(d2 / dn);

    cout << ans1 + ans2 - (abs(d1) % dn == 0) << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<string.h>
using namespace std;
#define pb push_back
#define all(v) v. begin(),v. end()
#define  rep(i,n,v) for(i=n;i<v;i++)
#define per(i,n,v) for(i=n;i>v;i--)
#define ff first 
#define ss second 
#define pp pair<ll,ll>
#define ll  long long
#define endl '\n'
void solve()
{
  ll n, a,m=0,b=1, c,k=0, i, j,l=1e9+7;
  string s, r, y;
  cin>>n>>m>>a;
    cout<<(m/a)-n/a+(n%a==0);
}
int main()
{
 ios_base::sync_with_stdio(false);
  cin. tie(0);cout. tie(0);
    ll t=1;
  // cin>>t;
    while(t--)
    {
      solve();
      
    }
    return 0;
}

Measured memory_bytes: 3640
h, w, k = map(int, input().split())
ans = []
color = 0
count = 0
for i in range(h):
    line = input()
    strawberry = [i for i in range(w) if line[i] == '#']
    if not strawberry:
        count += 1
        continue
    paint = []
    now = -1
    for pos in strawberry:
        color += 1
        paint += [color] * (pos - now)
        now = pos
    paint += [color] * (w-now-1)
    ans.append(paint)
    for _ in range(count):
        ans.append(paint)
    count = 0

for i in range(count):
    ans.append(ans[-1])

for line in ans:
    print(' '.join(map(str, line)))

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

int main(){
	int n;
	cin >> n;
	vector<int>c(n), s(n), f(n);
	for (int i = 0;i < n - 1;i++) {
		cin >> c[i] >> s[i] >> f[i];
	}

	for (int i = 0;i < n;i++) {
		int ans = 0;
		for (int j = i;j < n - 1;j++) {
			if (ans <= s[j]) {
				ans = s[j];
			}
			else {
				int start = s[j];
				while (ans > start) {
					start += f[j];
				}
				ans = start;
			}
			ans += c[j];
		}
		cout << ans << endl;
	}

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	int n, m, i, j, k;
	cin >> n >> m;
	vector<string> s(n);
	for (i = 0; i < n; i++) cin >> s[i];
	for (i = 0; i < n; i++) cout << s[i] << "\n" << s[i] << "\n";


	return 0;
}



Measured memory_bytes: 256
S=str(input())
M=int(S[0])*10+int(S[1])
Y=int(S[2])*10+int(S[3])
if M<=12 and M>0:
    if Y<=12 and Y>0:
        print('AMBIGUOUS')
    else:
        print('MMYY')
else:
    if Y<=12 and Y>0:
        print('YYMM')
    else:
        print('NA')

Measured memory_bytes: 3060
package main
import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var H, W int
  NextInt(&H, &W)
  A := make([]string, H)
  for i := range A {
    A[i] = NextLine()
  }
  B := make([][][]string, 2)
  for i := range B {
    B[i] = make([][]string, H)
    for j := range B[i] {
      B[i][j] = make([]string, W)
      for k := range B[i][j] { B[i][j][k] = "." }
    }
  }
  for j := 1; j < H - 1; j++ {
    B[0][j][0] = "#"
    B[1][j][W - 1] = "#"
    for k := 1; k < W - 1; k++ { B[j % 2][j][k] = "#" }
  }
  for j := range A {
    for k, a := range A[j] {
      if a == '#' {
        B[0][j][k] = "#"
        B[1][j][k] = "#"
      }
    }
  }
  for _, b := range B[0] { Write(strings.Join(b, "")) }
  Write("")
  for _, b := range B[1] { Write(strings.Join(b, "")) }
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntVec(A *[]int) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatVec(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(s interface{}) {
  fmt.Fprintln(writer, s)
}
func WriteIntVec(A []int) {
  S := make([]string, len(A))
  for i, a := range A {
    S[i] = strconv.Itoa(a)
  }
  Write(strings.Join(S, " "))
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using p = pair<int, int>;
#define INF 1001001001
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define repX(i, n ,x) for (int i = x; i < (int)(n); ++i)
#define repBack(i, n) for (int i = n; i >= 0; --i)
#define dup(x,y) (((x)+(y)-1)/(y))

int main() {
    int A,B,C,K;
    cin >> A >> B >> C >> K;
    ll ans = 0;
    if(K-A<=0){
        cout << K << endl;
        return 0;
    }else{
        ans += A;
        K -= A;
    }
    if(K-B<=0){
        cout << ans << endl;
        return 0;
    }else{
        K-=B;
    }
    cout << ans - K << endl;

    return 0;
}

Measured memory_bytes: 3592
#!/usr/bin/env python3
from collections import deque, Counter
from heapq import heappop, heappush
from bisect import bisect_right,bisect_left
from itertools import accumulate

def main():
    N = int(input())
    A = list(map(int, input().split()))
    # B = sorted(accumulate(A))
    A = [0] + list(accumulate(A))
    ans = 0
    # print(B,A)
    for l in Counter(A).values():
        # print(l)
        ans += l*(l-1)//2
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 37648
#include<iostream>

char a;
int main()
{
	std::cin >> a;

	if(a == 'A')
	{
		std::cout << "T";
	}
	else if(a == 'C')
	{
		std::cout << "G";
	}
	else if(a == 'G')
	{
		std::cout << "C";
	}
		else if(a == 'T')
	{
		std::cout << "A";
	}

}

Measured memory_bytes: 256
const input = require("fs").readFileSync("/dev/stdin", "utf8")

;(input => {
 
    const lines = input.split('\n')
    const N = lines[0] - 0
    const S = lines

    let c = 0
    const m = {}
    for (let i = 1; i <= N; i++) {
        if (!m[S[i]]) {
            m[S[i]] = 1
            c++
        }
    }
    console.log(c)
 
})(input)


Measured memory_bytes: 79868
# include<bits//stdc++.h>
using namespace std;
int main()
{
    int a, b;
    cin >> a >> b;
    char c[a][b];
    for (int i = 0; i < a; i++)
    {
        string d;
        cin >> d;
        for (int j = 0; j < b; j++)
        {
            c[i][j] = d[j];
        }
    }
    int f = 0, e = 10000000;
    for (int i = 1; i <= a - 2; i++)
    {
        f = 0;
        for (int z = 0; z < i; z++)
        {
            for (int g = 0; g < b; g++)
            {
                if (c[z][g] != 'W') { f++; }
            }
        }
        for (int j = 1; j <= a - i - 1; j++)
        {
            int h = f;
            for (int z = 0; z < j; z++)
            {
                for (int g = 0; g < b; g++)
                {
                    if (c[z + i][g] != 'B') { h++; }
                }
            }
            int k = a - i - j;
            for (int z = 0; z < a - i - j; z++)
            {
                for (int g = 0; g < b; g++)
                {
                    if (c[z + i + j][g] != 'R') { h++; }
                }
            }
            if (h < e) {e = h;}
        }
    }
    cout << e << endl;
}

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

using namespace std;

int main(){
    int A, B;
    string S, T, U;
    cin >> S >> T;
    cin >> A >> B;
    cin >> U;
    if(S == U){
        A--;
    }
    else{
        B--;
    }
    cout << A << " " << B << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define forr(i, a, b) for(int i = (a); i < (b); i++)
#define rep(i,n) for(int i = 0; i < (n); i++)
#define rrep(i,n) for(int i = 1; i <= (n); i++)
#define ALL(a) (a.begin()),(a.end())
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll, ll> LP;
const ll LINF = 1LL<<60;
const int INF = 1001001001;
const int MOD = 1000000007;

/* --------------------------------------------------- */


int main() {
    int n;
    cin >> n;
    vector<int> A(n);
    rep(i, n) cin >> A[i];
    sort(ALL(A), greater<int>());
    int Alice = 0, Bob = 0;
    rep(i, n) {
        if(i % 2 == 0) Alice += A[i];
        else Bob += A[i];
    }
    cout << Alice - Bob << endl;
    
    return 0;
}

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

int main() {
    int n;
    cin >> n;
    int tot = 0;
    int L[n];
    rep(i,n) {
        cin >> L[i];
        tot += L[i];
    }

    rep(i,n) {
        if ( tot-L[i] <= L[i]) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 256
import math
s = list(input())

total = 753
for i in range(len(s) - 2):
    a = int(s[i]) * 100 + int(s[i+1]) * 10 + int(s[i+2])
    if total >= abs(a - 753):
        total = abs(a - 753)

print(total)


Measured memory_bytes: 2940
// In the name of God

#include <bits/stdc++.h>

using namespace std;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	long long n;
	cin >> n;
	

	auto dgs = [](long long x) {
		int c = 0;
		while(x) {
			c++;
			x /= 10;
		}
		return c;
	};

	int ans = 1e9;

	for(long long i = 1; i * i <= n; i++) {
		if(n % i != 0) continue;
		long long ot = n / i;
			
		ans = min(ans, max(dgs(i), dgs(ot)));

	}

	cout << ans;
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<math.h>
#include<queue>
#include<map>
#include<unordered_map>
#include<iomanip>
#include<sstream>

using namespace std;

#define P 1009

// struct Node{
//   string s;
//   int num;
//   bool operator < (const Node& N) const {
//     if(s < N.s){
//       return true;
//     }
//     if(s > N.s){
//       return false;
//     }
//     return false;
//   }
// };

struct Node{
  int s;
  int num;
  bool operator==(const Node &left) const {return this->s == left.s;}
};

struct Graph{
  int num;
  Graph(){
    num = 0;
  }
  queue< Node > free;
  // map<string, int> inpath;
  // map<string, vector<Node> > outpath;
  unordered_map<int, int> inpath;
  unordered_map<int, vector<Node> > outpath;
};

int main(){
  int n; cin >> n;
  Graph G;
  vector< Node > last(n, {-1, -1});
  for(int i = 0; i < n ; i++){
    for(int j = 0; j < n-1; j++){
      int t; cin >> t; t--;
      int a = min(i,t);
      int b = max(i,t);
      int s = a * P + b;
      // ostringstream A,B;
      // A << setw(4) << setfill('0') << a << endl;
      // B << setw(4) << setfill('0') << b << endl;
      // string s = A.str() + B.str();
      if(a == i){
        G.inpath[(Node){s, 0}.s] = 0;
      }
      if(last[i].s != -1){
        G.outpath[last[i].s].push_back((Node){s, 0});
        G.inpath[(Node){s, 0}.s]++;
      }
      if(i == b && G.inpath[(Node){s, 0}.s] == 0) G.free.push((Node){s, 0});
      last[i] = (Node){s, 0};
    }
  }
  int ans = 0;
  while(!G.free.empty()){
    Node now = G.free.front();
    G.free.pop();
    G.num++;
    ans = now.num;
    for(auto to : G.outpath[now.s]){
      G.inpath[to.s]--;
      if(G.inpath[to.s] == 0){
        to.num = max(to.num, now.num + 1);
        G.free.push(to);
      }
    }
  }
  if(G.num != n*(n-1)/2){
    cout << -1 << endl;
  }
  else{
    cout << ans+1 << endl;
  }
}


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

int main(){

  map<int ,int > stu;
  
  int n;
  
  cin >> n;
  
  rep(i,n){
    int a;
    cin >> a;
    stu.insert(make_pair(a,i));
  }
  
  rep(i,n){
    cout << stu[i+1] + 1 << " " ;
  }
    
    return 0;
}




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

using namespace std;
typedef long long ll;

int main()
{
	int K;
	string S;
	cin >> K >> S;
	if(S.length() <= K){
		cout << S << endl;
	}else{
		for(int i = 0; i < K; i++){
			cout << S[i];
		}
		cout << "..." << endl;
	}
	
	return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
int main(){
int w,h,x,y,r;
scanf("%d %d %d %d %d",&w,&h,&x,&y,&r);
if(y+r<=h && y-r>=0 && x+r<=w && x-r>=0) {
printf("Yes\n");
}
else 
printf("No\n");

return 0;
}


Measured memory_bytes: 2136
#include<bits/stdc++.h>
#define maxn 200100
using namespace std;
int a[maxn],b[maxn],c[maxn],n,m,sum;
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i)
		scanf("%d",&c[i]),a[c[i]]++;
	for(int i=1;i<=n;++i)
		for(int j=i;j>=i-a[i]+1&&j>=0;j--)b[j]++;
	for(int i=1;i<=n;++i)if(b[i])sum++;
	for(int i=1,x,y;i<=m;++i){
		scanf("%d%d",&x,&y);
		int nwsum=sum;
		if(c[x]-a[c[x]]+1>=1&&b[c[x]-a[c[x]]+1]==1)nwsum--;
		if(c[x]-a[c[x]]+1>=1)b[c[x]-a[c[x]]+1]--;
		a[c[x]]--;
		if(y-a[y]>=1&&!b[y-a[y]])nwsum++;
		if(y-a[y]>=1)b[y-a[y]]++;
		a[y]++;
		c[x]=y;
	//	for(int j=1;j<=n;++j)printf("%d ",c[j]);puts("");
		printf("%d\n",n-nwsum);
		sum=nwsum;
	}
}

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

int main(){
	double x[4];
	double y[4];
	double ab_x,ab_y;
	double cd_x,cd_y;
	int n,i,j;
	scanf("%d",&n);
	for(i=0; i<n; i++){
		for(j=0; j<4; j++)scanf("%lf %lf",&x[j],&y[j]);
		ab_x=x[1]-x[0];
		ab_y=y[1]-y[0];
		cd_x=x[3]-x[2];
		cd_y=y[3]-y[2];
		if(fabs(ab_x*cd_y-ab_y*cd_x)<0.0000000001)printf("YES\n");
		else printf("NO\n");
	}
	return 0; 
}

Measured memory_bytes: 620
#b = int(input())
#n, m = [int(i) for i in input().split()]
#table = [[int(i) for i in input().split()] for j in range(n)]

n = int(input())
l = [int(i) for i in input().split()]

count = 0
for i in range(n-2):
    for j in range(i,n-1):
        for k in range(j,n):
            if(l[i] != l[j] and l[j] != l[k] and l[k] != l[i]):
                if(l[i] + l[j] + l[k] > 2 * max(l[i],l[j],l[k])):
                    count += 1

print(count)

Measured memory_bytes: 68616
#include<bits/stdc++.h>
#define rep(i,m) for(long long i=0; i<m; i++)
#define per(i,m) for(long long i=m-1; i>=0; i--)
#define FOR(i,n,m) for(long long i=n; i<m; i++)
#define ROF(i,n,m) for(long long i=n-1; i>=m; i--)
#define all(x) (x).begin(),(x).end()
#define EPS (1e-7)
#define INF (1e18)
#define PI (acos(-1))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
typedef pair<ll, ll> LP;

ll POW(ll x,ll n){
  if(n==0)return 1;
  if(n%2==0)return POW(x*x%MOD,n/2);
  return x*POW(x,n-1)%MOD;
}

ll gcd(ll u, ll v) {
  ll r;
  while (0 != v) {
    r = u % v; u = v; v = r;
  }
  return u;
}
 
ll KAI(ll m)
{
  if(m<0) return 0;
  if(m==0) return 1;
  return m*KAI(m-1)%MOD;
}
 
ll extGCD(ll a, ll b, ll &x, ll &y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    ll d = extGCD(b, a%b, y, x);
    y -= a / b * x;
    return d;
}
 
inline ll mod(ll a, ll m) {
    return (a % m + m) % m;
}
 
ll modinv(ll a) {
    ll x, y;
    extGCD(a, MOD, x, y);
    return mod(x, MOD);
}
 
ll COM(ll m,ll n)
{
  if(m<n) return 0;
  if(n<0) return 0;
  if(n==0) return 1;
  if(m==n) return 1;
  return KAI(m)%MOD*modinv(KAI(n)%MOD*KAI(m-n)%MOD)%MOD;
}

ll DEC(ll x,ll m,ll n)
{
  return x%POW(m,n+1)/POW(m,n);
}

ll keta(ll x,ll n)
{
  if(x==0)return 0;
  return keta(x/n,n)+1;
}

ll DIV(ll x,ll n)
{
  if(x==0)return 0;
  return x/n+DIV(x/n,n);
}


int main()
{
  string s;
  cin >> s;
  rep(i,s.length())if(i%2==0)cout << s[i];
}

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

#define loop(s, e, i) for (int i = s; i < e; ++i)
#define print(s) cout << s << endl;
#define DIV 1000000007
#define ll = long long
using namespace std;

/*
浮動小数点の入力
cout << fixed << setprecision(9) << endl;
*/

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

  int score = 0;
  loop(0, S.size(), i) {
    loop(i, S.size(), j) {
      if (S[j] == 'A' || S[j] == 'G' || S[j] == 'C' || S[j] == 'T') {
        score = max(score, j-i+1);
        continue;
      }
      break;
    }
  }
  print(score);
}


Measured memory_bytes: 3524
n,w = map(int,input().split())
weight = [0 for i in range(n)]
value = [0 for i in range(n)]
for i in range(n):
    weight[i],value[i] = map(int,input().split())
    
 
#dp[i][j]: i番目の品物までの中から選び、重さがj以下になる時の、価値の総和の最大値
dp = [[0 for i in range(w+1)] for j in range(n+1)]
 
for i in range(n):
    for j in range(w+1):
        if j - weight[i] >= 0:
            dp[i+1][j] = max(dp[i][j-weight[i]]+value[i],dp[i][j])
        else:
            dp[i+1][j] = dp[i][j]
            
print(dp[n][w])

Measured memory_bytes: 173448
#include "bits/stdc++.h"
#define rep(i,b) for(ll i=0;i<b;i++)
#define ll long long
using namespace std;
/*--Input//////////////////////////////////////////////////*/
inline void IN(void){return;}
template <typename First, typename... Rest>
void IN(First& first, Rest&... rest){cin >> first;IN(rest...);return;}
#define SS(T, ...)      T __VA_ARGS__; IN(__VA_ARGS__);
#define SV(type,c,n) vector<type> c(n);for(auto& i:c)cin >> i;
/*--Output/////////////////////////////////////////////////*/
inline int p(void){cout << endl; return 0;}
template<class Head> int p(Head&& head){cout << head;p();return 0;} template<class Head,class... Tail> int p(Head&& head,Tail&&... tail){cout<<head<<" ";p(forward<Tail>(tail)...);return 0;}
struct ProconInit {
    static constexpr bool AUTOFLUSH = false;
    ProconInit() {
        cin.tie(nullptr);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
        if(AUTOFLUSH)
            cout << unitbuf;
    }
} PROCON_INIT;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define vl vector<ll>
#define debug(x) cerr<<#x<<" "<<x<<'\n';
#define all(x) (x).begin(),(x).end()
#define bit(n) (1LL<<(n))
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; }
bool cmp(pair<ll,ll> a, pair<ll,ll> b) { return a.first+a.second > b.first+b.second; }

signed main() {
  SS(int,h,w);
    int cnt=0;
  	for(int i=0;i<h;i++){
    	for(int j=0;j<w;j++){
       		SS(char,c);
          	if(c=='#')cnt++;
        }
    }
  cout<<(cnt==h+w-1?"Possible":"Impossible")<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
     
     
const int MAX_V = 210;
const int INF = 1e9;
     
struct edge {
  int to, cap, rev;
};
     
vector<edge> G[MAX_V];
bool used[MAX_V];
     
void add_edge(int from, int to, int cap) {
  G[from].push_back((edge){to, cap, (int)G[to].size()});
  G[to].push_back((edge){from, 0, (int)(G[from].size() - 1)});
}
     
int dfs(int v, int t, int f) {
  if (v == t) return f;
  used[v] = true;
  for (int i = 0; i < G[v].size(); i++) {
    edge &e = G[v][i];
    if (!used[e.to] && e.cap > 0) {
      int d = dfs(e.to, t, min(f, e.cap));
      if (d > 0) {
	e.cap -= d;
	G[e.to][e.rev].cap += d;
	return d;
      }
    }
  }
  return 0;
}
     
int max_flow(int s, int t) {
  int flow = 0;
  for (;;) {
    memset(used, 0, sizeof(used));
    int f = dfs(s, t, INF);
    if (f == 0) return flow;
    flow += f;
  }
}
     
int main() {
  int n;
  cin >> n;
  vector<int> a(n), b(n), c(n), d(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; i++) {
    cin >> c[i] >> d[i];
  }
     
  int start = 0;
  int goal = 2*n+1;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a[i] < c[j] and b[i] < d[j]) {
	add_edge(i+1, n+j+1, 1);
      }
    }
  }
     
  for (int i = 0; i < n; i++) {
    add_edge(0, i+1, 1);
    add_edge(n+i+1, 2*n+1, 1);
  }
     
  cout << max_flow(start, goal) << endl;
     
  return 0;
}


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

using namespace std;

#define REP(var, n)  for (int var = 0; var < (n); var++)
#define RREP(var, n)  for (auto var = n - 1; var != static_cast<int>(-1); var--)
#define FOR(var, a, b)  for (auto var = (a); var < (b); var++)
#define RFOR(var, a, b)  for (auto var = b - 1; var != a; var--)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pii;

#define all(c) begin(c),end(c)

#define D(x) do { std::cerr << x << " "; } while (0)
#define D2(x) do { std::cerr << #x << ": " << x << std::endl; } while (0)


template<typename T>
std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) {
    if (!v.empty()) {
        out << '[';
        std::copy(v.begin(), v.end(), std::ostream_iterator<T>(out, ", "));
        out << "\b\b]";
    }
    return out;
}


template<typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
    return os << '(' << p.first << ',' << p.second << ')';
}


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

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

vvll mul(vvll a, vvll b, int M) {
    int NR = a.size();
    int NC = a[0].size();
    int NL = b[0].size();
    vvll res(NR, vll(NL, 0));

    REP(i, NR) {
        REP(j, NL) {
            ll sum = 0;
            REP(t, NC) {
                sum += a[i][t] * b[t][j];
                sum %= M;
            }
            res[i][j] = sum;
        }
    }

    return res;
}

vvll matfpow(vvll a, ll k, int M) {
    int NR = a.size();
    int NC = a[0].size();

    vvll t(NR, vll(NC, 0));
    REP(i, NR) REP(j, NC) t[i][j] = a[i][j];

    vvll res(NR, vll(NC, 0));
    REP(i, NR) res[i][i] = 1;

    while (k > 0) {
        if (k % 2 == 1) {
            res = mul(res, t, M);
        }
        t = mul(t, t, M);
        k >>= 1;
    }

    return res;
}

auto solve() {
    const int MOD = 1e9 + 7;

    int N; ll K;
    cin >> N >> K;

    vvll a(N, vll(N));
    REP(i, N) REP(j, N) cin >> a[i][j];

    vvll p = matfpow(a, K, MOD);
    vvll zero (N, vll(1, 1));
    vvll res = mul(p,zero, MOD);

    ll sum = 0;
    REP(i,N) {
        sum += res[i][0];
        sum %= MOD;
    }

    return sum;
}


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

//    cout << (solve() ? "Heisei" : "TBD") << endl;
//    cout << (solve() ? "YES" : "NO") << endl;
    cout << solve() << endl;
//    solve();

    return 0;
}

Measured memory_bytes: 384
import math
from decimal import *

numbers = [int(i) for i in input().split()]

diff = numbers[1] - numbers[2]

if numbers[0] <= numbers[1]:
    print("1")
elif diff <= 0:
    print("-1")
else:
    print(math.ceil(Decimal(numbers[0] - numbers[1]) / diff) * 2 + 1)

Measured memory_bytes: 5332