akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
int n,s[100],ans,ok;
int backtrack(int sol,int i)
{
    if(i==-1)
    {
        if(sol%10==0)return 0;
        return sol;
    }
    return max(backtrack(sol+s[i],i-1),backtrack(sol,i-1));
}
int main()
{
    cin>>n;
    for(int i=0;i<n;i++)
    {
        cin>>s[i];
        if(!ok&&s[i]%10!=0)ok=true;
    }
    if(!ok)cout<<0;
    else{
        sort(s,s+n);
        ok=0;
        //cout<<backtrack(0,n-1);
        for(int i=n-1;i>=0;i--)ans+=s[i];
        if(ans%10==0)
        {
            int i;
            for(i=0;i<n;i++)
            {
                if((ans-s[i])%10!=0)break;
            }
            cout<<ans-s[i];
        }
        else cout<<ans;
        //cout<<ans;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a1;
	cin>>a1;
	int a=a1.length();
	//reverse(a1,a1+a);
	if(a1.find('C')==a1.npos|a1.find('F')==a1.npos)
		cout<<"No";
	else if(a1.find_first_of('C')<a1.find_last_of('F') )cout<<"Yes";
	else cout<<"No";
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <iterator>
#include <cmath>
#include <set>
#include <deque> 
#include <string>


using namespace std;


int n;
int a[110];

int main()
{
	scanf("%d", &n);
	for (int i = 0 ; i < n ; i++)
		scanf("%d", &(a[i]));
		
	sort(a, a + n);
	int count = 0;
	for (int i = 0 ; i < n ; i++) {
		for (int j = i + 1 ; j < n ; j++) {
			if (a[i] == a[j])
				continue;
			for (int k = j + 1 ; k < n ; k++) {
				if (a[j] == a[k])
					continue;
				if ((a[i] + a[j]) > a[k]) {
//					printf("%d %d %d\n", i, j, k);
					count++;
				}
			}
		}
	}
	
	
	printf("%d\n", count);

	return 0;
}




Measured memory_bytes: 1736
#include <bits/stdc++.h>
#define LL long long
#define PII pair<int, int>
#define fi first
#define se second 
using namespace std;
//const LL INF = (LL) 1e9 + 5;
//const LL MOD = (LL) 1e9 + 7;
//const int MAXN = 200005;

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	
	LL a, b, n;
	cin >> a >> b >> n;
	LL x = min(b - 1, n);
	cout << (a * (x % b) - (a * x) % b) / b << '\n';
	
	
	return 0;
}

Measured memory_bytes: 3636
package main

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

const maxBuf = 200100

var debug = false

var buf []byte = make([]byte, maxBuf)
var sc = bufio.NewScanner(os.Stdin)

func init() {
	if debug {
		testFile, _ := os.Open("./test/sample-1.in")
		sc = bufio.NewScanner(testFile)
	}
	sc.Split(bufio.ScanWords)
	sc.Buffer(buf, maxBuf)
}

func readString() string {
	sc.Scan()
	return sc.Text()
}

func readInt() int {
	sc.Scan()
	r, _ := strconv.Atoi(sc.Text())
	return r
}

func readFloat64() float64 {
	sc.Scan()
	r, _ := strconv.ParseFloat(sc.Text(), 64)
	return r
}

/* #### main #### */
func main() {
	N := readInt()
	M := readInt()
	C := readInt()

	B := make([]int, M)

	var ans int

	for i := 0; i < M; i++ {
		B[i] = readInt()
	}
	for i := 0; i < N; i++ {
		sum := 0
		for j := 0; j < M; j++ {
			sum += readInt() * B[j]
		}
		if sum+C > 0 {
			ans++
		}

	}

	fmt.Println(ans)
}


Measured memory_bytes: 1796
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define V vector
#define vel V<int>
#define rep(i,n) for(int i=0;i<n;i++)
vel solve(V<vel>& ab, int ex) {
	if (ex == 0) { return { 1, 0 }; }
	V<V<vel>> qab(2);
	for (vel x : ab) {
		qab[x[1] & 1].push_back({ x[0] / 2,x[1] / 2 });
		if (x[0] & 1) { qab[(x[1] + 1) & 1].push_back({ x[0] / 2,(x[1] + 1) / 2 }); }
	}
	V<vel> c(3,vel(2));
	rep(i, 2) {
		for (vel x : qab[i]) {
			int qc = (3 - x[0] + x[1]) % 3; qc = (qc + 3) % 3;
			if (qc==0) { c[i][0] ^= 1; }
			if (qc==1) { c[i][1] ^= 1; }
			if (qc == 2) { c[i][0] ^= 1; c[i][1] ^= 1; }
		}
	}
	rep(i, 2) {
		if (c[1-i] == c[2]) {
			vel ans = solve(qab[i], ex - 1);
			ans[0] *= 2; ans[1] *= 2; ans[1] += i;
			return ans;
		}
	}
	rep(i, ab.size()) { ab[i][0]++; }
	vel ans = solve(ab, ex); ans[0]--;
	return ans;
}
signed main() {
	int inf = 2e17;
	int n; cin >> n;
	V<vel> ab(n);
	rep(i, n) {
		int a, b; cin >> a >> b;
		ab[i] = { a + inf,b + inf };
	}
	vel ret = solve(ab, 70);
	cout << ret[0] - inf << " " << ret[1] - inf << "\n";
}

Measured memory_bytes: 37052
using System;
using System.Collections.Generic;
using static Assistant.Input;
using static Assistant.Debug;
using System.Linq;
using Assistant;

namespace ABC110A
{
    class Program
    {
        static void Main(string[] args)
        {
            var a = RInts.OrderByDescending(x => x).ToArray();
            int ans = a[0] * 10 + a[1] + a[2];
            Console.WriteLine(ans);
        }


    }


}

namespace Assistant
{
    static class Input
    {
        static List<string> line = new List<string>();
        static int index = 0;
        static String RNext()
        {
            if (line.Count <= index) line.AddRange(Console.ReadLine().Split());
            return line[index++];
        }
        public static int RInt => int.Parse(RNext());
        public static long RLong => long.Parse(RNext());
        public static int[] RInts => Console.ReadLine().Split().Select(int.Parse).ToArray();
        public static long[] RLongs => Console.ReadLine().Split().Select(long.Parse).ToArray();
        public static string RString => RNext();
        //以下未テスト
        public static int[] RIntsC(int c) => Enumerable.Repeat(0, c).Select(x => int.Parse(RNext())).ToArray();
        public static long[] RLongsC(int c) => Enumerable.Repeat(0, c).Select(x => long.Parse(RNext())).ToArray();
        public static char[][] RMap(int h) => Enumerable.Repeat(0, h).Select(x => Console.ReadLine().ToCharArray()).ToArray();
    }

    static class Debug
    {
        static public void Draw2D<T>(T[,] map, int mode = 1)
        {
#if DEBUG
            int W = map.GetLength(0);
            int H = map.GetLength(1);

            string[,] map2 = new string[W + 1, H + 1];
            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (i == 0 && j == 0) map2[i, j] = 0.ToString();
                    else if (i == 0) map2[i, j] = (j - 1).ToString();
                    else if (j == 0) map2[i, j] = (i - 1).ToString();
                    else map2[i, j] = map[i - 1, j - 1].ToString();
                }
            }

            for (int i = 0; i < W + 1; i++)
            {
                for (int j = 0; j < H + 1; j++)
                {
                    if (mode == 0) Console.Write(map2[i, j].Last());
                    if (mode == 1) Console.Write(map2[i, j] + " ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
#endif
        }

        public static void Draw1D<T>(T[] array, int mode = 0)
        {
#if DEBUG
            Console.WriteLine(string.Join(" ", array));
#endif
        }
    }
}


Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
# define ll long long
# define int unsigned long long
#define gok ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
# define MOD 998244353
signed main(){
	int a,b,c;
	cin>>a>>b>>c;
	if(c<=a+b){
        cout<<"No";
     return 0;
	}
	int d = c-a-b;

	d=d*d;
	int e = 4*a*b;
	//e = sqrt(e);
	if(e<d)
        cout<<"Yes";
    else
        cout<<"No";
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <vector>
#include <cmath>
#include <iostream>
#include <sstream> // std::stringstream
#include <istream> // std::getline
#include <climits>

int main(int argc, char* argv[]){
    int num;
    scanf("%d\n", &num);

    std::string input;
    std::getline(std::cin, input);

    std::vector<int> list;
    std::stringstream stream {input};
    std::string buffer;
    while(std::getline(stream, buffer, ' ')){
        list.push_back(std::stoi(buffer));
    }

    int min = INT_MAX;
    int max = INT_MIN;
    int64_t sum = 0;
    for (auto each: list) {
        sum += each;
        min = std::min(each, min);
        max = std::max(each, max);
    }
    printf("%d %d %ld\n", min, max, sum);
}


Measured memory_bytes: 3424
//by shubham_bitsg

#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;
 
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pi;
typedef vector <string> vs;

//#define oset tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define forl(i,a,b) for (int i = a; i < b; i++)
#define rfor(i,b,a) for (int i = b; i >= a; i--)
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define srt(x) sort(x.begin(), x.end())
#define sumup(x) accumulate(x.begin(), x.end(), 0)
#define PI 3.141592653589793238

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n, k;
    cin>>n>>k;
    vi p(n);
    forl(i,0,n) {
        cin>>p[i];
    }
    srt(p);
    vi q (p.begin(), p.begin()+k);
    ll sum = sumup(q);
    cout<<sum<<"\n";
}

Measured memory_bytes: 3652
#include <iostream>
#include <sstream>
#include <algorithm>
#include <string>
#include <cmath>
using namespace std;


int main()
{
	int a, b, c, k, total=0;
	cin >> a >> b >> c >> k;
	total += min(a, k);
	k -= min(a, k);
	k -= min(b, k);
	total += k*-1;
	cout << total;
}



Measured memory_bytes: 3640
#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>;

void Main()
{
  int A,B,C,D;
  cin >> A >> B >> C >> D;
  while (A > 0 && C > 0) {
    C -= B;
    if (C <= 0) {cout << "Yes" << endl; return;}
    A -= D;
    if (D <= 0) {cout << "No" << endl; return;}
  }
  if (C <= 0) {cout << "Yes" << endl; return;}
  if (A <= 0) {cout << "No" << endl; return;}
}

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

Measured memory_bytes: 3652
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			Scanner cin = new Scanner();
			int n = cin.Int();
			int[] p = new int[n];
			for (int i = 0; i < n; i++) {
				p[i] = cin.Int();
			}

			int count = 0;
			for (int i = 0; i < n - 2; i++) {
				if (p[i] > p[i + 1] && p[i + 1] > p[i + 2]) {
					++count;
				} else if (p[i] < p[i + 1] && p[i + 1] < p[i + 2]) {
					++count;
				}
			}

			Console.WriteLine(count);
		}
	}

	public class Scanner
	{
		string[] s;
		int i;

		char[] cs = new char[] { ' ' };

		public Scanner()
		{
			s = new string[0];
			i = 0;
		}

		public string Next()
		{
			if (i < s.Length) return s[i++];
			string st = Console.ReadLine();
			while (st == "") st = Console.ReadLine();
			s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			if (s.Length == 0) return Next();
			i = 0;
			return s[i++];
		}

		public int Int()
		{
			return int.Parse(Next());
		}
		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long Long()
		{
			return long.Parse(Next());
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double Double()
		{
			return double.Parse(Next());
		}


		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}
	}
}


Measured memory_bytes: 11092
import java.util.Scanner;

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

		int N,K;
		N = sc.nextInt();
		K = sc.nextInt();
		long a,b;
		a = N/K;
		long ans;
		ans = a * a * a;
		if (K % 2 == 0) {

			b = (N+K/2) / K;
			ans += b * b* b;
		}
		System.out.println(ans);
	}
}

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

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


Measured memory_bytes: 3584
using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split().Select(long.Parse).ToArray();
            var N = input[0];
            var M = input[1];
            var K = input[2];
            var mod = 998244353;

            var calc = new CombinationCalculator(N - 1, mod);

            var mArray = new long[N];
            mArray[0] = 1;
            for (int i = 1; i < N; i++) mArray[i] = mArray[i - 1] * (M - 1) % mod;

            long ans = 0;
            for (int k = 0; k <= K; k++)
            {
                ans += (M * calc.nCr(N - 1, k) % mod) * mArray[N - 1 - k] % mod;
                ans %= mod;
            }

            Console.WriteLine(ans);
        }

        public class CombinationCalculator
        {
            public long Mod { get; }
            public Dictionary<long, long> Factorial { get; }
            public Dictionary<long, long> FactorialInverse { get; }

            public CombinationCalculator(long max, long mod)
            {
                Mod = mod;
                Factorial = new Dictionary<long, long> { { 0, 1 }, { 1, 1 } };
                FactorialInverse = new Dictionary<long, long> { { 0, 1 }, { 1, 1 } };
                for (long i = 2; i <= max; i++)
                {
                    Factorial.Add(i, Factorial[i - 1] * i % Mod);
                    FactorialInverse.Add(i, FactorialInverse[i - 1] * Inverse(i) % Mod);
                }
            }

            public static long ExtGcd(long a, long b, out long x, out long y)
            {
                if (b == 0)
                {
                    x = 1;
                    y = 0;
                    return a;
                }
                var d = ExtGcd(b, a % b, out y, out x);
                y -= a / b * x;
                return d;
            }

            public long Inverse(long a)
            {
                long x;
                long y;
                var d = ExtGcd(a, Mod, out x, out y);
                if (d != 1) return -1;
                return x < 0 ? x + Mod : x;
            }

            public long nCr(long n, long r)
            {
                return (Factorial[n] * FactorialInverse[r] % Mod) * FactorialInverse[n - r] % Mod;
            }
        }
    }
}


Measured memory_bytes: 53384
#include <bits/stdc++.h>
using namespace std;
int main(){
	string s,t;cin>>s>>t;
	int len = s.size();
	int count(0);
	for(int i=0;i<len;i++){
			if(s[i]!=t[i])count++;
		}
	cout<<count;	
	return 0;
	} 


Measured memory_bytes: 3908
import java.util.*;
import java.io.*;
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] arr = new int[n];
		int[] pos = new int[n+1];
		for(int i = 0; i < n; i++) {
			arr[i] = sc.nextInt();
			pos[arr[i]] = i;
		}
		int[] L = new int[n+1];
		int[] R = new int[n+1];
		TreeSet<Integer> set = new TreeSet<>();
		L[n] = pos[n]+1;
		R[n] = n - pos[n];
		set.add(pos[n]);
		long res = 0;
		for(int k = n-1; k >= 1; k--) {
			Integer left = set.lower(pos[k]);
			Integer right = set.higher(pos[k]);
			if(left == null) {
				L[k] = pos[k]+1;
			}
			else {
				L[k] = pos[k] - left;
				R[arr[left]] = L[k];
			}
			if(right == null) {
				R[k] = n - pos[k];
			}
			else {
				R[k] = right - pos[k];
				L[arr[right]] = R[k];
			}
			
			if(left != null) {
				res += ((long)k)*((long)L[arr[left]])*((long)R[k]);
			}
			if(right != null) {
				res += ((long)k)*((long)L[k])*((long)R[arr[right]]);
			}
			set.add(pos[k]);
		}
		System.out.println(res);
	}

}


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

int main()
{
    int sum = 0;

    for (int i=0; i<3; i++) {
        int temp;
        cin >> temp;
        sum += temp;
    }

    if (sum >= 22) {
        cout << "bust" << endl;
    }
    else {
        cout << "win" << endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std;

int main()
{
	long long a[3];
	for(int i=0;i<3;i++)
	    scanf("%lld",&a[i]);
	sort(a,a+3);
    if((a[0]*a[1]*a[2])%2==0)
	    printf("0\n");
	else
	    printf("%lld",a[0]*a[1]);
	return 0;
}

Measured memory_bytes: 256
#![allow(non_snake_case)]
#![allow(unused_variables)]
#![allow(dead_code)]

fn main() {
    let (X, Y): (i64, i64) = {
        let mut line: String = String::new();
        std::io::stdin().read_line(&mut line).unwrap();
        let mut iter = line.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap()
        )
    };

    let ans = X + Y / 2;

    println!("{}", ans);
}


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


int main()
{
  int n, k;
  cin >> n >> k;
  vector<int> p(n);
  rep(i, n)
    cin >> p[i];
  sort(p.begin(), p.end());
  int ans = 0;
  rep(i, k)
    ans += p[i];
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3624
#include <iostream>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef long double ld;

int main(){
ll a,b,c,d;
cin >> a;
if(a%2==0){
  cout << a/2 << endl;
}else{
  cout << a/2+1<<endl;
}
}




Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v
#define NUM(x,v) (POSU(x,v)-POSL(x,v))
const ll INF=1e15+7;
const ll N = 200003;
ll n,a[N],y=0,x=0;
pair<ll,ll> ans[N];
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>n;
	FOR(i,0,n){
		cin>>a[i];
	}
	ll x;
	x=1;
	FOR(i,0,n){
		ans[i].second=a[i];
		if(i%2==0){
			x++;
			ans[i].first=x;
		}else{
			x*=-1;
			ans[i].first=x;
			x*=-1;
			x++;
		}
	}
	sort(ans,ans+n);
	FOR(i,0,n){
		if(n%2==0)cout<<ans[i].second<<" ";
		else cout<<ans[n-1-i].second<<" ";
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 6912
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace AtCoder
{
    class Program
    {
        private static string Read() { return Console.ReadLine(); }
        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); }

        private static CompareInfo ci = new System.Globalization.CultureInfo("ja-JP").CompareInfo;
        private static int Compare(string a, string b) { return ci.Compare(a, b, System.Globalization.CompareOptions.Ordinal); }

        static int Solve(int A, int B)
        {
            for (int i = 0; i <= 1250; ++i)
            {
                if (i * 8 / 100 == A && i * 10 / 100 == B) { return i; }
            }
            return -1;
        }

        static void Main(string[] args)
        {
            int[] V = ReadInts();
            Console.WriteLine(Solve(V[0], V[1]));
        }
    }
}


Measured memory_bytes: 13268
#include <bits/stdc++.h>
using namespace std;
/* typedef */
typedef long long ll;
typedef pair<int, int> pii;
/* constant */
const int INF = 1 << 30;
const ll LINF = 1LL << 50;
const int NIL = -1;
const int MAX = 10000;
const int mod = 1000000007;
const double pi = 3.141592653589;
/* global variables */
/* function */
/* main */
int main(){
    int a;
    for (int i = 1; i <= 5; i++) {
        cin >> a;
        if (a == 0) cout << i << '\n';
    }
}


Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define MOD 1000000007
#define INF 1000000000000000000

int main(){
  int N,A,B,C,D;
  string S;
  cin>>N>>A>>B>>C>>D>>S;
  A--,B--,C--,D--;
  if(C<B){
    bool flag=true;
    for(int i=A+1;i<C-1;i++){
      if(S.at(i)=='#'&&S.at(i+1)=='#'){
        flag=false;
        break;
      }
    }
    for(int i=B+1;i<D-1;i++){
      if(S.at(i)=='#'&&S.at(i+1)=='#'){
        flag=false;
        break;
      }
    }
    if(flag){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }else if(D<C){
    bool flag=true;
    for(int i=A+1;i<C-1;i++){
      if(S.at(i)=='#'&&S.at(i+1)=='#'){
        flag=false;
        break;
      }
    }
    bool sub=false;
    for(int i=B;i<=D;i++){
      if(S.at(i-1)=='.'&&S.at(i)=='.'&&S.at(i+1)=='.'){
        sub=true;
        break;
      }
    }
    if(flag&&sub){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }else{
    bool flag=true;
    for(int i=A+1;i<D-1;i++){
      if(S.at(i)=='#'&&S.at(i+1)=='#'){
        flag=false;
        break;
      }
    }
    if(flag){
      cout<<"Yes"<<endl;
    }else{
      cout<<"No"<<endl;
    }
  }
}


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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
    return string(1, val);
}

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

    if(N % 2 == 1) {
        cout << 0 << endl;
    } else {
        ll ans = 0;
        ll tmp = N / 2;
        while(tmp) {
            tmp = tmp / 5;
            ans += tmp;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<string>
using namespace std;
int main() {
    int N, K;
    int I[100];
    cin >> N >> K;
    for(int i = 0; i < N; i++) cin >> I[i];

    int sum = 0;

    sort(I, I + N, greater<int>());
    
    for(int i = 0; i < K; i++)
        sum += I[i];
    
    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 3572
import java.io.*;
import java.math.BigInteger;
import java.util.*;
class Main{
	static final long MOD = 1_000_000_007; // 10^9+7
    static final int MAX = 2_147_483_646; // intMax 
    static final int INF = 1_000_000_000; // 10^9  
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		BigInteger a = new BigInteger(saori.nextHayami());
		BigInteger b = new BigInteger(saori.nextHayami());
		if(a.compareTo(b) > 0){
			System.out.println("GREATER");
		} else if(a.compareTo(b) < 0){
			System.out.println("LESS");
		} else {
			System.out.println("EQUAL");
		}

		saori.close();
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

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

int pow(int n){

        int ans = 1;
        for(int i=0;i<n;i++){
            ans *= 10;
        }
    return ans;

}


int main()
{
    long long A,B,C;

    int bit1=0,bit2=0,bit3=0; 

    cin >> A >> B >> C;

    if(A==B) bit1 = 1;

    if(B==C) bit2 = 1;
    
    if(C==A) bit3 = 1;

    if(bit1+bit2+bit3==1){
        cout << "Yes"<<endl;
    }else{
        cout <<"No"<<endl;
    }

    return 0;

}

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

#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")


#define boost ios::sync_with_stdio(0); cin.tie(0);
#define int long long
const int N = 5 + 1000;


int32_t main(){
	boost;


    string a , b , c;

    cin >> a >> b >> c;

    char curr = 'A';
    int x = 0 , y = 0 , z = 0;
    while(1){
    	if(curr == 'A'){
    		if(x == a.length()){
    			cout << curr;
    			return 0;
    		}
    		
    		if(a[x] == 'a'){
    			curr = 'A';
    		}
    		else if(a[x] == 'b'){
    			curr = 'B';
    		}
    		else{
    			curr = 'C';
    		}
    		x++;
    	}
    	else if(curr == 'B'){
    		

    		if( y == b.length()){
    			cout << curr;
    			return 0;
    		}
    		
    		if(b[y] == 'a'){
    			curr = 'A';
    		}
    		else if(b[y] == 'b'){
    			curr = 'B';
    		}
    		else{
    			curr = 'C';
    		}
    		y++;
    	}
    	else{
    		
    		if(z == c.length()){
    			cout << curr;
    			return 0;
    		}
    		
    		if(c[z] == 'a'){
    			curr = 'A';
    		}
    		else if(c[z] == 'b'){
    			curr = 'B';
    		}
    		else{
    			curr = 'C';
    		}
    		z++;
    	}

    }
    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
  int n,r,p,c;
  int i,j;
  int num[50];
  int rep[50];
  while(1)
    {
      scanf("%d%d",&n,&r);
      if((n==0)&&(r==0)) break;
      for(i=0;i<n;i++) num[i]=rep[i]=n-i;
      for(i=0;i<r;i++)
	{
	  scanf("%d%d",&p,&c);
	  for(j=0;j<c;j++) rep[j]=num[j+p-1];
	  for(j=c;j<c+p-1;j++) rep[j]=num[j-c];
	  for(j=0;j<c+p-1;j++) num[j]=rep[j];
	}
      printf("%d\n",num[0]);
    }
  return 0;
}

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

int main()
{
	int K;
	cin >> K;
	vector<ll> A(K);
	for (int i = 0; i < K; i++) {
		cin >> A[i];
	}
	ll l = 2, r = 2;
	bool ok = true;
	for (int i = K - 1; i >= 0; i--) {
		l = (l + A[i] - 1) / A[i] * A[i];
		r = r / A[i] * A[i] + A[i] - 1;
		if (r < l) {
			ok = false;
			break;
		}
	}
	if (ok) {
		cout << l << ' ' << r << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}


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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


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

  int ans = b * pow(10, 2 * a);

  if (b == 100) ans += pow(10, 2 * a);

  cout << ans << endl;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<ll>vect;
vector<bool>vist;
vector<ll>path;
ll cl=0;
void dfs(ll n)
{
    // cout<<n<<" ";
    if(vist[n])
    {
        for(ll i=0;i<path.size();i++)
        {
            if(path[i]==n)
            break;
            cl++;
        }
        cl=path.size()-cl;
        return;
    }
    vist[n]=true;
    path.push_back(n);
    dfs(vect[n]);
}
int main()
{
    ll n,k;
    cin>>n>>k;
    vect.clear();
    vist.clear();
    vect.resize(n);
    vist.resize(n);
    for(ll i=0;i<n;i++)
    {
        cin>>vect[i];
        vect[i]--;
    }
    dfs(0);
    if(k<path.size())
    cout<<path[k]+1;
    else
    {
        ll res=path.size()-cl;
        cout<<path[res+(k-res)%cl]+1;
    }
    // cout<<cl<<endl;
    // for(auto x: path)
    // cout<<x<<" ";
    return 0;
}
//Author: master_sam

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

public class Main {

	public static void main(String[] args) throws IOException {
		InputStream inputStream = System.in;
		OutputStream outputStream = System.out;
		InputReader in = new InputReader(inputStream);
		PrintWriter out = new PrintWriter(outputStream);
		TaskX solver = new TaskX();
		solver.solve(1, in, out);
		out.close();
	}

	static int INF = 1 << 30;
	static long LINF = 1L << 55;
	static int MOD = 1000000007;
	static int[] mh4 = { 0, -1, 1, 0 };
	static int[] mw4 = { -1, 0, 0, 1 };
	static int[] mh8 = { -1, -1, -1, 0, 0, 1, 1, 1 };
	static int[] mw8 = { -1, 0, 1, -1, 1, -1, 0, 1 };

	static class TaskX {

		public void solve(int testNumber, InputReader in, PrintWriter out) {

			int v = in.nextInt(), e = in.nextInt();
			int[][] mat = new int[v][v];
			for (int i = 0; i < v; i++) {
				Arrays.fill(mat[i], -1);
			}

			for (int i = 0; i < e; i++) {
				int s = in.nextInt(), t = in.nextInt(), d = in.nextInt();
				mat[s][t] = d;
			}

			int[][] dp = new int[1 << v][v];
			for (int i = 0; i < 1 << v; i++) {
				Arrays.fill(dp[i], INF);
			}
			dp[(1<<v)-1][0] = 0;

			for (int s = (1<<v)-2; s >= 0; s--) {
				for (int now = 0; now < v; now++) {
					for (int to = 0; to < v; to++) {
						if ((s >> to & 1) == 0 && mat[now][to] != -1) {
							dp[s][to] = Math.min(dp[s][to], dp[s | 1<<to][now] + mat[now][to]);
						}
					}
				}
			}

			out.println(dp[0][0] == INF ? -1 : dp[0][0]);

		}
	}

	static class InputReader {
		BufferedReader in;
		StringTokenizer tok;

		public String nextString() {
			while (!tok.hasMoreTokens()) {
				try {
					tok = new StringTokenizer(in.readLine(), " ");
				} catch (IOException e) {
					throw new InputMismatchException();
				}
			}
			return tok.nextToken();
		}

		public int nextInt() {
			return Integer.parseInt(nextString());
		}

		public long nextLong() {
			return Long.parseLong(nextString());
		}

		public double nextDouble() {
			return Double.parseDouble(nextString());
		}

		public int[] nextIntArray(int n) {
			int[] res = new int[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextInt();
			}
			return res;
		}

		public long[] nextLongArray(int n) {
			long[] res = new long[n];
			for (int i = 0; i < n; i++) {
				res[i] = nextLong();
			}
			return res;
		}

		public InputReader(InputStream inputStream) {
			in = new BufferedReader(new InputStreamReader(inputStream));
			tok = new StringTokenizer("");
		}
	}

}



Measured memory_bytes: 28052
#![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 s: chars,
    }
    let mut c_cnt = vec![0; 26];
    for &c in &s {
        c_cnt[(c as u8 - b'a') as usize] += 1;
    }
    if s.len() < 26 {
        for i in 0..26 {
            if c_cnt[i] == 0 {
                for &c in &s {
                    print!("{}", c);
                }
                return println!("{}", (i as u8 + b'a') as char);
            }
        }
    } else {
        while let Some(c) = s.pop() {
            for i in (c as u8 - b'a') + 1..26 {
                if c_cnt[i as usize] == 0 {
                    for &c_ in &s {
                        print!("{}", c_);
                    }
                    return println!("{}", (i + b'a') as char);
                }
            }
            c_cnt[(c as u8 - b'a') as usize] = 0;
        }
    }

    println!("-1");
}


Measured memory_bytes: 4352
// https://atcoder.jp/contests/abc131/tasks/abc131_e

#include <bits/stdc++.h>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(_i, n) printf("%d%c", a[_i], _i + 1 == n ? '\n' : ' ')
#define DUMP2D(a, n, m) REP(_i, n) REP(_j, m) printf("%d%c", a[_i][_j], _j + 1 == m ? '\n' : ' '); puts("")

const int N_MAX = 100;

int N, K;

void solve() {
  int M = (N - 1) * (N - 2) / 2;
  if (K > M) {
    puts("-1");
    return;
  }
  printf("%d\n", N - 1 + M - K);
  FOR(i, 1, N - 1) {
    printf("%d %d\n", i, N);
  }
  int i = 1;
  int j = 2;
  REP(k, M - K) {
    printf("%d %d\n", i, j);
    j++;
    if (j >= N) {
      i++;
      j = i + 1;
    }
  }
}

void input() {
  scanf("%d%d", &N, &K);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 256
#include <bits//stdc++.h>
using namespace std;
#define int long long
#define rep(i,n,k) for(int i=n;i<k;i++)
#define P make_pair
#define F first
#define S second
#define M LLONG_MAX
signed main(void){
    int n,m,ans,w,p,q;
    ans=0;
    cin>>n>>m;
    int a[n];
    rep(i,0,n)
    a[i]=0;
    rep(i,0,m){
        cin>>p>>q;
        if(n>1&&p==1&&q==0){
            cout<<"-1"<<endl;
            return 0;
        }
        else if(n==1&&q==0&&a[0]==0)
        a[0]=10;
        else if(n==1&&q==0&&a[0]==10)
        a[0]=10;
        else if(a[p-1]==0)
        a[p-1]=q;
        else if(a[p-1]!=q){
            cout<<"-1"<<endl;
            return 0;
        }
        
        else
        a[p-1]=q;
    }
    if(a[0]==10){
    cout<<"0"<<endl;
    return 0;
    }
    
    rep(i,0,n){
        if(n>1&&a[0]==0)
        a[0]++;
    cout<<a[i];
    }
    cout<<endl;
    
}


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



using namespace std;

typedef vector<int> VI;
typedef vector<string> VS;


//container util
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)



int main(void){

	int N, Q; cin >> N >> Q;
	string S; cin >> S;
	vector<int> l(Q);
	vector<int> r(Q);
	REP(i,Q){
		cin >> l[i] >> r[i];
	}

	vector<int> sum(N+1, 0);
	FOR(i,1,N){
		sum[i+1] = sum[i];
		if(S[i-1] == 'A' and S[i] == 'C') sum[i+1]++;
	}

	REP(i,Q){
		int ans = sum[r[i]] - sum[l[i]];
		cout << ans << endl;
	}


	return 0;

}


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

using namespace std;

#define FOR(i, j, k) for(int i = j; i <= k; i++)
#define SZ 110000
#define PB push_back
#define MEM(n, val) memset((n), val, sizeof(n))
#define INF 1000000000
#define F first
#define S second
#define MP make_pair
#define LL long long

LL n, ara[10];

int main()  {
//    freopen("in.txt", "r", stdin);
    cin >> n;
    LL mn = 1000000000000000000LL;
    FOR(i, 1, 5)   {
        cin >> ara[i];
        mn = min(mn, ara[i]);
    }

    LL chk = 0;

    if(n % mn)    {
        chk++;
    }

    cout << (n / mn) + chk + 5 - 1;


    return 0;
}
/**
*/


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<int,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,m,k,num,ans[305][305];char s[305][305];bool flg[305];
int main()
{
    scanf("%d%d%d",&n,&m,&k);
    rep(i,1,n) scanf("%s",s[i]+1);
    num=1;
    rep(i,1,n){
        int lst=-1;
        rep(j,1,m) if(s[i][j]=='#') lst=j;
        if(lst==-1) continue;
        rep(j,1,m) {
            ans[i][j]=num;
            if(s[i][j]=='#'&&j!=lst) num++;
        }
        num++;flg[i]=1;
    }
    rep(i,1,n) if(!flg[i]){
        if(i!=1) rep(j,1,m) ans[i][j]=ans[i-1][j];
    }
    per(i,n,1) if(ans[i][1]==0){
        rep(j,1,m) ans[i][j]=ans[i+1][j];
    }
    rep(i,1,n) rep(j,1,m) printf("%d%c",ans[i][j],j==m?'\n':' ');
    return 0;
}

Measured memory_bytes: 1152
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int R = sc.nextInt();
		int ans = 0;
		if (10 <= N) {
			ans = R;
		} else {
			ans = R + 100 * (10 - N);
		}
		System.out.println(ans);
	}
}

Measured memory_bytes: 22996
package main

import (
	"fmt"
	"math"
	"sort"
)

var N int
var A []int

func binarySearch(a []int, k int) (right int) {
	n := len(a)
	left := -1
	right = n - 1
	for right-left > 1 {
		mid := (left + right) / 2
		if a[mid] >= k {
			right = mid
		} else {
			left = mid
		}
	}
	return right
}

func main() {
	fmt.Scan(&N)
	A = make([]int, N)
	max_for_all := -1
	for i := 0; i < N; i++ {
		fmt.Scan(&A[i])
		if max_for_all < A[i] {
			max_for_all = A[i]
		}
	}
	B := make([]int, N)
	for i := 0; i < N; i++ {
		B[i] = A[i]
	}
	sort.Ints(B)
	for i := 0; i < N; i++ {
		res := max_for_all
		if A[i] == max_for_all {
			idx := binarySearch(B, A[i])
			if idx == 0 {
				idx++
			}
			if idx < len(B)-1 {
				// log.Println(idx, B)
				if B[idx] == B[idx+1] {
					fmt.Println(B[idx])
					continue
				}
			}
			fmt.Println(B[idx-1])
			continue
		}
		fmt.Println(res)
	}
}

var dy = []int{0, 1, 0, -1}
var dx = []int{1, 0, -1, 0}
var inf = int(1e9)

func pow(a, b int) int {
	return int(math.Pow(float64(a), float64(b)))
}

func lcm(a, b int) int {
	return a * b / gcd(a, b)
}
func gcd(a, b int) int {
	if a < b {
		a, b = b, a
	}
	for b != 0 {
		a, b = b, a%b
	}
	return a
}
func max(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r < a[i] {
			r = a[i]
		}
	}
	return r
}
func min(a ...int) int {
	r := a[0]
	for i := 0; i < len(a); i++ {
		if r > a[i] {
			r = a[i]
		}
	}
	return r
}
func sum(a []int) (r int) {
	for i := range a {
		r += a[i]
	}
	return r
}
func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}

type Pair struct {
	a, b int
}

type pairs []Pair

func (p pairs) Len() int {
	return len(p)
}
func (p pairs) Swap(i, j int) {
	p[i], p[j] = p[j], p[i]
}

func (p pairs) Less(i, j int) bool {
	if p[i].a == p[j].a {
		return p[i].b < p[j].b
	}
	return p[i].a < p[j].a
}


Measured memory_bytes: 8064
S = int(input())
waru = 10**9 + 7

import math
def C(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
i = 1
ans = 0
S -= 3
while S >= 0:
  ans += C(S+i-1, S)
  i += 1
  S -= 3
print(ans%waru)
  

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

#define ll long long
#define vvi vector<vector<int>>
#define vec vector
#define pq priority_queue
#define all(v) (v).begin(), (v).end()
#define uniqueV(x) sort(x.begin(), x.end()); x.erase(unique(x.begin(), x.end()), x.end());
#define rep(i, n) for (int (i) = (0); (i) < (n); ++(i))
#define repp(i, m, n) for (int (i) = (m); (i) < (n); ++(i))
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) cerr<<"("<<#x<<", "<<#y<<") = "<<"("<<x<<", "<<y<<")"<<endl;
#define debug3(x, y, z) cerr<<"("<<#x<<", "<<#y<<", "<<#z<<") = "<<"("<<x<<", "<<y<<", "<<z<<")"<<endl;
#define debugB(value, size) cerr<<#value<<": "<<bitset<size>(value) << endl;
#define line() cerr << "---------------" << endl;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};
const double PI = 3.14159265358979323846;

template<typename T>
void printA(vector<T> &printArray, char between = ' ') {
   int paSize = printArray.size();
   for (int i = 0; i < paSize; i++) { cerr << printArray[i] << between;}
   if (between != '\n') {cerr << endl;}
}

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

set<ll> s;

void init() {
   for (ll i = 1; i <= 1111; i++) {
      ll a = i;
      for (ll j = 2; j <= 1111; j++) {
         a *= i;
         if (a > 1000) break;
         s.insert(a);
      }
   }
}

int main() {
   init();
   int x;
   cin >> x;
   for (auto itr = s.rbegin(); itr != s.rend(); itr++) {
      if ((*itr) <= x) {
         cout << (*itr) << endl;
         return 0;
      }
   }
   cout << 1 << endl;

   return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	return gcd(b, a % b);
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}


const long long MOD = 1000000007;
const long long INF = 1LL << 60;


const int MAX_N = 100010;
int n;
int tmp[10];
signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	string s; cin >> s;
	n = s.size();
	int ans = 0;
	rep(i, n) {
		tmp[i] = s[i] - '0';
	}
	rep(bit, 1 << n) {
		bool now[10];
		rep(i, 10)now[i] = false;
		rep(i, n) {
			if (bit & (1LL << i)) {
				now[i] = true;
			}
		}
		int t = 0;
		for (int i = 9; i >= 0; i--) {
			if (now[i]) {
				ans += tmp[i] * (int)(pow(10, t));
				t++;
			}
			else {
				t = 0;
			}
		}
	}
	cout << ans << endl;
	return 0;
}


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

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

  vector<int> v(n+1);
  rep(i,n) {
    cin >> v.at(i+1);
  }

  int ans = -1;
  int cnt = 1;
  int t = v.at(1);
  rep(i,n){
    if(t==2){
      ans = cnt;
      break;
    }
    t = v.at(t);
    cnt++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
 
using namespace std;
 
#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()
 
typedef int64_t ll; typedef vector<int> VI; typedef pair<int,int> pii;
const ll mod = 1e9+7;


int main()
{
 
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n,k;
	cin >>n >>k;
	
	ll a=1;
	rep(i,n){
		if( a*2 < a+k) a *= 2;
		else a +=k;
	}
	cout << a <<"\n";
	return 0;
 
}

Measured memory_bytes: 256
def dfs(v, c):
    color[v] = c
    for i in range(n):
        if g[v][i] == 1:
            if color[i] == c:
                return False
            if color[i] == 0 and not dfs(i, -c):
                return False
    return True


n = int(input())
g = []
for i in range(n):
    s = list(map(int, list(input())))
    for j in range(n):
        if s[j] == 0:
            s[j] = 1000000
        if i == j:
            s[j] = 0
    g.append(s)

# 二部グラフ判定
color = [0] * n
nibu = True
for i in range(n):
    if color[i] == 0:
        if not dfs(i, 1):
            nibu = False

if nibu:
    for k in range(n):
        for i in range(n):
            for j in range(n):
                g[i][j] = min(g[i][j], g[i][k] + g[k][j])
    ans = 0
    for i in range(n):
        ans = max(ans, max(g[i]))
    print(ans + 1)
else:
    print(-1)

Measured memory_bytes: 44124
#include <iostream>

long max = 1000000000000000000;

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

    long answer = 1;
    bool isOverflow = false;

    for (int i = 0; i < n; i += 1) {
        long a;
        std::cin >> a;

        if (a == 0) {
            std::cout << 0 << std::endl;
            return 0;
        } else if (isOverflow) {
            continue;
        }

        if (max / answer < a) {
            // Will be overflow
            isOverflow = true;
            continue;
        }

        answer = answer * a;
    }

    if (isOverflow) {
        std::cout << -1 << std::endl;
    } else {
        std::cout << answer << std::endl;
    }
}


Measured memory_bytes: 3632