akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define PI 3.14159265359
#define NIL -1
using namespace std;
const int64_t MOD = 1e9 + 7;

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

	vector<int64_t> v(N);
	int64_t sum = 0;
	for (int64_t i = 0; i < N; i++) {
		cin >> v.at(i);
		sum += v.at(i);
	}

	int64_t x = 0;
	int64_t ans = INT64_MAX;
	for (int64_t i = 0; i < N-1; i++) {
		x += v.at(i);
		int64_t y = sum - x;
		ans = min(ans, abs(x - y));
	}

	cout << ans << endl;
}

Measured memory_bytes: 4740
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<string>
#include<iomanip>
#include<vector>
#include<map>
#include<set>
#include<queue>
#include<stack>
#define FAST ios::sync_with_stdio(false);
#define pb push_back
#define lowbit(x) x&(-x)
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int mod = (int)1e9 + 5;
const int maxn = (int)1e5 + 5;
using namespace std;

struct hia{
	int a, b;
};

bool  cmp(hia a, hia b){
	return a.b < b.b;
}

hia z[maxn];

int main()
{
	int n, m;
	scanf("%d %d", &n, &m);
	for(int i = 0; i < m; i++)
		scanf("%d %d", &z[i].a, &z[i].b);
	sort(z , z + m, cmp);
	int t = 0, sum = 0;
	for(int i = 0; i < m; i++)
		if(z[i].a >= t){
			t = z[i].b;
			sum++;
		}
	printf("%d\n", sum);
	return 0;
}

Measured memory_bytes: 1024
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()

    i = 0
    x_cnt = [0]
    T = ""
    for s in S:
        if s == "x":
            x_cnt[i] += 1
        else:
            T = "".join((T, s))
            i += 1
            x_cnt.append(0)

    is_palindrome = True
    for i in range(len(T) // 2):
        if T[i] != T[-(i+1)]:
            is_palindrome = False

    if is_palindrome:
        ans = 0
        for i in range(len(x_cnt) // 2):
            ans += abs(x_cnt[i] - x_cnt[-(i+1)])
    else:
        ans = -1
    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
  int k;
  cin>>k;
  int a,b;
  cin>>a>>b;
  string s="NG";
  for(int i=a;i<=b;i++) {
    if(i%k==0) {
      s="OK";
      break;
    }
  }
  cout<<s<<endl;
  return 0;
}


Measured memory_bytes: 3628
#include <iostream>
#include <iomanip>
#include <algorithm>
using namespace std;
int a[200];
int main(){
	cout<<setprecision(12);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	sort(a,a+n);
	double j=2,ans=0,k=0;
	for(int i=n-1;i>=0;i--){
		ans+=(k=a[i]/j);
		j*=2;
	}
	ans+=k;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            List<String> inputNumbers = Arrays.asList(br.readLine().split(" "));
            List<Integer> numbers = new ArrayList<>();

            for (String inputNumber : inputNumbers) {
                numbers.add(Integer.parseInt(inputNumber));
            }

            numbers.sort((i1, i2) -> i1 - i2);

            int firstCost = numbers.get(1) - numbers.get(0);
            int secondCost = numbers.get(2) - numbers.get(1);
            int sumCost = firstCost + secondCost;

            System.out.println(sumCost);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 28244
#include<deque>
#include<queue>
#include<vector>
#include<algorithm>
#include<iostream>
#include<set>
#include<cmath>
#include<tuple>
#include<string>
#include<chrono>
#include<functional>
#include<iterator>
#include<random>
#include<unordered_set>
#include<unordered_map>
#include<array>
#include<map>
#include<bitset>
#include<iomanip>
using namespace std;
typedef long long int llint;
typedef long double lldo;
#define mp make_pair
#define mt make_tuple
#define pub push_back
#define puf push_front
#define pob pop_back
#define pof pop_front
#define fir first
#define sec second
#define res resize
#define ins insert
#define era erase
#define dme cout<<"IMPOSSIBLE"<<endl;return 0
//ios::sync_with_stdio(false);
//std::cin.tie(0);
//<< setprecision(20)
//12:15~
const int mod=1e9+7;
const int big=1e9+100;
const long double pai=3.141592653589793238462643383279502884197;
const long double ena=2.71828182845904523536;
const long double eps=1e-7;
template <class T,class U>void mineq(T& a,U b){if(a>b){a=b;}}
template <class T,class U>void maxeq(T& a,U b){if(a<b){a=b;}}
llint gcd(llint a,llint b){if(a%b==0){return b;}else return gcd(b,a%b);}
llint lcm(llint a,llint b){return a/gcd(a,b)*b;}
void solve(void){
	int h,w,i,j,c;cin>>h>>w;
	vector<string> kai(h);
	for(i=0;i<h;i++){cin>>kai[i];}
	int dame[26][26]={};
	array<int,26> up,dow,lef,rig;
	for(c=0;c<26;c++){up[c]=h;lef[c]=w;dow[c]=0;rig[c]=0;}
	int has[26]={0};
	for(i=0;i<h;i++){
		for(j=0;j<w;j++){
			if(kai[i][j]=='.'){continue;}
			mineq(up[kai[i][j]-'A'],i);
			maxeq(dow[kai[i][j]-'A'],i);
			mineq(lef[kai[i][j]-'A'],j);
			maxeq(rig[kai[i][j]-'A'],j);
			has[kai[i][j]-'A']=1;
		}
	}
	for(c=0;c<26;c++){
		for(i=up[c];i<=dow[c];i++){
			for(j=lef[c];j<=rig[c];j++){
				if(kai[i][j]=='.'){cout<<"SUSPICIOUS"<<endl;return;}
				dame[c][kai[i][j]-'A']=1;
			}
		}
	}
	vector<int> pa;
	for(c=0;c<26;c++){if(has[c]){pa.pub(c);}}
	int n=pa.size();
	do{
		int ok=1;
		for(i=0;i<n;i++){
			for(j=i+1;j<n;j++){
				if(dame[pa[i]][pa[j]]){ok=0;break;}
			}
		}
		if(ok==1){cout<<"SAFE"<<endl;return;}
	}while(next_permutation(pa.begin(),pa.end()));
	cout<<"SUSPICIOUS"<<endl;return;
}
int main(void){
	int n;cin>>n;
	while(n--){solve();}
	return 0;
}

Measured memory_bytes: 3180
#include <bits/stdc++.h>
#define N 2020
using namespace std;
char grid[N][N];
vector<int> ln[N],vln[N];
int main(){
	int n,m,i,j,k,l,num,ans=0,pos1,pos2,posa,posb;
	cin>>n>>m;
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			cin>>grid[i][j];
			if(grid[i][j]=='#')
			{
				ln[i].push_back(j);
				vln[j].push_back(i);
			}
		}
	}
	for(i=0;i<n;i++)
	{
		for(j=0;j<m;j++)
		{
			if(grid[i][j]=='#')
			{
				continue;
			}
			pos1=upper_bound(ln[i].begin(),ln[i].end(),j)-ln[i].begin();
			pos2=upper_bound(vln[j].begin(),vln[j].end(),i)-vln[j].begin();
			posa=pos1-1;
			posb=pos2-1;
			if(pos1==ln[i].size())
			{
				pos1=m-1;
			}
			else
			{
				pos1=ln[i][pos1]-1;
			}
			if(pos2==vln[j].size())
			{
				pos2=n-1;
			}
			else
			{
				pos2=vln[j][pos2]-1;
			}
			if(posa==-1)
			{
				posa=0;
			}
			else
			{
				posa=ln[i][posa]+1;
			}
			if(posb==-1)
			{
				posb=0;
			}
			else
			{
				posb=vln[j][posb]+1;
			}
			num=pos1-posa+pos2-posb+1;
			ans=max(ans,num);
		}
	} 
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 40448
from collections import defaultdict
n = int(input())

d=defaultdict(int)
for i in range(n):
    s=input()
    d[s]+=1

mx=0
for i,j in d.items():
    if j>mx:
        mx=j

ans=[]
for i, j in d.items():
    if j==mx:
        ans.append(i)

ans.sort()
for i in ans:
    print(i)

Measured memory_bytes: 32480
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int target = 0;
		int amari = 0;
		if(a > b) {
			amari = b + c;
			target = a;
		} else {
			amari = a + c;
			target = b;
		}
		if (target < c) {
			amari = a + b;
			target = c;
		}
		for(int i = 0; i < x; i++) {
			target *= 2;
		}
		System.out.println(target + amari);
	}
}

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


int main(void)
{
    long long N;
    cin >> N;
    long long p = 2;
    long long count =0;
    while( p * p <= N){
        if( N % p != 0) {
            p++;
            continue;
        }

        long long z = p;
        while( N % z == 0 ){
                N /= z;
                z *= p;
                count++;               
        }

        while( N % p == 0) N /= p; 
    }

    if( N != 1 ) count += 1;
    cout << count << endl;
    
}

Measured memory_bytes: 3640
#include "bits/stdc++.h"
#define rep(i, N) for(int (i) = 0; (i) < (N); (i)++)
#define debug(var) std::cout << #var << " : " << var << std::endl;
using ll = long long;
using ull = unsigned long long;
using vint = std::vector<int>;
using vvint = std::vector<std::vector<int>>;
using namespace std;
ll mod = 1e9 + 7;


int main() {


	int N; cin >> N;

	if (N <= 999)cout << "ABC";
	else cout << "ABD";


	return 0;
}

Measured memory_bytes: 256
list=input().split(" ")
N=int(list[0])
road_num=int(list[1])
high_list=input().split(" ")
for i in range(N):
    high_list[i]=int(high_list[i])

N_list=["zero"]
for i in range(N):
    N_list.append("good")

for i in range(road_num):
    tmp=input().split(" ")
    num1=int(tmp[0])
    num2=int(tmp[1])
    if high_list[num1-1] < high_list[num2-1]:
        N_list[num1]="bad"
    elif high_list[num1-1] > high_list[num2-1]:
        N_list[num2]="bad"
    else:
        N_list[num1]="bad"
        N_list[num2]="bad"
        
count=0
for i in range(1,N+1):
    if N_list[i]=="good":
        count+=1
print(count)

Measured memory_bytes: 17744
#!/usr/bin/env python3
import sys
input = sys.stdin.readline
def INT(): return int(input())
def MAP(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def main():
    N,K = MAP()
    have = [False]*N

    for i in range(K):
        d = INT()
        A = LI()

        for a in A:
            have[a-1] = True
    
    answer = 0
    for i in range(N):
        if not have[i]:
            answer += 1
    print(answer)


if __name__ == '__main__':
    main()


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

int n, t;
int ans;

int main(){
//	cin.tie(0);
//	ios::sync_with_stdio(false);
	cin >> n >> t;
	ans = 10101010;
	for(int i=0; i<n; ++i){
		int a, b;
		cin >> a >> b;
		if(b <= t && a <= ans){
			ans = a;
		}
	}
	if(ans == 10101010) cout << "TLE\n";
	else cout << ans << "\n";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
#define mii map <int, int>
#define mll map <ll, ll>
#define pii pair <int, int>
#define pll pair <ll, ll>
#define vi vector <int>
#define vd vector <double>
#define vll vector <ll>
#define fi first
#define se second
#define si set <int>
#define sll set <ll>
#define spii set <pii>
#define vs vector <string>
#define vpii vector <pair <int,int> >
#define vpll vector <pair <long long,long long> >
#define vvi vector <vector <int> >
#define vvpii vector <vector <pii > >
#define vb vector <bool>
#define vvb vector <vb>
#define mp make_pair
#define vvll vector <vll>
#define vsi vector <si>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define MANX MAXN
#define itn int
#define in(x); { for (auto &to : x) cin>>to;}
#define out(x); { for (auto &to : x) cout<<to<<" ";cout<<'\n'; }

const ll INFLL = 1e18;
const int MAXN = 1e6+100;
const ll INF = 1e9;
const ll mod1=1e9+7;
const ll mod2=2e9+11;

void solve()
{
    ll n,x,m;
    cin>>n>>x>>m;
    if (n==1)
    {
        cout<<x;
        return;
    }
    vll val={0};
    vector <int> pos(m);
    pos[x]=1;
    int now=2;
    while (true)
    {
   //     cout<<now<<" "<<n<<'\n';
        val.pb(x);
        x=(x*x)%m;
        if (pos[x]==0)
        {
            pos[x]=now++;
            if (now-1==n)
            {
                ll ans=0;
                for (int i=0;i<m;i++)
                {
                    if (pos[i]==0)
                        continue;
                    ans+=i;
                }
                cout<<ans;
                return;
            }
            continue;
        }
        int pre_cyc=pos[x]-1;
        ll ans=0;
        for (int i=0;i<=pre_cyc;i++)
            ans+=val[i];
        ll sz=now-1-(pre_cyc+1)+1;
        n-=pre_cyc;
        ll sum=0;
        for (int i=pre_cyc+1;i<val.size();i++)
            sum+=val[i];
        ans+=sum*(n/sz);
        n%=sz;
        for (int i=pre_cyc+1;i<pre_cyc+1+n;i++)
            ans+=val[i];
        cout<<ans;
        return;
    }
}

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    #ifdef Mip182
    freopen("a.in","r",stdin);
    #endif
    int _t;
    _t=1;
 //   cin>>_t;
    while (_t--)
        solve();
    //n=1 ?
    //recursion - matrix exponential
    //linear algebra - just a joke
    //check ios_base, MAXN, mod1 before submit
    //if debug more than 15 minutes - write stress
    //compression
}

Measured memory_bytes: 4272
import java.io.*;
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
 
     String[] nyu=sc.nextLine().split(" ");

//     String nyu=sc.nextLine();
int A=Integer.parseInt(nyu[0]);
int B=Integer.parseInt(nyu[1]);
int C=Integer.parseInt(nyu[2]);
//int D=Integer.parseInt(nyu);

int[] num=new int[300];
num[A+100]++;
num[B+100]++;
num[C+100]++;

//     String nyu2=sc.nextLine();
//int E=Integer.parseInt(nyu2);



//double A=Double.parseDouble(nyu[0]);
//double B=Double.parseDouble(nyu[1]);
/*
switch(C){
case 7:
case 5:
case 3:
System.out.println("YES") ;
break;
default:
System.out.println("NO") ;

break;
}
*/

//int res=Math.min((A*B),C);

//for(String tem:nyu){
//if(tem.equals("1"))res++;
//}
int res=0;
for(int i=0;i<300;i++){
if(num[i]==1)res=i;
}

//char[] c = nyu.toCharArray();


//System.out.println(nyu+"-"+line_r_2+"-"+nyu2+"-"+line_r_1);


//if(nyu.equals(line_r_2) && nyu2.equals(line_r_1)){
//double res=Math.ceil((AB)/2);

System.out.println(res-100);
//}else if((int)c[0]>(int)c[2]){
//System.out.println(">");

//}else{
//System.out.println("NO");

//}




	}
}

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

struct Edge
{
    int to;
    int from;
    int dist;
    Edge(int f, int t, int d) : from(f), to(t), dist(d) {}
};

using Graph = vector<vector<Edge>>;
Graph g;
vector<int> color;

void dfs(int v, int c)
{
    color[v] = c;
    for(auto e:g[v])
    {
        if(color[e.to]>=0) continue;
        int nc = e.dist == 0 ? c : int(c==0);
        dfs(e.to, nc);
    }
}

int main()
{   
    int n;
    cin >> n;
    g.resize(n);
    color.assign(n,-1);

    rep(i,n)
    {
        int u,v,w;
        cin >> u >> v >> w;
        g[u-1].push_back(Edge(u-1,v-1,w%2));
        g[v-1].push_back(Edge(v-1,u-1,w%2));
    }

    for(int i=0;i<n;++i)
    {
        if(color[i]>=0) continue;
        dfs(i,0);
    }

    for(int i=0;i<n;++i)
        cout << color[i] << endl;

    return 0;
}

Measured memory_bytes: 7424
/*
*
* author: ian macleod
*
*/

#include <bits/stdc++.h>

using namespace std;

typedef long long int ll;
typedef vector<long long int> vll;

#define IO                 \
    ios::sync_with_stdio(0); \
    cin.tie(0);              \
    cout.tie(0);
 
#define f(i,a,b) for(ll i=a;i<b;i++)
#define fo(i,a,b) for(ll i = a; i<=b;i+=1)
#define rf(i,a,b) for(ll i=a;i>=b;i--)

ll power(ll x, ll y) {
    ll res = 1;     // Initialize result
    x = x ;
    if (y==0)return 1;
    if(x==0)return 0;
    while (y > 0) {
        if (y & 1)
            res = (res*x);
        y = y>>1; // y = y/2
        x = (x*x);  // Change x to x^2
    }
    return res;
}


void solve() {
    
    string a, b;
    cin >> a >> b;
    string c = b.substr(0,b.length()-1);
    if (a.compare(c) == 0) {
        cout << "Yes" << endl;
    }
    else {
        cout << "No" << endl;
    }
    
    return ;
}



int main() {
    solve();
}



Measured memory_bytes: 3576
#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 ll long long int
#define ld long double
#define ordered_set tree < ll ,  null_type ,  less<ll> ,  rb_tree_tag ,  tree_order_statistics_node_update >
//added two more functions to set
//(1)*(set.find_by_order(k))[kth element in the sorted set] 
//(2)set.order_of_key(k)[count of elements strictly less than k]

typedef vector< int > vi;
typedef vector<long long> lvi;
typedef vector< vector<int> > vvi;
typedef vector< vector<long long> > lvvi;
typedef pair< int,int > ii;
typedef pair< long long,long long > lii;
typedef vector<pair<int,int>> vii;
typedef vector<pair<long long,long long>> lvii;
typedef vector<vector<pair<int,int>>> vvii;
typedef vector<vector<pair<long long,long long>>> lvvii;

#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)//remember i is an iterator
#define tc(t) int (t); cin>>(t);while((t)--)
#define ff first
#define ss second
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " is " << a << endl;
	err(++it, args...);
}

//-----------------------------------------------------------------------------------------------------------------------------------------------------------------
#define mod 1000000007
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

long long mos() { return 0LL; }
template<typename T, typename... Args>
T mos(T a, Args... args) { return ((a + mos(args...))%mod + mod)%mod; }

long long mop() { return 1LL; }
template<typename T, typename... Args>
T mop(T a, Args... args) { return (a*mop(args...))%mod; }
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------


signed main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);	
	ll n;
	cin>>n;
	ll ans=0;
	for(ll i=1;i<=n;i++)
	{
		ans += (i*(n-i+1));
	}
	for (int i = 0; i < n-1; ++i)
	{
		ll x,y;
		cin>>x>>y;
		if(x>y) swap(x,y);
		ans -= (x*(n-y+1));
	}
	cout<<ans<<endl;
	return 0;
}	

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#include<limits>
#define ll long long
#define F first
#define S second
#define pb push_back
#define oo 1e18
#define endl '\n'
#define si size()
#define all(v) v.begin(),v.end()
#define FASTIO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);

using namespace std;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
const long double Pi=acos(-1),e=2.718;
const int N=3e3+10,mod=1e9+7;
int n;
double dp[N][N],p[N];
double solve(int i,int h){
    if(i==n)return (h>n/2);
    double &ret=dp[i][h];
    if(ret==ret)return ret;
    ret = 0;
    ret += p[i]*solve(i+1,h+1);
    ret += (1-p[i])*solve(i+1,h);
    return ret;
}
int main()
{
    memset(dp,-1,sizeof dp);
    FASTIO
    cin >> n;
    for(int i=0;i<n;i++){
        cin >> p[i];
    }
    cout << fixed << setprecision(12) << solve(0,0) << endl;
    return 0;
}
/**

*/


Measured memory_bytes: 71296
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> lpair;
const ll MOD = 1e9 + 7;
#define rep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define print2(x,y) cout << (x) << " " << (y) << endl;
#define printa(x,n) for(ll i = 0; i < n; i++){ cout << (x[i]) << " ";} cout<<endl;
#define INF (1e18)
ll dp[1000010][4] = {};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll N, Q;
    string S;
    ll k[110];
    cin >> N >> S >> Q;
    rep(i,0,Q) cin >> k[i];
    ll cnt_M[1000010] = {};
    rep(i,0,N){
        if(S[i] == 'D'){
            dp[i+1][0] += dp[i][0] + 1;
            dp[i+1][1] += dp[i][1];
            dp[i+1][2] += dp[i][2];
        }else if(S[i] == 'M'){
            cnt_M[i+1] = 1;
            dp[i+1][1] += dp[i][0] + dp[i][1];
            dp[i+1][0] = dp[i][0];
            dp[i+1][2] = dp[i][2];
        }else if(S[i] == 'C'){ 
            dp[i+1][2] += dp[i][1];
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];
        }else{
            dp[i+1][2] = dp[i][2];
            dp[i+1][0] = dp[i][0];
            dp[i+1][1] = dp[i][1];

        }
    }
    rep(i,0,N+1) cnt_M[i+1] += cnt_M[i];
    // printa(cnt_M, N+1);
    // rep(j,0,3){
    //     rep(i,0,N+1){
    //         cout << dp[i][j] << " \n"[i == N];
    //     }
    // }
    rep(q,0,Q){
        ll ans = 0;
        rep(i,0,N){
            if(S[i] == 'C'){
                if(i < k[q]){
                    ans += dp[i+1][1];
                    // print2(i, dp[i+1][1]);
                }else{
                    ans += dp[i+1][1] - dp[i+1-k[q]][1] - dp[i+1-k[q]][0] * (cnt_M[i+1] - cnt_M[i+1-k[q]]);
                    // ans += dp[i+1][1] - dp[i-k[q]][1] - dp[i-k[q]][0];
                    // print2(i, dp[i+1][1] - dp[i-k[q]][1] - dp[i-k[q]][0]);
                    // print(dp[i+1][1] - dp[i+1-k[q]][1] - dp[i+1-k[q]][0] * (cnt_M[i+1] - cnt_M[i-k[q]]));
                }
            }
            // print(ans);
        }
        // rep(i,1,N+1){
        //     if(dp[i][2] == dp[i-1][2]) continue;
        //     if(i < k[q]) continue;
        // }
        // rep(i,k[q],N+1){
        //     ll v = dp[i][2] - dp[i-k[q]][0] - dp[i-k[q]][1] - dp[i-k[q]][2];
        //     print(v);
        //     ans += dp[i][2] - dp[i-k[q]][0] - dp[i-k[q]][1] - dp[i-k[q]][2];
        // }
        print(ans);
    }
}

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

ll d2sum[11][1001];
ll h,w,K;
vector<ll> group(ll bit,ll size)
{
	vector<ll> bitzen(size-1);
	for(ll i = 0;i<size-1;i++)
	{
		bitzen[i] = bit&1;
		bit/=2;
	}
	ll n = 0;
	vector<ll> res(size);
	for(ll i = 0;i<size-1;i++)
	{
		if(bitzen[i]==1)
		{
			res[i+1] = ++n;
		}
		else
		{
			res[i+1] = n;
		}
		
	}
	return res;
}

int main()
{
	
	cin >> h>> w>> K;
	vector<string> s(h);
	for(ll i = 0;i<h;i++)cin >> s[i];

	ll ans = INT_MAX;
	for(ll bit = 0;bit<(1<<(h-1));bit++)
	{
		
		ll N = 0;
		vector<ll> G = group(bit,h);
		N += G.back();
		bool isans = true;
		vector<ll> now(h);
		///for(auto I:G)cout<<' '<<I;cout<<endl;
		for(ll i = 0;i<w;i++)
		{
			
			for(ll j = 0;j<h;j++)
			{
				if(s[j][i]=='1')now[G[j]]++;
				if(now[G[j]]>K)
				{
					//cout<<';'<<i<<';'<<N<<endl;
					for(ll k = 0;k<h;k++)
					{
						now[k]=0;
					}
					for(ll k = 0;k<h;k++)
					{
						if(s[k][i]=='1')now[G[k]]++;
						if(now[G[k]]>K)isans=false;
					}
					//for(auto I:now)cout<<I<<' ';cout<<endl;cout<<';'<<isans<<endl;
					N++;
					break;
				}
			}
		}
		//cout<<N<<endl;
		if(isans)ans = min(N,ans);
	}

	cout<<ans<<endl;
	return 0;
	
	for(ll i = 0;i<h+1;i++)
	{
		for(ll j = 0;j<w+1;j++)
		{
			cout<<d2sum[i][j]<<' ';
		}
		cout<<endl;
	}
	
	return 0;
}

Measured memory_bytes: 256
#include <cstring>
#include <iostream>

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

    int ad_mat[n][n];
    memset(ad_mat, 0, sizeof(int) * n * n);

    int u, v, k;
    for (int i = 0; i < n; i++) {
        std::cin >> u >> k;
        for (int j = 0; j < k; j++) {
            std::cin >> v;
            ad_mat[u - 1][v - 1] = 1;
        }
    }
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n - 1; j++) {
            std::cout << ad_mat[i][j] << " ";
        }
        std::cout << ad_mat[i][n - 1] << std::endl;
    }
}



Measured memory_bytes: 3132
#include <stdio.h>
#include <stdlib.h>

void push(int);
int pop(void);

int list[100], top = 0;

int main(){
	int a, b;
	char str[6];
	
	while(1){
		if(scanf("%s", str) == EOF) break;
		if(str[0] == '+'){
			a = pop();
			b = pop();
			push(a+b);
		}
		else if(str[0] == '-'){
			a = pop();
			b = pop();
			push(b-a);
		}
		else if(str[0] == '*'){
			a = pop();
			b = pop();
			push(a*b);
		}
		else push(atoi(str));
	}
	
	printf("%d\n", list[top]);
	
	return 0;
}

void push(int x){
	top++;
	list[top] = x;
}

int pop(void){
	if(top == 0) exit(1);
	top--;
	return list[top+1];
}

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

using namespace std;

int main(){

    int test,a,b;
    cin>>test;

    vector<int>num;

    for(int i=0; i<test; i++){
        cin>>a;
        if(a==0){
            cin>>b;
            num.push_back(b);
        }
        else if(a==1){
            cin>>b;
            cout<<num.at(b)<<endl;
        }
        else if(a==2){
            num.pop_back();
        }
    }
   return 0;
}



Measured memory_bytes: 3824
#125 b
def age(x):
    if x%10==0:
        return x
    else:
        return x+10-x%10

r=[]
amari=[]
amari_new=[]
amari_min=10
ans=0
for i in range(5):
    d=int(input())
    amari.append(d%10)
    r.append(age(d))

for x in range(5):
    if x!=0 and amari_min>x:
        amari_min=x
ans+=sum(r)


for x in amari:
    if x!=0:
        amari_new.append(x)

if amari_new:
    amari_min=min(amari_new)
    ans-=10-amari_min

print(ans)

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

using namespace std;
 
//#define int long long
using ll = long long;
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(ll i=0;i<n;i++)
#define reps(i,n) for(ll i=0;i<=n;i++)

ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
 
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

ll modm(ll val, ll m) {
  ll res = val % m;
  if (res < 0) res += m;
  return res;
}

int main(){
    ios_base::sync_with_stdio(false);
    ll n,m,k,a,ans=0;
    cin >> n >> m;
    vector<ll> s(m,0);
    rep(i,n){
      cin >> k;
      rep(j,k){
        cin >> a;
        s[--a]++;
      }
    }
    rep(c,m){
      if(s[c]==n){
        ans++;
      }
    }

    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3552
#include <iostream>
#include <array>

int main()
{
    char S[4];
    for (int i=0; i<4; ++i){
        std::cin>>S[i];
    }

    if (S[0]==S[1] && S[2]==S[3] && S[0]!=S[2]){
        std::cout<<" Yes "<<std::endl;
    } else if (S[0]==S[2] && S[1]==S[3] && S[0]!=S[1]){
        std::cout<<" Yes "<<std::endl;
    } else if (S[0]==S[3] && S[1]==S[2] && S[0]!=S[1]){
        std::cout<<" Yes "<<std::endl;
    } else {
        std::cout<<" No "<<std::endl;
    }
    
    return 0;
}

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

const int MAX = 25;
const int NIL = -1;

struct Node
{
	int p,l,r;
};

Node T[MAX];
int n;

//先行順巡回
void preParse(int u)
{
	if (u == NIL) return;
	cout << " " << u;
	preParse(T[u].l);
	preParse(T[u].r);
}

//中間順巡回
void inParse(int u)
{
	if (u == NIL) return;
	inParse(T[u].l);
	cout << " " << u;
	inParse(T[u].r);
}

//後方順巡回
void postParse(int u)
{
	if (u == NIL) return;
	postParse(T[u].l);
	postParse(T[u].r);
	cout << " " << u;
}

int main()
{
	int v,l,r,root;
	for (int i = 0; i < MAX; ++i)
	{
		T[i].p = NIL;
	}

	cin >> n;

	for (int i = 0; i < n; ++i)
	{
		cin >> v >> l >> r;
		T[v].l = l;
		T[v].r = r;
		if (T[v].l != NIL) T[l].p = v;
		if (T[v].r != NIL) T[r].p = v;
	}

	for (int i = 0; i < n; ++i)
	{
		if (T[i].p == NIL) root = i;
	}

	cout << "Preorder" << endl;
	preParse(root);
	cout << endl;
	cout << "Inorder" << endl;
	inParse(root);
	cout << endl;
	cout << "Postorder" << endl;
	postParse(root);
	cout << endl;
}


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

int main(){
string s;  
    cin>>s;
    int len=s.size();
    int sum=0;
    for(int i=0;i<len;i++){
      sum+=s.at(i)-'0';//-"0"数字から数値へ変換
    }
    if(sum%9==0){
        cout<<"Yes"<<endl;
    }else{
        cout<<"No"<<endl;
    }
}


Measured memory_bytes: 3724
# C - Forbidden List

X, N = map(int, input().split())
P = list(int(p) for p in input().split())
P = set(P)
INF = 10**18

ans = 0
tmp = INF
for i in range(102):
    if i not in P:
        if abs(i-X) < tmp:
            tmp = abs(i-X)
            ans = i

print(ans)




Measured memory_bytes: 9124
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MAX_N 100000
#define MAX_M 100000
const int MAX = 100100;
const int MOD = 1000000007;
#define vec vector<int>
#define vecll vector<ll>
#define vecllvec vector<vector<ll>>
#define vecb vector<bool>
#define vecbvecb vector<vector<bool>>
#define vecst vector<string>
#define vecch vector<char>
#define vecf vector<float>
#define vecvec vector<vector<int>>
#define vecHvec vector<vector<char>>
#define all(x) (x).begin(),(x).end()
const long long INF = 1LL<<60;
#define PI 3.141592653589793
// cout << setprecision(15) << std::fixed;

void add(int &a, int b) {
    a += b;
    if (a >= MOD) a -= MOD;
}

int main() {
  int h,w;
  cin>>h>>w;
  vecst maze(h);
  for(int i=0;i<h;i++){
    cin>>maze[i];
  }
  int dp[1100][1100]={0};
  dp[0][0]=1;
  for(int i=0;i<h;i++){
    for(int j=0;j<w;j++){
      if(i+1<h&&maze[i+1][j]=='.') add(dp[i+1][j],dp[i][j]);
      if(j+1<w&&maze[i][j+1]=='.') add(dp[i][j+1],dp[i][j]);
    }
  }
  cout<<dp[h-1][w-1]%MOD<<endl;
}


Measured memory_bytes: 6016
#include <iostream>

using namespace std;

int main() {
    int x, y;

    while (1) {
        cin >> x >> y;

        if (x == 0 && y == 0) break;

        if(x < y){
            cout << x << " " << y << endl;
        }
        else {
            cout << y << " " << x << endl;
        }
    }

    return 0;
}


Measured memory_bytes: 3096
#include <iostream>
#include <limits.h>
#include <algorithm>
using namespace std;

long long n, cap, w[100010], v[100010];
long long dp[105][100010];

long long solve(long long j, long long u) {
    if (dp[j][u] > 0) return dp[j][u];
    
    if (j == 0) {
        if (w[0] <= u) dp[j][u] = v[0];
        else dp[j][u] = 0;
    }
    else if (u < w[j]) {
        dp[j][u] = solve(j - 1, u);
    }
    else {
        long long r1, r2;
        r1 = solve(j - 1, u);
        r2 = solve(j - 1, u - w[j]) + v[j];
        dp[j][u] = max(r1, r2);
    }
    
    return dp[j][u];
    
}


int main(void){
    cin >> n >> cap;
    for (int i = 0; i < n; i++) {
        cin >> w[i] >> v[i];
        for (int j = 0; j <= cap; j++) dp[i][j] = -1;
    }
    
    cout << solve(n - 1, cap) << endl;
    
    
}


Measured memory_bytes: 80128
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int a,b,c,d;
	cin >> a >> b;
	if(b<10){
	c=a*10+b;
}	
	if((b > 9) && (b < 100)){
	c=a*100+b;
}	
	if(b == 100){
	c=a*1000+b;
}
	d=0;
	for(int i=1;i<1000;i++){
	if(i*i == c){
	d=1;
}
}
	if(d == 1){
	cout << "Yes" << endl;
}
	if(d == 0){
	cout << "No" << endl;
}
}

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


int main(void) {
  int x, a, b;
  cin >> x >> a >> b;

  if (abs(x - a) < abs(x - b)) {
    cout << "A" << endl;
  } else {
    cout << "B" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3632
import sys


def input():
    return sys.stdin.readline().rstrip()


def main():
    BB=380000
    ans =0
    N =int(input())

    for i in range(N):
        x,v =input().split()
        if v =="JPY":
            ans +=int(x)
        else:
            ans +=BB*float(x)

    print(ans)


if __name__ == "__main__":
    main()


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

using namespace std;

int main() {
	// your code goes here
	int H,W;
  	int h,w;
  
    unsigned int temp = 0;
	temp = scanf("%d %d",&H,&W);
    temp = scanf("%d %d",&h,&w);
	
    long all = (H - h) * (W - w) ;

    printf("%d",all);
	return 0;
}


Measured memory_bytes: 256
import sys
sys.setrecursionlimit(10**8)
def line_to_int(): return int(sys.stdin.readline())
def line_to_each_int(): return map(int, sys.stdin.readline().split())
def line_to_list(): return list(map(int, sys.stdin.readline().split()))
def line_to_list_in_iteration(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
# def dp(init, i, j): return [[init]*i for i2 in range(j)]
#from collections import defaultdict #d = defaultdict(int) d[key] += value
#from collections import Counter # a = Counter(A).most_common()
from itertools import accumulate #A = [0]+list(accumulate(A))
import bisect #bisect.bisect_left(B, a), bisect.bisect_right(B,a)

n,m,k = line_to_each_int()
A = line_to_list()
B = line_to_list()

a, b = [0], [0]
a = [0]+list(accumulate(A))
b = [0]+list(accumulate(B))

ans, j = 0, m
for i in range(n+1):
    if a[i] > k:
        break
    while b[j] > k - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)


Measured memory_bytes: 48972
#include <bits/stdc++.h>
using namespace std;
#define PB push_back
int n,k;
int v[205];
bool r;
vector<int>g[205];
void dfs(int p,int o){
    v[p]=1;
    for(int i=0;i<g[p].size();i++){
        int u=g[p][i];
        if(u==o)r=true;
        if(!v[u])dfs(u,o);
    }
}
int main(void){
    cin>>n;
    for(int i=0;i<200;i++)v[i]=-1;
    for(int i=0;i<n;i++){
        int a,b;
        char s[10];
        scanf("%d %s %d",&a,s,&b);
        a--;
        b--;
        b+=100;
        if(s[0]=='l'){
            g[b].PB(a);
        }else{
            g[a].PB(b);
        }
    }
    for(int i=0;i<200;i++){
        for(int j=0;j<200;j++)v[j]=0;
        dfs(i,i);
    }
    if(r)cout<<1<<endl;
    else cout<<0<<endl;
}



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

using namespace std;
const int N = 1e5 + 5;
long long arr[N];

int main() {

//    freopen("in.txt", "r", stdin);
    int n, k;
    scanf("%d%d", &n, &k);
    int res = k;
    for(int i = 1; i < n; i++) res *= (k - 1);
    printf("%d", res);
    return 0;
}


Measured memory_bytes: 256
N,K=map(int,input().split())
A=list(map(int,input().split()))
v=[[0]*N for i in range(2)]
for i,a in enumerate(A):
    for j,aa in enumerate(A):
        if a>aa:
            if i<j:
                v[0][i]+=1
            elif i>j:
                v[1][i]+=1
r=0
m=10**9+7
for i in range(N):
    r+=((v[0][i]*K*(K+1)//2)%m+(v[1][i]*K*(K-1)//2)%m)%m
print(r%m)

Measured memory_bytes: 3188
#include <iostream>
#include<vector>
using namespace std;
long long rev(long long a,long long def){
	long long pow=def-2;
	long long ans=1;
	long long mul=a;
	while(pow>0){
		if(pow&1){
			ans*=mul;
			if(ans>def)ans%=def;
		}
		mul*=mul;
		if(mul>def)mul%=def;
		pow>>=1;
	}
	return ans;
}

int main() {
	long long n,a,b,c,d;cin>>n>>a>>b>>c>>d;
	vector<vector<long long>> dp(n+1,vector<long long>(n+1,0)),ik(n+1,vector<long long>(n+1,1));
	vector<long long> ke(n+1),p(n+1),prev(n+1);
	long long def=1;
	for(int i=0;i<9;i++){
		def*=10;
	}
	def+=7;
	p[0]=1;
	ik[0][1]=1;
	ke[0]=1;
	for(int i=1;i<=n;i++){
		p[i]=p[i-1]*i;
		if(p[i]>=def)p[i]%=def;
		ke[i]=ke[i-1]*i;
		if(ke[i]>def)ke[i]%=def;
		ik[i][1]=ik[i-1][1]*i;
		if(ik[i][1]>def)ik[i][1]%=def;
		for(int j=2;j<=n;j++){
			ik[i][j]=ik[i][j-1]*ik[i][1];
			if(ik[i][j]>def)ik[i][j]%=def;
		}
	}
	for(int i=0;i<=n;i++){
		prev[i]=rev(p[i],def);
		ke[i]=rev(ke[i],def);
		for(int j=1;j<=n;j++){
			ik[i][j]=rev(ik[i][j],def);
		}
	}
	dp[0][0]=1;
	for(int i=1;i<=n;i++){
		if(i>=a){
		for(int j=0;j<=n;j++){
			long long k=c;
			while(k<=d){
				if(j-i*k<0)break;
				if(k==0){
					dp[i][j]+=dp[i-1][j-i*k];
				}else{
					long long add=1;
					add=dp[i-1][j-i*k]*p[n-j+i*k];
					if(add>def)add%=def;
					add*=prev[n-j];
					if(add>def)add%=def;
					add*=ik[i][k];
					if(add>def)add%=def;
					add*=ke[k];
					if(add>def)add%=def;
					dp[i][j]+=add;

				}
				if(dp[i][j]>def)dp[i][j]%=def;
				k++;
			}
			dp[i][j]+=dp[i-1][j];
			if(dp[i][j]>def)dp[i][j]%=def;
		}
		}else{
			dp[i][0]=1;
		}
	}
//	for(int i=0;i<=n;i++){
//		for(int j=0;j<=n;j++){
//			cout<<dp[i][j]<<' ';
//		}
//		cout<<endl;
//	}
//	for(int i=0;i<=n;i++){
//		cout<<p[i]<<' ';
//	}
//	cout<<endl;
//	for(int i=0;i<=n;i++){
//		cout<<prev[i]<<' ';
//	}
//	cout<<endl;
	cout<<dp[b][n]<<endl;
	return 0;
}

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

const int m= 1000000007;
void testcase(){
    int n;
    cin >> n;
    int a[n];
    for(int i=0;i<n;i++)
        cin >> a[i];
    ll ans=0;
    vector <ll> sum;
    sum.push_back(a[n-1]);
    for(int i=n-2;i>0;i--){
        sum.push_back((sum.back()+a[i])%m);
    }
    for(int i=n-2;i>=0;i--){
        ans+= a[i]*sum[n-2-i];
        ans%=m;
    }
    cout << ans;
}


int main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int q=1;
  //  cin >> q;
    while(q--){
    testcase();
    }
    return 0;
}



Measured memory_bytes: 6088
#include <stdio.h>
 
int main(void) {
    int a, b, c;
    scanf("%d" "%d" "%d", &a, &b, &c);
    if (a + b == c || a + c == b || b + c == a){
      printf("Yes");
    }else{
      printf("No");
    }
  return 0;
}

Measured memory_bytes: 128
# coding: utf-8

N = int(input())
H = list(map(int, input().split()))

rev_H = H[::-1]

for i in range(N-1):
    if H[i] < H[i+1]:
        H[i+1] = H[i+1] - 1

for i in range(N-1):
    if H[i] > H[i+1]:
        print("No")
        exit()

print("Yes")

Measured memory_bytes: 14396
#include<bits/stdc++.h>
using namespace std;
long long n,m;
long long g[1005][1005];
int main(){
	cin>>n>>m;
	for(int i=1;i<=n;i++){
		for(int j=1;j<=n;j++)
			g[i][j]=-1e18;
		g[i][i]=0;
	}
	for(int i=1;i<=m;i++){
		long long u,w,c;
		scanf("%lld%lld%lld",&u,&w,&c);
		g[u][w]=c;
	}
	for(int k=1;k<=n;k++)
		for(int i=1;i<=n;i++)
			for(int j=1;j<=n;j++)
					g[i][j]=max(g[i][j],g[i][k]+g[k][j]);
	if(g[1][1]>0) cout<<"inf"<<endl;
	else cout<<g[1][n]<<endl;
	return 0;
}

Measured memory_bytes: 8064
import java.io.*;
import java.util.*;

public class Main {
    static ContestScanner in;
    static Writer out;
    public static void main(String[] args) {
        Main main = new Main();
        try {
            in = new ContestScanner();
            out = new Writer();
            main.solve();
            out.close();
            in.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    void solve() throws IOException {
        int n = in.nextInt();
        int s = 0;
        int k = 0;
        for (int i = 0; i < n; i++) {
            int a = in.nextInt();
            if(a >= 3200) {
                k++;
            } else {
                s |= 1 << (a / 400);
            }
        }
        int min = s == 0 ? 1 : Integer.bitCount(s);
        if(s > 0) k += Integer.bitCount(s);
        System.out.println(min + " " + k);
    }

}

@SuppressWarnings("serial")
class MultiSet<T> extends HashMap<T, Long>{
    @Override public Long get(Object key){return containsKey(key)?super.get(key):0L;}
    public void add(T key,long v){put(key,get(key)+v);}
    public void add(T key){put(key,get(key)+1);}
    public void sub(T key){final long v=get(key);if(v==1)remove(key);else put(key,v-1);}
    public MultiSet<T> merge(MultiSet<T> set)
    {MultiSet<T>s,l;if(this.size()<set.size()){s=this;l=set;}else{s=set;l=this;}
        for(Entry<T,Long>e:s.entrySet())l.add(e.getKey(),e.getValue());return l;}
}

class Writer extends PrintWriter{
    public Writer(String filename)throws IOException
    {super(new BufferedWriter(new FileWriter(filename)));}
    public Writer()throws IOException{super(System.out);}
}
class ContestScanner implements Closeable{
    private BufferedReader in;private int c=-2;
    public ContestScanner()throws IOException
    {in=new BufferedReader(new InputStreamReader(System.in));}
    public ContestScanner(String filename)throws IOException
    {in=new BufferedReader(new InputStreamReader(new FileInputStream(filename)));}
    public String nextToken()throws IOException {
        StringBuilder sb=new StringBuilder();
        while((c=in.read())!=-1&&Character.isWhitespace(c));
        while(c!=-1&&!Character.isWhitespace(c)){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public String readLine()throws IOException{
        StringBuilder sb=new StringBuilder();if(c==-2)c=in.read();
        while(c!=-1&&c!='\n'&&c!='\r'){sb.append((char)c);c=in.read();}
        return sb.toString();
    }
    public long nextLong()throws IOException,NumberFormatException
    {return Long.parseLong(nextToken());}
    public int nextInt()throws NumberFormatException,IOException
    {return(int)nextLong();}
    public double nextDouble()throws NumberFormatException,IOException
    {return Double.parseDouble(nextToken());}
    public void close() throws IOException {in.close();}
}


Measured memory_bytes: 23380
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,m,i,j,t;
  string s;
  while(cin>>s)
  {
    int p=0;
    int sz=s.size();
    for(i=0;i<sz;i+=2)
    {
      if(s[i]=='L'){
          p=1;
          break;

      }
    }
      for(i=1;i<sz;i+=2)
    {
      if(s[i]=='R'){
          p=1;
          break;

      }

    }

    if(p==1)printf("No\n");
    else printf("Yes\n");
  }
  return 0;
}


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

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef string st;
typedef vector<int> vi;
#define all(v) ((v).begin()),((v).end())
#define allr(v) v.rbegin(),v.rend()
#define repi(n)  for(int i = 0; i < (int)(n); ++i)
#define repj(n)  for(int j = 0; j < (int)(n); ++j)
#define endl "\n"
#define sz(n) n.size()
#define RT(v) return cout<<v,0
#define watch(x) cout<<#x<<" = { "<<x<<" }\n"
ll gcd(ll a, ll b) { return !b ? abs(a) : gcd(b, a % b); }
ll lcm(ll a, ll b) { return abs(a / gcd(a, b)) * b; }
void run() {
#ifndef ONLINE_JUDGE
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
#endif
}
void Ahmed_Meky()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}


int main()
{

	Ahmed_Meky();  		   /*█▀▀▄░░░░░░░░░░░▄▀▀█
							░█░░░▀▄░▄▄▄▄▄░▄▀░░░█  
							░░▀▄░░░▀░░░░░▀░░░▄▀
							░░░░▌░▄▄░░░▄▄░▐▀▀
							░░░▐░░█▄░░░▄█░░▌▄▄▀▀▀▀█
							░░░▌▄▄▀▀░▄░▀▀▄▄▐░░░░░░█
							▄▀▀▐▀▀░▄▄▄▄▄░▀▀▌▄▄▄░░░█
							█░░░▀▄░█░░░█░▄▀░░░░█▀▀▀
							░▀▄░░▀░░▀▀▀░░▀░░░▄█▀
							░░░█░░░░░░░░░░░▄▀▄░▀▄
							░░░█░░░░░░░░░▄▀█░░█░░█
							░░░█░░░░░░░░░░░█▄█░░▄▀
							░░░█░░░░░░░░░░░████▀
							░░░▀█▄▄▄▀▀▀▀▄▄▄█▀*/

	ll a,b,c;
	cin >> a>>b>>c;
	
	swap(a, b);
	swap(a, c);
	cout <<a<<" "<<b<<" "<<c ;

	
    //system("pause");
	return 0;

}


Measured memory_bytes: 256
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<functional>
#include<vector>
#include<queue>
#include<stack>
#include<set>
#include<map>
using namespace std;
#define MOD 1000000007
#define f(i,n) for(int i=0;i<int(n);i++)
#define N 200000

int main(){
	long long n,m;
	scanf("%lld", &n);
	long long x = 1;
	long long ans=1000;
	long long y;
	while (x < n){
		m = n / x;
		y = m % 1000;
		if (y > 99){
			if (abs(y - 753) < ans)ans = abs(y - 753);
		}
		x = x * 10;
	}
	printf("%lld\n", ans);


	return 0;
}

Measured memory_bytes: 128
import java.io.*;

class Main{
  public static void main(String[] args) throws Exception{
   int x, ans;
   
   BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
   x = Integer.parseInt(br.readLine());

   ans = x*x*x;
   System.out.println(ans);
  }
}

Measured memory_bytes: 24280
#include <algorithm>
#include <iostream>
#include <vector>

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

    int num_odd = 0;
    for (int i = 0; i < n; i++) {
        int temp;
        std::cin >> temp;

        if (temp % 2) {
            num_odd++;
        }
    }

    if (num_odd % 2) {
        std::cout << "NO" << std::endl;
    } else {
        std::cout << "YES" << std::endl;
    }
}


Measured memory_bytes: 256
import java.util.*;

public class Main{
    static int N;
    static Map<Integer,Set<Integer>> friend;
    static Map<Integer, Set<Integer>> block;
    public static void main(String args[]){
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int M = scanner.nextInt();
        int K = scanner.nextInt();
        ArrayList<ArrayList<Integer>> friend = new ArrayList<ArrayList<Integer>>();
        for(int i=0; i<N; i++) friend.add(new ArrayList<Integer>());

        UnionFind sns = new UnionFind(N);
        for(int i=0; i<M; i++){
            int a = scanner.nextInt() -1;
            int b = scanner.nextInt() -1;
            sns.union(a, b);
            friend.get(a).add(b);
            friend.get(b).add(a);
        }
        Map<Integer, List<Integer>> block = new HashMap<>();
        for(int i=0; i<N; i++){
            block.put(i, new ArrayList<>());
        }
        for(int i=0; i<K; i++){
            int c = scanner.nextInt() -1;
            int d = scanner.nextInt() -1;
            block.get(c).add(d);
            block.get(d).add(c);
        }
        for(int i=0; i<N; i++){
            int res = sns.size(i) - 1 - friend.get(i).size();
            for(int j:block.get(i)){
                if(sns.find(i) == sns.find(j)){
                    res--;
                }
            }
            System.out.print(res);
            System.out.print(" ");
        }

    }

    public static class UnionFind{
        private int[] d;
        public UnionFind(int num){
            d = new int[num];
            for(int i=0; i<num; i++){
                d[i] = -1;
            }
        }
        public void union(int a, int b){
            a = find(a);
            b = find(b);
            if(a == b){
                return;
            }
            if(-d[a] < -d[b]){
                int tmp = a;
                a = b;
                b = tmp;
            }
            d[a] += d[b];
            d[b] = a;
            // for(int i=0; i<d.length;i++){
            //     System.out.print(d[i]);
            //     System.out.print(" ");
            // }
        }
        public int find(int a){
            if(d[a] < 0){
                return a;
            }else{
                d[a] = find(d[a]);
                return d[a];
            }
        }
        public int size(int a){
            return -d[find(a)];
        }
    }
}

Measured memory_bytes: 179648
//code_sm
#include<bits/stdc++.h>
using namespace std;
//#include <ext/pb_ds/assoc_container.hpp> 
//using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> pseudo_set;
#define ll long long
#define vi vector<int>
#define si set<int>
#define msi multiset<int>
#define mii map<int,int>
#define pb push_back
#define pii pair<int,int>
#define extract_word(s)  stringstream str(s); while(str>>word)
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define SET(s) cout<<fixed<<setprecision(s)
#define chotu ((int)1e9+7)
//sieve generation begin
vi PRIME;
void sieve(int n)
{
	bool a[n+1];
	memset(a,0,sizeof(a));
	a[0]=1;
	a[1]=1;
	for(int i=2;i*i<=n;i++)
	{
		if(a[i]==0)
		{
			for(int j=i*i;j<=n;j+=i)
			a[j]=1;
		}
	}
	for(int i=2;i<=n;i++)
	{
		if(a[i]==0)
		PRIME.pb(i);
	}
}
//sieve generation end
ll gcd(ll a,ll b)
{
	while(b%a)
	{
		ll c=b;
		b=a;
		a=c%a;
	}
	return a;
}
ll bigpow(ll x,ll y)
{
	if(y==0)
	return 1;
	else if(y&1)
	{
		return (x*bigpow((x*x)%chotu,(y-1)/2))%chotu;
	}
	else 
	return bigpow((x*x)%chotu,y/2);
}
//fastio
/*void fastscan(int &number) 
{ 
    //variable to indicate sign of input number 
    bool negative = false; 
    register int c; 
  
    number = 0; 
    c = getchar(); 
    if (c=='-') 
    { 
        
        negative = true; 
  
        c = getchar(); 
    } 
    for (; (c>47 && c<58); c=getchar()) 
        number = number *10 + c - 48; 
    if (negative) 
        number *= -1; 
} 
*/
void solve()
{
	fastio
}
int main()
{
//code
fastio
int r;
cin>>r;
float x=2*3.14159*(float)r;
cout<<x;
}


Measured memory_bytes: 3804
#include <iostream>
#include <vector>
using namespace std;
int main(void){
    // Your code here!
    vector<int> X(5);
    for (int& elem : X)
        cin >> elem;
    for (int i=0; i<X.size();i++){
        if(X.at(i) == 0)
            cout << i+1;
    }
}

Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
signed main(){
  int i,x,flag=0;
  cin>>i;
  for(int j=3;j<=i;j++){
    x=j;
    while(true){
      if(x==0){
	break;
      }
      if(x%10==3)
	flag=1;
      x/=10;
    }
    if(flag==1 || j%3==0)
      cout<<' '<<j;
    flag=0;
  }
  cout<<'\n';
  return(0);
}



Measured memory_bytes: 3096