akhauriyash/Code-Regression huggingface dataset:
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        s: String,
    }
    let l = s.len();
    let mut zeroc: isize = 0;
    for c in s.into_bytes() {
        match c as char {
            '0' => zeroc += 1,
            '1' => zeroc -= 1,
            _ => panic!("panic"),
        }
    }

    println!("{}", l - zeroc.abs() as usize);
}


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

using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
typedef long long ll;
typedef pair<int, int> P;

const int MOD = 1000000007;
const int INF_32 = 1LL << 30;
const int64_t INF_64 = 1LL << 60;

ll solve(ll n, ll k)
{
    if (n <= k) {
        return min(n, k - n);
    }
    // n > k
    n = n % k;
    return solve(n, k);
}
int main()
{
    ll n, k;
    cin >> n >> k;
    cout << solve(n, k) << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	static boolean[] primes;

	static void primeSet(final int MAX){
		primes = new boolean[MAX+1];

		primes[2] = true;
		for(int i=3;i<=MAX;i+=2){
			primes[i] = true;
		}
		int rt = (int) Math.sqrt(MAX);
		for(int i=3;i<=rt;i+=2){
			if(primes[i]){
				for(int j=i*i;j<=MAX;j+=i){
					primes[j] = false;
				}
			}
		}
	}

	public static void main(String[] args) {
		Scanner stdIn = new Scanner(System.in);
		int p = 0;
		
		while(true){
			int n = stdIn.nextInt();
			if(p<n){
				primeSet(n);
			}
			if(n==0){
				return;
			}
			
			int before = 0;
			int cnt = 0;
			for(int i=2;i<=n;i++){
				int sum=0;
				int start = 0;
//				System.out.print(i+":");
				for(int j=i;j<=n;j++){
					if(primes[j]){
//						System.out.print(j+",");
						if(start==0){
							start=j;
						}
						sum+=j;
						if(sum==n){
							if(start==before){
								sum=0;
								start=0;
								break;
							}
//							System.out.print("*****");
							before=start;
							start=0;
							cnt++;
							sum=0;
							break;
						}
						else if(sum>n){
							sum=0;
							break;
						}
					}
				}
//				System.out.println();
			}
			System.out.println(cnt);
		}
	}
}

Measured memory_bytes: 0
#include<iostream>
#include <algorithm>
#include<string>
#include <bitset>
#include <vector>
#include <functional>
#include <climits>
#include <iomanip>
#include <utility>
#include <stack>
using namespace std;
using ll = long long;
int main()
{
	ll a, b = 0, c = 0, d = 0;
	char C;
	char s[1000];
	cin >> a;
	cin >> b;
	cin >> c;
	cin >> d;
		cout << c+b-d << " " << d+c-a << " " << c + b - d+a-c << " " << d + c - a+b-d << endl;

	//if (a==c&&b>d)
	//{
	//	cout << a + b - d << " " << d << " " << a + b - d << " " << b << endl;

	//}
	//else if (a==c&&b<=d)
	//{
	//	cout << a + b - d << " " << d << " " << a + b - d << " " << b << endl;

	//}
	//else if (a<c&&b==d)
	//{
	//	cout << c << " " << c-a+b << " " << a << " " << c - a + b << endl;

	//}
	//else
	//{
	//	cout << c << " " << c - a + b << " " << a << " " << c - a + b << endl;

	//}


	//cout << b*c<<endl;

	return 0;
}

Measured memory_bytes: 256
#include<iostream>

using namespace std;

void apply(int f,int &t,const string &s,int x){
  static int filter[][7]={
    {0,1,2,4,6,7,9},
    {1,3,4,6,8,9,11},
    {2,4,5,7,9,10,12},
    {4,6,7,9,11,12,14},
    {6,8,9,11,13,14,16},
    {7,9,10,12,14,15,17},
    {9,11,12,14,16,17,18}
  };
  int sx=0;
  for(int i=0;i<7;i++){
    sx|=(f>>filter[x][i]&1)<<i;
  }
  int rb=filter[x][3];
  t=t&~(1<<rb)|(s[sx]-'0')<<rb;
}

int main(){
  for(string s;cin>>s,s!="#";){
    bool f=false;
    for(int i=0;i<1<<19;i++){
      int once=i;
      for(int j=0;j<7;j++){
	apply(i,once,s,j);
      }
      int twice=once;
      apply(once,twice,s,3);
      f|=(once>>9&1)!=(twice>>9&1);
    }
    cout<<(f?"no":"yes")<<endl;
  }
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

//#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 100;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)

bool contain(set<char> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);

typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;
const int mod = 1000000007;


int main() {
    while (true) {
        int h, w;
        cin >> h >> w;
        if (h == 0 && w == 0) return 0;
        rep(y, h) {
            rep(x, w) {
                if (((y % 2) + x) % 2 == 0)cout << '#';
                else cout << '.';
            }
            cout << endl;
        }
        cout << endl;

    }
}


Measured memory_bytes: 3120
#include<algorithm>
#include<bitset>
#include<cmath>
#include<complex>
#include<cstdlib>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<utility>
#include<vector>

using namespace std;

#define ll long long
#define pal pair<long,long>
#define pad pair<double,double>
#define PB push_back
#define MP make_pair
#define F first
#define S second

const ll MOD = 1e9+7;
const ll INF = 1e18;
const double EPS = 1e-8;

long long pow(long long x, long long n) {
    long long ret = 1;
    while (n > 0) {
        if (n & 1) ret = ret * x % MOD;
        x = x * x % MOD;
        n >>= 1;
    }
    return ret;
}

template<typename T,typename U>
bool chmax(T& max, const U& x){
	if(max<x){
		max = x;
		return true;
	}
	return false;
}

template<typename T,typename U>
bool chmin(T& min, const U& x){
	if(min>x){
		min = x;
		return true;
	}
	return false;
}


int main(){
	string s;
	cin >> s;

	for(ll i=0;i<s.size();i++){
		if(s[i]=='?'){
			s[i]='D';
		}
	}
	cout<< s<<endl;
}

Measured memory_bytes: 3724
n = int(input())
p = list(map(int, input().split()))
count = 0
for i in range(1,n-1):
    if p[i-1] < p[i] and p[i] < p[i+1]:
        count += 1
    elif p[i-1] > p[i] and p[i] > p[i+1]:
        count += 1
print(count)

Measured memory_bytes: 3060
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>

#define maxn 100000+5

using namespace std;

int a[maxn];
int n,all;

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

Measured memory_bytes: 1536
#include <algorithm>
#include <complex>
#include <cstdlib>
#include <ctime>
#include <time.h>
#include <iomanip>
#include <iostream>
#include <map>
#include <math.h>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <numeric>
#include <limits>
#include <type_traits>

using namespace std;
#define SAY_YES cout << "YES" << endl;
#define SAY_Yes cout << "Yes" << endl;
#define SAY_NO cout << "NO" << endl;
#define SAY_No cout << "No" << endl;
#define IFYES(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "YES" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "NO" << endl;  \
    }
#define IFYes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "Yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "No" << endl;  \
    }
#define IFyes(TRUE_OR_FALSE)   \
    if (TRUE_OR_FALSE)         \
    {                          \
        cout << "yes" << endl; \
    }                          \
    else                       \
    {                          \
        cout << "no" << endl;  \
    }
#define DEBUG_OUTPUT_ARRAY(XXX, ONE)                            \
    for (int i = 0; i < (ONE); i++)                             \
    {                                                           \
        cout << "DEBUG: i = " << i << " -> " << XXX[i] << endl; \
    }
#define DEBUG_OUTPUT_ARRAY2(XXX, ONE, TWO)                             \
    for (int i = 0; i < (ONE); i++)                                    \
    {                                                                  \
        cout << "<<< i = " << i << " >>>" << endl;                     \
        for (int j = 0; j < (TWO); j++)                                \
        {                                                              \
            cout << "DEBUG: j = " << j << " -> " << XXX[i][j] << endl; \
        }                                                              \
    }
#define DEBUG_OUTPUT_ARRAY2_BOX(XXX, ONE, TWO) \
    for (int i = 0; i < (ONE); i++)            \
    {                                          \
        cout << i << "  ";                     \
        for (int j = 0; j < (TWO); j++)        \
        {                                      \
            cout << XXX[i][j] << " ";          \
        }                                      \
        cout << endl;                          \
    }

typedef pair<long long int, long long int> pll;


const long long int mod = 1000000007;
const long long int INF = 1e18;
const long double PI=3.14159265358979323; 

long long int N,M,A[200303],B[200203],res=0,sum=0,cou=0;
string S,T;

int main()
{
    cout << fixed << setprecision(18);
    cin>>N;
    cout<<2.0*PI*N<<endl;
}    


Measured memory_bytes: 3788
N = int(input())

A = []
B = []

for i in range(N):

    a,b = map(int,input().split())
    A.append(a)
    B.append(b)

A.sort()
B.sort()

if N % 2 == 1:
    am = A[N//2]
    bm = B[N//2]

    print (bm-am+1)

else:
    am = (A[N//2] + A[N//2-1])/2
    bm = (B[N//2] + B[N//2-1])/2

    print ( int((bm-am)/0.5) + 1)


Measured memory_bytes: 99016
#include <iostream>
#include <algorithm>

using namespace std;
const int inf = 2e9+7;

long long c[101], w[101];
long long f[110][100100];

int main()
{
    int N, V, i, j;

    cin>>N>>V;

    for(i=0;i<N;i++)
        cin>>c[i]>>w[i];
    fill(f[0],f[0]+100001,inf);
    f[0][0] = 0;
    for(i=0;i<N;i++)
    {
        for(j=0;j<=100000;j++)
            if(j >= w[i])
                f[i+1][j] = min(f[i][j-w[i]] + c[i], f[i][j]);
            else
                f[i+1][j] = f[i][j];
    }
    int res=0;
    for(int i=0;i<=100000;i++)
        if(f[N][i]<=V)
            res = i;

    cout<<res<<endl;

    return 0;
}

Measured memory_bytes: 80128
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000
#define mod 1000000007
typedef long long ll;
const ll LINF = 1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
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; }
ll n,m;
vector<ll> a;

int main(){
    ll n;
    cin>>n;
    int ans=INF;
    for(ll i=1;i*i<=n;i++){
        if(n%i) continue;
        ans=min(ans,max((int)(to_string(i)).size(),(int)(to_string(n/i)).size()));
    }
    cout<<ans<<endl;
    return 0;
}

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

int main(void)
{
	int j;
	int i;
	char str[200], *p;
	
	
	//for(j=0; j<20; j++){
		
		scanf("%s", str);
		//printf("%s\n", str);
		
		i = strlen(str);
		//printf("i=%d\n", i);
		for(i; i>0; i--){
			printf("%c", str[i-1]);
		}
		
		printf("\n");
		//break;
//}
		
	return 0;
}

Measured memory_bytes: 524
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
using namespace std;

#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,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > pipii;
typedef vector<int> vi;

int solve(int y, int m, int d){
	int yy = y, mm = m, dd = d;
	int ret = 0;
	while(1){
//cout << yy << ":" << mm << ":" << dd  << ":" << ret << endl;
		if(yy == 1000 && mm == 1 && dd == 1) break;
		dd++;
		ret++;
		if(yy % 3){
			if(mm % 2 && dd == 21){
				dd = 1; mm++;
			}
			else if(!(mm % 2) &&dd == 20){
				dd = 1; mm++;
			}
		}
		else {
			if(dd == 21){
				dd = 1; mm++;
			}
		}
		if(mm == 11){
			yy++;
			mm = 1;
		}
	}
	return ret;
}

int main(void){
	int n;
	cin >> n;
	while(n--){
		int y, m, d;
		cin >> y >> m >> d;
		cout << solve(y,m,d) << endl;
	}
	
	return 0;
}

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

const ll mod = 1e9 + 7;

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

/*-------------------------------------------*/

template <typename T> T mod_pow(T x, T n, const T &p) {
    T ret = 1;
    while(n > 0) {
        if(n & 1) (ret *= x) %= p;
        (x *= x) %= p;
        n = n >> 1;
    }
    return ret;
}

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

    ll n, a[10009], lcm = 1, sum = 0;
    map<int, int> num;
    cin >> n;
    rep(i, n) {
        cin >> a[i];
        int A = a[i];
        for(int j = 2; j * j <= A; j++) {
            int x = 0;
            while(A % j == 0) {
                x++;
                A /= j;
            }
            chmax(num[j], x);
        }
        if(chmax(num[A], 1) && A > 1000) (lcm *= A) %= mod;
    }
    FOR(i, 2, 1001) { (lcm *= mod_pow(i, (ll)num[i], mod)) %= mod; }
    rep(i, n) {
        sum += lcm * mod_pow(a[i], mod - 2, mod);
        sum %= mod;
    }
    cout << sum << endl;
}

Measured memory_bytes: 896
n,m = map(int,input().split())

def fact(n):
    if n in (0,1):
        return 1
    return n * fact(n-1)

ans = 0
if n>1:
  ans += fact(n)//(fact(n-2)*fact(2))
if m>1:
  ans += fact(m)//(fact(m-2)*fact(2))
print(ans)

Measured memory_bytes: 3060
import bisect
import sys
input = sys.stdin.readline


a, b, q = map(int, input().split())
S = [int(input()) for _ in range(a)]
T = [int(input()) for _ in range(b)]
X = [int(input()) for _ in range(q)]

S.append(float('INF'))
S.append(-float('INF'))
T.append(float('INF'))
T.append(-float('INF'))

S.sort()
T.sort()

for x in X:
    S_idx = bisect.bisect_left(S, x)
    T_idx = bisect.bisect_left(T, x)

    s_left, s_right = S[S_idx-1], S[S_idx]
    t_left, t_right = T[T_idx-1], T[T_idx]
    pathA = x - min(s_left, t_left)
    pathB = max(s_right, t_right) - x
    pathC = min(x-s_left, t_right-x) + t_right - s_left
    pathD = min(x-t_left, s_right-x) + s_right - t_left
    print(min(pathA, pathB, pathC, pathD))

Measured memory_bytes: 16144
N, M = map(int, input().split())
ans = [-1] * N

def find(x):
    global ans
    if ans[x] == -1:
        return x
    else:
        ans[x] = find(ans[x])
        return ans[x]
    
for _ in range(M):
    x, y, z = map(int, input().split())
    x -= 1
    y -= 1
    xx = find(x)
    yy = find(y)
    if ans[x] == ans[y] == -1:
        ans[y] = x
    elif xx == yy:
        continue
    else:
        ans[yy] = xx

n = 0
for i in ans:
    if i == -1:
        n += 1

print(n)

Measured memory_bytes: 5580
N = int(input())
# L = map(int, input().split())
SL = [int(i) for i in input().split()]
SL.sort()
# SL = sorted(list(L))
# SL = L.sort()
# print('SL', SL)
import bisect

ans = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        ab = SL[i] + SL[j]
        # print(i, j)
        # print(SL[i], SL[j])
        r = bisect.bisect_left(SL, ab)
        l = j + 1
        # print('r', r)
        # print('l', l)
        # print('---')
        ans += max(0, r - l)

print(ans)

Measured memory_bytes: 3188
import numpy as np
a,b,n = map(int,input().split())
ans = 0
if b == 1:
    print(0)
    exit()
else:
    for k in range(1,int(n/b)+1+1):
        if k*b -1 <= n :
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*(k*b-1)/b) - a * (k-1))
        else:
        # print(k,k*b-1,n)
            ans = max(ans, np.floor(a*n/b) - a*(k-1))
        # break
print(int(ans))


Measured memory_bytes: 27100
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
using namespace std;
#define rep(i,x) for(int i = 0; i < x; i++)
#define pb push_back
#define mp make_pair
typedef long long ll;
typedef long double ld;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
const ll MOD = 1e9+7;
const int n_max = 1e5+10;

ll ceil(ll a, ll b){
    return (a+b-1)/b;
}
int main(){
    ll n; cin >> n;
    vector<ll> vec(5);
    rep(i,5) cin >> vec[i];
    ll min_time = *min_element(vec.begin(), vec.end());
    cout << 4 + ceil(n,min_time) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <cstdlib>
#include <tuple>

using ll = long long;
using namespace std;
#define modmod 1000000007


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

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

    sort(s,s+N);

    if(sum%10 != 0){
        cout << sum << endl;
        return 0;
    }

    for(int i = 0 ; i < N ; i++){
        if(s[i]%10 != 0){
            cout << sum-s[i] << endl;
            return 0;
        }
    }

    cout << 0 << endl;

    return 0;
}


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

#include <bits/stdc++.h>
using namespace std;
#define sd(x) scanf("%d", &x)
#define slld(x) scanf("%lld", &x)
#define all(x) x.begin(), x.end()
#define For(i, s, e) for (ll i = s; i < e; i++)
#define Forr(i, s, e) for (ll i = s; i > e; i--)
#define pb push_back
#define ll long long
#define mp make_pair
ll mod = 1000000007;
int main()
{
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    srand(chrono::high_resolution_clock::now().time_since_epoch().count());
    cout << fixed << setprecision(8);
    ll n, m;
    cin >> n >> m;
    string s[n];
    For(i, 0, n)
    {
        cin >> s[i];
    }
    ll a[n][m];
    For(i, 0, n)
    {
        For(j, 0, m)
        {
            a[i][j] = 0;
        }
    }
    a[0][0] = 1;
    For(i, 1, m)
    {
        if (s[0][i] == '#')
            a[0][i] = 0;
        else
            a[0][i] = a[0][i - 1];
    }
    For(i, 1, n)
    {
        if (s[i][0] == '#')
            a[i][0] = 0;
        else
            a[i][0] = a[i - 1][0];
    }
    For(i, 1, n)
    {
        For(j, 1, m)
        {
            if (s[i][j] == '#')
                a[i][j] = 0;
            else
            {
                a[i][j] = (a[i - 1][j] % mod + a[i][j - 1] % mod) % mod;
            }
        }
    }
    cout << a[n - 1][m - 1] % mod << endl;
    return 0;
}

Measured memory_bytes: 12576
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n, j, k;
  cin >> n >> j;
  k = j - 1;
  
  string s;
  cin >> s;
  
  if(s.at(k) == 'A')
    s.at(k) = 'a';
  if(s.at(k) == 'B')
    s.at(k) = 'b';
  if(s.at(k) == 'C')
    s.at(k) = 'c';
  
  cout << s << endl;
}
  

Measured memory_bytes: 256
package main

import (
	"bufio"
	_ "container/heap"
	"fmt"
	"os"
	_ "sort"
	"strconv"
)

// I/O
type Scanner struct {
	sc *bufio.Scanner
}

func NewScanner() *Scanner {
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	sc.Buffer(make([]byte, 1024), int(1e+9))
	return &Scanner{sc}
}

func (s *Scanner) nextStr() string {
	s.sc.Scan()
	return s.sc.Text()
}

func (s *Scanner) nextInt() int {
	i, e := strconv.Atoi(s.nextStr())
	if e != nil {
		panic(e)
	}
	return i
}

func (s *Scanner) nextFloat() float64 {
	f, e := strconv.ParseFloat(s.nextStr(), 64)
	if e != nil {
		panic(e)
	}
	return f
}

func (s *Scanner) nextRuneSlice() []rune {
	return []rune(s.nextStr())
}

func (s *Scanner) nextIntSlice(n int) []int {
	res := make([]int, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextInt()
	}
	return res
}

func (s *Scanner) nextFloatSlice(n int) []float64 {
	res := make([]float64, n)
	for i := 0; i < n; i++ {
		res[i] = s.nextFloat()
	}
	return res
}

// Arithmetic
func max(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m < i {
			m = i
		}
	}
	return m
}

func min(nums ...int) int {
	m := nums[0]
	for _, i := range nums {
		if m > i {
			m = i
		}
	}
	return m
}

func abs(x int) int {
	if x > 0 {
		return x
	}
	return -x
}

func pow(x, y int) int {
	res := 1
	for i := 0; i < y; i++ {
		res *= x
	}
	return res
}

func ceil(a, b int) int {
	if a%b == 0 {
		return a / b
	} else {
		return a/b + 1
	}
}

func gcd(a, b int) int {
	if b == 0 {
		return a
	}
	return gcd(b, a%b)
}

func lcm(a, b int) int {
	return a / gcd(a, b) * b
}

// Sort
type RuneSlice []rune

func (a RuneSlice) Len() int           { return len(a) }
func (a RuneSlice) Less(i, j int) bool { return a[i] < a[j] }
func (a RuneSlice) Swap(i, j int)      { a[i], a[j] = a[j], a[i] }

// Main
const MOD = int(1e+9) + 7
const INF = 1 << 60

func main() {
	sc := NewScanner()
	wtr := bufio.NewWriter(os.Stdout)
	defer wtr.Flush()
	N, M := sc.nextInt(), sc.nextInt()
	MAX := 1 << uint(N)
	C := make([]int, M)
	A := make([]int, M)
	for i := 0; i < M; i++ {
		a, b := sc.nextInt(), sc.nextInt()
		C[i] = a
		sum := 0
		for j := 0; j < b; j++ {
			c := sc.nextInt() - 1
			sum += 1 << uint(c)
		}
		A[i] = sum
	}
	dp := make([][]int, M)
	for i := 0; i < M; i++ {
		dp[i] = make([]int, MAX)
		for j := 1; j < MAX; j++ {
			dp[i][j] = INF
		}
	}
	for i := 0; i < M; i++ {
		for bit := 1; bit < MAX; bit++ {
			common := bit & A[i]
			if i > 0 {
				dp[i][bit] = min(dp[i-1][bit], dp[i-1][bit-common]+C[i])
			} else {
				if bit-common == 0 {
					dp[i][bit] = C[i]
				}
			}
		}
	}
	//fmt.Fprintln(wtr, dp)

	if dp[M-1][MAX-1] != INF {
		fmt.Fprintln(wtr, dp[M-1][MAX-1])
	} else {
		fmt.Fprintln(wtr, -1)
	}
}


Measured memory_bytes: 33792
n,a,b=map(int,input().split())
if a%2==b%2:
  print(abs((a+b)//2-a))
else:
  k=min(a-1,n-b)
  if a-1<n-b:
    flag=0
  else:
    flag=1
  if flag==0:
    if b-k-1>=0:
      print(k+1+abs(b-k-1-(1+b-k-1)//2))
    else:
      print(k+1)
  else:
    if a+k+1<=n:
      print(k+1+abs(a+k+1-(n+a+k+1)//2))
    else:
      pritn(k+1)

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

int main(void) {
    string s[3];

    cin >> s[0] >> s[1] >> s[2];

    if((s[0][s[0].size()-1] == s[1][0])
        && (s[1][s[1].size()-1] == s[2][0])) {
        cout << "YES\n";
    } else {
        cout << "NO\n";
    }

    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
    int n, m, i, r, x[101] = {}, y[101][101] = {}, c[101] = {};
    scanf("%d %d", &n, &m);
    for( i = 0; i < n; i++ ){
        for( r = 0; r < m; r++ ){
            scanf("%d", &y[i][r]);
        }
    }
    for( i = 0; i < m; i++ ){
        scanf("%d", &x[i]);
    }
    for( i = 0; i < n; i++ ){
        for( r = 0; r < m; r++ ){
            c[i] += x[r] * y[i][r];
        }
        printf("%d\n", c[i]);
    }
    return 0;
}

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

int main() {
	double a, b;

	cin >> a >> b;

	if (a < b) cout << "a < b";
	else if (a > b) cout << "a > b";
	else if (a==b) cout << "a == b";
	cout << endl;

	//system("pause");
	return 0;
}


Measured memory_bytes: 3164
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>
#include<bitset>
#include<cassert>

#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,b) for (int (i)=a;(i)<(b);(i)++)
#define all(x) (x).begin(),(x).end()

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;



void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(vector<long long int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}

int ok(int n,vector<int> &d){
	while(n){
		int a = n % 10;
		if(count(all(d),a))
			return false;
		n = n / 10;
	}
	return true;
}

int main()
{
	int n,k;
	cin >> n >> k;
	vector<int> d(k);
	rep(i, k) cin >> d[i];
	while(1){
		if(ok(n,d)){
			cout << n << endl;
			return 0;
		}
		n++;
	}

	return 0;
}

Measured memory_bytes: 3608
#include<stdio.h>

int main(void){
int S,h,m,s;
int minute;
scanf("%d",&S);

if(0>S||86400<=S)
printf("Too Large\n");


minute = S/60;

h = minute / 60;

m = minute % 60;

s = S % 60;

printf("%d:%d:%d\n",h,m,s);



}

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

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


#define rep(i,n) for(ll (i)=0; (i)<(ll)(n); (i)++)
#define frep(i,m,n) for(ll (i)=(m); (i)<=(ll)(n); (i)++)
#define rrep(i,n) for(ll (i)=(n)-1; (i)>-1; (i)--)
#define frrep(i,m,n) for(ll (i)=(n); (i)>(ll)(m); (i)--)
#define ALL(x) (x).begin(), (x).end()

const ll INF = 100100100100100100;
const ll MOD = 1000000007;

// get abs
ll my_abs(ll a);
// a^n
ll a_n(ll a, ll n);
// get gcd
ll my_gcd(ll a, ll b);
// a^(-1) % MOD 
ll inv(ll a);

int main() {
    ll n;
    cin >> n;
    ll dp[105][5][5][5];
    rep(i, n+1) rep(j, 5) rep(k, 5) rep(l, 5) dp[i][j][k][l] = 0;

    dp[0][0][0][0] = 1;
    rep(x, n) {
        rep(i, 5) {
            rep(j, 5) {
                rep(k, 5) {
                    frep(l, 1, 4) {
                        // "GAC"
                        if(j == 2 && k == 1 && l == 3) continue;
                        // "ACG"
                        if(j == 1 && k == 3 && l == 2) continue;
                        // "A?GC"
                        if(i == 1 && k == 2 && l == 3) continue;
                        // "AG?C"
                        if(i == 1 && j == 2 && l == 3) continue;
                        // "AGC"
                        if(j == 1 && k == 2 && l == 3) continue;
                        dp[x+1][j][k][l] += dp[x][i][j][k];
                        dp[x+1][j][k][l] %= MOD;
                    }
                }
            }
        }
    }
    ll ans = 0;
    frep(i, 1, 4) {
        frep(j, 1, 4) {
            frep(k, 1, 4) {
                ans += dp[n][i][j][k];
                ans %= MOD;
            }
        }
    }
    cout << ans << endl;
    return 0;
}

ll my_abs(ll a) {
    if(a >= 0) return a;
    else return -1 *a;
}

ll a_n(ll a, ll n) { 
    if(n == 0) return 1;
    
    ll ret = a, count = 1;
    while(count * 2 < n) {
        ret *= ret;
        ret %= MOD;
        count *= 2;
    }
    if(count == n) return ret;
    else return (ret * a_n(a, n-count))%MOD;
}

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

ll inv(ll a) {
    return a_n(a, MOD-2);
}



Measured memory_bytes: 384
#include <iostream>
#include<algorithm>
int a[101];
using namespace std;
int main()
{
	int n;
	while (cin >> n)
	{
		int m = 0;
		for (int i = 0; i < n; i++)
		{
			cin >> a[i];
		}
		sort(a, a + n);
		if (a[0] == a[n - 1])
			cout << m << endl;
		else
		{
			m = 1e9;
			int x = 0;
			for (int i = a[0]; i < a[n - 1]; i++)
			{
				x = 0;
				for (int j = 0; j < n; j++)
				{
					x += (i - a[j]) * (i - a[j]);
				}
				if (x < m)
					m = x;
			}
			cout << m << endl;
		}
	}
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
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){return b?gcd(b,a%b):a;}
const LL mod=1000000007;
const LL LINF=1LL<<62;
const int INF=1<<30;
int dx[]={1,0,-1,0,1,-1,1,-1};
int dy[]={0,1,0,-1,1,-1,-1,1};


int main(){
    string s;cin >> s;
    LL sum = 0;
    for (int i = 0; i < s.length(); i++) {
        sum += s[i] - '0';
    }
    if(sum % 9 == 0) puts("Yes");
    else puts("No");
    return 0;
}



Measured memory_bytes: 3724
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <bitset>
#include <string>
#include <cmath>
#include <complex>
#include <numeric>
#include <cassert>

#include <vector>
#include <array>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <deque>
#include <utility>

#define PI 3.14159265358979323846
#define int64 long long
#define uint64 unsigned long long
#define coutfix(i) cout << fixed << setprecision(i)		//coutの浮動小数出力の桁数設定
using namespace std;

int main()
{
	int64 kk, ii, nana = 7;
	cin >> kk;
	if(kk % 2 == 0)
	{
		cout << -1 << endl;
		return 0;
	}
	for(int64 ii = 1;ii < 1e8;ii++)
	{
		if(nana % kk == 0)
		{
			cout << ii << endl;
			return 0;
		}
		nana *= 10;
		nana += 7;
		nana %= kk;
	}
	cout << -1 << endl;
	return 0;
}

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

int main() {
    int N;
    cin >> N;
    vector<int>a(N);
    for(int i = 0; i < N; i++) {
        cin >> a[i];
    }
    int X = 1;
    for(int i = 0; i < N; i++) {
        if(a[X-1] == 2) {
            cout << i+1 << endl;
            return 0;
        }
        else {
            X = a[X-1];
        }
    }
    cout << -1 << endl;
}



Measured memory_bytes: 640
#include <iostream>
#include <math.h>

using namespace std;

struct Point {
    double x = 0, y = 0;
};

void koch(int d, Point p1, Point p2) {
    if(d == 0) return;
    Point s, t, u;
    double th = M_PI * 60.0 / 180.0;
    s.x = (2 * p1.x + p2.x) / 3.0;
    s.y = (2 * p1.y + p2.y) / 3.0;
    t.x = (p1.x + 2 * p2.x) / 3.0;
    t.y = (p1.y + 2 * p2.y) / 3.0;
    u.x = (t.x - s.x) * cos(th) - (t.y - s.y) * sin(th) + s.x;
    u.y = (t.x - s.x) * sin(th) + (t.y - s.y) * cos(th) + s.y;
    koch(d-1, p1, s);
    cout << s.x << " " << s.y << endl;
    koch(d-1, s, u);
    cout << u.x << " " << u.y << endl;
    koch(d-1, u, t);
    cout << t.x << " " << t.y << endl;
    koch(d-1, t, p2);
}

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

    Point p1, p2;
    p2.x = 100.0;

    std::cout << std::fixed;
    cout << p1.x << " " << p1.y << endl;
    koch(n, p1, p2);
    cout << p2.x << " " << p2.y << endl;
}


Measured memory_bytes: 3304
object Main extends App {
	val Array(a, b) = scala.io.StdIn.readLine.split(" ")

	val ans = (a, b) match {
		case ("H", "H") => "H"
		case ("H", "D") => "D"
		case ("D", "H") => "D"
		case ("D", "D") => "H"
	}

	println(ans)
}


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

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	int d, t, s;
	cin >> d >> t >> s;
	if(s * t >= d) {
		cout << "Yes\n";
	}
	else
		cout << "No\n";
}


Measured memory_bytes: 3656
#include<iostream>
#include<climits>
#include<math.h>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<stdio.h>
#include <string>
#include <complex>
#include <functional>
#include <map>
using namespace std;
using ll = long long;
//typedef pair<string,string> P;
//double dat[100][100];
//int dp[6][1010];//動的計画法
//int prime[100001];
//char str[1010][1010];
//vector<pair<int,int> > pc[100001];
//int ABS(int a){return max(a,-a);}
int main(){
	string s;
	cin>>s;
	s[3]='8';
	cout<<s<<endl;
	return 0;
}

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

int main()
{
    int n, p;
    string s;
    cin >> n;
    vector<pair<pair<string, int>, int>> w(n);
    rep(i, n)
    {
        cin >> s >> p;
        w[i] = make_pair(make_pair(s, -1 * p), i + 1);
    }
    sort(w.begin(), w.end());
    rep(i, n) cout << w[i].second << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
#define MSV(A,a) memset(A, a, sizeof(A))
#define MP make_pair
#define PB push_back
#define INF (int(1e9))
#define INFL (LL(1e18))
#define EPS 1e-12
#define chkbit(s, b) (s & (1<<b))
#define setbit(s, b) (s |= (1<<b))
#define chk(a) cerr << endl << #a << " : " << a << endl
#define chk2(a,b) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << endl
#define chk3(a,b,c) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << endl
#define chk4(a,b,c,d) cerr << endl << #a << " : " << a << "\t" << #b << " : " << b << "\t" << #c << " : " << c << "\t" << #d << " : " << d << endl
#define rep(i, a, n) for(i=a;i<n;i++)
#define rev(i, a, n) for(i=a;i>=n;i--)
#define rep_itr(itr, c) for(itr = (c).begin(); itr != (c).end(); itr++)
#define MOD 1000000007
#define MAX 100005
#define in(x) scanf("%d", &x)
#define inl(x) scanf("%lld", &x)
#define in2(x, y) scanf("%d %d", &x, &y)
#define inl2(x, y) scanf("%lld %lld", &x, &y)
typedef pair<int, int> pi;
typedef pair<LL, LL> pl;
const char en = '\n';


int main() {

	int n, i, ans = 0;

	string s;
	cin>>s;

	if(s[0] == 'R') {
		ans = 1;

		if(s[1] == 'R') {

			if(s[2] == 'R') {
				ans = 3;
			} else ans = 2;
		}
		
	} else if(s[1] == 'R') {

		if(s[2] == 'R') ans =2 ;
		else ans = 1;
	
	} else if (s[2] == 'R') {
		ans = 1;
	}

	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 3616
import java.io.*;

public class Main {
    public static void main (String[] args) throws Exception {
        BufferedReader reader =
            new BufferedReader (new InputStreamReader (System.in));
        String S = reader.readLine();
        boolean flg =
            S.charAt (2) == S.charAt (3) && S.charAt (4) == S.charAt (5);
        System.out.println (flg ? "Yes" : "No");
    }
}

Measured memory_bytes: 21204
#include <iostream>
#include <vector>
#include <string>
#include <tuple>
#include <algorithm>
#include <numeric>
#include <climits>
#include <map>
#include <functional>
#include <cmath>
#include <cassert>
#include <set>

using namespace std;

template<typename T>inline T get(){T x;cin>>x;return x;}

int main()
{
    int n = get<int>();
    int d = get<int>();
    cout << (int)ceil((double)n / (d * 2 + 1)) << endl;;
    return 0;
}

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

typedef long long STATES;

int main( void )
{
	STATES free_days[31], dp[51], goal_state, next;
	register int i, j;
	int n, answer, free_day, k;

	while ( scanf( "%d", &n ) == 1 && n )
	{
		memset( free_days, 0, sizeof(free_days) );
		memset( dp, 0, sizeof(dp) );

		goal_state = 0;
		for ( i = 0; i < n; i++ ) goal_state |= 1LL << i;

		for ( i = 0; i < n; i++ )
		{
			scanf( "%d", &k );
			for ( j = 0; j < k; j++ )
			{
				scanf( "%d", &free_day );
				free_days[free_day] |= 1LL << i;
			}
		}

		answer = -1;
		for ( i = 0; i < n; i++ ) dp[i] = 1LL << i;
		for ( i = 1; i <= 30; i++ )
		{
			next = 0;
			for ( j = 0; j < n; j++ ) if ( free_days[i] & 1LL << j ) next |= dp[j];
			if ( next == goal_state )
			{
				answer = i;
				break;
			}
			for ( j = 0; j < n; j++ ) if ( free_days[i] & 1LL << j ) dp[j] |= next;
		}

		printf( "%d\n", answer );
	}

	return 0;
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxx = 1e5 + 7;
const int Inf = 1 << 30;
char s[15];
int l;
ll res;

void Dfs(int pos, ll last, ll sum) {
	if(pos >= l + 1) {
		res += sum + last; 
		return ;
	}
	Dfs(pos + 1, last * 10 + s[pos] - '0', sum); 
	Dfs(pos + 1, 0, sum + last); 
}

int main() {
	scanf("%s", s + 1);
	l = strlen(s + 1);
	Dfs(1, 0, 0);
	printf("%lld\n", res);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n)for (int i=0;i<(n);i++)
#define PB push_back
#define MP make_pair
#define ALL(a) (a).begin(),(a).end()
#define ll long long
using namespace std;
int main(){
    ll a,b,c;
    cin>>a>>b>>c;
    for(int i=0;i<10000000;i++){
        if(c%(a+b)<=a){
            cout<<c<<endl;
            return 0;
        }
        c+=60;
    }
    cout<<-1<<endl;
}

Measured memory_bytes: 3100
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define pi 3.1415926535898
#define ll long long
#define int long long
typedef std::pair<long long,long long> pll;
typedef std::pair<int,int> pii;
typedef std::vector<int> vi;
typedef std::vector<long long> vll;
typedef double db;
const ll mod=1e9+7;
ll powmod(ll a,ll b,ll p){ll res=1;a%=p;while(b){if(b&1) res=res*a%p;a=a*a%p;b>>=1;}return res;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
signed main()
{
    int t=1;
    //cin>>t;
    while (t--){
        int x,y;
        cin>>x>>y;
        if(y<x*2||y>x*4||y%2==1) cout<<"No"<<endl;
        else cout<<"Yes"<<endl;
    }
}

Measured memory_bytes: 3592
#include<iostream>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<set>
#include<list>
#include<iomanip>
#include<vector>
#include<functional>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
#define int long long
#define rep(i,a,n) for (int (i)=(a);(i)<(n);(i)++)
using namespace std;
#define hash hush
typedef long long ll;
typedef long double ld;
int a[26];
signed  main() {
	string s;
	cin >> s;
	for (int i = 0; i < s.size(); i++) {
		a[(int)s[i] - 'a']++;
	}
	for (int i = 0; i < 26; i++) {
		if (a[i] >= 2) {
			cout << "no\n";
			return 0;
		}
	}
	cout << "yes\n";
	getchar(); getchar();
}

Measured memory_bytes: 256
package main
 
import "fmt"
 
func main() {
  var l,r,d int
  fmt.Scan(&l,&r,&d)
  var c int
  for {
    if l > r {
      break
    } else if (l % d) == 0 {
      c++
    }
    l++
  }
  fmt.Println(c)
}


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

using ll = long long;
const ll mod = 998244353;
using namespace std;

#define int ll
struct node{
    ll val = 0;
    ll lz = 0;
} st[8000001];

void push(int p,int l = 0,int r = 0){
    st[p].val %= mod;
    st[p].val += st[p].lz * (r - l + 1);
    st[p].val %= mod;
    st[p*2].lz += st[p].lz;
    st[p*2].lz %= mod;
    st[p*2+1].lz += st[p].lz;
    st[p*2+1].lz %= mod;
    st[p].lz = 0;
}
void update(int p,int l,int r,int i,int j,ll val){
    push(p);
    if(r < i || j < l) return;
    if(i <= l && r <= j){
        st[p].lz = val;
        push(p,l,r);
    }else{
        int m = (l+r)/2;
        update(p*2,l,m,i,j,val);
        update(p*2+1,m+1,r,i,j,val);
    }
}

int qry(int p,int l,int r,int i){
    push(p);
    if(l == r){
        return st[p].val;
    }else{
        int m = (l+r)/2;
        if(i <= m){
            return qry(p*2,l,m,i);
        }else{
            return qry(p*2+1,m+1,r,i);
        }
    }
}

signed main(){
    int n,k;
    cin >> n >> k;
    vector<pair<int,int>> segs;
    while(k--){
        int l,r;
        cin >> l >> r;
        segs.emplace_back(l,r);
    }
    update(1,0,n-1,0,0,1);
    for(int i = 0; i < n-1; i++){
        for(auto p: segs){
            int l,r;
            l = p.first; r = p.second;
            if(i + l < n){
                update(1,0,n-1,i+l,min(n-1,i+r),qry(1,0,n-1,i)%mod);
            }
        }
    }
    cout << qry(1,0,n-1,n-1);
}


Measured memory_bytes: 20012
#include<stdio.h>
int main(void){
  long int l,i,sum=0;
  scanf("%ld",&l);
  for(i=1;i<=l;i++){
    if(i%15==0){
      continue;
    }else if(i%5==0||i%3==0){
      continue;
    }else{
      sum+=i;
    }
  }
  printf("%ld",sum);
  return 0;
}

Measured memory_bytes: 1732
/**-------------------------
|--------From A.R.A--------|
-------------------------**/
#include <bits/stdc++.h>

#define ll long long int
#define ull unsigned long long int
#define FOR(i,n) for(ll i=0;i<n;i++)
#define input (a,i,n)for(ll i=0;i<n;i++){      cin>>a[i];}
#define output(a,i,n)for(ll i=0;i<n;i++){cout<<a[i]<<" ";}
#define pb push_back
#define sz(c) (c).size()
#define vi vector <int>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define sall(c) sort((c).begin(),(c).end())
#define rsall(c) sort((c).rbegin(),(c).rend())
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
int64_t TN=1;
using namespace std;
void  solution(){
    int64_t n,mx=0,s=0;
    cin>>n>>mx;
    for(int64_t i=1,x;i<n;i++){
        cin>>x;
        if(x<mx){s+=mx-x;}
        else{mx=max(mx,x);}
    }
    cout<<s<<endl;
}

int main()
{
    //cout<<'0'-0<<endl;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    //cin>>TN;
    while(TN--){
        solution();
    }
    return 0;
}


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

int main()
{
	long long n,s=0;
	cin>>n;
	int a[n];
	for(long long i=0;i<n;i++)
	{
		cin>>a[i];
	}
	for(long long i=1;i<n;i++)
	{
		if(a[i-1]>a[i])
		{
			s+=a[i-1]-a[i];
			a[i]=a[i-1];
		}
	}
	cout<<s;
	return 0;
}

Measured memory_bytes: 4368
# 
import sys

from sys import stdin
input = lambda: stdin.readline().rstrip()


N = int(input())
AC = 'AC'
WA = 'WA'
TLE = 'TLE'
RE = 'RE'
ac = 0
wa = 0
tle = 0
re = 0
for i in range(N):
    s = input()
    if s == AC:
        ac += 1
    elif s == WA:
        wa += 1
    elif s == TLE:
        tle += 1
    else:
        re += 1

print('AC x ' + str(ac))
print('WA x ' + str(wa))
print('TLE x ' + str(tle))
print('RE x ' + str(re))


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

int main() {
    int k;
    string s;
    cin >> k;
    cin >> s;

    if (s.size() <= k) cout << s << endl;
    else {
        s.erase(k);
        cout << s << "..." << endl;
    }
}

Measured memory_bytes: 3628
#include <bits/stdc++.h>
#define FOR(i, begin, end) for(int i=(begin);i<(end);i++)
#define REP(i, n) FOR(i,0,n)
#define IFOR(i, begin, end) for(int i=(end)-1;i>=(begin);i--)
#define IREP(i, n) IFOR(i,0,n)
#define SORT(a) sort(a.begin(), a.end())
#define REVERSE(a) reverse(a.begin(), a.end())
#define Lower_bound(v, x) distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x) distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define int long long
#define INF 1000000000000000000
using namespace std;

typedef vector<int> vec;
typedef vector<vec> mat;
typedef pair<int, int> Pii;

template<typename T>
void readv(vector<T> &a){ REP(i, a.size()) cin >> a[i]; }
void readi(vector<int> &a){ REP(i, a.size()){cin >> a[i]; a[i]--;} }



signed main(){

    string S; cin >> S;
    REVERSE(S);

    string s[4] = {"dream", "dreamer", "erase", "eraser"};
    REP(i, 4) REVERSE(s[i]);

    bool ans = true;
    int n = 0;
    while(n < S.size()){
        bool tmp = false;
        REP(i, 4){
            if(n + s[i].size() <= S.size() && S.substr(n, s[i].size()) == s[i]){
                tmp = true;
                n += s[i].size();
                break;
            }
        }
        if(!tmp){
            ans = false;
            break;
        }
    }
    if(ans) cout << "YES";
    else cout << "NO";
    
    return 0;
}

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

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

    int x; cin >> x;
    for (int t = 1; t < x + 1; ++t) {
        if (t * (t + 1) / 2 >= x) {
            cout << t << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
import java.util.Scanner;
 
public class Main{
public static void main(String[] args){
	Scanner sc = new Scanner(System.in);
	String output = "Three";
 
    // 個数の入力
	int num = sc.nextInt();
 
	String[] color = new String[num];
	// 色の入力
	for(int i = 0; i < num;i++ ) {
		color[i] = sc.next();
	}
 
	sc.close();
 
	for(int i = 0;i<num;i++) {
		if(color[i].equals("Y")) {
			output = "Four";
			break;
		}
	}
 
	System.out.println(output);
}
}

Measured memory_bytes: 21844
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define LI list<int>
#define vct vector
#define vi vct<int>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vvi vct<vi>
#define vll vct<ll>
#define vvll vct<vll>
#define vpii vct<pii>
#define vpll vct<pll>
#define all(a) a.begin(),a.end()
#define mp(a,b) make_pair(a,b)
#define pb push_back
#define ff first
#define ss second
#define bg begin()
#define ft cout<<"for test"<<endl;
#define read(v,a,n) for(int i=a; i<n; i++)cin>>v[i];
#define print(v) for(auto it:v)cout<<it<<endl;
#define PI 2*acos(0.0)
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define yes cout<<"Yes"<<endl
#define no cout<<"-1"<<endl
#define FIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define t_c int test,cs=1;cin>>test;while(test--)
///................Graph's Move.................
///const int dx[] = {+1,-1,+0,+0}; ///Rock's Move
///const int dy[] = {+0,+0,+1,-1}; ///Rock's Move
///const int dx[] = {+0,+0,+1,-1,-1,+1,-1,+1}; ///King's Move
///const int dy[] = {-1,+1,+0,+0,+1,+1,-1,-1}; ///king's Move
///const int dx[] = {-2,-2,-1,-1,+1,+1,+2,+2}; ///knight's Move
///const int dy[] = {-1,+1,-2,+2,-2,+2,-1,+1}; ///knight's Move
///*.....................-_-........................*///
int main()
{
    FIO;
    ll n,w,i,j;
    cin>>n>>w;
    vll _cost(n+1),wt(n+1);
    for(i=1; i<=n; i++)
        cin>>wt[i]>>_cost[i];
    ll cost=0;
    for(auto it:_cost)
        cost+=it;
    ll mod=1000000000000;
    vvll dp(n+1, vll (cost+1,mod));
    for(i=0; i<=n; i++)dp[i][0]=0;
    for(i=1; i<=n; i++)
    {
        for(j=1; j<=cost; j++)
        {
            ll p1 = dp[i-1][j];
            ll p2 = (_cost[i]<=j)? dp[i-1][j-_cost[i]]+wt[i]:mod;
            dp[i][j] = min(p1,p2);
        }
    }
    ll ans=0;
    for(i=0; i<=cost; i++)
    {
        if(dp[n][i]<=w)
            ans=i;
    }
    cout<<ans<<endl;
}
/**
3 8
3 30
4 50
5 60
**/


Measured memory_bytes: 83120