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

#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << ": " << arg1 << endl;
}
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 << "\t|";
    __f(comma + 1, args...);
}


#define print(x) for(auto it : x) cout<< it << ' '; cout << '\n';
typedef long long ll;
typedef unsigned long long ull;

const int MOD = 1e9 + 7;
ll mod(ll a) { return (ll) (a % MOD + MOD) % MOD; }
ll mul(ll a, ll b) { return (ll) mod(mod(a) * mod(b));}

int w[100];
int v[100];
ll INF = 1e15;

ll dp[100][100001];

int main() {
    ios::sync_with_stdio(false); cin.tie(0);
    int N, W; cin >> N >> W;
    for (int i = 0; i < N; i++)
        cin >> w[i] >> v[i];
    
    std::fill(dp[0], dp[0] + 100 * 100001, INF);
    
//    for (int i = 0; i < N; i++) {
//        print(dp[i]);
//    }
    
    dp[0][0] = 0;
    dp[0][v[0]] = w[0];
    for (int i = 1; i < N; i++) {
        dp[i][0] = 0;
        for (int j = 1; j < 100001; j++) {
            // leave it
            dp[i][j] = dp[i - 1][j];
            
            // take it
            if (j >= v[i])
                dp[i][j] = min(dp[i][j], w[i] + dp[i - 1][j - v[i]]);
        }
    }
    
//    for (int i = 0; i < N; i++) {
//        print(dp[i]);
//    }
    
    ll ans = 0;
    for (ll j = 1; j <= 100001; j++) {
        if (dp[N - 1][j] <= W)
//            cout << j << " " << dp[N - 1][j] << " ";
            ans = max(ans, j);
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 81784
fun main(args: Array<String>) {
    val A = next()
    val B = next()
    val C = next()
    val al = A.length
    val bl = B.length
    val cl = C.length
    val M = 2000
    val ab = BooleanArray(100000)
    val ac = BooleanArray(100000)
    val bc = BooleanArray(100000)
    fun match(c1: Char, c2: Char) = c1 == c2 || c1 == '?' || c2 == '?'
    for (i in 0 until al)
        for (j in 0 until bl)
            if (!match(A[i], B[j])) ab[i - j + 50000] = true
    for (i in 0 until al)
        for (j in 0 until cl)
            if (!match(A[i], C[j])) ac[i - j + 50000] = true
    for (i in 0 until bl)
        for (j in 0 until cl)
            if (!match(B[i], C[j])) bc[i - j + 50000] = true
    var ans = 3 * M
    for (i in -2 * M .. 2 * M)
        for (j in -2 * M .. 2 * M)
            if (!ab[i + 50000] && !ac[j + 50000] && !bc[j - i + 50000]) {
                val L = Math.min(0, Math.min(i, j))
                val R = Math.max(al, Math.max(bl + i, cl + j))
                ans = Math.min(ans, R - L)
            }
    println(ans)
}
fun Long.isEven() = (this % 2L) == 0L
fun Long.isOdd() = !this.isEven()
fun next() = readLine()!!
fun nextInt() = Integer.parseInt(next())
fun nextInt(offset: Int = 0) = nextInt() + offset
fun nextLong() = java.lang.Long.parseLong(next())
fun nextLong(offset: Long = 0L) = nextLong() + offset
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() = listOfString().map { Integer.parseInt(it) }
fun listOfInt(offset: Int = 0) = listOfString().map { Integer.parseInt(it) + offset }
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }
fun listOfLong(offset: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + offset }
fun listOfDouble() = listOfString().map { it.toDouble() }


Measured memory_bytes: 34600
#include <queue>
#include <stack>
#include <map>
#include <algorithm>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <complex>
typedef long long int LL;
using namespace std;

// 插入此處

bool is_palin(char *s, int n) {
    for (int i = 0; i < n / 2; i++) {
        if (s[i] != s[n - 1 - i]) {
            return false;
        }
    }
    return true;
}

int main() {
    char s[100];
    scanf("%s", s);
    int n = strlen(s);
    int l_len = (n - 1) / 2;
    int r_len = n - l_len - 1;
    if (is_palin(s, n) && is_palin(s, (n - 1) / 2) && is_palin(s + l_len + 1, r_len)) {
        printf("Yes\n");
    } else {
        printf("No\n");
    }
}


Measured memory_bytes: 128
n, k = map(int, input().split())
s = input()

s = '1' + s + '1'

cnt_1 = []
cnt_0 = []
stack_1 = 0
stack_0 = 0
for i in s:
    if i == '1':
        if stack_0 > 0:
            cnt_0.append(stack_0)
            stack_0 = 0
        stack_1 += 1
    else:
        if stack_1 > 0:
            cnt_1.append(stack_1)
            stack_1 = 0
        stack_0 += 1
if stack_1 > 0:
    cnt_1.append(stack_1)

if len(cnt_1) == 0 or len(cnt_0) == 0:
    print(n)
    exit()
cnt_1[0] -= 1
cnt_1[-1] -= 1

if k > len(cnt_0):
    k = len(cnt_0)
cum_1 = [sum(cnt_1[:k+1])]
cum_0 = [sum(cnt_0[:k])]
for i in range(1, len(cnt_1)-k):
    cum = cum_1[i-1] + cnt_1[i+k] - cnt_1[i-1]
    cum_1.append(cum)
for i in range(1, len(cnt_0)-k+1):
    cum = cum_0[i-1] + cnt_0[i+k-1] - cnt_0[i-1]
    cum_0.append(cum)
res = []

for v, w in zip(cum_1, cum_0):
    res.append(v+w)
print(max(res))

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    ll D, N;
    cin >> D >> N;

    ll ans = 1;
    for (ll i = 0; i < D; i++) {
        ans *= 100;
    }

    if (N == 100) N = 101;

    ans *= N;

    cout << ans << endl;

    return 0;
}

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

using namespace std;

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

typedef long l;

l gcd(l a, l b){
 while(a%b){
  l r=a%b;
   a=b;
   b=r;
 }
return b;
}


int main(){
  l n,x;
  cin >> n >> x;
  
  cout << 3*(n-gcd(n,x)) << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <fstream>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <stack>
#include <queue>
#include <complex>
#include <set>
#include <list>
#include <iomanip>
#include <map>
#include <memory.h>



using namespace std;
static const double EPS = 1e-9;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define all(c) (c).begin(), (c).end()
#define zero(a) memset(a,0,sizeof(a))
#define minus(a) memset(a,0xff,sizeof(a))
#define chmax(a,b) a=min((a),(b))
#define chmin(a,b) a=max((a),(b))


#define MOD 1000000007LL

typedef pair<int,int>P;
#define INF (1<<29)
 
struct edge { 
	int from, to; 
	edge (int from, int to){
		this->from=from; this->to=to;
	}
};
 
int V,E;
typedef vector<edge> edges;
vector<edges> G;

int down[100005];
int a[100005];
int cnt[100005];
int l, r;
ll inv[100005];
ll fact[100005];

void factor(ll a) {
	ll ret = 1LL;
	for (ll i = 1; i <= a; i++) {
		ret = ret*i%MOD;
		fact[i] = ret;
	}
	
}

ll beki(ll a, ll p) {
	ll ret = 1LL;
	while (p > 0) {
		if (p & 1) {
			ret = ret*a%MOD;
		}
		a = a*a%MOD;
		p >>= 1;
	}
	return ret;
}

ll comb(ll a, ll b) {//
	if (a < 0 || b < 0 || a < b)return 0LL;
	if (a == b || b == 0)return 1LL;
	ll ret = fact[a]*inv[b]%MOD;
	ret = ret*inv[a - b] % MOD;
	return ret;

}

int main() {
	int n;
	scanf("%d ", &n);
	rep(i, n+1) {//
		scanf("%d ", &a[i]);
		cnt[a[i]]++;
		if (cnt[a[i]] == 2) {
			r = i;
		}

	}

	rep(i,n+1){
		if (a[i] == a[r]) {
			l = i;
			break;
		}
	}
	l++; r++;
	fact[0] = 1;//
	factor(n + 1);//


	inv[0] = 1;//
	FOR(i, 1, n + 1) {
		inv[i] = beki(fact[i], MOD - 2);
	}
	
	FOR(i,1,n+1) {
		printf("%lld\n", (comb(n + 1, i) + MOD - comb(n - r + l, i - 1)) % MOD);

	}
	return 0;
}


Measured memory_bytes: 3712
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cmath>
#include <tuple>
#define rep(i, n) for(i = 0; i < n; i++)
using namespace std;

signed main() {
	string s;
	cin >> s;
	
	if (s == "SUN") cout << 7 << endl;
	if (s == "MON") cout << 6 << endl;
	if (s == "TUE") cout << 5 << endl;
	if (s == "WED") cout << 4 << endl;
	if (s == "THU") cout << 3 << endl;
	if (s == "FRI") cout << 2 << endl;
	if (s == "SAT") cout << 1 << endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAXN=1e5+5;
const int MOD=1e9+7;
int n;char c[MAXN];
long long ans,f[MAXN],r[MAXN];
long long A[MAXN],C[MAXN];
long long FA[MAXN],FC[MAXN];
void Init(){
	f[0]=r[0]=1;
	for(int i=1;i<=n;i++){
		r[i]=(r[i-1]*i)%MOD;
		f[i]=(f[i-1]*3)%MOD;
	}
	r[0]=0;
}
long long Get(int x){
	/*long long ret=(A[x-1]*C[x+1])%MOD;
	ret=(ret+((r[FA[x-1]]*C[x+1])%MOD))%MOD;
	ret=(ret+((r[FC[x+1]]*A[x-1])%MOD))%MOD;
	ret=(ret+((r[FA[x-1]]*r[FC[x+1]])%MOD))%MOD;*/
	long long ret=0;
	ret=(ret+((((A[x-1]*C[x+1])%MOD)*f[FA[x-1]+FC[x+1]])%MOD))%MOD;
	ret=(ret+((((FA[x-1]*FC[x+1])%MOD)*f[FA[x-1]+FC[x+1]-2])%MOD))%MOD;
	ret=(ret+((((FA[x-1]*C[x+1])%MOD)*f[FA[x-1]+FC[x+1]-1])%MOD))%MOD;
	ret=(ret+((((FC[x+1]*A[x-1])%MOD)*f[FA[x-1]+FC[x+1]-1])%MOD))%MOD;
	return ret;
}
int main(){
	scanf("%s",c+1);
	n=strlen(c+1);Init();
	for(int i=1;i<=n;i++){
		A[i]=A[i-1];FA[i]=FA[i-1];
		if(c[i]=='A')A[i]++;
		if(c[i]=='?')FA[i]++;
	}
	for(int i=n;i>=1;i--){
		C[i]=C[i+1];FC[i]=FC[i+1];
		if(c[i]=='C')C[i]++;
		if(c[i]=='?')FC[i]++;
	}
	for(int i=1;i<=n;i++)
		if(c[i]=='B'||c[i]=='?')
			ans=(ans+Get(i))%MOD;
	printf("%lld\n",ans);
}

Measured memory_bytes: 4992
import Control.Applicative ((<$>), (<*>))
import Control.Monad
import Data.List
import qualified Data.Map as M

main :: IO ()
main = do
  n <- getl toInt
  solve <$> replicateM n (getl words) >>= mapM_ putStrLn

solve :: [[String]] -> [String]
solve = map h . sortBy g . M.assocs . foldl (\mp (k,a) -> M.insertWith (+) k a mp) M.empty . map f
  where
    f [x,y] = (x, toInt y)
    g (x,_) (y,_)
      | length x == length y  = x `compare` y
      | otherwise = length x `compare` length y
    h (x,y) = x ++ " " ++ show y

toInt :: String -> Int
toInt = read

getl :: (String -> a) -> IO a
getl f = f <$> getLine

Measured memory_bytes: 12356
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
template<class T, class U> inline bool chmax(T& a,U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a,U b) { if (a > b) { a = b; return 1; } return 0; }

int main() {
    long long n, a, b;
    cin >> n >> a >> b;
    long long c = a + b;
    long long ans = (n/c) * a + min(a, n % c);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int N,K;
    cin >> N >> K;
    int l[N];
    long long sum=0;
    for (int i=0 ; i<N ; i++){
        cin >> l[i];
        }
    sort(l,l+N);
    for (int s=N-K ; s<N;s++){
        sum=sum+l[s];
        }
    cout << sum << endl;
    
         
    
return 0;}

Measured memory_bytes: 256
// C - Reconciled?
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define MOD 1000000007

ll factorial_mod(ll n){
	ll ans = n;
	while(n>1) ans = ans * --n % MOD;
	return ans;
}

ll calc(ll N, ll M){
	if(abs(N - M) > 1) return 0;
	ll ans =  factorial_mod(N);
	if(N == M) ans = ans * ans % MOD * 2;
	else ans = ans * factorial_mod(M);
	return ans % MOD;
}

int main(){
	ll N,M; cin>>N>>M;
	cout<< calc(N, M) <<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define all(v) (v).begin(),(v).end()
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> 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; }
typedef pair<int, int> P;
typedef long long ll;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;
const ll MOD = 1e9+7;

bool isprime(int p) {
    if (p==1) return false;
    for (int i = 2; i < p; i++) {
        if (p%i == 0) return false;
    }
    return true;
}
int main() {
	int n;
	cin >> n;
    for (int i = 11; i <= 55555; i += 10) {
        if (isprime(i)) {
            if (i != 11) cout << ' ';
            cout << i;
            n--;
        }
        if (n == 0) break;
    }
	cout << endl;
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int a[50][50];
int n,d;

bool cal(int x,int y)
{
    int num=0;
    for(int i=1;i<=d;i++)
    {
        num+=(a[x][i]-a[y][i])*(a[x][i]-a[y][i]);
    }
    int tt=num;
    int t=sqrt(num);
    if(t*t==tt)
        return 1;
    return 0;
}

int main()
{
    scanf("%d%d",&n,&d);
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=d;j++)
        {
            scanf("%d",&a[i][j]);
        }
    }
    int sum=0;
    for(int i=1;i<=n;i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            if(cal(i,j)) sum++;
        }
    }
    cout<<sum<<endl;

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define pb(a) push_back(a)

typedef long long ll;
using namespace std;

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 dy[] = { 0, 0, 1, -1 };
//const int dx[] = { 1, -1, 0, 0 };
const int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
const int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };
ll gcd(ll a, ll b);
ll lcm(ll x, ll y);

vector<ll> a;
map<ll,ll> m;

int main()
{
	ll r,g,x;
	
	cin >> r >> g;
	x = 2 * g - r;
	cout << x << endl;
	return 0;
}



Measured memory_bytes: 256
n, m, c = map(int, input().split())
b = list(map(int, input().split()))

ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    if sum([a[i] * b[i] for i in range(m)]) + c > 0:
        ans += 1
print(ans)

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

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll a, b;
  cin >> a >> b;
  cout << max(a + b, max(a - b, a * b)) << flush;
  return 0;
}


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



int main() {
  int N,M,fn;//N:元の数　fn:Nの各桁の和
  cin>>N;
  M=N;
  fn=0;
  while(M>0){
    int a;
    a=M%10;
    fn+=a;
    M=(M-a)/10;
  }
  /*ut << fn << endl;*/
  if (N % fn == 0)
  {
    cout << "Yes" << endl;
  }
  else
  {
    cout << "No" << endl;
  }
}  

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

#define PI 3.14159265358979323846264338327950288419

using namespace std;

int n;
char str[4004];
int freq[128];

long long ans = 0;

int main(){
	scanf("%d %s", &n, str + 1);
	for(int i = 1; i <= n; i++){
		freq[str[i]]++;
	}
	ans = 1LL * freq['R'] * freq['G'] * freq['B'];
	// subtract those that violate condition 2
	for(int i = 1; i <= n; i++){
		for(int j = i + 1; j + j - i <= n; j++){
			int k = j + j - i;
			if(str[i] != str[j] && str[i] != str[k] && str[j] != str[k]){
				ans--;
			}
		}
	}
	printf("%lld\n", ans);
	return 0;
}

Measured memory_bytes: 3796
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n) ; ++i)
#define FOR(i,a,b) for(int i = (a); i < (b); ++i)
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define emb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll = long long;
using P = pair<int,int>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

int main() {
  int c[3][3];
  rep(i,3) rep(j,3) cin >> c[i][j];

  int p = c[0][1] - c[0][0];
  if(p != c[1][1] - c[1][0]) {
    Yes(false);
    return 0;
  }
  if(p != c[2][1] - c[2][0]) {
    Yes(false);
    return 0;
  }

  int q = c[0][2] - c[0][1];
  if(q != c[1][2] - c[1][1]) {
    Yes(false);
    return 0;
  }
  if(q != c[2][2] - c[2][1]) {
    Yes(false);
    return 0;
  }

  int r = c[0][0] - c[0][2];
  if(r != c[1][0] - c[1][2]) {
    Yes(false);
    return 0;
  }
  if(r != c[2][0] - c[2][2]) {
    Yes(false);
    return 0;
  }

  if(0!=p+q+r) {
    Yes(false);
    return 0;
  }

  Yes(true);

  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcountll
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC

const int MOD = 1000 * 1000 * 1000 + 7;
int mod(int n) {
    n %= MOD;
    if (n < 0) return n + MOD;
    else return n;
}   
int fp(int a, int p) {
    int ans = 1, c = a;
    for (int i = 0; (1ll << i) <= p; ++i) {
        if ((p >> i) & 1) ans = mod(ans * c);
        c = mod(c * c);
    }   
    return ans;
}   
int dv(int a, int b) { return mod(a * fp(b, MOD - 2)); }


int sum(int n) {
    return dv(mod(n * (n + 1)), 2);
}   

signed main() {
    #ifdef HOME
    freopen("input.txt", "r", stdin);
    #else
    #define endl '\n'
    ios_base::sync_with_stdio(0); cin.tie(0);
    #endif
    int n, k;
    cin >> n >> k;
    vector <int> a(n);
    for (int i = 0; i < n; ++i)
        cin >> a[i];

    int inv = 0;
    for (int i = 0; i < n; ++i)
        for (int j = i + 1; j < n; ++j)
            inv += a[i] > a[j];

    int ans = mod(inv * k);
    for (int i = 0; i < n; ++i) {
        int ls = 0;
        for (int j = 0; j < n; ++j)
            ls += a[j] < a[i];
        ans += sum(k - 1) * ls;                    
        ans = mod(ans);
    }   
    cout << ans << endl;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int ySize = scanner.nextInt();
        int xSize = scanner.nextInt();
        scanner.nextLine();
        int[][] dp = new int[ySize][xSize];
        dp[0][0] = 1;

        for (int y = 0; y < ySize; ++y) {
            String line = scanner.nextLine();
            for (int x = 0; x < xSize; ++x) {
                if (line.charAt(x) == '.') {
                    if (x > 0) {
                        dp[y][x] += dp[y][x - 1];
                    }
                    if (y > 0) {
                        dp[y][x] += dp[y - 1][x];
                    }
                    dp[y][x] %= 1_000_000_007;
                }
            }
        }
        System.out.println(dp[ySize - 1][xSize - 1]);
    }
}


Measured memory_bytes: 37360
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
const ll INF = 1LL << 60;
#define rep(i, a, n) for (ll i = (a); i < (n); i++)
#define debug(x) cerr << #x << ": " << x << endl;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}

int main() {
    ll n;
    cin >> n;
    vector<ll> p(n);
    rep(i, 0, n) cin >> p[i];
    ll ans = 0;
    ll a, b, c;
    rep(i, 1, n-1) {
        a = p[i-1];
        b = p[i];
        c = p[i+1];
        if(a < b && b < c) ans++;
        if(c < b && b < a) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256
a, b, k = map(int, input().split())
A_list = []
for i in range(a, min(a + k, b + 1)):
  A_list.append(i)
for i in range(max(b - k + 1, a), b + 1):
  A_list.append(i)
List_set = sorted(list(set(A_list)))
for num in List_set:
  print(num)

Measured memory_bytes: 38256
import core.bitop, std.algorithm, std.ascii, std.bigint, std.conv, std.math,
    std.functional, std.numeric, std.range, std.stdio, std.string, std.random,
    std.typecons, std.container, std.format;

// dfmt off
T lread(T = long)(){return readln.chomp.to!T();}
T[] aryread(T = long)(){return readln.split.to!(T[])();}
void scan(TList...)(ref TList Args){auto line = readln.split();
foreach (i, T; TList){T val = line[i].to!(T);Args[i] = val;}}
alias sread = () => readln.chomp();enum MOD = 10 ^^ 9 + 7;
alias PQueue = BinaryHeap!(Array!long, "a<b");
// dfmt on

void main()
{
    long a = lread();
    auto s = sread();
    writeln(a < 3200 ? "red" : s);
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>	
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#include<sstream>
#include<iomanip>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
#define shosu(x) fixed<<setprecision(x)
using namespace std;
//kaewasuretyuui
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vp;
typedef vector<vp> vvp;
typedef pair<int,pii> pip;
typedef vector<pip>vip;
const double PI=acos(-1);
const double EPS=1e-8;
const int inf=1e8;
int main(){
	int n,m;
	while(cin>>n>>m,n+m){
		vi a(n+1),b(m+1);
		rep(i,n)cin>>a[i+1];
		rep(i,m)cin>>b[i+1];
		rep(i,n)a[i+1]+=a[i];
		rep(i,m)b[i+1]+=b[i];
		vi sa,sb;
		rep(i,n+1)loop(j,i+1,n+1)sa.pb(a[j]-a[i]);
		rep(i,m+1)loop(j,i+1,m+1)sb.pb(b[j]-b[i]);
		sort(all(sa));
		sort(all(sb));
		int out=0;
		rep(i,sa.size()){
			out+=upper_bound(all(sb),sa[i])-lower_bound(all(sb),sa[i]);
		}
		cout<<out<<endl;
	}
}

Measured memory_bytes: 18904
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define   sz(s)         s.size()
#define   ll            long long int
#define   ull           unsigned ll
#define   ld            long double
#define   print(v)      for(ll i=0;i<v.size();i++)cout<<v[i]<<" "
#define   printpair(v)  for(ll i=0;i<v.size();i++)cout<<v[i].first<<" "<<v[i].second<<"\n"
#define   bmd           1000000007
#define   bmd1          998244353
#define   umll          unordered_map<ll,ll>
#define   mll           map<ll,ll>
#define   mcl           map<char,ll>
#define   pll           pair<ll,ll>
#define   F             first
#define   S             second
#define   setp(x)       setprecision(x)
#define   pb            push_back
#define   all(v)        v.begin(),v.end()
#define   tr(a)         for(auto it=a.begin();it!=a.end();it++)
#define   trr(a)        for(auto it1=a.begin();it1!=a.end();it1++)
#define   vll           vector<long long int>
#define   sorty(v)      sort(v.begin(),v.end())
#define   rsort(v)      sort(v.rbegin(),v.rend())
#define   unik(v)       v.erase(unique(all(v)),v.end())
#define   PI            3.1415926535897932384626
#define   db()          cout<<"\n"<<"here"<<"\n"
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;


//---------------------------------------------------------------------------
const int MOD = bmd;
const int N=2e5+100;
inline  ll sqr(ll x){return x*x;}
inline  void normal(ll &a) { a = (a+MOD)%MOD; }
inline  ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; }
inline  ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; }
inline  ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; }
inline  ll modPow(ll b, ll p) { ll r = 1;b=b%MOD; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; }
inline  ll modInv(ll a) { return modPow(a, MOD-2); }
inline  ll modDiv(ll a,ll b) { return modMul(a, modInv(b)); }
//---------------------------------------------------------------------------
void solve()
{
    ll x;
    cin>>x;
    if(x>=30){
        cout <<"Yes"<<"\n";
    }
    else cout <<"No"<<"\n";
}

int main()
{
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);//first give all input then gives output
    ll t=1;
    //cin>>t;
    while(t--){
        solve();
    }

    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
using namespace std;
int main(){
	int n,pm,pj,pe;
	while(n){
		cin>>n;
		for( int i=0; i<n; i++){
			cin>>pm>>pe>>pj;
			if(pm==100||pj==100||pe==100){
				cout<<"A"<<endl;
			}else if((pm+pe)/2>=90){
				cout<<"A"<<endl;
			}else if((pe+pj+pm)/3>=80){
				cout<<"A"<<endl;
			}
			else if((pm+pj+pe)/3>=70){
				cout<<"B"<<endl;
			}else if((pm+pe+pj)/3>=50&&pm>=80||pe>=80){
				cout <<"B"<<endl;
			}else{
				cout<<"C"<<endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1156
def dfs(tiles, w, h, x, y):
    cnt = 1
    tiles[y][x] = '@'
    for dx,dy in ((0,1), (0,-1), (-1,0), (1,0)):
        if 0<=x+dx<w and 0<=y+dy<h and tiles[y+dy][x+dx]=='.':
            cnt += dfs(tiles, w, h, x+dx, y+dy)
    return cnt

def main():
    while True:
        W,H = [int(x) for x in input().split()]
        if W==0 and H==0:
            exit()
        tiles = [[c for c in input()] for h in range(H)]
        for i in range(H):
            if '@' in tiles[i]:
                Y = i
                X = tiles[i].index('@')
        answer = dfs(tiles, W, H, X, Y)
        print(answer)

if __name__ == '__main__':
    main()

Measured memory_bytes: 6800
#coding:utf-8
import sys
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = lambda *something : print(*something) if DEBUG else 0
DEBUG = False
def main(given = sys.stdin.readline):
    input = lambda : given().rstrip()
    LMIIS = lambda : list(map(int,input().split()))
    II = lambda : int(input())
    XLMIIS = lambda x : [LMIIS() for _ in range(x)]

    N,T = LMIIS()
    people = LMIIS()
    sumtime = T
    pre = people[0]
    for i in range(1,N):
        tmp = people[i]
        sumtime += min(tmp-pre,T)
        pre = tmp
    print(sumtime)

if __name__ == '__main__':
    main()

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

int main(){
    int n;
    cin >> n;
    string s;
    cin >> s;
    int count = 0;
    for(int i = 0; i < n; i++){
        if(s[i]=='A'){
            if(s[i+1]=='B'){
                if(s[i+2]=='C'){
                    count++;
                }
            }
        }
    }
    cout << count;
}

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

class CCombi
{
	public:
		// Public member function
		CCombi(void);
		bool Input(void);
		void InputDataSet(void);
		void PrintCountcombi(void);
		bool CheckPrm(int num, int sum);
		bool CheckEnd(void);
		void CountCombination(void);
	private:
		// Private member variable
		static const int NUM_MAX = 100;
		static const int NUM_MIN = 3;
		static const int SUM_MAX = 300;
		int num;
		int sum;
		int countcombi;
};

CCombi::CCombi(void)
{
	num = 0;
	sum = 0;
	countcombi = 0;
}

bool CCombi::Input(void)
{
	InputDataSet();
	if(CheckPrm(num, sum) == false)
	{
		return false;
	}
	
	return true;
}

void CCombi::InputDataSet(void)
{
	cin >> num >> sum;
	
	return;
}

void CCombi::PrintCountcombi(void)
{
	cout << countcombi << "\n";
	
	return;
}

bool CCombi::CheckPrm(int num, int sum)
{
	if( (num < 0) || (num > NUM_MAX) ||
		(sum < 0) || (sum > SUM_MAX) )
	{
		return false;
	}
	
	return true;
}

bool CCombi::CheckEnd(void)
{
	if( (num == 0) && (sum == 0) )
	{
		return true;
	}
	else{
		countcombi = 0;
	}
	
	return false;
}

void CCombi::CountCombination(void)
{
	for(int i = 1; i <= num - 2; i++){
		for(int j = i + 1; j <= num - 1; j++){
			for(int k = j + 1; k <= num; k++){
				if( (i + j + k) == sum){
					countcombi++;
					break;
				}
			}
		}
	}
	
	return;
}

int main(void)
{
	CCombi combi;
	
	while(1)
	{
		if(combi.Input() == false)
		{
			return -1;
		}
		if(combi.CheckEnd() == true)
		{
			break;
		}
		combi.CountCombination();
		combi.PrintCountcombi();
	}
	
	return 0;
}



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

const int MAX_N = 1e5+10;
int N;
string s;
int L[MAX_N], R[MAX_N];
int ans[MAX_N];

void solve()
{
	N = s.length();
	for(int i=0; i<N; ++i){
		if(s[i] == 'R') R[i]=i;
		else R[i] = R[i-1];
	}
	for(int i=N-1; i>=0; --i){
		if(s[i] == 'L') L[i]=i;
		else L[i] = L[i+1];
	}
	for(int i=0;i<N;++i){
		int x;
		if(s[i] == 'R'){
			const int d = abs(L[i]-i);
			if(d%2==0) x=L[i];
			else x=L[i]-1;
		}else{
			const int d = abs(R[i]-i);
			if(d%2==0) x=R[i];
			else x=R[i]+1;
		}
		ans[x]++;
	}
	for(int i=0;i<N;++i)cout << ans[i] << " ";
	cout << endl;
}

int main()
{
	cin >> s;
	solve();
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#include<iomanip>
#include<numeric>

using namespace std;
using ll = long long;
constexpr int mo = 1e9+7;
constexpr int  mod = mo;
constexpr int inf = 1<<30;
int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(auto &a : v) cin>>a;
    int ret = accumulate(v.begin(),v.end(),0);
    if(ret%10 == 0){
        sort(v.begin(),v.end());
        int sub = 0;
        for(int i=0;i<n;++i){
            if(v[i]%10){
                sub = v[i];
                break;
            }
        }
        if(sub == 0){
            cout << 0 << endl;
            return 0;
        }
        ret -= sub;
    }
    cout << ret << endl; 
    return 0;
}



Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
#include <numeric>
using namespace std;
#define INF (1 << 30) - 1
#define LINF 1LL << 60
const int MOD = 1000000007;
using ll = long long;
using P = pair<int, int>;

ll dp[410][410];

int main(){
  int n;
  cin >> n;
  vector<ll> a(n);
  vector<ll> sum(n + 1);
  for(int i = 0; i < n; ++i){
  	cin >> a[i];
  	sum[i + 1] = sum[i] + a[i];
  }

  for(int i = 1; i < n; ++i){
  	for(int j = 0; j < n - i; ++j){
  		ll tmp = LINF;
  		for(int k = j; k < j + i; ++k){
  			tmp = min(tmp, dp[j][k] + dp[k + 1][j + i]);
  		}
  		dp[j][j + i] = tmp + sum[j + i + 1] - sum[j];
  	}

  }

  cout << dp[0][n - 1] << endl;

  return 0;
}


Measured memory_bytes: 1536
#include <iostream>

int main() {
    int x;
    std::cin >> x;
    if (x >= 400 && x <= 599) {
        std::cout << "8" << std::endl;
    } else if (x >= 600 && x <= 799) {
        std::cout << "7" << std::endl;
    }

    else if (x >= 800 && x <= 999) {
        std::cout << "6" << std::endl;
    }

    else if (x >= 1000 && x <= 1199) {
        std::cout << "5" << std::endl;
    } else if (x >= 1200 && x <= 1399) {
        std::cout << "4" << std::endl;
    } else if (x >= 1400 && x <= 1599) {
        std::cout << "3" << std::endl;
    } else if (x >= 1600 && x <= 1799) {
        std::cout << "2" << std::endl;
    } else if (x >= 1800 && x <= 1999) {
        std::cout << "1" << std::endl;
    }

    return 0;
}


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

int n, m;

int main()
{
  cin >> n >> m;
  vector<vector<int> > A(n, vector<int>(m));
  vector<int> b(m);
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < m; j++)
    {
      cin >> A.at(i).at(j);
    }
  }
  for (int j = 0; j < m; j++)
  {
    cin >> b.at(j);
  }

  for (int i = 0; i < n; i++)
  {
    int c_i = 0;
    for (int j = 0; j < m; j++)
    {
      c_i += A.at(i).at(j) * b.at(j);
    }
    cout << c_i << endl;
  }
}


Measured memory_bytes: 3172
#include <stdio.h>

void swap(int,int);
int gcd(int,int);

int main() {
  int x,y,g;
  scanf("%d%d",&x,&y);
  g = gcd(x,y);
  printf("%d\n",g);
  return 0;
}

int gcd(int x,int y){
  int d;
  while (y>0) {
    d = x%y;
    x = y;
    y = d;
  }
  return x;
}

void swap(int a,int b){
  int temp;
  temp = a;
  a = b;
  b = temp;
}



Measured memory_bytes: 2108
#include <bits/stdc++.h>
#define r(i,n) for(int i=0;i<n;i++)
#define int long long
using namespace std;
typedef pair<int,int>P;
typedef pair<int,P>P2;
#define F first
#define S second

int calc1(string s){
	if(s[0]=='1')return 0;
	int x=1;
	r(i,7){
		if(s[i+1]=='x')x*=2;
	}
	return x;
}

int calc2(string s){
	int y=0;
	string p="110yyyyx10xxxxxx";
	r(i,16){
		if(p[i]=='y'&&(s[i]=='1'||s[i]=='x')) y=1;
		if(isdigit(p[i])&&isdigit(s[i])&&p[i]!=s[i])return 0;
	}
	if( !y )return 0;
	int dp[33][2]={};
	dp[0][0]=1;
	r(i,16){
		r(j,2){
			if(isdigit(p[i])){
				dp[i+1][j] += dp[i][j];
			}
			if(p[i]=='x'){
				int x=(isdigit(s[i])?1:2);
				dp[i+1][j] += dp[i][j]*x;
			}
			if(p[i]=='y'){
				if(s[i]=='1'){
					dp[i+1][1] += dp[i][j];
				}
				if(s[i]=='0'){
					dp[i+1][j] += dp[i][j];
				}
				if(s[i]=='x'){
					dp[i+1][1] += dp[i][j];
					dp[i+1][j] += dp[i][j];
				}
			}
			dp[i+1][j] %= 1000000;
		}
	}
	return dp[16][1];
}

int calc3(string s){
	int y=0;
	string p="1110yyyy10yxxxxx10xxxxxx";
	r(i,24){
		if(p[i]=='y'&&(s[i]=='1'||s[i]=='x')) y=1;
		//cout<<i<<endl;
		if(isdigit(p[i])&&isdigit(s[i])&&p[i]!=s[i])return 0;
	}
	//cout<<y<<endl;
	if( !y )return 0;
	int dp[33][2]={};
	dp[0][0]=1;
	r(i,24){
		r(j,2){
			if(isdigit(p[i])){
				dp[i+1][j] += dp[i][j];
			}
			if(p[i]=='x'){
				int x=(isdigit(s[i])?1:2);
				dp[i+1][j] += dp[i][j]*x;
			}
			if(p[i]=='y'){
				if(s[i]=='1'){
					dp[i+1][1] += dp[i][j];
				}
				if(s[i]=='0'){
					dp[i+1][j] += dp[i][j];
				}
				if(s[i]=='x'){
					dp[i+1][1] += dp[i][j];
					dp[i+1][j] += dp[i][j];
				}
			}
			dp[i+1][j] %= 1000000;
		}
	}
	return dp[24][1];
}

int calc4(string s){
	int y=0;
	string p="11110yyy10yyxxxx10xxxxxx10xxxxxx";
	r(i,32){
		if(p[i]=='y'&&(s[i]=='1'||s[i]=='x')) y=1;
		if(isdigit(p[i])&&isdigit(s[i])&&p[i]!=s[i])return 0;
	}
	if( !y )return 0;
	int dp[33][2]={};
	dp[0][0]=1;
	r(i,32){
		r(j,2){
			if(isdigit(p[i])){
				dp[i+1][j] += dp[i][j];
			}
			if(p[i]=='x'){
				int x=(isdigit(s[i])?1:2);
				dp[i+1][j] += dp[i][j]*x;
			}
			if(p[i]=='y'){
				if(s[i]=='1'){
					dp[i+1][1] += dp[i][j];
				}
				if(s[i]=='0'){
					dp[i+1][j] += dp[i][j];
				}
				if(s[i]=='x'){
					dp[i+1][1] += dp[i][j];
					dp[i+1][j] += dp[i][j];
				}
			}
			dp[i+1][j] %= 1000000;
		}
	}
	return dp[32][1];
}

int n;
string s[1111];
int dp[1111];

signed main(){
	while(cin>>n,n){
		r(i,n)cin>>s[i];
		memset(dp,0,sizeof(dp));
		dp[0] = 1;
		for(int i=0;i<n;i++){
			if( i+1 <= n ){
				int x = calc1(s[i]);
				dp[i+1] += dp[i]*x;
				dp[i+1] %= 1000000;
			}
			if( i+2 <= n ){
				int x = calc2(s[i]+s[i+1]);
				dp[i+2] += dp[i]*x;
				dp[i+2] %= 1000000;
			}
			if( i+3 <= n ){
				int x = calc3(s[i]+s[i+1]+s[i+2]);
				//cout<<x<<endl;
				dp[i+3] += dp[i]*x;
				dp[i+3] %= 1000000;
			}
			if( i+4 <= n ){
				int x = calc4(s[i]+s[i+1]+s[i+2]+s[i+3]);
				dp[i+4] += dp[i]*x;
				dp[i+4] %= 1000000;
			}
		}
		cout<<dp[n]<<endl;
	}
}


Measured memory_bytes: 3144
#include<stdio.h>
#include<iostream>
using namespace std;
int main()
{
    long long n,num=0,i;
    scanf("%lld",&n);
    for(i=1; i<=n; i++)
    {
        if(i%3==0)
            continue;
        else if(i%5==0)
            continue;
        else if(i%3==0&&i%5==0)
            continue;
        else
            num+=i;
    }
    printf("%lld\n",num) ;
    return 0;
}

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

using namespace std;

#define pb push_back
#define mp make_pair
#define lli long long int
#define F first
#define S second
#define ios ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define MAX1 998244353
#define MAX2 1000000007
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    std::cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');std::cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#define input(data,n,command) for(lli i=0;i<n;i++){lli tmp;cin>>tmp;data.pb(tmp);command}
#define sort(a) sort(a.begin(),a.end());
#define display(a) for(lli i = 0 ;i<a.size();i++){cout<<a[i]<<" ";} cout<<endl;
#define rep(i,n,p) for(lli i = 0;i<n;i= i +p)
#define endl "\n"

//Written By GHATAK...
/*--------------------------------------------------------------------*/
//vector<pair<lli,lli>>adj[300010];

int main()
{
    ios
    lli T=1;
    //cin>>T;
    while(T--)
    {
        //start from here
        lli k,a,b;
        cin>>k>>a>>b;
        for(lli i = a;i<=b;i++)
        {
            if(i%k == 0)
            {
                cout<<"OK";
                return 0;
            }
        }
        cout<<"NG";
        return 0;
    }
    return 0;
}
/*-----------------------------------------------------------------------*/
/*
--->  reverse(vec.begin(),vec().end());
*/

Measured memory_bytes: 3640
import sys
input = sys.stdin.readline
def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

H,W=map(int,input().split())
S=[list(input().strip()) for _ in range(H)]
G=[[float("inf")]*H*W for _ in range(H*W)]
for i in range(H*W):
    G[i][i]=0
#print(S)
for h in range(H):
    for w in range(W-1):
        if S[h][w]=="." and S[h][w+1]==".":
            G[W*h+w][W*h+w+1]=1
            G[W*h+w+1][W*h+w]=1

for h in range(H-1):
    for w in range(W):
        if S[h][w]=="." and S[h+1][w]==".":
            G[W*h+w][W*(h+1)+w]=1
            G[W*(h+1)+w][W*h+w]=1

#print(G)
n=H*W
G=warshall_floyd(G)
#print(G)
ans=0
for h in range(H*W):
    for w in range(H*W):
        if G[h][w]!=float("inf"):
            ans=max(ans,G[h][w])
print(ans)


Measured memory_bytes: 133532
function main(arg) {
	arg = arg.trim().split("\n")[0].split(" ").map(Number)
	var a = arg[0]
	var b = arg[1]
	var t = arg[2]
	var result = 0
	for (var i = a;i < t + 0.5; i += a) {
		result += b
	}
	console.log(result)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));

Measured memory_bytes: 22080
#include <stdio.h>
#include <string.h>
#define max(X, Y) ((X) > (Y) ? (X) : (Y))

int isACGT(char ch);

int main()
{
	char str[16];
	int ans = 0;
	int cnt;
	scanf("%s", str);

	for (int i = 0; i < strlen(str); i++) {
		int j = i;
		cnt = 0;
		while (j < strlen(str) && isACGT(str[j])) {
			cnt++;
			j++;
		}
		ans = max(ans, cnt);
	}

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

	return 0;
}

int isACGT(char ch)
{
	if (ch == 'A' || ch == 'C' || ch == 'G' || ch == 'T') {
		return 1;
	} else {
		return 0;
	}
}


Measured memory_bytes: 128
#include <iostream>
using namespace std;
int gcd(int a, int b) {
  if (a < b) {
    int temp = a;
    a = b;
    b = temp;
  }
  
  if (b == 0) {
    return a;
  } else {
    return gcd(a%b, b);
  }
}

int main() {
  int a, b; cin >> a >> b;
  cout << gcd(a,b) << endl; 
}




Measured memory_bytes: 3100
#include <iostream>

using namespace std;


int main(){
    int W,a,b;
    cin >> W >> a >> b;
    if(a+W < b){
        cout << b-(a+W) << endl;
    }else if(b+W < a){
        cout << a-(b+W) << endl;
    }else {
        cout << 0 << endl;
    }

    return 0;
}

Measured memory_bytes: 256
(N, M, Q) = map(x -> parse(Int, x), split(readline()))
  
a = zeros(Int, Q)
b = zeros(Int, Q)
c = zeros(Int, Q)
d = zeros(Int, Q)
  
for i in 1:Q
  (a[i], b[i], c[i], d[i]) = map(x -> parse(Int, x), split(readline()))
end

function score(A)
    
  res = 0
    
  for i in 1:Q
    if A[b[i]] - A[a[i]] == c[i]
      res += d[i]
    end
  end
  
  return res
    
end

function dfs(A)
  if length(A) == N
    return score(A)
  end
  res = 0
  check = length(A) > 0 ? A[end] : 1
  for i in check:M
    push!(A, i)
    res = max(res, dfs(A))
    pop!(A)
  end
  return res
end

println(dfs([]))

Measured memory_bytes: 210916
n = int(input())

l = []

check = 0

for i in range(n):
	if (i+1)%2 != 0:
		test = 0
		for j in range(i+1):
			if (i+1)%(j+1)==0:
				test = test + 1
				#print(i+1,j+1)
				if test == 8:
					#print(j+1)
					check = check + 1
				
print(check)


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

using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using vint = vector<int>;
using vll = vector<ll>;
template<typename T> using uset = unordered_set<T>;
template<typename T1, typename T2> using umap = unordered_map<T1, T2>;

constexpr int INF = (1 << 30) - 1;
constexpr ll LLINF = 1LL << 60;
constexpr int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};
constexpr int dx[] = {0, 1, 0, -1, 1, 1, -1, -1};
constexpr char el = '\n';
constexpr int mod = 1000000007;

template<typename T> T gcd(T a, T b) { return (b ? gcd(b, a % b) : a); }
template<typename T> T lcm(T a, T b) { return (a / gcd(a, b) * b); }
template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a > b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a < b) a = b; }

template<typename T>
ostream& operator <<(ostream &os, vector<T> &v) {
	for (auto &u : v) os << u << endl;
	return (os);
}

template<typename T>
istream& operator >>(istream &is, pair<vector<T>&, int> v) {
	while (v.second--) {
		T a;
		v.first.push_back(is >> a, a);
	}
	return (is);
}

template<typename T>
istream& operator >>(istream &is, vector<T> &v) {
	for (auto &u : v) is >> u;
	return (is);
}

//1 1 
int main() {
	int N; cin >> N;
	vint B(N); cin >> B;
	vint ans;
	for (int i = 0; i < N; i++) {
		int p = -1;
		for (int j = 0; j < B.size(); j++) {
			if (B[j] == j + 1) {
				p = j;
			}
		}
		if (p == -1) {
			cout << -1 << endl;
			return (0);
		}
		ans.push_back(B[p]);
		B.erase(begin(B) + p);
	}
	reverse(begin(ans), end(ans));
	for (auto &v : ans) cout << v << el;
    return (0);
}


Measured memory_bytes: 256
//
// Created by Tetsuya Shiota on 2019-03-03.
//

#include<iostream>
#include<algorithm>
#include <vector>
#include <set>
#include<string>

using namespace std;

int main(){
    string s;
    cin>> s;
    int zero = 0, one = 0;
    for(auto c : s){
        if(c == '0')zero++;
        else one++;
    }
    cout << s.length() - abs(one - zero) <<endl;
    return 0;
}

Measured memory_bytes: 1144
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
    ll x,y; cin >> x >> y;
    if(y & 1){
        puts("No");
        return 0;
    }
    if(2*x<=y && y<=4*x) puts("Yes");
    else puts("No");
}

Measured memory_bytes: 3592
import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		Integer[] d = new Integer[n];
		for(int i=0;i<n;i++){
			d[i] = scanner.nextInt();
		}
		Arrays.sort(d,Comparator.reverseOrder());
		int beforeSize = d[0];
		int count = 1;
		for(int i=1;i<n;i++){
			if(d[i] < beforeSize){
				count++;
			}
			beforeSize = d[i];
		}
		System.out.println(count);
	}

}


Measured memory_bytes: 23764
#include<stdio.h>

int main(){
    int x,y,i;
    for(i=1;;i++){
        scanf("%d %d",&x,&y);
        if(x==0&&y==0)break;
        if(x<y)printf("%d %d\n",x,y);
        else printf("%d %d\n",y,x);
    }
    return 0;
}


Measured memory_bytes: 2036
N, K = list(map(int, input().split()))
A = [0] + list(map(int, input().split()))

path = [0]*(N+1)
visited = set()

pos = 1
for i in range(N+1):
    if pos in visited: break
    path[i] = pos
    visited.add(pos)
    pos = A[pos]

loc = path.index(pos)
head = path[:loc]
rep = path[loc:i]

if K < len(head):
    print(head[K])
else:
    print(rep[(K - len(head)) % len(rep)])



Measured memory_bytes: 122876
S = input()

if len(S) <= 2:
    print(0)

else:
    ans1 = 0
    ans2 = 0
    flag1 = 0
    flag2 = 1
    for i in S:
        if flag1 % 2 == int(i):
            pass
        else:
            ans1 += 1
        flag1 += 1
    for i in S:
        if flag2 % 2 == int(i):
            pass
        else:
            ans2 += 1
        flag2 += 1

    print(min(ans1,ans2))

Measured memory_bytes: 3188
#include<iostream>
using namespace std;
#define MAX 100005
#define NIL -1

struct Node {
	int p, l, r;
};
Node T[MAX];
int n, D[MAX];

void print(int u) {
	int i, c;
	cout << "node " << u << ": ";
	cout << "parent = " << T[u].p << ", ";
	cout << "depth = " << D[u] << ", ";

	if (T[u].p == NIL)cout << "root, ";
	else if (T[u].l == NIL)cout << "leaf, ";
	else cout << "internal node, ";

	cout << "[";

	for (i = 0, c = T[u].l; c != NIL; i++, c = T[c].r) {
		if (i)cout << ", ";
		cout << c;
	}
	cout << "]" << endl;
}

void rec(int u, int p) {
	D[u] = p;
	if (T[u].r != NIL)rec(T[u].r, p);
	if (T[u].l != NIL)rec(T[u].l, p + 1);
}
int main() {
	int i, j, d, v, c, l, r;
	cin >> n;
	for (i = 0; i < n; i++) T[i].p = T[i].l = T[i].r = NIL;
	for (i = 0; i < n; i++) {
		cin >> v >> d;
		for (j = 0; j < d; j++) {
			cin >> c;
			if (j == 0)T[v].l = c;
			else T[l].r = c;
			l = c;
			T[c].p = v;
		}
	}
	for (i = 0; i < n; i++) {
		if (T[i].p == NIL)r = i;
	}
	rec(r, 0);
	for (i = 0; i < n; i++) {
		print(i);
	}
	return 0;
}


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

namespace test
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = ReadLong();
            var A = ReadArrayLong();
            var sumA = A.Sum(a => Math.Abs(a));
            var zero = A.Contains(0);
            if (zero) { Console.WriteLine(sumA); return; }
            var minus = A.Count(a => a < 0);
            if (minus % 2 == 0) { Console.WriteLine(sumA); return; }
            var min = A.Select(a => Math.Abs(a)).Min();

            Console.WriteLine(sumA - min * 2);
            Console.ReadLine();
        }

        static string Read() { return Console.ReadLine(); }
        static int ReadInt() { return int.Parse(Read()); }
        static long ReadLong() { return long.Parse(Read()); }
        static int[] ReadArrayInt() { return Read().Split(' ').Select(s => int.Parse(s)).ToArray(); }
        static long[] ReadArrayLong() { return Read().Split(' ').Select(s => long.Parse(s)).ToArray(); }
    }
}

Measured memory_bytes: 31068