akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

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

using namespace std;

string s;

bool cmp(const pair<int, int> &x, const pair<int, int> &y)
{
	if (x.first != y.first){
		return x.first > y.first;
	}else{
		return x.second < y.second;
	}
}

ll calc(int a, int b, int c)
{
	vector<ll> number;
	vector<char> ope;
	//priority, index
	vector<pair<int, int> > priority;

	int nest=0;
	rep(idx, s.size()){
		if (s[idx]=='(') nest++;
		if (s[idx]==')') nest--;
		if ('0'<=s[idx] && s[idx]<='9'){
			string temp=""; temp += s[idx++];
			while('0'<=s[idx] && s[idx]<='9'){
				temp += s[idx];
				idx++;
			}
			number.push_back(stoll(temp));
			idx--;
		}
		if (s[idx]=='+'){
			ope.push_back(s[idx]);
			priority.push_back(make_pair(nest*10+a, priority.size()));
		}
		if (s[idx]=='-'){
			ope.push_back(s[idx]);
			priority.push_back(make_pair(nest*10+b, priority.size()));
		}
		if (s[idx]=='*'){
			ope.push_back(s[idx]);
			priority.push_back(make_pair(nest*10+c, priority.size()));
		}
 	}
 	vector<bool> use(ope.size(), false);
 	sort(priority.begin(), priority.end(), cmp);
 	
 	/*rep(i, ope.size()){
 		cout << ope[priority[i].second] << ", " << priority[i].first << ", " << priority[i].second << endl;
 	}
 	cout << endl;*/
 	
 	int size = ope.size();

 	rep(i, size){
 		int index = priority[i].second;
 		use[index] = true; 
 		int isize = index;
 		rep(j, isize){
 			if (use[j]) index--;
 		}
 		if (ope[index]=='+'){
 			ll res = number[index]+number[index+1];
 			number.erase(number.begin()+index);
 			number.erase(number.begin()+index);
 			number.insert(number.begin()+index, res);
 			//cout << res << endl;
 		}
 		if (ope[index]=='-'){
 			ll res = number[index]-number[index+1];
 			number.erase(number.begin()+index);
 			number.erase(number.begin()+index);
 			number.insert(number.begin()+index, res);
 			//cout << res << endl;
 		}
 		if (ope[index]=='*'){
 			ll res = number[index]*number[index+1];
 			number.erase(number.begin()+index);
 			number.erase(number.begin()+index);
 			number.insert(number.begin()+index, res);
 			//cout << res << endl;
 		}
 		ope.erase(ope.begin()+index);
 	}
	return number[0];
}

int main()
{
	cin>>s;
	ll maxi = LONG_LONG_MIN;
	rep(i, 3)rep(j, 3)rep(k, 3){
		//cout << i << ", " << j << ", " << k << endl;
		maxi = max(maxi, calc(i, j, k));
		//cout << endl;
	}
	cout << maxi << "\n";
	return 0;
}


Measured memory_bytes: 3248
import sys
input = sys.stdin.readline

def sumN(n,N,f):
	total = 0
	i = n
	while i < N:
		total += f[i]
		i += n+1

	if total % 2:
		return 1
	else:
		return 0

def main():
	N = int(input())
	a = list(map(int,input().split()))
	ball = []
	ballNum = 0
	f = [0]*N

	for i in reversed(range(0,N)):
		if (sum(f[i::i+1])%2) != (a[i] % 2):
			f[i] = 1
			ball.append(i+1)
			ballNum +=1

	if (sum(f) % 2) != (a[0] % 2):
		f[0] = 1
		ball.append(1)
		ballNum +=1

	print(ballNum)
	print(*ball)

if __name__ == "__main__":
	main()


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

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	string s;
	cin >> s;
	if(s[2] == s[3] && s[4] == s[5]) cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

int main() {
  string s;
  cin>>s;
  cout<<s[0]<<s[1]<<s[2]<<s[3]<<" "<<s[4]<<s[5]<<s[6]<<s[7]<<s[8]<<s[9]<<s[10]<<s[11]<<endl;
}

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

//Eleven Lover
public class Main{

	void run(){
		Scanner sc = new Scanner(System.in);
		for(;;){
			char[] s = sc.next().toCharArray();
			if(s.length==1&&s[0]=='0')break;
			int[][] dp = new int[2][11];
			int x = 0, res = 0;
			for(int i=0;i<s.length;i++,x=1-x){
				int r = s[i]-'0';
				Arrays.fill(dp[x], 0);
				for(int j=0;j<11;j++){
					dp[x][(10*j+r)%11]+=dp[1-x][j];
				}
				if(r!=0)dp[x][r]++;
				res+=dp[x][0];
			}
			System.out.println(res);
		}
	}
	
	public static void main(String[] args) {
		new Main().run();
	}
}

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

int main(){
	double xa,ya,xb,yb,xc,yc,xd,yd;
	while(cin>>xa>>ya>>xb>>yb>>xc>>yc>>xd>>yd){
		double dot = (xa-xb)*(xc-xd) + (ya-yb)*(yc-yd);
		if(fabs(dot) < 1e-10)cout<<"YES"<<endl;
		else cout<<"NO"<<endl;
	}
	return 0;
}

Measured memory_bytes: 1216
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
const ll mo = 1000000007;
const ll INF = 1LL << 60; //MAX 9223372036854775807
ll ans = 0;

int main()
{
string s;
cin >> s;
int len=(int)(s.length());
ll w=0;
rep(i,len){
    if(s[i]=='W'){
        ans+=i-w;
        w++;
    }
}

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


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

int main()
{
    long long N, Z, W;
    cin >> N >> Z >> W;

    vector<long long> a(N);
    for (long long &elem : a)
    {
        cin >> elem;
    }

    if (N == 1)
    {
        cout << abs(a.front() - W) << endl;
    }
    else
    {
        cout << max(abs(a.back() - W), abs(a[N - 2] - a.back())) << endl;
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
using ll = long long;
using ld = long double;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define FORR(i, m, n) for (int i = (m); i >= (n); i--)
#define REP(i, n) FOR(i, 0, (n))
#define REPR(i, n) FORR(i, (n) - 1, 0)
#define REP1(i, n) FOR(i, 1, (n) + 1)
#define REPS(c, s) for (char c : s)
#define ALL(c) (c).begin(), (c).end()
#define SORT(c) sort(ALL(c))
#define REV(c) reverse(ALL(c))
#define sz(v) (int)v.size()
#define endl '\n'
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;}
template<class T> inline void printv(vector<T>& v) {int n = sz(v); REP(i, n) cout << v[i] << (i == n - 1 ? endl : ' ');}
const int MOD = 1000000007;
const int INF = 1000000001;
const ll LINF = 1000000001000000001LL;
 
void solve();
 
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(numeric_limits<double>::max_digits10);
    solve();
    return 0;
}

void solve() {
    int n;
    cin >> n;
    cout << (n + 1) / 2 << endl;
}


Measured memory_bytes: 256
#include <cstdio>
int main() {
	int N;
	while(scanf("%d",&N),N) {
		int sum=0;
		for(int i=1;i<N;i++) {
			bool OK=0;
			for(int j=1;;j++) {
				int k=(i*2+j)*(j+1)/2;
				if(k==N) {
					OK=1;
					break;
				}else if(k>N) {
					break;
				}
			}
			if(OK) sum++;
		}
		printf("%d\n",sum);
	}
}

Measured memory_bytes: 1028
n, T = map(int, input().split(' '))
cost, time = [], []
for i in range(n):
    c, t = map(int, input().split(' '))
    if t <= T:
        cost.append(c)
        time.append(t)
if len(cost) == 0:
  	print('TLE')
else:
    print(min(cost))

Measured memory_bytes: 3060
def f(n):
    N=1
    for i in range(n):
        N=N*(i+1)
    return N

def C(n,x):
    return f(n)//(f(x)*f(n-x))
    
n,p = map(int,input().split())
a   = list(map(int,input().split()))
odd=0
even=0
for i in range(n):
    if a[i]%2==0:
        even+=1
    else:
        odd+=1
if p % 2 == 0:
    x=0
    for i in range(odd//2+1):
        x+=C(odd,i*2)
    print((2**even) * x)
else:
    x=0
    for i in range(odd//2):
        x+=C(odd,i*2+1)
    print((2**even) * x)
    


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

using namespace std;

typedef long long ll;

int n, i, j;
int w;
ll dp[101][100001];

int main(){
    scanf("%d %d", &n, &w);
    memset(dp, -1, sizeof dp);
    dp[0][0] = 0;
    for(i=1;i<=n;++i){
        int a, b;
        scanf("%d %d", &a, &b);
        memcpy(dp[i], dp[i-1], sizeof dp[i]);
        for(j=b;j<=100000;++j){
            if(dp[i-1][j-b] == -1) continue;
            if(dp[i][j] == -1)
                dp[i][j] = dp[i-1][j-b]+a;
            else
                dp[i][j] = min(dp[i][j], dp[i-1][j-b]+a);
        }
    }
    for(i=100000;i>=0;--i)
        if(dp[n][i]!=-1 && dp[n][i]<=w){
            printf("%lld\n", i);
            break;
        }
    return 0;
}







Measured memory_bytes: 79104
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<(b);++i)
#define erep(i,a,b) for(int i=a;i<=(int)(b);++i)
#define per(i,a,b) for(int i=(a);i>(b);--i)
#define eper(i,a,b) for(int i=(a);i>=b;--i)
#define fore(x, a) for(auto &x : a)
#define pb push_back
#define mp make_pair
#define INF 100100100100
#define inf 2001001001
#define MOD 1000000007
#define ALL(x) begin(x),end(x)
#define F first
#define S second
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using vii = vector<int>;
using vll = vector<ll>;
template<class T>using vv = vector<T>;
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; }
template<class T>void show(const vector<T> &a) { for (int i = 0; i < (int)a.size(); ++i) cout << a[i] << (i != (int)a.size()-1 ? " " : "\n"); }
template<class T>T gcd(T a, T b){ return b ? gcd(b, a % b) : a; }
template<class T>T lcm(T a, T b){ return a / gcd(a, b) * b; }
int dy[]={0, 1, -1, 0};
int dx[]={1, 0, 0, -1};

ll n, ans;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
    cin >> n;
    ll a[] = {3, 5, 7};
    queue<pair<ll, ll>> que;
    que.push({0, 0});
    while (!que.empty()) {
      pair<ll, ll> p = que.front(); que.pop();
      if (p.first > n) continue;
      if (p.second == 7) ans++;
      rep(i, 0, 3) {
        que.push({p.first * 10 + a[i], p.second | (1 << i)});
      }
    }
    cout << ans << endl;
    return 0;
}



Measured memory_bytes: 1280
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <map>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main()
{
    int n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    if (s[k-1] == 'A')
    {
        s[k-1] = 'a';
    }
    if (s[k-1] == 'B')
    {
        s[k-1] = 'b';
    }
    if (s[k-1] == 'C')
    {
        s[k-1] = 'c';
    }
    for (int i = 0; i < n; i++)
    {
        cout << s[i];
    }
    cout << endl;
}

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

int H, W;
const string DIR = "^>v<";
const int dx[] = {-1, -1, 0, 1, 1, 1, 0, -1};
const int dy[] = {0, 1, 1, 1, 0, -1, -1, -1};

int main() {
    cin >> H >> W;
    vector<vector<char> > V(H + 2, vector<char>(W + 2, '#'));
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            cin >> V[i][j];
        }
    }

    int sx, sy, gx, gy, dir;
    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            if (V[i][j] == 'G') gx = i, gy = j;
            else if (DIR.find(V[i][j]) != string::npos)
                sx = i, sy = j, dir = DIR.find(V[i][j]);
        }
    }

    vector<vector<vector<bool> > > used(H+2, vector<vector<bool> >(W+2, vector<bool>(4, false)));
    while (!used[sx][sy][dir] && V[sx][sy] != 'G') {
        used[sx][sy][dir] = true;
        int nx = sx + dx[dir * 2];
        int ny = sy + dy[dir * 2];
        int nhx = nx + dx[(dir * 2 + 2) % 8];
        int nhy = ny + dy[(dir * 2 + 2) % 8];
        if (V[nx][ny] == '#') {
            dir = (dir + 3) % 4;
        } else {
            sx = nx;
            sy = ny;

            if (V[nhx][nhy] != '#') {
                dir = (dir + 1) % 4;
            }
        }
    }

    if (V[sx][sy] == 'G') {
        int ans = 1;
        for (int i = 1; i <= H; i++) {
            for (int j = 1; j <= W; j++) {
                bool flag = false;
                for (int k = 0; k < 4; k++) {
                    if (used[i][j][k]) flag = true;
                }
                if (flag) ans++;
            }
        }
        cout << ans << endl;
    } else {
        cout << -1 << endl;
    }

    return 0;
}

Measured memory_bytes: 3432
#include <iostream>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;

typedef pair<int,string> P;

int main(void)
{

	char c;
	string str,maxstr;
	P d[1001] = {};	

	while(scanf("%c", &c), c != '\n'){
		if(c != ' '){
			str += c;
		}
		else {
			if(strlen(str.c_str()) > strlen(maxstr.c_str())){
				maxstr.clear();
				maxstr = str;
			}
			int i;
			for(i = 0; d[i].first != 0; i++){
				if(d[i].second == str){
					d[i].first++;
					break;
				}
			}
			if(d[i].first == 0){
				d[i] = P(1,str);
			}
			str.clear();
		}
	}
	if(strlen(str.c_str()) > strlen(maxstr.c_str())){
		maxstr.clear();
		maxstr = str;
	}
	int i;
	for(i = 0; d[i].first != 0; i++){
		if(d[i].second == str){
			d[i].first++;
			break;
		}
	}
	if(d[i].first == 0){
		d[i] = P(1,str);
	}
	str.clear();

	sort(d,d+1001);
	cout << d[1000].second << ' ' << maxstr << endl;

	return 0;
}

Measured memory_bytes: 1224
#include<iostream>
#include<string>
#include<stack>
#include<algorithm>
#include<queue>
#include<cmath>
#include<numeric>
#include<map>
#include<set>
#include<vector>
#include<list>
#include<iomanip>
#include<functional>
#include<bitset>

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

using namespace std;
typedef long long ll;

int main(){
    int d,g;
    cin>>d>>g;
    int p[d],c[d];
    rep(i,d) cin>>p[i]>>c[i];

    int ans = 1e9;
    for(int mask = 0;mask < (1<<d); ++mask){
        int s = 0,num =0,restmax=-1;
        for(int i=0;i<d;++i){
            if(mask >> i & 1){
                s += 100 * (i+1) * p[i] + c[i];
                num += p[i];
            }
            else{
                restmax = i;
            }
        }
        if(s<g){
            int s1 = 100*(restmax + 1);
            int need = (g -s +s1 -1)/s1;
            if(need >= p[restmax]){
                continue;
            }
            num += need;

        }
        ans = min(ans,num);
    }
    cout<<ans<<endl;


    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

#define M 1000007
#define L 14

char H[M][L]; /* Hash Table */

int getChar(char ch){
  if ( ch == 'A') return 1;
  else if ( ch == 'C') return 2;
  else if ( ch == 'G') return 3;
  else if ( ch == 'T') return 4;
}

/* convert a string into an integer value */
long long getKey(char str[]){
  long long sum = 0, p = 1, i;
  for ( i = 0; i < strlen(str); i++ ){
    sum += p*(getChar(str[i]));
    p *= 5;
  }
  return sum;
}

int h1(int key){ return key%M; }
int h2(int key){ return (1+key)%(M-1); }

int find(char str[]){
  long long trip; 
  int i = 0;
  long long sum = getKey(str);
 
  while(1){
    trip = (h1(sum)+ i * h2(sum)) % M;
    if(strcmp(H[trip], str) == 0) return 1;
    if(H[trip][0] == '\0') return 0;
    i++;
  }
  return 0;
}

int insert(char str[]){
  int i = 0;
  long long ago;
  long long sum = getKey(str);
  
  while(1){
    ago = (h1(sum)+ i * h2(sum)) % M;
    if(H[ago][0] == '\0' || strcmp(H[ago],str) == 0){
      strcpy(H[ago], str);
      break;
    }
    i++;
  }
}

int main(){
  int i, n, h;
    char str[L], com[9];
    for ( i = 0; i < M; i++ ) H[i][0] = '\0';
    
    scanf("%d", &n);
    
    for ( i = 0; i < n; i++ ){
      scanf("%s %s", com, str);
      
      if ( com[0] == 'i' ){
	insert(str);
      } else {
	if (find(str)){
	  printf("yes\n");
	} else {
	  printf("no\n");
	}
      }
    }
    
    return 0;
}

Measured memory_bytes: 14280
/*######################################################
#########~~~~~####~~~~###~~##~~##~~##~~##~~##~~#########
#########~~##~~##~~##~~##~~~#~~##~~~#~~##~~##~~#########
#~~~~~~##~~~~~###~~~~~~##~~#~~~##~~#~~~##~~##~~##~~~~~~#
#########~~######~~##~~##~~##~~##~~##~~##~~##~~#########
#########~~######~~##~~##~~##~~##~~##~~###~~~~##########
######################################################*/
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>

using namespace __gnu_pbds;
using namespace std;

#pragma GCC optimize("O3")
#define rtn return
#define endl '\n'
#define F first
#define S second
#define mt make_tuple
#define pb push_back
#define MOD 1000000007
#define INF 1e18
#define EPS 1e-15
#define int long long
#define value_at find_by_order
#define index_of order_of_key
#define fill(a, v) memset(a,v,sizeof(a))
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define rep(i, n) for(int i=0;i<(int)n;++i)
#define per(i, n) for(int i=(int)n-1;i>=0;--i)
#define loop1(i, n) for(int i=1;i<=(int)n;++i)
#define loop(i, begin, end) for(int i=(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
#define FAST_IO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)

#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " = " << arg1 << '\n';
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " = " << arg1 << " |";
  __f(comma+1, args...);
}
#else
#define trace(...)
#endif

typedef string str;
typedef pair<int, int> pll;
typedef vector<int> vll;
typedef vector<pll> vpll;	
typedef long double db;

template<class T, class V> void remin(T &a, V b) { a > b ? a = b : a = a; }
template<class T, class V> void remax(T &a, V b) { a < b ? a = b : a = a; }
template<class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

#define N 100005

//

int32_t main() {
  FAST_IO;
  
  int n, x;
  vll a;
  cin >> n;
  rep(i, n) {
		cin >> x;
		a.pb(x);
	}
	multiset<int> mt;
	rep(i, n) {
		auto ls = mt.lower_bound(a[i]);
		if (ls == mt.begin()) {
			mt.insert(a[i]);
		} else {
			--ls;
			mt.erase(ls);
			mt.insert(a[i]);
		}
	}
	cout << (int) mt.size() << '\n';
  rtn 0;
}


Measured memory_bytes: 5748
k = int(input())
a,b = map(int,input().split())

c = list(range(a,b+1))
d = []

for i in range(len(c)):
    if c[i] % k == 0:
        d.append('A')

if len(d) >= 1:
    print('OK')
else:
    print('NG')

Measured memory_bytes: 9184
open System

let N = stdin.ReadLine() |> int
let List = stdin.ReadLine().Split(' ') |> Array.map int |> Seq.toList |> List.sort |> List.rev

let solveF list =
    let rec subSolveF accumA accumB list2 =
        match list2 with
        | hd :: (md :: tl) -> subSolveF (hd + accumA) (md + accumB) tl
        | hd :: tl -> accumA + hd - accumB
        | [] -> accumA - accumB

    subSolveF 0 0 list

solveF List |> printfn "%i"


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

#define vec vector
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define Str(x) to_string(x)
#define len(s) (int)s.size()

typedef long long ll;
typedef double d;
typedef long double lld;
typedef string str;
typedef unsigned long long ull;
typedef unsigned int ui;


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
#ifdef LOCAL
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    int a, b, c;
    cin >> a >> b >> c;
    cout << (c / a) * b;

    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef long double ld;
typedef pair <ll, ll> pii;

void faster()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
}

const ll MAXN = 1e6 + 10;
const ll N = 4000 + 10;
const ll MN = 200 + 10;
const ll mod = 1e6;


int main()
{
	faster();
	ll a , b;
	cin >> a >> b;
	if(a <= b)
		cout << a << endl;
	else
		cout << a - 1 << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define inf 99999999
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define ll long long
#define f first
#define s second

using namespace std;

const ll gr = 1005;
const ll P = 1e9+7;

ll tab[gr][gr];
ll dp[gr][gr];

int main(){
    ll n,m;
    char c;
    cin >> n >> m;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
            cin >> c;
            if(c=='.')
                tab[i][j]=1;
        }
    }
    tab[0][1] = 1;
    dp[0][1] = 1;
    for(ll i=1;i<=n;i++){
        for(ll j=1;j<=m;j++){
            if(tab[i][j] > 0){
                if(tab[i-1][j] > 0){
                    dp[i][j]+=dp[i-1][j];
                }
                if(tab[i][j-1] > 0){
                    dp[i][j]+=dp[i][j-1];
                }
                dp[i][j] = dp[i][j]%P;
            }
        }
    }
    cout << dp[n][m] << "\n";
    return 0;
}

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

typedef long long ll;
typedef vector<long long> vll;
typedef vector<int> vi;
typedef pair<int, int> pi;

#define yes "Yes"
#define yse "Yes"
#define no "No"

#define pb push_back
#define mp make_pair

#define NIL -1

#define list_itr list<ll>::iterator

#define rep(i, l, n) for (int i = (l); i < (n); i++)
#define rep_cs(i, l, n) for (int i = (l); i <= (n); i++)
#define rep_d(j, n) for (int j = n; j >= 0; j--)
#define rep_d_op(j, n, a) for (int j = n; j >= a; j--)

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;
}

const int MOD = 1000000007;
const vector<int> dx = {1, 0};
const vector<int> dy = {0, 1};
const ll INF = 1LL << 60;

// int max = *std::max_element(v.begin(), v.end());
// int sum = accumulate(v, v + v.size(), 0);

int GCD(int a, int b) { return b ? GCD(b, a % b) : a; }

bool binary_search(int a[], int n, int key)
{
    int l = 0;
    int r = n;
    int middle;
    while (l < r)
    {
        middle = (l + r) / 2;
        if (key == a[middle])
        {
            return true;
        }

        if (key > a[middle])
        {
            l = middle + 1;
        }
        else if (key < a[middle])
        {
            r = middle;
        }
    }
    return false;
}

const int MAX = 510000;
long long fac[MAX], finv[MAX], inv[MAX];

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

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

const int MAX_C = 1000;
long long Com[MAX_C][MAX_C];

void combination_for_small()
{
    memset(Com, 0, sizeof(Com));
    Com[0][0] = 1;
    for (int i = 1; i < MAX_C; ++i)
    {
        Com[i][0] = 1;
        for (int j = 1; j < MAX_C; ++j)
        {
            Com[i][j] = (Com[i - 1][j - 1] + Com[i - 1][j]) % MOD;
        }
    }
}

int main()
{
    ll n;
    cin >> n;
    ll ok = 1;
    rep(i, 0, n)
    {
        ll a;
        cin >> a;
        if (a % 2 != 0)
        {
            continue;
        }

        if (a % 3 != 0 && a % 5 != 0)
        {
            ok = 0;
        }
    }

    if (ok)
    {
        cout << "APPROVED" << endl;
    }
    else
    {
        cout << "DENIED" << endl;
    }
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define range(i,a,b) for(int i = (a); i < (b); i++)
#define rep(i,b) for(int i = 0; i < (b); i++)
#define all(a) (a).begin(), (a).end()
#define show(x)  cerr << #x << " = " << (x) << endl;
//const int INF = 1e8;
using namespace std;

vector<string> split(string in, char sp = ' '){
	vector<string> ret;
	stringstream ss(in);
	string s;
	while(getline(ss, s, sp)){
		ret.emplace_back(s);
	}
	return ret;
}

int main(){
	string in;
	while(getline(cin,in)){
		vector<double> st;
		vector<string> v = split(in);

		for(auto s : v){
			if(s.size() == 1 and not isdigit(s.front())){
				double b = st.back(); st.pop_back();
				double a = st.back(); st.pop_back();
				switch (s[0]) {
					case '+':
						st.emplace_back(a + b);
						break;
					case '-':
						st.emplace_back(a - b);
						break;
					case '*':
						st.emplace_back(a * b);
						break;
					case '/':
						st.emplace_back(a / b);
						break;
				}
			}else{
				st.emplace_back(stod(s));
			}
		}
		cout << fixed << setprecision(7) << st.front() << endl;
	}
}



Measured memory_bytes: 3144
#include<iostream>
using namespace std;
int main() {
	string S;
	cin >> S;

	int ans = 0;
	for (int i = 0; i < S.size(); i++) {
		if (S.at(i) == '+')
			ans++;
		else
			ans--;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val map = Array(n + 1) { LongArray(n + 1) { 0 } }
    fun gcd(a: Long, b: Long): Long {
        if (map[a.toInt()][b.toInt()] != 0L) return map[a.toInt()][b.toInt()]
        return if (b > 0) gcd(b, a % b) else a
    }

    fun gcd(a: Long, b: Long, c: Long): Long {
        val g = gcd(a, b)
        return gcd(g, c)
    }



    for (i in 1..n) {
        for (j in 1..n) {
            map[i][j] = gcd(i.toLong(), j.toLong())
        }
    }
    var ans = 0L
    for (i in 1L..n) {
        for (j in 1L..n) {
            for (k in 1L..n) {
                ans += gcd(i, j, k)
            }
        }
    }
    println(ans)
}

Measured memory_bytes: 35820
from itertools import accumulate
n,k=map(int, input().split())
A=[((int(i)*(int(i)+1))/2)/int(i) for i in input().split()]
al = list(accumulate(A))
ans = al[k-1]
for i in range(k, n):ans=max(ans, al[i]-al[i-k])
print(ans)


Measured memory_bytes: 23616
#include <iostream>
#include <vector>
#include <cmath>
#include <map>
 
using namespace std;
int N;

bool add(int, int, int);

int main()
{
  int i,j;
  int inp;
  map<int, int>A;

  cin >> N;

  for (i=0; i<N; i++) {
    cin >> inp;
    if (A.find(inp) != A.end()) {
      printf("NO\n");
      return 0;
    }
    A[inp] = i;
  }
  printf("YES\n");
  return 0;
}


Measured memory_bytes: 9600
//83A
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int a,b,c,d =0;
  cin >>a >>b >>c >>d;
  if (a+b> c+d){
      cout << "Left";
  }else if (a+b < c+d){
      cout << "Right";
  }else if (a+b==c+d){
      cout << "Balanced";
  }
}

Measured memory_bytes: 256
// ALDS1_9_C Priority Queue
#include <iostream>
#include <string>
#include <queue>
bool debug = false;

int main() {
    std::priority_queue<int> pq;
    std::string command_1;
    int command_2;
    while (true) {
        std::cin >> command_1;
        if (command_1 == "end") break;
        if (command_1 == "extract") {
            std::cout << pq.top() << "\n";
            pq.pop();
        } else {
            std::cin >> command_2;
            pq.push(command_2);
        }
    }
}


Measured memory_bytes: 6900
#include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
typedef long long ll;


int main(){
  
  int a,b,N;
  cin>>a>>b;
  cin>>N;
  int s[100],f[100];
  for(int i=0;i<N;i++){
    cin>>s[i]>>f[i];
  }
  int judge=0;
  for(int i=0;i<N;i++){
      if(s[i]<=a && f[i]>a){
        judge=judge+1;
      }
      if(s[i]<b && f[i]>=b){
        judge=judge+1;
      }
      if(a<=s[i] && b>s[i]){
        judge=judge+1;
      }
      if(a<f[i] && b>=f[i]){
        judge=judge+1;
      }
  }
  if(judge==0){
    cout<<0<<endl;
  }
  else{
    cout<<1<<endl;
  }
  
 /* int X;
  cin>>X;
  if(X%7==0){
    cout<<"thu"<<endl;
  }
  if(X%7==1){
    cout<<"fri"<<endl;
  }
  if(X%7==2){
    cout<<"sat"<<endl;
  }
  if(X%7==3){
    cout<<"sun"<<endl;
  }
  if(X%7==4){
    cout<<"mon"<<endl;
  }
  if(X%7==5){
    cout<<"tue"<<endl;
  }
  if(X%7==6){
    cout<<"wed"<<endl;
  }
 */
	
	/*int m,f,b;
	cin>>m>>f>>b;
	if(b-m<=0){
		cout<<0<<endl;
	}
	if(b-m>0 && b-m<=f){
		cout<<b-m<<endl;
	}
	if(b-m>0 && b-m>f){
		cout<<"NA"<<endl;
	}*/
	/*int a,b;
	cin>>a>>b;
	cout<<(a+b)/2<<endl;*/
	
	/*random_device rnd;
	mt19937 mt(rnd());
	uniform_int_distribution<> rnd3(1, 3);
	
	string p1, p2, p3, p4;
	cin >> p1 >> p2 >> p3 >> p4;
	
	int t = rnd()%3;
	
	if(t == 0){
		cout << "1:" << p1 << ',' << p2 << endl;
		cout << "2:" << p3 << ',' << p4 << endl;
	}
	if(t == 1){
		cout << "1:" << p1 << ',' << p3 << endl;
		cout << "2:" << p2 << ',' << p4 << endl;
	}
	if(t == 2){
		cout << "1:" << p1 << ',' << p4 << endl;
		cout << "2:" << p2 << ',' << p3 << endl;
	}*/
	
	/*
	switch(type){
		case 0:
			cout << "1:" << p1 << ',' << p2 << endl;
			cout << "2:" << p3 << ',' << p4 << endl;
			break;
		case 1:
			cout << "1:" << p1 << ',' << p3 << endl;
			cout << "2:" << p2 << ',' << p4 << endl;
			break;
		case 2:
			cout << "1:" << p1 << ',' << p4 << endl;
			cout << "2:" << p2 << ',' << p3 << endl;
			break;
	}
	*/
	
	
	return 0;
}



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

int main() {
  int N; cin >> N; // 頂点の数（２～８）
  int M; cin >> M; // 辺の数（０～N(N-1)/2)
  set<string> Hen;  // 辺属性を裏表でハッシュにためて、全順列に対し、辿れるか、判定する。
  rep(i,M){
    cin >> tmp_iA >> tmp_iB;
    Hen.insert(to_string(tmp_iA) + '-' + to_string(tmp_iB));
    Hen.insert(to_string(tmp_iB) + '-' + to_string(tmp_iA));
  }
  int Ans = 0; // 最後まで行けるパス数

  // if (debug) {for(auto h:Hen){cout<<h<<endl;}}

  if(N==2){   // ２頂点の場合、1-2 が入ってるかどうかの判断
    if (Hen.count("1-2")) {Ans = 1;}
  } else {    // ３頂点以上（Ｎ≧３）の場合
    // １を起点として、２～Ｎの全順列へのパスの存在チェックを行う。
    // 初期文字列作成
    string Choten;
    rep(i,N-1){ Choten += to_string(i+2); } // ２からＮまでの文字列
    string Check;
    if(debug){for(auto H : Hen) cout << H << endl;}
    do{
      // １から２点目へのパスの有無
      Check = to_string(1) + '-' + (char)(Choten.at(0));
      if (debug) {cout << "A:" << Check << ":" << Hen.count(Check) << endl;}
      if (!Hen.count(Check)) {continue;}  // 1-2 が無ければ、カウントせずに次へ
      rep(i,N-2){
        string Check1; Check1 += Choten.at(i);    // 部分文字列を切り取って、更に繋げるってどうするんだ？
        string Check2; Check2 += "-";
        string Check3; Check3 += Choten.at(i+1);
        Check = Check1 + Check2 + Check3;

        if (debug) {cout << "B:i" << i << " Check:" << Check << " Hen.c:" << Hen.count(Check) << " Choten:" << Choten.at(i) << "-" << Choten.at(i+1) << " Ans:" << Ans << endl;}
        if (!Hen.count(Check)) {break;}  // 1-2 が無ければ、カウントせずに次へ
      }
      if (!Hen.count(Check)) {continue;}  // 1-2 が無ければ、カウントせずに次へ
      Ans +=1; // 最後まで到達したら、パス＋１

    } while (next_permutation(Choten.begin(),Choten.end()));
  }

  cout << Ans << endl;
}

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

int main()
{
    int x, y;
    cin>> x >> y;
    if ((y % 2 == 0) && (y / 2 - x >= 0) && (2*x - y / 2 >= 0))
    {
        cout << "Yes" << endl;
    }
    else
    {
        cout << "No" << endl;
    }
    return 0;
}

Measured memory_bytes: 3628
#include <iostream>
#include <string>
#include <cstdlib>
#include <vector>
#include <array>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdio>
#include <iomanip>
#include <utility>
#include <unordered_map>

using namespace std;
typedef long long int ll;

#define SP(x) setprecision((int)x)
#define SW(x) setw(x)    // 桁数指定
#define SF(c) setfill(c) // 埋め文字指定('0')
#define ALL(v) v.begin(), v.end()

int main(int argc, char const *argv[])
{
    ll n;
    cin >> n;
    ll t = 1000000000000000000;
    ll ans = 1;
    vector<ll> a(n);
    for (ll i = 0; i < n; i++)
    {
        cin >> a[i];
        if (a[i] == 0)
        {
            cout << 0 << endl;
            exit(0);
        }
    }

    

    for (ll i = 0; i < n; i++)
    {
        t /= a[i];

        if (t <= 0)
        {
            cout << -1 << endl;
            exit(0);
        }
    }

    for (ll i = 0; i < n; i++)
    {
        ans *= a[i];
    }
    
    cout << ans << endl;
}

Measured memory_bytes: 4356
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=500005;
int n,fail[maxn];
char s[maxn];
bool vis[maxn];
inline void getfail()
{
	for(int i=2,j=0;i<=n;i++)
	{
		while(j && s[j+1]!=s[i]) j=fail[j];
		if(s[j+1]==s[i]) j++;
		fail[i]=j;
	}
}
int main()
{
	scanf("%s",s+1); n=strlen(s+1);
	getfail();
	if(n%(n-fail[n])!=0 || !fail[n]) return printf("1\n1\n"),0;
	if(fail[n]==n-1) return printf("%d\n1\n",n),0;
	for(int i=1;i<=n;i++) vis[i]|=i%(i-fail[i])==0 && fail[i];
	reverse(s+1,s+n+1);
	getfail();
	for(int i=1;i<=n;i++) vis[n-i]|=i%(i-fail[i])==0 && fail[i];
	int ans=0;
	for(int i=1;i<=n;i++) ans+=!vis[i];
	printf("2\n%d\n",ans);
	return 0;
}

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

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    string s, t;
    cin >> s >> t;
    int ans = s.size();
    for (int i = 0; i + t.size() - 1 <= s.size() - 1; i++) {
        string cur = s.substr(i, t.size());
        int tmp = 0;
        for (int i = 0; i < t.size(); i++) {
            if (cur[i] != t[i]) tmp++;
        }
        ans = min(ans, tmp);
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3596
import static java.lang.System.out;
import java.lang.Math;
import java.io.InputStream;
import java.io.IOException;
import java.util.NoSuchElementException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.LinkedList;
import java.util.Collections;

public class Main {
    public static void main(String args[]) {
        new Main().run();
    }

    MyInput in = new MyInput();
    public void run() {
        String str = in.next();
        out.println(str.substring(0,str.lastIndexOf("FESTIVAL")));
    }
}

class MyInput {
	private final InputStream in = System.in;
	private final byte[] buffer = new byte[1024];
	private int ptr= 0;
	private int buflen = 0;
	private boolean hasNextByte() {
		if(ptr < buflen) {
			return true;
		}else {
			ptr = 0;
			try {
				buflen = in.read(buffer);
			} catch(IOException e) {
				e.printStackTrace();
			}
			if(buflen <= 0) {
				return false;
			}
		}
		return true;
	}

	public int readByte() { 
		if (hasNextByte()) return buffer[ptr++];
		else return -1;
	}

	private static boolean isPrintableChar(int c) {
		return 33 <= c && c <=126;
	}

	private void skipUnprintable() {
		while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;
	}

	public boolean hasNext() {
		skipUnprintable();
		return hasNextByte();
	}

	public String next() {
		if(!hasNext()) throw new NoSuchElementException();
		StringBuilder sb = new StringBuilder();
		int b = readByte();
		while(isPrintableChar(b)) {
			sb.appendCodePoint(b);
			b = readByte();
		}
		return sb.toString();
	}

	public long nextLong() {
		if(!hasNext()) throw new NoSuchElementException();
		long n = 0;
		boolean minus = false;
		int b = readByte();
		if (b == '-') {
			minus = true;
			b = readByte();
		}
		if(b < '0' || '9' < b) {
			throw new NumberFormatException();
		}
		while(true) {
			if('0' <= b && b <= '9') {
				n *= 10;
				n += b - '0';
			}else if(b == -1 || !isPrintableChar(b)) {
				return minus ? -n : n;
			}else {
				throw new NumberFormatException();
			}
			b = readByte();
		}
	}

	public int nextInt() {
		long nl = nextLong();
		if(nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) nl;
	}

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



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

int main() {
    int A, B;
    cin >> A >> B;

    bool isOk = false;
    if (A % 3 == 0) {
        isOk = true;
    } else if (B % 3 == 0) {
        isOk = true;
    } else if ((A + B) % 3 == 0) {
        isOk = true;
    }
    if (isOk) {
        cout << "Possible" << endl;
    } else {
        cout << "Impossible" << endl;
    }

    return 0;
}

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

int x;

int main(void)
{
    cin >> x;

    if (x >= 400 && x < 600){
        cout << 8 << endl;
    }
    else if (x >= 600 && x < 800){
        cout << 7 << endl;
    }
    else if (x >= 800 && x < 1000){
        cout << 6 << endl;
    }
    else if (x >= 1000 && x < 1200){
        cout << 5 << endl;
    }
    else if (x >= 1200 && x < 1400){
        cout << 4 << endl;
    }
    else if (x >= 1400 && x < 1600){
        cout << 3 << endl;
    }
    else if (x >= 1600 && x < 1800){
        cout << 2 << endl;
    }
    else if (x >= 1800 && x < 2000){
        cout << 1 << endl;
    }
    return 0;
}


Measured memory_bytes: 3632
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<tuple>
#define int long long
using namespace std;

signed main() {
	int X,Y;
	cin >> X >> Y;
	int A = X;
	int count = 0;
	while(A <= Y) {
		count++;
		A = A * 2;
	}
	cout << count << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;
using ll = long long;
const ll mod = 1000000007;
const ll INF = 100000000000000000LL;
signed main(){
    int a,b,k;
    cin>>a>>b>>k;
    set<int> num;
    for(int i=0;i<k;i++){
        num.insert(a+i);
        num.insert(b-i);
    }
    vector<int> v(num.begin(),num.end());
    sort(v.begin(),v.end());
    for(int i=0;i<v.size();i++){
        if(a<=v[i]&&v[i]<=b)cout<<v[i]<<endl;
    }
}

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

using ll = long long;

//constant
const double EPS = 1e-10;
ll MOD = 1000000007;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define FOR(i, s, e) for (ll i = s; i < e; i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(), (x).rend()

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl;
#define DEBUG(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl;

// vector
//template<typename T> vector<vector<T>> vv(ll H, ll W, T v) { return vector<vector<T>> vec(H, vector<T>(W, v)); }

// view vector
template<typename T> void view(T e) { std::cout << e << std::endl; }
template<typename T> void view(const std::vector<T>& v) { for (const auto& e : v) { std::cout << e << " "; } std::cout << std::endl; }
template<typename T> void view(const std::vector<std::vector<T> >& vv) { for (const auto& v : vv) { view(v); } }

// DP
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; }

// ***************************************

const ll INF = 1e+20;
vector<vector<ll>> dp;

int main(void) {

	int N;
	cin >> N;

	dp.assign(N, vector<ll>(N, INF));
	vector<ll> cum(N + 1);
	vector<ll> A(N);
	REP(i, N) {
		cin >> A[i];
		cum[i + 1] = cum[i] + A[i];
	}
	REP(i, N) {
		dp[i][i] = 0;
	}

	FOR(w, 1, N) {
		REP(i, N - w) {
			ll j = i + w;
			FOR(m, i, j) {
				chmin(dp[i][j], dp[i][m] + dp[m + 1][j] + cum[j + 1] - cum[i]);
			}
		}
	}
	cout << dp[0][N - 1] << endl;

	return 0;
}

Measured memory_bytes: 1536
#include <stdio.h>
#include <algorithm>
using namespace std;

int len[222];

int main(){
    int n;

    scanf("%d",&n);
    for(int i=1;i<=(n<<1);i++) scanf("%d",&len[i]);
    sort(len+1,len+(n<<1)+1);

    int sum=0;
    for(int i=1;i<(n<<1);i+=2) sum+=len[i];

    printf("%d",sum);

    return 0;
}


Measured memory_bytes: 128
#include<iostream>
#include <bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
string s;
long long tle=0,ac=0,wa=0,re=0;
for(long long i=1;i<=n;i++){
	cin>>s;
	if(s=="AC"){
		ac++;
	}
	else if(s=="TLE"){
		tle++;
	}
	else if(s=="WA"){
		wa++;
	}
	else{
		re++;
	}
	
}
cout<<"AC"<<" "<<"x"<<" "<<ac<<'\n';
cout<<"WA"<<" "<<"x"<<" "<<wa<<'\n';
cout<<"TLE"<<" "<<"x"<<" "<<tle<<'\n';
cout<<"RE"<<" "<<"x"<<" "<<re;
}

Measured memory_bytes: 3628
#include <iostream>
#include <vector>

int main(int argc, char* argv[]) {
	int m1, h1, m2, h2, k;
	scanf("%d %d %d %d %d", &h1, &m1, &h2, &m2, &k);

	const int wake = 60 * h1 + m1;
	const int sleep = 60 * h2 + m2;

	const int deadline = sleep - k;

	int ans = deadline - wake;

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

	return 0;
}

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

int main(){
    
    int n,m;
    cin>>n>>m;
    
    vector<long long int> sum(n+1);

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

    for(int i=0;i<m;i++){
        int x;
        cin>>x;
        sum[x] = 0;
    }


    for(int i=2;i<n+1;i++){
        if(sum[i]==1){
            sum[i] = (sum[i-1]%1000000007 + sum[i-2]%1000000007)%1000000007;
        }
    }
    cout<<sum[n]<<endl;
    return 0;
}

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

int main()
{
    int A,B,C,D;
    cin>>A>>B>>C>>D;
    if(A+B == C+D){
        cout<<"Balanced"<<endl;
    }else if(A+B < C+D){
        cout<<"Right"<<endl;
    }else{
        cout<<"Left"<<endl;
    }
}

Measured memory_bytes: 256
import sys

def main():
    A, B, N = map(int, input().split())

    if B == 1:
        ans = 0
        print(ans)
        return

    if B > N:
        x = N
    else:
        x = B-1

    ans = (A*x) // B
    print(ans)
    return

if __name__ == '__main__':
    main()
    sys.exit(0)

Measured memory_bytes: 80104
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <utility>
#include <cmath>
#include <functional>
#include <queue>
//#include <stack>
#include <climits>
#include <map>
#define Rep(i,n) for(int i=0;i<n;i++)
#define For(i,n1,n2) for(int i=n1;i<n2;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define put(a) cout<<a<<endl;
#define all(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
using namespace std;
typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> P;

int n,k;

int main() {
    cin >> n >> k;
    vector<int> h(n);
    Rep(i,n){
        cin >> h[i];
    }
    int res=INT_MAX;
    SORT(h);
    Rep(i,n-k+1){
        if(res>h[i+k-1]-h[i]){
            res=h[i+k-1]-h[i];
        }
    }
    put(res);
    return 0;
}


Measured memory_bytes: 640
using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
using Pair = System.Tuple<int, int>;
using Edge = System.Tuple<int, int, long>;
//using Debug;
//using static System.Globalization.CultureInfo;

class Program
{
    static void Main(string[] args)
    {
        var num = Input.num;
        var ar = Input.arL;
        var left = 0;
        var right = 0;
        var res = 0L;
        var sum = 0L;
        var xor = 0L;
        while (right < num && left < num)
        {
            if (sum + ar[right] == (xor ^ ar[right]))
            {
                sum += ar[right];
                xor ^= ar[right];
                right++;
            }
            else
            {
                sum -= ar[left];
                xor ^= ar[left];
                res += right - left;
                left++;
            }
        }
        WriteLine(res +(long)(right - left + 1) * (right - left) / 2);
    }
}

public class Input
{
    public static string read => ReadLine();
    public  static int[] ar => Array.ConvertAll(read.Split(' '), int.Parse);
    public  static int num => ToInt32(read);
    public static long[] arL => Array.ConvertAll(read.Split(' '), long.Parse);
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h) 
        => Enumerable.Repeat(0, h).Select(v => read.ToCharArray()).ToArray();
    public static int[][] twodim(int num)
        => Enumerable.Repeat(0, num).Select(v => ar).ToArray();
    public static long[][] twodimL(int num)
        => Enumerable.Repeat(0, num).Select(v => arL).ToArray();
    public const long Inf = (long)1e18/2;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


Measured memory_bytes: 30684
#include<stdio.h>
int main()
  {
  long long int x,a,b,c=0,d,e,f,g;
  scanf("%lld",&x);
  a = x/500;
    b = x%500;
    d = a*1000;
    e = b/5;
    g = e*5;
    f = d+g;
    c+=f;
    printf("%lld",c);
    return 0;
  }


Measured memory_bytes: 1708
import java.util.Scanner;

class Main{
	static final long MOD = 1000000007;

	static int H, W, K;
	static long[][] dp = new long[110][10];



	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);			//文字の入力
		int n = sc.nextInt();
		if(n == 3 || n == 5 || n == 7){
			System.out.println("YES");
			
		}else{
			System.out.println("NO");
		}
	}





}







class Pair implements Comparable{
	int from;		//p
	int end;		//y
	int num;
	int bango;
	@Override
	public int compareTo(Object other) {
		Pair otherpair = (Pair)other;

		return end - otherpair.end;
	}
}


Measured memory_bytes: 23764
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<string>
#include<vector>
#include<set>
#include<cctype>
using namespace std;

int main(void){
	ios::sync_with_stdio(false); cin.tie(0);
	
	int a;
	cin>>a;
	cout<<"ABC"<<a<<endl;
	
	
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
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; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



int N; ll C;
ll x[101010], v[101010];
ll y[101010];
ll A[101010], B[101010], D[101010];
//---------------------------------------------------------------------------------------------------
ll solve() {
    A[0] = v[0];
    rep(i, 1, N) A[i] = A[i - 1] + v[i];

    rep(i, 0, N) y[i] = C - x[i];
    B[N - 1] = v[N - 1];
    rrep(i, N - 2, 0) B[i] = B[i + 1] + v[i];

    D[N - 1] = B[N - 1] - y[N - 1];
    rrep(i, N - 2, 0) {
        D[i] = B[i] - y[i];
        chmax(D[i], D[i + 1]);
    }


    ll ans = 0;
    rep(i, 0, N) {
        ll sm = 0;

        sm -= x[i]; // →移動
        sm += A[i]; // →カロリー
        chmax(ans, sm);

        sm -= x[i]; // 原点に戻る

        if (i < N - 1) sm += D[i + 1];

        chmax(ans, sm);
    }
    
    return ans;
}
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> C;
    rep(i, 0, N) cin >> x[i] >> v[i];
    
    ll ans = 0;
    chmax(ans, solve());

    reverse(v, v + N);
    rep(i, 0, N) x[i] = C - x[i];
    reverse(x, x + N);

    chmax(ans, solve());
    cout << ans << endl;
}

Measured memory_bytes: 4992