akhauriyash/Code-Regression huggingface dataset:
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var ab = ReadInts();
            if(ab[0]<=9 && ab[0] >= 1)
            {
                if (ab[1] <= 9 && ab[1] >= 1)
                {
                    WriteLine(ab[0] * ab[1]);
                    return;
                }
            }
            WriteLine(-1);
        }

        private static string Read() { return ReadLine(); }
        private static string[] Reads() { return (Read().Split()); }
        private static int ReadInt() { return int.Parse(Read()); }
        private static long ReadLong() { return long.Parse(Read()); }
        private static double ReadDouble() { return double.Parse(Read()); }
        private static int[] ReadInts() { return Array.ConvertAll(Read().Split(), int.Parse); }
        private static long[] ReadLongs() { return Array.ConvertAll(Read().Split(), long.Parse); }
        private static double[] ReadDoubles() { return Array.ConvertAll(Read().Split(), double.Parse); }
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
#define rg register

template <typename _Tp> inline _Tp read(_Tp&x){
	char c11=getchar(),ob=0;x=0;
	while(c11^'-'&&!isdigit(c11))c11=getchar();if(c11=='-')ob=1,c11=getchar();
	while(isdigit(c11))x=x*10+c11-'0',c11=getchar();if(ob)x=-x;return x;
}

int n,m,tot,a[105];

int main(){
	read(n),read(m);
	for(rg int i=1;i<=m;i++)read(a[i]),tot+=(a[i]&1);
	if(tot>2){puts("Impossible");return 0;}
	if(tot){
		bool flag=0;
		for(rg int i=1;i<m;i++)
			if(a[i]&1)
				if(flag)swap(a[i],a[m]);
				else flag=1,swap(a[i],a[1]);
	}
	if(m==1){
		if(a[1]==1){puts("1\n1\n1");return 0;}
		printf("%d\n",a[1]);puts("2");
		printf("1 %d\n",a[1]-1);
		return 0;
	}
	for(rg int i=1;i<=m;i++)printf("%d ",a[i]);putchar('\n');
	if(a[m]==1)printf("%d\n",m-1);
	else printf("%d\n",m);
	printf("%d\n",a[1]+1);
	for(rg int i=2;i<m;i++)printf("%d ",a[i]);
	if(a[m]>1)printf("%d\n",a[m]-1);
	return 0;
}

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

using namespace std;

typedef long long ll;
typedef long double ld;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int a,b,ok=0;;
    cin>>a>>b;
    if(a==1 && b==1) ok=1;
    if(a==1 && b==3) ok=1;
    if(a==3 && b==1) ok=1;
    if(a==3 && b==3) ok=1;
    if(ok) cout<<"Yes\n";
    else cout<<"No\n";
    return 0;
}


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

using namespace std;

#define inf  -(1e9 + 5)

template<typename t>
void self_max(t& a, t b){
	a = max(a, b);
}

bool check(pair<int, int> a){
	return a.first==0 || a.second==0;
}

int main(){
	string a, b, s;
	cin>>a>>b;
	vector<vector<pair<int, pair<int, int>>>> dp((int)a.length()+1, vector<pair<int, pair<int, int>>>((int)b.length()+1, {inf, {0, 0}}));
	dp[0][0] = {0, {0, 0}};
	for(int i=0; i<(int)a.length(); i++){
		for(int j=0; j<(int)b.length(); j++){
			if(a[i] == b[j]){
				self_max(dp[i+1][j+1], make_pair(dp[i][j].first+1, make_pair(i, j)));
				
			}
			self_max(dp[i][j+1], make_pair(dp[i][j].first, make_pair(i, j)));
			self_max(dp[i+1][j], make_pair(dp[i][j].first, make_pair(i, j)));
		}
		
	}
	
	pair<int, pair<int, int>> ans = make_pair(0, make_pair(0, 0));
	
	for(int i=0; i<=(int)a.length(); i++){
		for(int j=0; j<=(int)b.length(); j++){
			self_max(ans, make_pair(dp[i][j].first, make_pair(i, j)));
		}
	}
	
	
	auto cur = ans.second;
	int i, j;
	while(!check(cur)){
		i = cur.first;
		j = cur.second;
	    auto prev = dp[i][j].second;
		if(prev == make_pair(i-1, j-1)){
			s +=a[i-1];
		}
		cur = prev;
	}
	reverse(begin(s), end(s));
	
	std::cout<<s;
}

Measured memory_bytes: 105984
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static java.lang.Integer.parseInt;

/**
 * Pollock's conjecture - Time Limit Exceeded
 */
public class Main {

	static final int MAX = 1000000;
	static final int MAX3 = 1500;
	static final int MAX4 = 200;

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		String line;

		int[] R3 = new int[MAX3];
		int[] R4 = new int[MAX4];

		R3[1] = 1;
		for (int i = 2; i < R3.length; i++) {
			R3[i] = R3[i - 1] + i;
		}

		R4[1] = 1;
		for (int i = 2; i < R4.length; i++) {
			R4[i] = R4[i - 1] + R3[i];
		}

		int[][] dp = new int[2][MAX];
		for (int i = 1; i < dp[0].length; i++) dp[1][i] = dp[0][i] = i;
		//decided i < 4
		for (int i = 4; i < dp[0].length; i++) {
			for (int j = 2; j < R4.length; j++) {
				if (i - R4[j] >= 0) {
					dp[0][i] = Math.min(dp[0][i], dp[0][i - R4[j]] + 1);
					if (R4[j] % 2 != 0) {
						dp[1][i] = Math.min(dp[1][i], dp[1][i - R4[j]] + 1);
					}
				}
			}
		}

		while ((line = br.readLine()) != null && !line.isEmpty()) {

			int n = parseInt(line);
			if (n == 0) break;

			System.out.println(dp[0][n] + " " + dp[1][n]);

		}//end while
	}//end main
}

Measured memory_bytes: 33240
package main

import (
	"fmt"
	"strings"
)

func main() {
	var s string
	fmt.Scanf("%s", &s)

	_s := strings.Split(s, "")
	start, end := -1, -1
	var __s []string

	for i := 0; i < len(_s); i++ {
		if contains(__s, _s[i]) {
			continue
		}

		for j := 1; j < len(_s); j++ {
			if s[i] == s[j-1] && s[i] == s[j] {
				start = j - 1 + 1
				end = j + 1
			}
		}
		if start != -1 {
			break
		}

		for j := 2; j < len(_s); j++ {
			if s[i] == s[j-2] && s[i] == s[j] {
				start = j - 2 + 1
				end = j + 1
			}
		}
		if start != -1 {
			break
		}

		__s = append(__s, _s[i])
	}

	fmt.Println(start, end)
}

func contains(s []string, e string) bool {
	for _, v := range s {
		if e == v {
			return true
		}
	}
	return false
}

Measured memory_bytes: 2944
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
vector<int> G[8];
void add_edge(int from, int to){
    G[from].push_back(to);
    G[to].push_back(from);
}
int dfs(int now,vector<bool> used, int count){
    if(count==n-1){
        return 1;
    }
    int ans=0;
    used[now]=true;
    for(int i=0;i<G[now].size();i++){
        if(used[G[now][i]]==true)continue;
        ans+=dfs(G[now][i],used,count+1);
    }
    return ans;
}
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    for (int i = 0; i < m; i++)
    {
        int temp, temp1;
        cin >> temp>>temp1;
        add_edge(temp-1,temp1-1);
    }
    vector<bool> used(n,false);
    cout << dfs(0,used,0) << "\n";
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
  int fib[45] = {1, 1};
  int i;
  
  for (i = 1; i < 45; i++){
    fib[i] = fib[i - 1] + fib[i - 2];
  }

  scanf("%d", &i);
  printf("%d\n", fib[i]);

  return 0;
}

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

#define LL long long
#define COIN const int
#define PII pair<int,int>
#define PSI pair<string,int>
#define PIS pair<int,string>

#define REP(i,n) for((i)=0;(i)<(int)(n);(i)++)
#define REPD(i,n) for((i)=(n)-1;(i)>=0;(i)--)

#define ALL(c) (c).begin(), (c).end()
#define CLEAR(x) memset(x,0,sizeof x);

#define MP make_pair
#define PB push_back
#define X first
#define Y second

#define VI vector<int>
#define VS vector<string>
#define VII vector<PII>
#define VVI vector<VI>

#define PIII 3.1415926
#define PI 3.14
/*****************************************************************************/

using namespace std;

int n,m,X,Y,Z,x,MAX=-1,MIN=200,i,a,b;

int main()
{
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	cin >>n >>m >>X >>Y;
	REP(i,n)
	{
		cin >>x;
		MAX=max(MAX,x);
	}
	REP(i,m)
	{
		cin >>x;
		MIN=min(MIN,x);
	}
	a=MAX+1;
	b=MIN;
	if (a>b)
	{
		cout <<"War"<<endl;
		return 0;
	}
	if (a>Y || b<=X)
	{
		cout <<"War"<<endl;
		return 0;
	}
	cout <<"No War"<<endl;
	return 0;
}
/******************************************************************************
******************************************************************************/


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

int main() {
  char c;
  cin >> c;
  if (c == 'a' || c == 'i' || c == 'u' || c == 'e' || c == 'o')
    cout << "vowel" << endl;
  else
    cout << "consonant" << endl;
}


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

const int P = 1e9 + 7; int dp[5003][5003] , N , M , pw[5003] , iv[5003];

int main(){
	cin >> N >> M; for(int j = 1 ; j <= M ; ++j) dp[0][j] = 1;
	pw[0] = iv[0] = 1; pw[1] = 2; iv[1] = (P + 1) / 2;
	for(int i = 2 ; i <= M ; ++i){pw[i] = (pw[i - 1] * 2) % P; iv[i] = 1ll * iv[i - 1] * iv[1] % P;}
	
	for(int i = 1 ; i <= N ; ++i){
		int sum = 0;
		for(int j = 1 ; j <= M ; ++j){
			dp[i][j] = (dp[i][j] + 1ll * sum * pw[j] + (j + 1ll) * dp[i - 1][j]) % P;
			sum = (sum + 1ll * dp[i - 1][j] * j % P * iv[j + 1]) % P;
		}
	}
	cout << dp[N][M]; return 0;
}

Measured memory_bytes: 101368
#![allow(unused_imports)]
use std::io::*;
use std::fmt::*;
use std::str::*;
use std::cmp::*;
use std::collections::*;

pub trait InputValue {
    fn parse(s: &str) -> Self;
}

pub fn read<T: InputValue>() -> T {
    let mut buf = String::new();
    let _ = stdin().read_line(&mut buf);
    T::parse(&buf.trim())
}

pub fn readn<T: InputValue>(n: usize) -> Vec<T> {
    let mut vec = vec![];
    for _ in 0..n {
        vec.push(read());
    }
    vec
}

pub fn readnc<T: InputValue>() -> Vec<T> {
    let mut vec = vec![];
    let line: String = read();
    for token in line.split_whitespace() {
        vec.push(T::parse(token));
    }
    vec
}

macro_rules! parse_single_value {
    ($($t:ty),*) => {
        $(
            impl InputValue for $t {
                fn parse(s: &str) -> $t { s.parse().unwrap() }
            }
        )*
	}
}
parse_single_value!(i32, i64, f32, f64, usize, String);

macro_rules! parse_tuple {
	($($t:ident),*) => {
		impl<$($t),*> InputValue for ($($t),*) where $($t: InputValue),* {
			fn parse(s: &str) -> ($($t),*) {
				let mut tokens = s.split_whitespace();
				let t = ($($t::parse(tokens.next().unwrap())),*);
				t
			}
		}
	}
}
parse_tuple!(A, B);
parse_tuple!(A, B, C);


// ===

fn main() {
    let (d, g): (usize, i32) = read();
    let pair: Vec<(i32, i32)> = readn(d);

    let mut ans = 100000;
    for p in 0..1<<d {
        let mut total = 0;
        let mut used = 0;
        for i in 0..d {
            let (count, bonus) = pair[i];
            let score = (i+1) as i32 * 100;
            if p&(1<<i) >= 1 {
                total += bonus + count * score;
                used += count;
            }
        }
        for i in (0..d).rev() {
            let (count, bonus) = pair[i];
            let score = (i+1) as i32 * 100;
            if p&(1<<i) == 0 {
                let left = g - total;
                if left >= 1 {
                    let u = min(left / score, count);
                    total += score * u;
                    used += u;
                }
            }
        }
        ans = min(ans, used);
    }
    println!("{}", ans);
}


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

#define INF 1001001001
#define LINF 1001001001001001001
#define MOD 1000000007
#define MOD2 998244353

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

#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define rep1(i,a,b) for(int a_=(a),b_=(b),i=a_;i<b_;++i)
#define repr(i,n) for(int _i=(n),i=_i;i>0;--i)

#define db(x) cerr<<#x<<" = "<<x<<" ";
#define db2(x,y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<") ";
#define db3(x,y,z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = ("<<x<<", "<<y<<", "<<z<<") ";
#define ln cout<<endl;

#define all(a)  (a).begin(),(a).end()
#define dig(n)  to_string(n).length()

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define se second
#define fi first

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,pii> ppii;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){return (a*b)/gcd(a,b);}

int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int main(){

    bool flag=false;
    ll ans=0,sum=0;

    int n,m;
    cin>>n>>m;

    map<int,int> road;

    rep(i,n)road[i+1]=0;

    rep(i,m){
        int a,b;
        cin>>a>>b;
        road[a]++;
        road[b]++;
    }

    rep(i,n)cout<<road[i+1]<<endl;

    //cout <<fixed<<setprecision(16)<< << endl;

    //if(flag)cout << "Yes" <<endl;
    //else cout << "No" <<endl;

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
int dy[]={1,-1,0,0};
int dx[]={0,0,1,-1};

const int maxn=100000;
bool visited[maxn*2]={false};
int cnt[2];
vector<int>  related[2*maxn];

void dfs(int pos){
    cnt[pos/maxn]++;
    for(auto next:related[pos]){
        if(visited[next]) continue;
        visited[next]=true;
        dfs(next);
    }
}


int main(){
  int N;
  cin>>N;
  int x[maxn],y[maxn];
  for(int i=0;i<N;i++){
    cin>>x[i]>>y[i];
    related[x[i]-1].push_back(maxn+y[i]-1);
    related[maxn+y[i]-1].push_back(x[i]-1);
  }
  ll ans=0;
  for(int i=0;i<N;i++){
    if(visited[x[i]-1]) continue;
    cnt[0]=0; cnt[1]=0;
    visited[x[i]-1]=true;
    dfs(x[i]-1);
    ans+=(ll)cnt[0]*cnt[1];
  }

  ans-=N;
  cout<<ans<<endl;

  return 0;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int MAX = 10005;
const int MOD = 1e9+7;
const int INF = 0x3f3f3f3f;

int main()
{
    int a, b;
    bool flag = 0;
    cin >>a >> b;
    if(a % 3 == 0) flag = 1;
    if(b % 3 == 0) flag = 1;
    if((a+b)%3 == 0) flag = 1;
    if(flag) puts("Possible");
    else puts("Impossible");
    return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main(void){
        int m,f,r,che;
        while(1){
                scanf("%d %d %d",&m,&f,&r);
                che=m+f;
                if(m==-1&&f==-1&&r==-1)
                        break;
                else if(m==-1||f==-1)
                        puts("F");
                else if(che>=80)
                        puts("A");
                else if(che>=65)
                        puts("B");
                else if(che>=50)
                        puts("C");
                else if(che>=30){
                        if(r>=50)
                                puts("C");
                        else
                                puts("D");
                }
                else
                        puts("F");
        }
        return 0;
}

Measured memory_bytes: 584
N = int(input())
if N == 3:
    print(*[2, 5, 63])
elif N == 4:
    print(*[2, 5, 20, 63])
elif N == 5:
    print(*[2, 5, 20, 30, 63])
else:
    ans = []
    k = 0
    i = 0
    while True:
        ans.append(6 * k + 2)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 3)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 4)
        i += 1
        if i == N:
            break
        ans.append(6 * k + 6)
        i += 1
        if i == N:
            break
        k += 1
    if sum(ans) % 6 == 0:
        print(*ans)
    elif sum(ans) % 6 == 2:
        for j in range(N):
            if ans[j] == 8:
                ans.pop(j)
                break
        ans.append(30000)
        print(*ans)
    elif sum(ans) % 6 == 3:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(30000)
        print(*ans)
    else:
        for j in range(N):
            if ans[j] == 9:
                ans.pop(j)
                break
        ans.append(29998)
        print(*ans)


Measured memory_bytes: 41968
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#include <limits>
#include <time.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000 // 1 billion, safer than 2B for Floyd Warshall’s
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pcont(x) for(auto i: x){cout << i << " ";} cout << "\n";

int main(){
    IOS;
    int x;
     cin >> x;
    if(x >= 30)cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

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

class UnionFind
{
public:
    static UnionFind Create(int iTotalNumber)
    {
        return UnionFind(iTotalNumber);
    }

    void Init(const int iTotalNum)
    {
        mParent.resize(iTotalNum);
        mRank.resize(iTotalNum);
        mSize.resize(iTotalNum);
        for (int i = 0; i < iTotalNum; i++)
        {
            mParent[i] = i;
            mRank[i] = 0;
            mSize[i] = 1;
        }
    }

    int FindParent(const int iRoot)
    {
        if (iRoot == mParent[iRoot])
        {
            return iRoot;
        }
        else
        {
            mParent[iRoot] = FindParent(mParent[iRoot]);
            return mParent[iRoot];
        }
    }

    void UniteGroup(const int iRoot1, const int iRoot2)
    {
        int parent1 = this->FindParent(iRoot1);
        int parent2 = this->FindParent(iRoot2);
        if (parent1 == parent2) return;

        if (mRank[parent1] < mRank[parent2])
        {
            mParent[parent1] = parent2;
            mSize[parent2] = mSize[parent1] + mSize[parent2];
        }
        else if (mRank[parent2] < mRank[parent1])
        {
            mParent[parent2] = parent1;
            mSize[parent1] = mSize[parent1] + mSize[parent2];
        }
        else if (mRank[parent2] == mRank[parent1])
        {
            mParent[parent2] = parent1;
            mSize[parent1] = mSize[parent1] + mSize[parent2];
            mRank[parent2]++;
        }
        //else should never happen
    }

    bool AreInTheSameGroup(const int iRoot1, const int iRoot2)
    {
        return FindParent(iRoot1) == FindParent(iRoot2);
    }

    int GetGroupSize(int iRoot)
    {
        int parent = FindParent(iRoot);
        return mSize[parent];
    }

private:
    UnionFind(int iTotalNumber)
    {
        this->Init(iTotalNumber);
    }


    std::vector<int> mParent;
    std::vector<int> mRank;
    std::vector<int> mSize;
};

int main(void) 
{
    int N, M, K;
    cin >> N >> M >> K;
    UnionFind unionFind = UnionFind::Create(N);
    vector<vector<int>> fr(N, vector<int>());
    vector<vector<int>> bl(N, vector<int>());

    for (int i = 0; i < M; i++)
    {
        int x, y;
        cin >> x >> y;
        fr[x-1].emplace_back(y-1);
        fr[y-1].emplace_back(x-1);
        unionFind.UniteGroup(x-1, y-1);
    }
    
    for (int i = 0; i < K; i++)
    {
        int x, y;
        cin >> x >> y;
        if (false == unionFind.AreInTheSameGroup(x-1, y-1)) continue;
        bl[x-1].emplace_back(y-1);
        bl[y-1].emplace_back(x-1);
    }

    for (int i = 0; i < N; i++)
    {
        int friendCandidate = unionFind.GetGroupSize(i) - fr[i].size() - bl[i].size() - 1;
        cout << friendCandidate << " ";
    }

    cout << endl;

    return 0;
}

Measured memory_bytes: 13816
N, A, B = gets.chomp.split(" ").map(&:to_i)
if N == 1 then
  if A == B then
    puts 1
  else
    puts 0
  end
else
  if A == B then
    puts 1
  elsif A > B then
    puts 0
  else
    puts (B - A) * (N - 2) + 1
  end
end


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

using namespace std;

int main(){
    string s;
    cin>>s;
    bool ok=true;
    for(int i=0;i<s.size();++i){
        if(s[i]=='U'||s[i]=='D')continue;
        if(i%2!=0&&s[i]=='R'){
            ok=false;
            break;
        }
        else if(i%2==0&&s[i]=='L'){
            ok=false;
            break;
        }
    }
    if(ok)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
    return 0;
}

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

const int MAXN = 200005;

int n;
char s[MAXN];

int main(){
	scanf("%d %s", &n, s);
	
	int r = 0;
	for(int i = 0; i < n; i++){
		if(s[i] == 'R'){
			r++;
		}
	}
	
	int res = 0;
	for(int i = 0; i < r; i++){
		if(s[i] != 'R'){
			res++;
		}
	}
	
	printf("%d\n", res);
	
	return 0;
}


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

int main () {
  int D,T,S;
  cin >> D >> T >> S;
  /*for (int i = 0; i < N; i++) {*/
  
  if (D <= T*S){
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
}
  

Measured memory_bytes: 3596
#include <vector>
#include <iostream>
#include <cmath>
#include <cstdio>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;

char g[10];
void gDfs(int i, int n, int mxChar) {
  if (i == n) {
    // cout << g << endl;
    printf("%s\n", g);
    return;
  }
  rep(j, mxChar + 1) {
    g[i] = (char)('a' + j);
    gDfs(i + 1, n, j == mxChar ? (mxChar + 1) : mxChar);
  }
}

void dfs(int i, int n, int mxChar, const string& s) {
  if (i == n) {
    cout << s << endl;
    return;
  }
  rep(j, mxChar + 1) {    
    string ss(s);
    ss.push_back((char)('a' + j));
    dfs(i + 1, n, j == mxChar ? (mxChar + 1) : mxChar, ss);
  }
}

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

  int n;
  cin >> n;
  // dfs(0, n, 0, "");
  gDfs(0, n, 0);
}

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

using namespace std;
#define int int64_t
#define rep(i, n) for (int i = 0; i < (n); i++)
#define reps(i, n) for (int i = 1; i <= (n); i++)
#define all(x) (x).begin(), (x).end()
#define gsort(x) sort((x).begin(), (x).end(), greater<int>())
#define rv(s) reverse((s).begin(), (s).end())
#define pii pair<int, int>
#define re(s) reverse((s).begin(), (s).end())
#define setout(n, x) setw(n) << setfill(x)
#define Fixed fixed << setprecision(10);
#define pb(x, a) (x).push_back(a)
#define fb(x, a) (x).flont_back(a)
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const long long mod = 1e9 + 7;

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

   int n, k, s;
   cin >> n >> k >> s;

   if (s == 1e9)
   {
      rep(i, n)
      {
         if (i >= k)
         {
            cout << 1 << ' ';
         }
         else
         {
            cout << s << ' ';
         }
      }
   }
   else
   {
      rep(i, n)
      {
         if (i >= k)
         {
            cout << s + 1 << ' ';
         }
         else
         {
            cout << s << ' ';
         }
      }
   }
   cout << '\n';
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>

using namespace std;

typedef pair<int,int> P;
typedef long long ll; 

ll mod = 1e9 + 7;

int main(){
	int n;
	int a[100];
	cin >> n;
	for(int i=0;i<n;i++) cin >> a[i];

	double ans = 0.0;
	for (int i = 0; i < n; i++){
		ans += 1.0/a[i];
	}
	ans = 1.0 / ans;

	cout << ans << endl;

		return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <climits>
#include <set>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <list>
#include <ctime>
#include <complex>
#include <bitset>
#include <tuple>
#include <functional>

using namespace std;

#define IOS ios::sync_with_stdio(false);cin.tie(0)
#define all(x) x.begin(), x.end()
#define ff first
#define ss second
#define MOD 1000000007LL
#define rep(i,a,n) for (int i=a ; i<n ; i++)
#define per(i,a,n) for (int i=n-1 ; i>=a ; i--)
#define LLINF 100000000000000005LL
#define INF 1e9+1
#define endl '\n'

template <typename A, typename B>
string to_string(pair<A, B> p);

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);

string to_string(const string& s) {
    return '"' + s + '"';
}

string to_string(const char* s) {
    return to_string((string)s);
}

string to_string(bool b) {
    return (b ? "true" : "false");
}

string to_string(vector<bool> v) {
    bool first = true;
    string res = "{";
    for (int i = 0; i < static_cast<int>(v.size()); i++) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(v[i]);
    }
    res += "}";
    return res;
}

template <size_t N>
string to_string(bitset<N> v) {
    string res = "";
    for (size_t i = 0; i < N; i++) {
        res += static_cast<char>('0' + v[i]);
    }
    return res;
}

template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for (const auto& x : v) {
        if (!first) {
            res += ", ";
        }
        first = false;
        res += to_string(x);
    }
    res += "}\n";
    return res;
}

template <typename A, typename B>
string to_string(pair<A, B> p) {
    return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}

template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ")";
}

template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
    return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " + to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}

void debug_out() { cerr << endl; }

template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:\n", debug_out(__VA_ARGS__)

using llong = long long;
using VI = vector<int>;
using VLL = vector<long long>;
using PII = pair<int, int>;

//struct cmp {
//	bool operator() (int a, int b)
//	{
//		return a > b;
//	}
//};

int main()
{
    IOS;
    string s;
    int n;
    cin >> n;
    cin >> s;
    int cnt = 1;
    rep(i, 0, s.length()-1) {
        if (s[i] != s[i + 1]) cnt++;
    }
    cout << cnt;
    return 0;
}

Measured memory_bytes: 3724
s = input()
k = int(input())
n = len(s)
if len(set(s)) == 1:
    print(k*n//2)
else:
    ans1 = 0
    i = 0
    while i+1<n:
        if s[i%n]==s[(i+1)%n]:
            i+=1
            ans1+=1
        i+=1
    ans2 = 0
    i = 0
    while i+1<2*n:
        if s[i%n]==s[(i+1)%n]:
           i+=1
           ans2+=1
        i+=1
    print(ans1+(ans2-ans1)*(k-1))

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

using namespace std;

int main(){
    string s;
    cin >> s;
    int cnt = 0, ans = 0;
    for(int i = 0; i < s.length(); ++i){
        if(s[i] == 'A' or s[i] == 'C' or s[i] == 'G' or s[i] == 'T'){
            ++cnt;
        }
        else{
            ans = max(cnt, ans);
            cnt = 0;
        }
    }
    cout << max(cnt,ans) << endl;
    
    return 0;
}

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

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N, T;
  int c[110], t[110];
  cin >> N >> T;
  int ans = 1 << 30;
  for (int i = 0; i < N; i++) {
    cin >> c[i] >> t[i];
    if (t[i] <= T) {
      ans = min(ans, c[i]);
    }
  }
  if (ans == 1 << 30) {
    cout << "TLE" << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define ALL(x) x.begin(), x.end()
#define iostreamBooster() do{ cin.tie(nullptr); ios_base::sync_with_stdio(false); }while(0)
using namespace std;
typedef int64_t i64;
typedef pair<int,int> pii;
template<class A, class B>inline bool chmax(A &a, const B &b){return b>a ? a=b,1 : 0;}
template<class A, class B>inline bool chmin(A &a, const B &b){return b<a ? a=b,1 : 0;}
constexpr int INF = 0x3f3f3f3f;

signed main()
{
  int mat[3][3];

  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < 3; ++j) {
      cin >> mat[i][j];
    }
  }

  int a0, a1, a2;

  bool ok = false;

  for (a0 = 0; a0 <= 100; ++a0) {
    for (a1 = 0; a1 <= 100; ++a1) {
      for (a2 = 0; a2 <= 100; ++a2) {
        int b0 = mat[0][0] - a0;
        int b1 = mat[0][1] - a0;
        int b2 = mat[0][2] - a0;

        if (
            a1 + b0 == mat[1][0] &&
            a1 + b1 == mat[1][1] &&
            a1 + b2 == mat[1][2] &&
            a2 + b0 == mat[2][0] &&
            a2 + b1 == mat[2][1] &&
            a2 + b2 == mat[2][2])
        {
          ok = true;
          break;
        }
      }
    }
  }

  puts(ok ? "Yes" : "No");
  return 0;
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
  int l;
  cin>>l;
  if(l<100){
    double m;
    m=pow(l,3);
    cout<<(m/27)<<endl;
  }else{
    long m;
    m=pow(l,3);
    cout<<(m/27)<<endl;
  }
}

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

int main() {
  
  int A=0, B=0, C=0;
  
  cin >> A >> B >> C;
  
  if(A==5 && B==5) {
    
    if(C==7) {
      
      cout << "YES" << endl;
      
    } else {
      
      cout << "NO" << endl;
      
    }
    
  } else if(A==5 && C==5) {
    
    if(B==7) {
      
      cout << "YES" << endl;
      
    } else {
      
      cout << "NO" << endl;
      
    }
    
  } else if(B==5 && C==5) {
    
    if(A==7) {
      
      cout << "YES" << endl;
      
    } else {
      
      cout << "NO" << endl;
      
    }
    
  } else if(A!=5 || A!=7) {
    
    cout << "NO" << endl;
    
  } else if(B!=5 || B!=7) {
    
    cout << "NO" << endl;
    
  } else if(C!=5 || C!=7) {
    
    cout << "NO" << endl;
    
  }
  
  return 0;
  
}

Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <string>
#include <iostream>
#include <algorithm>
#include <queue>

using i64 = long long;

int main() {
  int n; i64 K; scanf("%d%lld", &n, &K);
  std::vector<int> a(n);
  for(auto& v: a) scanf("%d", &v);

  std::vector<std::vector<int>> dp(60, std::vector<int>(n));
  for(int i = 0; i < n; i++) dp[0][i] = a[i] - 1;
  for(int k = 0; k < 59; k++) for(int i = 0; i < n; i++)  dp[k + 1][i] = dp[k][dp[k][i]];

  int ans = 0;
  for(int k = 59; k >= 0; k--) {
    if(!(K >> k & 1)) continue;
    ans = dp[k][ans];
  }

  printf("%d\n", ans + 1);
  return 0;
}


Measured memory_bytes: 51844
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll n,k,i;
    cin>>n>>k;
    int arr[n];
    for(i=0;i<n;i++)cin>>arr[i];
    for(i=0;i<(n-k);i++)
    {
       if(arr[i+k]>arr[i])cout<<"Yes"<<endl;
       else cout<<"No"<<endl;
    }
}


Measured memory_bytes: 4404
#include <iostream>
#include <string>
#include <vector>

using namespace std;
typedef long long ll;


int main () {
    char S;
    cin >> S;
    char res;
    if (S == 'A') res = 'T';
    else if (S == 'C') res = 'G';
    else if (S == 'G') res = 'C';
    else res = 'A';

    cout << res << endl;
}


Measured memory_bytes: 256
#!/usr/bin/env python3
import collections as cl
import sys


def II():
    return int(sys.stdin.readline())


def MI():
    return map(int, sys.stdin.readline().split())


def LI():
    return list(map(int, sys.stdin.readline().split()))


def main():
    N = II()
    S = LI()

    if len(set(S)) == N:
        print("YES")
    else:
        print("NO")


main()


Measured memory_bytes: 119584
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REPR(i, n) for(int i = (int)(n); i >= 0; i--)
#define FOR(i, s, n) for (int i = (s); i < (int)(n); i++)
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef unsigned long long ll;

ll N, n, M, K;

int main(){
    cin >> N >> M >>K;
    REP(i , 10){
        ll ans = N * K - M;
        cout << ans << "\n";
        K = ans; 
    }
}

Measured memory_bytes: 256
#include <cstdio>

using namespace std;

int main() {
  int a, b, c, n;
  scanf("%d%d%d%d", &a, &b, &c, &n);
  int ans = 0;
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= n; ++j) {
      int k = n - a * i - b * j;
      if (k >= 0 && k % c == 0) {
        ++ans;
      }
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

con = 10 ** 9 + 7
#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N, M = getlist()
	if N == 1 and M == 0:
		print(0)
		return
	
	ans = [10, 10, 10]
	judge = "Yes"
	for i in range(M):
		s, c = getlist()
		if c == 0 and s == 1 and (N == 2 or N == 3):
			judge = "No"
			break
		elif ans[2 - N + s] == 10 or ans[2 - N + s] == c:
			ans[2 - N + s] = c
		else:
			judge = "No"
			break

	if judge == "No":
		print(-1)
		return

	for i in range(3):
		if ans[i] == 10:
			if i + N == 3:
				ans[i] = 1
			else:
				ans[i] = 0

	answer = str(ans[0]) + str(ans[1]) + str(ans[2])
	print(int(answer))


if __name__ == '__main__':
	main()

Measured memory_bytes: 3316
#include <iostream>
#include <algorithm>

using namespace std;
using ll = long long;

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

    pair<ll, ll> dish[N];
    for (int i = 0; i < N; ++i) {
        cin >> dish[i].first >> dish[i].second;
    }

    // 和について降順にソート
    sort(dish, dish + N, [](const pair<ll, ll>& a, const pair<ll, ll>& b) {
        return a.first + a.second > b.first + b.second;
    });

    ll ans = 0;
    for (int i = 0; i < N; ++i) {
        if (i % 2 == 0) {
            ans += dish[i].first;
        } else {
            ans -= dish[i].second;
        }
    }

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


Measured memory_bytes: 1920
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

const int N=1005;
const int P=998244353;

struct pos{
	int x,y;
	inline pos(){}
	inline pos(int _x,int _y){
		x=_x;
		y=_y;
	}
	inline bool operator<(const pos &w)const{
		if(x==w.x) return y<w.y;
		return x<w.x;
	}
}a[N],b[N];

int n;
int cnt[N],ans;

void init(){
	int x1,x2;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>x1>>x2;
		a[i]=pos(x1,x2);
	}
	for(int i=1;i<=n;i++){
		cin>>x1>>x2;
		b[i]=pos(x1,x2);
	}
	sort(a+1,a+n+1);
	sort(b+1,b+n+1);
	for(int i=1,j=0;i<=n;i++){
		while(a[j+1]<b[i] && j<n){
			j++;
			cnt[a[j].y]++;
		}
		for(int k=b[i].y-1;k>=0;k--){
			if(cnt[k]!=0){
				cnt[k]--;
				ans++;
				break;
			}
		}
	}
	printf("%d\n",ans);
}

int main(){
	init();
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int max3(int a, int b, int c) {
    int x = max(a, b);
    return max(c, x);
}
vector<int> A(4);

int main() {
    for(int i = 0; i < 3; ++i) {
        cin >> A.at(i);
    }

    int sum = 0;
    int flag = 0;
    int r = max3(A.at(0), A.at(1), A.at(2));
    for(int i = 0; i < 3; ++i) {
        if(r == A.at(i) && flag == 0) {
            sum += A.at(i) * 10;
            flag = 1;
        }else {
            sum += A.at(i);
        }
    }

    cout << sum << endl;
    
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
long a,b,c,d,ans;
  cin >> a >> b >> c >> d;
  ans = max(a*c,a*d);
  ans = max(ans,b*c);
  ans = max(ans,b*d);
 cout << ans <<endl;
}

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



int main(){
   int N;
   cin>>N;
   int ans=0;
   for(int i=1;i<=N;i++){
       string s;
       s=to_string(i);
       int a=s.size();
       if(a%2==1)ans++;
   }
   cout<<ans<<endl;
}



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

const int INF=1001001001;
int n,m,r,ans=INF;
vector<int>v,a,b,c;
int dp[205][205];

void dfs(vector<int>x){
    if(x.size()==r){
        int calc=0;
        rep(i,r-1){
            calc+=dp[x[i]][x[i+1]];
        }
        ans=min(ans,calc);
        return;
    }
    x.push_back(-1);
    rep(i,r){
        if(count(x.begin(),x.end(),v[i])==0){
            x.back()=v[i];
            dfs(x);
        }
    }
}

int main(){
    cin>>n>>m>>r;
    v=vector<int>(r);
    a=b=c=vector<int>(m);
    rep(i,r){
        cin>>v[i];
        v[i]--;
    }
    //WF初期化
    rep(i,205)rep(j,205)dp[i][j]=INF;
    rep(i,205)dp[i][i]=0;
    rep(i,m){
        cin>>a[i]>>b[i]>>c[i];
        a[i]--; b[i]--;
        dp[a[i]][b[i]]=c[i];
        dp[b[i]][a[i]]=c[i];
    }
    //WF
    rep(k,n)rep(i,n)rep(j,n){
        dp[i][j]=min(dp[i][j],dp[i][k]+dp[k][j]);
    }
    dfs(vector<int>());
    cout<<ans<<endl;
}

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

namespace AtCoder
{
    class Program
    {
        const long divisor = 1000000000 + 7;
        static void Main()
        {
            string[] inputs = Console.ReadLine().Split(' ');
            int n = int.Parse(inputs[0]);
            int m = int.Parse(inputs[1]);
            long result = 0;
            decimal gap = Math.Abs(n - m);
            if (gap <= 1)
            {
                long npermutation = ModFactorial(n);
                long mpermutation = ModFactorial(m);
                result = npermutation * mpermutation % divisor;
                Console.Error.WriteLine("result1 = {0}", result);
                if (gap == 0)
                {
                    result = result * 2 % divisor;
                    Console.Error.WriteLine("result2 = {0}", result);
                }
            }
            Console.WriteLine(result);
        }

        static long ModFactorial(int n)
        {
            long result = 1;
            while (n > 1)
            {
                result = result * n % divisor;
                n--;
            }
            return result;
        }
    }
}


Measured memory_bytes: 13268
const line = require('fs').readFileSync('/dev/stdin', 'utf-8').split('\n');

let cnt = 0;

const merge = (arr, left, mid, right) => {
    const n1 = mid - left;
    const n2 = right - mid;
    const L = [];
    const R = [];

    for (let i = 0; i < n1; i++) {
        L[i] = arr[left + i];
    }
    for (let i = 0; i < n2; i++) {
        R[i] = arr[mid + i];
    }

    L[n1] = 1/0;
    R[n2] = 1/0;

    let i = 0;
    let j = 0;
    for (let k = left; k < right; k++) {
        cnt++;
        if (L[i] <= R[j]) {
            arr[k] = L[i];
            i++;
        } else {
            arr[k] = R[j];
            j++;
        }
    }
};

const msort = (arr, left, right) => {
    if (left + 1 < right) {
        const mid = Math.floor((left + right) / 2);
        msort(arr, left, mid);
        msort(arr, mid, right);
        merge(arr, left, mid, right);
    }
};

const data = line[1].split(' ').map(Number);
msort(data, 0, data.length);
console.log(data.join(' '));
console.log(cnt);



Measured memory_bytes: 121380
#include<iostream>
using namespace std;
int main(){
  int n,m;
  int i,j,k;
  int mat[100][100]={{}};
  int ve[100]={};
  cin >> n >> m;
  for(i=0;i<n;i++){
    for(j=0;j<m;j++){
      cin >> mat[i][j];
    }
  }
  for(j=0;j<m;j++) cin >> ve[j];
  for(i=0;i<n;i++){
    int x=0;
    for(j=0;j<m;j++) x+=mat[i][j]*ve[j];
    cout << x << endl;		       
  }
  
  return 0;
}


Measured memory_bytes: 3128
N,C = map(int,input().split())

def inc(n):
  return n+1
def dec(n):
  return n-1

history = {}
for i in range(N):
  s,t,c = map(int,input().split())
  s *= 2
  t *= 2
  #print(history)
  if (t-1) in history and c in history[t-1]:
    history[t-1].pop(c)
  else:
    if t in history:
      history[t][c] = dec
    else:history[t] = {c:dec}
  if (s) in history and c in history[s]:
    history[s].pop(c)
  else:
    #history[s-0.5][c] = inc
    if s-1 in history:
      history[s-1][c] = inc
    else:
      history[s-1] = {c:inc}
maximum = 0
counter = 0
for i in range(100000*2):
  if i in history:
    for func in history[i].values():
      counter = func(counter)
    if counter > maximum:
      maximum = counter
#print(history)
print(maximum)

Measured memory_bytes: 52084
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main() {
	int  a,b,x,y;
	scanf("%d%d", &a,&b);
	x = a*b;
	y = (a + b) * 2;
	printf("%d %d\n", x, y);
	return 0;
}

Measured memory_bytes: 2692
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math")


using namespace std;

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

const int N = 300 + 10;
const ll MOD = 998244353;
const ll INF = 1000000010;
const ll LOG = 25;

bool DP[N][N][N];
int dp[N][N][N], mark[N][N][N], n, ps[N];
string s;

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> s;
	if (s.size() == 1) return cout << 1, 0;
//	cout << s << endl;
	n = s.size();
	DP[0][0][0] = 1;
	for (int k = 1; k <= n; k++){
		ps[k] = ps[k - 1] + (s[k - 1] == '1');
		if (k == 1) continue;
		for (int j = k; j >= 0; j--){
			for (int i = k; i >= 0; i--){
				if (j + i == 0) continue;
				if (s[k - 1] == '0'){
					DP[i][j][k] |= DP[i][j][k - 1];
					DP[i][j][k] |= DP[i + 1][j][k] | DP[i][j + 1][k];
					if (i != 0) DP[i][j][k] |=  DP[i - 1][j + 1][k - 1];
				}else{
					DP[i][j][k] |= DP[i][j][k - 1];
					DP[i][j][k] |= DP[i + 1][j][k] | DP[i][j + 1][k];
					if (j != 0) DP[i][j][k] |=  DP[i + 1][j - 1][k - 1];
				}
				if ((s[k - 1] == '1' || s[k - 2] == '1') && (j != 0)) DP[i][j][k] |= DP[i][j - 1][k - 2];
				if ((s[k - 1] == '0' || s[k - 2] == '0') && (i != 0)) DP[i][j][k] |= DP[i - 1][j][k - 2];
//				cout << i << ' '  << j << ' ' <<k<<' '<< DP[i][j][k] << '\n';
			}
		}
	}
	dp[0][0][0] = 1;
	for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++) for (int k = 0; k <= n; k++){
		if (s[n - k - 1] == '0') dp[i + 1][j][k + 1] = (dp[i + 1][j][k + 1] + dp[i][j][k]) % MOD, dp[i][j + 1][k] = (dp[i][j + 1][k] + dp[i][j][k]) % MOD;
		else dp[i][j + 1][k + 1] = (dp[i][j + 1][k + 1] + dp[i][j][k]) % MOD, dp[i + 1][j][k] = (dp[i + 1][j][k] + dp[i][j][k]) % MOD;
//		cout << i << ' ' << j << ' ' <<k << ' '<< dp[i][j][k] <<'\n';
	}
	for (int k = 0; k <= n; k++)for (int i = 0; i <= k; i++)for (int j = 0; j <= n; j++){
		if (k == 1) continue;
		if (DP[i][j][k]){
			int x = i + (n - k - ps[n] + ps[k]);
			int y = (j + ps[n] - ps[k]);
			mark[x][y][n - k] = 1;
		}
	}
	int ans = 0;
	for (int i = 0; i <= n; i++) for (int j = 0; j <= n; j++)	for (int k = 0; k <= n; k++){
		if (k != 0) mark[i][j][k] |= mark[i][j][k - 1];
		if (mark[i][j][k]) ans = (ans + dp[i][j][k]) % MOD;
	}
	cout << ans;








	return 0;
}


Measured memory_bytes: 254408
#include "bits/stdc++.h"
#define in std::cin
#define out std::cout
#define rep(i,N) for(LL i=0;i<N;++i)
typedef long long int LL;

int main()
{
	LL N, M;
	std::string S;
	in >> N >> M >> S;

	LL pos = S.length() - 1;
	std::vector<LL>ans;
	while (pos > 0)
	{
		if (pos - M < 0)
		{
			ans.push_back(pos);
			pos = 0;
			break;
		}
		bool flag = false;
		for (LL i = pos - M; i <= pos - 1; ++i)
		{
			if (S[i] == '0')
			{
				flag = true;
				ans.push_back(pos - i);
				pos = i;
				break;
			}
		}
		if (!flag)
		{
			out << -1 << std::endl;
			return 0;
		}
	}
	std::reverse(ans.begin(), ans.end());

	rep(i, ans.size()) out << ans[i] << (i + 1 < ans.size() ? " " : "\n");
}


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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<ld,ld> pdd;

const int maxN = 10010;
const int MAXM = 310;
const int MAXK = 17;
const int MOD = 1000000007;
const ll INF = 10000000000000000LL;
const ll inf = 5000000000000LL;
ll a[65];
ll b[65];
ll A,B;
ll two(ll x)
{  
	if(x<0)
		return 0ll;
	int tot = -1;
	ll y = x;
	while(x)
	{
		a[++tot] =	x%2;
		x/=2;	
	}
	ll c = y/2;
	ll p = y%2;
	if((c+p)%2 == 0)
		b[0] = 0;
	else
		b[0] = 1;
	for(int i=1;i<=tot;i++)
	{
		ll r = 1ll<<(i+1);
		ll s = (y+1)%r;
		if(s<= r/2)
			b[i] = 0;
		else
		{
			s = s - r/2;
			if(s%2 == 0)
				b[i] = 0;
			else
				b[i] = 1;
		}
	}
	ll ans = 0;
	for(int i=tot;i>=0;i--)
	{
		ans = ans*2 + b[i];
	}
	return ans;
}
int main()
{
	scanf("%lld%lld",&A,&B);
	
	ll f1 = two(A-1);
	ll f2 = two(B);
	printf("%lld\n",f2^f1);
    return 0;
}

Measured memory_bytes: 256
// AtCoder Beginner Contest 122 - Problem D: We Like AGC (https://atcoder.jp/contests/abc122/tasks/abc122_d)
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const ll MAX { 110 }, A { 1 }, C { 2 }, G { 3 }, T { 4 }, MOD { 1000000007 };

ll st[MAX][2*MAX];

int encode(int a, int b, int c)
{
    return 25 * a + 5 * b + c;
}

void decode(int n, int&a, int &b, int& c)
{
    c = n % 5;
    n /= 5;

    b = n % 5;
    n /= 5;

    a = n;
}


ll dp(int idx, int N, int mask)
{
    if (idx == N)
        return 1;

    if (st[idx][mask] != -1)
        return st[idx][mask];

    int x, y, z;
    decode(mask, x, y, z);

    // A e T sempre podem ser adicionados
    ll ans = (dp(idx + 1, N, encode(y, z, T)) + dp(idx + 1, N, encode(y, z, A))) % MOD;

    // C só pode adicionado se não violar a regra (não pode formar AGC ou GAC ou AxGC)
    if (encode(0, A, G) != encode(0, y, z) and 
        encode(0, G, A) != encode(0, y, z) and
        encode(A, G, 0) != encode(x, y, 0) and
        encode(A, 0, G) != encode(x, 0, z))
            ans = (ans + dp(idx + 1, N, encode(y, z, C))) % MOD;

    // G só pode adicionado se não violar a regra (não pode formar ACG)
    if (encode(0, A, C) != encode(0, y, z))
        ans = (ans + dp(idx + 1, N, encode(y, z, G))) % MOD;

    st[idx][mask] = ans;

    return ans;
}

int solve(int N)
{
    memset(st, -1, sizeof st);

    return dp(0, N, 0);
}

int main()
{
    ios::sync_with_stdio(false);

    int N;
    cin >> N;

    auto ans = solve(N);

    cout << ans << '\n';

    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main()
{
    long long int n;
    scanf("%lld",&n);
    long long int a,i,s=0;
    a=n;
    while(a!=0)
    {
        s=s+a%10;
        a=a/10;
    }
    if(n%s==0)
        printf("Yes\n");
    else printf("No\n");
}


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

long long int c(long long int a, long long int b){
  long long int ret = 1LL;
  for(long long int i = 0; i < min(b,a-b); ++i)
    ret *= (long long int)a-i;
  for(long long int i = 1; i <= min(b,a-b); ++i)
    ret /= (long long int)i;
  return ret;
}

int main(){
  int N, P;
  cin >> N >> P;
  int a, o = 0, e = 0;
  for(int i = 0; i < N; ++i){
    cin >> a;
    if(a%2) ++o;
    else ++e;
  }
  long long int ans = 0;
  for(int i = P; i <= o; i += 2){
    ans += c(o,i);
  }
  for(int i = 0; i < e; ++i)
    ans *= (long long int)2;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256