akhauriyash/Code-Regression huggingface dataset:
#define _USE_MATH_DEFINES

#include <iostream>
#include <cstdio>
#include <memory>
#include <string>
#include <cstdlib>
#include <set>
#include <utility>
#include <vector>
#include <list>
#include <algorithm>
#include <regex>
#include <cmath>
#include <map>
#include <iterator>
#include <climits>
#include <numeric>
#include <bitset>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>
#include <queue>
#include <deque>
#include <stack>
#include <array>
#include <valarray>
#include <complex>
#include <random>
#include <functional>
#include <cassert>
#include <chrono>
#include <memory>

using namespace std;

#define int long long
//region TEMPLATE
////@formatter:off
#define double long double
typedef long long ll;
typedef unsigned long long ull;
template<typename T>void __read(T &a) { cin >> a; }
template<typename T, typename ... Args> void __read(T &a, Args &... args) { cin >> a;__read(args...);}
#define make(t, ...) t __VA_ARGS__; __read(__VA_ARGS__)
#define makev(a, n) VI a(n); FOR(n) cin >> a[i]
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define FORIT(p) for(auto it = p.begin(); it != p.end(); it++)
#define FOR(b) for(signed i = 0; i <(b); i++)
#define FORE(i, l, r) for(int i = (l); i < (r); i++)
#define NFOR(i, n) for(int i = (((int) n)-1); i >= 0; i--)
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
typedef pair<pair<int, int>, int> PPII;
constexpr ll M7 = 1000000007ll;
constexpr ll M9 = 1000000009ll;
constexpr ll MFFT = 998244353ll;
template<class T> void outv(T &a) { for (auto &x : a) cout << x << ' '; }
static mt19937 rnd(static_cast<unsigned>(chrono::steady_clock::now().time_since_epoch().count())); // NOLINT(cert-err58-cpp)
auto __fast_io__ = (ios_base::sync_with_stdio(false), cin.tie(nullptr)); // NOLINT(cert-err58-cpp,cppcoreguidelines-interfaces-global-init)
////@formatter:on
//endregion




int32_t main() {
    make(int, n, m, q);
    vector<tuple<int, int, int, int>> ar(q);
    for (auto&[a, b, c, d] : ar) {
        cin >> a >> b >> c >> d;
        a--, b--;
    }
    VI val(n, 1);
    int ans = 0;
    while (val[0] == 1) {
        int sm = 0;
        for (auto&[a, b, c, d] : ar) {
            if (val[b] - val[a] == c){
                sm += d;
            }
        }
        ans = max(ans, sm);
        int i = n - 1;
        while(i >= 0 && val[i] == m){
            i--;
        }
        if (i < 0){
            break;
        }
        val[i]++;
        while(i + 1 < n){
            val[i + 1] = val[i];
            i++;
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3624
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.StringTokenizer;

public class Main {
  public static void main(String[] args) {
	  FastReader sc = new FastReader();
	  String s = sc.next();
	  String t = sc.next();
	  int[] sCharCnt = new int[26];
	  int[] tCharCnt = new int[26];
	  
	  for (int i = 0; i < s.length(); i++) {
		  sCharCnt[s.charAt(i) - 'a']++;
		  tCharCnt[t.charAt(i) - 'a']++;
	  }
	  
	  Arrays.sort(sCharCnt);
	  Arrays.sort(tCharCnt);
	  
	  List<Integer> sl = new ArrayList();
	  List<Integer> tl = new ArrayList();
	  
	  for (int i = 0; i < sCharCnt.length; i++) {
		  if (sCharCnt[i] != 0) { sl.add(sCharCnt[i]); }
		  if (tCharCnt[i] != 0) { tl.add(tCharCnt[i]); }
	  }
	  
	  if (sl.size() != tl.size()) {
		  System.out.println("No");
		  System.exit(0);
	  } else {
		  for (int i = 0; i < sl.size(); i++) {
			  if (sl.get(i).intValue() != tl.get(i).intValue()) {
				  System.out.println("No");
				  System.exit(0);
			  }
		  }
	  }
	  System.out.println("Yes");
	  System.exit(0);
  }
  
  static class FastReader {
    BufferedReader br;
    StringTokenizer st;

    public FastReader() {
      br = new BufferedReader(new InputStreamReader(System.in));
    }
  
    String next() { 
      while (st == null || !st.hasMoreElements()) {
        try {
          st = new StringTokenizer(br.readLine());
        } catch (IOException  e) {
          e.printStackTrace();
        }
      }
      return st.nextToken();
    }

    int nextInt() {
      return Integer.parseInt(next());
    }

    long nextLong() {
      return Long.parseLong(next());
    }

    double nextDouble() { 
      return Double.parseDouble(next());
    }

    String nextLine() {
      String str = "";
        try{
            str = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return str;
      }
  }
}


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

const ll MOD = 1000000007;

struct mint {
    ll x;
    mint(ll x = 0) : x((x % MOD + MOD) % MOD) {
    }
    mint operator-() const {
        return mint(-x);
    }
    mint &operator+=(const mint a) {
        if ((x += a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator-=(const mint a) {
        if ((x += MOD - a.x) >= MOD) x -= MOD;
        return *this;
    }
    mint &operator*=(const mint a) {
        (x *= a.x) %= MOD;
        return *this;
    }
    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }
    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }
    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }
    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t / 2);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime MOD
    mint inv() const {
        return pow(MOD - 2);
    }
    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }
    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

ostream &operator<<(ostream &os, const mint &a) {
    return os << a.x;
}

int main() {
    string L;
    cin >> L;
    int N = L.size();
    vector<vector<mint>> dp(N + 1, vector<mint>(2, 0));
    dp[0][0] = 1;
    for (int i = 1; i <= N; ++i) {
        int l = L[i - 1] - '0';
        if (l == 0) {
            dp[i][0] = dp[i - 1][0];
            dp[i][1] = dp[i - 1][1] * 3;
        } else {
            dp[i][0] = dp[i - 1][0] * 2;
            dp[i][1] = dp[i - 1][1] * 3 + dp[i - 1][0];
        }
    }
    cout << dp[N][0] + dp[N][1] << endl;
}

Measured memory_bytes: 5760
/*
My heart’s beating faster
I know what I’m after
 
I’ve been standing here my whole life
Everything I’ve seen twice
Now it’s time I realized
It’s spinning back around now
On this road I’m crawlin’
Save me 'cause I’m fallin’
Now I can’t seem to breathe right
'Cause I keep runnin' runnin' runnin' runnin'
Runnin' runnin' runnin' runnin'
Runnin' from my heart
*/
 
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define ld long double
#define pb push_back
#define nt _int128
#define fir first
#define sec second
#define slow_as_snail ios_base::sync_with_stdio(false) , cin.tie(NULL);
#define debug(x) cout<<x<<"\n";
#define debugged cout<<"debugged\n";
#define inf 0x3f3f3f3f
#define rall(v) v.rbegin(),v.rend()
#define all(v) v.begin(),v.end() 
 
const ll mod = 1000000007;
#define mx 10000005
const ll mxi = 100005;

int main()
{
    slow_as_snail;
    ll n;
    cin>>n;
    ll d = n%1000;
    cout<<(1000-d)%1000;
}

Measured memory_bytes: 3632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
  
#define repd(i,a,b) for (int i=(a);i<=(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;

int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}
  
int main()
{
  int n;
  cin >> n;

  int p[n];
  int i;
  int cnt = 0;

  for(i=0;i<n;i++){
      cin >> p[i];
      if(p[i] != i+1){cnt++;}
  }

  if(cnt == 0 || cnt == 2){
      cout << "YES" << endl;
  }
  else{
      cout << "NO" << endl;
  }

  return 0;

}


Measured memory_bytes: 256
N,K=map(int,input().split())
a=input().split()

list.sort(a)#小さい順に並び替える
    
count=1#各数字が何回出てくるか
size=0#何種類の数字が出てくるか
b=[]#各数字が何回出てきたかを入れる箱
for p in range (N-1):
  if a[p]==a[p+1]:
    count+=1
  else:
    b.append(count)
    count=1
    size+=1

b.append(count)
size+=1
  
list.sort(b,reverse=True)#大きい順に並び替える

s=0
if K<size:
  for u in range (K):
    s+=b[u]#大きい方からK個分の個数の合計
else:
  s=N#出てくる数の個数が少なければ変える必要はない
print(N-s)

Measured memory_bytes: 19316
#include <iostream>
#include <cstdlib>
#include <vector>
#include <string>
#include <climits>
#include <algorithm>
#include <functional>
#include <string.h>

#define LOP(N) for(int i=0; i<N; i++)
#define LOOP(i, N) for(int i=0; i<N; i++)
#define LOOP_s(i, start, end) for(int i=start; i<end; i++)

using namespace std;


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

    long long int result = 1;
    LOOP_s(i, 1, N+1) {
        result = result * i % 1000000007;
    }
    cout << result;
}


Measured memory_bytes: 256
#include <iostream>

bool solve() {
    int s;
    std::cin >> s;
    if (s == 0) return false;

    for (int i = 0; i < 9; ++i) {
        int x;
        std::cin >> x;
        s -= x;
    }

    std::cout << s << "\n";
    return true;
}

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

    while (solve()) {}

    return 0;
}



Measured memory_bytes: 3220
c=[0,2,5,5,4,5,6,3,7,6];N=gets.split[0].to_i;A=B=gets.split.map &:to_i;d=[0]+B.map{};0.upto(N){|i|q=A.map{|x|c[x]<=i&&d[t=i-c[x]]?d[t]*10+x:p}.compact;q.any?&&d[i]=q.max};p d[N]

Measured memory_bytes: 36092
#include<bits/stdc++.h>
#define ll long long 
#define pb push_back
#define mod 1000000007
#define all(v) v.begin(),v.end()
#define MP make_pair
#define F first
#define S second
#define inf 10000000000000
#define vll vector<ll>
using namespace std;
const int N=200005;

void solve()
{
	ll n,a[N],i,ans,m;
	
	cin>>m>>n;
	vll v(m,0);
	for(i=0;i<n;i++)
		cin>>a[i];
	sort(a,a+n);
	ans=a[n-1]-a[0];
	m--;
	for(i=0;i<n-1;i++)
		v.pb(a[i+1]-a[i]);
	sort(all(v));
	reverse(all(v));
	i=0;
	while(m--)
		ans-=v[i++];
	cout<<ans;
}
 
int main() {
    
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	
    ll t=1;
    //cin>>t;
    while(t--)
        solve();
 
    
    return 0;
}

Measured memory_bytes: 3592
//O(NlogN + Qlog^2N)の適当解法(クエリ入れ替えなし)
//意味が分からないバグに悩まされる。→セグメントツリーの子はind*2 + 1とind*2 + 2。間違えてたし気づかなすぎたので、頭ない。
#include<iostream>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<math.h>
using namespace std;

int d;
int x[252521];
int q;
int l[100000], r[100000], e[100000];

const int INF = 1145141919;

const int depth = 17;		//ここをデバッグ用に6に設定していて、3WA出すなんて、あほすぎる。
class Segtree {
public:
	vector<int> data[1<<(depth+1)];
	
	void ini(int index = 0, int a = 0, int b = (1<<(depth)) - 1) {
		//[a, b]の昇順ソート列をdata[index]に入れる。
		for(int i = a; i <= b; i++ )
			data[index].push_back(x[i]);
		sort(data[index].begin(), data[index].end() );
		if ( b - a > 0 ) {
			ini(index*2 + 1, a, a + (b-a-1)/2);
			ini(index*2 + 2, a + (b-a+1)/2, b);
		}
	}
	
	//[l, r]にv以下の要素がいくつあるか。
	int count(int l, int r, int v, int index = 0, int a = 0, int b = (1<<(depth)) - 1) {
		if ( a > r || b < l || data[index].size() == 0 ) return 0;
		
		if ( l <= a && b <= r ) {			
			//[a, b]の昇順ソート列の中で、v(以下の要素のうち最大の要素)は何番目にある？
			//最初を0番とする。
			int st = -1, ed = data[index].size() - 1, medi;
			while( st <= ed ) {
				medi = (st + ed)/2;
				if ( data[index][medi] > v )
					ed = medi-1;
				else {
					if ( medi+1 == data[index].size() || data[index][medi+1] > v )
						break;
					st = medi+1;
				}
			}
			//Index + 1を返す
			return medi + 1;
		}
		int cnt1 = count(l, r, v, index*2 + 1, a, a + (b-a-1)/2);
		int cnt2 = count(l, r, v, index*2 + 2, a + (b-a+1)/2, b);
		return cnt1 + cnt2;
	}
}seg;

signed main() {
	int i, j;
	cin >> d;
	for( i = 0; i < d; i++ )
		cin >> x[i];
	for( i = d; i < 252521; i++ )
		x[i] = INF;
	
	seg.ini();
	
	cin >> q;
	for( i = 0; i < q; i++ ) {
		cin >> l[i] >> r[i] >> e[i];
		l[i]--; r[i]--;
		int a = max(x[l[i]], x[r[i]]) + e[i];
		int b = min(x[l[i]], x[r[i]]) - e[i];
		
		int cnt1 = seg.count(l[i], r[i], a);
		int cnt2 = seg.count(l[i], r[i], b-1);
		
		int ans = r[i] - l[i] + 1 - (cnt1 - cnt2);
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 24632
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <stack>
#include <climits>
#include <map>
#include <set>

using namespace std;

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

const ll mod = 1000000007;
const int inf = 1e9;
const long long INF = 1LL << 60;



int main()
{
    int n;cin >> n;
    vector<int> a(n),b(n),c(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());

    vector<ll> cnt(n);
    for(int i = 0; i < n; i++) cnt[i] = 0;
    for(int i = 0; i < n; i++){
        auto iter = upper_bound(b.begin(),b.end(),a[i]);
        if(iter != b.end()){
            int id = distance(b.begin(),iter);
            cnt[id]++;
        }
    }
    for(int i = 1; i < n; i++){
        cnt[i] = cnt[i] + cnt[i-1];
    }

    ll ans = 0;
    for(int i = 0; i < n; i++){
        auto iter = upper_bound(c.begin(),c.end(),b[i]);
        if(iter != c.end()){
            ll id = c.end() - iter;
            ans += (id * cnt[i]);
        }
    }
    cout << ans << endl;
} 


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

#include <iostream>

using namespace std;
using ll = long long;

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

    int continuous = 0;
    int max = 0;
    for (int i = 0; i < N; i++) {
        int a, b;
        cin >> a >> b;
        if (a == b) {
            continuous++;
        } else {
            continuous = 0;
        }
        if (continuous > max) max = continuous;
    }
    if (max >= 3)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String s = sc.next();
		sc.close();
		switch(s){
		case "SUN":
			System.out.println("7");
			return;

		case "MON":
			System.out.println("6");
			return;

		case "TUE":
			System.out.println("5");
			return;

		case "WED":
			System.out.println("4");
			return;

		case "THU":
			System.out.println("3");
			return;

		case "FRI":
			System.out.println("2");
			return;

		case "SAT":
			System.out.println("1");
			return;
			
		}
	}

}


Measured memory_bytes: 21588
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define REP(i,x,n) for(int i = (x); i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);

int main(void)
{
    string s;
    cin >> s;
    ll ans=0,n=s.size();
    vector<ll> a(n+1,0);
    rep(i,n){
        if(s[i] == '<') a[i+1] = max(a[i+1], a[i]+1);
    }
    for(int i=n-1; i>=0; i--){
        if(s[i] == '>') a[i] = max(a[i], a[i+1]+1);
    }
    rep(i,n+1) ans += a[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 7700
#include<iostream>
using namespace std;
long double p; int n;
int main() {
	cin >> n >> p; if (n % 2 == 1)n++; p = 100.0l - p; p /= 100.0l;
	long double ans = 1.0l*n / (2 - p * 2);
	printf("%.14Lf\n", ans);
	return 0;
}

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

//atcoder124
int main() {
  int A, B;
  int ans = 0;
  cin >> A >> B;

  if(A > B){
    ans += A;
    A--;
  }else{
    ans += B;
    B--;
  }
  if(A > B){
    ans += A;
    A--;
  }else{
    ans += B;
    B--;
  }
  cout << ans;



  }


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
#include <algorithm>
#include <cctype>
#include <cmath>
#include <bitset>
#include <set>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)(n);i++)
#define RREP(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define all(i,n) (i),(i+n)

int dx4[4]={1,0,-1,0};
int dy4[4]={0,-1,0,1};
int dx8[8]={1,0,-1,1,-1,1,0,-1};
int dy8[8]={1,1,1,0,0,-1,-1,-1};

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

const int INF = 1e9;
const ll LLINF = 1e18;
const int MAX_V = 1e6+1;
const ll mod = 1000000007;

// --------------------------------------
int n, k;
ll a[100005];
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> n >> k;
  REP(i, n) {
    cin >> a[i];
  }

  ll ans = LLINF;
  REP(i, n - k + 1) {
    ll r = abs(a[i]) + abs(a[i + k - 1] - a[i]);
    ll l = abs(a[i + k - 1]) + abs(a[i + k - 1] - a[i]);

    ans = min({ans, r, l});
  }

  cout << ans << endl;
}


Measured memory_bytes: 1024
#define _USE_MATH_DEFINES

#include <iostream>
#include <iomanip>
#include <stdio.h>

#include <sstream>
#include <algorithm>
#include <iterator>
#include <cmath>
#include <complex>

#include <string>
#include <cstring>
#include <vector>
#include <bitset>

#include <queue>
#include <set>
#include <map>
#include <stack>
#include <list>

#include <ctime>
////
//#include <random>//
/////////

typedef long long LL;
typedef long double LD;
typedef unsigned long long ULL;

////定数
const int INF = (int)1e9 + 10;
const LL MOD = (LL)1e9 + 7;
const LL LINF = (LL)4e18 + 20;
const LD PI = acos(-1.0);
const double EPS = 1e-9; 
/////////
using namespace::std;
template<typename T>
void chmax(T& a, T b) {
	a = max(a, b);
}

template<typename T>
void chmin(T& a, T b) {
	a = min(a, b);
}

template<typename T>
void IN(vector<T> &A,int N=-1) {
	if (N == -1) {
		N = A.size();
	}
	for (int i = 0; i < N; ++i) {
		cin >> A[i];
	}
}

template<typename T>
void SO(vector<T> &A,bool F=false) {
	sort(A.begin(), A.end());
	if (F) {
		reverse(A.begin(), A.end());
	}
}
//////////////
long long  bitcount64(long long bits)
{
	bits = (bits & 0x5555555555555555) + (bits >> 1 & 0x5555555555555555);
	bits = (bits & 0x3333333333333333) + (bits >> 2 & 0x3333333333333333);
	bits = (bits & 0x0f0f0f0f0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f0f0f0f0f);
	bits = (bits & 0x00ff00ff00ff00ff) + (bits >> 8 & 0x00ff00ff00ff00ff);
	bits = (bits & 0x0000ffff0000ffff) + (bits >> 16 & 0x0000ffff0000ffff);
	return (bits & 0x00000000ffffffff) + (bits >> 32 & 0x00000000ffffffff);
}

void solve() {
	int N;
	cin >> N;
	vector<int> M(N);
	for (int i = 0; i < N; ++i) {
		int s = 0;
		int k;
		for (int j = 0; j < 10; ++j) {
			cin >> k;
			s |= (k << j);
		}
		M[i] = s;
	}
	vector< vector<LL> > P(N, vector<LL>(11));
	for (int i = 0; i < N; ++i) {
		for (int j = 0; j < 11; ++j) {
			cin >> P[i][j];
		}
	}
	LL ans = -LINF;
	for (int s = 1; s < (1 << 10); ++s) {
		LL res = 0;
		for (int i = 0; i < N; ++i) {
			int ter = s & M[i];
			int c = bitcount64(ter);
			res += P[i][c];
		}
		chmax(ans, res);
	}
	cout << ans << endl;
}

signed main(void) {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	std::cout << std::fixed;//小数を10進数表示
	cout << setprecision(16);//小数点以下の桁数を指定//coutとcerrで別	

	solve();
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using static System.Console;

class Program
{
    static void Main(string[] args)
    {
        var N = int.Parse(ReadLine());
        var A = ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();

        var mod = 1_000_000_007L;

        var sumA = new long[N];
        sumA[0] = A[^1];
        for (int i = 1; i < A.Length; i++)
            sumA[i] = sumA[i - 1] + A[^(i + 1)];
        sumA = sumA.Reverse().ToArray();

        var ans = new BigInteger();

        for (int i = 0; i < A.Length - 1; i++)
            ans += (BigInteger)A[i] * sumA[i + 1];

        ans %= mod;

        WriteLine(ans);
    }
}


Measured memory_bytes: 67472
package main

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

var sc = bufio.NewScanner(os.Stdin)

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

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	sc.Split(bufio.ScanWords)

	n, a, b := nextInt(), nextInt(), nextInt()
	if n * a < b {
		fmt.Println(n * a)
	} else {
		fmt.Println(b)
	}
}


Measured memory_bytes: 640
n,m=map(int,input().split())
a=[]

for i in range(n):
    a.append(list(map(int,input().split())))
    
b=[]
for i in range(m):
    b.append(int(input()))

for i in range(n):
    c=0
    for j in range(m):
        c+=a[i][j]*b[j]
    print(c)




Measured memory_bytes: 6012
import java.util.Scanner;

public class Main {
	public static void main (String[] args) {
		Scanner scanner = new Scanner(System.in);
		int X = scanner.nextInt();
		
		for (int i = 0 ; i <= X ; i++) {
			if (i * (i + 1) / 2 >= X) {
				System.out.println(i);
				break;
			}
		}
	}
}

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

int main() {
    vector<bool> is_prime(1000000,true);

    is_prime[0] = is_prime[1] = false;
    for(int i=2; i<=sqrt(1000000); i++)
        if(is_prime[i])
            for(int j=i*i; j<1000000; j+=i) 
                is_prime[j] = false;

    int X;
    cin >> X;
    while(!is_prime[X]) X++;
    cout << X;
}

Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define int           long long
#define pb            push_back
#define all(a)        (a).begin(),(a).end()
#define sz(x)         (int)x.size()
#define F             first
#define S             second
#define endl          "\n"
#define inf           (long long)1000000007
#define FOR(i, a, b)  for(int i=a; i<b; i++)
#define bigint        1e18
mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); 
#define SHUF(v) shuffle(aint(v), RNG);
// Use mt19937_64 for 64 bit random numbers. 

template <typename T>
T ceil(T a, T b){ return (a+b-1)/b; }


template<typename T>
T binpow(T a, T b, T m) {
    a %= m;
    T res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve(){
    // (n-c)%a==0
    // n%a == c%a

    int n; cin>>n;
    int cnt=0;
    FOR(a, 1, n) {
        cnt+=(n-1)/a;
    }
    cout<<cnt<<endl;
}

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);     
    int t=1;
    //cin>>t;
    FOR(i, 1, t+1){ 
        //cout<<"Case #"<<i<<": ";
        solve();
    }
    cerr << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n";
    return 0;
 
}

Measured memory_bytes: 3656
n,m = map(int,input().split())
ps = []
for i in range(m):
    p,s = input().split()
    ps.append([int(p),s])
ps.sort(key=lambda x:x[0])
d = {}
t = 0
ac = 0
wa = 0

for res in ps:
    if t != res[0]:
        if res[1] == "WA":
            d[res[0]] = d.get(res[0],0) + 1
        else:
            ac += 1
            wa += d.get(res[0],0)
            t = res[0]

print(ac,wa)


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

using namespace std;

typedef long long ll;

ll ex[64];


ll solve(ll n, ll x){
	if(x==0)
		return 0;
	if(n==0)
		return 1;
	if(x<(2*ex[n]-1))
		return solve(n-1,x-1);
	else if(x==2*ex[n]-1)
		return solve(n-1,x-2)+1;
	else
		return 2*ex[n-1] + solve(n-1,x-2*ex[n] + 1);
}

int main(){

	ll n,x;
	cin >> n >> x;
	ex[0] = 1;
	for(int i=1;i<60;i++)
		ex[i] = ex[i-1]*2;
	cout << solve(n,x);
	

}

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

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

Measured memory_bytes: 256
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <limits>
#include <iostream> 
#include <iomanip>  
#include <string>
#include <sstream>  
#include <algorithm>
#include <numeric>
#include <complex>
#include <functional>
#include <cstring>
#include <cmath>
#include <cassert>


#define INF              (int)1000000007
#define EPS              1e-9
#define pb               push_back
#define mp               make_pair
#define all(c)           c.begin(), c.end()
#define forall(i,a,b)    for(int i=a;i<(b);++i)
#define trav(a,x)        for(auto & a: x)
#define in(a,b)          ((b).find(a) != (b).end())
#define sz(c)            (int)(c).size()
#define input(a)         for(auto & x : a) cin >> x;

using namespace std;

typedef vector<int>      vi;
typedef pair<int,int>    ii;
typedef vector<vi>       vvi;
typedef vector<ii>       vii;
typedef long long        ll;

#ifdef DEBUG
#define debug(args...)   {dbg,args; clog<<endl;}
#define print_( a )      for( auto & x : a ) clog << x << ' '; clog << '\n';
#define printPair_( a )  for( auto & x : a ) clog << '(' << x.first << ',' << x.second << ')' << ' '; clog << '\n';
#else
#define debug(args...)            
#define print_( a )               
#define printPair_( a )           
#endif

struct debugger {
  template<typename T> debugger& operator , (const T& x) {    
    clog << x << " ";    return *this;    
  }
}dbg;

auto ____ =[]() { std::ios::sync_with_stdio(0); cin.tie(0); return nullptr; }();
unordered_set<ll> factorize( ll n ){
  unordered_set<ll> bag;
  if( n%2 == 0 ) bag.insert(2);
  while( n%2 == 0 ){ n /= 2; }
  for(ll i = 3; i*i <= n; ++i ){
    while( n%i == 0 ){
      bag.insert(i);
      n /= i;
    }
  }
  if( n > 2 ) bag.insert(n);
  return bag;
}
int main( int argc, char * argv[] ){
  ll n,m; cin >> n >> m; 
  ll z = __gcd<ll>(n,m);
  //ll z = gcd(n,m);
  auto ans = factorize(z);
  print_(ans);
  cout << 1 + sz(ans) << '\n';
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#define int long long
using namespace std;
int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a / (gcd(a, b))*b;
}
signed main() {
	int t,n,a=1;
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> t;
		a = lcm(a, t);
	}
	cout << a << endl;
}

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

//O(F|E|)
class FordFulkerson{
public:
	class edge{
	public:
		int to, cap, rev;
		edge(){};
		edge(int _to, int _cap, int _rev){
			to = _to;
			cap = _cap;
			rev = _rev;
		}
	};
	vector<vector<edge> >G;
	vector<int>used;
	FordFulkerson(int n){
		G.resize(n);
	}
	void addEdge(int from, int to, int cap){
		G[from].push_back(edge(to, cap, G[to].size()));
		G[to].push_back(edge(from, 0, G[from].size() - 1));
	}
	int dfs(int v, int t, int f){
		if (v == t)return f;
		used[v] = 1;
		for (int i = 0; i < G[v].size(); i++){
			edge &e = G[v][i];
			if ((!used[e.to]) && (e.cap > 0)){
				int d = dfs(e.to, t, min(f, e.cap));
				if (d > 0){
					e.cap -= d;
					G[e.to][e.rev].cap += d;
					return d;
				}
			}
		}
		return 0;
	}
	int maxFlow(int s, int t){
		int flow = 0;
		for (;;){
			used.clear();
			used.resize(G.size(), 0);
			int f = dfs(s, t, 1145141919);
			if (f == 0)return flow;
			flow += f;
		}
	}
};

int main(){
    for(int H, W, C, M, NW, NC, NM;cin>>H>>W>>C>>M>>NW>>NC>>NM;){
        if(H<0)break;
        FordFulkerson mf(310);
        for(int i=1;i<=H;i++)mf.addEdge(0, i, 1);
        for(int i=1;i<=H;i++)mf.addEdge(i, 301, 1);
        
        mf.addEdge(301, 302, NW);
        for(int i=51;i<=50+W;i++)mf.addEdge(i, i+50, 1);
        
        for(int i=101;i<=100+W;i++)mf.addEdge(i, 303, 1);
        
        mf.addEdge(303, 304, NC);
        for(int i=151;i<=150+C;i++)mf.addEdge(i, i+50, 1);
        for(int i=151;i<=150+C;i++)mf.addEdge(302, i, 1);
        
        for(int i=201;i<=200+C;i++)mf.addEdge(i, 305, 1);
        
        for(int i=251;i<=250+M;i++)mf.addEdge(304, i, 1);
        for(int i=251;i<=250+M;i++)mf.addEdge(i, 306, 1);
        mf.addEdge(305, 306, NM);

        for(int i=1;i<=W;i++){
            int n;
            cin>>n;
            for(int j=1;j<=n;j++){
                int h;
                cin>>h;
                mf.addEdge(h, 50+i, 1);
            }
        }
        for(int i=1;i<=C;i++){
            int n;
            cin>>n;
            for(int j=1;j<=n;j++){
                int w;
                cin>>w;
                mf.addEdge(100+w, 150+i, 1);
            }
        }
        for(int i=1;i<=M;i++){
            int n;
            cin>>n;
            for(int j=1;j<=n;j++){
                int c;
                cin>>c;
                mf.addEdge(200+c, 250+i, 1);
            }
        }
        cout << mf.maxFlow(0, 306) << endl; 
    }
	return 0;
}


Measured memory_bytes: 3212
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define int long long
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e18;

long long mod_pow(long long x, long long n){
	if(n == 0) return 1;
	long long res = mod_pow(x * x % mod, n / 2);
	if(n & 1) res = res * x % mod;
	return res;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	int n, a, b;
	cin >> n >> a >> b;
	int ans = mod_pow(2, n) - 1 + mod;
	int ca = 1, cb = 1;
	for(int i = 1; i <= a; i++){
		ca = ca * mod_pow(i, mod - 2) % mod;
		ca = ca * (n - i + 1) % mod;
	}
	for(int i = 1; i <= b; i++){
		cb = cb * mod_pow(i, mod - 2) % mod;
		cb = cb * (n - i + 1) % mod;
	}
	cout << (ans - ca - cb + 2 * mod) % mod << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<math.h>
using namespace std;
int main(void){
    
    double L,V;
    
    scanf("%lf",&L);
    
    V = (L/3) * (L/3) * (L/3);
    printf("%.12lf\n",V);
    
    return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.math.BigInteger;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int x = cin.nextInt();
        for(int i = -1000;i <= 1000;i++){
            for(int j = -1000;j <= 1000;j++){
                BigInteger t = BigInteger.valueOf(i);
                BigInteger m = BigInteger.valueOf(j);
                BigInteger cur = t.pow(5).subtract(m.pow(5));
                if(cur.equals(BigInteger.valueOf((int)x))){
                    System.out.println(i + " " + j);return ;
                }
            }
        }
//        for(int i = 100;i <= 10000;i++){
//            BigInteger x = BigInteger.valueOf(i);
//            BigInteger t = BigInteger.valueOf(i - 1);
//            BigInteger cur = x.pow(5);
//            BigInteger cnt = t.pow(5);
//            BigInteger ans = cur.subtract(cnt);
//            ans = ans.subtract(BigInteger.valueOf((int)1e9));
//            System.out.println(i + " " + ans);
//        }
    }
}


Measured memory_bytes: 60532
#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;

const double PI = 3.1415926535897932384626433832795;

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

int gcd(int x, int y) { return y ? gcd(y, x % y) : x; }
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }
int lcm(int x, int y) { return x / gcd(x, y) * y; }
ll lcm(ll x, ll y) { return x / gcd(x, y) * y; }

vector<int> enumDiv(int n) {
	vector<int> res;
	for (int i = 1; i * i <= n; i++) {
		if (n % i != 0) {
			continue;
		}

		res.emplace_back(i);

		if (i == 1) {
			continue;
		}

		if (i * i != n) {
			res.emplace_back(n / i);
		}
	}

	res.emplace_back(n);

	sort(begin(res), end(res));
	return res;
}

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

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

	vector<int> divs = enumDiv(m);
	sort(rbegin(divs), rend(divs));

	for (auto d : divs) {
		if (m / d >= n) {
			cout << d << endl;
			break;
		}
	}

	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s;
int cnt,n;
const int maxn = 500005;
int head[maxn], to[maxn], nxt[maxn],in[maxn];
void add(int x, int y)
{
	to[++cnt] = y;
	nxt[cnt] = head[x];
	head[x] = cnt;
}
int d[500005];
void bfs()
{
	queue<int>q;
	for (int i = 0; i <= n; i++)
	{
		if (!in[i])d[i]=0,q.push(i);
	}
	while (!q.empty())
	{
		int t = q.front();
		q.pop();
		for (int i = head[t]; i; i = nxt[i])
		{
			int y = to[i];
			in[y]--;
			if (!in[y])
			{
				q.push(y);
				d[y] = min(d[y],d[t] + 1);
			}
		}
	}
}
int main()
{
	while (cin >> s)
	{
		ll sum = 0;
		memset(d, 0x7f, sizeof(d));
		cnt = 0;
		n = s.length();
		for (int i = 0; i < n; i++)
		{
			if (s[i] == '<')in[i + 1]++,add(i, i + 1);
			else add(i + 1, i),in[i]++; 
		}
		bfs();
		for (int i = 0; i <= n; i++)sum+=d[i];
		cout << sum << endl;
	}
}

Measured memory_bytes: 11140
n,k = map(int,input().split())
s,p,r=map(int,input().split())
t = input()
ans = 0
for i in range(n):
    if i<k:
        ans+=(s if t[i]==str('s') else p if t[i]==str('p') else r)
    else:
        if t[i]==t[i-k]:
            t = t[:i]+'*'+t[i+1:]
        else:
            ans+=(s if t[i]==str('s') else p if t[i]==str('p') else r)
print(ans)

Measured memory_bytes: 3496
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>   //PBDS
#include <ext/pb_ds/tree_policy.hpp>       //PBDS
#define int long long int
#define vi vector<int>
#define vii vector<pair<int,int>>
#define pi pair<int,int>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define mi map<int,int>
#define PI   3.141592653589
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define f(i,x,n) for(int i=x;i<n;i++)
#define rf(i,x,n) for(int i=n-1;i>=x;i--)
#define check(x)   cerr<<#x<<" : "<<x<<endl;
#define ordered_set tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update>
#define fbo find_by_order                    //return iterator PBDS
#define ook order_of_key                     //return number :)) PBDS
#define baar exit(0)
using namespace __gnu_pbds;
using namespace std;
int powmod(int base,int exponent,int mod)
{
	int ans=1;
	while(exponent){
		if(exponent&1)ans=(ans*base)%mod;
		base=(base*base)%mod;
		exponent/=2;
	}
	return ans;
}
signed main()
{
	fast
	int h,w,k;
	cin>>h>>w>>k;
	string  ans[h];
	int ttl=0;
	f(i,0,h)
	{
		cin>>ans[i];
		f(j,0,w)
		{
			if(ans[i][j]=='#') ttl++;
		}
    }
    int db=0;
    f(i,0,(1LL<<h))
    {
    	f(j,0,(1LL<<w))
    	{
    		vi row,col;
    		int val=ttl;
    		f(k,0,32)
    		{
    			if(i&(1<<k)) row.pb(k);
			}
			f(k,0,32)
			{
				if(j&(1<<k)) col.pb(k);
			}
			int vis[7][7];
			memset(vis,0,sizeof(vis));
			for(int x:row)
			{
				for(int l=0;l<w;l++)
				{
					if(ans[x][l]=='#') 
					{
						val--;
						vis[x][l]=1;
					}
				}
			}
			for(int x:col)
			{
				for(int l=0;l<h;l++)
				{
					if(vis[l][x]==0 && ans[l][x]=='#')
					{
						val--;
					}
				}
			}
			if(val==k) db++;
		}
	}
	cout<<db;
	//cerr << "Time elapsed: " << clock() / 1000 << " ms" << endl;
    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include <utility>
#include <iomanip>
#include <cmath>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
typedef long long ll;
using namespace std;
const int N = 2e5 + 5;
const ll MOD = 10e9 + 7;

int visited[N];
unordered_map<int, set<int>> edges;
int ct = 0;
int res = 0;
void dfs(int root, set<int> adjacents)
{
    for (int adjacent : adjacents)
    {
        visited[root] = 1;
        if (!visited[adjacent])
        {
            ct++;
            dfs(adjacent, edges[adjacent]);
        }
    }
}

int main()
{
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; ++i)
    {
        int a, b;
        cin >> a >> b;
        edges[a].insert(b);
        edges[b].insert(a);
    }

    for (int i = 1; i <= n; ++i)
    {
        ct = 1;
        if (!visited[i])
        {
            dfs(i, edges[i]);
        }
        res = max(ct, res);
    }
    cout << res << endl;
}

Measured memory_bytes: 90476
#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define per(i,a,n) for(int i=n;i>=a;i--)
#define pb push_back
#define SZ(x) ((int)(x).size())
#define fastin ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
typedef long long ll;
typedef pair<int,int> pii;
typedef double db;
int d,t,s;
int main(){
	cin>>d>>t>>s;
	if(t*s>=d)	puts("Yes");
	else	puts("No");
	return 0;
}


Measured memory_bytes: 3628
#include<bits/stdc++.h>
#define pi 3.1415926535897932384626
using namespace std;
      
struct P{
  int x,y;
  /*bool operator < (const P &a )const{
    //if(y!=a.y)
    return y<a.y;
  };*/
};

int a,b,c,d,i,k,n,m,e,dx[10]={1,0,-1,0,1,1,-1,-1},dy[10]={0,1,0,-1,1,-1,1,-1};
long long o[100031];
int l[3331];
int j[3331];

long long x,y,z,mod=1000000007;
//string r;
char r[3331];

P u[3331];
queue<int> q;
//stack<int> s;
set<int> s;
map<int,int> p;

vector<int> v;

bool as(P a,P b)
{
  //if(a.x!=b.x)
  //return a.x<b.x;
  return a.x<b.x;
}

long long f(long long x,long long y)
{
  long long p=1;
  for(;y;y/=2,x*=x,x%=mod)
  if(y%2)
  {
    p*=x;
    p%=mod;
  }
  return p;
}

int main()
{
  scanf("%d %d",&a,&b);
  for(int i=1;i*i<=a;i++)
  if(a%i==0)
  {
    v.push_back(i);
    if(a/i!=i) v.push_back(a/i);
  }
  sort(v.begin(),v.end());
  for(int i=0;i<v.size();i++)
  {
    p[v[i]]=i;
    //printf("%d ",v[i]);
  }
  for(int h=(int)v.size()-1;h>=0;h--)
  {
    long long s=a/v[h];
    o[h]+=f(b,s/2+s%2);
    o[h]%=mod;
    if(s%2) x+=o[h]*s%mod;
    else x+=o[h]*(s/2)%mod;
    x%=mod;
    for(int i=0;i<h&&(long long)v[i]*v[i]<=v[h];i++)
    if(v[h]%v[i]==0)
    {
      o[i]=(o[i]-o[h]+mod)%mod;
      if(v[h]/v[i]>v[i]&&v[i]>1) o[p[v[h]/v[i]]]=(o[p[v[h]/v[i]]]-o[h]+mod)%mod;
    }
    //printf("%lld %lld %lld\n",o[h],s,x);
  }
  printf("%lld",x);
}
//2
//21




Measured memory_bytes: 384
#include <stdio.h>
int main(){
    int n,now,top,l,r;
    scanf("%d%d",&n,&now);
    top=now;
    while(n--){
        scanf("%d%d",&l,&r);
        now+=l-r;
        if(now<0){
            top=0;
            break;
        }
        if(now>top)top=now;
    }
    printf("%d\n",top);
}


Measured memory_bytes: 2672
#include <iostream>
#include <random>
#include <chrono>
#include <algorithm>
#define rep(i, x) for(ll i = 0; i < x; i++)
using namespace std;
typedef long long ll;
const ll MOD = (ll)998244353;
const ll N = 1e5+5, inf = 1e17;
ll add(ll x, ll y) { x += y; if (x >= MOD) return x - MOD; return x; }
ll sub(ll x, ll y) { x -= y; if (x < 0) return x + MOD; return x; }
ll mult(ll x, ll y) { return (x * y) % MOD; }
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int main() {
  string s, t; cin >> s >> t;
  int ans = 0;
  for (int i = 0; i < s.length(); i++) {
    ans += (s[i] != t[i]);
  }
  cout << ans;
}

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

typedef long long ll;
typedef pair<int,int> pint;
#define INF 99999999
#define rep(i,n) for(int i=0,temp=(int)(n);i<temp;++i) 
#define repi(i,start,end) for(int i=start,temp=(int)(end);i<end;++i)
#define rfor(v,x) for(const auto& x : v) //xは値を表す
#define all(x) (x).begin(),(x).end()
#define SORT(v, n) sort(v, v+n)
#define vsort(v) sort(v.begin(), v.end())
#define vfsort(v,lambda) sort(v.begin(),v.end(),lambda)
#define vint vector<int>
#define vvint vector<vector<int>> //vvint v(n,vint(n))のように宣言できる
#define vin(v) rep(i,v.size()) {cin >> v[i];}
//最終奥義
//#define int long long
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
int gcd(int a,int b){return b?gcd(b,a%b):a;}
int ctoi(char c) {return c-'0';}
//lambda式 -> [&](int x, int y){return x<y;}
//vector内の重複を削除-> v.erase(unique(all(v)),v.end());
signed main(void){
  string s;cin >> s;
  rep(i,s.length())
    if(i%2==0&&s[i]=='L'||i%2&&s[i]=='R'){
      cout << "No" << endl;
      return 0;
    }
  cout << "Yes" << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'


int32_t main() {                                                                                                                        
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    
    char c;
    cin >> c;
    if (isupper(c))
      cout << 'A' << endl;
    else
      cout << 'a' << endl;
}   


Measured memory_bytes: 3608
#include<cstdio>

int main(){
  int n;
  scanf("%d",&n);
 
  
  int a[n];
  for(int i = 0; i < n ; i++){
    scanf("%d",&a[i]);
  }
  for(int i=n-1;i >=0;i--){
    if(i != 0){
      printf("%d ",a[i]);
    }
    else {
      printf("%d",a[i]);
    }
  }
    printf("\n");
  
  return 0;

}



Measured memory_bytes: 2716
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int tc;cin>>tc;
    map<string,int> mp;
    while(tc--)
    {

        string s;cin>>s;
        mp[s]++;
    }
    cout<<"AC x "<<mp["AC"]<<endl;
    cout<<"WA x "<<mp["WA"]<<endl;
    cout<<"TLE x "<<mp["TLE"]<<endl;
    cout<<"RE x "<<mp["RE"]<<endl;


}


Measured memory_bytes: 3604
#include<iostream>
using namespace std;
int main(){
  int t,n;
  long long int bell[100],tmp;
  while(1){
    t=0;

    cin >> n;
    if(n==0){
      break;
    }
    for(int i=0;i<n;i++){
      cin >> bell[i];
    }
    for(int i=0;i<n-1;i++){
      for(int j=n-1;j>i;j--){
	if(bell[j]<bell[j-1]){
	  tmp=bell[j];
	  bell[j]=bell[j-1];
	  bell[j-1]=tmp;
	  t++;
	}
      }
    }
    cout << t << endl;
  }
}

Measured memory_bytes: 1168
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var D = ReadLong();
            if (D == 25)
            {
                return "Christmas";
            }
            if(D == 24)
            {
                return "Christmas Eve";
            }
            if(D == 23)
            {
                return "Christmas Eve Eve";
            }
            return "Christmas Eve Eve Eve";
        }

        #region Console.Read

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static (long, long) Read2Longs() { var ls = ReadLongs(); return (ls[0], ls[1]); }
        public static (long, long, long) Read3Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2]); }
        public static (long, long, long, long) Read4Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3]); }
        public static (long, long, long, long, long) Read5Longs() { var ls = ReadLongs(); return (ls[0], ls[1], ls[2], ls[3], ls[4]); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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

int main(){
    int A[5];
    int K;
    for(int i=0;i<5;i++){
        cin>>A[i];
    }
    cin >> K;

    int max=A[4];
    int min=A[0];
    /*
    for(int i=1;i<1;i++){
        if(max<A[i])max=A[i];
        if(min>A[i])min=A[i];
    }
    */
    int d=max-min;
    if (d<=K)
    {
        cout<<"Yay!"<<endl;
    }else
    {
        cout<<":("<<endl;
    }
    
    
    
    
    return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<functional>
#include <random>
using namespace std;
long long A, B, ans;

long long p(long long a, long long b) {
	long long ret = (((b + 1) - a) / 2) % 2;
	return ret;
}

int main(void) {

	scanf("%lld %lld", &A, &B);
	if (A % 2 == 0 && B % 2 == 1) {
		ans = p(A, B);
	}
	if (A % 2 == 1 && B % 2 == 1) {
		ans = p(A + 1, B) ^ A;
	}
	if (A % 2 == 0 && B % 2 == 0) {
		ans = p(A, B - 1) ^ B;
	}
	if (A % 2 == 1 && B % 2 == 0) {
		ans = p(A + 1, B - 1) ^ A ^ B;
	}
	printf("%lld\n", ans);
}

Measured memory_bytes: 256
//teja349
#include <bits/stdc++.h>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <climits>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <iomanip> 
//setbase - cout << setbase (16); cout << 100 << endl; Prints 64
//setfill -   cout << setfill ('x') << setw (5); cout << 77 << endl; prints xxx77
//setprecision - cout << setprecision (14) << f << endl; Prints x.xxxx
//cout.precision(x)  cout<<fixed<<val;  // prints x digits after decimal in val

using namespace std;
#define f(i,a,b) for(i=a;i<b;i++)
#define rep(i,n) f(i,0,n)
#define fd(i,a,b) for(i=a;i>=b;i--)
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sz(a) a.size()
#define inf (1000*1000*1000+5)
#define all(a) a.begin(),a.end()
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (1000*1000*1000+7)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >

//std::ios::sync_with_stdio(false);   
ll A[(1<<18)],F[(1<<18)],G[(1<<18)];
vll vec;
vl jj;
ll haha[(1<<18)],b[(1<<18)],baba[(1<<18)];
int main(){
    std::ios::sync_with_stdio(false);
    ll N;
    cin>>N;
    ll i;
    rep(i,(1<<N)){
    	cin>>A[i];
    	vec.pb(mp(A[i],i));
    }
    sort(all(vec));
    rep(i,(1<<N)){
    	haha[i]=vec[i].ss;
    	b[vec[i].ss]=i;
    }
    for(ll i = 0; i<(1<<N); ++i){
		F[i] = b[i];
		G[i]=-1;
		//cout<<b[i]<<endl;
	}
	for(ll i = 0;i < N; ++i) for(ll mask = 0; mask < (1<<N); ++mask){
		if(mask & (1<<i)){
			//if(mask==3 && )
			//F[mask] += F[mask^(1<<i)];
			jj.clear();
			jj.pb(F[mask]);
			jj.pb(G[mask]);
			jj.pb(F[mask^(1<<i)]);
			jj.pb(G[mask^(1<<i)]);
			sort(all(jj));
			jj.resize(unique(jj.begin(), jj.end()) - jj.begin());
			F[mask]=jj[jj.size()-1];
			G[mask]=jj[jj.size()-2];
		}
	}
	f(i,1,(1<<N)){
		//cout<<i<<" "<<F[i]<<" "<<G[i]<<endl;
		baba[i]=max(baba[i],A[haha[F[i]]]+A[haha[G[i]]]);
		baba[i]=max(baba[i],baba[i-1]);
		cout<<baba[i]<<endl;
	}

    return 0;  
    
}



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

int power(int x,int p)
{
   int res=1;
   while(p)
   {
      if(p&1)res=(res*x)%mod;
      p=p>>1;
      x=(x*x)%mod;
   }
   return res;
}

int ncr(int n,int r)
{
   int x=min(r,n-r);
   int val=1;

   for(int i=0;i<x;i++)
   {
      val=((val*(n-i))%mod * power(i+1,mod-2))%mod;
   }
   return val;
}

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




int n,a,b;
cin>>n>>a>>b;

int ans=(power(2,n)-1+mod)%mod;
int val=(ncr(n,a)+ncr(n,b))%mod;
cout<<(ans-val+mod)%mod<<"\n";


}



Measured memory_bytes: 256
# https://atcoder.jp/contests/abc145/tasks/abc145_b

import sys
sys.setrecursionlimit(12345678)
import itertools
from collections import Counter
from collections import defaultdict
from collections import deque
import bisect
from heapq import heappush, heappop


def main():
    n = int(input())
    s = input()
    s1 = s[:n//2]
    s2 = s[n//2:]
    print('Yes' if s1 == s2 else 'No')

if __name__ == '__main__':
    main()


Measured memory_bytes: 38256