akhauriyash/Code-Regression huggingface dataset:
import java.util.*;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int a = -1;
        for (int i = 1; i < Math.sqrt(n*2); i++) {
            if(n*2 % i == 0 && n*2 / i == i+1){
                a = i;
                break;
            }
        }
        if(a == -1)System.out.println("No");
        else{
            int k = a+1;
            int[][] s = new int[k][a];
            int num = 1;
            for (int i = 0; i < a; i++) {
                for (int j = i; j < a; j++) {
                    s[i][j] = num;
                    s[j+1][i] = num;
                    num++;
                }
            }
            StringBuilder sb = new StringBuilder();
            sb.append("Yes" + "\n");
            sb.append(k + "\n");
            for (int i = 0; i < k; i++) {
                sb.append(a);
                for (int j = 0; j < a; j++) {
                    sb.append(" " + s[i][j]);
                }
                sb.append("\n");
            }
            System.out.print(sb.toString());
        }
        sc.close();

    }

}


Measured memory_bytes: 43720
#include <iostream>
#include <utility>
#include <map>
#include <vector>
#include <algorithm>
#include <queue>
#include <math.h>
#include <stack>
#include <set>
#include <deque>
#include <cmath>
#include <cassert>
#include <cstring>

using namespace std;
typedef long long ll;
ll mod = 1e9+7;
#define rep(i,n) for(int i = 0; i < (n); ++i)

int main() {
    int n, k;
    cin >> n >> k;
    vector<ll> a(n);
    rep(i, n) {
        cin >> a[i];
    }
    rep(i, n-k) {
        if (a[i] < a[i+k]) {
            cout << "Yes" << endl;
        }
        else {
            cout << "No" << endl;
        }
    }
    return 0;
}


Measured memory_bytes: 4816
# coding=utf-8

###
### for atcorder program
###

import sys
import math

# math class
class mymath:
    ### pi
    pi = 3.14159265358979323846264338

    ### Prime Number
    def pnum_eratosthenes(self, n):
        ptable = [0 for i in range(n+1)]
        plist = []

        for i in range(2, n+1):
            if ptable[i]==0:
                plist.append(i)
                for j in range(i+i, n+1, i):
                    ptable[j] = 1
        return plist

    ### GCD
    def gcd(self, a, b):
        if b == 0:
            return a
        return self.gcd(b, a%b)

    ### LCM
    def lcm(self, a, b):
        return (a*b)//self.gcd(a,b)

    ### Mat Multiplication
    def mul(self, A, B):
        ans = []
        for a in A:
            c = 0
            for j, row in enumerate(a):
                c += row*B[j]
            ans.append(c)
        return ans

mymath = mymath()

### output class
class output:
    ### list
    def list(self, l):
        l = list(l)
        #print(" ", end="")
        for i, num in enumerate(l):
            print(num, end="")
            if i != len(l)-1:
                print(" ", end="")
        print()

output = output()

### input sample
#i = input()
#N = int(input())
#A, B, C = [x for x in input().split()]
#N, K = [int(x) for x in input().split()]
#inlist = [int(w) for w in input().split()]

#R = float(input())
#A.append(list(map(int,input().split())))

#for line in sys.stdin.readlines():
#    x, y = [int(temp) for temp in line.split()]

#abc list
#abc = [chr(ord('a') + i) for i in range(26)]

### output sample
#print("{0} {1} {2:.5f}".format(A//B, A%B, A/B))
#print("{0:.6f} {1:.6f}".format(R*R*math.pi,R*2*math.pi))
#print(" {}".format(i), end="")

def get_input():
    N = []
    while True:
        try:
            N.append(input())
            #N.append(int(input()))
            #N.append(float(input()))
        except EOFError:
            break
    return N

def conv(s):
    num = 3
    if s == 'A':
        num = 0
    elif s == 'B':
        num = 1
    elif s == 'AB':
        num = 2
    return num

N = get_input()

for row in N[:-1]:
    PI = [x for x in row.split(' ')]
    for i in PI:
        print(len(i), end='')
    print()



Measured memory_bytes: 5660
#define _CRT_SECURE_NO_WARNINGS

#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>

using namespace std;

#define N_MAX 500010

int main()
{
	FILE *fin = NULL, *fout = NULL;
	//fin = freopen("input.txt", "r", stdin);
	//fout = freopen("output.txt", "w", stdout);

	char S[N_MAX]; scanf("%s", S);
	int len = strlen(S);

	int a[N_MAX]; a[0] = 0;
	int mini = 0;
	long long int sum = 0;
	for (int i = 0; i < len;){
		if ('<' == S[i]){
			a[i + 1] = a[i] + 1;
			i++;
		}
		else{
			int j;
			for (j = i + 1; j < len; j++){
				if ('<' == S[j]){
					break;
				}
			}
			a[j] = 0;
			for (int k = j - 1; k>=i; k--){
				a[k] =max(a[k], a[k+1]+1);
			}
			i = j;
		}
	}

	for (int i = 0; i <= len; i++){
		sum += a[i];
	}

	printf("%lld", sum);

	//finalize
	if (NULL != fin) fclose(fin);
	if (NULL != fout) fclose(fout);

	return 0;
}

Measured memory_bytes: 2560
import sys
input = sys.stdin.readline
h, w, k = map(int, input().split())
si, sj, ti, tj = map(int, input().split())
si -= 1
sj -= 1
ti -= 1
tj -= 1
b = [input() for _ in range(h)]
ans = [[-1]* w for _ in range(h)]
ans[si][sj] = 0
from collections import deque
d = deque()
d.append((si, sj))
while d:
  x, y = d.popleft()
  if x == ti and y == tj:
    print(ans[x][y])
    exit()
  for dx, dy in ((1, 0), (0, 1), (-1, 0), (0, -1)):
    for i in range(1, k+1):
      xx = x+dx*i
      yy = y+dy*i
      if not(0<= xx < h and 0<= yy < w) or b[xx][yy] == '@':
        break
      if 0 <= ans[xx][yy] <= ans[x][y]:
        break
      if ans[xx][yy] == -1:
        d.append((xx, yy))
      ans[xx][yy] = ans[x][y] + 1
print(-1)

Measured memory_bytes: 94164
// AOJ Volume0 0072
// v@ÉæÁÄððßé

#include <stdio.h>
#include <string.h>

#define MAX_N   (100)

int main(void)
{
    int n, m;
    int i, j, loop;
    int a, b, d;
    int path[MAX_N][MAX_N];
    int flag[MAX_N];
    int min_s, min_e;
    int lantern;
    
    while (1){
        scanf("%d", &n);
        if (n == 0){
            break;
        }
    
        // data init
        memset(path, -1, sizeof(path));
        memset(flag, 0, sizeof(flag));
    
        // data input
        scanf("%d", &m);
        for (i = 0; i < m; i++){
            scanf("%d,%d,%d", &a, &b, &d);
            path[a][b] = path[b][a] = d;
        }
        
        lantern = 0;
        flag[0] = 1;
        
        for (loop = 0; loop < n; loop++){
            min_s = min_e = 0;
            for (i = 0; i < n; i++){
                if (flag[i] == 1){
                    for (j = 0; j < n; j++){
                        if (flag[j] == 0){
                            if (path[i][j] > 0){
                                if (path[min_s][min_e] == -1){
                                    min_s = i;
                                    min_e = j;
                                }
                                else if (path[min_s][min_e] > path[i][j]){
                                    min_s = i;
                                    min_e = j;
                                }
                            }
                        }
                    }
                }
            }
            if (path[min_s][min_e] != -1){
//                printf("<%d-%d (%d)>\n", min_s, min_e,path[min_s][min_e]);
                lantern += (path[min_s][min_e] / 100 - 1);
                path[min_s][min_e] = path[min_e][min_s] = -1;
                flag[min_e] = 1;
            }
        }
        
        printf("%d\n", lantern);
    }
    
    return (0);
}

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

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (a<b && b<c) {
        cout << "No" << endl;
    }

    else if (c<a && a<b) {
        cout << "No" << endl;
    }

    else if (b<a && a<c) { 
        cout << "No" << endl;
    }

    else if (c<b && b<a) {
        cout << "No" << endl;
    }

    else cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
acute, right, obtuse = 0, 0, 0
while True:
    a, b, c = sorted(map(int, input().split()))
    if a + b <= c:
        print(acute + right + obtuse, right, acute, obtuse)
        break
    d = a ** 2 + b ** 2
    e = c ** 2
    if d == e:
        right += 1
    elif d < e:
        obtuse += 1
    else:
        acute += 1



Measured memory_bytes: 5600
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pull = pair<ull, ll>;
using pis = pair<int, string>;
#define all(x) (x).begin(), (x).end()
#define INF 1000000000
#define LLINF 10000000000000000ll
#define MOD 1000000007

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  //cout << fixed << setprecision(15)

  string s;
  cin >> s;
  int len = s.size(), div = 13, tens = 1;
  vector<vector<ll>> dp(len+1, vector<ll>(div, 0)); //dp[i][j]: 下からi文字目までで余りjであるような個数
  dp[0][0] = 1;
  for (int i = 1; i < len+1; i++) {
    for (int j = 0; j < div; j++) {
      if (s[len-i] != '?') {
        dp[i][((int)(s[len-i] - '0') * tens + j) % div] = dp[i-1][j];
      }
      else {
        for (int k = 0; k < 10; k++) {
          dp[i][(k * tens + j) % div] += dp[i-1][j];
          dp[i][(k * tens + j) % div] %= MOD;
        }
      }
    }
    tens = (tens * 10) % div;
  }

  cout << dp[len][5] << endl;
}


Measured memory_bytes: 16600
import java.util.Scanner;

public class Main {

	private static int[] gs = new int[]{100,101,102,103,104,105};

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int X = sc.nextInt();
		sc.close();

		if(X < 100){
			System.out.println(0);
			return;
		}

		for(int i0 = 0;i0 <= X/100;i0++){
			for(int i1 = 0;i1 <= X/101;i1++){
				for(int i2 = 0;i2 <= X/102;i2++){
					for(int i3 = 0;i3 <= X/103;i3++){
						for(int i4 = 0;i4 <= X/104;i4++){
							for(int i5 = 0;i5 <= X/105;i5++){
								if(gs[0]* i0 + gs[1] * i1 + gs[2] * i2 + gs[3] * i3 + gs[4] * i4 + gs[5] * i5 == X){
									System.out.println(1);
									return;
								}
							}
						}
					}
				}
			}
		}
		System.out.println(0);
	}
}

Measured memory_bytes: 22736
#include <stdio.h>

int main() {
  int i,n,j,temp;
  scanf("%d",&n);
  int a[n];
  for (i=0;i<n;i++) {
    scanf("%d",&a[i]);
  }

  for(i=0; i<n; i++){
   for(j=n-1; j>i; j--){
     if(a[j] < a[j-1]){
       temp = a[j];
       a[j] = a[j-1];
       a[j-1] = temp;
     }
   }
 }

  int alice = 0;
  int bob = 0;
  for (i=0;i<n;i++) {
    if (i%2==0) {
      alice += a[n-i-1];
    } else {
      bob += a[n-i-1];
    }
  }
  printf("%d\n",alice-bob);
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <string>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <stack>
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
using namespace std;

int main(){
    int n;
    while (cin >> n){
        if (n == 0) break;
        int num[n], sum[n], max;
        REP(i, n){
            cin >> num[i];
            if (i != 0 && sum[i-1]+num[i] > num[i]){
                sum[i] = sum[i-1] + num[i];
                if (max < sum[i]) max = sum[i];
            } else {
                sum[i] = num[i];
                if (i == 0) max = sum[i];
                else if (max < sum[i]) max = sum[i];
            }
        }
        cout << max << endl;
    }
}


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

#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x.size())
#define popcount(x) __builtin_popcount(x)
#define popcountll(x) __builtin_popcountll(x)
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
#define F first
#define S second
#define mp make_pair
#define eb emplace_back
#define pii pair<int, int>
#define pll pair<ll, ll>

using namespace std;

typedef long long ll;

/* --- INFやMODの値が適切か確認する --- */
// const int INF = 1 << 30;
// const ll INF = 1LL << 60;
const ll MOD = 1000000007;

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

  ll cnt[26] = {0};
  rep(i, s.size()) cnt[s[i] - 'a']++;

  ll ans = 1;
  rep(i, 26) ans = ans * (cnt[i] + 1) % MOD;
  ans--;

  cout << ans << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#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 srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define spair(p) cout<<#p<<": "<<p.fi<<" "<<p.se<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl
#define svec(v) cout<<#v<<":";rep(pachico,v.size())cout<<" "<<v[pachico];cout<<endl
#define svecp(v) cout<<#v<<":";each(pachico,v)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl
#define sset(s) cout<<#s<<":";each(pachico,s)cout<<" "<<pachico;cout<<endl
#define smap(m) cout<<#m<<":";each(pachico,m)cout<<" {"<<pachico.first<<":"<<pachico.second<<"}";cout<<endl

using namespace std;

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<P> vp;
typedef vector<string> vs;

const int MAX_N = 1000005;

int d[MAX_N];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K;
    cin >> K;
    rep(i,K){
        d[i] = INF;
    }
    priority_queue<P,vector<P>,greater<P> > que;
    srep(i,1,10){
        d[i] = i;
        que.push(P(d[i],i%K));
    }
    while(!que.empty()){
        P p = que.top();
        que.pop();
        if(p.se == 0){
            cout << p.fi << "\n";
            return 0;
        }
        if(d[p.se] < p.fi) continue;
        rep(i,10){
            int nx = (p.se*10+i)%K;
            if(d[nx] > p.fi+i){
                d[nx] = p.fi+i;
                que.push(P(d[nx],nx));
            }
        }
    }
    return 0;
}


Measured memory_bytes: 2804
n = int(input())
taro = 0
hana = 0
for i in range(n):
    a, b = map(str, input().split())
    if a == b:
        taro += 1
        hana += 1
    elif a < b:
        hana += 3
    else:
        taro += 3
print(taro, hana)


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

using namespace std;
using llong = long long;
using P = pair<llong, llong>;

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

const llong inf = llong(1e18)+7;
const llong mod = 1e9+7;

int main(){
	llong N,M;
	vector<llong> T;
	vector<P> PX;
	llong sum = 0;

	cin >> N;
	T.resize(N+1);
	for(int i = 1; i <= N; i++){
		cin >> T[i];
		sum += T[i];
	}

	cin >> M;
	PX.resize(M);
	for(int i = 0; i < M; i++)
		cin >> PX[i].first >> PX[i].second;

	for(int i = 0; i < M; i++)
		cout << sum - T[PX[i].first] + PX[i].second << endl;

	return 0;
}

Measured memory_bytes: 256
<?php

fscanf(STDIN, '%s', $string);
fscanf(STDIN, '%d', $n);

$chars = preg_split('//', $string, -1, PREG_SPLIT_NO_EMPTY);

for ($i = 0; $i < $n; $i++) {
    $line = trim(fgets(STDIN));

    $ops = preg_split('/ /', $line);

    if ('replace' === $ops[0]) {
        $chars = replace($chars, $ops[1], $ops[2], $ops[3]);
    }

    if ('reverse' === $ops[0]) {
        $chars = reverse($chars, $ops[1], $ops[2]);
    }

    if ('print' === $ops[0]) {
        print_chars($chars, $ops[1], $ops[2]);
    }
}

function replace($chars, $from, $to, $replace)
{
    $replaces = preg_split('//', $replace, -1, PREG_SPLIT_NO_EMPTY);

    for ($i = $from, $j =0; $i <= $to; $i++, $j++) {
        $chars[$i] = $replaces[$j];
    }

    return $chars;
}

function reverse($chars, $from, $to)
{
    $reverse_chars = array();
    for ($i = $from; $i <= $to; $i++) {
        $reverse_chars[] = $chars[$i];
    }
    $reverse_chars = reverse_all($reverse_chars);

    for ($i = $from, $j = 0; $i <= $to; $i++, $j++) {
        $chars[$i] = $reverse_chars[$j];
    }

    return $chars;
}

function reverse_all($chars)
{
    $reversed = array();

    for ($i = count($chars) - 1; $i >= 0; $i--) {
        $reversed[] = $chars[$i];
    }

    return $reversed;
}

function print_chars($chars, $from, $to)
{
    for ($i = $from; $i <= $to; $i++) {
        echo $chars[$i];
    }
    echo "\n";
}

Measured memory_bytes: 7172
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
const ll INF = 1e9;
const ll MOD = 1e9 + 7;
#define repi(i, n, init) for (ll i = init; i < (n); i++)

int main()
{
    ll n, m;
    cin >> n >> m;
    if (n >= m)
    {
        cout << 0 << endl;
    }
    else
    {
        vector<int> x(m, 0);
        repi(i, m, 0)
        {
            cin >> x[i];
        }
        sort(x.begin(), x.end());
        repi(i, m - 1, 0)
        {
            x[i] = abs(x[i] - x[i + 1]);
        }
        ll ans = 0;
        sort(x.begin(), x.end() - 1);
        repi(i, m - n, 0)
        {
            ans += x[i];
        }
        cout << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 640
import java.util.Scanner;

class Main {
	Scanner sc = new Scanner(System.in);

	public void run() {
		int c=sc.nextInt();
		int c1=0,c2=0;
		for(int i=0;i<c;i++){
			String s1=sc.next(),s2=sc.next();
			if(s1.compareTo(s2)>0){
				c1+=3;
			}else if(s1.compareTo(s2)<0){
				c2+=3;
			}else{
				c1++;c2++;
			}
		}
		ln(c1+" "+c2);
	}

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

	public static void pr(Object o) {
		System.out.print(o);
	}

	public static void ln(Object o) {
		System.out.println(o);
	}

	public static void ln() {
		System.out.println();
	}
}

Measured memory_bytes: 12000
import sys
sys.setrecursionlimit(10**6)

n = int(input())
A = list(map(int, input().split()))
#n, m = map(int, input().split())
#s = input()
#s,t = input().split()
#
#readline = sys.stdin.readline
#n,m = [int(i) for i in readline().split()]
#ab = [[int(i) for i in readline().split()] for _ in range(n)]

ans = 1
ma = 1e18


if 0 in A:
    print(0)
else:
    for a in A:
        ans *= a
        if ans > ma:
            print(-1)
            break
    else:
        print(ans)

Measured memory_bytes: 21584
//Created Time:2019年09月28日 星期六 20时02分24秒
#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

int main(){
	int n; cin >> n;
	double tmp = ((n / 2) + (n & 1)) * 1.0 / n;
	printf("%.10lf", tmp);
	return 0;
}


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

namespace Task {

#define long long long

const int MAXN = 40;
const int MAX_STATE = 1 << 18;
const int MOD = 1e9 + 7;

int f[MAXN + 1][MAX_STATE];

inline void solve() {
    std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL);
    register int n, x, y, z;
    std::cin >> n >> x >> y >> z;
    register int mask = (1 << z) | (1 << y + z) | (1 << x + y + z);
    register int s = (1 << x + y + z + 1) - 1;
    register int res = 10;
    for (register int i = 2; i <= n; i++) res = (long)res * 10 % MOD;
    f[0][1] = 1;
    for (register int i = 1, state; i <= n; i++) {
        for (register int j = 0; j <= s; j++) {
            for (register int k = 1; k <= 10; k++) {
                state = (j << k & s) + 1;
                if ((mask & state) == mask) continue;
                f[i][state] = (f[i][state] + f[i - 1][j]) % MOD;
            }
        }
    }
    for (register int i = 0; i < s; i++) res = (res - f[n][i]) % MOD;
    std::cout << (res % MOD + MOD) % MOD;
}

#undef long
}

int main() {
    Task::solve();
    return 0;
}

Measured memory_bytes: 41216
#include <iostream>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>

using namespace std;
typedef long long ll;

int main(){
    ll N;
    string S;
    cin >> S;
    N = S.length();
    int r=0,b=0;
    for(int i=0;i<N;i++){
        if(S[i]=='0')r++;
        else b++;
    }
    cout << min(r,b)*2 << endl;
}

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

using namespace std;

#define MP make_pair
#define PB push_back
typedef long long LL;
typedef pair<int,int> PII;
const double eps=1e-8;
const double pi=acos(-1.0);
const int K=1e6+7;
const int mod=1e9+7;

int tmpw,tmpv,mxw,w,n;
LL sum[4][300],ans;
vector<int>vc[4];
vector<int>dp[300];

int main(void)
{
    std::ios::sync_with_stdio(false);
    std::cin.tie(0);
    cin>>n>>mxw;
    cin>>w>>tmpv;
    vc[0].PB(-tmpv);
    for(int i=1;i<n;i++)
        cin>>tmpw>>tmpv,vc[tmpw-w].PB(-tmpv);
    for(int i=0;i<=3;i++)
        sort(vc[i].begin(),vc[i].end());
    for(int i=0;i<=3;i++)
        for(int j=0;j<vc[i].size();j++)
            sum[i][j+1]=sum[i][j]-vc[i][j];
    for(int i=0,sa=min(mxw/w,(int)vc[0].size());i<=sa;i++)
    for(int j=0,sb=min((mxw-i*w)/(w+1),(int)vc[1].size());j<=sb;j++)
    {
        int sc=min((mxw-i*w-j*(w+1))/(w+2),(int)vc[2].size());
        for(int k=0;k<=sc;k++)
        {
            int t=min((mxw-i*w-j*(w+1)-k*(w+2))/(w+3),(int)vc[3].size());
            ans=max(ans,sum[0][i]+sum[1][j]+sum[2][k]+sum[3][t]);
            //cout<<"=="<<i<<" "<<j<<" "<<k<<" "<<t<<" "<<sum[0][i]+sum[1][j]+sum[2][k]+sum[3][t]<<endl;
        }
    }
    cout<<ans<<endl;
    return 0;
}



Measured memory_bytes: 256
#include<iostream>

using namespace std;


int selectionsort(int n, int *buff)
{

	int j,minj,i;
	int count=0;

	for(i=0;i<n;i++){
		minj=i;
		
		for(j=i;j<n;j++){
			if(buff[minj]>buff[j]) minj=j;
		}
		if(i!=minj){
			swap(buff[minj],buff[i]);
			count++;
		}
	}
	
	return count;

}


int main()
{

	int n;
	int buff[100];
	cin>>n;
	for(int i=0;i<n;i++) cin>>buff[i];

	int count=selectionsort(n, buff);


	for(int i=0;i<n-1;i++) cout<<buff[i]<<" ";
	cout<<buff[n-1]<<endl;

	cout << count <<endl;

	return 0;
}



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

using namespace std;

#define rep1(i,x) for(int i=1;i<=(x);++i)
#define chmax(a,b) a=max(a,b)

int a[100001];
int memo[100001];
int start[100001];

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

	int n, k;
    while (cin >> n >> k, n || k) {
		fill_n(a, n, 0);
		fill_n(memo, n, 0);
		fill_n(start, n, 0);

		bool f = false;

		rep1(i, k) {
			int tmp; cin >> tmp;
			if (tmp == 0) f = true;
			else a[tmp] = true;
		}

		rep1(i, n) {
			if (a[i]) {
				if (a[i - 1]) {
					start[i] = start[i - 1];
					memo[start[i]]++;
				} else {
					start[i] = i;
					memo[start[i]]++;
				}
			}
		}

		int ma = 0;

		rep1(i, n) {
			if (a[i]) {
				chmax(ma, memo[start[i]]);
			} else if (f) {
				if (i + 1 <= n) {
					chmax(ma, memo[start[i - 1]] + memo[start[i + 1]] + 1);
				} else {
					chmax(ma, memo[start[i - 1]] + 1);
				}
			}
		}

        cout << ma << endl;
	}
}

Measured memory_bytes: 2368
#include <bits/stdc++.h>
#define ll long long
using namespace std;
 
const int MAX = 2e5 + 111;

vector <vector <int> > v;

vector <int> path; 

int c[MAX], ans, n;

void dfs(int ver, int p = -1) {
    path.push_back(ver);
    if (ver == n - 1) {
        int left = 0;
        int right = path.size() - 2;
        while (left < right) {
            left++;
            right--;
        }
        for (int i = 0; i < (int)path.size(); ++i) {
            if (i <= left)
                c[path[i]] = 1;
            else
                c[path[i]] = 0;
        }
    }
    for (int i = 0; i < (int)v[ver].size(); ++i) {
        if (v[ver][i] != p)
            dfs(v[ver][i], ver);
    }
    path.pop_back();
}

void f(int ver, int p = -1) {
    ans++;
    c[ver] = 1;
    for (int i = 0; i < (int)v[ver].size(); ++i) {
        if (v[ver][i] != p && c[v[ver][i]] != 0)
            f(v[ver][i], ver);
    }
}

int main() {
#ifdef LOCAL
    freopen("xxx.in", "r", stdin);
    freopen("xxx.out", "w", stdout);    
#endif
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    v.resize(n);
    memset(c, -1, sizeof c);
    for (int i = 0; i < n - 1; ++i) {
        int a, b;
        cin >> a >> b;
        --a, --b;
        v[a].push_back(b);
        v[b].push_back(a);
    }
    dfs(0);
    f(0);
    if (ans > n - ans)
        cout << "Fennec";
    else
        cout << "Snuke";
    return 0;
}

Measured memory_bytes: 11768
h,w=map(int,input().split())
s=[list(input()) for i in range(h)]
inf = h*w
d=[[inf]*w for i in range(h)]
if s[0][0]=="#":
    d[0][0]=1
else:
    d[0][0]=0
for j in range(1,w):
    if s[0][j]=="#" and s[0][j-1]==".":
        d[0][j]=d[0][j-1]+1
    else:
        d[0][j]=d[0][j-1]

for i in range(1,h):
    if s[i][0]=="#" and s[i-1][0]==".":
        d[i][0]=d[i-1][0]+1
    else:
        d[i][0]=d[i-1][0]

for i in range(1,h):
    for j in range(1,w):
        if s[i][j]=="#" and s[i][j-1]==".":
            p=d[i][j-1]+1
        else:
            p=d[i][j-1]
        if s[i][j]=="#" and s[i-1][j]==".":
            q=d[i-1][j]+1
        else:
            q=d[i-1][j]
        d[i][j]=min(p,q)
# for i in d:
#     print(i)
print(d[-1][-1])

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

int main(){
  int n;
  cin >> n;
  ll sum=0;
  rep(i,n+1){
    if(i%3==0 || i%5==0) continue;
    sum+=i;
  }
  cout << sum << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
int main(void){
    int N;
    cin >> N;
    vector<int> vec(N);
    for (int i = 0; i < N; i++)
        cin >> vec.at(i);
    sort(vec.begin(), vec.end());
    int Alice = 0;
    int Bob = 0;
    int tag = 1;
    for (int i = N - 1; i >= 0; i--)
    {
        if (tag == 1)
        {
            Alice += vec.at(i);
            tag = 0;
        }else{
            Bob += vec.at(i);
            tag = 1;
        }
    }
    cout << Alice - Bob << endl;
}


Measured memory_bytes: 256
n,a,b,c,d=map(int,input().split())
s=input()
for i in range(a-1,c-1):
  if s[i:i+2]=='##':
    print('No')
    exit()
for i in range(b-1,d-1):
  if s[i:i+2]=='##':
    print('No')
    exit()
if c<d:
  print('Yes')
else:
  for i in range(b-2,d-1):
    if s[i:i+3]=='...':
      print('Yes')
      exit()
  print('No')


Measured memory_bytes: 3572
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
    int n,k;
    cin>>n>>k;
    int dp[100005]={0};
    int a[n];
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        dp[a[i]] = 1;
    }
    sort(a,a+n);
    int i=a[0]+1;
    for (; i <=k ; ++i) {
        for (int j = 0; a[j]<i ; ++j) {
            if(dp[i]==1)
                break;
            if(dp[i-a[j]]==0)
            {
                dp[i]=1;
                break;
            }
            if(j==n-1)
                break;
        }
    }
    if(dp[k]==1)
        cout<<"First";
    else
        cout<<"Second";
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func main() {
	sc.Scan()
	dataset, _ := strconv.Atoi(sc.Text())
	var firstdata *big.Int

	for i := 0; i < dataset*2; i++ {
		n := new(big.Int)
		sc.Scan()
		data, _ := n.SetString(sc.Text(), 10)

		if i%2 == 0 {
			firstdata = data
			continue
		}

		result := new(big.Int)
		if result := result.Add(data, firstdata); len(result.String()) > 80 {
			fmt.Println("overflow")
			continue
		} else {
			fmt.Println(result)
		}
	}
}



Measured memory_bytes: 1140
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rep2(i,n) for (int i = 1; i <= (n); i++)
using namespace std;
using ll = long long;
using p = pair<int, int>;

int main() {
  ll x;
  cin >> x;

  ll counta = 0;
  ll countb = 0;

  counta += x / 500;
  ll current = x % 500;
  countb = current / 5;

  ll sum = 1000 * counta + 5 * countb;

  cout << sum << endl;
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>

int main(){
    int a, b, c;
    std::cin>>a>>b>>c;

    std::string ans;
    if(a + b >= c){
        ans = "Yes";
    }else{
        ans = "No";
    }

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

Measured memory_bytes: 256
fn main() {
    proconio::input! {
        n: usize,
        m: usize,
        q: usize,
        mut lr: [(usize,usize);m],
        pq: [(usize,usize);q],
    }
    lr.sort_unstable();
    let mut k: Vec<usize>=(0..q).collect();
    k.sort_unstable_by_key(|k|pq[*k]);
    let mut b=vec![0;n+1];
    for &(_,r) in &lr {
        let mut i=r;
        while i<=n {
            b[i]+=1;
            i+=i&i.wrapping_neg();
        }
    }
    let mut r=vec![0;q];
    let mut u=0;
    let mut v=0;
    for i in 1..=n {
        while u<m && lr[u].0<i {
            let mut i=lr[u].1;
            while i<=n {
                b[i]-=1;
                i+=i&i.wrapping_neg();
            }
            u+=1;
        }
        while v<q && pq[k[v]].0==i {
            let mut i=pq[k[v]].1;
            let mut s=0;
            while i>0 {
                s+=b[i];
                i-=i&i.wrapping_neg();
            }
            r[k[v]]=s;
            v+=1;
        }
    }
    for r in r {
        println!("{}",r);
    }
}

Measured memory_bytes: 10212
#include <iostream>
#include <string>
#include <cmath>
#include<algorithm>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <functional>
#include<complex>
using namespace std;

#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)

typedef long long ll;
const ll INF = 1e17;
const ll MOD = 1000000007;
const ll MAX = 4000001;
const long double eps = 1E-14;

ll max(ll a, ll b) {
	if (a > b) { return a; }
	return b;
}

ll min(ll a, ll b) {
	if (a > b) { return b; }
	return a;
}

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

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

struct edge {
	ll ind;
	ll fr;
	ll to;
	ll d;
};

class mint {
	long long x;
public:
	mint(long long x = 0) : x((x% MOD + MOD) % MOD) {}
	mint operator-() const {
		return mint(-x);
	}
	mint& operator+=(const mint& a) {
		if ((x += a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator-=(const mint& a) {
		if ((x += MOD - a.x) >= MOD) x -= MOD;
		return *this;
	}
	mint& operator*=(const  mint& a) {
		(x *= a.x) %= MOD;
		return *this;
	}
	mint operator+(const mint& a) const {
		mint res(*this);
		return res += a;
	}
	mint operator-(const mint& a) const {
		mint res(*this);
		return res -= a;
	}
	mint operator*(const mint& a) const {
		mint res(*this);
		return res *= a;
	}

	mint pow(ll t) const {
		if (!t) return 1;
		mint a = pow(t >> 1);
		a *= a;
		if (t & 1) a *= *this;
		return a;
	}

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

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

mint pw(mint a, ll b) {
	if (b == 0) { return 1; }
	mint ret = pw(a, b >> 1);
	ret *= ret;
	if (b & 1) { ret *= a; }
	return ret;
}

typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef vector<vector<vector<ll>>> vvvll;

typedef vector<mint> vmint;
typedef vector<vector<mint>> vvmint;
typedef vector<vector<vector<mint>>> vvvmint;

/////////////////////////////////////

int main() {
	ll R, C, K;
	cin >> R >> C >> K;
	vvll c(R + 1, vll(C + 1, 0));
	repn(i, K) {
		ll x, y, v;
		cin >> x >> y >> v;
		c[x][y] = v;
	}

	vvvll dp(R + 1, vvll(C + 1, vll(4, 0)));

	repn(i, R)repn(j, C) {
		rep(k, 4)dp[i][j][0] = max(dp[i][j][0], dp[i - 1][j][k]);
		rep(k, 4)dp[i][j][k] = max(dp[i][j][k], dp[i][j - 1][k]);

		for (ll k = 3; k >= 1; k--) {
			dp[i][j][k] = max(dp[i][j][k], dp[i][j][k - 1] + c[i][j]);
		}
	}

	ll ans = 0;
	rep(k, 4)ans = max(ans, dp[R][C][k]);
	cout << ans << endl;
}


Measured memory_bytes: 706816
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const static ll INF = 1e15;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
// __uint128_t
const ll MOD = 1e9+7;



int main(){
    ll N = 1e5+2;
    vector<bool> B(N, true); B[0] = B[1] = false;
    for(int i = 2; i*i <= N; i++){
        ll p = i;
        ll cnt = 2;
        while(p*cnt < N){
            B[p*cnt] = false;
            cnt++;
        }
    }
    vector<ll> D(N);
    for(int i = 2; i < N; i++){
        if(B[i]){
            if(B[(i+1)/2]) D[i]++;
        }
    }
    for(int i = 0; i < N-1; i++) D[i+1] += D[i];

    ll Q; cin >> Q;
    while(Q--){
        ll l, r; cin >> l >> r;
        cout << D[r] - D[l-1] << endl;

    }

}


Measured memory_bytes: 3804
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define loop(i,n) rep(i,0,n)
using namespace std;
using ll = long long;
int main(){
    int n;
    cin >> n;
    vector<int> a(n),a_cnt(n,0);
    loop(i,n)cin >> a[i];
    loop(i,n)a_cnt[a[i]]++;
    int a_max=*max_element(a.begin(),a.end());
    int a_min=*min_element(a.begin(),a.end());
    //次の条件を満たす木は構築できる
    // - a_minは1個, かつ a_min+1,...,a_maxは少なくとも2個, かつ a_maxは偶数 （M,M-1,...,m+1,m,m+1,...,Mに毛が生えたみたいな形）
    // - a_minは2個, かつ a_min+1,...,a_maxは少なくとも2個, かつ a_maxは奇数 （M,M-1,...,m+1,m,m,m+1,...,Mに毛が生えたみたいな形）
    //逆に、この形でないときは構築できない
    bool ans=(a_cnt[a_min]<=2)&&((a_cnt[a_min]==1)==(a_max%2==0));
    rep(i,a_min+1,a_max+1)ans=(ans&&a_cnt[i]>=2);
    cout << (ans?"Possible":"Impossible") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <map>
#include <set>
#include <cmath>
#include <queue>
#include <deque>
#include <stack>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

bool Debug;

const int mod = 1e9+7;
const int MAXN = 1e5+7;

#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define iter iterator
#define sqr(a) ((a)*(a))
#define abs(a) ((a)>0?(a):(-(a)))
#define max(a, b) ((a)>(b)?(a):(b))
#define min(a, b) ((a)<(b)?(a):(b))
#define mset(a, b) memset(a, b, sizeof(a))
#define mcpy(a, b) memcpy(a, b, sizeof(a))
#define lop(i,a,b) for(int i = (a); i <= (b); ++i)
#define dlop(i,a,b) for(int i = (a); i >= (b); --i)
#define debu(...) if (Debug) fprintf(stderr, __VA_ARGS__)
#define debug(x) if (Debug) cerr << "" #x " = " << x << endl
#define ergo(a) for(auto it = a.begin(); it != a.end(); ++it)

template<typename T> T gcd(T a, T b) {while(T t = a % b) a = b, b = t; return b;}
template<typename T> T Pow(T a, T b, T mod) {T ret = 1; for( ; b; b >>= 1) {if (b & 1) ret = ret * 1ull * a % mod; a = a * 1ull * a % mod;} return ret%mod;}
template<typename T> void chmax(T &x, T y) {if (x < y) x = y;}
template<typename T> void chmin(T &x, T y) {if (x > y) x = y;}
template<typename T> void amod(T &x, T y) {x += y; if (x >= mod) x -= mod;}
template<typename T> void smod(T &x, T y) {x -= y; if (x < 0) x += mod;}

typedef long long ll; 
typedef long double ld;
typedef unsigned int uint;
typedef pair<int,int> pii;
typedef unsigned long long ull;

int a, b;
char s1[1000007];
string s;
int main() {
  #ifdef LOCAL_DEBUG
    Debug = 1;
    freopen("data.in", "r", stdin);
  #endif
  cin >> (s1+1); cin >> a;
  int len = strlen(s1+1);
  for(int i = 1; i <= len; i += a) {
    s += s1[i];
  }
  cout << s;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
const int maxn = 1e5 + 20;
int a , b;
stack<char> st;
int main()
{
    int n;
    string s;
    cin >> n >> s;
    for(int i = 0; i < n; i++)
    {
        if(s[i] == ')')
        {
            if(!st.empty() && st.top() == '(')
                st.pop();
            else
                a++;
        }
        else
            st.push('(');
    }
    for(int i = 0; i < a; i++)
        cout << '(';
    cout << s;
    for(int i = 0; i < st.size(); i++)
        cout << ')';
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <algorithm>
using namespace std;
int getsum(int k){
    return k*(k-1)/2;
}
long long qSum[200003], n, num;
int main(int argc, char const *argv[])
{
    cin>>n;
    for (int i = 1; i <= n; ++i)
    {
        cin>>num;
        qSum[i] = qSum[i-1]+num;
    }
    sort(qSum, qSum+n+1);
    // for (int i = 1; i <= n; ++i)
    // {
    //     cout<<qSum[i]<<" ";
    // }cout<<endl;
    long long sum = 0;
    long long k = 1;
    for (int i = 1; i <= n; ++i)
    {
        if(qSum[i] == qSum[i-1]){
            k++;
        } else {
            sum += k*(k-1)/2;
            k = 1;
        }
    }
    cout<<sum+k*(k-1)/2<<endl;
    return 0;
}

Measured memory_bytes: 1792
#include<iostream>
using namespace std;
int ans = 0;
void solve(int n, int s, int i) {
	if (n == 0 && s == 0) {
		ans++;
		return;
	}
	else if (n == 0 || i == 10) return;
	solve(n, s, i + 1);
	solve(n - 1, s - i, i + 1);
}
int main() {
	int n, s;
	while (cin >> n >> s&&n + s) {
		ans = 0;
		solve(n, s, 0);
		cout << ans << endl;
	}
}


Measured memory_bytes: 3096
#include<bits/stdc++.h>
#define REP(i,n) for(int i = 0;i < (n);i++)
#define P pair<int,int>
#define pb push_back
#define mk make_pair
using namespace std;
const int INF = 1 << 20;

typedef long long ll;




int main(){
  int n,t;
  cin >> n>> t;
  vector <int> a;
  vector <int> b;
  REP(i,n){
    int c;
    cin >> c;
    a.pb(c);
    
  }
  int mn =a[0],pos = 0;
  for(int i = 1;i < a.size();i++){
    b.pb(a[i]-mn);
    mn = min(mn,a[i]);
  }
  /*
  REP(i,b.size())
  cout << b[i] << endl;*/
  sort(b.begin(),b.end(), greater <int>() );
  int mx = b[0],num = 0;
  REP(i,b.size()){
    if(b[i] == mx)
      num++;
    else
      break;
  }
  cout << num << endl;
  
  return 0;
}


Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
inline void read(int &x){
	x=0;
	int p=1;
	char c=getchar();
	while(!isdigit(c)){
		if(c=='-')p=-1;
		c=getchar();
	}
	while(isdigit(c)){
		x=(x<<1)+(x<<3)+(c^'0');
		c=getchar();
	}
	x*=p;
}
int n;
int a[105],b[105],ans;
int main(){
	read(n);
	for(register int i=1;i<=n;++i){
		read(a[i]);
		a[i]+=a[i-1];
	}
	for(register int i=1;i<=n;++i){
		read(b[i]);
		b[i]+=b[i-1];
	}
	for(register int i=1;i<=n;++i){
		ans=max(ans,a[i]+b[n]-b[i-1]);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
s = input()

if s[0] == 'A' and s[2:-1].count('C') == 1:
    c_idx = s[2:-1].index('C') + 2
    ss = [c for c in s]
    ss[0] = ''
    ss[c_idx] = ''
    s = ''.join(ss)
    if s.islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<int> >g(1001,vector<int>(1001));
int vis[1001];
ll n,m,M=1e9+7;
char c;
void solve()
{
    if(g[0][0]==-1)
    {
        cout<<"0";
        return;
    }
    for(ll i=1;i<n;i++)
    {
        if(g[i][0]==0) g[i][0]=1;
        else break;

    }
    for(ll i=1;i<m;i++)
    {
        if(g[0][i]==0) g[0][i]=1;
        else break;

    }
 for(ll i=1;i<n;i++)
 {
     for(ll j=1;j<m;j++)
     {
         if(g[i][j]==-1) continue;
         if(g[i-1][j]>0) g[i][j]=(g[i-1][j]+M)%M;
         if(g[i][j-1]>0) g[i][j]=(g[i][j]+g[i][j-1]+M)%M;
     }
 }
 if(g[n-1][m-1]==-1) cout<<"0";
 else cout<<g[n-1][m-1];

}
int main()
{
    cin>>n>>m;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            cin>>c;
            if(c=='.')g[i][j]=0;
            else g[i][j]=-1;
        }
    }

    solve();

}


Measured memory_bytes: 7564
#include<iostream>
#include<algorithm>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<iomanip>
#include<cstring>
#include<string>
#include<vector>
#include<math.h>
#include<queue>
#include<map>
using namespace std;
#define ll long long
const int INF=0x3f3f3f3f;
int mode=1e9+7;
double e[200020];
int main()
{
	int n,k;
	scanf("%d %d",&n,&k);
	double maxn=-1;
	int a;
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a);
		e[i]=(a*(a+1)/2.0)*1.0/a;
	}
	double sum=0;
	for(int i=0;i<k;i++)
	{
		sum+=e[i];
	}
//	cout<<sum<<endl;
	int i=0,j=k;
	while(1)
	{
		maxn=max(sum,maxn);
		//cout<<maxn<<" ";
		sum=sum+e[j]-e[i];
		i++;
		j++;
		if(j>n)
		{
			break;
		}
	}
	printf("%.12lf\n",maxn);
	return 0;
}

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

int main(void){
    int D,T,S;
    cin >> D >> T >> S;
    if(D <= T*S) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3616
import java.util.*;
public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    int m = sc.nextInt();
    int d = sc.nextInt();
    int count = 0;
    
    for(int i = 2 ; i <= m ; ++i){
      for(int j = 2 ; j <= d ; ++j){
        int d10 = j/10;
        int d1 = j%10;
        if(d10 != 1 && d1 != 1 && i==d10*d1){
          count++;
        }
      }
      
    }
    
    System.out.println(count);
    
  }
}

Measured memory_bytes: 35648
//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
const ll INF=1e+18;
const int MOD=1e+9+7;

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>(ll)(b);i--)

// 多次元 vector 生成
template<class T>
vector<T> make_vec(size_t a){
    return vector<T>(a);
}
template<class T, class... Ts>
auto make_vec(size_t a, Ts... ts){
  return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//省略
using vi  = vector<int>;
using vii = vector<vector<int>>;
using vl  = vector<ll>;
using vll = vector<vector<ll>>;
using pii = pair<int,int>;
using pll = pair<ll,ll>;

int main(){
    string S,T;
    cin>>S>>T;
    ll idx=0;
    ll cnt=0;
    ll ans=T.size();
    ll N=T.size();
    REP(i,S.size()-T.size()+1){
        cnt=0;
        REP(j,T.size()){
            if(T[j]==S[i+j]) cnt++;
        }
        ans=min(ans,N-cnt);
    }
    
    cout<<ans<<endl;
}

Measured memory_bytes: 3564
x=input()
w,x,y,z=list(map(int, x))

if w+x+y+z==7:
	print(w,'+',x,'+',y,'+',z,'=7',sep=(''))
elif w+x+y-z==7:
	print(w,'+',x,'+',y,'-',z,'=7',sep=(''))
elif w+x-y+z==7:
	print(w,'+',x,'-',y,'+',z,'=7',sep=(''))
elif w-x+y+z==7:
	print(w,'-',x,'+',y,'+',z,'=7',sep=(''))
elif w+x-y-z==7:
	print(w,'+',x,'-',y,'-',z,'=7',sep=(''))
elif w-x+y-z==7:
	print(w,'-',x,'+',y,'-',z,'=7',sep=(''))
elif w-x-y+z==7:
	print(w,'-',x,'-',y,'+',z,'=7',sep=(''))
elif w-x-y-z==7:
	print(w,'-',x,'-',y,'-',z,'=7',sep=(''))

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c,d,e,f;
  cin >> a >> b >> c >> d;
  e = a-c;
  f = b-d;
  cout << c+f << " ";
  cout << d-e << " ";
  cout << c+f+e <<" ";
  cout << d-e+f << endl;
}

Measured memory_bytes: 3640
using System;
using System.IO;
using System.Linq;
using System.Collections.Generic;
using static System.Math;
using static System.Console;
using static System.Linq.Enumerable;
using static System.Numerics.BitOperations;

namespace ABC174
{
    class SolverB
    {
        static void Main()
        {
            SetOut(new StreamWriter(Console.OpenStandardOutput()){AutoFlush = false});
            new SolverB().Solve();
            Out.Flush();
        }

        public void Solve()
        {
            (int N, long D) = Get.Tuple<int,long>();
            int cnt = 0;
            for (int i = 0; i < N; i++)
            {
                (long x, long y) = Get.Tuple<int,int>();
                if( x * x + y * y <= D * D )
                {
                    cnt++;
                }
            }
            WriteLine(cnt);
        }




        static class Get
        {
            public static string Str() => ReadLine().Trim();
            public static int Int() => int.Parse(Str());
            public static long Long() => long.Parse(Str());
            public static double Double() => double.Parse(Str());
            public static string[] Strs() => Str().Split(' ', StringSplitOptions.RemoveEmptyEntries);
            public static int[] Ints() => Strs().Select(int.Parse).ToArray();
            public static long[] Longs() => Strs().Select(long.Parse).ToArray();
            public static double[] Doubles() => Strs().Select(double.Parse).ToArray();
            static bool TypeEq<T,U>() => typeof(T).Equals(typeof(U));
            static T TypeConv<T,U>(U u) => (T)Convert.ChangeType(u, typeof(T));
            static T TypeConv<T>(string s) => TypeEq<T, int>() ?   TypeConv<T, int>(int.Parse(s))
                                        : TypeEq<T, long>() ?       TypeConv<T, long>(long.Parse(s))
                                        : TypeEq<T, double>() ?     TypeConv<T, double>(long.Parse(s))
                                        : TypeConv<T, string>(s);
            public static (T,U) Tuple<T,U>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); return(t,u);}
            public static (T,U,V) Tuple<T,U,V>() {string[] strs = Strs(); T t = TypeConv<T>(strs[0]); U u = TypeConv<U>(strs[1]); V v = TypeConv<V>(strs[2]); return(t,u,v);}
        }
    }
}


Measured memory_bytes: 40712
#include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const ll MOD=1000000007;
const ll INF=1000000000;
const ll LINF=4000000000000000010;
ll gcd(ll a,ll b){
    if(a<b)swap(a,b);
    ll r=a%b;
    while(r)a=b,b=r,r=a%b;
    return b;
}

ll lcm(ll a,ll b){
    return (a*b)/gcd(a,b);
}
int main(){
	ll n,m;cin>>n>>m;
	string s,t;cin>>s>>t;
	if(s[0]!=t[0]){
		cout<<-1<<endl;
		return 0;
	}
	bool f=false;
	if(gcd(n,m)>1){
		ll g=n/gcd(n,m);
		int j=0;
		for(int i=0;i<n;i+=g){
			if(s[i]!=t[j]){
				f=true;
			}
			j+=m/gcd(n,m);
		}
	}
	if(f){
		cout<<-1<<endl;
	}else{
		ll ans=lcm(n,m);
		cout<<ans<<endl;
	}
}	


Measured memory_bytes: 512
#include<cstdio>
#include<cstring>
int n;
int x[128];
long long dp[105][30];
long long solve(int id, int sum){
  if(dp[id][sum] != -1) return dp[id][sum];  
  if(id == n - 1 && sum == x[n - 1]) return 1;
  if(id == n - 1) return 0;
  long long ret = 0;
  if(sum + x[id] <= 20)
    ret = solve(id + 1, sum + x[id]);
  if(sum - x[id] >= 0)
    ret += solve(id + 1, sum - x[id]);
  return dp[id][sum] = ret;  
}

int main(void){
  memset(dp, -1, sizeof(dp));
  scanf("%d", &n);
  for(int i = 0;i < n; i++) scanf("%d", x + i);
  printf("%lld\n", solve(1, x[0]));
}


Measured memory_bytes: 1060
#include <stdio.h>
int x, y, ans;
int main() {
	scanf("%d%d", &x, &y);
	if (x == 1)ans += 300000;
	if (x == 2)ans += 200000;
	if (x == 3)ans += 100000;
	if (y == 1)ans += 300000;
	if (y == 2)ans += 200000;
	if (y == 3)ans += 100000;
	if (x * y == 1)ans += 400000;
	printf("%d\n", ans);
}

Measured memory_bytes: 128