akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#define int int64_t
#define REP(i, n) for (int i = 0; (i) < (int)(n); ++ (i))
#define REP3(i, m, n) for (int i = (m); (i) < (int)(n); ++ (i))
#define REP_R(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define REP3R(i, m, n) for (int i = (int)(n) - 1; (i) >= (int)(m); -- (i))
#define REPP(i, n) for (int i = 1; (i) < (int)(n+1); ++ (i))
#define REPR(i, n) for (int i = (int)(n) - 1; (i) >= 0; -- (i))
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define FORR(i, m, n) for(int i=(m)-1; i>=(n); i--)
#define ALL(v) v.begin(), v.end()
#define SZ(a) int((a).size())
#define SORT(c) sort((c).begin(),(c).end())
#define SORTR(c) sort((c).begin(),(c).end(),greater<int>());
#define BIT(n) (1LL<<(n))
#define PCNT(x) __builtin_popcountll(x)
#define GCD(x,y) __gcd(x,y)
#define LCM(x,y) x/__gcd(x,y)*y
#define PB push_back
#define MP make_pair
#define endl "\n"
#define pa cout << ans << endl
#define p(x) cout << x << endl
#define pall(x) for(auto iter : x) p(iter)
#define yes cout << "Yes" << endl
#define no cout << "No" << endl
#define yn(x) cout << (x ? "Yes" : "No") << endl
using namespace std;
using Graph = vector<vector<int> >;
using WeightedGraph = vector<vector<pair<int, int> > >;
typedef long double LD;
typedef vector<int> VI;
typedef vector<vector<int> > VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
const int INF = 2000000000;
const long double PI = acosl(-1);
const int MOD = 1000000007;
void print() {cout << endl;}
template <class Head, class... Tail> void print(Head&& head, Tail&&... tail) {cout << head; if (sizeof...(tail) != 0) cout << " ";print(forward<Tail>(tail)...);}
template <class T> void print(vector<T> &vec) {for (auto& a : vec) {cout << a; if (&a != &vec.back()) cout << " ";} cout << endl;}
template <class T> void print(vector<vector<T>> &df) { for (auto& vec : df) { print(vec);}}


signed main() {
    std::ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
    cout << fixed << setprecision(10);
    int ans = 0;
    
    int N;
    cin >> N;
    vector<string> S(N);
    map<string,int> mp;
    REP (i, N) {
        cin >> S[i];
        mp[S[i]]++;
    }
    cout << "AC x " << mp["AC"] << endl;
    cout << "WA x " << mp["WA"] << endl;
    cout << "TLE x " << mp["TLE"] << endl;
    cout << "RE x " << mp["RE"] << endl;
    
    
    
    return 0;
}

/*
cd ~/Desktop/Programming/AtCoder/contest/abc173/abc173_b && sh shellscripts/test_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc173/abc173_b && sh shellscripts/etest_cpp.sh
cd ~/Desktop/Programming/AtCoder/contest/abc173/abc173_b && sh shellscripts/submit_cpp.sh
*/


Measured memory_bytes: 6368
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;

namespace AtCoder
{
	public class Program
	{
		static void Main()
		{
			var nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
			int n = nm[0];
			int m = nm[1];

			var degs = new int[n];
			for (int i = 0; i < n; i++) {
				degs[i] = -1;
			}

			for (int i = 0; i < m; i++) {
				var sc = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
				int s = sc[0] - 1;
				int c = sc[1];

				if (degs[s] == -1) {
					degs[s] = c;
				} else {
					if (degs[s] != c) {
						Console.WriteLine(-1);
						return;
					}
				}
			}

			if (degs[0] == -1) {
				if (n != 1) {
					degs[0] = 1;
				} else {
					degs[0] = 0;
				}
			} else if (degs[0] == 0 && n != 1) {
				Console.WriteLine(-1);
				return;
			}

			for (int i = 1; i < n; i++) {
				if (degs[i] == -1) {
					degs[i] = 0;
				}
			}

			var sb = new StringBuilder();
			for (int i = 0; i < n; i++) {
				sb.Append(degs[i].ToString());
			}

			Console.WriteLine(sb.ToString());
		}
	}
}

Measured memory_bytes: 28312
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#define PI 3.141592653589793
#define MOD 1000000007

//qsort用、昇順
int compare_int(const void *a, const void *b)
{
	return *(int*)a-*(int*)b;
}
//qsort(data, 10, sizeof(int), compare_int)

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

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

const int N = 1e5;

int n;
int memo[N+5][4];
int li[N+5][4];

int dp(int idx, int bef){
   if(idx>n) return 0;
   int &ret = memo[idx][bef];
   if(ret!=-1) return ret;
   for(int j=1;j<=3;j++){
      if(j == bef) continue;
      ret = max(ret , dp(idx+1,j) + li[idx][j]);
   }
   return ret;
}

int main(){
   memset(memo,-1,sizeof(memo));
   scanf("%d",&n);
   for(int i=1;i<=n;i++){
      for(int j=1;j<=3;j++){
         scanf("%d",&li[i][j]);
      }
   }
   int ans = dp(1,0);
   printf("%d\n",ans);
	return 0;
}


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


int main(){

    long long int n;
    cin >> n;
    long long int ans=0;
    long long five=10;

    if(n%2==1) cout << 0 << endl;
    else{
        while(1){
            if(five>n) break;
            ans+=n/five;
            five*=5;
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 3504
#include <iostream>
#include <math.h>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <set>
#include <algorithm>
#include <iomanip>
#include <string.h>

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()

typedef long long lint;

using namespace std;

int main(){
  string w;;
  cin>>w;
  map<char,int> m;
  for(auto c:w)m[c]+=1;
  bool flag=1;
  for(auto  i:m){
    if(i.second%2)flag=0;
  }
  if(flag)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}


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

int main() {
    cout << fixed << setprecision(10);
    
    int N, K; cin >> N >> K;
    vector<int> h(N);
    rep(i, N) cin >> h[i];
    vector<int> dp(N);
    dp[0] = 0;

    int INF = 1e+9;
    repr(i, 1, N) {
        int min_cost = INF;
        repr(j, max(0, i-K), i) {
            min_cost = min(min_cost, dp[j]+abs(h[j] - h[i]));
        }
        dp[i] = min_cost;
    }
    cout << dp[N-1] << endl;
    return 0;
}

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

namespace AOJ
{
  class Problem0031
  {
    static void Main()
    {
      var avail = new[] { 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 };
      foreach (var weight in ReadNumbers())
      {
        foreach (var n in Enumerable.Range(1, avail.Length))
        {
          var comb = Combination(avail, n, false).Where(c => c.Sum() == weight).FirstOrDefault();
          if (comb != null)
          {
            // Console.WriteLine(string.Join(" ", comb));
            Console.WriteLine(string.Join(" ", comb.Select(x => x.ToString()).ToArray()));
            break;
          }
        }
      }
    }

    static IEnumerable<int> ReadNumbers()
    {
      string line;
      while (!string.IsNullOrEmpty(line = Console.ReadLine()))
        yield return int.Parse(line);
    }

    static IEnumerable<T[]> Combination<T>(IEnumerable<T> elements, int n, bool isRepeated)
    {
      if (n == 1)
      {
        foreach (var el in elements)
          yield return new T[] { el };
      }
      else
      {
        foreach (var atom in elements)
        {
          var temp = elements.SkipWhile(x => !x.Equals(atom)).ToList();
          if (!isRepeated)
            temp.Remove(atom);
          var comb = Combination(temp, n - 1, isRepeated);
          foreach (var e in comb)
            yield return (new T[] { atom }).Concat(e).ToArray();
        }
      }
    }
  }
}

Measured memory_bytes: 6644
#include<iostream>
#include<string>
#include<vector>
#include<numeric>
#include<math.h>
#include<algorithm>
#include<iomanip>
#include<bitset>
#include<list>
using namespace std;

struct Info {
	int r;
	int c;
	int cnt;
	Info(int dr, int dc, int dcnt) {
		r = dr;
		c = dc;
		cnt = dcnt;
	}
};

int main() {

	int H, W;
	cin >> H >> W;

	vector<string> A(H, "");
	int pos = 0;
	list<Info> loc;
	for (int i = 0; i < H; i++) {
		cin >> A[i];
		pos = A[i].find('#', 0);
		while (pos != string::npos) {
			loc.push_back(Info(i, pos, 0));
			pos = A[i].find('#', pos + 1);
		}
	}

	vector<Info> nns = { Info(-1,0,1), Info(1,0,1) , Info(0,-1,1) , Info(0,1,1) };

	Info val = Info(0,0,0); 
	Info dval = Info(0, 0, 0);

	while (loc.size() != 0) {
		val = loc.front();
		loc.pop_front();
		for (int i = 0; i < nns.size(); i++) {
			dval = val;
			dval.r += nns[i].r;
			dval.c += nns[i].c;
			if (0 <= dval.r && dval.r < H && 0 <= dval.c && dval.c < W) {
				if (A[dval.r][dval.c] == '.') {
					A[dval.r][dval.c] = '#';
					loc.push_back(Info(dval.r, dval.c, dval.cnt + nns[i].cnt));
				}
			}
		}
	}
	
	cout << val.cnt << endl;

	return 0;
}


Measured memory_bytes: 52260
import java.util.*;

public class Main {
	static class Tree {
		int N;
		ArrayList<ArrayList<Integer>> node;
		public Tree(int N) {
			this.N = N;
			node = new ArrayList<>();
			for(int i=0; i<N; i++)
				node.add(new ArrayList<Integer>());
		}
		
		public void addNode(int a, int b) {
			node.get(a).add(b);
			node.get(b).add(a);
		}
		
		
		public int cut(int root, int K) {
			int L = node.get(root).size();
			int[] cost1 = new int[L];
			int sum = 0;
			for(int i=0; i<L; i++) {
				cost1[i] = getCost(root, node.get(root).get(i), K/2-1);
				sum += cost1[i];
			}
			
			if(K%2==0)
				return sum;
			
			int[] cost2 = new int[L];
			int ans = N;
			for(int i=0; i<L; i++) {
				cost2[i] = getCost(root, node.get(root).get(i), (K+1)/2-1);
				ans = Math.min(ans, sum+cost2[i]-cost1[i]);
			}
			
			return ans;
		}
		
		int getCost(int parent, int cur, int maxDepth) {
			int ans = 0;
			for(Integer i : node.get(cur)) {
				if(i==parent)
					continue;
				ans += getCost(cur, i, maxDepth-1);
			}
			return ans + (maxDepth<0 ? 1 : 0);
		}
	}
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		int K = sc.nextInt();
		Tree tree = new Tree(N);
		
		for(int i=0; i<N-1; i++)
			tree.addNode(sc.nextInt()-1, sc.nextInt()-1);
		
		int ans = N;
		for(int i=0; i<N; i++)
			ans = Math.min(ans, tree.cut(i, K));
		
		System.out.println(ans);
		sc.close();
	}
}


Measured memory_bytes: 21220
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		int h = sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H-h) * (W-w));
	}
}


Measured memory_bytes: 23252
#include <iostream>
#include <utility>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int n, m, i;
    cin >> n >> m;
    vector<pair<int,int> > ans(m);
    vector<pair<pair<int,long long>, int> > cities(m);
    vector<int> cnt(n,0);

    for (i = 0; i < m; i++) {
        cities[i].second = i;
        cin >> cities[i].first.first >> cities[i].first.second;
    }

    sort(cities.begin(), cities.end());

    for (i = 0; i < m; i++) {
        cnt[cities[i].first.first]++;
        ans[cities[i].second].second = cnt[cities[i].first.first];
        ans[cities[i].second].first = cities[i].first.first;
    }

    for (i = 0; i < m; i++) {
        printf("%06d%06d\n", ans[i].first, ans[i].second);
    }

    return 0;
}

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

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

typedef pair<ll, ll> pll;
// const ll INF = (ll)1e18;

bool solve() {
	int n;
	cin >> n;
	if (n == 0) {
		return false;
	}
	double a[n];
	double sum = 0;
	double sum2 = 0;
	REP (i, n) {
		cin >> a[i];
		sum += a[i];
	}
	double avg = sum / n;
	REP (i, n) {
		sum2 += pow(a[i] - avg, 2);
	}
	double res = sqrt(sum2 / n);
	cout << res << endl;
	return true;
}

signed main() {
	while (solve()) { }
}

Measured memory_bytes: 3260
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
int main() {
  int n,dp[45]={};
  cin >> n;
  dp[0]=1;
  dp[1]=1;
  for(int i=2; i<=n; i++) {
      dp[i]=dp[i-1]+dp[i-2];
  }
  cout << dp[n] << endl;
}


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

typedef long long ll;

using namespace std;

#define swap(a, b)    do { typeof(a) __tmp = (a); (a) = (b); (b) = __tmp; } while(0)
#define repd(i, a, b) for(typeof(b) i = a; i < (b); ++i)
#define rep(i, n)     repd(i, 0, n)
#define dump(x)       cerr << #x << " = " << (x) << endl
#define debug(x)      cerr << "L" << __LINE__ << ": " << #x << " = " << (x) << endl
#define YesNo(x)      cout << ((x) ? "Yes" : "No") << endl
#define YESNO(x)      cout << ((x) ? "YES" : "NO") << endl
#define absi(x)       ( ((x) >= 0) ? (x) : (-(x)) )

int main(int argc, const char* argv[]) {
	ll r;
	cin >> r;

	if(r < 1200) {
		cout << "ABC" << endl;
	} else if(r < 2800) {
		cout << "ARC" << endl;
	} else {
		cout << "AGC" << endl;
	}

	return 0;
}


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

#define irep(i,n) for(int i = 0; i < (int)(n); i++)
#define irep2(i,a,n) for(int i = (int)(a); i <= (int)(n); i++)
#define irrep(i,n) for(int i = (int)(n-1); i > -1; i--)
#define irrep2(i,n,a) for(int i = (int)(n); i >= (int)(a); i--)

#define fi first
#define se second

using namespace std; 

using ll = long long;
using v_int = vector<int>;
using v2_int = vector<v_int>;
using v_ll = vector<ll>;
using v2_ll = vector<v_ll>;
using v_string = vector<string>;
using v_bool = vector<bool>;
using v2_bool = vector<v_bool>;
using pii = pair<int, int>;
using mii = map<int, int>;

const double PI = 3.1415926535897932;
const int INF = (int)2e9;
const ll LINF = (ll)2e18;
const ll MOD = 1000000007;
const int dc[8] = {1, -1, 0,  0, 1, -1,  1, -1};
const int dr[8] = {0,  0, 1, -1, 1,  1, -1, -1};

template<typename T, typename U> inline
ostream& operator<<(ostream &o, pair<T,U> &p) {
    return o << "{" << p.first << "," << p.second << "}";
}
template<typename T> inline
istream& operator>>(istream &is, vector<T> &vec) {
    for(auto &v : vec) { is >> v; }
    return is;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<T> &vec) {
    for(auto &v : vec) { os << v << ",";} 
    return os;
}
template<typename T> inline
ostream& operator<<(ostream &os, vector<vector<T> > &mat) {
    for(auto &row : mat) { os << row << endl; }
    return os;
}
template<typename T> inline
void chmin(T &a, T b) { a = min(a, b); }
template<typename T> inline
void chmax(T &a, T b) { a = max(a, b); }

int main(void)
{
    int n;
    cin >> n;
    v_int l(n);
    cin >> l;
    
    int ans = 0;
    for(int i = 0; i < n; i++) {
        for(int j = i+1; j < n; j++) {
            for(int k = j+1; k < n; k++) {
                v_int s(3);
                s[0] = l[i];
                s[1] = l[j];
                s[2] = l[k];
                sort(s.begin(), s.end());
                if(s[0] != s[1] && s[1] != s[2] && s[0] != s[2] && s[0]+s[1] > s[2]) { ans++; } 
            }
        }
    }
    cout << ans << endl;
    return 0;
} /*atcoder*/



Measured memory_bytes: 3632
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    s = S() + "AAAAAAAAAAAAAAAA"
    if s[:4] == "YAKI":
        print("Yes")
    else:
        print("No")
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 39280
struct Read<R: std::io::BufRead> {
    stdin: R,
    v: Vec<String>,
    i: usize,
}
impl<R:std::io::BufRead> Read<R> {
    pub fn new(stdin: R) -> Self {
        Read{
            stdin: stdin,
            v: Vec::new(),
            i: 0,
        }
    }
    pub fn read_line(&mut self) {
        self.i = 0; self.v.clear();
        let mut buf = String::new();
        self.stdin.read_line(&mut buf).unwrap();
        let buf = buf.trim().to_owned();
        let mut ws = buf.split_whitespace();
        loop {
            let x = ws.next();
            if x.is_none() {break;}
            let x = x.unwrap().to_owned();
            self.v.push(x);
        }
    }
    #[allow(dead_code)]
    pub fn read_t<T: std::str::FromStr>(&mut self) -> T {
        if self.i == self.v.len() {self.read_line();}
        let elem = &self.v[self.i];
        self.i += 1;
        elem.parse().unwrap_or_else(|_| panic!())
    }
    
    #[allow(dead_code)]
    pub fn read_i32(&mut self) -> i32 {
        if self.i == self.v.len() {self.read_line();}
        let elem = self.v[self.i].parse().unwrap();
        self.i += 1;
        elem
    }
    #[allow(dead_code)]
    pub fn read_usize(&mut self) -> usize {
        if self.i == self.v.len() {self.read_line();}
        let elem = self.v[self.i].parse().unwrap();
        self.i += 1;
        elem
    }
    #[allow(dead_code)]
    pub fn read_u64(&mut self) -> u64 {
        if self.i == self.v.len() {self.read_line();}
        let elem = self.v[self.i].parse().unwrap();
        self.i += 1;
        elem
    }
    #[allow(dead_code)]
    pub fn read_string(&mut self) -> String {
        if self.i == self.v.len() {self.read_line();}
        let elem = &self.v[self.i];
        self.i += 1;
        elem.to_owned()
    }
}

fn main() {
    use std::io;
    let stdin = io::stdin();
    let stdin = io::BufReader::new(stdin.lock());
    let read = Read::new(stdin);
    solve(read);
}

fn solve<R: std::io::BufRead>(mut r: Read<R>) {
    let x:f64 = r.read_t();
    let mut a = 100.0;
    let mut ans = 0;
    let mut tmp:i64;
    loop {
        ans+=1;
        a*=1.01;
        tmp = a as i64;
        a = tmp as f64;
        if a >= x {
            println!("{}",ans);
            return;
        }
    }

}


Measured memory_bytes: 2212
alp=[i for i in "abcdefghijklmnopqrstuvwxyz"]

n=int(input())
moji=""
while(n!=0):
  ind=n%26
  if ind==0:
    n=n//26-1
  else:
    n=n//26
  moji=alp[ind-1]+moji
print(moji)


Measured memory_bytes: 9172
#include<bits/stdc++.h>
#define endl "\n"
#define ll long long int
#define N (ll)(1e9+7)
#define T int
#define P pair<T,T>
#define umap unordered_map<T,T>
#define uset unordered_set<T>
#define rep(i,n) for(i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define print(v) for(auto x:v) cout<<x<< " "
#define pb push_back
using namespace std;
#define _USE_MATH_DEFINES

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
   	ll n,m;
   	cin>>n>>m;
   	ll sum=0;
   	ll i;
   	rep(i,m)
   	{
   		ll x;
   		cin>>x;
   		sum+=x;
   	}
   	if(sum>n)
   		cout<<"-1"<<endl;
   	else
   		cout<<n-sum<<endl;

    return 0;
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n;
    string s, t;
    cin >> n >> s >> t;
    rep (i, n) cout << s[i] << t[i];
    cout << endl;
    
    return 0;
}



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

int main(){
  string str;
  stack<char> s;
  int f;
  while(1){
    f=0;
    getline(cin,str);

     if(str[0]=='.') break;

    for(int i=0;i<str.size();i++){
      if(str[i]=='(' || str[i]=='[') s.push(str[i]);
      else if(str[i]==')' || str[i]==']'){
	if( s.empty()!=1 && str[i]==')' && s.top()=='(') s.pop();
	else if(s.empty()!=1 && str[i]==']' && s.top()=='[') s.pop();
	else f=1;
		    } 
    }

    if(f==0 && s.empty()==1) cout<<"yes"<<endl;
    else  cout<<"no"<<endl;
    while(s.empty()!=1)s.pop();
  }
  return 0;
}

Measured memory_bytes: 1172
// include headers{{{
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
/*}}}*/
# define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;

template<typename integer>
integer __lcm(integer a, integer b) {
    return (a * b) / __gcd(a, b);
}

int main() {
    long long a, b, c;
    cin >> a >> b >> c;
    
    string ans = "NO";
    rep (i, a*b) {
        if (i*a % b == c) {
            ans = "YES";
            break;
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
//素因数分解
//例えば60=2^2*3*5だったら、{(2,2),(3,1),(5,1)}を返す
vector<pair<ll,ll>> prime_factrize(ll n){
  vector<pair<ll,ll>> res;
  for(ll i=2;i<=sqrt(n);i++){
    if(n%i!=0)continue;
    ll tmp=0;
    while(n%i==0){
      ++tmp;
      n/=i;
    }
    res.push_back(make_pair(i,tmp));
  }
  if(n!=1)res.push_back(make_pair(n,1));
  return res;
}

int main(){
  ll N;
  cin>>N;
  vector<pair<ll,ll>> pri;
  pri=prime_factrize(N);
  ll cnt=0;
  for(ll i=0;i<pri.size();i++){
    ll v=pri[i].first;
    ll p=pri[i].second;
    
    for(ll j=1;j<=p;j++){
      //cout<<"v"<<v<<" "<<"j"<<j<<endl;
      ll tmp=(pow(v,j));
      if(N%tmp==0){
        N=N/pow(v,j);
        cnt++;
       // cout<<N<<endl;
      }
    }
  }
    cout<<cnt<<endl;
  
}

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

int main(){
	int n,m;
	cin>>n>>m;
	int map[100][100];
	int sum_h[100],sum_l[100];
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
    	    char tmp;
			cin>>tmp;
			if(tmp=='.')map[i][j]=0;
			else map[i][j]=1;
			sum_h[i]+=map[i][j],
			sum_l[j]+=map[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			if(sum_h[i]==0 || sum_l[j]==0)continue;
			cout<<char(map[i][j]?'#':'.');
		}
		if(sum_h[i])cout<<endl;
	}
}

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

#define rep(i, n) for (int i = 0; i < (int) (n); i++)
typedef long long ll;


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

    int  slime;
    char color[100000];
    int  count = 1;

    cin >> slime;

    rep(i, slime)
    {
        cin >> color[i];
    }
    rep(i, slime - 1)
    {
        if (color[i] != color[i + 1])
        {
            count++;
        }
    }
    cout << count << endl;

    return 0;
}


Measured memory_bytes: 384
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

//あたまわるわる～

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


	char S[11];
	int N = fread_unlocked(S, 1, 11, stdin);
	N--;

	ll dp[2] = {};
	dp[0] = S[0] - '0';
	rep1(i, N - 1) {
		dp[1] += dp[1];
		dp[1] += dp[0];
		dp[0] = dp[0] * 10 + (S[i] - '0') * (1 << i);
	}
	printf("%lld", dp[0] + dp[1]);

	Would you please return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int arr[N];

int minCost(int n) {
    int dp[n];
    for (int i = 0; i < n; i++)
        dp[i] = INT_MAX;
    dp[0] = 0;
    dp[1] = abs(arr[1] - arr[0]);

    for (int i = 2; i < n; i++) {
        dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2]));
    }

    return dp[n - 1];
}

int main()
{
    int n; cin >> n;
    for (int i = 0; i < n; i++)
        cin >> arr[i];
    cout << minCost(n);
    return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<set>
#include<vector>
#include<algorithm>
#include<cmath>
#include<string>
#include<queue>
#include<stack>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> pii;
typedef pair<ll, bool> pib;

typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;

typedef vector<double> vf;

typedef long double ld;

#define mp make_pair
#define pb push_back

#define rep(i, N) for(ll i = 0; i < N; i++)
#define repa(i, a, N) for(ll i = a; i < N; i++)
#define repr(i, N) for(ll i = N-1; i >= 0; i--)

#define drep(i, N, j, M) rep(i, N) rep(j, M)
#define trep(i, N, j, M, k, L) rep(i, N) rep(j, M) rep(k, L)

#define all(A) A.begin(), A.end()

#define printItr(A) for(auto itr = A.begin(); itr != A.end(); ++itr){cout << * itr << ", ";}cout << endl;

const double PI = 3.141592653589793;

const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;

const ll LLMAX = numeric_limits<long long>::max();

void No() {
	cout << "No" << endl;
}

void Yes() {
	cout << "Yes" << endl;
}

ll id(char c) {
	return c - 'a';
}

bool isOK(vi& a, ll k, ll index) {
	return a[index] < k * (index + 1);
}

ll binary_search(vi& a, ll k) {
	ll left = -1; //「index = 0」が条件を満たすこともあるので、初期値は -1
	ll right = (ll)a.size(); // 「index = a.size()-1」が条件を満たさないこともあるので、初期値は a.size()

	/* どんな二分探索でもここの書き方を変えずにできる！ */
	while (right - left > 1) {
		ll mid = left + (right - left) / 2;

		if (isOK(a, k, mid))
			right = mid;
		else left = mid;
	}

	/* left は条件を満たさない最大の値、right は条件を満たす最小の値になっている */
	return right;
}

template<class t, class u>
ostream& operator<<(ostream& os, const pair<t, u>& p) {
	return os << "{" << p.first << "," << p.second << "}";
}

template<class t> ostream& operator<<(ostream& os, const vector<t>& v) {
	os << "{";
	for (auto e : v)os << e << ",";
	return os << "}";
}

bool eq(vi P, vi Q) {
	rep(i, P.size()) {
		if (P[i] != Q[i]) {
			return false;
		}
	}
	return true;
}

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

ll modinv(ll a, ll m) {
	ll b = m, u = 1, v = 0;
	while (b) {
		ll t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}

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

	vi X(N);
	rep(i, N) {
		cin >> X[i];
	}

	rep(i, N) {
		X[i] = X[N - 1] - X[i];
	}

	// 階上のMOD
	ll m = 1;
	repa(i, 1, N) {
		m *= i;
		m %= MOD;
	}

	ll ans = 0;
	rep(i, N-1) {
		ll ad = X[i] * ((m * modinv(i+1, MOD)) % MOD);
		ans += ad;
		ans %= MOD;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
import sys,heapq
from collections import deque,defaultdict
printn = lambda x: sys.stdout.write(x)
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
DBG = True # and False
def ddprint(x):
  if DBG:
    print(x)

n,l = inm()
s = n*l+n*(n-1)//2
x = s
if l>0:
    x = s - l
elif l+n-1<0:
    x = s - (l+n-1)
print(x)


Measured memory_bytes: 3564
from collections import Counter

def get_prime_factors(x):
    out = []
    if x < 1:
        return out
    while not x%2:
        out.append(2)
        x //= 2
    i = 3
    while i*i <= x:
        if not x%i:
            out.append(i)
            x //= i
        else:
            i += 2
    if x != 1:
        out.append(x)
    return out

def main():
    n = int(input())
    primes = Counter(get_prime_factors(n))
    ans = 0
    for k, v in primes.items():
        num = 1
        while v >= num:
            ans += 1
            v -= num
            num += 1
    print(ans)

if __name__ == "__main__":
    main()

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

#define int long long

string s;
string t;

signed main(){
    cin >> s;

    s.push_back('N');
    for(int i = 0;i < s.size()-1;i++){
        if(s[i] == 'B' && s[i+1] == 'C'){
            t.push_back('D');
            i++;
        }else{
            t.push_back(s[i]);
        }
    }

    int ans = 0;
    int dd = 0;
    for(int i = t.size()-1;i >= 0;i--){
        if(t[i] == 'D'){
            dd++;
        }else if(t[i] == 'A'){
            ans += dd;
        }else{
            dd = 0;
        }
    }

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



Measured memory_bytes: 776
n = int(input())
alist = []
blist = []
for i in range(n):
    a,b = map(int,input().split())
    alist.append(a)
    blist.append(b)

N = len(alist)
alist.sort()
blist.sort()
# 偶数の場合
if N % 2 == 0:
    median1 = N/2
    median2 = N/2 + 1
    median1 = int(median1) - 1
    median2 = int(median2) - 1
    amedian = (alist[median1] + alist[median2]) / 2
    bmedian = (blist[median1] + blist[median2]) / 2
    ans = (bmedian-amedian)*2+1
# 奇数の場合
else:
    median = (N + 1) / 2
    median = int(median) - 1
    amedian = alist[median]
    bmedian = blist[median]
    ans = bmedian-amedian+1
print(int(ans))


Measured memory_bytes: 25360
#include <bits/stdc++.h>
#define x first
#define y second
#define pb push_back
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const double PI  = acos(-1.0);
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;
const LL INF  = 0x3f3f3f3f3f3f3f3f;
const int N=6e5+10;
const int M=1e6+10;
const int mod=1e9+7;
inline LL gcd(LL a, LL b) { return b ? gcd(b, a % b) : a; }
inline LL lcm(LL a, LL b) { return a * b / gcd(a, b); }
inline LL read(){LL x=0,f=1;char c=getchar();while(c<'0'||c>'9') {if(c=='-')f=-1;c=getchar();}while(c>='0'&&c<='9') {x=x*10+c-'0';c=getchar();}return x*f;}
inline LL qpow(LL x,LL k=mod-2,LL m=mod){LL res=1;while(k){if(k&1) res=res*x%m;x=x*x%m;k>>=1;}return res;}
/*=================================================================================================================*/
int n,k,a[N],rt;

struct SegTree{
    #define mid (l+r>>1)
    int maxv[N*4],ls[N*4],rs[N*4],tot;
    void upd(int& id,int l,int r,int pos,int x){
        if(!id) id=++tot;
        if(l==r) {maxv[id]=max(maxv[id],x);return;}
        if(pos<=mid) upd(ls[id],l,mid,pos,x);
        else upd(rs[id],mid+1,r,pos,x);
        maxv[id]=max(maxv[ls[id]],maxv[rs[id]]);
    }
    int ask(int id,int l,int r,int L,int R){
        if(!id) return 0;
        if(L<=l&&r<=R) return maxv[id];
        int res=0;
        if(L<=mid) res=max(res,ask(ls[id],l,mid,L,R));
        if(R>mid) res=max(res,ask(rs[id],mid+1,r,L,R));
        return res;
    }
    #undef mid
}tr;

int main(){
    n=read(),k=read();
    for(int i=1;i<=n;i++) a[i]=read();
    int ans=0;
    for(int i=1;i<=n;i++){
        int temp=tr.ask(rt,-6e5,6e5,a[i]-k,a[i]+k);
        ans=max(ans,temp+1);
        tr.upd(rt,-6e5,6e5,a[i],temp+1);
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 10344
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  cin >> N;
  int N_1000 = N / 1000 % 10,
      N_100 = N / 100 % 10,
      N_10 = N / 10 % 10,
      N_1 = N / 1 % 10;
  if ((N_1000 == N_100 && N_100 == N_10) || (N_100 == N_10 && N_10 == N_1))
    cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
K = int(input())
l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]

print(l[K-1])


Measured memory_bytes: 3316
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int a, b; readV(a, b);

  if (b%a == 0)
    writeln(a+b);
  else
    writeln(b-a);
}


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

struct Node {
  int id;
  Node *left;
  Node *right;
  Node *parent;

  Node(int id) : id(id), left(NULL), right(NULL), parent(NULL) {};

  ~Node() {
    delete left;
    delete right;
  }
};

Node* getNode(map<int, Node*> &nodes, int id) {
  map<int, Node*>::iterator it = nodes.find(id);
  if (it == nodes.end()) {
    Node *node = new Node(id);
    nodes[id] = node;
    return node;
  } else {
    return it->second;
  }
}

Node *findRoot(Node *node) {
  Node *p = node;
  while (p->parent) {
    p = p->parent;
  }
  return p;
}

void printNodeId(Node *node) {
  cout << " " << node->id;
}

void preorder(Node *node) {
  printNodeId(node);
  if (node->left) {
    preorder(node->left);
  }
  if (node->right) {
    preorder(node->right);
  }
}

void inorder(Node *node) {
  if (node->left) {
    inorder(node->left);
  }
  printNodeId(node);
  if (node->right) {
    inorder(node->right);
  }
}

void postorder(Node *node) {
  if (node->left) {
    postorder(node->left);
  }
  if (node->right) {
    postorder(node->right);
  }
  printNodeId(node);
}

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

  int N;
  cin >> N;

  map<int, Node*> nodes;
  for (int i = 0; i < N; ++i) {
    int id, leftId, rightId;
    cin >> id >> leftId >> rightId;

    Node *n = getNode(nodes, id);
    Node *l = leftId == -1 ? NULL : getNode(nodes, leftId);
    Node *r = rightId == -1 ? NULL : getNode(nodes, rightId);

    n->left = l;
    n->right = r;
    if (l) {
      l->parent = n;
    }
    if (r) {
      r->parent = n;
    }
  }

  Node *root = findRoot(nodes.begin()->second);

  cout << "Preorder" << endl;
  preorder(root);
  cout << endl;

  cout << "Inorder" << endl;
  inorder(root);
  cout << endl;

  cout << "Postorder" << endl;
  postorder(root);
  cout << endl;

  delete root;

  return 0;
}



Measured memory_bytes: 3156
use std::io::Write;
use std::str::FromStr;

fn read_line() -> String {
    let mut ret = String::new();
    std::io::stdin().read_line(&mut ret).unwrap();
    ret.trim().to_owned()
}

fn reads<T: FromStr>() -> Vec<T>
where
    <T as std::str::FromStr>::Err: std::fmt::Debug,
{
    let s = read_line();
    s.split_whitespace().map(|w| w.parse().unwrap()).collect()
}

fn query(q: &[usize]) -> bool {
    if true {
        print!("?");
        for &q in q.iter() {
            print!(" {}", q + 1);
        }
        println!("");
        std::io::stdout().flush().unwrap();

        let rep = read_line();
        if rep == "Red" {
            return true;
        } else if rep == "Blue" {
            return false;
        }
    } else {
        static S: &'static [u8] = /*b"RRBBRB"; */ b"RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB";
        let mut sum = 0;
        for i in 0..q.len() {
            sum += if S[q[i]] == b'R' { 1 } else { -1 };
        }
        return sum > 0;
    }

    unreachable!()
}

fn query_(q: usize, n: usize) -> bool {
    let mut v = vec![];

    for i in 0..n {
        v.push((q + i) % (n * 2));
    }

    query(&v)
}

fn main() {
    let n = reads::<usize>()[0];
    let n2 = n * 2;

    let c0 = query_(0, n);

    let mut l = 0;
    let mut r = n;

    while r - l > 1 {
        let m = (l + r) / 2;
        if query_(m, n) == c0 {
            l = m;
        } else {
            r = m;
        }
    }

    // println!("l: {}", l);

    // println!("lq: {}", query_(l, n));
    // println!("rq: {}", query_(r, n));

    // sum[l+1..l+1+n-1] == 0

    let mut zero = vec![];
    for i in 0..n - 1 {
        zero.push(l + 1 + i);
    }

    // println!("zero: {:?}", zero);

    let mut ans = vec![None; n2];

    for i in 0..n + 1 {
        let cur = (l + n + i) % n2;
        let mut q = zero.clone();
        q.push(cur);

        // println!("* {}", cur);
        ans[cur] = Some(query(&q));
    }

    // println!("{:?}", ans);

    let mut ll = 0;

    for i in 0.. {
        let start = (l + n + i) % n2;
        let mut sum = 0;
        for j in 0..n - 1 {
            sum += if ans[(start + j) % n2].unwrap() {
                1
            } else {
                -1
            };
        }
        if sum == 0 {
            ll = start;
            break;
        }
    }

    let mut zero = vec![];
    for i in 0..n - 1 {
        zero.push((ll + i) % n2);
    }

    for i in 0..n - 1 {
        let cur = (l + 1 + i) % n2;
        let mut q = zero.clone();
        q.push(cur);
        // println!("* {}", cur);
        ans[cur] = Some(query(&q));
    }

    // println!("{:?}", ans);

    print!("! ");

    for i in 0..n2 {
        print!("{}", if ans[i].unwrap() { 'R' } else { 'B' });
    }

    println!();
    std::io::stdout().flush().unwrap();
}


Measured memory_bytes: 4816
#include<bits/stdc++.h>
#define MAX_N 200005
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(V) (V).begin(),(V).end()
#define reset(V) (V).clear();(V).resize(0);
#define sq(x) ((x)*(x))
#define abs(x) ((x)>0?(x):(-(x)))
#define fi first
#define se second
#define inf 0x3fffffff
#define full_inf 0x7fffffff
#define half_inf 0x3fffffff
//#define inf 0x3fffffff
#define MOD 1000000007LL
#define cpx_mod(x) (((LD)(((LL)x.real())%MOD)),((LD)(((LL)x.imag())%MOD)))
#define prev(x) (((x)+n-1)%n)
#define next(x) (((x)+1)%n)
#define mod(x) (((x)%h + h)%h)
using namespace std;
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
typedef pair<LL,LL> pil;
typedef pair<LL,string> pls;
typedef complex<LD> Complex;
LL a,b,c;
int main(){
	scanf("%lld %lld %lld",&a,&b,&c);
	if(c - a - b <= 0)	return !printf("No\n");
	printf("%s\n",(4*a*b < (c-a-b) * (c-a-b))?"Yes":"No");
	return 0;
}	

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

int main(){
    int x;
    int y;
    cin >> x >> y;
    for(int i=1; i<=x; i++){
        if(y == 2 * i + 4 * (x - i) || y == 2 * (x - i) + 4 * i){
            cout << "Yes" << endl;
            return 0;
        }
    }
    cout << "No" << endl;
    return 0;
}

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

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

#define ALL(a) a.begin(),a.end()
#define SZ(a) ((int)a.size())
#define FI first
#define SE second
#define REP(i,n) for(int i=0;i<((int)n);i++)
#define REP1(i,n) for(int i=1;i<((int)n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define PB push_back
#define EB emplace_back
#define MP(a,b) make_pair(a,b)
#define SORT_UNIQUE(c) (sort(c.begin(),c.end()), c.resize(distance(c.begin(),unique(c.begin(),c.end()))))
#define GET_POS(c,x) (lower_bound(c.begin(),c.end(),x)-c.begin())
#define Decimal fixed<<setprecision(20)
#define INF 1000000000
#define LLINF 1000000000000000000LL

const int inf = 1e9;
const ll linf = 1LL << 50;
const double eps = 1e-10;
const int MOD = 1e9 + 7;
const int dx[4] = {-1, 0, 1, 0};
const int dy[4] = {0, -1, 0, 1};


const ll MAX = 510000;
ll fac[MAX], finv[MAX], inv[MAX];

void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
            fac[i] = fac[i - 1] * i % MOD;
            inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
            finv[i] = finv[i - 1] * inv[i] % MOD;
        }
}

ll COM(ll n, ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}



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

  ll n;
  cin>>n;
  vll a(n+1);
  REP(i,n+1)cin>>a[i];

  pll cur;
  map<ll,ll> m;
  REP(i,n+1){
    if(m[a[i]]!=0){
      cur=pll(m[a[i]]-1,i);
    }
    else
      m[a[i]]=i+1;
  }


  COMinit();
  ll l=cur.FI;
  ll r=n-cur.SE;
  for(ll i=1; i<=n+1; i++){
    ll c=COM(n+1,i)-COM(l+r,i-1);
    if(c<0)
      c+=MOD;
    cout<<c<<endl;
  }


}


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

int main() {

    vector<int>a(3);
    for(int i = 0;i < 3;i++){
        cin >> a[i];
    }
    sort(a.begin(),a.end());

    int ans = a[2]*10 + a[1] + a[0];

    cout << ans;
   
}

   

Measured memory_bytes: 3636
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		int a = 0;
		int b = 0;

		try(Scanner scan = new Scanner(System.in)) {
			a = scan.nextInt();
			b = scan.nextInt();

			System.out.println((a * b) + " " + ((a + b) * 2));
		}
	}
}

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

int main() {
  string str;
  
  while(getline(cin,str)) {
    if(str == "END OF INPUT") break;
    
    int res = 0;
    for(int i=0; i<str.size(); i++) {
      if(str[i] == ' ') {
	cout << res;
	res = 0;
      } else {
	res ++;
      }
    }
    cout << res << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1184
#include <iostream>
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>

using namespace std;

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

		for(int i = 0;i < 101;i++){
			if(i == n){
				a[i]++;
			}
		}
	}
	int hold = a[0];
	for(int i = 1;i < 101;i++){
		if(hold < a[i]){
			hold = a[i];
		}
	}
	for(int i = 0;i < 101;i++){
		if(a[i] == hold) cout << i << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
N = int(input())
A = list(map(int,input().split()))
maxA = max(A)
minA = min(A)

if minA >=0 or 2*abs(maxA)>abs(minA):
  maxi = A.index(maxA)
  print(2*N-1)
  print(maxi+1,maxi+1)

  for i in range(N):
    if i == maxi:continue
    print(maxi+1,i+1)
  
  for i in range(N-1):
    print(i+1,i+2)

else:
  mini = A.index(minA)
  print(2*N-1)
  print(mini+1,mini+1)
  for i in range(N):
    if i == mini: continue
    print(mini+1, i+1)
  
  for i in range(N-1, 0, -1):
    print(i+1,i)


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

int main(){
    int n, a;
    cin >> n;
    map<int, int> cnt;
    rep(i, n){
        cin >> a;
        cnt[a]++;
    }
    if(cnt.size() % 2) cout << cnt.size() << endl;
    else cout << cnt.size() - 1 << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define inf 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define umapi unordered_map<ll, ll>
#define umapc unordered_map<char, int>
#define endl "\n"
#define pui pair<int, pair<int,int> >
using namespace std;

/*
            ॐ
    || Jai Shree Ram ||  
 
 */






void solve(){
    
    string s;
    cin>>s;

    int ans = 0;
    int cnt = 0;
    for(auto it : s) {
        if(it == 'R') {
            cnt++;
        } else{
            cnt = 0;
        }
        ans = max(ans, cnt);
    }

    cout<<ans;








}

 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(10);
    int t = 1;
    // //cin >> t;
    while (t--)
    {
        solve();
    }
}



Measured memory_bytes: 3604
//
//  abc169_c.cpp
//  learningCplusplus
//
//  Created by Tran Duc Chinh on 2020/04/04.
//  Copyright © 2020 Tran Duc Chinh. All rights reserved.
//

#include <iostream>
#include <queue>
#include <map>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;
ll mod = 998244353;
ll INF = 1000000007;
#define PI 3.14159265


int main() {
  long double a, b;
  std::cin >> a >> b;

  ll ans = (ll)a*b;
  std::cout << ans << std::endl;

  return 0;
}

Measured memory_bytes: 3792
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<math.h>
#include<numeric>
#include<cassert>
#include<random>
#include<deque>
#include<chrono>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
const ll E=1e18+7;
#define F first
#define S second
#define MK make_pair





int main(){
    ll n,w;
    vector<ll> b[4]={{0},{0},{0},{0}};
    cin>>n>>w;
    ll mx=0;
    ll a=-1;
    for(int i=0;i<n;i++){
        ll W,v;
        cin>>W>>v;
        if(i==0){a=W;}
        b[W-a].push_back(v);
    }
    for(int i=0;i<4;i++){
        sort(++b[i].begin(),b[i].end(),greater<ll>());
        for(int t=1;t<b[i].size();t++){
            b[i][t]+=b[i][t-1];
        }
    }
    for(ll i=0;(a+3)*i<=w && i<b[3].size();i++){
        for(ll t=0;(a+2)*t+(a+3)*i<=w && t<b[2].size();t++){
            for(ll h=0;(a+1)*h+(a+2)*t+(a+3)*i<=w && h<b[1].size();h++){
                ll k=min((ll)b[0].size()-1,(w-(a+1)*h-(a+2)*t-(a+3)*i)/a);
                mx=max(mx,b[3][i]+b[2][t]+b[1][h]+b[0][k]);
            }
        }
    }
    cout<<mx<<endl;
    
    
    return 0;
}

Measured memory_bytes: 256
import sys

S = input().split()

N = int(S[0])
L = int(S[1])

taste = []
for i in range(1, N + 1):
    taste.append(L + i - 1)

org_taste_sum = sum(taste)
abs_min = sys.maxsize
ans = 0

for i in range(0, N):
    tmp_taste_sum = 0
    for x in taste:
        if x == taste[i]:
            continue
        else:
            tmp_taste_sum += x

    abs_val = abs(org_taste_sum - tmp_taste_sum)
    if abs_val < abs_min:
        ans = tmp_taste_sum
        abs_min = abs_val

print(ans)

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

using namespace std;

// Function to solve the problem come here.

int main(int argc, char **argv)
{
    // The solution come here...
    // 1) 3 5 4
    int A, B, X, flag = 0;
    cin >> A >> B >> X;

    for (int i = 0; i <= B; i++)
    {
        if (A + i == X)
        {
            flag = 1;
            break;
        }
    }

    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;

    return 0;
}

Measured memory_bytes: 256