akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i) 
#define rrep(i, a, b) for (int i = (a); i < (b); ++i)
#define PI acos(-1)
#define pcnt __builtin_popcountll
#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define sz(x) (int)(x).size()
#define v(T) vector<T>
#define vv(T) v(v(T))
#define fi first
#define se second

using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using LP = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using tl = tuple<ll, ll, ll>;

template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) {if (a > b) { a = b; return true; } return false; }

ll INF = 1001001001;
ll LINF = 1001001001001001001ll;

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

    map<string, ll> mp;
    ll n; cin>>n;
    vector<string> ss{
        "AC", "WA", "TLE", "RE",
    };
    rep(i, 4) mp[ss[i]] = 0;
    rep(i, n) {
        string s; cin>>s;
        mp[s]++;
    }
    rep(i, 4) cout<<ss[i]<<" x "<<mp[ss[i]]<<endl;
}

Measured memory_bytes: 3652
def lcs(X, Y, m, n):
    L = [[0 for x in range(n+1)] for x in range(m+1)]
 
    # Following steps build L[m+1][n+1] in bottom up fashion. Note
    # that L[i][j] contains length of LCS of X[0..i-1] and Y[0..j-1] 
    for i in range(m+1):
        for j in range(n+1):
            if i == 0 or j == 0:
                L[i][j] = 0
            elif X[i-1] == Y[j-1]:
                L[i][j] = L[i-1][j-1] + 1
            else:
                L[i][j] = max(L[i-1][j], L[i][j-1])
 
    # Following code is used to print LCS
    index = L[m][n]
 
    # Create a character array to store the lcs string
    lcs = [""] * (index)
 
    # Start from the right-most-bottom-most corner and
    # one by one store characters in lcs[]
    i = m
    j = n
    while i > 0 and j > 0:
 
        # If current character in X[] and Y are same, then
        # current character is part of LCS
        if X[i-1] == Y[j-1]:
            lcs[index-1] = X[i-1]
            i-=1
            j-=1
            index-=1
 
        # If not same, then find the larger of two and
        # go in the direction of larger value
        elif L[i-1][j] > L[i][j-1]:
            i-=1
        else:
            j-=1
 
    return "".join(lcs) 

n = int(input())
s = [sorted(input(), key = str.lower) for i in range(n)]

t = s[0]
for i in range(1, n):
    t = lcs(t, s[i], len(t), len(s[i]))

print("".join(sorted(t)))
    


Measured memory_bytes: 3188
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <vector>

#define REP(i,n) for(int i=0;i<(int)n;i++)
#define REP1(j,n) for(int j=0;j<(int)n;j++)
#define REPD(i,n) for(int i=n;i>=0;i--)
#define REPD1(j,n) for(int j=n;j=>0;j--)
#define REPS(i,n) for(int i=1;i<=(int)n;i++)
#define REPS1(j,n) for(int j=1;j<=(int)n;j++)
#define rep(i,a,n) for(int i=a;i<(int)n;i++)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define DescSort(a) sort(a.begin(),a.end(),std::greater<int>())

using namespace std;
typedef long long ll;

int main(void) {
	string s;
	int val = 700;
	int count = 0;
	cin >> s;
	if (s[0] == 'o') count++;
	if (s[1] == 'o')count++;
	if (s[2] == 'o')count++;
	cout << val + 100 * count << endl;
	return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<math.h>
#include<queue>
#include<vector>
#include<climits>
#include<map>
#include<string>
#include<functional>
#include<iomanip>
#include<deque>
#include<random>
#include<set>
#include<bitset>

using namespace std;
typedef long long ll;
typedef double lldo;
#define mp make_pair
#define pub push_back
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
ll gcd(ll a, ll b) { if (a % b == 0) { return b; } else  return gcd(b, a % b); }
ll lcm(ll a, ll b) { if (a == 0) { return b; }return a / gcd(a, b) * b; }
template<class T>ll LBI(vector<T>& ar, T in) { return lower_bound(ar.begin(), ar.end(), in) - ar.begin(); }
template<class T>ll UBI(vector<T>& ar, T in) { return upper_bound(ar.begin(), ar.end(), in) - ar.begin(); }

ll n, r;

int main() {
	cin >> n >> r;
	if (n < 10) {
		cout << r + 100 * (10 - n) << endl;
	}
	else {
		cout << r << endl;
	}
	return 0;
}

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

typedef long long ll;
ll cnt[200005];
ll pre[200005];
int main() {
    int n;cin>>n;
    for(int i=1;i<=n;i++) cin>>pre[i],cnt[pre[i]]++;
    ll sum=0;
    for(int i=1;i<=n;i++){
        sum+=cnt[i]*(cnt[i]-1)/2;
    }
    for(int i=1;i<=n;i++){
        cout<<sum-cnt[pre[i]]+1<<endl;
    }
    return 0;
}

Measured memory_bytes: 4736
fun main(args : Array<String>) {
    val (n, m, v, p) = readLine()!!.split(" ").map { it.toLong() }
    val aa = readLine()!!.split(" ").map { it.toLong() }.sortedDescending()

    var cnt = 0L
    var min = -1L
    var minSum = 0L
    var lastIndex = 0

    repeat(n.toInt()) {
        if (it < p) {
            cnt++
            if (aa[it] != min) {
                min = aa[it]
                minSum = min
                lastIndex = it
            } else {
                minSum += min
            }
            return@repeat
        }

        if (min == aa[it]) {
            cnt++
            minSum += min
            return@repeat
        }

        val max = aa[it] + m
        if (max < min) {
            println(cnt)
            return
        }

        val countUpSafely = (n - it) + lastIndex
        if (v <= countUpSafely) {
            cnt++
            minSum += aa[it]
            return@repeat
        }

        val vNeeded = v - countUpSafely
        val voteSum = minSum + (m * vNeeded)
        val itemCnt = it - lastIndex
        if (voteSum <= itemCnt * max) cnt++
        minSum += aa[it]
    }

    println(cnt)
}

Measured memory_bytes: 54684
import java.util.Scanner;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        while(true) {
        	int n = sc.nextInt();
        	if(n == 0) break;
        	int[] a = new int[n];
        	int sum = 0;
        	for(int i=0;i<n;i++) {
        		a[i] = sc.nextInt();
        		sum += a[i];
        	}
        	int ave = sum/n;
        	int cnt = 0;
        	for(int i=0;i<n;i++) {
        		if(a[i] <= ave) cnt++;
        	}
        	System.out.println(cnt);
        }
        
    }
}


Measured memory_bytes: 58400
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <stack>
#include <functional>
#include <queue>
#include <cmath>
#include <set>
#include <map>

#define rep(i,j,k) for(int i=j;i<k;i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vi vector<int>
#define INF 1000000000
#define MOD 1000000007
#define pb push_back
#define MP make_pair
typedef long long ll;
typedef std::pair<int,int> pii;
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

using namespace std;

int main() {
    string yes="POSSIBLE",no="IMPOSSIBLE";
    int n,m;
    cin>>n>>m;
    vector<bool> from(n,false),to(n,false);
    rep(i,0,m){
        int a,b;
        cin>>a>>b;
        if(a==1){
            from[b-1]=true;
        }
        if(b==n){
            to[a-1]=true;
        }
    }
    
    rep(i,0,n){
        if(from[i]&&to[i]){
            cout<<yes<<endl;
            return 0;
        }
    }
    cout<<no<<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>

#define ll long long int
#define pb push_back
#define eb emplace_back
#define xx first
#define yy second
#define INF 0x3f3f3f3f

using namespace std;
using namespace __gnu_pbds;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
typedef tree<pair<int,int>,null_type, less<pair<int,int>>,rb_tree_tag,tree_order_statistics_node_update>   ordered_set;
const int N=1e6+1, mod=1e9+7;

int main(){
	ios_base::sync_with_stdio(0);	cin.tie(0);
	int n,i,j;
	cin>>n;
	ll a[n],dp[n][n];
	memset(dp,0,sizeof dp);
	for(i=0;i<n;i++)cin>>a[i];
	for(i=1;i<n;i++)a[i]+=a[i-1];
	
	for(int len=1;len<=n;len++){
		for(i=0;i+len-1<n;i++){
			if(len==1){
				dp[i][i]=0;
				continue;
			}
			j=i+len-1;
			dp[i][j]=1e15;
			for(int k=1;k<len ;k++){
				dp[i][j]=min(dp[i][j], dp[i][i+k-1]+dp[i+k][j] );
			}
			dp[i][j]+=(  a[j]-(i==0?0:a[i-1]) );
		}
	}
	cout<<dp[0][n-1];
}
// check for any potential overflow before submitting


Measured memory_bytes: 1536
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(long long i=0;i<x;i++)
#define repn(i,x) for(long long i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())
vector<pair<string,P> >vec;
// vector<vector<int>> data(3, vector<int>(4));

void solve(string s){
	ll t = 0;
	rep(i, s.length()) {
		if (s[i] == 'p') t++;
	}
	cout << (s.length()/2-t) << endl;
}

int main(){	
	string s;
	cin >> s;
	solve(s);
	return 0;
}



Measured memory_bytes: 512
import * as fs from 'fs';

namespace AtCoder.abc082 {

    export class Program {

        constructor(private readonly args: string[][]) {
        }

        /**
         * in
         *
         * out
         *
         */
        main(this: Program): void {
            const [a, b]: number[] = this.args[0].map(Number);
            console.log(Math.ceil((a + b) / 2));
        }
    }
}

const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
const prg: AtCoder.abc082.Program = new AtCoder.abc082.Program(args);
prg.main();


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

static const int N =100;

int main(){
  int n,p[N+1],m[N+1][N+1];
  int i,j,k,l;
  cin >>n;
  for(i=1;i<=n;i++){
  cin >>p[i-1]>>p[i];
  }
  for(i=1;i<=n;i++)m[i][i]=0;
  for(l=2;l<=n;l++){
    for(i=1;i<=n-l+1;i++){
      j=i+l-1;
      m[i][j]=(1<<21);
      for(k=i;k<=j-1;k++){
        m[i][j]=min(m[i][j],m[i][k]+m[k+1][j]+p[i-1]*p[k]*p[j]);
      }
    }
  }
  cout <<m[1][n]<<endl;
  
  return 0;
}


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

int main() {
	int n; cin >> n;
	unordered_map<string, int> map;
	for (int i=0; i<n; i++) {
		string ver; cin >> ver;
		map[ver]++;
	}
	cout << "AC x " << map["AC"] << endl;
	cout << "WA x " << map["WA"] << endl;
	cout << "TLE x " << map["TLE"] << endl;
	cout << "RE x " << map["RE"];
}

Measured memory_bytes: 3540
fun main(args: Array<String>) = abc159d()

fun abc159d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }

    val groupBy = aList.groupBy { it }.mapValues { it.value.size.toLong() }

    val allMap = groupBy.map {
        var num = 0L
        for (i in 0 until it.value) num += i
        Pair(it.key, num)
    }.toMap()

    val allSum = allMap.map { it.value }.sum()

    val minusMap = groupBy.map {
        var num = 0L
        for (i in 0 until it.value - 1) num += i
        Pair(it.key, num)
    }.toMap()

    val answer = aList.map { allSum - allMap[it]!! + minusMap[it]!! }.joinToString(System.lineSeparator())

    println(answer)
}


Measured memory_bytes: 134396
#include<iostream>
#include<vector>
#include <algorithm>
#include <cmath>
#include <numeric>
#include <limits>
#include <map>
#include <bitset>
#include <iomanip>

#define rep(i,n) for(int (i) = 0; (i)<(n); (i)++)
#define FOR(i,s,e) for(int (i) = (s); (i)<(e); (i)++)
#define vecall(itr,vec) for(auto (itr) = (vec).begin(); (itr) != (vec).end(); (itr)++)
#define vecshow(vec) for(auto itr = (vec).begin(); itr != (vec).end(); itr++)cout << *itr << " ";

using namespace std;
using p = pair<int, int>;
using ll = long long;

int gcd(int a, int b) {
	int l = max(a, b);
	int s = min(a, b);
	while (l * s != 0) {
		int tmp = s;
		s = l % s;
		l = tmp;
	}

	return l;
}



int main() {
	int n;

	cin >> n;
	while (n > 0) {
		n -= 1000;
	}
	cout << -n << endl;
	return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
//#pragma GCC optimize "-O3"
typedef unsigned long long ull;
typedef unsigned int ui;
typedef unsigned short us;
typedef long long ll;
typedef long double ld;
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll infll=(1ull<<63)-1;
const int inf=(1ull<<31)-1;
int n;
map<int,int> mp;

int main()
{
	//freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
	ios_base::sync_with_stdio(false); cin.tie(0);cout.precision(18);
	cin>>n;
	for (int i=1;i<10;i++)
		for (int j=1;j<10;j++)
			mp[i*j]=1;
	if (mp[n]==1)
		cout<<"Yes";
	else 
		cout<<"No";
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define in freopen("input.txt", "r" ,stdin)
#define out freopen("output.txt", "w" , stdout)
#define ll long long
#define inf 200005
#define fr first
#define  sc second
#define pb push_back
#define p_b pop_back
#define p_f pop_front
#define mp make_pair
#define N 100100
#define mod 1000000007
#define pi 3.1415926535
using namespace std;
int n;
ll a[3035];
ll dp[3035][3035];
ll brute (ll l , ll r , ll t) {
    if (l > r){
            return 0;
    }
    if (dp[l][r] != -1) return dp[l][r];
    ll res = 0;
    if (t == 1) {
        res = max (brute (l+1,r,2) + a[l] , brute (l ,r-1,2) + a[r]);
    }
    else res = min (brute(l+1,r,1) - a[l] , brute (l,r-1,1) - a[r]);

    return dp[l][r]=res;
}
int main (){
//in;out;
ios_base::sync_with_stdio(0);
cin >> n;
for (int i = 1; i <= 3030; i++){
    cin >> a[i];
}
for (int i = 0; i <=3030; i++){
    for (int j = 0; j <= 3030; j++){
        dp[i][j] = -1;
    }
}
cout << brute (1, n ,1);
}


Measured memory_bytes: 72320
#include<cstdio>
#include<iostream>
#include<cstring>
using namespace std;
typedef long long ll;
const int N=60;
const int mod=1e9+7;
int n,a[N][N],res[N][N],sav[N][N],ans;ll k;
inline void Add(int &x,int y){x+=y;x-=x>=mod? mod:0;}
inline void Mul1(){
	memset(sav,0,sizeof(sav));
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			for(register int p=1;p<=n;p++)
				Add(sav[i][j],1ll*res[i][p]*a[p][j]%mod);
	memcpy(res,sav,sizeof(sav));
}
inline void Mul2(){
	memset(sav,0,sizeof(sav));
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			for(register int p=1;p<=n;p++)
				Add(sav[i][j],1ll*a[i][p]*a[p][j]%mod);
	memcpy(a,sav,sizeof(sav));
}
int main(){
	scanf("%d%lld",&n,&k);
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			scanf("%d",&a[i][j]);
	for(register int i=1;i<=n;i++)res[i][i]=1;
	while(k){if(k&1)Mul1();k>>=1;Mul2();}
	for(register int i=1;i<=n;i++)
		for(register int j=1;j<=n;j++)
			Add(ans,res[i][j]);
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define loop(i,a,b) for(ll i=a;i<b;i++)
const int inf=1e9+7;

int main()
{	
     ll n;
     cin>>n;
     ll a[n][3];
     loop(i,0,n)
     {
     	loop(j,0,3)
     	cin>>a[i][j];
	 }
	 loop(i,1,n)
	 {
	 	 loop(j,0,3)
	 	 a[i][j]+=max(a[i-1][(j+1)%3],a[i-1][(j+2)%3]);
	 }
	 ll ans=0;
	 loop(j,0,3)
	 {
	 	ans=max(ans,a[n-1][j]);
	 }
	 cout<<ans;
    return 0;
}


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

typedef long long ll;

const int N = 1e6 + 100;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int r, g, b, n;
    cin >> r >> g >> b >> n;
    int ans = 0;
    for(int i = 0; i <= n; i += r) {
        for(int j = 0; i + j <= n; j += g) {
            int k = n - i - j;
            if(k%b == 0) ans++;
        }
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
/*Hey, What's up?*/

#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1.0)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
vector<long long>v;
int main()
{
    fastio;
    long long a=0,b=0,c,d,e,f=0,l,g,m,n,k,i,j,t,p,q;
    cin>>n;
    if(n%2){
        cout<<0<<'\n';
        return 0;
    }
    a=10;b=1;
    f=n/10;
    a=50;
    d=0;
    while(a<=n){
        f+=n/a;
        d++;
        a*=5;
    }
    cout<<f<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstring>
using namespace std;
int main()
{
    char s[105];
    cin >> s;
    if (strcmp(s,"SUN")==0) cout << 7;
    else if (strcmp(s,"MON")==0) cout << 6;
    else if (strcmp(s,"TUE")==0) cout << 5;
    else if (strcmp(s,"WED")==0) cout << 4;
    else if (strcmp(s,"THU")==0) cout << 3;
    else if (strcmp(s,"FRI")==0) cout << 2;
    else if (strcmp(s,"SAT")==0) cout << 1;
}


Measured memory_bytes: 256
from functools import reduce
from fractions import gcd


def greatest_common_divisor(iter):
    '''
    最大公約数を返す
    '''
    return reduce(gcd, iter)


N, K = map(int, input().split())
A = list(map(int, input().split()))

if K % greatest_common_divisor(A) != 0 or K > max(A):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

Measured memory_bytes: 16308
import java.util.*;
class Main {
	public static void main(String args[]) {
    	Scanner sc = new Scanner(System.in);
      	int[] res = new int[]{111,222,333,444,555,666,777,888,999};
      	int n = sc.nextInt();
      	int i = 0;
      	while(res[i] < n) {
        	i++;
        }
      	System.out.println(String.valueOf(res[i]));
    }
}

Measured memory_bytes: 22740
#include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)

int main() {
	long long n,cnt=0;
	string ans="YES";
    cin>>n;
    vector<long long>p(n);
    rep(i,n)cin>>p[i];
    rep(j,n){
        if(p[j]!=j+1)cnt++;
    }
    if(cnt>2)ans="NO";
    cout<<ans;
	return 0;
}

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

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

long long lcm(long long a, long long b){
    return a / gcd(a, b) * b;
}


int main(){
    int n;
    cin >> n;
    
    long long t1;
    cin >> t1;
    
    long long ans = t1;
    
    for (int i = 0; i < n-1; i++){
        long long t;
        cin >> t;
        ans = lcm(ans, t);
    }
    cout << ans << endl;
}

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

using namespace std;


#define A

#ifdef A
int main(void) {

	string w;
	string t;
	int ans = 0;
	cin >> w>>t;

	while (t != "END_OF_TEXT")
	{
		for (size_t i = 0; i < t.size(); i++)
		{
			t[i] = tolower(t[i]);
		}
		if (w == t) ans++;
		cin >> t;
	}
	cout << ans << endl;

	return 0;
}
#endif

Measured memory_bytes: 3088
/**
** 
** Last Updated: 2019/06/09 21:18:16 JST
** (c) was
**/
#include <bits/stdc++.h>
using namespace std;

int main() {
  //input
  int n; cin >> n;
  vector<int> w(n);
  for(int i=0; i<n; i++){
    cin >> w[i];
  }
  int sum1=0,sum2=0;
  int tmp,ans=999999999;
  //compute
  for(int i=0;i<n;i++){
    for(int j=0;j<n;j++){
      if(j<=i){
	sum1+=w[j];
      }
      else{
	sum2+=w[j];
      }
    }
    tmp=abs(sum1-sum2);
    ans=min(ans,tmp);
    sum1=0;
    sum2=0;
  }
  //output
  cout << ans << endl;
  return 0;
	
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define For(i, a, b) for(int (i)=(int)(a); (i)<(int)(b); ++(i))
#define rFor(i, a, b) for(int (i)=(int)(a)-1; (i)>=(int)(b); --(i))
#define rep(i, n) For((i), 0, (n))
#define rrep(i, n) rFor((i), (n), 0)
#define fi first
#define se second
using namespace std;
typedef long long lint;
typedef unsigned long long ulint;
typedef pair<int, int> pii;
template<class T> bool chmax(T &a, const T &b){if(a<b){a=b; return true;} return false;}
template<class T> bool chmin(T &a, const T &b){if(a>b){a=b; return true;} return false;}
template<class T> T div_floor(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>=0 ? a/b : (a+1)/b-1;
}
template<class T> T div_ceil(T a, T b){
    if(b < 0) a *= -1, b *= -1;
    return a>0 ? (a-1)/b+1 : a/b;
}

constexpr lint mod = 1e9+7;
constexpr lint INF = mod * mod;
constexpr int MAX = 200010;

int main(){
    lint a, b, c;
    scanf("%lld%lld%lld", &a, &b, &c);
    puts(c-a-b > 0 && 4*a*b < (c-a-b)*(c-a-b) ? "Yes" : "No");
}

Measured memory_bytes: 256
/*
auth - @sportykush
*/

#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;
 
typedef long long int ll;
typedef long double ld;
typedef tree<ll,null_type,less<ll>,rb_tree_tag,tree_order_statistics_node_update> ordered_set; 
 
//#define mp make_pair
#define bug(v) cerr<<#v<<" = "<<(v)<<endl;
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define pb emplace_back
#define vii vector<int>
#define vll vector<ll>
#define vpll vector< pair <ll,ll> >
#define pll pair <ll,ll>
#define pii pair <int,int>
#define pq priority_queue< int >
#define khtm "\n"
#define F first
#define S second
#define fr(i,a,n) for(i=a;i<n;i++)
#define mem(arr,l) memset(arr,l,sizeof arr)
#define ALL(x) x.begin(), x.end()
#define frr(i,a,n) for(i=n-1;i>=a;i--)
//#define mod 1000000007
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define testcase ll T; cin>>T; while(T--)
const int MAX = 1e6 +2;
const ll inf =  1e18;
const int N = 1010;

const int mod=1e9+7;
inline int add(int a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int mul(int a,int b){return (a*1ll*b)%mod;}
inline int power(int a,int b){int rt=1;while(b>0){if(b&1)rt=mul(rt,a);a=mul(a,a);b>>=1;}return rt;}


/*
important builtin functions
__gcd(value1, value2)
__builtin_ffs(x)
  Number of leading zeroes: __builtin_clz(x)
  Number of trailing zeroes : __builtin_ctz(x)
  Number of set bits: __builtin_popcount(x)
*/
 

ll i,j,k,m,l,r,n;
ll a[MAX];


int main()
{
 
  #ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
//cout << setprecision(15) << fixed;
fast

	string s;
	cin >> s;
	n = s.size();
    fr(i,0,n) 
    {
        a[i] = s[i] - '0';
    }
    ll b[n];
    b[n-1] = 1;
    frr(i,1,n) 
    {
        b[i-1] = (b[i] * 10) % 2019;
        //bug(b[i-1])
    }
    ll L[n],R[n];
    L[0] = (a[0] * b[0]) % 2019;
    fr(i,1,n)
    {
        L[i] = (L[i-1] + a[i] * b[i]) % 2019;
    }
    ll cnt[2019];
    fr(i,0,2019)
    	cnt[i] = 0;
    cnt[0] = 1;
    fr(i,0,n) {
        cnt[L[i]]++;
    }
    ll ans = 0;
    fr(i,0,2019)
    {
        if (cnt[i] >= 2) {
            ans += cnt[i] * (cnt[i]-1) / 2;
        }
    }
    cout << ans << endl;

  #ifndef ONLINE_JUDGE
  cout<<"\nTime Elapsed : " << 1.0*clock() / CLOCKS_PER_SEC << " s";
  #endif
 
  return 0;
 
}

Measured memory_bytes: 8452
N = int(input())
A =[i for i in map(int,input().split())]
A = sorted(A,reverse=True)
Alice = 0
Bob = 0
while len(A) != 0:
    Alice += int(A.pop(0))
    if len(A) == 0:
        break
    else:
        Bob += int(A.pop(0))

print(Alice - Bob)

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

#define MAXN (110)

char str[MAXN];

int main(){
	scanf("%s", str + 1);
	int n = strlen(str + 1), ans = INT_MAX;
	for(int i = 0; i < 26; ++ i){
		str[n + 1] = i + 'a';
		int pre = 0, now = 0;
		for(int j = 1; j <= n + 1; ++ j){
			if(str[j] == i + 'a'){
				now = std::max(now, j - pre - 1);
				pre = j;
			}
		}
		ans = std::min(ans, now);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	/*
	 * １行目に n と m が空白区切りで与えられます。
	 * 続く n 行に行列 A の要素 aij が空白区切りで与えられます。
	 * 続く m 行にベクトル b
	 * の要素 bi がそれぞれ１行に与えられます。
	 */

	/*
	 * ci=?j=1maijbj = ai1b1+ai2b2+...+aimbm
	 */
	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		String line = sc.nextLine();
		String[] lineArray = line.split("[\\s]+");

		int n = Integer.parseInt(lineArray[0]);
		int m = Integer.parseInt(lineArray[1]);

		int[][] array = new int[n][m];
		int[] vector = new int [m];
		long[] c = new long[n];

		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				array[i][j] = sc.nextInt();
			}
		}
		for (int i = 0; i < vector.length; i++) {
			vector[i] = sc.nextInt();
		}

		sc.close();

		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array[i].length; j++) {
				c[i] += array[i][j] * vector[j]; 
			}
		}

		for (long l : c) {
			System.out.println(l);
		}

	}

}

Measured memory_bytes: 31108
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using ld = long double;

const int N = 3010;
double dp[2][N];
int n;

int main(){
   ios_base::sync_with_stdio(0);
   cin.tie(0);
   cout.precision(10);
   cout << fixed;
   
   cin >> n;
   dp[0][0] = 1;
   bool at = 0;
   for (int i = 0; i < n; ++i){
      at ^= 1;
      double p;
      cin >> p;
      fill(dp[at], dp[at] + n  + 1, 0.0);
      for (int j = 0; j < n; ++j){
         dp[at][j + 1] += dp[at ^ 1][j] * p;
         dp[at][j] += dp[at ^ 1][j] * (1 - p);
      }
   }
   double ans = 0;
   for (int i = n / 2; i < n; ++i)
      ans += dp[at][i + 1];
   cout << ans << '\n';

   return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
using namespace std;
typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 1000000007;
typedef long double ld;
typedef complex<ld> Point;
const ll INF = mod * mod;
typedef pair<int, int> P;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;

struct uf {
private:
	vector<int> par, ran;
public:
	void init(int n) {
		par.resize(n, 0);
		ran.resize(n, 0);
		rep(i, n) {
			par[i] = i;
		}
	}
	int find(int x) {
		if (par[x] == x)return x;
		else return par[x] = find(par[x]);
	}
	void unite(int x, int y) {
		x = find(x), y = find(y);
		if (x == y)return;
		if (ran[x] < ran[y]) {
			par[x] = y;
		}
		else {
			par[y] = x;
			if (ran[x] == ran[y])ran[x]++;
		}
	}
	bool same(int x, int y) {
		return find(x) == find(y);
	}
};

P nex[1 << 21];
bool used[1 << 21];

void solve() {
	int n;
	uf u; u.init(1 << 21);
	string s;
	cin >> n >> s;
	int m = (1 << n);

	rep(i, n) {
		int z = (1 << i);
		rep(j, z) {
			int cur = m * i + j;
			nex[cur] = { cur + m + j,cur + m + j + 1 };
		}
	}

	rep(i, m) {
		Rep(j, i + 1, m) {
			if (s[i] == s[j]) {
				u.unite(n*m + i, n*m + j);
			}
		}
	}
	int ans = m - 1;
	per(i, n) {
		int z = (1 << i);
		rep(j, z) {
			int cur = m * i + j;
			nex[cur] = { u.find(nex[cur].first),u.find(nex[cur].second) };
		}
		rep(j, z) {

			int cur = m * i + j;
			//cout << cur << " " << nex[cur].first << " " << nex[cur].second << endl;
			if (nex[cur].first == nex[cur].second) {
				if (!u.same(cur, nex[cur].first))ans--;
				u.unite(cur, nex[cur].first); used[cur] = true;
				//cout << cur << " " << nex[cur].first << endl;
			}
		}
		rep(j, z) {
			Rep(k, j + 1, z) {

				int cle = m * i + j, cri = m * i + k;
				if (used[cle] || used[cri])continue;
				if (nex[cle] == nex[cri]) {
					if (!u.same(cle, cri))ans--;
					//cout << cle << " " << cri << endl;
					u.unite(cle, cri);
				}
			}
		}
	}
	cout << ans << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	//stop
	return 0;
}


Measured memory_bytes: 19084
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    *p, = map(int, input().split())
    ans = -1
    d = 10**10
    for i in range(-101, 102):
        if i in p:
            continue
        m = abs(i-X)
        if m < d:
            d = m
            ans = i
    print(ans)


Measured memory_bytes: 61672
#include <stdio.h>
int main() {
	int a,b,i,j;

	while(1)
	{
		scanf("%d %d",&a,&b);
		if(a==0 && b==0) break;
		for(i=0;i<a;i++)
		{
			for(j=0;j<b;j++)
			{
				printf("#");
			}
			printf("\n");
		}
		printf("\n");
	}

	return 0;
}



Measured memory_bytes: 2596
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <limits>

using namespace std;

#define ll long long

#define in(x) cin >> x
#define out(x) cout << x << endl

#define PI acos(-1)
#define pp push_back

#define Yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define No cout << "No" << endl
#define NO cout << "NO" << endl

#define vec2(type) vector<vector<type>>
#define vec3(type) vector<vector<vector<type>>>

#define For(i, n) for(int i = 0; i < n; i++)

template<typename T> void input(T *data, int n){
	For(i, n){
		cin >> data[i];
	}
}

template<typename T> void input(vector<T> &vec, int n){
	T temp;
	For(i, n){
		cin >> temp;
		vec.push_back(temp);
	}
}

template<typename T> void sort(vector<T> &ary){
	sort(ary.begin(), ary.end());
}

template<typename T> void rsort(vector<T> &ary){
	sort(ary.rbegin(), ary.rend());
}

void rstring(string &str){
	string temp = str;

	For(i, (int)str.size()){
		str[i] = temp[(str.size() - 1) - i];
	}
}

struct Vec{
	int x, y;
	Vec():
	x(0), y(0){}
	Vec(int _x, int _y):
	x(_x), y(_y){}
};

template<typename T> void print(T *x, int n){
	For(i, n){
		cout << x[i] << " ";
	}
	cout << endl;
}

template<typename T> void print(vector<T> &x){
	For(i, (int)x.size()){
		cout << x[i] << " ";
	}
	cout << endl;
}

int gcd(int n, int m){
	if(n % m == 0){
		return m;
	}
	else{
		return gcd(m, n % m);
	}
}

int main(){

	int n, q;
	int l[100000], r[100000];
	string s;

	int flag = 0;
	int num;

	cin >> n >> q >> s;
	For(i, q){
		cin >> l[i] >> r[i];
	}

	int forword[100000];

	For(i, n){
		if(i == 0){
			forword[i] = 0;
		}
		else{
			forword[i] = forword[i - 1];
		}

		if(s[i] == 'A'){
			flag = 1;
		}
		else if(s[i] == 'C' && flag == 1){
			forword[i]++;
			flag = 0;
		}
		else{
			flag = 0;
		}
	}

	For(i, q){
		num = forword[r[i] - 1] - forword[l[i] - 1];
		out(num);
	}

	return 0;

}

Measured memory_bytes: 2176
#include <iostream>
#include <vector>
#include <array>
#include <set>
#include <cmath>
#include <string>
#include <sstream>
#include <queue> 
#include <list>
#include <stack>
#include <unordered_map>
#include <algorithm> 
#include <numeric>  
#include <functional>
#include <cassert>
#include <bitset>
#include <cctype>  
#include <iomanip> 
#include <limits>  
#include <regex>
// std::numeric_limits<int>::max(), min()
// std::setprecision(X)
// std::islower(), std::isupper(), std::tolower, std::toupper
// std::accumulate(m.begin(), m.end(), 0LL);
// std::sort(begin(),end()) // 0, 1, 2, 3 ,4 (default, less);
// std::priority_queue<int, vector<int>, less<int>> que; // 4, 3, 2, 1 (defualt, less) : 
// if ( std::regex_match(S, std::regex("(dream|dreamer|erase|eraser)*")) ) std::cout << "YES" << std::endl;
 
#define rep(i, n) for(int i = 0; i < (int)(n);    i++)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
typedef long long ll;

ll gcd ( ll a, ll b ) { if ( b == 0 ) return a; else return gcd ( b, a%b ); }
ll lcm ( ll a, ll b ) { return a * b / gcd(a, b); }

const double pi = 3.14159265359;

int main (void) {
  std::cin.tie(0);  std::ios::sync_with_stdio(false);
  std::cout << std::setprecision(10) << std::fixed;
  double a, b, x; std::cin >> a >> b >> x;
  double area = x/a;
  double xs = x/(a*a);
  double arg = 0.;
  if ( 2*xs >= b ) {
    arg = std::atan(a/(2*b-2*xs));
  }
  else {
    double y = 2*area/b;
    arg = std::atan(y/b);
  }
  std::cout << 90. - arg * 180. / pi << std::endl;
  return 0;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N; cin >> N;
  vector<int> L(2*N);
  rep(i,2*N) cin >> L[i];
  sort(L.begin(), L.end());
  int ans = 0;
  rep(i, N) ans += L[2*i];
  cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		final int K = scan.nextInt();
		final int X = scan.nextInt();
		scan.close();

		for(int i = X - (K - 1); i < X + K; i++) {
			System.out.print(i + " ");
		}
	}

}

Measured memory_bytes: 21844
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')


X = I()
d = 100
for i in range(1, 3761):
    d = int(d * 1.01)
    if d >= X:
        print(i)
        exit(0)


Measured memory_bytes: 63884
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef tuple<ll,ll,ll> T;
const long long INF = 1LL<<60;
const int MOD = 1000000000+7;
#define rev(s) (string((s).rbegin(), (s).rend()))
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };
// cout << fixed << setprecision(10) << ans << endl;
// *min_element(c + l, c + r) *max_element(c + l, c + r)
// int dx[8]={1,1,0,-1,-1,-1,0,1};
// int dy[8]={0,1,1,1,0,-1,-1,-1};
// int dx[4]={1,0,-1,0};
// int dy[4]={0,1,0,-1};
// struct Edge {
//   int to, id;
//   Edge(int to, int id): to(to), id(id) {}
// };

const int MAX = 1000010;
// const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    COMinit();
    int N,K;cin>>N>>K;
    vector<vector<int>> tree(N,vector<int>());
    rep(i,N-1) {
        int a,b;cin>>a>>b;
        a--;b--;
        tree[a].push_back(b);
        tree[b].push_back(a);
    }
    vector<int> par(N,-1);
    ll ans = 1;
    queue<int> qu;
    qu.push(0);
    ans *= K;
    vector<bool> done(N,false);
    done[0] = true;
    while(!qu.empty()) {
        int now = qu.front();
        qu.pop();
        int cnt = 0;
        for(auto nxt : tree[now]) {
            if(!done[nxt]) {
                cnt++;
                ans = (ans * cnt) % MOD;
                done[nxt] = true;
                qu.push(nxt);
                par[nxt] = now;
            }
        }
        if(par[now]==-1) {
            ans = (ans * COM(K-1,cnt))%MOD;
        } else {
            ans = (ans * COM(K-2,cnt))%MOD;
        }
    }
    cout<<ans<<endl;
}

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

using namespace std;

typedef long long LL;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
mt19937 mrand(random_device{}());

#define rep(i , l , r) for (int i = (l); i < (r); ++i)

const int N = 2e6 + 5;
const int mod = 998244353;

int n , m;
int fac[N] , ifac[N];

template <typename T> inline void chkmin(T &x , T y) { x = min(x , y); }
template <typename T> inline void chkmax(T &x , T y) { x = max(x , y); }
template <typename T> inline void read(T &x) {
   T f = 1; x = 0;
   char c = getchar();
   for (; !isdigit(c); c = getchar()) if (c == '-') f = -f;
   for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + c - '0';
   x *= f;
}

inline int quickpow(int a , int n) {
	int res = 1;
	for (; n; n >>= 1 , a = 1LL * a * a % mod)
		if (n & 1) res = 1LL * res * a % mod;
	return res;
}
inline void inc(int &x , int y) {
	x = x + y < mod ? x + y : x + y - mod;
}
inline void dec(int &x , int y) {
	x = x - y >= 0 ? x - y : x - y + mod;
}
inline void init(int n) {
	fac[0] = 1;
	for (int i = 1; i <= n; ++i)
		fac[i] = 1LL * fac[i - 1] * i % mod;
	ifac[n] = quickpow(fac[n] , mod - 2);
	for (int i = n - 1; i >= 0; --i)
		ifac[i] = 1LL * ifac[i + 1] * (i + 1) % mod;
	return;
}
inline int binom(int n , int m) {
	if (n < m) return 0;
	else return 1LL * fac[n] * ifac[m] % mod * ifac[n - m] % mod;
}
inline int F(int n , int m , int k) {
	int ret = 0;
	for (int i = 0; i <= k; ++i) {
		if ((m - i) & 1) continue;
		int val = 1LL * binom(n , i) * binom((m - i) / 2 + n - 1 , n - 1) % mod;
		inc(ret , val);
	}
	return ret;
}

int main() {
   	
   	init(2e6);
   	read(n) , read(m);
   	int ans = F(n , 3 * m , m);
   	dec(ans , 1LL * n * F(n , m , m) % mod); 
   	inc(ans , 1LL * n * F(n - 1 , m , m) % mod);
   	printf("%d\n" , ans);
    return 0;
}


Measured memory_bytes: 19352
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;


public class Main {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// TODO Auto-generated method stub
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String[] tmpArray = br.readLine().split(" ");
		
		int h = Integer.parseInt(tmpArray[0]);
		int w = Integer.parseInt(tmpArray[1]);
		
		char[][] input = new char[h][w];
		char[][] canvas = new char[h][w];
		
		for(int i = 0; i < h; i++){
			String str = br.readLine();
			
			for(int j = 0; j < w; j++){
				input[i][j] = str.charAt(j);
				canvas[i][j] = '.';
			}
		}
		

		//各マスについて探索
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
				if(input[i][j] == '.'){
					continue;
				}
				
				int dx[] = {1,0,-1,0};
				int dy[] = {0,1,0,-1};
				
				//四方向チェック
				int dirCount = 0;
				for(int k = 0; k < 4; k++){
					if(inRange(j + dx[k], i + dy[k], h, w) &&
							input[i + dy[k]][j + dx[k]] == '#'){
						dirCount++;
					}
				}
				
				if(dirCount >= 1){
					canvas[i][j] = '#';
					for(int k = 0; k < 4; k++){
						if(inRange(j + dx[k], i + dy[k], h, w) && input[i + dy[k]][j + dx[k]] == '#'){
							canvas[i + dy[k]][j + dx[k]] = '#';
						}
					}

				}
			}
		}
		
		//同じように書けたかチェック
		for(int i = 0; i < h; i++){
			for(int j = 0; j < w; j++){
//				System.out.print(canvas[i][j]);
				if(input[i][j] != canvas[i][j]){
					System.out.println("No");
					return;
				}
			}
//			System.out.println();
		}
		
		System.out.println("Yes");
	}
	
	static boolean inRange(int x, int y, int h, int w){
		if(x >= 0 && x < w && y >= 0 && y < h){
			return true;
		}
		else {
			return false;
		}
	}

}


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

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int a=0;
	while (n-a*7>=0)
	{
		if ((n-a*7)%4==0)
		{
			cout<<"Yes\n";
			return 0;
		}
		++a;
	}
	cout<<"No\n";
	return 0;
}


Measured memory_bytes: 256
// amigos y no más
// dile a la jardinera que traigo flores
 
// += O(logn) ; + = O(n)
 
//#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>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
 
#define fastio ios_base::sync_with_stdio(0);cin.tie(0)
#define MOD 998244353LL
#define MOD1 1000000009LL
#define LIM 262150
#define FORN(i,j,n) for(int i=j; i<n;i++) 
#define FOR(i,n) FORN(i,0,n)
using namespace std;
using namespace __gnu_pbds;
 
typedef long long ll ;
typedef unsigned long long ull ;
typedef tree<int,int,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

ll N,M;

int main() {
	fastio;
	cin>>N>>M;

	cout<< ((N-1)*(N))/2 + ((M-1)*(M))/2<<"\n";
	
	return 0;
}

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

int main(void){
    int n, d, x, a[110], b[110];
    cin >> n >> d >> x;
    for(int i=0;i<n;++i){
        cin >> a[i];
        b[i] = a[i] + 1;
    }
    int cnt = x + n;
    for(int i=0;i<n;++i){
        while(1){
            if(b[i]>d) break;
            ++cnt;
            b[i] += a[i];
        }
    }
    cout << cnt << endl;
}

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

// TYPEDEF
// ----------------------------------------
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> Pair;
typedef vector<ll> vll;
typedef vector<vector<ll>> Graph;
typedef vector<string> vs;
typedef vector<pair<ll, ll>> Pll;
typedef queue<ll> qll;

// REPEAT
// ----------------------------------------
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REPA(i,a) for(ll i=0;i<(ll)(a.size());i++);
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#define COUT(a) cout << (a) << endl;
#define ENDL(a) cout << endl;
#define COUTA(i,a) for(ll i=0;i<(ll)(a.size());i++) {cout << (a)[i] << " ";} cout << endl;

// UTIL
// ----------------------------------------
#define pb push_back
#define paired make_pair
#define ALL(a) (a).begin(),(a).end()
#define SORT(a) sort((a).begin(),(a).end())
#define RSORT(a) sort((a).rbegin(), (a).rend())

// DEBUG
// ----------------------------------------
#ifdef _DEBUG
#define debug(x) cout << "[debug] " << #x << ": " << x << endl
#else
#define debug(x)
#endif

template <typename T>
void debugV(const vector<T> v) {
#ifdef _DEBUG
  rep(i, v.size()) {
    cout << i << ":" << v[i] << " ";
  }
  cout << endl;
#else
  (void)v;
#endif
}

// BIT FLAG
// ----------------------------------------
const unsigned int BIT_FLAG_0 = (1 << 0); // 0000 0000 0000 0001
const unsigned int BIT_FLAG_1 = (1 << 1); // 0000 0000 0000 0010
const unsigned int BIT_FLAG_2 = (1 << 2); // 0000 0000 0000 0100
const unsigned int BIT_FLAG_3 = (1 << 3); // 0000 0000 0000 1000
const unsigned int BIT_FLAG_4 = (1 << 4); // 0000 0000 0001 0000
const unsigned int BIT_FLAG_5 = (1 << 5); // 0000 0000 0010 0000
const unsigned int BIT_FLAG_6 = (1 << 6); // 0000 0000 0100 0000
const unsigned int BIT_FLAG_7 = (1 << 7); // 0000 0000 1000 0000
const unsigned int BIT_FLAG_8 = (1 << 8); // 0000 0001 0000 0000
const unsigned int BIT_FLAG_9 = (1 << 9); // 0000 0010 0000 0000
const unsigned int BIT_FLAG_10 = (1 << 10); // 0000 0100 0000 0000
const unsigned int BIT_FLAG_11 = (1 << 11); // 0000 1000 0000 0000

// CONST
// ----------------------------------------
constexpr ll INF = 0x3f3f3f3f3f3f3f3f;
constexpr double PI=3.14159265358979323846; // or M_PI
constexpr int MOD = 1000000007;


void Main() {
  ll n;
  cin >> n;
  if (n > 29) {
    COUT("Yes");
  }
  else {
    COUT("No");
  }

}

int main()
{
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Main();
}

/*
2
3 5 2
4 5
*/


Measured memory_bytes: 3652
#include <iostream>
#include <algorithm>
#include <bitset>
#include <tuple>
#include <cstdint>
#include <cstdio>
#include <cctype>
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <complex>
#include <ctime>
#include <deque>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <limits>
#include <map>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <math.h>
using namespace std;

int main() {
    int N;
    cin>>N;
    int A=0;

    vector<int>L(N);
    for(int i=0;i<N;i++){
        cin>>L[i];
    }

    for(int i=0;i<N;i++){
        for(int j=i+1;j<N;j++){
            for(int k=j+1;k<N;k++){
                
                int len=L[i]+L[j]+L[k];
                int ma = max(L[i],max(L[j],L[k]));
                int rest = len-ma;
                    

                if(ma<rest&&L[i]!=L[j]&&L[i]!=L[k]&&L[j]!=L[k]){
                    A++;
                }
            }
        }
    }
    cout<<A<<endl;
}


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

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define FOR(i,n,m) for(int i=(int)(n); i<=(int)(m); i++)
#define RFOR(i,n,m) for(int i=(int)(n); i>=(int)(m); i--)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define RITR(x,c) for(__typeof(c.rbegin()) x=c.rbegin();x!=c.rend();x++)
#define setp(n) fixed << setprecision(n)

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

#define ld long double
#define ll long long
#define vll vector<ll>
#define vi vector<int>
#define pll pair<ll,ll>
#define pi pair<int,int>

#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define ins insert

using namespace std;

/* Some Libraries */

//-------------------------------------------------

int main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int a,b,h; cin>>a>>b>>h;
    cout<<(a+b)*h/2<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <cstdlib>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	string S;
	cin >> S;
	ll k = 0,p=0;
	rep(i, S.size()) {
		if (i % 2 == 0 && S.at(i) == '0') {
			k++;
		}
		if (i % 2 != 0 && S.at(i) == '0') {
			p++;
		}
		if (i % 2 == 0 && S.at(i) == '1') {
			p++;
		}
		if (i % 2 != 0 && S.at(i) == '1') {
			k++;
		}
	}
	cout << min(k, p) << endl;

}


Measured memory_bytes: 512