akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"
using namespace std;
#define int long long
#define REP(i,n) for(int i = 0;i < (int)(n);++i)
#define RREP(i,n) for(int i = (int)n-1;i >= 0;--i)
#define FOR(i,s,n) for(int i = s;i < (int)n;++i)
#define RFOR(i,s,n) for(int i = (int)n-1;i >= s;--i)
#define ALL(a) a.begin(),a.end()
#define IN(a, x, b) (a<=x && x<b)
template<class T>inline void out(T t){cout<<t<<"\n";}
template<class T,class... Ts>inline void out(T t,Ts... ts){cout<<t<<" ";out(ts...);}
template<class T>inline bool CHMAX(T&a,T b){if(a<b){a = b;return true;}return false;}
template<class T>inline bool CHMIN(T&a,T b){if(a>b){a = b;return true;}return false;}
constexpr int INF = 1e18;

template <typename T>
struct SegmentTree{
	using F = function<T(T,T)>;
	int n;
	F f;
	T ti;
	vector<T> dat;
	SegmentTree(){};
	SegmentTree(F f,T ti):f(f),ti(ti){}
	void init(int n_){
		n=1;
		while(n<n_) n<<=1;
		dat.assign(n<<1,ti);
	}
	void build(const vector<T> &v){
		int n_=v.size();
		init(n_);
		for(int i=0;i<n_;i++) dat[n+i]=v[i];
		for(int i=n-1;i;i--)
			dat[i]=f(dat[(i<<1)|0],dat[(i<<1)|1]);
	}
	void set_val(int k,T x){
		dat[k+=n]=x;
		while(k>>=1)
			dat[k]=f(dat[(k<<1)|0],dat[(k<<1)|1]);
	}
	T query(int a,int b){
		T vl=ti,vr=ti;
		for(int l=a+n,r=b+n;l<r;l>>=1,r>>=1) {
			if(l&1) vl=f(vl,dat[l++]);
			if(r&1) vr=f(dat[--r],vr);
		}
		return f(vl,vr);
	}
};
//auto f = [](){};
//auto seg = SegmentTree<T,decltype(f)>(f,Ti);

signed main(){
	int N;
	string s;
	cin >> N >> s;
	vector<SegmentTree<int>>seg(26,SegmentTree<int>([](int a,int b){return a+b;},0));
	REP(i,26){
		seg[i].build(vector<int>(N));
	}
	REP(i,N){
		seg[s[i] - 'a'].set_val(i,1);
	}
	int Q;
	cin >> Q;
	while(Q--){
		int t;
		cin >> t;
		if(t == 1){
			int idx;char c;
			cin >> idx >> c;
			--idx;
			seg[s[idx] - 'a'].set_val(idx,0);
			s[idx] = c;
			seg[s[idx] - 'a'].set_val(idx,1);
		}else{
			int cnt = 0;
			int l,r;
			cin >> l >> r;
			--l;--r;
			REP(i,26){
				cnt += seg[i].query(l,r + 1) > 0;
			}
			out(cnt);
		}
	}
}

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

using namespace std;

using ll = long long;


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

    ll ans = 0;

    int h;
    for (ll i = 0; i < N; ++i) {
        cin >> h;
        if (h >= K) { ++ans; }
    }
    
    cout << ans << endl;

    return 0;
}


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

int main() {
  long D;
  cin >> D;
  
  //減点量の入力
  long c[27];
  for(int i=1; i<26+1; i++){
    cin >> c[i];
  }
  
  //加点量の入力
  long s[D+1][26+1];
  for(int i=1; i<D+1; i++){
  for(int j=1; j<26+1; j++){
    cin >> s[i][j];
  }}
  
  //開催日程の入力
  long t[D+1];
  for(int i=1; i<D+1; i++){
    cin >> t[i];
  }
  
  //過去の最終開催日を保持する配列
  long past[26+1] = {0};
  
  //日々の処理
  
  for(int day=1; day<D+1; day++){
    
    //仮の満足度を保持する配列
    long tempPoint[26+1] = {0};
    for(int tt=1; tt<26+1; tt++){

      //満足度の加点計算
      tempPoint[tt] += s[day][tt];

      //満足度の減点計算
      for(int num=1; num<26+1; num++){
        tempPoint[tt] -= ( c[num] * (day - past[num]) );
      }
    }
    
    //それぞれの選択に対する満足度の変化量を表示
    //for(int i=1; i<26+1; i++){
    //  cout << i << " : " << tempPoint[i] << endl;
    //}
    
    //仮の満足度から一番高い満足度の選択を出力
    int choice=1;
    for(int i=1; i<26+1; i++){
      if(tempPoint[choice] < tempPoint[i]) choice = i;
    }
    //cout << "choice " << choice << endl;
    if(day!=D){
      cout << choice << endl;
    }else{
      cout << choice;
    }
    
    //実行したテストを記録
    past[choice] = day;
  }

  return 0;
}


Measured memory_bytes: 3708
import sys
def input():
    return sys.stdin.readline()[:-1]
inf=float("inf")
n=int(input())
s=input()
dp=[[0]*10,[0]*100,[0]*1000]
for i in range(n):
    for j in range(100):
        if dp[1][j]>=1:
            # print(j*10+int(s[i]))
            dp[2][j*10+int(s[i])]+=1
    for j in range(10):
        if dp[0][j]>=1:
            dp[1][j*10+int(s[i])]+=1
            # print(j*10+int(s[i]))
    dp[0][int(s[i])]+=1
ans=0
# print(dp[0])
# print(dp[1])
for i in range(1000):
    if dp[2][i]>=1:
        ans+=1
print(ans)

Measured memory_bytes: 41964
#include<bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;
typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
typedef pair<string,string> Ps;
const ll INF=1000000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};
struct pos{
	// 1 変数を入れる;
	ll x,cost;
};
int main() {

	int n;
	cin>>n;
	rep(i,n){
		int a;
		cin>>a;
		if(a%2==0&&a%3>0&&a%5>0){
			cout<<"DENIED"<<endl;
			return 0;
		}
	}
	cout<<"APPROVED"<<endl;
	return 0;
}


Measured memory_bytes: 256
package main
 
import (
	"bufio"
	"os"
	"strconv"
	"fmt"
)
 
var sc = bufio.NewScanner(os.Stdin)
 
func scanInt() int {
	iv, _ := strconv.Atoi(scanString())
	return iv
}
 
func scanString() string {
	sc.Scan()
	return sc.Text()
}
 
func init() {
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 100001), 100001*100)
}

func main() {
  var N, M, ANS, P, A int
  var S string
  N = scanInt()
  M = scanInt()
  al := make([]int, N)
  pl := make([]int, N)
  for i := 0; i < M; i++ {
	  A = scanInt()
	  S = scanString()
      if S == "AC" {
		if al[A - 1] != 1000000001 {
		  al[A - 1] = 1000000001
		  ANS++
		  P = P + pl[A - 1]
		}
	  } else {
		if al[A - 1] != 1000000001 {
			pl[A - 1]++
		}
	  }
  }
  fmt.Printf("%d %d",ANS ,P)
}

Measured memory_bytes: 4176
#include <stdio.h>

int main(void){
  int ans,i,x,d,n;
  
  scanf("%d %d",&d,&n);
  
  for(x=1,i=0;i<d;x*=100,i++);
  
  if( n==100 ) n++;
  
  printf("%d\n",x*n);
  
  return 0;
}


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

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define MOD 1000000007LL

#define rep(i, n) for(ll (i) = 0LL;(i) < (ll)(n);(i)++)
#define rep2(i, s, e) for(ll (i) = (ll)(s);(i) < (ll)(e);(i)++)
#define repi(i, n) for(ll (i) = 0LL;(i) <= (ll)(n);(i)++)
#define repi2(i, s, e) for(ll (i) = (ll)(s);(i) <= (ll)(e);(i)++)
#define per(i, n) for(ll (i) = (ll)(n) - 1LL;(i) >= 0LL;(i)--)
#define per2(i, s, e) for(ll (i) = (ll)(s) - 1LL;(i) >= (ll)(e);(i)--)
#define peri(i, n) for(ll (i) = (ll)(n);(i) >= 0LL;(i)--)
#define peri2(i, s, e) for(ll (i) = (ll)(s);(i) >= (ll)(e);(i)--)
#define iter(i, it) for(auto &(i): (it))

template<typename T, typename U> ostream& operator<<(ostream &s, const pair<T, U> m) {
    cout << "(" << m.first << ", " << m.second << ")";
    return s;
}
template<typename T, typename U> ostream& operator<<(ostream &s, const map<T, U> m) {
    ll c = 0;
    cout << "{ ";
    iter(i, m) cout << i << (c++ == m.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const vector<T> &v) {
    cout << "{ ";
    rep(i, v.size()) cout << v[i] << (i == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}
template<typename T> ostream& operator<<(ostream &s, const list<T> &v) {
    ll c = 0;
    cout << "{ ";
    iter(i, v) cout << i << (c++ == v.size() - 1 ? " " : ", ");
    cout << "}";
    return s;
}

int main(void) {
    ll N;
    cin >> N;
    vector<tuple<ll, ll, ll>> points(N);
    rep(i, N) cin >> get<0>(points[i]) >> get<1>(points[i]) >> get<2>(points[i]);
    repi(cx, 100) {
        repi(cy, 100) {
            set<ll> s;
            iter(p, points) {
                if(get<2>(p) != 0) {
                    ll temp = get<2>(p) + abs(cx - get<0>(p)) + abs(cy - get<1>(p));
                    if(temp >= 1) s.insert(temp);
                }
            }
            if(s.size() == 1) {
                iter(p, points) {
                    if(max(0LL, *s.begin() - abs(cx - get<0>(p)) - abs(cy - get<1>(p))) != get<2>(p)) goto end;
                }
                cout << cx << ' ' << cy << ' ' << *s.begin() << endl;
                return 0;
            }
            end:;
        }
    }
    return 0;
}


Measured memory_bytes: 3608
s = input()
K = int(input())

new = ""
for i in range(len(s) - 1):
  diff = (123 - ord(s[i])) % 26
  if diff <= K:
    K -= diff
    new += "a"
  else:
    new += s[i]

if K > 0:
  new_char = ord(s[-1]) + (K % 26)
  if new_char > 122:
    new_char = 96 + (new_char - 122)
  new += chr(new_char)
else:
  new += s[-1]

print(new)



Measured memory_bytes: 3444
#include <stdio.h>

int add_and_take_units_digit(int left,int right) {

  return (left+right)%10;

}


int main(void) {

  int pyramid[10][10];

  char buf[20];

  int i,j;


  while(fgets(buf,sizeof(buf),stdin)!=NULL) {

    for(i=0;i<10;i++) pyramid[0][i]=(int)(buf[i]-'0');

    //for(i=0;i<10;i++) printf("%d ",init[i]);

    for(i=0;i<9;i++) {

      for(j=0;j<9-i;j++) {

	pyramid[i+1][j]=add_and_take_units_digit(pyramid[i][j],pyramid[i][j+1]);
	
      }

    }

    printf("%d\n",pyramid[9][0]);

  }

  return 0;

}

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

int main(void) {
    int N,C,c;
    cin >> N >> C;

    vector<vector<int>> cost(C,vector<int>(C));
    vector<map<int,int>> mp(3);
    
    for(int i=0;i<C;i++) {
        for(int j=0;j<C;j++) {
            cin >> cost[i][j];
        }
    }

    for(int i=0;i<N;i++) {
        for(int j=0;j<N;j++) {
            cin >> c;
            mp[(i+j)%3][c]++;
        }
    }

    // 塗り替えパターンは4060通り
    // 30c3 の塗替え後のカラー配列を持つ
    vector<int> cmin(3);
    int cminsum = INT_MAX,sum;
    vector<int> x(3);
    for(x[0]=0;x[0]<C;x[0]++) {
    for(x[1]=0;x[1]<C;x[1]++) {
        if(x[0]==x[1]) continue;
    for(x[2]=0;x[2]<C;x[2]++) {
        if(x[0]==x[2]) continue;
        if(x[1]==x[2]) continue;
        
    fill(cmin.begin(), cmin.end(), 0);
    sum = 0;
    for(int i=0;i<3;i++) {
        map<int,int>::iterator it = mp[i].begin();
        for(;it!=mp[i].end();it++){
            cmin[i] +=  it->second * cost[it->first-1][x[i]];
        }
        sum += cmin[i];
    }    
    if(cminsum > sum) {
        cminsum = sum;
    }
    
    }}}

    cout << cminsum << endl;

    return 0;
}


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

int main() {
  int K;
  cin >> K ;
  string X = "ACL";
  cin >> X;
  
  rep(i, K) {    
   	cout << X ;
  }
  cout << endl;
}

Measured memory_bytes: 3624
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <math.h>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

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

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

ll gcd(ll a, ll b){
	if (b == 0)return a;
	return gcd(b, a % b);
}

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

ll nCr(ll n, ll r){
    if(r == 0 || r == n){
        return 1;
    } else if(r == 1){
        return n;
    }
    return (nCr(n - 1, r) + nCr(n - 1, r - 1));
}

ll nPr(ll n, ll r){
    r = n - r;
    ll ret = 1;
    for (ll i = n; i >= r + 1; i--) ret *= i;
    return ret;
}

//-----------------------ここから-----------

int main(void){
    int h, w;
    cin >> h >> w;

    int dist[10][10];

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

    for(int v = 0; v < 10; v++){
        for(int s = 0; s < 10; s++){
            for(int g = 0; g < 10; g++){
                if(s == g || s == v || v == g) continue;
                dist[s][g] = min(dist[s][g], dist[s][v] + dist[v][g]);
            }
        }
    }

    int ans = 0;

    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            int num;
            cin >> num;

            if(num == -1)continue;

            // cout << dist[num][1] << endl;

            ans += dist[num][1];
        }
    }

    cout << ans << endl;



}

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

/*BigInteger
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/rational.hpp>
namespace xxx = boost::multiprecision;
using Bint = xxx::cpp_int;
using Real = xxx::number<xxx::cpp_dec_float<1024>>;
*/

#define int long long
#define pb(x) push_back(x)
#define m0(x) memset((x), 0LL, sizeof(x))
#define mm(x) memset((x), -1LL, sizeof(x))

//container
#define ALL(x) (x).begin(), (x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define UNIQUE(v) (v).erase(unique((v).begin(), (v).end()), (v).end());
#define PERM(c) \
  sort(ALL(c)); \
  for (bool c##p = 1; c##p; c##p = next_permutation(ALL(c)))

// debug
#define GET_VAR_NAME(variable) #variable
#define test(x) cout << GET_VAR_NAME(x) << " = " << x << endl;

// bit_macro
#define Bit(n) (1LL << (n))
#define Bitset(a, b) (a) |= (1LL << (b))
#define Bitunset(a, b) (a) &= ~(1LL << (b))
#define Bitcheck(a, b) ((((a) >> (b)) & 1LL) == 1LL)
#define Bitcount(a) __builtin_popcountll((a))

//typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

//constant
constexpr int INF = (int)1e18;
constexpr int MOD = (int)1e9 + 7;
constexpr double PI = (double)acos(-1);
constexpr double EPS = (double)1e-10;
constexpr int dx[] = {-1, 0, 0, 1, 0, -1, -1, 1, 1};
constexpr int dy[] = {0, -1, 1, 0, 0, 1, -1, 1, -1};

//
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); }
//
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

//
struct Accelerate_Cin {
  Accelerate_Cin() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout << fixed << setprecision(20);
  };
} Accelerate_Cin;

int N;
vector<int> a;

int dp[410][410];
int sum[410];

int rec(int l, int r) {
  if (l == r) return 0;
  if (l + 1 == r) return sum[r] - sum[l - 1];
  if (dp[l][r]) return dp[l][r];

  int res = INF;
  for (int i = l; i < r; i++) {
    chmin(res, rec(l, i) + rec(i + 1, r));
  }

  return dp[l][r] = res + sum[r] - sum[l - 1];
}

signed main() {
  cin >> N;
  a.resize(N);
  for (int i = 0; i < N; i++) cin >> a[i];

  m0(sum);
  for (int i = 1; i <= N; i++) {
    if (i == 0) {
      sum[i] = 0;
    } else {
      sum[i] = sum[i - 1] + a[i - 1];
    }
  }

  cout << rec(1, N) << endl;
  return 0;
}


Measured memory_bytes: 1536
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <set>
using namespace std;
#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n;i>=s;i--)
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = (ll)1 << 62;

ll a[100001];
ll l[100001];
ll r[100001];
ll m[100001];
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

int main() {
	ll n; cin >> n;
	rep(i, 0, n) cin >> a[i];

	l[0] = 0;
	l[1] = a[0];
	rep(i, 2, n) {
		l[i] = gcd(a[i - 1], l[i - 1]);
	}

	r[n-1] = 0;
	r[n-2] = a[n-1];

	rep_r(i, 0, n-3) {
		r[i] = gcd(a[i+ 1], r[i + 1]);
	}

	ll maxV = 0;
	rep(i, 0, n) {
		maxV = max(maxV, gcd(l[i], r[i]));
	}

	cout << maxV << endl;

	return 0;
}

Measured memory_bytes: 2560
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y = sc.nextInt();
		int n = (y*2-x)/3;
		int m = (x*2-y)/3;
		long z = 1;
		if((x+y)%3 != 0 || x<=0 || y<=0) {
			System.out.println("0");
		}else {
			if(x*2 < y || y*2 < x) {
				System.out.println("0");
			}else {
				z = nCk(n+m, n, 1000000007);
				System.out.println(z);
			}
		}
	}

	public static int nCk(int n,int k,int M) {
        long ret = 1;
        int min = Math.min(k, n-k);
        for(int i=1;i<=min;i++) {
            ret = (ret * pow(i,M-2,M)) % M;
        }
        for(int i=n-min+1;i<=n;i++) {
            ret = (ret * i) % M;
        }
        return (int)ret;
    }

	public static long pow(long a,long b,int M) {
        long ret = 1;
        long tmp = a;
        while(b>0) {
            if((b&1)==1) ret = (ret * tmp) % M;
            tmp = (tmp * tmp) % M;
            b = b>>1;
        }
        return ret;
    }

}


Measured memory_bytes: 22992
#include<bits/stdc++.h>
using namespace std;                void iosbase(void);
typedef  long long int     ll;      typedef long double                            db;
typedef  vector<int>       vi;      typedef priority_queue<int>                    MAXHEAP;
typedef  pair<int, int>    pii;     typedef priority_queue<int, vi, greater<int>>  MINHEAP;
#define  int               ll
#define  ff                first
#define  ss                second
#define  pb                push_back
#define  si(x)             (int)x.size()
#define  minv(m,n)         *min_element(m,n)
#define  maxv(m,n)         *max_element(m,n)
#define  deb(x)            cout<<"> "<<#x<<" : "<<x<<endl;
#define  mem(a,x)          memset(a,x,sizeof(a))
#define  rep(i,n)          for(int i=0;i<n;i++)
#define  prs(x,y)          fixed<<setprecision(y)<<x
#define  show(a)           for(auto x:a){cout<<x<<" ";}cout<<endl;
#define  showmap(a)        for(auto x:a){cout<<x.ff<<" "<<x.ss<<endl;}
#define  showstack(a)      while(!a.empty()){cout<<a.top()<<endl;a.pop();}
const int sz = 1e5 + 5;

int32_t main()
{
    iosbase(); int tt = 1;
    //cin>>tt;
    for (int t = 1; t <= tt; t++)
    {
        int n;
        cin >> n;
        if ( n >= 30)
        {
            cout << "Yes" << endl;
        }
        else
            cout << "No" << endl;
    }
    return 0 ;
}
void iosbase(void) {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
#ifndef ONLINE_JUDGE
    freopen("in.txt", "r", stdin);
//freopen("in2.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif
}


Measured memory_bytes: 3660
#include<set>
#include<map>
#include<deque>
#include<queue>
#include<stack>
#include<cmath>
#include<ctime>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<complex>
#include<iostream>
#include<algorithm>
#define ll long long
using namespace std;

const int maxn = 110000;
const ll Mod = 998244353;

ll pw(ll x,ll k)
{
	ll re=1ll;
	for(;k;k>>=1,x=x*x%Mod)
		if(k&1) re=re*x%Mod;
	return re;
}
ll si[maxn],sN[maxn],Ni[maxn];
void pre()
{
	si[0]=1ll;for(ll i=1;i<maxn;i++) si[i]=si[i-1]*i%Mod;
	sN[maxn-1]=pw(si[maxn-1],Mod-2);
	for(ll i=maxn-2;i>=0;i--) sN[i]=sN[i+1]*(i+1)%Mod;
	for(ll i=1;i<maxn;i++) Ni[i]=sN[i]*si[i-1]%Mod;
}
ll C(const int i,const int j){return si[i]*sN[j]%Mod*sN[i-j]%Mod;}

int N,ln;
ll g[maxn]; int id[maxn];
void DFT(ll s[],int sig,int nown)
{
	for(int i=0;i<nown;i++) if(i<id[i]) swap(s[i],s[id[i]]);
	int kk=N/nown;
	for(int m=2;m<=nown;m<<=1)
	{
		int t=m>>1,tt=nown/m;
		for(int j=0;j<nown;j+=m)
		{
			for(int i=0;i<t;i++)
			{
				ll wn=sig==1?g[i*tt*kk]:g[(nown-i*tt)*kk];
				ll tx=s[j+i],ty=s[j+i+t]*wn%Mod;
				s[j+i]=(tx+ty)%Mod;
				s[j+i+t]=(tx-ty+Mod)%Mod;
			}
		}
	}
	if(sig==-1) for(int i=0;i<nown;i++) (s[i]*=Ni[nown])%=Mod;
}

ll f[maxn];
int n,m,e;
void FFT(ll s[])
{
	//for(int i=0;i<N;i++) printf("%lld ",s[i]); puts("");
	DFT(s,1,N);
	for(int i=0;i<N;i++) s[i]=s[i]*s[i]%Mod;
	DFT(s,-1,N);
	//for(int i=0;i<N;i++) printf("%lld ",s[i]); puts("");
	for(int i=m+1;i<N;i++) s[i]=0;
}
ll temp[maxn];
void get_f(ll f[],int k)
{
	temp[0]=si[m];
	for(;k;k>>=1,FFT(f)) if(k&1)
	{
		DFT(temp,1,N); DFT(f,1,N);
		for(int i=0;i<N;i++) temp[i]=temp[i]*f[i]%Mod;
		DFT(temp,-1,N); DFT(f,-1,N);
		for(int i=m+1;i<N;i++) temp[i]=0;
	}
	for(int i=0;i<N;i++) f[i]=temp[i];
}
void solve()
{
	for(int i=0;i<N;i++) id[i]=(id[i>>1]>>1)|((i&1)<<ln-1);
	get_f(f,e);
}
char s1[maxn],s2[maxn];

int main()
{
	pre();
	scanf("%s%s",s1,s2); n=strlen(s1);
	for(int i=0;i<n;i++)
	{
		if(s1[i]-'0'+s2[i]-'0'==1) e++;
		else if(s1[i]-'0'+s2[i]-'0'==2) m++;
	}e>>=1;
	N=1,ln=0;
	while(N<=2*m) N<<=1,ln++;
	g[0]=1ll; g[1]=pw(3ll,(Mod-1)/N);
	for(int i=2;i<=N;i++) g[i]=g[i-1]*g[1]%Mod;
	
	for(int i=0;i<=m;i++) f[i]=sN[i+1];
	solve();
	ll ans=0;
	for(int i=0;i<=m;i++) 
		(ans+=f[i]*si[e]%Mod*sN[m-i]%Mod*si[e+i]%Mod*si[m-i]%Mod*si[m-i]%Mod*C(e+m,m-i)%Mod)%=Mod;
	printf("%lld\n",ans);
	
	return 0;
}


Measured memory_bytes: 4608
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
int main(){
   ll n;
   cin>>n;
  ll flag=0;
   while(n!=0){
       if(n%10==7){
           flag=1;
           break;
       }
       n/=10;
   }
   if(flag==1)
       cout<<"Yes"<<endl;
   else
       cout<<"No"<<endl;

    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <string>
using namespace std; typedef long long ll; const int INF=1e9; typedef pair<int,int> P;
const int mx=30000;
int gcd(ll a, ll b) {if (b==0) return a; else return gcd(b, a%b);}
int main() {
  if (mx!=30000) cerr<<"30003003030303"<<endl;

  int n; cin>>n;
  if (n==3) {cout<<"2 5 63"<<endl; return 0;}
  if (n==4) {cout<<"2 5 20 63"<<endl; return 0;}
  if (n==5) {cout<<"2 5 20 90 63"<<endl; return 0;}
  if (n==6) {cout<<"2 5 20 90 180 63"<<endl; return 0;}

  set<int> v;
  for(int i=1;i*2<=mx;i++) {
    v.insert(i*2);
  }
  for(int i=1;i*3<=mx;i++) {
    v.insert(i*3);
  }
  vector<int> ans;
  if (n%8==7 || n%8==0) {
    int i=0;
    for(int x:v) {ans.push_back(x); if (++i==n) break;}
  } else {
    int m=n/8*8, lf=n-m;
    int i=0;
    for(int x:v) {ans.push_back(x); if (++i==m) break;}
    vector<vector<int>> v1={{29990,29998},{29991,29997},{29992,29996}};
    int idd=0;
    while(lf>0) {
      if (lf>=2) {
        ans.push_back(v1[idd][0]); ans.push_back(v1[idd][1]); lf-=2; idd++;
      } else {
        ans.push_back(29994); lf-=1;
      }
    }
  }
  ll sm=0;
  for(int x:ans) cout<<x<<" "; cout<<endl;
  /*
  vector<bool> u(mx);
  for(int x:ans) sm+=(ll)x;
  for(int x:ans) {
    if (u[x]) cout<<x<<endl;
    u[x]=true;
  }
  for(int x:ans) {
    if (gcd(sm-x,x) == 1) cout<<x<<" "<<sm-x<<endl;
  }*/
}

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

namespace Beginner
{
    class Program
    {
        static void Main(string[] args)
        {
            var inputValue = Console.ReadLine().Split(' ');


            int contests = Convert.ToInt32(inputValue[0]);
            int displayRating = Convert.ToInt32(inputValue[1]);

            int innerRating = 0;
            if (contests < 10)
            {
                var temp = 100 * (10 - contests);
                innerRating = displayRating + temp;
            }
            else
            {
                innerRating = displayRating;
            }

            Console.WriteLine(innerRating);
        }
    }
}

Measured memory_bytes: 13268
#include<cstdio>
#include<iostream>
#include<cmath>
using namespace std;

int main(){
  double x1, x2, y1, y2, d;

  cin >> x1 >> y1 >> x2 >> y2;

  d = sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) );
  
  printf("%f\n", d);
  
  return 0;
}

Measured memory_bytes: 1228
N = int(input())
H = list(map(int, input().split()))

def f():
    ans = 0
    i = 1
    now = H[0]
    count = 0

    if N <= 1:
        return 0
    else:
        while True:
            if now >= H[i]:
                count += 1
                now = H[i]
            else:
                ans = max(count, ans)
                now = H[i]
                count = 0
            
            now = H[i]
            i += 1

            if i >= len(H):
                ans = max(ans, count)
                break

        return ans

print(f())

Measured memory_bytes: 14252
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;
using ll = long long;
//----------------------------------------------
#define rep(i,m,n) for(int i=m;i<(int)(n);i++)
#define putout(x) cout<<x<<endl
//----------------------------------------------



int main()//
{
	int N, M;

	cin >> N >> M;

	if (M >= N)
	{
		putout("Yes");
	}
	else
	{
		putout("No");
	}

	return 0;
}



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

using namespace std;

typedef long long LL;

const int N = 1010;

bool check(int s)
{
    int a = s, b = 0;
    while(s)
    {
        b = b * 10 + s % 10;
        s /= 10;
    }
    return a == b;
}

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

    int res = 0;
    for(int i = a; i <= b; i++)
        if(check(i))
            res++;

    cout << res << endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>

typedef long long ll;
using namespace std;


int main() {
    int n = 0;
    cin >> n;
    vector<ll> a(n+1), b(n);
    for (int i=0; i<n+1; i++) {
        cin >> a.at(i);
    }
    for (int i=0; i<n; i++) {
        cin >> b.at(i);
    }
    ll ans = 0;
    for (int i=0; i<n; i++) {
        if (b.at(i) <= a.at(i)) {
            ans += b.at(i);
        }
        else{
            ans += a.at(i);
            b.at(i) -= a.at(i);
            if (b.at(i) <= a.at(i+1)) {
                a.at(i+1) -= b.at(i);
                ans += b.at(i);
            }
            else{
                ans += a.at(i+1);
                a.at(i+1) = 0;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner

object Main {
  def main(args: Array[String]): Unit = {
    //nextLineとnextを同時に使ったら死ぬ
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    val as = Array.fill(n + 1)(sc.nextLong())
    val bs = Array.fill(n)(sc.nextLong())

    var ans = 0L
    for (i <- bs.indices) {
      val one = math.min(bs(i), as(i))
      as(i) -= one
      bs(i) -= one
      val two = math.min(bs(i), as(i + 1))
      as(i + 1) -= two
      bs(i) -= two
      ans += one + two
    }

    println(ans)
  }
  def debug(args: Any*): Unit = {
    Console.err.println(args.mkString(" "))
  }
}


Measured memory_bytes: 72336
#include<bits/stdc++.h>
#define pb push_back
#define pob pop_back
#define vi vector<ll>
#define mp make_pair
#define sz size()
#define rep1(i,n) for(i=1;i<=n;i++)
#define ll long long int
#define rep(i,n) for(i=0;i<n;i++)
#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define maxx 10000005
#define en "\n"
#define se second
#define fi first
#define vs vector<string>
#define edge pair<ll,ll>
#define mod 1000000007
using namespace std;
 
 
// ¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++¦¦¦++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦¦¦¦¦¦¦¦¦+++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦+++++++¦++¦¦
// ¦¦¦¦¦¦¦¦++¦¦¦¦¦¦++++++¦¦¦¦+++++++++++++¦
// ¦¦¦¦¦¦¦++++++¦¦¦++++++¦¦++++++++++++++¦¦
// ¦¦¦¦¦¦¦+++++++¦¦¦+++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++¦¦¦¦¦¦¦¦+++++++¦ 
// ¦¦¦¦¦¦¦¦¦¦++¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦++++¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦ 
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++++++¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++¦¦+¦++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++¦¦+++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦¦+++¦¦¦¦++++++¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++¦¦+¦¦¦¦¦+++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++++++++++¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++++++++++¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++++¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+¦¦¦+++++++++++¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦+++++++++¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++++¦¦¦¦¦¦¦¦¦¦
// ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦++++++¦¦¦¦¦¦¦¦¦¦¦¦


//ll d[1000007];
int main()
{
	fast;
	ll n,k;
	cin>>n>>k;
	ll i,j;
	ll cnt=0;
	ll s1=0,s2=0;
	ll ma=0,mi=1000000009;
	for(i=k;i<=n;i++)
	{
		
		
		s1=(i*(i-1))/2;
		
		s2=(i*(2*n-i+1))/2;
		
		cnt+=(s2-s1)+1;
		cnt=cnt%mod;
	}
	cnt=(cnt+1)%mod;
	cout<<cnt%mod<<endl;
	
	return 0;
	
}	
//cout<<"YES"<<endl;

//cout<<"NO"<<endl;

Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
const long P=1000000007;
long long sum(long long d,long long a,long long k){
    if(k%2==0){return ((2*d+(a*(k-1))%P)*k/2)%P;}
    else{return (((2*d+(a*(k-1)))/2)%P)*k%P;}
}
int main(){
    long long n,k,D,A,K,ans=0;
    cin>>n>>k;
    vector<int> a(n);
    vector<int> fall(n,0);
    vector<int> fallall(n,0);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    for(int i=0;i<n;i++){
        for(int j=i+1;j<n;j++){
            if(a[i]>a[j]){fall[i]++;fallall[i]++;}
            else if(a[i]<a[j]){fallall[j]++;}
        }
    }
    for(int i=0;i<n;i++){
        D=fall[i];A=fallall[i];K=k;
        ans=(ans+sum(D,A,K))%P;
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define endl '\n'
int main(){
    ios_base::sync_with_stdio(false),cin.tie(NULL);
    ll n;
    cin>>n;
    ll a[n];
    map<ll,ll>mp;
    for(ll i=0;i<n;i++){
        cin>>a[i];
        mp[a[i]]++;
    }
    ll ans=0;
    for(auto it:mp){
        ll x=it.second;
        x=x*(x-1)/2;
        ans+=x;
    }
    for(ll i=0;i<n;i++){
        ll x=ans-mp[a[i]]+1;
        cout<<x<<endl;
    }
    return 0;
}


Measured memory_bytes: 11136
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <numeric> // accumulate(v.begin(), v.end(), 0)

using namespace std;
#define ll long long

bool execute(int n, int N, int Q, string S, vector<char>& T, vector<char>& D, char type) {
  int tmp = n;
  for(int i=0; i<Q; i++) {
    if(S[tmp] == T[i]) {
      if(D[i] == 'L')
	tmp--;
      else
	tmp++;
    }
  }
  // cout << tmp << ' ';
  return (type == 'L' && tmp >= 1) || (type == 'R' && tmp <= N);
}

int main(){
  int N, Q;
  cin >> N >> Q;
  string S;
  cin >> S;
  S = ' ' + S + ' ';
  vector<char> T(Q), D(Q);
  for(int i=0; i<Q; i++)
    cin >> T[i] >> D[i];

  // for(int i=0; i<N; i++)
  //   cout << execute(i+1, N, Q, S, T, D, 'R') << endl;

  int left, right;
  {
    int l = 0, r = N+1;
    while(l < r) {
      int mid = (l + r) / 2;
      if(execute(mid, N, Q, S, T, D, 'L'))
  	r = mid;
      else
  	l = mid + 1;
    }
    left = l;
  }
  {
    int l = 0, r = N+1;
    while(l < r) {
      int mid = (l + r) / 2;
      if(execute(mid, N, Q, S, T, D, 'R'))
  	l = mid + 1;
      else
  	r = mid;
    }
    right = l;
  }
  // cout << right << ' ' << left << endl;
  cout << right - left << endl;
  return 0;
}


Measured memory_bytes: 1088
/*
author: Apoorv Singh
*/

#include <bits/stdc++.h>
using namespace std;

typedef vector <long long> vi;
typedef pair <long long, long long> pii;
#define eb emplace_back   
#define aint(c) c.begin(), c.end()
#define watch(x) cout << (#x) << " " << (x) << endl;
#define FOR(i, a, b) for (long long i = a; i < b; ++i)
#define FORR(i, a, b) for (long long i = a; i > b; --i)
#define um unordered_map
#define F first
#define S second
#define int long long
#define inf LLONG_MAX

int modulo = 1e9 + 7;

template <class X>

void printarr(X arr[], int n)
{
    for (int i = 0; i < n; ++i)
        cout << arr[i] << " ";
    cout << endl;
}

int fpow(int a, int n)
{
    int ans = 1;
    while (n)
    {
        if (n&1)
            ans = (ans * a)%modulo;
        a = (a*a)%modulo;
        n = n >> 1;
    }
    return ans;
}

/*
const int M = 1e6 + 10;
int composite[M] = {0};

void sieve()
{
    FOR(i,2,M)
    {
        if (!composite[i])
        {
            for (int j = 2*i; j < M; j += i)
                composite[j] = max(composite[j], i);
        }
    }
}
*/

const int M = 1e5 + 10;
int temple[M], shrine[M];

int bs(int query, int type, int n)
{
    int low = 0, high = n-1;
    int ans = -1;
    while (low <= high)
    {
        int mid = (high+low)/2;
        if (type == 0)
        {
            if (shrine[mid] > query)
                high = mid-1;
            else
            {
                ans = query-shrine[mid];
                low = mid+1;
            }
        }
        else
        {
            if (temple[mid] > query)
                high = mid-1;
            else
            {
                ans = query-temple[mid];
                low = mid+1;
            }
        }
    }
    return ans;
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL); 
    int a,b,Q;
    cin >> a >> b >> Q;
    FOR(i,0,a)
        cin >> shrine[i];
    FOR(i,0,b)
        cin >> temple[i];
    // printarr(shrine, a);
    // printarr(temple, b);
    FOR(i,0,Q)
    {
        int ans = inf;
        int q; cin >> q;
        int lefts, leftt, rights, rightt;
        rights = lower_bound(shrine, shrine+a, q) - shrine;
        rightt = lower_bound(temple, temple+b, q) - temple;
        if (rights == a)
            rights = -1;
        else
            rights = shrine[rights]-q;
        if (rightt == b)
            rightt = -1;
        else
            rightt = temple[rightt]-q;
        lefts = bs(q,0,a); leftt = bs(q,1,b);
        // watch(q)
        // watch(lefts)
        // watch(leftt)
        // watch(rights)
        // watch(rightt)
        if (rightt != -1 and lefts != -1)
            ans = min({ans, 2*rightt+lefts, rightt+2*lefts});
        if (rightt != -1 and rights != -1)
            ans = min(ans, max(rightt, rights));
        if (leftt != -1 and rights != -1)
            ans = min({ans, 2*rights+leftt,rights+2*leftt});
        if (leftt != -1 and lefts != -1)
            ans = min(ans, max(lefts, leftt));
        cout << ans << endl;
    }
    return 0;
}

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

const int INF = 1e9;
const int MOD = 1e9 + 7;

using namespace std;

typedef long long ll;

#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 FOR(i, a, b) for (int i = a; i < int(b); i++)
#define FORD(i, a, b) for (int i = b - 1; i >= int(a); i--)
#define WRAP(y, x, h, w) (0 <= y && y < h && 0 <= x && x < w)

#define ALL(x) (x).begin(), (x).end()

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

int main()
{
    int n, k;
    cin >> k >> n;
    vector<int> vi(n+1);
    REP(i, n)
    {
        cin >> vi[i];
    }
    vi[n]=k+vi[0];
    int ans=k;
    REP(i,n){
        ans=min(ans,k-(vi[i+1]-vi[i]));
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 3944
import java.util.Arrays;
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        long l[]=new long[N];
        for (int i=0;i<N;i++)
        {l[i]=scan.nextLong();}
int p=0;
        for(int i=0;i<N;i++) {
        for(int j=0;j<=i;j++){
            for(int k=0;k<=j;k++){
                if(l[i]!=l[j]&&l[i]!=l[k]&&l[k]!=l[j]){
                    if(l[i]+l[j]>l[k]&&l[k]+l[j]>l[i]&&l[i]+l[k]>l[j]){p++;}
                }
        }}}
        System.out.println(p);
    }

}


Measured memory_bytes: 27372
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<math.h>
#include<string>
#include<string.h>
#include<stack>
#include<queue>
#include<vector>
#include<utility>
#include<set>
#include<map>
#include<stdlib.h>
#include<iomanip>

using namespace std;

#define ll long long
#define ld long double
#define EPS 0.0000000001
#define INF 1e9
#define MOD 1000000007
#define rep(i,n) for(i=0;i<n;i++)
#define loop(i,a,n) for(i=a;i<n;i++)
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)

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

int main(void) {
  int i,j;
  string s;
  cin>>s;
  rep(i,s.size())if(i%2==0)cout<<s[i];
  cout<<endl;
}


Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS
//#define DEBUG
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(void) {
#ifdef DEBUG
	printf("");
#endif

	int N;
	int ans=0;
	int i;

	scanf("%d", &N);
	for (i = 1; i <= N; i++) {
		ans += i;
	}

	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 128
#include<stdio.h>
int main()
{
    int m,f,r,s,i;
    for(i=1; ;i++)
    {
        scanf("%d%d%d",&m,&f,&r);
        if(m==-1 && f==-1 && r==-1)
        {
            break;
        }
        s=m+f;
        if(m==-1||f==-1|| (m+f)<30)
        {
            printf("F\n");
            
        }
        else if(s>=80)
        {
            printf("A\n");
        }
        else if(s>=65 && s<80)
        {
            printf("B\n");
            
        }
        else if((s>=50 && s<65)|| (r>=50))
        {
            printf("C\n");
        }
        else if(s>=30 && s<50)
        {
            printf("D\n");
            
        }
    }
    return 0;
}



Measured memory_bytes: 2068
//2020-05-28

#include <iostream>
#include <algorithm>
#include <vector>
#include <math.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio();
    cin.tie(NULL);
    
    int k,a,b;
    cin >> k >> a >> b;
    int c = a/k;
    
    if (a%k==0){
        cout << "OK";
        return 0;}
    
    c++;
    c *= k;
    
    if (c>=a && c<=b)
        cout << "OK";
    else
        cout << "NG";
    return 0;
}


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

#define INF 1 << 30

int A, B, C;

int main(){
  cin >> A >> B >> C;
  if (C > A + B) {
    cout << A + 2*B + 1 << endl;
  } else {
    cout << B + C << endl;
  }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define INF 9999999999
#define rep(i,m,n) for(lli i = m;i < n;i++)
#define rrep(i,m,n) for(lli i=m-1;i>=n;i--)
#define pb(n) push_back(n)
#define UE(N) N.erase(unique(N.begin(),N.end()),N.end());
#define Sort(n) sort(n.begin(), n.end())
#define Rev(n) reverse(n.begin(),n.end())
#define Out(S) cout << S << endl
#define NeOut(S) cout << S
#define HpOut(S) cout << setprecision(25) << S << endl
#define Vec(K,L,N,S) vector<L> K(N,S)
#define DV(K,L,N,M,S) vector<vector<L>> K(N,vector<L>(M,S))
#define TV(K,L,N,M,R,S) vector<vector<vector<L>>> K(N,vector<vector<L>>(M,vector<L>(R,S)))
#define pint pair<lli,lli>
#define paf(L,R) pair<L,R>
#define mod 1000000007
#define MAX 10000000
#define ALL(a)  a.begin(),a.end()
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
map<lli,lli>mp;
map<string,lli>ms;
set<string>ss;
set<lli>si;
set<char>sc;
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli A,B,C,D,E,F,N,M,K,L,X,Y,Z,H,W,sum=0,num=0,flag=0;string S,T;
  cin >> A >> B >> C >> K;
  if(A>=K)sum+=K;
  else{
    sum+=A;
    K-=A;
    if(K>B){
      K-=B;
      sum-=min(C,K);
    }
  }
  Out(sum);
}


Measured memory_bytes: 3644
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
//#include <vector>
#include <string>
//#include <list>
//#include <deque>
//#include <unordered_map>
//typedef long long LL;
//typedef long double LD;
using namespace std;
 
//#define MOD 1000000007
//#define MAX 200100
//#define NIL -1

int main() {
    string s;
    bool ans=true;
    cin >> s;
    if(s[0]!='A'){
        ans=false;
    }
    int c_num=0;
    for(int i=2; i<s.size()-1; i++){
        if(s[i]=='C'){
            c_num++;
        }
    }
    if(c_num!=1){
        ans=false;
    }

    int C_num=0;
    for(int i=0; i<s.size(); i++){
        int tmp=s[i]-'a';
        if(tmp<0 or tmp>25){
            C_num++;
        }
    }
    if(C_num!=2){
        ans=false;
    }

    if(ans==true){
        cout << "AC" << endl;
    }else{
        cout << "WA" << endl;
    }

    return 0;
}

Measured memory_bytes: 256
# from math import sqrt
# from heapq import heappush, heappop
# from collections import deque
from operator import mul
from functools import reduce
# a, b = [int(v) for v in input().split()]


def main():

    def modcmb(n, r, mod):
        if r < 0 or r > n:
            return 0
        r = min(r, n - r)
        over = 1
        under = 1
        for i in range(n, n-r, -1):
            over = over * i % mod
        for i in range(1, r+1):
            under = under * i % mod

#        over = reduce(lambda v1, v2: (v1 * v2) % mod, range(n, n-r, -1))
#        under = reduce(lambda v1, v2: (v1 * v2) % mod, range(1, r+1))
        return (over * pow(under, mod - 2, mod)) % mod

    mod = 1000000007
    n, a, b = map(int, input().split())

    count = pow(2, n, mod) - 1
    count -= modcmb(n, a, mod)
    count -= modcmb(n, b, mod)

    while count < 0:
        count += mod
    print(count % mod)


main()


Measured memory_bytes: 3572
using System;
using System.Collections.Generic;

namespace AtCoder.AGC028
{
    class a
    {
        static long Gcd(long x, long y)
        {
            long r = 0;
            while ((r = x % y) != 0)
            {
                x = y;
                y = r;
            }
            return y;
        }

        static long Lcm(long x, long y)
        {
            return (x * y / Gcd(x, y));
        }

        static void Main(string[] args)
        {
            var line = Console.ReadLine().Trim();
            var spl = line.Split(' ');
            var N = int.Parse(spl[0]);
            var M = int.Parse(spl[1]);
            var S = Console.ReadLine().Trim();
            var T = Console.ReadLine().Trim();
            var i = Lcm(N, M);
            var g = Gcd(N, M);
            for(var j = 0; j < N; j += (int)(N / g))
            {
                for(var k = 0; k < M; k += (int)(M / g))
                {
                    if(j * (i / N) == k * (i / M) && S[j] != T[k])
                    {
                        Console.WriteLine(-1);
                        return;
                    }
                }
            }
            Console.WriteLine(i);
        }
    }
}


Measured memory_bytes: 11616
#include <bits/stdc++.h>
// clang-format off
using namespace std; using ll = int64_t; using ull = uint64_t; const ll INF = 9e18;
void print() { cout << endl; }
template<typename Head,typename... Tail> void print(Head head,Tail... tail){cout<<head;if(sizeof...(Tail)>0)cout<<" ";print(tail...);}
void print0() {}
template<typename Head,typename... Tail> void print0(Head head,Tail... tail){cout<<head;print0(tail...);}
// clang-format on

const ll MODULO = 1000000007L;
ll mod_minus(ll x, ll modval) {
    if (x >= 0) {
        return x % modval;
    } else {
        ll mm = ((-x) % modval);
        if (mm == 0) {
            return 0;
        } else {
            return modval - mm;
        }
    }
}
ll mod(ll x) {
    return mod_minus(x, MODULO);
}

ll mod_pow(ll x, ll n, ll modval) {
    if (n == 0) {
        return 1;
    }
    ll res = mod_pow(x * x % modval, n / 2, modval);
    if (n & 1) {
        res = res * x % modval;
    }
    return res;
}
// ll pow(ll x, ll n) {
//     return mod_pow(x, n, MODULO);
// }
int main() {
    ll N;
    cin >> N;

    ll x = mod_pow(10, N, MODULO);
    x = mod(x - mod_pow(9, N, MODULO));
    x = mod(x - mod_pow(9, N, MODULO));
    x = mod(x + mod_pow(8, N, MODULO));
    print(x);
    // print(mod(pow(10, N) - pow(9, N) - pow(9, N) + pow(8, N)));
    //    print(mod(pow(10, N) - N * pow(9, N - 1) - N * pow(9, N - 1) - pow(8, N)));
}


Measured memory_bytes: 3636
def mul(n):
  s=1
  for t in range(1,n+1):
    s=s*t
  return s

def f(x):
  result=0
  N=len(x)
  for i in range (N):
    k=0
    for j in range(i,N):
      if x[i]>x[j]:
        k=k+1
    result=result+k*mul(N-i-1)
  return result

N=int(input())
P=list(map(int,input().split()))
Q=list(map(int,input().split()))

print(abs(f(P)-f(Q)))

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

using namespace std;

bool calc(const std::string& s) {
  // S の先頭の文字は大文字の A である。
  if (s[0] != 'A') {
    return false;
  }

  // S の先頭から 3 文字目と末尾から 2 文字目の間（両端含む）に大文字の C
  // がちょうど 1 個含まれる。
  int posC = -1;
  for (int i = 2; i < s.size() - 1; ++i) {
    if (s[i] == 'C') {
      if (posC >= 0) {
        return false;
      }
      posC = i;
    }
  }
  if (posC < 0) {
    return false;
  }

  // 以上の A, C を除くSのすべての文字は小文字である。
  for (int i = 1; i < s.size(); ++i) {
    if (i == posC) {
      continue;
    }
    if (!std::islower(s[i])) {
      return false;
    }
  }

  return true;
}

int main() {
  std::string s;
  std::cin >> s;
  std::cout << (calc(s) ? "AC" : "WA") << std::endl;
  return 0;
}


Measured memory_bytes: 256
z['   '],i;
main(j){
	for(;++i<2e3;)
//		if(!(z[i>>5]&1<<i))
			for(j=z[i>>5]&1<<i?1e7:-2*i*~i;j<5e6;j+=i-~i)z[j>>5]|=1<<j;
	for(;scanf("%d",&i),i;)
		for(j=i+1>>1;i;)
			z[--j>>5]&1<<j|
			z[j-1>>5]&1<<j-1|
			z[j-3>>5]&1<<j-3|
			z[j-4>>5]&1<<j-4||printf("%d\n",j*2+1,i=0);
	return 0;
}

Measured memory_bytes: 1020
#include<stdio.h>
#include<string.h>
int main(void){
    int A,B,C,D,E,x,y,cou=0,v[3];
    char S[10],X,Y;
    scanf("%c %c",&X,&Y);
   if(X=='A'){
       x=10;
   }else if(X=='B'){
       x=11;
   }else if(X=='C'){
       x=12;
   }else if(X=='D'){
       x=13;
   }else if(X=='E'){
       x=14;
   }else if(X=='F'){
       x=15;
   }
   if(Y=='A'){
       y=10;
   }else if(Y=='B'){
       y=11;
   }else if(Y=='C'){
       y=12;
   }else if(Y=='D'){
       y=13;
   }else if(Y=='E'){
       y=14;
   }else if(Y=='F'){
       y=15;
   }
   if(x>y){
       printf(">");
   }else if(x==y){
       printf("=");
   }else{
       printf("<");
   }
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
#include <cctype>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <utility>
#include <fstream>

using namespace std;
typedef long long ll;
using ull = unsigned long long;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { a = abs(a), b = abs(b); while (b > 0) { tie(a, b) = make_pair(b, a % b); } return a; }
//mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());

constexpr long long INF = 1LL << 60;
constexpr int inf = 1000000007;
//constexpr long long mod = 1000000007LL;
constexpr long long mod = 998244353;
constexpr int MAX = 5000000;


int main()
{

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	ll k; cin >> k;
	string t = "ACL";
	string s; for (int i = 0; i < k; i++) s += t;
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3612