akhauriyash/Code-Regression huggingface dataset:
N, K = map(int, input().split())
sumR = 0
for i in range(K, N+2):
    front = i*(2*N + 2 - i + 1)/2
    rear = i*(i+1)/2
    number = front - rear + 1
#    print (i)
#    print (number)
    sumR += number
print (int(sumR%(1000000007)))

Measured memory_bytes: 9192
#include<iostream>
#include<vector>
#include<algorithm>
#include<cctype>
#include<utility>
#include<string>
#include<cmath>
#include<cstring>
#include<queue>
#include<map>
#include<set>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)

using namespace std;
typedef pair<int, int> pii;

typedef long long int ll;



template<typename T>
vector<T> make_v(size_t a) { return vector<T>(a); }
template<typename T, typename... Ts>
auto make_v(size_t a, Ts... ts) {
	return vector<decltype(make_v<T>(ts...))>(a, make_v<T>(ts...));
}
template<typename T, typename V>
typename enable_if<is_class<T>::value == 0>::type
fill_v(T& t, const V& v) { t = v; }
template<typename T, typename V>
typename enable_if<is_class<T>::value != 0>::type
fill_v(T& t, const V& v) {
	for (auto& e : t) fill_v(e, v);
}


#define ARRAY_MAX 100005
const ll INF = 1e9 + 7;




/*素数のみの配列を返す*/
vector<ll> Eratosthenes(ll n, vector<ll>& arr) {

	for (ll i = 0; i <= n; i++) {
		arr[i] = 1;
	}

	for (ll i = 2; i <= sqrt(n); i++) {
		if (arr[i]) {
			for (ll j = 0; i * (j + 2) < n; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}
	vector<ll> prime;
	for (int i = 2; i < arr.size(); i++) {
		if (arr[i]) {
			prime.push_back(i);
		}
	}
	return prime;
}



int main() {


	ll n;
	cin >> n;
	vector<ll> vec(60000, 1);
	vector<ll> num = Eratosthenes(55555, vec);


	ll cnt = 0;
	vector<ll> ans;
	for (int i = 0; i < num.size(); i++)
	{
		if ((num[i] % 5) == 1)
		{
			ans.push_back(num[i]);
		}
	}

	for (int i = 0; i < n; i++)
	{
		if (i == 0)
		{
			cout << ans[i];
		}
		else
		{
			cout << " " << ans[i];
		}
	}
	cout << endl;


	return 0;
}





Measured memory_bytes: 896
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskB {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            char arr[] = in.next().toCharArray();
            int alphabet[] = new int[26];
            boolean[] got = new boolean[26];
            int ans = 0;
            for (int i = 0; i < arr.length; i++) {
                char tmp = arr[i];
                alphabet[tmp - 'a']++;
                got[tmp - 'a'] = true;
            }
            for (int i = 0; i < alphabet.length; i++) {
                if (got[i] == false) continue;
                if (alphabet[i] % 2 != 0) {
                    out.println("No");
                    return;
                }
            }
            out.println("Yes");
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

    }
}



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


int main() {
    int N;
	string S;
    cin >> N >> S  ;
int reR=0;
int reB=0;
for(int i=0;i<S.length();i++){
if(S[i]=='R')reR++;
else
reB++;
}
if(reR>reB)
    cout << "Yes";
else
    cout << "No";




return 0;
}

Measured memory_bytes: 256
s = input()
t = input()
if s == t:
    print("Yes")
    quit()
d = s[len(s)-1]+s[:len(s)-1]
while d != s:
    if d == t:
        print("Yes")
        quit()
    d = d[len(s)-1]+d[:len(s)-1]
print("No")

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

#define INF ((1<<30)-1)
#define LLINF (1LL<<60)
#define EPS (1e-10)

// dp[i][j] := i番目の人まででj個の雨を分けるときの場合の数
ll dp[110][101010];
ll dp_sum[110][101010];

const ll mod = 1e9 + 7;

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n+1);
    rep(i, n) cin >> a[i+1];

    dp[0][0] = 1;
    //for (int j = 0; j <= k; ++j) dp_sum[0][j] = 1;

    for (int i = 1; i <= n; ++i) {
        for (int j = 0; j <= k; ++j) dp_sum[i][j+1] = (dp_sum[i][j] + dp[i-1][j]) % mod;
        for (ll j = 0; j <= k; ++j) {
            dp[i][j] = dp_sum[i][j+1] - dp_sum[i][max(0LL, j - a[i])];
            dp[i][j] = (dp[i][j] + mod) % mod;
        }
    }

    cout << (dp[n][k] + mod) % mod << endl;
}


Measured memory_bytes: 161280
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(){
	string s;cin>>s;
	map<char,int> mp;
	for(char c:s){
		mp[c]++;
	}
	for(char c:s){
		if(mp[c]!=2){
			cout<<"No"<<endl;
			return 0;
		}
	}
	cout<<"Yes"<<endl;
	return 0;
}


Measured memory_bytes: 256
/*
Miles Morales : When will I know I'm ready?
Peter B. Parker : You won't. It's a leap of faith. That's all it is, Miles. A leap of faith.
*/
//KEEP IT SIMPLE STUPID
/*#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")*/
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define print(o) for(auto it=(o).begin();it!=(o).end();it++) cout<<*it<<" ";
#define vll vector<ll>
#define pb push_back
#define FOR(n) for(ll i=0;i<=n;i++)
#define FORd(n) for(ll i=n;i>=0;i--)
#define FORrd(a,b) for(ll i=a;i>=b;i--)
#define FORr(a,b) for(ll i=a;i<=b;i++)
#define all(x) (x).begin(),(x).end()
#define FIO ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define mp make_pair
#define ff first
#define ss second
#define w(t) ll t;cin>>t;while(t--)

int main()
{
    ll n,ans=0;
    cin>>n;
    for(ll i=1;i<=n;i++)
    {
        if(i%3!=0&&i%5!=0)
            ans+=i;
    }
    cout<<ans<<'\n';
    return 0;
}
/* stuff you should look for
	* int overflow, array bounds
	* special cases (n=1?)
	* do smth instead of nothing and stay organized
	* WRITE STUFF DOWN
*/


Measured memory_bytes: 3600
#include<bits/stdc++.h>
#define LiangJiaJun main
#define INF 1999122700
using namespace std;
int n,q;
struct obs{
    int x,s,t;
}a[200004];
int ans[200004],d[200004];

map<int,int>mert;
set<int>tr;
set<int>::iterator it;
vector<int>vec;
inline bool dex(obs A,obs B){
    return A.x<B.x;
}
int LiangJiaJun(){
    mert.clear();
    tr.clear();
    scanf("%d%d",&n,&q);
    for(int i=1;i<=n;i++){
        scanf("%d%d%d",&a[i].s,&a[i].t,&a[i].x);
    }
    sort(a+1,a+n+1,dex);
    for(int i=1;i<=q;i++){
        scanf("%d",&d[i]);
        mert[d[i]]=i;
        tr.insert(d[i]);
    }
    for(int i=1;i<=n;i++){
        vec.clear();
        it=tr.lower_bound(a[i].s-a[i].x);
        for(;it!=tr.end();it++){
            if((*it)>=a[i].t-a[i].x)break;
            else vec.push_back(*it);
        }
        for(int j=0;j<vec.size();j++){
            ans[mert[vec[j]]]=a[i].x;
            tr.erase(vec[j]);
        }
    }
    for(it=tr.begin();it!=tr.end();it++){
        ans[mert[(*it)]]=-1;
    }
    for(int i=1;i<=q;i++)printf("%d\n",ans[i]);
    return 0;
}



Measured memory_bytes: 24696
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <cctype>
#include <map>
#include <set>
#include <bitset>
#include <utility> 
using namespace std;

int main() {
    int n,k; cin >> n >> k;
    cout << n-k+1 << endl;
}

Measured memory_bytes: 256
// g++ -std=c++11 a.cpp
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<unordered_map>
#include<utility>
#include<cmath>
#include<random>
#include<cstring>
#include<queue>
#include<stack>
#include<bitset>
#include<cstdio>
#include<sstream>
#include<iomanip>
#include<assert.h>
#include<typeinfo>
#define loop(i,a,b) for(long long i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define FOR(i,a) for(auto i:a)
#define pb push_back
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
#define show1d(v) {rep(_,v.size())cout<<" "<<v[_];cout<<endl;}
#define show2d(v) {rep(__,v.size())show1d(v[__]);}
using namespace std;
//kaewasuretyuui
typedef long long ll;
#define int ll
typedef int Def;
typedef pair<Def,Def> pii;
typedef vector<Def> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<Def,pii> pip;
typedef vector<pip>vip;
#define mt make_tuple
typedef tuple<int,int,int,int> tp;
typedef vector<tp> vt;
template<typename A,typename B>bool cmin(A &a,const B &b){return a>b?(a=b,true):false;}
template<typename A,typename B>bool cmax(A &a,const B &b){return a<b?(a=b,true):false;}
const double PI=acos(-1);
const double EPS=1e-9;
Def inf = sizeof(Def) == sizeof(long long) ? 2e18 : 1e9+10;
#define yes cout<<"YES"<<"\n"
#define no cout<<"NO"<<"\n"

int a,out;
void f(int t,int w){
	if(t>a)return;
	if(w==7)out++;
	t*=10;
	f(t+3,w|1);
	f(t+5,w|2);
	f(t+7,w|4);
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	
	cin>>a;
	f(0,0);
	cout<<out<<endl;
}






Measured memory_bytes: 256
def resolve():
    import sys
    input = sys.stdin.readline
    xy = [int(x) for x in input().rstrip().split()]
    x = xy[0]
    y = xy[1]
    
    for i in range(x+1):
        if((i * 2 + (x-i)*4) == y):
            print("Yes")
            exit()
    
    print("No")


# x = list(map(int, input().split()))

if __name__ == "__main__":
    resolve()


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

using namespace std;

int main(void){

	long double x1,y1,x2,y2,x3,y3,x4,y4;
	int n;

	cin>>n;

	for(int i=0;i<n;i++){
		cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
		if(y2-y1==0){
			if(y4-y3==0) cout<<"YES"<<endl;
			else cout<<"NO"<<endl;
		}
		else if((x2-x1)/(y2-y1)==(x4-x3)/(y4-y3)) cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}

	return 0;
}

Measured memory_bytes: 1228
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
 
typedef long long int ll;
#define int long long int
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define FRE freopen("input.txt","r",stdin); freopen("output.txt","w",stdout);
#define debug cout << "debug" << endl;
#define f(i,n) for(ll i=0;i<n;i++)
#define fa(i,a,n) for(ll i=a;a<n?i<n:i>=n;a<n?i+=1:i-=1)
#define loop(i,a, n) for(ll i = a; i <= n; i++)
#define loopb(i,a, n) for(ll i = a; i >= n; i--)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define setmem(x, k) memset(x, k, sizeof(x))
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define PI 3.1415926535897932384626
#define MOD 1000000007
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int>	vi;
typedef vector<ll> vl;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef long double ld;
typedef vector<vector<ll>> matrix;
ll dx[] = {0, 1, 0, -1};
ll dy[] = {-1, 0, 1, 0};
const ll N = 1e6+5;
// ll a[N], b[N], dp[N], level[N], vis[N], in[N], out[N];
// vl g[N];
ll n, m;
 
ll ct[N], mp[N];
 
ll fun(ll n){
	for(ll i=1;i<=sqrt(n);i++) {
	    if(n%i==0){
	      	if(mp[i] || mp[n/i]) return 0;
	    }
	}
	return 1;
}
 
void solve() {
	ll t, x, y, l, r;
	cin >> n;
	ll a[n];
	f(i, n) cin >> a[i], ct[a[i]] ++;
	sort(a, a+n);
	ll ans = 0;
	f(i, n){
		x = a[i];
		if(ct[x] > 1){
			mp[x] ++;
			continue;
		}
		ans += fun(x);
		mp[x] ++;
	}
	cout << ans << endl;
}
 
int32_t main() {
	IOS
	ll T;
	// cin >> T;
	// while(T--)
	solve();
	cerr<<"Time elapsed : "<<clock()*1000.0/CLOCKS_PER_SEC<<"ms"<<'\n'; 
	return 0;
}

Measured memory_bytes: 20920
#include<stdio.h>
int main()
{
	int p,q,r,a;

	scanf("%d%d%d",&p,&q,&r);

	a=p+q<q+r?p+q:q+r;
	a=a<r+p?a:r+p;
	printf("%d",a);
	return 0;
}

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

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>
#define ll long long
#define ull unsigned long long
#define N 100005
#define mod 1000000007
//#define mod 1e18
#define boost ios_base::sync_with_stdio(false);cin.tie(0)
#define prec(n) fixed<<setprecision(n)

#define mii map<int,int>
#define mll map<ll,ll>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define fi  first

#define se second
#define pb push_back
#define mp make_pair
#define pp pop_back
#define vii vector<int>
#define vll vector<ll>
#define vpii vector<pii>
#define vpll vector<pll>
#define all(c) c.begin(),c.end()
#define tr(it,c) for(it = c.begin() ; it!=c.end() ; it++)
int inf = INT_MAX ;
ll modulo(ll num,ll MOD=mod){ return ((num%MOD)+MOD)%MOD;} // for negative integer
ll power(ll b,ll e,ll MOD=mod){ll ans=1; while(e){if(e%2) ans=(ans*b)%MOD; b=(b*b)%MOD; e/=2;} return ans;}
ll inv(ll num,ll MOD=mod){ return power(modulo(num),MOD-2,MOD); }
ll gcd(ll a,ll b){ return ((b==0) ? a:gcd(b,a%b));}
struct S {
    int w, s, v;
    void read() {
        scanf("%d%d%d", &w, &s, &v);
    }
    bool operator <(const S& b) const {
        return w + s < b.w + b.s;
    }
};

int main() {
    int n;
    scanf("%d", &n);
    vector<S> in(n);
    int MAX_S = 20123;
    for(int i = 0; i < n; ++i) {
        in[i].read();
        //~ MAX_S = max(MAX_S, in[i].s + in[i].w);
    }
    sort(in.begin(), in.end());
    vector<ll> dp(MAX_S + 1);
    // dp[i] - best score of boxes with total weight i
    for(S block : in) {
        for(int w = min(block.s, MAX_S - block.w); w >= 0; --w) {
            dp[w+block.w] = max(dp[w+block.w], dp[w] + block.v);
        }
    }
    ll answer = 0;
    for(int i = 0; i <= MAX_S; ++i) {
        answer = max(answer, dp[i]);
    }
    printf("%lld\n", answer);
}


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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////
string S;

ll i;
int main(){
    cin >> S;
    fornum(i,0,S.length()){
        S[i] = 'x';
    }
    cout << S;
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstring>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<string>
#include<bitset>
#include <sstream>
#include<queue>
#include<set>
#define rep(i,n) for(ll i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef pair<int,ll>P;

int main()
{
    int a;
    cin>>a;
    cout<<3*a*a;
}

Measured memory_bytes: 256
//拡張ユークリッド
//ax + by = 1　を満たす x, yを求めよ
//gcd(a, b) != 1　の時は解が存在しない(バグる)
#include<iostream>
using namespace std;

int gcd(int a, int b){

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

int extgcd(int  a, int b, int& x, int& y){
    int d = a;
    if(b != 0){
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    }else{
        x = 1; y = 0;
    }
    return d;
}

int main(){

    //ax + by = gcd(a, b)の解を求める
    int a, b; cin >> a >> b;
    int x, y;
    int d = gcd(a, b);
    a /= d;
    b /= d;
    d = extgcd(a, b, x, y);
    cout << x << " " << y <<  endl;
    return 0; 
}


Measured memory_bytes: 3080
// Example program
#include <iostream>
#include <vector>
#include <numeric>


using namespace std;

int gcd(int a, int b)
{
 
  int r, tmp;
 
 
  /* 自然数 a > b を確認・入替 */
  if(a<b){
    tmp = a;
    a = b;
    b = tmp;
  }
 
  /* ユークリッドの互除法 */
  r = a % b;
  while(r!=0){
    a = b;
    b = r;
    r = a % b;
  }
 
  /* 最大公約数を出力 */
  return b;
}

int main()
{
  int N;
  cin >> N;
  
  int ans;  
  for (int i=0; i < N; i++) {
    int Ai;
    cin >> Ai;
  	if (i==0) {
      ans = Ai;
    } else {
      ans = gcd(ans, Ai);
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld; 
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
typedef pair<ld,ld> point;

ld dist(point x, point y)
{
	return sqrt((x.fi-y.fi)*(x.fi-y.fi)+(x.se-y.se)*(x.se-y.se));
}

ld distcirc(point x, ld r1, point y, ld r2)
{
	ld tmp = dist(x,y);
	tmp -= (r1+r2);
	tmp=max(tmp,ld(0));
	return tmp;
}

ld d[1011];
ld score[1011][1011];
vector<pair<point,ld> > vec;
const ld eps = 1e-10;
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	ld a, b, c, dd;
	cin>>a>>b>>c>>dd;
	int n; cin>>n;
	vec.resize(n+2);
	vec[0].fi = mp(a,b);
	vec[0].se = 0;
	vec[1].fi = mp(c,dd);
	vec[1].se = 0;
	for(int i = 2; i < n + 2; i++)
	{
		cin>>vec[i].fi.fi>>vec[i].fi.se>>vec[i].se;
	}
	priority_queue<pair<ld,int>, vector<pair<ld,int> >, greater<pair<ld,int> > > pq;
	for(int i = 0; i < n + 2; i++)
	{
		d[i] = ld(1e18);
	}
	for(int i = 0; i < n + 2; i++)
	{
		for(int j = 0; j < n + 2; j++)
		{
			score[i][j] = distcirc(vec[i].fi,vec[i].se,vec[j].fi,vec[j].se);
		}
	}
	d[0] = 0;
	pq.push(mp(0,0));
	while(!pq.empty())
	{
		ld di = pq.top().fi; int s = pq.top().se;
		pq.pop();
		for(int i = 0; i < n + 2; i++)
		{
			ld dis = di + score[s][i];
			if(dis+eps<d[i])
			{
				d[i] = dis;
				pq.push(mp(d[i],i));
			}
		}
	}
	cout<<fixed<<setprecision(12)<<d[1]<<'\n';
}


Measured memory_bytes: 24428
#include <bits/stdc++.h>
using namespace std;
#define repr(i,k,n) for(int i = (k); i < (n); i++)
#define rep(i,n) repr(i,0,n)
#define ALL(a) begin(a),end(a)
const int MOD = 1000000007;
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
int ctoi(const char c){
  switch(c){
    case '0': return 0;
    case '1': return 1;
    case '2': return 2;
    case '3': return 3;
    case '4': return 4;
    case '5': return 5;
    case '6': return 6;
    case '7': return 7;
    case '8': return 8;
    case '9': return 9;
  }
}
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int X, N;
    int L, LA=0,A=0;
    cin >> N >> X;
    rep(i,N){
        cin >> L;
        LA+=L;
        if (LA>=X){
            A=i+2;
            if(LA>X) A--;
            break;
        }
    }
    if(A==0) A = N+1;
    cout << A <<endl;
}

Measured memory_bytes: 256
#include <cstdio>
using namespace std;
int n,a[105],cnt;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i){
		scanf("%d",a+i);
		if(i%2&&a[i]%2)++cnt;
	}
	printf("%d\n",cnt);
	return 0;
}

Measured memory_bytes: 1732
def getN():
    return int(input())
def getNM():
    return map(int, input().split())
def getList():
    return list(map(int, input().split()))
def getArray(intn):
    return [int(input()) for i in range(intn)]
def input():
    return sys.stdin.readline().rstrip()
def rand_N(ran1, ran2):
    return random.randint(ran1, ran2)
def rand_List(ran1, ran2, rantime):
    return [random.randint(ran1, ran2) for i in range(rantime)]
def rand_ints_nodup(ran1, ran2, rantime):
  ns = []
  while len(ns) < rantime:
    n = random.randint(ran1, ran2)
    if not n in ns:
      ns.append(n)
  return sorted(ns)

def rand_query(ran1, ran2, rantime):
  r_query = []
  while len(r_query) < rantime:
    n_q = rand_ints_nodup(ran1, ran2, 2)
    if not n_q in r_query:
      r_query.append(n_q)
  return sorted(r_query)

from collections import defaultdict, deque, Counter
from sys import exit
from decimal import *
import heapq
import math
from fractions import gcd
import random
import string
import copy
from itertools import combinations, permutations, product
from operator import mul, itemgetter
from functools import reduce
from bisect import bisect_left, bisect_right

import sys
sys.setrecursionlimit(1000000000)
mod = 10 ** 9 + 7

#############
# Main Code #
#############

N, Q = getNM()
S = input()
que = [getList() for i in range(Q)]
imos = [0] * N
for i in range(N - 1):
    if S[i + 1] == 'C' and S[i] == 'A':
        imos[i + 1] += imos[i] + 1
    else:
        imos[i + 1] += imos[i]

imos = [0] + imos
for l, r in que:
    opt = imos[r] - imos[l - 1]
    # 修正入る
    if l >= 2 and S[l - 1] == 'C' and S[l - 2] == 'A':
        opt -= 1
    print(opt)

Measured memory_bytes: 100908
N =input()
As = [int(x) for x in input().split()]
count = {}
for a in As:
    for a_ in [a-1, a, a+1]:
        if count.get(a_):
            count[a_] += 1
        else:
            count[a_] = 1
max_count = 0
for key, value in count.items():
    if value > max_count:
        max_count = value
        
print(max_count)

Measured memory_bytes: 18712
#include <stdio.h>

int main(void) {
	int L;
	double nakamayukie;
	if (scanf("%d", &L) != 1) return 1;
	nakamayukie = L / 3.0;
	printf("%.15f\n", nakamayukie * nakamayukie * nakamayukie);
	return 0;
}

/*

(x+a)(x-a) =x^2 - a^2 < x^2 (x, aは実数)

すなわち、違う値があれば同じにすることで積を大きくできる

*/


Measured memory_bytes: 128
# 解説を読んでから

from itertools import product
from math import floor, ceil
import numpy as np

N = int(input())
d = floor(np.log10(N)) + 1  # Nの桁数
N_sento = N // (10 ** (d - 1))  # Nの先頭の数字

n = np.zeros((9, 9), dtype='int')
# n[i-1,j-1] は、先頭がi, 末尾がjであるN以下の整数の個数とする

for i, j in product(range(9), range(9)):
    # n[i, j]を求める。
    # i.e. 先頭がi+1, 末尾がj+1である整数の数

    # 1桁の数字
    if i == j and N >= (i + 1):
        n[i, j] += 1

    # 2桁以上 d桁未満 の数字
    for k in range(2, d):
        n[i, j] += 10 ** (k - 2)
    
    # d桁の数字 (d >= 2 の場合)
    if d < 2:
        pass
    elif N_sento > (i + 1):
        # 先頭の桁がNのそれより小さければ、中央d-2桁は好きに作れる
        n[i, j] += 10 ** (d - 2)
    elif N_sento == (i + 1):
        # 先頭の桁がNのそれと同じだと、Nより大きくならないように中央d-2桁を決める
        n[i, j] += (N - N_sento * 10**(d-1)) // 10 + 1
        if (j + 1) > N % 10:
            n[i, j] -= 1

print(np.einsum('ij,ji', n, n))


Measured memory_bytes: 12516
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO ?????????????????????????????????????????????
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for(int i = 0; i < n; i++){
			a[i] = in.nextInt();
		}
		int m = in.nextInt();
		int[] b = new int[m];
		for(int i = 0; i < m; i++){
			b[i] = in.nextInt();
		}
		int count = 0;
		for(int bb : b){
			if(binarySearch(a, bb, 0, a.length) != -1)count++;
		}
		System.out.println(count);
		in.close();
	}
	static int binarySearch(int[]a,int n, int l, int r){
		while(l != r){
			int mid = (l+r)/2;
			if(a[mid] == n){
				return mid;
			}else if(a[mid] < n){
				l = mid + 1;
			}else if(a[mid] > n){
				r = mid;
			}
		}
		return -1;
	}

}

Measured memory_bytes: 78476
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main ()
{
    ll a;
    string b;
    int e[5]={0},m=0;
    ll ans=0;
    int t[30]={0};
    cin>>a>>b;
    for(int i=0;i<b.size();i++)
        if(b[i]!='.')   e[m++]=b[i]-'0';
    ans=e[2]*a+10*e[1]*a+e[0]*100*a;
    ans/=100;
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <memory.h>
#include <queue>
#include <cstdio>
#include <cstdlib>
#include <set>
#include <map>
#include <cctype>
#include <iomanip>
#include <sstream>
#include <cctype>
#include <fstream>
#include <cmath>
using namespace std;

#define rep(i, n) for(int i = 0; i< (int)(n); i++)
#define all(c) (c).begin(), (c).end()
#define iter(c) __typeof((c).begin())
#define pb(e) push_back(e)
#define foreach(c, i) for(iter(c) i = (c).begin(); i != c.end(); ++i)

typedef long long ll;
typedef pair<ll, ll> P;
ll mod = 1000 * 1000 * 1000 + 7;
const double EPS = 1e-10;

const int sz = 210;
ll dp[sz][sz][sz]; 
//dp[i][j][k]:=(上位i人目まで見たときにj人の元の順位が決まっておらず、元の上位i人目まででk人の順位が決まっていない場合の数)

int main(){
  int N;
  cin >> N;
  dp[0][0][0] = 1;
  
  rep(i, N){
    char c;  
    cin >> c;
    rep(j, N){
      rep(k, N){
	//cout << i << " " << j << " " << k << " " << dp[i][j][k] << endl;
	switch(c){
	case '-':
	  dp[i+1][j][k] = (dp[i+1][j][k] + dp[i][j][k]) % mod;
	  break;
	case 'U':
	  dp[i+1][j+1][k+1] = (dp[i+1][j+1][k+1] + dp[i][j][k]) % mod;
	  dp[i+1][j][k] = (dp[i+1][j][k] + dp[i][j][k] * j) % mod;
	  break;
	case 'D':
	  dp[i+1][j][k] = (dp[i+1][j][k] + dp[i][j][k] * k) % mod;
	  if(j > 0 && k > 0){
	    dp[i+1][j-1][k-1] = (dp[i+1][j-1][k-1] + dp[i][j][k] * j * k) % mod;
	  }
	}
      }
    }
  }
  cout << dp[N][0][0] << endl;
  
  return 0;
}

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

int main() {
	cin.tie(0);
   	ios::sync_with_stdio(false);
   	string s;cin>>s;
    int c[26] = {0};
	rep(i, s.length()){
        c[s[i]-97]++;
    }
    rep(i, 26){
        if(c[i]%2 == 1){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        int N = scanner.nextInt();

        boolean flag = true;
        for (int i = 0 ; i < N ; i++) {
            int A = scanner.nextInt();
            if (A % 2 == 0 && A % 3 != 0 && A % 5 != 0) {
                System.out.println("DENIED");
                return;
            }
        }

        System.out.println("APPROVED");
    }
}


Measured memory_bytes: 35780
#include <stdio.h>
#include <string.h>
#define MAX_LEN 21

int main()
{
        char *p, *e;
        char str[MAX_LEN];
        gets(str);
        for(p = str, e = str+strlen(str)-1; p<e;e--,p++)
        {
                *e = *e ^ *p;
                *p = *e ^ *p;
                *e = *p ^ *e;
        }
        puts(str);
        return 0;
}

Measured memory_bytes: 524
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

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

    int N;
    cin >> N;
    vector<ll> A(3 * N);
    for (auto &x : A) cin >> x;
    sort(A.begin(), A.end());
    ll ans = 0;
    for (int i = 3 * N - 2; i >= N; i -= 2) {
        ans += A.at(i);
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 2560
//============================================================================
// Name        : Hello.cpp
// Author      :
// Version     :
// Copyright   : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================

#include<algorithm>
#include <iostream>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<string>
using namespace std;
int main() {

	double t,x;
	cin>>t>>x;

	cout<<setprecision(5)<<fixed<<t/x<<endl;

	return 0;
}


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

int mod = 1000000007;

int main()
{
	int n, m;
	cin >> n >> m;
	vector<bool> step(100001, true);
	for (int i = 0; i < m; i++) {
		int a_in;
		cin >> a_in;
		step.at(a_in) = false;
	}

	vector<int> dp(100001);
	if (step.at(1) == true) {
		dp.at(1) = 1;
	}
	if (step.at(2) == true) {
		dp.at(2) = 1 + dp.at(1);
	}

	for (int i = 3; i < 100001; i++) {
		if (step.at(i) == false) {
			dp.at(i) = 0;
		} else {
			int temp = dp.at(i - 2) + dp.at(i - 1);
			dp.at(i) = temp % mod;
		}
	}
	int ans = dp.at(n);

	cout << ans << endl;
}


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

const int N = 100005, INF = int(2e9);

int n, k = 2, h[N], d[N];

int main(){
    scanf("%d", &n);
    for(int i = 1; i <= n; i++){
        scanf("%d", h + i);
        if(i > 1) d[i] = INF;
        for(int j = 1; j <= k; j++){
            if(i - j < 1) break;
            d[i] = min(d[i], d[i - j] + abs(h[i] - h[i - j]));
        }
    }
    printf("%d\n", d[n]);
}

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

int main()
{
    int n;
    cin >> n;
    vector<int> v = {1,
                     1,
                     1,
                     2,
                     1,
                     2,
                     1,
                     5,
                     2,
                     2,
                     1,
                     5,
                     1,
                     2,
                     1,
                     14,
                     1,
                     5,
                     1,
                     5,
                     2,
                     2,
                     1,
                     15,
                     2,
                     2,
                     5,
                     4,
                     1,
                     4,
                     1,
                     51};
    cout << v[n - 1] << endl;
    return 0;
}


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

int main() {
  int a,b,h,m;
  cin>>a>>b>>h>>m;
  double ans=sqrt(a*a+b*b-2*a*b*cos((h*60-11*m)*3.14159265358979/360));
  printf("%.10lf\n", ans);
}

Measured memory_bytes: 4108
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const ll INF = 1001001001001001LL;
const ll MOD = 1000000007LL;
 
int main() {
    int r; cin >> r;
    cout << 3 * r * r << endl;
    return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize ("O3")
#pragma GCC optimize ("unroll-loops")

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

#define pb push_back
#define F first
#define S second
#define f(i,a,b)  for(int i = a; i < b; i++)
//#define endl '\n'

using ll = long long;
using db = long double;
using row = vector<int>;
using ii = pair<int, int>;

//const int N = 5e5 + 5, M = 1e6 + 5, A = 6561, LG = 17, MOD = 1e9 + 7;
const int BLOCK = 1900;
//const int BLOCKN = N / BLOCK + 1;
const long double EPS = 1e-7;

  ll N, A, B;
ll simul1(ll A, ll B){
  ll ans = A - 1;
  B -= (A-1);
  A=1;
  ans++;
  B--;
  ans+=(B-A)/2;
  return ans;
}
ll simul2(ll A, ll B){
  return simul1(N-B+1,N-A+1);
}
int main(){
#ifdef ONLINE_JUDGE
  ios_base::sync_with_stdio(0);
  cin.tie(0);
#endif // ONLINE_JUDGE


  cin >> N >> A >> B;

  if((A&1)==(B&1)){
    cout<<(B-A)/2<<'\n';
  } else {
    cout<<min(simul1(A,B),simul2(A,B))<<'\n';
  }

  return 0;
}


Measured memory_bytes: 256
IDENTIFICATION DIVISION.
PROGRAM-ID. aising-B.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 INP        PIC X(400).
01 N          PIC 9(03).
01 A          PIC 9(03).
01 I          PIC 9(04) COMP.
01 P1         PIC 9(04) COMP.
01 P2         PIC 9(04) COMP.
01 S          PIC 9(02).
01 AMR        PIC 9(01).
01 SW-K       PIC 9(01).
01 CNT        PIC 9(03).
01 OUT        PIC ZZ9.
*>
PROCEDURE DIVISION.
  ACCEPT N.
  ACCEPT INP.
*>
  MOVE ZERO TO CNT.
  MOVE 1    TO P1 SW-K.
  PERFORM VARYING I FROM 1 BY 1 UNTIL I > N
    PERFORM VARYING P2 FROM P1 BY 1 UNTIL INP(P2:1) = ' '
    END-PERFORM
    MOVE INP(P1:P2 - P1) TO A
    DIVIDE A BY 2 GIVING S REMAINDER AMR
    IF (SW-K = 1 AND AMR = 1)
      ADD 1 TO CNT
    END-IF
    COMPUTE P1 = P2 + 1
    COMPUTE SW-K = 1- SW-K
  END-PERFORM.
*>
  MOVE CNT TO OUT.
  DISPLAY FUNCTION TRIM(OUT).
  STOP RUN.


Measured memory_bytes: 3940
#include<bits/stdc++.h>
#define rep(i,N) for(int i=0;i<(N);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e12;
const int inf = 1e9;
const int mod = 1e9+7;
typedef long long ll;
typedef pair<ll,int> P;
typedef set<int> S;
int main(){
    int n,k;
    cin >> n >> k;
    if(n%k==0) cout << 0 << endl;
    else{
        cout<<1<<endl;
    }
    return 0;
}

Measured memory_bytes: 256
m,d=gets.chomp.split(" ").map(&:to_i);

# d1 = d%10
# d2 = d/10

# puts m
# puts d
 # puts d2
 # puts d1
sum = 0

for j in 1..m do

	for i in 22..d  do
		d1 = i%10
		d2 = i/10
		#puts i

		if j == d1*d2 
			sum = sum + 1
			#puts "j#{j} i#{i} sum#{sum}"
			if d1 < 2 || d2 < 2
				sum = sum -1
			end
		end
	end
#puts j

end

puts sum

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;

#define repr(i, n) for(int i = n; i >= 0; i--)
#define reprl(i, n) for(ll i = n; i >= 0; i--)
#define all(v) v.begin(), v.end()
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);
}
bool isLowerCase(char c){
  return (c>='a'&&c<='z');
}
const string outputYesNo(bool ans){
  return (ans?"Yes":"No");
}
int main() {
  ll n,m;cin>>n>>m;
  ll ans=0;
  if(n==1){
    if(m==1){
      ans=1;
    }else if(m==2){
      ans=0;
    }else if(m>=3){
      ans=m-2;
    }
  }else if(n==2){
    if(m==1){
      ans=0;
    }else if(m==2){
      ans=0;
    }else if(m>=3){
      ans=0;
    }
  }else if(n>=3){
    if(m==1){
      ans=n-2;
    }else if(m==2){
      ans=0;
    }else if(m>=3){
      ans=(n-2)*(m-2);
    }
  }
  cout<<ans<<endl;
  return 0;
}


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

#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int  long long

#define x first
#define y second

using pii = pair<int, int>;
using ld  = long double;

const int mxn = 1e5 + 5;
const int mod = 1e9 + 7;

int a[mxn], b[mxn], c[mxn], dp[mxn][3];

int32_t main()
{
    IOS
    int n;
    cin >> n;
    for(int i = 0; i < n; i++)
        cin >> a[i] >> b[i] >> c[i];
    dp[0][0] = a[0];
    dp[0][1] = b[0];
    dp[0][2] = c[0];
    for(int i = 1; i < n; i++)
    {
        dp[i][0] = a[i] + max(dp[i - 1][1], dp[i - 1][2]);
        dp[i][1] = b[i] + max(dp[i - 1][0], dp[i - 1][2]);
        dp[i][2] = c[i] + max(dp[i - 1][0], dp[i - 1][1]);
    }
    cout << max({dp[n - 1][0], dp[n - 1][1], dp[n - 1][2]}) << endl;
    return 0;
}

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

using namespace __gnu_pbds;
using namespace std;

template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

#define all(a) a.begin(),a.end()
#define F first
#define S second
#define pb push_back
#define ll long long
#define vi vector<int>
#define pi pair<int,int>
#define mp make_pair

#ifdef LOCAL
#include "debug.h"
#else
#define debug(...) "FUCK YOU"
#endif
	

const int mod=1e9+7;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template<typename A,typename B> istream& operator>>(istream&,pair<A,B>&);
template<typename A> istream& operator>>(istream&,vector<A>&);
void add(int&,int);
int mul(int,int);
int powz(int,int);
template<typename A> ostream& operator<<(ostream&,vector<A>&);
const int N=500006;


void solve()
{
int n,q;
cin>>n>>q;
string s;
cin>>s;
vector<int>pref(n);
for(int i=1;i<n;i++)
{
	pref[i]=pref[i-1];
	if(s[i]=='C'&&s[i-1]=='A')pref[i]++;
}
while(q--)
{
	int l,r;
	cin>>l>>r;
	l--;r--;
	if(l)
	cout<<pref[r]-pref[l-1]-(s[l]=='C'&&s[l-1]=='A')<<"\n";
	else cout<<pref[r]<<"\n";
  	
	
}
}




int main()
{
	
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tc=1;
	//~ cin>>tc;	
	for(int i=0; i<tc; i++)
	{
		solve();
	}

}

int mul(int a,int b)
{
	return ((a)*1ll*(b))%mod;
}

void add(int &a,int b)
{
	a+=b;
	if(a>=mod)a-=mod;
	if(a<0)a+=mod;
}
int powz(int a,int b)
{
	int res=1;
	while(b)
	{
		if(b&1)res=mul(res,a);
		b/=2;
		a=mul(a,a);
	}
	return res;
}

template <typename A, typename B>
istream& operator>>(istream& input,pair<A,B>& x) {
	input>>x.F>>x.S;
	return input;
}

template <typename A>
istream& operator>>(istream& input,vector<A>& x) {
	for(auto& i:x)
		input>>i;
	return input;
}

template<typename A>
ostream& operator<<(ostream& output,vector<A>& x) {
	for(auto& i:x)
	    output<<i<<' ';
	return output;	
}


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

using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); ++i)
#define erep(i, n) for (ll i = 0; i <= (ll)(n); ++i)
#define FOR(i,a,b) for (ll i = (a); i < (ll)(b); ++i)
#define EFOR(i,a,b) for (ll i = (a); i <= (ll)(b); ++i)
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } }

ll gcd(ll m, ll n) {
    ll tmp;
    while (m % n != 0) {
        tmp = n;
        n = m % n;
        m = tmp;
    }
    return n;
}

ll lcm(ll m, ll n) {
    return max(m, n)/gcd(m,n) * min(m,n);
}

using Graph = vector<vector<int>>;

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

ll modnum = 1e9+7;

int main() {
    string n; cin >> n;
    char now = '_';
    int count = 0;
    rep(i, n.size()) {
        if(n[i] == now) {
            count++;
            if(count >= 3) break;
        }
        else {
            now = n[i];
            count = 1;
        }
    }
    if(count >= 3) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
h, w = map(int, input().split())

if h == 1:
    print(1)
elif w == 1:
    print(1)
elif h%2 == 0 or w%2 == 0:
    print(h*w//2)
else:
    ans = (h + 1) * w // 2
    print(ans - int(w/2))


Measured memory_bytes: 2940
#include <stdio.h>

int main(void)
{
	unsigned int H = 1;
	unsigned int W = 1;
	unsigned int i;
	unsigned int j;
	
	while(H != 0 && W != 0)
	{
		scanf("%d %d", &H, &W);
		if(H == 0 && W == 0)
		{
			break;
		}
	
		for(i = 0; i < H; i++)
		{
			for(j = 0; j < W; j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}

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

#define rep(i, n) for (int i = 0; i < n; ++i)
#define all(x) (x).begin(),(x).end()
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using mp =  map<int,int>;

const int MOD = 1e9 + 7;

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

    string s;
    cin >> s;

    bool ok = true;
    for (int i = 0; i < s.size(); i += 2) {
        if(s[i] != 'h' || s[i+1] != 'i'){
            ok = false;
        }
    }

    cout << (ok ? "Yes" : "No") << endl;

    return 0;
}


Measured memory_bytes: 256
// AtCoder My Practice
// author: Leonardone @ NEETSDKASU

[<EntryPoint>]
let main _ =
    let a = stdin.ReadLine()
    let b = stdin.ReadLine()
    let f1 = a.[0] = b.[2]
    let f2 = a.[1] = b.[1]
    let f3 = a.[2] = b.[0]
    let ans = if f1 && f2 && f3 then "YES" else "NO"
    printfn "%s" ans
    0

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

#include <random>
using namespace std;
typedef double db;
int n;
db x[105],y[105];int id[105];
db abs(db x,db y){return sqrt(x*x+y*y);}
db sa(){
    shuffle(id+1,id+1+n, std::mt19937(std::random_device()()));
    db a=0,b=0;
    for(int i=1;i<=n;i++){
        if(abs(a+x[id[i]],b+y[id[i]])>=abs(a,b))a+=x[id[i]],b+=y[id[i]];
    }
    return abs(a,b);
}
int main(){
    ios::sync_with_stdio(false);
    cin>>n;
    for(int i=1;i<=n;i++)cin>>x[i]>>y[i],id[i]=i;
    db ans=0;
    for(int i=1;i<=100000;i++)
        ans = max(ans,sa());
    printf("%.17f\n",ans);
}


Measured memory_bytes: 256
import math
n = int(input())
x = []
y = []
for i in range(n):
    a,b = (int(x) for x in input().split())
    x.append(a)
    y.append(b)

ans = 0
count = 0
for i in range(n-1):
    for j in range(i+1,n):
        d=math.sqrt( (x[i]-x[j])**2 + (y[i]-y[j])**2 )
        ans += d
        count += 1

#print(ans)
print(ans*(n-1)/count)


Measured memory_bytes: 3064
#include <iostream>
#include <vector>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <climits>
#include <iomanip>
#include <list>

using namespace std;

struct Query {
  int T;
  int F;
  char C;
};

int main()
{
  string S;
  int Q;
  vector<Query> query_array;

  cin >> S >> Q;
  query_array.resize(Q);
  for (int i = 0; i < Q; i++) {
    cin >> query_array[i].T;
    if (query_array[i].T == 2) {
      cin >> query_array[i].F >> query_array[i].C;
    }
  }

  list<char> list_S;
  for (int i = 0; i < S.size(); i++) {
    list_S.push_back(S[i]);
  }

  int flip_num = 0;

  for (int i = 0; i < Q; i++) {
    if (query_array[i].T == 1) {
      flip_num++;
    }
    else if ((1 - (query_array[i].F - 1) * 2) * (1 - (flip_num % 2) * 2) == 1) {
      list_S.push_front(query_array[i].C);
    }
    else {
      list_S.push_back(query_array[i].C);
    }
  }

  if (flip_num % 2 == 1) {
    reverse(list_S.begin(), list_S.end());
  }

  for (auto &&i : list_S) {
    cout << i;
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 12416
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
C = Counter(A)
# print(C)
ans = sum([C[key]*(C[key]-1) // 2 for key in C.keys() if C[key] >= 2])
#print([C[key]*(C[key]-1) // 2 for key in C.keys() if C[key] >= 2])

for a in A:
    print(ans - (C[a]-1))


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

using namespace std;
typedef long long ll;

#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
//typedef pair<int, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX;
const ll MINF = LONG_LONG_MIN;
const int INF = INT_MAX;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }


//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<ll, vector<ll>, greater<ll>> PQ_ASK;
const int mod = 1000000007;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

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

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

int main() {
    int n;
    cin >> n;
    map<int, int> line;
    rep(i, n) {
        int a;
        cin >> a;
        line[a]++;
    }
    if (n % 2 == 1) {
        int ma = n - 1;
        int mi = 2;
        for (int k = ma; k >= mi; k -= 2) {
            if (line[k] != 2) {
                cout << 0 << endl;
                return 0;
            }
        }
        if (line[0] != 1) {
            cout << 0 << endl;
            return 0;
        }

        int p = ma / 2;

        mint ans = 2;
        ans = ans.pow(p);

        cout << ans.x << endl;

    } else {
        int ma = n - 1;
        int mi = 1;
        for (int k = ma; k >= mi; k -= 2) {
            if (line[k] != 2) {
                cout << 0 << endl;
                return 0;
            }
        }

        int p = (ma + 1) / 2;

        mint ans = 2;
        ans = ans.pow(p);

        cout << ans.x << endl;

    }

}

Measured memory_bytes: 3200
a, b, m = map(int, input().split())
a_arr = list(map(int, input().split()))
b_arr = list(map(int, input().split()))
waribiki = []

for i in range(m):
    waribiki.append(list(map(int, input().split())))

yen = min(a_arr) + min(b_arr)
for i in range(m):
    yen = min(yen, a_arr[(waribiki[i][0] - 1)] + b_arr[(waribiki[i][1] - 1)] - waribiki[i][2])

print(yen)

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

long n,m,k,ans=0,mod=1000000007,a=1,b=1,c;

long modpow(long modpow_x,long modpow_y) {
  long modpow_return=1;
  for(long i=1;i<=modpow_y;i*=2) {
    if(modpow_y/i%2==1) modpow_return=modpow_return*modpow_x%mod;
    modpow_x=modpow_x*modpow_x%mod;
  }
  return modpow_return;
}

int main() {
  cin >> n >> m >> k;
  for(long i=1;i<n;i++) ans=(m*m%mod*(n-i)%mod*i+ans)%mod;
  for(long i=1;i<m;i++) ans=(n*n%mod*(m-i)%mod*i+ans)%mod;
  
  for(long i=0;i<k;i++) a=a*(n*m-i)%mod;
  for(long i=0;i<k;i++) b=b*(i+1)%mod;
  c=a*modpow(b,mod-2)%mod*(k*(k-1)/2%mod)%mod;
  ans=c*modpow((n*m)*(n*m-1)/2%mod,mod-2)%mod*ans%mod;
  
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <bits/stdc++.h>
#define mod 1000000007
typedef long long ll;
using namespace std;  
int h,w,d,q,l,r;
int s[303][303];
int zb[100005][2];
int dp[90009][205];
int vis[90009];
int main()
{
	cin>>h>>w>>d;
	int x;
	for(int i=1;i<=h;i++){
		for(int j=1;j<=w;j++){
			cin>>s[i][j];
			x=s[i][j];
			zb[x][0]=i;
			zb[x][1]=j;	
		}
	}
	cin>>q;
	while(q--){
		scanf("%d%d",&l,&r);
		ll ans=0;
		int l2,l3;
		while(l!=r){
			int qj=(r-l)/d;
			if(qj>200){
				qj=200;
			}
			if(vis[l]==0){
				for(int i=1;i<=200 && l+d*i<=h*w;i++){
					l2=l+d*i;
					l3=l+d*(i-1);	
					dp[l][i]=abs(zb[l2][0]-zb[l3][0])+abs(zb[l2][1]-zb[l3][1]);
					dp[l][i]+=dp[l][i-1];
				}
				vis[l]=1;
			}
			ans+=dp[l][qj]; 
			l+=qj*d;
		}	
		printf("%lld\n",ans);
	}
	
	return 0;  
}
/**/


Measured memory_bytes: 74624
#include <bits/stdc++.h>
#include <algorithm>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(x) (x).begin(), (x).end()
#define PB(x) push_back(x)
#define MP(x,y) make_pair(x,y)
using namespace std;
using P = pair<int,int>;
typedef long long ll;
 
int main() {

    string s;
    cin>>s;

    int n=s.size();

    rep(i,n)    cout<<'x';
    
 return 0;
}

Measured memory_bytes: 256