akhauriyash/Code-Regression huggingface dataset:
/*
#pragma GCC optimize("O2")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,sse,sse2,fma,tune=native")
//*/
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int  ,int > pii;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

const ll maxn  = 3e6;
const ll mod =1e9+7;
const ld PI = acos((ld)-1);

#define pb push_back
#define endl '\n'
#define dokme(x) return(cout << x , 0);
#define migmig ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define ms(x , y) memset(x , y , sizeof x);
#define file_init freopen("input.txt", "r+", stdin); freopen("output.txt", "w+", stdout);
ll pw(ll a, ll b, ll md = mod){ll res = 1;while(b){if(b&1){res=(a*res)%md;}a=(a*a)%md;b>>=1;}return(res);}

int n;
int a[maxn];
map < int , int > mp;

int32_t main(){
    migmig
    cin >> n;
    for(int i = 0 ; i < n ; i ++)
        cin >> a[i], mp[a[i]]++;
    sort(a , a + n);
    reverse(a , a + n);
    int ans = 0;
    for(int i = 0 ; i < n ; i ++)
        if(mp[a[i]] > 0){
            mp[a[i]]--;
            if(mp[(1 << int(ceil(log2(a[i]+1)))) - a[i]] > 0)
                mp[(1 << int(ceil(log2(a[i]+1)))) - a[i]]--,
                ans++;
        }
    cout << ans;
    return(0);
}

Measured memory_bytes: 23368
#include <iostream>
#include <vector>
#include <cmath>

using namespace std;

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

	int a[100002] = {};
	int sum = 0;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
		sum += abs(a[i] - a[i - 1]);
	}
	sum += abs(a[n + 1] - a[n]);

	for (int i = 1; i <= n; i++) {
		cout << sum - abs(a[i] - a[i - 1]) - abs(a[i + 1] - a[i]) + abs(a[i + 1] - a[i - 1]) << endl;
	}


	return 0;
}

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

#define mem(a,n) memset(a,n,sizeof(a))
#define memc(a,b) memcpy(a,b,sizeof(b))
#define rep(i,a,n) for(int i=a;i<n;i++) ///[a,n)
#define pb push_back
#define IO ios::sync_with_stdio(false)
#define fre freopen("in.txt","r",stdin)
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
typedef long long ll;
typedef unsigned long long ull;
const double PI=acos(-1.0);
const double E=2.718281828459045;
const double eps=1e-8;
const int INF=0x3f3f3f3f;
const ll inf=0x3f3f3f3f3f3f3f3f;
const int MOD=1e3;
const int N=1e2+5;
const ll maxn=2e5+5;
const int dir[4][2]= {-1,0,1,0,0,-1,0,1};

int n,m;
int a[N],b[N],c[N],d[N];
int ans,match[N];
bool vis[N];
vector<int> vec[N];
bool dfs(int u)
{
	for(auto v:vec[u])
	{
	    if(vis[v]) continue;
		vis[v]=1;
		if(match[v]==-1||dfs(match[v]))
		{
			match[v]=u;
			return true;
		}
	}
	return false;
}
void solve()
{
    int ans=0;
    mem(match,-1);
    rep(i,1,n+1)
	{
		mem(vis,0);
		if(dfs(i)) ans++;
	}
	cout<<ans<<endl;
}
int main()
{
    IO;
	cin>>n;
	rep(i,1,n+1) cin>>a[i]>>b[i];
	rep(i,1,n+1) cin>>c[i]>>d[i];
	rep(i,1,n+1)
	{
		rep(j,1,n+1)
		{
			if(a[i]<=c[j]&&b[i]<=d[j]) vec[i].pb(j);
		}
	}
	solve();
	return 0;
}


Measured memory_bytes: 256
import std;

alias sread = () => readln.chomp();
alias lread = () => readln.chomp.to!long();
alias aryread(T = long) = () => readln.split.to!(T[]);

void main()
{
    long n;
    scan(n);

    auto SP = new Tuple!(string, long, long)[](n);
    foreach (i; 0 .. n)
    {
        string s;
        long p;
        scan(s, p);
        SP[i] = Tuple!(string, long, long)(s, -p, (i + 1));
    }
    // writeln(SP);
    SP.sort();
    // writeln(SP);
    foreach (i; 0 .. n)
    {
        writeln(SP[i][2]);
    }

}

void scan(L...)(ref L A)
{
    auto l = readln.split;
    foreach (i, T; L)
    {
        A[i] = l[i].to!T;
    }
}


Measured memory_bytes: 3652
def main():
    import sys

    S = list(input())
    N = len(S)

    # c = 0
    # for i in range(0, N-3):
    #     for j in range(i+4, N+1):
    #         num = int(''.join(S[i:j]))
    #         if num % 2019 == 0:
    #             c += 1
    #             print(num)
    # print(c)

    P = 2019
    num = [0] * P
    num[0] = 1
    now, ans = 0, 0
    _10 = 1
    for i in range(N-1, -1, -1):
        now = (now + int(S[i])*_10) % P
        _10 *= 10
        _10 %= P
        ans += num[now]
        num[now] += 1
    print(ans)


if __name__ == "__main__":
    main()


Measured memory_bytes: 10604
//Author: Rahul Purohit

#include<bits/stdc++.h>
#define vi vector<int>
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define ll  long long int
#define pi pair<ll,ll>
#define f first
#define mp make_pair
#define mod 1000000007
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
int gcd(int a, int b)
{
	if(b==0)
		return a;
	else
		return (b,a%b);
}
/*ll isp[N]={1};
void sieve(int n)
{
	isp[0]=isp[1]=0;
	for(int i=2;i<=n;i++)
	{
		if(isp[i]==1)
		{
			for(int j=i*i;j<=n;j+=i)
			{
				isp[j]==0;
			}
		}
	}
}*/
ll pow(int x,int  y,int m)
{
	ll ans=1;
	while(y!=0)
	{
		if(y%2==1)
		{
			ans=(ans*x)%m;
		}
		x=(x*x)%m;
		y/=2;
	}
	return ans;
}
template <class x>
void swap(x &a,x &b)
{
	x tp;
	tp=a;
	a=b;
	b=tp;
}
int main(void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	
	int n,m,k;
	cin>>n>>m>>k;
	cout<<min(n*m,k);
    return 0;
}


Measured memory_bytes: 256
//            ____             ____
//           /@@@@\           |@@@@|      ____
//          /@@@@@@\          |@@@@|     |@@@@|
//         /@@@@@@@@\         |@@@@|   __|@@@@|___    ____       ____      ___  _________     ____        ____    ____________      ___  _________     ____         ____
//        /@@@@/\@@@@\        |@@@@|   @@@@@@@@@@@   |@@@@|     |@@@@|    |@@@\/@@@@@@@@@\   (@@@@\      /@@@@)  /@@@@@@@@@@@@|    |@@@\/@@@@@@@@@\   (@@@@\       /@@@@)
//       /@@@@/  \@@@@\       |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|    \@@@@@|   \@@@@\    /@@@@/  |@@/     |@@@@|    |@@@@|    \@@@@@|   \@@@@\     /@@@@/
//      /@@@@(____)@@@@\      |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|    \@@@@\  /@@@@/            |@@@@|    |@@@@|     |@@@@|    \@@@@\   /@@@@/
//     /@@@@@@@@@@@@@@@@\     |@@@@|     |@@@@|      |@@@@|     |@@@@|    |@@@@|     |@@@@|     \@@@@\/@@@@/    /@@@@@@@@@@@@@|    |@@@@|     |@@@@|     \@@@@\ /@@@@/
//    /@@@@@@@@@@@@@@@@@@\    |@@@@|     |@@@@|___   |@@@@|____/@@@@@|    |@@@@|     |@@@@|      \@@@@@@@@/    (@@@@(   )@@@@@|    |@@@@|     |@@@@|      \@@@@|@@@@/
//   /@@@@/          \@@@@\   |@@@@|     |@@@@@@@@    \@@@@@@@@@@@@@@|    |@@@@|     |@@@@|       \@@@@@@/      \@@@@\_/@@@@@@|    |@@@@|     |@@@@|       \@@@@@@@/
//  /@@@@/            \@@@@\  |@@@@|      \@@@@@@/      \@@@@@/  \@@@|    |@@@@|     |@@@@|        )@@@@/        \@@@@@@@/\@@@|    |@@@@|     |@@@@|        \@@@@@/
//                                                                                                (@@@@/

#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>

using namespace std;
// using namespace __gnu_pbds;

//-----------------------------------------------
#define all(x)  x.begin(), x.end()
#define sz(x)   (int)x.size()
#define sq(x)   (x) * (x)
#define fr      first
#define sc      second
//-----------------------------------------------
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pli = pair<ll, int>;

const int N = 300 * 1000 + 5;
const ll mod = 1000000007;
const ll INF = 1000000000 * 1ll * 1000000000 + 500000;
const ld pi = acosl(-1.0);

int par[N];
int n, m;

int find_par(int v) {
    return par[v] == v ? v : (par[v] = find_par(par[v]));
}

void unite(int v, int u) {
    v = find_par(v);
    u = find_par(u);
    if (v != u) {
        if (rand() % 2 == 1) {
            par[v] = u;
        } else {
            par[u] = v;
        }
    }
}

void input() {
    cin >> n >> m;
}

void solve(int testId) {
    for (int i = 0; i < n; i++) {
        par[i] = i;
    }
    int a, b;
    for (int i = 0; i < m; i++) {
        cin >> a >> b;
        unite(a, b);
    }
    vector<int> counts(n, 0);
    for (int i = 0; i < n; i++) {
        counts[find_par(i)]++;
    }
    cout << *max_element(counts.begin(), counts.end()) << endl;
}

int main() {
    // freopen("test", "r", stdin);
    int testcases = 1;
    // scanf("%d", &testcases);
    for(int testId = 1; testId <= testcases; testId++) {
        input();
        solve(testId);
    }
    return 0;
}


Measured memory_bytes: 7908
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
using namespace std;
 
#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

template<typename T>
struct cumsum2D{
    int n, m;
    vector<vector<T>> dat;

    cumsum2D(){}
    cumsum2D(vector<vector<T>> &x){
        n = x.size();
        m = x[0].size();
        dat.assign(n+1, vector<T>(m+1));
        REP(i,n) REP(j,m){
            dat[i+1][j+1] = dat[i+1][j] + dat[i][j+1] - dat[i][j] + x[i][j];
        }
    }

    // [0, x) * [0, y)
    T sum(int x, int y){
        return dat[x][y];
    }

    // [x0, x1) * [y0 * y1)
    T sum(int x0, int y0, int x1, int y1){
        return sum(x1, y1) - sum(x0, y1) - sum(x1, y0) + sum(x0, y0);
    }
};

int main() {
    int n, d;
    cin >> n >> d;
    VVI cnt(d, VI(d));
    REP(i,n){
        int x = in(), y = in();
        cnt[x % d][y % d]++;
    }

    int ma = 0;
    REP(i,d) REP(j,d) ma = max(ma, cnt[i][j]);

    int x = 0;
    while ((x + 1) * (x + 1) < ma) x++;

    int c = 0, c2 = 0;
    VVI f(2 * d, VI(2 * d));
    VVI g(2 * d, VI(2 * d));
    REP(i,d) REP(j,d) if (cnt[i][j] > x * (x + 1)) {
        f[i][j] = f[i + d][j] = f[i][j + d] = f[i + d][j + d] = 1;
        c++;
    }
    REP(i,d) REP(j,d) if (cnt[i][j] > x * x) {
        g[i][j] = g[i + d][j] = g[i][j + d] = g[i + d][j + d] = 1;
        c2++;
    }


    // REP(i,d){
    //     REP(j,d) cout << cnt[i][j];
    //     cout << endl;
    // }
    // REP(i,d){
    //     REP(j,d) cout << f[i][j];
    //     cout << endl;
    // }
    // cout << endl;
    // REP(i,d){
    //     REP(j,d) cout << g[i][j];
    //     cout << endl;
    // }
    // cout << endl;

    cumsum2D<int> s1(f), s2(g);

    int ok = d, ng = -1;
    while (ok - ng > 1){
        int m = (ok + ng) / 2;
        bool f = false;
        REP(i,d) REP(j,d){
            int tmp = s1.sum(i, j, i + m, j + m);
            int tmp2 = s2.sum(i, j, i + d, j + m) + s2.sum(i, j, i + m, j + d) - s2.sum(i, j, i + m, j + m);
            if (tmp == c && tmp2 == c2){
                f = true;
                break;
            }
        }
        if (f) ok = m;
        else ng = m;
    }

    int ans = d * x - 1;
    ans += ok;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 67072
package main

import (
	"bufio"
	"fmt"
	"os"
)

var sc = bufio.NewScanner(os.Stdin)

func r() (n int) {
	sc.Scan()
	for _, v := range sc.Bytes() {
		n = n*10 + int(v-48)
	}
	return
}

func abs(x int) int {
	if x < 0 {
		return -x
	} else {
		return x
	}
}

func main() {
	sc.Split(bufio.ScanWords)
	n := r()

	t, x, y := 0, 0, 0
	var tn, xn, yn int
	flg := true
	for i := 0; i < n; i++ {
		tn, xn, yn = r(), r(), r()
		dt, dx, dy := abs(tn-t), abs(xn-x), abs(yn-y)
		if !(dx+dy <= dt && (dx+dy)%2 == dt%2) {
			flg = false
		}
		t, x, y = tn, xn, yn
	}
	if flg {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 640
import scala.io.StdIn._
 
object Main {
    def main(args: Array[String]): Unit = { 
        val seq: Seq[Int] = (0 until 10).map(_ => readInt())
        val rev: Seq[Int] = seq.sorted.reverse
        for(i <- 0 until 3) println(rev(i))
    }   
}

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

class Node {
	int key;
	Node next;
	Node prev;
	
	Node( int key )
	{
		this.key = key;
		this.next = null;
		this.prev = null;
	}
}
class DLL {
	int size;
	Node head;
	Node tail;

	DLL( )
	{
		head = null;
		tail = null;
		size = 0;
	}
	
	public void add( int key )
	{
		Node node = new Node( key );
		if( null == head ) {
			tail = head = node;
		} else {
			head.prev = node;
			node.next = head;
			head = node;
			size++;
		}
		return;
	}
	public void delete( int key )
	{
		Node node = head;
		Node pre = null;
        while( null != node ) {
        	if( key == node.key ) {
        		if( head == node ) {
        			deleteFirst();
        			break; 
        		}
        		if( tail == node ) {
        			deleteLast();
        			break; 
        		}
        		node = node.next;
    			pre.next = node;
    			node.prev = pre;
        		size--;
        		break;
        	}
        	pre = node;
			node = node.next;
		}
		return;
	}
	public void deleteFirst( )
	{
		head = head.next;
		if( null != head ) {
			head.prev = null;
		} else {
			tail = head;
		}
		size--;
		return;
	}
	public void deleteLast( )
	{
		tail = tail.prev;
		if( null != tail ) {
			tail.next = null;
		} else {
			head = tail;
		}
		size--;
		return;
	}
}

class Main {
    public static void main(String[] args) {
        BufferedReader kb = new BufferedReader( new InputStreamReader( System.in ) );
        try {
			int n = Integer.parseInt( kb.readLine() );
			
			
			String[] str;
			DLL list = new DLL( );
            for( int i=0; i<n; i++ ) {
                str = kb.readLine().split( " " );
                if( "insert".equals( str[0] ) ) {
                	list.add( Integer.parseInt( str[1] ) );
                } else if( "deleteFirst".equals( str[0] ) ) {
                	list.deleteFirst( );
                } else if( "deleteLast".equals( str[0] ) ) {
                	list.deleteLast( );
                } else {
                	list.delete( Integer.parseInt( str[1] ) );
                }
            }
            
			StringBuilder output = new  StringBuilder( );
			Node node = list.head;
            while(  null != node ) {
				output.append( node.key ).append( " " );
				node = node.next;
 			}
 			output.deleteCharAt( output.lastIndexOf( " " ) );
			System.out.println( output );

	    } catch( IOException e ) {
	        System.err.println( e );
	    }
	}
}

Measured memory_bytes: 562912
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<set>
#include<map>
#include<math.h>
#include <string>
#define cinf(n,x) for(int i=0;i<(n);i++) cin >> x[i];
typedef long long int ll;
using namespace std;
ll mod=1e9+7;
int x,y,s;
int sumx,sumy,ans;
int main(){
	while(1){
		cin >> x >>y >> s;
		if(x==0&&y==0&&s==0)break;
		int ans=0;
		for(int i=1;i<s;i++){
			for(int j=i;j<s;j++){
				sumx=i*(100+x)/100+j*(100+x)/100;
				if(sumx==s){
					sumy=i*(100+y)/100+j*(100+y)/100;
					ans=max(ans,sumy);
				}
			}
		}
		cout << ans << endl;
	}
}


Measured memory_bytes: 3000
#include<bits/stdc++.h>
using namespace std ;
#define Next( i, x ) for( register int i = head[x]; i; i = e[i].next )
#define rep( i, s, t ) for( register int i = (s); i <= (t); ++ i )
#define drep( i, s, t ) for( register int i = (t); i >= (s); -- i )
#define re register
int gi() {
	char cc = getchar() ; int cn = 0, flus = 1 ;
	while( cc < '0' || cc > '9' ) {  if( cc == '-' ) flus = - flus ; cc = getchar() ; }
	while( cc >= '0' && cc <= '9' )  cn = cn * 10 + cc - '0', cc = getchar() ;
	return cn * flus ;
}
const int N = 100 + 5 ; 
int n, a[N][N] ;  
signed main()
{
	n = gi() ; int M = 0 ; 
	int m = n + ((n & 1) ^ 1) ;
	rep( i, 1, n ) rep( j, i + 1, n ) if( (i + j) != m ) a[i][j] = 1, ++ M ; 
	cout << M << endl ; 
	rep( i, 1, n ) rep( j, i + 1, n ) {
		if( a[i][j] ) cout << i << " " << j << endl ; 
	}
	return 0 ;
}

Measured memory_bytes: 3580
n=int(input())
a=list(map(int,input().split()))
fg=[1,-1]
ret=[0]*2
tot=[0]*2
for i in range(n):
  for j in range(2):
    tot[j]+=a[i]
    if tot[j]*fg[j]<=0:
      ret[j]+=abs(fg[j]-tot[j])
      tot[j]+=fg[j]-tot[j]
    fg[j]*=-1
print(min(ret))

Measured memory_bytes: 14376
open System
open System.Collections.Generic

let ReadOne T = stdin.ReadLine()|> T
let ReadSplit T = stdin.ReadLine().Split()|>Array.map T
[<EntryPoint>]
let main argv =
    let N,X=stdin.ReadLine().Split()|>fun c -> int c.[0],int c.[1]
    let m=[|for i in [0..N-1] do yield ReadOne int|]
    let r=Array.min m
    N+((X-(Array.sum m))/r)
    |>stdout.WriteLine
    0


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

int main()
{
	int mountains[10];
	int first = 0,second = 0,third = 0;

	for(int i=0;i<10;i++) {
		cin >> mountains[i];
		if(mountains[i]>first) {
			third = second;
			second = first;
			first = mountains[i];
		}
		else if(mountains[i]>second) {
			third = second;
			second = mountains[i];
		}
		else if(mountains[i]>third)
			third = mountains[i];
	}

	cout << first << endl << second << endl << third << endl;

	return 0;
}

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

bool slv(string a){
    int An = a.size();
    bool Ans = true;
    for(int i = 0; i < An / 2; i++){
        if(a.at(i) != a.at(An - i - 1)) Ans = false;
    }

    return Ans;


}

int main() {
    string S;
    cin >> S;
    int N = S.size();

    string m = "";
    string n = "";

    for(int i = 0; i < (N - 1)/2; i++){
        m.push_back(S.at(i));
    }
    for(int i = (N + 3) / 2 - 1; i < N; i++){
        n.push_back(S.at(i));
    }

    string Ans = "No";
    if(slv(m) && slv(n) && slv(S)) Ans = "Yes";

  
    cout << Ans << endl;
}


Measured memory_bytes: 256
import sys
input = sys.stdin.readline


def main():
    N, K = map(int, input().split())
    X = [int(c) for c in input().split()]

    def fullsearch():
        for i in range(N-K+1):
            l = X[i]
            r = X[i+K-1]
            distance = abs(r - l)
            yield min(distance + abs(r), distance + abs(l))

    print(min(fullsearch()))

main()

Measured memory_bytes: 14596
import java.util.*;

public class Main {

    private int N;
    private String S;
    private int[][] ch;

    public Main() {
        Scanner sc = new Scanner(System.in);
        N = sc.nextInt();
        S = sc.next();
        ch = new int[26][2];
    }

    public void inputCH() {
        boolean[] first = new boolean[26];
        for (int i = 0; i < N; i++) {
            if (!first[S.charAt(i) - 'a']) {
                ch[S.charAt(i) - 'a'][0] = i;
                first[S.charAt(i) - 'a'] = true;
            } else {
                ch[S.charAt(i) - 'a'][1] = i;
            }
        }
    }

    public void printAnswer() {
        int max = 0;
        for (int i = 1; i < N-1; i++) {
            int count = 0;
            for (int j = 0; j < 26; j++) {
                if (ch[j][0] < i && ch[j][1] >= i) {
                    count++;
                }
            }
            if (count > max) {
                max = count;
            }
        }
        System.out.println(max);
    }

    public void run() {
        inputCH();
        printAnswer();
    }

    public static void main(String[] args) {
        (new Main()).run();
    }

}


Measured memory_bytes: 23764
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll dp[101][100001];

ll helper(vector<ll> &w,vector<ll> &v,ll n,ll wt,ll idx)
{
    //base case;
    if(wt<=0)
    {
        return 0;
    }
    if(idx>=n)
    {
        return 0;
    }
    if(dp[idx][wt]!=-1)
    {
        return dp[idx][wt];
    }
    ll one=0;
    if(wt>=w[idx]){
    one=helper(w,v,n,wt-w[idx],idx+1)+v[idx];
    }
    ll two=helper(w,v,n,wt,idx+1);
    return dp[idx][wt]=max(one,two);
}

int main() {
    int n,wt;
    cin>>n>>wt;
    vector<ll> w(n);
    vector<ll> v(n);
    memset(dp,-1,sizeof(dp));
    for(int i=0;i<n;i++)
    {
        cin>>w[i]>>v[i];
    } 

    ll ans=helper(w,v,n,wt,0);
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 82480
#include<bits/stdc++.h>
using namespace std;
int n,a[100009],k;
int main(){
    cin>>n>>k;
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    sort(a,a+n);
    int r=a[0];
    for(int i=1;i<n;i++)r=__gcd(r,a[i]);
    if(k%r!=0){cout<<"IMPOSSIBLE"<<endl;return 0;}
    
    if(k>a[n-1]){cout<<"IMPOSSIBLE"<<endl;return 0;}
    cout<<"POSSIBLE"<<endl;
    return 0;
}

Measured memory_bytes: 640
defmodule Main do
  def main do
    n = IO.gets("") |> String.trim() |> String.to_integer()
    1..n
    |> Enum.reduce([], fn _, acc ->
      s = IO.gets("") |> String.trim()
      [s | acc]
    end)
    |> Enum.frequencies()
    |> print()
  end

  defp print(map) do
    ["AC", "WA", "TLE", "RE"]
    |> Enum.map(fn s ->
      "#{s} x #{Map.get(map, s, 0)}"
    end)
    |> Enum.each(&IO.puts/1)
  end
end


Measured memory_bytes: 41856
import sys
sys.setrecursionlimit(2147483647)
INF=float("inf")
MOD=10**9+7
input=lambda:sys.stdin.readline().rstrip()
def resolve():
    x=int(input())
    for k in range(1,1001):
        if(100*k<=x<=105*k):
            print(1)
            return
    print(0)
resolve()

Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
typedef long long LL;
LL L[1001];
int main(){
    int N;
    cin>>N;
    L[0]=2;
    L[1]=1;
    for(int i=2;i<1000;i++){
        L[i]=L[i-1]+L[i-2];
    }
    cout<<L[N]<<endl;
	return(0);
}

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

using namespace std;

int main(){

    int R, G, B, N;
    cin >> R >> G >> B >> N;
    int count = 0;
    int a = N / R;

    for (int i = 0; i < a+1; i++){
        int b = N - R * i;
        int c = b / G;
        for(int j = 0; j < c+1; j++){
            int d = b - G * j;
            if (d % B == 0){
                count += 1;
            }
        }
    }

    cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <limits>
#include <vector>
#include <cstdio>
#include <bits/stdc++.h>
#include <set>
#include <map>
#include <stdio.h>
#include <stack>
#include <queue>
#include <deque>
#include <numeric>
#include <bits/stdc++.h>
#include <utility>
#include <iomanip>
#include <numeric>

#define ALL(obj) (obj).begin(), (obj).end()
#define FOR(i,a,b) for(int i = (a); i < (b); i++)
#define RFOR(i,a,b) for(int i = (a); (b) <= i; i--)
#define REP(i,n) for(int i = 0; i < (n); i++)
#define RREP(i,n) for(int i = n; n <= i; i--)
#define ABS(a) ((a < 0) ? ((-1)*(a)) : (a))
#define elif else if
#define MOD 1000000007
#define INF (1<<30)

using namespace std;

#define ld long double
#define ll long long

map <int ,int> mpa,mpb;
typedef pair<ll, ll> P;
priority_queue<P, vector<P>, greater<P>> pque;


ll gcd(ll a,ll b){
  return b? gcd(b,a%b):a;
}
/*ll gcd(ll m, ll n){
  // 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd*/

ll lcm( ll m, ll n )
{
	// 引数に０がある場合は０を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	return ((m / gcd(m, n)) * n); // lcm = m * n / gcd(m,n)
}//lcm

// a x + b y = gcd(a, b)
int extgcd(int a, int b, int &x, int &y) {
  int g = a; x = 1; y = 0;
  if (b != 0) g = extgcd(b, a % b, y, x), y -= (a / b) * x;
  return g;
}
int invMod(int a, int m) {
  int x, y;
  if (extgcd(a, m, x, y) == 1) return (x + m) % m;
  else                         return 0; // unsolvable
}


int main(){
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  ll A[1001000];
  ll t;
  for(int i=0;i<N;i++){
    cin >> t;
    A[i]=t;
  }
  sort(A,A+N);
  ll ans=A[0];
  for(int i=1;i<N;i++){
    ans=gcd(ans,A[i]);
    if(ans==1LL)break;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 2944
// **** WHEN THE GOING GETS TOUGH, THE TOUGH GETS GOING. ****

#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 ull unsigned 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< ll > lvi;
typedef vector< vi > vvi;
typedef vector< lvi > lvvi;
typedef pair< int,int > ii;
typedef pair< ll,ll > lii;
typedef vector<ii> vii;
typedef vector<lii> lvii;

#define min_prq(t) priority_queue<t,vector<t>,greater<t>>
#define max_prq(t) priority_queue<t>
#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 present(c,x) ((c).find(x) != (c).end())//for sets,maps,multimaps
#define cpresent(c,x) (find(all(c),x) != (c).end())//for vectors
#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
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------

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

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


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

Measured memory_bytes: 256
//#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<numeric>
#include<cstdio>
#include<cmath>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<ctype.h>
#include <fstream>
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
using namespace std;
typedef long long ll;//int64
typedef unsigned long long ull;
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int lcm(int a,int b){return a*b/gcd(a,b);}
int dy[4]={0,1,0,-1};
//----------program from here----------

int main(){
  int a=0,b=0;
  cin >> a >> b;
  cout << (a==b?a:(a+b)%2?(a+b)/2+1:(a+b)/2) << endl;

  return 0;
}

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

int main() {
  int n, ans;
  string key, str;
  
  cin >> n >> key;
  int t = key.size();
  
  ans = 0;
  for(int I=0; I<n; I++) {
    cin >> str;
    int s = str.size();
    
    bool ok = false;
    for(int space = 0; space < s; space ++) {
      for(int st = 0; st < s; st ++) {
	int cnt = 0;
	for(int kidx = 0; kidx < t; kidx ++) {
	  if(st + kidx*space + kidx < s)
	    if(key[kidx] == str[st + kidx*space + kidx]) {
	      cnt ++;
	    }
	}
	if(cnt == t) {
	  ok = true;
	}
      }
    }
    if(ok) ans ++;
  }
  cout << ans << endl;
  
  return 0;
}

Measured memory_bytes: 1208
def p(x):
 if x%2==0:return 0
 for i in range(3,int(x**.5+1),2):
  if x%i==0:return 0
 return 1
def f():print(sum(p(int(input())*2+1)for _ in[0]*int(input())))
if'__main__'==__name__:f()


Measured memory_bytes: 5992
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
//using P = pair<int,int>;
//pow(x,n)
//cout << fixed << setprecision(桁数);
//string = to_string(数値)
//int = stoi(文字列)
//(int)(char-'0')
//string = itoa(int)


int main() {
    int n; cin >> n;
    cout << fixed << setprecision(10);
    cout << n*2*M_PI << endl;
}





Measured memory_bytes: 3776
#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr ll MOD = 1e9+7;

inline ll pw(ll base, ll exp) {
	ll res = 1;
	while (exp) {
		if (exp & 1) (res *= base) %= MOD;
		exp >>= 1, (base *= base) %= MOD;
	}
	return res;
}

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

ll F[5005][2], G[5005], DP[5005][2];

int main() {
    if (fopen("in", "r")) freopen("in", "r", stdin), freopen("out", "w", stdout);
    ios_base::sync_with_stdio(0), cin.tie(0);

    int N, A, B; cin >> N >> A >> B;
    if (A > B) swap(A, B);

    if (B == 1) {
        cout << pw(2, N);
        return 0;
    }

    F[0][0] = F[0][1] = 1;
    for (int i = 1; i <= N; ++i)
        for (int d : { 0, 1 })
            for (int j = 1; j <= i; ++j)
                if (d == 1 || j >= A) (F[i][d] += F[i-j][!d]) %= MOD;
    
    G[0] = 1;
    for (int i = 1; i <= N; ++i) G[i] = F[i][0]+F[i][1];

    ll ans = 0;
    for (int i = 1; i < N; ++i) {
        if (i < A) ++DP[i][0];
        for (int j = 1; j < min(i, A); ++j) (DP[i][0] += DP[i-j][1]) %= MOD;
        if (i < B) (DP[i][1] += G[i-1]) %= MOD;
        for (int j = 1; j < min(i, B); ++j) (DP[i][1] += DP[i-j][0]*(j==1?1:G[j-2])) %= MOD;
        if (N-i < B) (ans += DP[i][0]*G[N-i-1]) %= MOD;
        if (N-i < A) (ans += DP[i][1]) %= MOD;
    }

    //for (int i = 0; i <= N; ++i) cout << DP[i][0] << ' ' << DP[i][1] << '\n';
    cout << (pw(2, N)-ans+MOD)%MOD;
}


Measured memory_bytes: 3848
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::{Bytes, Chars};
#[allow(unused_imports)]
use std::cmp::{min, max};

fn main() {
	input! {
		n: usize,
		f: [[usize; 10]; n],
		p: [[isize; 11]; n],
	}

	let inf = 999999999999999999isize;

	let mut v: Vec<usize> = vec![0; n];
	for i in 0..n {
		for j in 0..10 {
			v[i] <<= 1;
			v[i] += f[i][j];
		}
	}

	let mut ans = -inf;
	for i in 1..1024 {
		let mut sum = 0;
		for j in 0..n {
			let count = (i & v[j]).count_ones() as usize;
			sum += p[j][count];
		}
		ans = max(ans, sum);
	}
	println!("{}", ans);
}



Measured memory_bytes: 2176
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int count = 1;
		while(true) {
			int W = sc.nextInt();
			if(W == 0) break;
			int N = sc.nextInt();
			int[] v = new int[N];
			int[] w = new int[N];

			String[] s = new String[2];
			for(int i=0;i<N;i++) {
				s = sc.next().split(",");
				v[i] = Integer.parseInt(s[0]);
				w[i] = Integer.parseInt(s[1]);
			}

			int[][] dpv = new int[N+1][W+1];
			int[][] dpw = new int[N+1][W+1];
			for(int i=0;i<=W;i++) {
				dpv[0][i] = 0;
				dpw[0][i] = 0;
			}
			for(int i=0;i<N;i++) {
				for(int j=0;j<=W;j++) {
					if(w[i] <= j) {
						dpv[i+1][j] = Math.max(dpv[i][j-w[i]] + v[i], dpv[i][j]);
						if((dpv[i][j-w[i]] + v[i]) == dpv[i][j]) {
							dpw[i+1][j] = Math.min(dpw[i][j-w[i]] + w[i], dpw[i][j]);
						}else if(Math.max(dpv[i][j-w[i]] + v[i], dpv[i][j]) == dpv[i][j-w[i]] + v[i]) {
							dpw[i+1][j] = dpw[i][j-w[i]] + w[i];
						}else {
							dpw[i+1][j] = dpw[i][j];
						}
					}else {
						dpv[i+1][j] = dpv[i][j];
						dpw[i+1][j] = dpw[i][j];
					}
				}
			}
//			for(int i=0;i<=N;i++) {
//				for(int j=0;j<=W;j++) {
//					System.out.print(dpv[i][j] + " ");
//				}
//				System.out.println();
//			}
//			System.out.println();
//			for(int i=0;i<=N;i++) {
//				for(int j=0;j<=W;j++) {
//					System.out.print(dpw[i][j] + " ");
//				}
//				System.out.println();
//			}
			
			System.out.println("Case" + " " + count + ":");
			System.out.println(dpv[N][W]);
			System.out.println(dpw[N][W]);
			count++;
		}
	}	
}





Measured memory_bytes: 43136
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <cstring>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <ctype.h>

using namespace std;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,int> pli;
typedef pair<lli,lli> pll;

int _abs_int(int a) {return a<0 ? -a : a;}
lli _abs_lli(lli a) {return a<0 ? -a : a;}

int n;
char str[301][301],tmp[301][301];

int main() {
	scanf("%d",&n);
	for(int i=0;i<n;i++) scanf("%s",str[i]);

	int ans=0;
	for(int t=0;t<n;t++) {
		for(int i=0;i<n;i++) for(int j=0;j<n;j++) {
			tmp[i][(j+t)%n] = str[i][j];
		}
		int f=1;
		for(int i=0;i<n;i++) for(int j=0;j<n;j++) if(tmp[i][j]!=tmp[j][i]) {
			f=0;
			break;
		}
		if(f) ans+=n;
	}
	printf("%d\n",ans);

	return 0;
}


Measured memory_bytes: 384
s = input()
n = len(s)

def part_sum(cur, i, res):
    if i < n-1:
        part_sum(cur+s[i], i+1, res)
        part_sum(cur+s[i]+"+", i+1, res)
    else:
        cur += s[i]
        res.append(sum(list(map(int, cur.split("+")))) )
    return res
  
res = part_sum("", 0, [])
print(sum(res))

Measured memory_bytes: 3064
#include <iostream>
#include <map>
#include <queue>

using namespace std;

struct State {
  int city;
  int coins;
  long long time;

  bool operator<(const State& s) const {
    if (time != s.time) {
      return time > s.time;
    }
    if (coins != s.coins) {
      return coins < s.coins;
    }
    return city < s.city;
  }
};

map<State, long long> minimum;

void PushQueue(priority_queue<State>* que, const State& state) {
  State key = state;
  key.time = 0;
  map<State, long long>::iterator it = minimum.find(key);
  if (it != minimum.end() && it->second <= state.time) {
    return;
  }
  que->push(state);
  minimum[key] = state.time;
}

struct Edge {
  int V, A, B; 
};

int C[50];
int D[50];

const int kMaxCoins = 50 * 100;

int main() {
  int N, M, S;
  cin >> N >> M >> S;

  vector<vector<Edge>> edges;
  edges.resize(N);
  for (int i = 0; i < M; ++i) {
    int U, V, A, B;
    cin >> U >> V >> A >> B;
    edges[U - 1].push_back(Edge{V - 1, A, B});
    edges[V - 1].push_back(Edge{U - 1, A, B});
  }

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

  State init;
  init.city = 0;
  init.coins = min(S, kMaxCoins);
  init.time = 0;

  priority_queue<State> que;
  que.push(init);

  while (!que.empty()) {
    State here = que.top();
    que.pop();

    // cout << "here: " << here.city << " " << here.coins << " " << here.time << endl;

    if (here.coins < kMaxCoins) {
      State there = here;
      there.coins += C[there.city];
      there.time += D[there.city];
      PushQueue(&que, there);
    }

    for (const Edge& e : edges[here.city]) {
      if (here.coins < e.A) {
        continue;
      }
      State there = here;
      there.city = e.V;
      there.coins -= e.A;
      there.time += e.B;
      PushQueue(&que, there);
    }
  }

  for (int i = 1; i < N; ++i) {
    long long ans = -1;
    for (int j = 0; j <= kMaxCoins; ++j) {
      map<State, long long>::iterator it = minimum.find(State{i, j, 0});
      if (it != minimum.end() && (ans == -1 || ans > it->second)) {
        ans = it->second;
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 21432
#include<bits/stdc++.h>
 
using namespace std;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define INF 1e9
typedef unsigned long long ull;
ull mod =   1e9+7;
 
long long fast_exp(long long a, long long b)
{
    if(b <= 0)
       return 1;
    else
    {
       long long res = 1;
       res = fast_exp(a,b/2);
       res = (res*res)%mod;
       if(b%2 == 1)
          res = (res*a)%mod;
       return res;
 
    }
}

ull xo, yo, ax, ay, bx, by;
ull xs, ys,t;


ull n, m;
ull dp[100][100] = {};
pair<ull, ull> pa[100];

ull check(ull mask)
{
    //cout<<"\nentered check with mask : "<<mask<<"\n";
    ull no = 0, j = 0;
    //cout<<" no : "<<no<<'\n';
    while (mask)
    {   

        if (mask & 1)
        {
            no = no | dp[pa[j].ff][pa[j].ss];
        }
        j++;
        mask >>= 1;
        //cout<<" no : "<<no<<'\n';

    }

    ull cnt = 0;
    while (no)
    {
        if(no & 1)
            cnt++;
        no >>= 1;
    }
    //cout<<"cnt : "<<cnt<<endl;
    return (n - 1 - cnt);
} 

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

    cin >> n;
    ull in = 1;
    for (ull i = 0 ; i<=n ; i++)
        for(ull j = 0; j<=n ; j++)
            dp[i][j] = (1ll<<(n-1)) - 1;

    for (ull i = 0; i < n - 1; ++i)
    {
        ull a, b;
        cin >> a >> b;
        
        dp[a][b] = in;
        dp[b][a] = in;

        in <<= 1;
    }
    
    cin >> m;

    for (ull i = 0; i < m; ++i)
    {
        cin >> pa[i].ff >> pa[i].ss;
    }    

    for (ull i = 1; i<=n ; i++)
        dp[i][i] = 0;

    for (ull k = 1; k <= n; ++k)
    {
        for (ull i = 1; i<=n ; i++)
        {
            for (ull j = 1; j<=n ; j++)
            {
                if (i == j)
                    continue;
                if (__builtin_popcount(dp[i][j]) > __builtin_popcount(dp[i][k] | dp[k][j]) )
                    dp[i][j] = dp[i][k] | dp[k][j];
            }
        } 
    }

    // for (ull i = 1; i<=n ; i++)
    // {
    //     for (ull j = 1 ; j<=n ; j++)
    //     {
    //         cout << dp[i][j] << " \n"[j == n];
    //     }
    // } 


    ull ans = ( 1ull << (n - 1)  );

    for (ull i = 1; i < (1ll << m); ++i)
    {
       
       // cout<<"mask : "<<i<<endl;
        ull bit = 1;
        
        if (__builtin_popcount(i) % 2)
        {    
            ans -= (1ll << check(i));
            //cout<<"sub_this\n";
             //cout << (1ull << check(i)) << endl;
        }
        else
        {    
            ans += (1ll << check(i));
           // cout<<"add_this\n";
           // cout << (1ull << check(i)) << endl;
        }   
    }

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

Measured memory_bytes: 384
def solve():
    N, M = map(int, input().split())
    danger = [0] * (N + 1)
    for i in range(M):
        a = int(input())
        danger[a] = 1
    dp = [0] * (N + 1)
    dp[0] = 1
    for i in range(1, N + 1):
        if danger[i] == 0:
            if i == 1:
                dp[i] = dp[i - 1]
            else:
                dp[i] = dp[i - 1] + dp[i - 2]
            dp[i] %= 1000000007
    print(dp[N])


if __name__ == "__main__":
    solve()


Measured memory_bytes: 7668
/* Author: $%U%$
 * Time: $%Y%$-$%M%$-$%D%$ $%h%$:$%m%$:$%s%$
**/
#include <bits/stdc++.h>
using namespace std;
#define fore(i, a, b) for (int i = a, to = b; i < to; i++)
#define foref(i, a, b) for (int i = b - 1, to = a; i >= to; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define SZ(v) (int)v.size()
#define pb push_back
typedef long long Long;
typedef pair<int, int> Pair;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  char x;
  cin >> x;
  if (x <= 'Z') {
    cout << 'A' << '\n';
  } else {
    cout << "a\n";
  }

  return 0;
}

Measured memory_bytes: 3576
#include <bits/stdc++.h>
using namespace std;
#define ll long long 
#define endl "\n"
#define pb push_back
#define f(i,n) for(i=0;i<n;i++)
#define F(i,a,b) for(i=a;a<=b;i++)
#define arr(a,n) for( i=0;i<n;i++)cin>>a[i];
#define fi first
#define se second
#define mp make_pair
#define mod 1000000007
#define YES cout<<"YES"<<endl;
#define Yes cout<<"Yes"<<endl;
#define NO cout<<"NO"<<endl;
#define No cout<<"No"<<endl;
#define yes cout<<"yes"<<endl;
#define no cout<<"no"<<endl;
#define vi vector<ll>
#define ed end()
#define bg begin()
#define sz size()
#define ln length()
#define s() sort(a,a+n);
#define sr() sort(a,a+n,greater<ll>());
#define v()  sort(v.begin(),v.end());
#define vr() sort(v.begin(),v.end(),greater<ll>());
#define mod 1000000007
#define fast() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
ll gcd(ll a, ll b){if(!b)return a;return gcd(b, a % b);}
ll power(ll x,ll y,ll p){ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}
int main() {
    /*#ifndef ONLINE_JUDGE
        // for getting input from input.txt
        freopen("input.txt", "r", stdin);
        // for writing output to output.txt
        freopen("output.txt", "w", stdout);
    #endif*/
        /* 
        Ofcourse it's Hard.
        It's supposed to be Hard.
        If it's easy everyone would do it.
        HARD IS WHAT MAKES IT GREAT

        YESTERDAY U SAID TOMORROW

        SLOWLY BECOMING THE PERSON I 
        SHOULD HAVE BEEN A LONG TIME AGO

        SAME TASK CAN'T BE FOUND DIFFICULT TWICE

        BTBHWSITW

        SPRH TU KAB P

        CP IS ALL ABOUT THINKING 
        YOU HAVE MUCH MORE POTENTIAL THAN U THINK

        AJIT SHIDDAT 10

        UR DAILY ROUTINE 


        */

fast();
//ll t;cin>>t;while(t--)
{
    string s;
    cin>>s;
    if(s[0]!=s[1]&&s[2]==s[3]&&s[4]==s[5])
        Yes
    else
        No
}
return 0;
}

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

int count_combination(int num, int sum)
{
  int count = 0;
  for (int i = 1; i < num; i++)
  {
    for (int j = i + 1; j <= num; j++)
    {
      int k = sum - i - j;
      if (k <= j)
      {
        break;
      }
      if (k <= num)
      {
        count++;
      }
    }
  }
  return count;
}

int main()
{
  while (true)
  {
    int num, sum;
    cin >> num >> sum;
    if (num == 0 && sum == 0)
    {
      break;
    }
    cout << count_combination(num, sum) << endl;
  }
}



Measured memory_bytes: 3092
import java.util.Scanner;

public class Main {
	static int five,seven;
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int A = scanner.nextInt();
		int B = scanner.nextInt();
		int C = scanner.nextInt();
		five=0;
		seven=0;

		check(A);
		check(B);
		check(C);

		if(five==2&&seven==1) System.out.println("YES");
		else System.out.println("NO");
		scanner.close();
	}
	public static void check(int N) {
		if(N==5) {
			five++;
		}
		else if(N==7) {
			seven++;
		}
	}
}


Measured memory_bytes: 21844
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;


namespace StartFinish
{
 

    class Program
    {
        static void Main(string[] args)
        {


            int[] abc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int count = 0;
            for (int i = abc[0]; i <= abc[1]; i++)
            {
                if (abc[2] % i == 0)
                {
                    count++;
                }
            }
            Console.WriteLine(count);

        }




    }
}

Measured memory_bytes: 9536
a=int(input())
b=int(input())
c=int(input())
x=int(input())
count=0
for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            if x == (i*500 + j*100 + k*50):
                count+=1
print(count)
            

Measured memory_bytes: 3064
#include "bits/stdc++.h"
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("avx,tune=native")
using namespace std;
const int maxn = 500500;
int nxt[maxn], prv[maxn];
int dp[maxn];
char st[maxn];
int main(){
    int len; scanf("%d", &len);
    scanf("%s", st);
    nxt[len] = len;
    for(int e = len - 1; e >= 0; e--){
        if(st[e] == '0') nxt[e] = e;
        else nxt[e] = nxt[e+1];
    }
    for(int e = 0; e < len; e++){
        if(st[e] == '0') prv[e] = e;
        else prv[e] = (e == 0 ? -1 : prv[e-1]);
    }
    for(int e = 0; e <= len; e++){
        if(e >= 3 && st[e-1] == '1' && st[e-2] == '0' && st[e-3] == '1'){
            int f = prv[e-3];
            dp[e] = max(dp[e], dp[f+1] + (e - f - 3));
            if(f != e - 4) dp[e] = max(dp[e], dp[f+2] + (e - f - 4));
        }
        if(e + 3 <= len && st[e] == '1' && st[e+1] == '0' && st[e+2] == '1'){
            int f = nxt[e+2];
            dp[f] = max(dp[f], dp[e] + (f - e - 2));
            if(f != e + 3) dp[f-1] = max(dp[f-1], dp[e] + (f - e - 3));
        }
        if(e < len) dp[e+1] = max(dp[e+1], dp[e]);
    }
    cout << dp[len] << endl;
    return 0;
}


Measured memory_bytes: 6656
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long n = sc.nextLong();
        long x = sc.nextLong();
        long a = Math.max(n - x, x);
        long b = Math.min(n - x, x);
        long ans = n;
        while (b > 0) {
            long q = a / b;
            long r = a % b;
            ans += b * 2 * q;
            if (r == 0) {
                ans -= b;
            }
            a = b;
            b = r;
        }
        System.out.println(ans);
    }

}


Measured memory_bytes: 35672
#![allow(non_snake_case, unused)]
use std::cmp::*;
use std::collections::*;
use std::f64::consts::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        mut n: usize,
        k: usize,
        mut a: [usize1; k],
    }
    a.sort();
    a.reverse();

    let mut n_match: Vec<usize> = vec![2, 5, 5, 4, 5, 6, 3, 7, 6];
    let mut dp = vec![0i64; n + 1];
    for i in 1..n + 1 {
        let mut acc = std::i64::MIN;
        for &a_ in &a {
            if i < n_match[a_] {
                continue;
            }
            acc = max(acc, dp[i - n_match[a_]] + 1);
        }
        dp[i] = acc;
    }
    let mut ans = vec![];

    for _ in 0..dp[n] {
        for &a_ in &a {
            if n < n_match[a_] {
                continue;
            } else if dp[n - n_match[a_]] == dp[n] - 1 {
                ans.push(a_ + 1);
                n -= n_match[a_];
                break;
            }
        }
    }
    println!(
        "{}",
        ans.iter()
            .fold(String::new(), |acc, num| acc + &num.to_string())
    );
}

Measured memory_bytes: 4352